Эх сурвалжийг харах

feat(shop): 小程序订单列表/详情状态映射适配三阶段退款,待收货 tab 改用 pending_receipt

Xiaogang Liao 2 өдөр өмнө
parent
commit
a1e0700d3f

+ 22 - 11
cfc-frontend/pages/shop/order-detail/order-detail.vue

@@ -13,9 +13,11 @@
         <text v-if="order.status === 'paid' && !order.fulfillStatus" class="status-hint">商家正在准备中,请耐心等待</text>
         <text v-if="order.status === 'completed'" class="status-hint">订单已完成,感谢购买</text>
         <text v-if="order.status === 'cancelled'" class="status-hint">订单已取消</text>
-        <text v-if="order.refundStatus === 1" class="status-hint">退款申请处理中,请耐心等待</text>
-        <text v-if="order.refundStatus === 2" class="status-hint">退款已完成,金额将原路返回</text>
+        <text v-if="order.status === 'pending_refund'" class="status-hint">退款申请待审核,请耐心等待</text>
+        <text v-if="order.status === 'refunding' || order.status === 'refund_pending'" class="status-hint">退款处理中,金额将原路到账</text>
+        <text v-if="order.status === 'refunded'" class="status-hint">退款已完成,金额已原路返回</text>
       </view>
+      <view class="section">
         <text class="section-title">订单信息</text>
         <view class="info-row">
           <text class="info-label">订单编号</text>
@@ -106,7 +108,7 @@
         </view>
       </view>
 
-      <view v-if="order.status === 'shipped' || order.status === 'completed'" class="section">
+      <view v-if="order.status === 'pending_receipt' || order.status === 'completed'" class="section">
         <text class="section-title">物流信息</text>
         <view class="info-row">
           <text class="info-label">物流公司</text>
@@ -131,11 +133,11 @@
       <!-- 履约确认收货按钮:线上服务/自取需要在供应商确认后用户才能确认 -->
       <button v-if="order.fulfillStatus === 'confirmed_by_vendor' && (order.deliveryMethod === 4 || order.deliveryMethod === 5)" class="btn-confirm-receive" @click="onConfirmReceive">确认收货</button>
       <button v-if="order.fulfillStatus === 'confirmed_by_vendor' && (order.deliveryMethod === 2 || order.deliveryMethod === 3)" class="btn-confirm-receive" @click="onConfirmReceive">确认收货</button>
-      <button v-if="order.status === 'shipped'" class="btn-confirm-receive" @click="onConfirmReceive">确认收货</button>
-      <button v-if="order.status === 'paid' || order.status === 'shipped' || order.status === 'pending_receipt'" class="btn-after-sales" @click="onApplyAfterSales">申请售后</button>
+
+      <button v-if="order.status === 'paid' || order.status === 'pending_receipt'" class="btn-after-sales" @click="onApplyAfterSales">申请售后</button>
       <button v-if="order.status === 'completed'" class="btn-buy-again" @click="onBuyAgain">再次购买</button>
-      <button v-if="order.refundStatus === 1 && order.status === 'refunding'" class="btn-cancel-refund" @click="onCancelRefund">取消退款申请</button>
-      <button v-if="order.status === 'completed' || order.status === 'refunding' || order.status === 'refunded'" class="btn-after-sales" @click="onAfterSales">售后记录</button>
+      <button v-if="order.status === 'pending_refund'" class="btn-cancel-refund" @click="onCancelRefund">取消退款申请</button>
+      <button v-if="order.status === 'completed' || order.status === 'pending_refund' || order.status === 'refunding' || order.status === 'refund_pending' || order.status === 'refunded'" class="btn-after-sales" @click="onAfterSales">售后记录</button>
     </view>
   </view>
 </template>
@@ -279,18 +281,24 @@ export default {
       }
     },
     getDisplayStatus() {
-      if (this.order.refundStatus === 1) return 'refunding'
-      if (this.order.refundStatus === 2) return 'refunded'
+      // 主状态优先(后端已按新口径写 pending_refund/refunding/pending_receipt 等)
+      var st = this.order.status
+      if (st === 'pending_refund' || st === 'refunding' || st === 'refund_pending' || st === 'refunded' || st === 'pending_receipt') {
+        return st
+      }
+      // 旧数据兜底:退款驳回
       if (this.order.refundStatus === 3) return 'refund-rejected'
-      return this.order.status
+      return st
     },
     getDisplayStatusText() {
       const map = {
         pending: '待支付',
         paid: '待发货',
-        shipped: '待收货',
+        pending_receipt: '待收货',
         completed: '已完成',
+        pending_refund: '待退款',
         refunding: '退款中',
+        refund_pending: '退款中',
         refunded: '已退款',
         cancelled: '已取消',
         'refund-rejected': '退款驳回'
@@ -439,6 +447,9 @@ export default {
 .order-status-section .status-pending { background: linear-gradient(135deg, $brand-primary, $brand-primary-light); }
 .order-status-section .status-paid { background: linear-gradient(135deg, $status-info-deep-2, $status-info-light); }
 .order-status-section .status-shipped { background: linear-gradient(135deg, $status-info-deep-2, $status-info-light); }
+.order-status-section .status-pending_receipt { background: linear-gradient(135deg, $status-info-deep-2, $status-info-light); }
+.order-status-section .status-pending_refund { background: linear-gradient(135deg, $status-warning-deep, $status-warning); }
+.order-status-section .status-refund_pending { background: linear-gradient(135deg, $status-warning-deep, $status-warning); }
 .order-status-section .status-completed { background: linear-gradient(135deg, $status-success-strong-2, #4ADE80); }
 .order-status-section .status-refunding { background: linear-gradient(135deg, $status-warning-deep, $status-warning); }
 .order-status-section .status-refunded { background: linear-gradient(135deg, $facade-text-slate, $facade-text-gray-400); }

+ 17 - 7
cfc-frontend/pages/shop/order-list/order-list.vue

@@ -89,7 +89,7 @@
               <button v-if="item.status === 'pending'" class="btn-sm btn-cancel" @click="onCancel(item.orderNo)">取消</button>
               <button v-if="item.status === 'pending'" class="btn-sm btn-pay" @click="onPay(item.orderNo, item.totalAmount)">去支付</button>
               <button v-if="item.status === 'paid'" class="btn-sm btn-refund" @click="goAfterSales(item.id, item.orderNo)">申请退款</button>
-              <button v-if="item.status === 'shipped'" class="btn-sm btn-confirm" @click="onConfirm(item.orderNo)">确认收货</button>
+              <button v-if="item.status === 'pending_receipt'" class="btn-sm btn-confirm" @click="onConfirm(item.orderNo)">确认收货</button>
               <button v-if="item.status === 'completed'" class="btn-sm btn-rebuy" @click="goDetail(item.orderNo)">再次购买</button>
             </view>
           </view>
@@ -130,12 +130,13 @@ export default {
         { label: '全部', value: '' },
         { label: '待支付', value: 'pending' },
         { label: '待发货', value: 'paid' },
-        { label: '待收货', value: 'shipped' },
+        { label: '待收货', value: 'pending_receipt' },
         { label: '已完成', value: 'completed' },
+        { label: '待退款', value: 'pending_refund' },
         { label: '退款中', value: 'refunding' }
       ],
       currentStatus: '',
-      statusCounts: { total: 0, pending: 0, paid: 0, shipped: 0, completed: 0, refunding: 0 },
+      statusCounts: { total: 0, pending: 0, paid: 0, pending_receipt: 0, completed: 0, pending_refund: 0, refunding: 0 },
       orders: [],
       page: 1,
       size: 20,
@@ -290,18 +291,24 @@ export default {
       uni.navigateTo({ url: url })
     },
     getDisplayStatus(item) {
-      if (item.refundStatus === 1) return 'refunding'
-      if (item.refundStatus === 2) return 'refunded'
+      // 主状态优先(后端已按新口径写 pending_refund/refunding/pending_receipt 等)
+      var st = item.status
+      if (st === 'pending_refund' || st === 'refunding' || st === 'refund_pending' || st === 'refunded' || st === 'pending_receipt') {
+        return st
+      }
+      // 旧数据兜底:退款子状态
       if (item.refundStatus === 3) return 'refund-rejected'
-      return item.status
+      return st
     },
     getDisplayStatusText(item) {
       var map = {
         pending: '待支付',
         paid: '待发货',
-        shipped: '待收货',
+        pending_receipt: '待收货',
         completed: '已完成',
+        pending_refund: '待退款',
         refunding: '退款中',
+        refund_pending: '退款中',
         refunded: '已退款',
         cancelled: '已取消',
         'refund-rejected': '退款驳回'
@@ -543,8 +550,11 @@ export default {
 .status-pending { background: $brand-primary-tint-2; color: $brand-primary; }
 .status-paid { background: $tint-sky-tint; color: $status-info-deep-2; }
 .status-shipped { background: $tint-sky-tint; color: $status-info-deep-2; }
+.status-pending_receipt { background: $tint-sky-tint; color: $status-info-deep-2; }
+.status-pending_refund { background: $status-warning-soft; color: $status-warning-deep; }
 .status-completed { background: $status-success-tint-2; color: $status-success-strong-2; }
 .status-refunding { background: $status-warning-soft; color: $status-warning-deep; }
+.status-refund_pending { background: $status-warning-soft; color: $status-warning-deep; }
 .status-refunded { background: $facade-fill-2; color: $facade-text-muted; }
 .status-cancelled { background: $facade-fill-2; color: $facade-text-muted; }
 .status-refund-rejected { background: $status-danger-soft; color: $status-danger-deep; }