支持微信支付宝独立支付渠道
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
type HandoffRecord,
|
||||
type Order,
|
||||
type PaymentOrder,
|
||||
type PaymentPayWay,
|
||||
} from '@/features/orders/api/orders'
|
||||
import {
|
||||
hydrateCounterFormFromCheckout,
|
||||
@@ -51,6 +52,8 @@ export interface UseOrderActionsOptions {
|
||||
confirm: (opts: { title: string; message: string }) => Promise<boolean>
|
||||
/** 需要走二次确认的 handler 名集合。Mobile 传 ['cancel','confirmCheckout','acceptCheckout','cancelDispute'],PC 传 []。 */
|
||||
actionsNeedingConfirm: readonly string[]
|
||||
/** 支付前选择支付方式。返回 null 表示用户取消支付。 */
|
||||
selectPayWay: () => Promise<PaymentPayWay | null>
|
||||
/** 订单列表跳转路径,PC '/orders' / Mobile '/m/orders'。 */
|
||||
ordersPath: string
|
||||
/** 订单群聊路由前缀,PC '/messages/' / Mobile '/m/chats/'。openOrderChat 内部拼接 `${prefix}${chat.id}`。 */
|
||||
@@ -261,9 +264,11 @@ export function useOrderActions(options: UseOrderActionsOptions) {
|
||||
|
||||
async function handlePay() {
|
||||
if (!order.value) return
|
||||
const payWay = await options.selectPayWay()
|
||||
if (!payWay) return
|
||||
startingPayment.value = true
|
||||
try {
|
||||
const payment = await startOrderPayment(order.value.id)
|
||||
const payment = await startOrderPayment(order.value.id, { pay_way: payWay })
|
||||
if (payment.paid) {
|
||||
options.notifySuccess('支付成功,等待号主交接')
|
||||
await loadOrder()
|
||||
|
||||
Reference in New Issue
Block a user