feat:bug修改

This commit is contained in:
dzc committed 2025-12-26 11:08:40 +08:00
1 parent 2615650564
commit ad40673da4
19 files changed
+569 -207

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ SHOPRO_VERSION=v2.4.1
SHOPRO_API_PATH=/app-api
# 后端接口 - 测试环境(通过 process.env.NODE_ENV == development)
# SHOPRO_DEV_BASE_URL=http://127.0.0.1:48083
# SHOPRO_DEV_BASE_URL=http://192.168.68.52:48083
# SHOPRO_DEV_BASE_URL = https://chatapi.zianxin.com
SHOPRO_DEV_BASE_URL=https://rj4jv5rwqs.by.takin.cc
+5 -1
View File
@@ -108,6 +108,9 @@
}
</style>
<style type="text/css">
#txt-title{
color: white;
}
@media (min-width: 765px) {
.pc {
display: block
@@ -209,6 +212,7 @@
line-height: .5rem;
letter-spacing: 3px;
margin-top: .2rem;
color: white;
}
.top-box p {
@@ -270,7 +274,7 @@
<body>
<div class="msite container">
<div class="top-box">
<img class="logo-ico" src="./bg-image.png" alt="logo">
<img class="logo-ico" src="./logo.png" alt="logo">
<p id='txt-title'>荷塘月色</p>
<div class="sub-title">同城交友平台</div>
</div>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

+3 -3
View File
@@ -122,9 +122,9 @@
"iosStyle" : "common",
"useOriginalMsgbox" : true,
"android" : {
"hdpi" : "unpackage/res/icons/launch-bg.png",
"xhdpi" : "unpackage/res/icons/launch-bg.png",
"xxhdpi" : "unpackage/res/icons/launch-bg.png"
"hdpi" : "unpackage/res/splash_screen/480x762.png",
"xhdpi" : "unpackage/res/splash_screen/720x1242.png",
"xxhdpi" : "unpackage/res/splash_screen/1080x1882.png"
}
},
"icons" : {
+7
View File
@@ -417,6 +417,13 @@
"navigationBarTitleText": "邀请历史",
"navigationStyle": "custom"
}
},
{
"path": "pages/withdraw",
"style": {
"navigationBarTitleText": "提现",
"navigationStyle": "custom"
}
}
]
}
+107 -136
View File
@@ -9,24 +9,12 @@
<view class="flex w-full flex-col items-center gap-40rpx">
<view class="relative flex w-full items-center">
<input
class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white"
type="number"
placeholder="请输入手机号"
placeholder-style="color: rgba(255, 255, 255, 0.6)"
v-model="phone"
maxlength="11"
/>
<input class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white" type="number"
placeholder="请输入手机号" placeholder-style="color: rgba(255, 255, 255, 0.6)" v-model="phone" maxlength="11" />
</view>
<view class="relative flex w-full items-center">
<input
class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white"
type="number"
placeholder="验证码"
placeholder-style="color: rgba(255, 255, 255, 0.6)"
v-model="smsCode"
maxlength="4"
/>
<input class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white" type="number"
placeholder="验证码" placeholder-style="color: rgba(255, 255, 255, 0.6)" v-model="smsCode" maxlength="4" />
<view class="absolute right-20rpx text-12px flex-row-center">
<wd-button @click="handleGetCode" :disabled="isTiming" size="medium">
<text>获取验证码</text><text v-if="isTiming"> ({{ countDown }}s)</text>
@@ -34,30 +22,21 @@
</view>
</view>
</view>
<view
class="mt-40rpx w-full rounded-full bg-color-theme-dark active:bg-color-theme text-lg text-center py-2"
@click="handleLogin"
>
<view class="mt-40rpx w-full rounded-full bg-color-theme-dark active:bg-color-theme text-lg text-center py-2"
@click="handleLogin">
登 录 / 注 册
</view>
</view>
<view
class="flex items-center justify-center flex-wrap px-20rpx absolute bottom-40rpx text-center text-14px text-white"
>
class="flex items-center justify-center flex-wrap px-20rpx absolute bottom-40rpx text-center text-14px text-white">
<wd-checkbox v-model="isAgree" />
<text>我已阅读并同意</text>
<text
class="text-#D29E52 underline underline-1 underline-solid underline-amber"
@click="alert(2, '用户协议')"
>
<text class="text-#D29E52 underline underline-1 underline-solid underline-amber" @click="alert(2, '用户协议')">
《用户协议》
</text>
<text>和</text>
<text
class="text-#D29E52 underline underline-1 underline-solid underline-amber"
@click="alert(3, '隐私政策')"
>
<text class="text-#D29E52 underline underline-1 underline-solid underline-amber" @click="alert(3, '隐私政策')">
《隐私政策》
</text>
并同意授权
@@ -68,21 +47,13 @@
<rich-text :nodes="nodes"></rich-text>
</wd-message-box>
<wd-message-box selector="agreeBox">
<view
class="flex items-center justify-center flex-wrap px-20rpx text-center text-14px text-white"
>
<view class="flex items-center justify-center flex-wrap px-20rpx text-center text-14px text-white">
<text>我已阅读并同意</text>
<text
class="text-#D29E52 underline underline-1 underline-solid underline-amber"
@click="alert(2, '用户协议')"
>
<text class="text-#D29E52 underline underline-1 underline-solid underline-amber" @click="alert(2, '用户协议')">
《用户协议》
</text>
<text>和</text>
<text
class="text-#D29E52 underline underline-1 underline-solid underline-amber"
@click="alert(3, '隐私政策')"
>
<text class="text-#D29E52 underline underline-1 underline-solid underline-amber" @click="alert(3, '隐私政策')">
《隐私政策》
</text>
并同意授权
@@ -93,105 +64,105 @@
</template>
<script setup>
import { ref } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { ref } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import AuthUtil from '@/sheep/api/member/auth';
import { useMessage } from '@/uni_modules/wot-design-uni';
import RecentApi from '@/sheep/api/member/recent';
import AuthUtil from '@/sheep/api/member/auth';
import { useMessage } from '@/uni_modules/wot-design-uni';
import RecentApi from '@/sheep/api/member/recent';
const message = useMessage('xyBox');
const agreeMessage = useMessage('agreeBox');
const message = useMessage('xyBox');
const agreeMessage = useMessage('agreeBox');
const phone = ref('');
const smsCode = ref('');
const isTiming = ref(false);
const countDown = ref(60);
const isAgree = ref(false);
const nodes = ref(''); // 同意协议的文本
const phone = ref('');
const smsCode = ref('');
const isTiming = ref(false);
const countDown = ref(60);
const isAgree = ref(false);
const nodes = ref(''); // 同意协议的文本
onShow(() => {
if (!phone.value) {
const lastLoginPhone = uni.getStorageSync('last_login_phone');
if (lastLoginPhone) {
phone.value = lastLoginPhone;
}
onShow(() => {
if (!phone.value) {
const lastLoginPhone = uni.getStorageSync('last_login_phone');
if (lastLoginPhone) {
phone.value = lastLoginPhone;
}
});
const handleGetCode = async () => {
if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
if (
!/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/.test(
phone.value,
)
)
return uni.showToast({ title: '手机号格式错误', icon: 'none' });
const { code } = await AuthUtil.sendSmsCode(phone.value, 1);
if (code !== 0) return;
isTiming.value = true;
timer = setInterval(() => {
countDown.value--;
if (countDown.value === 0) {
isTiming.value = false;
countDown.value = 60;
clearInterval(timer);
}
}, 1000);
};
// 登录
const handleLogin = async () => {
if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
if (
!/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/.test(
phone.value,
)
)
return uni.showToast({ title: '手机号格式错误', icon: 'none' });
if (!smsCode.value) return uni.showToast({ title: '请填写验证码', icon: 'none' });
if (!isAgree.value) {
agreeMessage
.confirm({
title: '授权',
confirmButtonText: '同意并登录',
})
.then(() => {
disposeLogin();
});
return;
}
disposeLogin();
};
const disposeLogin = async () => {
if (!phone.value || !smsCode.value) {
return;
}
const { code } = await AuthUtil.smsRegister({ mobile: phone.value, code: smsCode.value });
if (code === 0) {
uni.setStorageSync('last_login_phone', phone.value);
// #ifdef MP-WEIXIN
uni.reLaunch({ url: '/pages/wechat-tabbar/index' });
// #endif
// #ifndef MP-WEIXIN
uni.reLaunch({ url: '/pages/tabbar/home' });
getApp().$vm.init();
// #endif
return;
}
// 清理数据,防止缓存未失效
getApp().$vm.unloadStore();
};
// 2-用户协议;3-隐私协议;
async function alert(type, title) {
const { data } = await RecentApi.getPromotionArticle({ id: type });
nodes.value = data.content;
message.alert({
title,
zIndex: 200,
});
}
});
const handleGetCode = async () => {
if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
if (
!/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/.test(
phone.value,
)
)
return uni.showToast({ title: '手机号格式错误', icon: 'none' });
const { code } = await AuthUtil.sendSmsCode(phone.value, 1);
if (code !== 0) return;
isTiming.value = true;
timer = setInterval(() => {
countDown.value--;
if (countDown.value === 0) {
isTiming.value = false;
countDown.value = 60;
clearInterval(timer);
}
}, 1000);
};
// 登录
const handleLogin = async () => {
if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
if (
!/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/.test(
phone.value,
)
)
return uni.showToast({ title: '手机号格式错误', icon: 'none' });
if (!smsCode.value) return uni.showToast({ title: '请填写验证码', icon: 'none' });
if (!isAgree.value) {
agreeMessage
.confirm({
title: '授权',
confirmButtonText: '同意并登录',
})
.then(() => {
disposeLogin();
});
return;
}
disposeLogin();
};
const disposeLogin = async () => {
if (!phone.value || !smsCode.value) {
return;
}
const { code } = await AuthUtil.smsRegister({ mobile: phone.value, code: smsCode.value });
if (code === 0) {
uni.setStorageSync('last_login_phone', phone.value);
// #ifdef MP-WEIXIN
uni.reLaunch({ url: '/pages/wechat-tabbar/index' });
// #endif
// #ifndef MP-WEIXIN
uni.reLaunch({ url: '/pages/tabbar/home' });
getApp().$vm.init();
// #endif
return;
}
// 清理数据,防止缓存未失效
getApp().$vm.unloadStore();
};
// 2-用户协议;3-隐私协议;
async function alert(type, title) {
const { data } = await RecentApi.getPromotionArticle({ id: type });
nodes.value = data.content;
message.alert({
title,
zIndex: 200,
});
}
</script>
+1 -1
View File
@@ -9,7 +9,7 @@
</wd-navbar>
<scroll-list style="height: calc(100dvh - 44px - 50px)" :loadMoreStatus="loadMoreStatus" @refresh="refreshList"
@loadMore="listLoadMore">
<view class="flex-col justify-center card-thin mx-20rpx px-20rpx py-18rpx mb-15rpx"
<view class="flex-col justify-center card-thin mx-20rpx px-30rpx py-30rpx mb-30rpx"
v-for="(v, i) in listData" :key="v.id">
<view class="text-xs break-all">
<wd-tag size="30rpx" custom-class="space">
+45 -28
View File
@@ -2,16 +2,18 @@
<wd-config-provider theme="dark">
<wd-navbar title="开通VIP" safeAreaInsetTop :bordered="false">
<template #left>
<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/profile/apply-vip-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>
<!-- #endif -->
<view class="flex items-center">
<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/profile/apply-vip-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>
<!-- #endif -->
</view>
</template>
<!-- #ifndef MP-WEIXIN -->
<template #right>
@@ -42,7 +44,7 @@
<view class="flex">
<view v-for="item in openTypeList" :key="item.id" class="mr-3 ml-1 my-1" @click="curOpenTypeId = item.id">
<view class="w-220rpx rounded-3 flex-col-center transition-all duration-200" :class="[
curOpenTypeId === item.id
curOpenTypeId == item.id
? 'bg-#111 text-white b-3 b-solid b-#D29E52/60'
: 'b-3 b-solid b-#333',
]">
@@ -114,7 +116,7 @@
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
import { computed, ref, nextTick } from 'vue';
// @ts-ignore
import { fen2yuan } from '@/sheep/hooks/useGoods';
import { onLoad, onShow } from '@dcloudio/uni-app';
@@ -168,25 +170,26 @@ const payMethod = ref<'alipay' | 'wechat'>('alipay'); // 支付方式:alipay /
const openTypeList = ref<OpenTypeItem[]>([]); // 会员类型列表
const curOpenTypeId = ref<number>(); // 当前选择的会员类型id
const currentOpenType = computed<OpenTypeItem | undefined>(() =>
openTypeList.value?.find((item) => item.id === curOpenTypeId.value),
openTypeList.value?.find((item) => item.id == curOpenTypeId.value),
); // 当前选择的会员类型
onLoad(async (params) => {
console.log('onLoad:', params);
if (params) {
if (params.openTypeId && params.payMethod) {
payMethod.value = params.payMethod;
disposeWechatPay(params.openTypeId);
}
}
});
onShow(async () => {
const { data = null } = await RecentApi.getMemberOpenTypeList();
openTypeList.value = data ?? [];
if (openTypeList.value && openTypeList.value[0]) {
curOpenTypeId.value = openTypeList.value[0].id;
}
if (params) {
if (params.openTypeId && params.payMethod) {
payMethod.value = params.payMethod;
curOpenTypeId.value = params.openTypeId;
handleOpenVip();
}
}
});
onShow(async () => {
getChatConfig();
});
@@ -237,8 +240,8 @@ const handleOpenVip = () => {
}
messageBox
.confirm({
msg: '确认开通?',
title: '提示',
title: '确认开通?',
msg: `确认使用${payMethodItem.title}${fen2yuan(currentOpenType.value?.preferentialPrice)}元,开通${currentOpenType.value?.title}会员吗?`,
})
.then(async () => {
// #ifdef MP-WEIXIN
@@ -274,9 +277,23 @@ const disposeWechatPay = async (openTypeId: any) => {
// 跳转到微信小程序
const jumpToWechatPage = async () => {
await jumpToWechatMiniProgram('openVip', {
openTypeId: curOpenTypeId.value,
payMethod: payMethod.value,
});
try {
const url = await jumpToWechatMiniProgram('openVip', {
openTypeId: curOpenTypeId.value,
payMethod: payMethod.value,
});
if (!url) {
uni.showToast({ title: '获取小程序短链失败', icon: 'none' });
throw new Error('获取小程序短链失败');
}
// #ifdef H5
window.location.href = url
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(url)
// #endif
} catch (error) {
console.log('|跳转微信小程序|,意外的错误error:', error);
}
};
</script>
+1 -1
View File
@@ -10,7 +10,7 @@
<scroll-list style="height: calc(100dvh - 44px - 50px)" :loadMoreStatus="loadMoreStatus" @refresh="refreshList"
@loadMore="listLoadMore">
<view class="flex items-center card-thin mx-20rpx px-20rpx py-18rpx mb-15rpx" v-for="(v, i) in listData"
<view class="flex items-center card-thin mx-20rpx px-30rpx py-30rpx mb-30rpx" v-for="(v, i) in listData"
:key="v.id">
<view class="flex items-center flex-1 text-xs">
<wd-tag size="30rpx" custom-class="space">
+22 -6
View File
@@ -120,18 +120,24 @@ const rechargePackag = ref<{ id: number; name: string; payPrice: number; bonusPr
);
const userWallet = computed(() => sheep.$store('user').userWallet);
onLoad((params) => {
onLoad(async (params) => {
console.log('onLoad:', params);
const { data } = await RecentApi.getWalletRechargePackage();
rechargePackag.value = data ?? [];
if (params) {
if (params.packageId && params.payMethod) {
payMethod.value = params.payMethod;
disposeWechatPay(params.packageId);
const item = rechargePackag.value.find((item) => item.id === Number(params.packageId));
if (!item) {
uni.showToast({ title: '请选择会员类型', icon: 'none' });
return;
}
handleRecharge(item);
}
}
});
onShow(async () => {
const { data } = await RecentApi.getWalletRechargePackage();
rechargePackag.value = data ?? [];
// 查询钱包余额
getWallet();
});
@@ -156,8 +162,8 @@ const handleRecharge = (item: any) => {
}
messageBox
.confirm({
msg: `确认购买套餐 ${fen2yuanSimple(item.payPrice)} 元?`,
title: '提示',
msg: `确认使用${payMethodItem.title}${fen2yuanSimple(item.payPrice)}元获取${fen2yuanSimple(item.bonusPrice + item.payPrice)}砖石?`,
})
.then(async () => {
// #ifdef MP-WEIXIN
@@ -194,9 +200,19 @@ const disposeWechatPay = async (packageId: any) => {
// 跳转到微信小程序
const jumpToWechatPage = async (packageId: any) => {
console.log("跳转到微信小程序");
jumpToWechatMiniProgram('recharge', {
const url = await jumpToWechatMiniProgram('recharge', {
packageId,
payMethod: payMethod.value,
});
if (!url) {
uni.showToast({ title: '获取小程序短链失败', icon: 'none' });
throw new Error('获取小程序短链失败');
}
// #ifdef H5
window.location.href = url
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(url)
// #endif
};
</script>
+40 -19
View File
@@ -96,6 +96,8 @@
</view>
<view class="h-30rpx" />
<wd-message-box />
<wd-message-box selector="bind-wechat" />
<wd-message-box selector="bind-wechat-confirm" />
</wd-config-provider>
</template>
@@ -104,10 +106,11 @@ import { computed, reactive, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import { fen2yuanSimple } from '@/sheep/hooks/useGoods';
import BrokerageApi from '@/sheep/api/trade/brokerage';
import TradeConfigApi from '@/sheep/api/trade/config.js';
import { useMessage } from '@/uni_modules/wot-design-uni';
import useBindWechat from "@/sheep/hooks/use-bind-wechat"
const message = useMessage();
@@ -178,15 +181,26 @@ const state = reactive({
summary: {},
posterPic: '',
posterUrl: '',
wechatNum: '',
loginInfoStorage: "",
});
const { bindWechatNum, open: openBindWechat } = useBindWechat(() => {
getTxConfig()
})
onLoad(async () => {
// #ifdef MP-WEIXIN
await sheep.$platform.useProvider('wechat').bind();
// #endif
})
onShow(async () => {
state.loginInfoStorage = uni.getStorageSync('loginInfo') ?? null
if (isLogin.value) {
await getTradeConfig()
await getBrokerageUserSummary()
getMiniProgramPoster()
await getMiniProgramPoster()
}
});
@@ -198,7 +212,7 @@ const getTradeConfig = async () => {
throw new Error();
}
if (data.brokerageWithdrawMinPrice !== undefined) {
state.rule[1].title = `邀请奖励满${fen2yuan(
state.rule[1].title = `邀请奖励满${fen2yuanSimple(
data.brokerageWithdrawMinPrice,
)}元可提现,3个月工作日内到账`;
}
@@ -214,21 +228,20 @@ const getTradeConfig = async () => {
// 获取收益统计
const getBrokerageUserSummary = async () => {
let { code, data } = await BrokerageApi.getBrokerageUserSummary();
if (code === 0) {
state.summary = data || {};
// 累计收益
if (state.summary.withdrawPrice !== undefined) {
state.txTab[0].value = fen2yuan(state.summary.withdrawPrice);
}
// 可提现
if (state.summary.brokeragePrice !== undefined) {
state.txTab[1].value = fen2yuan(state.summary.brokeragePrice);
}
// 成功邀请用户
const firstBrokerageUserCount = state.summary.firstBrokerageUserCount ?? 0;
const secondBrokerageUserCount = state.summary.secondBrokerageUserCount ?? 0;
state.txTab[2].value = firstBrokerageUserCount + secondBrokerageUserCount;
if (code != 0) return
state.summary = data || {};
// 累计收益
if (state.summary.withdrawPrice !== undefined) {
state.txTab[0].value = fen2yuanSimple(state.summary.withdrawPrice);
}
// 可提现
if (state.summary.brokeragePrice !== undefined) {
state.txTab[1].value = fen2yuanSimple(state.summary.brokeragePrice);
}
// 成功邀请用户
const firstBrokerageUserCount = state.summary.firstBrokerageUserCount ?? 0;
const secondBrokerageUserCount = state.summary.secondBrokerageUserCount ?? 0;
state.txTab[2].value = firstBrokerageUserCount + secondBrokerageUserCount;
};
// 获取分销海报
@@ -238,6 +251,7 @@ const getMiniProgramPoster = async () => {
if (code != 0) throw new Error();
state.posterPic = data?.posterPic || '';
state.posterUrl = data?.url || '';
state.wechatNum = data?.txWechatNum ?? ''
} catch (error) {
console.error('|获取分销海报|,意外的错误:', error);
}
@@ -293,12 +307,19 @@ const doLogout = () => {
.catch(() => { });
}
const doTx = () => {
// 立即提现
const doTx = async () => {
if (!isLogin.value) {
authDialog()
return;
}
uni.showToast({ title: '可提现金额为0,暂不能提现', icon: 'none' });
// 查看有没有绑定微信
if (!state.wechatNum) {
openBindWechat(state.wechatNum)
return;
}
uni.navigateTo({ url: '/pages/wechat/pages/withdraw' })
}
const authDialog = () => {
+42 -6
View File
@@ -10,10 +10,10 @@
<view class="mt-30rpx mx-30rpx">
<view class="flex justify-between items-center">
<view class="flex items-end">
<text class="text-3xl font-bold">{{ fen2yuan(state.wallet.giftBalance) }}</text>
<text class="text-3xl font-bold">{{ fen2yuanSimple(state.wallet.giftBalance) }}</text>
<text class="ml-10rpx text-xs">可提现总{{ dictData.unit }}</text>
</view>
<view v-if="false">
<view @tap="doBindWechatNum">
<text
class="bg-color-theme-dark active_cl_bg-color-theme text-xs text-center px-2 py-8rpx rounded-full">
绑定提现微信
@@ -38,21 +38,26 @@
</scroll-list>
</view>
<view class="px-30rpx fixed bottom-30rpx left-0 right-0" @tap="doTx">
<view class="bg-color-theme-dark active_cl_bg-color-theme text-base text-center px-2 py-12rpx rounded-full">
<view class="bg-color-theme-dark active_cl_bg-color-theme text-base text-center px-2 py-12rpx rounded-full"
@tap="doTx">
立即提现
</view>
</view>
<wd-message-box selector="bind-wechat" />
<wd-message-box selector="bind-wechat-confirm" />
</wd-config-provider>
</template>
<script setup>
import { computed, reactive, ref } from 'vue';
import sheep from '@/sheep';
import BrokerageApi from '@/sheep/api/trade/brokerage';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import { fen2yuanSimple } from '@/sheep/hooks/useGoods';
import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
import useScroll from '@/sheep/hooks/use-scroll';
import useBindWechat from "@/sheep/hooks/use-bind-wechat"
import { formatDate } from '@/sheep/helper/utils';
import PayWalletApi from "@/sheep/api/pay/wallet.js"
@@ -68,9 +73,16 @@ const state = reactive({
},
config: {
giftCashRatio: 0
},
txConfig: {
txWechatNum: ""
}
})
onLoad(() => {
getTxConfig()
})
onShow(() => {
refreshList()
getWithdrawableAmount()
@@ -84,6 +96,11 @@ const {
listLoadMore: listLoadMore,
} = useScroll(PayWalletApi.giftPage);
const { bindWechatNum, open } = useBindWechat(() => {
getTxConfig()
})
// 查询可以提现的礼物金额
const getWithdrawableAmount = async () => {
@@ -105,7 +122,26 @@ const getChatConfig = async () => {
}
}
const doTx = () => {
uni.showToast({ title: '可提现金额为0,暂不能提现', icon: 'none' });
// 绑定提现微信
const doBindWechatNum = async () => {
open(state.txConfig.txWechatNum)
}
// 点击提现
const doTx = async () => {
uni.navigateTo({ url: `/pages/wechat/pages/withdraw?type=gift` })
}
// 获取提现配置
const getTxConfig = async () => {
try {
let { code, data } = await BrokerageApi.getBrokerageCode();
console.log("data:", data);
if (code != 0) throw new Error();
state.txConfig = data
} catch (error) {
console.error('|获取提现配置|,意外的错误:', error);
}
};
</script>
+194
View File
@@ -0,0 +1,194 @@
<template>
<wd-config-provider theme="dark">
<wd-navbar :title="pageType == 'yj' ? '分销提现' : '礼物提现'" 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>
<view class="bg-color-dark rounded-12rpx px-4 py-3 mx-20rpx mt-30rpx">
<view class="flex items-end">
<text class="text-sm line-height-1em">提现金额</text>
<text class="text-xs line-height-1em m-l-4rpx">
每笔最低{{ fen2yuanSimple(state.config.brokerageWithdrawMinPrice) }}元</text>
</view>
<view class="m-t-20rpx">
<wd-input type="number" label="¥" label-width="10rpx" size="large" v-model="state.price"
placeholder="请输入提现金额" />
</view>
<view class="flex justify-between items-center m-t-20rpx">
<text>可提现金额{{ fen2yuanSimple(state.summary.brokeragePrice) }}元</text>
<text @tap="doTxAll">全部提现</text>
</view>
</view>
<view class="flex justify-between items-center bg-color-dark rounded-12rpx px-4 py-3 mx-20rpx mt-30rpx">
<view>微信号:{{ state.wechatNum }}</view>
<view
class="text-color-theme-dark border-color-theme border-1px border-solid active_cl_bg-color-theme text-xs text-center px-2 py-8rpx rounded-full"
@tap="doBindWechatNum">
请绑定微信号
</view>
</view>
<view class="flex-col justify-center items-center m-t-50rpx">
<view class="flex items-center justify-center flex-wrap px-20rpx text-center text-sm text-white"
@click="alert">
<text>确认提现即同意</text>
<text class="text-#D29E52 underline underline-1 underline-solid underline-amber">《提现协议》</text>
</view>
<view
class="bg-color-theme-dark active_cl_bg-color-theme text-base text-center w-95% m-t-20rpx py-12rpx rounded-full"
@tap="doTx">
申请提现
</view>
</view>
<wd-message-box selector="xyBox">
<rich-text :nodes="nodes" />
</wd-message-box>
<wd-message-box selector="bind-wechat" />
<wd-message-box selector="bind-wechat-confirm" />
</wd-config-provider>
</template>
<script setup>
import { computed, reactive, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { fen2yuanSimple } from '@/sheep/hooks/useGoods';
import BrokerageApi from '@/sheep/api/trade/brokerage';
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"
const message = useMessage('xyBox');
const state = reactive({
price: 0,
wechatNum: '',
summary: {
// 可提现金额
brokeragePrice: ""
},
config: {
// 分销提现最低金额
brokerageWithdrawMinPrice: ""
}
})
const nodes = ref('');
// 页面类型yj:分销(子级购买);gift:礼物
const pageType = ref('yj')
const { bindWechatNum, open: openBindWechat } = useBindWechat(() => {
getTxConfig()
})
onLoad((options) => {
const { type = "yj" } = options
if (type) pageType.value = type
})
onShow(() => {
getTxConfig()
getTradeConfig()
getBrokerageUserSummary()
})
// 提现
const doTx = async () => {
uni.showLoading({ title: '提现中...', mask: true })
const isValidate = await txValidate()
if (!isValidate) {
uni.hideLoading()
return
}
try {
const data = {
// 3:微信;5:微信零钱;
type: 5,
price: Number(state.price) * 100,
accountNo: state.wechatNum
}
const { code } = await BrokerageApi.createBrokerageWithdraw(data);
if (code !== 0) {
uni.showToast({ title: '提现失败', icon: "none" })
throw new Error('提现失败')
}
} catch (error) {
console.log("|提现|,意外的错误error:", error);
}
}
const txValidate = async () => {
if (state.price === undefined) {
uni.showToast({ title: '请输入提现金额', icon: "none" })
return false
}
let { code, data } = await TradeConfigApi.getTradeConfig();
const minPrice = data.brokerageWithdrawMinPrice / 100
if (Number(state.price) < minPrice) {
uni.showToast({ title: `提现金额不能小于${minPrice}元`, icon: "none" })
return false
}
return true
}
// 绑定微信号
const doBindWechatNum = () => {
openBindWechat(state.wechatNum)
}
// 全部提现
const doTxAll = async () => {
try {
uni.showLoading({ title: '计算中...', mask: true })
await getBrokerageUserSummary()
state.price = fen2yuanSimple(state.summary.brokeragePrice)
} catch (error) {
console.log("|全部提现|,意外的错误error:", error);
} finally {
setTimeout(() => uni.hideLoading(), 500);
}
}
// 获取提现配置
const getTxConfig = async () => {
try {
let { code, data } = await BrokerageApi.getBrokerageCode();
if (code != 0) throw new Error();
state.wechatNum = data?.txWechatNum ?? ''
} catch (error) {
console.error('|获取提现配置|,意外的错误:', error);
}
};
// 获取分销配置
const getTradeConfig = async () => {
try {
let { code, data } = await TradeConfigApi.getTradeConfig();
if (code != 0) throw new Error();
state.config = data || {};
} catch (error) {
console.error('|获取分销配置|,意外的错误:', error);
}
};
// 获取收益统计
const getBrokerageUserSummary = async () => {
let { code, data } = await BrokerageApi.getBrokerageUserSummary();
if (code != 0) return
state.summary = data || {};
}
async function alert() {
// 2-用户协议;3-隐私协议;
const { data } = await RecentApi.getPromotionArticle({ id: 2 });
nodes.value = data.content;
message.alert({
title: "提现协议",
zIndex: 200,
});
}
</script>
+11
View File
@@ -120,6 +120,17 @@ const BrokerageApi = {
},
});
},
// 绑定提现微信
bindTxWechatNum: (params) => {
return request({
url: '/trade/brokerage-code/bind-tx-wechat-num',
method: 'GET',
params,
custom: {
showLoading: false,
},
});
},
};
export default BrokerageApi;
+69
View File
@@ -0,0 +1,69 @@
import { computed, reactive, ref } from 'vue';
import { useMessage } from '@/uni_modules/wot-design-uni';
// @ts-ignore
import BrokerageApi from '@/sheep/api/trade/brokerage';
// 绑定提现微信
export default function useBindWechat(bindSuccess?: () => void) {
const bindWechatNumRef = ref<any>(null);
const message = useMessage('bind-wechat');
const messageConfirm = useMessage('bind-wechat-confirm');
const open = (bindWechatNum?: string) => {
bindWechatNumRef.value = bindWechatNum ?? null;
try {
message
.prompt({
title: '绑定提现微信',
confirmButtonText: '确定绑定',
inputValue: bindWechatNumRef.value,
inputPlaceholder: '请输入提现微信',
inputError: '请输入提现微信',
inputValidate: (value) => {
if (!value) {
uni.showToast({ title: '请输入提现微信', icon: 'none' });
return false;
}
return true;
},
})
.then((input) => {
if (input && input.action == 'confirm') {
bindWechatNumRef.value = input.value;
}
// 再次确认
messageConfirm
.confirm({
msg: '',
title: '确定绑定提现微信为' + bindWechatNumRef.value + '吗?',
zIndex: 200,
})
.then(async () => {
try {
uni.showLoading({ title: '绑定中...', mask: true });
const { code, data } = await BrokerageApi.bindTxWechatNum({
txWechatNum: bindWechatNumRef.value,
});
if (code != 0) throw new Error();
uni.hideLoading();
uni.showToast({ title: '绑定成功', icon: 'success' });
bindSuccess?.();
} catch (error) {
console.log('|绑定提现微信|,意外的错误error:', error);
uni.hideLoading();
uni.showToast({ title: '绑定失败', icon: 'none' });
}
});
});
} catch (error) {
console.log('|绑定提现微信|,意外的错误error:', error);
}
};
return {
bindWechatNum: bindWechatNumRef.value,
open,
};
}
+21 -5
View File
@@ -4,25 +4,41 @@ import SocialApi from '@/sheep/api/member/social';
const targetAppId = 'wx2b4e4d3feff8267f';
const paramsToQuery = (params) => {
if (isEmpty(params)) {
return '';
}
let query = [];
for (let key in params) {
query.push(key + '=' + params[key]);
}
return query.join('&');
};
export const jumpToWechatMiniProgram = async (
action: 'recharge' | 'openVip',
params: Record<string, any>,
) => {
let path = '';
let _params = '';
if (action === 'recharge') {
path = 'pages/profile/recharge';
}
if (action === 'openVip') {
path = 'pages/profile/apply-vip';
}
if (!isEmpty(params)) {
_params = paramsToQuery(params);
console.log('|跳转微信小程序|参数_params:', _params);
}
try {
// 获取小程序短链
const { code, data } = await SocialApi.getWxaQrcode({
path: path,
json: JSON.stringify(params)
})
console.log("|获取小程序短链|成功code:", code, "data:", data);
json: _params,
});
return data;
} catch (error) {
console.log("|获取小程序短链|意外的错误error:", error);
console.log('|获取小程序短链|意外的错误error:', error);
}
}
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB