ソースを参照

✨ 对接门店检查记录/门店客户记录,修改bugs

谢创宏 3 年 前
コミット
20408638e3
共有53 個のファイルを変更した2773 個の追加180 個の削除を含む
  1. BIN
      .DS_Store
  2. 4 1
      app.json
  3. BIN
      images/.DS_Store
  4. BIN
      images/icon_01.png
  5. BIN
      images/phone_01.png
  6. BIN
      images/phone_02.png
  7. BIN
      images/phone_03.png
  8. BIN
      images/select_no.png
  9. BIN
      images/select_ok.png
  10. 63 5
      pages/clientInfo/clientInfo.js
  11. 7 4
      pages/clientInfo/clientInfo.wxml
  12. 3 2
      pages/clientInfoEdit/clientInfoEdit.wxml
  13. 95 0
      pages/customerList/customerList.js
  14. 4 0
      pages/customerList/customerList.json
  15. 28 0
      pages/customerList/customerList.wxml
  16. 54 0
      pages/customerList/customerList.wxss
  17. 1 1
      pages/dossier/dossier.js
  18. 22 6
      pages/dossier/dossier.wxml
  19. 34 15
      pages/feedback/feedback.js
  20. 1 1
      pages/feedback/feedback.wxss
  21. 102 0
      pages/historyOrder/historyOrder.js
  22. 4 0
      pages/historyOrder/historyOrder.json
  23. 33 0
      pages/historyOrder/historyOrder.wxml
  24. 55 0
      pages/historyOrder/historyOrder.wxss
  25. 2 2
      pages/home/home.wxml
  26. 7 0
      pages/login/login.js
  27. 1 1
      pages/member/member.wxml
  28. 1 0
      pages/orderDetail/orderDetail.wxml
  29. 206 0
      pages/phone/phone.js
  30. 4 0
      pages/phone/phone.json
  31. 14 0
      pages/phone/phone.wxml
  32. 52 0
      pages/phone/phone.wxss
  33. 46 4
      pages/recordList/recordList.js
  34. 12 12
      pages/recordList/recordList.wxml
  35. 258 27
      pages/recordSheet/components/inspect/inspect.js
  36. 105 47
      pages/recordSheet/components/inspect/inspect.wxml
  37. 77 1
      pages/recordSheet/components/inspect/inspect.wxss
  38. 252 3
      pages/recordSheet/components/review/review.js
  39. 135 2
      pages/recordSheet/components/review/review.wxml
  40. 240 1
      pages/recordSheet/components/review/review.wxss
  41. 270 3
      pages/recordSheet/components/verify/verify.js
  42. 135 2
      pages/recordSheet/components/verify/verify.wxml
  43. 240 1
      pages/recordSheet/components/verify/verify.wxss
  44. 55 3
      pages/recordSheet/recordSheet.js
  45. 13 13
      pages/recordSheet/recordSheet.wxml
  46. 90 6
      pages/tagsAdd/tagsAdd.js
  47. 9 4
      pages/tagsAdd/tagsAdd.wxml
  48. 27 5
      pages/tagsCustom/tagsCustom.js
  49. 2 2
      pages/tagsCustom/tagsCustom.wxml
  50. 5 4
      pages/tagsEdit/tagsEdit.js
  51. 1 1
      pages/tagsEdit/tagsEdit.wxml
  52. 1 1
      project.private.config.json
  53. 3 0
      utils/http.js

BIN
.DS_Store


+ 4 - 1
app.json

@@ -18,7 +18,10 @@
18 18
     "pages/role/role",
19 19
     "pages/recordList/recordList",
20 20
     "pages/test/test",
21
-    "pages/login/login"
21
+    "pages/login/login",
22
+    "pages/phone/phone",
23
+    "pages/customerList/customerList",
24
+    "pages/historyOrder/historyOrder"
22 25
   ],
23 26
   "tabBar": {
24 27
     "color": "#666666",

BIN
images/.DS_Store


BIN
images/icon_01.png


BIN
images/phone_01.png


BIN
images/phone_02.png


BIN
images/phone_03.png


BIN
images/select_no.png


BIN
images/select_ok.png


+ 63 - 5
pages/clientInfo/clientInfo.js

@@ -23,6 +23,10 @@ Page({
23 23
       1: '男',
24 24
       2: '女'
25 25
     },
26
+    calendar: {},
27
+    calendarConfig: {
28
+      takeoverTap: true,
29
+    },
26 30
     list: [],
27 31
     total: 0,
28 32
     page: 1,
@@ -38,7 +42,7 @@ Page({
38 42
       this.setData({
39 43
         userId: options.userId
40 44
       },() => {
41
-        this.getUserInfo()
45
+        // this.getUserInfo()
42 46
         this.getfeedbackList()
43 47
       })
44 48
       
@@ -57,7 +61,7 @@ Page({
57 61
    * 生命周期函数--监听页面显示
58 62
    */
59 63
   onShow: function () {
60
-
64
+    this.getUserInfo()
61 65
   },
62 66
 
63 67
   /**
@@ -98,8 +102,10 @@ Page({
98 102
   },
99 103
 
100 104
   afterCalendarRender(e) {
101
-    const calendar = this.selectComponent('#calendar').calendar
102
-    console.log('afterCalendarRender -> calendar', calendar)
105
+    this.data.calendar = this.selectComponent('#calendar').calendar
106
+    console.log(this.data.calendar.getCurrentYM())
107
+    this.getOrderCalendar()
108
+    console.log('afterCalendarRender -> calendar', this.data.calendar)
103 109
     const toSet = [
104 110
       {
105 111
         year: 2021,
@@ -112,7 +118,29 @@ Page({
112 118
         date: 18
113 119
       }
114 120
     ]
115
-    calendar.setSelectedDates(toSet)
121
+    this.data.calendar.setSelectedDates(toSet)
122
+  },
123
+
124
+  /**
125
+   * 当日历滑动时触发
126
+   */
127
+  onSwipe(e) {
128
+    console.log('onSwipe', e.detail)
129
+    this.getOrderCalendar()
130
+  },
131
+
132
+  /**
133
+   * 日期点击事件(此事件会完全接管点击事件),需自定义配置 takeoverTap 值为真才能生效
134
+   * currentSelect 当前点击的日期
135
+   */
136
+  takeoverTap(e) {
137
+    let { userId } = this.data;
138
+    if(e.detail.choosed) {
139
+      wx.navigateTo({
140
+        url: `/pages/historyOrder/historyOrder?user_id=${userId}&detail=${JSON.stringify(e.detail)}`,
141
+      })
142
+      console.log('takeoverTap', e.detail) // => { year: 2019, month: 12, date: 3, ...}
143
+    }
116 144
   },
117 145
   
118 146
   /**
@@ -162,5 +190,35 @@ Page({
162 190
       list.push(...res.data.list)
163 191
       this.setData({ list,total: res.data.total, })
164 192
     })
193
+  },
194
+
195
+  /**
196
+   * 获取日历
197
+   * api/order/calendar
198
+  */
199
+  getOrderCalendar() {
200
+    let calendar = this.data.calendar;
201
+    let month = calendar.getCurrentYM().month;
202
+    console.log(this.data.calendar.getCurrentYM())
203
+    get('api/order/calendar',{
204
+      user_id: this.data.userId,
205
+      month: `${calendar.getCurrentYM().year}-${month < 10 ? '0' + month : month }`
206
+    },(res) => {
207
+      let dates = []
208
+      calendar.cancelSelectedDates(dates)
209
+      res.data.forEach((item,index) => {
210
+        if(item.num > 0) {
211
+          dates.push({
212
+            year: calendar.getCurrentYM().year,
213
+            month: calendar.getCurrentYM().month,
214
+            date: item.day
215
+          })
216
+        }
217
+        console.log(item)
218
+      })
219
+      calendar.setSelectedDates(dates)
220
+      console.log(dates)
221
+      console.log(res)
222
+    })
165 223
   }
166 224
 })

+ 7 - 4
pages/clientInfo/clientInfo.wxml

@@ -22,7 +22,7 @@
22 22
         <text>客户标签:</text>
23 23
         <block wx:if="{{ userInfo.tags && userInfo.tags.length > 0 }}">
24 24
           <view class="item" wx:for="{{ userInfo.tags }}" wx:key="index">
25
-            <text>相逢是缘</text>
25
+            <text>{{ item }}</text>
26 26
           </view>
27 27
         </block>
28 28
         <block wx:else>
@@ -34,18 +34,21 @@
34 34
   <view class="border-radius padding buy-info">
35 35
     <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">会员信息</text>
36 36
     <view class="buy-content flex-column" wx:if="{{ userInfo.card_list && userInfo.card_list.length > 0 }}">
37
-      <text class="ellipsis {{ index == 0 ? 'active' : '' }}" wx:for="{{ userInfo.card_list }}" wx:key="index">2020/01/01-2020/02/01:40分钟月卡会员</text>
37
+      <text class="ellipsis {{ index == 0 ? 'active' : '' }}" wx:for="{{ userInfo.card_list }}" wx:key="index">{{ item.active_time }}-{{ item.expire_time }}{{ item.card_name }}</text>
38 38
       <view class="buy-active flex-center">生效中</view>
39 39
     </view>
40 40
     <view class="no-more-data" style="padding-bottom: 28rpx;" wx:else>暂无数据~</view>
41 41
     <!-- <view class="btn-more flex-center" style="color: #666;">查看更多记录</view> -->
42 42
   </view>
43
-  <!-- <view class="border-radius padding">
43
+  <view class="border-radius padding">
44 44
     <calendar 
45 45
       id="calendar"
46
+      config="{{calendarConfig}}"
47
+      bind:onSwipe="onSwipe"
48
+      bind:takeoverTap="takeoverTap"
46 49
       bind:afterCalendarRender="afterCalendarRender"
47 50
     />
48
-  </view> -->
51
+  </view>
49 52
   <view class="border-radius padding list">
50 53
     <view class="item-top flex-align-center">
51 54
       <text class="flex1">反馈记录</text>

+ 3 - 2
pages/clientInfoEdit/clientInfoEdit.wxml

@@ -51,12 +51,13 @@
51 51
       <image class="icon-right" src="/images/icon_02.png"></image>
52 52
     </view>
53 53
   </picker>
54
-  <view class="item flex-align-center" bindtap="onPopupState" data-key="visible" data-value="{{true}}">
54
+  <view class="item flex-align-center" data-key="visible" data-value="{{true}}">
55
+    <!-- bindtap="onPopupState" -->
55 56
     <view class="flex-column flex1">
56 57
       <text class="title">手机号码</text>
57 58
       <text class="flex1">{{ userInfo.mobile }}</text>
58 59
     </view>
59
-    <image class="icon-right" src="/images/icon_02.png"></image>
60
+    <!-- <image class="icon-right" src="/images/icon_02.png"></image> -->
60 61
   </view>
61 62
   <picker mode="region" bindchange="bindRegionChange">
62 63
     <view class="item flex-align-center">

+ 95 - 0
pages/customerList/customerList.js

@@ -0,0 +1,95 @@
1
+import { get } from "../../utils/http"
2
+
3
+// pages/customerList/customerList.js
4
+Page({
5
+
6
+  /**
7
+   * 页面的初始数据
8
+   */
9
+  data: {
10
+    homeData: {},
11
+    list: []
12
+  },
13
+
14
+  /**
15
+   * 生命周期函数--监听页面加载
16
+   */
17
+  onLoad: function (options) {
18
+    this.getHomeData()
19
+    this.getUserList()
20
+  },
21
+
22
+  /**
23
+   * 生命周期函数--监听页面初次渲染完成
24
+   */
25
+  onReady: function () {
26
+
27
+  },
28
+
29
+  /**
30
+   * 生命周期函数--监听页面显示
31
+   */
32
+  onShow: function () {
33
+
34
+  },
35
+
36
+  /**
37
+   * 生命周期函数--监听页面隐藏
38
+   */
39
+  onHide: function () {
40
+
41
+  },
42
+
43
+  /**
44
+   * 生命周期函数--监听页面卸载
45
+   */
46
+  onUnload: function () {
47
+
48
+  },
49
+
50
+  /**
51
+   * 页面相关事件处理函数--监听用户下拉动作
52
+   */
53
+  onPullDownRefresh: function () {
54
+
55
+  },
56
+
57
+  /**
58
+   * 页面上拉触底事件的处理函数
59
+   */
60
+  onReachBottom: function () {
61
+
62
+  },
63
+
64
+  /**
65
+   * 用户点击右上角分享
66
+   */
67
+  onShareAppMessage: function () {
68
+
69
+  },
70
+
71
+  /**
72
+   * 获取统计数据
73
+  */
74
+  getHomeData() {
75
+    get('api/home',{},(res) => {
76
+      this.setData({
77
+        homeData: res.data
78
+      })
79
+    })
80
+  },
81
+  
82
+  /**
83
+   * 获取门店客户列表
84
+   * api/user/list
85
+  */
86
+  getUserList() {
87
+    get('api/user/list',{},(res) => {
88
+      this.setData({
89
+        list: res.data.list
90
+      })
91
+      console.log(res)
92
+    })
93
+  }
94
+  // api/user/list
95
+})

+ 4 - 0
pages/customerList/customerList.json

@@ -0,0 +1,4 @@
1
+{
2
+  "navigationBarTitleText": "门店客户记录",
3
+  "usingComponents": {}
4
+}

+ 28 - 0
pages/customerList/customerList.wxml

@@ -0,0 +1,28 @@
1
+<view class="content">
2
+  <view class="top-text flex-column">
3
+    <text class="text-1" >今日预约订单数:{{ homeData.order_num }}</text>
4
+    <text style="font-size: 28rpx;color: #999999;margin-top: 12rpx;">今日服务订单数:{{ homeData.served_num }}</text>
5
+    <view class="flex-align-center" style="margin-top: 12rpx;">
6
+      <image src="/images/icon_05.png"></image>
7
+      <text class="flex1 ellipsis" style="font-size: 24rpx;">{{ homeData.store_address }} {{ homeData.store_name }}</text>
8
+    </view>
9
+  </view>
10
+</view>
11
+<view class="list">
12
+  <view class="item" wx:for="{{ list }}" wx:key="index">
13
+    <view class="title">{{ item.word }}</view>
14
+    <view class="item-content flex-align-center" wx:for="{{ item.list }}" wx:key="index">
15
+      <image src="{{ item.avatar_url }}"></image>
16
+      <text>{{ item.nickname }}</text>
17
+    </view>
18
+  </view>
19
+</view>
20
+
21
+
22
+<!-- font-size: 24px;
23
+font-family: PingFangSC-Regular, PingFang SC;
24
+font-weight: 400;
25
+color: #FF77B0; -->
26
+<view class="fixed flex-column flex-justify-center">
27
+  <text style="font-size: 24rpx;color: #FF77B0;" wx:for="{{ list }}" wx:key="index">{{ item.word }}</text>
28
+</view>

+ 54 - 0
pages/customerList/customerList.wxss

@@ -0,0 +1,54 @@
1
+.content {
2
+  padding: 0 28rpx;
3
+}
4
+
5
+.border-radius {
6
+  background: #FFFFFF;
7
+  border-radius: 24rpx;
8
+  margin: 20rpx 0;
9
+}
10
+
11
+.top-text {
12
+  padding: 18rpx 0 18rpx;
13
+  padding-left: 8rpx;
14
+}
15
+
16
+.top-text .text-1 {
17
+  font-size: 36rpx;
18
+  font-family: PingFangSC-Semibold, PingFang SC;
19
+  font-weight: 600;
20
+  color: #FF77B0;
21
+}
22
+
23
+.top-text image {
24
+  width: 28rpx;
25
+  height: 28rpx;
26
+  background-color: #ccc;
27
+  margin-right: 8rpx;
28
+}
29
+
30
+.title {
31
+  margin: 20rpx 0;
32
+  padding: 0 28rpx;
33
+}
34
+
35
+.item-content {
36
+  height: 112rpx;
37
+  padding: 0 28rpx;
38
+  background-color: #fff;
39
+  border-bottom: 2rpx solid #eee;
40
+}
41
+
42
+.item-content image {
43
+  width: 72rpx;
44
+  height: 72rpx;
45
+  margin-right: 20rpx;
46
+  border-radius: 50%;
47
+}
48
+
49
+.fixed {
50
+  position: fixed;
51
+  right: 20rpx;
52
+  top: 0rpx;
53
+  height: 100%;
54
+}

+ 1 - 1
pages/dossier/dossier.js

@@ -148,7 +148,7 @@ Page({
148 148
       realname,
149 149
       birthday,
150 150
       sex,
151
-      city: ''
151
+      city
152 152
     },() => {
153 153
 
154 154
     })

+ 22 - 6
pages/dossier/dossier.wxml

@@ -10,9 +10,25 @@
10 10
         <text class="flex1" wx:if="{{ userInfo.realname }}">{{ userInfo.realname  }}</text>
11 11
         <text class="flex1" wx:else style="font-size: 28rpx;color: #ccc;">请填写姓名</text>
12 12
       </view>
13
-      <image class="icon-right" src="/images/my/right.png"></image>
13
+      <image class="icon-right" src="/images/right.png"></image>
14 14
     </view>
15 15
   </navigator>
16
+  <view class="item flex-align-center">
17
+    <view class="flex-column flex1">
18
+      <text class="title">所属店铺</text>
19
+      <text class="flex1" wx:if="{{ userInfo.realname }}">{{ userInfo.store_name  }}</text>
20
+      <text class="flex1" wx:else style="font-size: 28rpx;color: #ccc;">'-'</text>
21
+    </view>
22
+    <!-- <image class="icon-right" src="/images/right.png"></image> -->
23
+  </view>
24
+  <view class="item flex-align-center">
25
+    <view class="flex-column flex1">
26
+      <text class="title">直属上级</text>
27
+      <text class="flex1" wx:if="{{ userInfo.realname }}">{{ userInfo.realname  }}</text>
28
+      <text class="flex1" wx:else style="font-size: 28rpx;color: #ccc;">'-'</text>
29
+    </view>
30
+    <!-- <image class="icon-right" src="/images/right.png"></image> -->
31
+  </view>
16 32
   <picker bindchange="bindGenderChange" value="{{userInfo.sex == 0 ? 0 : userInfo.sex -1}}" range="{{genders}}">
17 33
     <view class="item flex-align-center">
18 34
       <view class="flex-column flex1">
@@ -20,7 +36,7 @@
20 36
       <text class="flex1">{{ userInfo.sex == 0 ? '保密' : genders[userInfo.sex -1 ] }}</text>
21 37
       <!-- <text class="flex1">{{genders[genderIndex]}}</text> -->
22 38
     </view>
23
-    <image class="icon-right" src="/images/my/right.png"></image>
39
+    <image class="icon-right" src="/images/right.png"></image>
24 40
     </view>
25 41
   </picker>
26 42
   <picker mode="date" value="{{userInfo.birthday}}" start="1980-09-01" bindchange="bindDateChange">
@@ -30,7 +46,7 @@
30 46
         <text class="flex1" wx:if="{{ userInfo.birthday }}">{{userInfo.birthday}}</text>
31 47
         <text class="flex1" wx:else style="font-size: 28rpx;color: #ccc;">请选择生日</text>
32 48
       </view>
33
-      <image class="icon-right" src="/images/my/right.png"></image>
49
+      <image class="icon-right" src="/images/right.png"></image>
34 50
     </view>
35 51
   </picker>
36 52
   <view class="item flex-align-center" bindtap="onPopupState" data-key="visible" data-value="{{true}}">
@@ -38,9 +54,9 @@
38 54
       <text class="title">手机号码</text>
39 55
       <text class="flex1">{{ userInfo.mobile }}</text>
40 56
     </view>
41
-    <image class="icon-right" src="/images/my/right.png"></image>
57
+    <image class="icon-right" src="/images/right.png"></image>
42 58
   </view>
43
-  <picker mode="region" bindchange="bindRegionChange">
59
+  <picker mode="region" bindchange="bindRegionChange" style="display: none;">
44 60
     <view class="item flex-align-center">
45 61
       <view class="flex-column flex1">
46 62
         <text class="title">所在地</text>
@@ -48,7 +64,7 @@
48 64
         <text class="flex1" wx:else style="font-size: 28rpx;color: #ccc;">请选择常驻城市</text>
49 65
         <!-- <text class="flex1">{{region[0]}},{{region[1]}},{{region[2]}}</text> -->
50 66
       </view>
51
-      <image class="icon-right" src="/images/my/right.png"></image>
67
+      <image class="icon-right" src="/images/right.png"></image>
52 68
     </view>
53 69
   </picker>
54 70
 </view>

+ 34 - 15
pages/feedback/feedback.js

@@ -219,24 +219,43 @@ Page({
219 219
           mask: true
220 220
         });
221 221
         const tempFiles = res.tempFiles
222
+        that.upload(tempFiles[0].thumbTempFilePath).then((data) => {
223
+          if(imgs.length > 0 && imgs[0].type == 'video') {
224
+            that.setData({
225
+              ['imgs[' + 0 + '].thumb']: data.data.url
226
+            })
227
+          } else {
228
+            imgs.unshift({
229
+              type: 'video',
230
+              thumb: data.data.url,
231
+              url: ''
232
+            })
233
+            that.setData({ imgs })
234
+          }
235
+          // that.setData({ imgs })
236
+          wx.hideLoading()
237
+        });
222 238
         that.upload(tempFiles[0].tempFilePath).then((data) => {
223
-          imgs.unshift({
224
-            type: 'video',
225
-            thumb: tempFiles[0].thumbTempFilePath,
226
-            url: data.data.url
227
-          })
228
-          that.setData({ imgs })
239
+          if(imgs.length > 0 && imgs[0].type == 'video') {
240
+            that.setData({
241
+              ['imgs[' + 0 + '].url']: data.data.url
242
+            })
243
+          } else {
244
+            imgs.unshift({
245
+              type: 'video',
246
+              thumb: '',
247
+              url: data.data.url
248
+            })
249
+            that.setData({ imgs })
250
+          }
251
+          // imgs.unshift({
252
+          //   type: 'video',
253
+          //   thumb: tempFiles[0].thumbTempFilePath,
254
+          //   url: data.data.url
255
+          // })
256
+          // that.setData({ imgs })
229 257
           wx.hideLoading()
230 258
         });
231
-        return;
232
-        tempFiles.forEach((item) => {
233
-          imgs.unshift({
234
-            type: 'video',
235
-            thumb: item.thumbTempFilePath,
236
-            url: item.tempFilePath
237
-          })
238
-        })
239
-        that.setData({ imgs })
240 259
       }
241 260
     })
242 261
   },

+ 1 - 1
pages/feedback/feedback.wxss

@@ -21,7 +21,7 @@
21 21
 .detail .top image {
22 22
   width: 112rpx;
23 23
   height: 112rpx;
24
-  background: #ECECEC;
24
+  /* background: #ECECEC; */
25 25
   border-radius: 12rpx;
26 26
   margin-right: 20rpx;
27 27
 }

+ 102 - 0
pages/historyOrder/historyOrder.js

@@ -0,0 +1,102 @@
1
+import { get } from "../../utils/http"
2
+
3
+// pages/historyOrder/historyOrder.js
4
+Page({
5
+
6
+  /**
7
+   * 页面的初始数据
8
+   */
9
+  data: {
10
+    list: [],
11
+    total: 0,
12
+    page: 1,
13
+    user_id: '',
14
+    detail: {}
15
+  },
16
+
17
+  /**
18
+   * 生命周期函数--监听页面加载
19
+   */
20
+  onLoad: function (options) {
21
+    console.log(options)
22
+    if(options.user_id) {
23
+      this.setData({
24
+        user_id: options.user_id,
25
+        detail: JSON.parse(options.detail)
26
+      },() => {
27
+        this.getHistoryOrder()
28
+      })
29
+    }
30
+    
31
+  },
32
+
33
+  /**
34
+   * 生命周期函数--监听页面初次渲染完成
35
+   */
36
+  onReady: function () {
37
+
38
+  },
39
+
40
+  /**
41
+   * 生命周期函数--监听页面显示
42
+   */
43
+  onShow: function () {
44
+
45
+  },
46
+
47
+  /**
48
+   * 生命周期函数--监听页面隐藏
49
+   */
50
+  onHide: function () {
51
+
52
+  },
53
+
54
+  /**
55
+   * 生命周期函数--监听页面卸载
56
+   */
57
+  onUnload: function () {
58
+
59
+  },
60
+
61
+  /**
62
+   * 页面相关事件处理函数--监听用户下拉动作
63
+   */
64
+  onPullDownRefresh: function () {
65
+
66
+  },
67
+
68
+  /**
69
+   * 页面上拉触底事件的处理函数
70
+   */
71
+  onReachBottom: function () {
72
+    if(this.data.page * 10 < this.data.total) {
73
+      this.getHistoryOrder(++this.data.page)
74
+    }
75
+  },
76
+
77
+  /**
78
+   * 用户点击右上角分享
79
+   */
80
+  onShareAppMessage: function () {
81
+
82
+  },
83
+
84
+  /**
85
+   * 获取历史订单
86
+   * api/order/history
87
+  */
88
+  getHistoryOrder() {
89
+    let { page,list,user_id,detail } = this.data;
90
+    let month = detail.month
91
+    let date = detail.date
92
+    get('api/order/history',{
93
+      user_id,
94
+      day: `${detail.year}-${month < 10 ? '0'+month : month}-${date < 10 ? '0'+date : date}`,
95
+      page,
96
+      limit: 10
97
+    },(res) => {
98
+      list.push(...res.data.list)
99
+      this.setData({ list,total: res.data.total, })
100
+    })
101
+  }
102
+})

+ 4 - 0
pages/historyOrder/historyOrder.json

@@ -0,0 +1,4 @@
1
+{
2
+  "navigationBarTitleText": "历史订单",
3
+  "usingComponents": {}
4
+}

+ 33 - 0
pages/historyOrder/historyOrder.wxml

@@ -0,0 +1,33 @@
1
+<view class="tabs-content" style="padding: 28rpx;">
2
+  <navigator url="/pages/orderDetail/orderDetail?orderId={{item.order_id}}" hover-class="none" wx:for="{{ list }}" wx:key="index">
3
+    <view class="item border-radius">
4
+      <view class="item-top flex-align-center">
5
+        <text class="flex1 ellipsis">{{ item.project_name }}</text>
6
+        <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;color: #FF77B0;">{{ status[item.status] }}</text>
7
+      </view>
8
+      <view class="item-text flex">
9
+        <image src="{{ item.cover_url }}" style="width:152rpx;height:152rpx;margin-right: 12rpx;"></image>
10
+        <view class="flex-column">
11
+          <text>预约店铺:{{ item.store_name || '' }}</text>
12
+          <text>预约时间:{{ item.order_time }}</text>
13
+          <text>设备:{{ item.device_name }}</text>
14
+        </view>
15
+      </view>
16
+      <view class="flex-align-center price">
17
+        <text>预约费用:</text>
18
+        <text style="color: #FF77B0;">¥{{ item.price }}</text>
19
+      </view>
20
+      <view class="item-btn flex-align-center ">
21
+        <text class="flex1"></text>
22
+        <view class="btn flex-center" style="margin-right: 28rpx;">查看详情</view>
23
+        <!-- <navigator url="/pages/clientInfo/clientInfo?userId={{ item.user_id }}" hover-class="none">
24
+          <view class="btn flex-center">客户信息</view>
25
+        </navigator> -->
26
+        <navigator url="/pages/feedback/feedback?orderId={{ item.order_id }}&cover={{ item.cover_url }}&name={{ item.project_name }}" hover-class="none">
27
+          <view class="btn flex-center">记录反馈</view>
28
+        </navigator>
29
+        <!-- <view class="btn flex-center">记录反馈</view> -->
30
+      </view>
31
+    </view>
32
+  </navigator>
33
+</view>

+ 55 - 0
pages/historyOrder/historyOrder.wxss

@@ -0,0 +1,55 @@
1
+.border-radius {
2
+  background: #FFFFFF;
3
+  border-radius: 24rpx;
4
+  margin: 20rpx 0;
5
+}
6
+
7
+.tabs-content .item {
8
+  padding: 0 28rpx;
9
+}
10
+
11
+.tabs-content .item-top {
12
+  height: 102rpx;
13
+}
14
+
15
+.tabs-content .item-top text {
16
+  font-family: PingFangSC-Medium, PingFang SC;
17
+  font-weight: 500;
18
+}
19
+
20
+.tabs-content .item-text {
21
+  padding: 30rpx 26rpx;
22
+  background: #FFF7FA;
23
+  border-radius: 16rpx;
24
+}
25
+
26
+.tabs-content .item-text text {
27
+  font-size: 28rpx;
28
+  font-family: PingFangSC-Regular, PingFang SC;
29
+  font-weight: 400;
30
+  color: #666666;
31
+  line-height: 48rpx;
32
+}
33
+
34
+.tabs-content .price {
35
+  height: 84rpx;
36
+  justify-content: flex-end;
37
+  border-bottom: 2rpx solid #F9F9F9;
38
+}
39
+
40
+.tabs-content .price text {
41
+  font-family: PingFangSC-Medium, PingFang SC;
42
+  font-weight: 500;
43
+}
44
+
45
+.tabs-content .item-btn {
46
+  height: 132rpx;
47
+}
48
+
49
+.tabs-content .item-btn .btn {
50
+  width: 192rpx;
51
+  height: 72rpx;
52
+  border-radius: 36rpx;
53
+  border: 2rpx solid #333333;
54
+  box-sizing: border-box;
55
+}

+ 2 - 2
pages/home/home.wxml

@@ -38,7 +38,7 @@
38 38
           <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;color: #FF77B0;">{{ status[item.status] }}</text>
39 39
         </view>
40 40
         <view class="item-text flex-column">
41
-          <text>预约客户:{{ item.user_name }}</text>
41
+          <text>预约客户:{{ item.user_name || '' }}</text>
42 42
           <text>会员信息:{{ item.vip_name }}</text>
43 43
           <text>预约时间:{{ item.order_time }}</text>
44 44
           <text>设备:{{ item.device_name }}</text>
@@ -52,7 +52,7 @@
52 52
           <navigator url="/pages/clientInfo/clientInfo?userId={{ item.user_id }}" hover-class="none">
53 53
             <view class="btn flex-center">客户信息</view>
54 54
           </navigator>
55
-          <navigator url="/pages/feedback/feedback?orderId={{ item.order_id }}&cover={{ detailData.cover_url }}&name={{ item.project_name }}" hover-class="none">
55
+          <navigator url="/pages/feedback/feedback?orderId={{ item.order_id }}&cover={{ item.cover_url }}&name={{ item.project_name }}" hover-class="none">
56 56
             <view class="btn flex-center">记录反馈</view>
57 57
           </navigator>
58 58
           <!-- <view class="btn flex-center">记录反馈</view> -->

+ 7 - 0
pages/login/login.js

@@ -107,6 +107,13 @@ Page({
107 107
           wx_data: JSON.stringify(that.data.userInfo)
108 108
         }, (res) => {
109 109
           console.log(res)
110
+          if(res.data.status == 0) {
111
+            wx.showToast({
112
+              title: '未绑定角色,请联系管理员处理!',
113
+              icon: 'none'
114
+            })
115
+            return;
116
+          } 
110 117
           wx.setStorageSync('token', res.data.token);
111 118
           wx.setStorageSync('userInfo', res.data)
112 119
           wx.showToast({

+ 1 - 1
pages/member/member.wxml

@@ -70,7 +70,7 @@
70 70
       </view>
71 71
     </navigator>
72 72
 
73
-    <navigator url="/pages/beautyPlanList/beautyPlanList">
73
+    <navigator url="/pages/customerList/customerList">
74 74
       <view class="item line">
75 75
         <image class="icon-left" src="/images/icon_tools_02.png"></image>
76 76
         <text class="flex1">门店客户记录</text>

+ 1 - 0
pages/orderDetail/orderDetail.wxml

@@ -97,6 +97,7 @@
97 97
         <!-- <image src="{{item.url}}" data-index="{{item}}" bindtap="previewImage" wx:for="{{item.media_list}}" wx:key="index"></image> -->
98 98
       </view>
99 99
     </view>
100
+    <view class="no-more-data" style="display: {{list.length == 0 ? 'block' : 'none'}};">暂无数据~</view>
100 101
   </view>
101 102
   <view class="no-more-data" style="display: {{list.length > 0 && list.length >= total ? 'block' : 'none'}};">已经到底啦~~</view>
102 103
 </view>

+ 206 - 0
pages/phone/phone.js

@@ -0,0 +1,206 @@
1
+import { $wuxCountDown } from '../../components/dist/index'
2
+import {
3
+  get, post,
4
+} from '../../utils/http';
5
+Page({
6
+
7
+  /**
8
+   * 页面的初始数据
9
+   */
10
+  data: {
11
+    status: 0,
12
+    phone: '',
13
+    phoneVal: '',
14
+    codeVal: '',
15
+    sms_token: ''
16
+  },
17
+
18
+  /**
19
+   * 生命周期函数--监听页面加载
20
+   */
21
+  onLoad: function (options) {
22
+    console.log(options)
23
+    this.setData({
24
+      phone: options.phone
25
+    })
26
+  },
27
+
28
+  /**
29
+   * 生命周期函数--监听页面初次渲染完成
30
+   */
31
+  onReady: function () {
32
+
33
+  },
34
+
35
+  /**
36
+   * 生命周期函数--监听页面显示
37
+   */
38
+  onShow: function () {
39
+
40
+  },
41
+
42
+  /**
43
+   * 生命周期函数--监听页面隐藏
44
+   */
45
+  onHide: function () {
46
+
47
+  },
48
+
49
+  /**
50
+   * 生命周期函数--监听页面卸载
51
+   */
52
+  onUnload: function () {
53
+    if(this.c1) this.c1.stop()
54
+  },
55
+
56
+  /**
57
+   * 页面相关事件处理函数--监听用户下拉动作
58
+   */
59
+  onPullDownRefresh: function () {
60
+
61
+  },
62
+
63
+  /**
64
+   * 页面上拉触底事件的处理函数
65
+   */
66
+  onReachBottom: function () {
67
+
68
+  },
69
+
70
+  /**
71
+   * 用户点击右上角分享
72
+   */
73
+  onShareAppMessage: function () {
74
+
75
+  },
76
+
77
+  /**
78
+   * 监听输入手机号
79
+  */
80
+  onChangePhone(e) {
81
+    this.setData({
82
+      phoneVal: e.detail.value
83
+    })
84
+  },
85
+
86
+  /**
87
+    * 监听输入验证码
88
+  */
89
+  onChangeCode(e) {
90
+    this.setData({
91
+      codeVal: e.detail.value
92
+    })
93
+  },
94
+
95
+  /**
96
+   * 获取验证码
97
+   * api/sms/send_verify_code
98
+  */ 
99
+  getCode() {
100
+    let { phoneVal,status,sms_token } = this.data;
101
+    if(phoneVal == '') {
102
+      wx.showToast({
103
+        title: '请输入手机号',
104
+        icon: 'none'
105
+      })
106
+      return;
107
+    }
108
+    if (this.c1 && this.c1.interval) return !1
109
+    post('api/sms/send_verify_code',{
110
+      type: status == 0 ? 1 : 2,
111
+      mobile: phoneVal,
112
+      sms_token
113
+    },(res) => {
114
+      wx.showToast({
115
+        title: res.msg,
116
+      })
117
+      this.c1 = new $wuxCountDown({
118
+        date: +(new Date) + 60000,
119
+        onEnd() {
120
+          this.setData({
121
+            c1: '重新获取验证码',
122
+          })
123
+        },
124
+        render(date) {
125
+          const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
126
+          date.sec !== 0 && this.setData({
127
+            c1: sec,
128
+          })
129
+        },
130
+      })
131
+    })
132
+  },
133
+
134
+  /**
135
+   * 校验
136
+  */ 
137
+  onCheck() {
138
+    if(this.data.status == 0) {
139
+      this.verifyMobile();
140
+    } else {
141
+      this.changeMobile()
142
+    }
143
+    // this.setData({
144
+    //   status: ++this.data.status,
145
+    //   phoneVal: '',
146
+    //   codeVal: ''
147
+    // })
148
+  },
149
+
150
+  /**
151
+   * 校验旧手机号的验证码
152
+   * api/mruser/verify_mobile
153
+  */
154
+  verifyMobile() {
155
+    return new Promise((resolve,reject) => {
156
+      post('api/mruser/verify_mobile',{
157
+        verify_code: this.data.codeVal
158
+      },(res) => {
159
+        if(this.c1){
160
+          this.c1.stop()
161
+          this.setData({
162
+            c1: null
163
+          })
164
+        }
165
+        wx.showToast({
166
+          title: res.msg,
167
+        })
168
+        this.setData({
169
+          status: ++this.data.status,
170
+          phoneVal: '',
171
+          codeVal: '',
172
+          sms_token: res.data.sms_token
173
+        })
174
+        resolve()
175
+      })
176
+    })
177
+  },
178
+
179
+  /**
180
+   * 更换新手机
181
+   * api/mruser/change_mobile
182
+  */
183
+  changeMobile() {
184
+    let { phoneVal,codeVal,sms_token } = this.data;
185
+    post('api/mruser/change_mobile',{
186
+      verify_code:codeVal,
187
+      mobile:phoneVal,
188
+      sms_token
189
+    },(res) => {
190
+      if(this.c1){
191
+        this.c1.stop()
192
+        this.setData({
193
+          c1: null
194
+        })
195
+      }
196
+      wx.showToast({
197
+        title: res.msg,
198
+      })
199
+      this.setData({
200
+        status: ++this.data.status,
201
+        phoneVal: '',
202
+        codeVal: '',
203
+      })
204
+    })
205
+  }
206
+})

+ 4 - 0
pages/phone/phone.json

@@ -0,0 +1,4 @@
1
+{
2
+  "navigationBarTitleText": "更改手机绑定",
3
+  "usingComponents": {}
4
+}

+ 14 - 0
pages/phone/phone.wxml

@@ -0,0 +1,14 @@
1
+<view class="content flex-column flex-align-center">
2
+  <image src="/images/phone_0{{status+1}}.png"></image>
3
+  <text style="margin-bottom: 56rpx;" wx:if="{{ status == 0 }}">已绑定手机{{phone}}</text>
4
+  <text style="margin-bottom: 56rpx;" wx:if="{{ status == 1 }}">请输入新的手机号码</text>
5
+  <text style="margin-bottom: 56rpx;" wx:if="{{ status == 2 }}">绑定成功</text>
6
+  <block wx:if="{{ status < 2 }}">
7
+    <input class="number border-radius" value="{{phoneVal}}" type="number" maxlength="11" placeholder="{{ status == 0 ? '请输入手机号' : '请输入新的手机号' }}" bindinput="onChangePhone" />
8
+    <view class="code border-radius flex-align-center">
9
+      <input value="{{codeVal}}" type="number" maxlength="6" class="flex1" placeholder="请输入验证码" bindinput="onChangeCode" />
10
+      <text bindtap="getCode">{{ c1 || '发送验证码' }}</text>
11
+    </view>
12
+    <view class="btn border-radius flex-center" bindtap="onCheck">{{status == 0 ? '验证' : '确认'}}</view>
13
+  </block>
14
+</view>

+ 52 - 0
pages/phone/phone.wxss

@@ -0,0 +1,52 @@
1
+page {
2
+  background: #fff;
3
+}
4
+
5
+.content {
6
+  padding: 0 92rpx;
7
+}
8
+
9
+image {
10
+  width: 272rpx;
11
+  height: 272rpx;
12
+  margin: 94rpx 0 46rpx;
13
+}
14
+
15
+.border-radius {
16
+  width: 100%;
17
+  height: 92rpx;
18
+  border-radius: 50rpx;
19
+  box-sizing: border-box;
20
+}
21
+
22
+.number,.code {
23
+  padding-left: 40rpx;
24
+  box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(0, 0, 0, 0.15);
25
+}
26
+
27
+.code {
28
+  margin-top: 30rpx;
29
+  padding: 16rpx 0;
30
+}
31
+
32
+.code input {
33
+  height: 100%;
34
+  padding-left: 40rpx;
35
+  border-right: 1px solid rgba(229, 229, 229, 0.756);
36
+}
37
+
38
+.code text {
39
+  padding: 0 26rpx;
40
+  font-size: 28rpx;
41
+  color: #333333;
42
+  font-family: PingFangSC-Regular, PingFang SC;
43
+}
44
+
45
+.btn {
46
+  background: #FF77B0;
47
+  margin-top: 62rpx;
48
+  font-size: 36rpx;
49
+  font-family: PingFangSC-Medium, PingFang SC;
50
+  color: #FFFFFF;
51
+  box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(109, 0, 46, 0.15);
52
+}

+ 46 - 4
pages/recordList/recordList.js

@@ -1,3 +1,5 @@
1
+import { get } from "../../utils/http"
2
+
1 3
 // pages/recordList/recordList.js
2 4
 Page({
3 5
 
@@ -5,14 +7,18 @@ Page({
5 7
    * 页面的初始数据
6 8
    */
7 9
   data: {
8
-
10
+    todayData: {},
11
+    list: [],
12
+    total: 0,
13
+    page: 1,
9 14
   },
10 15
 
11 16
   /**
12 17
    * 生命周期函数--监听页面加载
13 18
    */
14 19
   onLoad: function (options) {
15
-
20
+    // this.getCheckToday()
21
+    // this.getCheckList()
16 22
   },
17 23
 
18 24
   /**
@@ -26,7 +32,8 @@ Page({
26 32
    * 生命周期函数--监听页面显示
27 33
    */
28 34
   onShow: function () {
29
-
35
+    this.getCheckToday()
36
+    this.getCheckList(1)
30 37
   },
31 38
 
32 39
   /**
@@ -54,7 +61,9 @@ Page({
54 61
    * 页面上拉触底事件的处理函数
55 62
    */
56 63
   onReachBottom: function () {
57
-
64
+    if(this.data.page * 10 < this.data.total) {
65
+      this.getCheckList(++this.data.page)
66
+    }
58 67
   },
59 68
 
60 69
   /**
@@ -62,5 +71,38 @@ Page({
62 71
    */
63 72
   onShareAppMessage: function () {
64 73
 
74
+  },
75
+
76
+  /**
77
+   * 获取今日检查信息
78
+   * api/check/today
79
+  */
80
+  getCheckToday() {
81
+    get('api/check/today',{},(res) => {
82
+      this.setData({
83
+        todayData: res.data
84
+      })
85
+      console.log(res)
86
+    })
87
+  },
88
+
89
+  /**
90
+   * 获取检查记录列表
91
+   * api/check/list
92
+  */
93
+  getCheckList(_page) {
94
+    let { page,list,total } = this.data;
95
+    get('api/check/list',{
96
+      page: _page || page,
97
+      limit: 10
98
+    },(res) => {
99
+      if (_page == 1 || page == 1) {
100
+        list = []
101
+        this.data.page = 1
102
+      }
103
+      list.push(...res.data.list)
104
+      this.setData({ list,total: res.data.total, })
105
+      console.log(res)
106
+    })
65 107
   }
66 108
 })

+ 12 - 12
pages/recordList/recordList.wxml

@@ -1,18 +1,18 @@
1 1
 <view class="content">
2 2
   <view class="detail-top flex-column">
3
-    <text style="font-size: 36rpx;">门店名称:JOLIJOLI南山店</text>
4
-    <text style="font-size: 28rpx;margin: 16rpx 0;">店长:南山店长</text>
3
+    <text style="font-size: 36rpx;">门店名称:{{ todayData.store_name }}</text>
4
+    <text style="font-size: 28rpx;margin: 16rpx 0;">店长:{{ todayData.manager_name }}</text>
5 5
     <view class="top-info">
6 6
       <view class="flex">
7 7
         <text>离店检查:</text>
8
-        <text style="color: #FF77B0;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">未检查</text>
8
+        <text style="color: #FF77B0;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">{{ todayData.is_check == 1 ? '已检查' : '未检查' }}</text>
9 9
         <text class="flex1"></text>
10
-        <text>营业复查:已复查</text>
10
+        <text>营业复查:{{ todayData.is_review == 1 ? '已复查' : '未复查' }}</text>
11 11
       </view>
12 12
       <view class="top-text flex-column">
13
-        <text>今日负责人:武则天</text>
14
-        <text style="margin:20rpx 0;">检查负责人:小婵</text>
15
-        <text>复查检查人:查理兹·塞隆</text>
13
+        <text>今日负责人:{{ todayData.charge_name }}</text>
14
+        <text style="margin:20rpx 0;">检查负责人:{{ todayData.check_name }}</text>
15
+        <text>复查检查人:{{ todayData.review_name }}</text>
16 16
       </view>
17 17
     </view>
18 18
   </view>
@@ -23,13 +23,13 @@
23 23
       <view class="flex1 flex-justify-center">复查</view>
24 24
       <view class="flex1 flex-justify-center">负责人</view>
25 25
     </view>
26
-    <navigator url="/pages/recordSheet/recordSheet" hover-class="none" wx:for="{{ 4 }}" wx:key="index">
26
+    <navigator url="/pages/recordSheet/recordSheet?check_id={{ item.id }}" hover-class="none" wx:for="{{ list }}" wx:key="index">
27 27
       <view class="item flex-align-center">
28
-        <view class="flex1 flex-justify-center">2021/10/11</view>
29
-        <view class="flex1 flex-justify-center {{ index == 0 ? 'active' : '' }}">未检查</view>
30
-        <view class="flex1 flex-justify-center {{ index == 0 ? 'active' : '' }}">已复查</view>
28
+        <view class="flex1 flex-justify-center">{{ item.day }}</view>
29
+        <view class="flex1 flex-justify-center {{ item.is_check == 0 ? 'active' : '' }}">{{item.is_check == 1 ? '已检查' : '未检查' }}</view>
30
+        <view class="flex1 flex-justify-center {{ item.is_review == 0 ? 'active' : '' }}">{{item.is_review == 1 ? '已复查' : '未复查' }}</view>
31 31
         <view class="flex1 flex-center">
32
-          <text style="margin-right:12rpx;font-size: 28rpx;">小婵</text>
32
+          <text style="margin-right:12rpx;font-size: 28rpx;">{{ item.charge_name }}</text>
33 33
           <image src="/images/right.png"></image>
34 34
         </view>
35 35
       </view>

+ 258 - 27
pages/recordSheet/components/inspect/inspect.js

@@ -1,3 +1,5 @@
1
+import { post } from "../../../../utils/http";
2
+
1 3
 // pages/recordSheet/components/inspect/inspect.js
2 4
 Component({
3 5
   /**
@@ -7,44 +9,48 @@ Component({
7 9
     addGlobalClass: true
8 10
   },
9 11
   properties: {
10
-
12
+    preCheck: {
13
+      type: Object,
14
+      value: null,
15
+      observer(newVal,oldVal) {
16
+        if(newVal) {
17
+          console.log(newVal)
18
+          console.log(newVal.option_list)
19
+          newVal.option_list.forEach((item,index)=> {
20
+            item.children.forEach((newItem) => {
21
+              console.log(newItem)
22
+              newItem.status = true
23
+            })
24
+          })
25
+          this.setData({
26
+            check: newVal
27
+          })
28
+          console.log(this.data.check)
29
+        }
30
+        console.log(newVal,oldVal)
31
+        // this.setData({
32
+        //   check
33
+        // })
34
+      }
35
+    },
36
+    check_id: {
37
+      type: String,
38
+      value: null,
39
+    }
11 40
   },
12 41
 
13 42
   /**
14 43
    * 组件的初始数据
15 44
    */
16 45
   data: {
46
+    is_list: true,
17 47
     list: ['','','',''],
18 48
     more: true,
19 49
     maxlength: 500,
20 50
     number: 0,
21 51
     value: "",
22
-    imgs: [
23
-      {
24
-        type: "image",
25
-        url: "https://img1.baidu.com/it/u=202543353,3627416815&fm=26&fmt=auto"
26
-      },
27
-      {
28
-        type: "image",
29
-        url: "https://img0.baidu.com/it/u=745609344,230882238&fm=26&fmt=auto"
30
-      },
31
-      {
32
-        type: "image",
33
-        url: "https://img0.baidu.com/it/u=286636366,3227707112&fm=26&fmt=auto"
34
-      },
35
-      {
36
-        type: "image",
37
-        url: "https://img1.baidu.com/it/u=2450865760,444795162&fm=26&fmt=auto"
38
-      },
39
-      {
40
-        type: "image",
41
-        url: "https://img0.baidu.com/it/u=4226275504,4103997964&fm=26&fmt=auto"
42
-      },
43
-      {
44
-        type: "image",
45
-        url: "https://img0.baidu.com/it/u=2247422843,411257408&fm=26&fmt=auto"
46
-      },
47
-    ],
52
+    imgs: [],
53
+    check: {}
48 54
   },
49 55
 
50 56
   /**
@@ -55,6 +61,231 @@ Component({
55 61
       this.setData({
56 62
         more: false
57 63
       })
64
+    },
65
+
66
+    /**
67
+     * 切换结果
68
+    */
69
+    onChangeStatus(e) {
70
+      let { idx,index,status } = e.currentTarget.dataset;
71
+      this.setData({
72
+        ['check.option_list[' + idx + '].children['+index+'].status']: status == 'true' ? true : false
73
+      })
74
+    },
75
+
76
+    /** 监听文本域 */
77
+    bindTextAreaInput(e) {
78
+      this.setData({
79
+        number: e.detail.cursor,
80
+        value: e.detail.value
81
+      })
82
+    },
83
+
84
+    /** 选择图片 */
85
+    chooseImage() {
86
+      let that = this;
87
+      let imgs = this.data.imgs;
88
+      let count = 9 - this.data.imgs.length
89
+      wx.chooseImage({
90
+        count,
91
+        sizeType: ['original', 'compressed'],
92
+        sourceType: ['album', 'camera'],
93
+        success (res) {
94
+          wx.showLoading({
95
+            title: '正在上传图片',
96
+            mask: true
97
+          });
98
+          const tempFiles = res.tempFiles
99
+          tempFiles.forEach((item) => {
100
+            that.upload(item.path).then((data) => {
101
+              imgs.push({
102
+                type: 'image',
103
+                url: data.data.url,
104
+              })
105
+              that.setData({ imgs })
106
+              wx.hideLoading()
107
+            });
108
+          })
109
+          
110
+        }
111
+      })
112
+    },
113
+
114
+    /** 选择视频 */
115
+    chooseVideo(){
116
+      let that = this;
117
+      let imgs = this.data.imgs;
118
+      wx.chooseMedia({
119
+        count: 1,
120
+        mediaType: ['video'],
121
+        sourceType: ['album', 'camera'],
122
+        maxDuration: 30,
123
+        camera: 'back',
124
+        success(res) {
125
+          wx.showLoading({
126
+            title: '正在上传视频',
127
+            mask: true
128
+          });
129
+          const tempFiles = res.tempFiles
130
+          that.upload(tempFiles[0].thumbTempFilePath).then((data) => {
131
+            if(imgs.length > 0 && imgs[0].type == 'video') {
132
+              that.setData({
133
+                ['imgs[' + 0 + '].thumb']: data.data.url
134
+              })
135
+            } else {
136
+              imgs.unshift({
137
+                type: 'video',
138
+                thumb: data.data.url,
139
+                url: ''
140
+              })
141
+              that.setData({ imgs })
142
+            }
143
+            // that.setData({ imgs })
144
+            wx.hideLoading()
145
+          });
146
+          that.upload(tempFiles[0].tempFilePath).then((data) => {
147
+            if(imgs.length > 0 && imgs[0].type == 'video') {
148
+              that.setData({
149
+                ['imgs[' + 0 + '].url']: data.data.url
150
+              })
151
+            } else {
152
+              imgs.unshift({
153
+                type: 'video',
154
+                thumb: '',
155
+                url: data.data.url
156
+              })
157
+              that.setData({ imgs })
158
+            }
159
+            // imgs.unshift({
160
+            //   type: 'video',
161
+            //   thumb: tempFiles[0].thumbTempFilePath,
162
+            //   url: data.data.url
163
+            // })
164
+            // that.setData({ imgs })
165
+            wx.hideLoading()
166
+          });
167
+        }
168
+      })
169
+    },
170
+
171
+    /** 上传视频/图片 */
172
+    upload(filePath) {
173
+      let that = this;
174
+      // 上传类型/业务类型:avatar头像,order订单反馈,check检查表反馈
175
+      return new Promise((resolve,reject) => {
176
+        let { imgs } = this.data;
177
+        wx.uploadFile({
178
+          url: 'https://store.test-api.ijolijoli.com/api/upload',
179
+          header: {
180
+            token: wx.getStorageSync('token') || '',
181
+          },
182
+          filePath,
183
+          name: 'file',
184
+          formData: {
185
+            'type': 'check'
186
+          },
187
+          success(res) {
188
+            console.log(res)
189
+            if(res.statusCode == 200 && res.data) {
190
+              let data = JSON.parse(res.data);
191
+              if(data.code == 200 && data.data) {
192
+                resolve(data)
193
+              } else {
194
+                wx.showToast({
195
+                  title: '上传失败',
196
+                  icon: 'none'
197
+                })
198
+              }
199
+            } else {
200
+              wx.showToast({
201
+                title: '上传失败',
202
+                icon: 'none'
203
+              })
204
+            }
205
+          },
206
+          fail(err) {
207
+            wx.showToast({
208
+              title: '上传失败',
209
+              icon: 'none'
210
+            })
211
+          }
212
+        })
213
+      })
214
+    },
215
+
216
+    /**
217
+     * 删除列表项
218
+    */
219
+    onDeleteItem(e) {
220
+      let imgs = this.data.imgs;
221
+      if(this.data.is_list) {
222
+        imgs = this.data.check.feedback.media_list
223
+      }
224
+      imgs.splice(e.currentTarget.dataset.index, 1);
225
+      this.setData({ imgs })
226
+      console.log(imgs)
227
+    },
228
+
229
+    /**
230
+     * /api/check/update
231
+     * 添加/修改检查信息
232
+    */
233
+    onCheckUpdate() {
234
+      let { orderId,value,imgs,check,check_id } = this.data;
235
+      let option_ids = [], option_values= [];
236
+      check.option_list.forEach((item,index) => {
237
+        item.children.forEach((newItem,index) => {
238
+          option_ids.push(newItem.id)
239
+          if(newItem.status) {
240
+            option_values.push(1)
241
+          } else {
242
+            option_values.push(2)
243
+          }
244
+        })
245
+      })
246
+      post('api/check/update',{
247
+        check_id,
248
+        type: check.type,
249
+        option_ids: option_ids.toString(),
250
+        option_values: option_values.toString(),
251
+        content: value,
252
+        media_list: JSON.stringify(imgs)
253
+      },(res) => {
254
+        wx.showToast({
255
+          title: res.msg,
256
+          icon: 'none'
257
+        })
258
+        setTimeout(() => {
259
+          let pages=getCurrentPages()
260
+          let prePage = pages[pages.length-1]
261
+          prePage.onShow()
262
+          this.setData({
263
+            is_list: true
264
+          })
265
+        }, 1500);
266
+        console.log(res)
267
+      })
268
+    },
269
+
270
+    /** 预览图片和视频 */
271
+    previewMedia(e) {
272
+      let arr = this.data.imgs
273
+      if(this.data.is_list) {
274
+        arr = this.data.check.feedback.media_list
275
+      }
276
+      let current = e.currentTarget.dataset.index
277
+      wx.previewMedia({
278
+        sources: arr,
279
+        current
280
+      })
281
+    },
282
+
283
+    /** 切换编辑 */
284
+    onChangeEdit() {
285
+      this.setData({
286
+        is_list: false
287
+      })
58 288
     }
289
+
59 290
   }
60 291
 })

+ 105 - 47
pages/recordSheet/components/inspect/inspect.wxml

@@ -7,71 +7,129 @@
7 7
     </view>
8 8
     <view class="list">
9 9
     <!-- <style="{{ more ? index < 3 ? 'block' : 'none' : block }}"></style> -->
10
-      <view class="item flex" wx:for="{{ list }}" wx:key="index" wx:if="{{  more?index<3 ? true : false  : true }}">
11
-        <view class="left flex-center">前台</view>
10
+      <view class="item flex" wx:for="{{ check.option_list }}" wx:for-index="idx"  wx:key="index" wx:if="{{  more?idx<3 ? true : false  : true }}">
11
+        <view class="left flex-center">{{ item.location }}</view>
12 12
         <view class="right flex1 flex-column flex-justify-center">
13
-          <view class="flex flex1" style="height: 100%;border-bottom: 2rpx solid #f2f2f2;" wx:for="{{ 3 }}" wx:key="index">
14
-            <view class="text flex1 flex-center" style="padding: 18rpx;">地面无杂物、垃圾桶清</view>
13
+          <view class="flex flex1" style="height: 100%;border-bottom: 2rpx solid #f2f2f2;" wx:for="{{ item.children }}" wx:key="index">
14
+            <view class="text flex1 flex-center" style="padding: 18rpx;">{{ item.name }}</view>
15 15
             <view class="item-btn flex-center" style="width: 238rpx;border-left: 2rpx solid #d3d3d3;">
16
-              <text>是</text>
17
-              <image src="" style="margin-right: 20rpx;"></image>
18
-              <text>否</text>
19
-              <image src=""></image>
16
+              <block wx:if="{{ is_list }}">
17
+                <block wx:if="{{ item.value == 1 }}">
18
+                  <text>是</text>
19
+                  <image src="/images/select_ok.png" style="margin-right: 20rpx;"></image>
20
+                </block>
21
+                <block wx:if="{{ item.value == 2 }}">
22
+                  <text>否</text>
23
+                  <image src="/images/select_ok.png"></image>
24
+                </block>
25
+                <block wx:if="{{ item.value == 0 }}">
26
+                  <text>未记录</text>
27
+                </block>
28
+              </block>
29
+              <block wx:if="{{ !is_list }}">
30
+                <text>是</text>
31
+                <image src="/images/select_{{ item.status ? 'ok' : 'no' }}.png" style="margin-right: 20rpx;" bindtap="onChangeStatus" data-idx="{{idx}}" data-index="{{index}}" data-status="true"></image>
32
+                <text>否</text>
33
+                <image src="/images/select_{{ !item.status ? 'ok' : 'no' }}.png" bindtap="onChangeStatus" data-idx="{{idx}}" data-index="{{index}}" data-status="false"></image>
34
+              </block>
20 35
             </view>
21 36
           </view>
22 37
         </view>
23 38
       </view>
24
-      <view class="module flex-center" wx:if="{{ list.length > 3 && more }}" bindtap="onOpenList">
39
+      <view class="module flex-center" wx:if="{{ check.option_list.length > 3 && more }}" bindtap="onOpenList">
25 40
         <view class="icon">>></view>
26 41
       </view>
27 42
     </view>
28 43
   </view>
29
-  <view class="padding" style="padding: 0 36rpx;" style="display: none;">
44
+  <view class="padding" style="padding: 0 36rpx;">
30 45
     <view class="detail border-radius">
31
-    <view class="top flex-align-center">
32
-      <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">早班复查问题反馈</text>
33
-    </view>
34
-    <view class="box-textarea">
35
-      <textarea bindinput="bindTextAreaInput" value="{{value}}" maxlength="{{maxlength}}" placeholder="请输入记录反馈" />
36
-      <view class="box-text">{{number}}/{{maxlength}}</view>
37
-    </view>
38
-    <view class="change-img">
39
-      <view class="text">
40
-        <text>添加视频/图片</text>
41
-        <text style="font-size:28rpx;color:#999;">({{imgs.length}}/9)</text>
46
+      <view class="top flex-align-center">
47
+        <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">早班复查问题反馈</text>
42 48
       </view>
43
-      <view class="img-box">
44
-        <view class="position-relative" style="position: relative;" wx:for="{{ imgs }}" wx:key="index">
45
-          <view class="item">
46
-            <block wx:if="{{ item.type == 'video' }}">
47
-              <!-- <video src="{{ item.url }}"></video> -->
48
-              <!-- <text>视频播放</text> -->
49
-              <view class="flex-center" style="font-size: 28rpx;width: 100%;height: 100%;background-color: #ccc;" data-index="{{index}}" bindtap="previewMedia">
50
-                <!-- 这个是视频 -->
51
-                <image class="icon-01" src="/images/icon_01.png"></image>
52
-                <!-- <text style="position: absolute;">这个是视频</text> -->
53
-                <image class="img-content" data-index="{{index}}" src="{{ item.thumb }}" alt=""></image>
49
+      <block wx:if="{{ is_list }}">
50
+        <view class="check-list" wx:if="{{ check.feedback }}">
51
+          <view class="item flex-column">
52
+            <view class="user-info flex-align-center">
53
+              <image src="{{ check.feedback.avatar_url }}"></image>
54
+              <view class="info flex-column flex1">
55
+                <text style="font-size: 28rpx;margin-bottom: 6rpx;">{{ check.feedback.nickname }}</text>
56
+                <text style="font-size: 20rpx;color: #999;">{{ check.feedback.update_time }}</text>
57
+              </view>
58
+              <!-- <view class="more flex-align-center flex-justify-space-between" data-item="{{ item }}" bindtap="onEditItem" wx:if="{{ item.allow_edit == 1 }}">
59
+                <text></text>
60
+                <text></text>
61
+                <text></text>
62
+              </view> -->
63
+              <!-- <view class="more">···</view> -->
64
+            </view>
65
+            <text style="font-size: 28rpx;color: #666;margin-bottom: 30rpx;">{{ check.feedback.content }}</text>
66
+            <view class="box" wx:if="{{ check.feedback.media_list && check.feedback.media_list.length > 0 }}">
67
+              <view class="item-media" wx:for="{{ check.feedback.media_list }}" wx:key="index">
68
+                <block wx:if="{{ item.type == 'video' }}">
69
+                  <!-- <video src="{{ item.url }}"></video> -->
70
+                  <!-- <text>视频播放</text> -->
71
+                  <view class="flex-center" style="font-size: 28rpx;width: 100%;height: 100%;background-color: #ccc;" data-idx="{{ idx }}" data-index="{{index}}" bindtap="previewMedia">
72
+                    <!-- 这个是视频 -->
73
+                    <image class="icon-01" src="/images/icon_01.png"></image>
74
+                    <!-- <text style="position: absolute;">这个是视频</text> -->
75
+                    <image class="img-content" data-index="{{index}}" src="{{ item.thumb }}" alt=""></image>
76
+                  </view>
77
+                </block>
78
+                <block wx:if="{{ item.type == 'image' }}">
79
+                  <image class="img-content" data-idx="{{ idx }}" data-index="{{index}}" src="{{ item.url }}" alt="" bindtap="previewMedia"></image>
80
+                </block>
54 81
               </view>
55
-            </block>
56
-            <block wx:if="{{ item.type == 'image' }}">
57
-              <image class="img-content" data-index="{{index}}" src="{{ item.url }}" alt="" bindtap="previewMedia"></image>
58
-            </block>
82
+              
83
+              <!-- <image src="{{item.url}}" data-index="{{item}}" bindtap="previewImage" wx:for="{{item.media_list}}" wx:key="index"></image> -->
84
+            </view>
59 85
           </view>
60
-          <image src="" class="delete-img" data-index="{{index}}" bindtap="onDeleteItem"></image>
61 86
         </view>
62
-        
63
-        <view class="item upload flex-column flex-center" wx:if="{{ imgs.length>0 && imgs.length < 9 &&imgs[0].type != 'video' }}" bindtap="chooseVideo">
64
-          <image src=""></image>
65
-          <text style="font-size: 28rpx;">添加视频</text>
87
+        <view class="no-more-data" wx:if="{{ !check.feedback }}">暂无反馈记录~</view>
88
+      </block>
89
+      <block wx:if="{{ !is_list }}">
90
+        <view class="box-textarea">
91
+        <textarea bindinput="bindTextAreaInput" value="{{value}}" maxlength="{{maxlength}}" placeholder="请输入记录反馈" />
92
+        <view class="box-text">{{number}}/{{maxlength}}</view>
66 93
         </view>
67
-        <view class="item upload flex-column flex-center" wx:if="{{ imgs.length > 0 && imgs.length < 9}}" bindtap="chooseImage">
68
-          <image src=""></image>
69
-          <text style="font-size: 28rpx;">添加图片</text>
94
+        <view class="change-img">
95
+          <view class="text">
96
+            <text>添加视频/图片</text>
97
+            <text style="font-size:28rpx;color:#999;">({{imgs.length}}/9)</text>
98
+          </view>
99
+          <view class="img-box">
100
+            <view class="position-relative" style="position: relative;" wx:for="{{ imgs }}" wx:key="index">
101
+              <view class="item">
102
+                <block wx:if="{{ item.type == 'video' }}">
103
+                  <!-- <video src="{{ item.url }}"></video> -->
104
+                  <!-- <text>视频播放</text> -->
105
+                  <view class="flex-center" style="font-size: 28rpx;width: 100%;height: 100%;background-color: #ccc;" data-index="{{index}}" bindtap="previewMedia">
106
+                    <!-- 这个是视频 -->
107
+                    <image class="icon-01" src="/images/icon_01.png"></image>
108
+                    <!-- <text style="position: absolute;">这个是视频</text> -->
109
+                    <image class="img-content" data-index="{{index}}" src="{{ item.thumb }}" alt=""></image>
110
+                  </view>
111
+                </block>
112
+                <block wx:if="{{ item.type == 'image' }}">
113
+                  <image class="img-content" data-index="{{index}}" src="{{ item.url }}" alt="" bindtap="previewMedia"></image>
114
+                </block>
115
+              </view>
116
+              <image src="/images/icon_03.png" class="delete-img" data-index="{{index}}" bindtap="onDeleteItem"></image>
117
+            </view>
118
+            
119
+            <view class="item upload flex-column flex-center" wx:if="{{ imgs.length < 9 &&imgs[0].type != 'video' }}" bindtap="chooseVideo">
120
+              <image src=""></image>
121
+              <text style="font-size: 28rpx;">添加视频</text>
122
+            </view>
123
+            <view class="item upload flex-column flex-center" wx:if="{{ imgs.length < 9}}" bindtap="chooseImage">
124
+              <image src=""></image>
125
+              <text style="font-size: 28rpx;">添加图片</text>
126
+            </view>
127
+          </view>
70 128
         </view>
71
-      </view>
72
-    </view>
129
+      </block>
73 130
     </view>
74
-    <view class="btn flex-center">提交</view>
131
+    <view class="btn flex-center" wx:if="{{ is_list && check.allow_edit == 1 }}" bindtap="onChangeEdit">编辑晚班记录</view>
132
+    <view class="btn flex-center" wx:if="{{ !is_list }}" bindtap="onCheckUpdate">提交</view>
75 133
   </view>
76 134
 
77 135
 </view>

+ 77 - 1
pages/recordSheet/components/inspect/inspect.wxss

@@ -50,7 +50,7 @@
50 50
 .content .item-btn image {
51 51
   width: 48rpx;
52 52
   height: 48rpx;
53
-  background-color: #ccc;
53
+  /* background-color: #ccc; */
54 54
   border-radius: 50%;
55 55
 }
56 56
 
@@ -161,4 +161,80 @@
161 161
   border-radius: 48rpx;
162 162
   font-size: 36rpx;
163 163
   color: #fff;
164
+}
165
+
166
+
167
+
168
+
169
+
170
+.check-list .item {
171
+  padding-top: 30rpx;
172
+}
173
+
174
+.check-list .item-top {
175
+  padding: 0 28rpx;
176
+}
177
+
178
+.check-list .item-top .btn {
179
+  width: 154rpx;
180
+  height: 52rpx;
181
+  border-radius: 26rpx;
182
+  border: 2rpx solid #333333;
183
+  box-sizing: border-box;
184
+  font-size: 28rpx;
185
+}
186
+
187
+.check-list .user-info {
188
+  margin-bottom: 20rpx;
189
+}
190
+
191
+.check-list .user-info image {
192
+  width: 64rpx;
193
+  height: 64rpx;
194
+  border-radius: 50%;
195
+  /* background-color: red; */
196
+  margin-right: 14rpx;
197
+}
198
+
199
+.check-list .more {
200
+  width: 48rpx;
201
+  height: 48rpx;
202
+  padding: 0 4rpx;
203
+  box-sizing: border-box;
204
+}
205
+
206
+.check-list .more text {
207
+  width: 8rpx;
208
+  height: 8rpx;
209
+  background: #333;
210
+  border-radius: 50%;
211
+}
212
+
213
+.check-list .box {
214
+  display: grid;
215
+  grid-gap: 20rpx 22rpx;
216
+  grid-template-columns: repeat(3, 1fr);
217
+  padding: 0rpx 0 30rpx;
218
+}
219
+
220
+.check-list .box .item-media {
221
+  width: 198rpx;
222
+  height: 198rpx;
223
+  border-radius: 16px;
224
+  box-sizing: border-box;
225
+  overflow: hidden;
226
+  position: relative;
227
+}
228
+
229
+.check-list .box image {
230
+  width: 100%;
231
+  height: 100%;
232
+  border-radius: 16rpx;
233
+  /* background-color: red; */
234
+}
235
+
236
+.check-list .box .icon-01 {
237
+  width: 64rpx;
238
+  height: 64rpx;
239
+  position: absolute;
164 240
 }

+ 252 - 3
pages/recordSheet/components/review/review.js

@@ -1,23 +1,272 @@
1
-// pages/recordSheet/components/review/review.js
1
+import { post } from "../../../../utils/http";
2
+
3
+// pages/recordSheet/components/inspect/inspect.js
2 4
 Component({
3 5
   /**
4 6
    * 组件的属性列表
5 7
    */
8
+  options: {
9
+    addGlobalClass: true
10
+  },
6 11
   properties: {
7
-
12
+    manager: {
13
+      type: Object,
14
+      value: null,
15
+      observer(newVal,oldVal) {
16
+        if(newVal) {
17
+          console.log(newVal)
18
+          console.log(newVal.option_list)
19
+          newVal.option_list.forEach((item,index)=> {
20
+            item.children.forEach((newItem) => {
21
+              console.log(newItem)
22
+              newItem.status = true
23
+            })
24
+          })
25
+          this.setData({
26
+            check: newVal
27
+          })
28
+          console.log(this.data.check)
29
+        }
30
+        console.log(newVal,oldVal)
31
+        // this.setData({
32
+        //   check
33
+        // })
34
+      }
35
+    },
36
+    check_id: {
37
+      type: String,
38
+      value: null,
39
+    }
8 40
   },
9 41
 
10 42
   /**
11 43
    * 组件的初始数据
12 44
    */
13 45
   data: {
14
-
46
+    is_list: true,
47
+    list: ['','','',''],
48
+    more: true,
49
+    maxlength: 500,
50
+    number: 0,
51
+    value: "",
52
+    imgs: [],
53
+    check: {}
15 54
   },
16 55
 
17 56
   /**
18 57
    * 组件的方法列表
19 58
    */
20 59
   methods: {
60
+    onOpenList() {
61
+      this.setData({
62
+        more: false
63
+      })
64
+    },
65
+
66
+    /**
67
+     * 切换结果
68
+    */
69
+    onChangeStatus(e) {
70
+      let { idx,index,status } = e.currentTarget.dataset;
71
+      this.setData({
72
+        ['check.option_list[' + idx + '].children['+index+'].status']: status == 'true' ? true : false
73
+      })
74
+    },
75
+
76
+    /** 监听文本域 */
77
+    bindTextAreaInput(e) {
78
+      this.setData({
79
+        number: e.detail.cursor,
80
+        value: e.detail.value
81
+      })
82
+    },
83
+
84
+    /** 选择图片 */
85
+    chooseImage() {
86
+      let that = this;
87
+      let imgs = this.data.imgs;
88
+      let count = 9 - this.data.imgs.length
89
+      wx.chooseImage({
90
+        count,
91
+        sizeType: ['original', 'compressed'],
92
+        sourceType: ['album', 'camera'],
93
+        success (res) {
94
+          wx.showLoading({
95
+            title: '正在上传图片',
96
+            mask: true
97
+          });
98
+          const tempFiles = res.tempFiles
99
+          tempFiles.forEach((item) => {
100
+            that.upload(item.path).then((data) => {
101
+              imgs.push({
102
+                type: 'image',
103
+                url: data.data.url,
104
+              })
105
+              that.setData({ imgs })
106
+              wx.hideLoading()
107
+            });
108
+          })
109
+          
110
+        }
111
+      })
112
+    },
113
+
114
+    /** 选择视频 */
115
+    chooseVideo(){
116
+      let that = this;
117
+      let imgs = this.data.imgs;
118
+      wx.chooseMedia({
119
+        count: 1,
120
+        mediaType: ['video'],
121
+        sourceType: ['album', 'camera'],
122
+        maxDuration: 30,
123
+        camera: 'back',
124
+        success(res) {
125
+          wx.showLoading({
126
+            title: '正在上传视频',
127
+            mask: true
128
+          });
129
+          const tempFiles = res.tempFiles
130
+          that.upload(tempFiles[0].tempFilePath).then((data) => {
131
+            imgs.unshift({
132
+              type: 'video',
133
+              thumb: tempFiles[0].thumbTempFilePath,
134
+              url: data.data.url
135
+            })
136
+            that.setData({ imgs })
137
+            wx.hideLoading()
138
+          });
139
+          return;
140
+          tempFiles.forEach((item) => {
141
+            imgs.unshift({
142
+              type: 'video',
143
+              thumb: item.thumbTempFilePath,
144
+              url: item.tempFilePath
145
+            })
146
+          })
147
+          that.setData({ imgs })
148
+        }
149
+      })
150
+    },
151
+
152
+    /** 上传视频/图片 */
153
+    upload(filePath) {
154
+      let that = this;
155
+      // 上传类型/业务类型:avatar头像,order订单反馈,check检查表反馈
156
+      return new Promise((resolve,reject) => {
157
+        let { imgs } = this.data;
158
+        wx.uploadFile({
159
+          url: 'https://store.test-api.ijolijoli.com/api/upload',
160
+          header: {
161
+            token: wx.getStorageSync('token') || '',
162
+          },
163
+          filePath,
164
+          name: 'file',
165
+          formData: {
166
+            'type': 'check'
167
+          },
168
+          success(res) {
169
+            console.log(res)
170
+            if(res.statusCode == 200 && res.data) {
171
+              let data = JSON.parse(res.data);
172
+              if(data.code == 200 && data.data) {
173
+                resolve(data)
174
+              } else {
175
+                wx.showToast({
176
+                  title: '上传失败',
177
+                  icon: 'none'
178
+                })
179
+              }
180
+            } else {
181
+              wx.showToast({
182
+                title: '上传失败',
183
+                icon: 'none'
184
+              })
185
+            }
186
+          },
187
+          fail(err) {
188
+            wx.showToast({
189
+              title: '上传失败',
190
+              icon: 'none'
191
+            })
192
+          }
193
+        })
194
+      })
195
+    },
196
+
197
+    /**
198
+     * 删除列表项
199
+    */
200
+    onDeleteItem(e) {
201
+      let imgs = this.data.imgs;
202
+      if(this.data.is_list) {
203
+        imgs = this.data.check.feedback.media_list
204
+      }
205
+      imgs.splice(e.currentTarget.dataset.index, 1);
206
+      this.setData({ imgs })
207
+      console.log(imgs)
208
+    },
209
+
210
+    /**
211
+     * /api/check/update
212
+     * 添加/修改检查信息
213
+    */
214
+    onCheckUpdate() {
215
+      let { orderId,value,imgs,check,check_id } = this.data;
216
+      let option_ids = [], option_values= [];
217
+      check.option_list.forEach((item,index) => {
218
+        item.children.forEach((newItem,index) => {
219
+          option_ids.push(newItem.id)
220
+          if(newItem.status) {
221
+            option_values.push(1)
222
+          } else {
223
+            option_values.push(2)
224
+          }
225
+        })
226
+      })
227
+      post('api/check/update',{
228
+        check_id,
229
+        type: check.type,
230
+        option_ids: option_ids.toString(),
231
+        option_values: option_values.toString(),
232
+        content: value,
233
+        media_list: JSON.stringify(imgs)
234
+      },(res) => {
235
+        wx.showToast({
236
+          title: res.msg,
237
+          icon: 'none'
238
+        })
239
+        setTimeout(() => {
240
+          let pages=getCurrentPages()
241
+          let prePage = pages[pages.length-1]
242
+          prePage.onShow()
243
+          this.setData({
244
+            is_list: true
245
+          })
246
+        }, 1500);
247
+        console.log(res)
248
+      })
249
+    },
250
+
251
+    /** 预览图片和视频 */
252
+    previewMedia(e) {
253
+      let arr = this.data.imgs
254
+      if(this.data.is_list) {
255
+        arr = this.data.check.feedback.media_list
256
+      }
257
+      let current = e.currentTarget.dataset.index
258
+      wx.previewMedia({
259
+        sources: arr,
260
+        current
261
+      })
262
+    },
263
+
264
+    /** 切换编辑 */
265
+    onChangeEdit() {
266
+      this.setData({
267
+        is_list: false
268
+      })
269
+    }
21 270
 
22 271
   }
23 272
 })

+ 135 - 2
pages/recordSheet/components/review/review.wxml

@@ -1,2 +1,135 @@
1
-<!--pages/recordSheet/components/review/review.wxml-->
2
-<text>pages/recordSheet/components/review/review.wxml</text>
1
+<view class="inspect">
2
+  <view class="content">
3
+    <view class="title flex">
4
+      <view class="item flex-center" style="width: 172rpx;border-right: 4rpx solid #fff;">站点</view>
5
+      <view class="item flex1 flex-center">检查项目</view>
6
+      <view class="item flex-center" style="width: 236rpx;border-left: 4rpx solid #fff;">结果</view>
7
+    </view>
8
+    <view class="list">
9
+    <!-- <style="{{ more ? index < 3 ? 'block' : 'none' : block }}"></style> -->
10
+      <view class="item flex" wx:for="{{ check.option_list }}" wx:for-index="idx"  wx:key="index" wx:if="{{  more?idx<3 ? true : false  : true }}">
11
+        <view class="left flex-center">{{ item.location }}</view>
12
+        <view class="right flex1 flex-column flex-justify-center">
13
+          <view class="flex flex1" style="height: 100%;border-bottom: 2rpx solid #f2f2f2;" wx:for="{{ item.children }}" wx:key="index">
14
+            <view class="text flex1 flex-center" style="padding: 18rpx;">{{ item.name }}</view>
15
+            <view class="item-btn flex-center" style="width: 238rpx;border-left: 2rpx solid #d3d3d3;">
16
+              <block wx:if="{{ is_list }}">
17
+                <block wx:if="{{ item.value == 1 }}">
18
+                  <text>是</text>
19
+                  <image src="/images/select_ok.png" style="margin-right: 20rpx;"></image>
20
+                </block>
21
+                <block wx:if="{{ item.value == 2 }}">
22
+                  <text>否</text>
23
+                  <image src="/images/select_ok.png"></image>
24
+                </block>
25
+                <block wx:if="{{ item.value == 0 }}">
26
+                  <text>未记录</text>
27
+                </block>
28
+              </block>
29
+              <block wx:if="{{ !is_list }}">
30
+                <text>是</text>
31
+                <image src="/images/select_{{ item.status ? 'ok' : 'no' }}.png" style="margin-right: 20rpx;" bindtap="onChangeStatus" data-idx="{{idx}}" data-index="{{index}}" data-status="true"></image>
32
+                <text>否</text>
33
+                <image src="/images/select_{{ !item.status ? 'ok' : 'no' }}.png" bindtap="onChangeStatus" data-idx="{{idx}}" data-index="{{index}}" data-status="false"></image>
34
+              </block>
35
+            </view>
36
+          </view>
37
+        </view>
38
+      </view>
39
+      <view class="module flex-center" wx:if="{{ check.option_list.length > 3 && more }}" bindtap="onOpenList">
40
+        <view class="icon">>></view>
41
+      </view>
42
+    </view>
43
+  </view>
44
+  <view class="padding" style="padding: 0 36rpx;">
45
+    <view class="detail border-radius">
46
+      <view class="top flex-align-center">
47
+        <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">早班复查问题反馈</text>
48
+      </view>
49
+      <block wx:if="{{ is_list }}">
50
+        <view class="check-list" wx:if="{{ check.feedback }}">
51
+          <view class="item flex-column">
52
+            <view class="user-info flex-align-center">
53
+              <image src="{{ check.feedback.avatar_url }}"></image>
54
+              <view class="info flex-column flex1">
55
+                <text style="font-size: 28rpx;margin-bottom: 6rpx;">{{ check.feedback.nickname }}</text>
56
+                <text style="font-size: 20rpx;color: #999;">{{ check.feedback.update_time }}</text>
57
+              </view>
58
+              <!-- <view class="more flex-align-center flex-justify-space-between" data-item="{{ item }}" bindtap="onEditItem" wx:if="{{ item.allow_edit == 1 }}">
59
+                <text></text>
60
+                <text></text>
61
+                <text></text>
62
+              </view> -->
63
+              <!-- <view class="more">···</view> -->
64
+            </view>
65
+            <text style="font-size: 28rpx;color: #666;margin-bottom: 30rpx;">{{ check.feedback.content }}</text>
66
+            <view class="box" wx:if="{{ check.feedback.media_list && check.feedback.media_list.length > 0 }}">
67
+              <view class="item-media" wx:for="{{ check.feedback.media_list }}" wx:key="index">
68
+                <block wx:if="{{ item.type == 'video' }}">
69
+                  <!-- <video src="{{ item.url }}"></video> -->
70
+                  <!-- <text>视频播放</text> -->
71
+                  <view class="flex-center" style="font-size: 28rpx;width: 100%;height: 100%;background-color: #ccc;" data-idx="{{ idx }}" data-index="{{index}}" bindtap="previewMedia">
72
+                    <!-- 这个是视频 -->
73
+                    <image class="icon-01" src="/images/icon_01.png"></image>
74
+                    <!-- <text style="position: absolute;">这个是视频</text> -->
75
+                    <image class="img-content" data-index="{{index}}" src="{{ item.thumb }}" alt=""></image>
76
+                  </view>
77
+                </block>
78
+                <block wx:if="{{ item.type == 'image' }}">
79
+                  <image class="img-content" data-idx="{{ idx }}" data-index="{{index}}" src="{{ item.url }}" alt="" bindtap="previewMedia"></image>
80
+                </block>
81
+              </view>
82
+              
83
+              <!-- <image src="{{item.url}}" data-index="{{item}}" bindtap="previewImage" wx:for="{{item.media_list}}" wx:key="index"></image> -->
84
+            </view>
85
+          </view>
86
+        </view>
87
+        <view class="no-more-data" wx:if="{{ !check.feedback }}">暂无反馈记录~</view>
88
+      </block>
89
+      <block wx:if="{{ !is_list }}">
90
+        <view class="box-textarea">
91
+        <textarea bindinput="bindTextAreaInput" value="{{value}}" maxlength="{{maxlength}}" placeholder="请输入记录反馈" />
92
+        <view class="box-text">{{number}}/{{maxlength}}</view>
93
+        </view>
94
+        <view class="change-img">
95
+          <view class="text">
96
+            <text>添加视频/图片</text>
97
+            <text style="font-size:28rpx;color:#999;">({{imgs.length}}/9)</text>
98
+          </view>
99
+          <view class="img-box">
100
+            <view class="position-relative" style="position: relative;" wx:for="{{ imgs }}" wx:key="index">
101
+              <view class="item">
102
+                <block wx:if="{{ item.type == 'video' }}">
103
+                  <!-- <video src="{{ item.url }}"></video> -->
104
+                  <!-- <text>视频播放</text> -->
105
+                  <view class="flex-center" style="font-size: 28rpx;width: 100%;height: 100%;background-color: #ccc;" data-index="{{index}}" bindtap="previewMedia">
106
+                    <!-- 这个是视频 -->
107
+                    <image class="icon-01" src="/images/icon_01.png"></image>
108
+                    <!-- <text style="position: absolute;">这个是视频</text> -->
109
+                    <image class="img-content" data-index="{{index}}" src="{{ item.thumb }}" alt=""></image>
110
+                  </view>
111
+                </block>
112
+                <block wx:if="{{ item.type == 'image' }}">
113
+                  <image class="img-content" data-index="{{index}}" src="{{ item.url }}" alt="" bindtap="previewMedia"></image>
114
+                </block>
115
+              </view>
116
+              <image src="/images/icon_03.png" class="delete-img" data-index="{{index}}" bindtap="onDeleteItem"></image>
117
+            </view>
118
+            
119
+            <view class="item upload flex-column flex-center" wx:if="{{ imgs.length < 9 &&imgs[0].type != 'video' }}" bindtap="chooseVideo">
120
+              <image src=""></image>
121
+              <text style="font-size: 28rpx;">添加视频</text>
122
+            </view>
123
+            <view class="item upload flex-column flex-center" wx:if="{{ imgs.length < 9}}" bindtap="chooseImage">
124
+              <image src=""></image>
125
+              <text style="font-size: 28rpx;">添加图片</text>
126
+            </view>
127
+          </view>
128
+        </view>
129
+      </block>
130
+    </view>
131
+    <view class="btn flex-center" wx:if="{{ is_list && check.allow_edit == 1 }}" bindtap="onChangeEdit">编辑晚班记录</view>
132
+    <view class="btn flex-center" wx:if="{{ !is_list }}" bindtap="onCheckUpdate">提交</view>
133
+  </view>
134
+
135
+</view>

+ 240 - 1
pages/recordSheet/components/review/review.wxss

@@ -1 +1,240 @@
1
-/* pages/recordSheet/components/review/review.wxss */
1
+.inspect .content {
2
+  background-color: #fff;
3
+  /* padding: 28rpx 0; */
4
+  padding-top: 28rpx;
5
+}
6
+
7
+.inspect .title .item {
8
+  height: 60rpx;
9
+  background: #FFF7FA;
10
+  font-size: 28rpx;
11
+  font-family: PingFangSC-Regular, PingFang SC;
12
+  font-weight: 400;
13
+  color: #333333;
14
+}
15
+
16
+.inspect .content .list {
17
+  position: relative;
18
+}
19
+
20
+.inspect .content .module {
21
+  position: absolute;
22
+  bottom: 0;
23
+  left: 0;
24
+  width: 100%;
25
+  height: 154rpx;
26
+  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, #FFFFFF 100%);
27
+} 
28
+
29
+.inspect .module .icon {
30
+  transform: rotate(90deg);
31
+}
32
+
33
+.inspect .content .list view,.content .list text {
34
+  font-size: 28rpx;
35
+  font-family: PingFangSC-Regular, PingFang SC;
36
+  font-weight: 400;
37
+  color: #333333;
38
+}
39
+
40
+.content .list .item {
41
+  border-bottom: 2rpx solid #d3d3d3;
42
+}
43
+
44
+.content .left {
45
+  width: 174rpx;
46
+  padding: 30rpx 0;
47
+  border-right: 2rpx solid #d3d3d3;
48
+}
49
+
50
+.content .item-btn image {
51
+  width: 48rpx;
52
+  height: 48rpx;
53
+  /* background-color: #ccc; */
54
+  border-radius: 50%;
55
+}
56
+
57
+.border-radius {
58
+  background: #FFFFFF;
59
+  box-shadow: 0rpx 4rpx 14rpx 0rpx rgba(0, 0, 0, 0.05);
60
+  border-radius: 24rpx;
61
+  margin: 20rpx 0;
62
+}
63
+
64
+.detail {
65
+  padding: 30rpx 28rpx;
66
+}
67
+
68
+.detail .top {
69
+  padding-bottom: 30rpx;
70
+  border-bottom: 2rpx solid #F2F2F2;
71
+}
72
+
73
+.detail .box-textarea {
74
+  position: relative;
75
+  padding-bottom: 30rpx;
76
+  height: 280rpx;
77
+  box-sizing: border-box;
78
+}
79
+
80
+.detail textarea {
81
+  width: 100%;
82
+  height: 100%;
83
+  box-sizing: border-box;
84
+  /* height: 280rpx;
85
+  box-sizing: border-box; */
86
+  padding: 30rpx 0 50rpx;
87
+}
88
+
89
+.detail .box-textarea .box-text {
90
+  position: absolute;
91
+  right: 0;
92
+  bottom: 30rpx;
93
+  font-size: 28rpx;
94
+  color: #999999;
95
+}
96
+
97
+.detail .change-img {
98
+  padding-top: 30rpx;
99
+  border-top: 2rpx solid #F2F2F2;
100
+}
101
+
102
+.change-img .img-box {
103
+  margin-top: 30rpx;
104
+  display: grid;
105
+  grid-gap: 20rpx 20rpx;
106
+  grid-template-columns: repeat(3, 1fr);
107
+}
108
+
109
+.change-img .img-box .item {
110
+  width: 200rpx;
111
+  height: 200rpx;
112
+  border-radius: 16px;
113
+  box-sizing: border-box;
114
+  overflow: hidden;
115
+  position: relative;
116
+}
117
+
118
+.change-img .delete-img {
119
+  position: absolute;
120
+  top: -24rpx;
121
+  right: -16rpx;
122
+  width: 48rpx;
123
+  height: 48rpx;
124
+  border-radius: 50%;
125
+  background-color: black;
126
+}
127
+
128
+.change-img .img-box .item.upload {
129
+  border: dashed 2rpx #c6c6c6;
130
+  background: #F4F4F4;
131
+}
132
+
133
+.change-img .upload image {
134
+  width: 48rpx;
135
+  height: 48rpx;
136
+  background-color: #ccc;
137
+  margin-bottom: 6rpx;
138
+}
139
+
140
+.change-img .img-box video {
141
+  width: 100%;
142
+  height: 100%;
143
+}
144
+
145
+.change-img .img-box .icon-01 {
146
+  width: 64rpx;
147
+  height: 64rpx;
148
+  position: absolute;
149
+}
150
+
151
+.change-img .img-box .img-content {
152
+  width: 100%;
153
+  height: 100%;
154
+}
155
+
156
+.btn {
157
+  margin: 30rpx 0;
158
+  height: 96rpx;
159
+  width: 100%;
160
+  background: #FF77B0;
161
+  border-radius: 48rpx;
162
+  font-size: 36rpx;
163
+  color: #fff;
164
+}
165
+
166
+
167
+
168
+
169
+
170
+.check-list .item {
171
+  padding-top: 30rpx;
172
+}
173
+
174
+.check-list .item-top {
175
+  padding: 0 28rpx;
176
+}
177
+
178
+.check-list .item-top .btn {
179
+  width: 154rpx;
180
+  height: 52rpx;
181
+  border-radius: 26rpx;
182
+  border: 2rpx solid #333333;
183
+  box-sizing: border-box;
184
+  font-size: 28rpx;
185
+}
186
+
187
+.check-list .user-info {
188
+  margin-bottom: 20rpx;
189
+}
190
+
191
+.check-list .user-info image {
192
+  width: 64rpx;
193
+  height: 64rpx;
194
+  border-radius: 50%;
195
+  /* background-color: red; */
196
+  margin-right: 14rpx;
197
+}
198
+
199
+.check-list .more {
200
+  width: 48rpx;
201
+  height: 48rpx;
202
+  padding: 0 4rpx;
203
+  box-sizing: border-box;
204
+}
205
+
206
+.check-list .more text {
207
+  width: 8rpx;
208
+  height: 8rpx;
209
+  background: #333;
210
+  border-radius: 50%;
211
+}
212
+
213
+.check-list .box {
214
+  display: grid;
215
+  grid-gap: 20rpx 22rpx;
216
+  grid-template-columns: repeat(3, 1fr);
217
+  padding: 0rpx 0 30rpx;
218
+}
219
+
220
+.check-list .box .item-media {
221
+  width: 198rpx;
222
+  height: 198rpx;
223
+  border-radius: 16px;
224
+  box-sizing: border-box;
225
+  overflow: hidden;
226
+  position: relative;
227
+}
228
+
229
+.check-list .box image {
230
+  width: 100%;
231
+  height: 100%;
232
+  border-radius: 16rpx;
233
+  /* background-color: red; */
234
+}
235
+
236
+.check-list .box .icon-01 {
237
+  width: 64rpx;
238
+  height: 64rpx;
239
+  position: absolute;
240
+}

+ 270 - 3
pages/recordSheet/components/verify/verify.js

@@ -1,23 +1,290 @@
1
-// pages/recordSheet/components/verify/verify.js
1
+import { post } from "../../../../utils/http";
2
+
2 3
 Component({
3 4
   /**
4 5
    * 组件的属性列表
5 6
    */
7
+  options: {
8
+    addGlobalClass: true
9
+  },
6 10
   properties: {
7
-
11
+    review: {
12
+      type: Object,
13
+      value: null,
14
+      observer(newVal,oldVal) {
15
+        if(newVal) {
16
+          console.log(newVal)
17
+          console.log(newVal.option_list)
18
+          newVal.option_list.forEach((item,index)=> {
19
+            item.children.forEach((newItem) => {
20
+              console.log(newItem)
21
+              newItem.status = true
22
+            })
23
+          })
24
+          this.setData({
25
+            check: newVal
26
+          })
27
+          console.log(this.data.check)
28
+        }
29
+        console.log(newVal,oldVal)
30
+        // this.setData({
31
+        //   check
32
+        // })
33
+      }
34
+    },
35
+    check_id: {
36
+      type: String,
37
+      value: null,
38
+    }
8 39
   },
9 40
 
10 41
   /**
11 42
    * 组件的初始数据
12 43
    */
13 44
   data: {
14
-
45
+    is_list: true,
46
+    list: ['','','',''],
47
+    more: true,
48
+    maxlength: 500,
49
+    number: 0,
50
+    value: "",
51
+    imgs: [],
52
+    check: {}
15 53
   },
16 54
 
17 55
   /**
18 56
    * 组件的方法列表
19 57
    */
20 58
   methods: {
59
+    onOpenList() {
60
+      this.setData({
61
+        more: false
62
+      })
63
+    },
64
+
65
+    /**
66
+     * 切换结果
67
+    */
68
+    onChangeStatus(e) {
69
+      let { idx,index,status } = e.currentTarget.dataset;
70
+      this.setData({
71
+        ['check.option_list[' + idx + '].children['+index+'].status']: status == 'true' ? true : false
72
+      })
73
+    },
74
+
75
+    /** 监听文本域 */
76
+    bindTextAreaInput(e) {
77
+      this.setData({
78
+        number: e.detail.cursor,
79
+        value: e.detail.value
80
+      })
81
+    },
82
+
83
+    /** 选择图片 */
84
+    chooseImage() {
85
+      let that = this;
86
+      let imgs = this.data.imgs;
87
+      let count = 9 - this.data.imgs.length
88
+      wx.chooseImage({
89
+        count,
90
+        sizeType: ['original', 'compressed'],
91
+        sourceType: ['album', 'camera'],
92
+        success (res) {
93
+          wx.showLoading({
94
+            title: '正在上传图片',
95
+            mask: true
96
+          });
97
+          const tempFiles = res.tempFiles
98
+          tempFiles.forEach((item) => {
99
+            that.upload(item.path).then((data) => {
100
+              imgs.push({
101
+                type: 'image',
102
+                url: data.data.url,
103
+              })
104
+              that.setData({ imgs })
105
+              wx.hideLoading()
106
+            });
107
+          })
108
+          
109
+        }
110
+      })
111
+    },
112
+
113
+    /** 选择视频 */
114
+    chooseVideo(){
115
+      let that = this;
116
+      let imgs = this.data.imgs;
117
+      wx.chooseMedia({
118
+        count: 1,
119
+        mediaType: ['video'],
120
+        sourceType: ['album', 'camera'],
121
+        maxDuration: 30,
122
+        camera: 'back',
123
+        success(res) {
124
+          wx.showLoading({
125
+            title: '正在上传视频',
126
+            mask: true
127
+          });
128
+          const tempFiles = res.tempFiles
129
+          that.upload(tempFiles[0].thumbTempFilePath).then((data) => {
130
+            if(imgs.length > 0 && imgs[0].type == 'video') {
131
+              that.setData({
132
+                ['imgs[' + 0 + '].thumb']: data.data.url
133
+              })
134
+            } else {
135
+              imgs.unshift({
136
+                type: 'video',
137
+                thumb: data.data.url,
138
+                url: ''
139
+              })
140
+              that.setData({ imgs })
141
+            }
142
+            // that.setData({ imgs })
143
+            wx.hideLoading()
144
+          });
145
+          that.upload(tempFiles[0].tempFilePath).then((data) => {
146
+            if(imgs.length > 0 && imgs[0].type == 'video') {
147
+              that.setData({
148
+                ['imgs[' + 0 + '].url']: data.data.url
149
+              })
150
+            } else {
151
+              imgs.unshift({
152
+                type: 'video',
153
+                thumb: '',
154
+                url: data.data.url
155
+              })
156
+              that.setData({ imgs })
157
+            }
158
+            // imgs.unshift({
159
+            //   type: 'video',
160
+            //   thumb: tempFiles[0].thumbTempFilePath,
161
+            //   url: data.data.url
162
+            // })
163
+            // that.setData({ imgs })
164
+            wx.hideLoading()
165
+          });
166
+        }
167
+      })
168
+    },
169
+
170
+    /** 上传视频/图片 */
171
+    upload(filePath) {
172
+      let that = this;
173
+      // 上传类型/业务类型:avatar头像,order订单反馈,check检查表反馈
174
+      return new Promise((resolve,reject) => {
175
+        let { imgs } = this.data;
176
+        wx.uploadFile({
177
+          url: 'https://store.test-api.ijolijoli.com/api/upload',
178
+          header: {
179
+            token: wx.getStorageSync('token') || '',
180
+          },
181
+          filePath,
182
+          name: 'file',
183
+          formData: {
184
+            'type': 'check'
185
+          },
186
+          success(res) {
187
+            console.log(res)
188
+            if(res.statusCode == 200 && res.data) {
189
+              let data = JSON.parse(res.data);
190
+              if(data.code == 200 && data.data) {
191
+                resolve(data)
192
+              } else {
193
+                wx.showToast({
194
+                  title: '上传失败',
195
+                  icon: 'none'
196
+                })
197
+              }
198
+            } else {
199
+              wx.showToast({
200
+                title: '上传失败',
201
+                icon: 'none'
202
+              })
203
+            }
204
+          },
205
+          fail(err) {
206
+            wx.showToast({
207
+              title: '上传失败',
208
+              icon: 'none'
209
+            })
210
+          }
211
+        })
212
+      })
213
+    },
214
+
215
+    /**
216
+     * 删除列表项
217
+    */
218
+    onDeleteItem(e) {
219
+      let imgs = this.data.imgs;
220
+      if(this.data.is_list) {
221
+        imgs = this.data.check.feedback.media_list
222
+      }
223
+      imgs.splice(e.currentTarget.dataset.index, 1);
224
+      this.setData({ imgs })
225
+      console.log(imgs)
226
+    },
227
+
228
+    /**
229
+     * /api/check/update
230
+     * 添加/修改检查信息
231
+    */
232
+    onCheckUpdate() {
233
+      let { orderId,value,imgs,check,check_id } = this.data;
234
+      let option_ids = [], option_values= [];
235
+      check.option_list.forEach((item,index) => {
236
+        item.children.forEach((newItem,index) => {
237
+          option_ids.push(newItem.id)
238
+          if(newItem.status) {
239
+            option_values.push(1)
240
+          } else {
241
+            option_values.push(2)
242
+          }
243
+        })
244
+      })
245
+      post('api/check/update',{
246
+        check_id,
247
+        type: check.type,
248
+        option_ids: option_ids.toString(),
249
+        option_values: option_values.toString(),
250
+        content: value,
251
+        media_list: JSON.stringify(imgs)
252
+      },(res) => {
253
+        wx.showToast({
254
+          title: res.msg,
255
+          icon: 'none'
256
+        })
257
+        setTimeout(() => {
258
+          let pages=getCurrentPages()
259
+          let prePage = pages[pages.length-1]
260
+          prePage.onShow()
261
+          this.setData({
262
+            is_list: true
263
+          })
264
+        }, 1500);
265
+        console.log(res)
266
+      })
267
+    },
268
+
269
+    /** 预览图片和视频 */
270
+    previewMedia(e) {
271
+      let arr = this.data.imgs
272
+      if(this.data.is_list) {
273
+        arr = this.data.check.feedback.media_list
274
+      }
275
+      let current = e.currentTarget.dataset.index
276
+      wx.previewMedia({
277
+        sources: arr,
278
+        current
279
+      })
280
+    },
281
+
282
+    /** 切换编辑 */
283
+    onChangeEdit() {
284
+      this.setData({
285
+        is_list: false
286
+      })
287
+    }
21 288
 
22 289
   }
23 290
 })

+ 135 - 2
pages/recordSheet/components/verify/verify.wxml

@@ -1,2 +1,135 @@
1
-<!--pages/recordSheet/components/verify/verify.wxml-->
2
-<text>pages/recordSheet/components/verify/verify.wxml</text>
1
+<view class="inspect">
2
+  <view class="content">
3
+    <view class="title flex">
4
+      <view class="item flex-center" style="width: 172rpx;border-right: 4rpx solid #fff;">站点</view>
5
+      <view class="item flex1 flex-center">检查项目</view>
6
+      <view class="item flex-center" style="width: 236rpx;border-left: 4rpx solid #fff;">结果</view>
7
+    </view>
8
+    <view class="list">
9
+    <!-- <style="{{ more ? index < 3 ? 'block' : 'none' : block }}"></style> -->
10
+      <view class="item flex" wx:for="{{ check.option_list }}" wx:for-index="idx"  wx:key="index" wx:if="{{  more?idx<3 ? true : false  : true }}">
11
+        <view class="left flex-center">{{ item.location }}</view>
12
+        <view class="right flex1 flex-column flex-justify-center">
13
+          <view class="flex flex1" style="height: 100%;border-bottom: 2rpx solid #f2f2f2;" wx:for="{{ item.children }}" wx:key="index">
14
+            <view class="text flex1 flex-center" style="padding: 18rpx;">{{ item.name }}</view>
15
+            <view class="item-btn flex-center" style="width: 238rpx;border-left: 2rpx solid #d3d3d3;">
16
+              <block wx:if="{{ is_list }}">
17
+                <block wx:if="{{ item.value == 1 }}">
18
+                  <text>是</text>
19
+                  <image src="/images/select_ok.png" style="margin-right: 20rpx;"></image>
20
+                </block>
21
+                <block wx:if="{{ item.value == 2 }}">
22
+                  <text>否</text>
23
+                  <image src="/images/select_ok.png"></image>
24
+                </block>
25
+                <block wx:if="{{ item.value == 0 }}">
26
+                  <text>未记录</text>
27
+                </block>
28
+              </block>
29
+              <block wx:if="{{ !is_list }}">
30
+                <text>是</text>
31
+                <image src="/images/select_{{ item.status ? 'ok' : 'no' }}.png" style="margin-right: 20rpx;" bindtap="onChangeStatus" data-idx="{{idx}}" data-index="{{index}}" data-status="true"></image>
32
+                <text>否</text>
33
+                <image src="/images/select_{{ !item.status ? 'ok' : 'no' }}.png" bindtap="onChangeStatus" data-idx="{{idx}}" data-index="{{index}}" data-status="false"></image>
34
+              </block>
35
+            </view>
36
+          </view>
37
+        </view>
38
+      </view>
39
+      <view class="module flex-center" wx:if="{{ check.option_list.length > 3 && more }}" bindtap="onOpenList">
40
+        <view class="icon">>></view>
41
+      </view>
42
+    </view>
43
+  </view>
44
+  <view class="padding" style="padding: 0 36rpx;">
45
+    <view class="detail border-radius">
46
+      <view class="top flex-align-center">
47
+        <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">早班复查问题反馈</text>
48
+      </view>
49
+      <block wx:if="{{ is_list }}">
50
+        <view class="check-list" wx:if="{{ check.feedback }}">
51
+          <view class="item flex-column">
52
+            <view class="user-info flex-align-center">
53
+              <image src="{{ check.feedback.avatar_url }}"></image>
54
+              <view class="info flex-column flex1">
55
+                <text style="font-size: 28rpx;margin-bottom: 6rpx;">{{ check.feedback.nickname }}</text>
56
+                <text style="font-size: 20rpx;color: #999;">{{ check.feedback.update_time }}</text>
57
+              </view>
58
+              <!-- <view class="more flex-align-center flex-justify-space-between" data-item="{{ item }}" bindtap="onEditItem" wx:if="{{ item.allow_edit == 1 }}">
59
+                <text></text>
60
+                <text></text>
61
+                <text></text>
62
+              </view> -->
63
+              <!-- <view class="more">···</view> -->
64
+            </view>
65
+            <text style="font-size: 28rpx;color: #666;margin-bottom: 30rpx;">{{ check.feedback.content }}</text>
66
+            <view class="box" wx:if="{{ check.feedback.media_list && check.feedback.media_list.length > 0 }}">
67
+              <view class="item-media" wx:for="{{ check.feedback.media_list }}" wx:key="index">
68
+                <block wx:if="{{ item.type == 'video' }}">
69
+                  <!-- <video src="{{ item.url }}"></video> -->
70
+                  <!-- <text>视频播放</text> -->
71
+                  <view class="flex-center" style="font-size: 28rpx;width: 100%;height: 100%;background-color: #ccc;" data-idx="{{ idx }}" data-index="{{index}}" bindtap="previewMedia">
72
+                    <!-- 这个是视频 -->
73
+                    <image class="icon-01" src="/images/icon_01.png"></image>
74
+                    <!-- <text style="position: absolute;">这个是视频</text> -->
75
+                    <image class="img-content" data-index="{{index}}" src="{{ item.thumb }}" alt=""></image>
76
+                  </view>
77
+                </block>
78
+                <block wx:if="{{ item.type == 'image' }}">
79
+                  <image class="img-content" data-idx="{{ idx }}" data-index="{{index}}" src="{{ item.url }}" alt="" bindtap="previewMedia"></image>
80
+                </block>
81
+              </view>
82
+              
83
+              <!-- <image src="{{item.url}}" data-index="{{item}}" bindtap="previewImage" wx:for="{{item.media_list}}" wx:key="index"></image> -->
84
+            </view>
85
+          </view>
86
+        </view>
87
+        <view class="no-more-data" wx:if="{{ !check.feedback }}">暂无反馈记录~</view>
88
+      </block>
89
+      <block wx:if="{{ !is_list }}">
90
+        <view class="box-textarea">
91
+        <textarea bindinput="bindTextAreaInput" value="{{value}}" maxlength="{{maxlength}}" placeholder="请输入记录反馈" />
92
+        <view class="box-text">{{number}}/{{maxlength}}</view>
93
+        </view>
94
+        <view class="change-img">
95
+          <view class="text">
96
+            <text>添加视频/图片</text>
97
+            <text style="font-size:28rpx;color:#999;">({{imgs.length}}/9)</text>
98
+          </view>
99
+          <view class="img-box">
100
+            <view class="position-relative" style="position: relative;" wx:for="{{ imgs }}" wx:key="index">
101
+              <view class="item">
102
+                <block wx:if="{{ item.type == 'video' }}">
103
+                  <!-- <video src="{{ item.url }}"></video> -->
104
+                  <!-- <text>视频播放</text> -->
105
+                  <view class="flex-center" style="font-size: 28rpx;width: 100%;height: 100%;background-color: #ccc;" data-index="{{index}}" bindtap="previewMedia">
106
+                    <!-- 这个是视频 -->
107
+                    <image class="icon-01" src="/images/icon_01.png"></image>
108
+                    <!-- <text style="position: absolute;">这个是视频</text> -->
109
+                    <image class="img-content" data-index="{{index}}" src="{{ item.thumb }}" alt=""></image>
110
+                  </view>
111
+                </block>
112
+                <block wx:if="{{ item.type == 'image' }}">
113
+                  <image class="img-content" data-index="{{index}}" src="{{ item.url }}" alt="" bindtap="previewMedia"></image>
114
+                </block>
115
+              </view>
116
+              <image src="/images/icon_03.png" class="delete-img" data-index="{{index}}" bindtap="onDeleteItem"></image>
117
+            </view>
118
+            
119
+            <view class="item upload flex-column flex-center" wx:if="{{ imgs.length < 9 &&imgs[0].type != 'video' }}" bindtap="chooseVideo">
120
+              <image src=""></image>
121
+              <text style="font-size: 28rpx;">添加视频</text>
122
+            </view>
123
+            <view class="item upload flex-column flex-center" wx:if="{{ imgs.length < 9}}" bindtap="chooseImage">
124
+              <image src=""></image>
125
+              <text style="font-size: 28rpx;">添加图片</text>
126
+            </view>
127
+          </view>
128
+        </view>
129
+      </block>
130
+    </view>
131
+    <view class="btn flex-center" wx:if="{{ is_list && check.allow_edit == 1 }}" bindtap="onChangeEdit">编辑晚班记录</view>
132
+    <view class="btn flex-center" wx:if="{{ !is_list }}" bindtap="onCheckUpdate">提交</view>
133
+  </view>
134
+
135
+</view>

+ 240 - 1
pages/recordSheet/components/verify/verify.wxss

@@ -1 +1,240 @@
1
-/* pages/recordSheet/components/verify/verify.wxss */
1
+.inspect .content {
2
+  background-color: #fff;
3
+  /* padding: 28rpx 0; */
4
+  padding-top: 28rpx;
5
+}
6
+
7
+.inspect .title .item {
8
+  height: 60rpx;
9
+  background: #FFF7FA;
10
+  font-size: 28rpx;
11
+  font-family: PingFangSC-Regular, PingFang SC;
12
+  font-weight: 400;
13
+  color: #333333;
14
+}
15
+
16
+.inspect .content .list {
17
+  position: relative;
18
+}
19
+
20
+.inspect .content .module {
21
+  position: absolute;
22
+  bottom: 0;
23
+  left: 0;
24
+  width: 100%;
25
+  height: 154rpx;
26
+  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, #FFFFFF 100%);
27
+} 
28
+
29
+.inspect .module .icon {
30
+  transform: rotate(90deg);
31
+}
32
+
33
+.inspect .content .list view,.content .list text {
34
+  font-size: 28rpx;
35
+  font-family: PingFangSC-Regular, PingFang SC;
36
+  font-weight: 400;
37
+  color: #333333;
38
+}
39
+
40
+.content .list .item {
41
+  border-bottom: 2rpx solid #d3d3d3;
42
+}
43
+
44
+.content .left {
45
+  width: 174rpx;
46
+  padding: 30rpx 0;
47
+  border-right: 2rpx solid #d3d3d3;
48
+}
49
+
50
+.content .item-btn image {
51
+  width: 48rpx;
52
+  height: 48rpx;
53
+  /* background-color: #ccc; */
54
+  border-radius: 50%;
55
+}
56
+
57
+.border-radius {
58
+  background: #FFFFFF;
59
+  box-shadow: 0rpx 4rpx 14rpx 0rpx rgba(0, 0, 0, 0.05);
60
+  border-radius: 24rpx;
61
+  margin: 20rpx 0;
62
+}
63
+
64
+.detail {
65
+  padding: 30rpx 28rpx;
66
+}
67
+
68
+.detail .top {
69
+  padding-bottom: 30rpx;
70
+  border-bottom: 2rpx solid #F2F2F2;
71
+}
72
+
73
+.detail .box-textarea {
74
+  position: relative;
75
+  padding-bottom: 30rpx;
76
+  height: 280rpx;
77
+  box-sizing: border-box;
78
+}
79
+
80
+.detail textarea {
81
+  width: 100%;
82
+  height: 100%;
83
+  box-sizing: border-box;
84
+  /* height: 280rpx;
85
+  box-sizing: border-box; */
86
+  padding: 30rpx 0 50rpx;
87
+}
88
+
89
+.detail .box-textarea .box-text {
90
+  position: absolute;
91
+  right: 0;
92
+  bottom: 30rpx;
93
+  font-size: 28rpx;
94
+  color: #999999;
95
+}
96
+
97
+.detail .change-img {
98
+  padding-top: 30rpx;
99
+  border-top: 2rpx solid #F2F2F2;
100
+}
101
+
102
+.change-img .img-box {
103
+  margin-top: 30rpx;
104
+  display: grid;
105
+  grid-gap: 20rpx 20rpx;
106
+  grid-template-columns: repeat(3, 1fr);
107
+}
108
+
109
+.change-img .img-box .item {
110
+  width: 200rpx;
111
+  height: 200rpx;
112
+  border-radius: 16px;
113
+  box-sizing: border-box;
114
+  overflow: hidden;
115
+  position: relative;
116
+}
117
+
118
+.change-img .delete-img {
119
+  position: absolute;
120
+  top: -24rpx;
121
+  right: -16rpx;
122
+  width: 48rpx;
123
+  height: 48rpx;
124
+  border-radius: 50%;
125
+  background-color: black;
126
+}
127
+
128
+.change-img .img-box .item.upload {
129
+  border: dashed 2rpx #c6c6c6;
130
+  background: #F4F4F4;
131
+}
132
+
133
+.change-img .upload image {
134
+  width: 48rpx;
135
+  height: 48rpx;
136
+  background-color: #ccc;
137
+  margin-bottom: 6rpx;
138
+}
139
+
140
+.change-img .img-box video {
141
+  width: 100%;
142
+  height: 100%;
143
+}
144
+
145
+.change-img .img-box .icon-01 {
146
+  width: 64rpx;
147
+  height: 64rpx;
148
+  position: absolute;
149
+}
150
+
151
+.change-img .img-box .img-content {
152
+  width: 100%;
153
+  height: 100%;
154
+}
155
+
156
+.btn {
157
+  margin: 30rpx 0;
158
+  height: 96rpx;
159
+  width: 100%;
160
+  background: #FF77B0;
161
+  border-radius: 48rpx;
162
+  font-size: 36rpx;
163
+  color: #fff;
164
+}
165
+
166
+
167
+
168
+
169
+
170
+.check-list .item {
171
+  padding-top: 30rpx;
172
+}
173
+
174
+.check-list .item-top {
175
+  padding: 0 28rpx;
176
+}
177
+
178
+.check-list .item-top .btn {
179
+  width: 154rpx;
180
+  height: 52rpx;
181
+  border-radius: 26rpx;
182
+  border: 2rpx solid #333333;
183
+  box-sizing: border-box;
184
+  font-size: 28rpx;
185
+}
186
+
187
+.check-list .user-info {
188
+  margin-bottom: 20rpx;
189
+}
190
+
191
+.check-list .user-info image {
192
+  width: 64rpx;
193
+  height: 64rpx;
194
+  border-radius: 50%;
195
+  /* background-color: red; */
196
+  margin-right: 14rpx;
197
+}
198
+
199
+.check-list .more {
200
+  width: 48rpx;
201
+  height: 48rpx;
202
+  padding: 0 4rpx;
203
+  box-sizing: border-box;
204
+}
205
+
206
+.check-list .more text {
207
+  width: 8rpx;
208
+  height: 8rpx;
209
+  background: #333;
210
+  border-radius: 50%;
211
+}
212
+
213
+.check-list .box {
214
+  display: grid;
215
+  grid-gap: 20rpx 22rpx;
216
+  grid-template-columns: repeat(3, 1fr);
217
+  padding: 0rpx 0 30rpx;
218
+}
219
+
220
+.check-list .box .item-media {
221
+  width: 198rpx;
222
+  height: 198rpx;
223
+  border-radius: 16px;
224
+  box-sizing: border-box;
225
+  overflow: hidden;
226
+  position: relative;
227
+}
228
+
229
+.check-list .box image {
230
+  width: 100%;
231
+  height: 100%;
232
+  border-radius: 16rpx;
233
+  /* background-color: red; */
234
+}
235
+
236
+.check-list .box .icon-01 {
237
+  width: 64rpx;
238
+  height: 64rpx;
239
+  position: absolute;
240
+}

+ 55 - 3
pages/recordSheet/recordSheet.js

@@ -1,3 +1,7 @@
1
+import { 
2
+  get,post
3
+ } from "../../utils/http"
4
+
1 5
 // pages/recordSheet/recordSheet.js
2 6
 Page({
3 7
 
@@ -40,13 +44,21 @@ Page({
40 44
         url: "https://img0.baidu.com/it/u=2247422843,411257408&fm=26&fmt=auto"
41 45
       },
42 46
     ],
47
+    todayData: {},
48
+    detail: {}
43 49
   },
44 50
 
45 51
   /**
46 52
    * 生命周期函数--监听页面加载
47 53
    */
48 54
   onLoad: function (options) {
49
-
55
+    console.log(options.check_id)
56
+    this.setData({
57
+      check_id: options.check_id
58
+    },() => {
59
+      // this.getCheckInfo()
60
+      // this.getCheckToday()
61
+    })
50 62
   },
51 63
 
52 64
   /**
@@ -60,7 +72,8 @@ Page({
60 72
    * 生命周期函数--监听页面显示
61 73
    */
62 74
   onShow: function () {
63
-
75
+    this.getCheckInfo()
76
+    this.getCheckToday()
64 77
   },
65 78
 
66 79
   /**
@@ -201,5 +214,44 @@ Page({
201 214
     this.setData({
202 215
       ['raterList[' + index + '].num']: value
203 216
     })
204
-  }
217
+  },
218
+
219
+  /**
220
+   * 获取今日检查信息
221
+   * api/check/today
222
+  */
223
+  getCheckToday() {
224
+    get('api/check/today',{},(res) => {
225
+      this.setData({
226
+        todayData: res.data
227
+      })
228
+      console.log(res)
229
+    })
230
+  },
231
+
232
+  /**
233
+   * 获取检查记录详情
234
+   * api/check/info
235
+  */
236
+  getCheckInfo() {
237
+    get('api/check/info',{
238
+      check_id: this.data.check_id
239
+    },(res) => {
240
+      console.log(res.data.check.feedback)
241
+      if(res.data.check && res.data.check.feedback) {
242
+        res.data.check.feedback.media_list = JSON.parse(res.data.check.feedback.media_list)
243
+      }
244
+      if(res.data.review && res.data.review.feedback) {
245
+        res.data.review.feedback.media_list = JSON.parse(res.data.review.feedback.media_list)
246
+      }
247
+      if(res.data.manager && res.data.manager.feedback) {
248
+        res.data.manager.feedback.media_list = JSON.parse(res.data.manager.feedback.media_list)
249
+      }
250
+      // res.check.feedback.media_list.forEach(() => {})
251
+      this.setData({
252
+        detail: res.data
253
+      })
254
+    })
255
+  },
256
+
205 257
 })

+ 13 - 13
pages/recordSheet/recordSheet.wxml

@@ -1,18 +1,18 @@
1 1
 <view class="content">
2 2
   <view class="detail-top flex-column">
3
-    <text style="font-size: 36rpx;">门店名称:JOLIJOLI南山店</text>
4
-    <text style="font-size: 28rpx;margin: 16rpx 0;">店长:南山店长</text>
3
+    <text style="font-size: 36rpx;">门店名称:{{ todayData.store_name }}</text>
4
+    <text style="font-size: 28rpx;margin: 16rpx 0;">店长:{{ todayData.manager_name }}</text>
5 5
     <view class="top-info">
6 6
       <view class="flex">
7 7
         <text>离店检查:</text>
8
-        <text style="color: #FF77B0;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">未检查</text>
8
+        <text style="color: #FF77B0;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">{{ todayData.is_check == 1 ? '已检查' : '未检查' }}</text>
9 9
         <text class="flex1"></text>
10
-        <text>营业复查:已复查</text>
10
+        <text>营业复查:{{ todayData.is_review == 1 ? '已复查' : '未复查' }}</text>
11 11
       </view>
12 12
       <view class="top-text flex-column">
13
-        <text>今日负责人:武则天</text>
14
-        <text style="margin:20rpx 0;">检查负责人:小婵</text>
15
-        <text>复查检查人:查理兹·塞隆</text>
13
+        <text>今日负责人:{{ todayData.charge_name }}</text>
14
+        <text style="margin:20rpx 0;">检查负责人:{{ todayData.check_name }}</text>
15
+        <text>复查检查人:{{ todayData.review_name }}</text>
16 16
       </view>
17 17
     </view>
18 18
   </view>
@@ -23,14 +23,14 @@
23 23
       <view class="item flex-align-center {{currentTab==2 ? 'active' : ''}}" data-index="2" bindtap="onChangeTab">店长审核</view>
24 24
     </view>
25 25
     <view class="tabs-content">
26
-      <inspect style="display: {{ current == 0 ? 'block' : 'none' }};"></inspect>
27
-      <inspect style="display: {{ current == 1 ? 'block' : 'none' }};"></inspect>
28
-      <inspect style="display: {{ current == 2 ? 'block' : 'none' }};"></inspect>
29
-      <!-- <review style="display: {{ current == 1 ? 'block' : 'none' }};"></review>
30
-      <verify style="display: {{ current == 2 ? 'block' : 'none' }};"></verify> -->
26
+      <inspect style="display: {{ currentTab == 0 ? 'block' : 'none' }};" check_id="{{check_id}}" preCheck="{{detail.check}}" ></inspect>
27
+      <!-- <inspect style="display: {{ currentTab == 1 ? 'block' : 'none' }};"></inspect>
28
+      <inspect style="display: {{ currentTab == 2 ? 'block' : 'none' }};"></inspect> -->
29
+      <review style="display: {{ currentTab == 1 ? 'block' : 'none' }};" check_id="{{check_id}}" manager="{{ detail.manager }}"></review>
30
+      <verify style="display: {{ currentTab == 2 ? 'block' : 'none' }};" check_id="{{check_id}}" review="{{ detail.review }}"></verify>
31 31
     </view>
32 32
   </view>
33
-  <view class="padding" style="padding: 0 36rpx;">
33
+  <view class="padding" style="padding: 0 36rpx;display: none;">
34 34
     <view class="detail border-radius">
35 35
     <view class="top flex-align-center">
36 36
       <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">早班复查问题反馈</text>

+ 90 - 6
pages/tagsAdd/tagsAdd.js

@@ -1,3 +1,5 @@
1
+import { get,post } from "../../utils/http"
2
+
1 3
 // pages/tagsAdd/tagsAdd.js
2 4
 Page({
3 5
 
@@ -5,16 +7,23 @@ Page({
5 7
    * 页面的初始数据
6 8
    */
7 9
   data: {
8
-    tags:[
9
-      true,false,false,true,true,false,false,true,false,false,true
10
-    ]
10
+    tags:[],
11
+    list: []
11 12
   },
12 13
 
13 14
   /**
14 15
    * 生命周期函数--监听页面加载
15 16
    */
16 17
   onLoad: function (options) {
17
-
18
+    console.log(options)
19
+    if(options.user_id) {
20
+      this.setData({
21
+        user_id: options.user_id
22
+      },() => {
23
+        this.getUserInfo()
24
+        this.getUserTags()
25
+      })
26
+    }
18 27
   },
19 28
 
20 29
   /**
@@ -70,10 +79,85 @@ Page({
70 79
    * 选中标签
71 80
   */
72 81
   onChangeTags(e) {
73
-    let status = e.currentTarget.dataset.item
82
+    let status = e.currentTarget.dataset.status
74 83
     let index = e.currentTarget.dataset.index
84
+    let { tags,list } = this.data;
85
+    let sum = list.length
86
+    let that = this;
87
+    
75 88
     this.setData({
76
-      ['tags[' + index + ']']: !status
89
+      ['tags[' + index + '].status']: !status
90
+    },() => {
91
+      tags.forEach((item) => {
92
+        if(item.status) {
93
+          sum ++
94
+        }
95
+      })
96
+      if(sum > 10) {
97
+        wx.showToast({
98
+          title: '最多添加10个标签',
99
+          icon: 'none'
100
+        })
101
+        that.setData({
102
+          ['tags[' + index + '].status']: false
103
+        })
104
+      }
105
+    })
106
+  },
107
+
108
+  /**
109
+   * 获取用户信息
110
+   * api/user/info
111
+  */
112
+  getUserInfo() {
113
+    let { user_id } = this.data;
114
+    get('api/user/info',{
115
+      user_id
116
+    },(res) => {
117
+      console.log(res)
118
+      this.setData({
119
+        list: res.data.tags
120
+      })
121
+      console.log(res)
122
+    })
123
+  },
124
+
125
+  /**
126
+   * 获取常用标签
127
+   * api/user/tags
128
+  */
129
+  getUserTags() {
130
+    get('api/user/tags',{
131
+
132
+    },(res) => {
133
+      let { tags } = this.data;
134
+      res.data.tags.forEach(item => {
135
+        let obj = { tag:item,status:false }
136
+        tags.push(obj)
137
+        console.log(item)
138
+      });
139
+      this.setData({
140
+        tags
141
+      })
142
+      console.log(res)
143
+    })
144
+  },
145
+
146
+  /**
147
+   * 添加标签
148
+  */
149
+  onSubmit() {
150
+    let { user_id,list,tags } = this.data;
151
+    tags.forEach((item,index) => {
152
+      if(item.status) {
153
+        list.push(item.tag)
154
+      }
155
+    })
156
+    post('api/user/update',{
157
+      user_id,
158
+      tags: list.toString()
159
+    },(res) => {
160
+      console.log(res)
77 161
     })
78 162
   }
79 163
 })

+ 9 - 4
pages/tagsAdd/tagsAdd.wxml

@@ -1,9 +1,14 @@
1 1
 <view class="top">
2 2
   <view class="title flex-align-center">
3 3
     <text style="font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">客户标签</text>
4
-    <text style="font-size: 28rpx;color:#999;margin-left: 10rpx;">(3/10)</text>
4
+    <text style="font-size: 28rpx;color:#999;margin-left: 10rpx;">({{ list.length }}/10)</text>
5 5
   </view>
6
-  <navigator url="/pages/tagsCustom/tagsCustom" hover-class="none">
6
+  <view class="list" style="padding: 0;">
7
+    <view class="box flex" style="padding: 0;">
8
+      <view style="margin: 0 5rpx 30rpx;" class="item" wx:for="{{ list }}" wx:key="index" data-index="{{ index }}" data-item="{{ item }}">{{ item }}</view>
9
+    </view>
10
+  </view>
11
+  <navigator url="/pages/tagsCustom/tagsCustom?user_id={{ user_id }}" hover-class="none" wx:if="{{ list.length <= 10 }}">
7 12
     <view class="custom-btn flex-center">
8 13
       <text>+</text>
9 14
       <text>自定义标签</text>
@@ -13,10 +18,10 @@
13 18
 <view class="list">
14 19
   <text style="margin-left:44rpx;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">常用标签</text>
15 20
   <view class="box flex">
16
-    <view class="item {{item ? 'active' : '' }}" wx:for="{{ tags }}" wx:key="index" bindtap="onChangeTags" data-index="{{ index }}" data-item="{{ item }}">美丽貌美</view>
21
+    <view class="item {{item.status ? 'active' : '' }}" wx:for="{{ tags }}" wx:key="index" bindtap="onChangeTags" data-index="{{ index }}" data-status="{{ item.status }}">{{ item.tag }}</view>
17 22
   </view>
18 23
 </view>
19 24
 
20
-<view class="btn-box">
25
+<view class="btn-box" bindtap="onSubmit">
21 26
   <view class="btn flex-center">完成</view>
22 27
 </view>

+ 27 - 5
pages/tagsCustom/tagsCustom.js

@@ -1,19 +1,26 @@
1
-// import {
2
-//   get, post,
3
-// } from '../../utils/http';
1
+import {
2
+  get, post,
3
+} from '../../utils/http';
4 4
 Page({
5 5
 
6 6
   /**
7 7
    * 页面的初始数据
8 8
    */
9 9
   data: {
10
-    userInfo: {}
10
+    userInfo: {},
11
+    tag: ''
11 12
   },
12 13
 
13 14
   /**
14 15
    * 生命周期函数--监听页面加载
15 16
    */
16 17
   onLoad: function (options) {
18
+    console.log(options)
19
+    if(options.user_id) {
20
+      this.setData({
21
+        user_id: options.user_id
22
+      })
23
+    }
17 24
     // this.getUserFiles()
18 25
   },
19 26
 
@@ -71,7 +78,7 @@ Page({
71 78
    */
72 79
   onChangeName(e) {
73 80
     this.setData({
74
-      ['userInfo.real_name']: e.detail.value,
81
+      tag: e.detail.value,
75 82
     })
76 83
   },
77 84
 
@@ -111,5 +118,20 @@ Page({
111 118
         wx.navigateBack()
112 119
       }, 1000);
113 120
     })
121
+  },
122
+
123
+  /**
124
+   * 添加标签
125
+  */
126
+  onAddTag() {
127
+    let { user_id,tag } = this.data;
128
+    let pages=getCurrentPages()
129
+    let prePage = pages[pages.length-2]
130
+    let preList = prePage.data.list
131
+    preList.push(tag)
132
+    pages[pages.length-2].setData({
133
+      list: preList
134
+    })
135
+    wx.navigateBack()
114 136
   }
115 137
 })

+ 2 - 2
pages/tagsCustom/tagsCustom.wxml

@@ -1,9 +1,9 @@
1 1
 <view class="content flex-column ">
2
-  <input type="text" focus maxlength="20" placeholder="请输入自定义标签" value="{{userInfo.real_name}}" bindinput="onChangeName"/>
2
+  <input type="text" focus maxlength="8" placeholder="请输入自定义标签" value="{{userInfo.real_name}}" bindinput="onChangeName"/>
3 3
   <text style="margin: 8rpx 0 0 28rpx;font-size:28rpx;color:#999;">标签最多8个字</text>
4 4
   <!-- <view class="btn border-radius flex-center" bindtap="setUserFiles">确定</view> -->
5 5
 </view>
6 6
 
7
-<view class="btn-box">
7
+<view class="btn-box" bindtap="onAddTag">
8 8
   <view class="btn flex-center">添加标签</view>
9 9
 </view>

+ 5 - 4
pages/tagsEdit/tagsEdit.js

@@ -7,7 +7,8 @@ Page({
7 7
    * 页面的初始数据
8 8
    */
9 9
   data: {
10
-    user_id: ''
10
+    user_id: '',
11
+    list: []
11 12
   },
12 13
 
13 14
   /**
@@ -19,7 +20,7 @@ Page({
19 20
       this.setData({
20 21
         user_id: options.user_id
21 22
       },() => {
22
-        this.getUserInfo()
23
+        // this.getUserInfo()
23 24
       })
24 25
     }
25 26
     
@@ -36,7 +37,7 @@ Page({
36 37
    * 生命周期函数--监听页面显示
37 38
    */
38 39
   onShow: function () {
39
-
40
+    this.getUserInfo()
40 41
   },
41 42
 
42 43
   /**
@@ -74,7 +75,7 @@ Page({
74 75
 
75 76
   },
76 77
 
77
-    /**
78
+  /**
78 79
    * 获取用户信息
79 80
    * api/user/info
80 81
   */

+ 1 - 1
pages/tagsEdit/tagsEdit.wxml

@@ -10,7 +10,7 @@
10 10
 </view>
11 11
 
12 12
 <view class="btn-box">
13
-  <navigator url="/pages/tagsAdd/tagsAdd" hover-class="none">
13
+  <navigator url="/pages/tagsAdd/tagsAdd?user_id={{ user_id }}" hover-class="none">
14 14
     <view class="btn flex-center">
15 15
       <text class="icon">+</text>
16 16
       <text style="margin-left: 28rpx;">添加标签</text>

+ 1 - 1
project.private.config.json

@@ -57,7 +57,7 @@
57 57
         {
58 58
           "name": "记录表",
59 59
           "pathName": "pages/recordSheet/recordSheet",
60
-          "query": "",
60
+          "query": "check_id=6",
61 61
           "scene": null
62 62
         },
63 63
         {

+ 3 - 0
utils/http.js

@@ -48,6 +48,9 @@ function http(url,method,params, success, fail) {
48 48
           title: data.msg,
49 49
           icon: 'none'
50 50
         })
51
+        wx.reLaunch({
52
+          url: '/pages/login/login',
53
+        })
51 54
         // login()
52 55
       }
53 56
     },