xyvcard-goods 0.0.20 → 0.0.22

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 (40) hide show
  1. package/dist/ImageUpload-Dk6GY6PA.mjs +93 -0
  2. package/dist/{edit-Cj13W2TC.mjs → edit-Byv9oYAC.mjs} +1 -1
  3. package/dist/{edit-Bb2XgE0h.mjs → edit-Nuaz9WSB.mjs} +160 -244
  4. package/dist/edit-exVf8d8b.mjs +367 -0
  5. package/dist/edit.vue_vue_type_script_setup_true_lang-DuSBj1Mm.mjs +24172 -0
  6. package/dist/{goodsList-DOXK1EwK.mjs → goodsList-CZUqc4nm.mjs} +1 -1
  7. package/dist/goodsList-IWDAvKOx.mjs +4 -0
  8. package/dist/goodsList.vue_vue_type_script_setup_true_lang-BhJn02Ym.mjs +576 -0
  9. package/dist/{goodsList.vue_vue_type_script_setup_true_lang-COJVlEjX.mjs → goodsList.vue_vue_type_script_setup_true_lang-CuzIDtTN.mjs} +51 -50
  10. package/dist/{index-CGAoZY87.mjs → index-4i7TnWvV.mjs} +2 -3
  11. package/dist/index-BVGn6Q_T.mjs +53 -0
  12. package/dist/{index-DAJiqOCh.mjs → index-B_U2s9fI.mjs} +2 -2
  13. package/dist/{index-C3FT_Oe7.mjs → index-CQIttgns.mjs} +1 -1
  14. package/dist/{index-D3w33Nba.mjs → index-Dvaotk7B.mjs} +92 -68
  15. package/dist/{index-BmOxm1P2.mjs → index-_xxSoBUe.mjs} +1 -1
  16. package/dist/index.mjs +561 -538
  17. package/dist/{info-DImlMNq0.mjs → info-BH4MW3Sw.mjs} +2 -2
  18. package/dist/info-BQaaTFry.mjs +365 -0
  19. package/dist/sku-B-IzfYLq.mjs +52 -0
  20. package/dist/skuForm-AMIoZkH-.mjs +287 -0
  21. package/dist/{skuForm-Bt3arW0s.mjs → skuForm-CgjMd46J.mjs} +16 -16
  22. package/dist/{skuTable-Ahc3WlPp.mjs → skuTable-CyGQuTvR.mjs} +208 -255
  23. package/dist/skuTable-DDWSmvoz.mjs +592 -0
  24. package/dist/style.css +1 -1
  25. package/dts/api/dict.d.ts +3 -0
  26. package/dts/api/goods-sku/types.d.ts +2 -2
  27. package/dts/api/goods-spu/index.d.ts +1 -0
  28. package/dts/api/goods-spu/types.d.ts +18 -1
  29. package/dts/api/index.d.ts +2 -1
  30. package/dts/constant.d.ts +4 -0
  31. package/dts/lang/goods/zh-cn.d.ts +6 -1
  32. package/dts/router/index.d.ts +1 -0
  33. package/dts/views/goods/goods-combination/edit.vue.d.ts +2 -0
  34. package/dts/views/goods/goods-combination/goodsList.vue.d.ts +14 -0
  35. package/dts/views/goods/goods-combination/index.vue.d.ts +2 -0
  36. package/dts/views/goods/goods-combination/info.vue.d.ts +2 -0
  37. package/dts/views/goods/goods-combination/skuForm.vue.d.ts +20 -0
  38. package/dts/views/goods/goods-combination/skuTable.vue.d.ts +40 -0
  39. package/package.json +62 -61
  40. package/dist/edit.vue_vue_type_script_setup_true_lang-D2w1583D.mjs +0 -234
@@ -0,0 +1,287 @@
1
+ import { defineComponent as D, openBlock as _, createElementBlock as T, createElementVNode as z, ref as V, watch as C, resolveComponent as c, createBlock as b, withCtx as r, createVNode as o, unref as g, Fragment as M, renderList as Y, createCommentVNode as G, createTextVNode as H, toDisplayString as x } from "vue";
2
+ import { useI18n as J } from "vue-i18n";
3
+ import { D as E, C as v } from "./index-Dvaotk7B.mjs";
4
+ import { goodsSpuApi as K } from "./index.mjs";
5
+ import "jmash-core";
6
+ import { specValueApi as Q } from "xyvcard-shop";
7
+ import { _ as W } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
8
+ /*! Element Plus Icons Vue v2.3.1 */
9
+ var X = /* @__PURE__ */ D({
10
+ name: "Plus",
11
+ __name: "plus",
12
+ setup(I) {
13
+ return (y, P) => (_(), T("svg", {
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ viewBox: "0 0 1024 1024"
16
+ }, [
17
+ z("path", {
18
+ fill: "currentColor",
19
+ d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
20
+ })
21
+ ]));
22
+ }
23
+ }), Z = X;
24
+ const w = /* @__PURE__ */ D({
25
+ __name: "skuForm",
26
+ props: {
27
+ form: {
28
+ type: Object,
29
+ default: () => {
30
+ }
31
+ }
32
+ },
33
+ emits: ["getGoodsSku", "getFormData"],
34
+ setup(I, { emit: y }) {
35
+ const { t: P } = J(), k = V([]), d = V([
36
+ {
37
+ salePrice: 0,
38
+ skuId: "",
39
+ spuId: "",
40
+ spuName: "",
41
+ saleNum: 0,
42
+ picUrl: "",
43
+ specType: "",
44
+ skuOptions: []
45
+ }
46
+ ]);
47
+ E.goodsSpuBizDict.useValues();
48
+ const $ = y;
49
+ function B(l, e) {
50
+ l.picUrl = e;
51
+ }
52
+ const S = I;
53
+ C(
54
+ S.form,
55
+ (l) => l,
56
+ {
57
+ deep: !0,
58
+ immediate: !0
59
+ }
60
+ ), S.form.spuId;
61
+ function F(l) {
62
+ const e = d.value.indexOf(l.row);
63
+ e !== 0 && d.value.splice(e, 1);
64
+ }
65
+ function O() {
66
+ d.value.push({
67
+ salePrice: 0,
68
+ skuId: "",
69
+ spuId: "",
70
+ spuName: "",
71
+ saleNum: 0,
72
+ picUrl: "",
73
+ specType: "",
74
+ skuOptions: []
75
+ });
76
+ }
77
+ const N = V({});
78
+ async function j(l) {
79
+ if (!k.value[l])
80
+ try {
81
+ const { data: e } = await Q.findById({
82
+ specValueId: l
83
+ });
84
+ return k.value[l] = e.valueName, e.valueName;
85
+ } catch {
86
+ }
87
+ }
88
+ async function A(l, e) {
89
+ var n, p;
90
+ if (e.skuId = "", e.skuOptions = [], e.picUrl = "", e.salePrice = 0, e.saleNum = 0, !l) {
91
+ e.skuId = "", e.picUrl = "", e.salePrice = 0, e.saleNum = 0, e.skuOptions = [];
92
+ return;
93
+ }
94
+ try {
95
+ const { data: u } = await K.findById({ spuId: l });
96
+ if (e.specType = u.specType, e.specType === v.SPEC_TYPE.UNIFIED_SPEC && (e.picUrl = u.picUrls ? u.picUrls.split(",")[0] : "", e.salePrice = (n = u.skuList) == null ? void 0 : n.results[0].salePrice, e.saleNum = (p = u.skuList) == null ? void 0 : p.results[0].stock), e.specType === v.SPEC_TYPE.MULTI_SPEC && u.skuList) {
97
+ const m = u.skuList.results, f = m.map((s) => s.specValues && Array.isArray(s.specValues) ? s.specValues.map(
98
+ (i) => i.specValueId
99
+ ) : []), h = f.flat().map((s) => j(s));
100
+ await Promise.all(h);
101
+ const U = f.map(
102
+ (s) => s.map((i) => k.value[i] || i)
103
+ );
104
+ e.skuOptions = m.map((s, i) => ({
105
+ key: s.skuId,
106
+ value: U[i].join(", "),
107
+ picUrl: s.picUrl || (u.picUrls ? u.picUrls.split(",")[0] : ""),
108
+ salePrice: s.salePrice,
109
+ stock: s.stock
110
+ })), m.forEach((s) => {
111
+ s.skuId && (N.value[s.skuId] = {
112
+ ...s,
113
+ spuPicUrls: u.picUrls
114
+ });
115
+ });
116
+ }
117
+ } catch {
118
+ }
119
+ }
120
+ function L(l) {
121
+ const e = d.value.find((n) => n.skuId === l);
122
+ if (e && l) {
123
+ const n = N.value[l];
124
+ if (n) {
125
+ const p = n.spuPicUrls ? n.spuPicUrls.split(",")[0] : "";
126
+ e.picUrl = n.picUrl || p, e.salePrice = n.salePrice, e.saleNum = n.stock;
127
+ }
128
+ }
129
+ }
130
+ return C(
131
+ d,
132
+ (l) => {
133
+ $("getGoodsSku", l);
134
+ },
135
+ {
136
+ deep: !0,
137
+ immediate: !0
138
+ }
139
+ ), (l, e) => {
140
+ const n = c("jmash-select"), p = c("el-table-column"), u = c("el-option"), m = c("el-select"), f = c("jmash-single-image-upload"), h = c("el-input-number"), U = c("DeleteFilled"), s = c("el-icon"), i = c("el-table"), R = c("el-button"), q = c("el-row");
141
+ return _(), b(q, null, {
142
+ default: r(() => [
143
+ o(i, {
144
+ data: d.value,
145
+ border: "",
146
+ style: { width: "100%" }
147
+ }, {
148
+ default: r(() => [
149
+ o(p, {
150
+ label: l.$t("goodsSpu.spuName"),
151
+ prop: "spuId",
152
+ "header-align": "center"
153
+ }, {
154
+ default: r(({ row: a }) => [
155
+ o(n, {
156
+ modelValue: a.spuId,
157
+ "onUpdate:modelValue": (t) => a.spuId = t,
158
+ data: g(E).goodsSpuBizDict.values,
159
+ filterable: "",
160
+ clearable: "",
161
+ placeholder: l.$t("goodsSpu.spuNameRequireds"),
162
+ class: "w-full",
163
+ onChange: (t) => A(a.spuId, a)
164
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data", "placeholder", "onChange"])
165
+ ]),
166
+ _: 1
167
+ }, 8, ["label"]),
168
+ o(p, {
169
+ label: l.$t("goodsSpu.specType"),
170
+ prop: "skuId",
171
+ "header-align": "center"
172
+ }, {
173
+ default: r(({ row: a }) => [
174
+ o(m, {
175
+ modelValue: a.skuId,
176
+ "onUpdate:modelValue": (t) => a.skuId = t,
177
+ placeholder: l.$t("goodsSpu.specTypeRequired"),
178
+ disabled: a.specType === g(v).SPEC_TYPE.UNIFIED_SPEC,
179
+ onChange: (t) => L(a.skuId)
180
+ }, {
181
+ default: r(() => [
182
+ (_(!0), T(M, null, Y(a.skuOptions, (t) => (_(), b(u, {
183
+ key: t.key,
184
+ label: t.value,
185
+ value: t.key
186
+ }, null, 8, ["label", "value"]))), 128))
187
+ ]),
188
+ _: 2
189
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled", "onChange"])
190
+ ]),
191
+ _: 1
192
+ }, 8, ["label"]),
193
+ o(p, {
194
+ label: l.$t("goodsSpu.picUrls"),
195
+ prop: "picUrl",
196
+ width: "105",
197
+ "header-align": "center"
198
+ }, {
199
+ default: r(({ row: a }) => [
200
+ o(f, {
201
+ "picture-url": a.picUrl,
202
+ onImageSrc: (t) => B(a, t),
203
+ width: 80,
204
+ type: "trans"
205
+ }, null, 8, ["picture-url", "onImageSrc"])
206
+ ]),
207
+ _: 1
208
+ }, 8, ["label"]),
209
+ o(p, {
210
+ label: l.$t("goodsSpu.salePriceV1"),
211
+ prop: "salePrice",
212
+ "header-align": "center"
213
+ }, {
214
+ default: r(({ row: a }) => [
215
+ o(h, {
216
+ modelValue: a.salePrice,
217
+ "onUpdate:modelValue": (t) => a.salePrice = t,
218
+ precision: 2,
219
+ min: 0,
220
+ placeholder: l.$t("goodsSpu.salePriceV1Required"),
221
+ class: "w-full",
222
+ controls: !1
223
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
224
+ ]),
225
+ _: 1
226
+ }, 8, ["label"]),
227
+ o(p, {
228
+ label: l.$t("goodsSpu.saleNums"),
229
+ prop: "saleNum",
230
+ "header-align": "center"
231
+ }, {
232
+ default: r(({ row: a }) => [
233
+ o(h, {
234
+ modelValue: a.saleNum,
235
+ "onUpdate:modelValue": (t) => a.saleNum = t,
236
+ placeholder: l.$t("goodsSpu.saleNumRequireds"),
237
+ class: "w-full",
238
+ controls: !1,
239
+ precision: 0,
240
+ min: 0
241
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
242
+ ]),
243
+ _: 1
244
+ }, 8, ["label"]),
245
+ o(p, {
246
+ label: l.$t("common.operate"),
247
+ width: "60",
248
+ align: "center"
249
+ }, {
250
+ default: r((a) => [
251
+ a.$index !== 0 ? (_(), b(s, {
252
+ key: 0,
253
+ onClick: (t) => F(a),
254
+ size: "18",
255
+ style: { cursor: "pointer", color: "inherit" },
256
+ class: "hover-blue"
257
+ }, {
258
+ default: r(() => [
259
+ o(U)
260
+ ]),
261
+ _: 2
262
+ }, 1032, ["onClick"])) : G("", !0)
263
+ ]),
264
+ _: 1
265
+ }, 8, ["label"])
266
+ ]),
267
+ _: 1
268
+ }, 8, ["data"]),
269
+ o(R, {
270
+ icon: g(Z),
271
+ class: "addButton",
272
+ onClick: O
273
+ }, {
274
+ default: r(() => [
275
+ H(x(g(P)("common.add")), 1)
276
+ ]),
277
+ _: 1
278
+ }, 8, ["icon"])
279
+ ]),
280
+ _: 1
281
+ });
282
+ };
283
+ }
284
+ }), ue = /* @__PURE__ */ W(w, [["__scopeId", "data-v-429eb573"]]);
285
+ export {
286
+ ue as default
287
+ };
@@ -1,6 +1,6 @@
1
- import { defineComponent as te, ref as S, computed as se, watch as $, resolveComponent as i, openBlock as m, createElementBlock as g, Fragment as b, unref as M, createVNode as o, withCtx as a, createCommentVNode as I, renderList as P, createElementVNode as k, toDisplayString as O, createTextVNode as y, createBlock as w } from "vue";
2
- import { C as D, D as ue, S as Y, a as ne } from "./index-D3w33Nba.mjs";
3
- import re from "./skuTable-Ahc3WlPp.mjs";
1
+ import { defineComponent as te, ref as S, computed as se, watch as $, resolveComponent as i, openBlock as m, createElementBlock as g, Fragment as k, unref as M, createVNode as o, withCtx as a, createCommentVNode as I, renderList as P, createElementVNode as b, toDisplayString as O, createTextVNode as y, createBlock as w } from "vue";
2
+ import { C as D, D as ue, S as Y, a as ne } from "./index-Dvaotk7B.mjs";
3
+ import re from "./skuTable-CyGQuTvR.mjs";
4
4
  import { _ as de } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
5
5
  const pe = { key: 0 }, ce = {
6
6
  key: 1,
@@ -105,7 +105,7 @@ const pe = { key: 0 }, ce = {
105
105
  u.value[e].specValueList.splice(l, 1);
106
106
  }
107
107
  function X() {
108
- h.value = new ne({ shopId: v.form.shopId }), h.value.useValues().then((e) => {
108
+ h.value = new ne({ shopId: v.form.shopId }), console.log("handleSpecShow", h.value), h.value.useValues().then((e) => {
109
109
  e.forEach((l) => {
110
110
  Array.isArray(u.value) && u.value.length > 0 && u.value.forEach((t) => {
111
111
  l.key === t.id && (l.disabled = !0);
@@ -145,7 +145,7 @@ const pe = { key: 0 }, ce = {
145
145
  }
146
146
  return (e, l) => {
147
147
  const t = i("el-input-number"), n = i("el-form-item"), d = i("el-col"), p = i("el-row"), f = i("Delete"), le = i("el-icon"), oe = i("el-tag"), R = i("el-button"), N = i("el-option"), j = i("el-select"), A = i("el-popover"), B = i("el-tab-pane"), G = i("el-tabs");
148
- return m(), g(b, null, [
148
+ return m(), g(k, null, [
149
149
  v.specType == M(D).SPEC_TYPE.UNIFIED_SPEC ? (m(), g("div", pe, [
150
150
  o(p, null, {
151
151
  default: a(() => [
@@ -337,13 +337,13 @@ const pe = { key: 0 }, ce = {
337
337
  default: a(() => [
338
338
  o(B, { label: "商品规格" }, {
339
339
  default: a(() => [
340
- (m(!0), g(b, null, P(u.value, (s, V) => (m(), g("div", {
340
+ (m(!0), g(k, null, P(u.value, (s, V) => (m(), g("div", {
341
341
  class: "goods-spec",
342
342
  key: V
343
343
  }, [
344
- k("div", ie, [
345
- k("span", null, O(s.name), 1),
346
- k("span", {
344
+ b("div", ie, [
345
+ b("span", null, O(s.name), 1),
346
+ b("span", {
347
347
  class: "goods-delete",
348
348
  onClick: (c) => Q(V)
349
349
  }, [
@@ -356,9 +356,9 @@ const pe = { key: 0 }, ce = {
356
356
  l[9] || (l[9] = y("移除 "))
357
357
  ], 8, me)
358
358
  ]),
359
- k("div", fe, [
360
- k("div", ve, [
361
- (m(!0), g(b, null, P(u.value[V].specValueList, (c, ae) => (m(), w(oe, {
359
+ b("div", fe, [
360
+ b("div", ve, [
361
+ (m(!0), g(k, null, P(u.value[V].specValueList, (c, ae) => (m(), w(oe, {
362
362
  key: c,
363
363
  closable: "",
364
364
  type: "info",
@@ -394,7 +394,7 @@ const pe = { key: 0 }, ce = {
394
394
  onChange: (c) => x(c, V)
395
395
  }, {
396
396
  default: a(() => [
397
- (m(!0), g(b, null, P(_.value.values, (c) => (m(), w(N, {
397
+ (m(!0), g(k, null, P(_.value.values, (c) => (m(), w(N, {
398
398
  key: c.key,
399
399
  label: c.value,
400
400
  value: c.key,
@@ -431,7 +431,7 @@ const pe = { key: 0 }, ce = {
431
431
  onChange: Z
432
432
  }, {
433
433
  default: a(() => [
434
- (m(!0), g(b, null, P(h.value.values, (s) => (m(), w(N, {
434
+ (m(!0), g(k, null, P(h.value.values, (s) => (m(), w(N, {
435
435
  key: s.key,
436
436
  label: s.value,
437
437
  value: s.key,
@@ -469,7 +469,7 @@ const pe = { key: 0 }, ce = {
469
469
  ], 64);
470
470
  };
471
471
  }
472
- }), he = /* @__PURE__ */ de(Ve, [["__scopeId", "data-v-e6aa4b01"]]);
472
+ }), be = /* @__PURE__ */ de(Ve, [["__scopeId", "data-v-761a6cc9"]]);
473
473
  export {
474
- he as default
474
+ be as default
475
475
  };