shinnosuke
5 天以前 e52934f6527027bd6008c2ade61c3083159efd4a
rencaika_merchant/services/orders.uts
@@ -5,6 +5,10 @@
   id: string
   orderNo: string
   category: string
   /** 订单来源:普通订单为空,观影券(票包领取记录)为 TICKET_PACKAGE。 */
   sourceType?: string
   /** 观影券的领取记录 ID(只有 sourceType = TICKET_PACKAGE 时才有值)。 */
   claimId?: string
   status: string
   statusText: string
   title: string
@@ -19,6 +23,23 @@
   subsidyAmount: number
   createdAt: string
   verifyTime: string
}
/** 观影券在商户端没有任何金额,详情页只展示领取/核销时间、持卡人和当前权益。 */
export type MerchantTicketPackageClaim = {
   id: string
   claimNo: string
   title: string
   packageName: string
   merchantName: string
   customerName: string
   customerMobile: string
   cardLevel: string
   status: string
   statusText: string
   createdAt: string
   usedAt: string
   benefitText: string
}
export type MerchantOrderPage = {
@@ -117,6 +138,8 @@
   id: textValue(value, 'id', 'id'),
   orderNo: textValue(value, 'orderNo', 'order_no'),
   category: textValue(value, 'category', 'category', 'group'),
   sourceType: textValue(value, 'sourceType', 'source_type'),
   claimId: textValue(value, 'claimId', 'claim_id'),
   status: textValue(value, 'status', 'status', 'pending_verification'),
   statusText: textValue(value, 'statusText', 'status_text', '待核销'),
   title: textValue(value, 'title', 'title', '订单'),
@@ -180,6 +203,36 @@
}, (data: any, traceId: string) => onSuccess(toOrderDetail(data), traceId), onError)
/**
 * 观影券领取记录详情:团购列表里的观影券那一条点开后调用。
 * 观影券没有订单号,用领取记录 ID 定位。
 */
export const loadMerchantTicketPackageClaim = (
   claimId: string,
   onSuccess: (claim: MerchantTicketPackageClaim, traceId: string) => void,
   onError: (error: HttpError) => void
): (() => void) => request<any>({
   path: getApiEndpoint('merchantTicketPackageClaim') + encodeURIComponent(claimId),
   method: 'GET'
}, (data: any, traceId: string) => {
   const source = data != null ? data : {}
   onSuccess({
      id: textValue(source, 'claimId', 'claim_id'),
      claimNo: textValue(source, 'claimNo', 'claim_no'),
      title: textValue(source, 'title', 'title', '观影券1张'),
      packageName: textValue(source, 'packageName', 'package_name'),
      merchantName: textValue(source, 'merchantName', 'merchant_name'),
      customerName: textValue(source, 'customerName', 'customer_name'),
      customerMobile: textValue(source, 'customerMobile', 'customer_mobile'),
      cardLevel: textValue(source, 'cardLevel', 'card_level'),
      status: textValue(source, 'status', 'status', 'pending_verification'),
      statusText: textValue(source, 'statusText', 'status_text', '待核销'),
      createdAt: textValue(source, 'createdAt', 'created_at'),
      usedAt: textValue(source, 'usedAt', 'used_at'),
      benefitText: textValue(source, 'benefitText', 'benefit_text')
   }, traceId)
}, onError)
/**
 * 订单核销:核销成功会写核销记录并确认延迟入账的资金。
 *
 * verificationId 是扫码尝试编号;从订单列表直接核销时不传。