ts-glitter 20.3.2 → 20.3.4
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-product.js +21 -15
- package/lowcode/backend-manager/bg-product.ts +32 -22
- package/lowcode/backend-manager/bg-widget.ts +1 -1
- package/lowcode/cms-plugin/model/order.d.ts +1 -0
- package/lowcode/cms-plugin/module/order-setting.js +118 -22
- package/lowcode/cms-plugin/module/order-setting.ts +133 -22
- package/lowcode/cms-plugin/order/order-module.js +366 -0
- package/lowcode/cms-plugin/order/order-module.ts +404 -0
- package/lowcode/cms-plugin/shopping-order-manager.js +21 -9
- package/lowcode/cms-plugin/shopping-order-manager.ts +21 -9
- package/lowcode/css/editor.css +14 -0
- package/package.json +1 -1
- package/src/api-public/controllers/ai-points.js.map +1 -1
- package/src/api-public/controllers/index.js.map +1 -1
- package/src/api-public/controllers/track.js.map +1 -1
- package/src/api-public/services/filter-protect-data.js.map +1 -1
- package/src/api-public/services/shopping.d.ts +6 -0
- package/src/api-public/services/shopping.js +158 -123
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +204 -166
- package/src/api-public/services/user.js.map +1 -1
- package/src/controllers/backend-server.js.map +1 -1
- package/src/firebase/message.js +2 -1
- package/src/firebase/message.js.map +1 -1
- package/src/helper/glitter-util.d.ts +1 -0
- package/src/helper/glitter-util.js.map +1 -1
- package/src/modules/caught-error.js.map +1 -1
- package/src/modules/firebase.js.map +1 -1
- package/src/services/app.js +1 -1
- package/src/services/app.ts +1 -1
- package/src/services/backend-service.js +1 -1
- package/src/services/backend-service.js.map +5 -1
- package/src/services/backend-service.ts +1 -1
- package/src/services/ios-release.js.map +1 -1
- package/src/services/release.js.map +1 -1
- package/src/services/saas-table-check.js +2 -2
- package/src/services/saas-table-check.js.map +1 -1
- package/src/services/template.js.map +1 -1
- package/src/api-public/services/product-migrate.js +0 -9
package/lowcode/Entry.js
CHANGED
|
@@ -143,7 +143,7 @@ export class Entry {
|
|
|
143
143
|
}
|
|
144
144
|
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
|
|
145
145
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
146
|
-
glitter.share.editerVersion = 'V_20.3.
|
|
146
|
+
glitter.share.editerVersion = 'V_20.3.4';
|
|
147
147
|
glitter.share.start = new Date();
|
|
148
148
|
const vm = { appConfig: [] };
|
|
149
149
|
window.saasConfig = {
|
package/lowcode/Entry.ts
CHANGED
|
@@ -144,7 +144,7 @@ export class Entry {
|
|
|
144
144
|
}
|
|
145
145
|
(window as any).renderClock = (window as any).renderClock ?? createClock();
|
|
146
146
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
147
|
-
glitter.share.editerVersion = 'V_20.3.
|
|
147
|
+
glitter.share.editerVersion = 'V_20.3.4';
|
|
148
148
|
glitter.share.start = new Date();
|
|
149
149
|
const vm = { appConfig: [] };
|
|
150
150
|
(window as any).saasConfig = {
|
|
@@ -179,9 +179,13 @@ export class BgProduct {
|
|
|
179
179
|
? BgWidget.infoInsignia(ProductConfig.getName(opt.content))
|
|
180
180
|
: ''}${opt.value}
|
|
181
181
|
</div>
|
|
182
|
-
${opt.sub_title
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
${opt.sub_title
|
|
183
|
+
? html `
|
|
184
|
+
<div class="fw-500" style="color:grey;font-size:13px;">
|
|
185
|
+
${opt.sub_title}
|
|
186
|
+
</div>
|
|
187
|
+
`
|
|
188
|
+
: ''}
|
|
185
189
|
</div>
|
|
186
190
|
</div>
|
|
187
191
|
${(() => {
|
|
@@ -255,28 +259,30 @@ export class BgProduct {
|
|
|
255
259
|
vm.options = [];
|
|
256
260
|
data.response.data.map((product) => {
|
|
257
261
|
var _a;
|
|
262
|
+
const image = (_a = product.content.preview_image[0]) !== null && _a !== void 0 ? _a : BgWidget.noImageURL;
|
|
263
|
+
const value = [
|
|
264
|
+
product.content.visible === 'false' ? BgWidget.warningInsignia('隱形商品') : '',
|
|
265
|
+
product.content.title,
|
|
266
|
+
]
|
|
267
|
+
.filter(Boolean)
|
|
268
|
+
.join('');
|
|
258
269
|
if (obj.with_variants) {
|
|
259
|
-
product.content.variants.map((
|
|
260
|
-
var _a;
|
|
270
|
+
product.content.variants.map((variant) => {
|
|
261
271
|
vm.options.push({
|
|
262
|
-
key: `${product.content.id}-${
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}).join(''),
|
|
272
|
+
key: `${product.content.id}-${variant.spec.join('-')}`,
|
|
273
|
+
sub_title: variant.spec.join('-') ? `規格:${variant.spec.join('-')}` : '',
|
|
274
|
+
value: value,
|
|
266
275
|
content: product.content,
|
|
267
|
-
|
|
268
|
-
image: (_a = product.content.preview_image[0]) !== null && _a !== void 0 ? _a : BgWidget.noImageURL,
|
|
276
|
+
image: image,
|
|
269
277
|
});
|
|
270
278
|
});
|
|
271
279
|
}
|
|
272
280
|
else {
|
|
273
281
|
vm.options.push({
|
|
274
282
|
key: product.content.id,
|
|
275
|
-
value:
|
|
276
|
-
return dd;
|
|
277
|
-
}).join(''),
|
|
283
|
+
value: value,
|
|
278
284
|
content: product.content,
|
|
279
|
-
image:
|
|
285
|
+
image: image,
|
|
280
286
|
});
|
|
281
287
|
}
|
|
282
288
|
});
|
|
@@ -13,7 +13,7 @@ export type OptionsItem = {
|
|
|
13
13
|
value: string;
|
|
14
14
|
image: string;
|
|
15
15
|
note?: string;
|
|
16
|
-
sub_title?:string
|
|
16
|
+
sub_title?: string;
|
|
17
17
|
content?: any;
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -74,7 +74,7 @@ export class BgProduct {
|
|
|
74
74
|
productType?: string;
|
|
75
75
|
single?: boolean;
|
|
76
76
|
filter_visible?: string;
|
|
77
|
-
with_variants?:boolean
|
|
77
|
+
with_variants?: boolean;
|
|
78
78
|
show_product_type?: boolean;
|
|
79
79
|
}) {
|
|
80
80
|
const glitter = (window.parent as any).glitter;
|
|
@@ -228,9 +228,13 @@ export class BgProduct {
|
|
|
228
228
|
? BgWidget.infoInsignia(ProductConfig.getName(opt.content))
|
|
229
229
|
: ''}${opt.value}
|
|
230
230
|
</div>
|
|
231
|
-
${opt.sub_title
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
${opt.sub_title
|
|
232
|
+
? html`
|
|
233
|
+
<div class="fw-500" style="color:grey;font-size:13px;">
|
|
234
|
+
${opt.sub_title}
|
|
235
|
+
</div>
|
|
236
|
+
`
|
|
237
|
+
: ''}
|
|
234
238
|
</div>
|
|
235
239
|
</div>
|
|
236
240
|
${(() => {
|
|
@@ -321,31 +325,37 @@ export class BgProduct {
|
|
|
321
325
|
filter_visible: obj.filter_visible,
|
|
322
326
|
status: 'inRange',
|
|
323
327
|
}).then(data => {
|
|
324
|
-
vm.options=[]
|
|
325
|
-
|
|
326
|
-
(product: {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
vm.options = [];
|
|
329
|
+
data.response.data.map(
|
|
330
|
+
(product: {
|
|
331
|
+
content: { id: number; title: string; preview_image: string[]; variants: any; visible: string };
|
|
332
|
+
}) => {
|
|
333
|
+
const image = product.content.preview_image[0] ?? BgWidget.noImageURL;
|
|
334
|
+
const value = [
|
|
335
|
+
product.content.visible === 'false' ? BgWidget.warningInsignia('隱形商品') : '',
|
|
336
|
+
product.content.title,
|
|
337
|
+
]
|
|
338
|
+
.filter(Boolean)
|
|
339
|
+
.join('');
|
|
340
|
+
|
|
341
|
+
if (obj.with_variants) {
|
|
342
|
+
product.content.variants.map((variant: any) => {
|
|
330
343
|
vm.options.push({
|
|
331
|
-
key: `${product.content.id}-${
|
|
332
|
-
|
|
333
|
-
|
|
344
|
+
key: `${product.content.id}-${variant.spec.join('-')}`,
|
|
345
|
+
sub_title: variant.spec.join('-') ? `規格:${variant.spec.join('-')}` : '',
|
|
346
|
+
value: value,
|
|
334
347
|
content: product.content,
|
|
335
|
-
|
|
336
|
-
image: product.content.preview_image[0] ?? BgWidget.noImageURL,
|
|
348
|
+
image: image,
|
|
337
349
|
});
|
|
338
|
-
})
|
|
339
|
-
}else{
|
|
350
|
+
});
|
|
351
|
+
} else {
|
|
340
352
|
vm.options.push({
|
|
341
353
|
key: product.content.id,
|
|
342
|
-
value:
|
|
343
|
-
return dd}).join(''),
|
|
354
|
+
value: value,
|
|
344
355
|
content: product.content,
|
|
345
|
-
image:
|
|
356
|
+
image: image,
|
|
346
357
|
});
|
|
347
358
|
}
|
|
348
|
-
|
|
349
359
|
}
|
|
350
360
|
);
|
|
351
361
|
vm.loading = false;
|
|
@@ -2630,8 +2630,8 @@ ${obj.default ?? ''}</textarea
|
|
|
2630
2630
|
}
|
|
2631
2631
|
|
|
2632
2632
|
static inlineCheckBox(obj: {
|
|
2633
|
-
title: string;
|
|
2634
2633
|
gvc: any;
|
|
2634
|
+
title: string;
|
|
2635
2635
|
def: string | string[];
|
|
2636
2636
|
array: string[] | { title: string; value: string; innerHtml?: string }[];
|
|
2637
2637
|
callback: (text: string | string[]) => void;
|
|
@@ -2,6 +2,7 @@ import { BgWidget } from '../../backend-manager/bg-widget.js';
|
|
|
2
2
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
3
3
|
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
4
4
|
import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
5
|
+
import { EditorElem } from '../../glitterBundle/plugins/editor-elem.js';
|
|
5
6
|
const html = String.raw;
|
|
6
7
|
export class OrderSetting {
|
|
7
8
|
static getPaymentMethodText(orderData) {
|
|
@@ -76,11 +77,12 @@ export class OrderSetting {
|
|
|
76
77
|
}
|
|
77
78
|
static getShippmentOpt() {
|
|
78
79
|
return [
|
|
80
|
+
{ title: '未出貨', value: 'wait' },
|
|
81
|
+
{ title: '備貨中', value: 'in_stock' },
|
|
79
82
|
{ title: '已出貨', value: 'shipping' },
|
|
80
|
-
{ title: '
|
|
83
|
+
{ title: '已到貨', value: 'arrived' },
|
|
81
84
|
{ title: '已取貨', value: 'finish' },
|
|
82
85
|
{ title: '已退貨', value: 'returns' },
|
|
83
|
-
{ title: '已到貨', value: 'arrived' },
|
|
84
86
|
].map(item => {
|
|
85
87
|
return {
|
|
86
88
|
key: item.value,
|
|
@@ -1123,7 +1125,7 @@ export class OrderSetting {
|
|
|
1123
1125
|
topGVC.glitter.closeDiaLog();
|
|
1124
1126
|
}
|
|
1125
1127
|
function getDatalist() {
|
|
1126
|
-
return vm.orders.map((dd) => {
|
|
1128
|
+
return vm.orders.map((dd, index) => {
|
|
1127
1129
|
return [
|
|
1128
1130
|
{
|
|
1129
1131
|
key: '訂單編號',
|
|
@@ -1157,40 +1159,117 @@ export class OrderSetting {
|
|
|
1157
1159
|
value: `$ ${dd.orderData.total.toLocaleString()}`,
|
|
1158
1160
|
},
|
|
1159
1161
|
{
|
|
1160
|
-
key: '
|
|
1161
|
-
value:
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
style: 'min-width: 220px;',
|
|
1169
|
-
}),
|
|
1162
|
+
key: '出貨單號碼',
|
|
1163
|
+
value: html `<div style="width: 200px;">
|
|
1164
|
+
${BgWidget.grayNote(dd.orderData.user_info.shipment_number
|
|
1165
|
+
? `#${dd.orderData.user_info.shipment_number}`
|
|
1166
|
+
: dd.orderData.orderSource === 'POS'
|
|
1167
|
+
? 'POS 訂單'
|
|
1168
|
+
: '')}
|
|
1169
|
+
</div>`,
|
|
1170
1170
|
},
|
|
1171
1171
|
{
|
|
1172
|
-
key: '
|
|
1172
|
+
key: '訂單狀態',
|
|
1173
1173
|
value: BgWidget.select({
|
|
1174
1174
|
gvc,
|
|
1175
1175
|
callback: (value) => {
|
|
1176
|
-
dd.orderData.
|
|
1176
|
+
dd.orderData.orderStatus = value;
|
|
1177
1177
|
},
|
|
1178
|
-
default: dd.orderData.
|
|
1179
|
-
options: OrderSetting.
|
|
1180
|
-
style: 'min-width: 180px;',
|
|
1178
|
+
default: `${dd.orderData.orderStatus || 0}`,
|
|
1179
|
+
options: OrderSetting.getOrderStatusOpt(),
|
|
1181
1180
|
}),
|
|
1182
1181
|
},
|
|
1183
1182
|
{
|
|
1184
|
-
key: '
|
|
1183
|
+
key: '付款狀態',
|
|
1185
1184
|
value: BgWidget.select({
|
|
1186
1185
|
gvc,
|
|
1187
1186
|
callback: (value) => {
|
|
1188
|
-
dd.
|
|
1187
|
+
dd.status = value;
|
|
1189
1188
|
},
|
|
1190
|
-
default: `${dd.
|
|
1191
|
-
options: OrderSetting.
|
|
1189
|
+
default: `${dd.status || 0}`,
|
|
1190
|
+
options: OrderSetting.getPaymentStatusOpt(),
|
|
1191
|
+
style: 'min-width: 220px;',
|
|
1192
1192
|
}),
|
|
1193
1193
|
},
|
|
1194
|
+
{
|
|
1195
|
+
key: '出貨狀態',
|
|
1196
|
+
value: gvc.bindView((() => {
|
|
1197
|
+
const divView = {
|
|
1198
|
+
id: gvc.glitter.getUUID(),
|
|
1199
|
+
checkbox: 'auto',
|
|
1200
|
+
hasShipmentNumber: Boolean(dd.orderData.user_info.shipment_number),
|
|
1201
|
+
};
|
|
1202
|
+
if (divView.hasShipmentNumber) {
|
|
1203
|
+
dd.orderData.progress = 'in_stock';
|
|
1204
|
+
}
|
|
1205
|
+
return {
|
|
1206
|
+
bind: divView.id,
|
|
1207
|
+
view: () => {
|
|
1208
|
+
var _a;
|
|
1209
|
+
const htmlArray = [
|
|
1210
|
+
BgWidget.select({
|
|
1211
|
+
gvc,
|
|
1212
|
+
callback: (value) => {
|
|
1213
|
+
dd.orderData.progress = value;
|
|
1214
|
+
if (['wait', 'returns', undefined].includes(value)) {
|
|
1215
|
+
dd.orderData.user_info.shipment_number = '';
|
|
1216
|
+
}
|
|
1217
|
+
gvc.notifyDataChange(divView.id);
|
|
1218
|
+
},
|
|
1219
|
+
default: dd.orderData.progress || 'wait',
|
|
1220
|
+
options: OrderSetting.getShippmentOpt(),
|
|
1221
|
+
style: 'max-width: 180px;',
|
|
1222
|
+
}),
|
|
1223
|
+
(() => {
|
|
1224
|
+
var _a;
|
|
1225
|
+
if (!divView.hasShipmentNumber &&
|
|
1226
|
+
['wait', 'returns', undefined].includes(cloneOrders[index].orderData.progress) &&
|
|
1227
|
+
['arrived', 'finish', 'shipping', 'in_stock'].includes(dd.orderData.progress)) {
|
|
1228
|
+
(_a = dd.orderData.user_info).shipment_number || (_a.shipment_number = new Date().getTime());
|
|
1229
|
+
return EditorElem.radio({
|
|
1230
|
+
gvc: gvc,
|
|
1231
|
+
title: '',
|
|
1232
|
+
def: divView.checkbox,
|
|
1233
|
+
array: [
|
|
1234
|
+
{
|
|
1235
|
+
title: '自動選號',
|
|
1236
|
+
value: 'auto',
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
title: '手動輸入',
|
|
1240
|
+
value: 'manual',
|
|
1241
|
+
},
|
|
1242
|
+
],
|
|
1243
|
+
callback: text => {
|
|
1244
|
+
divView.checkbox = text;
|
|
1245
|
+
gvc.notifyDataChange(divView.id);
|
|
1246
|
+
},
|
|
1247
|
+
oneLine: true,
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
return '';
|
|
1251
|
+
})(),
|
|
1252
|
+
divView.checkbox === 'manual'
|
|
1253
|
+
? BgWidget.editeInput({
|
|
1254
|
+
gvc,
|
|
1255
|
+
title: '',
|
|
1256
|
+
default: `${(_a = dd.orderData.user_info.shipment_number) !== null && _a !== void 0 ? _a : ''}`,
|
|
1257
|
+
placeHolder: '為空則為自動選號',
|
|
1258
|
+
callback: text => {
|
|
1259
|
+
dd.orderData.user_info.shipment_number = text;
|
|
1260
|
+
gvc.notifyDataChange(divView.id);
|
|
1261
|
+
},
|
|
1262
|
+
})
|
|
1263
|
+
: '',
|
|
1264
|
+
].filter(Boolean);
|
|
1265
|
+
return html `<div class="d-flex align-items-center gap-2">${htmlArray.join('')}</div>`;
|
|
1266
|
+
},
|
|
1267
|
+
divCreate: {
|
|
1268
|
+
style: 'min-width: 580px;',
|
|
1269
|
+
},
|
|
1270
|
+
};
|
|
1271
|
+
})()),
|
|
1272
|
+
},
|
|
1194
1273
|
];
|
|
1195
1274
|
});
|
|
1196
1275
|
}
|
|
@@ -1331,6 +1410,23 @@ export class OrderSetting {
|
|
|
1331
1410
|
<div class="w-100 d-flex justify-content-end" style="padding: 14px 16px; gap: 14px;">
|
|
1332
1411
|
${BgWidget.cancel(gvc.event(() => closeEvent()))}
|
|
1333
1412
|
${BgWidget.save(gvc.event(() => {
|
|
1413
|
+
for (let i = 0; i < vm.orders.length; i++) {
|
|
1414
|
+
const order = vm.orders[i];
|
|
1415
|
+
const cloneOrder = cloneOrders[i];
|
|
1416
|
+
if (['wait', 'returns', undefined].includes(cloneOrder.orderData.progress) &&
|
|
1417
|
+
['arrived', 'finish', 'shipping', 'in_stock'].includes(order.orderData.progress) &&
|
|
1418
|
+
!order.orderData.user_info.shipment_number) {
|
|
1419
|
+
dialog.errorMessage({
|
|
1420
|
+
text: `訂單編號 #${order.cart_token} 未輸入出貨單號碼`,
|
|
1421
|
+
});
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
vm.orders.forEach((order) => {
|
|
1426
|
+
if (order.orderData.progress === 'in_stock') {
|
|
1427
|
+
order.orderData.progress = 'wait';
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1334
1430
|
obj.callback(vm.orders);
|
|
1335
1431
|
topGVC.glitter.closeDiaLog();
|
|
1336
1432
|
}))}
|
|
@@ -3,6 +3,7 @@ import { BgWidget, OptionsItem } from '../../backend-manager/bg-widget.js';
|
|
|
3
3
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
4
4
|
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
5
5
|
import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
6
|
+
import { EditorElem } from '../../glitterBundle/plugins/editor-elem.js';
|
|
6
7
|
|
|
7
8
|
const html = String.raw;
|
|
8
9
|
|
|
@@ -111,11 +112,12 @@ export class OrderSetting {
|
|
|
111
112
|
// 配送方式 Select Options
|
|
112
113
|
static getShippmentOpt() {
|
|
113
114
|
return [
|
|
115
|
+
{ title: '未出貨', value: 'wait' },
|
|
116
|
+
{ title: '備貨中', value: 'in_stock' },
|
|
114
117
|
{ title: '已出貨', value: 'shipping' },
|
|
115
|
-
{ title: '
|
|
118
|
+
{ title: '已到貨', value: 'arrived' },
|
|
116
119
|
{ title: '已取貨', value: 'finish' },
|
|
117
120
|
{ title: '已退貨', value: 'returns' },
|
|
118
|
-
{ title: '已到貨', value: 'arrived' },
|
|
119
121
|
].map(item => {
|
|
120
122
|
return {
|
|
121
123
|
key: item.value,
|
|
@@ -1291,7 +1293,7 @@ export class OrderSetting {
|
|
|
1291
1293
|
}
|
|
1292
1294
|
|
|
1293
1295
|
function getDatalist() {
|
|
1294
|
-
return vm.orders.map((dd: any) => {
|
|
1296
|
+
return vm.orders.map((dd: any, index: number) => {
|
|
1295
1297
|
return [
|
|
1296
1298
|
{
|
|
1297
1299
|
key: '訂單編號',
|
|
@@ -1325,40 +1327,124 @@ export class OrderSetting {
|
|
|
1325
1327
|
value: `$ ${dd.orderData.total.toLocaleString()}`,
|
|
1326
1328
|
},
|
|
1327
1329
|
{
|
|
1328
|
-
key: '
|
|
1329
|
-
value:
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1330
|
+
key: '出貨單號碼',
|
|
1331
|
+
value: html`<div style="width: 200px;">
|
|
1332
|
+
${BgWidget.grayNote(
|
|
1333
|
+
dd.orderData.user_info.shipment_number
|
|
1334
|
+
? `#${dd.orderData.user_info.shipment_number}`
|
|
1335
|
+
: dd.orderData.orderSource === 'POS'
|
|
1336
|
+
? 'POS 訂單'
|
|
1337
|
+
: ''
|
|
1338
|
+
)}
|
|
1339
|
+
</div>`,
|
|
1338
1340
|
},
|
|
1339
1341
|
{
|
|
1340
|
-
key: '
|
|
1342
|
+
key: '訂單狀態',
|
|
1341
1343
|
value: BgWidget.select({
|
|
1342
1344
|
gvc,
|
|
1343
1345
|
callback: (value: any) => {
|
|
1344
|
-
dd.orderData.
|
|
1346
|
+
dd.orderData.orderStatus = value;
|
|
1345
1347
|
},
|
|
1346
|
-
default: dd.orderData.
|
|
1347
|
-
options: OrderSetting.
|
|
1348
|
-
style: 'min-width: 180px;',
|
|
1348
|
+
default: `${dd.orderData.orderStatus || 0}`,
|
|
1349
|
+
options: OrderSetting.getOrderStatusOpt(),
|
|
1349
1350
|
}),
|
|
1350
1351
|
},
|
|
1351
1352
|
{
|
|
1352
|
-
key: '
|
|
1353
|
+
key: '付款狀態',
|
|
1353
1354
|
value: BgWidget.select({
|
|
1354
1355
|
gvc,
|
|
1355
1356
|
callback: (value: any) => {
|
|
1356
|
-
dd.
|
|
1357
|
+
dd.status = value;
|
|
1357
1358
|
},
|
|
1358
|
-
default: `${dd.
|
|
1359
|
-
options: OrderSetting.
|
|
1359
|
+
default: `${dd.status || 0}`,
|
|
1360
|
+
options: OrderSetting.getPaymentStatusOpt(),
|
|
1361
|
+
style: 'min-width: 220px;',
|
|
1360
1362
|
}),
|
|
1361
1363
|
},
|
|
1364
|
+
{
|
|
1365
|
+
key: '出貨狀態',
|
|
1366
|
+
value: gvc.bindView(
|
|
1367
|
+
(() => {
|
|
1368
|
+
const divView = {
|
|
1369
|
+
id: gvc.glitter.getUUID(),
|
|
1370
|
+
checkbox: 'auto',
|
|
1371
|
+
hasShipmentNumber: Boolean(dd.orderData.user_info.shipment_number),
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
if (divView.hasShipmentNumber) {
|
|
1375
|
+
dd.orderData.progress = 'in_stock';
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
return {
|
|
1379
|
+
bind: divView.id,
|
|
1380
|
+
view: () => {
|
|
1381
|
+
const htmlArray = [
|
|
1382
|
+
BgWidget.select({
|
|
1383
|
+
gvc,
|
|
1384
|
+
callback: (value: any) => {
|
|
1385
|
+
dd.orderData.progress = value;
|
|
1386
|
+
if (['wait', 'returns', undefined].includes(value)) {
|
|
1387
|
+
dd.orderData.user_info.shipment_number = '';
|
|
1388
|
+
}
|
|
1389
|
+
gvc.notifyDataChange(divView.id);
|
|
1390
|
+
},
|
|
1391
|
+
default: dd.orderData.progress || 'wait',
|
|
1392
|
+
options: OrderSetting.getShippmentOpt(),
|
|
1393
|
+
style: 'max-width: 180px;',
|
|
1394
|
+
}),
|
|
1395
|
+
(() => {
|
|
1396
|
+
if (
|
|
1397
|
+
!divView.hasShipmentNumber &&
|
|
1398
|
+
['wait', 'returns', undefined].includes(cloneOrders[index].orderData.progress) &&
|
|
1399
|
+
['arrived', 'finish', 'shipping', 'in_stock'].includes(dd.orderData.progress)
|
|
1400
|
+
) {
|
|
1401
|
+
dd.orderData.user_info.shipment_number ||= new Date().getTime();
|
|
1402
|
+
return EditorElem.radio({
|
|
1403
|
+
gvc: gvc,
|
|
1404
|
+
title: '',
|
|
1405
|
+
def: divView.checkbox,
|
|
1406
|
+
array: [
|
|
1407
|
+
{
|
|
1408
|
+
title: '自動選號',
|
|
1409
|
+
value: 'auto',
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
title: '手動輸入',
|
|
1413
|
+
value: 'manual',
|
|
1414
|
+
},
|
|
1415
|
+
],
|
|
1416
|
+
callback: text => {
|
|
1417
|
+
divView.checkbox = text;
|
|
1418
|
+
gvc.notifyDataChange(divView.id);
|
|
1419
|
+
},
|
|
1420
|
+
oneLine: true,
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
return '';
|
|
1424
|
+
})(),
|
|
1425
|
+
divView.checkbox === 'manual'
|
|
1426
|
+
? BgWidget.editeInput({
|
|
1427
|
+
gvc,
|
|
1428
|
+
title: '',
|
|
1429
|
+
default: `${dd.orderData.user_info.shipment_number ?? ''}`,
|
|
1430
|
+
placeHolder: '為空則為自動選號',
|
|
1431
|
+
callback: text => {
|
|
1432
|
+
dd.orderData.user_info.shipment_number = text;
|
|
1433
|
+
gvc.notifyDataChange(divView.id);
|
|
1434
|
+
},
|
|
1435
|
+
})
|
|
1436
|
+
: '',
|
|
1437
|
+
].filter(Boolean);
|
|
1438
|
+
|
|
1439
|
+
return html`<div class="d-flex align-items-center gap-2">${htmlArray.join('')}</div>`;
|
|
1440
|
+
},
|
|
1441
|
+
divCreate: {
|
|
1442
|
+
style: 'min-width: 580px;',
|
|
1443
|
+
},
|
|
1444
|
+
};
|
|
1445
|
+
})()
|
|
1446
|
+
),
|
|
1447
|
+
},
|
|
1362
1448
|
];
|
|
1363
1449
|
});
|
|
1364
1450
|
}
|
|
@@ -1511,6 +1597,31 @@ export class OrderSetting {
|
|
|
1511
1597
|
${BgWidget.cancel(gvc.event(() => closeEvent()))}
|
|
1512
1598
|
${BgWidget.save(
|
|
1513
1599
|
gvc.event(() => {
|
|
1600
|
+
// 與原訂單的資料做驗證
|
|
1601
|
+
for (let i = 0; i < vm.orders.length; i++) {
|
|
1602
|
+
const order = vm.orders[i];
|
|
1603
|
+
const cloneOrder = cloneOrders[i];
|
|
1604
|
+
|
|
1605
|
+
if (
|
|
1606
|
+
['wait', 'returns', undefined].includes(cloneOrder.orderData.progress) &&
|
|
1607
|
+
['arrived', 'finish', 'shipping', 'in_stock'].includes(order.orderData.progress) &&
|
|
1608
|
+
!order.orderData.user_info.shipment_number
|
|
1609
|
+
) {
|
|
1610
|
+
dialog.errorMessage({
|
|
1611
|
+
text: `訂單編號 #${order.cart_token} 未輸入出貨單號碼`,
|
|
1612
|
+
});
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
// 「備貨中」重新賦值
|
|
1618
|
+
vm.orders.forEach((order: any) => {
|
|
1619
|
+
if (order.orderData.progress === 'in_stock') {
|
|
1620
|
+
order.orderData.progress = 'wait';
|
|
1621
|
+
}
|
|
1622
|
+
});
|
|
1623
|
+
|
|
1624
|
+
// 觸發更新事件
|
|
1514
1625
|
obj.callback(vm.orders);
|
|
1515
1626
|
topGVC.glitter.closeDiaLog();
|
|
1516
1627
|
})
|