lrf402788946 3 tahun lalu
induk
melakukan
97dc62b272

+ 2 - 2
commpents/history/index.js

@@ -13,7 +13,6 @@ Component({
   data: {
 
   },
-
   /**
    * 组件的方法列表
    */
@@ -21,5 +20,6 @@ Component({
     detail: function (e) {
       this.triggerEvent('detail', { id: e.currentTarget.dataset.id })
     }
-  }
+  },
+
 })

+ 3 - 3
commpents/history/index.wxml

@@ -1,9 +1,9 @@
 <view class="main">
   <view class="list" wx:key="item" wx:for="{{list}}" bindtap="detail" data-id="{{item.id}}">
     <view class="top">
-      <text>{{item.create_time}}</text>
-      <text>{{item.type}}</text>
-      <text>{{item.status=='0'?'待使用':item.status=='1'?'待评价':item.status=='2'?'已完成':item.status=='3'?'失效':'未识别'}}</text>
+      <text>{{item.name}}</text>
+      <text>{{item.reserve}}大卡</text>
+      <text>{{item.num}}份</text>
     </view>
     <view class="down">
       <text wx:key="tag" wx:for="{{item.children}}" wx:for-item="tag">{{tag.title}},</text>

+ 9 - 13
pages/history/index.js

@@ -12,19 +12,11 @@ Page({
       name: '历史记录'
     },
     activeName: 0,
-    list: [
-      {
-        date: '2021-02-01'
-      },
-      {
-        date: '2021-02-01'
-      },
-      {
-        date: '2021-02-01'
-      },
-      {
-        date: '2021-02-01'
-      },
+    list: [],
+    mealList: [
+      { label: '早餐', key: 'breakfast' },
+      { label: "午餐", key: 'lunch' },
+      { label: "晚餐", key: "dinner" }
     ]
   },
   onChange(event) {
@@ -50,6 +42,10 @@ Page({
         data: {},
         success: res => {
           console.log(res);
+          const { data } = res.data;
+          this.setData({
+            list: data
+          })
         },
         error: err => {
           wx.showToast({

+ 13 - 4
pages/history/index.wxml

@@ -1,10 +1,19 @@
 <nav-bar navbar-data='{{navbarData}}' needBack="{{false}}"></nav-bar>
 <view class="main" style="padding-top:{{height}}px;height:{{windowHeight-height}}px">
-  <!-- <van-collapse accordion value="{{ activeName }}" bind:change="onChange">
+  <van-collapse accordion value="{{ activeName }}" bind:change="onChange">
     <van-collapse-item wx:key="item" wx:for="{{list}}" title="{{item.date}}" wx:for-index="idx" name="{{idx}}">
-      <view>
+      <view wx:for-item="meal" wx:for="{{mealList}}" wx:for-index="midx" wx:key="meal">
+        <view>
+          <text>{{meal.label}}</text>
+          <text wx:if="{{item[meal.key].list.length>0}}">
+            {{item[meal.key].is_use=='0'?"待使用":item[meal.key].is_use=='1'?"待评价":item[meal.key].is_use=='2'?"已完成":"失效"}}
+          </text>
+          <text wx:else>
+            未订餐
+          </text>
+        </view>
+        <history-list list="{{item[meal.key].list}}"></history-list>
       </view>
     </van-collapse-item>
-  </van-collapse> -->
-  n ihao
+  </van-collapse>
 </view>

+ 0 - 43
pages/reserve/index.js

@@ -144,7 +144,6 @@ Page({
     const data = JSON.parse(JSON.stringify(this.data.form))
     if (app.globalData.userInfo.openid) data.openid =app.globalData.userInfo.openid;
     if (this.data.today) data.date = this.data.today
-    console.log(data)
     wx.request({
       url: `${app.globalData.publicUrl}/api/st/dining/order`,
       method: "post",
@@ -171,48 +170,6 @@ Page({
    */
   onLoad: function (options) {
     this.searchDate();
-    let one = [{
-      id: '1',
-      url: '/image/home/image2.jpg',
-      title: '早餐1',
-      num: '1000',
-      reserve: 15
-    }, {
-      id: '2',
-      url: '/image/home/image2.jpg',
-      title: '早餐2',
-      num: '1000',
-      reserve: 15
-    },]
-    if (one) this.setData({ breakfastList: one })
-    let two = [{
-      id: '3',
-      url: '/image/home/image2.jpg',
-      title: '午餐1',
-      num: '1000',
-      reserve: 15
-    }, {
-      id: '4',
-      url: '/image/home/image2.jpg',
-      title: '午餐2',
-      num: '1000',
-      reserve: 15
-    },]
-    if (two) this.setData({ lunchList: two })
-    let thr = [{
-      id: '5',
-      url: '/image/home/image2.jpg',
-      title: '晚餐1',
-      num: '1000',
-      reserve: 15
-    }, {
-      id: '6',
-      url: '/image/home/image2.jpg',
-      title: '晚餐2',
-      num: '1000',
-      reserve: 15
-    },]
-    if (thr) this.setData({ dinnerList: thr })
   },
   // 查询时间
   searchDate: function () {