store/packageA/member/order/orderCash/orderCash.js

129 lines
2.5 KiB
JavaScript

// packageA/member/order/orderCash/orderCash.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
order_pay_id: "",
pid: '',
uid: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.order_pay_id) {
this.setData({
order_pay_id: options.order_pay_id
});
}
if (options.pid) {
this.setData({
pid: options.pid
});
}
try {
const value = wx.getStorageSync('uid');
if (value) {
this.setData({
uid: value
});
// Do something with return value
}
} catch (e) {
// Do something when catch error
}
this.verificationCash();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
verificationCash() {
let that = this;
let urlStr = '';
urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.order-detail.payment-qr-code-url");
console.log(this.data.order_pay_id);
console.log(this.data.pid ? this.data.pid : this.data.uid);
urlStr += '&order_pay_id=' + this.data.order_pay_id;
urlStr += '&pid=' + (this.data.pid ? this.data.pid : this.data.uid);
app._getNetWork({
url: urlStr,
success: function(resdata) {
var res = resdata.data;
if (res.result == 1) {
that.setData({
qrcode: res.data.miQrCodeUrl,
showQrcode: true
});
} else {
wx.showToast({
title: res.msg,
icon: 'none',
duration: 1500,
success: function() {
setTimeout(function() {
//要延时执行的代码
wx.navigateBack({
delta: 1
});
}, 1500); //延迟时间
},
});
}
},
fail: function(res) {
console.log(res);
}
});
},
});