feat: 添加现金支付渠道、解决选择地址没有id问题
This commit is contained in:
@@ -101,6 +101,7 @@
|
||||
mobile: '',
|
||||
detailAddress: '',
|
||||
defaultStatus: false,
|
||||
areaId: null,
|
||||
areaName: '',
|
||||
},
|
||||
rules: {},
|
||||
@@ -119,7 +120,7 @@
|
||||
errorMessage: '请输入手机号',
|
||||
}, ],
|
||||
},
|
||||
areaName: {
|
||||
areaId: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择您的位置',
|
||||
@@ -135,8 +136,10 @@
|
||||
|
||||
// 确认选择地区
|
||||
const onRegionConfirm = (e) => {
|
||||
state.model.areaName = `${e.province_name} ${e.city_name} ${e.district_name} ${e.street_name}`;
|
||||
state.model.areaId = e.street_id;
|
||||
state.model.areaName = [e.province_name, e.city_name, e.district_name, e.street_name]
|
||||
.filter(Boolean)
|
||||
.join(' ');
|
||||
state.model.areaId = e.street_id ?? e.district_id ?? e.city_id ?? e.province_id ?? null;
|
||||
state.showRegion = false;
|
||||
};
|
||||
|
||||
@@ -263,7 +266,6 @@
|
||||
onEdit,
|
||||
});
|
||||
const regionClick = (e) => {
|
||||
console.log('111')
|
||||
if (e.value == 'areaName') {
|
||||
state.showRegion = true;
|
||||
}
|
||||
@@ -389,4 +391,4 @@
|
||||
:deep(.is-disabled){
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
+33
-1
@@ -34,6 +34,9 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
cash: () => {
|
||||
this.cashPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
@@ -51,6 +54,9 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
cash: () => {
|
||||
this.cashPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
@@ -65,6 +71,9 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
cash: () => {
|
||||
this.cashPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
@@ -85,6 +94,9 @@ export default class SheepPay {
|
||||
wallet: () => {
|
||||
this.walletPay();
|
||||
},
|
||||
cash: () => {
|
||||
this.cashPay();
|
||||
},
|
||||
mock: () => {
|
||||
this.mockPay();
|
||||
},
|
||||
@@ -221,6 +233,11 @@ export default class SheepPay {
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
|
||||
async cashPay() {
|
||||
const { code } = await this.prepay('cash_payment');
|
||||
code === 0 && this.payResult('success');
|
||||
}
|
||||
|
||||
// 模拟支付
|
||||
async mockPay() {
|
||||
// console.log('模拟支付')
|
||||
@@ -426,6 +443,12 @@ export function getPayMethods(channels) {
|
||||
value: 'wallet',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
icon: '/static/pay/wallet.svg',
|
||||
title: '现金支付',
|
||||
value: 'cash',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
icon: '/static/pay/apple.svg',
|
||||
title: 'Apple Pay',
|
||||
@@ -459,6 +482,7 @@ export function getPayMethods(channels) {
|
||||
let alipayMethod = null;
|
||||
// 3. 处理【余额支付】
|
||||
let walletMethod = null;
|
||||
let cashMethod = null;
|
||||
// 4. 处理【苹果支付】TODO 芋艿:未来接入
|
||||
// 5. 处理【模拟支付】
|
||||
let mockMethod = null;
|
||||
@@ -467,7 +491,10 @@ export function getPayMethods(channels) {
|
||||
// 7. 处理【汇付支付宝支付】
|
||||
let hfAlipayMethod = null;
|
||||
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);
|
||||
if (e.value == 'wechat') {
|
||||
wechatMethod = e;
|
||||
@@ -475,6 +502,8 @@ export function getPayMethods(channels) {
|
||||
alipayMethod = e;
|
||||
} else if (e.value == 'wallet') {
|
||||
walletMethod = e;
|
||||
} else if (e.value == 'cash') {
|
||||
cashMethod = e;
|
||||
} else if (e.value == 'mock') {
|
||||
mockMethod = e;
|
||||
} else if (e.value == 'hf_wx_app') {
|
||||
@@ -505,6 +534,9 @@ export function getPayMethods(channels) {
|
||||
if (channels.includes('wallet')) {
|
||||
walletMethod.disabled = false;
|
||||
}
|
||||
if (channels.includes('cash_payment') && cashMethod) {
|
||||
cashMethod.disabled = false;
|
||||
}
|
||||
if (channels.includes('mock')) {
|
||||
mockMethod.disabled = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user