张田田 преди 2 месеца
родител
ревизия
2cb78e689d

+ 19 - 4
miniprogram/module/care/pages/care/verifyRecord.scss

@@ -43,7 +43,7 @@
     display: flex;
     flex-wrap: wrap;
   }
-  
+
   .opt-img {
     display: flex;
     justify-content: baseline;
@@ -64,7 +64,7 @@
   align-items: center;
   min-height: 300rpx;
   padding: 40rpx;
-  
+
   .empty-text {
     color: #999;
     font-size: 28rpx;
@@ -76,7 +76,7 @@
   border-radius: 16rpx;
   // margin: 24rpx;
   padding: 30rpx 32rpx 40rpx;
-  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
+  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
   margin-bottom: 20rpx;
 }
 
@@ -158,4 +158,19 @@
   color: #000;
   line-height: 1.8;
   text-align: center;
-}
+}
+.evaluate-box{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+.btn-review {
+  padding: 12rpx 40rpx;
+  border-radius: 12rpx;
+  font-size: 26rpx;
+  text-align: center;
+  background-color: #fff;
+  color: #1976d2;
+  border: 1px solid #1976d2;
+  margin-left: 20rpx;
+}

+ 17 - 0
miniprogram/module/care/pages/care/verifyRecord.ts

@@ -64,5 +64,22 @@ Page({
       console.error("核销记录列表", error);
     }
   },
+  // 去评价
+  onReview(e: WechatMiniprogram.TouchEvent) {
+    console.log(e.currentTarget.dataset);
+    const { evaluateTime } = e.currentTarget.dataset.goods;
+    if (evaluateTime) {
+      // 线下服务评价详情
+      wx.navigateTo({
+        url: `/module/order/pages/offline-evaluateDetail/offline-evaluateDetail?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
+      });
+    } else {
+      // 去线下服务评价
+      wx.navigateTo({
+        url: `/module/order/pages/offline-evaluate/offline-evaluate?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
+      });
+
+    }
+  },
 
 });

+ 68 - 69
miniprogram/module/care/pages/care/verifyRecord.wxml

@@ -1,82 +1,81 @@
 <t-navbar title="核销记录" left-arrow />
 <scroll-view class="page-container" scroll-y>
   <!-- 预约成功卡片 -->
-    <view class="appointment-success-card" wx:if="{{showAppointmentInfo}}">
-      <!-- 标题 -->
-      <view class="appointment-success-title">预约成功</view>
-      
-      <!-- 二维码 -->
-      <view class="qr-code-container" wx:if="{{qrCodeUrl}}">
-        <image 
-          class="qr-code-image" 
-          src="{{qrCodeUrl}}" 
-          mode="aspectFit"
-        />
-      </view>
-      
-      <!-- 预约详情 -->
-      <view class="appointment-info">
-        <view class="info-item" wx:if="{{appointmentInfo.arrangeTime}}">
-          <text class="info-label">开始服务时间:</text>
-          <text class="info-value">{{appointmentInfo.arrangeTime}}</text>
-        </view>
-        <view class="info-item" wx:if="{{appointmentInfo.arrangeDuration}}">
-          <text class="info-label">服务时长:</text>
-          <text class="info-value">{{appointmentInfo.arrangeDuration}}分钟</text>
-        </view>
-        <view class="info-item" wx:if="{{appointmentInfo.conditioningProgramSupplierName}}">
-          <text class="info-label">服务机构:</text>
-          <text class="info-value" wx:if="{{appointmentInfo.pieTime}}">{{appointmentInfo.conditioningProgramSupplierName}}</text>
-          <text class="info-value" wx:else>待分配</text>
-        </view>
-        <view class="info-item" wx:if="{{appointmentInfo.cpSupplierDetailAddress}}">
-          <text class="info-label">服务地址:</text>
-          <text class="info-value">{{appointmentInfo.cpSupplierDetailAddress}}</text>
-        </view>
-        <view class="info-item" wx:if="{{appointmentInfo.cpSupplierPhone}}">
-          <text class="info-label">联系电话:</text>
-          <text class="info-value">{{appointmentInfo.cpSupplierPhone}}</text>
-        </view>
-      </view>
-      
-      <!-- 提示信息 -->
-      <view class="appointment-tip">
-        <text class="tip-text">为了保证您的服务体验,请提前5分钟到达门店</text>
-      </view>
+  <view class="appointment-success-card" wx:if="{{showAppointmentInfo}}">
+    <!-- 标题 -->
+    <view class="appointment-success-title">预约成功</view>
+
+    <!-- 二维码 -->
+    <view class="qr-code-container" wx:if="{{qrCodeUrl}}">
+      <image class="qr-code-image" src="{{qrCodeUrl}}" mode="aspectFit" />
     </view>
-<view class="verify-record-page" wx:if="{{recordList.length>0}}">
-  <block wx:for="{{recordList}}" wx:key="id">
-    <view class="record-card">
-      <view class="record-header">
-        <text class="record-index">{{index + 1}}、</text>
-        <text class="record-time">{{item.operateTime}}</text>
+
+    <!-- 预约详情 -->
+    <view class="appointment-info">
+      <view class="info-item" wx:if="{{appointmentInfo.arrangeTime}}">
+        <text class="info-label">开始服务时间:</text>
+        <text class="info-value">{{appointmentInfo.arrangeTime}}</text>
       </view>
-      <view class="record-row" wx:if="{{item.operateBy}}">
-        <text class="label">操作人:</text>
-        <text style="color:black">{{item.operateBy}}</text>
+      <view class="info-item" wx:if="{{appointmentInfo.arrangeDuration}}">
+        <text class="info-label">服务时长:</text>
+        <text class="info-value">{{appointmentInfo.arrangeDuration}}分钟</text>
       </view>
-       <!-- 新增加的一列--机构 -->
-        <view class="record-row" wx:if="{{item.operateBy}}">
-        <text class="label">机构:</text>
-        <text style="color:black">{{item.operateBy}}</text>
+      <view class="info-item" wx:if="{{appointmentInfo.conditioningProgramSupplierName}}">
+        <text class="info-label">服务机构:</text>
+        <text class="info-value" wx:if="{{appointmentInfo.pieTime}}">{{appointmentInfo.conditioningProgramSupplierName}}</text>
+        <text class="info-value" wx:else>待分配</text>
       </view>
-       <!-- end -->
-      <view class="record-row" wx:if="{{item.feedback}}">
-        <text class="label">治疗备注:</text>
-        <text style="color:black">{{item.feedback}}</text>
+      <view class="info-item" wx:if="{{appointmentInfo.cpSupplierDetailAddress}}">
+        <text class="info-label">服务地址:</text>
+        <text class="info-value">{{appointmentInfo.cpSupplierDetailAddress}}</text>
       </view>
-      <view class="record-row" wx:if="{{item.acuPointNames}}">
-        <text class="label">穴位:</text>
-        <text style="color:black">{{item.acuPointNames}}</text>
-      </view>
-       <view class="record-row opt-img" wx:if="{{item.photo}}">
-        <text class="label">操作照片:</text>
-     <image src="{{item.photo}}" class="img-box" />
+      <view class="info-item" wx:if="{{appointmentInfo.cpSupplierPhone}}">
+        <text class="info-label">联系电话:</text>
+        <text class="info-value">{{appointmentInfo.cpSupplierPhone}}</text>
       </view>
     </view>
-  </block>
-</view>
- <view wx:else class="empty-state">
+
+    <!-- 提示信息 -->
+    <view class="appointment-tip">
+      <text class="tip-text">为了保证您的服务体验,请提前5分钟到达门店</text>
+    </view>
+  </view>
+  <view class="verify-record-page" wx:if="{{recordList.length>0}}">
+    <block wx:for="{{recordList}}" wx:key="id">
+      <view class="record-card">
+        <view class="evaluate-box">
+          <view class="record-header">
+            <text class="record-index">{{index + 1}}、</text>
+            <text class="record-time">{{item.operateTime}}</text>
+          </view>
+          <view class="btn-review" catchtap="onReview" data-goods="{{item}}">评价</view>
+        </view>
+        <view class="record-row" wx:if="{{item.operateBy}}">
+          <text class="label">操作人:</text>
+          <text style="color:black">{{item.operateBy}}</text>
+        </view>
+        <!-- 新增加的一列--机构 -->
+        <view class="record-row" wx:if="{{item.operateBy}}">
+          <text class="label">机构:</text>
+          <text style="color:black">{{item.operateBy}}</text>
+        </view>
+        <!-- end -->
+        <view class="record-row" wx:if="{{item.feedback}}">
+          <text class="label">治疗备注:</text>
+          <text style="color:black">{{item.feedback}}</text>
+        </view>
+        <view class="record-row" wx:if="{{item.acuPointNames}}">
+          <text class="label">穴位:</text>
+          <text style="color:black">{{item.acuPointNames}}</text>
+        </view>
+        <view class="record-row opt-img" wx:if="{{item.photo}}">
+          <text class="label">操作照片:</text>
+          <image src="{{item.photo}}" class="img-box" />
+        </view>
+      </view>
+    </block>
+  </view>
+  <view wx:else class="empty-state">
     <text class="empty-text">暂无核销数据</text>
   </view>
 </scroll-view>

+ 13 - 0
miniprogram/module/order/model/evaluate.model.ts

@@ -0,0 +1,13 @@
+export interface EvaluateModel {
+  patientConditioningRecordId: string; //	患者调理记录ID
+  patientConditioningProgramId: string; //患者调理方案ID
+  lineId: string; //调理任务ID
+  conditioningProgramId:number; //调理方案ID
+  complianceScore:number;  //相符度评分
+  qualityScore:number;  //质量评分
+  attitudeScore:number;  //态度评分
+  environmentScore:number;  //环境评分
+  depict:string;  //评价描述
+  imageVideos:string[];  //评价图片/视频
+  createTime:string;  //创建时间
+}

+ 11 - 0
miniprogram/module/order/pages/goods-evaluate/goods-evaluate.scss

@@ -100,6 +100,17 @@
 .comment-placeholder {
   color: #999;
 }
+.product-name-row {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  gap: 8rpx;
+}
+.product-divider {
+  font-size: 28rpx;
+  color: #dcdcdc;
+  margin: 0 30rpx;
+}
 
 .comment-count {
   position: absolute;

+ 43 - 22
miniprogram/module/order/pages/goods-evaluate/goods-evaluate.ts

@@ -1,13 +1,16 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
-
+import { EvaluateModel } from "../../model/evaluate.model";
+import { evaluateOrderGoodsMethod } from "../../request";
+import { upload } from "../../../../lib/request/upload";
 Page({
   behaviors: [PageContainerBehavior],
   data: {
     orderId: "",
-    product: {} as { name: string; image: string; description?: string },
+    product: {} as { name: string; image: string; description?: string, patientConditioningRecordId?: number, patientConditioningProgramId?: number },
     score: 0,
     rateColor: "#F7BA2A",
     content: "",
+    evaluateInfo: {} as EvaluateModel,
     mediaList: [] as { path: string; type: "image" | "video" }[],
     canPublish: false,
     videoFullscreen: false,
@@ -15,18 +18,23 @@ Page({
   onLoad(options: Record<string, string>) {
     console.log(options, "options===");
     // const orderId = options.orderId || options.id || "";
-    let product: { name: string; image: string; description?: string } = {
+    let product: { name: string; image: string; description?: string, patientConditioningRecordId?: number, patientConditioningProgramId?: number } = {
       name: "",
       image: "",
       description: "",
+      patientConditioningRecordId: 0,
+      patientConditioningProgramId: 0,
     };
     if (options.goodsInfo) {
-        const goods = JSON.parse(decodeURIComponent(options.goodsInfo));
-        product = {
-          name: goods.name || "",
-          image: goods.image || "",
-          description: goods.description || "",
-        };
+      const goods = JSON.parse(decodeURIComponent(options.goodsInfo));
+      console.log(goods, "goods===");
+      product = {
+        name: goods.name || "",
+        image: goods.image || "",
+        description: goods.description || "",
+        patientConditioningRecordId: goods.patientConditioningRecordId || 0,
+        patientConditioningProgramId: goods.id || 0,
+      };
     }
     this.setData({
       // orderId,
@@ -97,27 +105,40 @@ Page({
   },
   onRemoveProduct() {
     this.setData({
-      product: { name: "", image: "", description: "" },
+      product: { name: "", image: "", description: "", patientConditioningRecordId: 0, patientConditioningProgramId: 0 },
     });
   },
-  onPublish() {
+  async onPublish() {
     if (!this.data.canPublish) {
       wx.showToast({ title: "请先完成评分", icon: "none" });
       return;
     }
-    const { orderId } = this.data;
+
+    console.log(this.data.product,"90000")
+    const data = {
+      patientConditioningProgramId: this.data.product.patientConditioningProgramId,
+      patientConditioningRecordId: this.data.product.patientConditioningRecordId,
+      complianceScore: this.data.score,
+      depict: this.data.content,
+      imageVideos: this.data.mediaList,
+    };
+    console.log(data,"评价数据")
+    return
     // TODO: 调用评价提交接口,将 this.data.score、content、mediaList 上传
-    wx.showLoading({ title: "发布中..." });
-    setTimeout(() => {
-      wx.hideLoading();
-      wx.showToast({ title: "发布成功", icon: "success" });
-      if (orderId) {
+    try {
+      await evaluateOrderGoodsMethod(data)
+      wx.showLoading({ title: "发布中..." });
+      setTimeout(() => {
+        wx.hideLoading();
+        wx.showToast({ title: "发布成功", icon: "success" });
         wx.redirectTo({
-          url: `/module/order/pages/other-detail/other-detail?id=${orderId}`,
+          url: `/module/order/pages/other-detail/other-detail`,
         });
-      } else {
-        wx.navigateBack();
-      }
-    }, 500);
+      }, 500);
+    } catch (error: any) {
+      wx.showToast({ title: error.errMsg || "发布失败", icon: "none" });
+    } finally {
+      wx.hideLoading();
+    }
   },
 });

+ 4 - 1
miniprogram/module/order/pages/goods-evaluate/goods-evaluate.wxml

@@ -6,8 +6,11 @@
     <view class="product-card" wx:if="{{product.name}}">
       <image class="product-img" src="{{product.image}}" mode="aspectFill" />
       <view class="product-info">
+       <view class="product-name-row">
         <text class="product-name">{{product.name}}</text>
-        <text class="product-spec" wx:if="{{product.spec}}">{{product.spec}}</text>
+        <text class="product-divider" wx:if="{{product.description}}">|</text>
+        <text class="product-spec" wx:if="{{product.description}}">{{product.description}}</text>
+        </view>
       </view>
     </view>
 

+ 10 - 5
miniprogram/module/order/pages/other-detail/other-detail.ts

@@ -123,7 +123,7 @@ Page({
             // 0是一口价 1按穴位/经络次数计费
             const pricingType = item?.conditioningProgramDetail?.pricingType;
             return {
-              id: item.id || '',
+              id: item.id || '', //患者调理方案id
               patientConditioningRecordId: item?.patientConditioningRecordId || '',//调理记录id
               name: item.conditioningProgramName || '',
               description: (() => {
@@ -148,6 +148,8 @@ Page({
               quantity: item?.totalMeasure || 0,
               statusClass: this.getStatusClass(item?.sellType, item?.progress, item?.receiptStatus),
               statusText: this.getGoodsStatusText(item?.sellType, item?.progress, item?.receiptStatus),
+              isCanEvaluate: item?.isCanEvaluate, //是否可以评价 false-否 true-是
+              evaluateTime: item?.evaluateTime, //有评价时间就是已评价,是空就是未评价
             }
           });
         };
@@ -267,6 +269,7 @@ Page({
   onReview(e: WechatMiniprogram.TouchEvent) {
     // const orderId = this.data.id || "";
     console.log(e.currentTarget.dataset);
+    const { evaluateTime } = e.currentTarget.dataset.goods;
     // const { name = "", image = "", description = ''} = (e.currentTarget.dataset.goods || {}) as {
     //   name?: string;
     //   image?: string;
@@ -278,14 +281,16 @@ Page({
     // if (image) parts.push(`image=${encodeURIComponent(image)}`);
     // if (description != null) parts.push(`description=${encodeURIComponent(description.toString())}`);
     // const query = parts.length ? "?" + parts.join("&") : "";
-    if (false) {
+    if (evaluateTime) {
+      // 单商品评价详情
       wx.navigateTo({
-        url: `/module/order/pages/goods-evaluate/goods-evaluate?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
+        url: `/module/order/pages/goods-evaluateDetail/goods-evaluateDetail?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
       });
+
     } else {
-      // 单商品评价详情
+      // 去单商品评价页面
       wx.navigateTo({
-        url: `/module/order/pages/goods-evaluateDetail/goods-evaluateDetail?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
+        url: `/module/order/pages/goods-evaluate/goods-evaluate?goodsInfo=${encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods))}`,
       });
       // 线下服务评价
       // wx.navigateTo({

+ 6 - 6
miniprogram/module/order/pages/other-detail/other-detail.wxml

@@ -43,8 +43,8 @@
               </view>
               <!-- 申请售后 + 评价 -->
               <view class="action-btns">
-                <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view>
-                <view class="btn-review" catchtap="onReview" data-goods="{{goods}}">评价</view>
+                <!-- <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view> -->
+                <view class="btn-review" catchtap="onReview" data-goods="{{goods}}" wx:if="{{goods.isCanEvaluate}}">{{goods.evaluateTime?"已评价":"评价"}}</view>
               </view>
             </view>
           </view>
@@ -74,8 +74,8 @@
               </view>
               <!-- 申请售后 + 评价 -->
               <view class="action-btns" catchtap="preventTap">
-                <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view>
-                  <view class="btn-review" catchtap="onReview" data-goods="{{goods}}">评价</view>
+                <!-- <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view> -->
+                  <view class="btn-review" catchtap="onReview" data-goods="{{goods}}" wx:if="{{goods.isCanEvaluate}}">{{goods.evaluateTime?"已评价":"评价"}}</view>
               </view>
             </view>
           </view>
@@ -105,8 +105,8 @@
               </view>
               <!-- 申请售后 + 评价 -->
               <view class="action-btns">
-                <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view>
-                  <view class="btn-review" catchtap="onReview" data-goods="{{goods}}">评价</view>
+                <!-- <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view> -->
+                  <view class="btn-review" catchtap="onReview" data-goods="{{goods}}" wx:if="{{goods.isCanEvaluate}}">{{goods.evaluateTime?"已评价":"评价"}}</view>
               </view>
             </view>
           </view>

+ 16 - 0
miniprogram/module/order/request.ts

@@ -69,3 +69,19 @@ export function getAddressListMethod(id: string, keyWord: string) {
     }
   );
 }
+//获取订单商品-线下核销记录的患者个人评价 type 1-商品 2-线下核销记录 id:商品/线下核销记录id
+export function getOrderGoodsEvaluationMethod(type: string, id: string) {
+  return Post(`/patientCrManage/getEvaluate/${type}/${id}`, {
+    transform({ data }: AnyObject) {
+      return data;
+    },
+  });
+}
+// 订单商品评价
+export function evaluateOrderGoodsMethod(data: any) {
+  return Post(`/patientCrManage/evaluate`, data, {
+    transform({ data }: { data: any }) {
+      return data;
+    },
+  });
+}