From 80040f273b68d749783740cb3861ed0384b92861 Mon Sep 17 00:00:00 2001
From: huliyong <2783385703@qq.com>
Date: Fri, 13 Jun 2025 16:16:23 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E6=8F=90=E7=8E=B0):=20=E5=AE=9E=E7=8E=B0?=
=?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=95=86=E6=88=B7=E8=BD=AC=E8=B4=A6=E6=8F=90?=
=?UTF-8?q?=E7=8E=B0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 添加商户号配置和提现相关API接口
- 修改佣金显示字段为userInfo.recommendAmount
- 实现微信requestMerchantTransfer提现流程
- 添加提现记录页面状态显示和领取功能
- 调整提现金额验证规则为大于1的整数
---
api/model/info.js | 22 ++++++++
config.js | 2 +
manifest.json | 2 +-
pages_order/mine/partner.vue | 2 +-
pages_order/mine/runningWater.vue | 55 ++++++++++++++++++-
pages_order/mine/withdraw.vue | 112 ++++++++++++++++++++++++++++++++------
6 files changed, 175 insertions(+), 20 deletions(-)
diff --git a/api/model/info.js b/api/model/info.js
index 50c2567..0896281 100644
--- a/api/model/info.js
+++ b/api/model/info.js
@@ -54,6 +54,28 @@ const api = {
limit: 1000,
showLoading: true,
},
+ // 钱包-提现
+ cashout: {
+ url: '/amount/cashout',
+ method: 'POST',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 钱包-领取提现金额
+ getMoney: {
+ url: '/amount/getMoney',
+ method: 'POST',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 钱包-提现记录列表
+ queryCashoutLog: {
+ url: '/amount/queryCashoutLog',
+ method: 'GET',
+ auth: true,
+ },
// 获取地址列表带分页
getAddressPageList: {
url: '/info_common/getAddressPageList',
diff --git a/config.js b/config.js
index dd54ead..2169d93 100644
--- a/config.js
+++ b/config.js
@@ -38,6 +38,8 @@ const defaultConfig = {
endpoint: 'oss-cn-shenzhen.aliyuncs.com',
}
},
+ //商户号
+ mchId : '1712378227',
}
diff --git a/manifest.json b/manifest.json
index 8fadf3d..cbc1ffa 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name" : "unapp模板",
- "appid" : "__UNI__C572032",
+ "appid" : "__UNI__197A38F",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
diff --git a/pages_order/mine/partner.vue b/pages_order/mine/partner.vue
index 39e6e2f..658b964 100644
--- a/pages_order/mine/partner.vue
+++ b/pages_order/mine/partner.vue
@@ -13,7 +13,7 @@
{{ userInfo.phone }}
- ¥{{ riceInfo.canWithdraw || 0 }}
+ ¥{{ userInfo.recommendAmount || 0 }}
推广佣金
diff --git a/pages_order/mine/runningWater.vue b/pages_order/mine/runningWater.vue
index 61ec58f..1c788f5 100644
--- a/pages_order/mine/runningWater.vue
+++ b/pages_order/mine/runningWater.vue
@@ -28,7 +28,10 @@
佣金提现
{{ item.createTime }}
- {{ `-${item.money}` }}
+ {{ `-${item.amount}` }}
+ 领取
@@ -48,7 +51,7 @@
selectedTime: new Date(),
x: ['+', '-', '-', '+'],
- mixinsListApi: "getWaterPageList",
+ mixinsListApi: "queryCashoutLog",//getWaterPageList
beforeDate: new Date(), //开始日期
afterDate: new Date(), //结束日期
@@ -96,6 +99,47 @@
// todo
console.log('--onTimeChange', e)
},
+ withdraw(item){
+ // 拉起微信收款确认页面
+ if (!wx.canIUse('requestMerchantTransfer')) {
+ wx.showModal({
+ content: '你的微信版本过低,请更新至最新版本。',
+ showCancel: false,
+ });
+ return
+ }
+
+ // 在真机环境中,调用API
+ wx.requestMerchantTransfer({
+ mchId: this.$config.mchId,
+ appId: wx.getAccountInfoSync().miniProgram.appId,
+ package: item.packageInfo,
+ success: (res) => {
+ uni.showToast({
+ title: '提现申请已提交',
+ icon: 'success'
+ })
+ this.$store.commit('getUserInfo')
+ this.$store.commit('getRiceInfo')
+
+ this.$api('getMoney', {
+ id : item.id,
+ }).then(res => {
+ this.getData()
+ })
+ },
+ fail: (res) => {
+ console.log('fail:', res);
+ uni.showToast({
+ title: '提现失败,请稍后再试',
+ icon: 'none'
+ })
+ },
+ complete: (res) => {
+ console.log('requestMerchantTransfer完成:', res);
+ }
+ });
+ },
}
}
@@ -109,6 +153,13 @@
background-image: linear-gradient(#84A73F, #D8FF8F);
}
}
+
+ .uni-color-btn{
+ padding: 10rpx 20rpx;
+ margin: 0;
+ font-size: 26rpx;
+ margin-left: 20rpx;
+ }
.tools {
background-color: $uni-fg-color;
diff --git a/pages_order/mine/withdraw.vue b/pages_order/mine/withdraw.vue
index fe61b4a..03061d5 100644
--- a/pages_order/mine/withdraw.vue
+++ b/pages_order/mine/withdraw.vue
@@ -10,11 +10,11 @@
- 总佣金余额(元)
- {{ riceInfo.canWithdraw || 0 }}
+ 佣金(元)
+ {{ userInfo.recommendAmount || 0 }}
- {{ `累积提现:${123 || 0} 元` }}
+ {{ `累积提现:${userInfo.cashoutSum || 0} 元` }}