|
|
@@ -11,7 +11,8 @@ Page({
|
|
|
cashList: [],
|
|
|
cashList_more: true,
|
|
|
cashList_change: false,
|
|
|
- cashTotal: 0
|
|
|
+ cashTotal: 0,
|
|
|
+ confirmedTransferIds: {}
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
@@ -67,7 +68,14 @@ Page({
|
|
|
cashList_change: false
|
|
|
})
|
|
|
}
|
|
|
- var result = that.data.cashList.concat(res.data.list || [])
|
|
|
+ var confirmedTransferIds = that.data.confirmedTransferIds || {}
|
|
|
+ var list = res.data.list || []
|
|
|
+ list.forEach(function (item) {
|
|
|
+ if (confirmedTransferIds[item.id]) {
|
|
|
+ item.can_confirm_transfer = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var result = that.data.cashList.concat(list)
|
|
|
var listMore = res.data.list_count > result.length
|
|
|
that.setData({
|
|
|
cashList: result,
|
|
|
@@ -80,6 +88,9 @@ Page({
|
|
|
var that = this
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var item = that.data.cashList[index] || {}
|
|
|
+ if (item.confirming_transfer) {
|
|
|
+ return
|
|
|
+ }
|
|
|
if (!item.can_confirm_transfer || !item.package_info) {
|
|
|
wx.showToast({
|
|
|
title: '当前提现无需确认收款',
|
|
|
@@ -96,6 +107,12 @@ Page({
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ var cashList = that.data.cashList
|
|
|
+ cashList[index].can_confirm_transfer = false
|
|
|
+ cashList[index].confirming_transfer = true
|
|
|
+ that.setData({
|
|
|
+ cashList: cashList
|
|
|
+ })
|
|
|
wx.requestMerchantTransfer({
|
|
|
mchId: String(item.mch_id || ''),
|
|
|
appId: String(item.app_id || ''),
|
|
|
@@ -106,14 +123,25 @@ Page({
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
})
|
|
|
+ var confirmedTransferIds = that.data.confirmedTransferIds || {}
|
|
|
+ confirmedTransferIds[item.id] = true
|
|
|
that.setData({
|
|
|
page: 1,
|
|
|
cashList_more: true,
|
|
|
- cashList_change: true
|
|
|
+ cashList_change: true,
|
|
|
+ confirmedTransferIds: confirmedTransferIds
|
|
|
})
|
|
|
that.getCashList()
|
|
|
},
|
|
|
fail: function (res) {
|
|
|
+ var cashList = that.data.cashList
|
|
|
+ if (cashList[index]) {
|
|
|
+ cashList[index].can_confirm_transfer = true
|
|
|
+ cashList[index].confirming_transfer = false
|
|
|
+ that.setData({
|
|
|
+ cashList: cashList
|
|
|
+ })
|
|
|
+ }
|
|
|
wx.showToast({
|
|
|
title: (res && res.errMsg) ? res.errMsg : '确认收款失败',
|
|
|
icon: 'none',
|