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.
- package/cjbt8743y0.json +1 -0
- package/lowcode/Entry.js +29 -9
- package/lowcode/Entry.ts +28 -9
- package/lowcode/backend-manager/bg-recommend.js +4 -6
- package/lowcode/backend-manager/bg-recommend.ts +4 -6
- package/lowcode/cms-plugin/member-setting.js +36 -2
- package/lowcode/cms-plugin/member-setting.ts +36 -1
- package/lowcode/cms-plugin/shopping-rebate-setting.js +21 -6
- package/lowcode/cms-plugin/shopping-rebate-setting.ts +24 -8
- package/lowcode/glitter-base/route/wallet.js +11 -0
- package/lowcode/glitter-base/route/wallet.ts +14 -2
- package/lowcode/glitterBundle/plugins/editor-elem.js +32 -11
- package/lowcode/glitterBundle/plugins/editor-elem.ts +42 -12
- package/lowcode/public-components/checkout/index.js +35 -27
- package/lowcode/public-components/checkout/index.ts +111 -106
- package/lowcode/public-components/product/product-detail.js +182 -171
- package/lowcode/public-components/product/product-detail.ts +214 -196
- package/lowcode/public-components/user-manager/um-class.js +234 -193
- package/lowcode/public-components/user-manager/um-class.ts +230 -189
- package/lowcode/public-components/user-manager/um-rebate.js +13 -8
- package/lowcode/public-components/user-manager/um-rebate.ts +17 -12
- package/lowcode/public-components/user-manager/um-voucher.js +3 -3
- package/lowcode/public-components/user-manager/um-voucher.ts +3 -3
- package/package.json +1 -1
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/controllers/app-release.js.map +1 -1
- package/src/api-public/controllers/article.js.map +1 -1
- package/src/api-public/controllers/post.js.map +1 -1
- package/src/api-public/controllers/shop.js +23 -12
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +36 -36
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/services/EcInvoice.js.map +5 -1
- package/src/api-public/services/ai-robot.js.map +1 -1
- package/src/api-public/services/financial-service.d.ts +1 -0
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/rebate.d.ts +1 -0
- package/src/api-public/services/rebate.js +15 -0
- package/src/api-public/services/rebate.js.map +1 -1
- package/src/api-public/services/rebate.ts +21 -5
- package/src/api-public/services/shopping.js +0 -3
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +0 -4
- package/src/index.js +9 -4
- package/src/index.js.map +5 -1
- package/src/index.ts +7 -1
- 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
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
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
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return '
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
product.length <
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
|
|
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
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
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
|
-
|
|
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
|
|
351
|
-
vm.data = dataArray[1].response.data
|
|
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);
|