Переглянути джерело

feat(康道足浴) 添加预约 选择技师的功能 预约详情的限时问题

xing.li 4 роки тому
батько
коміт
5b35948870

+ 5 - 0
api/store.js

@@ -14,6 +14,11 @@ class store extends request {
         const res = await this.getRequest(`${this.BASE_URL}Store/read?id=${id}`, this._defaultHeader)
         return res.data;
     }
+    static async getStaffsListByStoreId(id,page = 1, pageSize = 10000) {
+        const res = await this.getRequest(`${this.BASE_URL}Staff/index?page=${page}&pageSize=${pageSize}&storeId=${id}&status=1`, this._defaultHeader)
+        return res.data;
+    }
+    
 
     static async getNearStore(lat, lon) {
         const res = await this.postRequest(`${this.BASE_URL}Store/getStore`, {

+ 25 - 4
pages/appointment/appointment.js

@@ -27,7 +27,10 @@ Page({
     mobile: '',
     address:'',
     shopName:'',
-    userName:''
+    userName:'',
+    staffsList:[],
+    indexStaff:0,
+   
   },
 
   /**
@@ -52,6 +55,12 @@ Page({
     let productImg = product.info.productImg;
     let productName = product.info.productName;
     let price = product.info.currentPrice;
+    let result = await storeApi.getStaffsListByStoreId(shopId);
+    console.log(result);
+    let staffsList = result.list;
+    let indexStaff = this.data.indexStaff;
+    let staffName = staffsList[indexStaff]['staffName'];
+    let staffId = staffsList[indexStaff]['id'];
     this.setData({
       shopId,
       productId,
@@ -59,7 +68,10 @@ Page({
       productName,
       price,
       address,
-      shopName
+      shopName,
+      staffsList,
+      staffName,
+      staffId,
     })
     let userInfo = await app.getWxUserInfo();
     console.log(userInfo.name)
@@ -105,7 +117,8 @@ Page({
       storeId: self.data.shopId,
       appointmentTime: self.data.orderTime,
       num: self.data.peopleNum,
-      mobile: self.data.mobile
+      mobile: self.data.mobile,
+      staffId: self.data.staffId,
     }
     const rs = await orderApi.createOrder(data)
     let orderId = rs.orderId;
@@ -230,7 +243,15 @@ Page({
       peopleNum: num
     })
   },
-
+  bindStaffChange: function(e){
+    var indexStaff = e.detail.value;
+    var staffList = this.data.staffsList;
+    this.setData({
+      indexStaff:indexStaff,
+      staffName:staffList[indexStaff]['staffName'],
+      staffId:staffList[indexStaff]['id'],
+    })
+  },
 
 
   /**

+ 8 - 0
pages/appointment/appointment.wxml

@@ -51,6 +51,14 @@
             </block>
         </mp-tabs>
     </view>
+    <view class="desc-title">选择技师</view>
+    <view class="section" style="text-align: -webkit-center;">
+        <picker bindchange="bindStaffChange" value="{{indexStaff}}" range-key="staffName" range="{{staffsList}}">
+            <view class="staffName card">
+                当前选择:{{staffName}}
+            </view>
+        </picker>
+    </view>
     <view class="desc-title">联系人</view>
     <view class="product-mobile card f17">
         <view class="phone">

+ 8 - 0
pages/appointment/appointment.wxss

@@ -280,3 +280,11 @@
   text-align: center;
   line-height: 100rpx;
 }
+.staffName{
+  width: 93%;
+    text-align: left;
+    color: #646464;
+    line-height: 100rpx;
+    letter-spacing: 4rpx;
+
+}

+ 6 - 1
pages/order/order.wxml

@@ -54,7 +54,7 @@
             </view>
         </view>
     </view>
-    <view class="shop-info card">
+    <view class="shop-info card" style="{{order.orderType ==3?'height:250rpx':''}}">
         <view class="store-name-table">
             <view class="shop f17">{{ order.storeName}}</view>
              <view class="shop f17" wx:if="{{order.orderType ==3}}">桌号:{{ order.tableId}}</view>
@@ -69,6 +69,11 @@
             <image src="../../images/icons/tel.png"></image>
             {{order.storeMobile}}
         </view>
+        <view class="f17 shop" wx:if="{{order.orderType !=3}}">技师</view>
+        <view class="tel f14 c-707070 " wx:if="{{order.orderType !=3}}">
+            <image src="../../images/icons/defult-user.png"></image>
+            {{order.staffName}}
+        </view>
     </view>
     <view class="order-btn">
         <view class="delete-btn" bindtap="cancelOrder" wx:if="{{order.status==1}}">取消订单</view>

+ 1 - 1
pages/order/order.wxss

@@ -96,7 +96,7 @@
 }
 
 .container .shop-info {
-  height: 250rpx;
+  height: 350rpx;
   margin-top: 20rpx;
   padding: 20rpx 30rpx;
   background-color: #fff;