From f157e521e151faaac5597a1d32929c526ad01462 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 31 Dec 2025 17:20:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=BD=AC=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- @html/download.html | 16 +--- src/pages.json | 26 ++++++ src/pages/wechat-tabbar/index.vue | 36 ++++++- src/pages/wechat-tabbar/me.vue | 5 + src/pages/wechat/pages/withdraw.vue | 49 ++++++++-- src/pages/wechat/pages/withraw-record.vue | 109 ++++++++++++++++++++++ src/sheep/util/wechat-tool.ts | 34 ++++++- 8 files changed, 252 insertions(+), 25 deletions(-) create mode 100644 src/pages/wechat/pages/withraw-record.vue diff --git a/.env b/.env index 041ae07a..b64b7c9b 100644 --- a/.env +++ b/.env @@ -5,7 +5,7 @@ SHOPRO_VERSION=v2.4.1 SHOPRO_API_PATH=/app-api # 后端接口 - 测试环境(通过 process.env.NODE_ENV == development) -# SHOPRO_DEV_BASE_URL=http://192.168.68.52:48083 +# SHOPRO_DEV_BASE_URL=http://127.0.0.1:48083 # SHOPRO_DEV_BASE_URL = https://chatapi.zianxin.com SHOPRO_DEV_BASE_URL=https://dzc001.fy.takin.cc diff --git a/@html/download.html b/@html/download.html index 38e6f4ba..e6d3021b 100644 --- a/@html/download.html +++ b/@html/download.html @@ -281,16 +281,8 @@
下载安装
- @@ -333,7 +325,7 @@ client = judgeClient() if (client == 'android') { const ua = navigator.userAgent - var src = 'https://down.newroad.top/%E7%BC%98%E9%81%87%E5%9C%88_v5.9.6.apk'; + var src = 'http://hch5.zianxin.com/荷塘月色.apk'; var form = document.createElement('form'); form.action = src; document.getElementsByTagName('body')[0].appendChild(form); @@ -341,7 +333,8 @@ return } if (client == 'ios') { - window.open("https://apps.apple.com/cn/app/id6444849074", "_self") + // window.open("https://apps.apple.com/cn/app/id6444849074", "_self") + alert("暂不支持") } } @@ -352,7 +345,8 @@ return; } if (isInitSuccess && client == 'ios') { - ShareTrace.download(); + // ShareTrace.download(); + alert("暂不支持") } else { //如果初始化失败建议自己指定下载地址,虽然不能获取安装参数但是不会影响用户的下载 _download() diff --git a/src/pages.json b/src/pages.json index a14eeb03..1b6f733f 100644 --- a/src/pages.json +++ b/src/pages.json @@ -152,6 +152,18 @@ ], // #ifdef MP-WEIXIN "subPackages": [ + { + "root": "pages/login", + "pages": [ + { + "path": "login", + "style": { + "navigationBarTitleText": "登录", + "navigationStyle": "custom" + } + } + ] + }, { "root": "pages/profile", "pages": [ @@ -222,6 +234,13 @@ "navigationBarTitleText": "提现", "navigationStyle": "custom" } + }, + { + "path": "pages/withraw-record", + "style": { + "navigationBarTitleText": "提现", + "navigationStyle": "custom" + } } ] } @@ -502,6 +521,13 @@ "navigationBarTitleText": "提现", "navigationStyle": "custom" } + }, + { + "path": "pages/withraw-record", + "style": { + "navigationBarTitleText": "提现", + "navigationStyle": "custom" + } } ] } diff --git a/src/pages/wechat-tabbar/index.vue b/src/pages/wechat-tabbar/index.vue index 855575b4..9bacea51 100644 --- a/src/pages/wechat-tabbar/index.vue +++ b/src/pages/wechat-tabbar/index.vue @@ -98,6 +98,7 @@ + @@ -111,8 +112,10 @@ 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" +import { jumpToWechatMiniProgram } from '@/sheep/util/wechat-tool'; const message = useMessage(); +const jumpWechatMessage = useMessage('jump-wechat'); const userInfo = computed(() => sheep.$store('user')?.userInfo ?? null); const isLogin = computed(() => sheep.$store('user').isLogin && state.loginInfoStorage != null); @@ -147,7 +150,7 @@ const data = { title: '邀请好友', icon: 'icon-tianjiahaoyou', bgColor: '#a4e55a', - path: '', + path: '/pages/wechat/pages/inviter/index', }, ], }; @@ -191,7 +194,9 @@ const { bindWechatNum, open: openBindWechat } = useBindWechat(() => { onLoad(async () => { // #ifdef MP-WEIXIN - await sheep.$platform.useProvider('wechat').bind(); + if (isLogin.value) { + await sheep.$platform.useProvider('wechat').bind(); + } // #endif }) @@ -320,7 +325,34 @@ const doTx = async () => { openBindWechat(state.wechatNum) return; } + // #ifdef MP-WEIXIN uni.navigateTo({ url: '/pages/wechat/pages/withdraw' }) + // #endif + // TODO 由于是到账到微信,所以必须跳转到微信小程序 + // #ifndef MP-WEIXIN + jumpWechatMessage.confirm({ + msg: '由于是到账到微信,所以必须跳转到微信小程序', + title: '', + confirmButtonText: '确定', + cancelButtonText: '取消', + }).then(async () => { + try { + const url = await jumpToWechatMiniProgram('home', {}); + 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); + } + }) + // #endif } const authDialog = () => { diff --git a/src/pages/wechat-tabbar/me.vue b/src/pages/wechat-tabbar/me.vue index 16ae5616..eac034e9 100644 --- a/src/pages/wechat-tabbar/me.vue +++ b/src/pages/wechat-tabbar/me.vue @@ -58,6 +58,11 @@ onShow(async () => { state.loginInfoStorage = uni.getStorageSync('loginInfo') ?? null }); +const doLogin = () => { + sheep.$store('user').logout(); + uni.reLaunch({ url: '/pages/login/login' }); +} + const doLogout = () => { message .confirm({ diff --git a/src/pages/wechat/pages/withdraw.vue b/src/pages/wechat/pages/withdraw.vue index 13a7f42d..bb3f066f 100644 --- a/src/pages/wechat/pages/withdraw.vue +++ b/src/pages/wechat/pages/withdraw.vue @@ -2,9 +2,20 @@ @@ -96,25 +107,43 @@ onShow(() => { // 提现 const doTx = async () => { - uni.showLoading({ title: '提现中...', mask: true }) + uni.showLoading({ title: '申请提现中...', mask: true }) const isValidate = await txValidate() if (!isValidate) { uni.hideLoading() return } try { + const price = Number(state.price) * 100 const data = { // 3:微信;5:微信零钱; type: 5, - price: Number(state.price) * 100, - accountNo: state.wechatNum + price: price, + accountNo: state.wechatNum, + channelExtras: { + sceneId: '1005', + sceneReportInfos: [ + { + "info_type": "活动名称", + "info_content": "佣金提现" + }, + { + "info_type": "奖励说明", + "info_content": `提现${fen2yuanSimple(price)}元` + }, + ] + } } - const { code } = await BrokerageApi.createBrokerageWithdraw(data); - if (code !== 0) { - 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('申请提现失败') } + uni.hideLoading() + uni.showToast({ title: '申请提现成功', icon: "success" }) } catch (error) { + uni.hideLoading() console.log("|提现|,意外的错误error:", error); } } diff --git a/src/pages/wechat/pages/withraw-record.vue b/src/pages/wechat/pages/withraw-record.vue new file mode 100644 index 00000000..2cc127d6 --- /dev/null +++ b/src/pages/wechat/pages/withraw-record.vue @@ -0,0 +1,109 @@ + + + diff --git a/src/sheep/util/wechat-tool.ts b/src/sheep/util/wechat-tool.ts index 8d544b70..8b8d7503 100644 --- a/src/sheep/util/wechat-tool.ts +++ b/src/sheep/util/wechat-tool.ts @@ -16,7 +16,7 @@ const paramsToQuery = (params) => { }; export const jumpToWechatMiniProgram = async ( - action: 'recharge' | 'openVip', + action: 'recharge' | 'openVip' | 'home', params: Record, ) => { let path = ''; @@ -27,6 +27,9 @@ export const jumpToWechatMiniProgram = async ( if (action === 'openVip') { path = 'pages/profile/apply-vip'; } + if (action === 'home') { + path = 'pages/wechat-tabbar/index'; + } if (!isEmpty(params)) { _params = paramsToQuery(params); console.log('|跳转微信小程序|参数_params:', _params); @@ -42,3 +45,32 @@ export const jumpToWechatMiniProgram = async ( console.log('|获取小程序短链|意外的错误error:', error); } }; + +// 商家转账用户确认模式下,拉起页面请求用户确认收款 Transfer +export function requestMerchantTransfer(mchId, packageInfo, successCallback, failCallback) { + if (!uni.canIUse('requestMerchantTransfer')) { + uni.showModal({ + content: '你的微信版本过低,请更新至最新版本。', + showCancel: false, + }); + return; + } + uni.requestMerchantTransfer({ + mchId: mchId, + appId: uni.getAccountInfoSync().miniProgram.appId, + package: packageInfo, + success: (res) => { + // res.err_msg 将在页面展示成功后返回应用时返回 ok,并不代表付款成功 + console.log('success:', res); + successCallback && successCallback(res); + }, + fail: (res) => { + console.log('fail:', res); + uni.showToast({ + title: res.errMsg, + icon: 'none', + }); + failCallback && failCallback(res); + }, + }); +}