Browse Source

客户预约表&&次卡时间修改

yuhao 2 years ago
parent
commit
346c5b1a69

+ 164 - 5
src/pages/customerMan/myOrder/index.vue

@@ -79,7 +79,12 @@
79 79
                   <div>{{ scope.row.card_name | ellipsis(8) }}</div>
80 80
                 </template>
81 81
               </el-table-column>
82
-              <el-table-column prop="total_num" label="总次数" show-overflow-tooltip align="center">
82
+              <el-table-column
83
+                prop="total_num"
84
+                label="总次数"
85
+                show-overflow-tooltip
86
+                align="center"
87
+              >
83 88
               </el-table-column>
84 89
               <el-table-column
85 90
                 prop="num"
@@ -99,7 +104,13 @@
99 104
                 label="过期时间"
100 105
                 width="180"
101 106
                 show-overflow-tooltip
102
-              ></el-table-column>
107
+              >
108
+                <template slot-scope="{ row }">
109
+                  <div class="expir_time" @click.stop="amendCardTime(row)">
110
+                    {{ row.expir_time }}
111
+                  </div>
112
+                </template>
113
+              </el-table-column>
103 114
               <el-table-column
104 115
                 prop="create_time"
105 116
                 label="创建时间"
@@ -179,7 +190,15 @@ status: 5 -->
179 190
                         ? goodStatus[scope.row.status]
180 191
                         : goodStatus[goodStatus.length - 1]
181 192
                     }} -->
182
-                    {{scope.row.status==2||scope.row.status==3?'已取货':scope.row.status==0?'未支付':scope.row.status==1?'待取货':'已取消'}}
193
+                    {{
194
+                      scope.row.status == 2 || scope.row.status == 3
195
+                        ? "已取货"
196
+                        : scope.row.status == 0
197
+                        ? "未支付"
198
+                        : scope.row.status == 1
199
+                        ? "待取货"
200
+                        : "已取消"
201
+                    }}
183 202
                   </div>
184 203
                 </template>
185 204
               </el-table-column>
@@ -319,6 +338,39 @@ type: "全额券" -->
319 338
         <div class="confirm" @click="confirm">确定</div>
320 339
       </div>
321 340
     </mine-pupop>
341
+    <!-- 修改次卡时间 -->
342
+    <mine-pupop :show="isAmend">
343
+      <div class="amendTime">
344
+        <div class="image">
345
+          <img
346
+            src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
347
+            alt
348
+            @click="closeAmend"
349
+          />
350
+        </div>
351
+        <div class="admendTime-content">
352
+          <div class="oldTime">
353
+            次卡过期时间 :<span> {{ amendCardInfo.expir_time }}</span>
354
+          </div>
355
+          <div class="newTime">
356
+            选择更改日期:
357
+            <el-date-picker
358
+              class="date"
359
+              v-model="cardTime"
360
+              type="date"
361
+              placeholder="选择日期"
362
+              value-format="yyyy-MM-dd"
363
+              @focus="forbid"
364
+            >
365
+            </el-date-picker>
366
+          </div>
367
+          <div class="radio">
368
+            <button class="cancelBtn" @click="cancel">取消</button>
369
+            <button class="affirmBtn" @click="affirm">确定</button>
370
+          </div>
371
+        </div>
372
+      </div>
373
+    </mine-pupop>
322 374
   </div>
323 375
 </template>
324 376
 
@@ -381,12 +433,59 @@ export default {
381 433
       cardInfo: {}, //订单详情
382 434
       cardLogList: [], //次卡消耗记录
383 435
       cardListData: [], //用户次卡列表
436
+      isAmend: false, //修改次卡时间弹窗
437
+      amendCardInfo: "", // 要修改次卡的信息
438
+      cardTime: "", //次卡修改时间(年月日)
384 439
     };
385 440
   },
386 441
   computed: {},
387 442
   watch: {},
388 443
 
389 444
   methods: {
445
+    // 阻止修改次卡时间时键盘弹出
446
+    forbid() {
447
+      //禁止软键盘弹出
448
+      document.activeElement.blur();
449
+    },
450
+    // 修改次卡时间取消
451
+    cancel() {
452
+      this.isAmend = false;
453
+      this.cardTime = "";
454
+    },
455
+    // 修改次卡时间确定
456
+    affirm() {
457
+      this.amendCardTimeApi();
458
+    },
459
+    // 修改次卡时间
460
+    amendCardTime(e) {
461
+      this.isAmend = true;
462
+      this.amendCardInfo = e;
463
+      console.log(e);
464
+    },
465
+    // 关闭修改次卡时间弹窗
466
+    closeAmend() {
467
+      this.isAmend = false;
468
+      this.cardTime = "";
469
+    },
470
+    // 发起修改次卡订单请求
471
+    amendCardTimeApi() {
472
+      api
473
+        .amendCardTime({
474
+          id: this.amendCardInfo.id,
475
+          expire_date: this.cardTime,
476
+        })
477
+        .then((res) => {
478
+          if (res.code == 200) {
479
+            this.$message({
480
+              message: res.msg,
481
+              type: "success",
482
+            });
483
+            this.isAmend = false;
484
+            // 更新次卡列表
485
+            this.getCardList();
486
+          }
487
+        });
488
+    },
390 489
     // 获取优惠券订单
391 490
     getUserCoupon() {
392 491
       let params = {
@@ -547,8 +646,8 @@ export default {
547 646
       this.getCardList();
548 647
     } else if (this.activeName == "third") {
549 648
       this.getUserGoods();
550
-    }else if (this.activeName == 'fourth'){
551
-      this.getUserCoupon()
649
+    } else if (this.activeName == "fourth") {
650
+      this.getUserCoupon();
552 651
     }
553 652
   },
554 653
 
@@ -730,4 +829,64 @@ export default {
730 829
     text-align: center;
731 830
   }
732 831
 }
832
+// 修改次卡时间
833
+.amendTime {
834
+  width: 440px;
835
+  height: 300px;
836
+  background-color: #fff;
837
+  border-radius: 12px;
838
+  padding: 15px;
839
+  .image {
840
+    height: 30px;
841
+    width: 30px;
842
+    img {
843
+      width: 100%;
844
+    }
845
+  }
846
+  .oldTime {
847
+    color: #333;
848
+    margin-left: 20px;
849
+    margin-top: 30px;
850
+    span {
851
+      margin-left: 20px;
852
+    }
853
+  }
854
+  .newTime {
855
+    margin-left: 20px;
856
+    margin-top: 10px;
857
+    .time {
858
+      margin-top: 20px;
859
+      margin-left: 110px;
860
+    }
861
+    .date {
862
+      margin-top: 20px;
863
+      margin-left: 20px;
864
+    }
865
+  }
866
+  .radio {
867
+    width: 100%;
868
+    display: flex;
869
+    justify-content: space-evenly;
870
+    button {
871
+      width: 176px;
872
+      height: 28px;
873
+      border-radius: 14px;
874
+      background-color: #fff;
875
+      border: none;
876
+      margin-top: 90px;
877
+    }
878
+    .cancelBtn {
879
+      border: 1px solid #fa7d22;
880
+      color: #fa7d22;
881
+    }
882
+    .affirmBtn {
883
+      background-color: #fa7d22;
884
+      color: #fff;
885
+      margin-left: 15px;
886
+    }
887
+  }
888
+}
889
+.expir_time {
890
+  color: #3115cc;
891
+}
733 892
 </style>

+ 223 - 0
src/pages/home/calendarPop/index.vue

@@ -0,0 +1,223 @@
1
+<template>
2
+  <div>
3
+    <div class="filterPop">
4
+      <el-dialog
5
+        top="160px"
6
+        :visible.sync="visible"
7
+        width="56.5%"
8
+        :close-on-click-modal="false"
9
+      >
10
+        <span slot="title" class="slot-title">
11
+          <i @click="closeFilterPop" class="el-icon-arrow-left"></i>
12
+          10月客户预约表
13
+        </span>
14
+        <!-- 日历 -->
15
+        <el-calendar v-model="value">
16
+          <template slot="dateCell" slot-scope="{ data }">
17
+            <div>
18
+              <div class="status">已预约</div>
19
+              <div class="Data-bottom" @click="toUserOrder(data)">
20
+                <div
21
+                  :class="{
22
+                    orderSum: true,
23
+                    overActive: data.day.split('-').slice(2).join('-') < today,
24
+                    active:
25
+                      data.day.split('-').slice(2).join('-') > today &&
26
+                      newItem(data) != 0,
27
+                  }"
28
+                >
29
+                  {{ newItem(data) }}
30
+                </div>
31
+                <div class="date">
32
+                  {{ data.day.split("-").slice(2).join("-") }}日
33
+                </div>
34
+              </div>
35
+            </div>
36
+          </template>
37
+        </el-calendar>
38
+      </el-dialog>
39
+    </div>
40
+  </div>
41
+</template>
42
+
43
+<script>
44
+import api from "../../../server/home";
45
+export default {
46
+  props: ["visible"],
47
+  data() {
48
+    return {
49
+      value: "",
50
+      orderSumList: "", //每天预约人数
51
+      today: "",
52
+    };
53
+  },
54
+  methods: {
55
+    closeFilterPop() {
56
+      this.$emit("update:visible", false);
57
+    },
58
+    // 获取每天预约人数
59
+    OrderSum() {
60
+      let nowdays = new Date();
61
+      let year = nowdays.getFullYear();
62
+      let month = nowdays.getMonth() + 1;
63
+      let firstDayOfCurMonth = `${year}-${month}-01`;
64
+      let lastDay = new Date(year, month, 0);
65
+      let lastDayOfCurMonth = `${year}-${month}-${lastDay.getDate()}`;
66
+      api
67
+        .OrderSum({
68
+          start_time: firstDayOfCurMonth,
69
+          end_time: lastDayOfCurMonth,
70
+        })
71
+        .then((res) => {
72
+          if (res.code == 200) {
73
+            this.orderSumList = res.data;
74
+          }
75
+          console.log(res);
76
+        });
77
+    },
78
+    // 跳转到指定日期
79
+    toUserOrder(data) {
80
+      this.$emit("updateUserOrder", data.day);
81
+      this.$emit("update:visible", false);
82
+    },
83
+  },
84
+  computed: {
85
+    newItem: function () {
86
+      return function (data) {
87
+        let num = "";
88
+        if (data.type != "prev-month" && data.type != "next-month") {
89
+          num =
90
+            data.day.split("-").slice(2).join("-").indexOf(0) == 0
91
+              ? this.orderSumList[
92
+                  data.day.split("-").slice(2).join("-").split("0")[1] - 1
93
+                ].num
94
+              : this.orderSumList[data.day.split("-").slice(2).join("-") - 1]
95
+                  .num;
96
+        }
97
+        return num;
98
+      };
99
+    },
100
+  },
101
+  watch: {
102
+    visible(newValue, oldValue) {
103
+      if (newValue) {
104
+        // 获取没天预约人数
105
+        this.OrderSum();
106
+      }
107
+    },
108
+  },
109
+  created() {
110
+    // 获取当天日
111
+    let date = new Date();
112
+    this.today = date.getDate();
113
+  },
114
+};
115
+</script>
116
+
117
+<style lang='less' scoped>
118
+// 弹窗
119
+.filterPop {
120
+  .slot-title {
121
+    display: inline-block;
122
+    font-size: 14px;
123
+    margin-top: 24px;
124
+    font-weight: 600;
125
+    color: #333333;
126
+    i {
127
+      font-size: 24px;
128
+      color: #666666;
129
+      margin-left: 22px;
130
+      margin-right: 180px;
131
+    }
132
+  }
133
+  // 筛选条件
134
+  /deep/.el-dialog {
135
+    border-radius: 8px;
136
+    height: 460px;
137
+    position: relative;
138
+    margin-left: 300px;
139
+    overflow: hidden;
140
+  }
141
+  /deep/.el-dialog__header {
142
+    padding: 0;
143
+    padding-bottom: 10px;
144
+  }
145
+  /deep/button.el-dialog__headerbtn {
146
+    display: none;
147
+  }
148
+  /deep/.el-dialog__body {
149
+    padding: 0;
150
+  }
151
+  // 日历样式
152
+  .status {
153
+    font-size: 8px;
154
+    color: #333;
155
+    margin-bottom: 3px;
156
+  }
157
+  .Data-bottom {
158
+    display: flex;
159
+    align-items: center;
160
+    justify-content: space-between;
161
+    .orderSum {
162
+      font-size: 27px;
163
+      color: #333333 !important;
164
+    }
165
+    .overActive{
166
+      color:darkgrey !important;
167
+    }
168
+    .active {
169
+      color: #fa7d22 !important;
170
+    }
171
+    .date {
172
+      font-size: 10px;
173
+      color: #333333;
174
+    }
175
+  }
176
+
177
+  /deep/.el-calendar__header {
178
+    display: none;
179
+  }
180
+  /deep/.el-calendar-table .el-calendar-day {
181
+    width: 104px;
182
+    height: 60px;
183
+  }
184
+  /deep/td.prev,
185
+  /deep/td.next {
186
+    pointer-events: none;
187
+    visibility: hidden;
188
+  }
189
+  /deep/td.current .el-calendar-day {
190
+    padding: 8px 20px 8px 15px;
191
+  }
192
+  /deep/td.current {
193
+    border: none;
194
+    margin-top: 6px;
195
+    position: relative;
196
+  }
197
+  /deep/td.current::after {
198
+    content: "";
199
+    position: absolute;
200
+    right: 0;
201
+    top: 10px;
202
+    height: 40px;
203
+    background-color: #ededed;
204
+    width: 1px;
205
+  }
206
+  /deep/td.current:nth-child(7)::after {
207
+    display: none;
208
+  }
209
+  /deep/table.el-calendar-table {
210
+    border: 1px solid #f5f5f5;
211
+    border-top: none;
212
+    border-radius: 8px;
213
+    overflow: hidden;
214
+  }
215
+  /deep/thead {
216
+    background-color: #f5f5f5;
217
+    border-radius: 8px !important;
218
+  }
219
+  /deep/tr.el-calendar-table__row:last-child {
220
+    display: none;
221
+  }
222
+}
223
+</style>

+ 392 - 0
src/pages/home/createOrder/index.vue

@@ -0,0 +1,392 @@
1
+<template>
2
+  <div>
3
+    <div class="filterPop">
4
+      <el-dialog
5
+        top="130px"
6
+        :visible.sync="orderShow"
7
+        width="52.5%"
8
+        :close-on-click-modal="false"
9
+      >
10
+        <span slot="title" class="slot-title">
11
+          <i @click="closeFilterPop" class="el-icon-arrow-left"></i>
12
+          创建订单
13
+        </span>
14
+        <!-- 创建订单内容 -->
15
+        <div class="create-content">
16
+          <div class="create-title">预约时间:</div>
17
+          <div class="filter-top">
18
+            <el-date-picker
19
+              :picker-options="pickerOptions"
20
+              :editable="false"
21
+              v-model="value1"
22
+              type="date"
23
+              placeholder="选择日期"
24
+            >
25
+            </el-date-picker>
26
+            <el-time-select
27
+              :editable="false"
28
+              :disabled="value1 == '' ? true : false"
29
+              placeholder="起始时间"
30
+              v-model="startTime"
31
+              :picker-options="{
32
+                start: '10:00',
33
+                step: '00:10',
34
+                end: '23:00',
35
+                minTime: this.nowTime,
36
+              }"
37
+            >
38
+            </el-time-select>
39
+            <el-time-select
40
+              :editable="false"
41
+              :disabled="startTime == '' ? true : false"
42
+              placeholder="结束时间"
43
+              v-model="endTime"
44
+              :picker-options="{
45
+                start: '10:00',
46
+                step: '00:10',
47
+                end: '23:00',
48
+                minTime: startTime,
49
+              }"
50
+            >
51
+            </el-time-select>
52
+          </div>
53
+          <div class="create-title">选择用户:</div>
54
+          <div class="filter-center">
55
+            <el-input
56
+              placeholder="用户手机号、用户id、用户昵称、用户真实姓名"
57
+              class="search"
58
+              v-model="searchText"
59
+            >
60
+              <i slot="prefix" class="el-input__icon el-icon-search"></i>
61
+            </el-input>
62
+            <el-button @click="searchUser" type="primary" class="searchButton"
63
+              >搜索</el-button
64
+            >
65
+          </div>
66
+          <div class="filter-bottom">
67
+            <div
68
+              v-for="(item, index) in userList"
69
+              :key="index"
70
+              class="bottom-item"
71
+              @click="isSelectUser(item, index)"
72
+            >
73
+              <div class="left">
74
+                <img :src="item.avatar_url" alt="">
75
+              </div>
76
+              <div class="right">
77
+                <div class="right-content">
78
+                  <div class="nickname">
79
+                    {{ item.nickname }}
80
+                    <span class="name">{{ item.real_name }}</span>
81
+                  </div>
82
+                  <div class="userID">id: {{ item.id }}</div>
83
+                  <div class="phone">电话: {{ item.mobile }}</div>
84
+                </div>
85
+              </div>
86
+              <img
87
+                class="radio"
88
+                :src="item.status ? select : unSelect"
89
+                alt=""
90
+              />
91
+            </div>
92
+          </div>
93
+        </div>
94
+        <div class="slot-footer" slot="footer">
95
+          <button class="cancel" @click="closeFilterPop">取消</button>
96
+          <button class="affirm" @click="affirm">确认</button>
97
+        </div>
98
+      </el-dialog>
99
+    </div>
100
+  </div>
101
+</template>
102
+
103
+<script>
104
+import api from "../../../server/home";
105
+export default {
106
+  props: ["visible", "orderShow", "toTime"],
107
+  data() {
108
+    return {
109
+      isSelect: false,
110
+      select:
111
+        "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/select.png",
112
+      unSelect:
113
+        "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/unSelect.png",
114
+      value1: "", //日期
115
+      startTime: "", //开始时间
116
+      endTime: "", //结束时间
117
+      searchText: "", //搜索框内容
118
+      nowTime: "", //当前的(小时分钟)时间
119
+      pickerOptions: {
120
+        disabledDate(time) {
121
+          let times = Date.now() - 24 * 60 * 60 * 1000;
122
+          return time.getTime() < times;
123
+        },
124
+      }, //限制只能选择今天及以后的时间
125
+      userList: [], //查询的用户列表
126
+      checkUserList: [], //选中的用户信息ID
127
+      id: "", //预约记录ID
128
+      isClick: "", //是否是编辑或者直接点击加号创建的
129
+    };
130
+  },
131
+  methods: {
132
+    // 取消&&返回按钮关闭弹窗
133
+    closeFilterPop() {
134
+      this.$emit("update:orderShow", false);
135
+      Object.assign(this.$data, this.$options.data());
136
+    },
137
+    // 查询用户
138
+    searchUser(keyword) {
139
+      api
140
+        .searchOrderUser({
141
+          keyword: this.searchText || keyword,
142
+        })
143
+        .then((res) => {
144
+          if (res.code == 200) {
145
+            // 手机号四位隐藏
146
+            res.data.list.map((item) => {
147
+              if (item.mobile) {
148
+                item.mobile =
149
+                  item.mobile.substring(0, 3) +
150
+                  "****" +
151
+                  item.mobile.substring(7);
152
+              }
153
+              item.status = false;
154
+            });
155
+            // 获取查询的用户
156
+            this.userList = res.data.list;
157
+            console.log(this.userList);
158
+          }
159
+        });
160
+    },
161
+    // 选择用户
162
+    isSelectUser(item, index) {
163
+      if (this.userList[index].status) {
164
+        this.$set(this.userList, index, {
165
+          ...this.userList[index],
166
+          status: false,
167
+        });
168
+      } else {
169
+        this.$set(this.userList, index, {
170
+          ...this.userList[index],
171
+          status: true,
172
+        });
173
+      }
174
+      let checkList = [];
175
+      this.userList.forEach((item) => {
176
+        if (item.status) {
177
+          checkList.push(item.id);
178
+        }
179
+      });
180
+      this.checkUserList = checkList;
181
+    },
182
+    // 创建订单
183
+    affirm() {
184
+      if (this.startTime == "" || this.value1 == "") {
185
+        this.$message.error("请选择预约时间");
186
+        return;
187
+      }
188
+      if (this.checkUserList == "") {
189
+        this.$message.error("请选择预约用户");
190
+        return;
191
+      }
192
+      let date = this.isClick
193
+        ? this.value1
194
+        : `${this.value1.getFullYear()}-${
195
+            this.value1.getMonth() + 1
196
+          }-${this.value1.getDate()}`;
197
+      let start_time = date + " " + this.startTime;
198
+      let end_time = date + " " + this.endTime;
199
+      let params = {
200
+        user_id: this.checkUserList.toString(),
201
+        start_time,
202
+        end_time,
203
+        id: this.id || "",
204
+      };
205
+      console.log(params);
206
+      api.createUserOrder(params).then((res) => {
207
+        this.$message({
208
+          message:params.id?'修改成功': "创建成功",
209
+          type: "success",
210
+        });
211
+        this.$emit("update:orderShow", false);
212
+        this.$emit("updateUserOrder", date);
213
+      });
214
+      // 清除数据
215
+      Object.assign(this.$data, this.$options.data());
216
+    },
217
+  },
218
+  watch: {
219
+    // 获取父组件赋值的时间
220
+    toTime(newValue, oldValue) {
221
+      console.log(newValue);
222
+      if (newValue.isClick) {
223
+        this.isClick = newValue.isClick;
224
+        this.startTime = newValue.start;
225
+        this.endTime = newValue.end;
226
+        this.id = newValue.order_id;
227
+        let date = new Date();
228
+        if (newValue.day) {
229
+          this.value1 = newValue.day;
230
+        } else {
231
+          this.value1 = `${date.getFullYear()}-${
232
+            date.getMonth() + 1
233
+          }-${date.getDate()}`;
234
+        }
235
+      } else {
236
+        this.startTime = "";
237
+        this.endTime = "";
238
+        this.value1 = "";
239
+      }
240
+    },
241
+  },
242
+  created() {
243
+    let date = new Date();
244
+    // 限制选择的时间截止到当前之后
245
+    this.nowTime = `${date.getHours() - 1}:59`;
246
+  },
247
+};
248
+</script>
249
+
250
+<style lang='less' scoped>
251
+// 弹窗
252
+.filterPop {
253
+  .slot-title {
254
+    display: inline-block;
255
+    font-size: 14px;
256
+    margin-top: 24px;
257
+    font-weight: 600;
258
+    i {
259
+      font-size: 24px;
260
+      color: #666666;
261
+      margin-left: 22px;
262
+      margin-right: 175px;
263
+    }
264
+  }
265
+  // 创建订单内容
266
+  .create-content {
267
+    .create-title {
268
+      font-size: 14px;
269
+      color: #333333;
270
+    }
271
+    .filter-top {
272
+      margin-top: 10px;
273
+      margin-bottom: 15px;
274
+    }
275
+    .filter-center {
276
+      margin-top: 15px;
277
+      .search {
278
+        width: 338px;
279
+      }
280
+      .searchButton {
281
+        margin-left: 10px;
282
+        width: 68px;
283
+        background: #fa7d22;
284
+        border-radius: 2px;
285
+        border-color: #fa7d22;
286
+      }
287
+    }
288
+    .filter-bottom {
289
+      margin-top: 12px;
290
+      height: 70px;
291
+      width: 416px;
292
+      display: flex;
293
+      overflow-x: auto;
294
+      .bottom-item {
295
+        height: 100%;
296
+        width: 203px;
297
+        background-color: #f5f5f5;
298
+        border-radius: 8px;
299
+        display: flex;
300
+        align-items: center;
301
+        margin-left: 10px;
302
+        .left {
303
+          width: 70px;
304
+          height: 70px;
305
+          border-radius: 8px;
306
+          margin-right: 8px;
307
+          overflow: hidden;
308
+          img{
309
+            width: 100%;
310
+            height: 100%;
311
+          }
312
+        }
313
+        .right {
314
+          width: 90px;
315
+          height: 100%;
316
+          .right-content {
317
+            width: 98px;
318
+            height: 100%;
319
+            display: flex;
320
+            flex-direction: column;
321
+            justify-content: space-evenly;
322
+            .nickname {
323
+              font-size: 14px;
324
+              color: #333;
325
+              overflow: hidden; // 溢出隐藏
326
+              text-overflow: ellipsis; // 文字溢出显示省略号
327
+              white-space: nowrap; // 强制一行
328
+              .name {
329
+                font-size: 10px;
330
+              }
331
+            }
332
+            .userID,
333
+            .phone {
334
+              font-size: 10px;
335
+              color: #666666;
336
+            }
337
+          }
338
+        }
339
+        .radio {
340
+          width: 24px;
341
+          height: 24px;
342
+          margin-right: 10px;
343
+        }
344
+      }
345
+    }
346
+  }
347
+  .slot-footer {
348
+    margin-top: 48px;
349
+    display: flex;
350
+    justify-content: center;
351
+    button {
352
+      width: 176px;
353
+      height: 28px;
354
+      border-radius: 14px;
355
+      background-color: #fff;
356
+      border: none;
357
+    }
358
+    .cancel {
359
+      border: 1px solid #fa7d22;
360
+      color: #fa7d22;
361
+    }
362
+    .affirm {
363
+      background-color: #fa7d22;
364
+      color: #fff;
365
+      margin-left: 15px;
366
+    }
367
+  }
368
+  /deep/.el-date-editor.el-input.el-input--prefix.el-input--suffix.el-date-editor--date {
369
+    width: 180px;
370
+  }
371
+  /deep/.el-date-editor.el-input.el-input--prefix.el-input--suffix.el-date-editor--time-select {
372
+    width: 150px;
373
+    margin-left: 10px;
374
+  }
375
+  /deep/.el-dialog__body {
376
+    padding: 0 0 0 56px;
377
+  }
378
+  /deep/.el-dialog {
379
+    border-radius: 8px;
380
+    height: 500px;
381
+    margin-left: 300px;
382
+    position: relative;
383
+  }
384
+  /deep/button.el-dialog__headerbtn {
385
+    display: none;
386
+  }
387
+  /deep/.el-dialog__header {
388
+    padding: 0;
389
+    padding-bottom: 20px;
390
+  }
391
+}
392
+</style>

+ 379 - 91
src/pages/home/detailList/index.vue

@@ -1,164 +1,452 @@
1 1
 <template>
2 2
   <div class="container">
3
-    <div class="row" ref="row" v-for="(orderListItem, index) in orderList" :key="index">
3
+    <div
4
+      class="row"
5
+      ref="row"
6
+      v-for="(orderListItem, index) in orderList"
7
+      :key="index"
8
+    >
4 9
       <div class="time" :style="{ height: `${rowHeightList[index]}px` }">
5
-        <span>{{orderListItem.time.start}}</span>
10
+        <span>{{ orderListItem.time.start }}</span>
6 11
         <span>-</span>
7
-        <span>{{orderListItem.time.end}}</span>
12
+        <span>{{ orderListItem.time.end }}</span>
8 13
       </div>
9 14
       <div class="project-wrapper">
10
-        <div class="project"
11
-          v-for="(projectItem, index) in orderListItem.list" 
15
+        <div
16
+          class="project"
17
+          v-for="(projectItem, index) in orderListItem.list"
12 18
           :key="index"
13 19
           @click="toOrderDetail(projectItem)"
14 20
           :style="{
15 21
             color: getStyleByOrderStatus(projectItem).color,
16 22
             borderLeft: '1px solid',
17
-            backgroundColor: getStyleByOrderStatus(projectItem).backgroundColor
23
+            backgroundColor: getStyleByOrderStatus(projectItem).backgroundColor,
18 24
           }"
19 25
         >
20
-          <div class="name">{{projectItem.nickname}}</div>
26
+          <!-- 设置手动预约标识 -->
27
+          <!-- 1是线上预约 2是线下预约 -->
28
+          <div
29
+            v-if="projectItem.type == 2"
30
+            class="order-tip"
31
+            :style="{ color: getStyleByOrderStatus(projectItem).orderTipColor }"
32
+          >
33
+            预
34
+          </div>
35
+          <div class="name">{{ projectItem.nickname }}</div>
21 36
           <div class="project-time">
22
-            <span>{{projectItem.start}}</span>
37
+            <span>{{ projectItem.start }}</span>
23 38
             <span>-</span>
24
-            <span>{{projectItem.end}}</span>
39
+            <span>{{ projectItem.end }}</span>
40
+          </div>
41
+          <!-- 新人预约提示tip -->
42
+          <!-- 1付费用户 0未付费用户 -->
43
+          <div
44
+            v-if="projectItem.pay == 0"
45
+            :style="{
46
+              backgroundColor: getStyleByOrderStatus(projectItem).color,
47
+            }"
48
+            class="newPeople"
49
+          >
50
+            NEW
25 51
           </div>
52
+          <div
53
+            class="cicle"
54
+            :style="{
55
+              backgroundColor:
56
+                getStyleByOrderStatus(projectItem).backgroundColor,
57
+            }"
58
+          ></div>
59
+          <!-- 预约操作删除编辑 -->
60
+          <el-dropdown
61
+            v-if="projectItem.status == 0 || projectItem.status == 1"
62
+            @command="clickOrder"
63
+            placement="bottom"
64
+            trigger="click"
65
+            class="clickOrder"
66
+          >
67
+            <div class="clickOrder-item"></div>
68
+            <el-dropdown-menu slot="dropdown">
69
+              <el-dropdown-item :command="beforeHandleCommand(projectItem, 'a')"
70
+                >查看详情</el-dropdown-item
71
+              >
72
+              <el-dropdown-item :command="beforeHandleCommand(projectItem, 'b')"
73
+                >编辑</el-dropdown-item
74
+              >
75
+              <el-dropdown-item :command="beforeHandleCommand(projectItem, 'c')"
76
+                >删除</el-dropdown-item
77
+              >
78
+            </el-dropdown-menu>
79
+          </el-dropdown>
26 80
         </div>
81
+        <!-- 添加订单 -->
82
+        <i
83
+          class="el-icon-plus"
84
+          @click="orderCreate(orderListItem.time)"
85
+          v-if="
86
+            thisDays > Days? false: thisDays == Days? orderListItem.time.end > nowTime: true
87
+          "
88
+        ></i>
27 89
       </div>
28 90
     </div>
91
+    <!-- 侧边图标 -->
92
+    <div class="calendar" @click="openCalendar">
93
+      <i class="el-icon-date"></i>
94
+      <span>日历</span>
95
+    </div>
96
+    <div class="setUp" @click="orderCreate">
97
+      <i class="el-icon-circle-plus-outline"></i>
98
+      <span>创建预约</span>
99
+    </div>
100
+    <div class="backNow" @click="backToday" v-if="isBackToday">
101
+      <i class="el-icon-refresh-right"></i>
102
+      <span>返回今天</span>
103
+    </div>
104
+    <!-- 日历弹窗 -->
105
+    <calendar-pop
106
+      @updateUserOrder="updateUserOrder"
107
+      :visible.sync="visible"
108
+    ></calendar-pop>
109
+    <!-- 创建订单弹窗 -->
110
+    <create-order
111
+      @updateUserOrder="updateUserOrder"
112
+      :toTime="toTime"
113
+      :orderShow.sync="orderShow"
114
+    ></create-order>
29 115
   </div>
30 116
 </template>
31 117
 
32 118
 <script>
33
-import api from '@/server/home'
34
-
119
+import api from "@/server/home";
120
+import calendarPop from "../calendarPop/index.vue";
121
+import createOrder from "../createOrder/index.vue";
35 122
 export default {
123
+  components: { calendarPop, createOrder },
36 124
   data() {
37 125
     return {
38 126
       orderList: [],
39 127
       timeList: [],
40 128
       rowHeightList: [],
41 129
       colorStyleList: [
42
-        { orderStatus: [3, 5], color: '#A3A3A3', backgroundColor: '#F0F0F0' },
43
-        { orderStatus: [2], color: '#FA7D22', backgroundColor: '#FEF4ED' },
44
-        { orderStatus: [0, 1], color: '#42D351', backgroundColor: '#F5FCF5' },
130
+        {
131
+          orderStatus: [3, 5],
132
+          color: "#A3A3A3",
133
+          backgroundColor: "#F0F0F0",
134
+          orderTipColor: "#e8e8e8",
135
+        },
136
+        {
137
+          orderStatus: [2],
138
+          color: "#FA7D22",
139
+          backgroundColor: "#FEF4ED",
140
+          orderTipColor: "#f6e1d1",
141
+        },
142
+        {
143
+          orderStatus: [0, 1],
144
+          color: "#42D351",
145
+          backgroundColor: "#F5FCF5",
146
+          orderTipColor: "#e0f6e2",
147
+        },
45 148
       ],
46
-      timer: null
149
+      timer: null,
150
+      visible: false, //控制日历
151
+      orderShow: false, //控制创建订单弹窗
152
+      nowTime: "", //当前小时分钟
153
+      toTime: "", //点击加号创建订单时传过去的时间
154
+      Days: "", //要查询的日期
155
+      thisDays: "", //当前日期
156
+      isBackToday: false, //是否显示返回今天
47 157
     };
48 158
   },
49
-  created () {
50
-    this.fetchOrderList()
159
+  created() {
160
+    this.nowTime = `${new Date().getHours()}:${new Date().getMinutes()}`;
161
+    this.fetchOrderList();
51 162
     this.timer = setInterval(() => {
52
-      this.fetchOrderList()
53
-    }, 10000)
163
+      this.fetchOrderList();
164
+    }, 10000);
165
+    let date = new Date();
166
+    let moth = date.getMonth() + 1;
167
+    let day = date.getFullYear() + "-" + moth + "-" + date.getDate();
168
+    this.thisDays = day;
169
+    this.Days = day;
54 170
   },
55
-  mounted () {
171
+  mounted() {
56 172
     if (this.$refs.row) {
57 173
       this.$refs.row.forEach((item) => {
58
-        this.rowHeightList.push(item.clientHeight)
59
-      })
174
+        this.rowHeightList.push(item.clientHeight);
175
+      });
60 176
     }
61 177
   },
62
-  destroyed () {
178
+  destroyed() {
63 179
     if (this.timer) {
64
-      clearInterval(this.timer)
65
-      this.timer = null
180
+      clearInterval(this.timer);
181
+      this.timer = null;
66 182
     }
67 183
   },
68 184
   methods: {
69
-    async fetchOrderList () {
70
-      let resp = await api.reservedRecords()
185
+    beforeHandleCommand(orderInfo, command) {
186
+      return {
187
+        orderInfo: orderInfo,
188
+        command: command,
189
+      };
190
+    },
191
+    // 返回今天
192
+    backToday() {
193
+      this.Days = this.thisDays;
194
+      this.fetchOrderList();
195
+    },
196
+    // 跳转到指定日期预约表
197
+    updateUserOrder(e) {
198
+      this.Days = e;
199
+      this.fetchOrderList();
200
+    },
201
+    // 创建订单  打开创建订单弹窗
202
+    orderCreate(e) {
203
+      if (e.end) {
204
+        e.day = this.Days;
205
+        e.isClick = true;
206
+        this.toTime = e;
207
+      } else {
208
+        e.isClick = false;
209
+        this.toTime = e;
210
+      }
211
+      this.orderShow = true;
212
+    },
213
+    // 删除创建订单
214
+    delOrder(id) {
215
+      api.delOrder(
216
+        {
217
+          id,
218
+          type: 1,
219
+        },
220
+      ).then(res=>{
221
+          this.$message({
222
+            message: "删除成功",
223
+            type: "success",
224
+          });
225
+      });
226
+    },
227
+    // 打开日历弹窗
228
+    openCalendar() {
229
+      this.visible = true;
230
+    },
231
+    async fetchOrderList() {
232
+      let date = new Date();
233
+      let moth = date.getMonth() + 1;
234
+      let day = date.getFullYear() + "-" + moth + "-" + date.getDate();
235
+      let resp = await api.reservedRecords({
236
+        day: this.Days || day,
237
+      });
71 238
       if (resp.code === 200) {
72
-        this.orderList = resp.data
239
+        this.orderList = resp.data;
240
+        if (this.thisDays != this.Days && this.Days != "") {
241
+          this.isBackToday = true;
242
+        } else {
243
+          this.isBackToday = false;
244
+        }
73 245
       }
246
+      this.nowTime = `${new Date().getHours()}:${new Date().getMinutes()}`;
74 247
     },
75
-    getStyleByOrderStatus (orderSource) {
76
-      let style = null
248
+    getStyleByOrderStatus(orderSource) {
249
+      let style = null;
77 250
       // 订单状态,0已预约,未支付,1已支付,待使用,2正在使用,3已结算,5已取消
78
-      switch(orderSource.status) {
251
+      switch (orderSource.status) {
79 252
         case 0:
80
-          style = this.colorStyleList[2]
81
-        break;
253
+          style = this.colorStyleList[2];
254
+          break;
82 255
         case 1:
83
-          style = this.colorStyleList[2]
84
-        break;
256
+          style = this.colorStyleList[2];
257
+          break;
85 258
         case 2:
86
-          style = this.colorStyleList[1]
87
-        break;
259
+          style = this.colorStyleList[1];
260
+          break;
88 261
         case 3:
89
-          style = this.colorStyleList[0]
90
-        break;
262
+          style = this.colorStyleList[0];
263
+          break;
91 264
         case 5:
92
-          style = this.colorStyleList[0]
93
-        break;
265
+          style = this.colorStyleList[0];
266
+          break;
267
+      }
268
+      return style;
269
+    },
270
+    clickOrder(e) {
271
+      if (e.command == "b") {
272
+        if (e.orderInfo.end) {
273
+          e.orderInfo.isClick = true;
274
+          e.orderInfo.day = this.Days
275
+          this.toTime = e.orderInfo;
276
+        } else {
277
+          e.orderInfo.isClick = false;
278
+          this.toTime = e.orderInfo;
279
+        }
280
+        this.orderShow = true;
281
+      } else if (e.command == "a") {
282
+        api.userOrderDetail({
283
+          id:e.orderInfo.order_id
284
+        }).then(res=>{
285
+        this.$router.push({
286
+          path: "/customerMan/details",
287
+          query:{
288
+            id:res.data[0].user_id
289
+          }
290
+        });
291
+        })
292
+      } else {
293
+        this.delOrder(e.orderInfo.order_id);
294
+        this.fetchOrderList();
94 295
       }
95
-      return style
96 296
     },
97
-    toOrderDetail (source) {
297
+    toOrderDetail(source) {
298
+      // 如果是付费用户
299
+      if (source.type == 2) {
300
+        return;
301
+      }
98 302
       if (source.status === 0) {
99
-        this.$router.push({ 
100
-          path: '/confirmOrder/details',
303
+        this.$router.push({
304
+          path: "/confirmOrder/details",
101 305
           query: {
102
-            id: source.order_id
103
-          } 
104
-        })
306
+            id: source.order_id,
307
+          },
308
+        });
105 309
       } else {
106 310
         this.$router.push({
107 311
           path: "/historicalOrder/details",
108 312
           query: {
109
-            id: source.order_id
110
-          }
111
-        })
313
+            id: source.order_id,
314
+          },
315
+        });
112 316
       }
113
-    }
114
-  }
317
+    },
318
+  },
115 319
 };
116 320
 </script>
117 321
 
118 322
 <style lang="less" scoped>
119
-  .container {
120
-    width: 100%;
121
-    height: 100%;
122
-    background-color: #FFFFFF;
123
-    overflow: hidden;
124
-    overflow-y: auto;
125
-    border-radius: 8px;
126
-    .row {
323
+.container {
324
+  width: 100%;
325
+  height: 100%;
326
+  background-color: #ffffff;
327
+  overflow: hidden;
328
+  overflow-y: auto;
329
+  border-radius: 8px;
330
+  position: relative;
331
+  .row {
332
+    display: flex;
333
+    .time,
334
+    .project-wrapper .project {
335
+      width: 77px;
336
+      height: 80px;
127 337
       display: flex;
128
-      .time, .project-wrapper .project {
129
-        width: 77px;
130
-        height: 80px;
131
-        display: flex;
132
-        flex-direction: column;
133
-        justify-content: center;
134
-        align-items: center;
135
-        font-family: PingFangSC-Medium, PingFang SC;
136
-      }
137
-      .time {
138
-        border-bottom: 2px #f5f5f5 solid;
139
-      }
140
-      .project-wrapper {
141
-        flex: 1;
142
-        display: flex;
143
-        flex-wrap: wrap;
144
-        .project {
145
-          padding: 3px;
146
-          box-sizing: border-box;
147
-          .name {
338
+      flex-direction: column;
339
+      justify-content: center;
340
+      align-items: center;
341
+      font-family: PingFangSC-Medium, PingFang SC;
342
+    }
343
+    .time {
344
+      border-bottom: 2px #f5f5f5 solid;
345
+    }
346
+    .project-wrapper {
347
+      flex: 1;
348
+      display: flex;
349
+      flex-wrap: wrap;
350
+      .project {
351
+        padding: 3px;
352
+        box-sizing: border-box;
353
+        position: relative;
354
+        .name {
355
+          position: relative;
356
+          width: 100%;
357
+          text-align: center;
358
+          font-size: 14px;
359
+          margin-bottom: 3px;
360
+          overflow: hidden;
361
+          white-space: nowrap;
362
+          text-overflow: ellipsis;
363
+        }
364
+        .project-time {
365
+          position: relative;
366
+          display: flex;
367
+          font-size: 10px;
368
+        }
369
+        .order-tip {
370
+          position: absolute;
371
+          font-size: 60px;
372
+        }
373
+        .newPeople {
374
+          text-align: center;
375
+          font-size: 10px;
376
+          position: absolute;
377
+          line-height: 16px;
378
+          font-size: center;
379
+          width: 26px;
380
+          height: 18px;
381
+          left: 5px;
382
+          top: 0;
383
+          background-color: aqua;
384
+          color: #fff;
385
+        }
386
+        .cicle {
387
+          position: absolute;
388
+          width: 26px;
389
+          height: 6px;
390
+          background-color: bisque;
391
+          left: 5px;
392
+          border-radius: 9px 9px 0 0;
393
+          top: 15px;
394
+        }
395
+        .clickOrder {
396
+          position: absolute;
397
+          width: 77px;
398
+          height: 80px;
399
+          top: 0;
400
+          left: 0;
401
+          .clickOrder-item {
148 402
             width: 100%;
149
-            text-align: center;
150
-            font-size: 14px;
151
-            margin-bottom: 3px;
152
-            overflow: hidden;
153
-            white-space: nowrap;
154
-            text-overflow: ellipsis;
155
-          }
156
-          .project-time {
157
-            display: flex;
158
-            font-size: 10px;
403
+            height: 100%;
159 404
           }
160 405
         }
161 406
       }
407
+      .el-icon-plus {
408
+        color: #ededed;
409
+        font-size: 32px;
410
+        line-height: 80px;
411
+        margin-left: 29px;
412
+      }
162 413
     }
163 414
   }
415
+  // 侧边图表样式
416
+  .calendar,
417
+  .setUp,
418
+  .backNow {
419
+    position: fixed;
420
+    height: 42px;
421
+    width: 125px;
422
+    border-radius: 100px 0px 0px 100px;
423
+    right: 20px;
424
+    background-color: #fff;
425
+    box-shadow: 0px 0px 4px 0px rgba(228, 228, 228, 0.5);
426
+    line-height: 42px;
427
+    color: #333333;
428
+    font-size: 16px;
429
+    i {
430
+      font-size: 20px;
431
+      margin-left: 15px;
432
+      margin-right: 15px;
433
+    }
434
+  }
435
+  .calendar {
436
+    top: 102px;
437
+    span {
438
+      width: 64px;
439
+      display: inline-block;
440
+      text-align: justify;
441
+      text-justify: distribute-all-lines;
442
+      text-align-last: justify;
443
+    }
444
+  }
445
+  .setUp {
446
+    top: 154px;
447
+  }
448
+  .backNow {
449
+    top: 206px;
450
+  }
451
+}
164 452
 </style>

+ 20 - 0
src/server/home.js

@@ -233,4 +233,24 @@ export default class Home {
233 233
   static getUserPayList (params) {
234 234
     return $http.get(url.getUserPayList, params)
235 235
   }
236
+  // 获取付费用户列表
237
+  static searchOrderUser (params) {
238
+    return $http.post(url.searchOrderUser, params)
239
+  }
240
+  // 创建订单
241
+  static createUserOrder (params) {
242
+    return $http.post(url.createUserOrder, params)
243
+  }
244
+  // 获取预约人数统计
245
+  static OrderSum (params) {
246
+    return $http.post(url.OrderSum, params)
247
+  }
248
+  // 删除预约订单
249
+  static delOrder (params) {
250
+    return $http.get(url.delOrder, params)
251
+  }
252
+  // 用户预约详情
253
+  static userOrderDetail (params) {
254
+    return $http.get(url.userOrderDetail, params)
255
+  }
236 256
 }

+ 15 - 0
src/server/urls.js

@@ -144,4 +144,19 @@ export default {
144 144
 
145 145
   // 获取付费用户列表
146 146
   getUserPayList:'/v2/pad/user/pay_list',
147
+
148
+  // 查询预约用户
149
+  searchOrderUser:'/v2/pad/reserved/user',
150
+
151
+  // 创建预约
152
+  createUserOrder:'/v2/pad/reserved/created',
153
+
154
+  // 预约人数统计
155
+  OrderSum:'/v2/pad/reserved/count',
156
+
157
+  // 预约人数统计
158
+  delOrder:'/v2/pad/reserved/del',
159
+
160
+  //用户预约详情
161
+  userOrderDetail:'/v2/pad/reserved/info'
147 162
 }