jufubao-base 1.0.302-beta1 → 1.0.302-beta2

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,502 @@
2
2
  <view
3
3
  class="jfb-base-invoice"
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-invoice__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-invoice__edit-icon" @click="delEdit">删除</view>
14
14
  </view>
15
15
  <!-- #endif -->
16
- <view class="jfb-base-invoice__body">
17
- <view>测试插件( {{containerId}} )</view>
16
+ <view
17
+ class="jfb-base-invoice__body"
18
+ :style="{ minHeight: layoutInfo.bodyMinHeightRpx + 'rpx' }"
19
+ >
20
+ <view v-if="firstStep">
21
+ <view :style="[statusStyle]" class="jfb-base-invoice__body-status">
22
+ <XdFontIcon icon="iconmingchengtubiao"></XdFontIcon>
23
+ <view>{{ status_name }}</view>
24
+ </view>
25
+ <view class="jfb-base-invoice__body-content">
26
+ <view class="jfb-base-invoice__body-content-item">
27
+ <view class="jfb-base-invoice__body-content-item-info">
28
+ <view>订单编号</view>
29
+ <view>{{ main_order_id }}</view>
30
+ </view>
31
+ <view class="jfb-base-invoice__body-content-item-info">
32
+ <view>开票金额</view>
33
+ <XdUnit :price="invoice_amount" :isOld="false"></XdUnit>
34
+ </view>
35
+ </view>
36
+ <view
37
+ style="margin-top: 24rpx"
38
+ class="jfb-base-invoice__body-content-item"
39
+ >
40
+ <view class="jfb-base-invoice__body-content-item-info">
41
+ <view>发票类型</view>
42
+ <view>(普通发票)数电发票</view>
43
+ </view>
44
+ <view class="jfb-base-invoice__body-content-item-info">
45
+ <view><text class="required">*</text>抬头类型</view>
46
+ <view>
47
+ <radio-group @change="radioChange">
48
+ <label
49
+ style="margin-left: 10rpx"
50
+ v-for="(item, index) in invoice_header_type_list"
51
+ :key="index"
52
+ >
53
+ <radio
54
+ style="transform: scale(0.7)"
55
+ :value="item.value"
56
+ :checked="item.value === invoice_header_type"
57
+ :activeBackgroundColor="mainColor"
58
+ :activeBorderColor="mainColor"
59
+ :color="mainColor"
60
+ />
61
+ <text
62
+ :style="{
63
+ color:
64
+ item.value === invoice_header_type ? mainColor : '',
65
+ }"
66
+ >{{ item.label }}</text
67
+ >
68
+ </label>
69
+ </radio-group>
70
+ </view>
71
+ </view>
72
+ <view class="jfb-base-invoice__body-content-item-info">
73
+ <view><text class="required">*</text>发票抬头</view>
74
+ <view class="jfb-base-invoice__body-content-item-info-input">
75
+ <input
76
+ type="text"
77
+ v-model="invoice_header"
78
+ placeholder="填写需要开具发票的抬头"
79
+ />
80
+ </view>
81
+ </view>
82
+ <view class="jfb-base-invoice__body-content-item-info">
83
+ <view><text class="required">*</text>联系电话</view>
84
+ <view class="jfb-base-invoice__body-content-item-info-input">
85
+ <input
86
+ type="text"
87
+ v-model="phone_number"
88
+ placeholder="填写联系电话"
89
+ />
90
+ </view>
91
+ </view>
92
+ <view
93
+ v-if="invoice_header_type === 'company'"
94
+ class="jfb-base-invoice__body-content-item-info"
95
+ >
96
+ <view><text class="required">*</text>税号</view>
97
+ <view class="jfb-base-invoice__body-content-item-info-input">
98
+ <input
99
+ type="text"
100
+ v-model="invoice_number"
101
+ placeholder="填写税号"
102
+ />
103
+ </view>
104
+ </view>
105
+ <view class="jfb-base-invoice__body-content-item-info">
106
+ <view><text class="required">*</text>接收邮箱</view>
107
+ <view class="jfb-base-invoice__body-content-item-info-input">
108
+ <input
109
+ type="text"
110
+ v-model="email"
111
+ placeholder="开票成功后将发往您的邮箱"
112
+ />
113
+ </view>
114
+ </view>
115
+ </view>
116
+ </view>
117
+ <view class="fixe_bottom" :style="prod_bottom">
118
+ <XdButton @click="handleToSecondStep" size="small" type="primary"
119
+ >下一步</XdButton
120
+ >
121
+ </view>
122
+ </view>
123
+ <view v-else>
124
+ <view class="jfb-base-invoice__body-step2-content">
125
+ <view class="jfb-base-invoice__body-step2-content-item">
126
+ <view class="jfb-base-invoice__body-step2-content-item-info">
127
+ <view>开票金额</view>
128
+ <XdUnit :isOld="false" :price="invoice_amount"></XdUnit>
129
+ </view>
130
+ <view class="jfb-base-invoice__body-step2-content-item-info">
131
+ <view>发票类型</view>
132
+ <view>(普通发票)数电发票</view>
133
+ </view>
134
+ </view>
135
+ <view
136
+ style="margin-top: 24rpx"
137
+ class="jfb-base-invoice__body-step2-content-item"
138
+ >
139
+ <view class="jfb-base-invoice__body-step2-content-item-info">
140
+ <view>抬头类型</view>
141
+ <view>{{
142
+ invoice_header_type === "company" ? "单位" : "个人"
143
+ }}</view>
144
+ </view>
145
+ <view class="jfb-base-invoice__body-step2-content-item-info">
146
+ <view>发票抬头</view>
147
+ <view>{{ invoice_header }}</view>
148
+ </view>
149
+ <view class="jfb-base-invoice__body-step2-content-item-info">
150
+ <view>联系电话</view>
151
+ <view>{{ phone_number }}</view>
152
+ </view>
153
+ <view
154
+ v-if="invoice_header_type === 'company'"
155
+ class="jfb-base-invoice__body-step2-content-item-info"
156
+ >
157
+ <view>税号</view>
158
+ <view>{{ invoice_number }}</view>
159
+ </view>
160
+ <view class="jfb-base-invoice__body-step2-content-item-info">
161
+ <view>接收邮箱</view>
162
+ <view>{{ email }}</view>
163
+ </view>
164
+ </view>
165
+ </view>
166
+ <view class="fixe_bottom" :style="prod_bottom">
167
+ <XdButton
168
+ :cusStyle="[btnStyle]"
169
+ @click="handleBack"
170
+ size="small"
171
+ type="default"
172
+ >返回修改</XdButton
173
+ >
174
+ <XdButton @click="handleConfirm" size="small" type="primary"
175
+ >确认提交</XdButton
176
+ >
177
+ </view>
178
+ </view>
18
179
  </view>
19
180
  </view>
20
181
  </template>
21
182
 
22
183
  <script>
23
- import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
24
- import { jfbRootExec } from "@/utils/xd.event";
25
- import JfbBaseInvoiceMixin from "./JfbBaseInvoiceMixin";
26
- import { getContainerPropsValue } from "@/utils/xd.base";
27
- import componentsMixins from "@/mixins/componentsMixins";
28
- import extsMixins from "@/mixins/extsMixins";
29
- export default {
30
- name: "JfbBaseInvoice",
31
- components: {
32
- XdFontIcon
33
- },
34
- mixins: [
35
- componentsMixins, extsMixins, JfbBaseInvoiceMixin
36
- ],
37
- data() {
184
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
185
+ import XdButton from "@/components/XdButton/XdButton";
186
+ import { jfbRootExec } from "@/utils/xd.event";
187
+ import JfbBaseInvoiceMixin from "./JfbBaseInvoiceMixin";
188
+ import { getContainerPropsValue, gCPVal } from "@/utils/xd.base";
189
+ import componentsMixins from "@/mixins/componentsMixins";
190
+ import extsMixins from "@/mixins/extsMixins";
191
+ import getServiceUrl from "@/common/getServiceUrl";
192
+ import XdUnit from "../XdUnit/XdUnit.vue";
193
+ export default {
194
+ name: "JfbBaseInvoice",
195
+ components: {
196
+ XdFontIcon,
197
+ XdUnit,
198
+ XdButton,
199
+ },
200
+ mixins: [componentsMixins, extsMixins, JfbBaseInvoiceMixin],
201
+ data() {
202
+ return {
203
+ statusBg: "",
204
+ invoice_header_type_list: [],
205
+ invoice_header_type: "",
206
+ invoice_header: "",
207
+ phone_number: "",
208
+ email: "",
209
+ confirmPath: "",
210
+ detailPath: "",
211
+ main_order_id: "",
212
+ pay_order_id: "",
213
+ invoice_amount: "",
214
+ invoice_number: "",
215
+ status_name: "",
216
+ firstStep: true,
217
+ };
218
+ },
219
+ computed: {
220
+ statusStyle() {
38
221
  return {
39
-
40
- //todo
41
- }
222
+ backgroundImage: `url(${this.statusBg})`,
223
+ backgroundRepeat: "no-repeat",
224
+ backgroundSize: "100% 100%",
225
+ };
42
226
  },
43
- watch: {
44
- container(value, oldValue) {
45
- if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
46
- if (this.$configProject['isPreview']) this.init(value)
47
- },
227
+ prod_bottom() {
228
+ return this.fixedStyle({ height: 0, zIndex: 111 });
48
229
  },
49
- created() {
50
- this.init(this.container);
51
-
52
- //todo
230
+ btnStyle() {
231
+ return {
232
+ color: this.mainColor,
233
+ border: `1px solid ${this.mainColor}`,
234
+ };
53
235
  },
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) {
236
+ },
237
+ watch: {
238
+ container(value, oldValue) {
239
+ if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
240
+ if (this.$configProject["isPreview"]) this.init(value);
241
+ },
242
+ },
243
+ created() {
244
+ this.init(this.container);
72
245
 
73
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
246
+ //todo
247
+ },
248
+ methods: {
249
+ async onJfbLoad(options) {
250
+ this.main_order_id = options.main_order_id;
251
+ this.pay_order_id = options.pay_order_id;
252
+ await jfbRootExec("userInvoiceOptions", {
253
+ vm: this,
254
+ data: {},
255
+ })
256
+ .then((res) => {
257
+ this.invoice_header_type_list = res.invoice_header_type_list;
258
+ })
259
+ .catch();
260
+ await jfbRootExec("userInvoiceDetail", {
261
+ vm: this,
262
+ data: {
263
+ main_order_id: this.main_order_id,
264
+ pay_order_id: this.pay_order_id,
265
+ },
266
+ })
267
+ .then((res) => {
268
+ this.invoice_amount = res.invoice_result.invoice_amount;
269
+ this.status_name = res.invoice_result.status_name;
270
+ })
271
+ .catch();
272
+ },
273
+ /**
274
+ * @description 监听事件变化
275
+ * @param container {object} 业务组件对象自己
276
+ */
277
+ init(container) {
278
+ this.statusBg = getServiceUrl(
279
+ gCPVal(container, "statusBg", { url: "" }, {}).url
280
+ );
281
+ this.confirmPath = getContainerPropsValue(
282
+ container,
283
+ "content.confirmPath",
284
+ { value: "" }
285
+ ).value;
286
+ this.detailPath = getContainerPropsValue(
287
+ container,
288
+ "content.detailPath",
289
+ { value: "" }
290
+ ).value;
291
+ debugger
292
+ },
293
+ radioChange: function (evt) {
294
+ for (let i = 0; i < this.invoice_header_type_list.length; i++) {
295
+ if (this.invoice_header_type_list[i].value === evt.detail.value) {
296
+ this.invoice_header_type = evt.detail.value;
297
+ break;
298
+ }
299
+ }
300
+ },
301
+ convertObjToQueryString(obj, prefix = "this.", encode = true) {
302
+ // 过滤掉值为 undefined/null 的属性,避免生成空参数
303
+ const validEntries = Object.entries(obj).filter(
304
+ ([_, value]) => value !== undefined && value !== null
305
+ );
74
306
 
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
- }
307
+ // 拼接每个键值对:key=prefix.key(支持编码)
308
+ const querySegments = validEntries.map(([key, _]) => {
309
+ const valueStr = this[key];
310
+ // 根据需求决定是否对值进行 URL 编码(避免特殊字符问题)
311
+ const encodedValue = encode ? encodeURIComponent(valueStr) : valueStr;
312
+ return `${encodeURIComponent(key)}=${encodedValue}`;
313
+ });
100
314
 
315
+ // 用 & 连接所有段,返回最终查询字符串
316
+ return querySegments.join("&");
317
+ },
318
+ handleToSecondStep() {
319
+ if (!this.invoice_header_type) {
320
+ this.$xdAlert({ content: "请选择发票抬头类型" });
321
+ return;
322
+ }
323
+ if (!this.invoice_header) {
324
+ this.$xdAlert({ content: "请填写发票抬头" });
325
+ return;
326
+ }
327
+ if (this.invoice_header_type == "company") {
328
+ if (!this.invoice_number) {
329
+ this.$xdAlert({ content: "请填写税号" });
330
+ return;
331
+ }
332
+ }
333
+ if (!this.email) {
334
+ this.$xdAlert({ content: "请填写接收邮箱" });
335
+ return;
336
+ }
337
+ if (!this.phone_number) {
338
+ this.$xdAlert({ content: "请填写联系电话" });
339
+ return;
340
+ }
341
+ this.firstStep = false;
342
+ },
343
+ handleConfirm() {
344
+ //调用确认提交接口并跳转详情页面
345
+ jfbRootExec("userInvoiceSubmit", {
346
+ vm: this,
347
+ data: {
348
+ main_order_id: this.main_order_id,
349
+ pay_order_id: this.pay_order_id,
350
+ email: this.email,
351
+ invoice_header_type: this.invoice_header_type,
352
+ invoice_header: this.invoice_header,
353
+ phone_number: this.phone_number,
354
+ invoice_number: this.invoice_number,
355
+ },
356
+ }).then((res) => {
357
+ let params = {
358
+ main_order_id: this.main_order_id,
359
+ pay_order_id: this.pay_order_id,
360
+ };
361
+ params = this.convertObjToQueryString(params);
362
+ params = this.$xdUniHelper.navigateTo({
363
+ url: `${this.detailPath}?${params}`,
364
+ });
365
+ });
366
+ },
367
+ handleBack() {
368
+ this.firstStep = true;
369
+ },
370
+ onJfbScroll(options) {
371
+ console.log("event.onJfbScroll", options);
372
+ },
373
+ onJfbReachBottom(options) {
374
+ console.log("event.onJfbReachBottom", options);
375
+ },
376
+ onJfbShow(options) {
377
+ console.log("event.onJfbShow", options);
378
+ },
379
+ onJfbHide(options) {
380
+ console.log("event.onJfbHide", options);
381
+ },
382
+ onJfbBack(options) {
383
+ console.log("event.onJfbBack", options);
384
+ },
385
+ onJfbUpdate(...data) {
386
+ console.log("event.onJfbUpdate", data);
387
+ },
388
+ onJfbCustomEvent(options) {
389
+ console.log("event.onJfbReachBottom", options);
390
+ },
391
+ },
392
+ };
101
393
  </script>
102
394
 
103
395
  <style scoped lang="less">
104
- @import "./JfbBaseInvoiceLess.less";
396
+ @import "./JfbBaseInvoiceLess.less";
105
397
 
106
- .jfb-base-invoice {
107
- &__body{
398
+ .jfb-base-invoice {
399
+ &__body {
400
+ &-status {
401
+ display: flex;
402
+ align-items: center;
403
+ justify-content: center;
404
+ font-size: 36rpx;
405
+ height: 180rpx;
406
+ color: #fff;
407
+ & > view {
408
+ margin-left: 16rpx;
409
+ }
410
+ }
411
+ &-content {
412
+ padding: 24rpx;
413
+ position: relative;
414
+ top: -18rpx;
415
+ border-radius: 16rpx;
416
+ background: #f8f8f8;
417
+ &-item {
418
+ background: #fff;
419
+ border-radius: 8rpx;
420
+ &-info {
421
+ padding: 20rpx 48rpx;
422
+ display: flex;
423
+ justify-content: space-between;
424
+ align-items: center;
425
+ color: #333333;
426
+ font-size: 28rpx;
427
+ border-bottom: 2rpx solid #f7f7f7;
428
+ position: relative;
429
+ &-input {
430
+ flex: 1;
431
+ }
432
+ input {
433
+ font-size: 26rpx;
434
+ text-align: end;
435
+ }
436
+ }
437
+ .required {
438
+ color: red;
439
+ position: absolute;
440
+ left: 30rpx;
441
+ }
442
+ }
443
+ }
444
+ .fixe_bottom {
445
+ display: flex;
446
+ align-items: center;
447
+ justify-content: space-around;
448
+ height: unit(100, rpx);
449
+ padding: 0 unit(40, rpx);
450
+ flex-flow: nowrap;
451
+ background: #fff;
452
+ box-shadow: 0 0 unit(16, rpx) rgba(0, 0, 0, 0.05);
453
+ .flex_l {
454
+ display: flex;
455
+ align-items: center;
456
+ font-size: unit(32, rpx);
457
+ }
108
458
 
459
+ & > view {
460
+ flex: 1;
461
+ padding: 0 unit(15, rpx);
462
+ }
463
+ }
464
+ &-step2-content {
465
+ padding: 24rpx;
466
+ border-radius: 16rpx;
467
+ &-item {
468
+ background: #fff;
469
+ border-radius: 8rpx;
470
+ &-info {
471
+ padding: 20rpx 48rpx;
472
+ display: flex;
473
+ justify-content: space-between;
474
+ align-items: center;
475
+ color: #333333;
476
+ font-size: 28rpx;
477
+ border-bottom: 2rpx solid #f7f7f7;
478
+ }
479
+ }
480
+ }
481
+ .fixe_bottom {
482
+ display: flex;
483
+ align-items: center;
484
+ justify-content: space-around;
485
+ height: unit(100, rpx);
486
+ padding: 0 unit(40, rpx);
487
+ flex-flow: nowrap;
488
+ background: #fff;
489
+ box-shadow: 0 0 unit(16, rpx) rgba(0, 0, 0, 0.05);
490
+ .flex_l {
491
+ display: flex;
492
+ align-items: center;
493
+ font-size: unit(32, rpx);
494
+ }
495
+
496
+ & > view {
497
+ flex: 1;
498
+ padding: 0 unit(15, rpx);
499
+ }
109
500
  }
110
501
  }
502
+ }
111
503
  </style>
@@ -0,0 +1,33 @@
1
+ import {
2
+ dataVal,
3
+ } from "@/utils/AttrTools";
4
+ export default (data, gValue, gColor, oldData = {}) => {
5
+ return [
6
+ {
7
+ label: '确认开票',
8
+ ele: 'xd-select-pages-path',
9
+ valueKey: 'confirmPath',
10
+ placeholder: '请选择确认开票页面',
11
+ value: data['confirmPath'] || {},
12
+ labelInline: true,
13
+ setting: {
14
+ router: XdBus.getParentApi('getPagesTree'),
15
+ },
16
+ className: 'input100',
17
+ groupKey: 'advanced',
18
+ },
19
+ {
20
+ label: '开票详情',
21
+ ele: 'xd-select-pages-path',
22
+ valueKey: 'detailPath',
23
+ placeholder: '请选择开票详情页面',
24
+ value: data['detailPath'] || {},
25
+ labelInline: true,
26
+ setting: {
27
+ router: XdBus.getParentApi('getPagesTree'),
28
+ },
29
+ className: 'input100',
30
+ groupKey: 'advanced',
31
+ },
32
+ ].filter(i => i);
33
+ }
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+ import {
3
+ dataVal,
4
+ statusDataVal,
5
+ statusShow,
6
+ customVal,
7
+ getRemoteOptions
8
+ } from "@/utils/AttrTools";
9
+
10
+ export default (data, gValue, gColor, oldData = {}) => {
11
+ return [].filter(i => i);
12
+ }
@@ -0,0 +1,41 @@
1
+ import {
2
+ dataVal,
3
+ statusDataVal,
4
+ statusShow,
5
+ cRaBorShadow,
6
+ cusDisabled,
7
+ getCustomAttr,
8
+ TestCssInfo
9
+ } from "@/utils/AttrTools";
10
+ export default (data, gValue, gColor, oldData = {}) => {
11
+ return [
12
+ {
13
+ label: '背景图',
14
+ ele: 'xd-upload',
15
+ labelInline: true,
16
+ valueKey: 'statusBg',
17
+ value: dataVal({
18
+ data,
19
+ key: 'statusBg',
20
+ dValue: null,
21
+ gValue,
22
+ }),
23
+ defaultValue: dataVal({
24
+ data,
25
+ key: 'statusBg',
26
+ dValue: null,
27
+ gValue,
28
+ }),
29
+ slot: true,
30
+ tipsformet: '上传文件格式:@imageType@,不超过@size@MB.,建议宽度为:<span style="color:red">750</span>像素',
31
+ type: ['jpg', 'png', 'jpeg'],
32
+ styleType: 'one',
33
+ uploadType: 'aliyun',
34
+ oneHeight: 90,
35
+ oneWidth: 375,
36
+ size: 5,
37
+ action: 'aliyun',
38
+ groupKey: 'style',
39
+ },
40
+ ].filter(i => i);
41
+ }