ts-glitter 21.5.3 → 21.5.5

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 (79) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/cms-plugin/account-info.js +79 -67
  4. package/lowcode/cms-plugin/account-info.ts +327 -311
  5. package/lowcode/cms-plugin/information/information-module.ts +3 -1
  6. package/lowcode/cms-plugin/list-header-option.js +1 -0
  7. package/lowcode/cms-plugin/list-header-option.ts +1 -0
  8. package/lowcode/cms-plugin/shopping-information.js +468 -0
  9. package/lowcode/cms-plugin/shopping-information.ts +557 -0
  10. package/lowcode/cms-plugin/shopping-market-shopee.js +283 -231
  11. package/lowcode/cms-plugin/shopping-market-shopee.ts +401 -361
  12. package/lowcode/cms-plugin/shopping-order-manager.js +16 -4
  13. package/lowcode/cms-plugin/shopping-order-manager.ts +18 -3
  14. package/lowcode/glitter-base/global/language.js +4 -1
  15. package/lowcode/glitter-base/global/language.ts +4 -2
  16. package/lowcode/glitter-base/route/shopee.js +48 -11
  17. package/lowcode/glitter-base/route/shopee.ts +119 -80
  18. package/lowcode/glitterBundle/plugins/html-render.js +121 -90
  19. package/lowcode/glitterBundle/plugins/html-render.ts +367 -318
  20. package/lowcode/modules/image-library.js +2 -3
  21. package/lowcode/modules/image-library.ts +21 -7
  22. package/lowcode/public-components/checkout/index.js +90 -41
  23. package/lowcode/public-components/checkout/index.ts +101 -49
  24. package/lowcode/public-components/footer/footer-initial.js +11 -2
  25. package/lowcode/public-components/footer/footer-initial.ts +29 -18
  26. package/lowcode/public-components/headers/header-class.js +47 -35
  27. package/lowcode/public-components/headers/header-class.ts +54 -38
  28. package/lowcode/public-components/layout-plugin/social-links-01.js +122 -3
  29. package/lowcode/public-components/layout-plugin/social-links-01.ts +135 -10
  30. package/lowcode/public-components/product/pd-card-01.js +23 -14
  31. package/lowcode/public-components/product/pd-card-01.ts +25 -14
  32. package/lowcode/public-components/product/pd-card-02.js +23 -16
  33. package/lowcode/public-components/product/pd-card-02.ts +25 -16
  34. package/lowcode/public-components/product/pd-card-03.js +25 -16
  35. package/lowcode/public-components/product/pd-card-03.ts +27 -16
  36. package/lowcode/public-components/terms-related/index.js +13 -2
  37. package/lowcode/public-components/terms-related/index.ts +15 -2
  38. package/lowcode/public-components/user-manager/um-class.js +490 -501
  39. package/lowcode/public-components/user-manager/um-class.ts +872 -882
  40. package/lowcode/public-components/user-manager/um-info.js +41 -40
  41. package/lowcode/public-components/user-manager/um-info.ts +54 -56
  42. package/lowcode/public-components/user-manager/um-login.js +10 -13
  43. package/lowcode/public-components/user-manager/um-login.ts +15 -23
  44. package/lowcode/public-components/user-manager/um-orderlist.js +60 -51
  45. package/lowcode/public-components/user-manager/um-orderlist.ts +289 -275
  46. package/lowcode/public-components/user-manager/um-rebate.js +104 -82
  47. package/lowcode/public-components/user-manager/um-rebate.ts +294 -267
  48. package/lowcode/public-components/user-manager/um-receive.js +582 -0
  49. package/lowcode/public-components/user-manager/um-receive.ts +599 -0
  50. package/lowcode/public-components/user-manager/um-wishlist.js +72 -68
  51. package/lowcode/public-components/user-manager/um-wishlist.ts +240 -230
  52. package/package.json +1 -1
  53. package/src/api-public/controllers/shopee.js +17 -0
  54. package/src/api-public/controllers/shopee.js.map +1 -1
  55. package/src/api-public/controllers/shopee.ts +32 -0
  56. package/src/api-public/services/monitor.d.ts +1 -0
  57. package/src/api-public/services/post.js +17 -7
  58. package/src/api-public/services/post.js.map +1 -1
  59. package/src/api-public/services/rebate.js +2 -11
  60. package/src/api-public/services/rebate.js.map +1 -1
  61. package/src/api-public/services/rebate.ts +5 -12
  62. package/src/api-public/services/shopee.d.ts +23 -2
  63. package/src/api-public/services/shopee.js +230 -111
  64. package/src/api-public/services/shopee.js.map +1 -1
  65. package/src/api-public/services/shopee.ts +1012 -838
  66. package/src/api-public/services/user.js +2 -2
  67. package/src/api-public/services/user.js.map +1 -1
  68. package/src/api-public/services/user.ts +3 -3
  69. package/src/index.js +17 -7
  70. package/src/index.js.map +1 -1
  71. package/src/modules/tool.d.ts +4 -4
  72. package/src/modules/tool.js +2 -1
  73. package/src/modules/tool.js.map +1 -1
  74. package/src/services/backend-service.js +17 -7
  75. package/src/services/backend-service.js.map +1 -1
  76. package/src/services/template.d.ts +1 -1
  77. package/src/services/template.js +24 -18
  78. package/src/services/template.js.map +1 -1
  79. package/src/services/template.ts +34 -37
@@ -367,6 +367,8 @@ export class ShoppingOrderManager {
367
367
  dd.orderData.customer_info = (_a = dd.orderData.customer_info) !== null && _a !== void 0 ? _a : {};
368
368
  const isWatchUser = watchUsers.includes(dd.orderData.email);
369
369
  const tooltipText = isWatchUser ? '此份訂單的顧客為觀察名單' : '';
370
+ const userName = dd.orderData.customer_info ? dd.orderData.customer_info.name || '未填寫' : '匿名';
371
+ const receiveName = dd.orderData.user_info ? dd.orderData.user_info.name || '未填寫' : '匿名';
370
372
  if (query.isShipment) {
371
373
  return [
372
374
  {
@@ -382,7 +384,11 @@ export class ShoppingOrderManager {
382
384
  },
383
385
  {
384
386
  key: '訂購人',
385
- value: dd.orderData.user_info ? dd.orderData.user_info.name || '未填寫' : '匿名',
387
+ value: dd.orderData.orderSource === 'POS' ? receiveName : userName,
388
+ },
389
+ {
390
+ key: '收件人',
391
+ value: receiveName,
386
392
  },
387
393
  {
388
394
  key: '出貨狀態',
@@ -412,7 +418,11 @@ export class ShoppingOrderManager {
412
418
  },
413
419
  {
414
420
  key: '訂購人',
415
- value: dd.orderData.user_info ? dd.orderData.user_info.name || '未填寫' : '匿名',
421
+ value: dd.orderData.orderSource === 'POS' ? receiveName : userName,
422
+ },
423
+ {
424
+ key: '收件人',
425
+ value: receiveName,
416
426
  },
417
427
  {
418
428
  key: '訂單金額',
@@ -2655,12 +2665,14 @@ export class ShoppingOrderManager {
2655
2665
  >
2656
2666
  ${[
2657
2667
  (() => {
2658
- var _a;
2668
+ var _a, _b, _c;
2659
2669
  const name = (_a = userData === null || userData === void 0 ? void 0 : userData.userData) === null || _a === void 0 ? void 0 : _a.name;
2660
2670
  if (name) {
2661
2671
  return html `<span style="font-weight: 500; color: #4D86DB;">${name}</span>`;
2662
2672
  }
2663
- return html `<span style="font-weight: normal; color: #393939;">訪客</span>`;
2673
+ return html `<span style="font-weight: normal; color: #393939;"
2674
+ >${((_c = (_b = orderData.orderData) === null || _b === void 0 ? void 0 : _b.customer_info) === null || _c === void 0 ? void 0 : _c.name) || '訪客'}</span
2675
+ >`;
2664
2676
  })(),
2665
2677
  (() => {
2666
2678
  if (userData.status === 0) {
@@ -440,6 +440,11 @@ export class ShoppingOrderManager {
440
440
  const isWatchUser = watchUsers.includes(dd.orderData.email);
441
441
  const tooltipText = isWatchUser ? '此份訂單的顧客為觀察名單' : '';
442
442
 
443
+ // 顧客資料 | 訂購人資料
444
+ const userName = dd.orderData.customer_info ? dd.orderData.customer_info.name || '未填寫' : '匿名';
445
+ // 收件人資料
446
+ const receiveName = dd.orderData.user_info ? dd.orderData.user_info.name || '未填寫' : '匿名';
447
+
443
448
  if (query.isShipment) {
444
449
  return [
445
450
  {
@@ -455,7 +460,11 @@ export class ShoppingOrderManager {
455
460
  },
456
461
  {
457
462
  key: '訂購人',
458
- value: dd.orderData.user_info ? dd.orderData.user_info.name || '未填寫' : '匿名',
463
+ value: dd.orderData.orderSource === 'POS' ? receiveName : userName,
464
+ },
465
+ {
466
+ key: '收件人',
467
+ value: receiveName,
459
468
  },
460
469
  {
461
470
  key: '出貨狀態',
@@ -484,7 +493,11 @@ export class ShoppingOrderManager {
484
493
  },
485
494
  {
486
495
  key: '訂購人',
487
- value: dd.orderData.user_info ? dd.orderData.user_info.name || '未填寫' : '匿名',
496
+ value: dd.orderData.orderSource === 'POS' ? receiveName : userName,
497
+ },
498
+ {
499
+ key: '收件人',
500
+ value: receiveName,
488
501
  },
489
502
  {
490
503
  key: '訂單金額',
@@ -2930,7 +2943,9 @@ export class ShoppingOrderManager {
2930
2943
  if (name) {
2931
2944
  return html`<span style="font-weight: 500; color: #4D86DB;">${name}</span>`;
2932
2945
  }
2933
- return html`<span style="font-weight: normal; color: #393939;">訪客</span>`;
2946
+ return html`<span style="font-weight: normal; color: #393939;"
2947
+ >${orderData.orderData?.customer_info?.name || '訪客'}</span
2948
+ >`;
2934
2949
  })(),
2935
2950
  (() => {
2936
2951
  if (userData.status === 0) {
@@ -140,6 +140,7 @@ export class Language {
140
140
  { key: 'can_buy', tw: '可售數量', cn: '可售数量', en: `Available quantity` },
141
141
  { key: 'login_in_to_checkout', tw: '登入後結帳', cn: '登入后结帐', en: `Log in and checkout` },
142
142
  { key: 'birth', tw: '生日', cn: '生日', en: `Birth` },
143
+ { key: 'select', tw: '選取', cn: '选择', en: 'Select' },
143
144
  {
144
145
  key: 'disable_ship',
145
146
  tw: '無配送方式',
@@ -154,6 +155,7 @@ export class Language {
154
155
  },
155
156
  { key: 'buy_it_now', tw: '立即購買', cn: '立即购买', en: `Buy it now` },
156
157
  { key: 'cart', tw: '購物車', cn: '购物车', en: `Cart` },
158
+ { key: 'cart_subtotal', tw: '購物車小計', cn: '购物车小计', en: `Cart Subtotal` },
157
159
  {
158
160
  key: 'free_shipping_achieved',
159
161
  tw: '已達成免運費',
@@ -249,6 +251,7 @@ export class Language {
249
251
  cn: '付款及配送方式',
250
252
  en: 'Payment and shipping',
251
253
  },
254
+ { key: 'recipient_info', tw: '收件人資料', cn: '收件人资料', en: 'Recipient Information' },
252
255
  { key: 'payment_method', tw: '付款方式', cn: '付款方式', en: 'Payment method' },
253
256
  { key: 'shipping_method', tw: '配送方式', cn: '配送方式', en: 'Shipping method' },
254
257
  { key: 'shipping_address', tw: '配送地址', cn: '配送地址', en: 'Shipping address' },
@@ -256,7 +259,6 @@ export class Language {
256
259
  { key: 'name', tw: '姓名', cn: '姓名', en: 'Name' },
257
260
  { key: 'contact_number', tw: '聯絡電話', cn: '联系电话', en: 'Contact number' },
258
261
  { key: 'email', tw: '電子信箱', cn: '电子邮箱', en: 'Email' },
259
- { key: 'recipient_info', tw: '收件人資料', cn: '收件人资料', en: 'Recipient information' },
260
262
  { key: 'invoice_recipient', tw: '發票開立對象', cn: '发票开立对象', en: 'Invoice recipient' },
261
263
  { key: 'invoice_method', tw: '開立方式', cn: '开立方式', en: 'Invoice method' },
262
264
  { key: 'invoice_number', tw: '發票號碼', cn: '發票號碼', en: 'Invoice number' },
@@ -273,6 +275,7 @@ export class Language {
273
275
  { key: 'send_to_user_email', tw: '傳送至用戶信箱', cn: '传送至用户邮箱', en: 'Send to user email' },
274
276
  { key: 'mobile_barcode_device', tw: '手機條碼載具', cn: '手机条码载具', en: 'Mobile barcode device' },
275
277
  { key: 'add_to_cart', tw: '加入購物車', cn: '加入购物车', en: 'Add to Cart' },
278
+ { key: 'sold_out', tw: '商品已售完', cn: '商品已售罄', en: 'Sold Out' },
276
279
  { key: 'preorder_item', tw: '預購商品', cn: '预购商品', en: 'Preorder Item' },
277
280
  { key: 'confirm_select', tw: '確認選擇', cn: '确认选择', en: 'Confirm selection' },
278
281
  { key: 'add_to_cart_success', tw: '加入成功', cn: '加入成功', en: 'Added successfully' },
@@ -140,7 +140,6 @@ export class Language {
140
140
  { key: 'line_pay', tw: 'Line Pay', cn: 'Line Pay', en: `Line Pay` },
141
141
  { key: 'jkopay', tw: '街口支付', cn: '街口支付', en: `JKOPAY` },
142
142
  { key: 'paynow', tw: 'PayNow 立吉富', cn: 'PayNow 立吉富', en: `PayNow` },
143
-
144
143
  { key: 'atm', tw: 'ATM 轉帳', cn: 'ATM 转帐', en: `ATM Transfer` },
145
144
  { key: 'line', tw: 'Line 轉帳', cn: 'Line 转帐', en: `Line Bank` },
146
145
  { key: 'cash_on_delivery', tw: '貨到付款', cn: '货到付款', en: `Cash on delivery` },
@@ -150,6 +149,7 @@ export class Language {
150
149
  { key: 'can_buy', tw: '可售數量', cn: '可售数量', en: `Available quantity` },
151
150
  { key: 'login_in_to_checkout', tw: '登入後結帳', cn: '登入后结帐', en: `Log in and checkout` },
152
151
  { key: 'birth', tw: '生日', cn: '生日', en: `Birth` },
152
+ { key: 'select', tw: '選取', cn: '选择', en: 'Select' },
153
153
  {
154
154
  key: 'disable_ship',
155
155
  tw: '無配送方式',
@@ -164,6 +164,7 @@ export class Language {
164
164
  },
165
165
  { key: 'buy_it_now', tw: '立即購買', cn: '立即购买', en: `Buy it now` },
166
166
  { key: 'cart', tw: '購物車', cn: '购物车', en: `Cart` },
167
+ { key: 'cart_subtotal', tw: '購物車小計', cn: '购物车小计', en: `Cart Subtotal` },
167
168
  {
168
169
  key: 'free_shipping_achieved',
169
170
  tw: '已達成免運費',
@@ -259,6 +260,7 @@ export class Language {
259
260
  cn: '付款及配送方式',
260
261
  en: 'Payment and shipping',
261
262
  },
263
+ { key: 'recipient_info', tw: '收件人資料', cn: '收件人资料', en: 'Recipient Information' },
262
264
  { key: 'payment_method', tw: '付款方式', cn: '付款方式', en: 'Payment method' },
263
265
  { key: 'shipping_method', tw: '配送方式', cn: '配送方式', en: 'Shipping method' },
264
266
  { key: 'shipping_address', tw: '配送地址', cn: '配送地址', en: 'Shipping address' },
@@ -266,7 +268,6 @@ export class Language {
266
268
  { key: 'name', tw: '姓名', cn: '姓名', en: 'Name' },
267
269
  { key: 'contact_number', tw: '聯絡電話', cn: '联系电话', en: 'Contact number' },
268
270
  { key: 'email', tw: '電子信箱', cn: '电子邮箱', en: 'Email' },
269
- { key: 'recipient_info', tw: '收件人資料', cn: '收件人资料', en: 'Recipient information' },
270
271
  { key: 'invoice_recipient', tw: '發票開立對象', cn: '发票开立对象', en: 'Invoice recipient' },
271
272
  { key: 'invoice_method', tw: '開立方式', cn: '开立方式', en: 'Invoice method' },
272
273
  { key: 'invoice_number', tw: '發票號碼', cn: '發票號碼', en: 'Invoice number' },
@@ -283,6 +284,7 @@ export class Language {
283
284
  { key: 'send_to_user_email', tw: '傳送至用戶信箱', cn: '传送至用户邮箱', en: 'Send to user email' },
284
285
  { key: 'mobile_barcode_device', tw: '手機條碼載具', cn: '手机条码载具', en: 'Mobile barcode device' },
285
286
  { key: 'add_to_cart', tw: '加入購物車', cn: '加入购物车', en: 'Add to Cart' },
287
+ { key: 'sold_out', tw: '商品已售完', cn: '商品已售罄', en: 'Sold Out' },
286
288
  { key: 'preorder_item', tw: '預購商品', cn: '预购商品', en: 'Preorder Item' },
287
289
  { key: 'confirm_select', tw: '確認選擇', cn: '确认选择', en: 'Confirm selection' },
288
290
  { key: 'add_to_cart_success', tw: '加入成功', cn: '加入成功', en: 'Added successfully' },
@@ -10,11 +10,29 @@ export class ApiShopee {
10
10
  Authorization: getConfig().config.token,
11
11
  },
12
12
  data: JSON.stringify({
13
- "redirect": redirect
14
- })
13
+ redirect: redirect,
14
+ }),
15
15
  }).then(r => {
16
- console.log("r.response.result -- ", r.response.result);
17
- localStorage.setItem("shopee", window.parent.location.href);
16
+ console.log('r.response.result -- ', r.response.result);
17
+ localStorage.setItem('shopee', window.parent.location.href);
18
+ window.parent.location.href = r.response.result;
19
+ });
20
+ }
21
+ static generateOrderAuth(redirect) {
22
+ BaseApi.create({
23
+ url: getBaseUrl() + `/api-public/v1/shopee/getOrderAuth`,
24
+ type: 'POST',
25
+ headers: {
26
+ 'Content-Type': 'application/json',
27
+ 'g-app': getConfig().config.appName,
28
+ Authorization: getConfig().config.token,
29
+ },
30
+ data: JSON.stringify({
31
+ redirect: redirect,
32
+ }),
33
+ }).then(r => {
34
+ console.log('r.response.result -- ', r.response.result);
35
+ localStorage.setItem('shopee', window.parent.location.href);
18
36
  window.parent.location.href = r.response.result;
19
37
  });
20
38
  }
@@ -28,11 +46,11 @@ export class ApiShopee {
28
46
  Authorization: getConfig().config.token,
29
47
  },
30
48
  data: JSON.stringify({
31
- "code": code,
32
- "shop_id": shop_id
33
- })
49
+ code: code,
50
+ shop_id: shop_id,
51
+ }),
34
52
  }).then(r => {
35
- console.log("r -- ", r);
53
+ console.log('r -- ', r);
36
54
  });
37
55
  }
38
56
  static getItemList(start, end, callback) {
@@ -45,10 +63,11 @@ export class ApiShopee {
45
63
  Authorization: getConfig().config.token,
46
64
  },
47
65
  data: JSON.stringify({
48
- "start": start,
49
- "end": end
50
- })
66
+ start: start,
67
+ end: end,
68
+ }),
51
69
  }).then(r => {
70
+ console.log('r -- ', r);
52
71
  callback(r.response);
53
72
  });
54
73
  }
@@ -76,6 +95,24 @@ export class ApiShopee {
76
95
  },
77
96
  });
78
97
  }
98
+ static getOrderList(start, end, callback) {
99
+ BaseApi.create({
100
+ url: getBaseUrl() + `/api-public/v1/shopee/getOrderList`,
101
+ type: 'POST',
102
+ headers: {
103
+ 'Content-Type': 'application/json',
104
+ 'g-app': getConfig().config.appName,
105
+ Authorization: getConfig().config.token,
106
+ },
107
+ data: JSON.stringify({
108
+ start: start,
109
+ end: end,
110
+ }),
111
+ }).then(r => {
112
+ console.log('r -- ', r);
113
+ callback(r.response);
114
+ });
115
+ }
79
116
  }
80
117
  function getConfig() {
81
118
  const saasConfig = window.parent.saasConfig;
@@ -1,93 +1,132 @@
1
1
  import { BaseApi } from '../../glitterBundle/api/base.js';
2
2
 
3
3
  export class ApiShopee {
4
- public static generateAuth(redirect:string){
5
- BaseApi.create({
6
- url: getBaseUrl() + `/api-public/v1/shopee/getAuth`,
7
- type: 'POST',
8
- headers: {
9
- 'Content-Type': 'application/json',
10
- 'g-app': getConfig().config.appName,
11
- Authorization: getConfig().config.token,
12
- },
13
- data: JSON.stringify({
14
- "redirect" : redirect
15
- })
16
- }).then(r => {
17
- console.log("r.response.result -- " , r.response.result)
18
- localStorage.setItem("shopee" , window.parent.location.href);
19
- window.parent.location.href = r.response.result;
20
- });
21
- }
22
- public static getToken(code:string , shop_id:number){
23
- BaseApi.create({
24
- url: getBaseUrl() + `/api-public/v1/shopee/getToken`,
25
- type: 'POST',
26
- headers: {
27
- 'Content-Type': 'application/json',
28
- 'g-app': getConfig().config.appName,
29
- Authorization: getConfig().config.token,
30
- },
31
- data: JSON.stringify({
32
- "code" : code,
33
- "shop_id" : shop_id
34
- })
35
- }).then(r => {
36
- console.log("r -- " , r);
4
+ public static generateAuth(redirect: string) {
5
+ BaseApi.create({
6
+ url: getBaseUrl() + `/api-public/v1/shopee/getAuth`,
7
+ type: 'POST',
8
+ headers: {
9
+ 'Content-Type': 'application/json',
10
+ 'g-app': getConfig().config.appName,
11
+ Authorization: getConfig().config.token,
12
+ },
13
+ data: JSON.stringify({
14
+ redirect: redirect,
15
+ }),
16
+ }).then(r => {
17
+ console.log('r.response.result -- ', r.response.result);
18
+ localStorage.setItem('shopee', window.parent.location.href);
19
+ window.parent.location.href = r.response.result;
20
+ });
21
+ }
37
22
 
38
- });
39
- }
40
- public static getItemList(start:number , end:number ,callback:(response:any)=>void){
23
+ public static generateOrderAuth(redirect: string) {
24
+ BaseApi.create({
25
+ url: getBaseUrl() + `/api-public/v1/shopee/getOrderAuth`,
26
+ type: 'POST',
27
+ headers: {
28
+ 'Content-Type': 'application/json',
29
+ 'g-app': getConfig().config.appName,
30
+ Authorization: getConfig().config.token,
31
+ },
32
+ data: JSON.stringify({
33
+ redirect: redirect,
34
+ }),
35
+ }).then(r => {
36
+ console.log('r.response.result -- ', r.response.result);
37
+ localStorage.setItem('shopee', window.parent.location.href);
38
+ window.parent.location.href = r.response.result;
39
+ });
40
+ }
41
41
 
42
- BaseApi.create({
43
- url: getBaseUrl() + `/api-public/v1/shopee/getItemList`,
44
- type: 'POST',
45
- headers: {
46
- 'Content-Type': 'application/json',
47
- 'g-app': getConfig().config.appName,
48
- Authorization: getConfig().config.token,
49
- },
50
- data: JSON.stringify({
51
- "start" : start,
52
- "end" : end
53
- })
54
- }).then(r => {
55
- callback(r.response);
56
- });
57
- }
58
- public static syncProduct(callback:(response:any)=>void){
59
- BaseApi.create({
60
- url: getBaseUrl() + `/api-public/v1/shopee/syncStock`,
61
- type: 'POST',
62
- headers: {
63
- 'Content-Type': 'application/json',
64
- 'g-app': getConfig().config.appName,
65
- Authorization: getConfig().config.token,
66
- },
67
- }).then(r => {
68
- callback(r.response);
69
- });
70
- }
71
- public static syncStatus(){
72
- return BaseApi.create({
73
- url: getBaseUrl() + `/api-public/v1/shopee/sync-status`,
74
- type: 'GET',
75
- headers: {
76
- 'Content-Type': 'application/json',
77
- 'g-app': getConfig().config.appName,
78
- Authorization: getConfig().config.token,
79
- },
80
- });
81
- }
42
+ public static getToken(code: string, shop_id: number) {
43
+ BaseApi.create({
44
+ url: getBaseUrl() + `/api-public/v1/shopee/getToken`,
45
+ type: 'POST',
46
+ headers: {
47
+ 'Content-Type': 'application/json',
48
+ 'g-app': getConfig().config.appName,
49
+ Authorization: getConfig().config.token,
50
+ },
51
+ data: JSON.stringify({
52
+ code: code,
53
+ shop_id: shop_id,
54
+ }),
55
+ }).then(r => {
56
+ console.log('r -- ', r);
57
+ });
58
+ }
82
59
 
60
+ public static getItemList(start: number, end: number, callback: (response: any) => void) {
61
+ BaseApi.create({
62
+ url: getBaseUrl() + `/api-public/v1/shopee/getItemList`,
63
+ type: 'POST',
64
+ headers: {
65
+ 'Content-Type': 'application/json',
66
+ 'g-app': getConfig().config.appName,
67
+ Authorization: getConfig().config.token,
68
+ },
69
+ data: JSON.stringify({
70
+ start: start,
71
+ end: end,
72
+ }),
73
+ }).then(r => {
74
+ console.log('r -- ', r);
75
+ callback(r.response);
76
+ });
77
+ }
78
+
79
+ public static syncProduct(callback: (response: any) => void) {
80
+ BaseApi.create({
81
+ url: getBaseUrl() + `/api-public/v1/shopee/syncStock`,
82
+ type: 'POST',
83
+ headers: {
84
+ 'Content-Type': 'application/json',
85
+ 'g-app': getConfig().config.appName,
86
+ Authorization: getConfig().config.token,
87
+ },
88
+ }).then(r => {
89
+ callback(r.response);
90
+ });
91
+ }
92
+
93
+ public static syncStatus() {
94
+ return BaseApi.create({
95
+ url: getBaseUrl() + `/api-public/v1/shopee/sync-status`,
96
+ type: 'GET',
97
+ headers: {
98
+ 'Content-Type': 'application/json',
99
+ 'g-app': getConfig().config.appName,
100
+ Authorization: getConfig().config.token,
101
+ },
102
+ });
103
+ }
104
+
105
+ public static getOrderList(start: number, end: number, callback: (response: any) => void) {
106
+ BaseApi.create({
107
+ url: getBaseUrl() + `/api-public/v1/shopee/getOrderList`,
108
+ type: 'POST',
109
+ headers: {
110
+ 'Content-Type': 'application/json',
111
+ 'g-app': getConfig().config.appName,
112
+ Authorization: getConfig().config.token,
113
+ },
114
+ data: JSON.stringify({
115
+ start: start,
116
+ end: end,
117
+ }),
118
+ }).then(r => {
119
+ console.log('r -- ', r);
120
+ callback(r.response);
121
+ });
122
+ }
83
123
  }
84
124
 
85
125
  function getConfig() {
86
- const saasConfig: { config: any; api: any } = (window.parent as any).saasConfig;
87
- return saasConfig;
126
+ const saasConfig: { config: any; api: any } = (window.parent as any).saasConfig;
127
+ return saasConfig;
88
128
  }
89
129
 
90
130
  function getBaseUrl() {
91
- return getConfig().config.url;
131
+ return getConfig().config.url;
92
132
  }
93
-