xyvcard-goods 0.0.5 → 0.0.6

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