dolphin-weex-bc 0.0.36 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,119 +1,102 @@
1
1
  <template>
2
2
  <div class="material-wrapper">
3
- <!-- <text class="title">{{ title }}</text> -->
4
- <!-- <div class="outsideWrapper"></div> -->
5
- <!-- <slider class="slider" :show-indicators="true" v-if="layoutMode == 'row'"> -->
6
- <div
7
- class="middleBox"
8
- ref="recommend"
9
- v-if="layoutMode == 'row'"
10
- :style="{ height: dealDeviceMaterialList[0].consumables.length > 4 ? '272px' : '232px' }"
11
- >
12
- <scroller class="slider" scroll-direction="horizontal" @scroll="scrollEvent1">
13
- <!-- <div class="material-list" v-for="(item, index) in dealDeviceMaterialList[0]" :key="index"> -->
14
- <div class="recommendBox" ref="recommendBox">
15
- <template v-if="dealDeviceMaterialList[0].consumables && dealDeviceMaterialList[0].consumables.length > 0">
16
- <!-- <div class="material-title">
17
- <image
18
- class="title-icon"
19
- :src="dealDeviceMaterialList[0].deviceInfo.deviceIcon ? dealDeviceMaterialList[0].deviceInfo.deviceIcon : ''"
20
- style="width:88px; height:88px;"
21
- ></image>
22
- <div class="title-content">
23
- <text class="title-txt1">{{ dealDeviceMaterialList[0].deviceInfo.deviceName }} | {{ dealDeviceMaterialList[0].deviceInfo.roomName }}</text>
24
- <text class="title-txt2" v-if="dealDeviceMaterialList[0].deviceInfo.isOnline == 1">在线</text>
25
- <text class="title-txt3" style="color:#F56428;" v-else>设备离线</text>
26
- </div>
27
- </div> -->
28
- <div class="consumables-list" v-for="(item, index) in getSliderList" :key="index">
29
- <div class="consumables-list1" v-for="(it, i) in item" :key="i">
30
- <div
31
- class="material-item2"
32
- @click.stop="goDetail(it, dealDeviceMaterialList[0])"
33
- v-if="statusSlectedIndex == 0 ? true : it.remainingStatus == statusSlectedIndex"
34
- >
35
- <template>
36
- <div class="item-left2">
37
- <template v-if="dealDeviceMaterialList[0].deviceInfo.isOnline == 1 && it.remainingValueType != 5">
38
- <template v-if="it.remainingValue === '0' || it.remainingValue > 0">
39
- <midea-wave-progress-view
40
- class="drag-slider1"
41
- :accessible="true"
42
- :ariaLabel="水波进度条"
43
- :accessibilityHint="水波进度条"
44
- :data="it.waveData"
45
- v-if="showMode == 'wave'"
46
- >
47
- </midea-wave-progress-view>
48
- <!-- <midea-circle-progress-view class="circle" :data="{ ...common, ...chartJson1, ...{ progress: 1 - Number((it.remainingValue/it.total).toFixed(2)), text: ((Number((it.remainingValue/it.total).toFixed(2)))*100).toFixed(0) + '%' , completedColor: circleColorList[it.remainingStatus], textColor: circleColorList[it.remainingStatus] }}" v-else> </midea-circle-progress-view> -->
49
-
50
- <!-- <midea-circle-progress-view class="circle" :data="{ ...common, ...chartJson1, ...{ progress: 1 - Number((it.remainingValue/it.total).toFixed(2)), text: ((Number((it.remainingValue/it.total).toFixed(2)))*100).toFixed(0) + '%' , backCircleColor: circleColorList[it.remainingStatus], textColor: circleColorList[it.remainingStatus], lineWidth: isIos?2.5:5 }}" v-else> </midea-circle-progress-view> -->
51
- <div class="progresscycle-wrapper1" v-else>
52
- <midea-progresscycle-view
53
- class="progresscycle1"
54
- :data="it.chartData"
55
- @progresscycleTap="goDetail(it, dealDeviceMaterialList[0])"
3
+ <template v-if="layoutMode == 'row'">
4
+ <div
5
+ :class="['middleBox', !showAddCartButton && insufficientGoodinfoList.length == 0 && 'middleBox-not-button', dealDeviceMaterialList[0].consumables.length <= 4 && 'middleBox-lfour']"
6
+ ref="recommend"
7
+ >
8
+ <scroller class="slider" scroll-direction="horizontal" @scroll="scrollEvent1">
9
+ <div class="recommendBox" ref="recommendBox">
10
+ <template v-if="dealDeviceMaterialList[0].consumables && dealDeviceMaterialList[0].consumables.length > 0">
11
+ <div
12
+ :class="[
13
+ 'consumables-list',
14
+ dealDeviceMaterialList[0].consumables.length == 3 && 'consumables-list-ls-3',
15
+ dealDeviceMaterialList[0].consumables.length == 2 && 'consumables-list-ls-2',
16
+ dealDeviceMaterialList[0].consumables.length == 1 && 'consumables-list-ls-1'
17
+ ]"
18
+ v-for="(item, index) in getSliderList"
19
+ :key="index"
20
+ >
21
+ <div class="consumables-list1" v-for="(it, i) in item" :key="i">
22
+ <div
23
+ class="material-item2"
24
+ @click.stop="goDetail(it, dealDeviceMaterialList[0])"
25
+ v-if="statusSlectedIndex == 0 ? true : it.remainingStatus == statusSlectedIndex"
26
+ >
27
+ <template>
28
+ <div class="item-left2">
29
+ <template
30
+ v-if="dealDeviceMaterialList[0].deviceInfo.isOnline == 1 && it.remainingValueType != 5"
31
+ >
32
+ <template v-if="it.remainingValue === '0' || it.remainingValue > 0">
33
+ <template v-if="showMode == 'wave'">
34
+ <image
35
+ class="bg-circle2"
36
+ resize="stretch"
37
+ :src="showBgco(it)"
38
+ ></image>
39
+ <midea-wave-progress-view
40
+ class="drag-slider1"
41
+ :accessible="true"
42
+ :ariaLabel="水波进度条"
43
+ :accessibilityHint="水波进度条"
44
+ :data="setWavePercentDetail(it)"
56
45
  >
57
- </midea-progresscycle-view>
58
- <!-- <midea-progresscycle-view class="progresscycle" :data="chartData">
59
- </midea-progresscycle-view> -->
46
+ </midea-wave-progress-view>
47
+ </template>
60
48
 
61
- <!-- <div class="cricle-num-wrapper" v-if="isShow">
62
- <text :style="{color: circleColorList[it.remainingStatus]}" class="cricle-num-txt">{{((it.remainingValue/it.total)*100).toFixed(0) }}%</text>
63
- </div> -->
64
- </div>
49
+ <div class="progresscycle-wrapper1" v-else>
50
+ <midea-progresscycle-view
51
+ class="progresscycle1"
52
+ :data="it.chartData"
53
+ @progresscycleTap="goDetail(it, dealDeviceMaterialList[0])"
54
+ >
55
+ </midea-progresscycle-view>
56
+ </div>
57
+ </template>
58
+ <template v-else>
59
+ <div class="circle-noData1">
60
+ <text class="noData-txt">- -</text>
61
+ </div>
62
+ </template>
65
63
  </template>
66
64
  <template v-else>
67
65
  <div class="circle-noData1">
68
66
  <text class="noData-txt">- -</text>
69
67
  </div>
70
68
  </template>
71
- </template>
72
- <template v-else>
73
- <div class="circle-noData1">
74
- <text class="noData-txt">- -</text>
75
- </div>
76
- </template>
77
- </div>
78
- <div class="item-right2">
79
- <text class="item-txt11">{{ it.name }}</text>
80
-
81
- <!-- <div class="item-right-txt">
82
-
83
- </div> -->
84
- </div>
85
- </template>
69
+ </div>
70
+ <div class="item-right2">
71
+ <text class="item-txt11">{{ it.name }}</text>
72
+ </div>
73
+ </template>
74
+ </div>
86
75
  </div>
87
76
  </div>
88
-
89
- <!-- <div class="consumables-list">
90
- <div class="material-item2">
91
- <text>6666</text>
92
- </div>
93
- <div class="material-item2">
94
- <text>6666</text>
95
- </div>
96
- <div class="material-item2">
97
- <text>6666</text>
98
- </div>
99
- </div> -->
100
- </div>
101
- <indicator class="indicator"></indicator>
102
- </template>
103
- </div>
104
- <!-- </div> -->
105
- </scroller>
106
- <div class="recommendSlider" v-if="dealDeviceMaterialList[0].consumables.length > 4">
107
- <div class="recommendSliderOut">
108
- <div
109
- class="recommendSliderInner"
110
- :style="{ width: recommendSliderInnerWidth + 'px', left: recommendSliderInnerLeft + 'px' }"
111
- ></div>
77
+ <indicator class="indicator"></indicator>
78
+ </template>
79
+ </div>
80
+ </scroller>
81
+ <div class="recommendSlider" v-if="dealDeviceMaterialList[0].consumables.length > 4">
82
+ <div class="recommendSliderOut">
83
+ <div
84
+ class="recommendSliderInner"
85
+ :style="{ width: recommendSliderInnerWidth + 'px', left: recommendSliderInnerLeft + 'px' }"
86
+ ></div>
87
+ </div>
112
88
  </div>
113
89
  </div>
114
- </div>
90
+ <!-- 显示一键加购 -->
91
+ <template v-if="showAddCartButton && insufficientGoodinfoList.length > 0">
92
+ <div class="car-card-box">
93
+ <div class="car-card" @click="showGoodsList()">
94
+ <text class="car-card-text">立即购买</text>
95
+ </div>
96
+ </div>
97
+ </template>
98
+ </template>
115
99
 
116
- <!-- </slider> -->
117
100
  <scroller
118
101
  class="scroll-wrapper"
119
102
  :style="{ height: columnBoxHeight + 'px' }"
@@ -124,48 +107,35 @@
124
107
  @loadmore="loadmore"
125
108
  v-else
126
109
  >
127
- <!-- <text>{{ getSliderList }}</text> -->
128
110
  <template>
129
111
  <div class="material-wrapper">
130
- <!-- <div class="material-list" v-for="(item, index) in deviceMaterialList" -->
131
- <!-- <template v-if="deviceMaterialList.length>0"> -->
132
112
  <div class="material-list" v-for="(item, index) in dealDeviceMaterialList" :key="index">
133
113
  <template v-if="item.consumables && item.consumables.length > 0">
134
- <!-- <div class="material-title">
135
- <image
136
- class="title-icon"
137
- :src="item.deviceInfo.deviceIcon ? item.deviceInfo.deviceIcon : ''"
138
- style="width:88px; height:88px;"
139
- ></image>
140
- <div class="title-content">
141
- <text class="title-txt1">{{ item.deviceInfo.deviceName }} | {{ item.deviceInfo.roomName }}</text>
142
- <text class="title-txt2" v-if="item.deviceInfo.isOnline == 1">在线</text>
143
- <text class="title-txt3" style="color:#F56428;" v-else>设备离线</text>
144
- </div>
145
- </div> -->
146
114
  <div v-for="(it, i) in item.consumables" :key="i">
147
115
  <div
148
116
  class="material-item"
149
117
  @click="goDetail(it, item)"
150
118
  v-if="statusSlectedIndex == 0 ? true : it.remainingStatus == statusSlectedIndex"
151
119
  >
152
- <!-- <text>{{ it.chartData }}</text> -->
153
120
  <midea-progresscycle-view class="progresscycle" :data="it.chartData"> </midea-progresscycle-view>
154
121
  <div class="item-left">
155
122
  <template v-if="item.deviceInfo.isOnline == 1 && it.remainingValueType != 5">
156
123
  <template v-if="it.remainingValue === '0' || it.remainingValue > 0">
157
- <midea-wave-progress-view
158
- class="drag-slider"
159
- :accessible="true"
160
- :ariaLabel="水波进度条"
161
- :accessibilityHint="水波进度条"
162
- :data="it.waveData"
163
- v-if="showMode == 'wave'"
164
- >
165
- </midea-wave-progress-view>
166
- <!-- <midea-circle-progress-view class="circle" :data="{ ...common, ...chartJson1, ...{ progress: 1 - Number((it.remainingValue/it.total).toFixed(2)), text: ((Number((it.remainingValue/it.total).toFixed(2)))*100).toFixed(0) + '%' , completedColor: circleColorList[it.remainingStatus], textColor: circleColorList[it.remainingStatus] }}" v-else> </midea-circle-progress-view> -->
167
-
168
- <!-- <midea-circle-progress-view class="circle" :data="{ ...common, ...chartJson1, ...{ progress: 1 - Number((it.remainingValue/it.total).toFixed(2)), text: ((Number((it.remainingValue/it.total).toFixed(2)))*100).toFixed(0) + '%' , backCircleColor: circleColorList[it.remainingStatus], textColor: circleColorList[it.remainingStatus], lineWidth: isIos?2.5:5 }}" v-else> </midea-circle-progress-view> -->
124
+ <template v-if="showMode == 'wave'">
125
+ <image
126
+ class="bg-circle2"
127
+ resize="stretch"
128
+ :src="showBgco(it)"
129
+ ></image>
130
+ <midea-wave-progress-view
131
+ class="drag-slider"
132
+ :accessible="true"
133
+ :ariaLabel="水波进度条"
134
+ :accessibilityHint="水波进度条"
135
+ :data="setWavePercentDetail(it)"
136
+ >
137
+ </midea-wave-progress-view>
138
+ </template>
169
139
  <div class="progresscycle-wrapper" v-else>
170
140
  <midea-progresscycle-view
171
141
  class="progresscycle1"
@@ -191,46 +161,30 @@
191
161
  <div class="item-right-txt">
192
162
  <text class="item-txt1">{{ it.name }}</text>
193
163
  <template v-if="item.deviceInfo.isOnline == 1 && it.remainingValueType != 5">
194
- <template v-if="it.classification != 3">
195
- <div class="item-txt2-row" v-if="it.remainingValue === '0' || it.remainingValue > 0">
196
- <text class="item-txt2" v-if="it.remainingStatus == 2" :style="{ color: '#8E969B' }"
197
- >余量充足,请放心使用</text
198
- >
199
- <text
200
- class="item-txt2"
201
- v-else-if="it.remainingStatus == 1 && it.remainingValueType != 4"
202
- :style="{ color: '#FFAA10' }"
203
- >即将用尽,建议及时补充或更换</text
204
- >
205
- <template v-else>
206
- <!-- <image class="warning-icon" src="./assets/img/material/icon_warning@3x.png" style="width:40px; height:40px; margin-right:8px;"></image> -->
207
- <text class="item-txt3">已用尽,请立即补充或更换</text>
208
- </template>
209
- </div>
210
- <div v-else>
211
- <text class="item-txt2" :style="{ color: '#8E969B' }">未获取到设备耗材数据</text>
212
- </div>
213
- </template>
214
- <!-- 10.1 清洁类型设备 -->
215
- <template v-else>
216
- <div class="item-txt2-row" v-if="it.remainingValue === '0' || it.remainingValue > 0">
217
- <text class="item-txt2" v-if="it.remainingStatus == 2" :style="{ color: '#8E969B' }"
218
- >洁净度良好,请放心使用</text
219
- >
220
- <text
221
- class="item-txt2"
222
- v-else-if="it.remainingStatus == 1 && it.remainingValueType != 4"
223
- :style="{ color: '#FFAA10' }"
224
- >有少量杂质,建议及时清洁或更换</text
225
- >
226
- <template v-else>
227
- <text class="item-txt3">存在较多杂质,请立即清洁或更换</text>
228
- </template>
229
- </div>
230
- <div v-else>
231
- <text class="item-txt2" :style="{ color: '#8E969B' }">未获取到设备耗材数据</text>
232
- </div>
233
- </template>
164
+ <div class="item-txt2-row" v-if="it.remainingValue == 0 || it.remainingValue > 0">
165
+ <text
166
+ :class="['item-txt4', isDiablo && 'item-txt4-isDiablo']"
167
+ v-if="it.remainingStatus == 2"
168
+ >{{ it.classification == 3 ? '洁净度良好,请放心使用' : '余量充足,请放心使用' }}</text
169
+ >
170
+ <text
171
+ :class="['item-txt5', isDiablo && 'item-txt5-isDiablo']"
172
+ v-else-if="it.remainingStatus == 1 && it.remainingValueType != 4"
173
+ >{{ it.classification == 3 ? '洁净度下降,请及时清洗' : '即将用尽,请及时补充或更换' }}</text
174
+ >
175
+ <text
176
+ v-else
177
+ :class="['item-txt3', isDiablo && 'item-txt3-isDiablo']"
178
+ >{{
179
+ it.classification == 3 ? '洁净度严重不足,请立即清洗' : '已用尽,请立即补充或更换'
180
+ }}</text
181
+ >
182
+ </div>
183
+ <div v-else>
184
+ <text :class="['item-txt4', isDiablo && 'item-txt4-isDiablo']"
185
+ >未获取到设备耗材数据</text
186
+ >
187
+ </div>
234
188
  </template>
235
189
  <template v-else>
236
190
  <div>
@@ -241,10 +195,13 @@
241
195
  <div class="item-right-arrow">
242
196
  <div
243
197
  class="btn-purhase"
244
- v-if="it.goodsInfo && it.goodsInfo.skulink"
245
- @click="buyGoods(it.goodsInfo.skulink, it, item.deviceInfo, it.goodsInfo)"
198
+ v-if="it.btnType > 0"
199
+ @click="buyGoods(it, item.deviceInfo, false)"
246
200
  >
247
- <text class="txt-purhase">购买</text>
201
+ <text v-if="it.btnType == 1" class="txt-purhase">购买</text>
202
+ <text v-if="it.btnType == 2" class="txt-purhase">保养</text>
203
+ <text v-if="it.btnType == 3" class="txt-purhase">更换</text>
204
+ <text v-if="it.btnType == 4" class="txt-purhase">清洗</text>
248
205
  </div>
249
206
  <image class="arrow-icon" resize="stretch" :src="arrowIcon"></image>
250
207
  </div>
@@ -254,11 +211,20 @@
254
211
  </div>
255
212
  </template>
256
213
  </div>
257
- <!-- </template> -->
258
- <!-- </div> -->
259
214
  </div>
260
215
  </template>
261
216
  </scroller>
217
+
218
+ <dof-material-add-card
219
+ :showAddCartPopup="showAddCartPopup"
220
+ :insufficientGoodinfoList="insufficientGoodinfoList"
221
+ :repeatProductCodesCount="repeatProductCodesCount"
222
+ :insufficientProductCodeJson="insufficientProductCodeJson"
223
+ :isDiablo="isDiablo"
224
+ channel="materialComponent"
225
+ @cancleShowAddCartPopup="cancleShowAddCartPopup"
226
+ >
227
+ </dof-material-add-card>
262
228
  </div>
263
229
  </template>
264
230
 
@@ -277,17 +243,13 @@ const stream = weex.requireModule('stream')
277
243
  const dom = weex.requireModule('dom')
278
244
  import { Bridge } from 'dolphin-native-bridge'
279
245
  import Icon from './settings/icon.base64'
280
-
246
+ import dofMaterialAddCard from '../dof-material-add-card/index'
247
+ import MaterialEvent from '../material-event/index'
281
248
  import { DofOverlay, DofPopup, DofButton, DofIpxBar, DofMinibar, DofIcon, Utils, DofCell } from 'dolphin-weex-ui'
282
249
 
283
250
  export default {
284
251
  components: {
285
- // DofMinibar,
286
- // DofIcon,
287
- // DofPopup,
288
- // DofButton,
289
- // DofOverlay,
290
- // DofCell
252
+ dofMaterialAddCard
291
253
  },
292
254
  // mixins: [base],
293
255
  props: {
@@ -306,85 +268,35 @@ export default {
306
268
  columnBoxHeight: {
307
269
  type: Number,
308
270
  default: 1200 // 列展示高度
271
+ },
272
+ isDiablo: {
273
+ type: Boolean,
274
+ default: false
275
+ },
276
+ showAddCartButton: {
277
+ type: Boolean,
278
+ default: false
279
+ },
280
+ needBackground: {
281
+ type: Boolean,
282
+ default: true
309
283
  }
310
284
  },
311
285
  data() {
312
286
  return {
313
- title: '999',
314
- isIos: weex.config.env.platform == 'iOS' ? true : false,
315
- leftButton: './assets/img/material/menu_back_black@3x.png',
316
- blackCellBg: {
317
- 'background-color': '#000000'
318
- },
319
- newArr: [1, 2, 3, 4],
320
- chartJson: {
321
- frontWaveColor: '#adcafb', //已完成后的颜色默认#FFFFFF
322
- backWaveColor: '#cfdffa',
323
- animate: true,
324
- backgroundColor: '#F9F9F9', //背景色 默认为#000000
325
- progress: 0.3, // 进度 [0 ... 1]
326
- textFont: 18, //字体大小,默认为14
327
- text: '', //文本 默认为空
328
- textColor: '#267AFF' //文本颜色,默认#FFFFFF
329
- },
330
- deviceList: [],
331
- deviceIdList: [],
287
+ showAddCartPopup: false,
288
+ insufficientGoodinfoList: [],
289
+ repeatProductCodesCount: {},
290
+ insufficientProductCodeJson: {},
291
+ applianceCodes: '',
332
292
  deviceMaterialList: [],
333
- barOpacity: 0,
334
- needAuthDeviceIdList: [],
335
- circleColorList: ['#F56428', '#FFAA10', '#00A4F2'],
336
- common: {
337
- completedColor: '#f9f9f9', //已完成后的颜色默认#FFFFFF
338
- backgroundColor: '#ffffff', //背景色 默认为#000000
339
- backCircleColor: '#f9f9f9', //进度背景色,默认为#3d3d3f
340
- lineWidth: 5, //线宽 默认为2
341
- textFont: 12 //字体大小,默认为14
342
- },
343
- chartJson1: {
344
- progress: 0, // 进度 0 -1
345
- text: '', //文本 默认为空
346
- textColor: '#00A4F2' //文本颜色,默认#FFFFFF
347
- },
348
- isBottomShow4: false,
349
- isBottomShow2: false,
350
- isBottomShow: false,
351
- bgOpacity: 1,
352
- isShow: true,
353
- intervalHandler: null,
354
- step: 5,
355
- chartData: {
356
- completedColor: '#00a4f2', //环形进度条未完成后的颜色默认#267AFF
357
- incompletedColor: '#f9f9f9', //环形进度条未完成后的颜色,默认透明
358
- thickness: 3, //环形进度条宽度,默认4
359
- cornerRadius: 44, //环形的半径,默认是width/2
360
- totalCounter: 100, //环形进度条的最大值,默认是360
361
- progressCounter: 80, //设置进度值,默认是从0-360, 默认为0
362
- autoProgress: false, //设置是否需要自动执行环形进度,默认false, 如果设置为true,则每秒进度值+1操作
363
- clockwise: false, //环形自动执行进度的方向,默认是true,即顺时针方向,false为逆时针方向
364
- startingSlice: 360, //环形进度开始的起始位置,当totalCounter为360的时候,0: 0点钟位置起点,90:3点钟位置起点 180:6点钟位置起点
365
- pointShow: false, //环形进度中的进度球是否需要显示,默认不显示
366
- pointRadius: 8, //默认是环形进度宽度的一半
367
- pointColor: '#FFFFFF', //环形进度中的进度球颜色
368
- duration: 1000
369
- },
370
- // applianceSetsList: [],
371
- listPage: {
372
- pageNo: 1,
373
- pageSize: 30
374
- },
375
- hasNext: false,
376
- allList: [],
377
- isFilterShow: false,
378
- statusList: ['全部状态', '不足', '充足'],
379
293
  statusSlectedIndex: 0, // 0'全部状态', 1'不足', 2'充足'
380
- filterTopOffset: 400,
381
- isError: false,
382
- from: '',
383
- homegroupId: '',
384
- applianceCode: '',
385
294
  deviceInfo: {},
386
295
  notSmartList: [],
387
296
  arrowIcon: Icon.icon_arrow,
297
+ bgcoOne: Icon.bgco_one,
298
+ bgcoTwo: Icon.bgco_two,
299
+ bgcoThree: Icon.bgco_three,
388
300
  recommendList: [],
389
301
  recommendSliderWidth: 0,
390
302
  recommendSliderInnerWidth: 0,
@@ -394,36 +306,9 @@ export default {
394
306
  computed: {
395
307
  dealDeviceMaterialList: function() {
396
308
  return this.deviceMaterialList
397
- /* if (this.statusSlectedIndex == 1) {
398
- let list = []
399
- list = this.deviceMaterialList.filter(item => {
400
- let hasItem = item.consumables.find(it => {
401
- return it.remainingStatus == 1
402
- })
403
- if (hasItem) {
404
- return hasItem
405
- }
406
- })
407
- return list
408
- } else if (this.statusSlectedIndex == 2) {
409
- let list = []
410
- list = this.deviceMaterialList.filter(item => {
411
- let hasItem = item.consumables.find(it => {
412
- return it.remainingStatus == 2
413
- })
414
-
415
- if (hasItem) {
416
- return hasItem
417
- }
418
- })
419
- return list
420
- } else {
421
- return this.deviceMaterialList.slice(0, this.listPage.pageNo * this.listPage.pageSize)
422
- } */
423
309
  },
424
310
  getSliderList: function() {
425
311
  console.log('this.deviceMaterialList0000===' + JSON.stringify(this.deviceMaterialList))
426
-
427
312
  let newArr = []
428
313
  if (this.deviceMaterialList.length > 0) {
429
314
  if (this.deviceMaterialList[0].consumables.length > 4) {
@@ -449,811 +334,497 @@ export default {
449
334
  newArr.forEach((item, index) => {
450
335
  console.log(`getSliderList${index}====${JSON.stringify(item)}`)
451
336
  })
452
-
453
337
  return newArr
454
- }
338
+ },
455
339
  },
456
- watch: {},
457
- created() {
458
- console.log('666666666666')
459
- // nativeService.toast('7777777')
460
- // this.$bridge.showToast('7777777')
461
- // 页面埋点
462
- /* let trackParam = {
463
- event: 'user_page_view',
464
- eventParams: {
465
- page_name: '耗材列表',
466
- page_id: 'consumables_list',
467
- module: '耗材管理'
468
- }
469
- }
470
- nativeService.trackEvent(trackParam)
471
- this.from = nativeService.getParameters('from') || '' */
472
-
473
- this.getDeviceInfo()
474
- // this.getHomegroupList()
475
340
 
476
- // return
477
- /* if (this.from == 'pluginMenu') {
478
- this.homegroupId = nativeService.getParameters('homegroupId') || ''
479
- this.applianceCode = nativeService.getParameters('applianceCode') || ''
480
- console.log('applianceCode000====' + this.applianceCode)
481
-
482
- // 更多页跳转
483
- this.getDeviceInfo()
341
+ created() {
342
+ console.log('docbcaaaaaaaaaaaaa')
343
+ if (this.deviceId) {
344
+ this.applianceCodes = this.deviceId
345
+ this.getMaterialDetail()
484
346
  } else {
485
- this.getHomegroupList()
347
+ this.getDefalutDeviceInfo()
486
348
  }
487
- this.getNotSmartList() */
488
-
489
- // this.getUpkeepShopInfo()
490
-
491
- // this.getUpkeepShopInfo()
492
-
493
- // this.queryBatchMaterial()
494
- // this.getProductModel()
349
+ // this.getDeviceInfo()
495
350
  },
496
351
  methods: {
497
- // 0. 获取家庭列表V2
498
- async getHomegroupList() {
499
- const title = 'toast测试',
500
- duration = 3000,
501
- bgStyle = 'black'
502
- this.$bridge
503
- .showToast(title, duration)
504
- .then(res => {
505
- // this.$toast(res)
506
- })
507
- .catch(err => {
508
- // this.$toast(err)
509
- })
352
+ async getMaterialDetail() {
353
+ try {
354
+ const params = {
355
+ applianceCodes: [this.applianceCodes],
356
+ remainingStatusSet: ['0', '1', '2']
357
+ }
358
+ const options = {
359
+ needBackground: this.needBackground,
360
+ isDiablo: this.isDiablo
361
+ }
362
+ console.log('获取参数:'+ JSON.stringify(params))
363
+ this.deviceMaterialList = await MaterialEvent.getMaterialDetail(params, options)
364
+ console.log('获取到的耗材的数量2:'+this.deviceMaterialList.length)
365
+ this.handleChartData(this.deviceMaterialList)
366
+ this.queryInsufficientGoodsProductCodes(this.deviceMaterialList)
367
+ this.getInnerWidth()
368
+ } catch (error) {
369
+ console.log('打印的错误信息' + JSON.stringify(error))
370
+ // if (error.errorMessage && error.errorMessage != '网络错误') {
371
+ // nativeService.toast(error.errorMessage)
372
+ // }
373
+ }
374
+ },
510
375
 
511
- console.log('家庭2333333333' + JSON.stringify(this.$bridge.sendCentralCloudRequest))
376
+ handleChartData(val) {
377
+ let tempVal = JSON.parse(JSON.stringify(val))
378
+ tempVal.forEach(item => {
379
+ item.consumables.forEach(it => {
380
+ it.chartData = MaterialEvent.setChartData(it, {
381
+ isDiablo: this.isDiablo,
382
+ needBackground: this.needBackground,
383
+ isComponent: true
384
+ })
385
+ })
386
+ })
387
+ this.deviceMaterialList = tempVal
388
+ },
512
389
 
390
+ getDefalutDeviceInfo() {
513
391
  this.$bridge
514
- .sendCentralCloudRequest(
515
- '/v2/homegroup/list/get',
516
- {
517
- method: 'POST', //POST/GET, 默认POST
518
- headers: {}, //请求header
519
- data: {
520
- stamp: new Date().getTime(),
521
- reqId: utils.generateUUID()
522
- } //请求参数
523
- }
524
- // { isShowLoading: false }
525
- )
526
- .then(res => {
527
- console.log('获取家庭列表======:' + JSON.stringify(res))
528
-
529
- if (res.code == 0) {
530
- let list = res.data.homeList.map(item => {
531
- return {
532
- homegroupId: item.homegroupId
533
- }
534
- })
535
- this.homegroupList = list
536
- console.log('家庭列表result====' + JSON.stringify(this.homegroupList))
537
-
538
- this.getDeviceList()
539
- }
392
+ .getDeviceInfo({ applianceCode: this.deviceId })
393
+ .then(resp1 => {
394
+ console.log('getDeviceInfo==res==' + JSON.stringify(resp1))
395
+ this.applianceCodes = resp1.result.deviceId
396
+ this.getMaterialDetail()
540
397
  })
541
398
  .catch(err => {
542
- // this.$toast(err)
543
- console.log('wifi版本号获取失败' + JSON.stringify(err))
399
+ console.log('err====' + JSON.stringify(err))
544
400
  })
545
401
  },
546
- // 1.获取用户所有设备列表
547
- getDeviceList() {
548
- // nativeService.showLoading()
549
- const params = {
550
- familyId: '', //家庭id,
551
- roomId: '' //房间id
552
- }
553
- this.$bridge
554
- .getDeviceList()
555
- .then(res => {
556
- // this.toastInput(JSON.stringify(res))
557
- console.log('getDeviceInfo: ' + JSON.stringify(res))
558
- // nativeService.alert('获取设备列表成功:' + JSON.stringify(res))
559
- // return
560
- let list = res.list instanceof Array ? res.list : JSON.parse(JSON.stringify(res))
561
- this.deviceList = list
562
- /* this.deviceList.forEach((item, index) => {
563
- console.log('device' + index + '====' + JSON.stringify(item));
564
-
565
- }) */
566
-
567
- this.deviceIdList = list.map(item => item.deviceId)
568
- console.log('设备id列表deviceIdList: ' + JSON.stringify(this.deviceIdList))
569
- /* this.applianceSetsList = list.map(item => {
570
- // console.log('item===' + JSON.stringify(item));
571
-
572
- return{
573
- a0: item.deviceSubType,
574
- applianceCode: item.deviceId,
575
- sn8: item.deviceSn8,
576
- spid: item.smartProductId,
577
- applianceType: item.deviceType,
578
- }})
579
- console.log('设备耗材列表applianceSetsList: ' + JSON.stringify(this.applianceSetsList)) */
580
- console.log('获取设备列表成功333:' + JSON.stringify(this.deviceList))
581
-
582
- // this.deviceList.forEach(item => {
583
- // console.log('item=========' + JSON.stringify(item.deviceSn));
584
-
585
- // })
586
-
587
- // nativeService.alert(JSON.stringify(this.deviceIdList))
402
+
403
+ // 跳转耗材详情
404
+ goDetail(item, device) {
405
+ console.log('跳转前itemmmm===' + JSON.stringify(item))
406
+ console.log('跳转前device===' + JSON.stringify(device.deviceInfo))
407
+ // item.replacementMethodInfo = {}
408
+ // item.purchaseInfo = {}
588
409
 
589
- // console.log('拼接后数组000:', JSON.stringify(this.deviceList));
590
- // nativeService.alert(JSON.stringify(this.deviceMaterialList))
410
+ utils.setItem('previous_materialDetail', item)
411
+ utils.setItem('previous_deviceInfo', device.deviceInfo)
412
+ let consumables = [item]
413
+ utils.setItem('previous_consumables', consumables)
591
414
 
592
- this.queryBatchMaterial()
593
- // nativeService.hideLoading();
594
- })
595
- .catch(error => {
596
- // nativeService.hideLoading()
597
- // nativeService.toast(err.msg)
598
- // this.$alert('获取设备列表失败:' + JSON.stringify(error))
599
- })
415
+ let url = 'customer-service/materialDetail.js?from=externalPage'
416
+ let params = {
417
+ type: 'jumpWeex',
418
+ param: {
419
+ url: url,
420
+ viewTag: 'maintenance',
421
+ }
422
+ }
423
+ console.log(JSON.stringify(params))
424
+ routerModule.goToMeijuPage(params)
600
425
  },
601
- // 2.1批量获取设备耗材余量
602
- queryBatchMaterial(isFirstLoad = false) {
603
- console.log('批量获取设备耗材余量222222222' + JSON.stringify(this.homegroupList))
604
- // console.log('批量设备3333===' + JSON.stringify(utils.queryBatchMaterialByHomeGroupList()))
605
-
606
- // return new Promise((reslove, reject) => {
607
- // nativeService.queryBatchMaterial({
608
- utils
609
- .queryBatchMaterialByHomeGroupList(
610
- {
611
- homeGroupInfoList: this.homegroupList,
612
- /* applianceSets: [
613
- {applianceCode: '177021372139629',
614
- sn8: '750004D2',
615
- a0: '0',
616
- spid: '10007459',
617
- applianceType: "0xB8"}
618
- ], */
619
- remainingStatusSet: [0, 1, 2] // 余量状态, 0-已耗尽, 1-余量不足, 2-余量充足
620
- },
621
- {
622
- isShowLoading: false
623
- }
624
- )
625
- .then(async res => {
626
- console.log('请求成功88888888888')
627
-
628
- console.log('耗材余量:' + JSON.stringify(res))
629
- if (res.code == 0) {
630
- let allData = res.data
631
- let result = []
632
- allData.forEach(item1 => {
633
- console.log('item444=====' + JSON.stringify(item1.applianceConsumablesList))
634
-
635
- if (item1.applianceConsumablesList.length > 0) {
636
- result = result.concat(item1.applianceConsumablesList)
637
- }
638
- })
639
- console.log('合并后数组3333===' + JSON.stringify(result))
640
-
641
- if (result && result.length == 0) return
642
- // 遍历余量数组,相同设备id设备信息添加入该数组
643
- result.forEach(item => {
644
- let index = this.deviceList.findIndex(it => item.applianceCode == it.deviceId)
645
- console.log('device' + index + '====' + JSON.stringify(this.deviceList[index]))
646
-
647
- if (index != -1) {
648
- item.deviceId = this.deviceList[index].deviceId
649
- // item.isOnline = this.deviceList[index].isOnline
650
-
651
- // console.log('item=======isOnline' + JSON.stringify(item));
652
- item.deviceInfo = this.deviceList[index]
653
- // console.log('item=======deviceInfo' + JSON.stringify(item.deviceInfo));
654
- }
655
- })
656
- console.log('耗材余量result 000:' + JSON.stringify(result))
657
- this.needAuthDeviceIdList = result.map(item => item.deviceId)
658
- // 批量
659
- let authList = await this.getDeviceAuth()
660
- console.log('authList1111===' + JSON.stringify(authList))
661
-
662
- let newList = result.filter(x =>
663
- authList.some(
664
- y =>
665
- y.applianceCode == x.applianceCode &&
666
- (y.status == 0 || y.status == 3) &&
667
- x.consumables &&
668
- x.consumables.length > 0
669
- )
670
- )
671
- console.log('newList=======' + JSON.stringify(newList))
672
-
673
- // newArr2 = arr2.filter(x => !arr1.some(y => y.id === x.id));
674
-
675
- // this.deviceMaterialList = result
676
-
677
- if (newList.length > 30) {
678
- this.hasNext = true
679
- }
680
-
681
- this.deviceMaterialList = newList
682
- /* this.deviceMaterialEnough = newList.forEach(item => {
683
- // item.consumables[].remainingStatus == 2
684
- item.consumables.forEach
685
- return
686
- })
687
- this.deviceMaterialLack = newList */
688
-
689
- let tmpcodeList = []
690
- let circleColorList = ['#F56428', '#FFAA10', '#00A4F2']
691
- this.deviceMaterialList.forEach((item, index) => {
692
- item.consumables.forEach((it, i) => {
693
- if (it.productCode && it.productCode != 0) tmpcodeList.push(it.productCode)
694
- this.$set(this.deviceMaterialList[index].consumables[i], 'chartData', {
695
- ...this.chartData,
696
- ...{
697
- progressCounter: Number((it.remainingValue / it.total) * 100),
698
- completedColor: circleColorList[it.remainingStatus],
699
- textColor: circleColorList[it.remainingStatus]
700
- },
701
- text: Math.floor((it.remainingValue / it.total > 1 ? 1 : it.remainingValue / it.total) * 100) + '%',
702
- textSize: 12
703
- // cornerRadius: this.isIos ? 44 : 88,
704
- // thickness: this.isIos ? 3 : 6
705
- })
706
- /* it.chartData = {
707
- ...this.chartData,
708
- ...{
709
- progressCounter: Number((it.remainingValue / it.total) * 100),
710
- completedColor: circleColorList[it.remainingStatus],
711
- textColor: circleColorList[it.remainingStatus]
712
- },
713
- text: Math.floor((it.remainingValue / it.total) * 100) + '%',
714
- textSize: 12
715
- } */
716
- })
717
- })
718
- let codeList = [...new Set(tmpcodeList)]
719
- console.log('codeList9999===' + JSON.stringify(codeList))
720
-
721
- // return
722
- if (codeList && codeList.length > 20) {
723
- let groupNum = Math.ceil(codeList.length / 20)
724
- console.log('groupNum====' + groupNum)
725
426
 
726
- for (let index = 0; index < groupNum; index++) {
727
- // const element = groupNum[index];
728
-
729
- this.getUpkeepShopInfo(codeList.slice(index * 20, (index + 1) * 20))
730
- }
731
- } else {
732
- this.getUpkeepShopInfo(codeList)
733
- }
734
- this.getInnerWidth()
427
+ // 购买商品跳转
428
+ buyGoods(it, deviceInfo) {
429
+ // 1购买
430
+ if (it.btnType == 1) {
431
+ let activeUrl = it.purchaseInfo ? it.purchaseInfo.linkUrl : ''
432
+ let searchLinkUrl = it.purchaseInfo ? it.purchaseInfo.searchLinkUrl : ''
433
+ if (searchLinkUrl) {
434
+ MaterialEvent.handleSearchLinkUrlJump(searchLinkUrl)
435
+ } else if (it.purchaseInfo && it.purchaseInfo.skuId) {
436
+ this.goToGoodsDetail(it.purchaseInfo)
437
+ } else if (it.goodsInfo && (it.goodsInfo.skulink || it.goodsInfo.skuId)) {
438
+ this.goToGoodsDetail(it.goodsInfo)
439
+ } else {
440
+ if (activeUrl) {
441
+ this.goodsjumpWebViewNew(activeUrl)
735
442
  }
736
- })
737
- .catch(err => {
738
- console.log('请求余量失败:err' + JSON.stringify(err))
739
- this.$bridge.showToast(err.msg)
740
- // nativeService.toast(err.msg)
741
- this.isError = true
742
- })
743
- // })
443
+ }
444
+ } else if (it.btnType == 2) {
445
+ this.jumpNewService(0, deviceInfo)
446
+ } else if (it.btnType == 3) {
447
+ this.jumpNewService(1, deviceInfo)
448
+ } else if (it.btnType == 4) {
449
+ this.goCleanService(it, deviceInfo)
450
+ }
744
451
  },
745
- // 2.2 获取单独设备耗材余量信息
746
- async queryBatchMaterialSingle(isFirstLoad = false) {
747
- console.log('批量获取设备耗材余量222222222' + JSON.stringify(this.homegroupList))
748
452
 
453
+ goodsjumpWebViewNew(url) {
454
+ url = encodeURI(url)
749
455
  let params = {
750
- applianceCodes: [this.deviceInfo.deviceId],
751
- homegroupId: this.deviceInfo.homeId,
752
- remainingStatusSet: [0, 1, 2] // 余量状态, 0-已耗尽, 1-余量不足, 2-余量充足
456
+ type: 'jumpWebViewNew',
457
+ param: {
458
+ url: url,
459
+ needNavi: '1',
460
+ isHideNavBar: '0'
461
+ }
753
462
  }
754
- console.log('单个耗材获取2.2===' + JSON.stringify(params))
755
-
756
- // return new Promise((reslove, reject) => {
757
- // nativeService.queryBatchMaterial({
758
- utils
759
- .queryBatchMaterialByHomeId(params, {
760
- isShowLoading: false
761
- })
762
- .then(async res => {
763
- console.log('请求成功99999999999999999999999999')
764
-
765
- console.log('耗材余量222:' + JSON.stringify(res))
766
- if (res.code == 0) {
767
- let allData = res.data
768
- let result = allData[0]
769
- console.log('耗材余量result3333====' + JSON.stringify(result))
770
- // await this.getDeviceInfo()
771
- result.deviceInfo = this.deviceInfo
772
- console.log('耗材余量deviceInfo4444====' + JSON.stringify(this.deviceInfo))
773
- console.log('耗材余量result5555====' + JSON.stringify(result))
774
-
775
- result.consumables.forEach((item, index) => {
776
- console.log('consumables===item==' + JSON.stringify(item))
777
- })
778
-
779
- /* allData.forEach(item1 => {
780
- console.log('item444=====' + JSON.stringify(item1.applianceConsumablesList));
781
-
782
- if( item1.applianceConsumablesList.length > 0 ) {
783
- result = result.concat(item1.applianceConsumablesList)
784
-
785
- }
786
- })
787
- console.log('合并后数组3333===' + JSON.stringify(result)); */
788
-
789
- // return
790
- /* if( result && result.length == 0 ) return
791
- // 遍历余量数组,相同设备id设备信息添加入该数组
792
- result.forEach(item => {
793
-
794
- let index = this.deviceList.findIndex(it => item.applianceCode == it.deviceId )
795
- console.log('device' + index + '====' + JSON.stringify(this.deviceList[index]));
796
-
797
- if( index!=-1 ){
798
- item.deviceId = this.deviceList[index].deviceId
799
- // item.isOnline = this.deviceList[index].isOnline
800
-
801
- // console.log('item=======isOnline' + JSON.stringify(item));
802
- item.deviceInfo = this.deviceList[index]
803
- // console.log('item=======deviceInfo' + JSON.stringify(item.deviceInfo));
804
-
805
- }
806
-
807
- })
808
- console.log('耗材余量result 000:' + JSON.stringify(result))
809
- this.needAuthDeviceIdList = result.map(item => item.deviceId)
810
- // 批量
811
- let authList = await this.getDeviceAuth()
812
- console.log('authList1111===' + JSON.stringify(authList));
813
-
814
- let newList = result.filter(x => authList.some(y => (y.applianceCode == x.applianceCode && (y.status == 0 || y.status == 3) && (x.consumables && x.consumables.length>0) )))
815
- console.log('newList=======' + JSON.stringify(newList)); */
816
-
817
- // newArr2 = arr2.filter(x => !arr1.some(y => y.id === x.id));
818
-
819
- // this.deviceMaterialList = result
820
-
821
- /* if( newList.length > 30 ) {
822
- this.hasNext = true
823
- } */
824
-
825
- this.deviceMaterialList = [result]
826
-
827
- /* this.deviceMaterialEnough = newList.forEach(item => {
828
- // item.consumables[].remainingStatus == 2
829
- item.consumables.forEach
830
- return
831
- })
832
- this.deviceMaterialLack = newList */
833
-
834
- let tmpcodeList = []
835
- let circleColorList = ['#F56428', '#FFAA10', '#00A4F2']
836
- this.deviceMaterialList.forEach((item, index) => {
837
- item.consumables.forEach((it, i) => {
838
- if (it.productCode && it.productCode != 0) tmpcodeList.push(it.productCode)
839
- this.$set(this.deviceMaterialList[index].consumables[i], 'chartData', {
840
- ...this.chartData,
841
- ...{
842
- progressCounter: Number(
843
- (it.remainingValue / it.total > 1 ? 1 : it.remainingValue / it.total) * 100
844
- ),
845
- completedColor:
846
- it.remainingValueType == 4 && it.remainingStatus == 1
847
- ? circleColorList[0]
848
- : circleColorList[it.remainingStatus],
849
- textColor:
850
- it.remainingValueType == 4 && it.remainingStatus == 1
851
- ? circleColorList[0]
852
- : circleColorList[it.remainingStatus]
853
- },
854
- text: Math.floor((it.remainingValue / it.total > 1 ? 1 : it.remainingValue / it.total) * 100) + '%',
855
- textSize: 12,
856
- animate: true
857
- // cornerRadius: this.isIos ? 44 : 66,
858
- // thickness: this.isIos ? 3 : 6
859
- // duration: 1000
860
- })
861
- this.$set(this.deviceMaterialList[index].consumables[i], 'waveData', this.setWavePercent(it))
862
- /* it.chartData = {
863
- ...this.chartData,
864
- ...{
865
- progressCounter: Number((it.remainingValue / it.total) * 100),
866
- completedColor: circleColorList[it.remainingStatus],
867
- textColor: circleColorList[it.remainingStatus]
868
- },
869
- text: Math.floor((it.remainingValue / it.total) * 100) + '%',
870
- textSize: 12
871
- } */
872
- console.log('consumables66666666==' + JSON.stringify(it))
873
- console.log('consumables-remainingStatus==' + JSON.stringify(it.remainingStatus))
874
- })
875
- })
876
- let codeList = [...new Set(tmpcodeList)]
877
- console.log('codeList9999===' + JSON.stringify(codeList))
878
-
879
- // return
880
- if (codeList && codeList.length > 20) {
881
- let groupNum = Math.ceil(codeList.length / 20)
882
- console.log('groupNum====' + groupNum)
883
-
884
- for (let index = 0; index < groupNum; index++) {
885
- // const element = groupNum[index];
886
-
887
- this.getUpkeepShopInfo(codeList.slice(index * 20, (index + 1) * 20))
888
- }
889
- } else {
890
- this.getUpkeepShopInfo(codeList)
891
- }
463
+ routerModule.goToMeijuPage(params)
464
+ },
892
465
 
893
- this.getInnerWidth()
466
+ //跳商品详情页
467
+ goToGoodsDetail(goodsInfo) {
468
+ if (goodsInfo.skuId) {
469
+ this.$bridge.goToPage({
470
+ type: 'jumpElecBusinessWeexNew',
471
+ param: {
472
+ url: '/dist/v2/pages/product/product_details.js?skuId=' + goodsInfo.skuId + '&entrance=consumables',
473
+ needNavi: '1'
894
474
  }
895
475
  })
896
- .catch(err => {
897
- console.log('请求余量失败:err' + JSON.stringify(err))
898
- // nativeService.toast(err.msg)
899
- this.$bridge.showToast(err.msg)
900
- this.isError = true
476
+ } else {
477
+ this.$bridge.goToPage({
478
+ type: 'jumpElecBusiness',
479
+ param: {
480
+ url: goodsInfo.skulink,
481
+ needNavi: '1'
482
+ }
901
483
  })
902
- // })
484
+ }
903
485
  },
904
- // 3.获取指定设备确权状态
905
- getDeviceAuth(isFirstLoad = false) {
906
- console.log('确权id列表===' + JSON.stringify(this.needAuthDeviceIdList))
907
- console.log('确权222' + JSON.stringify(Utils.timeFormat(+new Date(), 'YYYYMMDDhhmmss')))
908
486
 
909
- return new Promise((reslove, reject) => {
910
- let params = {
911
- applianceCodeList: this.needAuthDeviceIdList
487
+ jumpNewService(type, deviceInfo) {
488
+ const sitUrl = 'https://weixincs.midea.com/apps/midea-service-meiju-sit/?pathName=appointment'
489
+ const prodUrl = 'https://cs.midea.com/c-css/front/wechat/midea-service-meiju/?pathName=appointment'
490
+ const url = weex.config.env.appEnv == 'prod' ? prodUrl : sitUrl
491
+ const routePath = type == 1 ? '/maintain' : '/maintenance'
492
+ this.$bridge.goToPage({
493
+ type: 'jumpWebViewNew',
494
+ param: {
495
+ url: `${url}${routePath}&serialNo=${deviceInfo.deviceSn}&spid=${deviceInfo.smartProductId}`,
496
+ needNavi: 0,
497
+ isShowLoading: true,
498
+ isShowRenderLoading: true,
499
+ params: {
500
+ enableScrollBar: 'NO',
501
+ enableSafeArea: 'NO'
502
+ }
912
503
  }
913
- utils
914
- .getDeviceAuth(
915
- {
916
- applianceCodeList: this.needAuthDeviceIdList,
917
- stamp: Utils.timeFormat(+new Date(), 'YYYYMMDDhhmmss'),
918
- reqId: utils.generateUUID()
919
- },
920
- {
921
- isShowLoading: !isFirstLoad
922
- }
923
- )
924
- .then(res => {
925
- console.log('设备确权列表555===' + JSON.stringify(res))
926
- reslove(res.data.applianceAuthList)
927
- })
928
- .catch(err => {
929
- console.log('设备确权列表666===' + JSON.stringify(err))
930
- reject(err)
931
- })
932
504
  })
933
505
  },
934
- // 4.批量获取耗材购买链接
935
- // 获取滤芯商品信息 测试账号:13005364612
936
- async getUpkeepShopInfo(codeList) {
937
- console.log('进来了3333')
938
- // nativeService.showLoading()
939
- let env = weex.config.env.appEnv
940
- let url = 'https://mp-sit.smartmidea.net/mas/v5/app/proxy'
941
- if (env == 'prod') url = 'https://mp-prod.smartmidea.net/mas/v5/app/proxy'
942
- url = url + '?alias=/next/mfop_item/getskuinfobyitemcodelist1'
943
- // let codeList = []
944
- // codeList.push(this.materialDetail.code)
945
-
946
- /* let tmpcodeList = []
947
- this.deviceMaterialList.forEach(item => {
948
- item.consumables.forEach(item => {
949
- if( item.productCode && item.productCode!=0 ) tmpcodeList.push(item.productCode)
950
-
951
- })
952
- })
953
- let codeList = [...new Set(tmpcodeList)] */
954
-
955
- // let codeList = ['21012500003057']
956
- // let codeList = ['21012500003057','21012500001356','21012500001377', '21012500002621','21012500001836', '21012500003477', '21012500003057']
957
- // let codeList = ["21012500003057","21012500000485","21012500001377","21012500002776","21012500002619","21012500002620","21012500002957","21012500002621","21012500002256","21012500002487","21012500000481","21012500000483","21012500003160","21012500002797","21012500003337","21012500003477"]
958
- console.log('滤芯商品列表codeList===' + JSON.stringify(codeList))
959
506
 
960
- // 测试用
961
- // codeList.push("31031040002524")
962
- let bizargs = JSON.stringify({ itemcodelist: codeList })
963
- let nonceid = utils.generateUUID()
964
- let appid = '1sic3jya0q0qlg20kl5460hmsd7jxbz8'
965
- let key = 'TUgNo2kpXQ8TUdGOjP88ljF7UX9mvSof'
966
- let version = '1.0'
967
- let sign = md5(`appid=${appid}&bizargs=${bizargs}&nonceid=${nonceid}&source=&version=${version}&key=${key}`)
968
- /* let requestParam = {
969
- appid: appid,
970
- nonceid: nonceid,
971
- version: version,
972
- sign: sign,
973
- bizargs: bizargs
974
- } */
975
- let requestParam = {
976
- /* appid: '1sic3jya0q0qlg20kl5460hmsd7jxbz8',
977
- nonceid: '8503c243-8e76-47ec-ab4a-a3e57bc903fc',
978
- version: '1.0',
979
- sign: '80f92dd038fbf3e5810454824c9d016e',
980
- bizargs: {"itemcodelist":["31031040002524"]} */
981
- appid: appid,
982
- nonceid: nonceid,
983
- version: version,
984
- sign: sign,
985
- bizargs: bizargs
507
+ goCleanService(it, deviceInfo) {
508
+ if (it.serviceSupport && it.serviceSupport.washingService && it.serviceSupport.washingService.enable) {
509
+ let activeUrl = it.serviceSupport.washingService.serviceUrl
510
+ let searchLinkUrl = it.serviceSupport.washingService.searchLinkUrl
511
+ if (searchLinkUrl) {
512
+ MaterialEvent.handleSearchLinkUrlJump(searchLinkUrl)
513
+ } else if (it.serviceSupport.washingService.skuId) {
514
+ this.goToGoodsDetail(it.serviceSupport.washingService)
515
+ } else if (
516
+ it.washingServiceGoodsInfo &&
517
+ (it.washingServiceGoodsInfo.skulink || it.washingServiceGoodsInfo.skuId)
518
+ ) {
519
+ this.goToGoodsDetail(it.washingServiceGoodsInfo)
520
+ } else {
521
+ this.goodsjumpWebViewNew(activeUrl)
522
+ }
986
523
  }
987
- console.log('请求商品链接requestParam===' + JSON.stringify(requestParam))
988
-
989
- let postBody = `appid=${requestParam.appid}&nonceid=${requestParam.nonceid}&version=${requestParam.version}&sign=${requestParam.sign}&bizargs=${requestParam.bizargs}`
990
- // const formData = new FormData()
991
- /* const formData = new FormData()
992
- Object.keys(requestParam).forEach((key) => {
993
- formData.append(key, requestParam[key])
994
- }) */
995
- console.log('postBody===' + postBody)
996
-
997
- let that = this
998
- await stream.fetch(
999
- {
1000
- method: 'POST',
1001
- // url: 'https://sitm.midea.cn/next/mfop_item/getskuinfobyitemcodelist',
1002
- // url: 'https://mp-sit.smartmidea.net/mas/v5/app/proxy?alias=/next/mfop_item/getskuinfobyitemcodelist1',
1003
- url,
1004
- // url: 'https://m.midea.cn/next/mfop_item/getskuinfobyitemcodelist',
1005
- type: 'json',
1006
- body: postBody
1007
- },
1008
- function(req) {
1009
- console.log('req1111===' + JSON.stringify(req))
1010
- // nativeService.hideLoading()
1011
- if (req.ok) {
1012
- console.log('req进来了222==' + JSON.stringify(req.data))
1013
- let data = req.data.data
1014
- // 商品信息返回为空不展示
1015
- if (JSON.stringify(data) == '{}') return
1016
-
1017
- let list = data.skuinfolist
1018
-
1019
- list.forEach((item, index) => {
1020
- console.log(`商品item==${index}==` + JSON.stringify(item))
1021
- let goodsIndex = -1
1022
- that.deviceMaterialList.forEach((it, i) => {
1023
- goodsIndex = it.consumables.findIndex(itt => {
1024
- // console.log('耗材itt33333====' + JSON.stringify(itt));
1025
-
1026
- return itt.productCode == item.itemcode
1027
- })
1028
- if (goodsIndex != -1) {
1029
- // it.consumables[goodsIndex].goodsInfo = item
1030
- that.$set(that.deviceMaterialList[i].consumables[goodsIndex], 'goodsInfo', item)
1031
- console.log('耗材item44444====' + JSON.stringify(item))
1032
- }
1033
- // console.log('商品itemmm===' + JSON.stringify(it));
1034
- })
1035
- })
1036
- // nativeService.alert(that.deviceMaterialList)
1037
-
1038
- /* that.deviceMaterialList.forEach(item => {
1039
- // console.log('itemmmmmmmmmmmmm===' + JSON.stringify(item));
1040
- item.consumables.forEach(itt => {
1041
- console.log('itt======' + JSON.stringify(itt));
1042
- if( itt.code == '21012500001836' ) {
1043
- nativeService.alert(itt.goodsInfo)
524
+ },
1044
525
 
1045
- }
1046
- })
526
+ setWavePercent(item) {
527
+ return MaterialEvent.setWavePercent(item, this.isDiablo, this.needBackground, { needChangeColor: true })
528
+ },
1047
529
 
1048
- // console.log('itemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm===' + JSON.stringify(item));
1049
- }) */
1050
- // nativeService.alert(that.deviceMaterialList)
530
+ // 设置波浪百分比
531
+ setWavePercentDetail(item) {
532
+ if( item.remainingValue || item.remainingValue == 0 ){
533
+ let percent = this.dealDeviceMaterialList[0].deviceInfo.isOnline == 1 ? item.percent / 100 : 0
534
+ let type = item.remainingStatus
535
+ let percentTxt = item.percent
536
+ let textColorList = ['#F56428', '#FFAA10', '#ffffff']
537
+ let frontColorList = ['#fd895c', '#ffd262', '#49c4fc']
538
+ let backColorList = ['#f56b35', '#ffb823', '#4baeff']
539
+
540
+ // 判断显示类型
541
+ if( item.remainingValueType == 4 ) {
542
+ percent = item.remainingStatus == 2 ?0.8 : 0.1
543
+ percentTxt = type == 2 ? '充足' : '不足'
544
+ textColorList = ['#FF6A4C', '#FF6A4C', '#00A4F2']
545
+ frontColorList = ['#fd895c', '#fd895c', '#49c4fc']
546
+ backColorList = ['#f56b35', '#f56b35', '#4baeff']
547
+ }
1051
548
 
1052
- // nativeService.alert(list)
1053
- // 商品状态(1---下架 2---上架)
1054
- // 下架商品不展示
1055
- /* if (list[0].state == 1) return
1056
- that.hasPurchase = true
1057
- // 购买展示页面埋点
1058
- let trackParam = {
1059
- event: 'user_page_view',
1060
- eventParams: {
1061
- page_name: '商品展示',
1062
- page_id: 'product_display',
1063
- module: '耗材管理',
1064
- // widget_name: '商品展示',
1065
- // widget_id: 'product_display',
1066
- ext_info: {
1067
- plugin_type: that.deviceInfo.deviceTypeName || ''
1068
- }
1069
- }
1070
- }
1071
- // nativeService.alert(JSON.stringify(trackParam))
1072
- nativeService.trackEvent(trackParam)
549
+ if( percent > 0.2 && percent <= 0.5 ){
550
+ textColorList = ['#00A4F2', '#00A4F2', '#00A4F2']
551
+ }
1073
552
 
1074
- that.shopDetail = list[0]
1075
- console.log('商品详情::' + JSON.stringify(that.shopDetail)) */
1076
- }
1077
- /* if(!req.ok){
1078
- self.postResult = "request failed";
1079
- }else{
1080
- console.log('get:'+JSON.stringify(req));
1081
- self.postResult = JSON.stringify(req.data);
1082
- } */
1083
- },
1084
- function(response) {
1085
- // console.log('get in progress:'+response.length);
1086
- // self.postResult = "bytes received:"+response.length;
1087
- // nativeService.hideLoading()
1088
- console.log('req222===' + JSON.stringify(response))
553
+ console.log('最终的wave:'+ JSON.stringify({
554
+ frontWaveColor: frontColorList[type], //已完成后的颜色默认#FFFFFF
555
+ backWaveColor: backColorList[type],
556
+ animate: true,
557
+ backgroundColor: '', //背景色 默认为#000000
558
+ progress: percent < 0.01 && percent != 0 ? 0.01 : percent, //s 进度 [0 ... 1]
559
+ textFont: 12, //字体大小,默认为14
560
+ text: percentTxt, //文本 默认为空
561
+ textColor: textColorList[type], //文本颜色,默认#FFFFFF
562
+ unit: '%', //单位
563
+ unitTextSize: 8, //单位字体大小,默认为12
564
+ unitTextColor: textColorList[type], //单位文本颜色,默认#267AFF
565
+ unitAlignType: 'bottom', //单位对齐文本的方式,top顶部 center居中(默认值) bottom底部
566
+ duration: 1000
567
+ }))
568
+
569
+ return {
570
+ frontWaveColor: frontColorList[type], //已完成后的颜色默认#FFFFFF
571
+ backWaveColor: backColorList[type],
572
+ animate: true,
573
+ backgroundColor: '', //背景色 默认为#000000
574
+ progress: percent < 0.01 && percent != 0 ? 0.01 : percent, //s 进度 [0 ... 1]
575
+ textFont: 12, //字体大小,默认为14
576
+ text: percentTxt, //文本 默认为空
577
+ textColor: textColorList[type], //文本颜色,默认#FFFFFF
578
+ unit: '%', //单位
579
+ unitTextSize: 8, //单位字体大小,默认为12
580
+ unitTextColor: textColorList[type], //单位文本颜色,默认#267AFF
581
+ unitAlignType: 'bottom', //单位对齐文本的方式,top顶部 center居中(默认值) bottom底部
582
+ duration: 1000
1089
583
  }
1090
- )
1091
- },
1092
- // 获取单个设备信息
1093
- getDeviceInfo() {
1094
- // return new Promise((resolve, reject) => {
1095
- this.$bridge
1096
- .getDeviceInfo({ applianceCode: this.deviceId })
1097
- .then(resp1 => {
1098
- // this.$bridge.showToast(JSON.stringify(resp1))
1099
- console.log('getDeviceInfo==res==' + JSON.stringify(resp1))
1100
- this.deviceInfo = resp1.result
1101
- this.queryBatchMaterialSingle()
1102
- // nativeService.toast(JSON.stringify(this.deviceInfo))
1103
- // resolve()
1104
- })
1105
- .catch(err => {
1106
- // this.$bridge.showToast(JSON.stringify(err))
1107
- console.log('err====' + JSON.stringify(err))
1108
- // reject()
1109
- })
1110
- // })
1111
- },
1112
- // 设置波浪百分比
1113
- setWavePercent(item) {
1114
- // remainingStatus 0-已耗尽,1-余量不足,2-余量充足
1115
- let percent = Number(item.remainingValue / item.total)
1116
- // let type = item.remainingValue > item.lowLevelAlertThreshold?0:((item.remainingValue <= item.lowLevelAlertThreshold && item.remainingValue!=0)?1:2)
1117
- let type = item.remainingStatus
1118
584
 
1119
- // let textColorList = ['#00A4F2', '#FFAA10', '#F56428']
1120
- // let frontColorList = ['#9fdaf5', '#FFAA10', '#F56428']
1121
- // let backColorList = ['#c7e8f7', '#fcc77c', '#fc9791']
1122
- let textColorList = ['#F56428', '#FFAA10', '#00A4F2']
1123
- let frontColorList = ['#F56428', '#fdbd49', '#9fdaf5']
1124
- let backColorList = ['#fc9791', '#fcd184', '#c7e8f7']
1125
- let percentTxt = ''
1126
- // 判断显示类型
1127
- if (item.remainingValueType == 4) {
1128
- percentTxt = item.remainingStatus == 2 ? '充足' : '不足'
1129
- percent = item.remainingStatus == 2 ? 0.4 : 0.05
1130
- textColorList = ['#F56428', '#F56428', '#00A4F2']
1131
- frontColorList = ['#F56428', '#F56428', '#9fdaf5']
1132
- backColorList = ['#fc9791', '#fc9791', '#c7e8f7']
1133
- } else {
1134
- percentTxt = Math.floor(percent * 100) + '%'
585
+ }else {
586
+ return {
587
+ backgroundColor: '#e9f1ff', //背景色 默认为#000000
588
+ frontWaveColor: '#e9f1ff', //已完成后的颜色默认#FFFFFF
589
+ backWaveColor: '#e9f1ff',
590
+ progress: 0,
591
+ animate: false,
592
+ text: '', //文本 默认为空
593
+ }
1135
594
  }
595
+ },
1136
596
 
1137
- return {
1138
- frontWaveColor: frontColorList[type], //已完成后的颜色默认#FFFFFF
1139
- backWaveColor: backColorList[type],
1140
- animate: true,
1141
- backgroundColor: '#F9F9F9', //背景色 默认为#000000
1142
- progress: percent, // 进度 [0 ... 1]
1143
- textFont: 11, //字体大小,默认为14
1144
- text: percentTxt, //文本 默认为空
1145
- textColor: textColorList[type], //文本颜色,默认#FFFFFF
1146
- duration: 1000
597
+ showGoodsList() {
598
+ this.showAddCartPopup = true
599
+ let trackParam = {
600
+ event: 'user_behavior_event',
601
+ eventParams: {
602
+ page_name: '耗材信息页',
603
+ page_id: 'page_consumables_information',
604
+ event_name: 'user_behavior_event',
605
+ module: '插件耗材组件',
606
+ widget_name: '点击立即购买',
607
+ widget_id: 'click_buy_Now',
608
+ }
1147
609
  }
610
+ this.$bridge.trackEvent(trackParam)
1148
611
  },
1149
- // 跳转前节流
1150
- /* goDetailThrottle: throttle(
1151
- function(item, device) {
1152
- console.log('goDetailThrottle1111111')
1153
612
 
1154
- this.goDetail(item, device)
1155
- },
1156
- 2000,
1157
- { leading: true, trailing: false }
1158
- ), */
1159
- // 跳转耗材详情
1160
- goDetail(item, device) {
1161
- console.log('跳转前itemmmm===' + JSON.stringify(item))
1162
- console.log('跳转前device===' + JSON.stringify(device.deviceInfo))
1163
- item.replacementMethodInfo = {}
1164
- item.purchaseInfo = {}
1165
-
1166
- utils.setItem('previous_materialDetail', item)
1167
- utils.setItem('previous_deviceInfo', device.deviceInfo)
1168
-
1169
- // let url = `customer-service/materialDetail.js?materialDetail=${encodeURIComponent(
1170
- // JSON.stringify(item)
1171
- // )}&deviceInfo=${encodeURIComponent(JSON.stringify(device.deviceInfo))}`
1172
- let url = 'customer-service/materialDetail.js?from=externalPage'
1173
- let params = {
1174
- type: 'jumpWeex',
1175
- param: {
1176
- url: url,
1177
- viewTag: 'maintenance',
1178
- bgColor: this.isColmo ? '#000000' : '#ffffff',
1179
- pageBackgroundColor: this.isColmo ? '#000000' : '#ffffff'
613
+ async queryInsufficientGoodsProductCodes(insufficientMaterialList) {
614
+ let tempGoodsProductCodes = []
615
+ let skuIdList = []
616
+ let insufficientProductCodeJson = {}
617
+ let isServiceSupportProductCodeArr = []
618
+ insufficientMaterialList.forEach(item => {
619
+ item.consumables.forEach(item1 => {
620
+ console.log('耗材不足的商品c:' + JSON.stringify(item1.purchaseInfo))
621
+ // if(item1.purchaseInfo && item1.purchaseInfo.purchaseEnable && item1.purchaseInfo.skuId){
622
+ // skuIdList.push(item1.purchaseInfo.skuId)
623
+ // }
624
+ if (
625
+ item1.purchaseInfo &&
626
+ item1.purchaseInfo.purchaseEnable &&
627
+ item1.purchaseInfo.productCodes &&
628
+ Array.isArray(item1.purchaseInfo.productCodes) &&
629
+ item1.purchaseInfo.productCodes.length > 0
630
+ ) {
631
+ if (item1.purchaseInfo.productCodes[0] != '') {
632
+ insufficientProductCodeJson[item1.purchaseInfo.productCodes[0]] = this.judgeInsufficientProductCode(
633
+ item1,
634
+ item
635
+ )
636
+ tempGoodsProductCodes.push(item1.purchaseInfo.productCodes[0])
637
+ }
638
+ }
639
+ console.log('耗材不足的商品c:' + JSON.stringify(item1.serviceSupport))
640
+ // if(item1.serviceSupport && item1.serviceSupport.washingService && item1.serviceSupport.washingService.enable && item1.serviceSupport.washingService.skuId){
641
+ // skuIdList.push(item1.serviceSupport.washingService.skuId)
642
+ // }
643
+ if (
644
+ item1.serviceSupport &&
645
+ item1.serviceSupport.washingService &&
646
+ item1.serviceSupport.washingService.enable &&
647
+ item1.serviceSupport.washingService.productCode
648
+ ) {
649
+ insufficientProductCodeJson[
650
+ item1.serviceSupport.washingService.productCode
651
+ ] = this.judgeInsufficientProductCode(item1, item)
652
+ isServiceSupportProductCodeArr.push(item1.serviceSupport.washingService.productCode)
653
+ }
654
+ })
655
+ //去重清洗单个设备清洗服务中的商品code
656
+ tempGoodsProductCodes.push(...new Set(isServiceSupportProductCodeArr))
657
+ })
658
+ console.log('耗材不足的商品1c:' + JSON.stringify(tempGoodsProductCodes))
659
+ console.log('耗材不足的商品2c:' + JSON.stringify(skuIdList))
660
+ console.log('耗材不足的商品3c:' + JSON.stringify(insufficientProductCodeJson))
661
+ let repeatProductCodesCount = {}
662
+ tempGoodsProductCodes.forEach(item => {
663
+ if (repeatProductCodesCount[item]) {
664
+ repeatProductCodesCount[item]++
665
+ } else {
666
+ repeatProductCodesCount[item] = 1
1180
667
  }
668
+ })
669
+ let goodsProductCodes = [...new Set(tempGoodsProductCodes)]
670
+ let skuinfolist = []
671
+ if (goodsProductCodes && goodsProductCodes.length > 20) {
672
+ let groupNum = Math.ceil(goodsProductCodes.length / 20)
673
+ for (let index = 0; index < groupNum; index++) {
674
+ try {
675
+ const resSuccessMap = await this.querySkuIdByItemCodes(
676
+ goodsProductCodes.slice(index * 20, (index + 1) * 20)
677
+ )
678
+ this.handleSkuinfolist(skuinfolist, resSuccessMap, goodsProductCodes)
679
+ } catch (error) {
680
+ continue
681
+ }
682
+ }
683
+ } else {
684
+ try {
685
+ if (goodsProductCodes.length > 0) {
686
+ const resSuccessMap = await this.querySkuIdByItemCodes(goodsProductCodes)
687
+ this.handleSkuinfolist(skuinfolist, resSuccessMap, goodsProductCodes)
688
+ }
689
+ } catch (error) {}
1181
690
  }
1182
- console.log(JSON.stringify(params))
1183
- routerModule.goToMeijuPage(params)
1184
- // this.$bridge.goToPage(params)
1185
691
 
1186
- // utils.setItem('materialDetail', item)
692
+ console.log('获取到的商品信息1c:' + JSON.stringify(skuinfolist))
693
+
694
+ //通过商城编码查询新商品skuId
695
+ // let itemCodeList = skuinfolist.map(item=>item.itemcode)
696
+ // try {
697
+ // const resSkuIdList = await this.querySkuIdByItemCodes(itemCodeList)
698
+ // if(resSkuIdList.code == '000000'){
699
+ // skuinfolist.forEach(item => {
700
+ // if(resSkuIdList.data && resSkuIdList.data.successMap){
701
+ // item.skuId = resSkuIdList.data.successMap[item.itemcode] ? resSkuIdList.data.successMap[item.itemcode].skuId : ''
702
+ // }
703
+ // })
704
+ // }
705
+ // } catch (error) {
706
+
707
+ // }
708
+
709
+ this.repeatProductCodesCountAddSkuid(skuinfolist, skuIdList, repeatProductCodesCount)
710
+
711
+ if (skuinfolist.length > 0 || skuIdList.length > 0) {
712
+ this.showAddCart = true
713
+ this.insufficientGoodinfoList = skuinfolist
714
+ this.insufficientProductCodeJson = insufficientProductCodeJson
715
+ } else {
716
+ this.showAddCart = false
717
+ }
1187
718
  },
1188
- // 购买商品跳转
1189
- buyGoods(url, materialDetail, deviceInfo) {
1190
- // console.log('goodsInfo=====' + JSON.stringify(goodsInfo));
1191
719
 
1192
- // 购买事件埋点
1193
- /* if( materialDetail ){
1194
- if( isNosmart ){
1195
- let trackParam = {
1196
- event: 'user_behavior_event',
1197
- eventParams: {
1198
- page_name: '耗材列表',
1199
- page_id: 'consumables_list',
1200
- event_name: 'user_behavior_event',
1201
- module: '耗材管理',
1202
- widget_name: '配件购买点击',
1203
- widget_id: 'accessory_click',
1204
- ext_info: {
1205
- plugin_type: deviceInfo.deviceTypeName || '',
1206
- sn8: deviceInfo.deviceSn8 || '',
1207
- spid: deviceInfo.smartProductId || '',
1208
- A0: deviceInfo.deviceSubType || '',
1209
- name: materialDetail.name,
1210
- remainingValue: materialDetail.remainingValue,
720
+ //处理商品信息
721
+ handleSkuinfolist(skuinfolist, resSuccessMap, codeList) {
722
+ if (resSuccessMap.code == '000000') {
723
+ codeList.forEach(item => {
724
+ if (resSuccessMap.data && resSuccessMap.data.successMap) {
725
+ if (resSuccessMap.data.successMap[item] && resSuccessMap.data.successMap[item].skuId) {
726
+ console.log('获取到的图片信息c:' + JSON.stringify(resSuccessMap.data.successMap[item].mainPicList))
727
+ if (
728
+ resSuccessMap.data.successMap[item].mainPicList &&
729
+ resSuccessMap.data.successMap[item].mainPicList.length > 0
730
+ ) {
731
+ resSuccessMap.data.successMap[item].mainPicList.forEach(item1 => {
732
+ console.log('获取到的图片信息c:' + JSON.stringify(item1))
733
+ if (item1.imageSort == 1) {
734
+ resSuccessMap.data.successMap[item].picInfo = item1.imageUrl
735
+ }
736
+ })
1211
737
  }
738
+ skuinfolist.push(resSuccessMap.data.successMap[item])
1212
739
  }
1213
740
  }
1214
- console.log('非智埋点===trackParam==' + JSON.stringify(trackParam));
741
+ })
742
+ }
743
+ },
1215
744
 
1216
- nativeService.trackEvent(trackParam)
1217
- }else {
1218
- let trackParam = {
1219
- event: 'user_behavior_event',
1220
- eventParams: {
1221
- page_name: '耗材列表',
1222
- page_id: 'consumables_list',
1223
- module: '耗材管理',
1224
- widget_name: '购买',
1225
- widget_id: 'buy',
1226
- ext_info: {
1227
- plugin_type: deviceInfo.deviceTypeName || '',
1228
- sn8: deviceInfo.deviceSn8 || '',
1229
- spid: deviceInfo.smartProductId || '',
1230
- A0: deviceInfo.deviceSubType || '',
1231
- name: materialDetail.name,
1232
- remainingValue: materialDetail.remainingValue,
1233
- }
1234
- }
745
+ repeatProductCodesCountAddSkuid(skuinfolist, skuIdList, repeatProductCodesCount) {
746
+ let newSkuIdList = [] //剔除已经有商品信息的数据,用此去请求新的商品信息接口
747
+ skuIdList.forEach(item => {
748
+ let hasSkuInfo = false
749
+ skuinfolist.forEach(item1 => {
750
+ if (item == item1.skuId) {
751
+ repeatProductCodesCount[item1.itemcode]++
752
+ hasSkuInfo = true
1235
753
  }
1236
- console.log('管理页-购买商品埋点====' + JSON.stringify(trackParam));
1237
- nativeService.trackEvent(trackParam)
1238
-
754
+ })
755
+ if (!hasSkuInfo) {
756
+ newSkuIdList.push(item)
1239
757
  }
758
+ })
759
+ this.repeatProductCodesCount = repeatProductCodesCount
760
+ },
1240
761
 
762
+ judgeInsufficientProductCode(consumable, device) {
763
+ if (
764
+ (consumable.remainingStatus == 1 || consumable.remainingStatus == 0) &&
765
+ consumable.remainingValue != null &&
766
+ device.deviceInfo &&
767
+ device.deviceInfo.isOnline == 1 &&
768
+ consumable.remainingValueType != 5
769
+ ) {
770
+ return true
771
+ }
772
+ return false
773
+ },
1241
774
 
1242
- } */
1243
-
1244
- this.$bridge.goToPage({
1245
- type: 'jumpElecBusiness',
1246
- param: {
1247
- // url: 'midea-meiju://com.midea.meiju/main?type=jumpElecBusiness&url=https://m.midea.cn/detail/index?itemid=10000000010010731003999'
1248
- // url: 'https://m.midea.cn/detail/index?itemid=10000000010010731003999',
1249
- url,
1250
- needNavi: '1'
775
+ async querySkuIdByItemCodes(itemCodeList) {
776
+ return new Promise(async (resolve, reject) => {
777
+ try {
778
+ const res = await utils.querySkuIdByItemCodes(
779
+ {
780
+ restParams: {
781
+ itemCodeList: [...new Set(itemCodeList)]
782
+ }
783
+ },
784
+ {
785
+ isShowLoading: false
786
+ }
787
+ )
788
+ console.log('获取商品id成功c:' + JSON.stringify(res))
789
+ resolve(res)
790
+ } catch (error) {
791
+ console.log('获取商品id失败c:' + JSON.stringify(error))
792
+ reject(error)
1251
793
  }
1252
794
  })
1253
795
  },
796
+
797
+ cancleShowAddCartPopup() {
798
+ this.showAddCartPopup = false
799
+ let trackParam = {
800
+ event: 'user_behavior_event',
801
+ eventParams: {
802
+ page_name: '耗材购买弹窗',
803
+ page_id: 'consumables_purchase_pop-up',
804
+ event_name: 'user_behavior_event',
805
+ module: '插件耗材组件',
806
+ widget_name: '关闭弹窗',
807
+ widget_id: 'click_to_close_pop-up',
808
+ }
809
+ }
810
+ this.$bridge.trackEvent(trackParam)
811
+ },
812
+
813
+ showBgco(item){
814
+ const bgcoArr = [this.bgcoOne,this.bgcoTwo,this.bgcoThree]
815
+ return bgcoArr[item.remainingStatus]
816
+ },
817
+
1254
818
  scrollEvent1(e) {
1255
819
  // console.log('scrollEvent===' + JSON.stringify(e))
1256
- this.recommendSliderInnerLeft = -(32 / this.recommendSliderWidth) * e.contentOffset.x
820
+ console.log('偏移量'+ (this.recommendSliderWidth - (686 + -e.contentOffset.x)))
821
+ if(this.recommendSliderWidth - (686 + -e.contentOffset.x) < 30){
822
+ // 判断滚动后离尾端距离小于30则滑动条直接到最右边
823
+ this.recommendSliderInnerLeft = 16
824
+ }else{
825
+ this.recommendSliderInnerLeft = -(32 / this.recommendSliderWidth) * (e.contentOffset.x)
826
+ }
827
+
1257
828
  console.log('recommendSliderInnerLeft===' + this.recommendSliderInnerLeft)
1258
829
  },
1259
830
  getInnerWidth() {
@@ -1262,6 +833,7 @@ export default {
1262
833
  setTimeout(() => {
1263
834
  dom.getComponentRect(this.$refs.recommendBox, data => {
1264
835
  this.recommendSliderWidth = data.size.width
836
+ console.log('元素的宽度'+this.recommendSliderWidth)
1265
837
  this.recommendSliderInnerWidth = 32
1266
838
  console.log('recommendSliderWidth====' + this.recommendSliderWidth)
1267
839
  console.log('recommendSliderInnerWidth====' + this.recommendSliderInnerWidth)
@@ -1273,3 +845,4 @@ export default {
1273
845
  </script>
1274
846
 
1275
847
  <style src="./assets/css/index.css" />
848
+ <style src="./assets/css/index_diablo.css" />