ts-glitter 21.6.7 → 21.7.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.
@@ -3106,7 +3106,7 @@ export class Shopping {
3106
3106
  await this.resetStore(origin.orderData.lineItems, 'minus');
3107
3107
  }
3108
3108
 
3109
- //當訂單多了出貨單號碼,新增出貨日期,反之清空出貨日期。
3109
+ // 當訂單多了出貨單號碼,新增出貨日期,反之清空出貨日期。
3110
3110
  if (update.orderData.user_info.shipment_number && !update.orderData.user_info.shipment_date) {
3111
3111
  update.orderData.user_info.shipment_date = new Date().toISOString();
3112
3112
  } else if (!update.orderData.user_info.shipment_number) {
@@ -3114,7 +3114,7 @@ export class Shopping {
3114
3114
  }
3115
3115
 
3116
3116
  // 當訂單出貨狀態變更,觸發通知事件
3117
- const updateProgress = update.orderData.progress;
3117
+ const updateProgress = update.orderData.progress || 'wait';
3118
3118
 
3119
3119
  if (
3120
3120
  updateProgress === 'wait' &&
@@ -4446,9 +4446,7 @@ export class Shopping {
4446
4446
  }
4447
4447
 
4448
4448
  const insertData = await db.query(
4449
- `replace
4450
- INTO \`${this.app}\`.t_variants
4451
- SET ?
4449
+ `REPLACE INTO \`${this.app}\`.t_variants SET ?
4452
4450
  `,
4453
4451
  [insertObj]
4454
4452
  );
@@ -4483,9 +4481,8 @@ export class Shopping {
4483
4481
  });
4484
4482
 
4485
4483
  await db.query(
4486
- `UPDATE \`${this.app}\`.t_manager_post
4487
- SET ?
4488
- WHERE id = ?`,
4484
+ `UPDATE \`${this.app}\`.t_manager_post SET ? WHERE id = ?
4485
+ `,
4489
4486
  [{ content: JSON.stringify(content) }, content.id]
4490
4487
  );
4491
4488
  } catch (error) {
@@ -4555,7 +4552,8 @@ export class Shopping {
4555
4552
  const variant_s: any = pd_data.variants.find((dd: any) => {
4556
4553
  return dd.spec.join('-') === spec.join('-');
4557
4554
  });
4558
- //如果是餐飲組合扣除庫存方式不同
4555
+
4556
+ // 如果是餐飲組合扣除庫存方式不同
4559
4557
  if (pd_data.product_category === 'kitchen' && pd_data.specs && pd_data.specs.length) {
4560
4558
  variant_s.spec.map((d1: any, index: number) => {
4561
4559
  const count_s = `${
@@ -4571,10 +4569,12 @@ export class Shopping {
4571
4569
  });
4572
4570
  } else {
4573
4571
  const store_config = await new User(this.app).getConfigV2({ key: 'store_manager', user_id: 'manager' });
4572
+
4574
4573
  if (Object.keys(variant_s.stockList).length === 0) {
4575
- //適應舊版庫存更新
4574
+ // 適應舊版庫存更新
4576
4575
  variant_s.stockList[store_config.list[0].id] = { count: variant_s.stock };
4577
4576
  }
4577
+
4578
4578
  if (variant_s.stockList[stock_id]) {
4579
4579
  variant_s.stockList[stock_id].count = variant_s.stockList[stock_id].count || 0;
4580
4580
  variant_s.stockList[stock_id].count = variant_s.stockList[stock_id].count + calc;