diff --git a/pages/order/order.js b/pages/order/order.js index 1804ef2..af33c22 100644 --- a/pages/order/order.js +++ b/pages/order/order.js @@ -63,6 +63,7 @@ Page({ console.log("传递的item" + item); wx.navigateTo({ url: "/pages/orderdetail/orderdetail?item=" + item, + }); } }, @@ -159,7 +160,7 @@ Page({ */ onReachBottom: function () { console.log("==页面上拉触底事件的处理函数==") - this.getOrderList(); + // this.getOrderList(); }, /** @@ -176,7 +177,7 @@ Page({ header: app.getRequestHeader(), method: 'GET', data: { - pageNum: 1, + pageNum: this.data.pageNum, pageSize: 30, status: that.data.status[that.data.currentType], usercId: wx.getStorageSync('uid') diff --git a/pages/orderdetail/orderdetail.js b/pages/orderdetail/orderdetail.js index 93606c3..5825a97 100644 --- a/pages/orderdetail/orderdetail.js +++ b/pages/orderdetail/orderdetail.js @@ -40,83 +40,77 @@ Page({ } ], show: false, - - - - height: '' - - }, - // 确认支付 - confirm_pay: async function () { - var that = this; - if (!this.data.is_ok_click) { - that.setData({ - is_ok_click: true - }) - - - //你要执行的操作 - this.godetail() - setTimeout(function () { - that.setData({ - is_ok_click: false - }) - }, 10000) //阻止一秒点击多次 - } else { - // wx.showToast({ - // title: '请勿重复操作!', - // }) - } - }, - - godetail() { - console.log('点击了去付款'); - var _this = this; - console.log(this.data.id + 'tttttttttttttttttttttttttttttttttt') - wx.request({ - // url: app.globalData.url + '/system/weixinPayNew/12345666', - //order_id为8位数字 - url: app.globalData.url + '/system/order/weixinPay/' + this.data.order_id, - header: app.getRequestHeader(), - method: 'GET', - data: { - - }, - success(res) { - if (res.data.code == 200) { - console.log('timeStamp==' + res.data.data.timeStamp) - console.log('nonceStr==' + res.data.data.nonceStr) - console.log('package==' + res.data.data.package) - console.log('signType==' + res.data.data.signType) - console.log('paySign==' + res.data.data.paySign) - wx.requestPayment({ - timeStamp: res.data.data.timeStamp, - nonceStr: res.data.data.nonceStr, - package: res.data.data.package, - signType: res.data.data.signType, - paySign: res.data.data.paySign, - success(res) { - console.log('支付成功'); - wx.navigateTo({ - url: '/shopping/pages/paysuccess/paysuccess', - }) - }, - fail(res) { - console.log('支付失败'); - } - }) - } else { - wx.showToast({ - title: res.data.msg, - icon: 'error', - duration: 2000 - }) - } - } + // 确认支付 + confirm_pay: async function () { + var that = this; + if (!this.data.is_ok_click) { + that.setData({ + is_ok_click: true }) - }, + + + //你要执行的操作 + this.godetail() + setTimeout(function () { + that.setData({ + is_ok_click: false + }) + }, 10000) //阻止一秒点击多次 + } else { + // wx.showToast({ + // title: '请勿重复操作!', + // }) + } + }, + + godetail() { + console.log('点击了去付款'); + var _this = this; + console.log(this.data.id + 'tttttttttttttttttttttttttttttttttt') + wx.request({ + // url: app.globalData.url + '/system/weixinPayNew/12345666', + //order_id为8位数字 + url: app.globalData.url + '/system/order/weixinPay/' + this.data.order_id, + header: app.getRequestHeader(), + method: 'GET', + data: { + + }, + success(res) { + if (res.data.code == 200) { + console.log('timeStamp==' + res.data.data.timeStamp) + console.log('nonceStr==' + res.data.data.nonceStr) + console.log('package==' + res.data.data.package) + console.log('signType==' + res.data.data.signType) + console.log('paySign==' + res.data.data.paySign) + wx.requestPayment({ + timeStamp: res.data.data.timeStamp, + nonceStr: res.data.data.nonceStr, + package: res.data.data.package, + signType: res.data.data.signType, + paySign: res.data.data.paySign, + success(res) { + console.log('支付成功'); + wx.navigateTo({ + url: '/shopping/pages/paysuccess/paysuccess', + }) + }, + fail(res) { + console.log('支付失败'); + } + }) + } else { + wx.showToast({ + title: res.data.msg, + icon: 'error', + duration: 2000 + }) + } + } + }) + }, /** * 生命周期函数--监听页面加载 @@ -127,15 +121,18 @@ Page({ statusBarHeight: statusBarHeight, height: 46 + statusBarHeight, }); - //条目点击进入详情页 - // this.setData({ - // order_id: e.id - // }) - //条目点击进入详情页,调取接口获取详情页数据,除外都是通过列表传参的方式展示详情页数据。 - if (e.type = 3) { + //从下单成功后的查看详情进入详情页 + this.setData({ + order_id: e.id + }) + //从下单成功后的查看详情进入详情页,调取接口获取详情页数据,除外都是通过列表传参的方式展示详情页数据。 + console.log('e.type' + e.type); + if (e.type == 3) { this.getOrderDetail(); + return } + var that = this; let item = JSON.parse(e.item); that.setData({ @@ -321,30 +318,30 @@ Page({ }); }, - //确认完成服务 - completeService() { - var that = this; - wx.request({ - url: app.globalData.url + '/system/view/completeOrder', - header: app.getRequestHeader(), - method: 'post', - data: { - orderId: that.data.order_id - }, - success: function (res) { - var resp = res.data; - if (res.data.code == 200) { - wx.showToast({ - title: res.data.msg, - }) - setTimeout(function () { - //要延时执行的代码 - wx.navigateBack() - }, 2000) //延迟时间 这里是2秒 - } + //确认完成服务 + completeService() { + var that = this; + wx.request({ + url: app.globalData.url + '/system/view/completeOrder', + header: app.getRequestHeader(), + method: 'post', + data: { + orderId: that.data.order_id + }, + success: function (res) { + var resp = res.data; + if (res.data.code == 200) { + wx.showToast({ + title: res.data.msg, + }) + setTimeout(function () { + //要延时执行的代码 + wx.navigateBack() + }, 2000) //延迟时间 这里是2秒 } - }); - }, + } + }); + }, /** * 待服务时被坚持取消订单 */ @@ -422,7 +419,7 @@ Page({ getOrderDetail: function () { var that = this; wx.request({ - url: app.globalData.url + '/system/view/getInfo', + url: app.globalData.url + '/system/view/getInfo/', header: app.getRequestHeader(), method: 'get', data: { diff --git a/pages/orderdetail/orderdetail.wxml b/pages/orderdetail/orderdetail.wxml index 057c8ad..decfda3 100644 --- a/pages/orderdetail/orderdetail.wxml +++ b/pages/orderdetail/orderdetail.wxml @@ -133,9 +133,9 @@ - + - + 服务人员正在赶来,确定要取消订单吗?