张田田 3 tygodni temu
rodzic
commit
66f8a68159

+ 14 - 3
miniprogram/module/order/components/refund-confirm-popup/refund-confirm-popup.scss

@@ -49,7 +49,7 @@
   background: #fff;
   padding: 16rpx;
   border-radius: 12rpx;
-  border: 1rpx solid #f3f3f3;
+  // border: 1rpx solid #f3f3f3;
   margin-bottom: 10px;
 }
 
@@ -60,9 +60,20 @@
   background: #efefef;
 }
 
+.goods-card__icon--placeholder {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: #f5f5f5;
+}
+
+.placeholder-icon {
+  font-size: 48rpx;
+}
+
 .goods-card__main {
   flex: 1;
-  margin-left: 15px;
+  // margin-left: 15px;
 }
 
 .goods-card__name {
@@ -266,4 +277,4 @@
 }
 .confirm-btn {
  margin-left: 20rpx !important;
-}
+}

+ 3 - 1
miniprogram/module/order/components/refund-confirm-popup/refund-confirm-popup.wxml

@@ -15,7 +15,9 @@
     <view class="refund-confirm-popup__content">
       <view class="goods-card">
         <image class="goods-card__icon" src="{{goodsImage}}" mode="aspectFill" wx:if="{{goodsImage}}" />
-        <view class="goods-card__icon" wx:else />
+        <view class="goods-card__icon goods-card__icon--placeholder" wx:else>
+          <text class="placeholder-icon">📦</text>
+        </view>
         <view class="goods-card__main">
           <view class="goods-card__name">{{goodsName}}</view>
           <view class="goods-card__meta">{{goodsMeta1}}</view>

+ 15 - 2
miniprogram/module/order/pages/negotiation-history/negotiation-history.scss

@@ -31,13 +31,26 @@ page {
   margin-bottom: 20rpx;
 }
 
-.user-avatar {
+.avatar {
   width: 72rpx;
   height: 72rpx;
   border-radius: 50%;
-  background-color: #e8e8e8;
   margin-right: 20rpx;
   flex-shrink: 0;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-size: 22rpx;
+  font-weight: 500;
+  color: #fff;
+}
+
+.avatar--user {
+  background-color: #1d6ff6;
+}
+
+.avatar--platform {
+  background-color: #ff8c00;
 }
 
 .user-info {

+ 2 - 2
miniprogram/module/order/pages/negotiation-history/negotiation-history.ts

@@ -37,8 +37,8 @@ Page({
         } else {
           // 平台操作
           const lines: string[] = [];
-          if (item.title) lines.push(`【标题】${item.title}`);
-          if (item.content) lines.push(`【内容】${item.content}`);
+          if (item.title) lines.push(`${item.title}`);
+          if (item.content) lines.push(`${item.content}`);
           return {
             type: 'platform',
             avatar: '',

+ 4 - 1
miniprogram/module/order/pages/negotiation-history/negotiation-history.wxml

@@ -6,7 +6,10 @@
       
       <!-- 顶部信息 -->
       <view class="item-header">
-        <image class="user-avatar" src="{{item.avatar}}" mode="aspectFill"></image>
+        <view class="avatar {{item.type === 'platform' ? 'avatar--platform' : 'avatar--user'}}">
+          <text wx:if="{{item.type === 'platform'}}">平台</text>
+          <text wx:else>{{item.name[0] || '用'}}</text>
+        </view>
         <view class="user-info">
           <view class="user-name">{{item.name}}</view>
           <view class="action-time">{{item.time}}</view>

+ 2 - 2
miniprogram/module/order/pages/other-detail/other-detail.ts

@@ -322,7 +322,7 @@ Page({
   onAftersaleProgress(e: any) {
     const { goods } = e.currentTarget.dataset;
     wx.navigateTo({
-      url: `/module/order/pages/refund-processing/refund-processing?id=${goods.id}`,
+      url: `/module/order/pages/refund-processing/refund-processing?id=${goods.id}&recordId=${goods.patientConditioningRecordId || ''}`,
     });
   },
 
@@ -409,7 +409,7 @@ Page({
       patientConditioningRecordId: (afterSaleSiteOption as any).patientConditioningRecordId,
       patientConditioningProgramId: (afterSaleSiteOption as any).patientConditioningProgramId,
       type: selectedAfterSaleType,
-      receiptStatus: (afterSaleSiteOption as any).sellType === '1' ? refundStatus : '',
+      ...((afterSaleSiteOption as any).sellType === '1' ? { receiptStatus: refundStatus } : {}),
       reason: selectedRefundReason,
       applyAmount: refundAmount,
       voucherImgs: refundProofImages,

+ 1 - 1
miniprogram/module/order/pages/refund-processing/refund-processing.scss

@@ -144,7 +144,7 @@ page {
 
 .goods-info {
   display: flex;
-  align-items: center;
+  // align-items: center;
   margin-bottom: 32rpx;
 }
 

+ 59 - 11
miniprogram/module/order/pages/refund-processing/refund-processing.ts

@@ -1,4 +1,4 @@
-import { getAfterSaleDetailMethod, cancelAfterSaleMethod, updateAfterSaleMethod } from "../../request";
+import { getAfterSaleDetailMethod, cancelAfterSaleMethod, applyAfterSaleMethod, updateAfterSaleMethod } from "../../request";
 
 // progress 数字转页面状态
 const progressToState: Record<string, string> = {
@@ -12,6 +12,7 @@ const progressToState: Record<string, string> = {
 Page({
   data: {
     id: '',
+    recordId: '',
     aftersaleId: '',
     pageTitle: '商家处理',
     refundState: '',
@@ -31,6 +32,7 @@ Page({
       finishTime: "",
       applyTime: "",
       refundNo: "",
+      updateTime:""
     },
     // 协商历史标题和内容
     negotiateTitle: "",
@@ -46,15 +48,19 @@ Page({
     refundConfirmPopupVisible: false,
     refundProofPopupVisible: false,
     refundStatus: '',
+    refundAction: '', // 'modify' 修改申请 | 'reApply' 再次申请
     refundMaxAmount: '0',
     refundProofImages: [] as string[],
+    refundDesc: '',
+    // 接口提交所需原始字段
+    rawDetail: {} as any,
   },
 
   timer: null as any,
 
   onLoad(options: any) {
     if (options.id) {
-      this.setData({ id: options.id });
+      this.setData({ id: options.id, recordId: options.recordId || '' });
       this.loadDetail(options.id);
     }
   },
@@ -75,6 +81,7 @@ Page({
       const refundState = progressToState[String(detail.progress)] || 'processing';
 
       this.setData({
+        rawDetail: detail,
         aftersaleId: detail.id || '',
         refundState,
         goods: {
@@ -85,16 +92,22 @@ Page({
         },
         refundDetail: {
           reason: detail.reason || '',
-          amount: String(detail.reviewAmount || detail.applyAmount || 0),
+          amount: String(detail.applyAmount || 0),
           finishTime: detail.finishTime || '',
           applyTime: detail.applyTime || '',
           refundNo: detail.ref || '',
+          updateTime:detail.updateTime || ''
         },
         negotiateTitle: detail.title || '',
-        negotiateContent: detail.content || '',
+        negotiateContent: (() => {
+          const c = detail.content || '';
+          try { if (c && JSON.parse(c)) return ''; } catch (e) { /* 不是JSON,保留原文 */ }
+          return c;
+        })(),
         handleEndTime: detail.handleEndTime || '',
         refundMaxAmount: String(detail.applyAmount || 0),
         refundProofImages: detail.voucherImgs || [],
+        refundDesc: detail.remark || '',
       });
 
       this.updatePageTitle();
@@ -129,6 +142,14 @@ Page({
     const setTime = (diff: number) => {
       if (diff <= 0) {
         this.setData({ days: '00', hours: '00', minutes: '00', seconds: '00' });
+        if (this.timer) {
+          clearInterval(this.timer);
+          this.timer = null;
+        }
+        // 拒绝状态倒计时结束,清除截止时间,触发按钮切换
+        if (this.data.refundState === 'rejected' && this.data.handleEndTime) {
+          this.setData({ handleEndTime: '' });
+        }
         return;
       }
       const d = Math.floor(diff / (1000 * 60 * 60 * 24));
@@ -160,7 +181,7 @@ Page({
 
   // 修改申请:打开确认弹窗
   onModify() {
-    this.setData({ refundConfirmPopupVisible: true });
+    this.setData({ refundAction: 'modify', refundConfirmPopupVisible: true });
   },
 
   onRefundConfirmClose() {
@@ -191,15 +212,37 @@ Page({
     });
   },
 
-  onSubmitRefundApply() {
-    this.setData({ refundConfirmPopupVisible: false });
+  async onSubmitRefundApply() {
+    if (!this.data.refundProofImages.length) {
+      wx.showToast({ title: '请上传凭证图片', icon: 'none' });
+      return;
+    }
     wx.showLoading({ title: '正在提交' });
-    setTimeout(() => {
-      wx.hideLoading();
+    const { rawDetail, refundStatus, refundDetail, refundProofImages, refundDesc, recordId, id, aftersaleId, refundAction } = this.data;
+    const params = {
+      patientConditioningRecordId: recordId,
+      patientConditioningProgramId: id,
+      type: rawDetail.type,
+      ...(rawDetail.sellType === '1' ? { receiptStatus: refundStatus || rawDetail.receiptStatus } : {}),
+      reason: refundDetail.reason,
+      applyAmount: Number(refundDetail.amount) || 0,
+      voucherImgs: refundProofImages,
+      remark: refundDesc,
+    };
+    try {
+      if (refundAction === 'modify') {
+        await updateAfterSaleMethod(Number(aftersaleId), params);
+      } else {
+        await applyAfterSaleMethod(params);
+      }
+      this.setData({ refundConfirmPopupVisible: false });
       wx.navigateTo({
         url: '/module/order/pages/refund-success/refund-success'
       });
-    }, 1000);
+    } catch (error: any) {
+      wx.showToast({ title: error.errMsg || '提交失败', icon: 'none' });
+    }
+    wx.hideLoading();
   },
 
   onRefundReasonPopupClose() {
@@ -215,12 +258,13 @@ Page({
   },
 
   onRefundProofPopupClose() {
-    this.setData({ refundProofPopupVisible: false });
+    this.setData({ refundProofPopupVisible: false, refundConfirmPopupVisible: true });
   },
 
   onRefundProofSubmit(e: any) {
     this.setData({
       refundProofImages: e.detail.images,
+      refundDesc: e.detail.desc || '',
       refundProofPopupVisible: false,
       refundConfirmPopupVisible: true
     });
@@ -248,6 +292,10 @@ Page({
     });
   },
 
+  onReApply() {
+    this.setData({ refundAction: 'reApply', refundConfirmPopupVisible: true });
+  },
+
   onRevoke() {
     wx.showModal({
       title: '撤销退款申请',

+ 24 - 16
miniprogram/module/order/pages/refund-processing/refund-processing.wxml

@@ -24,8 +24,8 @@
       <view class="approved-time">{{refundDetail.applyTime}}</view>
 
       <view class="approved-content" wx:if="{{negotiateTitle || negotiateContent}}">
-        <view class="content-row" wx:if="{{negotiateTitle}}">【标题】{{negotiateTitle}}</view>
-        <view class="content-row" wx:if="{{negotiateContent}}">【内容】{{negotiateContent}}</view>
+        <view class="content-row" wx:if="{{negotiateTitle}}">{{negotiateTitle}}</view>
+        <view class="content-row" wx:if="{{negotiateContent}}">{{negotiateContent}}</view>
       </view>
     </block>
 
@@ -36,12 +36,12 @@
 
     <!-- 拒绝状态 -->
     <block wx:elif="{{refundState === 'rejected'}}">
-      <view class="approved-title">拒绝退款(请在{{days}}天{{hours}}小时{{minutes}}分钟内处理)</view>
+      <view class="approved-title">拒绝退款({{handleEndTime ? '请在' + days + '天' + hours + '小时' + minutes + '分钟内处理' : '超过处理时间'}})</view>
       <view class="approved-time">{{refundDetail.applyTime}}</view>
 
       <view class="approved-content" wx:if="{{negotiateTitle || negotiateContent}}">
-        <view class="content-row" wx:if="{{negotiateTitle}}">【标题】{{negotiateTitle}}</view>
-        <view class="content-row" wx:if="{{negotiateContent}}">【内容】{{negotiateContent}}</view>
+        <view class="content-row" wx:if="{{negotiateTitle}}">{{negotiateTitle}}</view>
+        <view class="content-row" wx:if="{{negotiateContent}}">{{negotiateContent}}</view>
       </view>
     </block>
 
@@ -66,7 +66,7 @@
     <view class="goods-info">
       <image class="goods-img" src="{{goods.image}}" mode="aspectFill" wx:if="{{goods.image}}"></image>
       <view class="service-package-placeholder" wx:else>
-        <t-icon name="image" size="48rpx" color="#ccc" />
+        <text class="placeholder-icon">📦</text>
       </view>
       <view class="goods-desc">
         <view class="goods-title">{{goods.name}}</view>
@@ -95,11 +95,11 @@
       <!-- 根据状态不同展示不同的时间标签 -->
       <view class="info-item" wx:if="{{refundState === 'approved' || refundState === 'completed'}}">
         <text class="info-label">退款完结</text>
-        <text class="info-value">{{refundDetail.finishTime}}</text>
+        <text class="info-value">{{refundDetail.updateTime}}</text>
       </view>
       <view class="info-item" wx:elif="{{refundState === 'revoked'}}">
         <text class="info-label">撤销时间</text>
-        <text class="info-value">{{refundDetail.finishTime}}</text>
+        <text class="info-value">{{refundDetail.updateTime}}</text>
       </view>
       <view class="info-item">
         <text class="info-label">申请时间</text>
@@ -123,16 +123,22 @@
 </scroll-view>
 
 <!-- 底部操作按钮 -->
-<view class="bottom-bar {{refundState === 'rejected' ? 'bottom-bar-rejected' : ''}}" wx:if="{{refundState === 'processing' || refundState === 'rejected'}}">
+<view class="bottom-bar {{refundState === 'rejected' ? 'bottom-bar-rejected' : ''}}" wx:if="{{refundState === 'processing' || refundState === 'rejected' || refundState === 'revoked'}}">
   <!-- 处理中:单个撤销按钮 -->
   <button class="revoke-btn" bindtap="onRevoke" wx:if="{{refundState === 'processing'}}">撤销申请</button>
-  
-  <!-- 拒绝退款:修改申请 & 撤销申请 组合按钮 -->
-  <view class="dual-btn-group" wx:if="{{refundState === 'rejected'}}">
+
+  <!-- 撤销状态:再次申请按钮 -->
+  <button class="revoke-btn" bindtap="onReApply" wx:if="{{refundState === 'revoked'}}">再次申请</button>
+
+  <!-- 拒绝退款且有截止时间:修改申请 & 撤销申请 组合按钮 -->
+  <view class="dual-btn-group" wx:if="{{refundState === 'rejected' && handleEndTime}}">
     <button class="dual-btn left-btn" bindtap="onModify">修改申请</button>
     <view class="btn-divider"></view>
     <button class="dual-btn right-btn" bindtap="onRevoke">撤销申请</button>
   </view>
+
+  <!-- 拒绝退款且超过处理时间:再次申请按钮 -->
+  <button class="revoke-btn" bindtap="onReApply" wx:if="{{refundState === 'rejected' && !handleEndTime}}">再次申请</button>
 </view>
 
 <!-- 退款修改相关弹窗 -->
@@ -146,13 +152,14 @@
 <refund-confirm-popup
   visible="{{refundConfirmPopupVisible}}"
   goods-name="{{goods.name}}"
-  goods-price="{{goods.price || '240'}}"
+  goods-image="{{goods.image}}"
+  goods-price="{{goods.price}}"
   goods-meta1="{{goods.meta1}}"
   goods-meta2="{{goods.meta2}}"
   refund-reason="{{refundDetail.reason}}"
   refund-status="{{refundStatus || '仅退款'}}"
   refund-amount="{{refundDetail.amount}}"
-  max-amount="{{refundMaxAmount || '240'}}"
+  max-amount="{{refundMaxAmount}}"
   proof-images="{{refundProofImages || []}}"
   bind:close="onRefundConfirmClose"
   bind:changeStatus="onChangeRefundStatus"
@@ -164,7 +171,8 @@
 
 <refund-proof-popup
   visible="{{refundProofPopupVisible}}"
-  initial-images="{{refundProofImages}}"
+  images="{{refundProofImages}}"
+  desc="{{refundDesc}}"
   bind:close="onRefundProofPopupClose"
-  bind:submit="onRefundProofSubmit"
+  bind:confirm="onRefundProofSubmit"
 />

+ 2 - 2
miniprogram/module/order/request.ts

@@ -137,8 +137,8 @@ export function cancelAfterSaleMethod(id: number) {
   });
 }
 // 订单商品售后修改
-export function updateAfterSaleMethod(data: any) {
-  return Post(`/patientCrManage/updateAftersale`, data, {
+export function updateAfterSaleMethod(id: number, data: any) {
+  return Post(`/patientCrManage/updateAftersale/${id}`, data, {
     transform({ data }: AnyObject) {
       return data;
     },