jufubao-base 1.0.169-beta1 → 1.0.169-beta3

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": "jufubao-base",
3
- "version": "1.0.169-beta1",
3
+ "version": "1.0.169-beta3",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -16,4 +16,19 @@ module.exports = [
16
16
  },
17
17
  disabled: true,
18
18
  },
19
+ {
20
+ mapFnName: 'getListBaseNewsContent', //自定义方法名字(必选)
21
+ title: '获取内容',
22
+ path: '/cms/v1/news-content',
23
+ isRule: false,
24
+ params: {
25
+ scene: ['使用场景', 'String', '选填'],
26
+ container_id: ['插件ID', 'String', '必填'],
27
+ page_id: ['页面ID', 'String', '必填'],
28
+ page_size: ['记录条数', 'Number', '必填', 1],
29
+ code: ['业务线id', 'String', '选填'],
30
+ },
31
+ isConsole: true,
32
+ disabled: true,
33
+ },
19
34
  ];
@@ -38,10 +38,10 @@ export default {
38
38
  value: data.cardImageUrl || {},
39
39
  defaultValue: data.cardImageUrl || null,
40
40
  slot: true,
41
- oneWidth: 350,
42
- oneHeight: 137,
41
+ oneWidth: 355,
42
+ oneHeight: 170,
43
43
  elinputClassName: 'input40',
44
- tipsformet: '上传文件格式:@imageType@,不超过@size@MB.',
44
+ tipsformet: '上传格式:@imageType@不超过@size@MB.建议尺寸710*340',
45
45
  type: ['jpg', 'png', 'jpeg'],
46
46
  styleType: 'one',
47
47
  uploadType: 'aliyun',
@@ -50,6 +50,230 @@ export default {
50
50
  sort: true,
51
51
  maxlen: 100,
52
52
  },
53
+ {
54
+ label: "票券使用规则",
55
+ ele: 'xd-site-news',
56
+ valueKey: 'cardRule',
57
+ groupKey:'content',
58
+ value: data.cardRule || null,
59
+ className: 'input70',
60
+ setting: {
61
+ config: {
62
+ sort: true,
63
+ maxlen: 100,
64
+ action: 'aliyun',
65
+ size: 5,
66
+ tipsformet: '上传文件格式:@imageType@,不超过@size@MB.',
67
+ uploadType: 'aliyun',
68
+ type: ['jpg', 'png', 'jpeg']
69
+ },
70
+ },
71
+ handleCustom({action, data}) {
72
+ if (data && data.params) {
73
+ //当一个插件中出现使用内容分类时候需要设置code值,在页面引用时候容器id + code进行拼接
74
+ //data.params = Object.assign({}, data.params, {code: 'g_test_id'});
75
+ }
76
+
77
+ //获取返回参数(场景类型名称为必填)
78
+ //获取返回参数(场景类型名称为必填)
79
+ let loading = { close(){}}
80
+
81
+ //获取显示内容
82
+ if (action === 'screen') {
83
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_bucket_content_tip'})
84
+ .then(res => {
85
+ loading.close();
86
+ data.cb(res['list'])
87
+ })
88
+ .catch(error => {
89
+ console.error(error);
90
+ loading.close();
91
+ });
92
+
93
+ }
94
+
95
+ //获取返回参数(广告位高度必选项)
96
+ if (action === 'getNewsInfo') {
97
+ XdBus.getParentApi('cmsGetPublishEditxContent')(data.params)
98
+ .then(res => {
99
+ loading.close()
100
+ data.cb({list: res.list, selectId: res.selected})
101
+ })
102
+ .catch(error => {
103
+ loading.close()
104
+ console.error(error);
105
+ });
106
+ }
107
+
108
+ //获取产品业务线列表
109
+ if (action === 'namespace') {
110
+ XdBus.getParentApi('getOptionsNamespaces')({})
111
+ .then(res => {
112
+ loading.close()
113
+ data.cb(res['list'])
114
+ })
115
+ .catch(error => {
116
+ loading.close()
117
+ console.error(error);
118
+ });
119
+ }
120
+
121
+ //使用内容分类
122
+ if (action === 'cmsPublishEditxContent') {
123
+ loading = XdBus.getParentApi('loading')({});
124
+ XdBus.getParentApi('cmsPublishEditxContent')(data.params)
125
+ .then(res => {
126
+ console.log('cmsPublishEditxContent', res)
127
+ loading.close();
128
+ data.cb(res)
129
+ })
130
+ .catch(error => {
131
+ loading.close();
132
+ console.error(error);
133
+ });
134
+ }
135
+
136
+ //位置列表
137
+ if (action === 'getListPostion') {
138
+ loading = XdBus.getParentApi('loading')({});
139
+ XdBus.getParentApi('getListNewsPosition')(data.params)
140
+ .then(res => {
141
+ loading.close();
142
+ data.cb(res)
143
+ })
144
+ .catch(error => {
145
+ loading.close();
146
+ console.error(error);
147
+ });
148
+ }
149
+
150
+ //位置创建
151
+ if (action === 'addPostion') {
152
+ loading = XdBus.getParentApi('loading')({});
153
+ XdBus.getParentApi('addNewsPosition')(data.params)
154
+ .then(res => {
155
+ loading.close();
156
+ data.cb(true)
157
+ })
158
+ .catch(error => {
159
+ console.error(error);
160
+ loading.close();
161
+ data.cb(false)
162
+ });
163
+ }
164
+
165
+ //位置编辑
166
+ if (action === 'editPostion') {
167
+ loading = XdBus.getParentApi('loading')({});
168
+ XdBus.getParentApi('updateNewsPosition')(data.params)
169
+ .then(res => {
170
+ loading.close();
171
+ data.cb(true)
172
+ })
173
+ .catch(error => {
174
+ console.error(error);
175
+ loading.close();
176
+ data.cb(false)
177
+ });
178
+ }
179
+
180
+ //位置删除
181
+ if (action === 'deleltePostion') {
182
+ loading = XdBus.getParentApi('loading')({});
183
+ XdBus.getParentApi('deleteNewsPosition')(data.params)
184
+ .then(res => {
185
+ loading.close();
186
+ data.cb(true)
187
+ })
188
+ .catch(error => {
189
+ console.error(error);
190
+ loading.close();
191
+ data.cb(false)
192
+ });
193
+ }
194
+
195
+ //获取广告位内容列表
196
+ if (action === 'getListContent') {
197
+ loading = XdBus.getParentApi('loading')({});
198
+ XdBus.getParentApi('getListNewsContent')(data.params)
199
+ .then(res => {
200
+ loading.close();
201
+ data.cb(res)
202
+ })
203
+ .catch(error => {
204
+ loading.close();
205
+ console.error(error);
206
+ });
207
+ }
208
+
209
+ //广告内容创建
210
+ if (action === 'addContent') {
211
+ loading = XdBus.getParentApi('loading')({});
212
+ XdBus.getParentApi('addNewsContent')(data.params)
213
+ .then(res => {
214
+ loading.close();
215
+ data.cb(true)
216
+ })
217
+ .catch(error => {
218
+ console.error(error);
219
+ loading.close();
220
+ data.cb(false)
221
+ });
222
+ }
223
+
224
+ //广告内容编辑
225
+ if (action === 'editContent') {
226
+ loading = XdBus.getParentApi('loading')({});
227
+ XdBus.getParentApi('updateNewsContent')(data.params)
228
+ .then(res => {
229
+ loading.close();
230
+ data.cb(true)
231
+ })
232
+ .catch(error => {
233
+ console.error(error);
234
+ loading.close();
235
+ data.cb(false)
236
+ });
237
+ }
238
+
239
+ //广告内容删除
240
+ if (action === 'deleteContent') {
241
+ loading = XdBus.getParentApi('loading')({});
242
+ XdBus.getParentApi('deleteNewsContent')(data.params)
243
+ .then(res => {
244
+ loading.close();
245
+ data.cb(true)
246
+ })
247
+ .catch(error => {
248
+ console.error(error);
249
+ loading.close();
250
+ data.cb(false)
251
+ });
252
+ }
253
+
254
+ //内容发布
255
+ if (action === 'publish') {
256
+ loading = XdBus.getParentApi('loading')({});
257
+ console.log('publish', data.params)
258
+ XdBus.getParentApi('cmsPublishContent')(data.params)
259
+ .then(res => {
260
+ loading.close();
261
+ data.cb(res)
262
+ })
263
+ .catch(error => {
264
+ loading.close();
265
+ console.error(error);
266
+ });
267
+ }
268
+
269
+ //通知页面进行刷新
270
+ if (action === 'update') {
271
+ loading = XdBus.getParentApi('loading')({});
272
+ XdBus.getParentApi('getXdBusUpdateView')('onUpdateView', {});
273
+ loading.close()
274
+ }
275
+ },
276
+ },
53
277
  {
54
278
  label: "票券信息样式配置",
55
279
  ele: "title",
@@ -31,8 +31,10 @@
31
31
  </view>
32
32
  <view class="_name">{{ cardInfo.card_type_name }}</view>
33
33
  </view>
34
- <view>
35
- <view class="card_deduct">购买其他物品可抵扣:78.21</view>
34
+ <view v-if="cardInfo.other_card_point && cardInfo.card_point_type !== 1">
35
+ <view class="card_deduct">
36
+ 购买其他物品可抵扣:{{ cardInfo.other_card_point }}
37
+ </view>
36
38
  </view>
37
39
  </view>
38
40
  <view class="card_bottom">
@@ -74,8 +76,10 @@
74
76
  </view>
75
77
  </view>
76
78
  <view v-if="curModule === 'rule'">
77
- <view class="rule_wrap" :style="ruleDetailBoxStyle">
78
- 使用规则
79
+ <view v-if="cardRule" v-html="cardRule" class="rule_wrap" :style="ruleDetailBoxStyle">
80
+ </view>
81
+ <view v-else class="rule_wrap" :style="ruleDetailBoxStyle">
82
+ 使用规则暂无
79
83
  </view>
80
84
  </view>
81
85
  <view v-if="curModule === 'pickup'">
@@ -84,10 +88,14 @@
84
88
  <view><xd-font-icon :icon='payPreIcon || "iconsaoma1"' size="54"></xd-font-icon></view>
85
89
  <view class="_title">向商家付款</view>
86
90
  </view>
87
- <view class="barcode"></view>
88
- <view class="qrcode" :style="qrcodeBoxStyle"></view>
89
- <view class="time_loop">9分59秒后自动刷新</view>
90
- <view class="refresh_btn">
91
+ <view class="barcode">
92
+ <image :src="cardInfo.barcode" mode="widthFix"></image>
93
+ </view>
94
+ <view class="qrcode" :style="qrcodeBoxStyle">
95
+ <image :src="cardInfo.card_qrcode"></image>
96
+ </view>
97
+ <view class="time_loop">{{ timeStr }}后自动刷新</view>
98
+ <view class="refresh_btn" @click="handleRefresh">
91
99
  <xd-font-icon class="btn_icon" :icon="refreshIcon"></xd-font-icon>
92
100
  刷新二维码
93
101
  </view>
@@ -123,7 +131,13 @@
123
131
  card_number: "",
124
132
  cardInfo: {},
125
133
  businessList: [],
134
+ timeStr: "",
135
+ timeer: null,
136
+ date: 2, //时间底数
137
+ time: 2, //时间幂指数
138
+ stopTimer: false, //停止轮询
126
139
 
140
+ cardRule: "",
127
141
  showBusinessList: "Y",
128
142
  //todo
129
143
  cardInfoMargin: {},
@@ -292,6 +306,7 @@
292
306
  onJfbLoad(options) {
293
307
  this.card_number = options.card_number;
294
308
  this.getCardDetail();
309
+ this.getContent();
295
310
  },
296
311
  /**
297
312
  * @description 监听事件变化
@@ -336,28 +351,83 @@
336
351
  is_show_entry_settings: this.showBusinessList,
337
352
  }
338
353
  }).then(res => {
339
- this.cardInfo = res;
354
+ this.cardInfo = Object.assign({}, res, {
355
+ other_card_point: res.other_card_point ? this.$xdUniHelper.divisionFloatNumber(res.other_card_point, 100) : 0
356
+ });
340
357
  this.businessList = res.site_entry_settings.map(item => {
341
358
  item['image_url'] = getServiceUrl(item.image_url);
342
359
  return item;
343
360
  })
344
-
361
+ if(!this.$configProject.isPreview) {
362
+ this.setIntval(res.card_qrcode_expire);
363
+ }else{
364
+ this.timeStr = "08分10秒";
365
+ }
345
366
  })
346
367
  },
347
- onJfbScroll(options) {
348
- console.log('event.onJfbScroll', options)
368
+ getContent() {
369
+ jfbRootExec("getListBaseNewsContent", {
370
+ vm: this,
371
+ data: {
372
+ page_id: this.pageAttr["page_id"], //页面ID
373
+ container_id: this.containerId, //组件ID
374
+ limit: 1,
375
+ },
376
+ })
377
+ .then((res) => {
378
+ if (res.list.length > 0) {
379
+ if(res.list && res.list.length > 0) {
380
+ this.cardRule = this.$xdUniHelper.filterHtml(res.list[0].content);
381
+ }
382
+ // this.noticeStatus = true;
383
+ }
384
+ })
385
+ .catch((error) => {
386
+ console.error(error);
387
+ });
349
388
  },
350
- onJfbReachBottom(options) {
351
- console.log('event.onJfbReachBottom', options)
389
+ handleRefresh(){
390
+ clearInterval(this.timeer);
391
+ this.getCardDetail();
392
+ },
393
+ setIntval(time){
394
+ this.timeer = setInterval(() => {
395
+ if (time === 0) {
396
+ this.timeStr = "00分00秒";
397
+ clearInterval(this.timeer);
398
+ if (!this.stopTimer) this.getCardDetail();
399
+ } else {
400
+ time--;
401
+ let f = Math.floor(time / 60);
402
+ f = f < 10 ? "0" + f : f;
403
+ let m = time % 60;
404
+ m = m < 10 ? "0" + m : m;
405
+ this.timeStr = `${f}分${m}秒`;
406
+ }
407
+ }, 1000);
408
+ },
409
+
410
+ onJfbUnload(){
411
+ this.timeStr = ""
412
+ if (this.timeer) {
413
+ clearInterval(this.timeer);
414
+ }
352
415
  },
353
416
  onJfbShow(options) {
354
- console.log('event.onJfbShow', options)
417
+ this.onJfbLoad(options)
355
418
  },
356
419
  onJfbHide(options) {
357
- console.log('event.onJfbHide', options)
420
+ this.timeStr = ""
421
+ if (this.timeer) {
422
+ clearTimeout(this.timeer);
423
+ }
358
424
  },
359
425
  onJfbBack(options) {
360
- console.log('event.onJfbBack', options)
426
+ this.timeStr = ""
427
+ if (this.timeer) {
428
+ clearTimeout(this.timeer);
429
+ }
430
+ this.$xdUniHelper.navigateBack();
361
431
  },
362
432
  onJfbUpdate(...data) {
363
433
  console.log('event.onJfbUpdate', data)
@@ -477,16 +547,19 @@
477
547
  }
478
548
  }
479
549
  .barcode{
480
- background-color: #EEE;
481
- height: 100rpx;
550
+ width: 100%;
482
551
  margin-top: 32rpx;
552
+ image{
553
+ width: 100%;
554
+ }
483
555
  }
484
556
  .qrcode{
485
- background-color: #EEE;
486
- height: 100rpx;
487
- width: 100rpx;
488
557
  margin: 40rpx 24rpx;
489
558
  align-self: center;
559
+ image{
560
+ width: 100%;
561
+ height: 100%;
562
+ }
490
563
  }
491
564
  .time_loop{
492
565
  align-self: center;
@@ -15,11 +15,11 @@ module.exports = {
15
15
  card_qrcode_expire: 600,
16
16
  unit: "点",
17
17
  main_business_code_name: "",
18
- other_card_point: 0,
18
+ other_card_point: 2480,
19
19
  is_exchange: "N",
20
20
  exchange_card_type_name: "福券",
21
21
  exchange_card_point: 86511,
22
- card_point_type: 1,
22
+ card_point_type: 2,
23
23
  is_show_qrcode_logo: "Y",
24
24
  is_can_unbind: "Y",
25
25
  is_can_transfer: "Y",
@@ -259,7 +259,7 @@ export default {
259
259
  oneWidth: 350,
260
260
  oneHeight: 137,
261
261
  elinputClassName: 'input40',
262
- tipsformet: '上传文件格式:@imageType@,不超过@size@MB.',
262
+ tipsformet: '上传格式:@imageType@不超过@size@MB.建议尺寸700*274',
263
263
  type: ['jpg', 'png', 'jpeg'],
264
264
  styleType: 'one',
265
265
  uploadType: 'aliyun',
@@ -524,6 +524,13 @@ export default {
524
524
  size: "small",
525
525
  groupKey: "style",
526
526
  },
527
+ {
528
+ label: "优惠券左侧背景色设置:",
529
+ ele: "xd-gradient-color",
530
+ valueKey: "couponLeftBgColor",
531
+ value: data.couponLeftBgColor || 'linear-gradient(180deg, #FFA852 0%, #FF5733 100%)',
532
+ groupKey:'style',
533
+ },
527
534
  {
528
535
  label: "圆角设置",
529
536
  ele: 'xd-site-select-list',
@@ -120,37 +120,15 @@
120
120
  <!-- 优惠券 -->
121
121
  <template v-else >
122
122
  <view v-if="couponList.length" class="coupon_list">
123
- <view class="coupon_item" v-for="(item, i) in couponList" :key="i" :style="couponItemBoxStyle">
124
- <view class="coupon_left">
125
- <view class="_point">200<text style="font-size: 24rpx;">点</text></view>
126
- <view class="_rule">满100减40</view>
127
- </view>
128
- <view class="coupon_right" :style="couponRightItemBoxStyle">
129
- <view class="cont_top" :style="{
130
- background: couponTitleBgColor
131
- }">众福优选-众选全场通兑次票60档(上海)</view>
132
- <view class="cont_main">
133
- <view class="cou_number">券号:923974909815654</view>
134
- <view class="cou_time">有效期:2023-09-09</view>
135
- <view class="cou_point">余额:120</view>
136
- <view class="cou_btn" :style="[couponBtnStyle, {
137
- padding: couponBtnPadding,
138
- borderRadius: couponBtnRadius + 'rpx'
139
- }]">去使用</view>
140
- </view>
141
- <view class="cont_bottom">
142
- <view class="switch_rule">
143
- <view>使用规则</view>
144
- <view>
145
- <xd-font-icon icon="iconxia_down" size="24"></xd-font-icon>
146
- </view>
147
- </view>
148
- <view class="expand_rule">
149
- 这是一段文字规则描述,不知道又多长多长长...
150
- </view>
151
- </view>
152
- </view>
153
- </view>
123
+ <xd-coupon-item v-for="(item, i) in couponList" :key="i"
124
+ :couponRadius="couponRadius"
125
+ :couponImageUrl="couponImageUrl"
126
+ :couponTitleBgColor="couponTitleBgColor"
127
+ :couponUseBtnPadding="couponUseBtnPadding"
128
+ :couponBtnRadius="couponBtnRadius"
129
+ :couponBtnTextStyle="couponBtnTextStyle"
130
+ :couponLeftBgColor="couponLeftBgColor"
131
+ ></xd-coupon-item>
154
132
  <view v-if="!hasCouponList" class="no_more_card">没有更多券了,查看失效的票券 ></view>
155
133
  </view>
156
134
  <view v-else>
@@ -173,12 +151,14 @@
173
151
  import extsMixins from "@/mixins/extsMixins";
174
152
  import getServiceUrl from '@/common/getServiceUrl'
175
153
  import XdNoticeBar from "@/components/XdNoticeBar/XdNoticeBar";
154
+ import XdCouponItem from "./XdCouponItem";
176
155
  import Color from "color"
177
156
  export default {
178
157
  name: "JfbBaseTfkCardLogin",
179
158
  components: {
180
159
  XdFontIcon,
181
- XdNoticeBar
160
+ XdNoticeBar,
161
+ XdCouponItem,
182
162
  },
183
163
  mixins: [
184
164
  componentsMixins, extsMixins, JfbBaseTfkCardLoginMixin
@@ -219,6 +199,7 @@
219
199
  couponBtnTextStyle: {}, //优惠券包登录按钮文字背景色设置
220
200
  couponUseBtnPadding: {},
221
201
  couponBtnRadius: 16,
202
+ couponLeftBgColor: "",
222
203
  }
223
204
  },
224
205
  computed: {
@@ -411,8 +392,9 @@
411
392
  this.couponBtnTextStyle = getContainerPropsValue(value, "content.couponBtnTextStyle", {});
412
393
  this.couponUseBtnPadding = getContainerPropsValue(value, "content.couponUseBtnPadding", {top: 20, left: 20, right: 20, bottom: 20});
413
394
  this.couponBtnRadius = getContainerPropsValue(value, "content.couponBtnRadius", 16);
395
+ this.couponLeftBgColor = getContainerPropsValue(value, "content.couponLeftBgColor", "");
414
396
 
415
- console.log(this.couponTitleBgColor, 'couponTitleBgColor')
397
+ console.log(this.couponLeftBgColor, 'couponLeftBgColor')
416
398
 
417
399
  if(this.$configProject.isPreview){
418
400
  this.menuType = this.previewCurrent;
@@ -587,83 +569,7 @@
587
569
  }
588
570
  }
589
571
  }
590
- .coupon_list{
591
- .coupon_item{
592
- display: flex;
593
- margin: 20rpx 0;
594
- border-radius: 16rpx;
595
- background: #FFFFFF;
596
- overflow: hidden;
597
- .coupon_left{
598
- color: #FFFFFF;
599
- width: 170rpx;
600
- display: flex;
601
- flex-direction: column;
602
- align-items: center;
603
- justify-content: center;
604
- background: linear-gradient(180deg, #FFA852 0%, #FF5733 100%);
605
-
606
- ._point{
607
- font-size: 48rpx;
608
- }
609
- ._rule{
610
- font-size: 24rpx;
611
- }
612
- }
613
- .coupon_right{
614
- flex: 1;
615
- width: 530rpx;
616
- .cont_top{
617
- background: rgba(255, 87, 51, 0.1);
618
- padding: 8rpx 40rpx;
619
- font-size: 24rpx;
620
- overflow: hidden;
621
- white-space: nowrap;
622
- text-overflow: ellipsis;
623
- }
624
- .cont_main{
625
- position: relative;
626
- padding: 28rpx 20rpx 28rpx 40rpx;
627
- .cou_number{
628
- font-size: 32rpx;
629
- font-weight: bold;
630
- }
631
- .cou_time{
632
- font-size: 28rpx;
633
- margin: 16rpx 0;
634
- }
635
- .cou_point{
636
- font-size: 28rpx;
637
- }
638
- .cou_btn{
639
- position: absolute;
640
- padding: 10rpx 30rpx;
641
- background-color: #ddd;
642
- border-radius: 12rpx;
643
- right: 20rpx;
644
- bottom: 20rpx;
645
- }
646
- }
647
- .cont_bottom{
648
- background: #EEEEEE;
649
- .switch_rule{
650
- display: flex;
651
- align-items: center;
652
- justify-content: space-between;
653
- padding: 12rpx 40rpx;
654
- }
655
- .expand_rule{
656
- padding: 12rpx 40rpx;
657
- font-size: 20rpx;
658
- overflow: hidden;
659
- white-space: nowrap;
660
- text-overflow: ellipsis;
661
- background-color: #F5F5F5;
662
- }
663
- }
664
- }
665
- }
666
- }
572
+ .coupon_list{}
667
573
  .no_more_card{
668
574
  text-align: center;
669
575
  padding: 20rpx 0;
@@ -0,0 +1,219 @@
1
+ <template>
2
+ <view class="xd-coupon_item" :style="couponItemBoxStyle">
3
+ <view class="coupon_left" :style="{
4
+ background: couponLeftBgColor
5
+ }">
6
+ <view class="_point">200<text style="font-size: 24rpx;">点</text></view>
7
+ <view class="_rule">满100减40</view>
8
+ </view>
9
+ <view class="coupon_right" :style="couponRightItemBoxStyle">
10
+ <view class="cont_top" :style="{
11
+ background: couponTitleBgColor
12
+ }">众福优选-众选全场通兑次票60档(上海)</view>
13
+ <view class="cont_main">
14
+ <view class="cou_number">券号:923974909815654</view>
15
+ <view class="cou_time">有效期:2023-09-09</view>
16
+ <view class="cou_point">余额:120</view>
17
+ <view class="cou_btn" :style="[couponBtnStyle, {
18
+ padding: couponBtnPadding,
19
+ borderRadius: couponBtnRadius + 'rpx'
20
+ }]">去使用</view>
21
+ </view>
22
+ <view class="cont_bottom">
23
+ <view class="switch_rule">
24
+ <view>使用规则</view>
25
+ <view>
26
+ <xd-font-icon icon="iconxia_down" size="24"></xd-font-icon>
27
+ </view>
28
+ </view>
29
+ <view class="expand_rule">
30
+ 这是一段文字规则描述,不知道又多长多长长...
31
+ </view>
32
+ </view>
33
+ </view>
34
+ </view>
35
+ </template>
36
+ <script>
37
+ import getServiceUrl from '@/common/getServiceUrl'
38
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
39
+ export default{
40
+ name: "XdCouponItem",
41
+ components: {
42
+ XdFontIcon
43
+ },
44
+ props: {
45
+ couponRadius: {
46
+ type: String,
47
+ default: "16"
48
+ },
49
+ couponLeftBgColor: {
50
+ type: String,
51
+ default: 'linear-gradient(180deg, #FFA852 0%, #FF5733 100%)'
52
+ },
53
+ couponImageUrl: {
54
+ type: Object | String
55
+ },
56
+ couponTitleBgColor: {
57
+ type: String,
58
+ default: "rgba(255, 87, 51, 0.1)"
59
+ },
60
+ couponUseBtnPadding: {
61
+ type: Object,
62
+ default(){
63
+ return {
64
+ top: 20,
65
+ right: 20,
66
+ bottom: 10,
67
+ left: 20
68
+ }
69
+ },
70
+ },
71
+ couponBtnRadius: {
72
+ type: String,
73
+ default: "16"
74
+ },
75
+ couponBtnTextStyle: {
76
+ type: Object,
77
+ default(){
78
+ return {
79
+ color: '#fff',
80
+ bgColor: '#ff5722',
81
+ fontSize: '30rpx',
82
+ fontWeight: 'normal'
83
+ }
84
+ }
85
+ }
86
+ },
87
+ data() {
88
+ return {
89
+
90
+ }
91
+ },
92
+ computed: {
93
+ couponItemBoxStyle(){
94
+ return this.styleObjectToString({
95
+ borderRadius: this.couponRadius + 'rpx',
96
+ })
97
+ },
98
+ couponBtnPadding(){
99
+ let padding = `${this.checkValue(this.couponUseBtnPadding.top, 20)}rpx`;
100
+ padding = `${padding} ${this.checkValue(this.couponUseBtnPadding.right, 20)}rpx`;
101
+ padding = `${padding} ${this.checkValue(this.couponUseBtnPadding.bottom, 20)}rpx`;
102
+ padding = `${padding} ${this.checkValue(this.couponUseBtnPadding.left, 20)}rpx`;
103
+ return padding;
104
+ },
105
+ couponBtnStyle(){
106
+ let styleObj = {
107
+ color: this.couponBtnTextStyle['color'] || '#333',
108
+ background: this.couponBtnTextStyle['bgColor'] || '#fff',
109
+ fontSize: this.couponBtnTextStyle['fontSize'] || '30rpx',
110
+ fontWeight: this.couponBtnTextStyle['fontWeight'] || 'normal',
111
+ }
112
+ return this.styleObjectToString(styleObj)
113
+ },
114
+ couponRightItemBoxStyle(){
115
+ let image = {};
116
+ if(this.cardImageUrl) image = {
117
+ backgroundImage: `url(${this.getCouponBgImage})`,
118
+ backgroundSize: '100%',
119
+ backgroundRepeat: 'no-repeat',
120
+ }
121
+ return this.styleObjectToString(image)
122
+ },
123
+ getCouponBgImage(){
124
+ let bg = '';
125
+ if(this.$xdUniHelper.checkVarType(this.couponImageUrl) === 'object'
126
+ || this.$xdUniHelper.checkVarType(this.couponImageUrl) === 'array'
127
+ ) {
128
+ if(!this.$xdUniHelper.isEmpty(this.couponImageUrl)) {
129
+ return getServiceUrl(this.couponImageUrl.url)
130
+ }
131
+ }
132
+ return bg
133
+ },
134
+ },
135
+ methods: {
136
+ checkValue(value, dValue = 0){
137
+ if(value === undefined || value === '' || value === null) return dValue;
138
+ return Number(value || 0);
139
+ },
140
+ }
141
+ }
142
+
143
+ </script>
144
+ <style lang="less" scoped>
145
+ .xd-coupon_item{
146
+ display: flex;
147
+ margin: 20rpx 0;
148
+ border-radius: 16rpx;
149
+ background: #FFFFFF;
150
+ overflow: hidden;
151
+ .coupon_left{
152
+ color: #FFFFFF;
153
+ width: 170rpx;
154
+ display: flex;
155
+ flex-direction: column;
156
+ align-items: center;
157
+ justify-content: center;
158
+
159
+ ._point{
160
+ font-size: 48rpx;
161
+ }
162
+ ._rule{
163
+ font-size: 24rpx;
164
+ }
165
+ }
166
+ .coupon_right{
167
+ flex: 1;
168
+ width: 530rpx;
169
+ .cont_top{
170
+ background: rgba(255, 87, 51, 0.1);
171
+ padding: 8rpx 40rpx;
172
+ font-size: 24rpx;
173
+ overflow: hidden;
174
+ white-space: nowrap;
175
+ text-overflow: ellipsis;
176
+ }
177
+ .cont_main{
178
+ position: relative;
179
+ padding: 28rpx 20rpx 28rpx 40rpx;
180
+ .cou_number{
181
+ font-size: 32rpx;
182
+ font-weight: bold;
183
+ }
184
+ .cou_time{
185
+ font-size: 28rpx;
186
+ margin: 16rpx 0;
187
+ }
188
+ .cou_point{
189
+ font-size: 28rpx;
190
+ }
191
+ .cou_btn{
192
+ position: absolute;
193
+ padding: 10rpx 30rpx;
194
+ background-color: #ddd;
195
+ border-radius: 12rpx;
196
+ right: 20rpx;
197
+ bottom: 20rpx;
198
+ }
199
+ }
200
+ .cont_bottom{
201
+ background: #EEEEEE;
202
+ .switch_rule{
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: space-between;
206
+ padding: 12rpx 40rpx;
207
+ }
208
+ .expand_rule{
209
+ padding: 12rpx 40rpx;
210
+ font-size: 20rpx;
211
+ overflow: hidden;
212
+ white-space: nowrap;
213
+ text-overflow: ellipsis;
214
+ background-color: #F5F5F5;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ </style>