jufubao-base 1.0.67 → 1.0.69-beta1

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.
@@ -0,0 +1,608 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-con-list"
4
+ @click="handleEditxSelect"
5
+ :class="{
6
+ editx: isEditx && active,
7
+ noBorder: noBorder,
8
+ }"
9
+ >
10
+ <!--#ifdef H5-->
11
+ <view
12
+ class="jfb-base-con-list__edit"
13
+ :class="{ editx: isEditx && active }"
14
+ v-if="isEditx && active && !noBorder"
15
+ >
16
+ <view class="jfb-base-con-list__edit-icon" @click="delEdit">删除</view>
17
+ </view>
18
+ <!-- #endif -->
19
+ <view class="jfb-base-con-list__body" v-if="done">
20
+ <view
21
+ v-if="couponList.length > 0"
22
+ :style="{
23
+ backgroundImage: `url(${background})`,
24
+ backgroundSize: '100%',
25
+ backgroundRepeat: 'no-repeat',
26
+ height: `${layoutInfo.bodyMinHeightRpx}rpx`,
27
+ }"
28
+ >
29
+ <view class="jfb-base-con-list__body-content">
30
+ <view class="jfb-base-con-list__body-content-header">
31
+ <view class="jfb-base-con-list__body-content-header-left">
32
+ <view :style="{ backgroundColor: mainColor }"></view>
33
+ <view>赠送优惠券</view>
34
+ </view>
35
+ <view
36
+ :style="{ color: mainColor, backgroundColor: contentBackground }"
37
+ class="jfb-base-con-list__body-content-header-right"
38
+ @click="showRule = true"
39
+ >
40
+ <text>领券规则</text>
41
+ <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon>
42
+ </view>
43
+ </view>
44
+ <view class="jfb-base-con-list__body-content-list">
45
+ <view v-for="(item, index) in couponList" :key="index">
46
+ <view
47
+ class="jfb-base-con-list__body-content-list-item"
48
+ :style="{
49
+ backgroundColor: contentBackground,
50
+ }"
51
+ v-if="item.can_take === 'N'"
52
+ >
53
+ <view class="jfb-base-con-list__body-content-list-item-left">
54
+ <view
55
+ :style="item.couponBackground"
56
+ class="jfb-base-con-list__body-content-list-item-left-info"
57
+ >
58
+ <view
59
+ :style="{
60
+ color: mainColor,
61
+ textAlign: 'center',
62
+ }"
63
+ >{{ item.prize_type }}</view
64
+ >
65
+ <view
66
+ :style="{
67
+ color: '#fff',
68
+ }"
69
+ >{{ item.prize_name }}</view
70
+ >
71
+ </view>
72
+ </view>
73
+ <view class="jfb-base-con-list__body-content-list-item-right">
74
+ <view
75
+ class="jfb-base-con-list__body-content-list-item-right-name"
76
+ >
77
+ <view>{{ item.prize_name }}</view>
78
+ <xd-font-icon
79
+ size="100"
80
+ :style="{
81
+ color: '#D6D6D6',
82
+ position: 'absolute',
83
+ right: '-30rpx',
84
+ top: '-60rpx',
85
+ }"
86
+ icon="iconyilingqu"
87
+ ></xd-font-icon>
88
+ </view>
89
+ <view
90
+ class="jfb-base-con-list__body-content-list-item-right-num"
91
+ >
92
+ <!-- <view
93
+ :style="{
94
+ color: mainColor,
95
+ display: 'flex',
96
+ alignItems: 'center',
97
+ fontSize: '28rpx',
98
+ }"
99
+ >
100
+ <xd-font-icon
101
+ style="margin-right: 10rpx"
102
+ size="22"
103
+ icon="icondanchuangguanbi_xian"
104
+ ></xd-font-icon>
105
+ {{ item.prize_num }}
106
+ </view> -->
107
+ <view></view>
108
+
109
+ <xd-button
110
+ v-if="item.can_take === 'Y'"
111
+ size="small"
112
+ :disabled="item.remain_card_count == 0"
113
+ @click="getCoupont(item)"
114
+ type="primary"
115
+ :style="item.btn"
116
+ :color="item.remain_card_count == 0 ? '#AAA' : '#fff'"
117
+ >领取</xd-button
118
+ >
119
+ </view>
120
+ </view>
121
+ </view>
122
+ <view
123
+ class="jfb-base-con-list__body-content-list-item"
124
+ :style="{
125
+ backgroundColor:
126
+ item.remain_card_count == 0 ? '#f3f3f3' : contentBackground,
127
+ }"
128
+ v-else
129
+ >
130
+ <view class="jfb-base-con-list__body-content-list-item-left">
131
+ <view
132
+ :style="item.couponBackground"
133
+ class="jfb-base-con-list__body-content-list-item-left-info"
134
+ >
135
+ <view
136
+ :style="{
137
+ color:
138
+ item.remain_card_count == 0 ? '#D6D6D6' : mainColor,
139
+ textAlign: 'center',
140
+ }"
141
+ >{{ item.prize_type }}</view
142
+ >
143
+ <view
144
+ :style="{
145
+ color: item.remain_card_count == 0 ? '#D6D6D6' : '#fff',
146
+ }"
147
+ >{{ item.prize_name }}</view
148
+ >
149
+ </view>
150
+ </view>
151
+ <view class="jfb-base-con-list__body-content-list-item-right">
152
+ <view
153
+ class="jfb-base-con-list__body-content-list-item-right-name"
154
+ >
155
+ <view>{{ item.prize_name }}</view>
156
+ <xd-font-icon
157
+ size="100"
158
+ :style="{
159
+ color:
160
+ item.remain_card_count == 0 ? '#D6D6D6' : iconColor,
161
+ position: 'absolute',
162
+ right: '-30rpx',
163
+ top: '-30rpx',
164
+ }"
165
+ :icon="
166
+ item.remain_card_count == 0
167
+ ? 'iconyifawan'
168
+ : 'icondailingqu'
169
+ "
170
+ >
171
+ </xd-font-icon>
172
+ </view>
173
+ <view
174
+ class="jfb-base-con-list__body-content-list-item-right-num"
175
+ >
176
+ <!-- <view
177
+ :style="{
178
+ color: mainColor,
179
+ display: 'flex',
180
+ alignItems: 'center',
181
+ fontSize: '28rpx',
182
+ }"
183
+ >
184
+ <xd-font-icon
185
+ style="margin-right: 10rpx"
186
+ size="22"
187
+ icon="icondanchuangguanbi_xian"
188
+ ></xd-font-icon>
189
+ {{ item.prize_num }}
190
+ </view> -->
191
+ <view></view>
192
+
193
+ <xd-button
194
+ v-if="item.can_take === 'Y'"
195
+ size="small"
196
+ :disabled="item.remain_card_count == 0"
197
+ @click="getCoupont(item)"
198
+ type="primary"
199
+ :style="
200
+ item.remain_card_count == 0
201
+ ? { background: '#DDDDDD', margin: 0 }
202
+ : item.btn
203
+ "
204
+ :color="item.remain_card_count == 0 ? '#AAA' : '#fff'"
205
+ >领取</xd-button
206
+ >
207
+ </view>
208
+ </view>
209
+ </view>
210
+ </view>
211
+ </view>
212
+ <view class="jfb-base-con-list__body-content-foot"
213
+ >可在个人中心-我的票券进行查看</view
214
+ >
215
+ </view>
216
+ </view>
217
+ <view
218
+ v-else
219
+ class="empty_data"
220
+ :style="{ minHeight: layoutInfo.bodyMinHeightPx + 'px' }"
221
+ >
222
+ <image :src="emptyBg"></image>
223
+ {{ message }}
224
+ </view>
225
+ <xd-dailog
226
+ :cancel="false"
227
+ :confirm="false"
228
+ title="活动规则说明"
229
+ :show.sync="showRule"
230
+ >
231
+ <xd-content-xss :html="notice"></xd-content-xss>
232
+ </xd-dailog>
233
+ </view>
234
+ </view>
235
+ </template>
236
+
237
+ <script>
238
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
239
+ import XdButton from "@/components/XdButton/XdButton";
240
+ import { jfbRootExec } from "@/utils/xd.event";
241
+ import JfbBaseConListMixin from "./JfbBaseConListMixin";
242
+ import componentsMixins from "@/mixins/componentsMixins";
243
+ import extsMixins from "@/mixins/extsMixins";
244
+ import { getContainerPropsValue } from "@/utils/xd.base";
245
+ import XdDailog from "@/components/XdDailog/XdDailog";
246
+ import XdContentXss from "@/components/XdContentXss/XdContentXss";
247
+ import getServiceUrl from "@/common/getServiceUrl";
248
+ import colorCardMixins from "@/mixins/colorCardMixins";
249
+ import { mapState } from "vuex";
250
+ const Color = require("color");
251
+
252
+ export default {
253
+ name: "JfbBaseConList",
254
+ components: {
255
+ XdFontIcon,
256
+ XdButton,
257
+ XdDailog,
258
+ XdContentXss,
259
+ },
260
+ mixins: [componentsMixins, extsMixins, JfbBaseConListMixin, colorCardMixins],
261
+ data() {
262
+ return {
263
+ contentBackground: "",
264
+ iconColor: "",
265
+ couponList: [],
266
+ notice: "",
267
+ showRule: false,
268
+ btn: "",
269
+ activity_id: "",
270
+ background: "",
271
+ app_coupon_url: "",
272
+ method: "entry",
273
+ maxTime: 5, //最长轮询2的N次方(秒)
274
+ date: 2, //时间底数
275
+ time: 1, //时间幂指数
276
+ timeer: null,
277
+ order_num: null,
278
+ done: false,
279
+ message: "",
280
+ };
281
+ },
282
+ computed: {
283
+ ...mapState(["pageBusinessCode"]),
284
+ emptyBg() {
285
+ return this.getNoData();
286
+ },
287
+ },
288
+ watch: {
289
+ container(value) {
290
+ this.init(value);
291
+ },
292
+ },
293
+ created() {
294
+ this.init(this.container);
295
+ },
296
+ destroyed() {
297
+ if (this.timeer) {
298
+ clearTimeout(this.timeer);
299
+ }
300
+ },
301
+ methods: {
302
+ init(value) {
303
+ this.contentBackground = Color(this.mainColor).alpha(0.2).toString();
304
+ this.iconColor = Color(this.mainColor).alpha(0.3).toString();
305
+ },
306
+ getList() {
307
+ jfbRootExec("getCouponList", {
308
+ vm: this,
309
+ data: {
310
+ distribution_method: this.method,
311
+ namespace: this.pageBusinessCode,
312
+ activity_id: this.activity_id,
313
+ },
314
+ })
315
+ .then((res) => {
316
+ this.background = getServiceUrl(res.background);
317
+ this.couponList =
318
+ res.list &&
319
+ res.list.length > 0 &&
320
+ res.list.map((item) => {
321
+ if (item.can_take === "Y") {
322
+ item.btn = res.app_coupon_button_bg_url
323
+ ? {
324
+ backgroundImage: `url(${getServiceUrl(
325
+ res.app_coupon_button_bg_url
326
+ )})`,
327
+ backgroundSize: "100%",
328
+ backgroundRepeat: "no-repeat",
329
+ margin: "0",
330
+ }
331
+ : {
332
+ backgroundColor: this.mainColor,
333
+ margin: "0",
334
+ };
335
+ item.couponBackground = {
336
+ backgroundImage:
337
+ item.remain_card_count > 0
338
+ ? `url(${getServiceUrl(res.app_coupon_url)})`
339
+ : `url(${getServiceUrl(res.app_coupon_invalid_url)})`,
340
+ backgroundSize: "100%",
341
+ backgroundRepeat: "no-repeat",
342
+ };
343
+ } else {
344
+ item.btn = { background: "#D6D6D6", margin: "0" };
345
+ item.couponBackground = {
346
+ backgroundImage: `url(${getServiceUrl(res.app_coupon_url)})`,
347
+ backgroundSize: "100%",
348
+ backgroundRepeat: "no-repeat",
349
+ };
350
+ }
351
+ return item;
352
+ });
353
+ console.log("couponList", this.couponList);
354
+ this.message = res.message;
355
+ this.done = true;
356
+ })
357
+ .catch((err) => {
358
+ console.log(err, "err");
359
+ });
360
+ },
361
+ getCoupont(item) {
362
+ this.$xdShowLoading({});
363
+ jfbRootExec("getAllCoupon", {
364
+ vm: this,
365
+ data: {
366
+ distribution_method: this.method,
367
+ namespace: this.pageBusinessCode,
368
+ activity_id: this.activity_id,
369
+ prize_id: item.prize_id,
370
+ },
371
+ })
372
+ .then((res) => {
373
+ if (res.code == 400) {
374
+ this.$xdHideLoading();
375
+ this.$xdAlert({
376
+ content: res.message,
377
+ zIndex: 3200,
378
+ time: 2000,
379
+ isClose: false,
380
+ });
381
+ this.getList();
382
+ return;
383
+ }
384
+ this.order_num = res.tmp_order_number;
385
+ this.getResult();
386
+ })
387
+ .catch((err) => {
388
+ console.log(err, "err");
389
+ });
390
+ },
391
+ getResult() {
392
+ jfbRootExec("getCouponResult", {
393
+ vm: this,
394
+ data: {
395
+ tmp_order_number: this.order_num,
396
+ },
397
+ })
398
+ .then((res) => {
399
+ if (res.status_type === "success") {
400
+ this.$xdHideLoading();
401
+ this.$xdAlert({
402
+ content: "领取成功",
403
+ zIndex: 3200,
404
+ time: 2000,
405
+ isClose: false,
406
+ });
407
+ this.getList();
408
+ if (this.timeer) {
409
+ this.time = 1;
410
+ clearTimeout(this.timeer);
411
+ }
412
+ return;
413
+ }
414
+ if (res.status_type === "error") {
415
+ this.$xdHideLoading();
416
+ this.$xdAlert({
417
+ content: res.message,
418
+ zIndex: 3200,
419
+ time: 2000,
420
+ isClose: false,
421
+ });
422
+ if (res.code == 400) {
423
+ this.getList();
424
+ }
425
+ if (this.timeer) {
426
+ this.time = 1;
427
+ clearTimeout(this.timeer);
428
+ }
429
+ return;
430
+ }
431
+ this.time++;
432
+ this.timeer = setTimeout(() => {
433
+ this.getResult();
434
+ if (this.time > 5)
435
+ this.$xdLog.setARMSInfo(
436
+ { message: "领取中" },
437
+ `pay_${res.status_type}`
438
+ );
439
+ }, Math.pow(this.date, this.time > this.maxTime ? this.maxTime : this.time) * 1000);
440
+ })
441
+ .catch((err) => {
442
+ this.$xdHideLoading();
443
+ console.log(err, "err");
444
+ });
445
+ },
446
+ getContent() {
447
+ jfbRootExec("getListBaseNewsContentCoupon", {
448
+ vm: this,
449
+ data: {
450
+ page_id: this.pageAttr["page_id"], //页面ID
451
+ container_id: this.containerId, //组件ID
452
+ limit: 1,
453
+ },
454
+ })
455
+ .then((res) => {
456
+ console.log(res, "ajajajajaj");
457
+ if (res.list.length > 0) {
458
+ this.notice = res.list[0].content;
459
+ }
460
+ })
461
+ .catch((error) => {
462
+ console.error(error);
463
+ });
464
+ },
465
+ onJfbLoad(options) {
466
+ console.log(this.pageBusinessCode, "pageNamespace");
467
+ this.activity_id = options.activity_id;
468
+ this.method = options.distribution_method
469
+ ? options.distribution_method
470
+ : "entry";
471
+ this.getContent();
472
+ this.getList();
473
+ },
474
+
475
+ onJfbShow() {
476
+ if (this.timeer) {
477
+ clearTimeout(this.timeer);
478
+ }
479
+ this.time = 0;
480
+ if (this.order_num) this.getResult();
481
+ },
482
+
483
+ onJfbUnload() {
484
+ if (this.timeer) {
485
+ clearTimeout(this.timeer);
486
+ }
487
+ },
488
+
489
+ onJfbBack(options) {
490
+ if (this.timeer) {
491
+ clearTimeout(this.timeer);
492
+ }
493
+ if (this.$configProject.isPreview) return;
494
+ this.$xdUniHelper.navigateBack();
495
+ },
496
+ },
497
+ };
498
+ </script>
499
+
500
+ <style scoped lang="less">
501
+ @import "./JfbBaseConListLess.less";
502
+
503
+ .jfb-base-con-list {
504
+ &__body {
505
+ position: relative;
506
+ overflow-y: auto;
507
+ .empty_data {
508
+ text-align: center;
509
+ color: #999999;
510
+ font-size: 28rpx;
511
+ display: flex;
512
+ flex-direction: column;
513
+ align-items: center;
514
+ justify-content: center;
515
+ & > image {
516
+ width: unit(400, rpx);
517
+ height: unit(400, rpx);
518
+ }
519
+ }
520
+ &-content {
521
+ border-radius: unit(20, rpx);
522
+ background: #fff;
523
+ padding: unit(34, rpx);
524
+ position: relative;
525
+ top: unit(164, rpx);
526
+ margin-right: auto;
527
+ margin-left: auto;
528
+ width: unit(650, rpx);
529
+
530
+ &-header {
531
+ display: flex;
532
+ justify-content: space-between;
533
+ align-items: center;
534
+
535
+ &-left {
536
+ display: flex;
537
+ align-items: center;
538
+ font-size: unit(32, rpx);
539
+ & > view:first-child {
540
+ width: unit(8, rpx);
541
+ height: unit(36, rpx);
542
+ border-radius: unit(4, rpx);
543
+ margin-right: unit(20, rpx);
544
+ }
545
+ }
546
+
547
+ &-right {
548
+ display: flex;
549
+ font-size: unit(24, rpx);
550
+ padding: unit(8, rpx) unit(16, rpx);
551
+ border-radius: unit(24, rpx);
552
+ }
553
+ }
554
+
555
+ &-list {
556
+ margin-top: unit(20, rpx);
557
+
558
+ &-item {
559
+ display: flex;
560
+ justify-content: space-between;
561
+ align-items: center;
562
+ padding: unit(20, rpx) unit(30, rpx);
563
+ border-radius: unit(12, rpx);
564
+ margin: unit(20, rpx) auto 0 auto;
565
+ &-left {
566
+ display: flex;
567
+ &-info {
568
+ padding: unit(20, rpx) unit(36, rpx);
569
+ & > view:first-child {
570
+ font-size: unit(44, rpx);
571
+ font-weight: 500;
572
+ margin-bottom: unit(36, rpx);
573
+ }
574
+ & > view:nth-child(2) {
575
+ font-size: unit(28, rpx);
576
+ color: #fff;
577
+ }
578
+ }
579
+ }
580
+ &-right {
581
+ margin-left: unit(24, rpx);
582
+ flex: 1;
583
+ &-name {
584
+ position: relative;
585
+ font-size: unit(40, rpx);
586
+ color: #000;
587
+ display: flex;
588
+ align-items: center;
589
+ justify-content: space-between;
590
+ }
591
+ &-num {
592
+ margin-top: unit(40, rpx);
593
+ display: flex;
594
+ justify-content: space-between;
595
+ }
596
+ }
597
+ }
598
+ }
599
+ &-foot {
600
+ color: #a6a6a6;
601
+ font-size: unit(24, rpx);
602
+ text-align: center;
603
+ margin-top: unit(40, rpx);
604
+ }
605
+ }
606
+ }
607
+ }
608
+ </style>
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @desc 获取绝对路径完整地址
3
+ * @param @path
4
+ **/
5
+ //例如:https://image.jufubao.cn/20220501010108/image/bg/default_gonghui_bg.png
6
+ @basePath: 'business/';
7
+ @doMain: '//sandbox-img.jufubao.cn/';
8
+
9
+ .getBusinessImageUrl(@path, @size: 'size8') {
10
+ @url: "@{doMain}@{basePath}@{path}?x-oss-process=style/@{size}";
11
+ background-image: url(@url);
12
+ }
13
+
14
+ //start
15
+ .jfb-base-con-list {
16
+ border: 1px dashed rgba(0, 0, 0, 0);
17
+ box-sizing: border-box;
18
+ min-height: unit(50, rpx);
19
+
20
+ &__body{
21
+ position: relative;
22
+ overflow: hidden;
23
+ z-index: 2
24
+ }
25
+
26
+ &.editx {
27
+ position: relative;
28
+ border: 1px dashed blue;
29
+ box-sizing: border-box;
30
+ z-index: 3
31
+
32
+ }
33
+
34
+ &:hover {
35
+ border: 1px dashed blue;
36
+ }
37
+
38
+ &.noBorder {
39
+ border-color: rgba(0,0,0,0);
40
+ border-width: 0;
41
+ }
42
+
43
+
44
+ &__edit {
45
+ cursor: pointer;
46
+ position: absolute;
47
+ right: unit(0, rpx);
48
+ top: unit(-52, rpx);
49
+ height: unit(50, rpx);
50
+ line-height: unit(50, rpx);
51
+ display: flex;
52
+ justify-content: center;
53
+ align-items: center;
54
+ background: rgba(0, 0, 0, .6);
55
+ border-radius: unit(10, rpx);
56
+ box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
57
+ color: #fff;
58
+ font-size: unit(22, rpx);
59
+
60
+ &-icon{
61
+ padding: 0 unit(20, rpx);
62
+ }
63
+
64
+ &.editx {
65
+ box-sizing: border-box;
66
+
67
+ }
68
+ }
69
+ }
70
+ //end
71
+
72
+
73
+ /**notPreview**/
74
+ .jfb-base-con-list {
75
+ &:before {
76
+ content: " ";
77
+ display: table;
78
+ }
79
+ }
80
+ /**endNotPreview**/
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+
4
+ //@AttrImport
5
+ import Attr from "./Attr";
6
+ //@EndAttrImport
7
+
8
+
9
+ export default {
10
+ data() {
11
+ return {
12
+ //#ifdef H5
13
+
14
+ //@AttrData
15
+ Attr:{}, //对外开发编辑属性
16
+ //@EndAttrData
17
+
18
+ // #endif
19
+ cssRoot: 'jfb-base-con-list'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }