jufubao-base 1.0.208-beta1 → 1.0.209-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.
@@ -2,110 +2,467 @@
2
2
  <view
3
3
  class="jfb-base-recharge-new"
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-recharge-new__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-recharge-new__edit-icon" @click="delEdit">删除</view>
14
14
  </view>
15
15
  <!-- #endif -->
16
16
  <view class="jfb-base-recharge-new__body">
17
- <view>测试插件( {{containerId}} )</view>
17
+ <view class="recharge" :class="{active:tabsIndex === 'old'}" >
18
+ <view class="recharge-tab" v-if="tabs.length > 1">
19
+ <view
20
+ v-for="item in tabs"
21
+ :key="item.value"
22
+ @click.stop="handleTabs(item.value)"
23
+ :style="{ color: tabsIndex === item.value?mainColor: '#333'}"
24
+ >
25
+ <text>{{item.label}}</text>
26
+ <text class="recharge-tab-index" v-if="tabsIndex === item.value" :style="{background: tabsIndex === item.value?mainColor: '#fff'}"></text>
27
+ </view>
28
+ </view>
29
+ <view class="recharge-list">
30
+ <view class="recharge-item" v-if="tabsIndex === 'new'">
31
+ <view
32
+ class="recharge-pack"
33
+ v-for="item in newCardList"
34
+ :key="item.package_id"
35
+ :style="{backgroundImage: 'url('+ item['package_image'] +')'}"
36
+ >
37
+ <view class="name">{{item.package_name}}</view>
38
+ <view class="price">面值:{{item.card_point}}</view>
39
+ <view class="time">有效期:{{item['valid_date']}}</view>
40
+ <view class="line"></view>
41
+ <view class="buy">
42
+ <view>
43
+ <xd-unit :is-old="false" :price="item.card_amount" color-new="#fff" :font-size="40" :icon-size=".3"></xd-unit>
44
+ </view>
45
+ <view @click="handleNewBuy(item)">{{buyBtnName}}</view>
46
+ </view>
47
+ </view>
48
+ </view>
49
+ <view class="recharge-item" v-if="tabsIndex === 'old'">
50
+ <view class="jfb-base-recharge-new__body-card">
51
+ <view>
52
+ <view class="jfb-base-recharge-new__body-form">
53
+ <input v-model="cardNumber" :placeholder="card_num_placeholder" />
54
+ </view>
55
+ <view class="jfb-base-recharge-new__body-form">
56
+ <input v-model="card_point" :placeholder="point_placeholder" />
57
+ </view>
58
+ <view
59
+ v-if="amount && card_point"
60
+ :style="{
61
+ color: mainColor,
62
+ fontSize: '24rpx',
63
+ paddingBottom: '32rpx',
64
+ }"
65
+ >支付金额:{{ amount }} 元</view>
66
+ <xd-button
67
+ size="medium"
68
+ type="primary"
69
+ :bgColor="mainColor"
70
+ @click="handleToRecharge"
71
+ :disabled="!amount || !card_point || !cardNumber"
72
+ >提交</xd-button>
73
+ </view>
74
+ </view>
75
+ </view>
76
+ </view>
77
+ <view class="xd-notice-content" v-if="content">
78
+ <view>注意事项:</view>
79
+ <view v-html="content" class="prod_info"></view>
80
+ </view>
81
+ <view
82
+ v-if="isPreview && statusContent === true && content === '' "
83
+ class="xd-notice"
84
+ :style="{ color: dangerColor,fontSize: 24 + 'rpx',backgroundColor:noticeBgc }"
85
+ >注意事项未配置数据,因此改模块在正式环境将不显示</view>
86
+ <view class="bottom_btn-mask"></view>
87
+ </view>
18
88
  </view>
19
89
  </view>
20
90
  </template>
21
91
 
22
92
  <script>
23
- import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
24
- import { jfbRootExec } from "@/utils/xd.event";
25
- import JfbBaseRechargeNewMixin from "./JfbBaseRechargeNewMixin";
26
- import { getContainerPropsValue } from "@/utils/xd.base";
27
- import componentsMixins from "@/mixins/componentsMixins";
28
- import extsMixins from "@/mixins/extsMixins";
29
- export default {
30
- name: "JfbBaseRechargeNew",
31
- components: {
32
- XdFontIcon
93
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
94
+ import XdButton from "@/components/XdButton/XdButton";
95
+ import XdUnit from "@/components/XdUnit/XdUnit.vue";
96
+ import { jfbRootExec } from "@/utils/xd.event";
97
+ import JfbBaseRechargeNewMixin from "./JfbBaseRechargeNewMixin";
98
+ import { getContainerPropsValue } from "@/utils/xd.base";
99
+ import componentsMixins from "@/mixins/componentsMixins";
100
+ import extsMixins from "@/mixins/extsMixins";
101
+ import Color from "color";
102
+ import getServiceUrl from "@/common/getServiceUrl";
103
+ export default {
104
+ name: "JfbBaseRechargeNew",
105
+ components: {
106
+ XdFontIcon,
107
+ XdButton,
108
+ XdUnit
109
+ },
110
+ mixins: [componentsMixins, extsMixins, JfbBaseRechargeNewMixin],
111
+ data() {
112
+ return {
113
+ closeMask: true,
114
+ card_num_placeholder: "",
115
+ point_placeholder: "",
116
+ cardNumber: "",
117
+ card_point: "",
118
+ payPath: "",
119
+ amount: "",
120
+ timer:null,
121
+
122
+ //提示文案
123
+ isPreview: false,
124
+ content: "",
125
+ statusContent: false,
126
+ noticeBgc:'',
127
+
128
+ tabs: [],
129
+ tabsIndex: '',
130
+ buyBtnName: '立即购买' ,
131
+ newCardList:[],
132
+ };
133
+ },
134
+ watch: {
135
+ container(value,oldValue) {
136
+ if(JSON.stringify(value) === JSON.stringify(oldValue)) return;
137
+ if (this.$configProject['isPreview']) this.init(value)
138
+ },
139
+ card_point(value) {
140
+ if(this.timer) clearTimeout(this.timer);
141
+ this.timer = setTimeout(()=>{
142
+ if (value && value != 0) {
143
+ this.handleGetPrice();
144
+ }
145
+ }, 1000)
146
+ },
147
+ },
148
+ created() {
149
+ this.isPreview = this.$configProject.isPreview;
150
+ this.noticeBgc = Color(this.dangerColor).alpha(0.1).toString();
151
+ this.init(this.container);
152
+ },
153
+ methods: {
154
+ onJfbLoad(options) {
155
+ this.getContent();
33
156
  },
34
- mixins: [
35
- componentsMixins, extsMixins, JfbBaseRechargeNewMixin
36
- ],
37
- data() {
38
- return {
157
+ /**
158
+ * @description 监听事件变化
159
+ * @param container {object} 业务组件对象自己
160
+ */
161
+ init(container) {
162
+ this.card_num_placeholder = getContainerPropsValue(this.container, "content.card_num_placeholder", "输入券号");
163
+ this.point_placeholder = getContainerPropsValue(this.container, "content.point_placeholder", "充值点数");
164
+ this.payPath = getContainerPropsValue(container, "content.payPath", {value: "",}).value;
165
+ this.buyBtnName = getContainerPropsValue(container, 'content.buyBtnName', '立即购买')
39
166
 
40
- //todo
167
+ //标签设置
168
+ let tabs = getContainerPropsValue(container, "content.tabs", [{label:'新券购买', value:'new', check: true},{label:'旧券充值', value:'old', check: true}]);
169
+ let isNewCard = false;
170
+ this.tabs = tabs.filter(item=>{
171
+ if(item.check && item.value === 'new') {
172
+ isNewCard = true;
173
+ }
174
+ return item.check
175
+ });
176
+ if(tabs.length === 2) this.tabsIndex = 'old';
177
+ else {
178
+ if(tabs.length > 0) this.tabsIndex = tabs[0].value;
41
179
  }
180
+ if(isNewCard) this.getNewCardList();
42
181
  },
43
- watch: {
44
- container(value, oldValue) {
45
- if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
46
- if (this.$configProject['isPreview']) this.init(value)
47
- },
182
+
183
+ handleTabs(value){
184
+ if(this.tabsIndex === value) return;
185
+ this.tabsIndex = value;
48
186
  },
49
- created() {
50
- this.init(this.container);
51
187
 
52
- //todo
188
+ //==套餐购买=============
189
+ /**
190
+ * @description 获取套餐列表
191
+ */
192
+ getNewCardList(){
193
+ jfbRootExec("cardRechargeList", {
194
+ vm: this,
195
+ data: {},
196
+ })
197
+ .then((res) => {
198
+ this.newCardList = (res.list || []).map(item=>{
199
+ item['package_image'] = getServiceUrl(item['package_image']);
200
+ item['card_point'] = `${this.$xdUniHelper.divisionFloatNumber(item['card_point'],100)}`
201
+ if(item['card_unit']){
202
+ item['card_point'] = `${item['card_point']} ${item['card_unit']}`
203
+ }
204
+ return item;
205
+ });
206
+ })
207
+ .catch((error) => {
208
+ console.error(error);
209
+ });
210
+ },
211
+
212
+ handleNewBuy(item){
213
+ this.$xdShowLoading({});
214
+ jfbRootExec("cardRechargeNew", {
215
+ vm: this,
216
+ data: {
217
+ package_id: item.package_id,
218
+ },
219
+ })
220
+ .then((res) => {
221
+ this.$xdHideLoading();
222
+ this.toLink(res.pay_order_id, res.order_id)
223
+ })
224
+ .catch((err) => {
225
+ this.$xdHideLoading();
226
+ console.log(err, "err");
227
+ });
228
+
229
+ },
230
+ //==套餐购买=============
231
+
232
+ getContent() {
233
+ jfbRootExec("getListRechargeNewsContent", {
234
+ vm: this,
235
+ data: {
236
+ page_id: this.pageAttr["page_id"], //页面ID
237
+ container_id: this.containerId, //组件ID
238
+ },
239
+ })
240
+ .then((res) => {
241
+ if(res && res.list && res.list.length > 0) {
242
+ this.content = res.list[0].content;
243
+ }
244
+ this.statusContent = true;
245
+ })
246
+ .catch((error) => {
247
+ console.error(error);
248
+ });
249
+ },
250
+
251
+ toLink(pay_order_id, order_id){
252
+ this.$xdUniHelper.redirectTo({
253
+ url: `${this.payPath}?order_id=${pay_order_id}&main_order_id=${order_id}&type=recharge`,
254
+ }, false, true);
255
+ },
256
+
257
+ handleToRecharge() {
258
+ if (!this.cardNumber) {
259
+ this.$xdAlert({ content: "请输入卡券号" });
260
+ return;
261
+ }
262
+ if (!this.card_point) {
263
+ this.$xdAlert({ content: "请输入充值点数" });
264
+ return;
265
+ }
266
+
267
+ if( this.$configProject.isPreview) {
268
+ return;
269
+ }
270
+
271
+ this.$xdShowLoading({});
272
+ jfbRootExec("cardRecharge", {
273
+ vm: this,
274
+ data: {
275
+ card_number: this.cardNumber, //页面ID
276
+ card_point: this.card_point * 100, //组件ID
277
+ },
278
+ })
279
+ .then((res) => {
280
+ this.$xdHideLoading();
281
+ this.toLink(res.pay_order_id, res.order_id)
282
+ })
283
+ .catch((err) => {
284
+ this.$xdHideLoading();
285
+ console.log(err, "err");
286
+ });
287
+ },
288
+
289
+ handleGetPrice(e) {
290
+ //未填写值
291
+ if (!this.cardNumber || !this.card_point) {
292
+ return;
293
+ }
294
+
295
+ //预览模式
296
+ if( this.$configProject.isPreview) {
297
+ this.amount = this.card_point;
298
+ return;
299
+ }
300
+
301
+ jfbRootExec("getRechargeAmount", {
302
+ vm: this,
303
+ data: {
304
+ card_number: this.cardNumber, //页面ID
305
+ card_point: this.$xdUniHelper.multiplyFloatNumber(Number(this.card_point),100), //组件ID
306
+ },
307
+ })
308
+ .then((res) => {
309
+ this.amount = this.$xdUniHelper.divisionFloatNumber(res.amount ,100);
310
+ })
311
+ .catch((err) => {
312
+ });
313
+ },
314
+
315
+ onJfbUpdate(data) {
316
+ if( this.$configProject.isPreview) {
317
+ this.getContent();
318
+ }
319
+
53
320
  },
54
- methods: {
55
- onJfbLoad(options) {
56
-
57
- // jfbRootExec('baiduUserLogin', {
58
-
59
- // vm: this,// data: {
60
-
61
- // account: 'gaoshiyong',// password: '123456789',// type: 3,// ...options
62
-
63
- // }
64
-
65
- // }).then().catch()
66
- },
67
- /**
68
- * @description 监听事件变化
69
- * @param container {object} 业务组件对象自己
70
- */
71
- init(container) {
72
-
73
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
74
-
75
- //this.height = getContainerPropsValue(container, 'content.height', 10);
76
- },
77
- onJfbScroll(options) {
78
- console.log('event.onJfbScroll', options)
79
- },
80
- onJfbReachBottom(options) {
81
- console.log('event.onJfbReachBottom', options)
82
- },
83
- onJfbShow(options) {
84
- console.log('event.onJfbShow', options)
85
- },
86
- onJfbHide(options) {
87
- console.log('event.onJfbHide', options)
88
- },
89
- onJfbBack(options) {
90
- console.log('event.onJfbBack', options)
91
- },
92
- onJfbUpdate(...data) {
93
- console.log('event.onJfbUpdate', data)
94
- },
95
- onJfbCustomEvent(options) {
96
- console.log('event.onJfbReachBottom', options)
97
- },
98
- }
99
- }
100
321
 
322
+ onJfbShow(options) {
323
+ this.onJfbLoad(options);
324
+ },
325
+ onJfbCustomEvent(options) {
326
+ console.log("event.onJfbReachBottom", options);
327
+ },
328
+ },
329
+ };
101
330
  </script>
102
331
 
103
332
  <style scoped lang="less">
104
- @import "./JfbBaseRechargeNewLess.less";
333
+ @import "./JfbBaseRechargeNewLess.less";
334
+
335
+ .jfb-base-recharge-new {
336
+ &__body {
337
+ &-card {
338
+ box-shadow: 0 unit(16, rpx) unit(60, rpx) 0 rgba(227, 227, 227, 0.37);
339
+ border-radius: unit(20, rpx);
340
+ background: #fff;
341
+ padding: 30rpx;
342
+ }
343
+ &-form {
344
+ input {
345
+ background: #eeeeee;
346
+ border-radius: unit(16, rpx);
347
+ padding: unit(30, rpx);
348
+ margin-bottom: unit(30, rpx);
349
+ }
350
+ }
351
+
352
+ .xd-notice-content {
353
+ padding: 0 40rpx 40rpx 40rpx;
354
+ & > view:first-child {
355
+ font-size: 32rpx;
356
+ font-weight: 500;
357
+ color: #333;
358
+ margin-bottom: 20rpx;
359
+ }
360
+ & > view:last-child {
361
+ line-height: 44rpx;
362
+ font-size: 26rpx;
363
+ color: #666;
364
+ /deep/ img, /deep/ image{
365
+ max-width: 100% !important;
366
+ height: auto !important;
367
+ margin: 22rpx 0;
368
+ }
369
+
370
+ /deep/ *{
371
+ max-width: 100% !important;
372
+ }
373
+ }
374
+ }
375
+ .xd-notice {
376
+ margin-top: unit(40, rpx);
377
+ padding: unit(40, rpx);
378
+ border-radius: unit(15, rpx)
379
+ }
380
+ }
381
+ }
105
382
 
106
- .jfb-base-recharge-new {
107
- &__body{
383
+ .recharge {
384
+ padding: 30rpx;
108
385
 
386
+ &-tab {
387
+ height: 100rpx;
388
+ margin-bottom: 15rpx;
389
+ display:flex;
390
+ justify-content: flex-start;
391
+ align-items: center;
392
+ & > view {
393
+ margin: 0 50rpx 0 0;
394
+ font-size: 32rpx;
395
+ position: relative;
396
+ height: 100%;
397
+ line-height: 100rpx;
398
+ cursor: pointer;
109
399
  }
400
+
401
+ &-index {
402
+ height: 6rpx;
403
+ overflow: hidden;
404
+ border-radius: 4rpx;
405
+ position: absolute;
406
+ left: 0;
407
+ right: 0;
408
+ bottom: 16rpx;
409
+ }
410
+ }
411
+
412
+ .recharge-pack {
413
+ height: 330rpx;
414
+ background-position: top left;
415
+ background-size: 100% 100%;
416
+ background-repeat: no-repeat;
417
+ color: #fff;
418
+ padding: 30rpx;
419
+ box-sizing: border-box;
420
+ border-radius: 16rpx;
421
+ margin-bottom: 30rpx;
422
+ &:last-child {
423
+ margin-bottom: 0;
424
+ }
425
+
426
+ & .name {
427
+ font-size: 32rpx;
428
+ font-weight: 500;
429
+ }
430
+
431
+ & .price {
432
+ font-size: 28rpx;
433
+ font-weight: 400;
434
+ padding: 20rpx 0 10rpx;
435
+ }
436
+
437
+ & .time {
438
+ font-size: 28rpx;
439
+ font-weight: 400;
440
+ }
441
+
442
+ & .line {
443
+ margin: 20rpx 0;
444
+ height: 2rpx;
445
+ background: rgba(255,255,255,.2);
446
+ }
447
+
448
+ & .buy {
449
+ display: flex;
450
+ justify-content: space-between;
451
+ align-items: center;
452
+
453
+ & > view:nth-child(2) {
454
+ height: 60rpx;
455
+ min-width: 120rpx;
456
+ text-align: center;
457
+ border-radius: 40rpx;
458
+ line-height: 60rpx;
459
+ border: 4rpx solid #fff;
460
+ padding: 0 25rpx;
461
+ font-size: 28rpx;
462
+
463
+ }
464
+ }
465
+
110
466
  }
467
+ }
111
468
  </style>
@@ -1,13 +1,5 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports = {
4
-
5
- getRechargeByIdFilmSquate:{},
6
-
7
- updateRechargeFilmPaiqiDate:{},
8
-
9
- removeRechargeFilmAddress:{},
10
-
11
- addRechargeFilmcart:{},
12
-
4
+ cardRecharge: {"amount":10000,"request_id":"1d4ab6e96e7fd54d"}
13
5
  }