|  |  | @@ -12,31 +12,26 @@ Page({ | 
		
	
		
			
			|  |  |  | order: null, | 
		
	
		
			
			|  |  |  | orderId: null, | 
		
	
		
			
			|  |  |  | //存储计时器 | 
		
	
		
			
			|  |  |  | setInter: null, | 
		
	
		
			
			|  |  |  | mystatus: null, | 
		
	
		
			
			|  |  |  | staticGamedata:{}, | 
		
	
		
			
			|  |  |  | showIf:false | 
		
	
		
			
			|  |  |  | setInter: "", | 
		
	
		
			
			|  |  |  | mystatus: '' | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | powerDrawer: function (e) { | 
		
	
		
			
			|  |  |  | let that = this; | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * couponOrderStatus | 
		
	
		
			
			|  |  |  | *  0 未使用 | 
		
	
		
			
			|  |  |  | 1 已使用 | 
		
	
		
			
			|  |  |  | 2 已过期 | 
		
	
		
			
			|  |  |  | 3 已经退款 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | // couponOrderStatus | 
		
	
		
			
			|  |  |  | // 0 未使用 | 
		
	
		
			
			|  |  |  | // 1 已使用 | 
		
	
		
			
			|  |  |  | // 2 已过期 | 
		
	
		
			
			|  |  |  | // 3 已经退款 | 
		
	
		
			
			|  |  |  | console.log(e); | 
		
	
		
			
			|  |  |  | if (that.data.mystatus == "" || that.data.mystatus == undefined) { | 
		
	
		
			
			|  |  |  | wx.navigateTo({ | 
		
	
		
			
			|  |  |  | url: `/pages/orderquanma/index?quancode=${ | 
		
	
		
			
			|  |  |  | e.currentTarget.dataset.quancode | 
		
	
		
			
			|  |  |  | }&title=${e.currentTarget.dataset.title}&subtitle=${ | 
		
	
		
			
			|  |  |  | }&title=${e.currentTarget.dataset.title}&subtitle=${ | 
		
	
		
			
			|  |  |  | e.currentTarget.dataset.subtitle | 
		
	
		
			
			|  |  |  | }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | 
		
	
		
			
			|  |  |  | }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | 
		
	
		
			
			|  |  |  | e.currentTarget.dataset.couponorderstatus | 
		
	
		
			
			|  |  |  | }&sight=${that.data.sight}` | 
		
	
		
			
			|  |  |  | }); | 
		
	
	
		
			
				|  |  | @@ -45,11 +40,11 @@ Page({ | 
		
	
		
			
			|  |  |  | wx.navigateTo({ | 
		
	
		
			
			|  |  |  | url: `/pages/orderquanma/index?quancode=${ | 
		
	
		
			
			|  |  |  | e.currentTarget.dataset.quancode | 
		
	
		
			
			|  |  |  | }&title=${e.currentTarget.dataset.title}&subtitle=${ | 
		
	
		
			
			|  |  |  | }&title=${e.currentTarget.dataset.title}&subtitle=${ | 
		
	
		
			
			|  |  |  | e.currentTarget.dataset.subtitle | 
		
	
		
			
			|  |  |  | }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | 
		
	
		
			
			|  |  |  | }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | 
		
	
		
			
			|  |  |  | that.data.mystatus | 
		
	
		
			
			|  |  |  | }&sight=${that.data.sight}` | 
		
	
		
			
			|  |  |  | }&sight=${that.data.sight}` | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }, | 
		
	
	
		
			
				|  |  | @@ -73,59 +68,21 @@ Page({ | 
		
	
		
			
			|  |  |  | orderId: options.orderId | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }).then(res => { | 
		
	
		
			
			|  |  |  | console.log(res); | 
		
	
		
			
			|  |  |  | console.log("我是订单详情"); | 
		
	
		
			
			|  |  |  | that.setData({ | 
		
	
		
			
			|  |  |  | order: res.data | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | that.getStaticGame() | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | //createDate 创建时间 | 
		
	
		
			
			|  |  |  | var createDate = util.formatTime(res.data.createDate, "yyyy-MM-dd hh:mm:ss"); | 
		
	
		
			
			|  |  |  | console.log(createDate); | 
		
	
		
			
			|  |  |  | that.setData({ | 
		
	
		
			
			|  |  |  | createDate: createDate | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .catch(err => { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: err.errMsg, | 
		
	
		
			
			|  |  |  | icon: 'none', | 
		
	
		
			
			|  |  |  | duration: 2000, | 
		
	
		
			
			|  |  |  | mask: false | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | gotogame: function () { | 
		
	
		
			
			|  |  |  | let that=this; | 
		
	
		
			
			|  |  |  | wx.navigateTo({ | 
		
	
		
			
			|  |  |  | url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | // 获取游戏 | 
		
	
		
			
			|  |  |  | getStaticGame(token) { | 
		
	
		
			
			|  |  |  | let _this = this; | 
		
	
		
			
			|  |  |  | Http.get({ | 
		
	
		
			
			|  |  |  | url: config.api.getGame, | 
		
	
		
			
			|  |  |  | data: { | 
		
	
		
			
			|  |  |  | triggleAction: 3 | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }).then(res => { | 
		
	
		
			
			|  |  |  | if (res.data.id){ | 
		
	
		
			
			|  |  |  | _this.setData({ | 
		
	
		
			
			|  |  |  | showIf:true | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | _this.setData({ | 
		
	
		
			
			|  |  |  | staticGamedata: res.data | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .catch(err => { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: err.errMsg, | 
		
	
		
			
			|  |  |  | icon: 'none', | 
		
	
		
			
			|  |  |  | duration: 2000, | 
		
	
		
			
			|  |  |  | mask: false | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * 发起支付 | 
		
	
		
			
			|  |  |  | */ | 
		
	
	
		
			
				|  |  | @@ -155,57 +112,19 @@ Page({ | 
		
	
		
			
			|  |  |  | signType: (res.data.signType) ? res.data.signType : "MD5", | 
		
	
		
			
			|  |  |  | paySign: res.data.paySign, | 
		
	
		
			
			|  |  |  | success: res => { | 
		
	
		
			
			|  |  |  | console.log(res); | 
		
	
		
			
			|  |  |  | that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * @Meo | 
		
	
		
			
			|  |  |  | * 更新订单的状态 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | console.log(res); | 
		
	
		
			
			|  |  |  | if (res.errMsg == "requestPayment:ok") { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: "购买成功", | 
		
	
		
			
			|  |  |  | duration: 2000, | 
		
	
		
			
			|  |  |  | image: "./../../../assets/img/success.png", | 
		
	
		
			
			|  |  |  | mask: false, | 
		
	
		
			
			|  |  |  | success: function () { | 
		
	
		
			
			|  |  |  | wx.showLoading({ | 
		
	
		
			
			|  |  |  | title: "加载中..." | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | setTimeout(function () { | 
		
	
		
			
			|  |  |  | wx.hideLoading(); | 
		
	
		
			
			|  |  |  | }, 1600); | 
		
	
		
			
			|  |  |  | setTimeout(() => { | 
		
	
		
			
			|  |  |  | wx.navigateTo({ | 
		
	
		
			
			|  |  |  | url: `/pages/order/detail/index?orderId=${ | 
		
	
		
			
			|  |  |  | that.data.orderId | 
		
	
		
			
			|  |  |  | }` | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, 1600); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | that.payOrderUpdate(that.data.orderId, payOrderId, 1,'','',that); // 支付成功 | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | fail: res => { | 
		
	
		
			
			|  |  |  | that.payOrderUpdate(that.data.orderId, payOrderId, 2); | 
		
	
		
			
			|  |  |  | that.payOrderUpdate(that.data.orderId, payOrderId, 2,'','fail'); | 
		
	
		
			
			|  |  |  | console.log(res); | 
		
	
		
			
			|  |  |  | return; | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | /// End payment  -------- | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .catch(err => { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: err.errMsg, | 
		
	
		
			
			|  |  |  | icon: 'none', | 
		
	
		
			
			|  |  |  | duration: 2000, | 
		
	
		
			
			|  |  |  | mask: false | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | } else { | 
		
	
		
			
			|  |  |  | // 免费券 | 
		
	
		
			
			|  |  |  | that.payOrderUpdate(orderId, "0", 1) // 支付成功 | 
		
	
		
			
			|  |  |  | that.payOrderUpdate(orderId, "0", 1,'','fail') // 支付成功 | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: "支付成功", | 
		
	
		
			
			|  |  |  | duration: 2000, | 
		
	
	
		
			
				|  |  | @@ -216,28 +135,46 @@ Page({ | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * 支付订单更新 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | payOrderUpdate: (orderId, payOrderId, status, reason) => { | 
		
	
		
			
			|  |  |  | payOrderUpdate: (orderId, payOrderId, status, reason,type,_this) => { | 
		
	
		
			
			|  |  |  | // 支付成功 | 
		
	
		
			
			|  |  |  | Http.post({ | 
		
	
		
			
			|  |  |  | url: config.api.payOrderUpdate, | 
		
	
		
			
			|  |  |  | data: { | 
		
	
		
			
			|  |  |  | payOrderId: payOrderId, | 
		
	
		
			
			|  |  |  | orderId: orderId, | 
		
	
		
			
			|  |  |  | status: status, | 
		
	
		
			
			|  |  |  | reason: reason | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | url: config.api.payOrderUpdate, | 
		
	
		
			
			|  |  |  | data: { | 
		
	
		
			
			|  |  |  | payOrderId: payOrderId, | 
		
	
		
			
			|  |  |  | orderId: orderId, | 
		
	
		
			
			|  |  |  | status: status, | 
		
	
		
			
			|  |  |  | reason: reason | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .then(res => { | 
		
	
		
			
			|  |  |  | console.log("payOrderUpdate then", res); | 
		
	
		
			
			|  |  |  | if (!type) { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: "购买成功", | 
		
	
		
			
			|  |  |  | duration: 2000, | 
		
	
		
			
			|  |  |  | image: "./../../../assets/img/success.png", | 
		
	
		
			
			|  |  |  | mask: false, | 
		
	
		
			
			|  |  |  | success: function () { | 
		
	
		
			
			|  |  |  | wx.showLoading({ | 
		
	
		
			
			|  |  |  | title: "加载中..." | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | setTimeout(function () { | 
		
	
		
			
			|  |  |  | wx.hideLoading(); | 
		
	
		
			
			|  |  |  | }, 1600); | 
		
	
		
			
			|  |  |  | setTimeout(() => { | 
		
	
		
			
			|  |  |  | wx.redirectTo({ | 
		
	
		
			
			|  |  |  | url: `/pages/order/detail/index?orderId=${orderId}` | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, 1600); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | .catch(err => { | 
		
	
		
			
			|  |  |  | wx.showToast({ | 
		
	
		
			
			|  |  |  | title: err.errMsg, | 
		
	
		
			
			|  |  |  | icon: 'none', | 
		
	
		
			
			|  |  |  | duration: 2000, | 
		
	
		
			
			|  |  |  | mask: false | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | console.log(_this); | 
		
	
		
			
			|  |  |  | setTimeout(function () { | 
		
	
		
			
			|  |  |  | _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this); | 
		
	
		
			
			|  |  |  | }, 1500) | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | /** | 
		
	
	
		
			
				|  |  | @@ -251,6 +188,26 @@ Page({ | 
		
	
		
			
			|  |  |  | sight: res.value | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * 生命周期函数--监听页面隐藏 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | onHide: function () {}, | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * 页面相关事件处理函数--监听用户下拉动作 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | onPullDownRefresh: function () {}, | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * 页面上拉触底事件的处理函数 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | onReachBottom: function () {}, | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * 用户点击右上角分享 | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | onShareAppMessage: function () {} | 
		
	
		
			
			|  |  |  | }); |