From aff8d054df4a638f399dc8f15d98c19b9c9aa785 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 29 四月 2025 10:11:25 +0800 Subject: [PATCH] 扫码视频播放 --- packagePersonal/pages/myOrder/index.js | 205 ++++++++++++++++++++++++++------------------------ 1 files changed, 106 insertions(+), 99 deletions(-) diff --git a/packagePersonal/pages/myOrder/index.js b/packagePersonal/pages/myOrder/index.js index 1794a45..20cb563 100644 --- a/packagePersonal/pages/myOrder/index.js +++ b/packagePersonal/pages/myOrder/index.js @@ -40,14 +40,15 @@ isBackTop: false, setScrollValue: 0, skeletonLoding: true, - queryFilter: [] + queryFilter: [], + isPaySuccess: false, + isPayComplete: false, }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - console.log(options); this.getDataList(false) }, @@ -78,7 +79,6 @@ getDataList(isReachBottom) { var searchArr = []; - console.log(this.data.searchText, "earch") if (this.data.searchText != undefined && this.data.searchText != "") { searchArr.push({ compareType: "Contains", @@ -154,8 +154,11 @@ loading: false }) } else { + wx.showToast({ + icon: 'error', + title: '鏆傛棤鏁版嵁', + }) this.setData({ - list: false, skeletonLoding: false, loading: false }) @@ -166,12 +169,42 @@ }) }, onSearchOrder(e) { + console.log(e.detail.value); this.setData({ searchText: e.detail.value, }) this.getDataList(false); }, - + async goBookDetails(e) { + console.log(e.currentTarget.dataset); + const { + book, + remarks + } = e.currentTarget.dataset; + let parentData = null; + let bookId = book.orderSaleMethod.product.id; + const type = book.orderSaleMethod.product.cmsTypeRefCode + let url = '' + if (type == 'jsek_mediaBook') { + // 鍥句功銆佷簯瀛︿範 + parentData = await app.MG.store.getProductBySaleMethod({ + 'saleMethodId': book.orderSaleMethod.id + }) + if (parentData.parentProduct.length > 0) { + bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id; + } + url = `/packageBookService/pages/bookServices/detail/index?id=${bookId}&name=${book.name}` + } else if (type == 'jsek_digitalCourses') { + // 璇剧▼ + url = '/pages/digitalCourses/digitalCoursesDetails/index?id=' + book.orderSaleMethod.product.id + '&path=' + '' + } else if (type == 'jsek_digitalTextbooks') { + // 鏁板瓧鏁欐潗 + url = '/pages/digitalTextbooks/digitalTextbooksDetails/index?id=' + book.orderSaleMethod.product.id + } + wx.navigateTo({ + url + }); + }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 @@ -222,6 +255,7 @@ }, onCancel(e) { + let that = this; let { orderNum } = e.currentTarget.dataset @@ -232,13 +266,16 @@ if (res.confirm) { app.MG.store.cancelOrder({ orderNum: orderNum - }).then(() => { - wx.showToast({ - title: "璁㈠崟宸插彇娑�", - icon: 'success', - duration: 1000 - }) - this.getDataList(false) + }).then((res) => { + if (res) { + wx.showToast({ + title: "璁㈠崟宸插彇娑�", + icon: 'success', + duration: 1000 + }) + that.getDataList(false) + } + }) } else if (res.cancel) { console.log('鐢ㄦ埛鐐瑰嚮浜嗗彇娑�') @@ -257,93 +294,41 @@ 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() - } - } + app.MG.store.makeWeChatPay({ + orderNum: res.orderNumber, + platform: "WeChatAppCustom" + }) + .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 }) - }); - } 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() - } } - }) - }); - } + }, + "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() + } + } + }) + }); }); }, @@ -359,7 +344,29 @@ /** * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ - onShareAppMessage() { - + onShareAppMessage() {}, + // 澶勭悊璁㈠崟绫诲瀷鏄剧ず + handleOrderType(book) { + console.log(book); + const type = book.orderSaleMethod.product.cmsTypeRefCode + let title = '' + if (type == 'jsek_mediaBook') { + if (book.orderSaleMethod.type == 'defaultSaleMethod') { + title = '鍥句功鏈嶅姟-鐢靛瓙涔�' + } else if (book.orderSaleMethod.type == 'createProductSaleMethod' && book.orderSaleMethod.cmsItemList == 0) { + title = '鍥句功鏈嶅姟-缁勫嵎' + } else { + if (book.orderSaleMethod.cmsItemList.length && book.orderSaleMethod.cmsItemList[0].type == "questionBankFolder") { + title = '鍥句功鏈嶅姟-浜戞祴璇�' + } else { + title = '鍥句功鏈嶅姟-浜戝涔�' + } + } + } else if (type == 'jsek_digitalCourses') { + title = '鏁板瓧鏁欐潗' + } else { + title = '鏁板瓧璇剧▼' + } + return title } }) \ No newline at end of file -- Gitblit v1.9.1