gxd-uni-library-editx 1.0.59 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gxd-uni-library-editx",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -0,0 +1,790 @@
1
+ <template>
2
+ <view class="xd-card-pay">
3
+ <slot></slot>
4
+ <xd-down-drawer :show.sync="xdDownDrawer"
5
+ :z-index="3000">
6
+ <view style="height: 80rpx;background:#FFF;"></view>
7
+ <view class="jfb-cashier-verification-pay__body">
8
+ <view class="column-group">
9
+ <view class="column-item">
10
+ <view class="column_label">
11
+ 我的票券
12
+ <view :style="{color: style.$warningColor}" v-if="checkedCards.length>0" class="label_sub">(已使用{{checkedCards.length}}张票券)</view>
13
+ <view :style="{marginLeft:'20rpx',color: style.$warningColor}" class="label_sub" v-else>请勾选票券</view> </view>
14
+ <view class="column_value">
15
+ <xd-button
16
+ width="220rpx"
17
+ radius="60rpx"
18
+ type="primary"
19
+ size="small"
20
+ @click="xdDownDrawerNewCard=true"
21
+ >使用新票券</xd-button>
22
+ </view>
23
+ </view>
24
+ <view class="column-item">
25
+ <view class="column_label">
26
+ 仍需支付
27
+ <view class="label_sub">(可使用多张票券支付)</view>
28
+ </view>
29
+ <view class="column_value text-primary">
30
+ <xd-unit
31
+ :price="needPayPrice"
32
+ :isOld="false"
33
+ :font-size="32"
34
+ :icon-size="0.3"
35
+ ></xd-unit>
36
+ </view>
37
+ </view>
38
+
39
+ </view>
40
+ <view
41
+ class="ticket_list"
42
+ :key="renderChecked"
43
+ >
44
+ <view
45
+ class="ticket_item"
46
+ v-for="ticket in showCardList"
47
+ :key="ticket.card_number"
48
+ >
49
+ <view class="_header">
50
+ <view class="flex align-center">
51
+ <xd-font-icon
52
+ style="margin-right: 8rpx;"
53
+ icon="iconkaquan"
54
+ color="#ffc65d"
55
+ size="32"
56
+ ></xd-font-icon>
57
+ {{ticket.card_type_name}}
58
+ </view>
59
+ <xd-radio
60
+ :disabled="ticket.is_valid === 'N' || ticket.card_point == 0"
61
+ size="mini"
62
+ @change="flat => handlerTicketSelect(flat, ticket)"
63
+ :value="checkedCards.includes(ticket.card_number)"
64
+ ></xd-radio>
65
+ </view>
66
+ <view class="_cont">
67
+ <view style="margin-right: 30rpx;">ID:{{ticket.card_number}}</view>
68
+ <view>有效期至:{{getTimeFormat(ticket.end_time)}}</view>
69
+ </view>
70
+ <view class="_footer">
71
+ <view class="_item"> 剩余:<xd-unit
72
+ :price="ticket.card_point"
73
+ :isOld="false"
74
+ :font-size="24"
75
+ :icon-size="0.3"
76
+ :unit="ticket.unit || ''"
77
+ ></xd-unit>
78
+ </view>
79
+ <view
80
+ v-if="ticket.card_use_point"
81
+ class="_item text-primary"
82
+ >
83
+ 使用:<xd-unit
84
+ :price="ticket.card_use_point"
85
+ :isOld="false"
86
+ :font-size="24"
87
+ :icon-size="0.3"
88
+ :unit="ticket.unit || ''"
89
+ ></xd-unit>
90
+ </view>
91
+ </view>
92
+ <view v-if="ticket.is_show_other_card_point === 'Y'" class="orther_pay">
93
+ 购买其他物品可抵:{{ divideFloatNumber(ticket.other_card_point) }}{{ ticket.unit }}
94
+ </view>
95
+
96
+ </view>
97
+ </view>
98
+ <view style="height: 100rpx;"></view>
99
+ <view
100
+ v-if="xdDownDrawer"
101
+ class="bottom_btn"
102
+ :style="alert_bottom"
103
+ >
104
+ <xd-button
105
+ width="360rpx"
106
+ type="primary"
107
+ radius="50rpx"
108
+ @click="doTicketPay"
109
+ >确认支付</xd-button>
110
+ </view>
111
+ </view>
112
+ </xd-down-drawer>
113
+ <xd-down-drawer
114
+ :show.sync="xdDownDrawerNewCard"
115
+ :z-index="3010"
116
+ height="580rpx"
117
+ @close="switchValidToken"
118
+ >
119
+ <view class="drawer_title">使用新票券</view>
120
+ <xd-form
121
+ label-width="180"
122
+ label-align="left"
123
+ content-align="left"
124
+ >
125
+ <xd-form-item
126
+ label="票券号码"
127
+ content-align="left"
128
+ >
129
+ <view class="flex align-center">
130
+ <xd-form-input
131
+ placeholder="电子码无需输入券号"
132
+ v-model="cardForm.card_number"
133
+ />
134
+ <view
135
+ class="scan_icon"
136
+ @click="doScanCode"
137
+ >
138
+ <xd-font-icon icon="iconsaoma"></xd-font-icon>
139
+ </view>
140
+ </view>
141
+ </xd-form-item>
142
+ <xd-form-item
143
+ label="票券密码"
144
+ content-align="left"
145
+ >
146
+ <xd-form-input
147
+ placeholder="请输入票券密码"
148
+ v-model="cardForm.card_password"
149
+ />
150
+ </xd-form-item>
151
+ <xd-form-item
152
+ label="验证码"
153
+ content-align="left"
154
+ >
155
+ <view class="flex align-center">
156
+ <xd-form-input
157
+ placeholder="请输入验证码"
158
+ v-model="cardForm.valid_code"
159
+ />
160
+ <view
161
+ v-if="cardForm.valid_token"
162
+ class="capture"
163
+ @click="switchValidToken"
164
+ >
165
+ <image
166
+ style="width: 100%;height:100%"
167
+ :src="validImageAPIUrl + '?image_width=180&image_height=80&token='+cardForm.valid_token"
168
+ />
169
+ </view>
170
+ </view>
171
+ </xd-form-item>
172
+ </xd-form>
173
+ <xd-button
174
+ width="360rpx"
175
+ type="primary"
176
+ radius="50rpx"
177
+ @click="addNewCard()"
178
+ >使用新票券</xd-button>
179
+ <view :style="{height: layoutInfo.bottom + 'rpx'}"></view>
180
+ </xd-down-drawer>
181
+ </view>
182
+ </template>
183
+ <script>
184
+ /**
185
+ * @description 选择卡券支付 & 支持三方支付
186
+ * @property show {Boolean} 是否显示支付卡券弹窗
187
+ * @property layoutInfo {Object} XdLayout返回的布局信息
188
+ * @property validImageAPIUrl {String} 图片验证码接口API地址
189
+ * @property jwxSDK {Object} JSSDK授权对象
190
+ * @property price {Number|String} 订单总额 单位元
191
+ * @property getSettleListCards {Function(successCallBack(cardList))} 获取支付卡券列表
192
+ * @property setSettleSelectCard {Function(options, successCallBack, errCallBack)} 选择卡券列表
193
+ * @property addSettleCard {Function(options, successCallBack)} 添加卡券
194
+ *
195
+ */
196
+ import XdDownDrawer from "@/components/XdDownDrawer/XdDownDrawer"
197
+ import XdButton from "@/components/XdButton/XdButton"
198
+ import XdUnit from "@/components/XdUnit/XdUnit"
199
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon"
200
+ import XdRadio from "@/components/XdRadio/XdRadio"
201
+ import XdForm from "@/components/XdForm/XdForm"
202
+ import XdFormItem from "@/components/XdFormItem/XdFormItem"
203
+ import XdFormInput from "@/components/XdFormInput/XdFormInput"
204
+ import {
205
+ getParentsStyle, //获取页面风格单个键值值
206
+ getParentsStyles //获取页面风格列表
207
+ } from '@/utils/xd.base';
208
+
209
+ export default {
210
+ name: "XdCardPay",
211
+ components: {
212
+ XdDownDrawer,
213
+ XdButton,
214
+ XdUnit,
215
+ XdFontIcon,
216
+ XdRadio,
217
+ XdForm,
218
+ XdFormItem,
219
+ XdFormInput
220
+ },
221
+ props: {
222
+ show: false,
223
+ layoutInfo: {},
224
+ validImageAPIUrl: { //图片验证码 接口地址
225
+ type: String,
226
+ },
227
+ selected_wallet_list: {
228
+ type: Array,
229
+ default: () => ([])
230
+ },
231
+ price: { //订单总额 单位元
232
+ type: String|Number,
233
+ default: "100"
234
+ },
235
+ jwxSDK: { //JSSDK授权对象
236
+ type: Object,
237
+ },
238
+ getSettleListCards: { //支付卡券列表
239
+ type: Function
240
+ },
241
+ setSettleSelectCard: { //选择卡券列表
242
+ type: Function
243
+ },
244
+ addSettleCard: { //添加卡券
245
+ type: Function
246
+ },
247
+ },
248
+ watch: {
249
+ show(n, o){
250
+ this.xdDownDrawer = n;
251
+ },
252
+ xdDownDrawer(n){
253
+ this.$emit('update:show', n);
254
+ },
255
+ price: {
256
+ handler(n){
257
+ this.needPayPrice = this.$xdUniHelper.multiplyFloatNumber(n, 100);
258
+ },
259
+ immediate: true
260
+ },
261
+ xdDownDrawerNewCard(n){
262
+ if(!n){
263
+ this.cardForm = {
264
+ card_number: "",
265
+ card_password: "",
266
+ valid_code: "",
267
+ valid_token: this.$xdUniHelper.randomChar(20),
268
+ }
269
+ }
270
+ }
271
+ },
272
+ data(){
273
+ return {
274
+ xdDownDrawer: false,
275
+ xdDownDrawerNewCard: false,
276
+ channel_provider_id: "",
277
+ cardList: [], //展示
278
+ selectedCardList: [],
279
+ needPayPrice: 0,
280
+ cardPayPrice: 0,
281
+ cardForm: { //添加新卡券表单
282
+ card_number: "",
283
+ card_password: "",
284
+ valid_code: "", //验证码正文
285
+ valid_token: "", //验证码token
286
+ },
287
+ renderChecked: "renderChecked",
288
+
289
+ total_price: "",
290
+ style: {}
291
+ }
292
+ },
293
+ computed: {
294
+ showCardList(){
295
+ //筛选出不存在于cardList的数据
296
+ let otherCardList = this.selectedCardList.filter(item =>{
297
+ let cur = this.cardList.find(ii => ii.card_number == item.card_number);
298
+ return !cur;
299
+ })
300
+ //合并selectedCardList数据到对应的cardList
301
+ let combineList = this.cardList.map(item => {
302
+ let cur = this.selectedCardList.find(ii => ii.card_number == item.card_number);
303
+ if(cur) return Object.assign(item, cur);
304
+ return item;
305
+ })
306
+ return combineList.concat(otherCardList);
307
+ },
308
+ checkedCards(){
309
+ return this.showCardList.filter(item => item.card_use_point > 0).map(item => item.card_number);
310
+ },
311
+ //提交是的selectedCardList, 由于取消选中不走接口 & 避免取消隐藏
312
+ submitCardList(){
313
+ return this.selectedCardList.filter(item => item.card_use_point > 0);
314
+ },
315
+ alert_bottom(){
316
+ return this.fixedStyle({paddingBottom: 24, zIndex: 110})
317
+ },
318
+ },
319
+ async created(){
320
+ this.switchValidToken();
321
+ this.style = await getParentsStyles(this.$parent);
322
+ console.log(this.style,'this.style');
323
+ this.handleInit();
324
+ },
325
+ methods: {
326
+ handleInit(){
327
+ this.total_price = this.$xdUniHelper.multiplyFloatNumber(this.price, 100);
328
+ this.needPayPrice = this.total_price;
329
+ this.getList();
330
+ this.selectedCardList = this.selectedCardList.map(item => {
331
+ item['card_use_point'] = 0;
332
+ return item;
333
+ })
334
+ },
335
+ divideFloatNumber(num){
336
+ return this.$xdUniHelper.divisionFloatNumber(num, 100);
337
+ },
338
+ fixedStyle(options = {}, type = 'bottom') {
339
+ let paddingBottom = options.paddingBottom || options.height || 0;
340
+ if (options.paddingBottom) delete options.paddingBottom;
341
+ if (options.height) delete options.height;
342
+ let obj = Object.assign({}, {
343
+ top: 0, left: 0, right: 0, bottom: 0, zIndex: 100,
344
+ }, options);
345
+ let style = 'position: fixed';
346
+ style = `${style};left:${obj.left}rpx`;
347
+ style = `${style};right:${obj.right}rpx`;
348
+ style = `${style};z-index:${obj.zIndex}`;
349
+ if (type === 'bottom') {
350
+ let padding = (this.layoutInfo.bottomHeight + this.layoutInfo.footerHeight + paddingBottom) * this.$rpxNum;
351
+ style = `${style}; padding-bottom:calc(${padding}px + constant(safe-area-inset-bottom));`;
352
+ style = `${style}; padding-bottom:calc(${padding}px + env(safe-area-inset-bottom));`;
353
+ style = `${style};bottom:0;`;
354
+ }
355
+ if (type === 'top') {
356
+ style = `${style};top:${obj.top}rpx`;
357
+ }
358
+ return style;
359
+ },
360
+ getTimeFormat(time){
361
+ let date = null;
362
+ if(time == +time){
363
+ if((time+'').length <= 10) date = new Date(+time*1000);
364
+ else date = new Date(+time);
365
+ return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
366
+ }
367
+ return time;
368
+ },
369
+ getList(){
370
+ //获取卡券列表
371
+ this.getSettleListCards((cardList) => {
372
+ this.$xdLog.setARMSInfo(this.filterMGinfo(cardList), 'init_binded_list');
373
+ this.cardList = cardList;
374
+ })
375
+ },
376
+ //选卡弹出项
377
+ useCardPop(data){
378
+ return new Promise((resolve, reject) => {
379
+ uni.showModal({
380
+ title: '提示',
381
+ content: data.pop_message,
382
+ confirmText: data.confirm_text,
383
+ cancelText: data.cancel_text,
384
+ success: function (res) {
385
+ if (res.confirm) {
386
+ resolve(2);
387
+ } else if (res.cancel) {
388
+ // reject("取消支付");
389
+ if(data.pop_type == 'confirm'){
390
+ resolve();
391
+ }else{
392
+ resolve(3);
393
+ }
394
+ }
395
+ },
396
+ fail: function (res) {
397
+ reject(res);
398
+ }
399
+ });
400
+ })
401
+ },
402
+
403
+ //选择卡券
404
+ handlerTicketSelect(flat, ticket, options){
405
+ if(flat){ //选择卡券,重新调用接口获取 selectedCardList, neePayPrice
406
+ const {submitCardList, total_price} = this;
407
+ let callThis = this;
408
+ // #ifdef MP
409
+ callThis = this.$parent;
410
+ // #endif
411
+ this.$xdShowLoading({})
412
+ callThis.setSettleSelectCard({
413
+ total_price,
414
+ card_number: ticket.card_number,
415
+ selected_card_list_json: JSON.stringify(submitCardList),
416
+ selected_wallet_list_json: JSON.stringify(this.selected_wallet_list),
417
+ ...options
418
+ }, (res) => {
419
+ let resOptions = JSON.parse(JSON.stringify(res));
420
+ if(resOptions['selected_card_list1']) delete resOptions['selected_card_list1'];
421
+ if (resOptions['selected_card_list']){
422
+ resOptions['selected_card_list'] = this.filterMGinfo(resOptions['selected_card_list']);
423
+ }
424
+ this.$xdLog.setARMSInfo({
425
+ card_number: ticket.card_number,
426
+ selected_card_list_json: this.filterMGinfo(submitCardList),
427
+ ...options,
428
+ res: resOptions
429
+ },'select_binded_card');
430
+ this.$xdHideLoading();
431
+ const {selected_card_list, need_pay_price, is_need_pop, card_total_use_price} = res;
432
+ if(is_need_pop){
433
+ this.useCardPop(res).then((select_content) => {
434
+ if(select_content){
435
+ this.handlerTicketSelect(true, ticket, {select_content})
436
+ }else{
437
+ this.handlerTicketSelect(false, ticket);
438
+ }
439
+ }).catch(() => {})
440
+ }else{
441
+ this.selectedCardList = selected_card_list;
442
+ this.needPayPrice = need_pay_price;
443
+ this.cardPayPrice = card_total_use_price
444
+ this.renderChecked = Date.now();
445
+ }
446
+ }, (err) => {
447
+ this.$xdHideLoading();
448
+ this.renderChecked = Date.now();
449
+ })
450
+ }else{
451
+ this.$xdLog.setARMSInfo({
452
+ ticket: this.filterMGinfo(ticket),
453
+ ...options,
454
+ },'cancel_card');
455
+ //不走接口, selectedCardList不是真实选中的
456
+ this.selectedCardList = this.selectedCardList.map(item => {
457
+ if(item.card_number == ticket.card_number){
458
+ this.needPayPrice = +this.needPayPrice + item['card_use_price']
459
+ item['card_use_price'] = 0;
460
+ item['card_use_point'] = 0;
461
+ }
462
+ return item;
463
+ });
464
+ if(ticket.is_new){
465
+ this.cardList = this.cardList.filter(item => item.card_number != ticket.card_number);
466
+ this.selectedCardList = this.selectedCardList.filter(item => item.card_number != ticket.card_number);
467
+ }
468
+ this.cardPayPrice = this.cardPayPrice - ticket.card_use_price;
469
+ this.renderChecked = Date.now();
470
+ }
471
+
472
+ },
473
+
474
+ filterMGinfo(list){
475
+ //深拷贝
476
+ if(this.$xdUniHelper.checkVarType(list) === 'object'
477
+ || this.$xdUniHelper.checkVarType(list) === 'array'
478
+ ) {
479
+ list = JSON.parse(JSON.stringify(list));
480
+ }
481
+ //object
482
+ if(this.$xdUniHelper.checkVarType(list) === 'object') {
483
+ if (list.card_use_certificate) list.card_use_certificate = list.card_use_certificate.substr(0, 2) + '********' + list.card_use_certificate.substr(-3);
484
+ if (list.card_cert) list.card_cert = list.card_cert.substr(0, 2) + '********' + list.card_cert.substr(-3);
485
+ if (list.card_password) list.card_password = list.card_password.substr(0, 2) + '********' + list.card_password.substr(-3);
486
+ return list;
487
+ }
488
+
489
+ //array
490
+ return list.map(item => {
491
+ if(item.card_use_certificate) item.card_use_certificate = item.card_use_certificate.substr(0, 2) + '********' + item.card_use_certificate.substr(-3);
492
+ if(item.card_cert) item.card_cert = item.card_cert.substr(0, 2) + '********' + item.card_cert.substr(-3);
493
+ if(item.card_password) item.card_password = item.card_password.substr(0, 2) + '********' + item.card_password.substr(-4);
494
+ return item
495
+ });
496
+ },
497
+
498
+ //添加新卡券
499
+ addNewCard(options={}){
500
+ const { cardForm, total_price, submitCardList } = this;
501
+ let err_tip = "";
502
+ if(!cardForm.card_qrcode){
503
+ if (!cardForm.valid_code) err_tip = "验证码不能为空";
504
+ else if(!cardForm.card_number && !cardForm.card_password) err_tip = "票券和密码不能为空";
505
+ }
506
+ if(err_tip) {
507
+ return uni.showToast({
508
+ title: err_tip,
509
+ icon: "none"
510
+ })
511
+ }
512
+ let callThis = this;
513
+ // #ifdef MP
514
+ callThis = this.$parent;
515
+ // #endif
516
+ this.$xdShowLoading({});
517
+ callThis.addSettleCard({
518
+ ...cardForm,
519
+ selected_card_list_json: JSON.stringify(submitCardList),
520
+ total_price,
521
+ ...options
522
+ }, (res) => {
523
+ let resOptions = JSON.parse(JSON.stringify(res));
524
+ resOptions.selected_card_list = this.filterMGinfo(resOptions.selected_card_list)
525
+ this.$xdLog.setARMSInfo({
526
+ ...options,
527
+ total_price,
528
+ cardForm: {
529
+ ...cardForm,
530
+ card_password: cardForm.card_password ? cardForm.card_password.substr(0, 2) + '********' + cardForm.card_password.substr(-3) : '',
531
+ },
532
+ selected_card_list_json: this.filterMGinfo(submitCardList),
533
+ res: resOptions
534
+ },'add_card');
535
+ this.$xdHideLoading();
536
+
537
+ //成功回调
538
+ let {selected_card_list=[], need_pay_price, is_need_pop} = res;
539
+
540
+ if(is_need_pop){
541
+ this.useCardPop(res).then((select_content) => {
542
+ if(select_content) this.addNewCard({select_content});
543
+ // this.handlerTicketSelect(true, cardForm.card_number, {select_content})
544
+ }).catch((e) => {
545
+ console.error(e)
546
+ })
547
+ return;
548
+ }else{
549
+ // filterCard 去重后的卡券
550
+ let r_cards = this.cardList.map(item => item.card_number);
551
+ let filterCard = selected_card_list.filter(item => !r_cards.includes(item.card_number));
552
+ //重合的卡券列表
553
+ let repeatCardList = selected_card_list.filter(item => r_cards.includes(item.card_number));
554
+
555
+ if(repeatCardList.length > 0){
556
+ for(let i = 0; i < repeatCardList.length; i++){
557
+ let repeatCard = repeatCardList[i];
558
+ //重复的以前的卡数据
559
+ let oldCard = this.cardList.find(item => item.card_number == repeatCard.card_number);
560
+ //自动选中当前重合的卡券
561
+ if(this.selectedCardList.findIndex(item => item.card_number == repeatCard.card_number) == -1){
562
+ this.selectedCardList.push({...oldCard, ...repeatCard});
563
+ }else{
564
+ this.selectedCardList = this.selectedCardList.map(item => {
565
+ if(item.card_number == repeatCard.card_number){
566
+ item = {...oldCard, ...repeatCard};
567
+ }
568
+ return item;
569
+ })
570
+ }
571
+ }
572
+ }
573
+
574
+ selected_card_list = filterCard.map(item => {
575
+ item['is_new'] = true;
576
+ return item;
577
+ })
578
+ this.cardList = selected_card_list.concat(this.cardList);
579
+ this.selectedCardList = selected_card_list.concat(this.selectedCardList);
580
+ this.needPayPrice = need_pay_price;
581
+ }
582
+ this.xdDownDrawerNewCard = false;
583
+ this.renderChecked = Date.now();
584
+ //清空cardForm
585
+ this.cardForm = {
586
+ card_number: "",
587
+ card_password: "",
588
+ valid_code: ""
589
+ }
590
+ this.switchValidToken();
591
+ }, (err) => {
592
+ this.$xdHideLoading();
593
+ this.switchValidToken();
594
+ })
595
+ },
596
+ //确认支付
597
+ async doTicketPay(){
598
+ const { cardPayPrice, submitCardList, needPayPrice } = this;
599
+
600
+ let postData = {
601
+ cardPayPrice: cardPayPrice,
602
+ selectedCardList: submitCardList,
603
+ needPayPrice: needPayPrice
604
+ };
605
+ this.$emit("onChose", postData);
606
+ },
607
+ //刷新图片验证码
608
+ switchValidToken(){
609
+ let valid_token = this.$xdUniHelper.randomChar(20);
610
+ this.$set(this.cardForm, "valid_token", valid_token);
611
+ },
612
+ //扫码
613
+ doScanCode(){
614
+ // #ifdef H5
615
+ this.jwxSDK.scanQRCode({
616
+ needResult: 1,
617
+ success: res => {
618
+ // this.$set(this.cardForm, 'card_number', res.resultStr)
619
+ this.$set(this.cardForm, 'card_qrcode', res.resultStr)
620
+ this.addNewCard();
621
+ }
622
+ })
623
+ // #endif
624
+ // #ifdef MP
625
+ uni.scanCode({
626
+ success: res => {
627
+ console.log("scanCode", res)
628
+ // this.$set(this.cardForm, 'card_number', res.result)
629
+ this.$set(this.cardForm, 'card_qrcode', res.result)
630
+ this.addNewCard();
631
+ }
632
+ })
633
+ // #endif
634
+ },
635
+ }
636
+ }
637
+ </script>
638
+
639
+ <style lang="less" scoped>
640
+ .xd-card-pay{
641
+ .text-gray{
642
+ color: #999999;
643
+ }
644
+ .text-primary{
645
+ color: #FE7A63;
646
+ }
647
+ .flex{
648
+ display: flex;
649
+ }
650
+ .align-center{
651
+ align-items: center;
652
+ }
653
+ .drawer_title{
654
+ line-height: 100rpx;
655
+ text-align: center;
656
+ font-size: 32rpx;
657
+ }
658
+ .scan_icon{
659
+ width: 32rpx;
660
+ height: 32rpx;
661
+ }
662
+ .capture{
663
+ width: 180rpx;
664
+ height: 80rpx;
665
+ background: #DDD;
666
+ }
667
+ }
668
+ .jfb-cashier-verification-pay {
669
+ &__body{
670
+ padding-bottom: 150rpx;
671
+ max-height: 70vh;
672
+ overflow: auto;
673
+ .column-group{
674
+ .column-item{
675
+ display: flex;
676
+ align-items: center;
677
+ justify-content: space-between;
678
+ border-bottom: 1px solid rgba(238, 238, 238, 1);
679
+ padding: 30rpx 50rpx;
680
+
681
+ .column_label{
682
+ display: flex;
683
+ align-items: center;
684
+ font-size: 28rpx;
685
+ }
686
+ .column_value{
687
+ display: flex;
688
+ align-items: center;
689
+ font-size: 24rpx;
690
+ .xd-coins{
691
+ margin-left: 8rpx;
692
+ }
693
+ }
694
+ .label_sub{
695
+ font-size: 18rpx;
696
+ color: #999999;
697
+ }
698
+ }
699
+ }
700
+
701
+ .ticket_list{
702
+ .ticket_item{
703
+ width: 690rpx;
704
+ border-radius: 10rpx;
705
+ background: rgba(255, 255, 255, 1);
706
+ box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
707
+ margin: 30rpx auto;
708
+ padding: 30rpx 0 20rpx;
709
+ ._header{
710
+ display: flex;
711
+ justify-content: space-between;
712
+ padding: 0rpx 30rpx;
713
+ font-size: 28rpx;
714
+ }
715
+ ._cont{
716
+ display: flex;
717
+ font-size: 18rpx;
718
+ padding: 24rpx 30rpx;
719
+ border-bottom: 1px solid rgba(242, 242, 242, 1);
720
+ color: #777777;
721
+ }
722
+ ._footer{
723
+ display: flex;
724
+ justify-content: space-between;
725
+ padding: 24rpx 30rpx 12rpx;
726
+ font-size: 24rpx;
727
+ ._item{
728
+ display: flex;
729
+ align-items: center;
730
+ }
731
+ }
732
+ .orther_pay{
733
+ display: inline-block;
734
+ background: #F5F5F5;
735
+ font-size: 24rpx;
736
+ font-weight: 400;
737
+ border-radius: 8rpx;
738
+ color: #999999;
739
+ padding: 8rpx 20rpx;
740
+ margin: 16rpx 0 0 30rpx;
741
+ }
742
+ }
743
+ }
744
+
745
+ .remain_pay{
746
+ .remain_header{
747
+ display: flex;
748
+ justify-content: space-between;
749
+ padding: 30rpx 50rpx 0;
750
+ color: #999999;
751
+ font-size: 24rpx;
752
+ }
753
+ .pay_item{
754
+ display: flex;
755
+ align-items: center;
756
+ width: 700rpx;
757
+ height: 120rpx;
758
+ border-radius: 10rpx;
759
+ background: rgba(255, 255, 255, 1);
760
+ box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
761
+ padding: 24rpx 35rpx;
762
+ box-sizing: border-box;
763
+ margin: 30rpx auto;
764
+ font-size: 28rpx;
765
+
766
+ .icon{
767
+ width: 64rpx;
768
+ height: 64rpx;
769
+ border-radius: 32rpx;
770
+ // background: #DDD;
771
+ margin-right: 30rpx;
772
+ }
773
+ .pay_name{
774
+ flex: 1;
775
+ }
776
+ }
777
+ }
778
+ .bottom_btn{
779
+ position: fixed;
780
+ width: 100%;
781
+ padding: 24rpx 0;
782
+ background: #FFFFFF;
783
+ box-shadow: 0 0 0px 1px rgba(0, 0, 0, 0.1);
784
+ transition: 500ms all;
785
+ padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
786
+ padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
787
+ }
788
+ }
789
+ }
790
+ </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <view class="xd-input-confirm" @touchmove.stop.prevent :style="{zIndex:confirm.zIndex}" v-if="show">
3
- <view class="xd-input-confirm__mask"></view>
3
+ <view class="xd-input-confirm__mask" @click.stop="handleMaskClose"></view>
4
4
  <view
5
5
  class="xd-input-confirm__body"
6
6
  :style="{
@@ -197,6 +197,12 @@
197
197
  this.onClose()
198
198
  }
199
199
  },
200
+
201
+ handleMaskClose(){
202
+ if(this.$configProject && this.$configProject['isPreview']) {
203
+ this.close();
204
+ }
205
+ }
200
206
  }
201
207
  }
202
208
  </script>
@@ -0,0 +1,238 @@
1
+ <template>
2
+ <view class="xd-wallet-chose">
3
+ <xd-down-drawer :show.sync="xdDownDrawer">
4
+ <view class="title" >请选择{{showName}}</view>
5
+ <view class="wallet_body">
6
+ <view class="wallet_total">
7
+ <view class="_title">剩余{{showName}}</view>
8
+ <view class="_money">{{totalAmount/100}}</view>
9
+ </view>
10
+ <view class="wallet_list" :key="renderChecked">
11
+ <view class="wallet_item" v-for="(item, i) in showWalletList" :key="i">
12
+ <view class="label">
13
+ <view class="label_tit">{{item.wallet_name}}</view>
14
+ <view>{{item.amount/100}}</view>
15
+ </view>
16
+ <view class="value">
17
+ <view class="val_sub" v-if="item.wallet_use_price > 0">本单<text class="red">已减{{item.wallet_use_price/100}}</text></view>
18
+ <xd-radio
19
+ :value="item.wallet_use_price > 0"
20
+ @change="flag => handleChange(flag, item)"
21
+ ></xd-radio>
22
+ </view>
23
+ </view>
24
+ </view>
25
+ <view style="height: 100rpx;"></view>
26
+ <view
27
+ v-show="xdDownDrawer"
28
+ class="bottom_btn"
29
+ :style="alert_bottom"
30
+ >
31
+ <xd-button width="360rpx" type="primary" radius="50rpx" @click="handleChose">确认支付</xd-button>
32
+ </view>
33
+ </view>
34
+ </xd-down-drawer>
35
+ </view>
36
+ </template>
37
+ <script>
38
+ import XdDownDrawer from "@/components/XdDownDrawer/XdDownDrawer"
39
+ import XdRadio from "@/components/XdRadio/XdRadio"
40
+ import XdButton from "@/components/XdButton/XdButton"
41
+ export default {
42
+ name: "XdWalletChose",
43
+ components: {
44
+ XdDownDrawer,
45
+ XdRadio,
46
+ XdButton
47
+ },
48
+ props: {
49
+ show: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ layoutInfo: {},
54
+ getUserWalletList: {
55
+ type: Function
56
+ },
57
+ useBindedWallet: {
58
+ type: Function
59
+ }
60
+ },
61
+ watch: {
62
+ show(n, o){
63
+ this.xdDownDrawer = n;
64
+ },
65
+ xdDownDrawer(n){
66
+ this.$emit('update:show', n);
67
+ },
68
+ },
69
+ computed: {
70
+ showWalletList(){
71
+ let combineList = this.walletList.map(item => {
72
+ let cur = this.selectedWalletList.find(ii => ii.wallet_virtual_number == item.wallet_virtual_number);
73
+ if(cur) return Object.assign(item, cur);
74
+ return item;
75
+ })
76
+ return combineList;
77
+ },
78
+ alert_bottom(){
79
+ return this.fixedStyle({paddingBottom: 24, zIndex: 110})
80
+ },
81
+ },
82
+ data(){
83
+ return {
84
+ xdDownDrawer: false,
85
+ walletList: [],
86
+ selectedWalletList: [],
87
+ showName: "",
88
+ totalAmount: "",
89
+ needPayPrice: "",
90
+ walletPayPrice: "",
91
+ renderChecked: "renderChecked"
92
+ }
93
+ },
94
+ created(){
95
+ this.getUserWalletList((res) => {
96
+ console.log("getUserWalletList", res.walletList);
97
+ this.walletList = res.list.map(item => {
98
+ item.checked = false;
99
+ return item;
100
+ });
101
+ this.showName = res.show_name;
102
+ this.totalAmount = res.total_amount
103
+ })
104
+ },
105
+ methods: {
106
+ handleChose(){
107
+ let data = {
108
+ walletPayPrice: this.walletPayPrice,
109
+ selectedWalletList: this.selectedWalletList,
110
+ needPayPrice: this.needPayPrice
111
+ }
112
+ this.$emit("onChose", data)
113
+ },
114
+ handleChange(flag, row){
115
+ console.log(flag);
116
+ console.log(this.walletList);
117
+ if(flag){
118
+ this.$xdShowLoading({})
119
+ this.useBindedWallet({
120
+ wallet_type: row.wallet_type,
121
+ selected_wallet_list_json: JSON.stringify(this.selectedWalletList),
122
+ }, (res) => {
123
+ this.$xdHideLoading();
124
+ console.log("selected_wallet_list", res)
125
+ let selected_wallet_list = res.selected_wallet_list;
126
+ this.selectedWalletList = selected_wallet_list;
127
+ this.needPayPrice = res.need_pay_price;
128
+ this.walletPayPrice = res.wallet_total_use_price;
129
+ this.renderChecked = Date.now();
130
+ }, (err) => {
131
+ this.$xdHideLoading();
132
+ this.renderChecked = Date.now();
133
+ });
134
+ }else{
135
+ this.selectedWalletList = this.selectedWalletList.filter(item => {
136
+ return item.wallet_virtual_number != row.wallet_virtual_number
137
+ })
138
+ this.walletPayPrice = this.walletPayPrice - row.wallet_use_price;
139
+ this.$set(row, "wallet_use_price", 0);
140
+ }
141
+ },
142
+ fixedStyle(options = {}, type = 'bottom') {
143
+ let paddingBottom = options.paddingBottom || options.height || 0;
144
+ if (options.paddingBottom) delete options.paddingBottom;
145
+ if (options.height) delete options.height;
146
+ let obj = Object.assign({}, {
147
+ top: 0, left: 0, right: 0, bottom: 0, zIndex: 100,
148
+ }, options);
149
+ let style = 'position: fixed';
150
+ style = `${style};left:${obj.left}rpx`;
151
+ style = `${style};right:${obj.right}rpx`;
152
+ style = `${style};z-index:${obj.zIndex}`;
153
+ if (type === 'bottom') {
154
+ let padding = (this.layoutInfo.bottomHeight + this.layoutInfo.footerHeight + paddingBottom) * this.$rpxNum;
155
+ style = `${style}; padding-bottom:calc(${padding}px + constant(safe-area-inset-bottom));`;
156
+ style = `${style}; padding-bottom:calc(${padding}px + env(safe-area-inset-bottom));`;
157
+ style = `${style};bottom:0;`;
158
+ }
159
+ if (type === 'top') {
160
+ style = `${style};top:${obj.top}rpx`;
161
+ }
162
+ return style;
163
+ },
164
+ }
165
+ }
166
+ </script>
167
+
168
+ <style lang="less" scoped>
169
+ .xd-wallet-chose{
170
+ .title{
171
+ height: 100rpx;
172
+ line-height: 100rpx;
173
+ background:#FFF;
174
+ text-align: center;
175
+ font-size: 28rpx;
176
+ color: #666666;
177
+ border-bottom: 1px solid #F2F2F2;
178
+ }
179
+ .wallet_body{
180
+ padding-bottom: 150rpx;
181
+ max-height: 70vh;
182
+ overflow: auto;
183
+ .wallet_total{
184
+ padding: 32rpx 48rpx;
185
+ border-bottom: 1px solid #F2F2F2;
186
+ ._title{
187
+ color: #333333;
188
+ font-size: 24rpx;
189
+ font-weight: 400;
190
+ }
191
+ ._money{
192
+ color: #333333;
193
+ font-size: 64rpx;
194
+ font-weight: 500;
195
+ }
196
+ }
197
+ .wallet_list{
198
+ .wallet_item{
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: space-between;
202
+ padding: 32rpx 48rpx;
203
+ font-size: 26rpx;
204
+ color: #666666;
205
+ .label{
206
+ display: flex;
207
+ align-items: center;
208
+ .label_tit{
209
+ margin-right: 16rpx;
210
+ }
211
+ }
212
+ .value{
213
+ display: flex;
214
+ align-items: center;
215
+ .val_sub{
216
+ color: #999999;
217
+ margin-right: 24rpx;
218
+ .red{
219
+ color: #FF7070;
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+
226
+ .bottom_btn{
227
+ position: fixed;
228
+ width: 100%;
229
+ padding: 24rpx 0;
230
+ background: #FFFFFF;
231
+ box-shadow: 0 0 0px 1px rgba(0, 0, 0, 0.1);
232
+ transition: 500ms all;
233
+ padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
234
+ padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
235
+ }
236
+ }
237
+ }
238
+ </style>