mirror of
https://gitee.com/bootx/dax-pay-h5.git
synced 2025-10-14 22:20:31 +00:00
refactor(daxpay): 优化代码结构和类型定义
-调整代码格式和缩进,提高可读性
This commit is contained in:
@@ -7,7 +7,7 @@ import type { PayResult } from '@/views/daxpay/cashier/CashierCode.api'
|
||||
* 获取收银台订单和配置信息
|
||||
*/
|
||||
export function getOrderAndConfig(orderNo, checkoutType) {
|
||||
return http.request({
|
||||
return http.request<Result<CheckoutOrderAndConfigResult>>({
|
||||
url: '/unipay/checkout/getOrderAndConfig',
|
||||
method: 'GET',
|
||||
params: {
|
||||
|
@@ -19,9 +19,11 @@
|
||||
<van-field label="描述" rows="2" type="textarea" :model-value="orderAndConfig.order.description" readonly />
|
||||
</van-cell-group>
|
||||
|
||||
<van-cell-group inset :title="group.name" v-for="group in orderAndConfig.groupConfigs" :key="group.id">
|
||||
<van-cell-group v-for="group in orderAndConfig.groupConfigs" :key="group.id" inset :title="group.name">
|
||||
<van-space direction="vertical" fill>
|
||||
<van-button @click="pay(config)" type="primary" v-for="config in group.items" :key="config.id" block>{{ config.name }}</van-button>
|
||||
<van-button v-for="config in group.items" :key="config.id" type="primary" block @click="pay(config)">
|
||||
{{ config.name }}
|
||||
</van-button>
|
||||
</van-space>
|
||||
</van-cell-group>
|
||||
</div>
|
||||
@@ -30,13 +32,16 @@
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import {
|
||||
import type {
|
||||
CheckoutItemConfigResult,
|
||||
CheckoutOrderAndConfigResult,
|
||||
checkoutPay,
|
||||
CheckoutPayParam
|
||||
CheckoutPayParam,
|
||||
} from './CheckoutPay.api'
|
||||
import { getOrderAndConfig } from './CheckoutPay.api'
|
||||
import {
|
||||
checkoutPay
|
||||
, getOrderAndConfig,
|
||||
} from './CheckoutPay.api'
|
||||
|
||||
import { CheckoutTypeEnum } from '@/enums/daxpay/DaxPayEnum'
|
||||
import router from '@/router'
|
||||
|
||||
@@ -52,7 +57,6 @@ const orderAndConfig = ref<CheckoutOrderAndConfigResult>({
|
||||
groupConfigs: [],
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
@@ -87,7 +91,8 @@ function goAggregate() {
|
||||
}
|
||||
else if (ua.includes('Alipay')) {
|
||||
router.push({ path: `/aggregate/alipay/${orderNo}`, replace: true })
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
show.value = true
|
||||
}
|
||||
}
|
||||
@@ -98,8 +103,8 @@ function goAggregate() {
|
||||
function pay(config: CheckoutItemConfigResult) {
|
||||
loading.value = true
|
||||
const from = {
|
||||
orderNo: orderNo,
|
||||
itemId: config.id
|
||||
orderNo,
|
||||
itemId: config.id,
|
||||
} as CheckoutPayParam
|
||||
checkoutPay(from).then(({ data }) => {
|
||||
loading.value = false
|
||||
|
@@ -28,11 +28,12 @@ import { useRoute } from 'vue-router'
|
||||
|
||||
import { CheckoutAggregateEnum } from '@/enums/daxpay/DaxPayEnum'
|
||||
import router from '@/router'
|
||||
import {
|
||||
AggregateOrderAndConfigResult, aggregatePay, CheckoutAggregatePayParam,
|
||||
CheckoutAuthCodeParam,
|
||||
} from '@/views/daxpay/checkout/CheckoutPay.api'
|
||||
import { auth, generateAuthUrl, getAggregateConfig } from '@/views/daxpay/checkout/CheckoutPay.api'
|
||||
import type {
|
||||
AggregateOrderAndConfigResult, CheckoutAggregatePayParam,
|
||||
CheckoutAuthCodeParam} from '@/views/daxpay/checkout/CheckoutPay.api';
|
||||
import { aggregatePay
|
||||
auth, generateAuthUrl, getAggregateConfig } from '@/views/daxpay/checkout/CheckoutPay.api'
|
||||
|
||||
|
||||
import type { WxJsapiSignResult } from '@/views/daxpay/cashier/CashierCode.api'
|
||||
|
||||
|
Reference in New Issue
Block a user