谢创宏 лет назад: 3
Родитель
Сommit
118a518575

+ 30 - 1
pages/home/home.js

@@ -35,7 +35,7 @@ Page({
35 35
     console.log(year,month,day)
36 36
     this.setData({
37 37
       currentDay: `${year}-${month}-${day}`,
38
-      startDay: '1998-04-20',
38
+      startDay: `${year}-${month}-${day}`,
39 39
       endDay: `${year}-${month}-${day}`,
40 40
     })
41 41
     this.getHomeData();
@@ -97,12 +97,27 @@ Page({
97 97
   */
98 98
   onTabsChange(e) {
99 99
     let current = e.currentTarget.dataset.id
100
+    let startDay,endDay,currentDay
100 101
     if(current == this.data.current) {
101 102
       return;
102 103
     }
104
+    if(current == 0) {
105
+      startDay = this.formData(0)
106
+      endDay = this.formData(0)
107
+      currentDay = this.formData(0)
108
+    } else if(current == 1) {
109
+      startDay = this.formData(0)
110
+      endDay = this.formData(7)
111
+      currentDay = this.formData(0)
112
+    } else {
113
+      startDay = this.formData(-7)
114
+      currentDay = this.formData(-7)
115
+      endDay = this.formData(0)
116
+    }
103 117
     this.setData({
104 118
       current,
105 119
       page: 1,
120
+      startDay,endDay,currentDay
106 121
     },() => {
107 122
       this.getOrderList(1)
108 123
     })
@@ -160,5 +175,19 @@ Page({
160 175
       })
161 176
       console.log(res)
162 177
     })
178
+  },
179
+
180
+  /**'
181
+   * 格式化时间
182
+  */
183
+  formData(_day) {
184
+    let date = new Date()
185
+    date=date.setDate(date.getDate()+_day);
186
+    date=new Date(date);
187
+    let year = date.getFullYear()
188
+    let month = date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1
189
+    let day = date.getDate() < 10 ? '0'+date.getDate() : date.getDate()
190
+    console.log(year,month,day)
191
+    return `${year}-${month}-${day}`;
163 192
   }
164 193
 })

+ 2 - 1
pages/home/home.wxml

@@ -28,7 +28,8 @@
28 28
         <view class="triangle"></view>
29 29
       </view>
30 30
     </picker>
31
-    <view class="search flex-center" bindtap="onSearchOrder">搜索</view>
31
+    <view class="" style="width: 116rpx;" wx:if="{{ current == 0 }}"></view>
32
+    <view class="search flex-center" bindtap="onSearchOrder" wx:if="{{ current != 0 }}">搜索</view>
32 33
   </view>
33 34
   <view class="tabs-content">
34 35
     <navigator url="/pages/orderDetail/orderDetail?orderId={{item.order_id}}" hover-class="none" wx:for="{{ list }}" wx:key="index">

+ 8 - 1
pages/orderDetail/orderDetail.js

@@ -29,7 +29,14 @@ Page({
29 29
     page: 1,
30 30
     index: 0,
31 31
     visible: false,
32
-    currentItem: {}
32
+    currentItem: {},
33
+    raterStatus: {
34
+      1: '差',
35
+      2: '较差',
36
+      3: '一般',
37
+      4: '满意',
38
+      5: '非常好',
39
+    },
33 40
   },
34 41
 
35 42
   /**

+ 2 - 1
pages/orderDetail/orderDetail.json

@@ -1,6 +1,7 @@
1 1
 {
2 2
   "navigationBarTitleText": "订单详情",
3 3
   "usingComponents": {
4
-    "wux-popup": "../../components/dist/popup/index"
4
+    "wux-popup": "../../components/dist/popup/index",
5
+    "wux-rater": "../../components/dist/rater/index"
5 6
   }
6 7
 }

+ 28 - 0
pages/orderDetail/orderDetail.wxml

@@ -62,6 +62,34 @@
62 62
         <view class="btn flex-center">新增反馈</view>
63 63
       </navigator>
64 64
     </view>
65
+    <view class="detail border-radius rater">
66
+      <view class="rater-item flex-align-center" >
67
+        <text class="text-01">整体满意度</text>
68
+        <wux-rater slot="footer" active-color="#FF77B0" margin="{{ 12 }}" font-size="{{ 18 }}" default-value="{{ detailData.score.score_whole }}" data-index="{{ index }}" bind:change="onChange" />
69
+        <text class="text-02">{{ raterStatus[detailData.score.score_whole] }}</text>
70
+      </view>
71
+      <view class="rater-item flex-align-center" >
72
+        <text class="text-01">效果认可度</text>
73
+        <wux-rater slot="footer" active-color="#FF77B0" margin="{{ 12 }}" font-size="{{ 18 }}" default-value="{{ detailData.score.score_effect }}" data-index="{{ index }}" bind:change="onChange" />
74
+        <text class="text-02">{{ raterStatus[detailData.score.score_effect] }}</text>
75
+      </view>
76
+      <view class="rater-item flex-align-center" >
77
+        <text class="text-01">价格接受度</text>
78
+        <wux-rater slot="footer" active-color="#FF77B0" margin="{{ 12 }}" font-size="{{ 18 }}" default-value="{{ detailData.score.score_price }}" data-index="{{ index }}" bind:change="onChange" />
79
+        <text class="text-02">{{ raterStatus[detailData.score.score_price] }}</text>
80
+      </view>
81
+      <view class="rater-item flex-align-center" >
82
+        <text class="text-01">类别满意度</text>
83
+        <wux-rater slot="footer" active-color="#FF77B0" margin="{{ 12 }}" font-size="{{ 18 }}" default-value="{{ detailData.score.score_kind }}" data-index="{{ index }}" bind:change="onChange" />
84
+        <text class="text-02">{{ raterStatus[detailData.score.score_kind] }}</text>
85
+      </view>
86
+      <view class="rater-item flex-align-center" >
87
+        <text class="text-01">安全认可度</text>
88
+        <wux-rater slot="footer" active-color="#FF77B0" margin="{{ 12 }}" font-size="{{ 18 }}" default-value="{{detailData.score.score_safe}}" data-index="{{ index }}" bind:change="onChange" />
89
+        <text class="text-02">{{ raterStatus[detailData.score.score_safe] }}</text>
90
+      </view>
91
+      
92
+    </view>
65 93
     <view class="item flex-column" wx:for="{{list}}" wx:for-index="idx" wx:key="index">
66 94
       <view class="user-info flex-align-center">
67 95
         <image src="{{ item.avatar_url }}"></image>

+ 22 - 0
pages/orderDetail/orderDetail.wxss

@@ -145,6 +145,28 @@
145 145
   position: absolute;
146 146
 }
147 147
 
148
+.rater .rater-item {
149
+  margin-top: 34rpx;
150
+}
151
+
152
+.rater .text-01 {
153
+  font-size: 28rpx;
154
+  font-family: PingFangSC-Medium, PingFang SC;
155
+  font-weight: 500;
156
+  color: #666666;
157
+  line-height: 32rpx;
158
+  margin-right: 20rpx;
159
+}
160
+
161
+.rater .text-02 {
162
+  font-size: 28rpx;
163
+  font-family: PingFangSC-Medium, PingFang SC;
164
+  font-weight: 500;
165
+  color: #FF77B0;
166
+  line-height: 32rx;
167
+  margin-left: 36rpx;
168
+} 
169
+
148 170
 .btn-item {
149 171
   height: 112rpx;
150 172
   border-bottom: 2rpx solid #eee;

+ 1 - 1
utils/http.js

@@ -18,7 +18,7 @@ function http(url,method,params, success, fail) {
18 18
       api_url = 'https://store.test-api.ijolijoli.com/'
19 19
       break;
20 20
     default:
21
-      api_url = 'https://store-api.ijolijoli.com/'
21
+      api_url = 'https://store.api.ijolijoli.com/'
22 22
       break;
23 23
   }
24 24
   return wx.request({