feat: 添加现金支付渠道、解决选择地址没有id问题

This commit is contained in:
2026-05-27 15:08:46 +08:00
parent cf20c568de
commit 7f8cd06954
2 changed files with 40 additions and 6 deletions
+7 -5
View File
@@ -101,6 +101,7 @@
mobile: '', mobile: '',
detailAddress: '', detailAddress: '',
defaultStatus: false, defaultStatus: false,
areaId: null,
areaName: '', areaName: '',
}, },
rules: {}, rules: {},
@@ -119,7 +120,7 @@
errorMessage: '请输入手机号', errorMessage: '请输入手机号',
}, ], }, ],
}, },
areaName: { areaId: {
rules: [{ rules: [{
required: true, required: true,
errorMessage: '请选择您的位置', errorMessage: '请选择您的位置',
@@ -135,8 +136,10 @@
// 确认选择地区 // 确认选择地区
const onRegionConfirm = (e) => { const onRegionConfirm = (e) => {
state.model.areaName = `${e.province_name} ${e.city_name} ${e.district_name} ${e.street_name}`; state.model.areaName = [e.province_name, e.city_name, e.district_name, e.street_name]
state.model.areaId = e.street_id; .filter(Boolean)
.join(' ');
state.model.areaId = e.street_id ?? e.district_id ?? e.city_id ?? e.province_id ?? null;
state.showRegion = false; state.showRegion = false;
}; };
@@ -263,7 +266,6 @@
onEdit, onEdit,
}); });
const regionClick = (e) => { const regionClick = (e) => {
console.log('111')
if (e.value == 'areaName') { if (e.value == 'areaName') {
state.showRegion = true; state.showRegion = true;
} }
@@ -389,4 +391,4 @@
:deep(.is-disabled){ :deep(.is-disabled){
background-color: #ffffff !important; background-color: #ffffff !important;
} }
</style> </style>
+33 -1
View File
@@ -34,6 +34,9 @@ export default class SheepPay {
wallet: () => { wallet: () => {
this.walletPay(); this.walletPay();
}, },
cash: () => {
this.cashPay();
},
mock: () => { mock: () => {
this.mockPay(); this.mockPay();
}, },
@@ -51,6 +54,9 @@ export default class SheepPay {
wallet: () => { wallet: () => {
this.walletPay(); this.walletPay();
}, },
cash: () => {
this.cashPay();
},
mock: () => { mock: () => {
this.mockPay(); this.mockPay();
}, },
@@ -65,6 +71,9 @@ export default class SheepPay {
wallet: () => { wallet: () => {
this.walletPay(); this.walletPay();
}, },
cash: () => {
this.cashPay();
},
mock: () => { mock: () => {
this.mockPay(); this.mockPay();
}, },
@@ -85,6 +94,9 @@ export default class SheepPay {
wallet: () => { wallet: () => {
this.walletPay(); this.walletPay();
}, },
cash: () => {
this.cashPay();
},
mock: () => { mock: () => {
this.mockPay(); this.mockPay();
}, },
@@ -221,6 +233,11 @@ export default class SheepPay {
code === 0 && this.payResult('success'); code === 0 && this.payResult('success');
} }
async cashPay() {
const { code } = await this.prepay('cash_payment');
code === 0 && this.payResult('success');
}
// 模拟支付 // 模拟支付
async mockPay() { async mockPay() {
// console.log('模拟支付') // console.log('模拟支付')
@@ -426,6 +443,12 @@ export function getPayMethods(channels) {
value: 'wallet', value: 'wallet',
disabled: false, disabled: false,
}, },
{
icon: '/static/pay/wallet.svg',
title: '现金支付',
value: 'cash',
disabled: true,
},
{ {
icon: '/static/pay/apple.svg', icon: '/static/pay/apple.svg',
title: 'Apple Pay', title: 'Apple Pay',
@@ -459,6 +482,7 @@ export function getPayMethods(channels) {
let alipayMethod = null; let alipayMethod = null;
// 3. 处理【余额支付】 // 3. 处理【余额支付】
let walletMethod = null; let walletMethod = null;
let cashMethod = null;
// 4. 处理【苹果支付】TODO 芋艿:未来接入 // 4. 处理【苹果支付】TODO 芋艿:未来接入
// 5. 处理【模拟支付】 // 5. 处理【模拟支付】
let mockMethod = null; let mockMethod = null;
@@ -467,7 +491,10 @@ export function getPayMethods(channels) {
// 7. 处理【汇付支付宝支付】 // 7. 处理【汇付支付宝支付】
let hfAlipayMethod = null; let hfAlipayMethod = null;
payMethods1.forEach((e) => { payMethods1.forEach((e) => {
if (channels.indexOf(e.value) !== -1) { const exists =
channels.indexOf(e.value) !== -1 ||
(e.value === 'cash' && channels.includes('cash_payment'));
if (exists) {
payMethods.push(e); payMethods.push(e);
if (e.value == 'wechat') { if (e.value == 'wechat') {
wechatMethod = e; wechatMethod = e;
@@ -475,6 +502,8 @@ export function getPayMethods(channels) {
alipayMethod = e; alipayMethod = e;
} else if (e.value == 'wallet') { } else if (e.value == 'wallet') {
walletMethod = e; walletMethod = e;
} else if (e.value == 'cash') {
cashMethod = e;
} else if (e.value == 'mock') { } else if (e.value == 'mock') {
mockMethod = e; mockMethod = e;
} else if (e.value == 'hf_wx_app') { } else if (e.value == 'hf_wx_app') {
@@ -505,6 +534,9 @@ export function getPayMethods(channels) {
if (channels.includes('wallet')) { if (channels.includes('wallet')) {
walletMethod.disabled = false; walletMethod.disabled = false;
} }
if (channels.includes('cash_payment') && cashMethod) {
cashMethod.disabled = false;
}
if (channels.includes('mock')) { if (channels.includes('mock')) {
mockMethod.disabled = false; mockMethod.disabled = false;
} }