feat:礼物提现
This commit is contained in:
1 parent
f157e521e1
commit
fe226a8cb5
10 files changed
+406
-132
No files matched your search
Binary file not shown.
@@ -221,6 +221,13 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/gift/gift-record",
|
||||
"style": {
|
||||
"navigationBarTitleText": "礼物账单",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/inviter/index",
|
||||
"style": {
|
||||
@@ -508,6 +515,13 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/gift/gift-record",
|
||||
"style": {
|
||||
"navigationBarTitleText": "礼物账单",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/inviter/index",
|
||||
"style": {
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<view class="flex-col justify-center bg-[#1E1E1E] rounded-lg mx-20rpx px-30rpx py-30rpx mb-20rpx">
|
||||
<view class="flex justify-between items-center mb-10rpx">
|
||||
<text class="text-white text-base font-bold">礼物提现</text>
|
||||
<text class="text-[#D29E52] text-lg font-bold">{{ fen2yuan(item.txPrice) }} 元</text>
|
||||
</view>
|
||||
<view class="flex justify-between items-center">
|
||||
<text class="text-[#999999] text-xs">
|
||||
{{ formatDate(item.createTime) }}
|
||||
</text>
|
||||
<button v-if="item.checkStatus == 2 && item.txPrice > 0"
|
||||
class="m-0 text-xs bg-[#D29E52] text-black px-3 py-1 rounded-full"
|
||||
@tap="onRequestMerchantTransfer(item)">
|
||||
确认收款
|
||||
</button>
|
||||
<view v-else class="text-xs px-2 py-0.5 rounded" :class="{
|
||||
'text-[#409eff] bg-[#409eff]/10': item.checkStatus == 1,
|
||||
'text-[#ff9900] bg-[#ff9900]/10': item.checkStatus == 4,
|
||||
'text-[#19be6b] bg-[#19be6b]/10': item.checkStatus == 2,
|
||||
'text-[#fa3534] bg-[#fa3534]/10': ['3'].includes(item.checkStatus)
|
||||
}">
|
||||
{{ item.statusName }}
|
||||
<text v-if="item.checkStatus == 1">审核中</text>
|
||||
<text v-if="item.checkStatus == 2">已经同意</text>
|
||||
<text v-if="item.checkStatus == 3">已拒绝</text>
|
||||
<text v-if="item.checkStatus == 4">已提现</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
// @ts-ignore
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
// @ts-ignore
|
||||
import { fen2yuan, fen2yuanSimple } from '@/sheep/hooks/useGoods';
|
||||
// @ts-ignore
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
// @ts-ignore
|
||||
import PayTransferApi from '@/sheep/api/pay/transfer';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { requestMerchantTransfer } from "@/sheep/util/wechat-tool"
|
||||
|
||||
const emit = defineEmits(["onRefresh"])
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const onRequestMerchantTransfer = async (item: any) => {
|
||||
// 获取提现详情
|
||||
const { code: withdrawCode, data: withdrawData } = await RecentApi.walletTxGiftDetail({ id: item.id });
|
||||
if (withdrawCode !== 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '获取提现详情失败', icon: "none" })
|
||||
throw new Error('获取提现详情失败')
|
||||
}
|
||||
if (withdrawData.status === 11) {
|
||||
uni.showToast({ title: '该提现单已确认收款', icon: "none" })
|
||||
return;
|
||||
}
|
||||
if (!withdrawData.channelMchId || !withdrawData.channelPackageInfo) {
|
||||
uni.showToast({ title: '提现信息异常,请稍后再试', icon: "none" })
|
||||
return;
|
||||
}
|
||||
// 调用微信确认收款
|
||||
const payTransferId = withdrawData.payTransferId;
|
||||
requestMerchantTransfer(
|
||||
withdrawData.channelMchId,
|
||||
withdrawData.channelPackageInfo,
|
||||
async (res: any) => {
|
||||
if (res.result !== 'success') {
|
||||
uni.showToast({ title: res.errMsg, icon: "success" })
|
||||
return;
|
||||
}
|
||||
// 同步转账单状态
|
||||
try {
|
||||
const syncTransferResult = await PayTransferApi.syncTransfer(payTransferId);
|
||||
console.log('syncTransferResult 结果', syncTransferResult);
|
||||
} catch (e) {
|
||||
console.error('syncTransferResult 异常', e);
|
||||
}
|
||||
// 查询提现单最新状态
|
||||
const { data } = await RecentApi.walletTxGiftDetail({ id: item.id });
|
||||
if (data && data == true) {
|
||||
uni.showToast({ title: '确认收款成功,但数据存在延迟,请以实际【微信支付】到账为准', icon: "none" })
|
||||
return;
|
||||
}
|
||||
emit("onRefresh")
|
||||
},
|
||||
(err: any) => {
|
||||
console.error('微信获取佣金失败error:', err);
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<view class="flex-col justify-center bg-[#1E1E1E] rounded-lg mx-20rpx px-30rpx py-30rpx mb-20rpx">
|
||||
<view class="flex justify-between items-center mb-10rpx">
|
||||
<text class="text-white text-base font-bold">{{ item.typeName }}</text>
|
||||
<text class="text-[#D29E52] text-lg font-bold">{{ fen2yuan(item.price) }} 元</text>
|
||||
</view>
|
||||
<view class="flex justify-between items-center">
|
||||
<text class="text-[#999999] text-xs">
|
||||
{{ formatDate(item.createTime) }}
|
||||
</text>
|
||||
<button v-if="item.status === 10 && item.type === 5 && item.payTransferId > 0"
|
||||
class="m-0 text-xs bg-[#D29E52] text-black px-3 py-1 rounded-full"
|
||||
@tap="onRequestMerchantTransfer(item)">
|
||||
确认收款
|
||||
</button>
|
||||
<view v-else class="text-xs px-2 py-0.5 rounded" :class="{
|
||||
'text-[#409eff] bg-[#409eff]/10': item.status === 0,
|
||||
'text-[#ff9900] bg-[#ff9900]/10': item.status === 10,
|
||||
'text-[#19be6b] bg-[#19be6b]/10': item.status === 11,
|
||||
'text-[#fa3534] bg-[#fa3534]/10': [20, 21].includes(item.status)
|
||||
}">
|
||||
{{ item.statusName }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
|
||||
// @ts-ignore
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
// @ts-ignore
|
||||
import { fen2yuan, fen2yuanSimple } from '@/sheep/hooks/useGoods';
|
||||
// @ts-ignore
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
// @ts-ignore
|
||||
import PayTransferApi from '@/sheep/api/pay/transfer';
|
||||
import { requestMerchantTransfer } from "@/sheep/util/wechat-tool"
|
||||
|
||||
const emit = defineEmits(["onRefresh"])
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const onRequestMerchantTransfer = async (item: any) => {
|
||||
// 获取提现详情
|
||||
const { code: withdrawCode, data: withdrawData } = await BrokerageApi.getBrokerageWithdraw(item.id);
|
||||
if (withdrawCode !== 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '获取提现详情失败', icon: "none" })
|
||||
throw new Error('获取提现详情失败')
|
||||
}
|
||||
if (withdrawData.status === 11) {
|
||||
uni.showToast({ title: '该提现单已确认收款', icon: "none" })
|
||||
return;
|
||||
}
|
||||
if (!withdrawData.transferChannelMchId || !withdrawData.transferChannelPackageInfo) {
|
||||
uni.showToast({ title: '提现信息异常,请稍后再试', icon: "none" })
|
||||
return;
|
||||
}
|
||||
// 调用微信确认收款
|
||||
const payTransferId = withdrawData.payTransferId;
|
||||
requestMerchantTransfer(
|
||||
withdrawData.transferChannelMchId,
|
||||
withdrawData.transferChannelPackageInfo,
|
||||
async (res: any) => {
|
||||
if (res.result !== 'success') {
|
||||
uni.showToast({ title: res.errMsg, icon: "success" })
|
||||
return;
|
||||
}
|
||||
// 同步转账单状态
|
||||
try {
|
||||
const syncTransferResult = await PayTransferApi.syncTransfer(payTransferId);
|
||||
console.log('syncTransferResult 结果', syncTransferResult);
|
||||
} catch (e) {
|
||||
console.error('syncTransferResult 异常', e);
|
||||
}
|
||||
// 查询提现单最新状态
|
||||
const { data } = await BrokerageApi.getBrokerageWithdraw(item.id);
|
||||
if (data && data == true) {
|
||||
uni.showToast({ title: '确认收款成功,但数据存在延迟,请以实际【微信支付】到账为准', icon: "none" })
|
||||
return;
|
||||
}
|
||||
emit("onRefresh")
|
||||
},
|
||||
(err: any) => {
|
||||
console.error('微信获取佣金失败error:', err);
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="礼物提现历史记录" safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
<navigator open-type="navigateBack" hover-class="navigator-hover">
|
||||
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
|
||||
</navigator>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<scroll-list style="height: calc(100dvh - 44px - 50px)" :loadMoreStatus="loadMoreStatus" @refresh="refreshList"
|
||||
@loadMore="listLoadMore">
|
||||
<GiftRecordItem v-for="(v, i) in listData" :key="v.id" :item="v" @on-refresh="refreshList" />
|
||||
</scroll-list>
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
|
||||
import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
|
||||
import useScroll from '@/sheep/hooks/use-scroll';
|
||||
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
|
||||
import GiftRecordItem from "../components/gift-record-item.vue"
|
||||
|
||||
const { listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
RecentApi.walletTxGiftPage,
|
||||
);
|
||||
|
||||
onShow(() => {
|
||||
refreshList();
|
||||
});
|
||||
</script>
|
||||
@@ -13,7 +13,11 @@
|
||||
<wd-tab title="缘豆记录" />
|
||||
</wd-tabs>
|
||||
<view class="mt-15rpx mx-30rpx" style="height: calc(100dvh - 44px - 84rpx);">
|
||||
<scroll-list v-if="[0, 1].includes(activeTab)" class="h-full" :loadMoreStatus="loadMoreStatus"
|
||||
<scroll-list class="h-full" v-if="[0].includes(activeTab)" :loadMoreStatus="loadMoreStatus_withraw"
|
||||
@refresh="refreshList_withraw" @loadMore="listLoadMore_withraw">
|
||||
<WithrawRecordItem v-for="(v, i) in listData_withraw" :key="v.id" :item="v" />
|
||||
</scroll-list>
|
||||
<scroll-list v-else-if="[1].includes(activeTab)" class="h-full" :loadMoreStatus="loadMoreStatus"
|
||||
@refresh="refreshList" @loadMore="listLoadMore">
|
||||
<view class="flex items-center card-thin px-20rpx py-18rpx mb-15rpx" v-for="(v, i) in listData"
|
||||
:key="v.id">
|
||||
@@ -48,9 +52,12 @@ import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
|
||||
import useScroll from '@/sheep/hooks/use-scroll';
|
||||
|
||||
// @ts-ignore
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import PayWalletApi from "@/sheep/api/pay/wallet.js"
|
||||
|
||||
import WithrawRecordItem from "../components/withraw-record-item.vue"
|
||||
|
||||
const activeTab = ref(0);
|
||||
|
||||
const state = {
|
||||
@@ -63,6 +70,13 @@ const state = {
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
listData: listData_withraw,
|
||||
loadMoreStatus: loadMoreStatus_withraw,
|
||||
refreshList: refreshList_withraw,
|
||||
listLoadMore: listLoadMore_withraw,
|
||||
} = useScroll(BrokerageApi.getBrokerageWithdrawPage, {});
|
||||
|
||||
const {
|
||||
listData,
|
||||
loadMoreStatus: loadMoreStatus,
|
||||
@@ -78,17 +92,15 @@ const {
|
||||
} = useScroll(PayWalletApi.giftPage, state.giftParams);
|
||||
|
||||
onShow(() => {
|
||||
refreshList()
|
||||
refreshList_withraw()
|
||||
})
|
||||
|
||||
const tabsChange = ({ index }) => {
|
||||
if ([0, 1].includes(index)) {
|
||||
if (index == 0) {
|
||||
state.queryParams.type = 1
|
||||
}
|
||||
if (index == 1) {
|
||||
state.queryParams.type = 2
|
||||
}
|
||||
state.queryParams.type = null
|
||||
if ([0].includes(index)) {
|
||||
refreshList_withraw()
|
||||
} else if ([1].includes(index)) {
|
||||
state.queryParams.type = 2
|
||||
refreshList()
|
||||
} else if ([2].includes(index)) {
|
||||
refreshList_gift()
|
||||
|
||||
@@ -2,9 +2,18 @@
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="邀请福利" safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
<navigator open-type="navigateBack" hover-class="navigator-hover">
|
||||
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
|
||||
</navigator>
|
||||
<view class="flex items-center">
|
||||
<navigator open-type="navigateBack" hover-class="navigator-hover">
|
||||
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
|
||||
</navigator>
|
||||
<navigator url="/pages/wechat/pages/gift/gift-record" open-type="navigate"
|
||||
hover-class="navigator-hover">
|
||||
<view
|
||||
class="flex items-center rounded-full h-44rpx bg-color-theme py-1 px-2 text-black text-sm">
|
||||
历史记录
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<view class="mt-30rpx mx-30rpx">
|
||||
@@ -79,11 +88,14 @@ const state = reactive({
|
||||
}
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
const userWallet = computed(() => sheep.$store('user').userWallet);
|
||||
|
||||
onLoad((options) => {
|
||||
getTxConfig()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
getWallet();
|
||||
refreshList()
|
||||
getWithdrawableAmount()
|
||||
getChatConfig()
|
||||
@@ -100,7 +112,9 @@ const { bindWechatNum, open } = useBindWechat(() => {
|
||||
getTxConfig()
|
||||
})
|
||||
|
||||
|
||||
const getWallet = () => {
|
||||
sheep.$store('user').getWallet();
|
||||
};
|
||||
|
||||
// 查询可以提现的礼物金额
|
||||
const getWithdrawableAmount = async () => {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<navigator open-type="navigateBack" hover-class="navigator-hover">
|
||||
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
|
||||
</navigator>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<navigator url="/pages/wechat/pages/withraw-record" open-type="navigate"
|
||||
hover-class="navigator-hover">
|
||||
<view
|
||||
@@ -14,7 +13,6 @@
|
||||
历史记录
|
||||
</view>
|
||||
</navigator>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
@@ -29,7 +27,16 @@
|
||||
placeholder="请输入提现金额" />
|
||||
</view>
|
||||
<view class="flex justify-between items-center m-t-20rpx">
|
||||
<text>可提现金额{{ fen2yuanSimple(state.summary.brokeragePrice) }}元</text>
|
||||
<text>
|
||||
<text>可提现金额</text>
|
||||
<text class="text-#D29E52">{{ fen2yuanSimple(state.maxPrice) }}</text>
|
||||
<text v-if="pageType == 'yj'">元</text>
|
||||
<text v-if="pageType == 'gift'">
|
||||
<text>缘豆合计</text>
|
||||
<text class="text-#D29E52">{{ ydPrice }}</text>
|
||||
<text>元</text>
|
||||
</text>
|
||||
</text>
|
||||
<text @tap="doTxAll">全部提现</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -62,7 +69,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { computed, reactive, ref, nextTick } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
|
||||
import { fen2yuanSimple } from '@/sheep/hooks/useGoods';
|
||||
@@ -71,25 +78,32 @@ import RecentApi from '@/sheep/api/member/recent';
|
||||
import TradeConfigApi from '@/sheep/api/trade/config.js';
|
||||
import { useMessage } from '@/uni_modules/wot-design-uni';
|
||||
import useBindWechat from "@/sheep/hooks/use-bind-wechat"
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const message = useMessage('xyBox');
|
||||
|
||||
const state = reactive({
|
||||
price: 0,
|
||||
maxPrice: 0,
|
||||
wechatNum: '',
|
||||
summary: {
|
||||
// 可提现金额
|
||||
brokeragePrice: ""
|
||||
},
|
||||
giftCashRatio: 0,
|
||||
config: {
|
||||
// 分销提现最低金额
|
||||
brokerageWithdrawMinPrice: ""
|
||||
}
|
||||
},
|
||||
})
|
||||
const nodes = ref('');
|
||||
// 页面类型yj:分销(子级购买);gift:礼物
|
||||
const pageType = ref('yj')
|
||||
|
||||
const userWallet = computed(() => sheep.$store('user').userWallet);
|
||||
const ydPrice = computed(() => {
|
||||
if (!state.giftCashRatio) return 0
|
||||
if (!state.maxPrice) return 0
|
||||
return fen2yuanSimple((state.maxPrice / state.giftCashRatio).toFixed(2))
|
||||
});
|
||||
|
||||
const { bindWechatNum, open: openBindWechat } = useBindWechat(() => {
|
||||
getTxConfig()
|
||||
})
|
||||
@@ -102,9 +116,22 @@ onLoad((options) => {
|
||||
onShow(() => {
|
||||
getTxConfig()
|
||||
getTradeConfig()
|
||||
getBrokerageUserSummary()
|
||||
getChatConfig()
|
||||
// 获取总金额
|
||||
if (pageType.value === "yj") {
|
||||
getBrokerageUserSummary()
|
||||
}
|
||||
if (pageType.value === "gift") {
|
||||
getWallet()
|
||||
}
|
||||
})
|
||||
|
||||
const getWallet = async () => {
|
||||
await sheep.$store('user').getWallet();
|
||||
state.maxPrice = userWallet.value?.giftBalance || 0;
|
||||
|
||||
};
|
||||
|
||||
// 提现
|
||||
const doTx = async () => {
|
||||
uni.showLoading({ title: '申请提现中...', mask: true })
|
||||
@@ -114,31 +141,45 @@ const doTx = async () => {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const price = Number(state.price) * 100
|
||||
const data = {
|
||||
// 3:微信;5:微信零钱;
|
||||
type: 5,
|
||||
price: price,
|
||||
accountNo: state.wechatNum,
|
||||
channelExtras: {
|
||||
sceneId: '1005',
|
||||
sceneReportInfos: [
|
||||
{
|
||||
"info_type": "活动名称",
|
||||
"info_content": "佣金提现"
|
||||
},
|
||||
{
|
||||
"info_type": "奖励说明",
|
||||
"info_content": `提现${fen2yuanSimple(price)}元`
|
||||
},
|
||||
]
|
||||
if (pageType.value === "yj") {
|
||||
const price = Number(state.price) * 100
|
||||
const data = {
|
||||
// 3:微信;5:微信零钱;
|
||||
type: 5,
|
||||
price: price,
|
||||
accountNo: state.wechatNum,
|
||||
channelExtras: {
|
||||
sceneId: '1005',
|
||||
sceneReportInfos: [
|
||||
{
|
||||
"info_type": "活动名称",
|
||||
"info_content": "佣金提现"
|
||||
},
|
||||
{
|
||||
"info_type": "奖励说明",
|
||||
"info_content": `提现${fen2yuanSimple(price)}元`
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
const { code: createCode, data: createData } = await BrokerageApi.createBrokerageWithdraw(data);
|
||||
if (createCode !== 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '申请提现失败', icon: "none" })
|
||||
throw new Error('申请提现失败')
|
||||
}
|
||||
}
|
||||
const { code: createCode, data: createData } = await BrokerageApi.createBrokerageWithdraw(data);
|
||||
if (createCode !== 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '申请提现失败', icon: "none" })
|
||||
throw new Error('申请提现失败')
|
||||
if (pageType.value === "gift") {
|
||||
const data = {
|
||||
giftPrice: state.price * state.giftCashRatio * 100,
|
||||
wechatNum: state.wechatNum,
|
||||
}
|
||||
const { code: createCode, data: createData } = await RecentApi.walletTxGiftApply(data);
|
||||
if (createCode !== 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '申请提现失败', icon: "none" })
|
||||
throw new Error('申请提现失败')
|
||||
}
|
||||
}
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '申请提现成功', icon: "success" })
|
||||
@@ -171,8 +212,14 @@ const doBindWechatNum = () => {
|
||||
const doTxAll = async () => {
|
||||
try {
|
||||
uni.showLoading({ title: '计算中...', mask: true })
|
||||
await getBrokerageUserSummary()
|
||||
state.price = fen2yuanSimple(state.summary.brokeragePrice)
|
||||
if (pageType.value === "yj") {
|
||||
await getBrokerageUserSummary()
|
||||
state.price = fen2yuanSimple(state.maxPrice)
|
||||
}
|
||||
if (pageType.value === "gift") {
|
||||
await getWallet()
|
||||
state.price = ydPrice.value
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("|全部提现|,意外的错误error:", error);
|
||||
} finally {
|
||||
@@ -180,6 +227,16 @@ const doTxAll = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取聊天配置
|
||||
const getChatConfig = async () => {
|
||||
try {
|
||||
const { data } = await RecentApi.reportType()
|
||||
state.giftCashRatio = data?.giftCashRatio ?? 0
|
||||
} catch (error) {
|
||||
console.log("|获取聊天配置|,意外的错误error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取提现配置
|
||||
const getTxConfig = async () => {
|
||||
try {
|
||||
@@ -208,7 +265,7 @@ const getTradeConfig = async () => {
|
||||
const getBrokerageUserSummary = async () => {
|
||||
let { code, data } = await BrokerageApi.getBrokerageUserSummary();
|
||||
if (code != 0) return
|
||||
state.summary = data || {};
|
||||
state.maxPrice = data.brokeragePrice || 0;
|
||||
}
|
||||
|
||||
async function alert() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="提现历史记录" safeAreaInsetTop :bordered="false">
|
||||
<wd-navbar title="佣金提现历史记录" safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
<navigator open-type="navigateBack" hover-class="navigator-hover">
|
||||
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
|
||||
@@ -9,49 +9,19 @@
|
||||
</wd-navbar>
|
||||
<scroll-list style="height: calc(100dvh - 44px - 50px)" :loadMoreStatus="loadMoreStatus" @refresh="refreshList"
|
||||
@loadMore="listLoadMore">
|
||||
<view class="flex-col justify-center bg-[#1E1E1E] rounded-lg mx-20rpx px-30rpx py-30rpx mb-20rpx"
|
||||
v-for="(v, i) in listData" :key="v.id">
|
||||
<view class="flex justify-between items-center mb-10rpx">
|
||||
<text class="text-white text-base font-bold">{{ v.typeName }}</text>
|
||||
<text class="text-[#D29E52] text-lg font-bold">{{ fen2yuan(v.price) }} 元</text>
|
||||
</view>
|
||||
<view class="flex justify-between items-center">
|
||||
<text class="text-[#999999] text-xs">
|
||||
{{ formatDate(v.createTime) }}
|
||||
</text>
|
||||
{{ v.status }}
|
||||
<button v-if="v.status === 10 && v.type === 5 && v.payTransferId > 0"
|
||||
class="m-0 text-xs bg-[#D29E52] text-black px-3 py-1 rounded-full"
|
||||
@tap="onRequestMerchantTransfer(v)">
|
||||
确认收款
|
||||
</button>
|
||||
<view v-else class="text-xs px-2 py-0.5 rounded" :class="{
|
||||
'text-[#409eff] bg-[#409eff]/10': v.status === 0,
|
||||
'text-[#ff9900] bg-[#ff9900]/10': v.status === 10,
|
||||
'text-[#19be6b] bg-[#19be6b]/10': v.status === 11,
|
||||
'text-[#fa3534] bg-[#fa3534]/10': [20, 21].includes(v.status)
|
||||
}">
|
||||
{{ v.statusName }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<WithrawRecordItem v-for="(v, i) in listData" :key="v.id" :item="v" @on-refresh="refreshList" />
|
||||
</scroll-list>
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
// @ts-ignore
|
||||
import { fen2yuan, fen2yuanSimple } from '@/sheep/hooks/useGoods';
|
||||
// @ts-ignore
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
// @ts-ignore
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
// @ts-ignore
|
||||
import PayTransferApi from '@/sheep/api/pay/transfer';
|
||||
import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
|
||||
import useScroll from '@/sheep/hooks/use-scroll';
|
||||
import { requestMerchantTransfer } from "@/sheep/util/wechat-tool"
|
||||
|
||||
import WithrawRecordItem from "./components/withraw-record-item.vue"
|
||||
|
||||
const { listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
BrokerageApi.getBrokerageWithdrawPage,
|
||||
@@ -60,50 +30,4 @@ const { listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
onShow(() => {
|
||||
refreshList();
|
||||
});
|
||||
|
||||
const onRequestMerchantTransfer = async (item: any) => {
|
||||
// 获取提现详情
|
||||
const { code: withdrawCode, data: withdrawData } = await BrokerageApi.getBrokerageWithdraw(item.id);
|
||||
if (withdrawCode !== 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '获取提现详情失败', icon: "none" })
|
||||
throw new Error('获取提现详情失败')
|
||||
}
|
||||
if (withdrawData.status === 11) {
|
||||
uni.showToast({ title: '该提现单已确认收款', icon: "none" })
|
||||
return;
|
||||
}
|
||||
if (!withdrawData.transferChannelMchId || !withdrawData.transferChannelPackageInfo) {
|
||||
uni.showToast({ title: '提现信息异常,请稍后再试', icon: "none" })
|
||||
return;
|
||||
}
|
||||
// 调用微信确认收款
|
||||
const payTransferId = withdrawData.payTransferId;
|
||||
requestMerchantTransfer(
|
||||
withdrawData.transferChannelMchId,
|
||||
withdrawData.transferChannelPackageInfo,
|
||||
async (res: any) => {
|
||||
if (res.result !== 'success') {
|
||||
uni.showToast({ title: res.errMsg, icon: "success" })
|
||||
return;
|
||||
}
|
||||
// 同步转账单状态
|
||||
try {
|
||||
const syncTransferResult = await PayTransferApi.syncTransfer(payTransferId);
|
||||
console.log('syncTransferResult 结果', syncTransferResult);
|
||||
} catch (e) {
|
||||
console.error('syncTransferResult 异常', e);
|
||||
}
|
||||
// 查询提现单最新状态
|
||||
const { data } = await BrokerageApi.getBrokerageWithdraw(item.id);
|
||||
if (data && data.status !== 11) {
|
||||
uni.showToast({ title: '确认收款成功,但数据存在延迟,请以实际【微信支付】到账为准', icon: "none" })
|
||||
return;
|
||||
}
|
||||
},
|
||||
(err: any) => {
|
||||
console.error('微信获取佣金失败error:', err);
|
||||
}
|
||||
)
|
||||
}
|
||||
</script>
|
||||
@@ -553,6 +553,33 @@ const RecentApi = {
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 礼物申请提现
|
||||
walletTxGiftApply: (data: any) => {
|
||||
return request({
|
||||
url: '/pay/wallet-tx-auth/gift/apply',
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
},
|
||||
|
||||
// 礼物提现记录
|
||||
walletTxGiftPage: (params: any) => {
|
||||
return request({
|
||||
url: '/pay/wallet-tx-auth/gift/page',
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
},
|
||||
|
||||
// 礼物提现记录
|
||||
walletTxGiftDetail: (params: any) => {
|
||||
return request({
|
||||
url: '/pay/wallet-tx-auth/detail',
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default RecentApi;
|
||||
Reference in new issue
Block a user