guhongwei 3 år sedan
förälder
incheckning
9b646f4f46

+ 7 - 7
app.json

@@ -1,14 +1,14 @@
 {
   "pages": [
-    "pages/reserve/index",
-    "pages/food/index",
-    "pages/home/index",
+    "pages/history/index",
+    "pages/my/index",
     "pages/login/index",
+    "pages/home/index",
+    "pages/food/index",
     "pages/calorie/index",
+    "pages/reserve/index",
     "pages/news/index",
-    "pages/news/detail",
-    "pages/my/index",
-    "pages/history/index"
+    "pages/news/detail"
   ],
   "usingComponents": {
     "van-button": "/miniprogram_npm/vant-weapp/button/index",
@@ -79,7 +79,7 @@
   "window": {
     "backgroundTextStyle": "light",
     "navigationBarBackgroundColor": "#fff",
-    "navigationBarTitleText": "智慧食堂",
+    "navigationBarTitleText": "节俭会",
     "navigationBarTextStyle": "black",
     "navigationStyle": "custom"
   },

BIN
image/qrcode.jpg


+ 33 - 0
pages/history/index copy.wxml

@@ -0,0 +1,33 @@
+<nav-bar navbar-data='{{navbarData}}' needBack="{{false}}"></nav-bar>
+<view class="main" style="padding-top:{{height}}px;height:{{windowHeight-height}}px">
+  <el-col class="one" style="height:{{windowHeight-height}}px">
+    <view class="swiper-tab">
+      <view class="swiper-tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="clickTab">待使用</view>
+      <view class="swiper-tab-item {{currentTab==1?'active':''}}" data-current="1" bindtap="clickTab">待评价</view>
+      <view class="swiper-tab-item {{currentTab==2?'active':''}}" data-current="2" bindtap="clickTab">已完成</view>
+      <view class="swiper-tab-item {{currentTab==3?'active':''}}" data-current="3" bindtap="clickTab">已失效</view>
+    </view>
+    <swiper current="{{currentTab}}" style="height:{{windowHeight-height-40}}px">
+      <swiper-item catchtouchmove="stopTab">
+        <view class="one_1" style="height:{{windowHeight-height-40}}px">
+          <history-list list="{{list}}"></history-list>
+        </view>
+      </swiper-item>
+      <swiper-item catchtouchmove="stopTab">
+        <view class="one_1" style="height:{{windowHeight-height-40}}px">
+          待评价
+        </view>
+      </swiper-item>
+      <swiper-item catchtouchmove="stopTab">
+        <view class="one_1" style="height:{{windowHeight-height-40}}px">
+          已完成
+        </view>
+      </swiper-item>
+      <swiper-item catchtouchmove="stopTab">
+        <view class="one_1" style="height:{{windowHeight-height-40}}px">
+          已失效
+        </view>
+      </swiper-item>
+    </swiper>
+  </el-col>
+</view>

+ 34 - 0
pages/history/index copy.wxss

@@ -0,0 +1,34 @@
+.main .one {
+  float: left;
+  width: 100%;
+  overflow: hidden;
+}
+
+.main .one .one_1 {
+  float: left;
+  width: 100%;
+  overflow-y: auto;
+  background-color: #f1f1f1;
+}
+
+.main .one .swiper-tab {
+  width: 100%;
+  border-top: 1px solid #f1f1f1;
+  border-bottom: 1rpx solid #f1f1f1;
+  text-align: center;
+  height: 39px;
+  line-height: 39px;
+  display: flex;
+  flex-flow: row;
+  justify-content: space-between;
+}
+
+.main .one .swiper-tab-item {
+  width: 50%;
+  color: #434343;
+}
+
+.main .one .active {
+  color: #409eff;
+  border-bottom: 2rpx solid #409eff;
+}

+ 30 - 20
pages/history/index.js

@@ -11,34 +11,27 @@ Page({
     navbarData: {
       name: '历史记录'
     },
+    activeName: 0,
     list: [
       {
-        create_time: '2021-01-01',
-        type: '早餐',
-        status: '0',
-        children: [
-          { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' },
-          { title: '香辣肉絲' }, { title: '香辣肉絲' },
-        ]
+        date: '2021-02-01'
       },
       {
-        create_time: '2021-01-01',
-        type: '早餐',
-        status: '0',
-        children: [
-          { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' },
-        ]
+        date: '2021-02-01'
       },
       {
-        create_time: '2021-01-01',
-        type: '早餐',
-        status: '0',
-        children: [
-          { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' }, { title: '香辣肉絲' },
-        ]
+        date: '2021-02-01'
+      },
+      {
+        date: '2021-02-01'
       },
     ]
   },
+  onChange(event) {
+    console.log(event);
+    console.log(event.detail);
+    this.setData({ activeName: Number(event.detail) });
+  },
   // 返回
   back: function () {
     wx.switchTab({
@@ -49,7 +42,24 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    console.log(options.id);
+    if (!options.openid) {
+      wx.request({
+        url: `${app.globalData.publicUrl}/api/st/dining/order?openid=${'oDiAy5JAhb2ReM-LwmqbTCx5OteA'}`,
+        method: "get",
+        header: { 'x-tenant': app.globalData.tenant },
+        data: {},
+        success: res => {
+          console.log(res);
+        },
+        error: err => {
+          wx.showToast({
+            title: err.msg,
+            icon: 'error'
+          })
+        }
+      })
+    }
+
   },
 
   /**

+ 8 - 4
pages/history/index.wxml

@@ -1,6 +1,10 @@
-<nav-bar navbar-data='{{navbarData}}' bind:back="back"></nav-bar>
+<nav-bar navbar-data='{{navbarData}}' needBack="{{false}}"></nav-bar>
 <view class="main" style="padding-top:{{height}}px;height:{{windowHeight-height}}px">
-  <view class="one" style="height:{{windowHeight-height}}px;">
-    <history-list list="{{list}}" bind:detail="detail"></history-list>
-  </view>
+  <!-- <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>
+    </van-collapse-item>
+  </van-collapse> -->
+  n ihao
 </view>

+ 0 - 8
pages/history/index.wxss

@@ -1,8 +0,0 @@
-.main {}
-
-.main .one {
-  float: left;
-  width: 100%;
-  overflow-y: auto;
-  background-color: #f1f1f1;
-}

+ 24 - 23
pages/home/index.js

@@ -18,6 +18,23 @@ Page({
       '75%': '#ee0a24',
       '100%': '#ff0000',
     },
+    thrList: [
+      {
+        name: '菜名',
+        num: 1,
+        reserve: '100'
+      },
+      {
+        name: '菜名',
+        num: 1,
+        reserve: '100'
+      },
+      {
+        name: '菜名',
+        num: 1,
+        reserve: '100'
+      },
+    ]
   },
   // 查看本周菜谱
   reserveBtn: function () {
@@ -34,38 +51,22 @@ Page({
       })
     } else if (type == '2') {
       wx.showToast({
-        title: '暂开通',
+        title: '暂开通',
       })
     } else {
-      wx.redirectTo({
-        url: '/pages/calorie/index',
+      wx.showToast({
+        title: '暂未开通',
       })
+      // wx.redirectTo({
+      //   url: '/pages/calorie/index',
+      // })
     }
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    // const test = `${app.globalData.publicUrl}/api/st/dining/arrange`;
-    // console.log(test);
-    wx.request({
-      url: `${app.globalData.publicUrl}/api/st/dining/arrange`,
-      method: "get",
-      header: {
-        'x-tenant': app.globalData.tenant
-      },
-      data: {},
-
-      success: res => {
-        console.log(res);
-      },
-      error: err => {
-        wx.showToast({
-          title: err.msg,
-          icon: 'error'
-        })
-      }
-    })
+    console.log(app.globalData.userInfo);
   },
 
   /**

+ 22 - 1
pages/home/index.wxml

@@ -41,7 +41,28 @@
     </view>
   </view>
   <view class="thr">
-    用餐卡
+    <view class="thr_1">
+      <text>用餐卡:</text>
+      <text>当前餐厅</text>
+      <text>【早餐】</text>
+    </view>
+    <view class="thr_2">
+      <view class="thr_2Qrcode">
+        <image src="/image/qrcode.jpg"></image>
+      </view>
+      <view class="thr_2List">
+        <view class="list">
+          <text>菜名</text>
+          <text>份数</text>
+          <text>热量</text>
+        </view>
+        <view class="list" wx:key="item" wx:for="{{thrList}}">
+          <text>{{item.name}}</text>
+          <text>{{item.num}}</text>
+          <text>{{item.reserve}}</text>
+        </view>
+      </view>
+    </view>
   </view>
   <view class="four" bindtap="reserveBtn">
     <view class="tit">本周菜谱<text class="iconfont icon-jiantou"></text></view>

+ 57 - 0
pages/home/index.wxss

@@ -86,7 +86,64 @@
   margin: 0 0 15rpx 0;
 }
 
+.main .thr .thr_1 {
+  float: left;
+  width: 100%;
+  height: 30px;
+  line-height: 30px;
+  background-color: #409eff;
+  color: #ffffff;
+  text-align: center;
+  font-size: 12px;
+}
+
+.main .thr .thr_2 {
+  float: left;
+  width: 100%;
+  margin: 0 0 15rpx 0;
+  background-color: #ffffff;
+}
+
+.main .thr .thr_2 .thr_2Qrcode {
+  float: left;
+  width: 30%;
+  text-align: center;
+  padding: 8px 0;
+}
+
+.main .thr .thr_2 .thr_2Qrcode image {
+  width: 100px;
+  height: 100px;
+}
+
+
+.main .thr .thr_2 .thr_2List {
+  float: left;
+  width: 70%;
+  padding: 8px 0;
+}
+
+.main .thr .thr_2 .thr_2List .list {
+  float: left;
+  width: 100%;
+  border-bottom: 1px solid #ccc;
+}
+
+.main .thr .thr_2 .thr_2List .list text {
+  float: left;
+  width: 33%;
+  text-align: center;
+  height: 30px;
+  line-height: 30px;
+  font-size: 12px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
 .main .four {
+  float: left;
+  width: 100%;
   background-color: #ffffff;
 }
 

+ 2 - 2
pages/my/index.js

@@ -18,10 +18,10 @@ Page({
   },
   // 跳转页面
   routeBtn: function (e) {
-    let type = e.currentTarget.dataset.type
+    let type = e.currentTarget.dataset.type;
     if (type == '1') {
       wx.redirectTo({
-        url: '/pages/history/index'
+        url: `/pages/history/index?openid=${app.globalData.userInfo.openid}`
       })
     } else if (type == '2') {
       app.globalData.userInfo = null