From b7ed8541113f8fa116b19d13e34a70a929310077 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 12 三月 2024 14:38:22 +0800 Subject: [PATCH] 样书申请 --- pages/personalCenter/myOrder/index.js | 142 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 134 insertions(+), 8 deletions(-) diff --git a/pages/personalCenter/myOrder/index.js b/pages/personalCenter/myOrder/index.js index 4537c2f..8b502b1 100644 --- a/pages/personalCenter/myOrder/index.js +++ b/pages/personalCenter/myOrder/index.js @@ -9,26 +9,21 @@ */ data: { active: 0, - activeName: "FavoriteBookCity", tabList: [ { label: '鍏ㄩ儴', - key: 0, value: 'all', }, { label: '寰呮敮浠�', - key: 1, value: 'WaitPay', }, { label: '宸插畬鎴�', - key: 1, value: 'Success', }, { label: '宸插彇娑�', - key: 1, value: 'Cancel', } ], @@ -67,7 +62,6 @@ that.setData({ skeletonLoding: true, active: item.detail.value, - activeName: info.value, queryFilter: info.value == 'all' ? [] : [{ field: 'State', value: info.value }], list: [], page: 1, @@ -138,7 +132,7 @@ } this.setData({ list: dataList, - pageTotalCount: res.total, + pageTotalCount: res.totalSize, bottomLoading: false, isMoreData: dataList.length > 0 ? false : true, skeletonLoding: false, @@ -165,7 +159,7 @@ this.setData({ // list: [], page: 1, - limit: 18, + limit: 12, pageTotalCount: 0, bottomLoading: false, isMoreData: false @@ -204,6 +198,138 @@ this.getDataList(bool); }, + onCancel(e) { + let { orderNum } = e.currentTarget.dataset + console.log(orderNum, 12) + wx.showModal({ + title: '鎻愮ず', //鎻愮ず鐨勬爣棰� + content: '纭畾瑕佸彇娑堣鍗曪紵', //鎻愮ず鐨勫唴瀹� + success: function (res) { + if (res.confirm) { + app.MG.store.cancelOrder({ orderNum: orderNum }).then(() => { + wx.showToast({ + title: "璁㈠崟宸插彇娑�", + icon: 'success', + duration: 1000 + }) + this.getDataList(false) + }) + } else if (res.cancel) { + console.log('鐢ㄦ埛鐐瑰嚮浜嗗彇娑�') + } + } + }) + + }, + //绔嬪嵆鏀粯銆佸啀娆¤喘涔� + onPayment(e) { + var that = this; + const { + orderNum + } = e.currentTarget.dataset + const data = { + orderNum: orderNum, + }; + app.MG.store.getOrderByOrderNum(data).then(res => { + if (res && res.state != "WaitPay") { + app.MG.store.confirmOrder(data).then(conRes => { + if (conRes.orderNumber) { + const resOrderNum = { + orderNum: conRes.orderNumber, + }; + if (conRes.payPrice != 0) { + app.MG.store.makeWeChatPay(resOrderNum).then(payRes => { + const payVal = JSON.parse(payRes); + wx.requestPayment({ + "appId": payVal.appId, + "timeStamp": payVal.timeStamp, + "nonceStr": payVal.nonceStr, + "package": payVal.package, + "signType": payVal.signType, + "paySign": payVal.paySign, + "success": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPaySuccess: true + }) + } + console.log(res, "鎴愬姛") + }, + "fail": function (res) { + console.log(res, "澶辫触") + }, + "complete": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPayComplete: true + }) + } + if (that.data.isPaySuccess && that.data.isPayComplete) { + that.navToBack() + } + } + }) + }); + } else { + wx.showToast({ + title: '棰嗗彇鎴愬姛', + }) + // 鍙坊鍔犺繑鍥炰笂绾� + setTimeout(() => { + that.navToBack() + }, 2000); + } + } + }); + } else { + app.MG.store + .makeWeChatPay({ + orderNum: orderNum + }) + .then(payRes => { + const payVal = JSON.parse(payRes); + wx.requestPayment({ + "appId": payVal.appId, + "timeStamp": payVal.timeStamp, + "nonceStr": payVal.nonceStr, + "package": payVal.package, + "signType": payVal.signType, + "paySign": payVal.paySign, + "success": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPaySuccess: true + }) + } + }, + "fail": function (res) { + console.log(res, "澶辫触") + }, + "complete": function (res) { + if (res.errMsg == 'requestPayment:ok') { + that.setData({ + isPayComplete: true + }) + } + if (that.data.isPaySuccess && that.data.isPayComplete) { + that.navToBack() + } + } + }) + }); + } + }); + + }, + + //鍒犻櫎璁㈠崟 + onDel(e) { + const { + orderNum + } = e.currentTarget.dataset + + }, + /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ -- Gitblit v1.9.1