From 280123a710cd70efbec2a9ead7cb53cdb79e4d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=99=96?= Date: Wed, 17 Apr 2019 14:09:21 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=A7=AF=E5=88=86=E5=85=91=E6=8D=A2][?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E8=AF=95]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 1 + pages/integralmall/integcoupondetail/index.js | 2 +- pages/integralmall/integraHistory/index.js | 98 ++++++++++ pages/integralmall/integraHistory/index.json | 5 + pages/integralmall/integraHistory/index.wxml | 28 +++ pages/integralmall/integraHistory/index.wxss | 119 ++++++++++++ .../payIntegcouponStatus/index.js | 4 +- .../payIntegcouponStatus/index.wxml | 6 +- .../payIntegcouponStatus/index.wxss | 3 + .../payIntegcoupondetail/index.js | 173 ++++++++++++++++-- pages/main/index.js | 7 +- pages/main/index.wxml | 2 +- 12 files changed, 420 insertions(+), 28 deletions(-) create mode 100644 pages/integralmall/integraHistory/index.js create mode 100644 pages/integralmall/integraHistory/index.json create mode 100644 pages/integralmall/integraHistory/index.wxml create mode 100644 pages/integralmall/integraHistory/index.wxss diff --git a/app.json b/app.json index 90b8f25..e58e4d0 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,7 @@ { "pages": [ "pages/index/index", + "pages/integralmall/integraHistory/index", "pages/integralmall/payIntegcouponStatus/index", "pages/integralmall/payIntegcoupondetail/index", "pages/joinFrDpell/index", diff --git a/pages/integralmall/integcoupondetail/index.js b/pages/integralmall/integcoupondetail/index.js index aa68ae3..4919869 100644 --- a/pages/integralmall/integcoupondetail/index.js +++ b/pages/integralmall/integcoupondetail/index.js @@ -61,7 +61,7 @@ Page({ formId: e.detail.formId }) wx.navigateTo({ - url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + this.data.couponChannelId, + url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + this.data.couponChannelId + '&couponId=' + this.data.couponId, }) }, // 时间格式化输出,如11:03 25:19 每1s都会调用一次 diff --git a/pages/integralmall/integraHistory/index.js b/pages/integralmall/integraHistory/index.js new file mode 100644 index 0000000..a23cc1c --- /dev/null +++ b/pages/integralmall/integraHistory/index.js @@ -0,0 +1,98 @@ +var config = require("../../../config/config.js"); +var app = getApp(); +const Http = require("../../../utils/HttpBasics"); +let util = require("../../../utils/util"); +const imgurl = require("../../../utils/imgurl"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + score: 10, + pageNum: 1, + list: [], + showcontent: false, + loadingUrl: imgurl.loading.url, + bgg: imgurl.bgg.url, + allow_load: true + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + gotorule: function () { + wx.navigateTo({ + url: '/pages/grade/grade', + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this; + that.getScore(); + that.record(1, 15); + }, + record(pageNum) { + var that = this; + if (that.data.allow_load) { + Http.get({ + url: config.api.scoreHistory, + data: { + pageNum: pageNum, + pageSize: 20, + } + }).then(res => { + res.data.list.map(file => { + file.createDate = util.formatTime( + file.createDate, + "yyyy-MM-dd hh:mm:ss" + ); + }); + if (pageNum >= res.data.pages) { + that.setData({ + allow_load: false, + }); + } + that.data.list = that.data.list.concat(res.data.list); + that.setData({ + list: that.data.list + }); + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }, + getScore: function () { + let that = this; + Http.get({ + url: config.api.getScore, + data: {} + }) + .then(res => { + console.log(res) + that.setData({ + score: res.data.score, + levelName: res.data.levelName, + }) + }) + }, + onReachBottom: function () { + var that = this; + that.data.pageNum++; + that.setData({ + pageNum: that.data.pageNum + }); + that.record(that.data.pageNum); + } +}) \ No newline at end of file diff --git a/pages/integralmall/integraHistory/index.json b/pages/integralmall/integraHistory/index.json new file mode 100644 index 0000000..226994f --- /dev/null +++ b/pages/integralmall/integraHistory/index.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "积分记录", + "enablePullDownRefresh": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/integralmall/integraHistory/index.wxml b/pages/integralmall/integraHistory/index.wxml new file mode 100644 index 0000000..ddcac53 --- /dev/null +++ b/pages/integralmall/integraHistory/index.wxml @@ -0,0 +1,28 @@ + + 当前 + {{score}} + + + + + 积分明细 + + + 每日登录 + 消费 + 绑车牌 + 连接WIFI + 微信用户昵称授权 + 微信用户手机授权 + 完善个人信息 + 会员导入 + {{item.reason}} + {{item.createDate}} + + + 重置为{{item.scoreAmount}}分 + +{{item.scoreAmount}}分 + {{item.scoreAmount}}分 + + + \ No newline at end of file diff --git a/pages/integralmall/integraHistory/index.wxss b/pages/integralmall/integraHistory/index.wxss new file mode 100644 index 0000000..eb0acb4 --- /dev/null +++ b/pages/integralmall/integraHistory/index.wxss @@ -0,0 +1,119 @@ +/* pages/czdetail/czdetail.wxss */ + +.head { + height: 252rpx; + background: #02c0ff; + position: relative; +} + +.rule { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 124rpx; + height: 48rpx; + line-height: 48rpx; + text-align: center; + background: #fff; + font-size: 28rpx; + font-weight: 400; + color: rgba(2, 192, 255, 1); + border-bottom-left-radius: 50rpx; + border-top-left-radius: 50rpx; +} + +.head text { + display: block; + text-align: center; + color: #fff; +} + +.head text:nth-of-type(1) { + font-size: 28rpx; + font-family: PingFang-SC-Regular; + font-weight: 400; + color: rgba(255, 255, 255, 1); +} + +.head text:nth-of-type(2) { + font-size: 70rpx; + font-family: PingFang-SC-Bold; + font-weight: bold; + color: rgba(255, 255, 255, 1); +} + +.bg { + position: absolute; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 55rpx; + z-index: 100; +} + +.content { + position: relative; + padding: 0 35rpx; + height: 145rpx; + border-bottom: 1px solid #eaeaea; +} + +.content>view:nth-of-type(2n+1) text { + display: block; +} + +.content>view:nth-of-type(2n+1) text:nth-of-type(1) { + margin-top: 24rpx; +} + +.content>view:nth-of-type(2n+1) text:nth-of-type(2) { + margin-top: 10rpx; + font-size: 26rpx; + font-family: PingFang-SC-Bold; + color: rgba(153, 153, 153, 1); +} + +.content>view:nth-of-type(2n+1) { + float: left; + width: 60%; + height: 145rpx; + overflow: hidden; +} + +.content>view:nth-of-type(2n) { + width: 38%; + float: right; + text-align: right; + height: 145rpx; + line-height: 145rpx; + overflow: hidden; +} + +.title { + display: block; + text-align: center; + font-size: 30rpx; + font-family: PingFang-SC-Regular; + font-weight: 400; + color: rgba(51, 51, 51, 1); +} +.fr text{ + color: #FF3535; +} +.loading { + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #999; +} + +.loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; +} \ No newline at end of file diff --git a/pages/integralmall/payIntegcouponStatus/index.js b/pages/integralmall/payIntegcouponStatus/index.js index f1a7eb1..2535a44 100644 --- a/pages/integralmall/payIntegcouponStatus/index.js +++ b/pages/integralmall/payIntegcouponStatus/index.js @@ -17,7 +17,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.setData({ + formData:options + }) }, /** diff --git a/pages/integralmall/payIntegcouponStatus/index.wxml b/pages/integralmall/payIntegcouponStatus/index.wxml index 036528c..176d267 100644 --- a/pages/integralmall/payIntegcouponStatus/index.wxml +++ b/pages/integralmall/payIntegcouponStatus/index.wxml @@ -2,12 +2,12 @@ 兑换成功 - + - 会员积分兑换2小时停车券 + {{'会员积分兑换'+formData.title}} 已存入"我的券包"请您查看使用 - 剩余积分:23234 + {{'剩余积分:'+formData.remainingPoints}} diff --git a/pages/integralmall/payIntegcouponStatus/index.wxss b/pages/integralmall/payIntegcouponStatus/index.wxss index 407b035..7802fa3 100644 --- a/pages/integralmall/payIntegcouponStatus/index.wxss +++ b/pages/integralmall/payIntegcouponStatus/index.wxss @@ -23,6 +23,7 @@ height: auto; float: left; box-sizing: border-box; + padding-top: 18rpx; } .c-left image{ width: 120rpx; @@ -37,12 +38,14 @@ padding-left: 30rpx; line-height: 40rpx; margin-top: 30rpx; + color:rgba(85,85,85,1); } .detail-num{ font-size:30rpx; padding-left: 30rpx; line-height: 40rpx; margin-top: 10rpx; + color:rgba(85,85,85,1); } .button01{ width:710rpx; diff --git a/pages/integralmall/payIntegcoupondetail/index.js b/pages/integralmall/payIntegcoupondetail/index.js index e35a9a4..39110d7 100644 --- a/pages/integralmall/payIntegcoupondetail/index.js +++ b/pages/integralmall/payIntegcoupondetail/index.js @@ -59,34 +59,167 @@ Page({ // 关闭来自于左上角的分享 wx.hideShareMenu() }, + /** + * 发起支付 + */ gotoPay() { - let that = this; - wx.showLoading({ - title: '订单提交中...', + var that = this; + Http.get({ + url: config.api.checkPhoneStatus, + data: {} }) - //操作人类型 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 - } + .then(res => { + var data = { + couponChannelId: "" + that.data.paramData.couponChannelId, + couponId: "" + that.data.paramData.couponId + } + /** + * orderSave 下单 + */ + return Http.post({ + url: config.api.orderSave, + data: data + }); + }) + .catch(err => { + console.log(err); + that.setData({ + showbutton: false, + showbutton1: false + }) + if (err.code == 2011) { + wx.showToast({ + title: "商户信息没找到", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 2013) { + wx.showToast({ + title: "商户信息禁用", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3000) { + wx.showToast({ + title: "库存不足", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3001) { + wx.showToast({ + title: "超过限购条件", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3002) { + wx.showToast({ + title: "订单失败", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3003) { + wx.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3004) { + wx.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 4003) { + wx.showToast({ + title: "卡券已作废", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 11005) { + /** + * 将值传到用户手机号授权的页面 + * + */ + wx.redirectTo({ + url: "/pages/getphoneInfo/index?couponChannelId=" + + that.data.paramData.couponChannelId + }); + } else if (err.code == 11006) { + // 用户手机已加密 + wx.redirectTo({ + url: "/pages/phoneinput/phoneinput?couponChannelId=" + + that.data.paramData.couponChannelId + }); + } else { + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + .then(res => { + console.log(res) + if (typeof (res) != "undefined") { + let orderId = "" + res.data.id; + that.setData({ + orderId: orderId + }); + console.log(that.data.type) + // 免费券 + that.payOrderUpdate(orderId, "0", 1, '',that); + // that.payOrderUpdate(that.data.orderId, '', 1, '', that); + if (that.data.cardType == 100) { + wx.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else if (that.data.data.type != "5") { + wx.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + } + }) + }, + /** + * 支付订单更新 + */ + payOrderUpdate: (orderId, payOrderId, status, reason, _this) => { + let that = this; + // 支付成功 Http.post({ - url: config.api.addIntegral, - data: param + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + orderId: orderId, + status: status, + reason: reason + } }) .then(res => { wx.hideLoading() - /// End payment -------- + wx.navigateTo({ + url: '/pages/integralmall/payIntegcouponStatus/index?title=' + _this.data.data.title + '&coverImg=' + _this.data.data.coverImg + '&remainingPoints=' + _this.data.remainingPoints, + }) }) .catch(err => { - wx.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); + console.log(err); + if (err.code != 12002) { + setTimeout(function () { + _this.payOrderUpdate(orderId, payOrderId, status, reason, _this); + }, 2000) + } }) }, /** diff --git a/pages/main/index.js b/pages/main/index.js index 7564eef..a2c0e0f 100644 --- a/pages/main/index.js +++ b/pages/main/index.js @@ -124,9 +124,12 @@ Page({ }, //跳往个人中心 gotouser:function(){ - wx.switchTab({ - url: '/pages/user/index', + wx.navigateTo({ + url: '/pages/integralmall/integraHistory/index', }) + // wx.switchTab({ + // url: '/pages/user/index', + // }) }, //跳往砍价专场 gobargain: function () { diff --git a/pages/main/index.wxml b/pages/main/index.wxml index e82397f..f439d49 100644 --- a/pages/main/index.wxml +++ b/pages/main/index.wxml @@ -22,7 +22,7 @@ - +