Browse Source

finish tid1819

tid1878
刘嘉炜 3 months ago
parent
commit
eca5172b02
  1. 6
      src/pages.json
  2. 3
      src/subpackage/wallet/js/api.js
  3. 15
      src/subpackage/wallet/pages/douyin_withdraw/index.vue
  4. 72
      src/subpackage/wallet/pages/index/index.vue
  5. 82
      src/subpackage/wallet/pages/index/modules/recharge_modal.vue
  6. 6
      src/subpackage/wallet/pages/index/modules/wallet_info.vue
  7. 141
      src/subpackage/wallet/pages/index/recharge_record.vue

6
src/pages.json

@ -759,6 +759,12 @@
}
},
{
"path": "pages/index/recharge_record",
"style" : {
"navigationBarTitleText": "充值记录"
}
},
{
"path": "pages/douyin_withdraw/index",
"style" : {
"navigationBarTitleText": "平台提现"

3
src/subpackage/wallet/js/api.js

@ -8,6 +8,9 @@ export const WALLET_API = {
// 宝付
getPayAssureConfigs:`${ORIGIN}/admin/pay/assure/getPayAssureConfigs`, // 查看可选择的支付账户列表
baofuV2Gateway:`${ORIGIN}/admin/pay/assure/baofuV2/gateway`, // 宝付v2获取金额信息
// tid1819
wxpayinfo:`${ORIGIN}/admin/assistant/merchantwallet/wxpayinfo`, // 这个是充值
rechargeList:`${ORIGIN}/admin/merchantwallet/recharge/list`, // 这是充值记录
}
export default WALLET_API;

15
src/subpackage/wallet/pages/douyin_withdraw/index.vue

@ -5,14 +5,14 @@
title="微信平台可提现资金"
:balance="formatMoney(balanceInfo.total_amount_of_wechat)"
type="wx"
@click:extract="applyBtn(1)"
@click:extract="applyBtn(1, balanceInfo.total_amount_of_wechat)"
></platform-item>
<view class="dw-space"></view>
<platform-item
title="抖音平台可提现资金"
:balance="formatMoney(balanceInfo.total_amount_of_douyin)"
type="dy"
@click:extract="applyBtn(0)"
@click:extract="applyBtn(0, balanceInfo.total_amount_of_douyin)"
></platform-item>
<view class="dw-space"></view>
@ -26,7 +26,7 @@
<script>
import { WALLET_API } from '../../js/api';
import servers from '../../js/server';
import { routeTo, showLoad, hideLoad } from '@/utils/util';
import { routeTo, showLoad, hideLoad, showModal } from '@/utils/util';
import platformItem from "./modules/platform_item.vue";
export default {
@ -58,7 +58,14 @@ export default {
},
//
// md241024 241113 01
applyBtn(source){
applyBtn(source, balance){
if(!isNaN(balance) && balance < 0)return showModal({
content: '系统检测到您在欧轩有未支付的账单,请先完成支付后再提现。点击“前往”跳转钱包页面',
confirmText: '前往',
success: res=>{
if(res.confirm)routeTo();
}
})
routeTo(`/subpackage/wallet/pages/douyin_withdraw/apply?brand_id=${this.brand_id}&source=${source}`, 'nT');
},
/**

72
src/subpackage/wallet/pages/index/index.vue

@ -5,6 +5,8 @@
@click:douyin="dyBtnClick"
@click:baofu="bfBtnClick"
@click:admin="toWebView"
@click:recharge="rechargeBtn"
@click:record="toRechargeRecord"
></wallet-info>
<view class="wi-tips">
<view class="wt-tit">温馨提示</view>
@ -17,20 +19,28 @@
</text>
</view>
</view>
<wallet-modal v-if="false"></wallet-modal>
<wallet-modal-success ref="walletModalSuccess" :title="'充值成功'">
<template v-slot:tip>充值成功</template>
<template v-slot:btn>充值记录</template>
</wallet-modal-success>
<recharge-modal :balance="balance" ref="rechargeModal"></recharge-modal>
</view>
</template>
<script>
import walletInfo from './modules/wallet_info.vue'
import walletModalSuccess from '../../components/wallet_modal_success.vue'
import walletModalSuccess from '../../components/wallet_modal_success.vue';
import rechargeModal from "./modules/recharge_modal.vue";
import { WALLET_API } from '../../js/api';
import servers from '../../js/server';
import { routeTo, showLoad, hideLoad } from '@/utils/util';
import { routeTo, showLoad, hideLoad, debounce, showModal } from '@/utils/util';
export default {
components: {
'wallet-info': walletInfo,
'wallet-modal': walletModalSuccess,
walletModalSuccess,
rechargeModal
},
data(){
return {
@ -44,7 +54,32 @@ export default {
this.getWalletBalance(options.brand_id);
console.log(uni.getAccountInfoSync().miniProgram)
},
onReady(){
// this.$refs?.walletModalSuccess?.alert();
},
methods: {
toRechargeRecord(){
let { brand_id } = this;
routeTo(`/subpackage/wallet/pages/index/recharge_record?brand_id=${brand_id ?? ''}`, 'nT');
},
rechargeBtn: debounce(function(){
let { brand_id } = this;
this.$refs?.rechargeModal?.show?.({
success: async num =>{
let { wxpay_info } = await this.getPayInfo({ brand_id, pay_amount: num });
uni.requestPayment({
...wxpay_info,
success: res => {
this.$refs?.walletModalSuccess?.alert?.();
},
fail: err => {
console.log('wallet index rechargeBtn fail --->', err);
if(err?.errMsg?.indexOf?.('cancel') === -1)showModal({ content: err?.errMsg ?? '支付失败!' })
}
})
}
})
}, 300, true),
toWebView(){
routeTo(`/pages/web_view/web_view?src=${encodeURIComponent(this.getAdminAddress())}`,'nT');
},
@ -82,7 +117,34 @@ export default {
bfBtnClick(){
routeTo(`/subpackage/wallet/pages/baofu_withdraw/index?brand_id=${this.brand_id ?? ''}`, 'nT');
}
},
//
getPayInfo({ brand_id, pay_amount }){
showLoad();
return servers.post({
url: WALLET_API.wxpayinfo,
data: { brand_id, pay_amount },
isDefaultGet: false,
})
.then(res => {
hideLoad();
let _data = res?.data || {};
if(_data.code === 0){
return _data?.data ?? {};
}else{
return Promise.reject(_data);
}
})
.catch(err => {
hideLoad();
showModal({
title: '提示',
content: err.message || '加载支付信息失败!'
})
console.warn('wallet index getPayInfo err --->', err);
// return Promise.reject(err);
})
},
}
}
</script>

82
src/subpackage/wallet/pages/index/modules/recharge_modal.vue

@ -0,0 +1,82 @@
<template>
<wallet-modal title="充值" :show="isShow" @click:close="hide">
<view class="recharge-container">
<view class="rc-balance">
<text class="rb-txt">钱包余额</text>
{{ balance || 0 }}
</view>
<input type="digit" class="rc-ipt" v-model="iptNum" placeholder="请输入金额">
<view class="rc-btns">
<wm-button @click="hide">取消</wm-button>
<wm-button green @click="confirmBtn">确认</wm-button>
</view>
</view>
</wallet-modal>
</template>
<script>
import walletModal from '../../../components/wallet_modal.vue';
import wmButton from '../../../components/wm_button.vue';
import { showNone } from '@/utils/util';
export default {
props: {
balance: {
type: Number,
default: 0
}
},
components: {
walletModal,
wmButton,
},
data() {
return {
isShow: false,
iptNum: '',
initData: {},
}
},
methods: {
show(data){
this.isShow = true;
this.initData = data ?? {};
},
hide(){
this.isShow = false;
},
confirmBtn(){
let { initData, iptNum, hide } = this;
if(!iptNum || isNaN(iptNum) || Number(iptNum) <= 0)return showNone('请输入正确金额!');
initData?.success?.(iptNum);
hide();
}
}
}
</script>
<style lang="scss">
.recharge-container{
padding: 0 50upx;
.rc-balance{
margin-top: 60upx;
@include flcw(28upx, 40upx, $mColor);
@include tHide;
.rb-txt{
color: #1A1A1A;
}
}
.rc-ipt{
margin-top: 20upx;
padding: 0 20upx;
display: block;
height: 108upx;
border-radius: 10upx;
background: #F2F2F7;
@include flcw(32upx, 44upx, #1A1A1A);
}
.rc-btns{
margin-top: 80upx;
@include ctf(space-between);
}
}
</style>

6
src/subpackage/wallet/pages/index/modules/wallet_info.vue

@ -7,10 +7,10 @@
<view class="wi-account">
<veiw class="wa-top">
<view class="wt-name">欧轩内部钱包账户余额</view>
<!-- <view class="wt-record">
<view class="wt-record" @click="$emit('click:record')">
<text>充值记录</text>
<image class="wr-icon" mode="aspect" src="/subpackage/wallet/static/images/arrow_b2.png"></image>
</view> -->
</view>
</veiw>
<view class="wa-tip">(用于购买服务使用)</view>
<view class="wa-balance">
@ -18,7 +18,7 @@
<text class="wm-unit">¥</text>
{{ balance }}
</view>
<!-- <view class="wb-btn">充值</view> -->
<view class="wb-btn" @click="$emit('click:recharge')">充值</view>
</view>
</view>
<view class="wi-btns">

141
src/subpackage/wallet/pages/index/recharge_record.vue

@ -0,0 +1,141 @@
<template>
<view class="recharge-record">
<filtrate-bar
:filter-list="['全部', '已完成', '已退款']"
ref="filtrateBar"
@change:times="timesChange"
@change:filter="filterBtn"
></filtrate-bar>
<view class="rr-ls">
<view class="rl-item" v-for="(e, i) in rechargeList" :key="i">
<record-line name="充值金额" :tag="getTagTxt(e.pay_status)" >{{ e.amount || 0 }}</record-line>
<record-line name="充值单号">{{ e.order_no || '-' }}</record-line>
<record-line name="充值时间">{{ e.pay_time || '-' }}</record-line>
<record-line name="支付方式">{{ e.pay_type || '-' }}</record-line>
<record-line name="交易流水号">{{ e.trans_no || '-' }}</record-line>
<record-line name="充值途径">{{ e.optsourse || '-' }}</record-line>
</view>
</view>
</view>
<!-- 充值金额12.00
充值单号TX20191017898999
充值时间2024-10-17 12:12:12
支付方式微信支付
交易流水号4002676665666
充值途径商家助手刘晓 -->
</template>
<script>
import filtrateBar from '../../components/filtrate_bar.vue';
import recordLine from '../../components/record_line.vue';
import { WALLET_API } from '../../js/api';
import servers from '../../js/server';
import { routeTo, showLoad, hideLoad, debounce, showModal, showNone } from '@/utils/util';
export default {
components: {
filtrateBar,
recordLine,
},
data(){
return {
rechargeList: [],
page: 1,
brand_id: '',
stime: '',
etime: '',
status: '' // 0:, 1:, 2:退
}
},
onLoad(opts){
let _bid = opts?.brand_id ?? '';
this.brand_id = _bid;
let { startDate, endDate } = this.$refs.filtrateBar.getTimes();
this.stime = startDate;
this.etime = endDate;
this.getRechargeList({ brand_id: _bid, stime: startDate, etime: endDate });
},
onReachBottom(){
let { brand_id, page, stime, etime } = this;
this.getRechargeList({ brand_id, page: ++page, stime, etime });
},
methods: {
getTagTxt(status = ''){
return status === 0 ? '未支付' :
status === 1 ? '已完成' :
status === 2 ? '已退款' : '';
},
timesChange(e){
let { startDate, endDate } = e;
this.stime = startDate ?? '';
this.etime = endDate ?? '';
this.refreshLs();
},
filterBtn(idx) {
let _status = idx === 0 ? '' : idx;
this.status = _status;
this.refreshLs();
},
refreshLs(){
let { brand_id, stime, etime, status } = this;
this.page = 1;
this.rechargeList = [];
this.getRechargeList({
brand_id: brand_id,
pay_status: status,
stime,
etime,
});
},
//
getRechargeList({ brand_id, pay_status = '', stime = '', etime = '', page_size = 20, page = 1 }){
showLoad();
return servers.post({
url: WALLET_API.rechargeList,
data: { brand_id, pay_status, stime, etime, page_size, page },
isDefaultGet: false,
})
.then(res => {
hideLoad();
let _data = res?.data || {};
if(_data.code === 0){
let _ls = _data?.data?.list || [];
if(page === 1)return this.rechargeList = _ls;
if(_ls?.length <= 0)return showNone('没有更多!');
this.rechargeList = [ ...this.rechargeList, ..._ls ];
this.page = page;
}else{
return Promise.reject(_data);
}
})
.catch(err => {
hideLoad();
showModal({
title: '提示',
content: err.message || '加载失败!'
})
console.warn('wallet index getPayInfo err --->', err);
// return Promise.reject(err);
})
},
}
}
</script>
<style lang="scss">
.recharge-record{
}
.rr-ls{
padding: 24upx;
.rl-item{
padding: 26upx 20upx;
border-radius: 10upx;
background: #fff;
&+ .rl-item{
margin-top: 24upx;
}
}
}
</style>
Loading…
Cancel
Save