ts-glitter 21.2.7 → 21.2.9
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-widget.js +3 -0
- package/lowcode/backend-manager/bg-widget.ts +4 -0
- package/lowcode/cms-plugin/POS-setting.js +14 -1
- package/lowcode/cms-plugin/POS-setting.ts +15 -1
- package/lowcode/cms-plugin/pos-pages/credit-card.js +103 -0
- package/lowcode/cms-plugin/pos-pages/credit-card.ts +114 -0
- package/lowcode/cms-plugin/pos-pages/payment-function.js +8 -6
- package/lowcode/cms-plugin/pos-pages/payment-function.ts +13 -12
- package/lowcode/cms-plugin/pos-pages/payment-page.js +8 -3
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +8 -3
- package/lowcode/cms-plugin/pos-pages/pos-function.ts +1 -1
- package/lowcode/cms-plugin/shopping-finance-setting.js +11 -8
- package/lowcode/cms-plugin/shopping-finance-setting.ts +11 -8
- package/lowcode/cms-plugin/shopping-invoice-manager.js +8 -2
- package/lowcode/cms-plugin/shopping-invoice-manager.ts +11 -10
- package/lowcode/cms-plugin/shopping-order-manager.js +38 -30
- package/lowcode/cms-plugin/shopping-order-manager.ts +40 -29
- package/lowcode/index.html +1 -0
- package/package.json +1 -1
- package/src/api-public/controllers/shop.js +4 -4
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +1 -3
- package/src/api-public/services/checkout-event.js +14 -20
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +12 -7
- package/src/api-public/services/financial-service.js +1 -1
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +0 -1
|
@@ -431,10 +431,10 @@ export class ShoppingInvoiceManager {
|
|
|
431
431
|
}
|
|
432
432
|
static replaceOrder(gvc, vm, searchOrder) {
|
|
433
433
|
const glitter = gvc.glitter;
|
|
434
|
-
const invoiceData = searchOrder !== null && searchOrder !== void 0 ? searchOrder : vm.data;
|
|
435
434
|
let orderData_;
|
|
436
435
|
const mainViewID = gvc.glitter.getUUID();
|
|
437
436
|
let dataLoading = true;
|
|
437
|
+
const invoiceData = vm.invoiceData;
|
|
438
438
|
ApiShop.getOrder({
|
|
439
439
|
page: 0,
|
|
440
440
|
limit: 100,
|
|
@@ -443,6 +443,8 @@ export class ShoppingInvoiceManager {
|
|
|
443
443
|
returnSearch: 'true',
|
|
444
444
|
}).then((response) => {
|
|
445
445
|
orderData_ = response.response;
|
|
446
|
+
orderData_.orderData.user_info = invoiceData.invoice_data.original_data;
|
|
447
|
+
orderData_.orderData.user_info.print_invoice = (invoiceData.invoice_data.original_data.Print);
|
|
446
448
|
dataLoading = false;
|
|
447
449
|
gvc.notifyDataChange([mainViewID, 'invoiceContent']);
|
|
448
450
|
});
|
|
@@ -502,7 +504,10 @@ export class ShoppingInvoiceManager {
|
|
|
502
504
|
if (orderData_) {
|
|
503
505
|
const orderData = invoiceData.invoice_data.orderData || orderData_.orderData;
|
|
504
506
|
console.log(`orderData_.orderData===>`, orderData_.orderData);
|
|
505
|
-
console.log(`invoiceData.invoice_data.orderData=>`, invoiceData.invoice_data
|
|
507
|
+
console.log(`invoiceData.invoice_data.orderData=>`, invoiceData.invoice_data);
|
|
508
|
+
orderData.user_info.invoice_type = invoiceData.invoice_data.original_data.CustomerIdentifier ? `company` : `customer`;
|
|
509
|
+
orderData.user_info.company = invoiceData.invoice_data.original_data.CustomerName;
|
|
510
|
+
orderData.user_info.print_invoice = invoiceData.invoice_data.original_data.Print;
|
|
506
511
|
let tax_total = (() => {
|
|
507
512
|
let total = 0;
|
|
508
513
|
orderData.lineItems
|
|
@@ -519,6 +524,7 @@ export class ShoppingInvoiceManager {
|
|
|
519
524
|
let sale = orderData.total - tax_total;
|
|
520
525
|
let allowanceLoading = true;
|
|
521
526
|
let allowanceData = [];
|
|
527
|
+
console.log('orderData.user_info===>', orderData);
|
|
522
528
|
try {
|
|
523
529
|
return [
|
|
524
530
|
BgWidget.mainCard(html `
|
|
@@ -494,14 +494,6 @@ export class ShoppingInvoiceManager {
|
|
|
494
494
|
public static replaceOrder(gvc: GVC, vm: any, searchOrder?: any) {
|
|
495
495
|
const glitter = gvc.glitter;
|
|
496
496
|
|
|
497
|
-
const invoiceData: {
|
|
498
|
-
id: number;
|
|
499
|
-
invoice_no: string;
|
|
500
|
-
status: number;
|
|
501
|
-
order_id: string;
|
|
502
|
-
invoice_data: any;
|
|
503
|
-
create_date: string;
|
|
504
|
-
} = searchOrder ?? vm.data;
|
|
505
497
|
|
|
506
498
|
let orderData_: {
|
|
507
499
|
id: number;
|
|
@@ -545,6 +537,7 @@ export class ShoppingInvoiceManager {
|
|
|
545
537
|
MerchantTradeNo: string;
|
|
546
538
|
CVSAddress: string;
|
|
547
539
|
note?: string;
|
|
540
|
+
print_invoice?:string;
|
|
548
541
|
code_note?: string;
|
|
549
542
|
gui_number?: string;
|
|
550
543
|
};
|
|
@@ -590,7 +583,7 @@ export class ShoppingInvoiceManager {
|
|
|
590
583
|
};
|
|
591
584
|
const mainViewID = gvc.glitter.getUUID();
|
|
592
585
|
let dataLoading = true;
|
|
593
|
-
|
|
586
|
+
const invoiceData=vm.invoiceData;
|
|
594
587
|
ApiShop.getOrder({
|
|
595
588
|
page: 0,
|
|
596
589
|
limit: 100,
|
|
@@ -599,6 +592,9 @@ export class ShoppingInvoiceManager {
|
|
|
599
592
|
returnSearch: 'true',
|
|
600
593
|
}).then((response: any) => {
|
|
601
594
|
orderData_ = response.response;
|
|
595
|
+
|
|
596
|
+
orderData_.orderData.user_info=invoiceData.invoice_data.original_data;
|
|
597
|
+
orderData_.orderData.user_info.print_invoice=(invoiceData.invoice_data.original_data.Print)
|
|
602
598
|
dataLoading = false;
|
|
603
599
|
gvc.notifyDataChange([mainViewID, 'invoiceContent']);
|
|
604
600
|
});
|
|
@@ -666,7 +662,10 @@ export class ShoppingInvoiceManager {
|
|
|
666
662
|
if (orderData_) {
|
|
667
663
|
const orderData = invoiceData.invoice_data.orderData || orderData_.orderData;
|
|
668
664
|
console.log(`orderData_.orderData===>`, orderData_.orderData);
|
|
669
|
-
console.log(`invoiceData.invoice_data.orderData=>`, invoiceData.invoice_data
|
|
665
|
+
console.log(`invoiceData.invoice_data.orderData=>`, invoiceData.invoice_data);
|
|
666
|
+
orderData.user_info.invoice_type=invoiceData.invoice_data.original_data.CustomerIdentifier ? `company`:`customer`
|
|
667
|
+
orderData.user_info.company=invoiceData.invoice_data.original_data.CustomerName
|
|
668
|
+
orderData.user_info.print_invoice=invoiceData.invoice_data.original_data.Print;
|
|
670
669
|
let tax_total = (() => {
|
|
671
670
|
let total = 0;
|
|
672
671
|
orderData.lineItems
|
|
@@ -684,6 +683,7 @@ export class ShoppingInvoiceManager {
|
|
|
684
683
|
let allowanceLoading = true;
|
|
685
684
|
let allowanceData: any[] = [];
|
|
686
685
|
|
|
686
|
+
console.log('orderData.user_info===>', orderData);
|
|
687
687
|
// CustomerIdentifier
|
|
688
688
|
try {
|
|
689
689
|
return [
|
|
@@ -1588,6 +1588,7 @@ ${reason}</textarea
|
|
|
1588
1588
|
),
|
|
1589
1589
|
];
|
|
1590
1590
|
|
|
1591
|
+
|
|
1591
1592
|
if (
|
|
1592
1593
|
invoiceData.invoice_data.original_data.Print === '1' &&
|
|
1593
1594
|
(window.parent as any).glitter.share.PayConfig.posType === 'SUNMI'
|
|
@@ -121,38 +121,45 @@ export class ShoppingOrderManager {
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
+
const thathis = this;
|
|
124
125
|
return gvc.bindView({
|
|
125
126
|
bind: vm.id,
|
|
126
127
|
dataList: [{ obj: vm, key: 'type' }],
|
|
127
128
|
view: () => {
|
|
128
|
-
var _a
|
|
129
|
+
var _a;
|
|
129
130
|
if (vm.loading) {
|
|
130
131
|
return '';
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
133
|
+
try {
|
|
134
|
+
const viewMap = {
|
|
135
|
+
list: () => thathis.tableOrder(gvc, vm, query, ListComp),
|
|
136
|
+
replace: () => thathis.replaceOrder(gvc, vm, vm.data.cart_token),
|
|
137
|
+
add: () => thathis.createOrder(gvc, vm),
|
|
138
|
+
createInvoice: () => {
|
|
139
|
+
vm.return_order = true;
|
|
140
|
+
return ShoppingInvoiceManager.createOrder(gvc, vm, vm.tempOrder);
|
|
141
|
+
},
|
|
142
|
+
recommend: () => {
|
|
143
|
+
return BgRecommend.editorLink({
|
|
144
|
+
gvc: gvc,
|
|
145
|
+
data: vm.distributionData.data[0],
|
|
146
|
+
callback: () => {
|
|
147
|
+
vm.type = 'replace';
|
|
148
|
+
},
|
|
149
|
+
vm,
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
viewInvoice: () => {
|
|
153
|
+
vm.return_order = true;
|
|
154
|
+
return ShoppingInvoiceManager.replaceOrder(gvc, vm, vm.invoiceData);
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
return (_a = viewMap[vm.type]()) !== null && _a !== void 0 ? _a : '';
|
|
158
|
+
}
|
|
159
|
+
catch (e) {
|
|
160
|
+
console.error(e);
|
|
161
|
+
return `${e}`;
|
|
162
|
+
}
|
|
156
163
|
},
|
|
157
164
|
onCreate: () => {
|
|
158
165
|
if (vm.loading) {
|
|
@@ -943,6 +950,7 @@ export class ShoppingOrderManager {
|
|
|
943
950
|
let userData = {};
|
|
944
951
|
let invoiceDataList = [];
|
|
945
952
|
let storeList = [];
|
|
953
|
+
let mainViewId = gvc.glitter.getUUID();
|
|
946
954
|
let productData = [];
|
|
947
955
|
let is_shipment = ['shipment_list_archive', 'shipment_list'].includes(window.glitter.getUrlParameter('page'));
|
|
948
956
|
const dialog = new ShareDialog(gvc.glitter);
|
|
@@ -979,7 +987,7 @@ export class ShoppingOrderManager {
|
|
|
979
987
|
ApiUser.getUsersDataWithEmailOrPhone(orderData.email).then(res => {
|
|
980
988
|
userData = res.response;
|
|
981
989
|
userDataLoading = false;
|
|
982
|
-
gvc.notifyDataChange(
|
|
990
|
+
gvc.notifyDataChange(mainViewId);
|
|
983
991
|
});
|
|
984
992
|
ApiShop.getInvoice({
|
|
985
993
|
page: 0,
|
|
@@ -1000,7 +1008,7 @@ export class ShoppingOrderManager {
|
|
|
1000
1008
|
}).then(r => {
|
|
1001
1009
|
productData = r.response.data;
|
|
1002
1010
|
productLoading = false;
|
|
1003
|
-
gvc.notifyDataChange(
|
|
1011
|
+
gvc.notifyDataChange(mainViewId);
|
|
1004
1012
|
});
|
|
1005
1013
|
function saveEvent() {
|
|
1006
1014
|
dialog.dataLoading({ text: '上傳中', visible: true });
|
|
@@ -1089,7 +1097,7 @@ export class ShoppingOrderManager {
|
|
|
1089
1097
|
});
|
|
1090
1098
|
}
|
|
1091
1099
|
return gvc.bindView({
|
|
1092
|
-
bind:
|
|
1100
|
+
bind: mainViewId,
|
|
1093
1101
|
dataList: [{ obj: child_vm, key: 'type' }],
|
|
1094
1102
|
view: () => {
|
|
1095
1103
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -2176,7 +2184,7 @@ export class ShoppingOrderManager {
|
|
|
2176
2184
|
}
|
|
2177
2185
|
}
|
|
2178
2186
|
else {
|
|
2179
|
-
gvc.notifyDataChange(
|
|
2187
|
+
gvc.notifyDataChange(mainViewId);
|
|
2180
2188
|
}
|
|
2181
2189
|
},
|
|
2182
2190
|
});
|
|
@@ -2915,7 +2923,7 @@ export class ShoppingOrderManager {
|
|
|
2915
2923
|
</div>`,
|
|
2916
2924
|
ratio: 25,
|
|
2917
2925
|
})}
|
|
2918
|
-
|
|
2926
|
+
<div style="height:240px;"></div>
|
|
2919
2927
|
<div class="update-bar-container">
|
|
2920
2928
|
<div>
|
|
2921
2929
|
${gvc.bindView(() => {
|
|
@@ -28,6 +28,7 @@ import { LineItem } from './module/data.js';
|
|
|
28
28
|
import { OrderModule } from './order/order-module.js';
|
|
29
29
|
import { TableStorage } from './module/table-storage.js';
|
|
30
30
|
|
|
31
|
+
|
|
31
32
|
const html = String.raw;
|
|
32
33
|
const css = String.raw;
|
|
33
34
|
|
|
@@ -159,6 +160,8 @@ export class ShoppingOrderManager {
|
|
|
159
160
|
}
|
|
160
161
|
});
|
|
161
162
|
}
|
|
163
|
+
const thathis = this;
|
|
164
|
+
|
|
162
165
|
return gvc.bindView({
|
|
163
166
|
bind: vm.id,
|
|
164
167
|
dataList: [{ obj: vm, key: 'type' }],
|
|
@@ -167,31 +170,37 @@ export class ShoppingOrderManager {
|
|
|
167
170
|
return '';
|
|
168
171
|
}
|
|
169
172
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
173
|
+
try {
|
|
174
|
+
const viewMap: Record<string, () => string> = {
|
|
175
|
+
list: () => thathis.tableOrder(gvc, vm, query, ListComp),
|
|
176
|
+
replace: () => thathis.replaceOrder(gvc, vm, vm.data.cart_token),
|
|
177
|
+
add: () => thathis.createOrder(gvc, vm),
|
|
178
|
+
createInvoice: () => {
|
|
179
|
+
vm.return_order = true;
|
|
180
|
+
return ShoppingInvoiceManager.createOrder(gvc, vm, (vm as any).tempOrder);
|
|
181
|
+
},
|
|
182
|
+
recommend: () => {
|
|
183
|
+
return BgRecommend.editorLink({
|
|
184
|
+
gvc: gvc,
|
|
185
|
+
data: vm.distributionData.data[0],
|
|
186
|
+
callback: () => {
|
|
187
|
+
vm.type = 'replace';
|
|
188
|
+
},
|
|
189
|
+
vm,
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
viewInvoice: () => {
|
|
193
|
+
vm.return_order = true;
|
|
194
|
+
return ShoppingInvoiceManager.replaceOrder(gvc, vm, vm.invoiceData);
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
return viewMap[vm.type]() ?? '';
|
|
199
|
+
}catch (e) {
|
|
200
|
+
console.error(e)
|
|
201
|
+
return `${e}`
|
|
202
|
+
}
|
|
193
203
|
|
|
194
|
-
return viewMap[vm.type]?.() ?? '';
|
|
195
204
|
},
|
|
196
205
|
onCreate: () => {
|
|
197
206
|
if (vm.loading) {
|
|
@@ -1057,6 +1066,7 @@ export class ShoppingOrderManager {
|
|
|
1057
1066
|
let userData: any = {};
|
|
1058
1067
|
let invoiceDataList: any = [];
|
|
1059
1068
|
let storeList: any = [];
|
|
1069
|
+
let mainViewId=gvc.glitter.getUUID();
|
|
1060
1070
|
let productData: any = [];
|
|
1061
1071
|
let is_shipment = ['shipment_list_archive', 'shipment_list'].includes(
|
|
1062
1072
|
(window as any).glitter.getUrlParameter('page')
|
|
@@ -1107,7 +1117,7 @@ export class ShoppingOrderManager {
|
|
|
1107
1117
|
ApiUser.getUsersDataWithEmailOrPhone(orderData.email).then(res => {
|
|
1108
1118
|
userData = res.response;
|
|
1109
1119
|
userDataLoading = false;
|
|
1110
|
-
gvc.notifyDataChange(
|
|
1120
|
+
gvc.notifyDataChange(mainViewId);
|
|
1111
1121
|
});
|
|
1112
1122
|
|
|
1113
1123
|
ApiShop.getInvoice({
|
|
@@ -1130,7 +1140,7 @@ export class ShoppingOrderManager {
|
|
|
1130
1140
|
}).then(r => {
|
|
1131
1141
|
productData = r.response.data;
|
|
1132
1142
|
productLoading = false;
|
|
1133
|
-
gvc.notifyDataChange(
|
|
1143
|
+
gvc.notifyDataChange(mainViewId);
|
|
1134
1144
|
});
|
|
1135
1145
|
|
|
1136
1146
|
function saveEvent() {
|
|
@@ -1227,7 +1237,7 @@ export class ShoppingOrderManager {
|
|
|
1227
1237
|
}
|
|
1228
1238
|
|
|
1229
1239
|
return gvc.bindView({
|
|
1230
|
-
bind:
|
|
1240
|
+
bind: mainViewId,
|
|
1231
1241
|
dataList: [{ obj: child_vm, key: 'type' }],
|
|
1232
1242
|
view: () => {
|
|
1233
1243
|
try {
|
|
@@ -1955,6 +1965,7 @@ export class ShoppingOrderManager {
|
|
|
1955
1965
|
return;
|
|
1956
1966
|
}
|
|
1957
1967
|
(window.parent as any).glitter.setUrlParameter('orderID', undefined);
|
|
1968
|
+
|
|
1958
1969
|
if (backCallback) {
|
|
1959
1970
|
backCallback();
|
|
1960
1971
|
} else {
|
|
@@ -2406,7 +2417,7 @@ export class ShoppingOrderManager {
|
|
|
2406
2417
|
saveEvent();
|
|
2407
2418
|
}
|
|
2408
2419
|
} else {
|
|
2409
|
-
gvc.notifyDataChange(
|
|
2420
|
+
gvc.notifyDataChange(mainViewId);
|
|
2410
2421
|
}
|
|
2411
2422
|
},
|
|
2412
2423
|
});
|
|
@@ -3208,7 +3219,7 @@ export class ShoppingOrderManager {
|
|
|
3208
3219
|
ratio: 25,
|
|
3209
3220
|
}
|
|
3210
3221
|
)}
|
|
3211
|
-
|
|
3222
|
+
<div style="height:240px;"></div>
|
|
3212
3223
|
<div class="update-bar-container">
|
|
3213
3224
|
<div>
|
|
3214
3225
|
${gvc.bindView(() => {
|
package/lowcode/index.html
CHANGED
package/package.json
CHANGED
|
@@ -582,7 +582,7 @@ router.delete('/voucher', async (req, resp) => {
|
|
|
582
582
|
}
|
|
583
583
|
});
|
|
584
584
|
async function redirect_link(req, resp) {
|
|
585
|
-
var _a, _b, _c
|
|
585
|
+
var _a, _b, _c;
|
|
586
586
|
function setQueryParameter(originalUrl, paramName, newValue) {
|
|
587
587
|
try {
|
|
588
588
|
const url = new URL(originalUrl);
|
|
@@ -626,18 +626,18 @@ async function redirect_link(req, resp) {
|
|
|
626
626
|
</html> `);
|
|
627
627
|
}
|
|
628
628
|
try {
|
|
629
|
-
const order_id = (_b = (_a = req.query) === null || _a === void 0 ? void 0 : _a.orderID) !== null && _b !== void 0 ? _b : '';
|
|
630
629
|
req.query.appName = req.query.appName || req.get('g-app') || req.query['g-app'];
|
|
631
630
|
let return_url = new URL((await redis_js_1.default.getValue(req.query.return)));
|
|
631
|
+
const order_id = ((_a = req.query) === null || _a === void 0 ? void 0 : _a.orderID) || (return_url.searchParams.get('cart_token')) || '';
|
|
632
632
|
const old_order_id = await redis_js_1.default.getValue(order_id);
|
|
633
|
-
const idToQuery = old_order_id ? old_order_id : ((
|
|
633
|
+
const idToQuery = old_order_id ? old_order_id : ((_b = order_id) !== null && _b !== void 0 ? _b : '');
|
|
634
634
|
if (req.query.LinePay && req.query.LinePay === 'true') {
|
|
635
635
|
let order_data = {};
|
|
636
636
|
try {
|
|
637
637
|
const queryResult = await database_js_1.default.query(`SELECT *
|
|
638
638
|
FROM \`${req.query.appName}\`.t_checkout
|
|
639
639
|
WHERE cart_token = ?`, [idToQuery]);
|
|
640
|
-
order_data = (
|
|
640
|
+
order_data = (_c = queryResult === null || queryResult === void 0 ? void 0 : queryResult[0]) !== null && _c !== void 0 ? _c : undefined;
|
|
641
641
|
if (!order_data) {
|
|
642
642
|
console.log(`找不到 cart_token 為 ${idToQuery} 的訂單資料。`);
|
|
643
643
|
}
|