113 lines
2.6 KiB
JavaScript
113 lines
2.6 KiB
JavaScript
// packageH/circleCommunity/circlePayment/circlePayment.js
|
|
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: '',
|
|
buttons: [],
|
|
pay_sn: "订单编号",
|
|
order_pay_id: "",
|
|
uid: "",
|
|
pid: "",
|
|
status: "",
|
|
|
|
money: "",
|
|
circleID: 0,
|
|
},
|
|
onLoad: function (options) {
|
|
console.log("options:", options);
|
|
if (options.circleId && options.circleId != 0) {
|
|
this.data.circleId = options.circleId;
|
|
}
|
|
if (options.money && options.money != 0) {
|
|
this.setData({
|
|
money: options.money,
|
|
});
|
|
}
|
|
|
|
//获取支付方式
|
|
let urlStr = app.getNetAddresss("plugin.circle.frontend.circle-pay.get-pay-button");
|
|
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);
|
|
},
|
|
});
|
|
},
|
|
fromChild(e){
|
|
if(this.data.money=='0.00') {
|
|
// 0元
|
|
this.sureBtn();
|
|
}else {
|
|
let datas = e.detail.submitArr;
|
|
this.confirm(datas);
|
|
}
|
|
},
|
|
onReady: function () {
|
|
let language = wx.getStorageSync("langIndex");
|
|
this.setData({
|
|
language: language.en,
|
|
});
|
|
// 页面渲染完成
|
|
},
|
|
|
|
confirm: function (datas) {
|
|
let btn = datas;
|
|
this.surePay(btn);
|
|
},
|
|
surePay(_data) {
|
|
let json = {
|
|
pay_method: _data.value,
|
|
pay_name: _data.name,
|
|
circle_id: this.data.circleId,
|
|
};
|
|
let _url = app.getNetAddresss("plugin.circle.frontend.circle-pay.index");
|
|
app._getNetWork({
|
|
url: _url,
|
|
data: json,
|
|
success: (res) => {
|
|
let resData = res.data;
|
|
if (resData.result == 1) {
|
|
this.handleOtherPay(_data, _data.value, resData.data, 'circle');
|
|
} else {
|
|
wx.showToast({
|
|
title: resData.msg,
|
|
icon: "none",
|
|
duration: 2000,
|
|
success: function () {},
|
|
});
|
|
}
|
|
},
|
|
fail: function (error) {
|
|
console.log(error, "错误");
|
|
},
|
|
});
|
|
},
|
|
});
|