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
@@ -95,217 +95,235 @@ export class ProductDetail {
95
95
  </div>`;
96
96
  }
97
97
 
98
+ gvc.addMtScript(
99
+ [{ src: `https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js` }],
100
+ () => {},
101
+ () => {}
102
+ );
103
+
98
104
  gvc.glitter.addStyleLink(['https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css']);
105
+
99
106
  return gvc.bindView({
100
107
  bind: ids.page,
101
108
  view: () => {
102
109
  if (loadings.page) {
103
110
  return spinner();
104
- } else {
105
- const prod = vm.data.content;
106
- PdClass.addSpecStyle(gvc);
107
- vm.specs =
108
- vm.specs.length > 0
109
- ? vm.specs
110
- : prod.specs.map((spec) => {
111
- return spec.option[0].title;
112
- });
111
+ }
112
+ if (Object.keys(vm.data).length === 0) {
113
+ return html`<div class="d-flex align-items-center justify-content-center flex-column w-100 mx-auto">
114
+ <lottie-player
115
+ style="max-width: 100%;width: 300px;"
116
+ src="https://assets10.lottiefiles.com/packages/lf20_rc6CDU.json"
117
+ speed="1"
118
+ loop="true"
119
+ background="transparent"
120
+ ></lottie-player>
121
+ <span class="mb-5 fs-5">這個商品目前尚未上架喔!</span>
122
+ </div>`;
123
+ }
124
+ const prod = vm.data.content;
125
+ PdClass.addSpecStyle(gvc);
126
+ vm.specs =
127
+ vm.specs.length > 0
128
+ ? vm.specs
129
+ : prod.specs.map((spec) => {
130
+ return spec.option[0].title;
131
+ });
113
132
 
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('')}
126
- </div>
127
- <div class="swiper-button-prev"></div>
128
- <div class="swiper-button-next"></div>
133
+ return html` <div class="container">
134
+ <div class="row" style="${isPhone ? 'margin: 1rem 0; width: 100%;' : 'margin: 7rem;'}">
135
+ <div class="col-12 col-md-6 px-0 px-md-3" id="swiper-container">
136
+ <div class="swiper" id="dynamic-swiper">
137
+ <div class="swiper-wrapper">
138
+ ${prod.preview_image
139
+ .map((image, index) => {
140
+ return html` <div class="swiper-slide swiper-slide-def">
141
+ <img src="${image}" alt="${prod.title}-${index}" />
142
+ </div>`;
143
+ })
144
+ .join('')}
129
145
  </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('')}
139
- </div>
146
+ <div class="swiper-button-prev"></div>
147
+ <div class="swiper-button-next"></div>
148
+ </div>
149
+ <div class="swiper-sm mt-2" style="height: ${isPhone ? 75 : 100}px; overflow: hidden;">
150
+ <div class="swiper-wrapper">
151
+ ${prod.preview_image
152
+ .map((image, index) => {
153
+ return html` <div class="swiper-slide swiper-slide-sm" data-image-index="${index}">
154
+ <img src="${image}" alt="${prod.title}-${index}-sm" />
155
+ </div>`;
156
+ })
157
+ .join('')}
140
158
  </div>
141
159
  </div>
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
160
  </div>
144
- <div style="d-flex flex-column align-items-center mt-4">
145
- ${gvc.bindView(
146
- (() => {
147
- const id = glitter.getUUID();
148
- return {
149
- bind: id,
150
- view: () => {
151
- return this.tab(
152
- [{ title: '商品描述', key: 'default' }].concat(
153
- vm.content_manager
154
- .filter((cont) => {
155
- return prod.content_array.includes(cont.id);
156
- })
157
- .map((cont) => {
158
- return {
159
- title: cont.title,
160
- key: cont.id,
161
- };
162
- })
163
- ),
164
- gvc,
165
- vm.content_tag,
166
- (text) => {
167
- vm.content_tag = text;
168
- gvc.notifyDataChange(id);
169
- gvc.notifyDataChange(ids.content);
170
- }
161
+ <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>
162
+ </div>
163
+ <div style="d-flex flex-column align-items-center mt-4">
164
+ ${gvc.bindView(
165
+ (() => {
166
+ const id = glitter.getUUID();
167
+ return {
168
+ bind: id,
169
+ view: () => {
170
+ return this.tab(
171
+ [{ title: '商品描述', key: 'default' }].concat(
172
+ vm.content_manager
173
+ .filter((cont) => {
174
+ return prod.content_array.includes(cont.id);
175
+ })
176
+ .map((cont) => {
177
+ return {
178
+ title: cont.title,
179
+ key: cont.id,
180
+ };
181
+ })
182
+ ),
183
+ gvc,
184
+ vm.content_tag,
185
+ (text) => {
186
+ vm.content_tag = text;
187
+ gvc.notifyDataChange(id);
188
+ gvc.notifyDataChange(ids.content);
189
+ }
190
+ );
191
+ },
192
+ };
193
+ })()
194
+ )}
195
+ ${gvc.bindView({
196
+ bind: ids.content,
197
+ view: () => {
198
+ if (vm.content_tag === 'default') {
199
+ return prod.content;
200
+ } else {
201
+ const template = vm.content_manager.find((cont) => cont.id === vm.content_tag);
202
+ const jsonData = prod.content_json.find((data) => data.id === vm.content_tag);
203
+ if (!template) {
204
+ return '';
205
+ }
206
+ let htmlString = template.data.content;
207
+ if (jsonData) {
208
+ jsonData.list.map((data) => {
209
+ const cssStyle = template.data.tags.find((item) => item.key === data.key);
210
+ const regex = new RegExp(`@{{${data.key}}}`, 'g');
211
+ htmlString = htmlString.replace(
212
+ regex,
213
+ html`<span
214
+ style="font-size: ${cssStyle?.font_size ?? 16}px; color: ${cssStyle?.font_color ?? '${titleFontColor}'}; background: ${cssStyle?.font_bgr ??
215
+ '#fff'};"
216
+ >${data.value}</span
217
+ >`
171
218
  );
172
- },
173
- };
174
- })()
175
- )}
176
- ${gvc.bindView({
177
- bind: ids.content,
178
- view: () => {
179
- if (vm.content_tag === 'default') {
180
- return prod.content;
181
- } else {
182
- const template = vm.content_manager.find((cont) => cont.id === vm.content_tag);
183
- const jsonData = prod.content_json.find((data) => data.id === vm.content_tag);
184
- if (!template) {
185
- return '';
186
- }
187
- let htmlString = template.data.content;
188
- if (jsonData) {
189
- jsonData.list.map((data) => {
190
- const cssStyle = template.data.tags.find((item) => item.key === data.key);
191
- const regex = new RegExp(`@{{${data.key}}}`, 'g');
192
- htmlString = htmlString.replace(
193
- regex,
194
- html`<span
195
- style="font-size: ${cssStyle?.font_size ?? 16}px; color: ${cssStyle?.font_color ?? '${titleFontColor}'}; background: ${cssStyle?.font_bgr ??
196
- '#fff'};"
197
- >${data.value}</span
198
- >`
199
- );
200
- });
201
- }
202
- return htmlString.replace(/@{{[^}]+}}/g, '');
219
+ });
203
220
  }
204
- },
205
- divCreate: {
206
- style: (() => {
207
- if (PdClass.isPad()) {
208
- return 'margin: 0 60px;';
209
- }
210
- if (PdClass.isPhone()) {
211
- return '';
212
- }
213
- return 'margin: 0 240px;';
214
- })(),
215
- },
216
- })}
217
- </div>
218
- <div style="margin-top: 150px;"></div>
219
- ${gvc.bindView(() => {
220
- const swipID = gvc.glitter.getUUID();
221
- return {
222
- bind: gvc.glitter.getUUID(),
223
- view: async () => {
224
- return new Promise(async (resolve, reject) => {
225
- const product = (
226
- await ApiShop.getProduct({
227
- limit: 50,
228
- page: 0,
229
- id_list: prod.relative_product.join(','),
230
- })
231
- ).response.data;
232
- setTimeout(() => {
233
- //@ts-ignore
234
- var swiper = new Swiper('#' + swipID, {
235
- slidesPerView: glitter.ut.frSize(
236
- {
237
- sm: product.length < 4 ? product.length : 4,
238
- lg: product.length < 6 ? product.length : 6,
239
- },
240
- product.length < 2 ? product.length : 2
241
- ),
242
- spaceBetween: glitter.ut.frSize(
243
- {
244
- sm: 10,
245
- lg: 30,
246
- },
247
- 10
248
- ),
249
- });
250
- }, 100);
251
- if (!product.length) {
252
- return ``;
253
- }
254
- resolve(html`
255
- <div class="w-100 d-flex align-items-center justify-content-center ">
256
- <div class="mx-auto" style="flex-direction: column; justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
257
- <div
258
- 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;"
259
- >
260
- 相關商品
261
- </div>
262
- <div style="align-self: stretch; height: 0px; border: 1px ${ProductDetail.titleFontColor} solid"></div>
263
- </div>
264
- </div>
265
- <div class="w-100 d-flex align-items-center justify-content-center py-3 py-sm-4">
221
+ return htmlString.replace(/@{{[^}]+}}/g, '');
222
+ }
223
+ },
224
+ divCreate: {
225
+ style: (() => {
226
+ if (PdClass.isPad()) {
227
+ return 'margin: 0 60px;';
228
+ }
229
+ if (PdClass.isPhone()) {
230
+ return '';
231
+ }
232
+ return 'margin: 0 10%;';
233
+ })(),
234
+ },
235
+ })}
236
+ </div>
237
+ <div style="margin-top: 150px;"></div>
238
+ ${gvc.bindView(() => {
239
+ const swipID = gvc.glitter.getUUID();
240
+ return {
241
+ bind: gvc.glitter.getUUID(),
242
+ view: async () => {
243
+ return new Promise(async (resolve, reject) => {
244
+ const product = (
245
+ await ApiShop.getProduct({
246
+ limit: 50,
247
+ page: 0,
248
+ id_list: prod.relative_product.join(','),
249
+ })
250
+ ).response.data;
251
+ setTimeout(() => {
252
+ //@ts-ignore
253
+ var swiper = new Swiper('#' + swipID, {
254
+ slidesPerView: glitter.ut.frSize(
255
+ {
256
+ sm: product.length < 4 ? product.length : 4,
257
+ lg: product.length < 6 ? product.length : 6,
258
+ },
259
+ product.length < 2 ? product.length : 2
260
+ ),
261
+ spaceBetween: glitter.ut.frSize(
262
+ {
263
+ sm: 10,
264
+ lg: 30,
265
+ },
266
+ 10
267
+ ),
268
+ });
269
+ }, 100);
270
+ if (!product.length) {
271
+ return ``;
272
+ }
273
+ resolve(html`
274
+ <div class="w-100 d-flex align-items-center justify-content-center ">
275
+ <div class="mx-auto" style="flex-direction: column; justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
266
276
  <div
267
- class=""
268
- style="${product.length <
269
- glitter.ut.frSize(
270
- {
271
- sm: 4,
272
- lg: 6,
273
- },
274
- 2
275
- )
276
- ? `width:${200 * product.length}px;`
277
- : `width:100%;`}"
277
+ 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;"
278
278
  >
279
- <div class="swiper w-100" id="${swipID}">
280
- <div class="swiper-wrapper">
281
- ${product
282
- .map((dd: any, index: number) => {
283
- return html` <div class="swiper-slide" style="width:100%;height: 350px;">
284
- ${glitter.htmlGenerate.renderComponent({
285
- appName: (window as any).appName,
286
- tag: 'product_widget',
287
- gvc: gvc,
288
- subData: dd,
289
- })}
290
- </div>`;
291
- })
292
- .join('')}
293
- </div>
279
+ 相關商品
280
+ </div>
281
+ <div style="align-self: stretch; height: 0px; border: 1px ${ProductDetail.titleFontColor} solid"></div>
282
+ </div>
283
+ </div>
284
+ <div class="w-100 d-flex align-items-center justify-content-center py-3 py-sm-4">
285
+ <div
286
+ class=""
287
+ style="${product.length <
288
+ glitter.ut.frSize(
289
+ {
290
+ sm: 4,
291
+ lg: 6,
292
+ },
293
+ 2
294
+ )
295
+ ? `width:${200 * product.length}px;`
296
+ : `width:100%;`}"
297
+ >
298
+ <div class="swiper w-100" id="${swipID}">
299
+ <div class="swiper-wrapper">
300
+ ${product
301
+ .map((dd: any, index: number) => {
302
+ return html` <div class="swiper-slide" style="width:100%;height: 350px;">
303
+ ${glitter.htmlGenerate.renderComponent({
304
+ appName: (window as any).appName,
305
+ tag: 'product_widget',
306
+ gvc: gvc,
307
+ subData: dd,
308
+ })}
309
+ </div>`;
310
+ })
311
+ .join('')}
294
312
  </div>
295
313
  </div>
296
314
  </div>
297
- `);
298
- });
299
- },
300
- divCreate: {
301
- class: `w-100`,
302
- },
303
- onCreate: () => {},
304
- };
305
- })}
306
- <div style="margin-top: 100px;"></div>
307
- </div>`;
308
- }
315
+ </div>
316
+ `);
317
+ });
318
+ },
319
+ divCreate: {
320
+ class: `w-100`,
321
+ },
322
+ onCreate: () => {},
323
+ };
324
+ })}
325
+ <div style="margin-top: 100px;"></div>
326
+ </div>`;
309
327
  },
310
328
  divCreate: {
311
329
  style: 'min-height: 1000px;',
@@ -320,7 +338,7 @@ export class ProductDetail {
320
338
  collection: '',
321
339
  maxPrice: '',
322
340
  minPrice: '',
323
- search: decodeURIComponent(title) as string,
341
+ domain: decodeURIComponent(title),
324
342
  status: 'active',
325
343
  orderBy: '',
326
344
  with_hide_index: 'true',
@@ -347,8 +365,8 @@ export class ProductDetail {
347
365
  if (dataArray[0].result && dataArray[0].response.value) {
348
366
  vm.content_manager = dataArray[0].response.value;
349
367
  }
350
- if (dataArray[1].result && dataArray[1].response.data.length === 1) {
351
- vm.data = dataArray[1].response.data[0];
368
+ if (dataArray[1].result && dataArray[1].response.data) {
369
+ vm.data = dataArray[1].response.data;
352
370
  }
353
371
  if (dataArray[2].result && dataArray[2].response.data) {
354
372
  vm.wishStatus = dataArray[2].response.data.some((item: Product) => item.id === vm.data.id);