ts-glitter 14.2.8 → 14.3.0

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 (48) hide show
  1. package/cjbt8743y0.json +1 -0
  2. package/lowcode/Entry.js +29 -9
  3. package/lowcode/Entry.ts +28 -9
  4. package/lowcode/backend-manager/bg-recommend.js +4 -6
  5. package/lowcode/backend-manager/bg-recommend.ts +4 -6
  6. package/lowcode/cms-plugin/member-setting.js +36 -2
  7. package/lowcode/cms-plugin/member-setting.ts +36 -1
  8. package/lowcode/cms-plugin/shopping-rebate-setting.js +21 -6
  9. package/lowcode/cms-plugin/shopping-rebate-setting.ts +24 -8
  10. package/lowcode/glitter-base/route/wallet.js +11 -0
  11. package/lowcode/glitter-base/route/wallet.ts +14 -2
  12. package/lowcode/glitterBundle/plugins/editor-elem.js +32 -11
  13. package/lowcode/glitterBundle/plugins/editor-elem.ts +42 -12
  14. package/lowcode/public-components/checkout/index.js +35 -27
  15. package/lowcode/public-components/checkout/index.ts +111 -106
  16. package/lowcode/public-components/product/product-detail.js +182 -171
  17. package/lowcode/public-components/product/product-detail.ts +214 -196
  18. package/lowcode/public-components/user-manager/um-class.js +234 -193
  19. package/lowcode/public-components/user-manager/um-class.ts +230 -189
  20. package/lowcode/public-components/user-manager/um-rebate.js +13 -8
  21. package/lowcode/public-components/user-manager/um-rebate.ts +17 -12
  22. package/lowcode/public-components/user-manager/um-voucher.js +3 -3
  23. package/lowcode/public-components/user-manager/um-voucher.ts +3 -3
  24. package/package.json +1 -1
  25. package/src/api-public/controllers/ai-chat.js.map +1 -1
  26. package/src/api-public/controllers/app-release.js.map +1 -1
  27. package/src/api-public/controllers/article.js.map +1 -1
  28. package/src/api-public/controllers/post.js.map +1 -1
  29. package/src/api-public/controllers/shop.js +23 -12
  30. package/src/api-public/controllers/shop.js.map +1 -1
  31. package/src/api-public/controllers/shop.ts +36 -36
  32. package/src/api-public/controllers/user.js.map +1 -1
  33. package/src/api-public/services/EcInvoice.js.map +5 -1
  34. package/src/api-public/services/ai-robot.js.map +1 -1
  35. package/src/api-public/services/financial-service.d.ts +1 -0
  36. package/src/api-public/services/financial-service.js.map +1 -1
  37. package/src/api-public/services/post.js.map +1 -1
  38. package/src/api-public/services/rebate.d.ts +1 -0
  39. package/src/api-public/services/rebate.js +15 -0
  40. package/src/api-public/services/rebate.js.map +1 -1
  41. package/src/api-public/services/rebate.ts +21 -5
  42. package/src/api-public/services/shopping.js +0 -3
  43. package/src/api-public/services/shopping.js.map +1 -1
  44. package/src/api-public/services/shopping.ts +0 -4
  45. package/src/index.js +9 -4
  46. package/src/index.js.map +5 -1
  47. package/src/index.ts +7 -1
  48. package/src/services/template.js.map +1 -1
@@ -83,6 +83,7 @@ export class ProductDetail {
83
83
  <span class="mt-3">載入中</span>
84
84
  </div>`;
85
85
  }
86
+ gvc.addMtScript([{ src: `https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js` }], () => { }, () => { });
86
87
  gvc.glitter.addStyleLink(['https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css']);
87
88
  return gvc.bindView({
88
89
  bind: ids.page,
@@ -90,187 +91,197 @@ export class ProductDetail {
90
91
  if (loadings.page) {
91
92
  return spinner();
92
93
  }
93
- else {
94
- const prod = vm.data.content;
95
- PdClass.addSpecStyle(gvc);
96
- vm.specs =
97
- vm.specs.length > 0
98
- ? vm.specs
99
- : prod.specs.map((spec) => {
100
- return spec.option[0].title;
101
- });
102
- return html ` <div class="container">
103
- <div class="row" style="${isPhone ? 'margin: 1rem 0; width: 100%;' : 'margin: 7rem;'}">
104
- <div class="col-12 col-md-6 px-0 px-md-3" id="swiper-container">
105
- <div class="swiper" id="dynamic-swiper">
106
- <div class="swiper-wrapper">
107
- ${prod.preview_image
108
- .map((image, index) => {
109
- return html ` <div class="swiper-slide swiper-slide-def">
110
- <img src="${image}" alt="${prod.title}-${index}" />
111
- </div>`;
112
- })
113
- .join('')}
114
- </div>
115
- <div class="swiper-button-prev"></div>
116
- <div class="swiper-button-next"></div>
94
+ if (Object.keys(vm.data).length === 0) {
95
+ return html `<div class="d-flex align-items-center justify-content-center flex-column w-100 mx-auto">
96
+ <lottie-player
97
+ style="max-width: 100%;width: 300px;"
98
+ src="https://assets10.lottiefiles.com/packages/lf20_rc6CDU.json"
99
+ speed="1"
100
+ loop="true"
101
+ background="transparent"
102
+ ></lottie-player>
103
+ <span class="mb-5 fs-5">這個商品目前尚未上架喔!</span>
104
+ </div>`;
105
+ }
106
+ const prod = vm.data.content;
107
+ PdClass.addSpecStyle(gvc);
108
+ vm.specs =
109
+ vm.specs.length > 0
110
+ ? vm.specs
111
+ : prod.specs.map((spec) => {
112
+ return spec.option[0].title;
113
+ });
114
+ return html ` <div class="container">
115
+ <div class="row" style="${isPhone ? 'margin: 1rem 0; width: 100%;' : 'margin: 7rem;'}">
116
+ <div class="col-12 col-md-6 px-0 px-md-3" id="swiper-container">
117
+ <div class="swiper" id="dynamic-swiper">
118
+ <div class="swiper-wrapper">
119
+ ${prod.preview_image
120
+ .map((image, index) => {
121
+ return html ` <div class="swiper-slide swiper-slide-def">
122
+ <img src="${image}" alt="${prod.title}-${index}" />
123
+ </div>`;
124
+ })
125
+ .join('')}
117
126
  </div>
118
- <div class="swiper-sm mt-2" style="height: ${isPhone ? 75 : 100}px; overflow: hidden;">
119
- <div class="swiper-wrapper">
120
- ${prod.preview_image
121
- .map((image, index) => {
122
- return html ` <div class="swiper-slide swiper-slide-sm" data-image-index="${index}">
123
- <img src="${image}" alt="${prod.title}-${index}-sm" />
124
- </div>`;
125
- })
126
- .join('')}
127
- </div>
127
+ <div class="swiper-button-prev"></div>
128
+ <div class="swiper-button-next"></div>
129
+ </div>
130
+ <div class="swiper-sm mt-2" style="height: ${isPhone ? 75 : 100}px; overflow: hidden;">
131
+ <div class="swiper-wrapper">
132
+ ${prod.preview_image
133
+ .map((image, index) => {
134
+ return html ` <div class="swiper-slide swiper-slide-sm" data-image-index="${index}">
135
+ <img src="${image}" alt="${prod.title}-${index}-sm" />
136
+ </div>`;
137
+ })
138
+ .join('')}
128
139
  </div>
129
140
  </div>
130
- <div class="col-12 col-md-6 px-0 px-md-3 d-flex flex-column gap-2 mt-4 mt-md-0">${PdClass.selectSpec({ gvc, titleFontColor: ProductDetail.titleFontColor, prod, vm })}</div>
131
141
  </div>
132
- <div style="d-flex flex-column align-items-center mt-4">
133
- ${gvc.bindView((() => {
134
- const id = glitter.getUUID();
135
- return {
136
- bind: id,
137
- view: () => {
138
- return this.tab([{ title: '商品描述', key: 'default' }].concat(vm.content_manager
139
- .filter((cont) => {
140
- return prod.content_array.includes(cont.id);
141
- })
142
- .map((cont) => {
143
- return {
144
- title: cont.title,
145
- key: cont.id,
146
- };
147
- })), gvc, vm.content_tag, (text) => {
148
- vm.content_tag = text;
149
- gvc.notifyDataChange(id);
150
- gvc.notifyDataChange(ids.content);
151
- });
152
- },
153
- };
154
- })())}
155
- ${gvc.bindView({
156
- bind: ids.content,
142
+ <div class="col-12 col-md-6 px-0 px-md-3 d-flex flex-column gap-2 mt-4 mt-md-0">${PdClass.selectSpec({ gvc, titleFontColor: ProductDetail.titleFontColor, prod, vm })}</div>
143
+ </div>
144
+ <div style="d-flex flex-column align-items-center mt-4">
145
+ ${gvc.bindView((() => {
146
+ const id = glitter.getUUID();
147
+ return {
148
+ bind: id,
157
149
  view: () => {
158
- if (vm.content_tag === 'default') {
159
- return prod.content;
150
+ return this.tab([{ title: '商品描述', key: 'default' }].concat(vm.content_manager
151
+ .filter((cont) => {
152
+ return prod.content_array.includes(cont.id);
153
+ })
154
+ .map((cont) => {
155
+ return {
156
+ title: cont.title,
157
+ key: cont.id,
158
+ };
159
+ })), gvc, vm.content_tag, (text) => {
160
+ vm.content_tag = text;
161
+ gvc.notifyDataChange(id);
162
+ gvc.notifyDataChange(ids.content);
163
+ });
164
+ },
165
+ };
166
+ })())}
167
+ ${gvc.bindView({
168
+ bind: ids.content,
169
+ view: () => {
170
+ if (vm.content_tag === 'default') {
171
+ return prod.content;
172
+ }
173
+ else {
174
+ const template = vm.content_manager.find((cont) => cont.id === vm.content_tag);
175
+ const jsonData = prod.content_json.find((data) => data.id === vm.content_tag);
176
+ if (!template) {
177
+ return '';
160
178
  }
161
- else {
162
- const template = vm.content_manager.find((cont) => cont.id === vm.content_tag);
163
- const jsonData = prod.content_json.find((data) => data.id === vm.content_tag);
164
- if (!template) {
165
- return '';
166
- }
167
- let htmlString = template.data.content;
168
- if (jsonData) {
169
- jsonData.list.map((data) => {
170
- var _a, _b, _c;
171
- const cssStyle = template.data.tags.find((item) => item.key === data.key);
172
- const regex = new RegExp(`@{{${data.key}}}`, 'g');
173
- htmlString = htmlString.replace(regex, html `<span
174
- style="font-size: ${(_a = cssStyle === null || cssStyle === void 0 ? void 0 : cssStyle.font_size) !== null && _a !== void 0 ? _a : 16}px; color: ${(_b = cssStyle === null || cssStyle === void 0 ? void 0 : cssStyle.font_color) !== null && _b !== void 0 ? _b : '${titleFontColor}'}; background: ${(_c = cssStyle === null || cssStyle === void 0 ? void 0 : cssStyle.font_bgr) !== null && _c !== void 0 ? _c : '#fff'};"
175
- >${data.value}</span
176
- >`);
177
- });
178
- }
179
- return htmlString.replace(/@{{[^}]+}}/g, '');
179
+ let htmlString = template.data.content;
180
+ if (jsonData) {
181
+ jsonData.list.map((data) => {
182
+ var _a, _b, _c;
183
+ const cssStyle = template.data.tags.find((item) => item.key === data.key);
184
+ const regex = new RegExp(`@{{${data.key}}}`, 'g');
185
+ htmlString = htmlString.replace(regex, html `<span
186
+ style="font-size: ${(_a = cssStyle === null || cssStyle === void 0 ? void 0 : cssStyle.font_size) !== null && _a !== void 0 ? _a : 16}px; color: ${(_b = cssStyle === null || cssStyle === void 0 ? void 0 : cssStyle.font_color) !== null && _b !== void 0 ? _b : '${titleFontColor}'}; background: ${(_c = cssStyle === null || cssStyle === void 0 ? void 0 : cssStyle.font_bgr) !== null && _c !== void 0 ? _c : '#fff'};"
187
+ >${data.value}</span
188
+ >`);
189
+ });
180
190
  }
181
- },
182
- divCreate: {
183
- style: (() => {
184
- if (PdClass.isPad()) {
185
- return 'margin: 0 60px;';
186
- }
187
- if (PdClass.isPhone()) {
188
- return '';
191
+ return htmlString.replace(/@{{[^}]+}}/g, '');
192
+ }
193
+ },
194
+ divCreate: {
195
+ style: (() => {
196
+ if (PdClass.isPad()) {
197
+ return 'margin: 0 60px;';
198
+ }
199
+ if (PdClass.isPhone()) {
200
+ return '';
201
+ }
202
+ return 'margin: 0 10%;';
203
+ })(),
204
+ },
205
+ })}
206
+ </div>
207
+ <div style="margin-top: 150px;"></div>
208
+ ${gvc.bindView(() => {
209
+ const swipID = gvc.glitter.getUUID();
210
+ return {
211
+ bind: gvc.glitter.getUUID(),
212
+ view: () => __awaiter(this, void 0, void 0, function* () {
213
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
214
+ const product = (yield ApiShop.getProduct({
215
+ limit: 50,
216
+ page: 0,
217
+ id_list: prod.relative_product.join(','),
218
+ })).response.data;
219
+ setTimeout(() => {
220
+ var swiper = new Swiper('#' + swipID, {
221
+ slidesPerView: glitter.ut.frSize({
222
+ sm: product.length < 4 ? product.length : 4,
223
+ lg: product.length < 6 ? product.length : 6,
224
+ }, product.length < 2 ? product.length : 2),
225
+ spaceBetween: glitter.ut.frSize({
226
+ sm: 10,
227
+ lg: 30,
228
+ }, 10),
229
+ });
230
+ }, 100);
231
+ if (!product.length) {
232
+ return ``;
189
233
  }
190
- return 'margin: 0 240px;';
191
- })(),
192
- },
193
- })}
194
- </div>
195
- <div style="margin-top: 150px;"></div>
196
- ${gvc.bindView(() => {
197
- const swipID = gvc.glitter.getUUID();
198
- return {
199
- bind: gvc.glitter.getUUID(),
200
- view: () => __awaiter(this, void 0, void 0, function* () {
201
- return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
202
- const product = (yield ApiShop.getProduct({
203
- limit: 50,
204
- page: 0,
205
- id_list: prod.relative_product.join(','),
206
- })).response.data;
207
- setTimeout(() => {
208
- var swiper = new Swiper('#' + swipID, {
209
- slidesPerView: glitter.ut.frSize({
210
- sm: product.length < 4 ? product.length : 4,
211
- lg: product.length < 6 ? product.length : 6,
212
- }, product.length < 2 ? product.length : 2),
213
- spaceBetween: glitter.ut.frSize({
214
- sm: 10,
215
- lg: 30,
216
- }, 10),
217
- });
218
- }, 100);
219
- if (!product.length) {
220
- return ``;
221
- }
222
- resolve(html `
223
- <div class="w-100 d-flex align-items-center justify-content-center ">
224
- <div class="mx-auto" style="flex-direction: column; justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
225
- <div
226
- style="font-size:18px;align-self: stretch; text-align: center; color: ${ProductDetail.titleFontColor}; font-weight: 700; line-height: 18px; word-wrap: break-word;white-space: nowrap;margin: 0 20px;"
227
- >
228
- 相關商品
229
- </div>
230
- <div style="align-self: stretch; height: 0px; border: 1px ${ProductDetail.titleFontColor} solid"></div>
231
- </div>
232
- </div>
233
- <div class="w-100 d-flex align-items-center justify-content-center py-3 py-sm-4">
234
+ resolve(html `
235
+ <div class="w-100 d-flex align-items-center justify-content-center ">
236
+ <div class="mx-auto" style="flex-direction: column; justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
234
237
  <div
235
- class=""
236
- style="${product.length <
237
- glitter.ut.frSize({
238
- sm: 4,
239
- lg: 6,
240
- }, 2)
241
- ? `width:${200 * product.length}px;`
242
- : `width:100%;`}"
238
+ style="font-size:18px;align-self: stretch; text-align: center; color: ${ProductDetail.titleFontColor}; font-weight: 700; line-height: 18px; word-wrap: break-word;white-space: nowrap;margin: 0 20px;"
243
239
  >
244
- <div class="swiper w-100" id="${swipID}">
245
- <div class="swiper-wrapper">
246
- ${product
247
- .map((dd, index) => {
248
- return html ` <div class="swiper-slide" style="width:100%;height: 350px;">
249
- ${glitter.htmlGenerate.renderComponent({
250
- appName: window.appName,
251
- tag: 'product_widget',
252
- gvc: gvc,
253
- subData: dd,
254
- })}
255
- </div>`;
256
- })
257
- .join('')}
258
- </div>
240
+ 相關商品
241
+ </div>
242
+ <div style="align-self: stretch; height: 0px; border: 1px ${ProductDetail.titleFontColor} solid"></div>
243
+ </div>
244
+ </div>
245
+ <div class="w-100 d-flex align-items-center justify-content-center py-3 py-sm-4">
246
+ <div
247
+ class=""
248
+ style="${product.length <
249
+ glitter.ut.frSize({
250
+ sm: 4,
251
+ lg: 6,
252
+ }, 2)
253
+ ? `width:${200 * product.length}px;`
254
+ : `width:100%;`}"
255
+ >
256
+ <div class="swiper w-100" id="${swipID}">
257
+ <div class="swiper-wrapper">
258
+ ${product
259
+ .map((dd, index) => {
260
+ return html ` <div class="swiper-slide" style="width:100%;height: 350px;">
261
+ ${glitter.htmlGenerate.renderComponent({
262
+ appName: window.appName,
263
+ tag: 'product_widget',
264
+ gvc: gvc,
265
+ subData: dd,
266
+ })}
267
+ </div>`;
268
+ })
269
+ .join('')}
259
270
  </div>
260
271
  </div>
261
272
  </div>
262
- `);
263
- }));
264
- }),
265
- divCreate: {
266
- class: `w-100`,
267
- },
268
- onCreate: () => { },
269
- };
270
- })}
271
- <div style="margin-top: 100px;"></div>
272
- </div>`;
273
- }
273
+ </div>
274
+ `);
275
+ }));
276
+ }),
277
+ divCreate: {
278
+ class: `w-100`,
279
+ },
280
+ onCreate: () => { },
281
+ };
282
+ })}
283
+ <div style="margin-top: 100px;"></div>
284
+ </div>`;
274
285
  },
275
286
  divCreate: {
276
287
  style: 'min-height: 1000px;',
@@ -285,7 +296,7 @@ export class ProductDetail {
285
296
  collection: '',
286
297
  maxPrice: '',
287
298
  minPrice: '',
288
- search: decodeURIComponent(title),
299
+ domain: decodeURIComponent(title),
289
300
  status: 'active',
290
301
  orderBy: '',
291
302
  with_hide_index: 'true',
@@ -311,8 +322,8 @@ export class ProductDetail {
311
322
  if (dataArray[0].result && dataArray[0].response.value) {
312
323
  vm.content_manager = dataArray[0].response.value;
313
324
  }
314
- if (dataArray[1].result && dataArray[1].response.data.length === 1) {
315
- vm.data = dataArray[1].response.data[0];
325
+ if (dataArray[1].result && dataArray[1].response.data) {
326
+ vm.data = dataArray[1].response.data;
316
327
  }
317
328
  if (dataArray[2].result && dataArray[2].response.data) {
318
329
  vm.wishStatus = dataArray[2].response.data.some((item) => item.id === vm.data.id);