jufubao-base 1.0.297-beta23 → 1.0.298

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.
@@ -1,327 +0,0 @@
1
- 'use strict';
2
- import { jfbRootExec } from "@/utils/xd.event";
3
- export default {
4
- data() {
5
- return {
6
- payChannels: [],
7
- channel_provider_id: "",
8
- jwxSDK: null,
9
- validTimer: null,
10
- temp_order_id: "",
11
- expiration_sec: '',
12
- secondTimer: null,
13
- statusTimer: null,
14
-
15
- code_url: '',
16
- barcode_url: '',
17
- qrcode_icon: '',
18
- barCode: '',
19
- paySortList: [],
20
- tempList: [],
21
- deductDialog: false,
22
- }
23
- },
24
- computed: {
25
- curPaySelectShow(){
26
- if(this.paySortList.length === 0) return ''
27
- let curPay = this.paySortList[0];
28
- return curPay.pay_method_name + (curPay.pay_method !== 'card' ? `: ${this.$xdUniHelper.divisionFloatNumber(curPay.wallet_amount, 100)}` : '')
29
- },
30
- expiration_sec_str() {
31
- //秒数转 x分x秒
32
- let second = this.expiration_sec;
33
- if (second < 60) {
34
- return second + "秒";
35
- }
36
- let min = parseInt(second / 60);
37
- let sec = second % 60;
38
- return `${min}分${sec}秒`;
39
- },
40
- },
41
- methods: {
42
- //获取jwxSDK实例,用于发起微信支付请求
43
- getH5WxAuthorize() {
44
- jfbRootExec("getH5WxAuthorize", {
45
- vm: this,
46
- data: { jsApiList: ["chooseWXPay"], },
47
- })
48
- .then((res) => {
49
- this.jwxSDK = res.jwxSDK;
50
- console.log('this.jwxSDK', this.jwxSDK);
51
- })
52
- .catch(error => {
53
- this.$xdAlert({
54
- content: error,
55
- });
56
- });
57
- },
58
- // 发起微信支付请求 (支付签名数据)
59
- openTemplatePay(paySignData, cb) {
60
- console.log('openTemplatePay', paySignData);
61
-
62
- const { timeStamp, ...otherData } = paySignData;
63
- otherData["timestamp"] = timeStamp;
64
- // #ifdef H5
65
- this.jwxSDK.chooseWXPay({
66
- ...otherData,
67
- success: (res) => {
68
- this.refresh = false;
69
- this.$xdLog.setARMSInfo({ options: this.options, res }, 'pay_success');
70
- uni.showToast({
71
- title: "支付成功",
72
- });
73
- cb(res);
74
- },
75
- cancel: () => {
76
- this.onRefreshPage();
77
- this.$xdLog.setARMSInfo(this.options, 'cancel_pay');
78
- uni.showToast({
79
- title: "取消支付",
80
- });
81
- },
82
- fail: (error) => {
83
- this.onRefreshPage();
84
- if (typeof error === 'string') error = { error: error }
85
- if (window['jwxJfbSDKParams']) error = Object.assign(error, paySignData, window['jwxJfbSDKParams'])
86
- this.$xdLog.setARMSError(error)
87
- uni.showToast({
88
- title: "支付失败",
89
- });
90
- },
91
- });
92
- // #endif
93
- // #ifdef MP
94
- wx.requestPayment({
95
- ...paySignData,
96
- success: (res) => {
97
- this.refresh = false;
98
- this.$xdLog.setARMSInfo({ options: this.options, res }, 'pay_success');
99
- uni.showToast({
100
- title: "支付成功",
101
- icon: "none",
102
- });
103
- cb(res);
104
- },
105
- fail: (err) => {
106
- this.onRefreshPage();
107
- this.$xdLog.setARMSError({
108
- options: this.options,
109
- error: JSON.stringify(err)
110
- });
111
- uni.showToast({
112
- title: "支付失败",
113
- icon: "none",
114
- });
115
- },
116
- });
117
- // #endif
118
- },
119
- //三方支付 - 微信补差支付
120
- handleThirdPay(pay_order_id, main_order_id) {
121
- let { login_providers = [] } = this.projectAttr;
122
- let data = {
123
- order_id: pay_order_id,
124
- channel_provider_id: this.channel_provider_id,
125
- login_providers: login_providers.join(","),
126
- };
127
- //设置支付成功页面地址
128
- if (!this.$configProject.isPreview) {
129
- data['pay_success_url'] = '';
130
- // #ifdef H5
131
- data['pay_success_url'] = `${window.location.protocol}//${window.location.host}/${this.projectAttr.deploy_dir}`;
132
- // #endif
133
- data['pay_success_url'] += this.successPath + `?order_id=${main_order_id}`;
134
- }
135
-
136
- jfbRootExec("setConsumpThirdPlace", {
137
- vm: this,
138
- data,
139
- })
140
- .then((res) => {
141
- this.$xdHideLoading();
142
- const { channel_data } = res;
143
- const paySignData = JSON.parse(Base64.decode(channel_data));
144
- this.openTemplatePay(paySignData, (ps) => {
145
- jfbRootExec("updateConsumpPay", {
146
- vm: this,
147
- data: {
148
- main_order_id: main_order_id,
149
- },
150
- })
151
- .then((res) => {
152
- this.$xdUniHelper.redirectTo({
153
- url: this.successPath + `?order_id=${main_order_id}`
154
- });
155
- })
156
- .catch(error => {
157
- this.$xdLog.setARMSCustomError('update_loading_fail', { options: this.options, error });
158
- });
159
- })
160
- });
161
- },
162
- onRefreshPage() {
163
- this.temp_order_id = "";
164
- if (this.validTimer) clearInterval(this.validTimer)
165
- this.p_getAsyncStep();
166
- },
167
- //订单失效
168
- handlerOderFail() {
169
- console.warn("handlerOderFail");
170
- this.temp_order_id = "";
171
- clearInterval(this.validTimer);
172
- clearTimeout(this.orderTimer);
173
- clearInterval(this.secondTimer);
174
- },
175
- //获取订单状态 - 轮询订单状态
176
- p_getOrderStatus() {
177
- jfbRootExec("getConsumpAsyncSubmitStatus", {
178
- vm: this,
179
- data: {
180
- request_order_id: this.request_order_id
181
- }
182
- }).then(res => {
183
- let { hand_status, hand_status_msg, order_id, pay_order_id, need_pay_price } = res;
184
-
185
- if (hand_status === 'U') {
186
- this.orderTimer = setTimeout(() => {
187
- this.p_getOrderStatus();
188
- }, 2000)
189
- } else if (hand_status === 'S') { //成功
190
- if (parseFloat(need_pay_price) > 0) {//补差
191
- this.handleThirdPay(pay_order_id, order_id);
192
- } else {//订单成功
193
- this.refresh = false
194
- this.$xdUniHelper.redirectTo({
195
- url: this.successPath + `?order_id=${order_id}`
196
- })
197
- }
198
- } else if (hand_status === 'F') {
199
- this.handlerOderFail();
200
- this.$xdAlert({
201
- content: hand_status_msg || '支付失败',
202
- time: 3000,
203
- isClose: false,
204
- zIndex: 5000
205
- });
206
- }
207
- })
208
- },
209
- //创建订单
210
- p_createOrder() {
211
- jfbRootExec("batchConsumpUseCardCreated", {
212
- vm: this,
213
- data: {
214
- temp_order_id: this.temp_order_id,
215
- business_code: this.xnamespace,
216
- }
217
- }).then(res => {
218
- this.request_order_id = res.request_order_id;
219
- this.p_getOrderStatus();
220
- }).catch(err => {
221
- this.handlerOderFail();
222
- })
223
- },
224
- //获取支付码扫码状态 - 轮询支付状态
225
- p_getQRCodeStatus() {
226
- jfbRootExec("getConsumpCodeScanStatus", {
227
- vm: this,
228
- data: {
229
- temp_order_id: this.temp_order_id,
230
- shop_id: this.shop_id
231
- }
232
- }).then(res => {
233
- //P处理中 Y成功 E 失败
234
- if (res.status === 'P') {
235
- if (!this.isPreview) {
236
- if (this.statusTimer) clearTimeout(this.statusTimer);
237
- this.statusTimer = setTimeout(() => {
238
- this.p_getQRCodeStatus();
239
- }, 2000);
240
- }
241
- } else if (res.status === 'Y') {
242
- //订单下单有效时间 秒
243
- if (this.statusTimer) clearTimeout(this.statusTimer);
244
- this.orderSeconds = res.seconds;
245
- if (this.orderSeconds > 0) {
246
- this.validTimer = setInterval(() => {
247
- this.orderSeconds--;
248
- if (this.orderSeconds <= 0) {
249
- this.handlerOderFail();
250
- }
251
-
252
- }, 1000)
253
- }
254
- this.p_createOrder();
255
- } else if (res.status === 'E') {
256
- if (this.statusTimer) clearTimeout(this.statusTimer);
257
- this.$xdAlert({
258
- content: res.message,
259
- time: 1500,
260
- isClose: false,
261
- zIndex: 5000
262
- });
263
- }
264
- })
265
- },
266
-
267
- //获取用户可用支付渠道
268
- p_getListUserPayChannel() {
269
- const { pay_channels } = this.projectAttr;
270
- jfbRootExec("getConsumpListUserPayChannel", {
271
- vm: this,
272
- data: {
273
- providers: pay_channels && pay_channels.join(","),
274
- },
275
- }).then((res) => {
276
- console.log("p_getListUserPayChannel", res);
277
- this.payChannels = res.list;
278
- this.channel_provider_id = res.list[0].channel_provider_id;
279
- });
280
- },
281
- //关闭支付方式排序弹窗
282
- handleSortClose(){
283
- this.deductDialog = false;
284
- },
285
- //显示支付方式排序弹窗
286
- showSortDialog(){
287
- this.deductDialog = true;
288
- },
289
- //支付方式排序
290
- handleDeductSort(list){
291
- console.log("handleDeductSort",list);
292
- this.tempList = list;
293
- },
294
- //获取我的支付顺序配置
295
- p_getMyPayOrderConfig(){
296
- jfbRootExec("getMyPayOrderConfig", {
297
- vm: this,
298
- data: {},
299
- }).then(res => {
300
- this.paySortList = res.configs;
301
- })
302
- },
303
- //提交支付方式的排序
304
- doConfirmSortPay(){
305
- if(this.tempList.length === 0){
306
- this.deductDialog = false;
307
- return false;
308
- }
309
- let configs = this.tempList.map(item => {
310
- return {
311
- pay_method: item.pay_method,
312
- priority_rules: item.options.map(ii => ii.value)
313
- }
314
- })
315
- console.log('configs',configs);
316
- jfbRootExec("saveMyPayOrderConfig", {
317
- vm: this,
318
- data: {
319
- configs: configs
320
- }
321
- }).then(res => {
322
- this.deductDialog = false;
323
- this.paySortList = this.tempList;
324
- })
325
- },
326
- }
327
- }
@@ -1,94 +0,0 @@
1
- 'use strict';
2
-
3
- export default (data)=>{
4
- return [
5
- {
6
- label: '开通会员',
7
- ele: 'xd-select-pages-path',
8
- valueKey: 'openPath',
9
- placeholder: '请选择开通会员跳转页面',
10
- value: data.openPath || null,
11
- labelInline: true,
12
- setting: {
13
- router: XdBus.getParentApi('getPagesTree'),
14
- },
15
- groupKey:'advanced',
16
- className: 'input100',
17
- },
18
- {
19
- label: '切换门店',
20
- ele: 'xd-select-pages-path',
21
- valueKey: 'shopPath',
22
- placeholder: '请选择切换门店跳转页面',
23
- value: data.shopPath || null,
24
- labelInline: true,
25
- setting: {
26
- router: XdBus.getParentApi('getPagesTree'),
27
- },
28
- groupKey:'advanced',
29
- className: 'input100',
30
- },
31
- {
32
- label: '支付成功',
33
- ele: 'xd-select-pages-path',
34
- valueKey: 'successPath',
35
- placeholder: '请选择支付成功跳转页面',
36
- value: data.successPath || null,
37
- labelInline: true,
38
- setting: {
39
- router: XdBus.getParentApi('getPagesTree'),
40
- },
41
- groupKey:'advanced',
42
- className: 'input100',
43
- },
44
- {
45
- label: '核销支付',
46
- ele: 'xd-select-pages-path',
47
- valueKey: 'cash_pay_path',
48
- placeholder: '请选择核销支付跳转页面',
49
- value: data.cash_pay_path || null,
50
- labelInline: true,
51
- setting: {
52
- router: XdBus.getParentApi('getPagesTree'),
53
- },
54
- groupKey:'advanced',
55
- className: 'input100',
56
- },
57
- {
58
- label: '扫码提货',
59
- ele: 'xd-select-pages-path',
60
- valueKey: 'scanPath',
61
- placeholder: '请选择扫码提货跳转页面',
62
- value: data.scanPath || null,
63
- labelInline: true,
64
- setting: {
65
- router: XdBus.getParentApi('getPagesTree'),
66
- },
67
- groupKey:'advanced',
68
- className: 'input100',
69
- },
70
- {
71
- label: '选取城市:',
72
- ele: 'xd-select-pages-path',
73
- valueKey: 'cityPath',
74
- placeholder: '请选择选取城市跳转页面',
75
- value: data.cityPath || null,
76
- className: 'input100',
77
- labelInline: true,
78
- groupKey:'advanced',
79
- setting: {
80
- router: XdBus.getParentApi('getPagesTree')
81
- },
82
- inline: false,
83
- },
84
- {
85
- label: '版本号:',
86
- ele: 'el-input',
87
- type: 'text',
88
- groupKey: 'advanced',
89
- valueKey: 'version',
90
- value: 'v2.0',
91
- hidden: true,
92
- },
93
- ]
94
- }
@@ -1,298 +0,0 @@
1
- 'use strict';
2
- import {
3
- dataVal ,
4
- statusShow,
5
- statusDataVal,
6
- customVal,
7
- cusDisabled ,
8
- getCustomAttr,
9
- } from "@/utils/AttrTools";
10
- import IConList from "@/ICONS"
11
- import ProductAttr from "@/utils/Attr/ProductAttr";
12
-
13
- export default function (data, gValue,gColor,oldData){
14
-
15
- return [
16
- {
17
- ele: 'title',
18
- label: '基础',
19
- size: 'small',
20
- groupKey:'content',
21
- },
22
- {
23
- label: "是否展示优先支付账户:",
24
- ele: "xd-radio",
25
- valueKey: "isShowPaySoft",
26
- value: data.isShowPaySoft || "N",
27
- groupKey: "content",
28
- list: [
29
- { label: "展示", value: "Y" },
30
- { label: "不展示", value: "N" }
31
- ]
32
- },
33
-
34
- {
35
- ele: 'title',
36
- label: '组件样式',
37
- size: 'small',
38
- groupKey:'content',
39
- },
40
- {
41
- label: "组件样式",
42
- ele: "xd-style-image",
43
- groupKey: 'content',
44
- valueKey: "compLayout",
45
- cusStyle:{marginBottom: '5px'},
46
- value: customVal({
47
- data,
48
- key: 'compLayout',
49
- gValue,
50
- sValue:"1",
51
- }),
52
- labelInline:true,
53
- className: 'input100',
54
- isTplRef:true,
55
- handleCustom(cusRes) {
56
- XdBus.getParentApi('getCompStylesOptions')({
57
- layout_ids: 'lNIroukRdhDsu5lpqIkKn',
58
- key: Date.now()
59
- })
60
- .then(res => {
61
- cusRes.data.cb(res)
62
- })
63
- .catch(error => {
64
- console.error(error);
65
- });
66
- },
67
- },
68
-
69
- {
70
- ele: 'title',
71
- label: '展示内容',
72
- size: 'small',
73
- groupKey:'content',
74
- },
75
- {
76
- label: '扫码提货',
77
- ele: 'xd-cus-switch',
78
- valueKey: 'showScan',
79
- value: dataVal({ data, key: 'showScan', dValue: 'Y', gValue }),
80
- className: 'input100',
81
- labelInline: true,
82
- groupKey: 'content',
83
- setting: {
84
- tips: ['显示', '不显示'],
85
- isBackType: 'string'
86
- },
87
- },
88
- { ele: 'group_start' },
89
- {
90
- label: '标题',
91
- ele: 'el-input',
92
- valueKey: 'scanName',
93
- labelInline: true,
94
- value: dataVal({ data, key: 'scanName', dValue: '', gValue }),
95
- hidden: data.showScan !== 'Y',
96
- groupKey: 'content',
97
- className: 'input80',
98
- inline: false,
99
- max: 4,
100
- placeholder: "扫码提货"
101
- },
102
- {
103
- label: "图标",
104
- ele: "xd-radio",
105
- valueKey: "scanIconType",
106
- value: dataVal({ data, key: 'scanIconType', dValue: "icon", gValue }),
107
- groupKey: 'content',
108
- labelInline: true,
109
- list: [
110
- { label: "图标", value: "icon" },
111
- { label: "图片", value: "img" }
112
- ],
113
- hidden: data.showScan !== 'Y'
114
- },
115
- data.scanIconType === 'icon' &&{
116
- label: " ",
117
- ele: "xd-icon-select",
118
- valueKey: "scanIcon",
119
- value: data.scanIcon || '',
120
- list: IConList,
121
- labelInline: true,
122
- className: 'input80',
123
- groupKey: "content",
124
- },
125
- data.scanIconType === 'img' &&{
126
- label: ' ',
127
- ele: "xd-upload",
128
- valueKey: 'scanImg',
129
- groupKey:'content',
130
- value: data.scanImg || {},
131
- defaultValue: data.scanImg || null,
132
- slot: true,
133
- oneWidth: 60,
134
- oneHeight: 60,
135
- elinputClassName: 'input40',
136
- tipsformet: '上传@imageType@不超过@size@MB.比例1:1',
137
- type: ['jpg', 'png', 'jpeg'],
138
- styleType: 'one',
139
- uploadType: 'aliyun',
140
- size: 1,
141
- action: 'action',
142
- sort: true,
143
- maxlen: 100,
144
- labelInline: true,
145
- },
146
- { ele: 'group_end' },
147
-
148
-
149
- {
150
- label: '聚好兑',
151
- ele: 'xd-cus-switch',
152
- valueKey: 'showJHD',
153
- value: dataVal({ data, key: 'showJHD', dValue: 'Y', gValue }),
154
- className: 'input100',
155
- labelInline: true,
156
- groupKey: 'content',
157
- setting: {
158
- tips: ['显示', '不显示'],
159
- isBackType: 'string'
160
- },
161
- },
162
- { ele: 'group_start' },
163
- {
164
- label: '标题',
165
- ele: 'el-input',
166
- valueKey: 'JHDName',
167
- labelInline: true,
168
- value: dataVal({ data, key: 'JHDName', dValue: '', gValue }),
169
- hidden: data.showJHD !== 'Y',
170
- groupKey: 'content',
171
- className: 'input80',
172
- inline: false,
173
- max: 4,
174
- placeholder: "聚好兑"
175
- },
176
- {
177
- label: "图标",
178
- ele: "xd-radio",
179
- valueKey: "JHDIconType",
180
- value: dataVal({ data, key: 'JHDIconType', dValue: "icon", gValue }),
181
- groupKey: 'content',
182
- labelInline: true,
183
- list: [
184
- { label: "图标", value: "icon" },
185
- { label: "图片", value: "img" }
186
- ],
187
- hidden: data.showJHD !== 'Y'
188
- },
189
- data.JHDIconType === 'icon' &&{
190
- label: " ",
191
- ele: "xd-icon-select",
192
- valueKey: "JHDIcon",
193
- value: data.JHDIcon || '',
194
- list: IConList,
195
- labelInline: true,
196
- className: 'input80',
197
- groupKey: "content",
198
- },
199
- data.JHDIconType === 'img' &&{
200
- label: ' ',
201
- ele: "xd-upload",
202
- valueKey: 'JHDImg',
203
- groupKey:'content',
204
- value: data.JHDImg || {},
205
- defaultValue: data.JHDImg || null,
206
- slot: true,
207
- oneWidth: 60,
208
- oneHeight: 60,
209
- elinputClassName: 'input40',
210
- tipsformet: '上传@imageType@不超过@size@MB.比例1:1',
211
- type: ['jpg', 'png', 'jpeg'],
212
- styleType: 'one',
213
- uploadType: 'aliyun',
214
- size: 1,
215
- action: 'action',
216
- sort: true,
217
- maxlen: 100,
218
- labelInline: true,
219
- },
220
- { ele: 'group_end' },
221
-
222
-
223
- {
224
- label: '展码提货',
225
- ele: 'xd-cus-switch',
226
- valueKey: 'showQP',
227
- value: dataVal({ data, key: 'showQP', dValue: 'Y', gValue }),
228
- className: 'input100',
229
- labelInline: true,
230
- groupKey: 'content',
231
- setting: {
232
- tips: ['显示', '不显示'],
233
- isBackType: 'string'
234
- },
235
- },
236
- { ele: 'group_start' },
237
- {
238
- label: '标题',
239
- ele: 'el-input',
240
- valueKey: 'QPName',
241
- labelInline: true,
242
- value: dataVal({ data, key: 'QPName', dValue: '', gValue }),
243
- hidden: data.showQP !== 'Y',
244
- groupKey: 'content',
245
- className: 'input80',
246
- inline: false,
247
- max: 4,
248
- placeholder: "展码提货"
249
- },
250
- {
251
- label: "图标",
252
- ele: "xd-radio",
253
- valueKey: "QPIconType",
254
- value: dataVal({ data, key: 'QPIconType', dValue: "icon", gValue }),
255
- groupKey: 'content',
256
- labelInline: true,
257
- list: [
258
- { label: "图标", value: "icon" },
259
- { label: "图片", value: "img" }
260
- ],
261
- hidden: data.showQP !== 'Y'
262
- },
263
- data.QPIconType === 'icon' &&{
264
- label: " ",
265
- ele: "xd-icon-select",
266
- valueKey: "QPIcon",
267
- value: data.QPIcon || '',
268
- list: IConList,
269
- labelInline: true,
270
- className: 'input80',
271
- groupKey: "content",
272
- },
273
- data.QPIconType === 'img' &&{
274
- label: ' ',
275
- ele: "xd-upload",
276
- valueKey: 'QPImg',
277
- groupKey:'content',
278
- value: data.QPImg || {},
279
- defaultValue: data.QPImg || null,
280
- slot: true,
281
- oneWidth: 60,
282
- oneHeight: 60,
283
- elinputClassName: 'input40',
284
- tipsformet: '上传@imageType@不超过@size@MB.比例1:1',
285
- type: ['jpg', 'png', 'jpeg'],
286
- styleType: 'one',
287
- uploadType: 'aliyun',
288
- size: 1,
289
- action: 'action',
290
- sort: true,
291
- maxlen: 100,
292
- labelInline: true,
293
- },
294
- { ele: 'group_end' },
295
-
296
-
297
- ].filter(i=>i)
298
- }