121 lines
2.7 KiB
JavaScript
121 lines
2.7 KiB
JavaScript
var yz_pay = require('../../../mycomponent/yz_pay/yz_pay');
|
|
var app = getApp();
|
|
Page({
|
|
behaviors: [yz_pay],
|
|
data: {
|
|
language: '',
|
|
isclick: true,
|
|
order_id: '',
|
|
store_id: '',
|
|
orderData: null,
|
|
balance: 0,
|
|
payParams: '',
|
|
info_form: {},
|
|
order_sn: '',
|
|
money: '',
|
|
buttons: [],
|
|
pay_sn: '订单编号',
|
|
order_pay_id: '',
|
|
uid: '',
|
|
pid: '',
|
|
status: '',
|
|
|
|
},
|
|
onLoad: function (options) {
|
|
console.log('options:', options);
|
|
if (options.datas) {
|
|
this.setData({
|
|
info_form: JSON.parse(options.datas)
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: '缺少支付参数',
|
|
icon: 'success',
|
|
duration: 1000
|
|
});
|
|
wx.navigateBack({
|
|
delta: 1
|
|
});
|
|
return;
|
|
}
|
|
//获取支付方式
|
|
let urlStr = app.getNetAddresss('plugin.luck-draw.frontend.team.getPayType');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res)=> {
|
|
var _data = res.data.data;
|
|
console.log('PayResult::::', _data);
|
|
if (res.data.result == 1) {
|
|
this.hanleIcon(_data);
|
|
this.setData({
|
|
buttons: _data.buttons
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.data.msg,
|
|
icon: 'success',
|
|
duration: 2000
|
|
});
|
|
console.log('错误', res.data.msg);
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log("===============", res);
|
|
}
|
|
});
|
|
},
|
|
|
|
onReady: function () {
|
|
let language = wx.getStorageSync('langIndex');
|
|
this.setData({
|
|
'language': language.en
|
|
});
|
|
// 页面渲染完成
|
|
},
|
|
fromChild(e){
|
|
if(this.data.money=='0.00') {
|
|
// 0元
|
|
this.sureBtn();
|
|
}else {
|
|
let datas = e.detail.submitArr;
|
|
this.confirm(datas);
|
|
}
|
|
},
|
|
confirm (e) {
|
|
let btn = e;
|
|
this.surePay(btn);
|
|
},
|
|
surePay(_data) {
|
|
let json = {
|
|
activity_id: this.data.info_form.activity_id,
|
|
total: this.data.info_form.total,
|
|
pay_id: _data.value,
|
|
money: this.data.info_form.money* this.data.info_form.total,
|
|
pid: this.data.info_form.pid || 0,
|
|
address: this.data.info_form.address,
|
|
client_type: 2
|
|
};
|
|
let _url = app.getNetAddresss('plugin.luck-draw.frontend.team.payJoinActivity');
|
|
app._getNetWork({
|
|
url: _url,
|
|
data: json,
|
|
success: (res) => {
|
|
let resData = res.data;
|
|
if (resData.result == 1) {
|
|
this.handleOtherPay(_data, _data.value, resData.data);
|
|
} else {
|
|
wx.showToast({
|
|
title: resData.msg,
|
|
icon: 'none',
|
|
duration: 2000,
|
|
success: function () {}
|
|
});
|
|
}
|
|
},
|
|
fail: function (error) {
|
|
console.log(error, '错误');
|
|
}
|
|
});
|
|
},
|
|
});
|