| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | console.log(options); |
| | | this.getDataList(false) |
| | | }, |
| | | |
| | |
| | | |
| | | getDataList(isReachBottom) { |
| | | var searchArr = []; |
| | | console.log(this.data.searchText, "earch") |
| | | if (this.data.searchText != undefined && this.data.searchText != "") { |
| | | searchArr.push({ |
| | | compareType: "Contains", |
| | |
| | | loading: false |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | icon: 'error', |
| | | title: '暂无数据', |
| | | }) |
| | | this.setData({ |
| | | list: [], |
| | | skeletonLoding: false, |
| | | loading: false |
| | | }) |
| | |
| | | }) |
| | | }, |
| | | 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}`, |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | |
| | | 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.getDataList(false) |
| | | } |
| | | 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() |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | }); |
| | | |
| | | }, |