214 lines
4.8 KiB
JavaScript
214 lines
4.8 KiB
JavaScript
// packageA/member/order/TransferAccount/TransferAccount.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
language: '',
|
|
uploadUrl: 'remittance.remittance-record.upload',
|
|
order_pay_id: '',
|
|
imageUrl: "",
|
|
upImgSrc: '',
|
|
status: '',
|
|
order_ids: ''
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
if (options.id) {
|
|
this.setData({
|
|
order_pay_id: options.id
|
|
});
|
|
}
|
|
if (options.status) {
|
|
this.setData({
|
|
status: options.status
|
|
});
|
|
}
|
|
if (options.order_ids) {
|
|
this.setData({
|
|
order_ids: options.order_ids
|
|
});
|
|
}
|
|
this.getJson();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
let language = wx.getStorageSync('langIndex');
|
|
this.setData({ 'language': language.en});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
},
|
|
getJson() {
|
|
this.setData({
|
|
imageUrl: "",
|
|
upImgSrc: ""
|
|
});
|
|
let that = this;
|
|
let urlStr = '';
|
|
urlStr += app.getNetAddresss("order.mergePay.remittance");
|
|
urlStr += '&order_pay_id=' + this.data.order_pay_id;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
bank_info: res.data.payee_info,
|
|
amount_info: res.data.amount,
|
|
pay_info: res.data.pay_sn
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
//选择图片
|
|
onRead() {
|
|
let that = this;
|
|
let wx_token = wx.getStorageSync('wx_token');
|
|
let session = wx.getStorageSync('session');
|
|
let urlStr = app.getNetAddresss(this.data.uploadUrl);
|
|
urlStr += '&3rd_session=' + session;
|
|
wx.chooseImage({
|
|
count: 1,
|
|
sizeType: ['original', 'compressed'],
|
|
sourceType: ['album', 'camera'],
|
|
success(res) {
|
|
const tempFilePaths = res.tempFilePaths;
|
|
wx.compressImage({
|
|
src: tempFilePaths[0], // 图片路径
|
|
quality: 60, // 压缩质量
|
|
success(e) {
|
|
let photourl = e.tempFilePath;
|
|
wx.uploadFile({
|
|
url: urlStr,
|
|
filePath: photourl,
|
|
name: 'file',
|
|
header:{
|
|
"Content-Type": "multipart/form-data",
|
|
Cookie: "PHPSESSID=" + wx_token,
|
|
},
|
|
success(resdata) {
|
|
var res = JSON.parse(resdata.data);
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
imageUrl: photourl,
|
|
upImgSrc: res.data.img
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: res.msg,
|
|
duration: 1500
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
fail(e) {
|
|
|
|
},
|
|
complete(e) {
|
|
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},
|
|
//确认汇款
|
|
confirmEvent() {
|
|
if (this.data.upImgSrc != "") {
|
|
var that = this;
|
|
let urlStr = app.getNetAddresss("remittance.pay");
|
|
urlStr += '&order_pay_id=' + this.data.order_pay_id;
|
|
urlStr += '&report_url=' + this.data.upImgSrc;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 1500,
|
|
success: function() {
|
|
setTimeout(function() {
|
|
//要延时执行的代码
|
|
wx.navigateTo({
|
|
url: '/packageA/member/myOrder_v2/myOrder_v2?status=2&bank_id=' + that.data.order_pay_id
|
|
});
|
|
}, 1500); //延迟时间
|
|
},
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请上传付款凭证',
|
|
duration: 1500
|
|
});
|
|
}
|
|
},
|
|
//在线付款
|
|
onLine() {
|
|
wx.redirectTo({
|
|
url: '/packageD/buy/orderPay/orderPay?status=' + this.data.status + '&order_id=' + this.data.order_ids
|
|
});
|
|
},
|
|
});
|