| | |
| | | */ |
| | | onPullDownRefresh() { |
| | | this.setData({ |
| | | pageCurr: 1 |
| | | pageCurr: 1, |
| | | }) |
| | | this.getRechargList() |
| | | this.getRechargList(true) |
| | | }, |
| | | |
| | | /** |
| | |
| | | signType: data.content.signType, |
| | | paySign: data.content.paySign, |
| | | success(res) { |
| | | wx.showToast({ |
| | | title: "充值成功", |
| | | icon: 'success', |
| | | duration: 3000 |
| | | }) |
| | | console.log('支付成功', res); |
| | | this. getRechargList(true); |
| | | }, |
| | | fail(err) { |
| | | console.log('支付失败', err); |
| | |
| | | }); |
| | | }, |
| | | //获取充值记录 |
| | | getRechargList() { |
| | | getRechargList(isRefresh) { |
| | | const params = { |
| | | url: 'wx/virtual_card/getVcRechargeRecords', |
| | | data: { |
| | |
| | | }; |
| | | get(params).then(data => { |
| | | this.setData({ |
| | | allRechargeList:this.data.allRechargeList.concat( data.content.obj), |
| | | allRechargeList: isRefresh ? data.content.obj : this.data.allRechargeList.concat(data.content.obj), |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | loading: false, |
| | | hasMore: !data.content.obj.pageTotal === this.data.pageCurr |
| | | hasMore: this.data.pageCurr < data.content.pageTotal |
| | | }) |
| | | this.updateDisplayText(); |
| | | }).catch(err => { |
| | |
| | | }) |
| | | }); |
| | | }, |
| | | // 生成支付签名的函数 |
| | | generatePaySign(params) { |
| | | const sortedKeys = Object.keys(params).sort(); |
| | | const stringToSign = sortedKeys.map(key => `${key}=${params[key]}`).join('&') + `&key=your-mch-key`; |
| | | return md5(stringToSign).toUpperCase(); |
| | | }, |
| | | |
| | | //加载更多 |
| | | loadMore() { |
| | | if (this.data.hasMore && !this.data.loading) { |