From 892efc9976feb68ce1a3a4d759317e2585d67ebe Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期六, 07 九月 2024 18:16:18 +0800 Subject: [PATCH] bug修改 --- packagePersonal/pages/myOrder/index.js | 202 +++++++++++++++++++++++++------------------------- 1 files changed, 102 insertions(+), 100 deletions(-) diff --git a/packagePersonal/pages/myOrder/index.js b/packagePersonal/pages/myOrder/index.js index 7e8d3c4..075570e 100644 --- a/packagePersonal/pages/myOrder/index.js +++ b/packagePersonal/pages/myOrder/index.js @@ -1,7 +1,9 @@ const app = getApp(); import moment from 'moment' import tool2 from "../../../assets/js/toolClass.js" -import { getPublicImage } from "../../../assets/js/middleGround/tool.js"; +import { + getPublicImage +} from "../../../assets/js/middleGround/tool.js"; Page({ /** @@ -9,8 +11,7 @@ */ data: { active: 0, - tabList: [ - { + tabList: [{ label: '鍏ㄩ儴', value: 'all', }, @@ -27,6 +28,7 @@ value: 'Cancel', } ], + searchText: "", list: [], //鍒嗛〉 page: 1, @@ -38,14 +40,15 @@ isBackTop: false, setScrollValue: 0, skeletonLoding: true, - queryFilter: [] + queryFilter: [], + isPaySuccess: false, + isPayComplete: false, }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - console.log(options); this.getDataList(false) }, @@ -61,20 +64,33 @@ that.setData({ skeletonLoding: true, active: item.detail.value, - queryFilter: info.value == 'all' ? [] : [{ field: 'State', value: info.value }], + queryFilter: info.value == 'all' ? [] : [{ + field: 'State', + value: info.value + }], list: [], page: 1, bottomLoading: false, isMoreData: false, + searchText: "" }) that.getDataList(false); }, getDataList(isReachBottom) { + var searchArr = []; + if (this.data.searchText != undefined && this.data.searchText != "") { + searchArr.push({ + compareType: "Contains", + field: "orderNumber", + keywords: this.data.searchText, + }) + } const data = { start: this.data.page * this.data.limit - this.data.limit, size: this.data.limit, filterList: this.data.queryFilter, + searchList: searchArr, sort: { type: 'Desc', field: 'CreateDate' @@ -138,6 +154,10 @@ loading: false }) } else { + wx.showToast({ + icon: 'error', + title: '鏆傛棤鏁版嵁', + }) this.setData({ skeletonLoding: false, loading: false @@ -148,7 +168,32 @@ } }) }, + 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; + parentData = await app.MG.store.getProductBySaleMethod({ + 'saleMethodId': book.orderSaleMethod.id + }) + if (parentData.parentProduct.length > 0) { + bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id; + } + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/detail/index?id=${bookId}&name=${book.name}`, + }); + }, /** * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 @@ -161,7 +206,8 @@ limit: 12, pageTotalCount: 0, bottomLoading: false, - isMoreData: false + isMoreData: false, + searchText: '' }) this._freshing = true; this.setData({ @@ -198,19 +244,27 @@ }, onCancel(e) { - let { orderNum } = e.currentTarget.dataset + let that = this; + let { + orderNum + } = e.currentTarget.dataset 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) + app.MG.store.cancelOrder({ + orderNum: orderNum + }).then((res) => { + if (res) { + wx.showToast({ + title: "璁㈠崟宸插彇娑�", + icon: 'success', + duration: 1000 + }) + that.getDataList(false) + } + }) } else if (res.cancel) { console.log('鐢ㄦ埛鐐瑰嚮浜嗗彇娑�') @@ -229,93 +283,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() + } + } + }) + }); }); }, -- Gitblit v1.9.1