jufubao-base 1.0.297-beta23 → 1.0.298

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,32 +11,11 @@
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
-
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>
14
+ <view v-if="isFlow">
15
+ <view @click="handleToShop" class="shop">
16
+ <view>{{shopName}}</view>
17
+ <XdFontIcon size="20" icon="iconxiangyou_xian"></XdFontIcon>
37
18
  </view>
38
- </template>
39
- <view v-else style="padding-bottom: 40rpx;">
40
19
  <view class="verification-item">
41
20
  <view class="verification-item-label">提货标签</view>
42
21
  <view class="verification-item-tags">
@@ -55,79 +34,72 @@
55
34
  <view :style="{color:mainColor}" class="tip">*提货点数请咨询店员,提货成功后无法退换</view>
56
35
  </view>
57
36
  </view>
58
- <XdButton v-if="btnDisabled" style="margin-top: 100rpx;display:block" width="260rpx" type="primary" disabled>
37
+ <XdButton v-if="btnDisabled" style="margin-top: 200rpx;display:block" width="260rpx" type="primary" disabled>
59
38
  下一步</XdButton>
60
- <XdButton v-else style="margin-top: 100rpx;display:block" width="260rpx" type="primary" @click="toPayOrder">
39
+ <XdButton v-else style="margin-top: 200rpx;display:block" width="260rpx" type="primary" @click="toPayOrder">
61
40
  下一步</XdButton>
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>折
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>
70
53
  </view>
71
54
  </view>
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>
55
+ <view class="is-vip" v-else>
56
+ <text>PLUS</text>会员核销最低可享 <text>{{plusDiscount/1000}}</text>折
76
57
  </view>
77
58
  </view>
78
- <view class="is-vip" v-else>
79
- <text>PLUS</text>会员核销最低可享 <text>{{plusDiscount/1000}}</text>折
80
- </view>
81
59
  </view>
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>
95
- </view>
96
- <view >{{ scanName }}</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>
97
65
  </view>
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>
109
- </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>
110
80
  </view>
111
- <view >{{ JHDName }}</view>
112
81
  </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>
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>
124
94
  </view>
125
95
  </view>
126
- <view >{{ QPName }}</view>
96
+ <view class="is-vip" v-else>
97
+ <text>PLUS</text>会员消费最低可享 <text>{{plusDiscount/1000}}</text>折
98
+ </view>
127
99
  </view>
128
- <xd-font-icon :size="28" icon="iconxiangyou_xian"></xd-font-icon>
129
100
  </view>
130
- </template>
101
+ </view>
102
+
131
103
  </view>
132
104
  </view>
133
105
  <view :style="{
@@ -208,11 +180,8 @@
208
180
  import XdDeductSort from "./XdDeductSort.vue"
209
181
  import { jfbRootExec } from "@/utils/xd.event";
210
182
  import JfbBaseConsumpCodeMixin from "./JfbBaseConsumpCodeMixin";
211
- import QPMixin from "./QPMixin"; //展码消费
212
- import JHDMixin from "./JHDMixin"; //聚好兑
213
- import shopListMixin from "./shopListMixin";
214
183
  import getServiceUrl from "@/common/getServiceUrl";
215
- import { getContainerPropsValue, isWechat, isWechatTools, gCPVal } from "@/utils/xd.base";
184
+ import { getContainerPropsValue, isWechat, isWechatTools } from "@/utils/xd.base";
216
185
  import componentsMixins from "@/mixins/componentsMixins";
217
186
  import extsMixins from "@/mixins/extsMixins";
218
187
  import { mapState } from 'vuex';
@@ -231,15 +200,35 @@
231
200
  XdDeductSort
232
201
  },
233
202
  mixins: [
234
- componentsMixins, extsMixins, JfbBaseConsumpCodeMixin, QPMixin, JHDMixin, shopListMixin
203
+ componentsMixins, extsMixins, JfbBaseConsumpCodeMixin
235
204
  ],
236
205
  data() {
237
206
  return {
207
+ openPath: "",
208
+ shopPath: "",
209
+ successPath: "",
210
+ cashPayPath: "",
238
211
  showDialog: false,
239
212
  showMask: true,
240
213
  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: "",
241
224
  options: {},
242
225
  canEdit: true,
226
+ settle_tag_list: [],
227
+ settle_tag_list_status: false,
228
+ tag_id: "",
229
+ price: "",
230
+ total_price: "",
231
+ num: 1,
243
232
  tip: '',
244
233
  shopName: '',
245
234
  shopLogo: "",
@@ -249,43 +238,18 @@
249
238
  userInfo: {},
250
239
  is_vip: 'N',
251
240
  isPreview: false,
241
+ jwxSDK: null,
252
242
  refresh: true, //onshow是否刷新数据
253
243
  showLocationDialog: false,
244
+ cityPath: '',
254
245
  resource_shop_id: '',
255
- consume_options: [], //当前门店支持的核销方式
256
- default_consume_type: '', //默认核销方式
257
- baseInfo: {}, //基础接口返回信息 - 展码及门店基本信息
258
- curConsumeType: "JHD", //当前选择的核销方式, 默认聚好兑
246
+ qrcode_icon: '',
247
+ deductDialog: false,
248
+ paySortList: [],
249
+ tempList: [],
259
250
 
260
251
  bodyBgImg: "",
261
- contBgcColor: "#fff",
262
252
  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
-
289
253
  }
290
254
  },
291
255
  watch: {
@@ -305,17 +269,43 @@
305
269
  brandInfo: state => state.brandInfo,
306
270
  jfbAuthorize: (state) => state.jfbAuthorize,
307
271
  }),
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
+ },
308
294
  btnDisabled() {
309
295
  return this.total_price === '' || !this.tag_id;
310
296
  },
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
+ },
311
302
  bodyStyleComp(){
312
303
  return {
313
304
  minHeight: this.layoutInfo.bodyMinHeightRpx + 'rpx',
314
305
  backgroundImage: `url(${this.bodyBgImg})`,
315
- backgroundColor: this.contBgcColor,
316
306
  backgroundSize: '100% 100%'
317
307
  }
318
- },
308
+ }
319
309
  },
320
310
  created() {
321
311
  this.isPreview = this.$configProject['isPreview']
@@ -329,10 +319,10 @@
329
319
  },
330
320
  methods: {
331
321
  async onJfbLoad(options) {
322
+ // this.xnamespace = this.projectAttr.business_code
332
323
  this.setNameSpace(options, false);
333
324
  this.getUserInfo()
334
325
  this.options = options
335
- this.resource_shop_id = options.resource_shop_id;
336
326
  if (!this.isPreview) {
337
327
  console.log(this.stateLocation, 'this.stateLocation');
338
328
 
@@ -346,92 +336,211 @@
346
336
  this.showLocationDialog = false
347
337
  }
348
338
  }
349
- if(this.options.shop_id || this.isPreview){
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
361
  this.shop_id = this.options.shop_id;
351
362
  this.resource_shop_id = this.options.resource_shop_id;
352
- let isFirst = true;
353
363
  this.p_getAsyncStep((err) => {
354
364
  if(err === 'error'){
355
365
  }else{
356
366
  this.showShopList = false;
357
367
  this.showMask = false;
358
368
  }
359
- }, isFirst);
360
- }else{
361
- //没有门店id,展示门店列表去选择门店
362
- this.showShopList = true;
369
+
370
+ });
363
371
  }
372
+ this.p_getMyPayOrderConfig();
364
373
  },
365
374
  /**
366
375
  * @description 监听事件变化
367
376
  * @param container {object} 业务组件对象自己
368
377
  */
369
378
  init(container) {
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;
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;
377
403
  this.bodyBgImg = getServiceUrl(getContainerPropsValue(container, 'content.bodyBgImg', {url: ""}).url);
378
- this.contBgcColor = gCPVal(container, 'contBgcColor', '#fff')
379
404
  this.isShowPaySoft = getContainerPropsValue(container, 'content.isShowPaySoft', "N");
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,
406
- })
407
- return;
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;
408
441
  }
409
- //当前为展码,清除定时器
410
- if(this.curConsumeType === 'QP') this.clearAllTimer();
411
- this.curConsumeType = consumeType;
412
- this.p_getAsyncStep();
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
+ })
413
458
  },
414
- async p_getAsyncStep(cb, isFirst) {
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);
492
+ })
493
+ })
494
+ },
495
+ async p_getAsyncStep(cb) {
415
496
  try{
416
- await this.p_getQuickPayQRCode(isFirst);
497
+ await this.p_getQuickPayQRCode();
417
498
  }catch(e){
418
499
  if(cb) cb('error');
419
500
  return;
420
501
  }
421
502
  if(cb) cb();
422
- if (this.curConsumeType === 'QP') {
423
- this.p_getMyPayOrderConfig();
503
+ if (!this.isFlow) {
424
504
  this.p_getQRCodeStatus();
425
505
  this.p_getListUserPayChannel();
426
506
  }
427
507
  },
428
- //获取支付码及门店信息 - 60秒轮询刷新二维码信息
429
- p_getQuickPayQRCode(isFirst) {
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() {
430
537
  return new Promise((resolve, reject) => {
431
538
  this.$xdShowLoading({});
432
539
  let data = {
433
540
  shop_id: this.shop_id,
434
541
  temp_order_id: this.temp_order_id,
542
+ // business_code: this.xnamespace,
543
+ // resource_shop_id: this.resource_shop_id
435
544
  }
436
545
  if(data.resource_shop_id) delete data.shop_id
437
546
  jfbRootExec("getConsumpCode", {
@@ -439,19 +548,15 @@
439
548
  data: data
440
549
  }).then(res => {
441
550
  this.$xdHideLoading();
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'){
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 {
455
560
  // 消费码
456
561
  this.temp_order_id = res.temp_order_id;
457
562
  let code_url = this.brandInfo['api_host'] + res.code_url;
@@ -467,6 +572,8 @@
467
572
  this.qrcode_icon = qrcode_icon;
468
573
  this.barCode = res.payment_code
469
574
  this.expiration_sec = res.expiration_sec;
575
+ this.showMask = false;
576
+ this.shopName = res.resource_shop_name;
470
577
  this.shopLogo = getServiceUrl(res.shop_icon)
471
578
  clearInterval(this.secondTimer);
472
579
  this.secondTimer = setInterval(() => {
@@ -476,17 +583,348 @@
476
583
  this.p_getQuickPayQRCode();
477
584
  }
478
585
  }, 1000);
479
- }else{
480
- //扫水牌,核销标签列表
481
- this.getSettleTagList();
586
+ resolve();
482
587
  }
483
- resolve();
588
+
484
589
  }).catch(err => {
485
590
  console.error(err);
486
591
  reject(err);
487
592
  })
488
593
  })
489
594
  },
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
+ },
490
928
  handleToOpen() {
491
929
  this.$xdUniHelper.navigateTo({
492
930
  url: this.openPath
@@ -496,39 +934,41 @@
496
934
  this.showDialog = false;
497
935
  this.p_getAsyncStep();
498
936
  },
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
+ },
499
949
  handleToCity() {
500
950
  this.$xdUniHelper.navigateTo({
501
951
  url: this.cityPath
502
952
  },true);
503
953
  },
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
- })
954
+ handleNumberChange(num) {
955
+ let curTag = this.curTag;
956
+ this.total_price = this.$xdUniHelper.multiplyFloatNumber(curTag.price_yuan, num);
514
957
  },
515
- //清除所有定时器
516
- clearAllTimer(){
958
+ onJfbUnload(options) {
959
+ console.log('event.onJfbUnload', options)
517
960
  if (this.secondTimer) clearInterval(this.secondTimer);
518
961
  if (this.statusTimer) clearTimeout(this.statusTimer);
519
962
  if (this.orderTimer) clearTimeout(this.orderTimer);
520
963
  },
521
-
522
- onJfbUnload(options) {
523
- console.log('event.onJfbUnload', options)
524
- this.clearAllTimer();
525
- },
526
964
  onJfbBack(options) {
527
965
  console.log('event.onJfbBack', options)
528
- this.clearAllTimer();
966
+ if (this.secondTimer) clearInterval(this.secondTimer);
967
+ if (this.statusTimer) clearTimeout(this.statusTimer);
968
+ if (this.orderTimer) clearTimeout(this.orderTimer);
529
969
  },
530
970
  onJfbScroll(options) {
531
- // console.log('event.onJfbScroll', options)
971
+ console.log('event.onJfbScroll', options)
532
972
  },
533
973
  onJfbReachBottom(options) {
534
974
  console.log('event.onJfbReachBottom', options)
@@ -541,7 +981,9 @@
541
981
  },
542
982
  onJfbHide(options) {
543
983
  console.log('event.onJfbHide', options)
544
- this.clearAllTimer();
984
+ if (this.secondTimer) clearInterval(this.secondTimer);
985
+ if (this.statusTimer) clearTimeout(this.statusTimer);
986
+ if (this.orderTimer) clearTimeout(this.orderTimer);
545
987
  },
546
988
  onJfbUpdate(...data) {
547
989
  console.log('event.onJfbUpdate', data)
@@ -560,21 +1002,16 @@
560
1002
  .jfb-base-consump-code {
561
1003
  &__body {
562
1004
  .content-box {
563
- margin: 160rpx 30rpx 0 30rpx;
1005
+ margin: 0 30rpx 0 30rpx;
564
1006
  background-color: #fff;
565
1007
  padding: 81rpx 32rpx 32rpx 32rpx;
566
1008
  border-radius: 24rpx;
1009
+ position: relative;
1010
+ top: 158rpx;
567
1011
  display: flex;
568
1012
  flex-direction: column;
569
1013
  align-items: center;
570
1014
  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
- }
578
1015
 
579
1016
  .logo-box {
580
1017
  width: 154rpx;
@@ -597,43 +1034,6 @@
597
1034
  }
598
1035
 
599
1036
  }
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
- }
637
1037
 
638
1038
  .shop {
639
1039
  border: 2rpx solid #E6E6E6;
@@ -684,7 +1084,6 @@
684
1084
  padding: 40rpx 0;
685
1085
  align-items: center;
686
1086
  border-top: 1px dashed rgba(229, 229, 229, 1);
687
- width: 100%;
688
1087
  .pay_title{
689
1088
  font-size: 28rpx;
690
1089
  margin-bottom: 24rpx;