jufubao-mall 2.0.29-beta1 → 2.0.31

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,393 @@
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
+ let options = getRemoteOptions('productV20List', data, gValue, dataVal);
12
+ let cellNum = dataVal({ data, key: 'row_num', dValue: 2, gValue });
13
+ let cartStyle = dataVal({ data, key: 'cartStyle', dValue: 'icongouwuche-01', gValue });
14
+ if (cellNum === 3) {
15
+ if (cartStyle.indexOf('btn_cart') === 0) cartStyle = 'icongouwuche-01'
16
+ }
17
+ let reKey;
18
+ let isKey = false;
19
+ if (oldData['row_num'] !== undefined && cellNum !== oldData['row_num']) {
20
+ reKey = Date.now();
21
+ isKey = true;
22
+ }
23
+ return [
24
+ {
25
+ ele: 'title',
26
+ label: '基础',
27
+ size: 'small',
28
+ groupKey: 'content',
29
+ },
30
+ {
31
+ label: "业务线",
32
+ ele: "xd-choose-namespace",
33
+ valueKey: "xnamespace",
34
+ value: dataVal({ data, key: 'xnamespace', dValue: null, gValue }),
35
+ className: 'input100',
36
+ placeholder: '请选择业务线',
37
+ labelInline: true,
38
+ groupKey: 'content',
39
+ notice: '空继承上级业务线',
40
+ inline: false,
41
+ handleCustom: (cb) => {
42
+ XdBus.getParentApi('getOptionsNamespaces')()
43
+ .then(res => {
44
+ cb(res.list)
45
+ })
46
+ .catch();
47
+ }
48
+ },
49
+ {
50
+ ele: 'title',
51
+ label: '组件样式',
52
+ size: 'small',
53
+ groupKey: 'content',
54
+ },
55
+ {
56
+ label: "组件样式",
57
+ ele: "xd-style-image",
58
+ groupKey: 'content',
59
+ valueKey: "is_title",
60
+ value: customVal({
61
+ data,
62
+ key: 'is_title',
63
+ gValue,
64
+ sValue: 'Y'
65
+ }),
66
+ labelInline: true,
67
+ className: 'input100',
68
+ handleCustom(cusRes) {
69
+ XdBus.getParentApi('getCompStylesOptions')({
70
+ layout_ids: '6XhHNXn8Az9OSz6Xhojsj',
71
+ key: Date.now()
72
+ })
73
+ .then(res => {
74
+ console.log(res, 'res')
75
+ cusRes.data.cb(res)
76
+ })
77
+ .catch(error => {
78
+ console.error(error);
79
+ });
80
+ },
81
+ },
82
+ { ele: 'group_start' },
83
+ {
84
+ label: '展示效果',
85
+ ele: 'xd-radio',
86
+ valueKey: 'showType',
87
+ value: dataVal({ data, key: 'showType', dValue: 'list', gValue }),
88
+ groupKey: 'content',
89
+ multiple: false,
90
+ labelInline: true,
91
+ className: 'input80',
92
+ list: [
93
+ { label: '静态展示', value: 'list' },
94
+ { label: '左右滑动', value: 'slide' },
95
+ ],
96
+ },
97
+ {
98
+ label: "标题风格",
99
+ ele: "xd-style-image",
100
+ groupKey: 'content',
101
+ valueKey: "title_type",
102
+ value: customVal({
103
+ data,
104
+ key: 'title_type',
105
+ gValue,
106
+ sValue: 'default'
107
+ }),
108
+ labelInline: true,
109
+ className: 'input100',
110
+ hidden: data['is_title']==='N',
111
+ handleCustom(cusRes) {
112
+ XdBus.getParentApi('getCompStylesOptions')({
113
+ layout_ids: '8k1cXJFKMVQtBeoiubB0t',
114
+ key: Date.now()
115
+ })
116
+ .then(res => {
117
+ console.log(res, 'res')
118
+ cusRes.data.cb(res)
119
+ })
120
+ .catch(error => {
121
+ console.error(error);
122
+ });
123
+ },
124
+ },
125
+ {
126
+ label: '查看更多',
127
+ ele: 'xd-radio',
128
+ valueKey: 'isMore',
129
+ value: dataVal({ data, key: 'isMore', dValue: 'Y', gValue }),
130
+ groupKey: 'content',
131
+ multiple: false,
132
+ labelInline: true,
133
+ className: 'input80',
134
+ hidden: data['is_title'] === 'N' || data['title_type'] === 'three' || data['title_type'] === 'five',
135
+ list: [
136
+ { label: '显示', value: 'Y' },
137
+ { label: '隐藏', value: 'N' },
138
+ ]
139
+ },
140
+ {
141
+ label: '',
142
+ ele: 'el-input',
143
+ type: 'text',
144
+ groupKey: 'content',
145
+ valueKey: 'moreName',
146
+ value: dataVal({ data, key: 'moreName', dValue: '更多', gValue }),
147
+ cusStyle: { paddingLeft: '100px' },
148
+ hidden: data['isMore'] === 'N' || data['is_title'] === 'N' || data['title_type'] === 'three' || data['title_type'] === 'five',
149
+ inline: false,
150
+ className: 'input80',
151
+ rules: [{
152
+ validator: (rule, value, callback) => {
153
+ let errorStr = '';
154
+ if (value.length > 4) {
155
+ errorStr = `最大长度不能超过4个汉字`;
156
+ }
157
+ if (errorStr) {
158
+ callback(errorStr)
159
+ return
160
+ }
161
+
162
+ callback()
163
+ }, message: '输入名称内容最多4字', trigger: ['blur', 'change']
164
+ }]
165
+ },
166
+ { ele: 'group_end' },
167
+ {
168
+ label: "列表布局",
169
+ ele: "xd-style-image",
170
+ groupKey: 'content',
171
+ valueKey: "row_num",
172
+ cusStyle: { marginTop: '10px' },
173
+ value: dataVal({ data, key: 'row_num', dValue: 2, gValue }),
174
+ labelInline: true,
175
+ hidden: data['showType']==='slide',
176
+ className: 'input100',
177
+ handleCustom(cusRes) {
178
+ XdBus.getParentApi('getCompStylesOptions')({
179
+ layout_ids: 'FzCwxOH7MQpT5ISYs8Xm6',
180
+ key: Date.now()
181
+ })
182
+ .then(res => {
183
+ res.list = res.list.filter(item => item.value != 4)
184
+ res.list.map(item => {
185
+ item.value = Number(item.value)
186
+ return item;
187
+ })
188
+ cusRes.data.cb(res)
189
+ })
190
+ .catch(error => {
191
+ console.error(error);
192
+ });
193
+ },
194
+ },
195
+ {
196
+ label: "商品条数",
197
+ groupKey: 'content',
198
+ ele: 'el-input',
199
+ valueKey: "product_limit",
200
+ cusStyle: { marginTop: '10px' },
201
+ value: dataVal({ data, key: 'product_limit', dValue: 6, gValue }),
202
+ type: 'text',
203
+ groupKey: 'content',
204
+ labelInline: true,
205
+ className: 'input80',
206
+ },
207
+ {
208
+ label: "商品样式",
209
+ ele: "xd-style-image",
210
+ groupKey: 'content',
211
+ valueKey: "productStyle",
212
+ cusStyle: { marginBottom: '5px' },
213
+ value: customVal({
214
+ data,
215
+ key: 'productStyle',
216
+ fields: { 'itemBgColorStatus': ['itemBgColor'], 'itemBorder': ['itemBorder', 'bs'] },
217
+ gValue,
218
+ sValue: "{\"border\":0,\"backgroundColor\":\"#fff\"}",
219
+ }),
220
+ labelInline: true,
221
+ className: 'input100',
222
+ handleCustom(cusRes) {
223
+ XdBus.getParentApi('getCompStylesOptions')({
224
+ layout_ids: 'Y4oxNuIUOgVMaTD1LeWxp',
225
+ key: Date.now()
226
+ })
227
+ .then(res => {
228
+ cusRes.data.cb(res)
229
+ })
230
+ .catch(error => {
231
+ console.error(error);
232
+ });
233
+ },
234
+ },
235
+ {
236
+ ele: 'title',
237
+ label: '展示内容',
238
+ size: 'small',
239
+ groupKey: 'content',
240
+ },
241
+ {
242
+ label: '品牌',
243
+ ele: 'xd-cus-switch',
244
+ valueKey: 'is_show_brand',
245
+ value: dataVal({ data, key: 'is_show_brand', dValue: 'N', gValue }),
246
+ className: 'input100',
247
+ groupKey: 'content',
248
+ labelInline: true,
249
+ cusStyle: { marginBottom: '10px' },
250
+ setting: {
251
+ tips: ['显示', '隐藏'],
252
+ isBackType: 'string'
253
+ },
254
+ },
255
+ {
256
+ ele: 'xd-line',
257
+ groupKey: 'content'
258
+ },
259
+ {
260
+ label: '购物车',
261
+ ele: 'xd-cus-switch',
262
+ valueKey: 'isAddCart',
263
+ value: dataVal({ data, key: 'isAddCart', dValue: 'Y', gValue }),
264
+ className: 'input100',
265
+ groupKey: 'content',
266
+ labelInline: true,
267
+ cusStyle: { marginBottom: '10px' },
268
+ setting: {
269
+ tips: ['显示', '隐藏'],
270
+ isBackType: 'string'
271
+ },
272
+ },
273
+ { ele: 'group_start' },
274
+ {
275
+ label: "",
276
+ ele: "xd-style-image",
277
+ groupKey: 'content',
278
+ valueKey: "cartStyle",
279
+ hidden: data['isAddCart'] !== 'Y',
280
+ value: cartStyle,
281
+ labelInline: true,
282
+ isKey: isKey,
283
+ key: reKey,
284
+ //isTplRef:true, //内容引用模版被禁用
285
+ className: 'input100',
286
+ handleCustom(cusRes) {
287
+ XdBus.getParentApi('getCompStylesOptions')({
288
+ layout_ids: 'ngwFA8G8RzLuFHyv5cMCl',
289
+ key: Date.now()
290
+ })
291
+ .then(res => {
292
+ if (cellNum === 1 || cellNum === 4 || cellNum === 2) {
293
+ cusRes.data.cb(res)
294
+ }
295
+ else {
296
+ res.list = res.list.filter(item => {
297
+ return item.value.indexOf('btn_') === -1
298
+ });
299
+ cusRes.data.cb(res)
300
+ }
301
+
302
+ })
303
+ .catch(error => {
304
+ console.error(error);
305
+ });
306
+ },
307
+ },
308
+ (data['isAddCart'] === 'Y' && data['cartStyle'] && data['cartStyle'].indexOf('btn_cart') === 0) && {
309
+ label: '按钮文字',
310
+ ele: 'el-input',
311
+ type: 'text',
312
+ valueKey: 'cartName',
313
+ value: dataVal({ data, key: 'cartName', dValue: '', gValue }),
314
+ placeholder: '请输入按钮文字,默认值:购买',
315
+ className: 'input100',
316
+ labelInline: true,
317
+ groupKey: 'content',
318
+ rules: [
319
+ {
320
+ required: false,
321
+ validator: (rule, value, callback) => {
322
+ if (typeof value === "string") value = value.trim();
323
+ // if(value.length === 0){
324
+ // callback('按钮文字不能为空');
325
+ // return
326
+ // }
327
+ if (value.length > 3) {
328
+ callback('按钮文字长度为:1-3字符');
329
+ return
330
+ }
331
+ callback();
332
+ },
333
+ trigger: ['blur', 'change']
334
+ }
335
+ ]
336
+ },
337
+ { ele: 'group_end' },
338
+ ...options,
339
+ {
340
+ ele: 'xd-line',
341
+ groupKey: 'content',
342
+ },
343
+ {
344
+ label: '价格',
345
+ ele: 'xd-cus-switch',
346
+ valueKey: 'isPrice',
347
+ value: dataVal({ data, key: 'isPrice', dValue: 'Y', gValue }),
348
+ className: 'input100',
349
+ groupKey: 'content',
350
+ labelInline: true,
351
+ cusStyle: { marginBottom: '10px' },
352
+ setting: {
353
+ tips: ['显示', '隐藏'],
354
+ isBackType: 'string'
355
+ },
356
+ },
357
+ {
358
+ ele: 'xd-line',
359
+ groupKey: 'content',
360
+ hidden: data.isPrice !== 'Y',
361
+ },
362
+ {
363
+ label: '划线价',
364
+ ele: 'xd-cus-switch',
365
+ valueKey: 'isShowDiscount',
366
+ value: dataVal({ data, key: 'isShowDiscount', dValue: 'Y', gValue }),
367
+ className: 'input100',
368
+ labelInline: true,
369
+ groupKey: 'content',
370
+ hidden: data.isPrice !== 'Y',
371
+ setting: {
372
+ tips: ['显示', '隐藏'],
373
+ isBackType: 'string'
374
+ },
375
+ },
376
+ { ele: 'group_start' },
377
+ {
378
+ label: '差值',
379
+ ele: 'el-input',
380
+ type: 'number',
381
+ valueKey: 'differ',
382
+ labelInline: true,
383
+ value: dataVal({ data, key: 'differ', dValue: '', gValue }),
384
+ hidden: data.isShowDiscount !== 'Y' || data.isPrice !== 'Y',
385
+ groupKey: 'content',
386
+ placeholder: '价差,默认值:1',
387
+ className: 'input80',
388
+ notice: '划线价取市场价,市场价-售价差值大于等于设置值时展示',
389
+ inline: false
390
+ },
391
+ { ele: 'group_end' },
392
+ ].filter(i => i);
393
+ }