jufubao-base 1.0.118 → 1.0.119-beta10

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,495 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-con-phone"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx: isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-base-con-phone__edit"
10
+ :class="{ editx: isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-base-con-phone__edit-icon" @click="delEdit">删除</view>
14
+ </view>
15
+ <!-- #endif -->
16
+ <view class="jfb-base-con-phone__body" v-if="done">
17
+ <view
18
+ v-if="has_times==='Y'"
19
+ class="jfb-base-con-phone__body-wrap"
20
+ :style="{
21
+ height: layoutInfo.bodyMinHeightRpx + 'rpx',
22
+ backgroundImage: `url(${background})`,
23
+ backgroundSize: '100% 100%',
24
+ }"
25
+ >
26
+ <view v-if="showCode" class="jfb-base-con-phone__body-wrap-input">
27
+ <view>
28
+ <input
29
+ @input="filterSpaces"
30
+ v-model="phoneNumber"
31
+ placeholder="请输入手机号"
32
+ type="text"
33
+ />
34
+ </view>
35
+ <view
36
+ class="jfb-base-con-phone__body-wrap-input-code"
37
+ style="margin-bottom: 54rpx"
38
+ >
39
+ <input
40
+ v-model="valid_code"
41
+ placeholder="请输入验证码"
42
+ type="text"
43
+ />
44
+ <XdButton
45
+ :disabled="disabled"
46
+ class="jfb-base-con-phone__body-wrap-input-code-btn"
47
+ type="primary"
48
+ :bg-color="mainColor"
49
+ size="small"
50
+ @click="handleSendCode"
51
+ >{{ message }}</XdButton
52
+ >
53
+ </view>
54
+ <XdButton
55
+ type="primary"
56
+ :bg-color="mainColor"
57
+ width="360rpx"
58
+ radius="20rpx"
59
+ size="small"
60
+ :disabled="!phoneNumber || !valid_code"
61
+ @click="handleConfirm"
62
+ >确认领取</XdButton
63
+ >
64
+ </view>
65
+ <view v-else class="jfb-base-con-phone__body-wrap-input">
66
+ <view class="jfb-base-con-phone__body-wrap-input-phone">
67
+ <view class="jfb-base-con-phone__body-wrap-input-phone-change">
68
+ <view>当前登录手机号</view>
69
+ <XdButton
70
+ style="margin: 0"
71
+ type="primary"
72
+ :bg-color="mainColor"
73
+ size="small"
74
+ @click="showCode = true"
75
+ >切换手机号</XdButton
76
+ >
77
+ </view>
78
+ <view>{{ showOhoneNumber }}</view>
79
+ </view>
80
+ <XdButton
81
+ type="primary"
82
+ :bg-color="mainColor"
83
+ width="360rpx"
84
+ radius="20rpx"
85
+ size="small"
86
+ @click="handleConfirm"
87
+ >直接领取</XdButton
88
+ >
89
+ </view>
90
+ <view v-if="showBtn === 'Y'" class="jfb-base-con-phone__body-wrap-btn">
91
+ <XdButton
92
+ size="small"
93
+ type="primary"
94
+ :bg-color="mainColor"
95
+ radius="20rpx"
96
+ @click="handleTo(btnOneUrl)"
97
+ >{{ btnOneName }}</XdButton
98
+ >
99
+ <XdButton
100
+ size="small"
101
+ type="primary"
102
+ :bg-color="mainColor"
103
+ radius="20rpx"
104
+ @click="handleTo(btnTwoUrl)"
105
+ >{{ btnTwoName }}</XdButton
106
+ >
107
+ </view>
108
+ </view>
109
+ <view
110
+ :style="{
111
+ height: layoutInfo.bodyMinHeightRpx + 'rpx',
112
+ }"
113
+ v-else
114
+ class="empty_data"
115
+ >
116
+ <image :src="emptyBg"></image>
117
+ {{ errmessage }}
118
+ </view>
119
+ </view>
120
+ </view>
121
+ </template>
122
+
123
+ <script>
124
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
125
+ import XdButton from "@/components/XdButton/XdButton";
126
+ import { jfbRootExec } from "@/utils/xd.event";
127
+ import JfbBaseConPhoneMixin from "./JfbBaseConPhoneMixin";
128
+ import { getContainerPropsValue } from "@/utils/xd.base";
129
+ import componentsMixins from "@/mixins/componentsMixins";
130
+ import extsMixins from "@/mixins/extsMixins";
131
+ import { mapState } from "vuex";
132
+ import colorCardMixins from "@/mixins/colorCardMixins";
133
+ import getServiceUrl from "@/common/getServiceUrl";
134
+
135
+ export default {
136
+ name: "JfbBaseConPhone",
137
+ components: {
138
+ XdFontIcon,
139
+ XdButton,
140
+ },
141
+ computed: {
142
+ ...mapState(["pageBusinessCode"]),
143
+ emptyBg() {
144
+ return this.getNoData();
145
+ },
146
+ },
147
+ mixins: [componentsMixins, extsMixins, JfbBaseConPhoneMixin, colorCardMixins],
148
+ data() {
149
+ return {
150
+ showCode: true,
151
+ phoneNumber: "", //手机号
152
+ valid_code: "", //验证码
153
+ btnOneName: "",
154
+ btnOneUrl: "",
155
+ btnTwoName: "",
156
+ btnTwoUrl: "",
157
+ message: "发送验证码",
158
+ countdownTimer: null,
159
+ timeRemaining: 60,
160
+ disabled: false,
161
+ background:"",
162
+ method: "entry",
163
+ options: {},
164
+ activity_id: "",
165
+ done: false,
166
+ has_times: 'N',
167
+ errmessage: "",
168
+ showOhoneNumber: "", //仅用于展示
169
+ order_num: null,
170
+ maxTime: 5, //最长轮询2的N次方(秒)
171
+ date: 2, //时间底数
172
+ time: 0, //时间幂指数
173
+ timeer: null,
174
+ };
175
+ },
176
+ watch: {
177
+ container(value) {
178
+ this.init(value);
179
+ },
180
+ },
181
+ created() {
182
+ console.log(this.layoutInfo, "layoutInfo");
183
+ this.init(this.container);
184
+ },
185
+ destroyed() {
186
+ if (this.timeer) {
187
+ clearTimeout(this.timeer);
188
+ }
189
+ },
190
+ methods: {
191
+ async onJfbLoad(options) {
192
+ await jfbRootExec("getUserPhone", {
193
+ vm: this,
194
+ data: {},
195
+ }).then((res) => {
196
+ this.showOhoneNumber = res.phone_number;
197
+ if (this.showOhoneNumber) {
198
+ this.showCode = false;
199
+ }
200
+ });
201
+ this.options = options;
202
+ this.activity_id = options.activity_id;
203
+ this.method = options.distribution_method
204
+ ? options.distribution_method
205
+ : "phone";
206
+ await this.getList();
207
+ },
208
+ filterSpaces(event) {
209
+ // 使用replace方法去除用户输入的空格
210
+ let value = event.target.value.replace(/\s+/g, '');
211
+ // 更新数据以移除空格
212
+ this.phoneNumber = value;
213
+ // 将处理后的值反映到视图
214
+ event.target.value = value;
215
+ },
216
+ getList() {
217
+ jfbRootExec("getCouponPhoneList", {
218
+ vm: this,
219
+ data: {
220
+ ...this.options,
221
+ distribution_method: this.method,
222
+ namespace: this.pageBusinessCode,
223
+ activity_id: this.activity_id,
224
+ },
225
+ })
226
+ .then((res) => {
227
+ console.log(res, "res");
228
+ this.has_times = res.has_times;
229
+ this.showBtn = res.phone_button;
230
+ this.btnOneName = res.button_name_one;
231
+ this.btnTwoName = res.button_name_two;
232
+ this.btnOneUrl = res.button_url_one;
233
+ this.btnTwoUrl = res.button_url_two;
234
+ this.background = getServiceUrl(res.background);
235
+ this.errmessage = res.message;
236
+ this.done = true;
237
+ })
238
+ .catch((err) => {
239
+ console.log(err, "err");
240
+ });
241
+ },
242
+ /**
243
+ * @description 监听事件变化
244
+ * @param container {object} 业务组件对象自己
245
+ */
246
+ init(container) {},
247
+ handleTo(url) {
248
+ this.$xdUniHelper.navigateTo({
249
+ url: url,
250
+ });
251
+ },
252
+ handleSendCode() {
253
+ if (this.phoneNumber.length < 11) {
254
+ uni.showToast({
255
+ title: "请输入11位手机号",
256
+ icon: "none",
257
+ });
258
+ return;
259
+ }
260
+ // 发送验证码的异步操作
261
+ uni.showToast({
262
+ title: "发送中",
263
+ icon: "loading",
264
+ });
265
+ jfbRootExec("sendMsgConPhone", {
266
+ vm: this,
267
+ data: {
268
+ phone_number: this.phoneNumber,
269
+ biz_name: "login",
270
+ },
271
+ }).then((res) => {
272
+ this.startCountdown();
273
+ });
274
+ },
275
+ startCountdown() {
276
+ // 设置剩余时间
277
+ this.timeRemaining = 60;
278
+ // 设置定时器,每秒执行一次
279
+ this.countdownTimer = setInterval(() => {
280
+ // 每秒减少1
281
+ this.timeRemaining--;
282
+ // 更新显示
283
+ this.message = `${this.timeRemaining}s`;
284
+ // 禁用按钮
285
+ this.disabled = true;
286
+ // 如果时间小于等于0,则重新开始
287
+ if (this.timeRemaining <= 0) {
288
+ this.message = "重新发送";
289
+ this.disabled = false;
290
+ // 清除定时器
291
+ clearInterval(this.countdownTimer);
292
+ // 重新设置时间
293
+ this.timeRemaining = 60;
294
+ }
295
+ }, 1000);
296
+ },
297
+ handleConfirm() {
298
+ this.$xdShowLoading({});
299
+ jfbRootExec("getAllCouponPhone", {
300
+ vm: this,
301
+ data: {
302
+ ...this.options,
303
+ distribution_method: this.method,
304
+ namespace: this.pageBusinessCode,
305
+ activity_id: this.activity_id,
306
+ phone: this.showCode ? this.phoneNumber : null,
307
+ valid_code: this.showCode ? this.valid_code : null,
308
+ biz_name: "login",
309
+ },
310
+ })
311
+ .then((res) => {
312
+ if (res.code == 400) {
313
+ this.$xdHideLoading();
314
+ this.$xdAlert({
315
+ content: res.message,
316
+ zIndex: 3200,
317
+ time: 2000,
318
+ isClose: false,
319
+ });
320
+ this.getList();
321
+ return;
322
+ }
323
+ this.order_num = res.tmp_order_number;
324
+ setTimeout(() => {
325
+ this.getResult();
326
+ }, 1000);
327
+ })
328
+ .catch((err) => {
329
+ console.log(err, "err");
330
+ });
331
+ },
332
+ getResult() {
333
+ jfbRootExec("getCouponPhoneResult", {
334
+ vm: this,
335
+ data: {
336
+ ...this.options,
337
+ tmp_order_number: this.order_num,
338
+ },
339
+ })
340
+ .then((res) => {
341
+ if (res.status_type === "success") {
342
+ this.order_num = null;
343
+ this.$xdHideLoading();
344
+ this.$xdAlert({
345
+ content: "领取成功",
346
+ zIndex: 3200,
347
+ time: 2000,
348
+ isClose: false,
349
+ });
350
+ this.getList();
351
+ if (this.timeer) {
352
+ this.time = 0;
353
+ clearTimeout(this.timeer);
354
+ }
355
+ return;
356
+ }
357
+ if (res.status_type === "error") {
358
+ this.$xdHideLoading();
359
+ this.$xdAlert({
360
+ content: res.message,
361
+ zIndex: 3200,
362
+ time: 2000,
363
+ isClose: false,
364
+ });
365
+ if (res.code == 400) {
366
+ this.getList();
367
+ }
368
+ if (this.timeer) {
369
+ this.time = 0;
370
+ clearTimeout(this.timeer);
371
+ }
372
+ return;
373
+ }
374
+
375
+ this.timeer = setTimeout(() => {
376
+ this.getResult();
377
+ if (this.time > 5) {
378
+ this.$xdLog.setARMSInfo(
379
+ { message: "领取中" },
380
+ `pay_${res.status_type}`
381
+ );
382
+ }
383
+ this.time++;
384
+ }, Math.pow(this.date, this.time > this.maxTime ? this.maxTime : this.time) * 1000);
385
+ })
386
+ .catch((err) => {
387
+ this.$xdHideLoading();
388
+ console.log(err, "err");
389
+ });
390
+ },
391
+ onJfbShow() {
392
+ if (this.timeer) {
393
+ clearTimeout(this.timeer);
394
+ }
395
+ this.time = 0;
396
+ if (this.order_num) this.getResult();
397
+ },
398
+
399
+ onJfbUnload() {
400
+ if (this.timeer) {
401
+ clearTimeout(this.timeer);
402
+ }
403
+ },
404
+
405
+ onJfbBack(options) {
406
+ if (this.timeer) {
407
+ clearTimeout(this.timeer);
408
+ }
409
+ if (this.$configProject.isPreview) return;
410
+ this.$xdUniHelper.navigateBack();
411
+ },
412
+ },
413
+ };
414
+ </script>
415
+
416
+ <style scoped lang="less">
417
+ @import "./JfbBaseConPhoneLess.less";
418
+
419
+ .jfb-base-con-phone {
420
+ &__body {
421
+ .empty_data {
422
+ text-align: center;
423
+ color: #999999;
424
+ font-size: 28rpx;
425
+ display: flex;
426
+ flex-direction: column;
427
+ align-items: center;
428
+ justify-content: center;
429
+ & > image {
430
+ width: unit(400, rpx);
431
+ height: unit(400, rpx);
432
+ }
433
+ }
434
+ &-wrap {
435
+ display: flex;
436
+ justify-content: center;
437
+ align-items: center;
438
+ flex-direction: column;
439
+ &-input {
440
+ border-radius: 40rpx;
441
+ background: rgba(255, 255, 255, 0.5);
442
+ padding: 70rpx 60rpx;
443
+ input {
444
+ margin-bottom: 26rpx;
445
+ font-size: 28rpx;
446
+ background: #fff;
447
+ border-radius: 16rpx;
448
+ padding: 30rpx;
449
+ width: 540rpx;
450
+ }
451
+ &-code {
452
+ position: relative;
453
+ &-btn {
454
+ position: absolute;
455
+ right: 10rpx;
456
+ top: 20rpx;
457
+ }
458
+ }
459
+ &-phone {
460
+ padding: 30rpx;
461
+ width: 540rpx;
462
+ background: #fff;
463
+ border-radius: 16rpx;
464
+ margin-bottom: 32rpx;
465
+ & > view:nth-child(2) {
466
+ border-radius: 40rpx;
467
+ background: #f2f2f2;
468
+ display: flex;
469
+ justify-content: center;
470
+ align-items: center;
471
+ padding: 16rpx 120rpx 16rpx 120rpx;
472
+ margin-top: 30rpx;
473
+ }
474
+ &-change {
475
+ display: flex;
476
+ justify-content: space-between;
477
+ align-items: center;
478
+ & > view:first-child {
479
+ color: #999999;
480
+ font-size: 28rpx;
481
+ }
482
+ }
483
+ }
484
+ }
485
+ &-btn {
486
+ display: flex;
487
+ justify-content: space-around;
488
+ align-items: center;
489
+ width: 100%;
490
+ margin-top: 64rpx;
491
+ }
492
+ }
493
+ }
494
+ }
495
+ </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-phone {
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-phone {
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-phone'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ getCouponPhoneList: {
5
+ "list":[
6
+ {"prize_id":153,"prize_name":"满50减50","prize_type":"满减券","prize_num":1,"can_take":"Y","is_over":"N","can_take_num":"P","today_times":1,"today_num":0,"total_times":1,"total_num":0,"remain_card_count":55},
7
+ {"prize_id":153,"prize_name":"满50减50","prize_type":"满减券","prize_num":1,"can_take":"Y","is_over":"N","can_take_num":"P","today_times":1,"today_num":0,"total_times":1,"total_num":0,"remain_card_count":55},
8
+ {"prize_id":153,"prize_name":"满50减50","prize_type":"满减券","prize_num":1,"can_take":"Y","is_over":"N","can_take_num":"P","today_times":1,"today_num":0,"total_times":1,"total_num":0,"remain_card_count":55}
9
+ ],
10
+ "background":"//sandbox-img.jufubao.cn/uploads/20231204/96b801e0dc27422c183dc90d905dd2ed.jpg",
11
+ "used_up_url": "",
12
+ "has_times": "Y",
13
+ "can_take":"Y",
14
+ "message":"",
15
+ "app_coupon_url":"//sandbox-img.jufubao.cn/uploads/20231205/fee9b644b83495c9ba8a4db277600b54.jpg",
16
+ "app_activity_button":"//sandbox-img.jufubao.cn/uploads/20231207/35f3065b2b2bc3fc2dda73d7b5b9eae8.jpg",
17
+ "app_coupon_button_bg_url":"//sandbox-img.jufubao.cn/uploads/20231212/026a3ea901f87f51b531d06c24604676.png",
18
+ "app_coupon_button_see_url": "//sandbox-img.jufubao.cn/uploads/20231212/026a3ea901f87f51b531d06c24604676.png",
19
+ "app_coupon_invalid_url":"//sandbox-img.jufubao.cn/uploads/20231208/8b153ce4870686a37295c16fbc992235.jpg",
20
+ "rule":"<p>打发&middot;</p>",
21
+ "request_id":"a2603f2a480485f4"
22
+ },
23
+ getAllCouponPhone: {
24
+ "request_id": "5987aa28c709d4ef"
25
+ }
26
+ }
@@ -17,7 +17,7 @@
17
17
  minHeight: layoutInfo.bodyMinHeightRpx + 'rpx'
18
18
  }">
19
19
  <view class="setting_list">
20
- <xd-list-item label="已绑实体卡是否失效" :showRight="!showSwitch"
20
+ <xd-list-item label="已绑实体票券是否失效" :showRight="!showSwitch"
21
21
  paddingLR="50rpx" paddingTB="32rpx"
22
22
  style="margin-bottom: 8rpx;"
23
23
  @click="handleToShowSwitch"
@@ -32,7 +32,7 @@
32
32
  </xd-list-item>
33
33
  <view class="switch_tip">
34
34
  <xd-font-icon size="24" icon="iconmingchengtubiao" style="margin-right: 8rpx;"></xd-font-icon>
35
- <view>当卡被绑定后,实体卡的卡密与二维码都失效</view>
35
+ <view>当票券被绑定后,实体票券的密码与二维码都失效</view>
36
36
  </view>
37
37
  <xd-list-item :showRight="!phone_number" label="绑定手机号"
38
38
  paddingLR="50rpx" paddingTB="32rpx"
@@ -93,7 +93,6 @@
93
93
  <script>
94
94
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
95
95
  import { jfbRootExec } from "@/utils/xd.event";
96
- import JfbBasePhoneCollectMixin from "./JfbBasePhoneCollectMixin";
97
96
  import componentsMixins from "@/mixins/componentsMixins";
98
97
  import extsMixins from "@/mixins/extsMixins";
99
98
  import { getContainerPropsValue } from "@/utils/xd.base";
@@ -102,6 +101,7 @@ import XdForm from "@/components/XdForm/XdForm";
102
101
  import XdFormInput from "@/components/XdFormInput/XdFormInput";
103
102
  import XdButton from "@/components/XdButton/XdButton";
104
103
  import XdFormCheckbox from "@/components/XdFormCheckbox/XdFormCheckbox";
104
+ import JfbBasePhoneCollectMixin from "./JfbBasePhoneCollectMixin";
105
105
 
106
106
  export default {
107
107
  name: "JfbBasePhoneCollect",