1828 lines
45 KiB
JavaScript
1828 lines
45 KiB
JavaScript
// pages/member/withdrawal/withdrawal.js
|
||
var app = getApp();
|
||
Page({
|
||
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
Data: {},
|
||
language: '',
|
||
datasource: [],
|
||
//是否开启劳务税 手续费 单独费率
|
||
balance_special: false,
|
||
unAllCheckList: [],
|
||
allCheckList: [],
|
||
isCheckAll: false,
|
||
//alipay
|
||
isAlipay: false,
|
||
alipay: {},
|
||
//wechat
|
||
isWechat: false,
|
||
wechat: {},
|
||
//balance
|
||
isBalance: false,
|
||
balance: {},
|
||
//manual
|
||
isManual: false,
|
||
manual: {},
|
||
isHx: false,
|
||
huanxun: {},
|
||
isEup: false,
|
||
eup: {},
|
||
action: "",
|
||
msg: "",
|
||
notice: "",
|
||
//提现总金额
|
||
totalwithdrawal: 0.0,
|
||
//手续费
|
||
poundage: 0.0,
|
||
//劳务税
|
||
servicetax: 0.0,
|
||
//单独劳务费
|
||
independent_special: 0.0,
|
||
//单独手续费
|
||
independent_poundage: 0.0,
|
||
checkAll: false,
|
||
checkList: [],
|
||
show1: false,
|
||
pay_type: "",
|
||
clicktag: 0, //防止快速点击
|
||
//yop_pay
|
||
isyop_pay: false,
|
||
yop_pay: {},
|
||
// 汇聚需要的数据
|
||
converge_pay_json: {},
|
||
isHj: false,
|
||
show2: false, // 判断
|
||
show3: false, // 银行卡列表
|
||
withList: [], // 银行卡列表
|
||
checkObj: {}, // 选中的银行卡
|
||
poundage_hj: '', // 汇聚提现手续费
|
||
actual_amount: '', // 实际到账金额
|
||
special_service_tax_text: '',
|
||
income_name_text: '', // 收入自定义
|
||
service_switch: 0, //劳务税开关,
|
||
name_of_withdrawal: '',
|
||
poundage_name: '',
|
||
deduction_love: {}, //爱心值扣除
|
||
TeamDividendModel: false,
|
||
|
||
// 收入提现类型
|
||
income_type: null,
|
||
withTypeList: [],
|
||
bankdata: {
|
||
bankname: '',
|
||
Province: '',
|
||
city: '',
|
||
branchName: '',
|
||
card: '',
|
||
name: ''
|
||
},
|
||
posRightShow: false,
|
||
provinceData: [],
|
||
cityData: [],
|
||
showCityData: [],
|
||
ProvinceId: '',
|
||
addressShow_p: false,
|
||
addressShow_c: false,
|
||
pay_typeList: {},
|
||
stickStatus: false,
|
||
// 客服
|
||
customer_service: {},
|
||
// 规则说明
|
||
withdraw_rich_text: {},
|
||
// 客服显示
|
||
customer_show: false,
|
||
// 规则显示
|
||
withdraw_rich_show: false,
|
||
// 支付宝微信设置弹窗
|
||
setWX: false,
|
||
setAlipay: false,
|
||
setinWX: '',
|
||
setinAlipay: '',
|
||
setinAlipayName: '',
|
||
// 第三方代发相关信息
|
||
staff: {
|
||
name: '',
|
||
tel: '',
|
||
card_type: '1',// 卡类型:1=对私,2=对公
|
||
bank_sub_name: '',// 开户银行支行名称:对公必填
|
||
bank_act_name: '',//银行卡持有人姓名
|
||
card_num: '',// 银行卡卡号
|
||
account_id: '',// 银行卡持有人身份证号码
|
||
account_id_start: '',// 证件有效期开始时间,格式:YYYYMMDD
|
||
mer_type: '3',// 商户类型:1=个体户,3=个人
|
||
},
|
||
third_party_show: false,
|
||
date_time_show: false,
|
||
minDate: new Date(2000, 0, 1).getTime(),
|
||
selected_time: 0,
|
||
is_show_signing: false,
|
||
signing_url: '',
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad: function (options) {
|
||
let language = wx.getStorageSync("langIndex");
|
||
this.setData({
|
||
language: language.en
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady: function () {
|
||
let language = wx.getStorageSync('langIndex');
|
||
this.setData({
|
||
'language': language.en
|
||
});
|
||
},
|
||
stickChange(e) {
|
||
this.setData({
|
||
stickStatus: e.detail.isFixed
|
||
});
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow: function () {
|
||
this._intData();
|
||
this._getData();
|
||
// this._getWithdrawType();
|
||
this._initHxpay();
|
||
this.customizeIncome();
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面隐藏
|
||
*/
|
||
onHide: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面卸载
|
||
*/
|
||
onUnload: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面相关事件处理函数--监听用户下拉动作
|
||
*/
|
||
onPullDownRefresh: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面上拉触底事件的处理函数
|
||
*/
|
||
onReachBottom: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 用户点击右上角分享
|
||
*/
|
||
onShareAppMessage: function () {
|
||
|
||
},
|
||
setInput(e) {
|
||
let val = e.detail;
|
||
let key = e.currentTarget.dataset.key;
|
||
if (key == "wxuser") {
|
||
this.setData({
|
||
setinWX: val
|
||
});
|
||
} else if (key == "Alipay") {
|
||
this.setData({
|
||
setinAlipay: val
|
||
});
|
||
} else if (key == "AlipayName") {
|
||
this.setData({
|
||
setinAlipayName: val
|
||
});
|
||
}
|
||
},
|
||
bindSet(e) {
|
||
console.log(e);
|
||
let key = e.currentTarget.dataset.key;
|
||
let json = {};
|
||
if (key == 'wx') {
|
||
if (app._isTextEmpty(this.data.setinWX)) {
|
||
app.tips('请输入微信号');
|
||
return;
|
||
}
|
||
json.wx = this.data.setinWX;
|
||
} else {
|
||
if (app._isTextEmpty(this.data.setinAlipay)) {
|
||
app.tips('请输入支付宝账号');
|
||
return;
|
||
}
|
||
if (app._isTextEmpty(this.data.setinAlipayName)) {
|
||
app.tips('请输入支付宝账号姓名');
|
||
return;
|
||
}
|
||
json.alipay = this.data.setinAlipay;
|
||
json.alipay_name = this.data.setinAlipayName;
|
||
}
|
||
let urlStr = app.getNetAddresss("member.member.updateWxOrAli");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
data: json,
|
||
success: (resdata) => {
|
||
let res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
setAlipay:false,
|
||
setWX:false
|
||
});
|
||
app.tips(res.msg);
|
||
}else{
|
||
this.setData({
|
||
setAlipay:false,
|
||
setWX:false
|
||
});
|
||
app.tips(res.msg);
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
_intData() {
|
||
this.setData({
|
||
income_type: null,
|
||
Data: {},
|
||
datasource: [],
|
||
//是否开启劳务税 手续费 单独费率
|
||
balance_special: false,
|
||
unAllCheckList: [],
|
||
allCheckList: [],
|
||
isCheckAll: false,
|
||
//alipay
|
||
isAlipay: false,
|
||
alipay: {},
|
||
//wechat
|
||
isWechat: false,
|
||
wechat: {},
|
||
//balance
|
||
isBalance: false,
|
||
balance: {},
|
||
//manual
|
||
isManual: false,
|
||
manual: {},
|
||
isHx: false,
|
||
isEup: false,
|
||
eup: {},
|
||
action: "",
|
||
msg: "",
|
||
notice: "",
|
||
//提现总金额
|
||
totalwithdrawal: 0.0,
|
||
//手续费
|
||
poundage: 0.0,
|
||
//劳务税
|
||
servicetax: 0.0,
|
||
//单独劳务费
|
||
independent_special: 0.0,
|
||
//单独手续费
|
||
independent_poundage: 0.0,
|
||
checkAll: false,
|
||
checkList: [],
|
||
show1: false,
|
||
pay_type: "",
|
||
clicktag: 0, //防止快速点击
|
||
//yop_pay
|
||
isyop_pay: false,
|
||
yop_pay: {},
|
||
// 右上角弹窗显隐
|
||
posRightShow: false
|
||
});
|
||
},
|
||
//初始化数据
|
||
_getData() {
|
||
let urlStr = app.getNetAddresss("finance.income-withdraw.get-withdraw");
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
data: {
|
||
validate_page: 1
|
||
}, // validate_page 实名认证判断
|
||
success: (resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
balance_special: res.data.setting.balance_special,
|
||
datasource: res.data.data,
|
||
service_switch: res.data.setting.service_switch,
|
||
all_withdraw_income: res.data.all_withdraw_income ? res.data.all_withdraw_income.toFixed(2) : '',
|
||
customer_service: res.data.setting.customer_service,
|
||
withdraw_rich_text: res.data.setting.withdraw_rich_text
|
||
});
|
||
if (res.data.deduction_love) {
|
||
this.setData({
|
||
deduction_love: res.data.deduction_love
|
||
});
|
||
}
|
||
this.setData({
|
||
Data: res.data.data
|
||
});
|
||
if (this.data.Data.length > 0) {
|
||
this._allCheckListInit(res.data.data); // 初始化全选数据
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '暂无可提现金额',
|
||
duration: 1500
|
||
});
|
||
}
|
||
|
||
} else {
|
||
this.setData({
|
||
Data: []
|
||
});
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
// 判断汇聚提现按钮的显示
|
||
getGconverge_pay(val) {
|
||
let urlStr = app.getNetAddresss("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.get-bank-card");
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: (resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
show2: true,
|
||
show1: false
|
||
});
|
||
this.setData({
|
||
converge_pay_json: res.data
|
||
});
|
||
this.setData({
|
||
checkObj: res.data
|
||
});
|
||
let name = res.data.bankName + '(' + res.data.receiverAccountNoEnc.substring(res.data.receiverAccountNoEnc.length -
|
||
4) + ')';
|
||
this.setData({
|
||
'checkObj.bankName': name,
|
||
|
||
});
|
||
// 调用
|
||
this.getwithList();
|
||
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
setTimeout(() => {
|
||
wx.navigateTo({
|
||
url: '/packageA/others/HJinfo/bankCardInformation/bankCardInformation'
|
||
});
|
||
}, 2000);
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
// 获取银行卡列表
|
||
getwithList() {
|
||
let urlStr = app.getNetAddresss(
|
||
"plugin.converge_pay.frontend.controllers.converge-pay-bank-card.get-bank-card-list");
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: (resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
if (res.data.length == 0) {
|
||
wx.showToast({
|
||
title: '请先去添加银行卡',
|
||
icon: 'none'
|
||
});
|
||
wx.navigateTo({
|
||
url: '/packageA/others/HJinfo/bankCardInformation/bankCardInformation'
|
||
});
|
||
}
|
||
res.data.map(item => {
|
||
item.check = false;
|
||
if (item.receiverAccountNoEnc != '' && item.receiverAccountNoEnc != null) {
|
||
item.bankName += '(' + item.receiverAccountNoEnc.substring(item.receiverAccountNoEnc.length - 4) + ')';
|
||
}
|
||
});
|
||
this.setData({
|
||
withList: res.data
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
setTimeout(() => {
|
||
|
||
}, 2000);
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
gotoList() {
|
||
console.log('22333121');
|
||
|
||
this.setData({
|
||
show3: true,
|
||
show2: false
|
||
});
|
||
},
|
||
//初始化全选数据
|
||
_allCheckListInit(data) {
|
||
//this.allCheckList = data;
|
||
for (let i = 0; i < data.length; i++) {
|
||
if (!data[i].can) {
|
||
let unAllCheckList = this.data.unAllCheckList;
|
||
unAllCheckList.push(i + "");
|
||
this.setData({
|
||
unAllCheckList: unAllCheckList
|
||
});
|
||
} else {
|
||
// 全选默认选中default的选项
|
||
if (data[i].income_type === 'default') {
|
||
let allCheckList = this.data.allCheckList;
|
||
allCheckList.push(i + "");
|
||
this.setData({
|
||
allCheckList: allCheckList
|
||
});
|
||
}
|
||
}
|
||
}
|
||
//判断全选状态
|
||
this.setData({
|
||
isCheckAll: !(this.data.unAllCheckList.length === this.data.datasource.length)
|
||
});
|
||
},
|
||
|
||
getMergeServicetax() {
|
||
|
||
if (!this.data.income_type) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: "请先选择提现类型",
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
|
||
let income_type = [];
|
||
let checkList = this.data.checkList;
|
||
for (let i = 0; i < checkList.length; i++) {
|
||
income_type.push(this.data.datasource[checkList[i]].key_name);
|
||
}
|
||
let urlStr = app.getNetAddresss("finance.income-withdraw.getMergeServicetax");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
data: {
|
||
income_type
|
||
},
|
||
success: (resdata) => {
|
||
let res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
totalwithdrawal: res.data.sum_amount,
|
||
poundage: res.data.poundage_amount,
|
||
servicetax: res.data.servicetax_amount
|
||
});
|
||
this.checkPayWay();
|
||
// this._getWithdrawType();
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
|
||
//获取提现方式
|
||
_getWithdrawType(key = true) {
|
||
let that = this;
|
||
// if(Object.keys(this.data.pay_typeList).length != 0){
|
||
// if(key){
|
||
// that.setData({
|
||
// show1: true
|
||
// });
|
||
// }
|
||
// that._initWithdrawType(this.data.pay_typeList);
|
||
// return
|
||
// }
|
||
let urlStr = app.getNetAddresss("finance.income-withdraw.get-income-withdraw-mode");
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
data: {
|
||
income_type: that.data.income_type
|
||
},
|
||
success: function (resdata) {
|
||
let res = resdata.data;
|
||
if (res.result == 1) {
|
||
if (key) {
|
||
that.setData({
|
||
show1: true
|
||
});
|
||
}
|
||
that.setData({
|
||
pay_typeList: res.data
|
||
});
|
||
that._initWithdrawType(res.data);
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
backGo() {
|
||
this.setData({
|
||
show2: true,
|
||
show1: false,
|
||
show3: false
|
||
});
|
||
},
|
||
backTap() {
|
||
this.setData({
|
||
show2: false,
|
||
show1: true,
|
||
show3: false
|
||
});
|
||
},
|
||
//初始化提现方式
|
||
_initWithdrawType(data) {
|
||
this.setData({
|
||
service_switch: data.service_switch
|
||
});
|
||
//支付宝
|
||
this._initAlipay(data);
|
||
//微信
|
||
this._initWechat(data);
|
||
//余额
|
||
this._initBalance(data);
|
||
//手动打款
|
||
this._initManual(data);
|
||
//eup支付
|
||
this._initEup(data);
|
||
//初始化易宝
|
||
this.inityop_pay(data);
|
||
console.log(data, '参数');
|
||
// 初始化汇聚提现
|
||
this.initConverge_pay(data);
|
||
},
|
||
//支付宝
|
||
_initAlipay(data) {
|
||
if (
|
||
data.alipay == null ||
|
||
data.alipay == undefined ||
|
||
data.alipay == ""
|
||
) {
|
||
this.setData({
|
||
isAlipay: false
|
||
});
|
||
return;
|
||
}
|
||
this.setData({
|
||
isAlipay: true,
|
||
alipay: data.alipay
|
||
});
|
||
},
|
||
//微信
|
||
_initWechat(data) {
|
||
if (
|
||
data.wechat == null ||
|
||
data.wechat == undefined ||
|
||
data.wechat == ""
|
||
) {
|
||
this.setData({
|
||
isWechat: false
|
||
});
|
||
return;
|
||
}
|
||
this.setData({
|
||
isWechat: true,
|
||
wechat: data.wechat
|
||
});
|
||
},
|
||
//余额
|
||
_initBalance(data) {
|
||
if (
|
||
data.balance == null ||
|
||
data.balance == undefined ||
|
||
data.balance == ""
|
||
) {
|
||
this.setData({
|
||
isBalance: false
|
||
});
|
||
return;
|
||
}
|
||
this.setData({
|
||
isBalance: true,
|
||
balance: data.balance
|
||
});
|
||
},
|
||
//手动打款
|
||
_initManual(data) {
|
||
let that = this;
|
||
if (
|
||
data.manual == null ||
|
||
data.manual == undefined ||
|
||
data.manual == ""
|
||
) {
|
||
that.setData({
|
||
isManual: false
|
||
});
|
||
return;
|
||
}
|
||
// let mailLanguage = JSON.parse(wx.getStorageSync('mailLanguage'));
|
||
// let name = this.data.name_of_withdrawal + mailLanguage.income.manual_withdrawal;
|
||
// data.manual.name = name;
|
||
that.setData({
|
||
isManual: true,
|
||
manual: data.manual
|
||
});
|
||
},
|
||
//eup支付
|
||
_initEup(data) {
|
||
let that = this;
|
||
if (
|
||
data.eup_pay == null ||
|
||
data.eup_pay == undefined ||
|
||
data.eup_pay == ""
|
||
) {
|
||
that.setData({
|
||
isEup: false
|
||
});
|
||
return;
|
||
}
|
||
that.setData({
|
||
isEup: false,
|
||
eup: data.eup_pay
|
||
});
|
||
},
|
||
initConverge_pay(data) {
|
||
if (
|
||
data.converge_pay == null ||
|
||
data.converge_pay == undefined ||
|
||
data.converge_pay == ""
|
||
) {
|
||
this.setData({
|
||
isHj: false
|
||
});
|
||
return;
|
||
}
|
||
this.setData({
|
||
isHj: true,
|
||
converge_pay: data.converge_pay
|
||
});
|
||
},
|
||
_initHxpay() {
|
||
this.setData({
|
||
action: "",
|
||
msg: "",
|
||
notice: ""
|
||
});
|
||
},
|
||
allSelect(e) {
|
||
let bol = !this.data.checkAll;
|
||
this.setData({
|
||
checkAll: bol,
|
||
});
|
||
|
||
// 监听全选变化
|
||
if (bol) {
|
||
this.setData({
|
||
income_type: 'default',
|
||
checkList: this.data.allCheckList
|
||
});
|
||
} else {
|
||
this.setData({
|
||
income_type: null,
|
||
checkList: []
|
||
});
|
||
}
|
||
|
||
//计算总价格
|
||
this._countTotalPrice();
|
||
},
|
||
//提现方式选择监听
|
||
SelectHandle(val) {
|
||
console.log(val, 'aaa');
|
||
this.setData({
|
||
show1: false,
|
||
pay_type: val.detail
|
||
});
|
||
this.dynamicTxt();
|
||
},
|
||
cardSplice(str) {
|
||
let str_a = str.substr(0, 4);
|
||
let str_b = str.substr(str.length - 4, str.length);
|
||
return `${str_a}****${str_b}`;
|
||
},
|
||
dynamicTxt() {
|
||
let list = this.data.pay_typeList;
|
||
console.log(this.data.pay_type);
|
||
switch (this.data.pay_type) {
|
||
case "balance":
|
||
this.setData({
|
||
withTypeTipsIcon: 'iconfont icon-fontclass-fanli',
|
||
withTypeTipsTitle: `${list.balance.name}`,
|
||
withTypeTips: `通过审核后将打款到系统${list.balance.other_name}!`
|
||
});
|
||
break;
|
||
case "wechat":
|
||
this.setData({
|
||
withTypeTipsIcon: 'iconfont icon-card_weixin',
|
||
withTypeTipsTitle: `${list.wechat.name}`,
|
||
withTypeTips: `通过审核后将打款到个人微信零钱!`
|
||
});
|
||
break;
|
||
case "manual":
|
||
let manual = this.data.manual;
|
||
let title = '';
|
||
let tips = '';
|
||
if (manual.manual_type == 1) {
|
||
title = `${manual.name}-银行卡`;
|
||
tips = `通过审核后将由工作人员将打款到您的银行卡!`;
|
||
} else if (manual.manual_type == 2) {
|
||
title = `${manual.name}-微信`;
|
||
tips = `通过审核后将由工作人员将打款到您的微信!`;
|
||
} else if (manual.manual_type == 3) {
|
||
title = `${manual.name}-支付宝`;
|
||
tips = `通过审核后将由工作人员将打款到您的支付宝!`;
|
||
} else if (manual.manual_type == 4) {
|
||
title = `${manual.name}-第三方代发`;
|
||
tips = `通过审核后将第三方代发到您的银行卡!`;
|
||
}
|
||
console.log(title);
|
||
this.setData({
|
||
withTypeTipsIcon: 'iconfont icon-pay_otherpay',
|
||
withTypeTipsTitle: title,
|
||
withTypeTips: tips
|
||
});
|
||
break;
|
||
case "alipay":
|
||
this.setData({
|
||
withTypeTipsIcon: 'iconfont icon-all_alipay',
|
||
withTypeTipsTitle: `${list.alipay.name}`,
|
||
withTypeTips: `通过审核后将打款到个人支付宝!`
|
||
});
|
||
break;
|
||
case "converge_pay":
|
||
this.setData({
|
||
withTypeTipsIcon: 'iconfont icon-pay_otherpay',
|
||
withTypeTipsTitle: `${list.converge_pay.name}`,
|
||
withTypeTips: `通过审核后将打款到个人银行卡!`
|
||
});
|
||
break;
|
||
default:
|
||
// this.data.withTypeTipsIcon = 'iconfont icon-fontclass-fanli';
|
||
// this.withTypeTipsTitle='余额';
|
||
this.pay_type = '';
|
||
break;
|
||
}
|
||
|
||
|
||
},
|
||
allSelectHandle(e) {
|
||
let arrBol = e.detail;
|
||
let checkedCount = arrBol.length;
|
||
|
||
if (arrBol.length > 0) {
|
||
this.setData({
|
||
income_type: this.data.datasource[arrBol[0]].income_type
|
||
});
|
||
} else {
|
||
this.setData({
|
||
income_type: null
|
||
});
|
||
}
|
||
this.setData({
|
||
checkList: arrBol,
|
||
checkAll: checkedCount === this.data.allCheckList.length
|
||
});
|
||
//计算总价格
|
||
this._countTotalPrice();
|
||
},
|
||
//计算总价格
|
||
_countTotalPrice() {
|
||
let checkList = this.data.checkList;
|
||
this.setData({
|
||
totalwithdrawal: 0.0, //提现总金额
|
||
poundage: 0.0, //手续费
|
||
servicetax: 0.0, //劳务费手续费
|
||
independent_special: 0.0, //单独劳务税
|
||
independent_poundage: 0.0, //单独手续费
|
||
actual_amount: 0.0,
|
||
poundage_hj: 0.0
|
||
});
|
||
this.setData({
|
||
TeamDividendModel: false
|
||
});
|
||
for (let i = 0; i < checkList.length; i++) {
|
||
this.setData({
|
||
totalwithdrawal: this.floatAdd(
|
||
this.data.totalwithdrawal,
|
||
this.data.datasource[checkList[i]].income
|
||
),
|
||
|
||
poundage: this.floatAdd(
|
||
this.data.poundage,
|
||
this.data.datasource[checkList[i]].poundage
|
||
),
|
||
servicetax: this.floatAdd(
|
||
this.data.servicetax,
|
||
this.data.datasource[checkList[i]].servicetax
|
||
),
|
||
actual_amount: this.floatAdd(
|
||
this.data.actual_amount,
|
||
this.data.datasource[checkList[i]].actual_amount
|
||
),
|
||
poundage_hj: this.floatAdd(
|
||
this.data.poundage_hj,
|
||
this.data.datasource[checkList[i]].poundage
|
||
),
|
||
|
||
});
|
||
|
||
if (this.data.datasource[checkList[i]].type.indexOf("\TeamDividendModel") >= 0) {
|
||
this.setData({
|
||
TeamDividendModel: true
|
||
});
|
||
}
|
||
|
||
//是否有单独余额劳务费
|
||
if (this.data.balance_special) {
|
||
this.setData({
|
||
independent_special: this.floatAdd(
|
||
this.data.independent_special,
|
||
this.data.datasource[checkList[i]].special_service_tax
|
||
),
|
||
independent_poundage: this.floatAdd(
|
||
this.data.independent_poundage,
|
||
this.data.datasource[checkList[i]].special_poundage
|
||
)
|
||
});
|
||
}
|
||
}
|
||
this.setData({
|
||
totalwithdrawal: Number(this.data.totalwithdrawal.toString()).toFixed(2),
|
||
poundage: Number(this.data.poundage.toString()).toFixed(2),
|
||
servicetax: Number(this.data.servicetax.toString()).toFixed(2)
|
||
});
|
||
//是否有单独余额劳务费
|
||
if (this.data.balance_special) {
|
||
this.setData({
|
||
independent_special: Number(
|
||
this.data.independent_special.toString().match(/^\d+(?:\.\d{0,2})?/)
|
||
),
|
||
independent_poundage: Number(
|
||
this.data.independent_poundage.toString().match(/^\d+(?:\.\d{0,2})?/)
|
||
)
|
||
});
|
||
}
|
||
},
|
||
//浮点数加法运算
|
||
floatAdd(arg1, arg2) {
|
||
var r1, r2, m;
|
||
try {
|
||
r1 = arg1.split(".")[1].length;
|
||
} catch (e) {
|
||
r1 = 0;
|
||
}
|
||
try {
|
||
r2 = arg2.split(".")[1].length;
|
||
} catch (e) {
|
||
r2 = 0;
|
||
}
|
||
m = Math.pow(10, Math.max(r1, r2));
|
||
return (arg1 * m + arg2 * m) / m;
|
||
},
|
||
withdrawToBalanceBtn(e) {
|
||
let typeData = e.currentTarget.dataset.dataval;
|
||
this.withdrawToBalance(typeData);
|
||
},
|
||
//提现网络操作
|
||
withdrawToBalance(type) {
|
||
//验证是否选择提现数据
|
||
if (!this._checkWithdrawToBalance()) {
|
||
return;
|
||
}
|
||
let checkList = this.data.checkList;
|
||
if (checkList.length > 0) {
|
||
let checkListData = [];
|
||
for (let i = 0; i < checkList.length; i++) {
|
||
checkListData.push(this.data.datasource[checkList[i]]);
|
||
}
|
||
let data = {
|
||
data: {
|
||
total: {
|
||
amounts: this.data.totalwithdrawal,
|
||
poundage: this.data.poundage,
|
||
pay_way: type
|
||
},
|
||
withdrawal: checkListData
|
||
}
|
||
};
|
||
let that = this;
|
||
//finance.Income-withdraw.save-withdraw
|
||
let urlStr = app.getNetAddresss("withdraw.apply.index");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: data,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
show1: false,
|
||
show2: false,
|
||
checkList: [],
|
||
totalwithdrawal: 0.0,
|
||
poundage: 0.0,
|
||
});
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 1500,
|
||
success: function () {
|
||
setTimeout(function () {
|
||
//要延时执行的代码
|
||
wx.navigateBack({
|
||
delta: 1
|
||
});
|
||
}, 1500); //延迟时间
|
||
},
|
||
});
|
||
} else {
|
||
wx.showModal({
|
||
title: '提示',
|
||
content: res.msg,
|
||
success(response) {
|
||
if (response.confirm) {
|
||
if (res.data.status == 1) {
|
||
wx.navigateTo({
|
||
url: "/packageA/member/info/info"
|
||
});
|
||
}
|
||
if (res.data.love == 1) {
|
||
wx.navigateTo({
|
||
url: "/packageB/member/love/Love_index/Love_index"
|
||
});
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
setTimeout(() => {
|
||
that.setData({
|
||
clicktag: 0
|
||
});
|
||
}, 1000);
|
||
},
|
||
fail: function (res) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res,
|
||
duration: 1500
|
||
});
|
||
setTimeout(() => {
|
||
that.setData({
|
||
clicktag: 0
|
||
});
|
||
}, 1000);
|
||
}
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: '提现数据不可为空',
|
||
title: res,
|
||
duration: 1500
|
||
});
|
||
that.setData({
|
||
clicktag: 0
|
||
});
|
||
}
|
||
},
|
||
//验证是否选择提现数据
|
||
_checkWithdrawToBalance() {
|
||
if (
|
||
parseFloat(this.data.totalwithdrawal) <= 0 ||
|
||
this.data.totalwithdrawal == null
|
||
) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: "提现金额不能等于0",
|
||
duration: 1500
|
||
});
|
||
this.setData({
|
||
clicktag: 0
|
||
});
|
||
return false;
|
||
} else {
|
||
return true;
|
||
}
|
||
},
|
||
//验证手动打款的 设置 微信 支付 银行卡 是否完善
|
||
checkManual(type) {
|
||
let typeData = type;
|
||
//验证是否选择提现数据
|
||
console.log(this._checkWithdrawToBalance());
|
||
if (!this._checkWithdrawToBalance()) {
|
||
return;
|
||
}
|
||
let that = this;
|
||
let urlStr = app.getNetAddresss("finance.manual-type.is-can-submit");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: {},
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
if (res.data.status) {
|
||
that.withdrawToBalance(typeData); //提现
|
||
} else {
|
||
that.setManualInfo(typeData, res.data.manual_type);
|
||
}
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
|
||
},
|
||
fail: function (res) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res,
|
||
duration: 1500
|
||
});
|
||
}
|
||
});
|
||
},
|
||
setManualInfo(type, manual_type) {
|
||
let msg = "";
|
||
// let routerPath = "";
|
||
let that = this;
|
||
switch (manual_type) {
|
||
case "bank":msg = "请先填写银行卡信息";break;
|
||
case "third_party":msg = "请先完善相关信息";break;
|
||
case "wechat":msg = "请先填写微信信息";break;
|
||
case "alipay":msg = "请先填写支付宝信息";break;
|
||
default:break;
|
||
}
|
||
// let that = this;
|
||
wx.showModal({
|
||
title: '提示',
|
||
content: msg,
|
||
success(res) {
|
||
if (res.confirm) {
|
||
if (manual_type == 'bank') {
|
||
that.getBankCard();
|
||
}else if (manual_type == 'third_party') {
|
||
that.thirdPartyBankCardInfo();
|
||
} else if (manual_type == 'wechat') {
|
||
// 微信
|
||
that.setData({
|
||
setWX: true,
|
||
clicktag: 0
|
||
});
|
||
} else {
|
||
// 支付宝
|
||
that.setData({
|
||
setAlipay: true,
|
||
clicktag: 0
|
||
});
|
||
}
|
||
} else if (res.cancel) {
|
||
that.setData({
|
||
clicktag: 0
|
||
});
|
||
console.log('用户点击取消');
|
||
}
|
||
}
|
||
});
|
||
},
|
||
editUser() {
|
||
this.getBankCard();
|
||
},
|
||
onCancel() {
|
||
this.setData({
|
||
createCardShow: true,
|
||
addressShow_p: false,
|
||
addressShow_c: false
|
||
});
|
||
},
|
||
addressCallback(e) {
|
||
console.log(e);
|
||
this.setData({
|
||
'bankdata.Province': e.detail.value.areaname,
|
||
ProvinceId: e.detail.value.id,
|
||
showCityData: [],
|
||
'bankdata.city': '',
|
||
});
|
||
this.onCancel();
|
||
},
|
||
addressCallback_c(e) {
|
||
this.setData({
|
||
'bankdata.city': e.detail.value.areaname,
|
||
});
|
||
this.onCancel();
|
||
},
|
||
// 选择市
|
||
addressShowCity() {
|
||
if (!this.data.ProvinceId) {
|
||
wx.showToast({
|
||
title: '请先选择省',
|
||
icon: 'none',
|
||
duration: 1000
|
||
});
|
||
return;
|
||
}
|
||
for (let i = 0; i < this.data.cityData.length; i++) {
|
||
if (this.data.cityData[i].parentid == this.data.ProvinceId) {
|
||
this.setData({
|
||
showCityData: this.data.showCityData.concat(this.data.cityData[i]),
|
||
createCardShow: false,
|
||
addressShow_c: true
|
||
});
|
||
}
|
||
}
|
||
},
|
||
// 选择省
|
||
addressShowProvince() {
|
||
if (this.data.provinceData.length > 0) {
|
||
this.setData({
|
||
createCardShow: false,
|
||
addressShow_p: true
|
||
});
|
||
} else {
|
||
let urlStr = app.getNetAddresss("member.member-address.address");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: this.data.form,
|
||
success: ((resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
provinceData: res.data.province,
|
||
cityData: res.data.city,
|
||
createCardShow: false,
|
||
addressShow_p: true
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
}),
|
||
fail: ((err) => {
|
||
console.log(err);
|
||
})
|
||
});
|
||
}
|
||
},
|
||
getBankCard() {
|
||
// let json = {};
|
||
let that = this;
|
||
let urlStr = app.getNetAddresss("member.bank-card.show");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: this.data.form,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
'bankdata.bankname': res.data.bank_name,
|
||
'bankdata.card': res.data.bank_card,
|
||
'bankdata.name': res.data.member_name,
|
||
'bankdata.Province': res.data.bank_province,
|
||
'bankdata.city': res.data.bank_city,
|
||
'bankdata.branchName': res.data.bank_branch,
|
||
createCardShow: true,
|
||
clicktag:0
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
|
||
},
|
||
fail: function (res) {
|
||
console.log(res.msg);
|
||
}
|
||
});
|
||
},
|
||
tapinpbank(e) {
|
||
let key = e.currentTarget.dataset.key;
|
||
let value = e.detail;
|
||
this.setData({
|
||
['bankdata.' + key]: value
|
||
});
|
||
},
|
||
bindCard() {
|
||
console.log(this.data.bankdata);
|
||
if (app._isTextEmpty(this.data.bankdata.bankname)) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入开户行',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (app._isTextEmpty(this.data.bankdata.Province)) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入开户行省份',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (app._isTextEmpty(this.data.bankdata.city)) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入开户行城市',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
|
||
|
||
if (app._isTextEmpty(this.data.bankdata.branchName)) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入开户行支行',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (app._isTextEmpty(this.data.bankdata.card)) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入账号',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (app._isTextEmpty(this.data.bankdata.name)) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请输入姓名',
|
||
duration: 1500
|
||
});
|
||
return;
|
||
}
|
||
let json = {
|
||
'bank_card': this.data.bankdata.card,
|
||
'member_name': this.data.bankdata.name,
|
||
'bank_name': this.data.bankdata.bankname,
|
||
"bank_province": this.data.bankdata.Province,
|
||
"bank_city": this.data.bankdata.city,
|
||
"bank_branch": this.data.bankdata.branchName
|
||
};
|
||
let urlStr = app.getNetAddresss("member.bank-card.edit");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: json,
|
||
success: ((resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 1000,
|
||
success: ((ess) => {
|
||
this.setData({
|
||
createCardShow: false,
|
||
addressShow_c: false,
|
||
addressShow_p: false
|
||
});
|
||
console.log(ess, 'sssssssssss');
|
||
this._getWithdrawType(false);
|
||
}),
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1500
|
||
});
|
||
}
|
||
|
||
}),
|
||
fail: function (res) {
|
||
console.log(res.msg);
|
||
}
|
||
});
|
||
},
|
||
//eup支付
|
||
checkEup(type) {
|
||
let typeData = type;
|
||
//验证是否选择提现数据
|
||
if (!this._checkWithdrawToBalance()) {
|
||
return;
|
||
}
|
||
let that = this;
|
||
let urlStr = app.getNetAddresss("plugin.eup-pay.api.account.pi-account");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: {},
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
if (res.data.bool == 1) {
|
||
that.withdrawToBalance(typeData); //提现
|
||
}
|
||
} else if (res.result == 0) {
|
||
if (res.data.bool == 0) {
|
||
let msg = res.msg;
|
||
wx.showModal({
|
||
title: '提示',
|
||
content: msg,
|
||
success(res) {
|
||
if (res.confirm) {
|
||
wx.navigateTo({
|
||
url: "/packageA/member/info/info"
|
||
});
|
||
} else if (res.cancel) {
|
||
console.log('用户点击取消');
|
||
}
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
},
|
||
fail: function (res) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res,
|
||
duration: 1500
|
||
});
|
||
}
|
||
});
|
||
},
|
||
getToTitle() {
|
||
let urlStr = app.getNetAddresss("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.set-bank-card");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
data: {
|
||
set: this.data.checkObj
|
||
},
|
||
success: (resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
//有资格提现
|
||
var type = "converge_pay";
|
||
this.withdrawToBalance(type);
|
||
} else {
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 1500,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
// 提现
|
||
withBalance() {
|
||
console.log(this.data.checkObj, '选择的对象');
|
||
this.getToTitle();
|
||
return;
|
||
|
||
},
|
||
onChange(e) {
|
||
console.log(e.detail, '改变啊啊啊');
|
||
|
||
},
|
||
checkOut(e) {
|
||
let item = e.target.dataset.item || e.currentTarget.dataset.item;
|
||
item.check = !item.check;
|
||
console.log(item, '当前对象');
|
||
|
||
let data = this.data.withList;
|
||
data.map(items => {
|
||
if (items.id == item.id) {
|
||
items.check = item.check;
|
||
} else {
|
||
items.check = false;
|
||
}
|
||
});
|
||
console.log(data, '数组');
|
||
|
||
if (item.check == true) {
|
||
this.setData({
|
||
show3: false,
|
||
show2: true,
|
||
checkObj: item,
|
||
withList: data
|
||
});
|
||
}
|
||
},
|
||
// 右上角弹窗
|
||
tapShow() {
|
||
this.setData({
|
||
posRightShow: !this.data.posRightShow
|
||
});
|
||
},
|
||
onClickLeft(e) {
|
||
this.setData({
|
||
withdraw_rich_show: false,
|
||
customer_show: false
|
||
});
|
||
},
|
||
//右上角弹窗点击跳转
|
||
toRecord(e) {
|
||
console.log(e);
|
||
let path = e.currentTarget.dataset.path;
|
||
if (path == "presentationRecord_v2") {
|
||
wx.navigateTo({
|
||
url: "/packageA/member/presentationRecord_v2/presentationRecord_v2?orderType=extension"
|
||
});
|
||
} else if (path == "fa_child") {
|
||
this.setData({
|
||
withdraw_rich_show: true
|
||
});
|
||
} else {
|
||
this.setData({
|
||
customer_show: true
|
||
});
|
||
}
|
||
this.setData({
|
||
posRightShow: false
|
||
});
|
||
},
|
||
submitbrank() {
|
||
app._postNetWork({
|
||
url: this.data.action,
|
||
showToastIn: false,
|
||
data: {
|
||
ipsRequest: this.data.msg
|
||
},
|
||
success: function (resdata) {
|
||
wx.navigateBack({
|
||
delta: 1
|
||
});
|
||
},
|
||
fail: function (res) {}
|
||
});
|
||
},
|
||
show1btn() {
|
||
this.setData({
|
||
show1: true
|
||
});
|
||
},
|
||
show1CloseBtn() {
|
||
this.setData({
|
||
show1: false,
|
||
show2: false,
|
||
show3: false,
|
||
setWX: false,
|
||
setAlipay: false
|
||
});
|
||
},
|
||
createCardClose(){
|
||
this.setData({
|
||
createCardShow: false
|
||
});
|
||
},
|
||
payTypebtn(e) {
|
||
let val = e.detail;
|
||
this.setData({
|
||
pay_type: val
|
||
});
|
||
},
|
||
checkPayWay() {
|
||
console.log(this.data.pay_type, this.data.clicktag);
|
||
if (!this.data.pay_type) {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: '请选择提现方式'
|
||
});
|
||
return;
|
||
}
|
||
if (this.data.pay_type == 'converge_pay' && this.data.clicktag == 1) {
|
||
// 再次调用汇聚提现
|
||
this.getGconverge_pay(this.data.yop_pay);
|
||
}
|
||
if (this.data.clicktag === 0) {
|
||
this.setData({
|
||
clicktag: 1
|
||
});
|
||
switch (this.data.pay_type) {
|
||
case "balance":
|
||
this.withdrawToBalance(this.data.pay_type);
|
||
break;
|
||
case "wechat":
|
||
this.withdrawToBalance(this.data.pay_type);
|
||
break;
|
||
case "manual":
|
||
this.checkManual(this.data.pay_type);
|
||
break;
|
||
case "alipay":
|
||
this.withdrawToBalance(this.data.pay_type);
|
||
break;
|
||
case "eup":
|
||
this.checkEup(this.data.pay_type);
|
||
break;
|
||
case "yop_pay":
|
||
this.checkyop_pay(this.data.yop_pay);
|
||
break;
|
||
case "converge_pay":
|
||
this.getGconverge_pay(this.data.pay_type);
|
||
break;
|
||
default:
|
||
this.checkEup(this.pay_type);
|
||
break;
|
||
}
|
||
}
|
||
},
|
||
//易宝
|
||
inityop_pay(data) {
|
||
if (
|
||
data.yop_pay == null ||
|
||
data.wechat == undefined ||
|
||
data.yop_pay == ""
|
||
) {
|
||
this.setData({
|
||
isyop_pay: false
|
||
});
|
||
return;
|
||
}
|
||
this.setData({
|
||
isyop_pay: true,
|
||
yop_pay: data.yop_pay
|
||
});
|
||
},
|
||
//验证易宝是否注册
|
||
checkyop_pay(type) {
|
||
//验证是否选择提现数据
|
||
if (!this._checkWithdrawToBalance()) {
|
||
return;
|
||
}
|
||
let that = this;
|
||
let urlStr = app.getNetAddresss("plugin.yop-pay.api.yop-verification");
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
//有资格提现
|
||
that.withdrawToBalance(type);
|
||
} else {
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 1500,
|
||
success: function () {
|
||
setTimeout(function () {
|
||
//要延时执行的代码
|
||
wx.navigateTo({
|
||
url: "/packageA/member/info/info"
|
||
});
|
||
}, 1500); //延迟时间
|
||
},
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
//自定义提现收入语言
|
||
customizeIncome() {
|
||
try {
|
||
var value = wx.getStorageSync('mailLanguage');
|
||
if (value) {
|
||
let mailLanguage = JSON.parse(value);
|
||
this.setData({
|
||
special_service_tax_text: mailLanguage.income.special_service_tax,
|
||
income_name_text: mailLanguage.income.income_name,
|
||
name_of_withdrawal: mailLanguage.income.name_of_withdrawal,
|
||
poundage_name: mailLanguage.income.poundage_name
|
||
});
|
||
// wx.setNavigationBarTitle({
|
||
// title: mailLanguage.income.income_name + (this.data.name_of_withdrawal ? this.data.name_of_withdrawal : '提现')
|
||
// });
|
||
}
|
||
} catch (e) {
|
||
// Do something when catch error
|
||
}
|
||
},
|
||
/****** 第三方代发相关操作 ********************/
|
||
// 获取第三方银行卡配置信息
|
||
thirdPartyBankCardInfo(){
|
||
let _this = this;
|
||
let defaultStaff = this.data.staff;
|
||
app._postNetWork({
|
||
url: app.getNetAddresss("plugin.use-staff.api.index.getInfo"),
|
||
success: function (response) {
|
||
let res = response.data;
|
||
_this.setData({
|
||
staff: Object.values(res.data).length > 0 ? res.data : defaultStaff,
|
||
third_party_show: true,
|
||
});
|
||
// 处理时间
|
||
if(res.data.account_id_start){
|
||
let start = res.data.account_id_start;
|
||
let year = start.slice(0,4);
|
||
let month = parseInt(start.slice(4,6)) - 1;
|
||
let day = start.slice(6,8);
|
||
_this.setData({
|
||
selected_time: new Date(year, month, day).getTime()
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res.msg);
|
||
}
|
||
});
|
||
},
|
||
// 关闭第三方配置弹出框
|
||
thirdPartyPopupClose(){
|
||
this.setData({
|
||
third_party_show: false
|
||
});
|
||
},
|
||
// 配置信息改变
|
||
thirdPartyConfigChange(e) {
|
||
let key = e.currentTarget.dataset.key;
|
||
let value = e.detail;
|
||
this.setData({
|
||
['staff.' + key]: value
|
||
});
|
||
},
|
||
// 显示时间选择器
|
||
showDateTime(){
|
||
this.setData({
|
||
date_time_show: true,
|
||
});
|
||
},
|
||
// 隐藏时间选择器
|
||
closeDateTime(){
|
||
this.setData({
|
||
date_time_show: false,
|
||
});
|
||
},
|
||
// 身份证有效期开始时间改变
|
||
datetimePickerChange(e){
|
||
let value = e.detail;
|
||
this.setData({
|
||
selected_time: value,
|
||
});
|
||
},
|
||
// 确认改变时间
|
||
confirmChangeDatetime(){
|
||
let datetime = this.data.selected_time;
|
||
let time = new Date(datetime);
|
||
let year = time.getFullYear() + "";
|
||
let month = time.getMonth() + 1;
|
||
let day = time.getDate();
|
||
month = month < 10 ? "0" + month : month;
|
||
day = day < 10 ? "0" + day : day;
|
||
let date = year + month + day;
|
||
this.setData({
|
||
['staff.account_id_start']: date,
|
||
date_time_show: false,
|
||
});
|
||
},
|
||
// 提交第三方配置信息
|
||
thirdPartySubmitEdit(){
|
||
let _this = this;
|
||
let staff = _this.data.staff;
|
||
let tips = '';
|
||
// 判断信息是否完善
|
||
console.log(staff);
|
||
if (app._isTextEmpty(staff.name)) tips = '请输入联系人姓名';
|
||
else if (app._isTextEmpty(staff.tel)) tips = '请输入联系人电话';
|
||
else if (staff.card_type == 2 && app._isTextEmpty(staff.bank_sub_name)) tips = '请输入开户银行支行名称';
|
||
else if (app._isTextEmpty(staff.bank_act_name)) tips = '请输入银行卡持有人姓名';
|
||
else if (app._isTextEmpty(staff.card_num)) tips = '请输入银行卡卡号';
|
||
else if (app._isTextEmpty(staff.account_id)) tips = '请输入银行卡持有人身份证号码';
|
||
else if (app._isTextEmpty(staff.account_id_start)) tips = '请选择银行卡持有人身份证有效期开始时间';
|
||
if (!app._isTextEmpty(tips)){
|
||
wx.showModal({
|
||
showCancel: false,
|
||
content: tips,
|
||
success() {}
|
||
});
|
||
return;
|
||
}
|
||
app._postNetWork({
|
||
url: app.getNetAddresss("plugin.use-staff.api.index.applyToJoin"),
|
||
data:{
|
||
info: staff
|
||
},
|
||
success: function (response) {
|
||
let res = response.data;
|
||
if(parseInt(res.result) === 1){
|
||
wx.showModal({
|
||
showCancel: false,
|
||
content: '提交成功,审核开户中...!',
|
||
success() {
|
||
_this.thirdPartyBankCardInfo();
|
||
}
|
||
});
|
||
}
|
||
else{
|
||
wx.showModal({
|
||
showCancel: false,
|
||
content: res.msg,
|
||
success() {
|
||
_this.thirdPartyBankCardInfo();
|
||
}
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log('请求失败:',res.msg);
|
||
}
|
||
});
|
||
},
|
||
// 获取签约合同信息
|
||
goToSigning(){
|
||
let _this = this;
|
||
wx.showLoading({
|
||
title: "加载中..."
|
||
});
|
||
app._postNetWork({
|
||
url: app.getNetAddresss("plugin.use-staff.api.index.getContractInfo"),
|
||
success: function (response) {
|
||
let res = response.data;
|
||
wx.hideLoading();
|
||
if(parseInt(res.result) === 1){
|
||
_this.setData({
|
||
is_show_signing: true,
|
||
signing_url: res.data.sign_url,
|
||
});
|
||
}
|
||
else{
|
||
wx.showModal({
|
||
showCancel: false,
|
||
content: res.msg,
|
||
success() {
|
||
_this.thirdPartyBankCardInfo();
|
||
}
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res.msg);
|
||
}
|
||
});
|
||
},
|
||
// 关闭签约弹框
|
||
closeSigning(){
|
||
console.log("点击关闭");
|
||
this.setData({
|
||
is_show_signing: false,
|
||
});
|
||
},
|
||
|
||
|
||
}); |