jufubao-takeorder 1.0.2-beta7 → 1.0.2-beta9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-takeorder",
3
- "version": "1.0.2-beta7",
3
+ "version": "1.0.2-beta9",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -23,13 +23,19 @@
23
23
  <view class="menu_wrap" :style="[menuWrapBoxStyle]">
24
24
  <view class="jfb-takeorder-index__body-filter">
25
25
  <view
26
- :style="{ color: (filterType === 'province' || selectedProvs.length > 0) ? mainColor : '' }"
26
+ :style="{
27
+ color:
28
+ filterType === 'province' || selectedProvs.length > 0
29
+ ? mainColor
30
+ : '',
31
+ }"
27
32
  @click="handleSwitchFilter('province')"
28
33
  class="jfb-takeorder-index__body-filter-item"
29
- >
30
- <view v-if="selectedProvs.length===0">省份</view
31
- >
32
- <view v-else class="jfb-takeorder-index__body-filter-text">{{ selectedProvsName.join('') }}</view>
34
+ >
35
+ <view v-if="selectedProvs.length === 0">省份</view>
36
+ <view v-else class="jfb-takeorder-index__body-filter-text">{{
37
+ selectedProvsName.join("")
38
+ }}</view>
33
39
  <XdFontIcon
34
40
  style="font-weight: bolder"
35
41
  size="20"
@@ -37,11 +43,18 @@
37
43
  ></XdFontIcon
38
44
  ></view>
39
45
  <view
40
- :style="{ color: (filterType === 'city' || selectedCity.length > 0) ? mainColor : '' }"
46
+ :style="{
47
+ color:
48
+ filterType === 'city' || selectedCity.length > 0
49
+ ? mainColor
50
+ : '',
51
+ }"
41
52
  @click="handleSwitchFilter('city')"
42
53
  class="jfb-takeorder-index__body-filter-item"
43
- ><view v-if="selectedCity.length===0">城市</view
44
- ><view v-else class="jfb-takeorder-index__body-filter-text">{{ selectedCityName.join('') }}</view>
54
+ ><view v-if="selectedCity.length === 0">城市</view
55
+ ><view v-else class="jfb-takeorder-index__body-filter-text">{{
56
+ selectedCityName.join("")
57
+ }}</view>
45
58
  <XdFontIcon
46
59
  style="font-weight: bolder"
47
60
  size="20"
@@ -49,11 +62,18 @@
49
62
  ></XdFontIcon
50
63
  ></view>
51
64
  <view
52
- :style="{ color: (filterType === 'brand' || selectedBrands.length > 0) ? mainColor : '' }"
65
+ :style="{
66
+ color:
67
+ filterType === 'brand' || selectedBrands.length > 0
68
+ ? mainColor
69
+ : '',
70
+ }"
53
71
  @click="handleSwitchFilter('brand')"
54
72
  class="jfb-takeorder-index__body-filter-item"
55
- ><view v-if="selectedBrands.length===0">品牌</view
56
- ><view v-else class="jfb-takeorder-index__body-filter-text">{{ selectedBrandsName.join('') }}</view>
73
+ ><view v-if="selectedBrands.length === 0">品牌</view
74
+ ><view v-else class="jfb-takeorder-index__body-filter-text">{{
75
+ selectedBrandsName.join("")
76
+ }}</view>
57
77
  <XdFontIcon
58
78
  style="font-weight: bolder"
59
79
  size="20"
@@ -228,7 +248,7 @@ export default {
228
248
  page_token: 1,
229
249
  hasNext: true,
230
250
  next_page_token: "",
231
- max_id: null,
251
+ max_id: 0,
232
252
  order_detail_path: "",
233
253
  isPreview: false,
234
254
  isOpenNew: "N",
@@ -343,7 +363,9 @@ export default {
343
363
  // 只有当有选择时,才添加筛选参数,如果选择了 'all' 则不传
344
364
  if (this.selectedProvs && this.selectedProvs.length > 0) {
345
365
  // 如果只有一个选项且为 'all',则不传 province_codes
346
- if (!(this.selectedProvs.length === 1 && this.selectedProvs[0] === 'all')) {
366
+ if (
367
+ !(this.selectedProvs.length === 1 && this.selectedProvs[0] === "all")
368
+ ) {
347
369
  params.province_codes = this.selectedProvs;
348
370
  }
349
371
  }
@@ -496,13 +518,16 @@ export default {
496
518
  * 处理子组件派发的 'expire' 事件
497
519
  * 订单倒计时结束后,从列表中删除该订单
498
520
  */
499
- handleOrderExpire(orderId) {
521
+ handleOrderExpire(order) {
500
522
  if (this.isPreview) return;
501
523
  const orderIndex = this.orderList.findIndex(
502
- (item) => item.order_id === orderId
524
+ (item) => item.order_id === order.order_id
503
525
  );
504
526
  if (orderIndex === -1) return;
505
-
527
+ if (order.user_quotation_status === "quoted") {
528
+ this.handleRefresh();
529
+ return;
530
+ }
506
531
  // 从列表中删除该订单
507
532
  this.orderList.splice(orderIndex, 1);
508
533
  },
@@ -574,7 +599,7 @@ export default {
574
599
  vm: this,
575
600
  data: {
576
601
  order_type: this.order_type,
577
- max_id: this.max_id || 0,
602
+ max_id: this.max_id,
578
603
  },
579
604
  })
580
605
  .then((res) => {
@@ -608,7 +633,9 @@ export default {
608
633
  });
609
634
  }
610
635
  }
611
- this.max_id = res.new_order_max_id;
636
+ if (res.new_order_max_id > this.max_id) {
637
+ this.max_id = res.new_order_max_id;
638
+ }
612
639
  this.showNew = res.is_exist_new_order;
613
640
  })
614
641
  .catch((err) => {
@@ -698,10 +725,7 @@ export default {
698
725
  }
699
726
  },
700
727
  onJfbShow(options) {
701
- // 页面显示时恢复轮询
702
- if (!this.pollTimer) {
703
- this.startPolling();
704
- }
728
+ this.onJfbLoad(options);
705
729
  console.log("event.onJfbShow", options);
706
730
  },
707
731
  onJfbHide(options) {
@@ -27,9 +27,8 @@
27
27
  >
28
28
  <view
29
29
  v-if="
30
- (info.user_quotation_status === 'received' ||
31
- info.user_quotation_status === 'win_order') &&
32
- info.order_status !== 'close'
30
+ info.user_quotation_status === 'received' ||
31
+ info.user_quotation_status === 'win_order'
33
32
  "
34
33
  class="jfb-takeorder-order-detail__countdown-banner"
35
34
  :style="{ backgroundColor: mainColor }"
@@ -58,7 +57,7 @@
58
57
  v-if="
59
58
  info.user_quotation_status === 'wait_quote' ||
60
59
  info.user_quotation_status === 'quoted' ||
61
- info.order_status === 'close' ||
60
+ info.user_quotation_status === 'close' ||
62
61
  info.user_quotation_status === 'cancel_quotation'
63
62
  "
64
63
  class="wrap"
@@ -68,7 +67,7 @@
68
67
  v-if="
69
68
  step === 1 ||
70
69
  info.user_quotation_status === 'quoted' ||
71
- info.order_status === 'close'
70
+ info.user_quotation_status === 'close'
72
71
  "
73
72
  >
74
73
  <view>市场原价(仅供参考)</view>
@@ -91,7 +90,7 @@
91
90
  v-if="
92
91
  step === 1 ||
93
92
  info.user_quotation_status === 'quoted' ||
94
- info.order_status === 'close'
93
+ info.user_quotation_status === 'close'
95
94
  "
96
95
  >
97
96
  <view>报价人数</view>
@@ -102,7 +101,7 @@
102
101
  v-if="
103
102
  step === 1 ||
104
103
  info.user_quotation_status === 'quoted' ||
105
- info.order_status === 'close'
104
+ info.user_quotation_status === 'close'
106
105
  "
107
106
  >
108
107
  <view>报价倒计时</view>
@@ -158,9 +157,7 @@
158
157
  (info.user_quotation_status === 'cancel_quotation' ||
159
158
  info.user_quotation_status === 'wait_quote' ||
160
159
  info.user_quotation_status === 'quoted') &&
161
- step !== 2 &&
162
- info.order_status !== 'reported' &&
163
- info.order_status !== 'close'
160
+ step !== 2
164
161
  "
165
162
  >
166
163
  <view class="quote-title">订单报价</view>
@@ -185,8 +182,8 @@
185
182
  <view
186
183
  class="wrap upload"
187
184
  v-if="
188
- info.user_quotation_status === 'received' &&
189
- info.order_status !== 'close'
185
+ info.user_quotation_status === 'received' ||
186
+ info.user_quotation_status === 'reported'
190
187
  "
191
188
  >
192
189
  <view class="voucher" v-if="voucherImages && voucherImages.length > 0">
@@ -223,7 +220,7 @@
223
220
  </view>
224
221
  </view>
225
222
  </view>
226
- <view style="display: flex; justify-content: center">
223
+ <view v-if="info.user_quotation_status === 'received'" style="display: flex; justify-content: center">
227
224
  <xd-upload
228
225
  @on-done="handleUploadDone"
229
226
  selectType="image"
@@ -242,7 +239,7 @@
242
239
  >
243
240
  </xd-upload>
244
241
  </view>
245
- <view class="upload-notice">
242
+ <view v-if="info.user_quotation_status === 'received'" class="upload-notice">
246
243
  <text>请务必按真实报单并仔细校对取餐码正确无误,</text>
247
244
  <text :style="{ color: mainColor }"
248
245
  >取餐码错误或未上报真实取餐码造成客诉产生损失将由您承担!</text
@@ -251,9 +248,9 @@
251
248
  </view>
252
249
  <view
253
250
  v-if="
254
- (info.order_status === 'close' || info.order_status === 'quoting') &&
255
- notice &&
256
- info.user_quotation_status !== 'received'
251
+ (info.user_quotation_status === 'close' ||
252
+ info.user_quotation_status === 'quoted') &&
253
+ notice
257
254
  "
258
255
  class="special-tip wrap"
259
256
  style="padding: 24rpx 32rpx"
@@ -273,7 +270,10 @@
273
270
  <view v-if="!isCountdownEnd" :style="{ height: '100rpx' }"></view>
274
271
  <view
275
272
  :key="info.user_quotation_status"
276
- v-if="info.order_status !== 'close' && info.order_status !== 'reported'"
273
+ v-if="
274
+ info.user_quotation_status !== 'close' &&
275
+ info.user_quotation_status !== 'reported'
276
+ "
277
277
  class="fixe_bottom"
278
278
  :style="prod_bottom"
279
279
  >
@@ -478,7 +478,7 @@ export default {
478
478
  // 上报倒计时定时器标识
479
479
  reportCountdownTimer: null,
480
480
  // 上报倒计时剩余秒数(10分钟 = 600秒)
481
- reportCountdownSeconds: 600,
481
+ reportCountdownSeconds: 0,
482
482
  quotePrice: "",
483
483
  closeMask: true,
484
484
  showConfirmDialog: false,
@@ -509,7 +509,10 @@ export default {
509
509
  };
510
510
  },
511
511
  quotePriceTotal() {
512
- return this.$xdUniHelper.multiplyFloatNumber(this.quotePrice, this.info.product_total);
512
+ return this.$xdUniHelper.multiplyFloatNumber(
513
+ this.quotePrice,
514
+ this.info.product_total
515
+ );
513
516
  },
514
517
  },
515
518
  watch: {
@@ -566,11 +569,9 @@ export default {
566
569
  this.quoteDisabled = true;
567
570
  }
568
571
  if (
569
- (this.info.user_quotation_status === "cancel_quotation" ||
570
- this.info.user_quotation_status === "wait_quote" ||
571
- this.info.user_quotation_status === "quoted") &&
572
- this.info.order_status !== "reported" &&
573
- this.info.order_status !== "close"
572
+ this.info.user_quotation_status === "cancel_quotation" ||
573
+ this.info.user_quotation_status === "wait_quote" ||
574
+ this.info.user_quotation_status === "quoted"
574
575
  ) {
575
576
  this.startCountdown();
576
577
  }
@@ -582,7 +583,7 @@ export default {
582
583
  //如果已接单,开启十分钟上报订单倒计时
583
584
  this.startReportCountdown();
584
585
  }
585
- if (this.info.order_status === "close") {
586
+ if (this.info.user_quotation_status === "close") {
586
587
  //如果订单已关闭,则隐藏所有按钮,并且清除倒计时
587
588
  this.isCountdownEnd = true;
588
589
  this.clearReceiveCountdown();
@@ -772,7 +773,7 @@ export default {
772
773
  // 先清除可能存在的旧定时器,防止重复计时
773
774
  this.clearReportCountdown();
774
775
  // 初始化倒计时秒数(10分钟 = 600秒),如果有接口返回的时间则使用接口返回的时间
775
- this.reportCountdownSeconds = this.info.rest_report_time || 600;
776
+ this.reportCountdownSeconds = this.info.rest_report_time;
776
777
  this.isReportCountdownEnd = false;
777
778
 
778
779
  // 创建每秒执行的定时器
@@ -82,7 +82,7 @@ export default {
82
82
  isPreview: false,
83
83
  isOpenNew: "N",
84
84
  isOpenWin: "N",
85
- max_id: null,
85
+ max_id: 0,
86
86
  };
87
87
  },
88
88
  watch: {
@@ -185,13 +185,17 @@ export default {
185
185
  * 处理子组件派发的 'expire' 事件
186
186
  * 订单倒计时结束后,从列表中删除该订单
187
187
  */
188
- handleOrderExpire(orderId) {
188
+ handleOrderExpire(order) {
189
189
  if (this.isPreview) return;
190
190
  const orderIndex = this.orderList.findIndex(
191
- (item) => item.order_id === orderId || item.id === orderId
191
+ (item) => item.order_id === order.order_id
192
192
  );
193
193
  if (orderIndex === -1) return;
194
-
194
+ //如果用户状态为已报价,倒计时结束后则刷新列表,并return
195
+ if (order.user_quotation_status === "quoted") {
196
+ this.handleRefresh();
197
+ return;
198
+ }
195
199
  // 从列表中删除该订单
196
200
  this.orderList.splice(orderIndex, 1);
197
201
  },
@@ -215,28 +219,42 @@ export default {
215
219
  vm: this,
216
220
  data: {
217
221
  order_type: this.order_type,
218
- max_id: this.max_id || 0,
222
+ max_id: this.max_id,
219
223
  },
220
224
  }).then((res) => {
221
225
  if (res.is_exist_new_order && res.is_exist_win_order) {
222
226
  if (this.isOpenNew === "Y") {
223
- this.voiceAlert({ type: "new",filePath: 'https://img.jufubao.cn/takeorder/new_order.mp3' });
227
+ this.voiceAlert({
228
+ type: "new",
229
+ filePath: "https://img.jufubao.cn/takeorder/new_order.mp3",
230
+ });
224
231
  }
225
232
  if (this.isOpenWin === "Y") {
226
233
  setTimeout(() => {
227
- this.voiceAlert({ type: "win",filePath: 'https://img.jufubao.cn/takeorder/wait_order.mp3' });
234
+ this.voiceAlert({
235
+ type: "win",
236
+ filePath: "https://img.jufubao.cn/takeorder/wait_order.mp3",
237
+ });
228
238
  }, 1000);
229
239
  }
230
240
  } else if (res.is_exist_new_order) {
231
241
  if (this.isOpenNew === "Y") {
232
- this.voiceAlert({ type: "new",filePath: 'https://img.jufubao.cn/takeorder/new_order.mp3' });
242
+ this.voiceAlert({
243
+ type: "new",
244
+ filePath: "https://img.jufubao.cn/takeorder/new_order.mp3",
245
+ });
233
246
  }
234
247
  } else if (res.is_exist_win_order) {
235
248
  if (this.isOpenWin === "Y") {
236
- this.voiceAlert({ type: "win",filePath: 'https://img.jufubao.cn/takeorder/wait_order.mp3' });
249
+ this.voiceAlert({
250
+ type: "win",
251
+ filePath: "https://img.jufubao.cn/takeorder/wait_order.mp3",
252
+ });
237
253
  }
238
254
  }
239
- this.max_id = res.new_order_max_id;
255
+ if (res.new_order_max_id > this.max_id) {
256
+ this.max_id = res.new_order_max_id;
257
+ }
240
258
  this.showNew = res.is_exist_new_order;
241
259
  });
242
260
  },
@@ -270,7 +288,7 @@ export default {
270
288
  }
271
289
  },
272
290
  onJfbShow(options) {
273
- this.onJfbLoad(options);
291
+ this.onJfbLoad(options);
274
292
  },
275
293
  onJfbHide(options) {
276
294
  // 页面隐藏时暂停轮询