xyvcard-goods 0.0.9 → 0.0.10

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.
Files changed (22) hide show
  1. package/dist/{approveFailIndex-DJf9bHab.mjs → approveFailIndex-B-VGnf1U.mjs} +1 -1
  2. package/dist/{approveFailIndex.vue_vue_type_script_setup_true_lang-mXqZdtba.mjs → approveFailIndex.vue_vue_type_script_setup_true_lang-CiIyafoQ.mjs} +113 -107
  3. package/dist/{auditIndex-CCkGsSy2.mjs → auditIndex-tEq8uYdA.mjs} +1 -1
  4. package/dist/{auditIndex.vue_vue_type_script_setup_true_lang-DHolmNaP.mjs → auditIndex.vue_vue_type_script_setup_true_lang-BW22LRCL.mjs} +118 -112
  5. package/dist/edit-FCXD46Ef.mjs +556 -0
  6. package/dist/{index-vcmJ06-Y.mjs → index-C9LeLF51.mjs} +158 -149
  7. package/dist/index.mjs +3 -3
  8. package/dist/{info-CPZykxS1.mjs → info-CScBSLKA.mjs} +1 -1
  9. package/dist/{saleIndex-CdAcvCzO.mjs → saleIndex-B7TBQOB6.mjs} +1 -1
  10. package/dist/{saleIndex.vue_vue_type_script_setup_true_lang-CLzVH-ix.mjs → saleIndex.vue_vue_type_script_setup_true_lang-B6wKXUcV.mjs} +134 -147
  11. package/dist/{shelfIndex-ZHuhzU_h.mjs → shelfIndex-BfsIMQfD.mjs} +1 -1
  12. package/dist/{shelfIndex.vue_vue_type_script_setup_true_lang-CTv-j8Xe.mjs → shelfIndex.vue_vue_type_script_setup_true_lang-C6RfhqIl.mjs} +114 -108
  13. package/dist/{skuForm-BSlT4TYd.mjs → skuForm-CRnWdE9n.mjs} +11 -5
  14. package/dist/{skuTable-DYmQYXk3.mjs → skuTable-Ck7bJzYP.mjs} +25 -24
  15. package/dist/style.css +1 -1
  16. package/dts/api/goods-spu/types.d.ts +1 -1
  17. package/dts/components/EnumRadio/index.vue.d.ts +4 -3
  18. package/dts/components/GoodsUpload/ImageUpload.vue.d.ts +10 -18
  19. package/dts/components/ImageUpload.vue.d.ts +36 -0
  20. package/dts/views/goods/goods-spu/skuForm.vue.d.ts +1 -1
  21. package/package.json +14 -14
  22. package/dist/edit-D37yka6Z.mjs +0 -470
@@ -0,0 +1,556 @@
1
+ import { defineComponent as j, ref as g, watchEffect as O, computed as W, resolveComponent as p, openBlock as B, createElementBlock as G, Fragment as Z, createVNode as e, withCtx as u, createElementVNode as y, reactive as A, watch as J, unref as t, createBlock as K, createCommentVNode as Q, createTextVNode as X } from "vue";
2
+ import { ElMessageBox as Y, ElMessage as F } from "element-plus";
3
+ import { fileApi as k, routerUtil as P } from "jmash-core";
4
+ import { useI18n as L } from "vue-i18n";
5
+ import { _ as x } from "./skuTable-Ck7bJzYP.mjs";
6
+ import { useRouter as ee, useRoute as le } from "vue-router";
7
+ import { D as m, C as oe } from "./index-CKeHa-Cx.mjs";
8
+ import { goodsSpuApi as D } from "./index.mjs";
9
+ import { g as te } from "./index-BHmGYIuc.mjs";
10
+ import { WangEditor as se } from "xyvcard-cms";
11
+ import ae from "./skuForm-CRnWdE9n.mjs";
12
+ const ue = ["src"], re = /* @__PURE__ */ j({
13
+ __name: "ImageUpload",
14
+ props: {
15
+ modelValue: {
16
+ type: String,
17
+ default: () => ""
18
+ },
19
+ listType: {
20
+ type: String,
21
+ default: "picture"
22
+ },
23
+ limit: {
24
+ type: Number,
25
+ default: 1e3
26
+ }
27
+ },
28
+ emits: ["update:modelValue"],
29
+ setup(b, { emit: i }) {
30
+ const { t: h } = L(), c = g(k.uploadUrl()), v = g(k.authHeader()), l = g(), _ = g(!1), T = g(""), q = b, f = g([]);
31
+ O(() => {
32
+ f.value = q.modelValue.split(",").filter(Boolean);
33
+ });
34
+ const U = W(
35
+ () => f.value.map((a) => ({ url: k.imageUrl(a), status: "success", uid: a }))
36
+ ), C = (a) => {
37
+ T.value = a.url, _.value = !0;
38
+ }, $ = (a) => {
39
+ const r = a.size / 1024 / 1024 < 2;
40
+ ["image/jpeg", "image/png", "image/gif", "image/jpg"].includes(a.type) && !r && Y.confirm(h("file.imageLtRequired"), h("file.warning"), {
41
+ confirmButtonText: h("common.confirm"),
42
+ cancelButtonText: h("common.cancel"),
43
+ type: "warning"
44
+ }).then(async () => {
45
+ }).catch(() => (f.value.splice(-1, 1), n(), !1));
46
+ }, R = (a) => {
47
+ f.value = f.value.filter((r) => k.imageUrl(r) !== a.url), n();
48
+ }, s = (a) => {
49
+ f.value.push(a.fileSrc), n();
50
+ }, o = i, n = () => {
51
+ o("update:modelValue", f.value.join(","));
52
+ };
53
+ return (a, r) => {
54
+ const V = p("Plus"), w = p("el-icon"), S = p("el-upload"), E = p("el-dialog");
55
+ return B(), G(Z, null, [
56
+ e(S, {
57
+ ref_key: "uploadImageRef",
58
+ ref: l,
59
+ "file-list": U.value,
60
+ "onUpdate:fileList": r[0] || (r[0] = (I) => U.value = I),
61
+ action: c.value,
62
+ headers: v.value,
63
+ limit: b.limit,
64
+ "list-type": b.listType,
65
+ "on-preview": C,
66
+ "before-upload": $,
67
+ "on-success": s,
68
+ "on-remove": R
69
+ }, {
70
+ default: u(() => [
71
+ e(w, null, {
72
+ default: u(() => [
73
+ e(V)
74
+ ]),
75
+ _: 1
76
+ })
77
+ ]),
78
+ _: 1
79
+ }, 8, ["file-list", "action", "headers", "limit", "list-type"]),
80
+ e(E, {
81
+ modelValue: _.value,
82
+ "onUpdate:modelValue": r[1] || (r[1] = (I) => _.value = I),
83
+ fullscreen: !0
84
+ }, {
85
+ default: u(() => [
86
+ y("img", {
87
+ src: T.value,
88
+ alt: ""
89
+ }, null, 8, ue)
90
+ ]),
91
+ _: 1
92
+ }, 8, ["modelValue"])
93
+ ], 64);
94
+ };
95
+ }
96
+ }), de = /* @__PURE__ */ x(re, [["__scopeId", "data-v-f10f6f7e"]]), ne = { class: "app-container" }, pe = { class: "search-container" }, ie = { class: "image-card" }, ve = /* @__PURE__ */ j({
97
+ __name: "edit",
98
+ setup(b) {
99
+ var R;
100
+ const { t: i } = L(), h = ee(), c = le(), v = g();
101
+ m.shopInfoBizDict.useValues(), m.goodsCategoryDict.useValues();
102
+ let l = A({
103
+ requestId: Math.random() * 10 + "",
104
+ updateMask: "shopId,spuName,categoryId,spuCode,freightType,freightAmount,picUrls,shelf,saleNum,sellPoint,specType,description",
105
+ skuSpecValues: [],
106
+ freightType: m.freightTypeEnum.values[0].key,
107
+ freightAmount: 0,
108
+ shelf: m.shelfDict.values[0].key,
109
+ specType: m.specTypeEnum.values[0].key,
110
+ shopId: (R = m.shopInfoBizDict.values[0]) == null ? void 0 : R.key
111
+ });
112
+ const _ = (s, o, n) => {
113
+ var r;
114
+ const a = (r = l.picUrls) == null ? void 0 : r.split(",").filter(Boolean);
115
+ if (a != null && a.length) {
116
+ if ((a == null ? void 0 : a.length) < 3)
117
+ return n(new Error(i("goodsSpu.imageListsError")));
118
+ n();
119
+ } else return n(new Error(i("goodsSpu.picUrlsRequired")));
120
+ }, T = A({
121
+ shopId: [
122
+ {
123
+ required: !0,
124
+ message: i("goodsSpu.shopIdRequired"),
125
+ trigger: "change"
126
+ }
127
+ ],
128
+ spuName: [
129
+ {
130
+ required: !0,
131
+ message: i("goodsSpu.spuNameRequired"),
132
+ trigger: "blur"
133
+ }
134
+ ],
135
+ categoryId: [
136
+ {
137
+ required: !0,
138
+ message: i("goodsSpu.categoryIdRequired"),
139
+ trigger: "change"
140
+ }
141
+ ],
142
+ spuCode: [
143
+ {
144
+ required: !0,
145
+ message: i("goodsSpu.spuCodeRequired"),
146
+ trigger: "change"
147
+ }
148
+ ],
149
+ freightType: [
150
+ {
151
+ required: !0,
152
+ message: i("goodsSpu.freightTypeRequired"),
153
+ trigger: "change"
154
+ }
155
+ ],
156
+ freightAmount: [
157
+ {
158
+ required: !0,
159
+ message: i("goodsSpu.freightAmountRequired"),
160
+ trigger: "blur"
161
+ }
162
+ ],
163
+ picUrls: [
164
+ {
165
+ validator: _,
166
+ trigger: "change"
167
+ }
168
+ ],
169
+ shelf: [
170
+ {
171
+ required: !0,
172
+ message: i("goodsSpu.shelfRequired"),
173
+ trigger: "change"
174
+ }
175
+ ],
176
+ specType: [
177
+ {
178
+ required: !0,
179
+ message: i("goodsSpu.specTypeRequired"),
180
+ trigger: "change"
181
+ }
182
+ ]
183
+ }), q = g(!1);
184
+ J(
185
+ () => l.shopId,
186
+ (s) => s,
187
+ {
188
+ deep: !0,
189
+ immediate: !0
190
+ }
191
+ );
192
+ function f(s) {
193
+ l.skuSpecValues.push(s), l.skuSpecValues = l.skuSpecValues.slice(-1);
194
+ }
195
+ function U(s) {
196
+ s.forEach((o) => {
197
+ var n;
198
+ l.specId = (n = o.specValues) == null ? void 0 : n.map((a) => a.specId), l.skuSpecValues.push(o);
199
+ }), l.skuSpecValues = l.skuSpecValues.slice(-s.length);
200
+ }
201
+ c.query.spuId && D.findById({ spuId: c.query.spuId }).then(({ data: s }) => {
202
+ Object.assign(l, s), q.value = !0, te.findById({ spuId: c.query.spuId }).then(({ data: o }) => {
203
+ l.ensureIds = o.ensures;
204
+ });
205
+ });
206
+ const C = async () => {
207
+ var s;
208
+ await ((s = v.value) == null ? void 0 : s.validate((o) => {
209
+ o && (c.query.spuId ? D.update(l).then((n) => {
210
+ n.status === 200 && (F({
211
+ message: i("common.submitSuccess"),
212
+ type: "success"
213
+ }), P.closeTagView(c.fullPath, h, !1));
214
+ }) : D.create(l).then((n) => {
215
+ n.status === 200 && (F({
216
+ message: i("common.submitSuccess"),
217
+ type: "success"
218
+ }), P.closeTagView(c.fullPath, h, !1));
219
+ }));
220
+ }));
221
+ };
222
+ function $(s) {
223
+ s === "FREIGHT_FREE" && (l.freightAmount = 0);
224
+ }
225
+ return (s, o) => {
226
+ const n = p("jmash-select"), a = p("el-form-item"), r = p("el-col"), V = p("el-input"), w = p("el-tree-select"), S = p("jmash-enum-radio"), E = p("el-input-number"), I = de, M = p("jmash-dict-checkbox"), N = p("el-row"), z = p("el-button"), H = p("el-form");
227
+ return B(), G("div", ne, [
228
+ y("div", pe, [
229
+ e(H, {
230
+ ref_key: "goodsSpuFormRef",
231
+ ref: v,
232
+ model: t(l),
233
+ "label-width": "120px",
234
+ rules: T
235
+ }, {
236
+ default: u(() => [
237
+ o[15] || (o[15] = y("div", { class: "title-content" }, "基本信息", -1)),
238
+ e(N, null, {
239
+ default: u(() => [
240
+ e(r, { span: 12 }, {
241
+ default: u(() => [
242
+ e(a, {
243
+ label: s.$t("goodsSpu.shopId"),
244
+ prop: "shopId"
245
+ }, {
246
+ default: u(() => [
247
+ e(n, {
248
+ modelValue: t(l).shopId,
249
+ "onUpdate:modelValue": o[0] || (o[0] = (d) => t(l).shopId = d),
250
+ placeholder: s.$t("goodsSpu.shopIdRequired"),
251
+ data: t(m).shopInfoBizDict.values,
252
+ filterable: "",
253
+ class: "w-full"
254
+ }, null, 8, ["modelValue", "placeholder", "data"])
255
+ ]),
256
+ _: 1
257
+ }, 8, ["label"])
258
+ ]),
259
+ _: 1
260
+ }),
261
+ e(r, { span: 12 }, {
262
+ default: u(() => [
263
+ e(a, {
264
+ label: s.$t("goodsSpu.spuName"),
265
+ prop: "spuName"
266
+ }, {
267
+ default: u(() => [
268
+ e(V, {
269
+ modelValue: t(l).spuName,
270
+ "onUpdate:modelValue": o[1] || (o[1] = (d) => t(l).spuName = d),
271
+ placeholder: s.$t("goodsSpu.spuNameRequired"),
272
+ maxlength: "60",
273
+ "show-word-limit": "",
274
+ clearable: ""
275
+ }, null, 8, ["modelValue", "placeholder"])
276
+ ]),
277
+ _: 1
278
+ }, 8, ["label"])
279
+ ]),
280
+ _: 1
281
+ }),
282
+ e(r, { span: 12 }, {
283
+ default: u(() => [
284
+ e(a, {
285
+ label: s.$t("goodsSpu.categoryId"),
286
+ prop: "categoryId"
287
+ }, {
288
+ default: u(() => [
289
+ e(w, {
290
+ modelValue: t(l).categoryId,
291
+ "onUpdate:modelValue": o[2] || (o[2] = (d) => t(l).categoryId = d),
292
+ data: t(m).goodsCategoryDict.values,
293
+ filterable: "",
294
+ clearable: "",
295
+ "check-strictly": "",
296
+ "render-after-expand": !1,
297
+ placeholder: s.$t("goodsSpu.categoryIdRequired"),
298
+ class: "w-full"
299
+ }, null, 8, ["modelValue", "data", "placeholder"])
300
+ ]),
301
+ _: 1
302
+ }, 8, ["label"])
303
+ ]),
304
+ _: 1
305
+ }),
306
+ e(r, { span: 12 }, {
307
+ default: u(() => [
308
+ e(a, {
309
+ label: s.$t("goodsSpu.spuCode"),
310
+ prop: "spuCode"
311
+ }, {
312
+ default: u(() => [
313
+ e(V, {
314
+ modelValue: t(l).spuCode,
315
+ "onUpdate:modelValue": o[3] || (o[3] = (d) => t(l).spuCode = d),
316
+ placeholder: s.$t("goodsSpu.spuCodeRequired"),
317
+ maxlength: "15",
318
+ "show-word-limit": "",
319
+ clearable: ""
320
+ }, null, 8, ["modelValue", "placeholder"])
321
+ ]),
322
+ _: 1
323
+ }, 8, ["label"])
324
+ ]),
325
+ _: 1
326
+ }),
327
+ e(r, { span: 12 }, {
328
+ default: u(() => [
329
+ e(a, {
330
+ label: s.$t("goodsSpu.freightType"),
331
+ prop: "freightType"
332
+ }, {
333
+ default: u(() => [
334
+ e(S, {
335
+ modelValue: t(l).freightType,
336
+ "onUpdate:modelValue": o[4] || (o[4] = (d) => t(l).freightType = d),
337
+ data: t(m).freightTypeEnum.values,
338
+ onChange: $
339
+ }, null, 8, ["modelValue", "data"])
340
+ ]),
341
+ _: 1
342
+ }, 8, ["label"])
343
+ ]),
344
+ _: 1
345
+ }),
346
+ e(r, { span: 12 }, {
347
+ default: u(() => [
348
+ e(a, {
349
+ label: s.$t("goodsSpu.freightAmount"),
350
+ prop: "freightAmount"
351
+ }, {
352
+ default: u(() => [
353
+ e(E, {
354
+ modelValue: t(l).freightAmount,
355
+ "onUpdate:modelValue": o[5] || (o[5] = (d) => t(l).freightAmount = d),
356
+ readonly: t(l).freightType === "FREIGHT_FREE",
357
+ precision: 2,
358
+ step: 0.1,
359
+ controls: !1,
360
+ min: 0,
361
+ placeholder: s.$t("goodsSpu.freightAmountRequired"),
362
+ class: "w-full"
363
+ }, null, 8, ["modelValue", "readonly", "placeholder"])
364
+ ]),
365
+ _: 1
366
+ }, 8, ["label"])
367
+ ]),
368
+ _: 1
369
+ }),
370
+ e(r, { span: 24 }, {
371
+ default: u(() => [
372
+ e(a, {
373
+ label: s.$t("goodsSpu.picUrls"),
374
+ prop: "picUrls"
375
+ }, {
376
+ default: u(() => [
377
+ y("div", ie, [
378
+ e(I, {
379
+ modelValue: t(l).picUrls,
380
+ "onUpdate:modelValue": o[6] || (o[6] = (d) => t(l).picUrls = d),
381
+ limit: 6,
382
+ "list-type": "picture-card"
383
+ }, null, 8, ["modelValue"]),
384
+ o[13] || (o[13] = y("div", { class: "red-color" }, " 推荐尺寸:100*100或同比例图片,最少上传3张 ", -1))
385
+ ])
386
+ ]),
387
+ _: 1
388
+ }, 8, ["label"])
389
+ ]),
390
+ _: 1
391
+ }),
392
+ e(r, { span: 12 }, {
393
+ default: u(() => [
394
+ e(a, {
395
+ label: s.$t("goodsSpu.shelf"),
396
+ prop: "shelf"
397
+ }, {
398
+ default: u(() => [
399
+ e(S, {
400
+ modelValue: t(l).shelf,
401
+ "onUpdate:modelValue": o[7] || (o[7] = (d) => t(l).shelf = d),
402
+ data: t(m).shelfDict.values
403
+ }, null, 8, ["modelValue", "data"])
404
+ ]),
405
+ _: 1
406
+ }, 8, ["label"])
407
+ ]),
408
+ _: 1
409
+ }),
410
+ e(r, { span: 12 }, {
411
+ default: u(() => [
412
+ e(a, {
413
+ label: s.$t("goodsSpu.saleNum"),
414
+ prop: "saleNum"
415
+ }, {
416
+ default: u(() => [
417
+ e(E, {
418
+ modelValue: t(l).saleNum,
419
+ "onUpdate:modelValue": o[8] || (o[8] = (d) => t(l).saleNum = d),
420
+ placeholder: s.$t("goodsSpu.saleNumRequired"),
421
+ class: "w-full",
422
+ min: 0,
423
+ controls: !1,
424
+ precision: 0
425
+ }, null, 8, ["modelValue", "placeholder"])
426
+ ]),
427
+ _: 1
428
+ }, 8, ["label"])
429
+ ]),
430
+ _: 1
431
+ }),
432
+ e(r, { span: 24 }, {
433
+ default: u(() => [
434
+ e(a, {
435
+ label: s.$t("goodsSpu.sellPoint"),
436
+ prop: "sellPoint"
437
+ }, {
438
+ default: u(() => [
439
+ e(V, {
440
+ modelValue: t(l).sellPoint,
441
+ "onUpdate:modelValue": o[9] || (o[9] = (d) => t(l).sellPoint = d),
442
+ placeholder: s.$t("goodsSpu.sellPointRequired"),
443
+ maxlength: "250",
444
+ "show-word-limit": "",
445
+ clearable: "",
446
+ rows: 4,
447
+ type: "textarea"
448
+ }, null, 8, ["modelValue", "placeholder"])
449
+ ]),
450
+ _: 1
451
+ }, 8, ["label"])
452
+ ]),
453
+ _: 1
454
+ }),
455
+ e(r, { span: 24 }, {
456
+ default: u(() => [
457
+ e(a, {
458
+ label: s.$t("goodsSpu.ensureIds"),
459
+ prop: "ensureIds"
460
+ }, {
461
+ default: u(() => [
462
+ e(M, {
463
+ modelValue: t(l).ensureIds,
464
+ "onUpdate:modelValue": o[10] || (o[10] = (d) => t(l).ensureIds = d),
465
+ "type-code": t(oe).DICT_GOODS_ENSURE
466
+ }, null, 8, ["modelValue", "type-code"])
467
+ ]),
468
+ _: 1
469
+ }, 8, ["label"])
470
+ ]),
471
+ _: 1
472
+ })
473
+ ]),
474
+ _: 1
475
+ }),
476
+ o[16] || (o[16] = y("div", { class: "title-content" }, "商品规格", -1)),
477
+ e(N, null, {
478
+ default: u(() => [
479
+ e(r, { span: 24 }, {
480
+ default: u(() => [
481
+ e(a, {
482
+ label: s.$t("goodsSpu.specType"),
483
+ prop: "specType"
484
+ }, {
485
+ default: u(() => [
486
+ e(S, {
487
+ modelValue: t(l).specType,
488
+ "onUpdate:modelValue": o[11] || (o[11] = (d) => t(l).specType = d),
489
+ data: t(m).specTypeEnum.values
490
+ }, null, 8, ["modelValue", "data"])
491
+ ]),
492
+ _: 1
493
+ }, 8, ["label"])
494
+ ]),
495
+ _: 1
496
+ }),
497
+ !t(c).query.spuId || q.value ? (B(), K(ae, {
498
+ key: 0,
499
+ "spec-type": t(l).specType,
500
+ form: t(l),
501
+ isDisabled: !t(l).shopId,
502
+ onGetGoodsSku: f,
503
+ onGetFormData: U
504
+ }, null, 8, ["spec-type", "form", "isDisabled"])) : Q("", !0)
505
+ ]),
506
+ _: 1
507
+ }),
508
+ o[17] || (o[17] = y("div", { class: "title-content" }, "商品详情", -1)),
509
+ e(N, null, {
510
+ default: u(() => [
511
+ e(r, { span: 24 }, {
512
+ default: u(() => [
513
+ e(a, {
514
+ label: s.$t("goodsSpu.description"),
515
+ prop: "description"
516
+ }, {
517
+ default: u(() => [
518
+ e(t(se), {
519
+ modelValue: t(l).description,
520
+ "onUpdate:modelValue": o[12] || (o[12] = (d) => t(l).description = d),
521
+ style: { width: "100%" }
522
+ }, null, 8, ["modelValue"])
523
+ ]),
524
+ _: 1
525
+ }, 8, ["label"])
526
+ ]),
527
+ _: 1
528
+ }),
529
+ e(a, null, {
530
+ default: u(() => [
531
+ e(z, {
532
+ type: "primary",
533
+ onClick: C
534
+ }, {
535
+ default: u(() => o[14] || (o[14] = [
536
+ X("保存")
537
+ ])),
538
+ _: 1
539
+ })
540
+ ]),
541
+ _: 1
542
+ })
543
+ ]),
544
+ _: 1
545
+ })
546
+ ]),
547
+ _: 1
548
+ }, 8, ["model", "rules"])
549
+ ])
550
+ ]);
551
+ };
552
+ }
553
+ });
554
+ export {
555
+ ve as default
556
+ };