优化会员下单

This commit is contained in:
gyq
2024-05-29 14:01:05 +08:00
parent bf0614e10b
commit 3b0e6513c7
6 changed files with 85 additions and 41 deletions

View File

@@ -52,11 +52,11 @@ const menus = ref([
path: '/order',
icon: 'Tickets'
},
{
label: '网络',
path: '/internat',
icon: 'Paperclip'
},
// {
// label: '网络',
// path: '/internat',
// icon: 'Paperclip'
// },
{
label: '会员',
path: '/member',

View File

@@ -46,7 +46,7 @@
</div>
</div>
<scanModal ref="scanModalRef" :amount="props.amount" :orderId="props.orderId" :selecttype="props.selecttype"
@success="scanCodeSuccess" />
:payType="payType" @success="scanCodeSuccess" />
</template>
<script setup>
@@ -96,6 +96,7 @@ const waitPayMoney = computed(() => {
})
const payActive = ref(0)
const payType = ref('')
const payList = ref([])
const payLoading = ref(false)
@@ -107,16 +108,20 @@ function scanCodeSuccess() {
// 切换支付类型
function payTypeChange(index, item) {
payActive.value = index
payType.value = item.payType
if (item.payType == 'scanCode') {
scanModalRef.value.show()
}
if (payList.value[payActive.value].payType == 'deposit' && !props.member.id) {
scanModalRef.value.show()
}
}
// 结算支付
async function confirmOrder() {
if (payLoading.value) return
try {
if (payList.value[payActive.value].payType == 'scanCode') {
if (payList.value[payActive.value].payType == 'scanCode' || payList.value[payActive.value].payType == 'deposit') {
scanModalRef.value.show()
} else {
if (money.value < props.amount) return

View File

@@ -54,7 +54,7 @@
import _ from "lodash";
import { ref } from "vue";
import icon from "@/assets/icon_scan.png";
import { scanpay, queryOrder, quickPay, queryQuickPayStatus } from "@/api/pay";
import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay } from "@/api/pay";
import { useUser } from "@/store/user.js";
const store = useUser();
import {
@@ -83,6 +83,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
payType: {
type: [Number, String],
default: "",
}
});
const dialogVisible = ref(false);
@@ -115,10 +119,19 @@ async function submitHandle() {
payType: "scanCode",
});
} else {
await scanpay({
orderId: props.orderId,
authCode: scanCode.value,
});
if (props.payType == 'scanCode') {
await scanpay({
orderId: props.orderId,
authCode: scanCode.value,
});
}
if (props.payType == 'deposit') {
await accountPay({
orderId: props.orderId,
memberId: '',
memberAccount: scanCode.value
})
}
}
}