Jelajahi Sumber

中医调养第二版的bug

张田田 9 bulan lalu
induk
melakukan
41a51388d5

+ 44 - 30
miniprogram/module/article/pages/confirm-receiving/confirm-receiving.ts

@@ -1,50 +1,58 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
 import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
 import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
-import { getDietMethod } from "../../request";
+import { getOrderDetailMethod, orderConfirmMethod } from "../../request";
 // module/diet/pages/delivery-address/delivery-address.ts
 // module/diet/pages/delivery-address/delivery-address.ts
-Component({
+Page({
   behaviors: [
   behaviors: [
     PageContainerBehavior,
     PageContainerBehavior,
     tickleBehavior,
     tickleBehavior,
   ],
   ],
-  lifetimes: {
-    attached() {
+  async onLoad(options:any) {
+    console.log("onLoad",options)
+    if(options.orderId){
+      this.setData({ id: options.orderId });
+      await this.load(options.orderId);
     }
     }
+  
   },
   },
   properties: {
   properties: {
   },
   },
   data: {
   data: {
+    id: '',
     goodsList: [
     goodsList: [
-      {
-        id: 1,
-        img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
-        name: '元气茶',
-        count: 3,
-        expressNo: '00385322232830'
-      },
-      {
-        id: 2,
-        img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
-        name: '芡实米仁燕麦粥',
-        count: 21,
-        expressNo: '00385322290821'
-      }
+      // {
+      //   id: 1,
+      //   img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
+      //   name: '元气茶',
+      //   count: 3,
+      //   expressNo: '00385322232830'
+      // },
+      // {
+      //   id: 2,
+      //   img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
+      //   name: '芡实米仁燕麦粥',
+      //   count: 21,
+      //   expressNo: '00385322290821'
+      // }
     ]
     ]
   },
   },
-  methods: {
-
-  
-    async load() {
+    async load(id:string) {
       wx.showLoading({ title: '加载中' });
       wx.showLoading({ title: '加载中' });
       try {
       try {
-        const dataset = await getDietMethod(this.data.id);
-        this.setData({ dataset, title: dataset.name });
-      } catch (error) {
+        const res = await getOrderDetailMethod(id);
+        console.log("res",res)  
+        if(res && res.data && res.data.items && res.data.items.length > 0){
+          this.setData({ goodsList: res.data.items });
+        }else{
+          this.setData({ goodsList: [] });
+        }
+        console.log("goodsList",this.data.goodsList)
+      } catch (error:any) {
         getTickleContext.call(this).showWarnMessage(error.errMsg);
         getTickleContext.call(this).showWarnMessage(error.errMsg);
       }
       }
       wx.hideLoading();
       wx.hideLoading();
     },
     },
-    copyExpressNo(e) {
+    copyExpressNo(e:any) {
       wx.setClipboardData({
       wx.setClipboardData({
         data: e.currentTarget.dataset.no,
         data: e.currentTarget.dataset.no,
         success: () => wx.showToast({ title: '已复制', icon: 'none' })
         success: () => wx.showToast({ title: '已复制', icon: 'none' })
@@ -55,9 +63,15 @@ Component({
       wx.navigateBack();
       wx.navigateBack();
     },
     },
     // 确认收货逻辑
     // 确认收货逻辑
-    onConfirmReceiving() {
-      // 确认收货逻辑
-      wx.showToast({ title: '确认收货成功', icon: 'success' });
+    async onConfirmReceiving() {
+      try {
+        await orderConfirmMethod(this.data.id);
+        wx.showToast({ title: '确认收货成功', icon: 'success' });
+        wx.navigateTo({
+          url: "/module/article/pages/success-page/success-page?title=确认收货成功",
+        });
+      } catch (error:any) {
+        getTickleContext.call(this).showWarnMessage(error.errMsg);
+      }
     }
     }
-  }
 })
 })

+ 4 - 4
miniprogram/module/article/pages/confirm-receiving/confirm-receiving.wxml

@@ -5,11 +5,11 @@
   <!-- 商品物流卡片列表 -->
   <!-- 商品物流卡片列表 -->
   <view class="order-goods-list">
   <view class="order-goods-list">
     <view class="goods-card" wx:for="{{goodsList}}" wx:key="id">
     <view class="goods-card" wx:for="{{goodsList}}" wx:key="id">
-      <image class="goods-img" src="{{item.img}}" mode="aspectFill" />
+      <image class="goods-img" src="{{item.conditioningProgramDetail.photo}}" mode="aspectFill" />
       <view class="goods-info">
       <view class="goods-info">
-        <view class="goods-title">{{item.name}}</view>
-        <view class="goods-count">×{{item.count}}</view>
-        <view class="goods-express">
+        <view class="goods-title">{{item.conditioningProgramDetail.name}}</view>
+        <view class="goods-count">× {{item.totalMeasure}}</view>
+        <view class="goods-express" wx:if="{{false}}">
           <text class="express-label">快递:</text>
           <text class="express-label">快递:</text>
           <block wx:if="{{item.expressNo}}">
           <block wx:if="{{item.expressNo}}">
             <text class="express-no" bindtap="copyExpressNo" data-no="{{item.expressNo}}">
             <text class="express-no" bindtap="copyExpressNo" data-no="{{item.expressNo}}">

+ 19 - 1
miniprogram/module/chats/components/message-select/message-select.ts

@@ -23,8 +23,25 @@ Component({
     subOptions: [] as Option[],
     subOptions: [] as Option[],
     subMultiple: false,
     subMultiple: false,
     itemHeight: 48,
     itemHeight: 48,
-
     result: '', hasSelected: false,
     result: '', hasSelected: false,
+    leftTitle: '都没有',
+    rightTitle: '提交'
+  },
+  lifetimes: {
+    attached() {
+      console.log("attached",this.data.payload.belongNew)
+      if(this.data.payload.belongNew){
+        this.setData({
+          leftTitle: '都没有',
+          rightTitle: '提交'
+        })
+      }else{
+        this.setData({
+          leftTitle: '无变化',
+          rightTitle: '完成'
+        })
+      }
+    }
   },
   },
   observers: {
   observers: {
     'payload.options'(options) {
     'payload.options'(options) {
@@ -38,6 +55,7 @@ Component({
     handleTop(event: HandleEvent) {
     handleTop(event: HandleEvent) {
       const { mark: { item } } = event;
       const { mark: { item } } = event;
       if (!item || !this.data.active) return;
       if (!item || !this.data.active) return;
+      console.log("handleTop",item)
       const index = this.data.options.findIndex(option => option.id === item.id);
       const index = this.data.options.findIndex(option => option.id === item.id);
       const multiple = this.data.payload.multiple;
       const multiple = this.data.payload.multiple;
       const checked = !item.checked;
       const checked = !item.checked;

+ 2 - 2
miniprogram/module/chats/components/message-select/message-select.wxml

@@ -39,10 +39,10 @@
     </scroll-view>
     </scroll-view>
     <view wx:if="{{payload.multiple || !payload.required}}" class="chat-card__handle {{active ? '' : 'disabled'}}">
     <view wx:if="{{payload.multiple || !payload.required}}" class="chat-card__handle {{active ? '' : 'disabled'}}">
       <view wx:if="{{!payload.required}}" class="item {{hasSelected ? 'disabled': ''}}" bind:tap="onSkip">
       <view wx:if="{{!payload.required}}" class="item {{hasSelected ? 'disabled': ''}}" bind:tap="onSkip">
-        <view class="not-change">都没有</view>
+        <view class="not-change">{{leftTitle}}</view>
       </view>
       </view>
       <view wx:if="{{payload.multiple}}" class="item" bind:tap="onSubmit">
       <view wx:if="{{payload.multiple}}" class="item" bind:tap="onSubmit">
-        <view class="sub-btn">提交</view>
+        <view class="sub-btn">{{rightTitle}}</view>
       </view>
       </view>
     </view>
     </view>
   </view>
   </view>

+ 1 - 0
miniprogram/module/chats/components/questionnaire/questionnaire.ts

@@ -255,6 +255,7 @@ Component({
                       }),
                       }),
                       multiple: question.css === "checkbox",
                       multiple: question.css === "checkbox",
                       required: question.required,
                       required: question.required,
+                      belongNew: question.belongNew,
                     },
                     },
                   });
                   });
                 } else if (question.over) {
                 } else if (question.over) {