diff --git a/src/mobile/views/cashier/index.vue b/src/mobile/views/cashier/index.vue index 82c8509..f449f40 100644 --- a/src/mobile/views/cashier/index.vue +++ b/src/mobile/views/cashier/index.vue @@ -1,46 +1,35 @@ @@ -168,6 +318,20 @@ onUnmounted(() => { padding-bottom: 80px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + &__error { + color: @danger; + font-size: 14px; + padding: 24px; + text-align: center; + } + + &__empty { + color: @text-sub; + font-size: 14px; + text-align: center; + padding: 24px 0; + } + &__header { // header 加主色调浅渐变,与金额蓝色呼应 background: linear-gradient(180deg, #f0f6ff 0%, #ffffff 100%); @@ -305,6 +469,10 @@ onUnmounted(() => { &--union_pay { background: #e60012; } + + &--douyin { + background: #111; + } } &__pay-name { @@ -364,6 +532,10 @@ onUnmounted(() => { background: @primary-dark; opacity: 0.95; } + + &:disabled { + opacity: 0.6; + } } } diff --git a/src/pc/views/cashier/Index.vue b/src/pc/views/cashier/Index.vue index 6f23e97..ed2e63c 100644 --- a/src/pc/views/cashier/Index.vue +++ b/src/pc/views/cashier/Index.vue @@ -1,43 +1,38 @@ diff --git a/src/shared/api/gateway.ts b/src/shared/api/gateway.ts index aa179e3..b23a339 100644 --- a/src/shared/api/gateway.ts +++ b/src/shared/api/gateway.ts @@ -1,5 +1,5 @@ /** - * 网关聚合扫码 API + * 网关聚合扫码 / 收银台 API */ import { RequestEnum } from '@/shared/enums/httpEnum' import { http } from '@/shared/utils/http/axios' @@ -26,7 +26,7 @@ export interface GatewayOrderInfo { returnUrl?: string } -/** 聚合支付结果 */ +/** 聚合/收银台支付结果 */ export interface AggregatePayResult { orderId?: string | number bizOrderNo?: string @@ -36,6 +36,16 @@ export interface AggregatePayResult { payBodyType?: string } +/** 收银台支付项(公开字段) */ +export interface CashierItemPublic { + /** 支付项ID(后端 Long, 前端用 string 避免精度问题) */ + id: string + name?: string + icon?: string + recommend?: boolean + sortNo?: number +} + /** 查询网关订单 */ export function getGatewayOrder(orderNo: string): Promise { return http.request({ @@ -63,3 +73,47 @@ export function aggregatePay(data: { isShowMessage: false, }) } + +/** 收银台支付项列表 */ +export function listCashierItems(params: { + orderNo: string + cashierType: string + clientEnv?: string +}): Promise { + return http.request({ + url: '/client/gateway/cashier/items', + method: RequestEnum.GET, + params, + }, { + isShowMessage: false, + }).then((list) => { + // id 统一为 string + return (list || []).map(item => ({ + ...item, + id: String(item.id), + })) + }) +} + +/** 收银台发起支付 */ +export function cashierPay(data: { + orderNo: string + itemId: string | number + cashierType: string + clientEnv?: string + openId?: string + device?: string + clientIp?: string +}): Promise { + return http.request({ + url: '/client/gateway/cashier/pay', + method: RequestEnum.POST, + data: { + ...data, + // 后端 Long; 字符串数字可被 Jackson 反序列化 + itemId: data.itemId, + }, + }, { + isShowMessage: false, + }) +} diff --git a/src/shared/locales/en-US/cashier.json b/src/shared/locales/en-US/cashier.json index 593569b..b940153 100644 --- a/src/shared/locales/en-US/cashier.json +++ b/src/shared/locales/en-US/cashier.json @@ -16,5 +16,10 @@ "wechat": "WeChat Pay", "alipay": "Alipay", "union_pay": "UnionPay" - } + }, + "loadFail": "Failed to load order", + "payFail": "Failed to start payment", + "paid": "Payment successful", + "paying": "Paying...", + "emptyItems": "No payment methods available" } diff --git a/src/shared/locales/id-ID/cashier.json b/src/shared/locales/id-ID/cashier.json index 361d52b..99e2e4f 100644 --- a/src/shared/locales/id-ID/cashier.json +++ b/src/shared/locales/id-ID/cashier.json @@ -16,5 +16,10 @@ "wechat": "Pembayaran WeChat", "alipay": "Alipay", "union_pay": "UnionPay" - } + }, + "loadFail": "Gagal memuat pesanan", + "payFail": "Gagal memulai pembayaran", + "paid": "Pembayaran berhasil", + "paying": "Membayar...", + "emptyItems": "Tidak ada metode pembayaran" } diff --git a/src/shared/locales/ja-JP/cashier.json b/src/shared/locales/ja-JP/cashier.json index 4a88004..f152b4a 100644 --- a/src/shared/locales/ja-JP/cashier.json +++ b/src/shared/locales/ja-JP/cashier.json @@ -16,5 +16,10 @@ "wechat": "ウィーチャットペイ", "alipay": "アリペイ", "union_pay": "銀聯" - } + }, + "loadFail": "注文の読み込みに失敗しました", + "payFail": "支払いの開始に失敗しました", + "paid": "支払い成功", + "paying": "支払い中...", + "emptyItems": "利用可能な支払い方法がありません" } diff --git a/src/shared/locales/ko-KR/cashier.json b/src/shared/locales/ko-KR/cashier.json index 7efb5bb..e08780d 100644 --- a/src/shared/locales/ko-KR/cashier.json +++ b/src/shared/locales/ko-KR/cashier.json @@ -16,5 +16,10 @@ "wechat": "위챗페이", "alipay": "알리페이", "union_pay": "유니온페이" - } + }, + "loadFail": "주문 로드 실패", + "payFail": "결제 시작 실패", + "paid": "결제 성공", + "paying": "결제 중...", + "emptyItems": "사용 가능한 결제 수단이 없습니다" } diff --git a/src/shared/locales/ms-MY/cashier.json b/src/shared/locales/ms-MY/cashier.json index 3afe16d..4dde954 100644 --- a/src/shared/locales/ms-MY/cashier.json +++ b/src/shared/locales/ms-MY/cashier.json @@ -16,5 +16,10 @@ "wechat": "WeChat Pay", "alipay": "Alipay", "union_pay": "UnionPay" - } + }, + "loadFail": "Gagal memuatkan pesanan", + "payFail": "Gagal memulakan pembayaran", + "paid": "Pembayaran berjaya", + "paying": "Membayar...", + "emptyItems": "Tiada kaedah pembayaran" } diff --git a/src/shared/locales/th-TH/cashier.json b/src/shared/locales/th-TH/cashier.json index b8ee26a..7c5dddd 100644 --- a/src/shared/locales/th-TH/cashier.json +++ b/src/shared/locales/th-TH/cashier.json @@ -16,5 +16,10 @@ "wechat": "วีแชต เพย์", "alipay": "อาลีเพย์", "union_pay": "ยูเนี่ยนเพย์" - } + }, + "loadFail": "โหลดคำสั่งซื้อไม่สำเร็จ", + "payFail": "เริ่มชำระเงินไม่สำเร็จ", + "paid": "ชำระเงินสำเร็จ", + "paying": "กำลังชำระเงิน...", + "emptyItems": "ไม่มีช่องทางชำระเงิน" } diff --git a/src/shared/locales/vi-VN/cashier.json b/src/shared/locales/vi-VN/cashier.json index e06fdc6..ee8efb9 100644 --- a/src/shared/locales/vi-VN/cashier.json +++ b/src/shared/locales/vi-VN/cashier.json @@ -16,5 +16,10 @@ "wechat": "WeChat trả tiền", "alipay": "Alipay", "union_pay": "UnionPay" - } + }, + "loadFail": "Không tải được đơn hàng", + "payFail": "Không thể bắt đầu thanh toán", + "paid": "Thanh toán thành công", + "paying": "Đang thanh toán...", + "emptyItems": "Không có phương thức thanh toán" } diff --git a/src/shared/locales/zh-CN/cashier.json b/src/shared/locales/zh-CN/cashier.json index 18a5e98..72ff219 100644 --- a/src/shared/locales/zh-CN/cashier.json +++ b/src/shared/locales/zh-CN/cashier.json @@ -16,5 +16,10 @@ "wechat": "微信支付", "alipay": "支付宝", "union_pay": "银联支付" - } + }, + "loadFail": "加载订单失败", + "payFail": "支付发起失败", + "paid": "支付成功", + "paying": "支付中...", + "emptyItems": "暂无可用支付方式" } diff --git a/src/shared/locales/zh-HK/cashier.json b/src/shared/locales/zh-HK/cashier.json index 75f828c..26370f7 100644 --- a/src/shared/locales/zh-HK/cashier.json +++ b/src/shared/locales/zh-HK/cashier.json @@ -16,5 +16,10 @@ "wechat": "微信支付", "alipay": "支付寶", "union_pay": "銀聯支付" - } + }, + "loadFail": "載入訂單失敗", + "payFail": "支付發起失敗", + "paid": "支付成功", + "paying": "支付中...", + "emptyItems": "暫無可用支付方式" } diff --git a/src/shared/locales/zh-TW/cashier.json b/src/shared/locales/zh-TW/cashier.json index 75f828c..26370f7 100644 --- a/src/shared/locales/zh-TW/cashier.json +++ b/src/shared/locales/zh-TW/cashier.json @@ -16,5 +16,10 @@ "wechat": "微信支付", "alipay": "支付寶", "union_pay": "銀聯支付" - } + }, + "loadFail": "載入訂單失敗", + "payFail": "支付發起失敗", + "paid": "支付成功", + "paying": "支付中...", + "emptyItems": "暫無可用支付方式" } diff --git a/src/shared/router/paths.ts b/src/shared/router/paths.ts index f3af3a7..10957f5 100644 --- a/src/shared/router/paths.ts +++ b/src/shared/router/paths.ts @@ -19,8 +19,8 @@ export const RoutePath = { CASHIER: '/cashier/:orderNo', /** 聚合扫码支付(跨端:两端各实现) */ AGGREGATE: '/aggregate/:orderNo', - /** 码牌支付(移动独占) */ - CODE_PAY: '/code-pay/:code', + /** 码牌支付 H5(移动独占, path 与后端 getCodeLink /h/{code} 一致) */ + CODE_PAY: '/h/:code', /** 商户对账单(PC 独占) */ MERCHANT_STATEMENT: '/merchant/statement', /** 协议展示页(跨端:用户协议/隐私政策,链接可独立分享) */