jufubao-base 1.0.297-beta2 → 1.0.297-beta23

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.
@@ -11,11 +11,32 @@
11
11
  <image v-if="shopLogo" :src="shopLogo" class="logo"></image>
12
12
  <image v-else class="logo" src="https://img1-b.jufubao.cn/uploads/20250528/e88bb70d4ccdcdd01a277bdf6b66c488.jpg"></image>
13
13
  </view>
14
- <view v-if="isFlow">
15
- <view @click="handleToShop" class="shop">
16
- <view>{{shopName}}</view>
17
- <XdFontIcon size="20" icon="iconxiangyou_xian"></XdFontIcon>
14
+
15
+ <view @click="handleToShop" class="shop">
16
+ <view>{{shopName}}</view>
17
+ <XdFontIcon size="20" icon="iconxiangyou_xian"></XdFontIcon>
18
+ </view>
19
+
20
+ <template v-if="curConsumeType === 'QP'">
21
+ <view class="justify-center">
22
+ <image mode="aspectFit" class="bar-code" :src="barcode_url">
23
+ </image>
24
+ <view class="bar-code-text">{{barCode}}</view>
25
+ <view style="position: relative">
26
+ <image mode="aspectFit" class="qrcode" :src="code_url"></image>
27
+ <image v-if="qrcode_icon" class="logo-icon" :src="qrcode_icon"></image>
28
+ </view>
29
+ <view class="code-refresh">{{expiration_sec_str}}后自动更新</view>
30
+ <view v-if="isShowPaySoft === 'Y'" class="pay_way">
31
+ <view class="pay_title">此二维码优先使用以下账户进行支付</view>
32
+ <view class="pay_select" @click="showSortDialog">
33
+ <view>{{ curPaySelectShow }}</view>
34
+ <xd-font-icon icon="iconxia_down" size="28" style="margin-left: 24rpx;"></xd-font-icon>
35
+ </view>
36
+ </view>
18
37
  </view>
38
+ </template>
39
+ <view v-else style="padding-bottom: 40rpx;">
19
40
  <view class="verification-item">
20
41
  <view class="verification-item-label">提货标签</view>
21
42
  <view class="verification-item-tags">
@@ -34,72 +55,79 @@
34
55
  <view :style="{color:mainColor}" class="tip">*提货点数请咨询店员,提货成功后无法退换</view>
35
56
  </view>
36
57
  </view>
37
- <XdButton v-if="btnDisabled" style="margin-top: 200rpx;display:block" width="260rpx" type="primary" disabled>
58
+ <XdButton v-if="btnDisabled" style="margin-top: 100rpx;display:block" width="260rpx" type="primary" disabled>
38
59
  下一步</XdButton>
39
- <XdButton v-else style="margin-top: 200rpx;display:block" width="260rpx" type="primary" @click="toPayOrder">
60
+ <XdButton v-else style="margin-top: 100rpx;display:block" width="260rpx" type="primary" @click="toPayOrder">
40
61
  下一步</XdButton>
41
- <view v-if="plusDiscount" style="margin-top: 40rpx;">
42
- <view class="vip" v-if="is_vip==='N'">
43
- <view class="vip-title">
44
- <view class="vip-title-left">PLUS会员专享</view>
45
- <view class="vip-title-right">
46
- <text>{{plusDiscount/1000}}</text>折
47
- </view>
48
- </view>
49
- <view class="vip-open" @click="handleToOpen">
50
- <xd-font-icon color="#FCBF28" size="20" icon="iconPLUShuiyuan"></xd-font-icon>
51
- <text>立即开通</text>
52
- <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon>
62
+ </view>
63
+
64
+ <view v-if="plusDiscount" style="width: 100%;">
65
+ <view class="vip" v-if="is_vip==='N'">
66
+ <view class="vip-title">
67
+ <view class="vip-title-left">PLUS会员专享</view>
68
+ <view class="vip-title-right">
69
+ <text>{{plusDiscount/1000}}</text>折
53
70
  </view>
54
71
  </view>
55
- <view class="is-vip" v-else>
56
- <text>PLUS</text>会员核销最低可享 <text>{{plusDiscount/1000}}</text>折
72
+ <view class="vip-open" @click="handleToOpen">
73
+ <xd-font-icon color="#FCBF28" size="20" icon="iconPLUShuiyuan"></xd-font-icon>
74
+ <text>立即开通</text>
75
+ <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon>
57
76
  </view>
58
77
  </view>
78
+ <view class="is-vip" v-else>
79
+ <text>PLUS</text>会员核销最低可享 <text>{{plusDiscount/1000}}</text>折
80
+ </view>
59
81
  </view>
60
- <view v-else>
61
- <view>
62
- <view @click="handleToShop" class="shop">
63
- <view>{{shopName}}</view>
64
- <XdFontIcon size="20" icon="iconxiangyou_xian"></XdFontIcon>
65
- </view>
66
- <image mode="aspectFit" class="bar-code" :src="barcode_url">
67
- </image>
68
- <view class="bar-code-text">{{barCode}}</view>
69
- <view style="position: relative">
70
- <image mode="aspectFit" class="qrcode" :src="code_url"></image>
71
- <image v-if="qrcode_icon" class="logo-icon" :src="qrcode_icon"></image>
72
- </view>
73
-
74
- <view class="code-refresh">{{expiration_sec_str}}后自动更新</view>
75
- <view v-if="isShowPaySoft === 'Y'" class="pay_way">
76
- <view class="pay_title">此二维码优先使用以下账户进行支付</view>
77
- <view class="pay_select" @click="showSortDialog">
78
- <view>{{ curPaySelectShow }}</view>
79
- <xd-font-icon icon="iconxia_down" size="28" style="margin-left: 24rpx;"></xd-font-icon>
82
+ </view>
83
+ <view class="consume_list">
84
+ <template v-for="item in consume_options">
85
+ <view v-if="item.consume_mode==='WB' && showScan === 'Y'" :key="item.consume_mode"
86
+ class="consume_item"
87
+ @click="handleConsumeType(item.consume_mode)"
88
+ >
89
+ <view class="consume_title">
90
+ <view class="consume_icon">
91
+ <xd-font-icon v-if="scanIconType==='icon'" :size="28" :icon="scanIcon"></xd-font-icon>
92
+ <view v-else class="_img">
93
+ <image :src="scanImg" mode="aspectFill"></image>
94
+ </view>
80
95
  </view>
96
+ <view >{{ scanName }}</view>
81
97
  </view>
82
- <view v-if="plusDiscount">
83
- <view class="vip" v-if="is_vip==='N'">
84
- <view class="vip-title">
85
- <view class="vip-title-left">PLUS会员专享</view>
86
- <view class="vip-title-right">
87
- <text>{{plusDiscount/1000}}</text>折
88
- </view>
89
- </view>
90
- <view class="vip-open" @click="handleToOpen">
91
- <xd-font-icon color="#FCBF28" size="20" icon="iconPLUShuiyuan"></xd-font-icon>
92
- <text>立即开通</text>
93
- <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon>
98
+ <xd-font-icon :size="28" icon="iconxiangyou_xian"></xd-font-icon>
99
+ </view>
100
+ <view v-if="item.consume_mode==='JHD' && showJHD === 'Y'" :key="item.consume_mode"
101
+ class="consume_item"
102
+ @click="handleConsumeType(item.consume_mode)"
103
+ >
104
+ <view class="consume_title">
105
+ <view class="consume_icon">
106
+ <xd-font-icon v-if="JHDIconType==='icon'" :size="28" :icon="JHDIcon"></xd-font-icon>
107
+ <view v-else class="_img">
108
+ <image :src="JHDImg" mode="aspectFill"></image>
94
109
  </view>
95
110
  </view>
96
- <view class="is-vip" v-else>
97
- <text>PLUS</text>会员消费最低可享 <text>{{plusDiscount/1000}}</text>折
111
+ <view >{{ JHDName }}</view>
112
+ </view>
113
+ <xd-font-icon :size="28" icon="iconxiangyou_xian"></xd-font-icon>
114
+ </view>
115
+ <view v-if="item.consume_mode==='QP' && showQP==='Y'" :key="item.consume_mode"
116
+ class="consume_item"
117
+ @click="handleConsumeType(item.consume_mode)"
118
+ >
119
+ <view class="consume_title">
120
+ <view class="consume_icon">
121
+ <xd-font-icon v-if="QPIconType==='icon'" :size="28" :icon="QPIcon"></xd-font-icon>
122
+ <view v-else class="_img">
123
+ <image :src="QPImg" mode="aspectFill"></image>
124
+ </view>
98
125
  </view>
126
+ <view >{{ QPName }}</view>
99
127
  </view>
128
+ <xd-font-icon :size="28" icon="iconxiangyou_xian"></xd-font-icon>
100
129
  </view>
101
- </view>
102
-
130
+ </template>
103
131
  </view>
104
132
  </view>
105
133
  <view :style="{
@@ -180,8 +208,11 @@
180
208
  import XdDeductSort from "./XdDeductSort.vue"
181
209
  import { jfbRootExec } from "@/utils/xd.event";
182
210
  import JfbBaseConsumpCodeMixin from "./JfbBaseConsumpCodeMixin";
211
+ import QPMixin from "./QPMixin"; //展码消费
212
+ import JHDMixin from "./JHDMixin"; //聚好兑
213
+ import shopListMixin from "./shopListMixin";
183
214
  import getServiceUrl from "@/common/getServiceUrl";
184
- import { getContainerPropsValue, isWechat, isWechatTools } from "@/utils/xd.base";
215
+ import { getContainerPropsValue, isWechat, isWechatTools, gCPVal } from "@/utils/xd.base";
185
216
  import componentsMixins from "@/mixins/componentsMixins";
186
217
  import extsMixins from "@/mixins/extsMixins";
187
218
  import { mapState } from 'vuex';
@@ -200,35 +231,15 @@
200
231
  XdDeductSort
201
232
  },
202
233
  mixins: [
203
- componentsMixins, extsMixins, JfbBaseConsumpCodeMixin
234
+ componentsMixins, extsMixins, JfbBaseConsumpCodeMixin, QPMixin, JHDMixin, shopListMixin
204
235
  ],
205
236
  data() {
206
237
  return {
207
- openPath: "",
208
- shopPath: "",
209
- successPath: "",
210
- cashPayPath: "",
211
238
  showDialog: false,
212
239
  showMask: true,
213
240
  shop_id: '',
214
- showShopList: true,
215
- secondTimer: null,
216
- expiration_sec: '',
217
- code_url: '',
218
- barcode_url: '',
219
- barCode: '',
220
- statusTimer: null,
221
- validTimer: null,
222
- payChannels: [],
223
- channel_provider_id: "",
224
241
  options: {},
225
242
  canEdit: true,
226
- settle_tag_list: [],
227
- settle_tag_list_status: false,
228
- tag_id: "",
229
- price: "",
230
- total_price: "",
231
- num: 1,
232
243
  tip: '',
233
244
  shopName: '',
234
245
  shopLogo: "",
@@ -238,18 +249,43 @@
238
249
  userInfo: {},
239
250
  is_vip: 'N',
240
251
  isPreview: false,
241
- jwxSDK: null,
242
252
  refresh: true, //onshow是否刷新数据
243
253
  showLocationDialog: false,
244
- cityPath: '',
245
254
  resource_shop_id: '',
246
- qrcode_icon: '',
247
- deductDialog: false,
248
- paySortList: [],
249
- tempList: [],
255
+ consume_options: [], //当前门店支持的核销方式
256
+ default_consume_type: '', //默认核销方式
257
+ baseInfo: {}, //基础接口返回信息 - 展码及门店基本信息
258
+ curConsumeType: "JHD", //当前选择的核销方式, 默认聚好兑
250
259
 
251
260
  bodyBgImg: "",
261
+ contBgcColor: "#fff",
252
262
  isShowPaySoft: "N",
263
+
264
+ cityPath: '',
265
+ openPath: "",
266
+ shopPath: "",
267
+ successPath: "",
268
+ cashPayPath: "",
269
+ scanPath: "",
270
+
271
+ showScan: "",
272
+ scanName: "",
273
+ scanIconType: "",
274
+ scanIcon: "",
275
+ scanImg: "",
276
+
277
+ showJHD: "",
278
+ JHDName: "",
279
+ JHDIconType: "",
280
+ JHDIcon: "",
281
+ JHDImg: "",
282
+
283
+ showQP: "",
284
+ QPName: "",
285
+ QPIconType: "",
286
+ QPIcon: "",
287
+ QPImg: "",
288
+
253
289
  }
254
290
  },
255
291
  watch: {
@@ -269,43 +305,17 @@
269
305
  brandInfo: state => state.brandInfo,
270
306
  jfbAuthorize: (state) => state.jfbAuthorize,
271
307
  }),
272
- expiration_sec_str() {
273
- //秒数转 x分x秒
274
- let second = this.expiration_sec;
275
- if (second < 60) {
276
- return second + "秒";
277
- }
278
- let min = parseInt(second / 60);
279
- let sec = second % 60;
280
- return `${min}分${sec}秒`;
281
- },
282
- curTag() {
283
- return this.settle_tag_list.find(item => item.value === this.tag_id) || {}
284
- },
285
- curTagPrice() {
286
- const curTag = this.curTag;
287
- if (this.$xdUniHelper.isEmpty(curTag)) return 0;
288
- if (curTag.is_static_price) {
289
- return curTag.price_yuan;
290
- } else {
291
- return this.total_price;
292
- }
293
- },
294
308
  btnDisabled() {
295
309
  return this.total_price === '' || !this.tag_id;
296
310
  },
297
- curPaySelectShow(){
298
- if(this.paySortList.length === 0) return ''
299
- let curPay = this.paySortList[0];
300
- return curPay.pay_method_name + (curPay.pay_method !== 'card' ? `: ${this.$xdUniHelper.divisionFloatNumber(curPay.wallet_amount, 100)}` : '')
301
- },
302
311
  bodyStyleComp(){
303
312
  return {
304
313
  minHeight: this.layoutInfo.bodyMinHeightRpx + 'rpx',
305
314
  backgroundImage: `url(${this.bodyBgImg})`,
315
+ backgroundColor: this.contBgcColor,
306
316
  backgroundSize: '100% 100%'
307
317
  }
308
- }
318
+ },
309
319
  },
310
320
  created() {
311
321
  this.isPreview = this.$configProject['isPreview']
@@ -319,10 +329,10 @@
319
329
  },
320
330
  methods: {
321
331
  async onJfbLoad(options) {
322
- // this.xnamespace = this.projectAttr.business_code
323
332
  this.setNameSpace(options, false);
324
333
  this.getUserInfo()
325
334
  this.options = options
335
+ this.resource_shop_id = options.resource_shop_id;
326
336
  if (!this.isPreview) {
327
337
  console.log(this.stateLocation, 'this.stateLocation');
328
338
 
@@ -336,211 +346,92 @@
336
346
  this.showLocationDialog = false
337
347
  }
338
348
  }
339
- if (!this.options.shop_id) {
340
- // jfbRootExec("getConsumpShopList", {
341
- // vm: this,
342
- // data: {
343
- // city_code: this.stateCity.city_code,
344
- // consume_mode: 'SELL',
345
- // latitude: this.stateLocation.latitude + '',
346
- // longitude: this.stateLocation.longitude + '',
347
- // },
348
- // }).then(res => {
349
- // if (res && res.list.length > 0) {
350
- // this.shop_id = res.list[0].shop_id;
351
- // this.resource_shop_id = res.list[0].resource_shop_id;
352
- // this.shopName = res.list[0].resource_shop_name;
353
- // // this.showMask = true;
354
- // // this.showDialog = true;
355
- // } else {
356
- // this.tip = '您的附近暂时没有支持的店铺'
357
- // this.showDialog = false;
358
- // }
359
- // })
360
- } else {
349
+ if(this.options.shop_id || this.isPreview){
361
350
  this.shop_id = this.options.shop_id;
362
351
  this.resource_shop_id = this.options.resource_shop_id;
352
+ let isFirst = true;
363
353
  this.p_getAsyncStep((err) => {
364
354
  if(err === 'error'){
365
355
  }else{
366
356
  this.showShopList = false;
367
357
  this.showMask = false;
368
358
  }
369
-
370
- });
359
+ }, isFirst);
360
+ }else{
361
+ //没有门店id,展示门店列表去选择门店
362
+ this.showShopList = true;
371
363
  }
372
- this.p_getMyPayOrderConfig();
373
364
  },
374
365
  /**
375
366
  * @description 监听事件变化
376
367
  * @param container {object} 业务组件对象自己
377
368
  */
378
369
  init(container) {
379
- this.openPath = getContainerPropsValue(
380
- container,
381
- "content.openPath",
382
- { value: "" }
383
- ).value;
384
- this.shopPath = getContainerPropsValue(
385
- container,
386
- "content.shopPath",
387
- { value: "" }
388
- ).value;
389
- this.successPath = getContainerPropsValue(
390
- container,
391
- "content.successPath",
392
- { value: "" }
393
- ).value;
394
- this.cashPayPath = getContainerPropsValue(container, 'content.cash_pay_path', { value: "" }
395
- ).value;
396
- this.successPath = getContainerPropsValue(
397
- container,
398
- "content.successPath",
399
- { value: "" }
400
- ).value;
401
- this.cityPath = getContainerPropsValue(container, 'content.cityPath', { value: "" }
402
- ).value;
370
+ this.openPath = getContainerPropsValue( container, "content.openPath", { value: "" }).value;
371
+ this.shopPath = getContainerPropsValue( container, "content.shopPath", { value: "" }).value;
372
+ this.successPath = getContainerPropsValue( container, "content.successPath", { value: "" }).value;
373
+ this.cashPayPath = getContainerPropsValue(container, 'content.cash_pay_path', { value: "" }).value;
374
+ this.successPath = getContainerPropsValue( container, "content.successPath", { value: "" }).value;
375
+ this.scanPath = getContainerPropsValue(container, 'content.scanPath', { value: "" }).value;
376
+ this.cityPath = getContainerPropsValue(container, 'content.cityPath', { value: "" }).value;
403
377
  this.bodyBgImg = getServiceUrl(getContainerPropsValue(container, 'content.bodyBgImg', {url: ""}).url);
378
+ this.contBgcColor = gCPVal(container, 'contBgcColor', '#fff')
404
379
  this.isShowPaySoft = getContainerPropsValue(container, 'content.isShowPaySoft', "N");
405
- },
406
- handleSortClose(){
407
- this.deductDialog = false;
408
- },
409
- handleChoseShop(shop){
410
- this.shop_id = shop.shop_id;
411
- this.resource_shop_id = shop.resource_shop_id;
412
- this.shopName = shop.resource_shop_name;
413
- this.p_getAsyncStep((err) => {
414
- if(err === 'error'){
415
- }else{
416
- this.showShopList = false;
417
- this.showMask = false;
418
- }
419
- });
420
- },
421
- moveHandle(){},
422
- handleCityChange(){
423
- this.$xdUniHelper.navigateTo({
424
- url: this.cityPath
425
- })
426
- },
427
- handleCityDone(city){
428
- console.log("handleCityDone", city);
429
- },
430
- showSortDialog(){
431
- this.deductDialog = true;
432
- },
433
- handleDeductSort(list){
434
- console.log("handleDeductSort",list);
435
- this.tempList = list;
436
- },
437
- doConfirmSortPay(){
438
- if(this.tempList.length === 0){
439
- this.deductDialog = false;
440
- return false;
441
- }
442
- let configs = this.tempList.map(item => {
443
- return {
444
- pay_method: item.pay_method,
445
- priority_rules: item.options.map(ii => ii.value)
446
- }
447
- })
448
- console.log('configs',configs);
449
- jfbRootExec("saveMyPayOrderConfig", {
450
- vm: this,
451
- data: {
452
- configs: configs
453
- }
454
- }).then(res => {
455
- this.deductDialog = false;
456
- this.paySortList = this.tempList;
457
- })
458
- },
459
- p_getMyPayOrderConfig(){
460
- jfbRootExec("getMyPayOrderConfig", {
461
- vm: this,
462
- data: {},
463
- }).then(res => {
464
- this.paySortList = res.configs;
465
- })
466
- },
467
- getUserInfo() {
468
- jfbRootExec("getConsumpBaseUserInfo", {
469
- vm: this,
470
- data: {},
471
- }).then(res => {
472
- res = res || {};
473
- if(res['head_url']) res['head_url'] = getServiceUrl(res['head_url'], 'size2')
474
- this.userInfo = res;
475
- })
476
- },
477
- p_getShopList(params = {}, cb){
478
- return new Promise((resolve, reject) => {
479
- jfbRootExec("getConsumpShopList", {
480
- vm: this,
481
- data: {
482
- consume_mode: 'SELL',
483
- latitude: this.stateLocation.latitude + '',
484
- longitude: this.stateLocation.longitude + '',
485
- ...params,
486
- }
487
- }).then(res => {
488
- if(cb) cb(res.list);
489
- resolve(res.list);
490
- }).catch(err => {
491
- reject(err);
380
+
381
+ this.showScan = gCPVal(container, 'showScan', "Y");
382
+ this.scanName = gCPVal(container, 'scanName', "扫码提货");
383
+ this.scanIconType = gCPVal(container, 'scanIconType', "icon");
384
+ this.scanIcon = gCPVal(container, 'scanIcon', 'iconsaoma1');
385
+ this.scanImg = getServiceUrl(gCPVal(container, 'scanImg', {url: ""}).url);
386
+
387
+ this.showJHD = gCPVal(container, 'showJHD', "Y");
388
+ this.JHDName = gCPVal(container, 'JHDName', "聚好兑");
389
+ this.JHDIconType = gCPVal(container, 'JHDIconType', "icon");
390
+ this.JHDIcon = gCPVal(container, 'JHDIcon', 'iconqianbao-01');
391
+ this.JHDImg = getServiceUrl(gCPVal(container, 'JHDImg', {url: ""}).url);
392
+
393
+ this.showQP = gCPVal(container, 'showQP', "Y");
394
+ this.QPName = gCPVal(container, 'QPName', "展码提货");
395
+ this.QPIconType = gCPVal(container, 'QPIconType', "icon");
396
+ this.QPIcon = gCPVal(container, 'QPIcon', 'iconerweima');
397
+ this.QPImg = getServiceUrl(gCPVal(container, 'QPImg', {url: ""}).url);
398
+
399
+ console.log("this.scanImg", this.scanImg);
400
+ },
401
+ handleConsumeType(consumeType){
402
+ if(this.curConsumeType === consumeType) return;
403
+ if(consumeType === 'WB'){
404
+ this.$xdUniHelper.navigateTo({
405
+ url: this.scanPath,
492
406
  })
493
- })
407
+ return;
408
+ }
409
+ //当前为展码,清除定时器
410
+ if(this.curConsumeType === 'QP') this.clearAllTimer();
411
+ this.curConsumeType = consumeType;
412
+ this.p_getAsyncStep();
494
413
  },
495
- async p_getAsyncStep(cb) {
414
+ async p_getAsyncStep(cb, isFirst) {
496
415
  try{
497
- await this.p_getQuickPayQRCode();
416
+ await this.p_getQuickPayQRCode(isFirst);
498
417
  }catch(e){
499
418
  if(cb) cb('error');
500
419
  return;
501
420
  }
502
421
  if(cb) cb();
503
- if (!this.isFlow) {
422
+ if (this.curConsumeType === 'QP') {
423
+ this.p_getMyPayOrderConfig();
504
424
  this.p_getQRCodeStatus();
505
425
  this.p_getListUserPayChannel();
506
426
  }
507
427
  },
508
- getH5WxAuthorize() {
509
- jfbRootExec("getH5WxAuthorize", {
510
- vm: this,
511
- data: { jsApiList: ["chooseWXPay"], },
512
- })
513
- .then((res) => {
514
- this.jwxSDK = res.jwxSDK;
515
- console.log('this.jwxSDK', this.jwxSDK);
516
- })
517
- .catch(error => {
518
- this.$xdAlert({
519
- content: error,
520
- });
521
- });
522
- },
523
- p_getListUserPayChannel() {
524
- const { pay_channels } = this.projectAttr;
525
- jfbRootExec("getConsumpListUserPayChannel", {
526
- vm: this,
527
- data: {
528
- providers: pay_channels && pay_channels.join(","),
529
- },
530
- }).then((res) => {
531
- console.log("p_getListUserPayChannel", res);
532
- this.payChannels = res.list;
533
- this.channel_provider_id = res.list[0].channel_provider_id;
534
- });
535
- },
536
- p_getQuickPayQRCode() {
428
+ //获取支付码及门店信息 - 60秒轮询刷新二维码信息
429
+ p_getQuickPayQRCode(isFirst) {
537
430
  return new Promise((resolve, reject) => {
538
431
  this.$xdShowLoading({});
539
432
  let data = {
540
433
  shop_id: this.shop_id,
541
434
  temp_order_id: this.temp_order_id,
542
- // business_code: this.xnamespace,
543
- // resource_shop_id: this.resource_shop_id
544
435
  }
545
436
  if(data.resource_shop_id) delete data.shop_id
546
437
  jfbRootExec("getConsumpCode", {
@@ -548,15 +439,19 @@
548
439
  data: data
549
440
  }).then(res => {
550
441
  this.$xdHideLoading();
551
- this.plusDiscount = res.plus_discount
552
- if (res.is_st_flow === 'Y') {
553
- //水牌
554
- this.isFlow = true
555
- this.showMask = false;
556
- this.shopName = res.resource_shop_name;
557
- this.getSettleTagList()
558
- resolve();
559
- } else {
442
+ this.showMask = false;
443
+ this.baseInfo = res;
444
+ this.plusDiscount = res.plus_discount;
445
+ this.consume_options = res.consume_options;
446
+ this.default_consume_type = res.default_consume_type;
447
+ this.shopName = res.resource_shop_name;
448
+ //当前的核销方式
449
+ if(isFirst){
450
+ this.curConsumeType = res.default_consume_type;
451
+ }
452
+
453
+ //当期核销方式为消费码(二维码)
454
+ if(this.curConsumeType === 'QP'){
560
455
  // 消费码
561
456
  this.temp_order_id = res.temp_order_id;
562
457
  let code_url = this.brandInfo['api_host'] + res.code_url;
@@ -572,8 +467,6 @@
572
467
  this.qrcode_icon = qrcode_icon;
573
468
  this.barCode = res.payment_code
574
469
  this.expiration_sec = res.expiration_sec;
575
- this.showMask = false;
576
- this.shopName = res.resource_shop_name;
577
470
  this.shopLogo = getServiceUrl(res.shop_icon)
578
471
  clearInterval(this.secondTimer);
579
472
  this.secondTimer = setInterval(() => {
@@ -583,348 +476,17 @@
583
476
  this.p_getQuickPayQRCode();
584
477
  }
585
478
  }, 1000);
586
- resolve();
479
+ }else{
480
+ //扫水牌,核销标签列表
481
+ this.getSettleTagList();
587
482
  }
588
-
483
+ resolve();
589
484
  }).catch(err => {
590
485
  console.error(err);
591
486
  reject(err);
592
487
  })
593
488
  })
594
489
  },
595
- p_getQRCodeStatus() {
596
- jfbRootExec("getConsumpCodeScanStatus", {
597
- vm: this,
598
- data: {
599
- temp_order_id: this.temp_order_id,
600
- shop_id: this.shop_id
601
- }
602
- }).then(res => {
603
- //P处理中 Y成功 E 失败
604
- if (res.status === 'P') {
605
- if (!this.isPreview) {
606
- if (this.statusTimer) clearTimeout(this.statusTimer);
607
- this.statusTimer = setTimeout(() => {
608
- this.p_getQRCodeStatus();
609
- }, 2000);
610
- }
611
- } else if (res.status === 'Y') {
612
- //订单下单有效时间 秒
613
- if (this.statusTimer) clearTimeout(this.statusTimer);
614
- this.orderSeconds = res.seconds;
615
- if (this.orderSeconds > 0) {
616
- this.validTimer = setInterval(() => {
617
- this.orderSeconds--;
618
- if (this.orderSeconds <= 0) {
619
- this.handlerOderFail();
620
- }
621
-
622
- }, 1000)
623
- }
624
- this.p_createOrder();
625
- } else if (res.status === 'E') {
626
- if (this.statusTimer) clearTimeout(this.statusTimer);
627
- this.$xdAlert({
628
- content: res.message,
629
- time: 1500,
630
- isClose: false,
631
- zIndex: 5000
632
- });
633
- }
634
- })
635
- },
636
- p_createOrder() {
637
- jfbRootExec("batchConsumpUseCardCreated", {
638
- vm: this,
639
- data: {
640
- temp_order_id: this.temp_order_id,
641
- business_code: this.xnamespace,
642
- }
643
- }).then(res => {
644
- this.request_order_id = res.request_order_id;
645
- this.p_getOrderStatus();
646
- }).catch(err => {
647
- this.handlerOderFail();
648
- })
649
- },
650
- p_getOrderStatus() {
651
- jfbRootExec("getConsumpAsyncSubmitStatus", {
652
- vm: this,
653
- data: {
654
- request_order_id: this.request_order_id
655
- }
656
- }).then(res => {
657
- let { hand_status, hand_status_msg, order_id, pay_order_id, need_pay_price } = res;
658
-
659
- if (hand_status === 'U') {
660
- this.orderTimer = setTimeout(() => {
661
- this.p_getOrderStatus();
662
- }, 2000)
663
- } else if (hand_status === 'S') { //成功
664
- if (parseFloat(need_pay_price) > 0) {//补差
665
- this.handleThirdPay(pay_order_id, order_id);
666
- } else {//订单成功
667
- this.refresh = false
668
- this.$xdUniHelper.redirectTo({
669
- url: this.successPath + `?order_id=${order_id}`
670
- })
671
- }
672
- } else if (hand_status === 'F') {
673
- this.handlerOderFail();
674
- this.$xdAlert({
675
- content: hand_status_msg || '支付失败',
676
- time: 3000,
677
- isClose: false,
678
- zIndex: 5000
679
- });
680
- }
681
- })
682
- },
683
- openTemplatePay(paySignData, cb) {
684
- console.log('openTemplatePay', paySignData);
685
-
686
- const { timeStamp, ...otherData } = paySignData;
687
- otherData["timestamp"] = timeStamp;
688
- // #ifdef H5
689
- this.jwxSDK.chooseWXPay({
690
- ...otherData,
691
- success: (res) => {
692
- this.refresh = false;
693
- this.$xdLog.setARMSInfo({ options: this.options, res }, 'pay_success');
694
- uni.showToast({
695
- title: "支付成功",
696
- });
697
- cb(res);
698
- },
699
- cancel: () => {
700
- this.onRefreshPage();
701
- this.$xdLog.setARMSInfo(this.options, 'cancel_pay');
702
- uni.showToast({
703
- title: "取消支付",
704
- });
705
- },
706
- fail: (error) => {
707
- this.onRefreshPage();
708
- if (typeof error === 'string') error = { error: error }
709
- if (window['jwxJfbSDKParams']) error = Object.assign(error, paySignData, window['jwxJfbSDKParams'])
710
- this.$xdLog.setARMSError(error)
711
- uni.showToast({
712
- title: "支付失败",
713
- });
714
- },
715
- });
716
- // #endif
717
- // #ifdef MP
718
- wx.requestPayment({
719
- ...paySignData,
720
- success: (res) => {
721
- this.refresh = false;
722
- this.$xdLog.setARMSInfo({ options: this.options, res }, 'pay_success');
723
- uni.showToast({
724
- title: "支付成功",
725
- icon: "none",
726
- });
727
- cb(res);
728
- },
729
- fail: (err) => {
730
- this.onRefreshPage();
731
- this.$xdLog.setARMSError({
732
- options: this.options,
733
- error: JSON.stringify(err)
734
- });
735
- uni.showToast({
736
- title: "支付失败",
737
- icon: "none",
738
- });
739
- },
740
- });
741
- // #endif
742
- },
743
- onRefreshPage() {
744
- this.temp_order_id = "";
745
- if (this.validTimer) clearInterval(this.validTimer)
746
- this.p_getAsyncStep();
747
- },
748
- getSettleTagList() {
749
- this.$xdShowLoading({});
750
-
751
- jfbRootExec("getConsumpSettleMainInfo", {
752
- vm: this,
753
- data: {
754
- shop_id: this.shop_id,
755
- }
756
- }).then(res => {
757
- this.$xdHideLoading();
758
- const { settle_tag_list } = res;
759
- this.settle_tag_list = settle_tag_list;
760
- if (settle_tag_list.length > 0) {
761
- this.handlerTagRadio(settle_tag_list[0]);
762
- this.settle_tag_list_status = false;
763
- }
764
- else this.settle_tag_list_status = true;
765
- }).catch(err => {
766
- this.$xdHideLoading();
767
- this.$xdLog.catch(error)
768
- })
769
- },
770
- toPayOrder(options = {}) {
771
- let { tag_id, total_price, curTag, num = 1, shop_id } = this;
772
- let err_tip = "";
773
- if (!curTag.is_static_price) this.price = total_price;
774
- if (curTag.is_static_price) {
775
- if (total_price > 10000) {
776
- err_tip = '金额不能超过10000'
777
- }
778
- }
779
- let price = this.price;
780
- if (!price) err_tip = "请填写正确的提货金额";
781
- if (!tag_id) err_tip = "请选择结算标签";
782
- if (err_tip) {
783
- uni.showToast({
784
- title: err_tip,
785
- icon: 'none'
786
- });
787
- return false;
788
- }
789
- if (this.total_price == 0) {
790
- uni.showToast(
791
- {
792
- title: '核销金额不能为0',
793
- icon: 'none'
794
- }
795
- )
796
- return
797
- }
798
- jfbRootExec("addConsumpCashierTempOrderData", {
799
- vm: this,
800
- data: {
801
- shop_id: this.shop_id,
802
- settle_tag_id: this.tag_id,
803
- num: this.num,
804
- settle_tag_price: this.curTagPrice,
805
- total_price: this.total_price,
806
- ...options
807
- }
808
- })
809
- .then(res => {
810
- if (res.confirm_notice) {
811
- return this.useCardPop(res).then(data => {
812
- if (data == 2) {
813
- this.toPayOrder({
814
- is_ignore_unique_check: "Y"
815
- })
816
- }
817
- })
818
- } else {
819
- this.price = "";
820
- let params = {
821
- ...this.options,
822
- price: price,
823
- num: num,
824
- tag: tag_id,
825
- shop_id: shop_id,
826
- cart_order_id: res.cart_order_id
827
- };
828
- params = this.$xdUniHelper.jsonToParams(params)
829
- this.$xdUniHelper.navigateTo({
830
- url: this.cashPayPath + `?${params}`
831
- })
832
- }
833
- })
834
- .catch(error => {
835
- console.error(error);
836
- })
837
- },
838
- //选卡弹出项
839
- useCardPop(data) {
840
- return new Promise((resolve, reject) => {
841
- uni.showModal({
842
- title: '提示',
843
- content: data.msg,
844
- // confirmText: data.confirm_text,
845
- // cancelText: data.cancel_text,
846
- success: function (res) {
847
- if (res.confirm) {
848
- resolve(2);
849
- } else if (res.cancel) {
850
- resolve();
851
- }
852
- },
853
- fail: function (res) {
854
- reject(res);
855
- }
856
- });
857
- })
858
- },
859
- handlerPrice(e) {
860
- this.$nextTick(() => {
861
- this.total_price = e.detail.value.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/, '$1');
862
- if (this.total_price > 10000) {
863
- this.total_price = 10000
864
- uni.showToast(
865
- {
866
- title: '核销金额不能超过10000',
867
- icon: 'none'
868
- }
869
- )
870
- }
871
- })
872
- },
873
- handleThirdPay(pay_order_id, main_order_id) {
874
- let { login_providers = [] } = this.projectAttr;
875
- let data = {
876
- order_id: pay_order_id,
877
- channel_provider_id: this.channel_provider_id,
878
- login_providers: login_providers.join(","),
879
- };
880
- //设置支付成功页面地址
881
- if (!this.$configProject.isPreview) {
882
- data['pay_success_url'] = '';
883
- // #ifdef H5
884
- data['pay_success_url'] = `${window.location.protocol}//${window.location.host}/${this.projectAttr.deploy_dir}`;
885
- // #endif
886
- data['pay_success_url'] += this.successPath + `?order_id=${main_order_id}`;
887
- }
888
-
889
- jfbRootExec("setConsumpThirdPlace", {
890
- vm: this,
891
- data,
892
- })
893
- .then((res) => {
894
- this.$xdHideLoading();
895
- const { channel_data } = res;
896
- const paySignData = JSON.parse(Base64.decode(channel_data));
897
- this.openTemplatePay(paySignData, (ps) => {
898
- jfbRootExec("updateConsumpPay", {
899
- vm: this,
900
- data: {
901
- main_order_id: main_order_id,
902
- },
903
- })
904
- .then((res) => {
905
- this.$xdUniHelper.redirectTo({
906
- url: this.successPath + `?order_id=${main_order_id}`
907
- });
908
- })
909
- .catch(error => {
910
- this.$xdLog.setARMSCustomError('update_loading_fail', { options: this.options, error });
911
- });
912
- })
913
- });
914
- },
915
- //订单失效
916
- handlerOderFail() {
917
- console.warn("handlerOderFail");
918
- this.temp_order_id = "";
919
- clearInterval(this.validTimer);
920
- clearTimeout(this.orderTimer);
921
- clearInterval(this.secondTimer);
922
- },
923
- handleToShop() {
924
- this.$xdUniHelper.navigateTo({
925
- url: this.shopPath
926
- });
927
- },
928
490
  handleToOpen() {
929
491
  this.$xdUniHelper.navigateTo({
930
492
  url: this.openPath
@@ -934,41 +496,39 @@
934
496
  this.showDialog = false;
935
497
  this.p_getAsyncStep();
936
498
  },
937
- handlerTagRadio(item) {
938
- this.tag_id = item.value;
939
- this.canEdit = !item.is_static_price;
940
- this.num = 1;
941
- if (item.is_static_price) {
942
- this.total_price = item.price_yuan
943
- this.price = item.price_yuan
944
- } else {
945
- this.total_price = "";
946
- this.price = "";
947
- }
948
- },
949
499
  handleToCity() {
950
500
  this.$xdUniHelper.navigateTo({
951
501
  url: this.cityPath
952
502
  },true);
953
503
  },
954
- handleNumberChange(num) {
955
- let curTag = this.curTag;
956
- this.total_price = this.$xdUniHelper.multiplyFloatNumber(curTag.price_yuan, num);
504
+ moveHandle(){},
505
+ getUserInfo() {
506
+ jfbRootExec("getConsumpBaseUserInfo", {
507
+ vm: this,
508
+ data: {},
509
+ }).then(res => {
510
+ res = res || {};
511
+ if(res['head_url']) res['head_url'] = getServiceUrl(res['head_url'], 'size2')
512
+ this.userInfo = res;
513
+ })
957
514
  },
958
- onJfbUnload(options) {
959
- console.log('event.onJfbUnload', options)
515
+ //清除所有定时器
516
+ clearAllTimer(){
960
517
  if (this.secondTimer) clearInterval(this.secondTimer);
961
518
  if (this.statusTimer) clearTimeout(this.statusTimer);
962
519
  if (this.orderTimer) clearTimeout(this.orderTimer);
963
520
  },
521
+
522
+ onJfbUnload(options) {
523
+ console.log('event.onJfbUnload', options)
524
+ this.clearAllTimer();
525
+ },
964
526
  onJfbBack(options) {
965
527
  console.log('event.onJfbBack', options)
966
- if (this.secondTimer) clearInterval(this.secondTimer);
967
- if (this.statusTimer) clearTimeout(this.statusTimer);
968
- if (this.orderTimer) clearTimeout(this.orderTimer);
528
+ this.clearAllTimer();
969
529
  },
970
530
  onJfbScroll(options) {
971
- console.log('event.onJfbScroll', options)
531
+ // console.log('event.onJfbScroll', options)
972
532
  },
973
533
  onJfbReachBottom(options) {
974
534
  console.log('event.onJfbReachBottom', options)
@@ -981,9 +541,7 @@
981
541
  },
982
542
  onJfbHide(options) {
983
543
  console.log('event.onJfbHide', options)
984
- if (this.secondTimer) clearInterval(this.secondTimer);
985
- if (this.statusTimer) clearTimeout(this.statusTimer);
986
- if (this.orderTimer) clearTimeout(this.orderTimer);
544
+ this.clearAllTimer();
987
545
  },
988
546
  onJfbUpdate(...data) {
989
547
  console.log('event.onJfbUpdate', data)
@@ -1002,16 +560,21 @@
1002
560
  .jfb-base-consump-code {
1003
561
  &__body {
1004
562
  .content-box {
1005
- margin: 0 30rpx 0 30rpx;
563
+ margin: 160rpx 30rpx 0 30rpx;
1006
564
  background-color: #fff;
1007
565
  padding: 81rpx 32rpx 32rpx 32rpx;
1008
566
  border-radius: 24rpx;
1009
- position: relative;
1010
- top: 158rpx;
1011
567
  display: flex;
1012
568
  flex-direction: column;
1013
569
  align-items: center;
1014
570
  justify-content: center;
571
+ position: relative;
572
+ .justify-center{
573
+ display: flex;
574
+ align-items: center;
575
+ flex-direction: column;
576
+ justify-content: center;
577
+ }
1015
578
 
1016
579
  .logo-box {
1017
580
  width: 154rpx;
@@ -1034,6 +597,43 @@
1034
597
  }
1035
598
 
1036
599
  }
600
+ .consume_list{
601
+ margin: 30rpx;
602
+ background-color: #FFFFFF;
603
+ border-radius: 24rpx;
604
+ overflow: hidden;
605
+ .consume_item{
606
+ display: flex;
607
+ align-items: center;
608
+ justify-content: space-between;
609
+ font-size: 28rpx;
610
+ padding: 32rpx 40rpx;
611
+ border-bottom: 1px solid #E5E5E5;
612
+ &:last-child{
613
+ border-bottom: none;
614
+ }
615
+ .consume_title{
616
+ display: flex;
617
+ flex: 1;
618
+ align-items: center;
619
+ color: #333333;
620
+ .consume_icon{
621
+ width: 60rpx;
622
+ display: flex;
623
+ justify-content: flex-start;
624
+ ._img{
625
+ width: 30rpx;
626
+ height: 30rpx;
627
+ background-color: red;
628
+ image{
629
+ width: 100%;
630
+ height: 100%;
631
+ }
632
+ }
633
+ }
634
+ }
635
+ }
636
+ }
1037
637
 
1038
638
  .shop {
1039
639
  border: 2rpx solid #E6E6E6;
@@ -1084,6 +684,7 @@
1084
684
  padding: 40rpx 0;
1085
685
  align-items: center;
1086
686
  border-top: 1px dashed rgba(229, 229, 229, 1);
687
+ width: 100%;
1087
688
  .pay_title{
1088
689
  font-size: 28rpx;
1089
690
  margin-bottom: 24rpx;