jufubao-base 1.0.290-beta3 → 1.0.290

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.
Files changed (30) hide show
  1. package/package.json +1 -1
  2. package/src/components/CusCouponChose/CusCouponChose.vue +1027 -0
  3. package/src/components/CusCouponItem/CusCouponItem.vue +298 -0
  4. package/src/components/CusEnter/CusEnter.vue +360 -0
  5. package/src/components/CusPoster/CusPoster.vue +212 -0
  6. package/src/components/CusPoster/CusSwiperDot.vue +234 -0
  7. package/src/components/CusProduct/CusProduct.vue +372 -0
  8. package/src/components/CusShops/CusShops.vue +518 -0
  9. package/src/components/CusSwiperDot/CusSwiperDot.vue +234 -0
  10. package/src/components/CusTab/CusTab.vue +411 -0
  11. package/src/components/CusVideo/CusVideo.vue +170 -0
  12. package/src/components/JfbBaseFooter/Attr.js +10 -155
  13. package/src/components/JfbBaseFooter/JfbBaseFooter.vue +98 -44
  14. package/src/components/JfbBaseFooter/XdFooterBar.vue +324 -0
  15. package/src/components/JfbBaseFooter/cusAttr/advanced.js +12 -0
  16. package/src/components/JfbBaseFooter/cusAttr/content.js +475 -0
  17. package/src/components/JfbBaseFooter/cusAttr/style.js +7 -0
  18. package/src/components/JfbBaseFooter/cusAttr/tools.js +17 -0
  19. package/src/components/JfbBaseSavingDetail/JfbBaseSavingDetail.vue +3 -15
  20. package/src/components/JfbBaseTfkSearch/Api.js +15 -0
  21. package/src/components/JfbBaseTfkSearch/CustomList.vue +10 -0
  22. package/src/components/JfbBaseTfkSearch/JfbBaseTfkSearch.vue +255 -7
  23. package/src/components/JfbBaseTfkSearch/XdQueryFilter.vue +347 -0
  24. package/src/components/JfbBaseTfkSearch/XdQuerySort.vue +192 -0
  25. package/src/components/JfbBaseTfkSearch/listMixins.js +8 -6
  26. package/src/components/JfbBaseUserInfo/Attr.js +12 -0
  27. package/src/components/JfbBaseUserInfo/JfbBaseUserInfo.vue +8 -2
  28. package/src/mixins/componentsMixins.js +363 -55
  29. package/src/mixins/posterMixins.js +27 -199
  30. package/src/mixins/productCompMixins.js +252 -0
@@ -0,0 +1,1027 @@
1
+ <template>
2
+ <view class="xd-card-pay">
3
+ <slot></slot>
4
+ <xd-down-drawer
5
+ :show.sync="xdDownDrawer"
6
+ :isBodyClose="false"
7
+ :z-index="3000"
8
+ >
9
+ <view style="height: 80rpx; background: #fff"></view>
10
+ <view class="jfb-cashier-verification-pay__body">
11
+ <view class="column-group">
12
+ <view class="column-item">
13
+ <view class="column_label">
14
+ 我的优惠券
15
+ <view
16
+ :style="{ color: style.$warningColor }"
17
+ v-if="checkedCards.length > 0"
18
+ class="label_sub"
19
+ >(已使用{{ checkedCards.length }}张优惠券)</view
20
+ >
21
+ <view
22
+ :style="{ marginLeft: '20rpx', color: style.$warningColor }"
23
+ class="label_sub"
24
+ v-else
25
+ >请勾选优惠券</view
26
+ >
27
+ </view>
28
+ <view class="column_value">
29
+ <xd-button
30
+ width="260rpx"
31
+ radius="60rpx"
32
+ type="primary"
33
+ size="small"
34
+ @click="xdDownDrawerNewCard = true"
35
+ >使用新优惠券</xd-button
36
+ >
37
+ </view>
38
+ </view>
39
+ <view class="column-item">
40
+ <view class="column_label">
41
+ 仍需支付
42
+ <view class="label_sub">(可使用多张优惠券支付)</view>
43
+ </view>
44
+ <view class="column_value text-primary">
45
+ <xd-unit
46
+ :price="needPayPrice"
47
+ :isOld="false"
48
+ :font-size="32"
49
+ :icon-size="0.3"
50
+ ></xd-unit>
51
+ </view>
52
+ </view>
53
+ </view>
54
+ <view class="ticket_list" :key="renderChecked">
55
+ <view v-if="showCouponList.length" class="coupon_list">
56
+ <CusCouponItem
57
+ style="margin-bottom: 20rpx"
58
+ v-for="(item, i) in showCouponList"
59
+ :key="i"
60
+ :couponRadius="couponRadius"
61
+ :couponImageUrl="couponImageUrl"
62
+ :couponTitleBgColor="couponTitleBgColor"
63
+ :couponUseBtnPadding="couponUseBtnPadding"
64
+ :couponBtnRadius="couponBtnRadius"
65
+ :couponBtnTextStyle="couponBtnTextStyle"
66
+ :couponLeftBgColor="couponLeftBgColor"
67
+ :item="item"
68
+ :mainColor="mainColor"
69
+ >
70
+ <template slot="btn">
71
+ <div @click="handlerTicketSelect(!checkedCards.includes(item.card_number), item)">
72
+ <xd-radio
73
+ class="cou_btn"
74
+ :disabled="item.is_valid === 'N' || item.card_point == 0"
75
+ size="mini"
76
+ :value="checkedCards.includes(item.card_number)"
77
+ ></xd-radio>
78
+ </div>
79
+ </template>
80
+ </CusCouponItem>
81
+ <!-- <view v-if="!hasCouponList" class="no_more_card"
82
+ >没有更多券了,查看失效的优惠券 ></view
83
+ > -->
84
+ </view>
85
+ <view
86
+ :style="{ color: mainColor }"
87
+ class="ticket_add_new"
88
+ @click="xdDownDrawerNewCard = true"
89
+ >
90
+ <view :style="{ backgroundColor: mainColor }" class="plus_icon"
91
+ >+</view
92
+ >
93
+ <view>使用新优惠券</view>
94
+ </view>
95
+ </view>
96
+ <view style="height: 100rpx"></view>
97
+ <view v-if="xdDownDrawer" class="bottom_btn" :style="alert_bottom">
98
+ <xd-button
99
+ width="360rpx"
100
+ type="primary"
101
+ radius="50rpx"
102
+ @click="doTicketPay"
103
+ >确认支付</xd-button
104
+ >
105
+ </view>
106
+ </view>
107
+ </xd-down-drawer>
108
+ <xd-down-drawer
109
+ :show.sync="xdDownDrawerNewCard"
110
+ :z-index="3010"
111
+ height="580rpx"
112
+ @close="switchValidToken"
113
+ >
114
+ <view class="drawer_title">使用新优惠券</view>
115
+ <xd-form label-width="200" label-align="left" content-align="left">
116
+ <xd-form-item label="优惠券号码" content-align="left">
117
+ <view class="flex align-center">
118
+ <xd-form-input
119
+ placeholder="电子码无需输入券号"
120
+ v-model="cardForm.card_number"
121
+ />
122
+ <view v-if="isQrCode" class="scan_icon" @click="doScanCode">
123
+ <xd-font-icon icon="iconsaoma"></xd-font-icon>
124
+ </view>
125
+ </view>
126
+ </xd-form-item>
127
+ <xd-form-item label="优惠券密码" content-align="left">
128
+ <xd-form-input
129
+ placeholder="请输入优惠券密码"
130
+ v-model="cardForm.card_password"
131
+ />
132
+ </xd-form-item>
133
+ <xd-form-item label="验证码" content-align="left">
134
+ <view class="flex align-center">
135
+ <xd-form-input
136
+ placeholder="请输入验证码"
137
+ v-model="cardForm.valid_code"
138
+ />
139
+ <view
140
+ v-if="cardForm.valid_token"
141
+ class="capture"
142
+ @click="switchValidToken"
143
+ >
144
+ <image
145
+ style="width: 100%; height: 100%"
146
+ :src="
147
+ validImageAPIUrl +
148
+ '?image_width=180&image_height=80&token=' +
149
+ cardForm.valid_token
150
+ "
151
+ />
152
+ </view>
153
+ </view>
154
+ </xd-form-item>
155
+ </xd-form>
156
+ <xd-button
157
+ width="360rpx"
158
+ type="primary"
159
+ radius="50rpx"
160
+ @click="addNewCoupon()"
161
+ >使用新优惠券</xd-button
162
+ >
163
+ <view :style="{ height: layoutInfo.bottom + 'rpx' }"></view>
164
+ </xd-down-drawer>
165
+ </view>
166
+ </template>
167
+ <script>
168
+ /**
169
+ * @description 选择卡券支付 & 支持三方支付
170
+ * @property show {Boolean} 是否显示支付卡券弹窗
171
+ * @property layoutInfo {Object} XdLayout返回的布局信息
172
+ * @property validImageAPIUrl {String} 图片验证码接口API地址
173
+ * @property jwxSDK {Object} JSSDK授权对象
174
+ * @property price {Number|String} 订单总额 单位元
175
+ * @property getSettleListCoupons {Function(successCallBack(cardList))} 获取支付卡券列表
176
+ * @property setSettleSelectCoupon {Function(options, successCallBack, errCallBack)} 选择卡券列表
177
+ * @property addSettleCoupon {Function(options, successCallBack)} 添加卡券
178
+ *
179
+ */
180
+ import XdDownDrawer from "@/components/XdDownDrawer/XdDownDrawer";
181
+ import XdButton from "@/components/XdButton/XdButton";
182
+ import XdUnit from "@/components/XdUnit/XdUnit";
183
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
184
+ import XdRadio from "@/components/XdRadio/XdRadio";
185
+ import XdForm from "@/components/XdForm/XdForm";
186
+ import XdFormItem from "@/components/XdFormItem/XdFormItem";
187
+ import XdFormInput from "@/components/XdFormInput/XdFormInput";
188
+ import CusCouponItem from "@/components/CusCouponItem/CusCouponItem";
189
+ import {
190
+ getParentsStyle, //获取页面风格单个键值值
191
+ getParentsStyles, //获取页面风格列表
192
+ isQrCode,
193
+ } from "@/utils/xd.base";
194
+
195
+ export default {
196
+ name: "CusCouponChose",
197
+ components: {
198
+ XdDownDrawer,
199
+ XdButton,
200
+ XdUnit,
201
+ XdFontIcon,
202
+ XdRadio,
203
+ XdForm,
204
+ XdFormItem,
205
+ XdFormInput,
206
+ CusCouponItem,
207
+ },
208
+ props: {
209
+ show: false,
210
+ layoutInfo: {},
211
+ validImageAPIUrl: {
212
+ //图片验证码 接口地址
213
+ type: String,
214
+ },
215
+ orderTotalPrice: {
216
+ //订单总额 单位元
217
+ type: String | Number,
218
+ default: "100",
219
+ },
220
+ orderNeedPayPrice: {
221
+ type: String | Number,
222
+ default: "100",
223
+ },
224
+ jwxSDK: {
225
+ //JSSDK授权对象
226
+ type: Object,
227
+ },
228
+ getSettleListCoupons: {
229
+ //支付卡券列表
230
+ type: Function,
231
+ },
232
+ setSettleSelectCoupon: {
233
+ //选择卡券列表
234
+ type: Function,
235
+ },
236
+ addSettleCoupon: {
237
+ //添加卡券
238
+ type: Function,
239
+ },
240
+ hadChoseCoupon: {
241
+ type: null | Array,
242
+ },
243
+ mainColor: {
244
+ type: String,
245
+ },
246
+ couponRadius: {
247
+ type: String | Number,
248
+ default: "16",
249
+ },
250
+ couponLeftBgColor: {
251
+ type: String,
252
+ default: "linear-gradient(180deg, #FFA852 0%, #FF5733 100%)",
253
+ },
254
+ couponImageUrl: {
255
+ type: Object | String,
256
+ },
257
+ couponTitleBgColor: {
258
+ type: String,
259
+ default: "rgba(255, 87, 51, 0.1)",
260
+ },
261
+ couponUseBtnPadding: {
262
+ type: Object,
263
+ default() {
264
+ return {
265
+ top: 20,
266
+ right: 20,
267
+ bottom: 10,
268
+ left: 20,
269
+ };
270
+ },
271
+ },
272
+ couponBtnRadius: {
273
+ type: String | Number,
274
+ default: "16",
275
+ },
276
+ couponBtnTextStyle: {
277
+ type: Object,
278
+ default() {
279
+ return {
280
+ color: "#fff",
281
+ bgColor: "#ff5722",
282
+ fontSize: "30rpx",
283
+ fontWeight: "normal",
284
+ };
285
+ },
286
+ },
287
+ },
288
+ watch: {
289
+ show(n, o) {
290
+ this.xdDownDrawer = n;
291
+ },
292
+ xdDownDrawer(n, o) {
293
+ console.log("xdDownDrawer value", n, o);
294
+ if (n) {
295
+ console.log(this.hadChoseCoupon,'hadChoseCoupon');
296
+ let checkedArr = (this.hadChoseCoupon || []).map((c) => c.card_number);
297
+ this.selectedCardList = this.selectedCardList.map((item) => {
298
+ if (!checkedArr.includes(item.card_number)) {
299
+ this.needPayPrice = +this.needPayPrice + item["card_use_price"];
300
+ this.cardPayPrice = this.cardPayPrice - item.card_use_price;
301
+ item["card_use_point"] = 0;
302
+ }
303
+ return item;
304
+ });
305
+ }
306
+ this.$emit("update:show", n);
307
+ this.$emit("onAlert");
308
+ },
309
+ orderTotalPrice: {
310
+ handler(n) {
311
+ this.clearChecked();
312
+ },
313
+ },
314
+ orderNeedPayPrice(n, o) {
315
+ console.log("orderNeedPayPrice", n);
316
+ this.needPayPrice = n;
317
+ },
318
+ xdDownDrawerNewCard(n) {
319
+ if (!n) {
320
+ this.cardForm = {
321
+ card_number: "",
322
+ card_password: "",
323
+ valid_code: "",
324
+ valid_token: this.$xdUniHelper.randomChar(20),
325
+ };
326
+ }
327
+ },
328
+ },
329
+ data() {
330
+ return {
331
+ xdDownDrawer: false,
332
+ xdDownDrawerNewCard: false,
333
+ channel_provider_id: "",
334
+ cardList: [], //展示
335
+ selectedCardList: [],
336
+ needPayPrice: 0,
337
+ cardPayPrice: 0,
338
+ cardForm: {
339
+ //添加新卡券表单
340
+ card_number: "",
341
+ card_password: "",
342
+ valid_code: "", //验证码正文
343
+ valid_token: "", //验证码token
344
+ },
345
+ renderChecked: "renderChecked",
346
+
347
+ total_price: "",
348
+ style: {},
349
+ isQrCode: false,
350
+ hasCouponList: false,
351
+ };
352
+ },
353
+ computed: {
354
+ showCouponList() {
355
+ //筛选出不存在于cardList的数据
356
+ let otherCardList = this.selectedCardList.filter((item) => {
357
+ let cur = this.cardList.find(
358
+ (ii) => ii.card_number == item.card_number
359
+ );
360
+ return !cur;
361
+ });
362
+ //合并selectedCardList数据到对应的cardList
363
+ let combineList = this.cardList.map((item) => {
364
+ let cur = this.selectedCardList.find(
365
+ (ii) => ii.card_number == item.card_number
366
+ );
367
+ if (cur) return Object.assign(item, cur);
368
+ return item;
369
+ });
370
+ return combineList.concat(otherCardList);
371
+ },
372
+ checkedCards() {
373
+ return this.showCouponList
374
+ .filter((item) => item.card_use_point > 0)
375
+ .map((item) => item.card_number);
376
+ },
377
+ //提交是的selectedCardList, 由于取消选中不走接口 & 避免取消隐藏
378
+ submitCardList() {
379
+ return this.selectedCardList.filter((item) => item.card_use_point > 0);
380
+ },
381
+ alert_bottom() {
382
+ return this.fixedStyle({ paddingBottom: 24, zIndex: 110 });
383
+ },
384
+ },
385
+ async created() {
386
+ this.isQrCode = isQrCode(this);
387
+ this.switchValidToken();
388
+ this.style = await getParentsStyles(this.$parent);
389
+ console.log(this.mainColor, "this.$parent");
390
+ this.handleInit();
391
+ },
392
+ methods: {
393
+ handleInit() {
394
+ this.total_price = this.$xdUniHelper.multiplyFloatNumber(
395
+ this.orderTotalPrice,
396
+ 100
397
+ );
398
+ this.needPayPrice = this.total_price;
399
+ this.getList();
400
+ this.selectedCardList = this.selectedCardList.map((item) => {
401
+ item["card_use_point"] = 0;
402
+ return item;
403
+ });
404
+ },
405
+ clearChecked() {
406
+ console.log("xdCardPayChose", this.orderTotalPrice);
407
+ this.total_price = this.$xdUniHelper.multiplyFloatNumber(
408
+ this.orderTotalPrice,
409
+ 100
410
+ );
411
+ this.needPayPrice = this.total_price;
412
+ this.cardPayPrice = 0;
413
+ this.selectedCardList = this.selectedCardList.map((item) => {
414
+ item["card_use_point"] = 0;
415
+ return item;
416
+ });
417
+ this.doTicketPay();
418
+ },
419
+ divideFloatNumber(num) {
420
+ return this.$xdUniHelper.divisionFloatNumber(num, 100);
421
+ },
422
+ fixedStyle(options = {}, type = "bottom") {
423
+ let paddingBottom = options.paddingBottom || options.height || 0;
424
+ if (options.paddingBottom) delete options.paddingBottom;
425
+ if (options.height) delete options.height;
426
+ let obj = Object.assign(
427
+ {},
428
+ {
429
+ top: 0,
430
+ left: 0,
431
+ right: 0,
432
+ bottom: 0,
433
+ zIndex: 100,
434
+ },
435
+ options
436
+ );
437
+ let style = "position: fixed";
438
+ style = `${style};left:${obj.left}rpx`;
439
+ style = `${style};right:${obj.right}rpx`;
440
+ style = `${style};z-index:${obj.zIndex}`;
441
+ if (type === "bottom") {
442
+ let padding =
443
+ (this.layoutInfo.bottomHeight +
444
+ this.layoutInfo.footerHeight +
445
+ paddingBottom) *
446
+ this.$rpxNum;
447
+ style = `${style}; padding-bottom:calc(${padding}px + constant(safe-area-inset-bottom));`;
448
+ style = `${style}; padding-bottom:calc(${padding}px + env(safe-area-inset-bottom));`;
449
+ style = `${style};bottom:0;`;
450
+ }
451
+ if (type === "top") {
452
+ style = `${style};top:${obj.top}rpx`;
453
+ }
454
+ return style;
455
+ },
456
+ getTimeFormat(time) {
457
+ let date = null;
458
+ if (time == +time) {
459
+ if ((time + "").length <= 10) date = new Date(+time * 1000);
460
+ else date = new Date(+time);
461
+ return (
462
+ date.getFullYear() +
463
+ "-" +
464
+ (date.getMonth() + 1) +
465
+ "-" +
466
+ date.getDate()
467
+ );
468
+ }
469
+ return time;
470
+ },
471
+ getList() {
472
+ let callThis = this;
473
+ // #ifdef MP
474
+ callThis = this.$parent;
475
+ // #endif
476
+ //获取卡券列表
477
+ callThis.getSettleListCoupons((cardList) => {
478
+ this.$xdLog.setARMSInfo(
479
+ this.filterMGinfo(cardList),
480
+ "init_binded_list"
481
+ );
482
+ this.cardList = cardList;
483
+ });
484
+ },
485
+ //选卡弹出项
486
+ useCardPop(data) {
487
+ return new Promise((resolve, reject) => {
488
+ this.$xdConfirm({
489
+ title: '提示',
490
+ content: data.pop_message,
491
+ confirmText: data.confirm_text,
492
+ cancelText: data.cancel_text,
493
+ width: '85%',
494
+ isTitle: true,
495
+ success: (res) => {
496
+ if (res.confirm) {
497
+ resolve(2);
498
+ } else if (res.cancel) {
499
+ if(data.pop_type == 'confirm'){
500
+ resolve();
501
+ }else{
502
+ resolve(3);
503
+ }
504
+ }
505
+ },
506
+ fail: function (res) {
507
+ reject(res);
508
+ }
509
+ });
510
+ });
511
+ },
512
+
513
+ //选择卡券
514
+ handlerTicketSelect(flat, ticket, options) {
515
+ if (flat) {
516
+ //选择卡券,重新调用接口获取 selectedCardList, neePayPrice
517
+ const { submitCardList, total_price } = this;
518
+ let callThis = this;
519
+ // #ifdef MP
520
+ callThis = this.$parent;
521
+ // #endif
522
+ this.$xdShowLoading({});
523
+ callThis.setSettleSelectCoupon(
524
+ {
525
+ total_price,
526
+ card_number: ticket.card_number,
527
+ selected_card_list_json: JSON.stringify(submitCardList),
528
+ ...options,
529
+ },
530
+ (res) => {
531
+ let resOptions = JSON.parse(JSON.stringify(res));
532
+ if (resOptions["selected_card_list1"])
533
+ delete resOptions["selected_card_list1"];
534
+ if (resOptions["selected_card_list"]) {
535
+ resOptions["selected_card_list"] = this.filterMGinfo(
536
+ resOptions["selected_card_list"]
537
+ );
538
+ }
539
+ this.$xdLog.setARMSInfo(
540
+ {
541
+ card_number: ticket.card_number,
542
+ selected_card_list_json: this.filterMGinfo(submitCardList),
543
+ ...options,
544
+ res: resOptions,
545
+ },
546
+ "select_binded_card"
547
+ );
548
+ this.$xdHideLoading();
549
+ const {
550
+ selected_card_list,
551
+ need_pay_price,
552
+ is_need_pop,
553
+ card_total_use_price,
554
+ } = res;
555
+ if (is_need_pop) {
556
+ this.useCardPop(res)
557
+ .then((select_content) => {
558
+ if (select_content) {
559
+ this.handlerTicketSelect(true, ticket, { select_content });
560
+ } else {
561
+ this.handlerTicketSelect(false, ticket);
562
+ }
563
+ })
564
+ .catch(() => {});
565
+ } else {
566
+ this.selectedCardList = selected_card_list;
567
+ this.needPayPrice = need_pay_price;
568
+ this.cardPayPrice = card_total_use_price;
569
+ this.renderChecked = Date.now();
570
+ }
571
+ },
572
+ (err) => {
573
+ this.$xdHideLoading();
574
+ this.renderChecked = Date.now();
575
+ }
576
+ );
577
+ } else {
578
+ this.$xdLog.setARMSInfo(
579
+ {
580
+ ticket: this.filterMGinfo(ticket),
581
+ ...options,
582
+ },
583
+ "cancel_card"
584
+ );
585
+ //不走接口, selectedCardList不是真实选中的
586
+ this.selectedCardList = this.selectedCardList.map((item) => {
587
+ if (item.card_number == ticket.card_number) {
588
+ this.needPayPrice = +this.needPayPrice + item["card_use_price"];
589
+ item["card_use_price"] = 0;
590
+ item["card_use_point"] = 0;
591
+ }
592
+ return item;
593
+ });
594
+ if (ticket.is_new) {
595
+ this.cardList = this.cardList.filter(
596
+ (item) => item.card_number != ticket.card_number
597
+ );
598
+ this.selectedCardList = this.selectedCardList.filter(
599
+ (item) => item.card_number != ticket.card_number
600
+ );
601
+ }
602
+ this.cardPayPrice = this.cardPayPrice - ticket.card_use_price;
603
+ this.renderChecked = Date.now();
604
+ }
605
+ },
606
+
607
+ filterMGinfo(list) {
608
+ //深拷贝
609
+ if (
610
+ this.$xdUniHelper.checkVarType(list) === "object" ||
611
+ this.$xdUniHelper.checkVarType(list) === "array"
612
+ ) {
613
+ list = JSON.parse(JSON.stringify(list));
614
+ }
615
+ //object
616
+ if (this.$xdUniHelper.checkVarType(list) === "object") {
617
+ if (list.card_use_certificate)
618
+ list.card_use_certificate =
619
+ list.card_use_certificate.substr(0, 2) +
620
+ "********" +
621
+ list.card_use_certificate.substr(-3);
622
+ if (list.card_cert)
623
+ list.card_cert =
624
+ list.card_cert.substr(0, 2) +
625
+ "********" +
626
+ list.card_cert.substr(-3);
627
+ if (list.card_password)
628
+ list.card_password =
629
+ list.card_password.substr(0, 2) +
630
+ "********" +
631
+ list.card_password.substr(-3);
632
+ return list;
633
+ }
634
+
635
+ //array
636
+ return list.map((item) => {
637
+ if (item.card_use_certificate)
638
+ item.card_use_certificate =
639
+ item.card_use_certificate.substr(0, 2) +
640
+ "********" +
641
+ item.card_use_certificate.substr(-3);
642
+ if (item.card_cert)
643
+ item.card_cert =
644
+ item.card_cert.substr(0, 2) +
645
+ "********" +
646
+ item.card_cert.substr(-3);
647
+ if (item.card_password)
648
+ item.card_password =
649
+ item.card_password.substr(0, 2) +
650
+ "********" +
651
+ item.card_password.substr(-4);
652
+ return item;
653
+ });
654
+ },
655
+
656
+ //添加新卡券
657
+ addNewCoupon(options = {}) {
658
+ const { cardForm, total_price, submitCardList } = this;
659
+ let err_tip = "";
660
+ if (!cardForm.card_qrcode) {
661
+ if (!cardForm.valid_code) err_tip = "验证码不能为空";
662
+ else if (!cardForm.card_number && !cardForm.card_password)
663
+ err_tip = "优惠券和密码不能为空";
664
+ }
665
+ if (err_tip) {
666
+ return this.$xdAlert({
667
+ content: err_tip,
668
+ time: 2500,
669
+ isClose: false,
670
+ zIndex: 5000
671
+ });
672
+ }
673
+ let callThis = this;
674
+ // #ifdef MP
675
+ callThis = this.$parent;
676
+ // #endif
677
+ this.$xdShowLoading({});
678
+ callThis.addSettleCoupon(
679
+ {
680
+ ...cardForm,
681
+ selected_card_list_json: JSON.stringify(submitCardList),
682
+ total_price,
683
+ ...options,
684
+ },
685
+ (res) => {
686
+ let resOptions = JSON.parse(JSON.stringify(res));
687
+ resOptions.selected_card_list = this.filterMGinfo(
688
+ resOptions.selected_card_list
689
+ );
690
+ this.$xdLog.setARMSInfo(
691
+ {
692
+ ...options,
693
+ total_price,
694
+ cardForm: {
695
+ ...cardForm,
696
+ card_password: cardForm.card_password
697
+ ? cardForm.card_password.substr(0, 2) +
698
+ "********" +
699
+ cardForm.card_password.substr(-3)
700
+ : "",
701
+ },
702
+ selected_card_list_json: this.filterMGinfo(submitCardList),
703
+ res: resOptions,
704
+ },
705
+ "add_card"
706
+ );
707
+ this.$xdHideLoading();
708
+
709
+ //成功回调
710
+ let {
711
+ selected_card_list = [],
712
+ need_pay_price,
713
+ is_need_pop,
714
+ card_total_use_price,
715
+ } = res;
716
+
717
+ if (is_need_pop) {
718
+ this.useCardPop(res)
719
+ .then((select_content) => {
720
+ if (select_content) this.addNewCoupon({ select_content });
721
+ // this.handlerTicketSelect(true, cardForm.card_number, {select_content})
722
+ })
723
+ .catch((e) => {
724
+ console.error(e);
725
+ });
726
+ return;
727
+ } else {
728
+ // filterCard 去重后的卡券
729
+ let r_cards = this.cardList.map((item) => item.card_number);
730
+ let filterCard = selected_card_list.filter(
731
+ (item) => !r_cards.includes(item.card_number)
732
+ );
733
+ //重合的卡券列表
734
+ let repeatCardList = selected_card_list.filter((item) =>
735
+ r_cards.includes(item.card_number)
736
+ );
737
+
738
+ if (repeatCardList.length > 0) {
739
+ for (let i = 0; i < repeatCardList.length; i++) {
740
+ let repeatCard = repeatCardList[i];
741
+ //重复的以前的卡数据
742
+ let oldCard = this.cardList.find(
743
+ (item) => item.card_number == repeatCard.card_number
744
+ );
745
+ //自动选中当前重合的卡券
746
+ if (
747
+ this.selectedCardList.findIndex(
748
+ (item) => item.card_number == repeatCard.card_number
749
+ ) == -1
750
+ ) {
751
+ this.selectedCardList.push({ ...oldCard, ...repeatCard });
752
+ } else {
753
+ this.selectedCardList = this.selectedCardList.map((item) => {
754
+ if (item.card_number == repeatCard.card_number) {
755
+ item = { ...oldCard, ...repeatCard };
756
+ }
757
+ return item;
758
+ });
759
+ }
760
+ }
761
+ }
762
+
763
+ selected_card_list = filterCard.map((item) => {
764
+ item["is_new"] = true;
765
+ return item;
766
+ });
767
+ this.cardList = selected_card_list.concat(this.cardList);
768
+ this.selectedCardList = selected_card_list.concat(
769
+ this.selectedCardList
770
+ );
771
+ this.needPayPrice = need_pay_price;
772
+ this.cardPayPrice = card_total_use_price;
773
+ }
774
+ this.xdDownDrawerNewCard = false;
775
+ this.renderChecked = Date.now();
776
+ //清空cardForm
777
+ this.cardForm = {
778
+ card_number: "",
779
+ card_password: "",
780
+ valid_code: "",
781
+ };
782
+ this.switchValidToken();
783
+ },
784
+ (err) => {
785
+ this.$xdHideLoading();
786
+ this.switchValidToken();
787
+ }
788
+ );
789
+ },
790
+ //确认支付
791
+ async doTicketPay() {
792
+ const { cardPayPrice, submitCardList, needPayPrice } = this;
793
+ let postData = {
794
+ cardPayPrice: cardPayPrice,
795
+ selectedCardList: submitCardList,
796
+ needPayPrice: needPayPrice,
797
+ };
798
+ this.$emit("onChose", postData);
799
+ },
800
+ //刷新图片验证码
801
+ switchValidToken() {
802
+ let valid_token = this.$xdUniHelper.randomChar(20);
803
+ this.$set(this.cardForm, "valid_token", valid_token);
804
+ },
805
+ //扫码
806
+ doScanCode() {
807
+ // #ifdef H5
808
+ this.jwxSDK.scanQRCode({
809
+ needResult: 1,
810
+ success: (res) => {
811
+ // this.$set(this.cardForm, 'card_number', res.resultStr)
812
+ this.$set(this.cardForm, "card_qrcode", res.resultStr);
813
+ this.addNewCoupon();
814
+ },
815
+ });
816
+ // #endif
817
+ // #ifdef MP
818
+ uni.scanCode({
819
+ success: (res) => {
820
+ console.log("scanCode", res);
821
+ // this.$set(this.cardForm, 'card_number', res.result)
822
+ this.$set(this.cardForm, "card_qrcode", res.result);
823
+ this.addNewCoupon();
824
+ },
825
+ });
826
+ // #endif
827
+ },
828
+ },
829
+ };
830
+ </script>
831
+
832
+ <style lang="less" scoped>
833
+ .xd-card-pay {
834
+ .text-gray {
835
+ color: #999999;
836
+ }
837
+ .text-primary {
838
+ color: #fe7a63;
839
+ }
840
+ .flex {
841
+ display: flex;
842
+ }
843
+ .align-center {
844
+ align-items: center;
845
+ }
846
+ .drawer_title {
847
+ line-height: 100rpx;
848
+ text-align: center;
849
+ font-size: 32rpx;
850
+ }
851
+ .scan_icon {
852
+ width: 32rpx;
853
+ height: 32rpx;
854
+ }
855
+ .capture {
856
+ width: 180rpx;
857
+ height: 80rpx;
858
+ background: #ddd;
859
+ }
860
+ }
861
+ .coupon_list {
862
+ ::v-deep .xd-coupon_item {
863
+ margin: var(--card-list-margin) 0;
864
+ }
865
+ }
866
+ .cou_btn {
867
+ position: absolute;
868
+ padding: 10rpx 30rpx;
869
+ border-radius: 12rpx;
870
+ right: 20rpx;
871
+ bottom: 20rpx;
872
+ }
873
+ .no_more_card {
874
+ text-align: center;
875
+ padding: 20rpx 0;
876
+ color: #cccccc;
877
+ font-size: 28rpx;
878
+ }
879
+ .jfb-cashier-verification-pay {
880
+ &__body {
881
+ padding-bottom: 150rpx;
882
+ max-height: 70vh;
883
+ overflow: auto;
884
+ .column-group {
885
+ .column-item {
886
+ display: flex;
887
+ align-items: center;
888
+ justify-content: space-between;
889
+ border-bottom: 1px solid rgba(238, 238, 238, 1);
890
+ padding: 30rpx 50rpx;
891
+
892
+ .column_label {
893
+ display: flex;
894
+ align-items: center;
895
+ font-size: 28rpx;
896
+ }
897
+ .column_value {
898
+ display: flex;
899
+ align-items: center;
900
+ font-size: 24rpx;
901
+ .xd-coins {
902
+ margin-left: 8rpx;
903
+ }
904
+ }
905
+ .label_sub {
906
+ font-size: 18rpx;
907
+ color: #999999;
908
+ }
909
+ }
910
+ }
911
+
912
+ .ticket_list {
913
+ padding: 40rpx;
914
+ .ticket_add_new {
915
+ width: 690rpx;
916
+ height: 220rpx;
917
+ border-radius: 10rpx;
918
+ background: rgba(255, 255, 255, 1);
919
+ box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
920
+ margin: 30rpx auto;
921
+ display: flex;
922
+ flex-direction: column;
923
+ align-items: center;
924
+ justify-content: center;
925
+ font-size: 24rpx;
926
+
927
+ .plus_icon {
928
+ color: #ffffff;
929
+ border-radius: 20rpx;
930
+ display: flex;
931
+ align-items: center;
932
+ justify-content: center;
933
+ font-size: 48rpx;
934
+ width: 80rpx;
935
+ height: 80rpx;
936
+ margin-bottom: 20rpx;
937
+ }
938
+ }
939
+ .ticket_item {
940
+ width: 690rpx;
941
+ border-radius: 10rpx;
942
+ background: rgba(255, 255, 255, 1);
943
+ box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
944
+ margin: 30rpx auto;
945
+ padding: 30rpx 0 20rpx;
946
+ ._header {
947
+ display: flex;
948
+ justify-content: space-between;
949
+ padding: 0rpx 30rpx;
950
+ font-size: 28rpx;
951
+ }
952
+ ._cont {
953
+ display: flex;
954
+ font-size: 18rpx;
955
+ padding: 24rpx 30rpx;
956
+ border-bottom: 1px solid rgba(242, 242, 242, 1);
957
+ color: #777777;
958
+ }
959
+ ._footer {
960
+ display: flex;
961
+ justify-content: space-between;
962
+ padding: 24rpx 30rpx 12rpx;
963
+ font-size: 24rpx;
964
+ ._item {
965
+ display: flex;
966
+ align-items: center;
967
+ }
968
+ }
969
+ .orther_pay {
970
+ display: inline-block;
971
+ background: #f5f5f5;
972
+ font-size: 24rpx;
973
+ font-weight: 400;
974
+ border-radius: 8rpx;
975
+ color: #999999;
976
+ padding: 8rpx 20rpx;
977
+ margin: 16rpx 0 0 30rpx;
978
+ }
979
+ }
980
+ }
981
+
982
+ .remain_pay {
983
+ .remain_header {
984
+ display: flex;
985
+ justify-content: space-between;
986
+ padding: 30rpx 50rpx 0;
987
+ color: #999999;
988
+ font-size: 24rpx;
989
+ }
990
+ .pay_item {
991
+ display: flex;
992
+ align-items: center;
993
+ width: 700rpx;
994
+ height: 120rpx;
995
+ border-radius: 10rpx;
996
+ background: rgba(255, 255, 255, 1);
997
+ box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
998
+ padding: 24rpx 35rpx;
999
+ box-sizing: border-box;
1000
+ margin: 30rpx auto;
1001
+ font-size: 28rpx;
1002
+
1003
+ .icon {
1004
+ width: 64rpx;
1005
+ height: 64rpx;
1006
+ border-radius: 32rpx;
1007
+ // background: #DDD;
1008
+ margin-right: 30rpx;
1009
+ }
1010
+ .pay_name {
1011
+ flex: 1;
1012
+ }
1013
+ }
1014
+ }
1015
+ .bottom_btn {
1016
+ position: fixed;
1017
+ width: 100%;
1018
+ padding: 24rpx 0;
1019
+ background: #ffffff;
1020
+ box-shadow: 0 0 0px 1px rgba(0, 0, 0, 0.1);
1021
+ transition: 500ms all;
1022
+ padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
1023
+ padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
1024
+ }
1025
+ }
1026
+ }
1027
+ </style>