|
|
@@ -310,6 +310,70 @@ Page({
|
|
|
if (event.detail.event == "重新授权") {
|
|
|
this.toAuthorization(event.detail.order.orderId)
|
|
|
}
|
|
|
+ if(event.detail.event == "继续支付") {
|
|
|
+ this.toPay(event.detail.order.orderId)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 支付按钮点击事件 */
|
|
|
+ toPay(orderId) {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '支付中',
|
|
|
+ })
|
|
|
+ this.subMessage(orderId)
|
|
|
+ },
|
|
|
+ /** 订阅消息模板 */
|
|
|
+ subMessage(orderId) {
|
|
|
+ const that = this;
|
|
|
+ wx.requestSubscribeMessage({
|
|
|
+ tmplIds: ['V0tl-4n-5hwNZc4SrEttvrmawAyM-SB0pQWZNwp54Ks'], // 最多支持3条
|
|
|
+ success(res) {
|
|
|
+ that.pay(orderId)
|
|
|
+ // 'accept'表示用户同意订阅该条id对应的模板消息
|
|
|
+ if (res['V0tl-4n-5hwNZc4SrEttvrmawAyM-SB0pQWZNwp54Ks'] === 'accept') {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ that.pay(orderId)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ /** 实际支付 */
|
|
|
+ pay(orderId) {
|
|
|
+ const that = this;
|
|
|
+ api.request_wechatPay(orderId)
|
|
|
+ .then(res => {
|
|
|
+ wx.requestPayment({
|
|
|
+ timeStamp: res.data.data.unifiedOrderResult.timeStamp,
|
|
|
+ nonceStr: res.data.data.unifiedOrderResult.nonceStr,
|
|
|
+ package: res.data.data.unifiedOrderResult.package,
|
|
|
+ signType: res.data.data.unifiedOrderResult.signType,
|
|
|
+ paySign: res.data.data.unifiedOrderResult.paySign,
|
|
|
+ success: res => {
|
|
|
+ wx.hideLoading()
|
|
|
+ that.sendMessage(orderId)
|
|
|
+ that.refreshOrder()
|
|
|
+ },
|
|
|
+ fail: res => {
|
|
|
+ wx.hideLoading()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 发送消息模板 */
|
|
|
+ sendMessage(orderId) {
|
|
|
+ const message = {
|
|
|
+ trxid: orderId,
|
|
|
+ orderType: '支付'
|
|
|
+ }
|
|
|
+ api.request_sendMessage(message).then(res => {
|
|
|
+ console.log("发送消息模板结果", res)
|
|
|
+ }).catch(err => {
|
|
|
+ console.log("发送消息模板失败", err)
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/** 授权 */
|
|
|
@@ -352,6 +416,7 @@ Page({
|
|
|
const findTime = this.data.date != '' ? this.data.date + "T23:59:59" : this.data.date;
|
|
|
api.request_WXFindOrders(findTime, this.data.pageNum, this.data.pageSize).then(res => {
|
|
|
wx.hideLoading()
|
|
|
+ wx.stopPullDownRefresh()
|
|
|
// api.request_WXFindOrders(this.data.date, 3, 5).then(res => {
|
|
|
console.log("获取历史订单", res)
|
|
|
let datas = res.data.data;
|
|
|
@@ -468,6 +533,8 @@ Page({
|
|
|
refreshOrder() {
|
|
|
this.setData({
|
|
|
date: '',
|
|
|
+ pageNum:1,
|
|
|
+ pageSize:5,
|
|
|
orders: []
|
|
|
});
|
|
|
console.log(this.data.date)
|