From 0ac3fd564578515eedbe9d0566f707346665d4c2 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 13 Jul 2026 23:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/cashier.ts | 111 +++++++- config/index.ts | 8 + manifest.json | 5 +- pages.json | 16 ++ pages/cashier/index.vue | 469 +++++++++++++++++++++++++++++---- pages/cashier/result.vue | 12 +- pages/mine/index.vue | 231 ++++++++++++++++ pages/mine/score-records.vue | 199 ++++++++++++++ pages/pay/checkout.vue | 329 ++++++++++++++++++++--- pages/records/index.vue | 253 +++++++++++++++++- unocss/a-hua-unocss/index.scss | 2 + utils/checkout-return.ts | 40 +++ utils/merchant-context.ts | 2 + 13 files changed, 1586 insertions(+), 91 deletions(-) create mode 100644 pages/mine/index.vue create mode 100644 pages/mine/score-records.vue create mode 100644 utils/checkout-return.ts diff --git a/api/cashier.ts b/api/cashier.ts index b9fd94c..66280e2 100644 --- a/api/cashier.ts +++ b/api/cashier.ts @@ -1,4 +1,4 @@ -import { get, post } from '../utils/request'; +import { get, post, postForm } from '../utils/request'; export interface MerchantConfigQuery { merchant_id?: string; @@ -56,6 +56,11 @@ export interface SupplierInfo { }; } +export interface MerchantListItem { + merchant_id: string | number; + merchant_name: string; +} + export interface ApiResult { code: number | string; msg?: string; @@ -72,6 +77,79 @@ export interface TradeQueryResult { real_money?: string; } +export interface TradeListItem { + trade_no: string; + pay_status: number; + real_money: string; + merchant_id?: number | string; + create_time?: string; + wuye_money?: string; + pay_time?: string | null; + refund_time?: string | null; + pay_type?: number; + supplier_name?: string; +} + +export interface TradeListQuery { + trade_no?: string; + page?: number | string; + limit?: number | string; +} + +export interface PlatformScoreResult { + score?: string | number; +} + +export interface ScoreRecordItem { + id?: string | number; + score?: string | number; + change_score?: string | number; + type?: string | number; + remark?: string; + create_time?: string; + [key: string]: unknown; +} + +export interface ScoreRecordQuery { + page?: number | string; + limit?: number | string; +} + +export interface CashTradeInfo { + trade_no?: string; + pay_status?: number; + pay_type?: number; + total_money?: string; + reduce_money?: string; + real_money?: string; + merchant_id?: number | string; + supplier_id?: number | string; + timeout?: number; + create_time?: string; +} + +export interface CashTradeInfoResult { + trade?: CashTradeInfo; + body?: string; + subject?: string; +} + +export interface CashTradePayPayload { + trade_no: string; + platform?: string; + remark?: string; +} + +export interface CashTradePayResult { + trade_no?: string; + app_id?: string; + timestamp?: string; + nonce_str?: string; + package?: string; + sign_type?: string; + pay_sign?: string; +} + export const merchantConfig = (data: MerchantConfigQuery = {}) => get('v1/cashier/merchant', data); export const createCashierOrder = (data: CashierOrderPayload) => @@ -81,14 +159,45 @@ export const cashierPay = (data: { order_id: string }) => post get('v1/cashier/records', data); +export const tradeList = (data: TradeListQuery = {}) => + get>('user/v1/trade.list', { + trade_no: data.trade_no ?? '', + page: data.page ?? 1, + limit: data.limit ?? 10 + }); + export const bindMerchantByUrl = (url: string) => get>('user/v1/bing.merchant', { url }); export const supplierByUrl = (url: string) => get>('user/v1/supplier', { url }); +export const merchantListByUrl = (url: string) => + get>('user/v1/merchant.list', { url }); + +export const changeMerchant = (data: { merchant_id: string | number; url: string }) => + postForm('user/v1/merchant.change', data); + export const queryTrade = (tradeNo: string) => get>('user/v1/trade/query', { trade_no: tradeNo }); export const cancelTrade = (tradeNo: string) => get('user/v1/trade/cancel', { trade_no: tradeNo }); + +export const platformScore = () => get>('user/v1/platform.score'); + +export const platformScoreRecord = (data: ScoreRecordQuery = {}) => + get>('user/v1/platform.score.record', { + page: data.page ?? 1, + limit: data.limit ?? 10 + }); + +export const cashTradeInfo = (tradeNo: string) => + get>('user/v1/cash.trade.info', { trade_no: tradeNo }); + +export const cashTradePay = (data: CashTradePayPayload) => + post>('user/v1/cash.trade', { + trade_no: data.trade_no, + platform: data.platform ?? 'mp-weixin', + remark: data.remark ?? '' + }); diff --git a/config/index.ts b/config/index.ts index bc2c809..011f467 100644 --- a/config/index.ts +++ b/config/index.ts @@ -2,11 +2,19 @@ export const APP_CONFIG = { API_BASE_URL: 'https://dev.api.leapy.cn', APP_ID: '123018', RESOURCE_URL: 'https://resource.leapy.cn/staff/', + PROPERTY_IMG_URL: 'https://resource.leapy.cn/', STORAGE_TOKEN_KEY: 'cashier:auth:token', // 小程序代码可被反编译,密钥仅用于避免 token 明文落盘,不替代服务端的有效期与失效策略。 STORAGE_ENCRYPTION_KEY: 'cashier-storage-key-123018-v1-32' } as const; +export const PROPERTY_APP = { + APP_ID: 'wx42076f086669c49e', + BIND_HOUSE_PATH: 'pagesC/certification/index?from=cashier', + MINE_PATH: 'pages/mine/mine', + WECHAT_APP_ID: 'wx02de0e1de9f4bda3' +} as const; + export const DEFAULT_MERCHANT = { id: '', name: '上海大观园', diff --git a/manifest.json b/manifest.json index 37f6415..f81f03a 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,10 @@ "postcss" : true, "minified" : true }, - "usingComponents" : true + "usingComponents" : true, + "navigateToMiniProgramAppIdList" : [ + "wx42076f086669c49e" + ] }, "mp-alipay" : { "usingComponents" : true diff --git a/pages.json b/pages.json index d3c12da..f8480ba 100644 --- a/pages.json +++ b/pages.json @@ -34,6 +34,22 @@ "navigationBarTitleText": "付款记录" } }, + { + "path": "pages/mine/index", + "style": { + "enablePullDownRefresh": true, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "个人中心" + } + }, + { + "path": "pages/mine/score-records", + "style": { + "enablePullDownRefresh": true, + "navigationBarTextStyle": "black", + "navigationBarTitleText": "积分流水" + } + }, { "path": "pages/house/bind", "style": { diff --git a/pages/cashier/index.vue b/pages/cashier/index.vue index 2d466f6..066c833 100644 --- a/pages/cashier/index.vue +++ b/pages/cashier/index.vue @@ -1,5 +1,10 @@