jufubao-base 1.0.299 → 1.0.300

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,80 @@
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' && (isPreview || (!isPreview && curConsumeType !== 'JHD'))" :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>折
98
- </view>
111
+ <view >{{ JHDName }}</view>
99
112
  </view>
113
+ <xd-font-icon :size="28" icon="iconxiangyou_xian"></xd-font-icon>
100
114
  </view>
101
- </view>
102
115
 
116
+ <view v-if="item.consume_mode==='QP' && showQP==='Y' && (isPreview || (!isPreview && curConsumeType !== 'QP')) " :key="item.consume_mode"
117
+ class="consume_item"
118
+ @click="handleConsumeType(item.consume_mode)"
119
+ >
120
+ <view class="consume_title">
121
+ <view class="consume_icon">
122
+ <xd-font-icon v-if="QPIconType==='icon'" :size="28" :icon="QPIcon"></xd-font-icon>
123
+ <view v-else class="_img">
124
+ <image :src="QPImg" mode="aspectFill"></image>
125
+ </view>
126
+ </view>
127
+ <view >{{ QPName }}</view>
128
+ </view>
129
+ <xd-font-icon :size="28" icon="iconxiangyou_xian"></xd-font-icon>
130
+ </view>
131
+ </template>
103
132
  </view>
104
133
  </view>
105
134
  <view :style="{
@@ -180,8 +209,11 @@
180
209
  import XdDeductSort from "./XdDeductSort.vue"
181
210
  import { jfbRootExec } from "@/utils/xd.event";
182
211
  import JfbBaseConsumpCodeMixin from "./JfbBaseConsumpCodeMixin";
212
+ import QPMixin from "./QPMixin"; //展码消费
213
+ import JHDMixin from "./JHDMixin"; //聚好兑
214
+ import shopListMixin from "./shopListMixin";
183
215
  import getServiceUrl from "@/common/getServiceUrl";
184
- import { getContainerPropsValue, isWechat, isWechatTools } from "@/utils/xd.base";
216
+ import { getContainerPropsValue, isWechat, isWechatTools, gCPVal } from "@/utils/xd.base";
185
217
  import componentsMixins from "@/mixins/componentsMixins";
186
218
  import extsMixins from "@/mixins/extsMixins";
187
219
  import { mapState } from 'vuex';
@@ -200,35 +232,15 @@
200
232
  XdDeductSort
201
233
  },
202
234
  mixins: [
203
- componentsMixins, extsMixins, JfbBaseConsumpCodeMixin
235
+ componentsMixins, extsMixins, JfbBaseConsumpCodeMixin, QPMixin, JHDMixin, shopListMixin
204
236
  ],
205
237
  data() {
206
238
  return {
207
- openPath: "",
208
- shopPath: "",
209
- successPath: "",
210
- cashPayPath: "",
211
239
  showDialog: false,
212
240
  showMask: true,
213
241
  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
242
  options: {},
225
243
  canEdit: true,
226
- settle_tag_list: [],
227
- settle_tag_list_status: false,
228
- tag_id: "",
229
- price: "",
230
- total_price: "",
231
- num: 1,
232
244
  tip: '',
233
245
  shopName: '',
234
246
  shopLogo: "",
@@ -238,18 +250,43 @@
238
250
  userInfo: {},
239
251
  is_vip: 'N',
240
252
  isPreview: false,
241
- jwxSDK: null,
242
253
  refresh: true, //onshow是否刷新数据
243
254
  showLocationDialog: false,
244
- cityPath: '',
245
255
  resource_shop_id: '',
246
- qrcode_icon: '',
247
- deductDialog: false,
248
- paySortList: [],
249
- tempList: [],
256
+ consume_options: [], //当前门店支持的核销方式
257
+ default_consume_type: '', //默认核销方式
258
+ baseInfo: {}, //基础接口返回信息 - 展码及门店基本信息
259
+ curConsumeType: "JHD", //当前选择的核销方式, 默认聚好兑
250
260
 
251
261
  bodyBgImg: "",
262
+ contBgcColor: "#fff",
252
263
  isShowPaySoft: "N",
264
+
265
+ cityPath: '',
266
+ openPath: "",
267
+ shopPath: "",
268
+ successPath: "",
269
+ cashPayPath: "",
270
+ scanPath: "",
271
+
272
+ showScan: "",
273
+ scanName: "",
274
+ scanIconType: "",
275
+ scanIcon: "",
276
+ scanImg: "",
277
+
278
+ showJHD: "",
279
+ JHDName: "",
280
+ JHDIconType: "",
281
+ JHDIcon: "",
282
+ JHDImg: "",
283
+
284
+ showQP: "",
285
+ QPName: "",
286
+ QPIconType: "",
287
+ QPIcon: "",
288
+ QPImg: "",
289
+
253
290
  }
254
291
  },
255
292
  watch: {
@@ -269,43 +306,17 @@
269
306
  brandInfo: state => state.brandInfo,
270
307
  jfbAuthorize: (state) => state.jfbAuthorize,
271
308
  }),
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
309
  btnDisabled() {
295
310
  return this.total_price === '' || !this.tag_id;
296
311
  },
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
312
  bodyStyleComp(){
303
313
  return {
304
314
  minHeight: this.layoutInfo.bodyMinHeightRpx + 'rpx',
305
315
  backgroundImage: `url(${this.bodyBgImg})`,
316
+ backgroundColor: this.contBgcColor,
306
317
  backgroundSize: '100% 100%'
307
318
  }
308
- }
319
+ },
309
320
  },
310
321
  created() {
311
322
  this.isPreview = this.$configProject['isPreview']
@@ -319,10 +330,10 @@
319
330
  },
320
331
  methods: {
321
332
  async onJfbLoad(options) {
322
- // this.xnamespace = this.projectAttr.business_code
323
333
  this.setNameSpace(options, false);
324
334
  this.getUserInfo()
325
335
  this.options = options
336
+ this.resource_shop_id = options.resource_shop_id;
326
337
  if (!this.isPreview) {
327
338
  console.log(this.stateLocation, 'this.stateLocation');
328
339
 
@@ -336,211 +347,92 @@
336
347
  this.showLocationDialog = false
337
348
  }
338
349
  }
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 {
350
+ if(this.options.shop_id || this.isPreview){
361
351
  this.shop_id = this.options.shop_id;
362
352
  this.resource_shop_id = this.options.resource_shop_id;
353
+ let isFirst = true;
363
354
  this.p_getAsyncStep((err) => {
364
355
  if(err === 'error'){
365
356
  }else{
366
357
  this.showShopList = false;
367
358
  this.showMask = false;
368
359
  }
369
-
370
- });
360
+ }, isFirst);
361
+ }else{
362
+ //没有门店id,展示门店列表去选择门店
363
+ this.showShopList = true;
371
364
  }
372
- this.p_getMyPayOrderConfig();
373
365
  },
374
366
  /**
375
367
  * @description 监听事件变化
376
368
  * @param container {object} 业务组件对象自己
377
369
  */
378
370
  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;
371
+ this.openPath = getContainerPropsValue( container, "content.openPath", { value: "" }).value;
372
+ this.shopPath = getContainerPropsValue( container, "content.shopPath", { value: "" }).value;
373
+ this.successPath = getContainerPropsValue( container, "content.successPath", { value: "" }).value;
374
+ this.cashPayPath = getContainerPropsValue(container, 'content.cash_pay_path', { value: "" }).value;
375
+ this.successPath = getContainerPropsValue( container, "content.successPath", { value: "" }).value;
376
+ this.scanPath = getContainerPropsValue(container, 'content.scanPath', { value: "" }).value;
377
+ this.cityPath = getContainerPropsValue(container, 'content.cityPath', { value: "" }).value;
403
378
  this.bodyBgImg = getServiceUrl(getContainerPropsValue(container, 'content.bodyBgImg', {url: ""}).url);
379
+ this.contBgcColor = gCPVal(container, 'contBgcColor', '#fff')
404
380
  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);
381
+
382
+ this.showScan = gCPVal(container, 'showScan', "Y");
383
+ this.scanName = gCPVal(container, 'scanName', "扫码提货");
384
+ this.scanIconType = gCPVal(container, 'scanIconType', "icon");
385
+ this.scanIcon = gCPVal(container, 'scanIcon', 'iconsaoma1');
386
+ this.scanImg = getServiceUrl(gCPVal(container, 'scanImg', {url: ""}).url);
387
+
388
+ this.showJHD = gCPVal(container, 'showJHD', "Y");
389
+ this.JHDName = gCPVal(container, 'JHDName', "聚好兑");
390
+ this.JHDIconType = gCPVal(container, 'JHDIconType', "icon");
391
+ this.JHDIcon = gCPVal(container, 'JHDIcon', 'iconqianbao-01');
392
+ this.JHDImg = getServiceUrl(gCPVal(container, 'JHDImg', {url: ""}).url);
393
+
394
+ this.showQP = gCPVal(container, 'showQP', "Y");
395
+ this.QPName = gCPVal(container, 'QPName', "展码提货");
396
+ this.QPIconType = gCPVal(container, 'QPIconType', "icon");
397
+ this.QPIcon = gCPVal(container, 'QPIcon', 'iconerweima');
398
+ this.QPImg = getServiceUrl(gCPVal(container, 'QPImg', {url: ""}).url);
399
+
400
+ console.log("this.scanImg", this.scanImg);
401
+ },
402
+ handleConsumeType(consumeType){
403
+ if(this.curConsumeType === consumeType) return;
404
+ if(consumeType === 'WB'){
405
+ this.$xdUniHelper.navigateTo({
406
+ url: this.scanPath,
492
407
  })
493
- })
408
+ return;
409
+ }
410
+ //当前为展码,清除定时器
411
+ if(this.curConsumeType === 'QP') this.clearAllTimer();
412
+ this.curConsumeType = consumeType;
413
+ this.p_getAsyncStep();
494
414
  },
495
- async p_getAsyncStep(cb) {
415
+ async p_getAsyncStep(cb, isFirst) {
496
416
  try{
497
- await this.p_getQuickPayQRCode();
417
+ await this.p_getQuickPayQRCode(isFirst);
498
418
  }catch(e){
499
419
  if(cb) cb('error');
500
420
  return;
501
421
  }
502
422
  if(cb) cb();
503
- if (!this.isFlow) {
423
+ if (this.curConsumeType === 'QP') {
424
+ this.p_getMyPayOrderConfig();
504
425
  this.p_getQRCodeStatus();
505
426
  this.p_getListUserPayChannel();
506
427
  }
507
428
  },
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() {
429
+ //获取支付码及门店信息 - 60秒轮询刷新二维码信息
430
+ p_getQuickPayQRCode(isFirst) {
537
431
  return new Promise((resolve, reject) => {
538
432
  this.$xdShowLoading({});
539
433
  let data = {
540
434
  shop_id: this.shop_id,
541
435
  temp_order_id: this.temp_order_id,
542
- // business_code: this.xnamespace,
543
- // resource_shop_id: this.resource_shop_id
544
436
  }
545
437
  if(data.resource_shop_id) delete data.shop_id
546
438
  jfbRootExec("getConsumpCode", {
@@ -548,15 +440,19 @@
548
440
  data: data
549
441
  }).then(res => {
550
442
  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 {
443
+ this.showMask = false;
444
+ this.baseInfo = res;
445
+ this.plusDiscount = res.plus_discount;
446
+ this.consume_options = res.consume_options;
447
+ this.default_consume_type = res.default_consume_type;
448
+ this.shopName = res.resource_shop_name;
449
+ //当前的核销方式
450
+ if(isFirst){
451
+ this.curConsumeType = res.default_consume_type;
452
+ }
453
+
454
+ //当期核销方式为消费码(二维码)
455
+ if(this.curConsumeType === 'QP'){
560
456
  // 消费码
561
457
  this.temp_order_id = res.temp_order_id;
562
458
  let code_url = this.brandInfo['api_host'] + res.code_url;
@@ -572,8 +468,6 @@
572
468
  this.qrcode_icon = qrcode_icon;
573
469
  this.barCode = res.payment_code
574
470
  this.expiration_sec = res.expiration_sec;
575
- this.showMask = false;
576
- this.shopName = res.resource_shop_name;
577
471
  this.shopLogo = getServiceUrl(res.shop_icon)
578
472
  clearInterval(this.secondTimer);
579
473
  this.secondTimer = setInterval(() => {
@@ -583,348 +477,17 @@
583
477
  this.p_getQuickPayQRCode();
584
478
  }
585
479
  }, 1000);
586
- resolve();
480
+ }else{
481
+ //扫水牌,核销标签列表
482
+ this.getSettleTagList();
587
483
  }
588
-
484
+ resolve();
589
485
  }).catch(err => {
590
486
  console.error(err);
591
487
  reject(err);
592
488
  })
593
489
  })
594
490
  },
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
491
  handleToOpen() {
929
492
  this.$xdUniHelper.navigateTo({
930
493
  url: this.openPath
@@ -934,41 +497,39 @@
934
497
  this.showDialog = false;
935
498
  this.p_getAsyncStep();
936
499
  },
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
500
  handleToCity() {
950
501
  this.$xdUniHelper.navigateTo({
951
502
  url: this.cityPath
952
503
  },true);
953
504
  },
954
- handleNumberChange(num) {
955
- let curTag = this.curTag;
956
- this.total_price = this.$xdUniHelper.multiplyFloatNumber(curTag.price_yuan, num);
505
+ moveHandle(){},
506
+ getUserInfo() {
507
+ jfbRootExec("getConsumpBaseUserInfo", {
508
+ vm: this,
509
+ data: {},
510
+ }).then(res => {
511
+ res = res || {};
512
+ if(res['head_url']) res['head_url'] = getServiceUrl(res['head_url'], 'size2')
513
+ this.userInfo = res;
514
+ })
957
515
  },
958
- onJfbUnload(options) {
959
- console.log('event.onJfbUnload', options)
516
+ //清除所有定时器
517
+ clearAllTimer(){
960
518
  if (this.secondTimer) clearInterval(this.secondTimer);
961
519
  if (this.statusTimer) clearTimeout(this.statusTimer);
962
520
  if (this.orderTimer) clearTimeout(this.orderTimer);
963
521
  },
522
+
523
+ onJfbUnload(options) {
524
+ console.log('event.onJfbUnload', options)
525
+ this.clearAllTimer();
526
+ },
964
527
  onJfbBack(options) {
965
528
  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);
529
+ this.clearAllTimer();
969
530
  },
970
531
  onJfbScroll(options) {
971
- console.log('event.onJfbScroll', options)
532
+ // console.log('event.onJfbScroll', options)
972
533
  },
973
534
  onJfbReachBottom(options) {
974
535
  console.log('event.onJfbReachBottom', options)
@@ -981,9 +542,7 @@
981
542
  },
982
543
  onJfbHide(options) {
983
544
  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);
545
+ this.clearAllTimer();
987
546
  },
988
547
  onJfbUpdate(...data) {
989
548
  console.log('event.onJfbUpdate', data)
@@ -1001,17 +560,23 @@
1001
560
 
1002
561
  .jfb-base-consump-code {
1003
562
  &__body {
563
+ padding-top: 160rpx;
1004
564
  .content-box {
1005
- margin: 0 30rpx 0 30rpx;
565
+ margin: 0rpx 30rpx 0 30rpx;
1006
566
  background-color: #fff;
1007
567
  padding: 81rpx 32rpx 32rpx 32rpx;
1008
568
  border-radius: 24rpx;
1009
- position: relative;
1010
- top: 158rpx;
1011
569
  display: flex;
1012
570
  flex-direction: column;
1013
571
  align-items: center;
1014
572
  justify-content: center;
573
+ position: relative;
574
+ .justify-center{
575
+ display: flex;
576
+ align-items: center;
577
+ flex-direction: column;
578
+ justify-content: center;
579
+ }
1015
580
 
1016
581
  .logo-box {
1017
582
  width: 154rpx;
@@ -1034,19 +599,54 @@
1034
599
  }
1035
600
 
1036
601
  }
602
+ .consume_list{
603
+ margin: 30rpx;
604
+ background-color: #FFFFFF;
605
+ border-radius: 24rpx;
606
+ overflow: hidden;
607
+ .consume_item{
608
+ display: flex;
609
+ align-items: center;
610
+ justify-content: space-between;
611
+ font-size: 28rpx;
612
+ padding: 32rpx 40rpx;
613
+ border-bottom: 1px solid #E5E5E5;
614
+ &:last-child{
615
+ border-bottom: none;
616
+ }
617
+ .consume_title{
618
+ display: flex;
619
+ flex: 1;
620
+ align-items: center;
621
+ color: #333333;
622
+ .consume_icon{
623
+ width: 60rpx;
624
+ display: flex;
625
+ justify-content: flex-start;
626
+ ._img{
627
+ width: 30rpx;
628
+ height: 30rpx;
629
+ image{
630
+ width: 100%;
631
+ height: 100%;
632
+ }
633
+ }
634
+ }
635
+ }
636
+ }
637
+ }
1037
638
 
1038
639
  .shop {
1039
640
  border: 2rpx solid #E6E6E6;
1040
641
  padding: 30rpx 40rpx;
1041
642
  border-radius: 24rpx;
1042
643
  color: #fff;
1043
- font-size: 26rpx;
644
+ font-size: 28rpx;
1044
645
  display: flex;
1045
646
  justify-content: space-between;
1046
647
  align-items: center;
1047
648
  width: 520rpx;
1048
649
  background: linear-gradient(135deg, #2D2824 0%, #625344 100%);
1049
- ;
1050
650
  }
1051
651
 
1052
652
  .bar-code {
@@ -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;