gxd-uni-library-editx 1.0.8-beta2 → 1.0.8-beta4

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.8-beta2",
3
+ "version": "1.0.8-beta4",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -101,46 +101,7 @@
101
101
  </view>
102
102
  </view>
103
103
  <view
104
- v-if="needPayPrice>0"
105
- class="remain_pay"
106
- >
107
- <view class="remain_header">
108
- <view>选择以下支付方式</view>
109
- <view class="flex align-center text-primary">
110
- <view style="margin-right:8rpx;">继续支付</view>
111
- <xd-unit
112
- :price="needPayPrice"
113
- :is-show-icon="false"
114
- unit="元"
115
- :isOld="false"
116
- :font-size="24"
117
- :icon-size="0.3"
118
- ></xd-unit>
119
- </view>
120
- </view>
121
- <view class="pay_list">
122
- <view
123
- v-for="item in payChannels"
124
- :key="item.channel_provider_id"
125
- class="pay_item"
126
- >
127
- <view class="icon">
128
- <xd-font-icon
129
- v-if="item.channel_code =='wxpay'"
130
- icon="iconwx"
131
- size="64"
132
- color="#25bc46"
133
- ></xd-font-icon>
134
- </view>
135
- <view class="pay_name">{{item.channel_provider_name}}</view>
136
- <xd-radio
137
- @change="flat => handlerPayCheck(item.channel_provider_id, flat)"
138
- :value="channel_provider_id==item.channel_provider_id"
139
- ></xd-radio>
140
- </view>
141
- </view>
142
- </view>
143
- <view
104
+ v-if="xdDownDrawer"
144
105
  class="bottom_btn"
145
106
  :style="{bottom: layoutInfo.bottom+'rpx', opacity: this.show?'1':'0'}"
146
107
  >
@@ -157,6 +118,7 @@
157
118
  :show.sync="xdDownDrawerNewCard"
158
119
  :z-index="3010"
159
120
  height="580rpx"
121
+ @close="switchValidToken"
160
122
  >
161
123
  <view class="drawer_title">使用新票券</view>
162
124
  <xd-form
@@ -228,13 +190,11 @@
228
190
  * @property layoutInfo {Object} XdLayout返回的布局信息
229
191
  * @property validImageAPIUrl {String} 图片验证码接口API地址
230
192
  * @property jwxSDK {Object} JSSDK授权对象
231
- * @property payChannels {Array} 三方支付列表
232
193
  * @property price {Number|String} 订单总额 单位元
233
194
  * @property getSettleListCards {Function(successCallBack(cardList))} 获取支付卡券列表
234
195
  * @property setSettleSelectCard {Function(options, successCallBack, errCallBack)} 选择卡券列表
235
196
  * @property addSettleCard {Function(options, successCallBack)} 添加卡券
236
197
  * @property createSettleOrder {Function(options, successCallBack)} 创建订单
237
- * @property setThirdPlace {Function(options, successCallBack)} 获取三方支付签名
238
198
  *
239
199
  * @event {Function} onCreateOrder 订单创建完成触发函数
240
200
  */
@@ -272,12 +232,12 @@ export default {
272
232
  jwxSDK: { //JSSDK授权对象
273
233
  type: Object,
274
234
  },
275
- payChannels: { //三方支付列表
276
- type: Array,
277
- default: () => {
278
- return []
279
- }
280
- },
235
+ // payChannels: { //三方支付列表
236
+ // type: Array,
237
+ // default: () => {
238
+ // return []
239
+ // }
240
+ // },
281
241
  getSettleListCards: { //支付卡券列表
282
242
  type: Function
283
243
  },
@@ -290,9 +250,9 @@ export default {
290
250
  createSettleOrder: { //创建订单
291
251
  type: Function
292
252
  },
293
- setThirdPlace: { //获取三方支付签名参数
294
- type: Function
295
- }
253
+ // setThirdPlace: { //获取三方支付签名参数
254
+ // type: Function
255
+ // }
296
256
  },
297
257
  watch: {
298
258
  show(n, o){
@@ -333,12 +293,12 @@ export default {
333
293
  showCardList(){
334
294
  //筛选出不存在于cardList的数据
335
295
  let otherCardList = this.selectedCardList.filter(item =>{
336
- let cur = this.cardList.find(ii => ii.card_number === item.card_number);
296
+ let cur = this.cardList.find(ii => ii.card_number == item.card_number);
337
297
  return !cur;
338
298
  })
339
299
  //合并selectedCardList数据到对应的cardList
340
300
  let combineList = this.cardList.map(item => {
341
- let cur = this.selectedCardList.find(ii => ii.card_number === item.card_number);
301
+ let cur = this.selectedCardList.find(ii => ii.card_number == item.card_number);
342
302
  if(cur) return Object.assign(item, cur);
343
303
  return item;
344
304
  })
@@ -351,14 +311,11 @@ export default {
351
311
  submitCardList(){
352
312
  return this.selectedCardList.filter(item => item.card_use_price > 0);
353
313
  },
354
- curPayChannel(){
355
- return this.payChannels.find(item => item.channel_provider_id === this.channel_provider_id);
356
- }
357
314
  },
358
315
  created(){
359
316
  this.total_price = this.$xdUniHelper.multiplyFloatNumber(this.price, 100);
360
317
  this.needPayPrice = this.total_price;
361
-
318
+ this.switchValidToken();
362
319
  this.getList();
363
320
  },
364
321
  methods: {
@@ -387,7 +344,7 @@ export default {
387
344
  }else{
388
345
  //不走接口, selectedCardList不是真实选中的
389
346
  this.selectedCardList = this.selectedCardList.map(item => {
390
- if(item.card_number === card_number){
347
+ if(item.card_number == card_number){
391
348
  this.needPayPrice = +this.needPayPrice + item['card_use_price']
392
349
  item['card_use_price'] = 0;
393
350
  }
@@ -404,90 +361,45 @@ export default {
404
361
  ...cardForm,
405
362
  selected_card_list_json: JSON.stringify(submitCardList),
406
363
  total_price,
407
- }, () => {
364
+ }, (res) => {
408
365
  //成功回调
409
- this.getList();
366
+ let {selected_card_list=[], need_pay_price} = res;
367
+ this.cardList = selected_card_list.concat(this.cardList);
368
+ this.selectedCardList = selected_card_list.concat(this.selectedCardList);
369
+ this.needPayPrice = need_pay_price;
370
+ this.switchValidToken();
371
+ this.xdDownDrawerNewCard = false;
372
+ this.renderChecked = Date.now();
373
+ }, (err) => {
374
+ this.switchValidToken();
410
375
  })
411
376
  },
412
377
  //确认支付
413
378
  doTicketPay(){
414
379
  const { total_price, submitCardList, needPayPrice } = this;
415
-
416
- if(+needPayPrice > 0 && !this.channel_provider_id){
417
- uni.showToast({
418
- title: "请选择继续支付方式",
419
- icon: "none"
420
- });
421
- return false;
422
- }
423
380
  let postData = {
424
381
  total_price,
425
382
  selected_card_list_json: JSON.stringify(submitCardList),
426
383
  need_pay_price: needPayPrice
427
384
  };
428
-
429
385
  this.createSettleOrder(postData, (order) => {
430
- if(+needPayPrice > 0){
431
- this.doThirdPay(order);
432
- }else{
433
- this.$emit("onCreateOrder", order); //支付完成,触发
434
- }
386
+ this.$emit("onCreateOrder", order); //支付完成,触发
435
387
  })
436
388
  },
389
+ //刷新图片验证码
390
+ switchValidToken(){
391
+ let valid_token = this.$xdUniHelper.randomChar(20);
392
+ this.$set(this.cardForm, "valid_token", valid_token);
393
+ },
437
394
  //扫码
438
395
  doScanCode(){
439
396
  this.jwxSDK.scanQRCode({
440
397
  needResult: 1,
441
398
  success: res => {
442
- console.log(res);
443
399
  this.$set(this.cardForm, 'card_number', res.resultStr)
444
400
  }
445
401
  })
446
402
  },
447
- //第三方支付签名获取
448
- doThirdPay(order){
449
- const { channel_provider_id } = this;
450
- this.setThirdPlace({order_id: order.fms_order_id,channel_provider_id}, (res) => {
451
- const { channel_data } = res;
452
- const paySignData = JSON.parse(Base64.decode(channel_data));
453
- this.openTemplatePay(paySignData, ps => {
454
- this.$emit("onCreateOrder", order); //支付完成,触发
455
- });
456
- })
457
- },
458
- //唤醒三方平台支付
459
- openTemplatePay(paySignData, cb){
460
- // #ifdef H5
461
- this.jwxSDK.chooseWXPay({
462
- ...paySignData,
463
- success: (res) => {
464
- console.log('pay success', res);
465
- uni.showToast({
466
- title: "支付成功",
467
- icon: "none"
468
- })
469
- cb(res);
470
- },
471
- cancel: () => {
472
- uni.showToast({
473
- title: "取消支付",
474
- icon: "none"
475
- })
476
- },
477
- fail: err => {
478
- uni.showToast({
479
- title: "支付失败",
480
- icon: "none"
481
- })
482
- console.log('pay fail', err);
483
- }
484
- })
485
- // #endif
486
-
487
- // #ifndef H5
488
- console.log("未支持唤醒三方支付");
489
- // #endif
490
- },
491
403
  }
492
404
  }
493
405
  </script>
@@ -632,4 +544,4 @@ export default {
632
544
  }
633
545
  }
634
546
  }
635
- </style>
547
+ </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <view class="xd-coins" @click="handleClick" :style="getStyle">
3
- <view class="xd-coins__bg"></view>
3
+ <view class="xd-coins__bg" :style="{backgroundImage: 'url('+ icon +')'}"></view>
4
4
  </view>
5
5
  </template>
6
6
 
@@ -14,6 +14,11 @@
14
14
  * @event {Function} click|tap 点击元宝事件
15
15
  */
16
16
 
17
+ import {
18
+ getParentsStyle,
19
+ } from '@/utils/xd.base';
20
+ import {mapState} from 'vuex';
21
+
17
22
  export default {
18
23
  name: "XdCoins",
19
24
  props:{
@@ -29,10 +34,12 @@
29
34
  data(){
30
35
  return {
31
36
  height: 92,
32
- width: 120
37
+ width: 120,
38
+ icon: '',
33
39
  }
34
40
  },
35
41
  computed:{
42
+ ...mapState(['webUnitIcon']),
36
43
  getStyle(){
37
44
  let size = this.size;
38
45
  if (this.$xdUniHelper.checkVarType(size) === 'string') {
@@ -45,8 +52,25 @@
45
52
  if (size < 0.1) size = 0.1;
46
53
  if (size > 1.5) size = 1.5;
47
54
  return `height:${this.height * size}rpx; width: ${this.width * size}rpx;`;
55
+ },
56
+ },
57
+ created(){
58
+ //brand中获取
59
+ let brandIncon = null;
60
+ if (getApp().globalData.$xd && getApp().globalData.$xd.brandInfo['unit_icon']) {
61
+ brandIncon = getApp().globalData.$xd.brandInfo['unit_icon'];
62
+ }
63
+
64
+ //项目配置中获取
65
+ let projectIcon;
66
+ if (this.webUnitIcon) {
67
+ projectIcon = this.webUnitIcon;
48
68
  }
69
+
70
+ this.icon = projectIcon || brandIncon;
49
71
  },
72
+
73
+
50
74
  methods:{
51
75
  handleClick(e){
52
76
  this.$emit('click',e);
@@ -89,7 +89,12 @@
89
89
  <view><text>{{itemc['show_time_hour']}}</text><text>({{itemc['show_version']}})</text></view>
90
90
  <view>{{itemc['hall_name']}}</view>
91
91
  <view>
92
- <xd-unit font-weight="normal" :price="itemc['price']" :font-size="24"></xd-unit>
92
+ <xd-unit
93
+ font-weight="normal"
94
+ :price="itemc['price']"
95
+ :is-old="isOld"
96
+ :font-size="24"
97
+ ></xd-unit>
93
98
  </view>
94
99
  </view>
95
100
  </view>
@@ -120,7 +125,15 @@
120
125
  <view class="xd-seat__footer-buy">
121
126
  <xd-button @click="handleBuy" type="primary" radius="10rpx">
122
127
  <view class="xd-seat__footer-buy-box">
123
- <xd-unit v-if="getPrice > 0" :price="getPrice" :font-size="36" :iocn-size=".45" font-weight="normal" color="#fff"></xd-unit>
128
+ <xd-unit
129
+ v-if="getPrice > 0"
130
+ :price="getPrice"
131
+ :font-size="36"
132
+ :iocn-size=".45"
133
+ font-weight="normal"
134
+ color="#fff"
135
+ :is-old="isOld"
136
+ ></xd-unit>
124
137
  <view>确认选择</view>
125
138
  </view>
126
139
  </xd-button>
@@ -177,6 +190,10 @@
177
190
  XdNoticeBar
178
191
  },
179
192
  props:{
193
+ isOld: {
194
+ type: Boolean,
195
+ default: true,
196
+ },
180
197
  filmId: {
181
198
  type: Number | String,
182
199
  required: true
@@ -5,11 +5,13 @@
5
5
  v-if="!$isIpad"
6
6
  >
7
7
  <radio
8
+ v-if="!disabled"
8
9
  :checked="checked"
9
10
  :disabled="disabled"
10
11
  :color="uiColor"
11
12
  :class="'xd-radio__' + size + '-body'"
12
13
  ></radio>
14
+ <view :class="'xd-radio__' + size + '-disabled'" v-else></view>
13
15
  </view>
14
16
  <view class="xd-radio__ipad" v-else>
15
17
  <radio
@@ -100,6 +102,22 @@
100
102
  margin-right: 0;
101
103
  }
102
104
  }
105
+
106
+ &-disabled {
107
+ width: 100%;
108
+ height: 100%;
109
+ position: absolute;
110
+ transform: scale(1);
111
+ top: 0;
112
+ left: 0;
113
+ display: flex;
114
+ justify-content: center;
115
+ align-items: center;
116
+ border-radius: 50%;
117
+ background: #f8f8f8;
118
+ border: 1px solid #e5e5e5;
119
+ box-sizing: border-box;
120
+ }
103
121
  }
104
122
 
105
123
  &__small {
@@ -123,6 +141,22 @@
123
141
  margin-right: 0;
124
142
  }
125
143
  }
144
+
145
+ &-disabled {
146
+ width: 100%;
147
+ height: 100%;
148
+ position: absolute;
149
+ transform: scale(0.6);
150
+ top: 0;
151
+ left: 0;
152
+ display: flex;
153
+ justify-content: center;
154
+ align-items: center;
155
+ border-radius: 50%;
156
+ background: #f8f8f8;
157
+ border: 1px solid #e5e5e5;
158
+ box-sizing: border-box;
159
+ }
126
160
  }
127
161
 
128
162
  &__mini {
@@ -146,6 +180,22 @@
146
180
  margin-right: 0;
147
181
  }
148
182
  }
183
+
184
+ &-disabled {
185
+ width: 100%;
186
+ height: 100%;
187
+ position: absolute;
188
+ transform: scale(0.8);
189
+ top: 0;
190
+ left: 0;
191
+ display: flex;
192
+ justify-content: center;
193
+ align-items: center;
194
+ border-radius: 50%;
195
+ background: #f8f8f8;
196
+ border: 1px solid #e5e5e5;
197
+ box-sizing: border-box;
198
+ }
149
199
  }
150
200
  }
151
201
  </style>
@@ -124,7 +124,7 @@
124
124
  },
125
125
  data() {
126
126
  return {
127
- uiColor: '#c00', //金额显示颜色
127
+ uiColor: '#f00', //金额显示颜色
128
128
  uiIcon: null, //金额显示icon
129
129
  uiPrice: null, //金额
130
130
  }
@@ -135,21 +135,10 @@
135
135
  },
136
136
  },
137
137
  async created() {
138
- this.uiColor = this.$mainColor;
139
138
 
140
139
  //设置显示数字
141
140
  this.initPrice();
142
141
 
143
- //使用配置文件里面的单位颜色
144
- if(this.webSetting['unitTextColor']) {
145
- this.uiColor = this.webSetting['unitTextColor'];
146
- }
147
-
148
- //自定义单位自定义颜色
149
- if(this.webSetting['unitTextColor']) {
150
- this.uiColor = this.webSetting['unitTextColor'];
151
- }
152
-
153
142
  //配置中获取
154
143
  let optionsIcon = null;
155
144
  if (this.webSetting['unitIcon']) {
@@ -177,9 +166,18 @@
177
166
  },
178
167
  methods: {
179
168
  initPrice(){
169
+ if(this.price === undefined) return;
170
+
180
171
  //设置显示数字
181
172
  if (this.isOld) this.uiPrice = this.price;
182
- else this.uiPrice = this.$xdUniHelper.divisionFloatNumber(this.price, 100);
173
+ else {
174
+ let price = this.price;
175
+ console.log('initPrice',price);
176
+ if(this.$xdUniHelper.checkVarType(price) === 'string') {
177
+ price = Number(price);
178
+ }
179
+ this.uiPrice = this.$xdUniHelper.divisionFloatNumber(price, 100);
180
+ }
183
181
  }
184
182
  }
185
183
  }