ts-glitter 21.1.7 → 21.1.8

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 (49) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-product.js +39 -18
  4. package/lowcode/backend-manager/bg-product.ts +54 -23
  5. package/lowcode/cms-plugin/pos-pages/payment-page.js +37 -29
  6. package/lowcode/cms-plugin/pos-pages/payment-page.ts +61 -49
  7. package/lowcode/cms-plugin/pos-pages/pos-function.js +6 -1
  8. package/lowcode/cms-plugin/pos-pages/pos-function.ts +8 -1
  9. package/lowcode/cms-plugin/stock-history.js +1 -0
  10. package/lowcode/cms-plugin/stock-history.ts +1 -10
  11. package/lowcode/css/editor.css +2 -2
  12. package/lowcode/form-view/e-commerce/product-select.js +13 -11
  13. package/lowcode/form-view/e-commerce/product-select.ts +14 -12
  14. package/lowcode/modules/tool.js +9 -0
  15. package/lowcode/modules/tool.ts +12 -0
  16. package/lowcode/public-components/checkout/index.js +216 -207
  17. package/lowcode/public-components/checkout/index.ts +1315 -1309
  18. package/package.json +1 -1
  19. package/src/api-public/models/glitter-finance.js +1 -2
  20. package/src/api-public/models/glitter-finance.js.map +1 -5
  21. package/src/api-public/services/checkout-event.js +17 -7
  22. package/src/api-public/services/checkout-event.js.map +1 -1
  23. package/src/api-public/services/data-analyze.d.ts +1 -1
  24. package/src/api-public/services/fb-service.js +4 -4
  25. package/src/api-public/services/fb-service.js.map +1 -1
  26. package/src/api-public/services/schedule.d.ts +1 -1
  27. package/src/api-public/services/schedule.js +18 -14
  28. package/src/api-public/services/schedule.js.map +1 -1
  29. package/src/api-public/services/schedule.ts +18 -14
  30. package/src/api-public/services/user.js +17 -7
  31. package/src/api-public/services/user.js.map +1 -1
  32. package/src/config.d.ts +1 -1
  33. package/src/modules/AWSLib.js +2 -3
  34. package/src/modules/AWSLib.js.map +1 -1
  35. package/src/modules/database.d.ts +1 -1
  36. package/src/modules/redis.d.ts +1 -1
  37. package/src/modules/tool.d.ts +4 -4
  38. package/src/modules/tool.js +1 -2
  39. package/src/modules/tool.js.map +1 -1
  40. package/src/services/app.js +17 -7
  41. package/src/services/app.js.map +1 -1
  42. package/src/services/backend-service.js +17 -7
  43. package/src/services/backend-service.js.map +1 -1
  44. package/src/services/create-instance.js +3 -4
  45. package/src/services/create-instance.js.map +1 -1
  46. package/src/services/saas-table-check.js +2 -2
  47. package/src/services/saas-table-check.js.map +1 -5
  48. package/src/services/tool.js +2 -3
  49. package/src/services/tool.js.map +1 -1
package/lowcode/Entry.js CHANGED
@@ -146,7 +146,7 @@ export class Entry {
146
146
  }
147
147
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
148
148
  console.log(`Entry-time:`, window.renderClock.stop());
149
- glitter.share.editerVersion = 'V_21.1.7';
149
+ glitter.share.editerVersion = 'V_21.1.8';
150
150
  glitter.share.start = new Date();
151
151
  const vm = { appConfig: [] };
152
152
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -149,7 +149,7 @@ export class Entry {
149
149
  }
150
150
  (window as any).renderClock = (window as any).renderClock ?? createClock();
151
151
  console.log(`Entry-time:`, (window as any).renderClock.stop());
152
- glitter.share.editerVersion = 'V_21.1.7';
152
+ glitter.share.editerVersion = 'V_21.1.8';
153
153
  glitter.share.start = new Date();
154
154
  const vm = { appConfig: [] };
155
155
  (window as any).saasConfig = {
@@ -151,7 +151,6 @@ export class BgProduct {
151
151
  return {
152
152
  bind: id,
153
153
  view: () => {
154
- var _a;
155
154
  return html `<input
156
155
  class="form-check-input mt-0 ${vm.checkClass} cursor_pointer"
157
156
  type="checkbox"
@@ -184,13 +183,11 @@ export class BgProduct {
184
183
  style="text-wrap: auto;"
185
184
  onclick="${gvc.event(() => call())}"
186
185
  >
187
- ${obj.show_product_type
188
- ? BgWidget.infoInsignia(ProductConfig.getName(opt.content))
189
- : ''}${opt.value}
186
+ ${opt.value}
190
187
  </div>
191
188
  ${opt.sub_title
192
189
  ? html `
193
- <div class="fw-500" style="color:grey;font-size:13px;">
190
+ <div class="fw-500" style="color: grey; font-size: 13px;">
194
191
  ${opt.sub_title}
195
192
  </div>
196
193
  `
@@ -199,15 +196,43 @@ export class BgProduct {
199
196
  </div>
200
197
  ${(() => {
201
198
  var _a, _b;
199
+ const isVisibleProduct = opt.content.visible === 'false' && !obj.show_product_type
200
+ ? BgWidget.warningInsignia('隱形商品', { size: 'sm' })
201
+ : '';
202
+ const productCategory = obj.show_product_type
203
+ ? BgWidget.infoInsignia(ProductConfig.getName(opt.content), {
204
+ size: 'sm',
205
+ })
206
+ : '';
202
207
  const collections = (_b = (_a = opt.content) === null || _a === void 0 ? void 0 : _a.collection) === null || _b === void 0 ? void 0 : _b.filter(Boolean).map((col) => BgWidget.normalInsignia(col, { size: 'sm' })).join('');
203
- return collections
204
- ? html `<div class="d-flex flex-wrap gap-1 mt-2">${collections}</div>`
208
+ const renderString = `${isVisibleProduct}${productCategory}${collections}`;
209
+ return renderString
210
+ ? html `<div class="d-flex flex-wrap gap-1 mt-2">${renderString}</div>`
205
211
  : '';
206
212
  })()}
207
213
  </div>
208
214
  <div class="text-end">
209
215
  <div class="tx_normal_14">
210
- $${parseInt(`${(_a = opt.content[vm.orderString || 'min_price']) !== null && _a !== void 0 ? _a : opt.content.variants[0].sale_price}`, 10).toLocaleString()}
216
+ ${(() => {
217
+ const contentMap = {
218
+ price: () => {
219
+ var _a, _b;
220
+ return html `$${parseInt(`${(_a = opt.content[vm.orderString || 'min_price']) !== null && _a !== void 0 ? _a : opt.content.variants[(_b = opt.variant_index) !== null && _b !== void 0 ? _b : 0].sale_price}`, 10).toLocaleString()}`;
221
+ },
222
+ stock: () => {
223
+ var _a, _b;
224
+ const variant = opt.content.variants[(_a = opt.variant_index) !== null && _a !== void 0 ? _a : 0];
225
+ if (variant.show_understocking === 'false') {
226
+ return '不追蹤庫存';
227
+ }
228
+ const n = Number(opt.content.variants[(_b = opt.variant_index) !== null && _b !== void 0 ? _b : 0].stock);
229
+ return html `庫存 ${(isNaN(n) ? 0 : n).toLocaleString()} 個`;
230
+ },
231
+ };
232
+ return (obj.right_element_type
233
+ ? contentMap[obj.right_element_type]
234
+ : contentMap.price)();
235
+ })()}
211
236
  </div>
212
237
  ${opt.note ? html ` <div class="tx_gray_12">${opt.note}</div> ` : ''}
213
238
  </div>
@@ -215,7 +240,7 @@ export class BgProduct {
215
240
  },
216
241
  divCreate: {
217
242
  class: 'd-flex align-items-center',
218
- style: 'gap: 24px',
243
+ style: `gap: ${document.body.clientWidth > 800 ? 24 : 12}px`,
219
244
  },
220
245
  };
221
246
  }) + BgWidget.horizontalLine({ margin: 0.15 }));
@@ -269,18 +294,14 @@ export class BgProduct {
269
294
  data.response.data.map((product) => {
270
295
  var _a;
271
296
  const image = (_a = product.content.preview_image[0]) !== null && _a !== void 0 ? _a : BgWidget.noImageURL;
272
- const value = [
273
- product.content.visible === 'false' ? BgWidget.warningInsignia('隱形商品') : '',
274
- product.content.title,
275
- ]
276
- .filter(Boolean)
277
- .join('');
297
+ const title = product.content.title;
278
298
  if (obj.with_variants) {
279
- product.content.variants.map((variant) => {
299
+ product.content.variants.map((variant, index) => {
280
300
  vm.options.push({
281
301
  key: `${product.content.id}-${variant.spec.join('-')}`,
282
302
  sub_title: variant.spec.join('-') ? `規格:${variant.spec.join('-')}` : '',
283
- value: value,
303
+ variant_index: index,
304
+ value: title,
284
305
  content: product.content,
285
306
  image: image,
286
307
  });
@@ -289,7 +310,7 @@ export class BgProduct {
289
310
  else {
290
311
  vm.options.push({
291
312
  key: product.content.id,
292
- value: value,
313
+ value: title,
293
314
  content: product.content,
294
315
  image: image,
295
316
  });
@@ -16,6 +16,7 @@ export type OptionsItem = {
16
16
  note?: string;
17
17
  sub_title?: string;
18
18
  content?: any;
19
+ variant_index?: number;
19
20
  };
20
21
 
21
22
  type CollectionItem = {
@@ -77,6 +78,7 @@ export class BgProduct {
77
78
  filter_visible?: string;
78
79
  with_variants?: boolean;
79
80
  show_product_type?: boolean;
81
+ right_element_type?: 'price' | 'stock';
80
82
  }) {
81
83
  const glitter = (window.parent as any).glitter;
82
84
  return (window.parent as any).glitter.innerDialog((gvc: GVC) => {
@@ -225,13 +227,11 @@ export class BgProduct {
225
227
  style="text-wrap: auto;"
226
228
  onclick="${gvc.event(() => call())}"
227
229
  >
228
- ${obj.show_product_type
229
- ? BgWidget.infoInsignia(ProductConfig.getName(opt.content))
230
- : ''}${opt.value}
230
+ ${opt.value}
231
231
  </div>
232
232
  ${opt.sub_title
233
233
  ? html`
234
- <div class="fw-500" style="color:grey;font-size:13px;">
234
+ <div class="fw-500" style="color: grey; font-size: 13px;">
235
235
  ${opt.sub_title}
236
236
  </div>
237
237
  `
@@ -239,24 +239,59 @@ export class BgProduct {
239
239
  </div>
240
240
  </div>
241
241
  ${(() => {
242
+ const isVisibleProduct =
243
+ opt.content.visible === 'false' && !obj.show_product_type
244
+ ? BgWidget.warningInsignia('隱形商品', { size: 'sm' })
245
+ : '';
246
+
247
+ const productCategory = obj.show_product_type
248
+ ? BgWidget.infoInsignia(ProductConfig.getName(opt.content), {
249
+ size: 'sm',
250
+ })
251
+ : '';
252
+
242
253
  const collections = opt.content?.collection
243
254
  ?.filter(Boolean)
244
255
  .map((col: string) => BgWidget.normalInsignia(col, { size: 'sm' }))
245
256
  .join('');
246
- return collections
247
- ? html`<div class="d-flex flex-wrap gap-1 mt-2">${collections}</div>`
257
+
258
+ const renderString = `${isVisibleProduct}${productCategory}${collections}`;
259
+
260
+ return renderString
261
+ ? html`<div class="d-flex flex-wrap gap-1 mt-2">${renderString}</div>`
248
262
  : '';
249
263
  })()}
250
264
  </div>
251
265
  <div class="text-end">
252
266
  <div class="tx_normal_14">
253
- $${parseInt(
254
- `${
255
- opt.content[vm.orderString || 'min_price'] ??
256
- opt.content.variants[0].sale_price
257
- }`,
258
- 10
259
- ).toLocaleString()}
267
+ ${(() => {
268
+ const contentMap: Record<string, () => string> = {
269
+ price: () => {
270
+ return html`$${parseInt(
271
+ `${
272
+ opt.content[vm.orderString || 'min_price'] ??
273
+ opt.content.variants[opt.variant_index ?? 0].sale_price
274
+ }`,
275
+ 10
276
+ ).toLocaleString()}`;
277
+ },
278
+ stock: () => {
279
+ const variant = opt.content.variants[opt.variant_index ?? 0];
280
+ if (variant.show_understocking === 'false') {
281
+ return '不追蹤庫存';
282
+ }
283
+
284
+ const n = Number(opt.content.variants[opt.variant_index ?? 0].stock);
285
+ return html`庫存 ${(isNaN(n) ? 0 : n).toLocaleString()} 個`;
286
+ },
287
+ };
288
+
289
+ return (
290
+ obj.right_element_type
291
+ ? contentMap[obj.right_element_type]
292
+ : contentMap.price
293
+ )();
294
+ })()}
260
295
  </div>
261
296
  ${opt.note ? html` <div class="tx_gray_12">${opt.note}</div> ` : ''}
262
297
  </div>
@@ -264,7 +299,7 @@ export class BgProduct {
264
299
  },
265
300
  divCreate: {
266
301
  class: 'd-flex align-items-center',
267
- style: 'gap: 24px',
302
+ style: `gap: ${document.body.clientWidth > 800 ? 24 : 12}px`,
268
303
  },
269
304
  };
270
305
  }) + BgWidget.horizontalLine({ margin: 0.15 })
@@ -332,19 +367,15 @@ export class BgProduct {
332
367
  content: { id: number; title: string; preview_image: string[]; variants: any; visible: string };
333
368
  }) => {
334
369
  const image = product.content.preview_image[0] ?? BgWidget.noImageURL;
335
- const value = [
336
- product.content.visible === 'false' ? BgWidget.warningInsignia('隱形商品') : '',
337
- product.content.title,
338
- ]
339
- .filter(Boolean)
340
- .join('');
370
+ const title = product.content.title;
341
371
 
342
372
  if (obj.with_variants) {
343
- product.content.variants.map((variant: any) => {
373
+ product.content.variants.map((variant: any, index: number) => {
344
374
  vm.options.push({
345
375
  key: `${product.content.id}-${variant.spec.join('-')}`,
346
376
  sub_title: variant.spec.join('-') ? `規格:${variant.spec.join('-')}` : '',
347
- value: value,
377
+ variant_index: index,
378
+ value: title,
348
379
  content: product.content,
349
380
  image: image,
350
381
  });
@@ -352,7 +383,7 @@ export class BgProduct {
352
383
  } else {
353
384
  vm.options.push({
354
385
  key: product.content.id,
355
- value: value,
386
+ value: title,
356
387
  content: product.content,
357
388
  image: image,
358
389
  });
@@ -199,7 +199,8 @@ export class PaymentPage {
199
199
  </div>
200
200
  </div>
201
201
  <div
202
- class="d-flex flex-column py-2" onclick="${gvc.event(() => {
202
+ class="d-flex flex-column py-2"
203
+ onclick="${gvc.event(() => {
203
204
  PosFunction.setMoney(gvc, count => {
204
205
  obj.ogOrderData.lineItems[index].count = count;
205
206
  refreshOrderView();
@@ -242,7 +243,10 @@ export class PaymentPage {
242
243
  : ``}
243
244
  </div>
244
245
  <div class="flex-fill"></div>
245
- <div class="d-sm-none d-flex align-items-center justify-content-center flex-column" style="gap:0px;" onclick="${gvc.event(() => {
246
+ <div
247
+ class="d-sm-none d-flex align-items-center justify-content-center flex-column"
248
+ style="gap:0px;"
249
+ onclick="${gvc.event(() => {
246
250
  PosFunction.setMoney(gvc, money => {
247
251
  if (money === data.sale_price) {
248
252
  delete obj.ogOrderData.lineItems[index].custom_price;
@@ -252,20 +256,24 @@ export class PaymentPage {
252
256
  }
253
257
  refreshOrderView();
254
258
  }, '更改商品單價');
255
- })}">
256
- ${(data.sale_price !== data.variant_sale_price) ? `
257
- <span class="text-decoration-line-through"
258
- >$${parseInt((data.variant_sale_price * data.count), 10).toLocaleString()}</span
259
- >
260
- <span class="text-danger"
261
- >$${parseInt((data.sale_price * data.count), 10).toLocaleString()}</span
262
- >
263
- ` : `
264
- <span
265
- >$${parseInt((data.sale_price * data.count), 10).toLocaleString()}</span
259
+ })}"
266
260
  >
267
- `}
268
-
261
+ ${(() => {
262
+ function formatPrice(price) {
263
+ return `$${parseInt(`${price}`, 10).toLocaleString()}`;
264
+ }
265
+ if (data.variant_sale_price && data.sale_price !== data.variant_sale_price) {
266
+ return html `
267
+ <span class="text-decoration-line-through"
268
+ >${formatPrice(data.variant_sale_price * data.count)}</span
269
+ >
270
+ <span class="text-danger"
271
+ >${formatPrice(data.sale_price * data.count)}</span
272
+ >
273
+ `;
274
+ }
275
+ return html ` <span>${formatPrice(data.sale_price * data.count)}</span> `;
276
+ })()}
269
277
  </div>
270
278
  </div>
271
279
  <div class="col-2 d-none d-sm-flex align-items-center justify-content-start">
@@ -298,19 +306,20 @@ export class PaymentPage {
298
306
  }, '更改商品單價');
299
307
  })}"
300
308
  >
301
- ${(data.sale_price !== data.variant_sale_price) ? `
302
- <span class="text-decoration-line-through"
303
- >$${parseInt((data.variant_sale_price * data.count), 10).toLocaleString()}</span
304
- >
305
- <span class="text-danger"
306
- >$${parseInt((data.sale_price * data.count), 10).toLocaleString()}</span
307
- >
308
- ` : `
309
- <span
310
- >$${parseInt((data.sale_price * data.count), 10).toLocaleString()}</span
311
- >
312
- `}
313
-
309
+ ${(() => {
310
+ function formatPrice(price) {
311
+ return `$${parseInt(`${price}`, 10).toLocaleString()}`;
312
+ }
313
+ if (data.variant_sale_price && data.sale_price !== data.variant_sale_price) {
314
+ return html `
315
+ <span class="text-decoration-line-through"
316
+ >${formatPrice(data.variant_sale_price * data.count)}</span
317
+ >
318
+ <span class="text-danger">${formatPrice(data.sale_price * data.count)}</span>
319
+ `;
320
+ }
321
+ return html ` <span>${formatPrice(data.sale_price * data.count)}</span> `;
322
+ })()}
314
323
  </div>
315
324
  </div>
316
325
  `;
@@ -1956,7 +1965,6 @@ export class PaymentPage {
1956
1965
  else {
1957
1966
  PaymentPage.clearHistory();
1958
1967
  const glitter = gvc.glitter;
1959
- console.log(`res.response.order-data==>`, res.response.data);
1960
1968
  const invoice = res.response.data.invoice;
1961
1969
  if (res.response.data.invoice &&
1962
1970
  (PayConfig.deviceType === 'pos' || ConnectionMode.on_connected_device) &&
@@ -233,16 +233,17 @@ export class PaymentPage {
233
233
  </div>
234
234
  </div>
235
235
  <div
236
- class="d-flex flex-column py-2" onclick="${gvc.event(() => {
237
- PosFunction.setMoney(
238
- gvc,
239
- count => {
240
- obj.ogOrderData.lineItems[index].count = count;
241
- refreshOrderView();
242
- },
243
- '更改商品數量'
244
- );
245
- })}"
236
+ class="d-flex flex-column py-2"
237
+ onclick="${gvc.event(() => {
238
+ PosFunction.setMoney(
239
+ gvc,
240
+ count => {
241
+ obj.ogOrderData.lineItems[index].count = count;
242
+ refreshOrderView();
243
+ },
244
+ '更改商品數量'
245
+ );
246
+ })}"
246
247
  style="font-size: 16px;font-style: normal;font-weight: 500;letter-spacing: 0.64px;margin-left: 12px;"
247
248
  >
248
249
  <div class="d-flex justify-content-center flex-column" style="gap:5px;">
@@ -279,33 +280,42 @@ export class PaymentPage {
279
280
  : ``}
280
281
  </div>
281
282
  <div class="flex-fill"></div>
282
- <div class="d-sm-none d-flex align-items-center justify-content-center flex-column" style="gap:0px;" onclick="${gvc.event(()=>{
283
- PosFunction.setMoney(
284
- gvc,
285
- money => {
286
- if (money === data.sale_price) {
287
- delete obj.ogOrderData.lineItems[index].custom_price;
288
- } else {
289
- obj.ogOrderData.lineItems[index].custom_price = money;
290
- }
291
- refreshOrderView();
292
- },
293
- '更改商品單價'
294
- )
295
- })}">
296
- ${(data.sale_price !== data.variant_sale_price) ? `
297
- <span class="text-decoration-line-through"
298
- >$${parseInt((data.variant_sale_price * data.count) as any, 10).toLocaleString()}</span
299
- >
300
- <span class="text-danger"
301
- >$${parseInt((data.sale_price * data.count) as any, 10).toLocaleString()}</span
302
- >
303
- `:`
304
- <span
305
- >$${parseInt((data.sale_price * data.count) as any, 10).toLocaleString()}</span
283
+ <div
284
+ class="d-sm-none d-flex align-items-center justify-content-center flex-column"
285
+ style="gap:0px;"
286
+ onclick="${gvc.event(() => {
287
+ PosFunction.setMoney(
288
+ gvc,
289
+ money => {
290
+ if (money === data.sale_price) {
291
+ delete obj.ogOrderData.lineItems[index].custom_price;
292
+ } else {
293
+ obj.ogOrderData.lineItems[index].custom_price = money;
294
+ }
295
+ refreshOrderView();
296
+ },
297
+ '更改商品單價'
298
+ );
299
+ })}"
306
300
  >
307
- `}
301
+ ${(() => {
302
+ function formatPrice(price: any) {
303
+ return `$${parseInt(`${price}`, 10).toLocaleString()}`;
304
+ }
308
305
 
306
+ if (data.variant_sale_price && data.sale_price !== data.variant_sale_price) {
307
+ return html`
308
+ <span class="text-decoration-line-through"
309
+ >${formatPrice(data.variant_sale_price * data.count)}</span
310
+ >
311
+ <span class="text-danger"
312
+ >${formatPrice(data.sale_price * data.count)}</span
313
+ >
314
+ `;
315
+ }
316
+
317
+ return html` <span>${formatPrice(data.sale_price * data.count)}</span> `;
318
+ })()}
309
319
  </div>
310
320
  </div>
311
321
  <div class="col-2 d-none d-sm-flex align-items-center justify-content-start">
@@ -345,19 +355,22 @@ export class PaymentPage {
345
355
  );
346
356
  })}"
347
357
  >
348
- ${(data.sale_price !== data.variant_sale_price) ? `
349
- <span class="text-decoration-line-through"
350
- >$${parseInt((data.variant_sale_price * data.count) as any, 10).toLocaleString()}</span
351
- >
352
- <span class="text-danger"
353
- >$${parseInt((data.sale_price * data.count) as any, 10).toLocaleString()}</span
354
- >
355
- `:`
356
- <span
357
- >$${parseInt((data.sale_price * data.count) as any, 10).toLocaleString()}</span
358
- >
359
- `}
360
-
358
+ ${(() => {
359
+ function formatPrice(price: any) {
360
+ return `$${parseInt(`${price}`, 10).toLocaleString()}`;
361
+ }
362
+
363
+ if (data.variant_sale_price && data.sale_price !== data.variant_sale_price) {
364
+ return html`
365
+ <span class="text-decoration-line-through"
366
+ >${formatPrice(data.variant_sale_price * data.count)}</span
367
+ >
368
+ <span class="text-danger">${formatPrice(data.sale_price * data.count)}</span>
369
+ `;
370
+ }
371
+
372
+ return html` <span>${formatPrice(data.sale_price * data.count)}</span> `;
373
+ })()}
361
374
  </div>
362
375
  </div>
363
376
  `;
@@ -2125,7 +2138,6 @@ export class PaymentPage {
2125
2138
  } else {
2126
2139
  PaymentPage.clearHistory();
2127
2140
  const glitter = gvc.glitter;
2128
- console.log(`res.response.order-data==>`, res.response.data);
2129
2141
  const invoice = res.response.data.invoice;
2130
2142
  if (
2131
2143
  res.response.data.invoice &&
@@ -18,6 +18,7 @@ import { PaymentPage } from './payment-page.js';
18
18
  import { BgWidget } from '../../backend-manager/bg-widget.js';
19
19
  import { UmClass } from '../../public-components/user-manager/um-class.js';
20
20
  import { Language } from '../../glitter-base/global/language.js';
21
+ import { Tool } from '../../modules/tool.js';
21
22
  const html = String.raw;
22
23
  const css = String.raw;
23
24
  const dialogStyle = `
@@ -999,7 +1000,11 @@ export class PosFunction {
999
1000
  'guest',
1000
1001
  }).then((res) => __awaiter(this, void 0, void 0, function* () {
1001
1002
  if (res.result && res.response.data) {
1002
- vm.dataList = res.response.data.filter((item) => item.content.trigger === 'code');
1003
+ vm.dataList = res.response.data.filter((item) => {
1004
+ return (item.content.status === 1 &&
1005
+ item.content.trigger === 'code' &&
1006
+ Tool.isNowBetweenDates(item.content.start_ISO_Date, item.content.end_ISO_Date));
1007
+ });
1003
1008
  }
1004
1009
  else {
1005
1010
  vm.dataList = [];
@@ -12,6 +12,7 @@ import { BgWidget } from '../../backend-manager/bg-widget.js';
12
12
  import { UmClass } from '../../public-components/user-manager/um-class.js';
13
13
  import { Voucher, VoucherContent } from '../../public-components/user-manager/um-voucher.js';
14
14
  import { Language } from '../../glitter-base/global/language.js';
15
+ import { Tool } from '../../modules/tool.js';
15
16
 
16
17
  const html = String.raw;
17
18
  const css = String.raw;
@@ -1093,7 +1094,13 @@ export class PosFunction {
1093
1094
  'guest',
1094
1095
  }).then(async res => {
1095
1096
  if (res.result && res.response.data) {
1096
- vm.dataList = res.response.data.filter((item: Voucher) => item.content.trigger === 'code');
1097
+ vm.dataList = res.response.data.filter((item: Voucher) => {
1098
+ return (
1099
+ item.content.status === 1 &&
1100
+ item.content.trigger === 'code' &&
1101
+ Tool.isNowBetweenDates(item.content.start_ISO_Date, item.content.end_ISO_Date)
1102
+ );
1103
+ });
1097
1104
  } else {
1098
1105
  vm.dataList = [];
1099
1106
  }
@@ -1052,6 +1052,7 @@ export class StockHistory {
1052
1052
  gvc: gvc,
1053
1053
  default: dvm.variantIds,
1054
1054
  with_variants: true,
1055
+ right_element_type: 'stock',
1055
1056
  callback: (value) => __awaiter(this, void 0, void 0, function* () {
1056
1057
  dvm.variantIds = value;
1057
1058
  gvc.notifyDataChange(dvm.tableId);
@@ -1138,21 +1138,12 @@ export class StockHistory {
1138
1138
  gvc: gvc,
1139
1139
  default: dvm.variantIds,
1140
1140
  with_variants: true,
1141
+ right_element_type: 'stock',
1141
1142
  callback: async value => {
1142
1143
  dvm.variantIds = value;
1143
1144
  gvc.notifyDataChange(dvm.tableId);
1144
- // alert(JSON.stringify(value))
1145
1145
  },
1146
1146
  });
1147
- // BgWidget.variantDialog({
1148
- // gvc,
1149
- // title: '搜尋商品',
1150
- // default: dvm.variantIds,
1151
- // callback: resultData => {
1152
- // dvm.variantIds = resultData;
1153
- // gvc.notifyDataChange(dvm.tableId);
1154
- // },
1155
- // });
1156
1147
  })}"
1157
1148
  >
1158
1149
  <div>新增${typeData.name}商品</div>
@@ -590,12 +590,12 @@ h6 {
590
590
 
591
591
  .form-switch .form-check-input:checked {
592
592
  background-color: var(--main-black) !important;
593
- box-shadow: 0 0.5rem 1.125rem -0.5rem var(--main-black);
593
+ box-shadow: 1px 1px 2.5px rgba(0, 0, 0, 0.2);
594
594
  }
595
595
 
596
596
  .form-switch .form-check-input-success:checked {
597
597
  background-color: var(--item-success) !important;
598
- box-shadow: 0 0.5rem 1.125rem -0.5rem var(--main-black);
598
+ box-shadow: 1px 1px 2.5px rgba(0, 0, 0, 0.2);
599
599
  }
600
600
 
601
601
  .bt_border_editor {