From c2f0ec3b3891bc177bdc58c2a111ab9c4fea911d Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期五, 18 九月 2026 17:13:38 +0800
Subject: [PATCH] 更新....
---
rencaika_merchant/services/orders.uts | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/rencaika_merchant/services/orders.uts b/rencaika_merchant/services/orders.uts
index 14129a9..ad79001 100644
--- a/rencaika_merchant/services/orders.uts
+++ b/rencaika_merchant/services/orders.uts
@@ -1,4 +1,4 @@
-import { getApiEndpoint } from '../config/api.uts'
+import { getApiBaseUrl, getApiEndpoint } from '../config/api.uts'
import { request, HttpError } from './http.uts'
export type MerchantOrder = {
@@ -34,6 +34,8 @@
talentDiscountAmount: number
benefitName: string
merchantName: string
+ /** 商品图(无商品图时回落商家封面图),已补成可直接渲染的地址;都没有则为空。 */
+ productImage: string
canRevoke: boolean
revokeDeadline: string
revokeReason: string
@@ -105,6 +107,12 @@
return field != null ? '' + field : fallback
}
+/** 后台存的是相对路径(/uploads/xxx.jpg),小程序要绝对地址才能显示;空值原样返回。 */
+const mediaUrl = (value: string): string => {
+ if (value.length == 0 || value.indexOf('http://') == 0 || value.indexOf('https://') == 0 || value.indexOf('/static/') == 0) return value
+ return value.indexOf('/') == 0 ? getApiBaseUrl().replace(/\/$/, '') + value : value
+}
+
const toOrder = (value: any): MerchantOrder => ({
id: textValue(value, 'id', 'id'),
orderNo: textValue(value, 'orderNo', 'order_no'),
@@ -127,6 +135,8 @@
const toOrderDetail = (value: any): MerchantOrderDetail => {
const order = toOrder(value)
+ const productCover = textValue(value, 'productCoverUrl', 'product_cover_url')
+ const merchantCover = textValue(value, 'merchantCoverUrl', 'merchant_cover_url')
return {
...order,
basePayAmount: order.basePayAmount != null ? order.basePayAmount : order.orderAmount,
@@ -134,6 +144,7 @@
talentDiscountAmount: order.talentDiscountAmount != null ? order.talentDiscountAmount : 0,
benefitName: textValue(value, 'benefitName', 'benefit_name', order.title),
merchantName: textValue(value, 'merchantName', 'merchant_name'),
+ productImage: mediaUrl(productCover.length > 0 ? productCover : merchantCover),
canRevoke: fieldValue(value, 'canRevoke', 'can_revoke') == true,
revokeDeadline: textValue(value, 'revokeDeadline', 'revoke_deadline'),
revokeReason: textValue(value, 'revokeReason', 'revoke_reason')
--
Gitblit v1.7.1