소스 검색

feat(点餐系统)

xing.li 4 년 전
부모
커밋
720be2a993
6개의 변경된 파일50개의 추가작업 그리고 44개의 파일을 삭제
  1. 13 11
      app.js
  2. 12 16
      pages/food/food.js
  3. 1 1
      pages/food/food.wxml
  4. 14 7
      pages/index/index.js
  5. 5 5
      pages/index/index.wxss
  6. 5 4
      pages/order/order.wxml

+ 13 - 11
app.js

@@ -36,13 +36,14 @@ App({
   },
   globalData: {
     userInfo: null,
+    noShow: false,
 
-    base_url: "https://api.overseasdragon.com.cn",
-    base_img_url: "https://smdd.overseasdragon.com.cn",
+    // base_url: "https://api.overseasdragon.com.cn",
+    // base_img_url: "https://smdd.overseasdragon.com.cn",
     // base_img_url:"https://smdd.overseasdragon.com.cn",
     // base_url: "https://member.overseasdragon.com.cn",
-    bloc_code: "BAIXIONG",
-    header: { 'content-type': 'application/json' },
+    // bloc_code: "BAIXIONG",
+    // header: { 'content-type': 'application/json' },
     
   },
   wxLogin:async function(data){
@@ -100,6 +101,7 @@ App({
     }
   },
   isAuth: async function(){
+    let userInfo = wx.getStorageSync({key: 'userInfo'})
     console.log(this.globalData.userInfo);
     if (!this.globalData.userInfo){
       console.log('您还没有授权');
@@ -107,12 +109,12 @@ App({
     }
     return true;
 
-    const auth = await wxp.getSetting()
-    console.log(auth);
-    if (!auth.authSetting['scope.userInfo']){
-      console.log('您还没有授权');
-      return false
-    }
-    return true
+  //   const auth = await wxp.getSetting()
+  //   console.log(auth);
+  //   if (!auth.authSetting['scope.userInfo']){
+  //     console.log('您还没有授权');
+  //     return false
+  //   }
+  //   return true
   }
 })

+ 12 - 16
pages/food/food.js

@@ -5,7 +5,7 @@ import {
 
 const app = getApp()
 var utils = require('../../utils/util.js');
-let globalInterval = {};
+
 Page({
   data: {
     currentTab: 0,
@@ -21,20 +21,16 @@ Page({
 
 
   onShow: async function () {
-   
-    
+    // console.log(app.globalData.userInfo)
     // var that = this;
-    // var mobile = wx.getStorageSync('mobile');
-    // console.log(mobile + "/////////" );
-    //   if (!mobile) {
-    //   that.setData({
-    //     check_mobile: false
-    //   })
-    // } else {
+    // let checkMobile = false;
+    // if(app.globalData.userInfo && app.globalData.userInfo.mobile){
+    //   checkMobile = true;
+    // }
     //   that.setData({
-    //     check_mobile: true
+    //     check_mobile: checkMobile
     //   })
-    // }
+  
    
   },
 
@@ -90,7 +86,6 @@ Page({
     let type = e.target.dataset.type;
     //  wx.showLoading({
     //   title: '加入购物车',
-    //   mask: true
     // });
     await this.updateCart(productId,type);
     await this.getCart();
@@ -98,6 +93,7 @@ Page({
       this.setData({showCart:false})
     }
     await this.initProduct();
+    //动画
     this.cartWwing();
   },
 
@@ -160,11 +156,11 @@ Page({
   initProduct: function(){
     let series = this.data.series;
     let productList = this.data.productList;
-    
     let cartList = this.data.cartList;
+     productList.forEach((ele,pindex) => {
+      ele.hasChoose = false;
+      ele.hasNum  = 0;
       cartList.forEach((ite,index) => {
-        productList.forEach((ele,pindex) => {
-          ele.hasChoose = false;
         if (ele.id == ite.productId){
           ele.hasChoose = true;
           ele.hasNum = ite.num;

+ 1 - 1
pages/food/food.wxml

@@ -66,7 +66,7 @@
   <view class="weui-mask init" wx:if="{{mask}}" bindtap="openCartDialog" data-type="close"></view>
   <view class="weui-half-screen-dialog cart-dialog">
     <view class="weui-half-screen-dialog__hd cart-hd" >
-      <view class="delete-cart" bindtap="deleteCart">清空</view>
+      <!-- <view class="delete-cart" bindtap="deleteCart">清空</view> -->
        <view class="discount-txt">已点{{totalNum}}件商品,合计:¥{{totalPrice}}</view>
       
       <view bindtap="openCartDialog" data-type="close">

+ 14 - 7
pages/index/index.js

@@ -105,7 +105,14 @@ Page({
   },
   onShow: async function (op) {
     console.log(op)
+    console.log(this.data.isShow)
     const self = this
+    if (self.data.chooseStoreId) {
+      const rs = await storeApi.getStoreById(self.data.chooseStoreId)
+      self.setData({
+        storeInfo: rs.info
+      })
+    }
     if (self.data.isShow == 1) {
       return
     }
@@ -115,13 +122,13 @@ Page({
       wx.setStorageSync('token', tokenData.token)
       requestApi.HEAD.token = tokenData.token
     }
-    if (self.data.chooseStoreId) {
-      const rs = await storeApi.getStoreById(self.data.chooseStoreId)
-      self.setData({
-        storeInfo: rs.info,
-        chooseStoreId: 0
-      })
-    }
+    // if (self.data.chooseStoreId) {
+    //   const rs = await storeApi.getStoreById(self.data.chooseStoreId)
+    //   self.setData({
+    //     storeInfo: rs.info,
+    //     chooseStoreId: 0
+    //   })
+    // }
     await this.productTypeList()
     await this.getProductList();
     let tabs = this.data.tabs;

+ 5 - 5
pages/index/index.wxss

@@ -221,19 +221,19 @@ Page {
   position: fixed;
   bottom:350rpx;
   right:5rpx;
-  height: 80rpx;
-  width: 80rpx;
+  height: 100rpx;
+  width: 100rpx;
   font-size:28rpx;
   /* line-height: 30rpx; */
   background: rgb(250,165,46);
-  border-radius: 40rpx;
+  border-radius: 50rpx;
   text-align: center;
   color: #fff;
 }
 
 .orderFood>image {
-  width: 50rpx;
-  height: 50rpx;
+  width: 70rpx;
+  height: 70rpx;
   position: relative;
   top: 15rpx;
 }

+ 5 - 4
pages/order/order.wxml

@@ -25,7 +25,7 @@
         <view class="order-img">
             <image class="" src="{{order.productImg}}"></image>
         </view>
-        <view class="order-info">
+        <view class="order-info" style="padding-right: 20rpx;">
             <view class="order-id f30 c-707070" style="font-size:30rpx;">{{order.orderSn}}</view>
             <view class="order-title c-202020">{{order.productName}}</view>
             <view class="order-price f18">¥{{order.orderMoney}}</view>
@@ -35,10 +35,10 @@
             </view>
         </view>
     </view>
-    <view class="order" wx:if="{{order.orderType ==3}}" style="height:120rpx">
+    <view class="order" wx:if="{{order.orderType ==3}}" style="height:60rpx">
         <view class="order-info" style="padding-right: 20rpx;">
-            <view class="order-id f30 c-707070" style="font-size:30rpx;">{{order.orderSn}}</view>
-            <view class="order-id f30 c-707070" style="font-size:30rpx;">{{order.productList[0].createTime}}</view>
+            <view class="order-id f30 c-707070" style="font-size:30rpx;float:right">{{order.orderSn}}</view>
+            <view class="order-id f30 c-707070" style="font-size:30rpx;float:left">{{order.productList[0].createTime}}</view>
         </view>
     </view>
     <view class="order card" wx:if="{{order.orderType ==3}}" wx:for="{{order.productList}}">
@@ -56,6 +56,7 @@
     </view>
     <view class="shop-info card">
         <view class="shop f17">{{ order.storeName}}</view>
+        <view class="shop f17" wx:if="{{order.orderType ==3}}">桌号:{{ order.tableId}}</view>
         <view class="address f14 c-707070 " bindtap="guide">
             <image src="../../images/icons/location.png"></image>
             {{order.address}}