ts-glitter 21.9.0 → 21.9.2

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.
@@ -588,6 +588,60 @@ export class ShoppingOrderManager {
588
588
  return OrderSetting.combineOrders(gvc, checkArray, () => gvc.notifyDataChange(vm.id));
589
589
  },
590
590
  },
591
+ {
592
+ name: '更改付款狀態',
593
+ option: true,
594
+ event: (checkArray) => {
595
+ OrderSetting.allEditDialog({
596
+ gvc,
597
+ title: '批量更改付款狀態',
598
+ options: OrderSetting.getPaymentStatusOpt(),
599
+ callback: (value) => {
600
+ checkArray.forEach((order) => {
601
+ order.status = Number(value);
602
+ });
603
+ updateOrders(checkArray);
604
+ },
605
+ });
606
+ },
607
+ },
608
+ {
609
+ name: '更改出貨狀態',
610
+ option: true,
611
+ event: (checkArray) => {
612
+ OrderSetting.allEditDialog({
613
+ gvc,
614
+ title: '批量更改出貨狀態',
615
+ options: OrderSetting.getShippmentOpt(),
616
+ callback: (value) => {
617
+ checkArray.forEach((order) => {
618
+ order.orderData.progress = value;
619
+ if (['wait', 'returns', undefined].includes(value)) {
620
+ order.orderData.user_info.shipment_number = '';
621
+ }
622
+ });
623
+ updateOrders(checkArray);
624
+ },
625
+ });
626
+ },
627
+ },
628
+ {
629
+ name: '更改訂單狀態',
630
+ option: true,
631
+ event: (checkArray) => {
632
+ OrderSetting.allEditDialog({
633
+ gvc,
634
+ title: '批量更改訂單狀態',
635
+ options: OrderSetting.getOrderStatusOpt(),
636
+ callback: (value) => {
637
+ checkArray.forEach((order) => {
638
+ order.orderData.orderStatus = value;
639
+ });
640
+ updateOrders(checkArray);
641
+ },
642
+ });
643
+ },
644
+ },
591
645
  {
592
646
  name: '批改訂單各項狀態',
593
647
  option: true,
@@ -872,6 +926,51 @@ export class ShoppingOrderManager {
872
926
  },
873
927
  ];
874
928
  const defaultArray = [
929
+ {
930
+ name: '列印出貨明細 / 地址貼條',
931
+ event: (checkArray) => {
932
+ let type = '';
933
+ BgWidget.settingDialog({
934
+ gvc: gvc,
935
+ title: '列印模式',
936
+ innerHTML: (gvc) => BgWidget.select({
937
+ gvc,
938
+ callback: (value) => {
939
+ type = value;
940
+ },
941
+ default: '',
942
+ options: [
943
+ { title: '選擇列印模式', value: '' },
944
+ { title: '出貨明細', value: 'shipment' },
945
+ { title: '地址貼條', value: 'address' },
946
+ { title: '出貨明細 + 地址貼條', value: 'shipAddr' },
947
+ ].map(item => {
948
+ return {
949
+ key: item.value,
950
+ value: item.title,
951
+ };
952
+ }),
953
+ }),
954
+ footer_html: (gvc) => {
955
+ return [
956
+ BgWidget.cancel(gvc.event(() => {
957
+ gvc.closeDialog();
958
+ }), '取消'),
959
+ BgWidget.save(gvc.event(() => {
960
+ if (['shipment', 'address', 'shipAddr'].includes(type)) {
961
+ gvc.closeDialog();
962
+ DeliveryHTML.print(gvc, checkArray, type);
963
+ }
964
+ else {
965
+ dialog.infoMessage({ text: '請選擇列印模式' });
966
+ }
967
+ }), '列印'),
968
+ ].join('');
969
+ },
970
+ width: 350,
971
+ });
972
+ },
973
+ },
875
974
  {
876
975
  name: query.isArchived ? '解除封存' : '批量封存',
877
976
  event: (checkArray) => {
@@ -915,27 +1014,6 @@ export class ShoppingOrderManager {
915
1014
  DeliveryHTML.print(gvc, checkArray, 'pick');
916
1015
  },
917
1016
  },
918
- {
919
- name: '列印出貨明細',
920
- option: true,
921
- event: (checkArray) => {
922
- DeliveryHTML.print(gvc, checkArray, 'shipment');
923
- },
924
- },
925
- {
926
- name: '列印地址貼條',
927
- option: true,
928
- event: (checkArray) => {
929
- DeliveryHTML.print(gvc, checkArray, 'address');
930
- },
931
- },
932
- {
933
- name: '列印出貨明細 + 地址貼條',
934
- option: true,
935
- event: (checkArray) => {
936
- DeliveryHTML.print(gvc, checkArray, 'shipAddr');
937
- },
938
- },
939
1017
  ];
940
1018
  return [...defaultArray, ...(query.isShipment ? shipmentArray : normalArray)];
941
1019
  })(),
@@ -1999,7 +2077,7 @@ export class ShoppingOrderManager {
1999
2077
  const status = dd.discount_total > 0;
2000
2078
  const isMinus = status ? '-' : '';
2001
2079
  const isNegative = status ? 1 : -1;
2002
- return `${isMinus} $${(dd.discount_total * isNegative).toLocaleString()}`;
2080
+ return `${isMinus} $${(Math.floor(dd.discount_total) * isNegative).toLocaleString()}`;
2003
2081
  })(),
2004
2082
  },
2005
2083
  };
@@ -2057,7 +2135,7 @@ export class ShoppingOrderManager {
2057
2135
  <div>分倉出貨</div>
2058
2136
  <div
2059
2137
  class="${is_shipment ? 'd-none' : ''}"
2060
- style="display: flex;padding: 6px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
2138
+ style="display: flex;padding: 4px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
2061
2139
  onclick="${gvc.event(() => {
2062
2140
  OrderSetting.showEditShip({
2063
2141
  gvc: gvc,
@@ -2171,19 +2249,22 @@ export class ShoppingOrderManager {
2171
2249
  title: '',
2172
2250
  gvc: gvc,
2173
2251
  default: `${orderData.status}`,
2174
- options: [
2175
- {
2176
- title: '變更付款狀態',
2177
- value: '',
2178
- },
2179
- ]
2180
- .concat(ApiShop.getStatusArray(orderData.orderData.proof_purchase))
2181
- .map(item => {
2182
- return {
2183
- key: item.value,
2184
- value: item.title,
2185
- };
2186
- }),
2252
+ options: (() => {
2253
+ const paymentOptions = OrderSetting.getPaymentStatusOpt();
2254
+ const unpayOption = paymentOptions.find(item => item.key === '0');
2255
+ if (unpayOption) {
2256
+ if (orderData.orderData.proof_purchase) {
2257
+ unpayOption.value = '待核款';
2258
+ }
2259
+ else if (orderData.orderData.customer_info.payment_select == 'cash_on_delivery') {
2260
+ unpayOption.value = '貨到付款';
2261
+ }
2262
+ else {
2263
+ unpayOption.value = '未付款';
2264
+ }
2265
+ }
2266
+ return paymentOptions;
2267
+ })(),
2187
2268
  callback: text => {
2188
2269
  dialog.checkYesOrNot({
2189
2270
  text: '是否確認變更付款狀態?',
@@ -2389,28 +2470,28 @@ export class ShoppingOrderManager {
2389
2470
  <div class="w-100 d-flex tx_700 align-items-center justify-content-between">
2390
2471
  <div>顧客備註</div>
2391
2472
  <div
2392
- style="display: flex;padding: 6px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
2473
+ style="display: flex;padding: 4px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
2393
2474
  onclick="${gvc.event(() => {
2394
2475
  vm.edit_mode = !vm.edit_mode;
2395
2476
  gvc.notifyDataChange(vm.id);
2396
2477
  })}"
2397
2478
  >
2398
- ${vm.edit_mode ? `取消編輯` : `編輯`}
2479
+ ${vm.edit_mode ? '取消編輯' : '編輯'}
2399
2480
  </div>
2400
2481
  </div>
2401
2482
  ${BgWidget.mbContainer(18)}
2402
- <div style="position: relative;">
2483
+ <div style="position: relative; color: #8d8d8d;">
2403
2484
  ${vm.edit_mode
2404
2485
  ? EditorElem.editeText({
2405
2486
  gvc: gvc,
2406
2487
  title: '',
2407
2488
  default: orderData.orderData.user_info.note || '',
2408
- placeHolder: '',
2489
+ placeHolder: '請輸入備註',
2409
2490
  callback: text => {
2410
2491
  orderData.orderData.user_info.note = text;
2411
2492
  },
2412
2493
  })
2413
- : orderData.orderData.user_info.note || '尚未填寫顧客備註'}
2494
+ : orderData.orderData.user_info.note || '顧客尚未填寫備註'}
2414
2495
  </div>
2415
2496
  `;
2416
2497
  },
@@ -2426,30 +2507,19 @@ export class ShoppingOrderManager {
2426
2507
  view: () => {
2427
2508
  return html `
2428
2509
  <div class="w-100 d-flex tx_700 align-items-center justify-content-between">
2429
- <div>商家備註</div>
2430
- <div
2431
- style="display: flex;padding: 6px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
2432
- onclick="${gvc.event(() => {
2433
- vm.edit_mode = !vm.edit_mode;
2434
- gvc.notifyDataChange(vm.id);
2435
- })}"
2436
- >
2437
- ${vm.edit_mode ? `取消編輯` : `編輯`}
2438
- </div>
2510
+ 訂單備註
2439
2511
  </div>
2440
2512
  ${BgWidget.mbContainer(18)}
2441
2513
  <div style="position: relative;">
2442
- ${vm.edit_mode
2443
- ? EditorElem.editeText({
2444
- gvc: gvc,
2445
- title: '',
2446
- default: orderData.orderData.order_note || '',
2447
- placeHolder: '',
2448
- callback: text => {
2449
- orderData.orderData.order_note = text;
2450
- },
2451
- })
2452
- : orderData.orderData.order_note || '尚未填寫商家備註'}
2514
+ ${EditorElem.editeText({
2515
+ gvc: gvc,
2516
+ title: '',
2517
+ default: orderData.orderData.order_note || '',
2518
+ placeHolder: '請輸入備註',
2519
+ callback: text => {
2520
+ orderData.orderData.order_note = text;
2521
+ },
2522
+ })}
2453
2523
  </div>
2454
2524
  `;
2455
2525
  },
@@ -2650,7 +2720,7 @@ export class ShoppingOrderManager {
2650
2720
  <div class="tx_700">訂購人資料</div>
2651
2721
  <div class="flex-fill"></div>
2652
2722
  </div>
2653
- <div class="w-100 d-flex flex-column mt-2" style="gap:12px;">
2723
+ <div class="w-100 d-flex flex-column mt-2" style="gap:6px;">
2654
2724
  ${[
2655
2725
  html ` <div class="d-flex flex-column" style="gap:8px;">
2656
2726
  <div
@@ -2711,7 +2781,7 @@ export class ShoppingOrderManager {
2711
2781
  ${(_l = (_k = (_j = userData === null || userData === void 0 ? void 0 : userData.userData) === null || _j === void 0 ? void 0 : _j.email) !== null && _k !== void 0 ? _k : orderData.orderData.user_info.email) !== null && _l !== void 0 ? _l : ''}
2712
2782
  </div>
2713
2783
  </div>`,
2714
- BgWidget.horizontalLine(),
2784
+ BgWidget.horizontalLine({ margin: 0.5 }),
2715
2785
  gvc.bindView({
2716
2786
  bind: `user_info`,
2717
2787
  view: () => {
@@ -2748,10 +2818,11 @@ export class ShoppingOrderManager {
2748
2818
  </div>
2749
2819
  `;
2750
2820
  })
2751
- .join(BgWidget.mbContainer(4));
2821
+ .join('');
2752
2822
  }),
2753
2823
  divCreate: {
2754
- class: `tx_normal`,
2824
+ class: 'd-flex flex-column tx_normal',
2825
+ style: 'gap: 8px;',
2755
2826
  },
2756
2827
  };
2757
2828
  }),
@@ -2775,33 +2846,28 @@ export class ShoppingOrderManager {
2775
2846
  case 'UNIMARTC2C':
2776
2847
  case 'UNIMARTFREEZE':
2777
2848
  case 'FAMIC2CFREEZE':
2778
- return [
2779
- html ` <div class="d-flex flex-wrap w-100">
2780
- <span class="me-2 fw-normal fs-6">門市名稱:</span>
2849
+ return html ` <div class="tx_700">配送資訊</div>
2850
+ <div class="d-flex flex-wrap w-100">
2781
2851
  <div
2782
2852
  class="fw-normal fs-6"
2783
2853
  style="white-space: normal;word-break: break-all;"
2784
2854
  >
2785
- ${decodeURI(orderData.orderData.user_info.CVSStoreName)}
2855
+ ${decodeURI(orderData.orderData.user_info.CVSStoreName)}(${orderData.orderData.user_info.CVSStoreID})
2786
2856
  </div>
2787
- </div>`,
2788
- html ` <div class="fw-normal fs-6">
2789
- 代號: ${orderData.orderData.user_info.CVSStoreID}
2790
- </div>`,
2791
- html ` <div
2857
+ </div>
2858
+ <div
2792
2859
  class="fw-normal fs-6 w-100"
2793
2860
  style="white-space: normal;word-break: break-all;"
2794
2861
  >
2795
- 地址: ${orderData.orderData.user_info.CVSAddress}
2796
- </div>`,
2797
- ].join('');
2862
+ ${orderData.orderData.user_info.CVSAddress}
2863
+ </div>`;
2798
2864
  case 'global_express':
2799
2865
  case 'black_cat_freezing':
2800
2866
  case 'normal':
2801
2867
  default:
2802
2868
  const mapView = [];
2803
2869
  if (orderData.orderData.user_info.address) {
2804
- mapView.push(html ` <div class="tx_700">配送地址</div>
2870
+ mapView.push(html `<div class="tx_700">配送資訊</div>
2805
2871
  <div class="fw-normal fs-6" style="white-space: normal;">
2806
2872
  ${[
2807
2873
  orderData.orderData.user_info.city,
@@ -2865,7 +2931,7 @@ export class ShoppingOrderManager {
2865
2931
  `
2866
2932
  : ''}
2867
2933
  `);
2868
- return view.join(`<div class="my-2"></div>`);
2934
+ return view.join(BgWidget.horizontalLine({ margin: 0.5 }));
2869
2935
  },
2870
2936
  divCreate: {
2871
2937
  class: 'd-flex flex-column',
@@ -3421,6 +3487,11 @@ export class ShoppingOrderManager {
3421
3487
  sale_price: variant.sale_price,
3422
3488
  sku: variant.sku,
3423
3489
  deduction_log: {},
3490
+ rebate: 0,
3491
+ weight: 0,
3492
+ is_gift: false,
3493
+ origin_price: variant.cost || variant.sale_price,
3494
+ discount_price: 0,
3424
3495
  });
3425
3496
  orderDetail.subtotal +=
3426
3497
  Number(orderDetail.lineItems[index].count) * orderDetail.lineItems[index].sale_price;
@@ -3982,7 +4053,7 @@ export class ShoppingOrderManager {
3982
4053
  style: 'width: 100%; display: flex; align-items: center; margin: 24px 0;',
3983
4054
  },
3984
4055
  })}
3985
- ${BgWidget.horizontalLine()} ${showOrderDetail()}
4056
+ ${BgWidget.horizontalLine({ margin: 0.5 })} ${showOrderDetail()}
3986
4057
  </div>
3987
4058
  <!-- 選擇顧客 --- 顧客資料填寫 -->
3988
4059
  <div style="margin-top: 24px"></div>