xyvcard-goods 0.0.22 → 0.0.23

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 (37) hide show
  1. package/dist/{edit-Nuaz9WSB.mjs → edit-9jPSycsG.mjs} +185 -165
  2. package/dist/{edit-exVf8d8b.mjs → edit-CJpoa4Ck.mjs} +69 -68
  3. package/dist/{edit-DxnsmaXV.mjs → edit-CWQMgvVP.mjs} +38 -38
  4. package/dist/{edit-Byv9oYAC.mjs → edit-DU-BEAcq.mjs} +1 -1
  5. package/dist/{edit-BcokSKfN.mjs → edit-Ziwv43v0.mjs} +27 -27
  6. package/dist/{edit.vue_vue_type_script_setup_true_lang-DuSBj1Mm.mjs → edit.vue_vue_type_script_setup_true_lang-BP0C4d2-.mjs} +8 -7
  7. package/dist/{goodsList-CZUqc4nm.mjs → goodsList-2AwsJVoO.mjs} +1 -1
  8. package/dist/{goodsList-IWDAvKOx.mjs → goodsList-CyWliLjg.mjs} +1 -1
  9. package/dist/{goodsList.vue_vue_type_script_setup_true_lang-CuzIDtTN.mjs → goodsList.vue_vue_type_script_setup_true_lang-Bq06GIMe.mjs} +2 -2
  10. package/dist/{goodsList.vue_vue_type_script_setup_true_lang-BhJn02Ym.mjs → goodsList.vue_vue_type_script_setup_true_lang-DjKzEAB7.mjs} +136 -147
  11. package/dist/{index-4i7TnWvV.mjs → index-8E7BciYp.mjs} +7 -6
  12. package/dist/{index-BVGn6Q_T.mjs → index-B1H5hqEi.mjs} +2 -2
  13. package/dist/{index-B_U2s9fI.mjs → index-B88acg0Q.mjs} +2 -2
  14. package/dist/{index-_xxSoBUe.mjs → index-BdP_dXBK.mjs} +3 -3
  15. package/dist/index-C7oatDPl.mjs +4432 -0
  16. package/dist/{index-CQIttgns.mjs → index-DPjR32Kv.mjs} +3 -3
  17. package/dist/{index-r0u-27m7.mjs → index-DR3Gk44r.mjs} +1 -1
  18. package/dist/index-jCpYt-EU.mjs +221 -0
  19. package/dist/index.mjs +6 -2875
  20. package/dist/info-BEMxnD6-.mjs +325 -0
  21. package/dist/{info-BQaaTFry.mjs → info-DFIeVs66.mjs} +3 -3
  22. package/dist/{skuForm-CgjMd46J.mjs → skuForm-BhAbf2AG.mjs} +16 -16
  23. package/dist/skuForm-C2aQcL90.mjs +314 -0
  24. package/dist/{skuTable-CyGQuTvR.mjs → skuTable-9JJqGeRx.mjs} +255 -208
  25. package/dist/style.css +1 -1
  26. package/dts/api/goods-spu/index.d.ts +3 -1
  27. package/dts/api/goods-spu/types.d.ts +12 -1
  28. package/dts/index.d.ts +4 -0
  29. package/dts/router/index.d.ts +1 -0
  30. package/package.json +1 -1
  31. package/dist/index-DR7GlHNd.mjs +0 -1288
  32. package/dist/index-Dvaotk7B.mjs +0 -325
  33. package/dist/index-jTDhsbYM.mjs +0 -141
  34. package/dist/info-BH4MW3Sw.mjs +0 -365
  35. package/dist/sku-B-IzfYLq.mjs +0 -52
  36. package/dist/skuForm-AMIoZkH-.mjs +0 -287
  37. package/dist/skuTable-DDWSmvoz.mjs +0 -592
@@ -0,0 +1,314 @@
1
+ import { defineComponent as O, openBlock as m, createElementBlock as S, createElementVNode as M, ref as v, watch as $, resolveComponent as r, createBlock as h, withCtx as i, createVNode as c, unref as g, Fragment as Y, renderList as G, createCommentVNode as H, createTextVNode as x, toDisplayString as J } from "vue";
2
+ import { useI18n as K } from "vue-i18n";
3
+ import { D as B, C as U } from "./index-jCpYt-EU.mjs";
4
+ import { a as L } from "./index-C7oatDPl.mjs";
5
+ import { specValueApi as Q } from "xyvcard-shop";
6
+ import { _ as W } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
7
+ /*! Element Plus Icons Vue v2.3.1 */
8
+ var X = /* @__PURE__ */ O({
9
+ name: "Plus",
10
+ __name: "plus",
11
+ setup(b) {
12
+ return (N, C) => (m(), S("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ viewBox: "0 0 1024 1024"
15
+ }, [
16
+ M("path", {
17
+ fill: "currentColor",
18
+ 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"
19
+ })
20
+ ]));
21
+ }
22
+ }), Z = X;
23
+ const w = { key: 0 }, ee = /* @__PURE__ */ O({
24
+ __name: "skuForm",
25
+ props: {
26
+ form: {
27
+ type: Object,
28
+ default: () => {
29
+ }
30
+ }
31
+ },
32
+ emits: ["getGoodsSku", "getFormData"],
33
+ setup(b, { emit: N }) {
34
+ const { t: C } = K(), P = v([]), d = v([
35
+ {
36
+ salePrice: 0,
37
+ skuId: "",
38
+ spuId: "",
39
+ specInfo: "",
40
+ saleNum: 0,
41
+ picUrl: "",
42
+ specType: "",
43
+ skuOptions: []
44
+ }
45
+ ]);
46
+ B.goodsSpuBizDict.useValues();
47
+ const j = N;
48
+ function F(s, e) {
49
+ s.picUrl = e;
50
+ }
51
+ const y = b;
52
+ $(
53
+ y.form,
54
+ (s) => s,
55
+ {
56
+ deep: !0,
57
+ immediate: !0
58
+ }
59
+ ), y.form.spuId && L.findGroupList({ goodsId: y.form.spuId }).then(({ data: s }) => {
60
+ if (s && s.results.length > 0) {
61
+ d.value = [];
62
+ const e = s.results.map(async (l) => {
63
+ const t = {
64
+ salePrice: l.salePrice || 0,
65
+ skuId: l.skuId || "",
66
+ spuId: l.spuId || "",
67
+ saleNum: l.saleNum || 0,
68
+ picUrl: l.picUrl || "",
69
+ specType: "",
70
+ skuOptions: []
71
+ };
72
+ return await T(l.spuId, t), t.specType === U.SPEC_TYPE.MULTI_SPEC && l.skuId && (t.skuId = l.skuId || "", t.salePrice = l.salePrice || 0, t.saleNum = l.saleNum || 0, t.picUrl = l.picUrl || "", D(l.skuId)), t;
73
+ });
74
+ Promise.all(e).then((l) => {
75
+ d.value = l;
76
+ });
77
+ }
78
+ });
79
+ function A(s) {
80
+ const e = d.value.indexOf(s.row);
81
+ e !== 0 && d.value.splice(e, 1);
82
+ }
83
+ function R() {
84
+ d.value.push({
85
+ salePrice: 0,
86
+ skuId: "",
87
+ spuId: "",
88
+ specInfo: "",
89
+ saleNum: 0,
90
+ picUrl: "",
91
+ specType: "",
92
+ skuOptions: []
93
+ });
94
+ }
95
+ const E = v({});
96
+ async function q(s) {
97
+ if (!P.value[s])
98
+ try {
99
+ const { data: e } = await Q.findById({
100
+ specValueId: s
101
+ });
102
+ return P.value[s] = e.valueName, e.valueName;
103
+ } catch {
104
+ }
105
+ }
106
+ async function T(s, e) {
107
+ var l, t, k;
108
+ if (e.skuId = "", e.skuOptions = [], e.picUrl = "", e.salePrice = 0, e.saleNum = 0, !s) {
109
+ e.skuId = "", e.picUrl = "", e.salePrice = 0, e.saleNum = 0, e.skuOptions = [];
110
+ return;
111
+ }
112
+ try {
113
+ const { data: n } = await L.findById({ spuId: s });
114
+ if (e.specType = n.specType, e.specType === U.SPEC_TYPE.UNIFIED_SPEC && (e.picUrl = n.picUrls ? n.picUrls.split(",")[0] : "", e.salePrice = (l = n.skuList) == null ? void 0 : l.results[0].salePrice, e.saleNum = (t = n.skuList) == null ? void 0 : t.results[0].stock, e.skuId = (k = n.skuList) == null ? void 0 : k.results[0].skuId), e.specType === U.SPEC_TYPE.MULTI_SPEC && n.skuList) {
115
+ const f = n.skuList.results, _ = f.map((o) => o.specValues && Array.isArray(o.specValues) ? o.specValues.map(
116
+ (p) => p.specValueId
117
+ ) : []), V = _.flat().map((o) => q(o));
118
+ await Promise.all(V);
119
+ const I = _.map(
120
+ (o) => o.map((p) => P.value[p] || p)
121
+ );
122
+ e.skuOptions = f.map((o, p) => ({
123
+ key: o.skuId,
124
+ value: I[p].join(" "),
125
+ specInfo: I[p].join(" "),
126
+ picUrl: o.picUrl || (n.picUrls ? n.picUrls.split(",")[0] : ""),
127
+ salePrice: o.salePrice,
128
+ stock: o.stock
129
+ })), f.forEach((o, p) => {
130
+ o.skuId && (E.value[o.skuId] = {
131
+ ...o,
132
+ specInfo: I[p].join(" "),
133
+ spuPicUrls: n.picUrls
134
+ });
135
+ });
136
+ }
137
+ } catch {
138
+ }
139
+ }
140
+ function D(s) {
141
+ const e = d.value.find((l) => l.skuId === s);
142
+ if (e && s) {
143
+ const l = E.value[s];
144
+ if (l) {
145
+ const t = l.spuPicUrls ? l.spuPicUrls.split(",")[0] : "";
146
+ e.picUrl = l.picUrl || t, e.salePrice = l.salePrice, e.saleNum = l.stock, e.specInfo = l.specInfo;
147
+ }
148
+ }
149
+ }
150
+ return $(
151
+ d,
152
+ (s) => {
153
+ const e = s.filter((l) => l.spuId && l.skuId).map((l) => ({
154
+ salePrice: l.salePrice,
155
+ skuId: l.skuId,
156
+ spuId: l.spuId,
157
+ specInfo: l.specInfo,
158
+ saleNum: l.saleNum,
159
+ picUrl: l.picUrl
160
+ }));
161
+ j("getGoodsSku", e), console.log("filteredValue", e);
162
+ },
163
+ {
164
+ deep: !0,
165
+ immediate: !0
166
+ }
167
+ ), (s, e) => {
168
+ const l = r("jmash-select"), t = r("el-table-column"), k = r("el-option"), n = r("el-select"), f = r("jmash-single-image-upload"), _ = r("el-input-number"), V = r("DeleteFilled"), I = r("el-icon"), o = r("el-table"), p = r("el-button"), z = r("el-row");
169
+ return m(), h(z, null, {
170
+ default: i(() => [
171
+ c(o, {
172
+ data: d.value,
173
+ border: "",
174
+ style: { width: "100%" }
175
+ }, {
176
+ default: i(() => [
177
+ c(t, {
178
+ label: s.$t("goodsSpu.spuName"),
179
+ prop: "spuId",
180
+ "header-align": "center"
181
+ }, {
182
+ default: i(({ row: a }) => [
183
+ c(l, {
184
+ modelValue: a.spuId,
185
+ "onUpdate:modelValue": (u) => a.spuId = u,
186
+ data: g(B).goodsSpuBizDict.values,
187
+ filterable: "",
188
+ clearable: "",
189
+ placeholder: s.$t("goodsSpu.spuNameRequireds"),
190
+ class: "w-full",
191
+ onChange: (u) => T(a.spuId, a)
192
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data", "placeholder", "onChange"])
193
+ ]),
194
+ _: 1
195
+ }, 8, ["label"]),
196
+ c(t, {
197
+ label: s.$t("goodsSpu.specType"),
198
+ "header-align": "center"
199
+ }, {
200
+ default: i(({ row: a }) => [
201
+ a.specType === g(U).SPEC_TYPE.UNIFIED_SPEC ? (m(), S("span", w, " 统一规格 ")) : (m(), h(n, {
202
+ key: 1,
203
+ modelValue: a.skuId,
204
+ "onUpdate:modelValue": (u) => a.skuId = u,
205
+ placeholder: s.$t("goodsSpu.specTypeRequired"),
206
+ onChange: (u) => D(a.skuId)
207
+ }, {
208
+ default: i(() => [
209
+ (m(!0), S(Y, null, G(a.skuOptions, (u) => (m(), h(k, {
210
+ key: u.key,
211
+ label: u.value,
212
+ value: u.key
213
+ }, null, 8, ["label", "value"]))), 128))
214
+ ]),
215
+ _: 2
216
+ }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "onChange"]))
217
+ ]),
218
+ _: 1
219
+ }, 8, ["label"]),
220
+ c(t, {
221
+ label: s.$t("goodsSpu.picUrls"),
222
+ prop: "picUrl",
223
+ width: "105",
224
+ "header-align": "center"
225
+ }, {
226
+ default: i(({ row: a }) => [
227
+ c(f, {
228
+ "picture-url": a.picUrl,
229
+ onImageSrc: (u) => F(a, u),
230
+ width: 80,
231
+ type: "trans"
232
+ }, null, 8, ["picture-url", "onImageSrc"])
233
+ ]),
234
+ _: 1
235
+ }, 8, ["label"]),
236
+ c(t, {
237
+ label: s.$t("goodsSpu.salePriceV1"),
238
+ prop: "salePrice",
239
+ "header-align": "center"
240
+ }, {
241
+ default: i(({ row: a }) => [
242
+ c(_, {
243
+ modelValue: a.salePrice,
244
+ "onUpdate:modelValue": (u) => a.salePrice = u,
245
+ precision: 2,
246
+ min: 0,
247
+ placeholder: s.$t("goodsSpu.salePriceV1Required"),
248
+ class: "w-full",
249
+ controls: !1
250
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
251
+ ]),
252
+ _: 1
253
+ }, 8, ["label"]),
254
+ c(t, {
255
+ label: s.$t("goodsSpu.saleNums"),
256
+ prop: "saleNum",
257
+ "header-align": "center"
258
+ }, {
259
+ default: i(({ row: a }) => [
260
+ c(_, {
261
+ modelValue: a.saleNum,
262
+ "onUpdate:modelValue": (u) => a.saleNum = u,
263
+ placeholder: s.$t("goodsSpu.saleNumRequireds"),
264
+ class: "w-full",
265
+ controls: !1,
266
+ precision: 0,
267
+ min: 0
268
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
269
+ ]),
270
+ _: 1
271
+ }, 8, ["label"]),
272
+ c(t, {
273
+ label: s.$t("common.operate"),
274
+ width: "60",
275
+ align: "center"
276
+ }, {
277
+ default: i((a) => [
278
+ a.$index !== 0 ? (m(), h(I, {
279
+ key: 0,
280
+ onClick: (u) => A(a),
281
+ size: "18",
282
+ style: { cursor: "pointer", color: "inherit" },
283
+ class: "hover-blue"
284
+ }, {
285
+ default: i(() => [
286
+ c(V)
287
+ ]),
288
+ _: 2
289
+ }, 1032, ["onClick"])) : H("", !0)
290
+ ]),
291
+ _: 1
292
+ }, 8, ["label"])
293
+ ]),
294
+ _: 1
295
+ }, 8, ["data"]),
296
+ c(p, {
297
+ icon: g(Z),
298
+ class: "addButton",
299
+ onClick: R
300
+ }, {
301
+ default: i(() => [
302
+ x(J(g(C)("common.add")), 1)
303
+ ]),
304
+ _: 1
305
+ }, 8, ["icon"])
306
+ ]),
307
+ _: 1
308
+ });
309
+ };
310
+ }
311
+ }), ne = /* @__PURE__ */ W(ee, [["__scopeId", "data-v-f953fc89"]]);
312
+ export {
313
+ ne as default
314
+ };