jufubao-base 1.0.116-beta6 → 1.0.116-beta8

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