219 lines
4.8 KiB
JavaScript
219 lines
4.8 KiB
JavaScript
// packageA/member/order/scancodeAccount/scancodeAccount.js
|
|
|
|
|
|
// packageA/member/order/TransferAccount/TransferAccount.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
language: '',
|
|
uploadUrl: 'upload.uploadPic',
|
|
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() {
|
|
|
|
},
|
|
|
|
copyText(evt){
|
|
let text = evt.currentTarget.dataset.text;
|
|
wx.setClipboardData({
|
|
data: text
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
},
|
|
getJson() {
|
|
this.setData({
|
|
imageUrl: "",
|
|
upImgSrc: ""
|
|
});
|
|
let urlStr = '';
|
|
urlStr += app.getNetAddresss("order.merge-pay.dcm-scan-pay");
|
|
urlStr += '&order_pay_id=' + this.data.order_pay_id;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (resdata) => {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
this.setData({
|
|
bank_info: res.data.payee_info,
|
|
amount_info: res.data.amount,
|
|
pay_info: res.data.pay_sn
|
|
});
|
|
let desc = res.data.payee_info.information;
|
|
desc = desc.replace(/<img/g, '<img style="width:100%"');
|
|
this.setData({['bank_info.information']:desc});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
//选择图片
|
|
onRead() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss(this.data.uploadUrl);
|
|
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',
|
|
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("plugin.dcm-scan-pay.frontend.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
|
|
});
|
|
},
|
|
});
|