lrf402788946 3 年之前
父節點
當前提交
a9c9ce509b
共有 4 個文件被更改,包括 59 次插入8 次删除
  1. 20 1
      app.js
  2. 1 1
      app.json
  3. 32 0
      pages/reserve/index.js
  4. 6 6
      pages/reserve/index.wxml

+ 20 - 1
app.js

@@ -8,7 +8,25 @@ App({
     // 登录
     wx.login({
       success: res => {
+        console.log(res);
+        const { code: js_code } = res
         // 发送 res.code 到后台换取 openId, sessionKey, unionId
+        wx.request({
+          url: `${this.globalData.publicUrl}/api/st/system/weixin/appAuth?js_code=` + js_code,
+          method: "get",
+          header: {
+            'x-tenant': 'test'
+          },
+          success: res => {
+            console.log(res)
+          },
+          error: err => {
+            wx.showToast({
+              title: err.msg,
+              icon: 'error'
+            })
+          }
+        })
       }
     })
     //获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度
@@ -23,7 +41,8 @@ App({
     userInfo: null,
     height: 0,
     windowHeight: 0,
-    publicUrl: 'http://192.168.1.19:9901'
+    publicUrl: 'http://192.168.1.19:9901',
+    fileUrl: "http://broadcast.waityou24.cn"
   }
 })
 

+ 1 - 1
app.json

@@ -1,10 +1,10 @@
 {
   "pages": [
+    "pages/reserve/index",
     "pages/food/index",
     "pages/home/index",
     "pages/login/index",
     "pages/calorie/index",
-    "pages/reserve/index",
     "pages/news/index",
     "pages/news/detail",
     "pages/my/index",

+ 32 - 0
pages/reserve/index.js

@@ -196,6 +196,38 @@ Page({
   searchDate: function () {
     let today = moment().format('YYYY-MM-DD');
     if (today) this.setData({ today: today })
+    wx.request({
+      url: `${app.globalData.publicUrl}/api/st/dining/arrange/getByDate?date=` + today,
+      method: "get",
+      header: {
+        'x-tenant': 'test'
+      },
+      success: res => {
+        const { arrange } = res.data.data;
+        if (!arrange) return;
+        let { breakfast, lunch, dinner } = arrange
+        breakfast = this.dealImg(breakfast)
+        lunch = this.dealImg(lunch)
+        dinner = this.dealImg(dinner)
+        this.setData({
+          breakfastList: breakfast,
+          lunchList: lunch,
+          dinnerList: dinner
+        })
+      },
+      error: err => {
+        wx.showToast({
+          title: err.msg,
+          icon: 'error'
+        })
+      }
+    })
+  },
+  dealImg(list) {
+    for (let i of list) {
+      if (i.img && i.img.length > 0 && i.img[0]) i.url = `${app.globalData.fileUrl}${i.img[0].url}`
+    }
+    return list;
   },
 
   /**

+ 6 - 6
pages/reserve/index.wxml

@@ -34,9 +34,9 @@
                         <image src='{{item.url}}'></image>
                       </view>
                       <view class="other">
-                        <view class="other_1">{{item.title}}</view>
+                        <view class="other_1">{{item.name}}</view>
                         <view class="other_2">
-                          <view class="other_2num">已售:<text>{{item.num}}</text></view>
+                          <view class="other_2num">已售:<text>{{item.order}}</text></view>
                           <view class="other_2btn">
                             <van-stepper value="{{ item.oneStepper }}" min="0" bind:plus="onePlus" bind:minus="oneMinus"
                               disable-input="true" bind:change="oneChange" data-data="{{item}}" input-width="28px"
@@ -57,9 +57,9 @@
                         <image src='{{item.url}}'></image>
                       </view>
                       <view class="other">
-                        <view class="other_1">{{item.title}}</view>
+                        <view class="other_1">{{item.name}}</view>
                         <view class="other_2">
-                          <view class="other_2num">已售:<text>{{item.num}}</text></view>
+                          <view class="other_2num">已售:<text>{{item.order}}</text></view>
                           <view class="other_2btn">
                             <van-stepper value="{{ item.twoStepper }}" min="0" bind:plus="onePlus" bind:minus="oneMinus"
                               disable-input="true" bind:change="oneChange" data-data="{{item}}" input-width="28px"
@@ -80,9 +80,9 @@
                         <image src='{{item.url}}'></image>
                       </view>
                       <view class="other">
-                        <view class="other_1">{{item.title}}</view>
+                        <view class="other_1">{{item.name}}</view>
                         <view class="other_2">
-                          <view class="other_2num">已售:<text>{{item.num}}</text></view>
+                          <view class="other_2num">已售:<text>{{item.order}}</text></view>
                           <view class="other_2btn">
                             <van-stepper value="{{ item.thrStepper }}" min="0" bind:plus="onePlus" bind:minus="oneMinus"
                               disable-input="true" bind:change="oneChange" data-data="{{item}}" input-width="28px"