diff --git a/app.json b/app.json index 446b82a..90b8f25 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,7 @@ { "pages": [ "pages/index/index", + "pages/integralmall/payIntegcouponStatus/index", "pages/integralmall/payIntegcoupondetail/index", "pages/joinFrDpell/index", "pages/spellDetail/index", diff --git a/config/config.js b/config/config.js index f6a6646..cc749f3 100755 --- a/config/config.js +++ b/config/config.js @@ -262,7 +262,15 @@ var config = { /** * 专题详情 */ - topicFindById:"/topic/findById" + topicFindById:"/topic/findById", + /** + * 积分兑换 + */ + addIntegral: "/credit/add", + /** + * 积分券详情 + */ + integralDetail:'/wxCoupon/findById', }, weapp: { AppId: weappId diff --git a/pages/integralmall/index.js b/pages/integralmall/index.js index 5ba6dde..336727e 100644 --- a/pages/integralmall/index.js +++ b/pages/integralmall/index.js @@ -82,7 +82,7 @@ Page({ var param = { pageNum: pageNum, pageSize: 10, - targetAd: 5 + targetAd: 50 }; var url = config.api.couponChannelList; // 请求接口 diff --git a/pages/integralmall/index.wxml b/pages/integralmall/index.wxml index e1b4490..eb9636f 100644 --- a/pages/integralmall/index.wxml +++ b/pages/integralmall/index.wxml @@ -18,7 +18,7 @@ {{item.subTitle}} - {{item.salePriceStr}} + {{item.creditPrice}} 积分 diff --git a/pages/integralmall/integcoupondetail/index.wxml b/pages/integralmall/integcoupondetail/index.wxml index efbaa24..ee8c967 100644 --- a/pages/integralmall/integcoupondetail/index.wxml +++ b/pages/integralmall/integcoupondetail/index.wxml @@ -8,7 +8,7 @@ {{data.subTitle}} 售价 - {{data.salePriceStr}}积分 + {{data.creditPrice}}积分 有效期: {{data.validStartDate}}至{{data.validEndDate}}(请在有效期内使用) @@ -52,7 +52,7 @@
- diff --git a/pages/integralmall/payIntegcouponStatus/index.js b/pages/integralmall/payIntegcouponStatus/index.js new file mode 100644 index 0000000..f1a7eb1 --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.js @@ -0,0 +1,86 @@ +// pages/integralmall/payIntegcouponStatus/index.js +// pages/spellGroup/mySpellGroup/index.js +var config = require("../../../config/config.js"); +const Http = require("../../../utils/HttpBasics"); +const imgurl = require("../../../utils/imgurl"); +const utils = require("../../../utils/util.js") +Page({ + + /** + * 页面的初始数据 + */ + data: { + teljpgUrl: imgurl.teljpg.url, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + /** + * 去使用 + */ + gotoUse(){ + wx.navigateTo({ + url: '/pages/couponorder/index/index', + }) + }, + /** + * 返回首页 + */ + gotoIndex(){ + wx.switchTab({ + url: '/pages/main/index', + }) + }, + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/integralmall/payIntegcouponStatus/index.json b/pages/integralmall/payIntegcouponStatus/index.json new file mode 100644 index 0000000..039b934 --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "积分兑换结果", + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor":"#52A0FD", + "enablePullDownRefresh": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/integralmall/payIntegcouponStatus/index.wxml b/pages/integralmall/payIntegcouponStatus/index.wxml new file mode 100644 index 0000000..036528c --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.wxml @@ -0,0 +1,13 @@ + + 兑换成功 + + + + + 会员积分兑换2小时停车券 + + 已存入"我的券包"请您查看使用 + 剩余积分:23234 + + + diff --git a/pages/integralmall/payIntegcouponStatus/index.wxss b/pages/integralmall/payIntegcouponStatus/index.wxss new file mode 100644 index 0000000..407b035 --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.wxss @@ -0,0 +1,66 @@ +/* pages/integralmall/payIntegcouponStatus/index.wxss */ +.tilte{ + text-align: center; + height:50rpx; + font-size:40rpx; + font-family:PingFang-SC-Bold; + font-weight:bold; + color:rgba(51,51,51,1); + line-height:50rpx; + margin: 70rpx auto; +} +.coupon{ + overflow: hidden; + width:690rpx; + padding: 20rpx 0; + margin: 0 auto; + box-shadow:0px 10rpx 27rpx 0rpx rgba(15,15,15,0.09); + border-radius:20rpx; +} +.c-left{ + width: 160rpx; + padding-left: 20rpx; + height: auto; + float: left; + box-sizing: border-box; +} +.c-left image{ + width: 120rpx; +} +.c-right{ + width: 510rpx; + float: left; + line-height: 120rpx; +} +.detail-text{ + font-size:30rpx; + padding-left: 30rpx; + line-height: 40rpx; + margin-top: 30rpx; +} +.detail-num{ + font-size:30rpx; + padding-left: 30rpx; + line-height: 40rpx; + margin-top: 10rpx; +} +.button01{ + width:710rpx; + height:94rpx; + line-height: 94rpx; + background:rgba(82,160,253,1); + box-shadow:0px 10rpx 22rpx 2rpx rgba(82,160,253,0.51); + border-radius:10rpx; + color: #fff; + margin-top: 120rpx; +} +.button02{ + width:710rpx; + height:94rpx; + line-height: 94rpx; + background:rgba(82,160,253,1); + box-shadow:0px 10rpx 22rpx 2rpx rgba(82,160,253,0.51); + border-radius:10rpx; + color: #fff; + margin-top: 30rpx; +} \ No newline at end of file diff --git a/pages/integralmall/payIntegcoupondetail/index.js b/pages/integralmall/payIntegcoupondetail/index.js index a8f1d15..e35a9a4 100644 --- a/pages/integralmall/payIntegcoupondetail/index.js +++ b/pages/integralmall/payIntegcoupondetail/index.js @@ -30,7 +30,7 @@ Page({ .then(res => { console.log(res) that.setData({ - remainingPoints: Number(res.data.credit) - Number(that.data.data.salePriceStr), + remainingPoints: Number(res.data.credit) - Number(that.data.data.creditPrice), userInfo:res.data, nickName: res.data.nickName, avatarUrl: res.data.avatarUrl @@ -59,102 +59,28 @@ Page({ // 关闭来自于左上角的分享 wx.hideShareMenu() }, - /** - * 支付订单更新 - */ - payOrderUpdate: (orderId, payOrderId, status, reason, _this, orderGroupId) => { - console.log(orderGroupId, 7777) - let that = this; - // 支付成功 - Http.post({ - url: config.api.payOrderUpdate, - data: { - payOrderId: payOrderId, - orderId: orderId, - status: status, - reason: reason - } - }) - .then(res => { - wx.hideLoading() - if (res.data.orderStatus == 14) { - _this.setData({ - showErr: true - }) - return; - } - if (orderGroupId == undefined) { - wx.navigateTo({ - url: '/pages/order/detail/index?orderId=' + res.data.id, - }) - } else { - _this.goToOrderGroup(orderId, res.data.orderGroupId, _this) - } - }) - .catch(err => { - console.log(err); - if (err.code != 12002) { - setTimeout(function () { - _this.payOrderUpdate(orderId, payOrderId, status, reason, _this, orderGroupId); - }, 2000) - } - }) - }, gotoPay() { let that = this; wx.showLoading({ - title: '支付创建中...', + title: '订单提交中...', }) + //操作人类型 1:C端用户,2:A端会员,3:B端用户,4:A端用户 + let param={ + cuserId:that.data.userInfo.id,//用户id + operatorType:1,//操作人类型 + creditType: 11,//积分类型-积分兑换 + spend:this.data.data.credit,//积分数值 + couponId: this.data.data.couponId + } Http.post({ - url: config.api.payOrderCreate, - data: { - orderId: that.data.paramData.orderId - } + url: config.api.addIntegral, + data: param }) .then(res => { - var payOrderId = "" + res.data.payOrderId; - wx.hideLoading(); - wx.requestPayment({ - timeStamp: res.data.timeStamp, - nonceStr: res.data.nonceStr, - package: res.data.package, - signType: (res.data.signType) ? res.data.signType : "MD5", - paySign: res.data.paySign, - success: res => { - wx.showLoading({ - title: '订单正在处理中...', - }) - setTimeout(function () { - wx.hideLoading() - }, 5000) - that.payOrderUpdate(that.data.paramData.orderId, payOrderId, 1, '', that, 0); - if (res.errMsg == "requestPayment:ok") { - setTimeout(function () { - wx.hideLoading(); - }, 2000); - } - }, - fail: res => { - /** - * 支付失败,需要更新订单的状态 - */ - that.payOrderUpdate(that.data.paramData.orderId, payOrderId, 2, '', that, 0); - that.setData({ - showbutton: false, - canSpell: true, - canBuyIf: true - }) - return; - }, - complete: res => { } - }); + wx.hideLoading() /// End payment -------- }) .catch(err => { - that.setData({ - canSpell: true, - canBuyIf: true - }) wx.showToast({ title: err.message, icon: 'none', @@ -193,34 +119,28 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - this.setData({ - showTime: true - }) + }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { - this.setData({ - showTime: false - }) + }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { - this.setData({ - showTime: false - }) + }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - this.getDetail(this.data.paramData); + this.getDetail(this.data.paramData.couponChannelId); }, /** diff --git a/pages/integralmall/payIntegcoupondetail/index.wxml b/pages/integralmall/payIntegcoupondetail/index.wxml index 92e6448..8edda40 100644 --- a/pages/integralmall/payIntegcoupondetail/index.wxml +++ b/pages/integralmall/payIntegcoupondetail/index.wxml @@ -15,7 +15,7 @@ {{'价值:'+data.priceStr+'元'}} - {{data.salePriceStr}}积分 + {{data.creditPrice}}积分 积分售价 @@ -29,7 +29,7 @@ 兑换使用积分 - {{data.salePriceStr}} + {{data.creditPrice}} 剩余积分 @@ -37,7 +37,7 @@ - +