Commit d2fff1687cce6e21ff12fe52b23c54c5bb0ac8d4

Authored by iceling
1 parent 169b46f7

预约订单列表的二维码,预约详情数据填充判断,选择预约时间

pages/user/my_service/beauty_deta.js
... ... @@ -15,6 +15,8 @@ Page({
15 15 name: "", //美容师姓名
16 16 comment: "", //美容师评价
17 17 head_img: "", //美容师头像
  18 + time: ["08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00"],
  19 + time_index: 0, //选择预约时间下标
18 20 },
19 21  
20 22 /**
... ... @@ -32,7 +34,7 @@ Page({
32 34 th.query_date();
33 35 },
34 36 //图片失败,默认图片
35   - bind_bnerr1: function (e) {
  37 + bind_bnerr1: function(e) {
36 38 var _errImg = e.target.dataset.errorimg;
37 39 var _Img = e.target.dataset.img;
38 40 if (_Img != undefined) {
... ... @@ -68,6 +70,24 @@ Page({
68 70 }
69 71 })
70 72 },
  73 + //返回上个页面
  74 + navigateBack:function(){
  75 + wx.navigateBack({ changed: true });//返回上一页
  76 + },
  77 + //选择时间
  78 + Selection_time: function(e) {
  79 + var th = this;
  80 + var index = e.currentTarget.dataset.index;
  81 + var time_index = th.data.time_index;
  82 + if (index == time_index) {
  83 + return;
  84 + } else {
  85 + th.setData({
  86 + time_index: time_index
  87 + })
  88 + }
  89 + },
  90 +
71 91 query_date: function() {
72 92 var th = this;
73 93 var url = "/api/weshop/marketing/reservation/staff/time/list";
... ... @@ -82,8 +102,20 @@ Page({
82 102 }).then(res => {
83 103 if (res.data.code == 0) {
84 104 var data = res.data.data;
  105 + var time = th.data.time; //固定时间
  106 + var time_list = [];
  107 + for (var i = 0; i < time.length; i++) {
  108 + for (var ii = ii; ii < data.length; ii++) {
  109 + if (time[i] == data[ii]) {
  110 + time_list[i] = data[ii];
  111 + break;
  112 + } else {
  113 + time_list[i] = "";
  114 + }
  115 + }
  116 + }
85 117 th.setData({
86   - time_list: data
  118 + time_list: time_list
87 119 })
88 120 } else {
89 121 getApp().my_warnning(res.data.msg, 0, th);
... ...
pages/user/my_service/beauty_deta.wxml
... ... @@ -10,7 +10,7 @@
10 10  
11 11 <view class="introduce fs26">
12 12 <block wx:if="{{comment!=''}}">
13   - {{comment}}
  13 + {{comment}}
14 14 </block>
15 15 <block wx:else>
16 16 暂无介绍
... ... @@ -36,18 +36,27 @@
36 36 <!-- 选择时间 -->
37 37 <view class="Times">
38 38  
39   - <view class="flex-center" wx:for="{{time_list}}" style="display:inline-block;">
40   -
41   - <view class="Time flex-center {{index==0?'chTime':'nochTime'}}">
42   - <view>
43   - <view class="fs26">{{item.GroupHour}}</view>
44   - <block wx:if="{{flase}}">
45   - <view class="fs24">约满</view>
46   - </block>
  39 + <view class="flex-center" wx:for="{{time}}" style="display:inline-block;">
  40 + <block wx:if="{{true}}">
  41 + <!-- {{item==time_list[index]}} -->
  42 + <view class="Time flex-center {{time_index==index?'chTime':''}}" bindtap="Selection_time" data-index="{{index}}">
  43 + <view>
  44 + <view class="fs26">{{item}}</view>
  45 + <block wx:if="{{flase}}">
  46 + <view class="fs24">约满</view>
  47 + </block>
  48 + </view>
47 49 </view>
48   - </view>
  50 + </block>
  51 + <block wx:else>
  52 + <view class="Time flex-center nochTime">
  53 + <view>
  54 + <view class="fs26">{{item}}</view>
  55 + </view>
  56 + </view>
  57 + </block>
49 58 </view>
50   - <view class="choice flex-center fs32">
  59 + <view class="choice flex-center fs32" bindtap="navigateBack">
51 60 <view>确定选择</view>
52 61 </view>
53 62  
... ...
pages/user/my_service/tment_details.js
1 1 var e = getApp(),
2 2 a = e.globalData.setting,
3 3 os = a,
4   - t = e.request;
  4 + t = e.request,
  5 + d = e.globalData;
5 6 Page({
6 7  
7 8 /**
... ... @@ -9,13 +10,25 @@ Page({
9 10 */
10 11 data: {
11 12 iurl: a.imghost,
  13 + tment_details: [], //预约详情
12 14 },
13 15  
14 16 /**
15 17 * 生命周期函数--监听页面加载
16 18 */
17 19 onLoad: function(options) {
18   -
  20 + var th = this;
  21 + var url = "http://localhost:8022/api/weshop/yy_fuwu_meirsxiangq";
  22 + wx.request({
  23 + url: url,
  24 + success: function(res) {
  25 + if (res.data.code == 0) {
  26 + th.setData({
  27 + tment_details:res.data.data
  28 + })
  29 + }
  30 + }
  31 + })
19 32 },
20 33 /**
21 34 * 生命周期函数--监听页面显示
... ...
pages/user/my_service/tment_details.json
1 1 {
2   - "navigationBarTitleText": "预约详情"
  2 + "navigationBarTitleText": "预约详情",
  3 + "usingComponents": {
  4 + "warn": "/components/long_warn/long_warn"
  5 + }
3 6 }
4 7 \ No newline at end of file
... ...
pages/user/my_service/tment_details.wxml
... ... @@ -4,29 +4,30 @@
4 4 <!-- 状态栏 -->
5 5 <view class="statusBar fs32 flex-vertical-between lf">
6 6 <view>预约状态:</view>
7   - <view>未服务</view>
8   - <view wx:if="{{false}}">已服务</view>
9   - <view wx:if="{{false}}">已过期</view>
  7 + <view wx:if="{{tment_details.state==1}}">未服务</view>
  8 + <view wx:if="{{tment_details.state==2}}">已服务</view>
  9 + <view wx:if="{{tment_details.state==3}}">已过期</view>
  10 + <view wx:if="{{tment_details.state==4}}">已取消</view>
10 11 </view>
11 12 <view class="fs30">
12 13 <view class="items lf">
13 14 <!-- 预约门店 -->
14 15 <view class="flex-vertical bmt">
15 16 <view class="name">预约门店:</view>
16   - <view class="ellipsis-1 value">王者峡谷中路店</view>
  17 + <view class="ellipsis-1 value">{{tment_details.store_name}}</view>
17 18 </view>
18 19  
19 20 <!-- 预约项目 -->
20 21 <view class="flex-vertical bmt">
21 22 <view class="name">预约项目:</view>
22   - <view class="ellipsis-1 value">王者峡谷中路店</view>
  23 + <view class="ellipsis-1 value">{{tment_details.item}}</view>
23 24 </view>
24 25  
25 26 <!-- 预约时间 -->
26 27 <view class="flex-vertical bmt">
27 28 <view class="name">预约时间:</view>
28   - <view class="date">2018-08-16</view>
29   - <view>10:00</view>
  29 + <view class="date">{{tment_details.time}}</view>
  30 + <view>{{tment_details.time_interval}}</view>
30 31 </view>
31 32 </view>
32 33 <view class="bt">
... ... @@ -38,7 +39,7 @@
38 39 <view>容</view>
39 40 <view>师:</view>
40 41 </view>
41   - <view class="ellipsis-1 value">王者峡谷中路店</view>
  42 + <view class="ellipsis-1 value">{{tment_details.Beautician}}</view>
42 43 </view>
43 44 <!-- 预约人及联系方式 -->
44 45 <!-- 姓名 -->
... ... @@ -48,7 +49,7 @@
48 49 <view>约</view>
49 50 <view>人:</view>
50 51 </view>
51   - <view class="ellipsis-1 value">钱巧玲</view>
  52 + <view class="ellipsis-1 value">{{tment_details.name}}</view>
52 53 </view>
53 54 <!-- 号码 -->
54 55 <view class="flex-vertical">
... ... @@ -57,7 +58,7 @@
57 58 <view>机</view>
58 59 <view>人:</view>
59 60 </view>
60   - <view>18065336494</view>
  61 + <view>{{tment_details.phone}}</view>
61 62 </view>
62 63 </view>
63 64 </view>
... ... @@ -82,16 +83,16 @@
82 83 <view class="subs flex-vertical-between fs32">
83 84  
84 85 <view class="sub lb flex-center">
85   - <view>取消预约</view>
86   - <view wx:if="{{false}}">删除订单</view>
87   - <view wx:if="{{false}}">更改时间</view>
  86 + <view wx:if="{{tment_details.state==1}}">取消预约</view>
  87 + <view wx:if="{{tment_details.state==2 || tment_details.state==3}}">删除订单</view>
88 88 </view>
89 89  
90 90 <view class="sub rb flex-center">
91   - <view>更改时间</view>
92   - <view wx:if="{{false}}">重新预约</view>
93   - <view wx:if="{{false}}">发表评价</view>
  91 + <navigator wx:if="{{tment_details.state==1}}" url="/pages/user/my_service/beauty_deta">更改时间</navigator>
  92 + <navigator wx:if="{{tment_details.state==2}}" url="/pages/user/my_service/tment_eval">发表评价</navigator>
  93 + <navigator wx:if="{{tment_details.state==3}}" url="/pages/user/my_service/appment_main">重新预约</navigator>
94 94 </view>
95 95  
96 96 </view>
97   -</view>
98 97 \ No newline at end of file
  98 +</view>
  99 +<warn id="warn"></warn>
99 100 \ No newline at end of file
... ...
pages/user/my_service/tment_order_list.js
... ... @@ -49,6 +49,18 @@ Page({
49 49 return false;
50 50 }
51 51 },
  52 + //显示核销码
  53 + code_show: function (e) {
  54 + var th = this;
  55 + //--获取成功的时候--
  56 + var no = e.currentTarget.dataset.order_sn;
  57 + var qc_com = th.selectComponent("#qc_com"); //组件的id
  58 + var obj = {
  59 + val: no,
  60 + content: "请将二维码展示给核销员,使用更快捷"
  61 + };
  62 + qc_com.open(obj)
  63 + },
52 64 query_orderList: function() {
53 65 var th = this;
54 66 var url = "http://localhost:8022/api/weshop/yy_order_list";
... ...
pages/user/my_service/tment_order_list.json
1 1 {
2   - "navigationBarTitleText": "我的预约"
  2 + "navigationBarTitleText": "我的预约",
  3 + "usingComponents": {
  4 + "qr_code": "/components/qr_code/qr_code"
  5 + }
3 6 }
4 7 \ No newline at end of file
... ...
pages/user/my_service/tment_order_list.wxml
... ... @@ -9,19 +9,15 @@
9 9 <!-- 预约项目 -->
10 10 <view wx:for="{{tm_order_list}}">
11 11 <!-- 商品编号和状态 -->
12   - <view class="Commodity_number flex-vertical-between fs24 padding">
  12 + <view class="Commodity_number flex-vertical-between fs26 padding">
13 13 <!--商品编号 -->
14 14 <text class="order_number ellipsis-1" selectable='true'>订单编号:{{item.order_sn}}</text>
15   - <!-- 商品评价状态 -->
16   - <view class="flex-center xc-wc">
17   - <!-- 订单状态 -->
  15 + <!-- 订单状态 -->
  16 + <view class="flex-center state">
18 17 <view wx:if="{{item.is_prom==1}}">未服务</view>
19 18 <view wx:if="{{item.is_prom==2}}">已服务</view>
20 19 <view wx:if="{{item.is_prom==3}}">已过期</view>
21   - <view class="flex-center">
22   - <view class="lin"></view>
23   - <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-order_id="{{index}}"></image>
24   - </view>
  20 + <view wx:if="{{item.is_prom==4}}">已取消</view>
25 21 </view>
26 22 </view>
27 23  
... ... @@ -59,15 +55,16 @@
59 55 </view>
60 56 </navigator>
61 57 <view class="Unim flex-right-vertical fs26 padding">
62   - <block wx:if="{{item.order_status==1}}">
  58 + <image wx:if="{{item.is_prom==1}}" src="{{iurl}}miniapp/images/order/code.png" class="code" bindtap="code_show" data-order_sn="{{item.order_sn}}"></image>
  59 + <block wx:if="{{item.is_prom==1}}">
63 60 <navigator url="/pages/user/my_service/tment_details" class="Unimportance flex-level">取消预约</navigator>
64 61 </block>
65 62 <block wx:else>
66   - <navigator url="/pages/user/my_service/tment_details" class="Unimportance flex-level">查看详情</navigator>
  63 + <navigator wx:if="{{item.is_prom==2 || item.is_prom==3}}" url="/pages/user/my_service/tment_details" class="Unimportance flex-level">查看详情</navigator>
67 64 </block>
68   - <navigator class="important Unimportance flex-level" url="/pages/user/my_service/tment_details">更改时间</navigator>
69   - <navigator url="/pages/user/my_service/tment_eval" wx:if="{{false}}" class="important Unimportance flex-level">发表评价</navigator>
70   - <navigator url="/pages/user/my_service/appment_main" wx:if="{{false}}" class="important Unimportance flex-level">重新预约</navigator>
  65 + <navigator wx:if="{{item.is_prom==1}}" class="important Unimportance flex-level" url="/pages/user/my_service/beauty_deta">更改时间</navigator>
  66 + <navigator wx:if="{{item.is_prom==2}}" url="/pages/user/my_service/tment_eval" class="important Unimportance flex-level">发表评价</navigator>
  67 + <navigator wx:if="{{item.is_prom==3}}" url="/pages/user/my_service/appment_main" class="important Unimportance flex-level">重新预约</navigator>
71 68  
72 69 </view>
73 70 </view>
... ... @@ -90,4 +87,6 @@
90 87 <view class="flex-center fs28 white">立即预约</view>
91 88 </navigator>
92 89 </view>
93   -</view>
94 90 \ No newline at end of file
  91 +</view>
  92 +<!-- 弹出框扫描 -->
  93 +<qr_code id="qc_com"></qr_code>
95 94 \ No newline at end of file
... ...
pages/user/my_service/tment_order_list.wxss
... ... @@ -46,15 +46,20 @@ page {
46 46 }
47 47  
48 48 .order_number {
49   - max-width: 500rpx;
  49 + max-width: 550rpx;
  50 +}
  51 +.state{
  52 + color: rgb(216,63,82);
50 53 }
51   -
52 54 .items {
53 55 border-top: 4rpx solid rgb(245, 245, 245);
54 56 border-bottom: 4rpx solid rgb(245, 245, 245);
55 57 height: 260rpx;
56 58 }
57   -
  59 +.code{
  60 + width: 55rpx;
  61 + height: 55rpx;
  62 +}
58 63 .itemimage {
59 64 width: 190rpx;
60 65 height: 190rpx;
... ...