ts-glitter 21.1.5 → 21.1.6
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/cms-plugin/module/order-excel.js +256 -132
- package/lowcode/cms-plugin/module/order-excel.ts +228 -81
- package/lowcode/cms-plugin/shopping-finance-setting.js +1 -1
- package/lowcode/cms-plugin/shopping-finance-setting.ts +1 -1
- package/lowcode/cms-plugin/shopping-order-manager.js +33 -29
- package/lowcode/cms-plugin/shopping-order-manager.ts +36 -30
- package/lowcode/editor-components/global-widget/global-widget.js +254 -0
- package/lowcode/editor-components/global-widget/global-widget.ts +269 -0
- package/lowcode/editor-components/global-widget/src/banner.jpg +0 -0
- package/lowcode/editor-components/global-widget/src/footer.jpg +0 -0
- package/lowcode/editor-components/global-widget/src/header.png +0 -0
- package/lowcode/editor-components/global-widget/src/product.jpg +0 -0
- package/lowcode/jspage/function-page/tool-setting.js +18 -94
- package/lowcode/jspage/function-page/tool-setting.ts +21 -93
- package/lowcode/public-components/checkout/index.js +32 -1
- package/lowcode/public-components/checkout/index.ts +32 -1
- package/lowcode/public-components/product/pd-card-01.js +0 -58
- package/lowcode/public-components/product/pd-card-01.ts +0 -45
- package/lowcode/public-components/product/pd-card-02.js +1 -59
- package/lowcode/public-components/product/pd-card-02.ts +1 -45
- package/lowcode/public-components/product/pd-card-03.js +2 -59
- package/lowcode/public-components/product/pd-card-03.ts +2 -46
- package/package.json +1 -1
- package/src/api-public/services/financial-serviceV2.js +17 -7
- package/src/api-public/services/financial-serviceV2.js.map +1 -1
- package/src/api-public/services/post.js +17 -7
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/shopee.js +17 -7
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopping.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.
|
|
149
|
+
glitter.share.editerVersion = 'V_21.1.6';
|
|
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.
|
|
152
|
+
glitter.share.editerVersion = 'V_21.1.6';
|
|
153
153
|
glitter.share.start = new Date();
|
|
154
154
|
const vm = { appConfig: [] };
|
|
155
155
|
(window as any).saasConfig = {
|
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var _a;
|
|
10
11
|
import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
11
12
|
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
12
13
|
import { ShipmentConfig } from '../../glitter-base/global/shipment-config.js';
|
|
@@ -20,9 +21,10 @@ import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
|
20
21
|
const html = String.raw;
|
|
21
22
|
export class OrderExcel {
|
|
22
23
|
static optionsView(gvc, callback) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
let columnList = new Set();
|
|
26
|
+
const randomString = BgWidget.getCheckedClass(gvc);
|
|
27
|
+
const checkbox = (checked, name, toggle) => html `
|
|
26
28
|
<div class="form-check">
|
|
27
29
|
<input
|
|
28
30
|
class="form-check-input cursor_pointer ${randomString}"
|
|
@@ -41,47 +43,61 @@ export class OrderExcel {
|
|
|
41
43
|
</label>
|
|
42
44
|
</div>
|
|
43
45
|
`;
|
|
44
|
-
|
|
46
|
+
const checkboxContainer = (items) => html `
|
|
45
47
|
<div class="row w-100">
|
|
46
48
|
${Object.entries(items)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
.map(([category, fields]) => {
|
|
50
|
+
const bindId = Tool.randomString(5);
|
|
51
|
+
return gvc.bindView({
|
|
52
|
+
bind: bindId,
|
|
53
|
+
view: () => {
|
|
54
|
+
const allChecked = fields.every(item => columnList.has(item));
|
|
55
|
+
return html `
|
|
54
56
|
${checkbox(allChecked, category, () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
if (allChecked) {
|
|
58
|
+
fields.forEach(item => columnList.delete(item));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
fields.forEach(item => columnList.add(item));
|
|
62
|
+
}
|
|
63
|
+
callback(Array.from(columnList));
|
|
64
|
+
gvc.notifyDataChange(bindId);
|
|
65
|
+
})}
|
|
64
66
|
<div class="d-flex position-relative my-2">
|
|
65
67
|
${BgWidget.leftLineBar()}
|
|
66
68
|
<div class="ms-4 w-100 flex-fill">
|
|
67
69
|
${fields
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
.map(item => checkbox(columnList.has(item), item, () => {
|
|
71
|
+
columnList.has(item) ? columnList.delete(item) : columnList.add(item);
|
|
72
|
+
callback(Array.from(columnList));
|
|
73
|
+
gvc.notifyDataChange(bindId);
|
|
74
|
+
}))
|
|
75
|
+
.join('')}
|
|
74
76
|
</div>
|
|
75
77
|
</div>
|
|
76
78
|
`;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
},
|
|
80
|
+
divCreate: {
|
|
81
|
+
class: (() => {
|
|
82
|
+
let maxLength = Math.max(...fields.map(field => field.length));
|
|
83
|
+
switch (true) {
|
|
84
|
+
case maxLength < 12:
|
|
85
|
+
return 'col-12 col-md-4 mb-3';
|
|
86
|
+
case maxLength >= 12 && maxLength < 20:
|
|
87
|
+
return 'col-12 col-md-6 mb-3';
|
|
88
|
+
case maxLength > 20:
|
|
89
|
+
return 'col-12 col-md-12 mb-3';
|
|
90
|
+
}
|
|
91
|
+
})(),
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
})
|
|
95
|
+
.join('')}
|
|
82
96
|
</div>
|
|
83
97
|
`;
|
|
84
|
-
|
|
98
|
+
const getColumn = yield this.headerColumn();
|
|
99
|
+
return checkboxContainer(getColumn);
|
|
100
|
+
});
|
|
85
101
|
}
|
|
86
102
|
static export(gvc, apiJSON, column) {
|
|
87
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -93,22 +109,23 @@ export class OrderExcel {
|
|
|
93
109
|
const XLSX = yield Excel.loadXLSX(gvc);
|
|
94
110
|
const [shipment_methods, payment_methods] = yield Promise.all([
|
|
95
111
|
ShipmentConfig.shipmentMethod({
|
|
96
|
-
type: 'all'
|
|
112
|
+
type: 'all',
|
|
97
113
|
}),
|
|
98
114
|
PaymentConfig.getSupportPayment(true),
|
|
99
115
|
]);
|
|
100
|
-
const
|
|
116
|
+
const getColumn = yield this.headerColumn();
|
|
117
|
+
const showLineItems = getColumn['商品'].some(a => column.includes(a));
|
|
101
118
|
const formatDate = (date) => date ? gvc.glitter.ut.dateFormat(new Date(date), 'yyyy-MM-dd hh:mm') : '';
|
|
102
|
-
const getStatusLabel = (status, mapping, defaultLabel = '未知') => { var
|
|
103
|
-
const findMethodName = (key, methods) => { var
|
|
119
|
+
const getStatusLabel = (status, mapping, defaultLabel = '未知') => { var _b, _c; return (_c = mapping[(_b = status === null || status === void 0 ? void 0 : status.toString()) !== null && _b !== void 0 ? _b : '']) !== null && _c !== void 0 ? _c : defaultLabel; };
|
|
120
|
+
const findMethodName = (key, methods) => { var _b, _c; return (_c = (_b = methods.find(m => m.key === key)) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '未知'; };
|
|
104
121
|
const formatJSON = (obj) => Object.fromEntries(Object.entries(obj).filter(([key]) => column.includes(key)));
|
|
105
122
|
const getOrderJSON = (order, orderData) => {
|
|
106
|
-
var
|
|
123
|
+
var _b, _c, _d, _e, _f, _g;
|
|
107
124
|
return formatJSON({
|
|
108
125
|
訂單編號: order.cart_token,
|
|
109
126
|
訂單來源: orderData.orderSource === 'POS' ? 'POS' : '手動',
|
|
110
127
|
訂單建立時間: formatDate(order.created_time),
|
|
111
|
-
會員信箱: (
|
|
128
|
+
會員信箱: (_b = order.email) !== null && _b !== void 0 ? _b : 'no-email',
|
|
112
129
|
訂單處理狀態: getStatusLabel(orderData.orderStatus, { '-1': '已取消', '1': '已完成', '0': '處理中' }, '處理中'),
|
|
113
130
|
付款狀態: getStatusLabel(order.status, { '1': '已付款', '-1': '付款失敗', '-2': '已退款', '0': '未付款' }, '未付款'),
|
|
114
131
|
出貨狀態: getStatusLabel(orderData.progress, {
|
|
@@ -121,27 +138,27 @@ export class OrderExcel {
|
|
|
121
138
|
}, '未出貨'),
|
|
122
139
|
訂單小計: orderData.total + orderData.discount - orderData.shipment_fee + orderData.use_rebate,
|
|
123
140
|
訂單運費: orderData.shipment_fee,
|
|
124
|
-
訂單使用優惠券: ((
|
|
141
|
+
訂單使用優惠券: ((_c = orderData.voucherList) === null || _c === void 0 ? void 0 : _c.map((v) => v.title).join(', ')) || '無',
|
|
125
142
|
訂單折扣: orderData.discount,
|
|
126
143
|
訂單使用購物金: orderData.use_rebate,
|
|
127
144
|
訂單總計: orderData.total,
|
|
128
|
-
分銷連結代碼: (
|
|
129
|
-
分銷連結名稱: (
|
|
145
|
+
分銷連結代碼: (_e = (_d = orderData.distribution_info) === null || _d === void 0 ? void 0 : _d.code) !== null && _e !== void 0 ? _e : '',
|
|
146
|
+
分銷連結名稱: (_g = (_f = orderData.distribution_info) === null || _f === void 0 ? void 0 : _f.title) !== null && _g !== void 0 ? _g : '',
|
|
130
147
|
});
|
|
131
148
|
};
|
|
132
149
|
const getProductJSON = (item) => {
|
|
133
|
-
var
|
|
150
|
+
var _b;
|
|
134
151
|
return formatJSON({
|
|
135
152
|
商品名稱: item.title,
|
|
136
153
|
商品規格: item.spec.length > 0 ? item.spec.join(' / ') : '單一規格',
|
|
137
|
-
商品SKU: (
|
|
154
|
+
商品SKU: (_b = item.sku) !== null && _b !== void 0 ? _b : '',
|
|
138
155
|
商品購買數量: item.count,
|
|
139
156
|
商品價格: item.sale_price,
|
|
140
157
|
商品折扣: item.discount_price,
|
|
141
158
|
});
|
|
142
159
|
};
|
|
143
160
|
const getUserJSON = (order, orderData) => {
|
|
144
|
-
var
|
|
161
|
+
var _b, _c, _d, _e, _f, _g;
|
|
145
162
|
return formatJSON({
|
|
146
163
|
顧客姓名: orderData.customer_info.name,
|
|
147
164
|
顧客手機: orderData.customer_info.phone,
|
|
@@ -155,19 +172,19 @@ export class OrderExcel {
|
|
|
155
172
|
.filter(Boolean)
|
|
156
173
|
.join(''),
|
|
157
174
|
代收金額: orderData.customer_info.payment_select === 'cash_on_delivery' ? orderData.total : 0,
|
|
158
|
-
出貨單號碼: (
|
|
175
|
+
出貨單號碼: (_b = orderData.user_info.shipment_number) !== null && _b !== void 0 ? _b : '',
|
|
159
176
|
出貨單日期: formatDate(orderData.user_info.shipment_date),
|
|
160
|
-
發票號碼: (
|
|
161
|
-
會員等級: (
|
|
162
|
-
備註: (
|
|
177
|
+
發票號碼: (_c = order.invoice_number) !== null && _c !== void 0 ? _c : '',
|
|
178
|
+
會員等級: (_f = (_e = (_d = order.user_data) === null || _d === void 0 ? void 0 : _d.member_level) === null || _e === void 0 ? void 0 : _e.tag_name) !== null && _f !== void 0 ? _f : '',
|
|
179
|
+
備註: (_g = orderData.user_info.note) !== null && _g !== void 0 ? _g : '無備註',
|
|
163
180
|
});
|
|
164
181
|
};
|
|
165
182
|
const getReconciliationJSON = (order) => {
|
|
166
|
-
var
|
|
183
|
+
var _b;
|
|
167
184
|
return formatJSON({
|
|
168
185
|
對帳狀態: (() => {
|
|
169
|
-
var
|
|
170
|
-
const received_c = ((
|
|
186
|
+
var _b;
|
|
187
|
+
const received_c = ((_b = order.total_received) !== null && _b !== void 0 ? _b : 0) + order.offset_amount;
|
|
171
188
|
if (order.total_received === null || order.total_received === undefined) {
|
|
172
189
|
return '待入帳';
|
|
173
190
|
}
|
|
@@ -201,43 +218,60 @@ export class OrderExcel {
|
|
|
201
218
|
return `$${order.orderData.total - (order.total_received + (order.offset_amount || 0))}`;
|
|
202
219
|
}
|
|
203
220
|
})(),
|
|
204
|
-
沖帳原因: (
|
|
221
|
+
沖帳原因: (_b = order.offset_reason) !== null && _b !== void 0 ? _b : '-',
|
|
205
222
|
});
|
|
206
223
|
};
|
|
224
|
+
const getCustomizeJSON = (order) => __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
const customizeMap = yield this.getCustomizeMap(order);
|
|
226
|
+
const json = Object.fromEntries(customizeMap);
|
|
227
|
+
return formatJSON(json);
|
|
228
|
+
});
|
|
207
229
|
function exportOrdersToExcel(dataArray) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
if (!dataArray.length) {
|
|
232
|
+
dialog.errorMessage({ text: '無訂單資料可以匯出' });
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const printArray = [];
|
|
236
|
+
for (const order of dataArray) {
|
|
237
|
+
const orderData = order.orderData;
|
|
238
|
+
const customizeJSON = yield getCustomizeJSON(order);
|
|
239
|
+
if (showLineItems) {
|
|
240
|
+
printArray.push(orderData.lineItems.map((item) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, getOrderJSON(order, orderData)), getProductJSON(item)), getUserJSON(order, orderData)), getReconciliationJSON(order)), customizeJSON))));
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
printArray.push([
|
|
244
|
+
Object.assign(Object.assign(Object.assign(Object.assign({}, getOrderJSON(order, orderData)), getUserJSON(order, orderData)), getReconciliationJSON(order)), customizeJSON),
|
|
245
|
+
]);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const printArrayFlat = printArray.flat();
|
|
249
|
+
const worksheet = XLSX.utils.json_to_sheet(printArrayFlat);
|
|
250
|
+
const workbook = XLSX.utils.book_new();
|
|
251
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, '訂單列表');
|
|
252
|
+
const fileName = `訂單列表_${gvc.glitter.ut.dateFormat(new Date(), 'yyyyMMddhhmmss')}.xlsx`;
|
|
253
|
+
XLSX.writeFile(workbook, fileName);
|
|
219
254
|
});
|
|
220
|
-
const worksheet = XLSX.utils.json_to_sheet(printArray);
|
|
221
|
-
const workbook = XLSX.utils.book_new();
|
|
222
|
-
XLSX.utils.book_append_sheet(workbook, worksheet, '訂單列表');
|
|
223
|
-
const fileName = `訂單列表_${gvc.glitter.ut.dateFormat(new Date(), 'yyyyMMddhhmmss')}.xlsx`;
|
|
224
|
-
XLSX.writeFile(workbook, fileName);
|
|
225
255
|
}
|
|
226
256
|
function fetchOrders(limit) {
|
|
227
|
-
var
|
|
257
|
+
var _b;
|
|
228
258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
-
dialog.dataLoading({ visible: true });
|
|
259
|
+
dialog.dataLoading({ visible: true, text: '匯出資料中,請稍後...' });
|
|
230
260
|
try {
|
|
231
261
|
const response = yield ApiShop.getOrder(Object.assign(Object.assign({}, apiJSON), { page: 0, limit: limit }));
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
exportOrdersToExcel(
|
|
262
|
+
if (((_b = response === null || response === void 0 ? void 0 : response.response) === null || _b === void 0 ? void 0 : _b.total) > 0) {
|
|
263
|
+
const orders = response.response.data;
|
|
264
|
+
yield exportOrdersToExcel(orders).then(() => {
|
|
265
|
+
dialog.dataLoading({ visible: false });
|
|
266
|
+
});
|
|
235
267
|
}
|
|
236
268
|
else {
|
|
269
|
+
dialog.dataLoading({ visible: false });
|
|
237
270
|
dialog.errorMessage({ text: '匯出檔案發生錯誤' });
|
|
238
271
|
}
|
|
239
272
|
}
|
|
240
273
|
catch (error) {
|
|
274
|
+
console.error(error);
|
|
241
275
|
dialog.dataLoading({ visible: false });
|
|
242
276
|
dialog.errorMessage({ text: '無法取得訂單資料' });
|
|
243
277
|
}
|
|
@@ -279,22 +313,30 @@ export class OrderExcel {
|
|
|
279
313
|
title: '匯出' + pageType,
|
|
280
314
|
width: 700,
|
|
281
315
|
innerHTML: gvc2 => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
316
|
+
const id = gvc2.glitter.getUUID();
|
|
317
|
+
return gvc2.bindView({
|
|
318
|
+
bind: id,
|
|
319
|
+
view: () => __awaiter(this, void 0, void 0, function* () {
|
|
320
|
+
const view = yield this.optionsView(gvc2, cols => {
|
|
321
|
+
vm.column = cols;
|
|
322
|
+
});
|
|
323
|
+
return html `<div class="d-flex flex-column align-items-start gap-2">
|
|
324
|
+
<div class="tx_700 mb-2">匯出範圍</div>
|
|
325
|
+
${BgWidget.multiCheckboxContainer(gvc2, [
|
|
326
|
+
{ key: 'all', name: `全部${pageType}` },
|
|
327
|
+
{ key: 'search', name: '目前搜尋與篩選的結果' },
|
|
328
|
+
{ key: 'checked', name: `勾選的 ${dataArray.length} 個訂單` },
|
|
329
|
+
], [vm.select], (res) => {
|
|
330
|
+
vm.select = res[0];
|
|
331
|
+
}, { single: true })}
|
|
332
|
+
<div class="tx_700 mb-2">
|
|
333
|
+
匯出欄位
|
|
334
|
+
${BgWidget.grayNote('*若勾選商品系列的欄位,將會以訂單商品作為資料列匯出 Excel', 'margin: 4px;')}
|
|
335
|
+
</div>
|
|
336
|
+
${view}
|
|
337
|
+
</div>`;
|
|
338
|
+
}),
|
|
339
|
+
});
|
|
298
340
|
},
|
|
299
341
|
footer_html: gvc2 => {
|
|
300
342
|
return [
|
|
@@ -324,14 +366,14 @@ export class OrderExcel {
|
|
|
324
366
|
});
|
|
325
367
|
}
|
|
326
368
|
static importWithShipment(gvc, target, callback) {
|
|
327
|
-
var
|
|
369
|
+
var _b;
|
|
328
370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
329
371
|
const dialog = new ShareDialog(gvc.glitter);
|
|
330
372
|
function errorMsg(text) {
|
|
331
373
|
dialog.dataLoading({ visible: false });
|
|
332
374
|
dialog.errorMessage({ text: text });
|
|
333
375
|
}
|
|
334
|
-
if ((
|
|
376
|
+
if ((_b = target.files) === null || _b === void 0 ? void 0 : _b.length) {
|
|
335
377
|
try {
|
|
336
378
|
dialog.dataLoading({ visible: true, text: '上傳檔案中' });
|
|
337
379
|
const jsonData = yield Excel.parseExcelToJson(gvc, target.files[0]);
|
|
@@ -422,14 +464,14 @@ export class OrderExcel {
|
|
|
422
464
|
});
|
|
423
465
|
}
|
|
424
466
|
static importWithReconciliation(gvc, target, callback) {
|
|
425
|
-
var
|
|
467
|
+
var _b;
|
|
426
468
|
return __awaiter(this, void 0, void 0, function* () {
|
|
427
469
|
const dialog = new ShareDialog(gvc.glitter);
|
|
428
470
|
function errorMsg(text) {
|
|
429
471
|
dialog.dataLoading({ visible: false });
|
|
430
472
|
dialog.errorMessage({ text: text });
|
|
431
473
|
}
|
|
432
|
-
if ((
|
|
474
|
+
if ((_b = target.files) === null || _b === void 0 ? void 0 : _b.length) {
|
|
433
475
|
try {
|
|
434
476
|
dialog.dataLoading({ visible: true, text: '上傳檔案中' });
|
|
435
477
|
const jsonData = yield Excel.parseExcelToJson(gvc, target.files[0]);
|
|
@@ -484,7 +526,7 @@ export class OrderExcel {
|
|
|
484
526
|
});
|
|
485
527
|
});
|
|
486
528
|
const saveEvent = (order) => {
|
|
487
|
-
var
|
|
529
|
+
var _b;
|
|
488
530
|
const compare = importMap.get(order.cart_token);
|
|
489
531
|
const money = parseInt(compare['入帳/沖帳金額'], 10);
|
|
490
532
|
if (compare['操作選項'] === '入帳') {
|
|
@@ -497,7 +539,7 @@ export class OrderExcel {
|
|
|
497
539
|
});
|
|
498
540
|
}
|
|
499
541
|
else {
|
|
500
|
-
order.offset_records = (
|
|
542
|
+
order.offset_records = (_b = order.offset_records) !== null && _b !== void 0 ? _b : [];
|
|
501
543
|
return ApiReconciliation.putReconciliation({
|
|
502
544
|
order_id: order.cart_token,
|
|
503
545
|
update: {
|
|
@@ -681,7 +723,42 @@ export class OrderExcel {
|
|
|
681
723
|
});
|
|
682
724
|
}, vm.id);
|
|
683
725
|
}
|
|
726
|
+
static customizePromise() {
|
|
727
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
+
const saasConfig = window.parent.saasConfig;
|
|
729
|
+
const dataArray = yield Promise.all([
|
|
730
|
+
yield saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'glitter_finance').then((data) => {
|
|
731
|
+
const cashflowObject = {};
|
|
732
|
+
data.response.result[0].value.payment_info_custom.map((item) => {
|
|
733
|
+
ApiUser.getPublicConfig(`form_finance_${item.id}`, 'manager').then(r => {
|
|
734
|
+
cashflowObject[item.id] = r.response.value.list;
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
return cashflowObject;
|
|
738
|
+
}),
|
|
739
|
+
yield saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'logistics_setting').then((data) => {
|
|
740
|
+
const shipmentObject = {};
|
|
741
|
+
data.response.result[0].value.custom_delivery.map((item) => {
|
|
742
|
+
ApiUser.getPublicConfig(`form_delivery_${item.id}`, 'manager').then(r => {
|
|
743
|
+
if (r.response.value.list.length > 0) {
|
|
744
|
+
shipmentObject[item.id] = r.response.value.list;
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
});
|
|
748
|
+
return shipmentObject;
|
|
749
|
+
}),
|
|
750
|
+
yield ApiUser.getPublicConfig('custom_form_register', 'manager').then(r => {
|
|
751
|
+
return Array.isArray(r.response.value.list) ? r.response.value.list : [];
|
|
752
|
+
}),
|
|
753
|
+
yield ApiUser.getPublicConfig('customer_form_user_setting', 'manager').then(r => {
|
|
754
|
+
return Array.isArray(r.response.value.list) ? r.response.value.list : [];
|
|
755
|
+
}),
|
|
756
|
+
]);
|
|
757
|
+
return dataArray;
|
|
758
|
+
});
|
|
759
|
+
}
|
|
684
760
|
}
|
|
761
|
+
_a = OrderExcel;
|
|
685
762
|
OrderExcel.importShipmentExample = [
|
|
686
763
|
{
|
|
687
764
|
訂單編號: '1241770010001',
|
|
@@ -706,40 +783,87 @@ OrderExcel.importReconciliation = [
|
|
|
706
783
|
沖帳備註: '於玉山銀行進行查帳只有收到',
|
|
707
784
|
},
|
|
708
785
|
];
|
|
709
|
-
OrderExcel.headerColumn = {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
'
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
786
|
+
OrderExcel.headerColumn = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
787
|
+
const customizeMap = yield _a.getCustomizeMap();
|
|
788
|
+
return {
|
|
789
|
+
訂單: [
|
|
790
|
+
'訂單編號',
|
|
791
|
+
'訂單來源',
|
|
792
|
+
'訂單建立時間',
|
|
793
|
+
'會員信箱',
|
|
794
|
+
'訂單處理狀態',
|
|
795
|
+
'付款狀態',
|
|
796
|
+
'出貨狀態',
|
|
797
|
+
'訂單小計',
|
|
798
|
+
'訂單運費',
|
|
799
|
+
'訂單使用優惠券',
|
|
800
|
+
'訂單折扣',
|
|
801
|
+
'訂單使用購物金',
|
|
802
|
+
'分銷連結代碼',
|
|
803
|
+
'分銷連結名稱',
|
|
804
|
+
],
|
|
805
|
+
商品: ['商品名稱', '商品規格', '商品SKU', '商品購買數量', '商品價格', '商品折扣'],
|
|
806
|
+
顧客: [
|
|
807
|
+
'顧客姓名',
|
|
808
|
+
'顧客手機',
|
|
809
|
+
'顧客信箱',
|
|
810
|
+
'收件人姓名',
|
|
811
|
+
'收件人手機',
|
|
812
|
+
'收件人信箱',
|
|
813
|
+
'付款方式',
|
|
814
|
+
'配送方式',
|
|
815
|
+
'收貨地址',
|
|
816
|
+
'代收金額',
|
|
817
|
+
'出貨單號碼',
|
|
818
|
+
'出貨單日期',
|
|
819
|
+
'發票號碼',
|
|
820
|
+
'會員等級',
|
|
821
|
+
'備註',
|
|
822
|
+
],
|
|
823
|
+
對帳資訊: ['對帳狀態', '入帳金額', '入帳日期', '應沖金額', '沖帳原因'],
|
|
824
|
+
客製化資訊: [...customizeMap.keys()],
|
|
825
|
+
};
|
|
826
|
+
});
|
|
827
|
+
OrderExcel.getCustomizeMap = (order) => __awaiter(void 0, void 0, void 0, function* () {
|
|
828
|
+
const [cashflowConfigObj, shipmentConfigObj, registerConfig, memberConfig] = yield OrderExcel.customizePromise();
|
|
829
|
+
const customizeMap = new Map();
|
|
830
|
+
const getUserValue = (key) => {
|
|
831
|
+
try {
|
|
832
|
+
return order.user_data.userData[key] || '-';
|
|
833
|
+
}
|
|
834
|
+
catch (error) {
|
|
835
|
+
return '-';
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
const getCashflowValue = (key) => {
|
|
839
|
+
try {
|
|
840
|
+
return order.orderData.user_info.custom_form_payment[key] || '-';
|
|
841
|
+
}
|
|
842
|
+
catch (error) {
|
|
843
|
+
return '-';
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
const getShipmentValue = (key) => {
|
|
847
|
+
try {
|
|
848
|
+
return order.orderData.user_info.custom_form_delivery[key] || '-';
|
|
849
|
+
}
|
|
850
|
+
catch (error) {
|
|
851
|
+
return '-';
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
(registerConfig || []).map((item) => {
|
|
855
|
+
customizeMap.set(`註冊自訂值 - ${item.title}`, order ? getUserValue(item.key) : '-');
|
|
856
|
+
});
|
|
857
|
+
(memberConfig || []).map((item) => {
|
|
858
|
+
customizeMap.set(`會員自訂值 - ${item.title}`, order ? getUserValue(item.key) : '-');
|
|
859
|
+
});
|
|
860
|
+
const cashflowConfig = order ? cashflowConfigObj[order.payment_method] : Object.values(cashflowConfigObj).flat();
|
|
861
|
+
(cashflowConfig || []).map((item) => {
|
|
862
|
+
customizeMap.set(`金流自訂值 - ${item.title}`, order ? getCashflowValue(item.key) : '-');
|
|
863
|
+
});
|
|
864
|
+
const shipmentConfig = order ? shipmentConfigObj[order.shipment_method] : Object.values(shipmentConfigObj).flat();
|
|
865
|
+
(shipmentConfig || []).map((item) => {
|
|
866
|
+
customizeMap.set(`物流自訂值 - ${item.title}`, order ? getShipmentValue(item.key) : '-');
|
|
867
|
+
});
|
|
868
|
+
return customizeMap;
|
|
869
|
+
});
|