ts-glitter 20.6.7 → 20.6.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 +2 -2
- package/lowcode/Entry.ts +2 -2
- package/lowcode/backend-manager/bg-blog.js +617 -621
- package/lowcode/backend-manager/bg-blog.ts +2323 -2325
- package/lowcode/backend-manager/bg-line.js +5 -4
- package/lowcode/backend-manager/bg-line.ts +5 -4
- package/lowcode/backend-manager/bg-list-component.js +9 -0
- package/lowcode/backend-manager/bg-list-component.ts +15 -1
- package/lowcode/backend-manager/bg-notify.js +6 -4
- package/lowcode/backend-manager/bg-notify.ts +6 -4
- package/lowcode/backend-manager/bg-product.js +145 -0
- package/lowcode/backend-manager/bg-product.ts +153 -0
- package/lowcode/backend-manager/bg-sns.js +5 -3
- package/lowcode/backend-manager/bg-sns.ts +5 -3
- package/lowcode/backend-manager/bg-widget.js +92 -4
- package/lowcode/backend-manager/bg-widget.ts +122 -6
- package/lowcode/backend-manager/splitPage.js +0 -39
- package/lowcode/backend-manager/splitPage.ts +0 -40
- package/lowcode/cms-plugin/auto-fcm-advertise.js +17 -5
- package/lowcode/cms-plugin/auto-fcm-advertise.ts +19 -6
- package/lowcode/cms-plugin/auto-fcm-history.js +2732 -0
- package/lowcode/cms-plugin/auto-fcm-history.ts +2995 -0
- package/lowcode/cms-plugin/cms-router.js +5 -0
- package/lowcode/cms-plugin/cms-router.ts +6 -0
- package/lowcode/cms-plugin/filter-options.js +80 -27
- package/lowcode/cms-plugin/filter-options.ts +83 -27
- package/lowcode/cms-plugin/language-backend.js +50 -39
- package/lowcode/cms-plugin/language-backend.ts +109 -95
- package/lowcode/cms-plugin/menus-setting.js +175 -151
- package/lowcode/cms-plugin/menus-setting.ts +620 -591
- package/lowcode/cms-plugin/model/order.d.ts +1 -0
- package/lowcode/cms-plugin/module/data.js +7 -7
- package/lowcode/cms-plugin/module/data.ts +262 -233
- package/lowcode/cms-plugin/module/delivery-html.js +18 -10
- package/lowcode/cms-plugin/module/delivery-html.ts +26 -10
- package/lowcode/cms-plugin/module/order-setting.js +458 -328
- package/lowcode/cms-plugin/module/order-setting.ts +622 -351
- package/lowcode/cms-plugin/module/product-excel.js +1 -1
- package/lowcode/cms-plugin/module/product-excel.ts +2 -1
- package/lowcode/cms-plugin/order/order-module.js +90 -1
- package/lowcode/cms-plugin/order/order-module.ts +106 -1
- package/lowcode/cms-plugin/pos-pages/payment-page.js +11 -8
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +28 -15
- package/lowcode/cms-plugin/pos-pages/products-page.js +0 -39
- package/lowcode/cms-plugin/pos-pages/products-page.ts +0 -40
- package/lowcode/cms-plugin/shopping-collections.ts +1 -3
- package/lowcode/cms-plugin/shopping-finance-setting.js +19 -80
- package/lowcode/cms-plugin/shopping-finance-setting.ts +19 -87
- package/lowcode/cms-plugin/shopping-order-manager.js +122 -38
- package/lowcode/cms-plugin/shopping-order-manager.ts +160 -58
- package/lowcode/cms-plugin/shopping-product-setting.js +364 -376
- package/lowcode/cms-plugin/shopping-product-setting.ts +406 -415
- package/lowcode/cms-plugin/shopping-setting-advance.js +57 -16
- package/lowcode/cms-plugin/shopping-setting-advance.ts +69 -18
- package/lowcode/cms-plugin/user/user-module.js +2 -43
- package/lowcode/cms-plugin/user/user-module.ts +2 -46
- package/lowcode/cms-plugin/user-list.js +4 -6
- package/lowcode/cms-plugin/user-list.ts +35 -38
- package/lowcode/css/editor.css +42 -3
- package/lowcode/glitter-base/global/language.js +6 -1
- package/lowcode/glitter-base/global/language.ts +10 -4
- package/lowcode/glitter-base/global/payment-config.js +19 -16
- package/lowcode/glitter-base/global/payment-config.ts +22 -16
- package/lowcode/glitter-base/global/shipment-config.js +6 -5
- package/lowcode/glitter-base/global/shipment-config.ts +12 -10
- package/lowcode/glitter-base/route/fcm.js +21 -1
- package/lowcode/glitter-base/route/fcm.ts +22 -2
- package/lowcode/glitter-base/route/shopping.js +8 -32
- package/lowcode/glitter-base/route/shopping.ts +10 -33
- package/lowcode/glitter-base/route/user.js +11 -2
- package/lowcode/glitter-base/route/user.ts +23 -12
- package/lowcode/jspage/function-page/setting_editor.js +9 -0
- package/lowcode/jspage/function-page/setting_editor.ts +9 -0
- package/lowcode/public-components/blogs/list.js +223 -195
- package/lowcode/public-components/blogs/list.ts +383 -352
- package/lowcode/public-components/product/product-list.js +8 -4
- package/lowcode/public-components/product/product-list.ts +9 -4
- package/lowcode/public-components/terms-related/index.js +1 -1
- package/lowcode/public-components/terms-related/index.ts +1 -1
- package/lowcode/public-components/user-manager/um-login.js +1 -1
- package/lowcode/public-components/user-manager/um-login.ts +2 -2
- package/lowcode/public-components/user-manager/um-order.js +41 -5
- package/lowcode/public-components/user-manager/um-order.ts +58 -20
- package/lowcode/public-components/user-manager/um-voucher.ts +2 -2
- package/nhi4veq3gk.json +1 -0
- package/package.json +1 -1
- package/src/Language.d.ts +2 -0
- package/src/Language.js +66 -65
- package/src/Language.js.map +1 -1
- package/src/Language.ts +719 -715
- package/src/api-public/config/shipment-config.js +3 -2
- package/src/api-public/config/shipment-config.js.map +1 -1
- package/src/api-public/config/shipment-config.ts +3 -2
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/controllers/ai-chat.ts +1 -2
- package/src/api-public/controllers/fcm.js +23 -58
- package/src/api-public/controllers/fcm.js.map +1 -1
- package/src/api-public/controllers/fcm.ts +28 -56
- package/src/api-public/controllers/shop.js +7 -1
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +17 -10
- package/src/api-public/controllers/user.js +1 -0
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +2 -0
- package/src/api-public/services/auto-send-email.js +247 -187
- package/src/api-public/services/auto-send-email.js.map +1 -1
- package/src/api-public/services/auto-send-email.ts +568 -505
- package/src/api-public/services/delivery.js +1 -1
- package/src/api-public/services/delivery.js.map +1 -1
- package/src/api-public/services/delivery.ts +6 -5
- package/src/api-public/services/financial-service.js +1 -2
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +4 -6
- package/src/api-public/services/manager.d.ts +4 -3
- package/src/api-public/services/manager.js +8 -12
- package/src/api-public/services/manager.js.map +1 -1
- package/src/api-public/services/manager.ts +57 -59
- package/src/api-public/services/model/handlePaymentTransaction.d.ts +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.js +23 -3
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +25 -36
- package/src/api-public/services/schedule.d.ts +1 -0
- package/src/api-public/services/schedule.js +27 -0
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +30 -0
- package/src/api-public/services/shopping.d.ts +22 -2
- package/src/api-public/services/shopping.js +362 -90
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +481 -134
- package/src/api-public/services/user.d.ts +1 -0
- package/src/api-public/services/user.js +36 -16
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +42 -23
- package/src/api-public/services/workers.js +3 -3
- package/src/api-public/services/workers.js.map +1 -1
- package/src/api-public/services/workers.ts +103 -103
- package/src/app-project/serverless/src/modules/database.js +1 -1
- package/src/app-project/serverless/src/modules/database.js.map +1 -1
- package/src/app-project/serverless/src/modules/database.ts +171 -171
- package/src/controllers/template.d.ts +1 -1
- package/src/controllers/template.js +16 -16
- package/src/controllers/template.js.map +1 -1
- package/src/controllers/template.ts +98 -84
- package/src/modules/database.js +3 -1
- package/src/modules/database.js.map +1 -1
- package/src/modules/database.ts +185 -181
- package/src/modules/firebase.d.ts +17 -0
- package/src/modules/firebase.js +126 -0
- package/src/modules/firebase.js.map +1 -1
- package/src/modules/firebase.ts +169 -0
- package/src/public-config-initial/auto-fcm.js +8 -2
- package/src/public-config-initial/auto-fcm.js.map +1 -1
- package/src/public-config-initial/auto-fcm.ts +15 -6
- package/src/services/app.d.ts +2 -1
- package/src/services/app.js.map +1 -1
- package/src/services/app.ts +2 -1
- package/src/services/template.d.ts +3 -2
- package/src/services/template.js +2 -1
- package/src/services/template.js.map +1 -1
- package/src/services/template.ts +13 -20
|
@@ -88,402 +88,390 @@ export class ShoppingProductSetting {
|
|
|
88
88
|
window.parent.glitter.share.checkData = () => true;
|
|
89
89
|
vm.tableId = gvc.glitter.getUUID();
|
|
90
90
|
vm.dataList = [];
|
|
91
|
-
const vmlist = {
|
|
92
|
-
id: glitter.getUUID(),
|
|
93
|
-
loading: true,
|
|
94
|
-
collections: [],
|
|
95
|
-
};
|
|
96
91
|
return gvc.bindView({
|
|
97
|
-
bind:
|
|
92
|
+
bind: glitter.getUUID(),
|
|
98
93
|
view: () => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
94
|
+
return BgWidget.container(html `
|
|
95
|
+
<div class="title-container">
|
|
96
|
+
${BgWidget.title((() => {
|
|
97
|
+
const titleMap = {
|
|
98
|
+
addProduct: '加購品',
|
|
99
|
+
giveaway: '贈品',
|
|
100
|
+
product: '商品列表',
|
|
101
|
+
hidden: '隱形賣場商品',
|
|
102
|
+
};
|
|
103
|
+
return titleMap[type] || '';
|
|
104
|
+
})())}
|
|
105
|
+
<div class="flex-fill"></div>
|
|
106
|
+
<div style="display: flex; gap: 10px;">
|
|
107
|
+
${[
|
|
108
|
+
BgWidget.grayButton('匯入', gvc.event(() => {
|
|
109
|
+
ProductExcel.importDialog(gvc, () => gvc.notifyDataChange(vm.id));
|
|
110
|
+
})),
|
|
111
|
+
BgWidget.grayButton('匯出', gvc.event(() => {
|
|
112
|
+
ProductExcel.exportDialog(gvc, type, vm.apiJSON, vm.checkedData);
|
|
113
|
+
})),
|
|
114
|
+
BgWidget.darkButton('新增', gvc.event(() => {
|
|
115
|
+
var _b, _c, _d, _e;
|
|
116
|
+
ShoppingProductSetting.select_language = (_d = (_c = (_b = window.parent) === null || _b === void 0 ? void 0 : _b.store_info) === null || _c === void 0 ? void 0 : _c.language_setting) === null || _d === void 0 ? void 0 : _d.def;
|
|
117
|
+
const supportProducts = ShoppingProductSetting.getSupportProductCategory();
|
|
118
|
+
if (supportProducts.length <= 1) {
|
|
119
|
+
ShoppingProductSetting.select_product_type = (((_e = supportProducts[0]) === null || _e === void 0 ? void 0 : _e.key) || '');
|
|
120
|
+
vm.type = 'add';
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
ShoppingProductSetting.select_product_type = supportProducts[0].key;
|
|
124
|
+
BgWidget.settingDialog({
|
|
125
|
+
gvc: gvc,
|
|
126
|
+
title: '選擇商品類型',
|
|
127
|
+
innerHTML: (gvc) => {
|
|
128
|
+
return html `
|
|
129
|
+
<div class="d-flex align-items-center">
|
|
130
|
+
${BgWidget.select({
|
|
131
|
+
gvc: gvc,
|
|
132
|
+
callback: data => {
|
|
133
|
+
ShoppingProductSetting.select_product_type = data;
|
|
134
|
+
},
|
|
135
|
+
options: supportProducts,
|
|
136
|
+
default: ShoppingProductSetting.select_product_type,
|
|
137
|
+
})}
|
|
138
|
+
</div>
|
|
139
|
+
`;
|
|
140
|
+
},
|
|
141
|
+
footer_html: (gvc) => {
|
|
142
|
+
return BgWidget.save(gvc.event(() => {
|
|
143
|
+
vm.type = 'add';
|
|
144
|
+
gvc.closeDialog();
|
|
145
|
+
}), '下一步');
|
|
146
|
+
},
|
|
147
|
+
width: 300,
|
|
114
148
|
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const titleMap = {
|
|
120
|
-
addProduct: '加購品',
|
|
121
|
-
giveaway: '贈品',
|
|
122
|
-
product: '商品列表',
|
|
123
|
-
hidden: '隱形賣場商品',
|
|
124
|
-
};
|
|
125
|
-
return titleMap[type] || '';
|
|
126
|
-
})())}
|
|
127
|
-
<div class="flex-fill"></div>
|
|
128
|
-
<div style="display: flex; gap: 10px;">
|
|
129
|
-
${[
|
|
130
|
-
BgWidget.grayButton('匯入', gvc.event(() => {
|
|
131
|
-
ProductExcel.importDialog(gvc, () => gvc.notifyDataChange(vm.id));
|
|
132
|
-
})),
|
|
133
|
-
BgWidget.grayButton('匯出', gvc.event(() => {
|
|
134
|
-
ProductExcel.exportDialog(gvc, type, vm.apiJSON, vm.checkedData);
|
|
135
|
-
})),
|
|
136
|
-
BgWidget.darkButton('新增', gvc.event(() => {
|
|
137
|
-
var _b, _c, _d, _e;
|
|
138
|
-
ShoppingProductSetting.select_language = (_d = (_c = (_b = window.parent) === null || _b === void 0 ? void 0 : _b.store_info) === null || _c === void 0 ? void 0 : _c.language_setting) === null || _d === void 0 ? void 0 : _d.def;
|
|
139
|
-
const supportProducts = ShoppingProductSetting.getSupportProductCategory();
|
|
140
|
-
if (supportProducts.length <= 1) {
|
|
141
|
-
ShoppingProductSetting.select_product_type = (((_e = supportProducts[0]) === null || _e === void 0 ? void 0 : _e.key) || '');
|
|
142
|
-
vm.type = 'add';
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
ShoppingProductSetting.select_product_type = supportProducts[0].key;
|
|
146
|
-
BgWidget.settingDialog({
|
|
147
|
-
gvc: gvc,
|
|
148
|
-
title: '選擇商品類型',
|
|
149
|
-
innerHTML: (gvc) => {
|
|
150
|
-
return html `
|
|
151
|
-
<div class="d-flex align-items-center">
|
|
152
|
-
${BgWidget.select({
|
|
153
|
-
gvc: gvc,
|
|
154
|
-
callback: data => {
|
|
155
|
-
ShoppingProductSetting.select_product_type = data;
|
|
156
|
-
},
|
|
157
|
-
options: supportProducts,
|
|
158
|
-
default: ShoppingProductSetting.select_product_type,
|
|
159
|
-
})}
|
|
160
|
-
</div>
|
|
161
|
-
`;
|
|
162
|
-
},
|
|
163
|
-
footer_html: (gvc) => {
|
|
164
|
-
return BgWidget.save(gvc.event(() => {
|
|
165
|
-
vm.type = 'add';
|
|
166
|
-
gvc.closeDialog();
|
|
167
|
-
}), '下一步');
|
|
168
|
-
},
|
|
169
|
-
width: 300,
|
|
170
|
-
});
|
|
171
|
-
}), {
|
|
172
|
-
class: `guide5-3`,
|
|
173
|
-
}),
|
|
174
|
-
].join('')}
|
|
175
|
-
</div>
|
|
149
|
+
}), {
|
|
150
|
+
class: `guide5-3`,
|
|
151
|
+
}),
|
|
152
|
+
].join('')}
|
|
176
153
|
</div>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
default: vm.queryType || 'title',
|
|
192
|
-
options: FilterOptions.productSelect,
|
|
193
|
-
style: 'min-width: 160px;',
|
|
194
|
-
}),
|
|
195
|
-
BgWidget.searchFilter(gvc.event(e => {
|
|
196
|
-
vm.query = `${e.value}`.trim();
|
|
154
|
+
</div>
|
|
155
|
+
${BgWidget.container(BgWidget.mainCard([
|
|
156
|
+
(() => {
|
|
157
|
+
const id = gvc.glitter.getUUID();
|
|
158
|
+
return gvc.bindView({
|
|
159
|
+
bind: id,
|
|
160
|
+
view: () => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const productFunnel = yield FilterOptions.getProductFunnel();
|
|
162
|
+
const filterList = [
|
|
163
|
+
BgWidget.selectFilter({
|
|
164
|
+
gvc,
|
|
165
|
+
callback: (value) => {
|
|
166
|
+
vm.queryType = value;
|
|
197
167
|
gvc.notifyDataChange(vm.tableId);
|
|
198
168
|
gvc.notifyDataChange(id);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
filter_visible: `${type !== 'hidden'}`,
|
|
247
|
-
collection: vm.filter.collection,
|
|
248
|
-
accurate_search_collection: true,
|
|
249
|
-
productType: type === 'hidden' ? 'product' : type,
|
|
250
|
-
};
|
|
251
|
-
ApiShop.getProduct(vm.apiJSON).then(data => {
|
|
252
|
-
function getDatalist() {
|
|
253
|
-
return data.response.data.map((dd) => {
|
|
254
|
-
var _b;
|
|
255
|
-
return [
|
|
256
|
-
{
|
|
257
|
-
key: '商品',
|
|
258
|
-
value: html ` <div class="d-flex align-items-center">
|
|
259
|
-
${BgWidget.validImageBox({
|
|
260
|
-
gvc: gvc,
|
|
261
|
-
image: dd.content.preview_image[0],
|
|
262
|
-
width: 40,
|
|
263
|
-
class: 'rounded border me-2',
|
|
264
|
-
})}
|
|
265
|
-
<div class="d-flex flex-column" style="">
|
|
266
|
-
${dd.content.shopee_id
|
|
267
|
-
? `<div style="margin-bottom: -10px;"><div class="insignia" style="background: orangered;color: white;">蝦皮</div></div>
|
|
268
|
-
`
|
|
269
|
-
: ``}
|
|
270
|
-
<div>${Tool.truncateString(dd.content.title)}</div>
|
|
271
|
-
</div>
|
|
272
|
-
</div>`,
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
key: '售價',
|
|
276
|
-
value: (() => {
|
|
277
|
-
var _b;
|
|
278
|
-
const numArray = ((_b = dd.content.variants) !== null && _b !== void 0 ? _b : [])
|
|
279
|
-
.map((dd) => {
|
|
280
|
-
return parseInt(`${dd.sale_price}`, 10);
|
|
281
|
-
})
|
|
282
|
-
.filter((dd) => {
|
|
283
|
-
return !isNaN(dd);
|
|
284
|
-
});
|
|
285
|
-
if (numArray.length == 0) {
|
|
286
|
-
return '尚未設定';
|
|
287
|
-
}
|
|
288
|
-
return `$ ${Math.min(...numArray).toLocaleString()}`;
|
|
289
|
-
})(),
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
key: '庫存',
|
|
293
|
-
value: (() => {
|
|
294
|
-
let sum = 0;
|
|
295
|
-
let countStock = 0;
|
|
296
|
-
dd.content.variants.forEach((variant) => {
|
|
297
|
-
if (variant.show_understocking == 'true') {
|
|
298
|
-
countStock++;
|
|
299
|
-
sum += variant.stock;
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
if (countStock == 0) {
|
|
303
|
-
return html ` 無追蹤庫存 `;
|
|
304
|
-
}
|
|
305
|
-
return html `${countStock}個子類
|
|
306
|
-
${sum > 1
|
|
307
|
-
? `有${sum}件庫存`
|
|
308
|
-
: html ` <span style="color:#8E0E2B">有${sum} 件庫存</span>`}`;
|
|
309
|
-
})(),
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
key: '已售出',
|
|
313
|
-
value: ((_b = dd.total_sales) !== null && _b !== void 0 ? _b : '0').toLocaleString(),
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
key: '狀態',
|
|
317
|
-
value: gvc.bindView(() => {
|
|
318
|
-
const id = gvc.glitter.getUUID();
|
|
319
|
-
return {
|
|
320
|
-
bind: id,
|
|
321
|
-
view: () => {
|
|
322
|
-
return ShoppingProductSetting.getOnboardStatus(dd.content);
|
|
323
|
-
},
|
|
324
|
-
divCreate: {
|
|
325
|
-
style: 'min-width: 60px;',
|
|
326
|
-
option: [
|
|
327
|
-
{
|
|
328
|
-
key: 'onclick',
|
|
329
|
-
value: gvc.event((e, event) => {
|
|
330
|
-
event.stopPropagation();
|
|
331
|
-
}),
|
|
332
|
-
},
|
|
333
|
-
],
|
|
334
|
-
},
|
|
335
|
-
};
|
|
336
|
-
}),
|
|
337
|
-
},
|
|
338
|
-
].map(dd => {
|
|
339
|
-
dd.value = html ` <div style="line-height:40px;">${dd.value}</div>`;
|
|
340
|
-
return dd;
|
|
341
|
-
});
|
|
342
|
-
});
|
|
169
|
+
},
|
|
170
|
+
default: vm.queryType || 'title',
|
|
171
|
+
options: FilterOptions.productSelect,
|
|
172
|
+
style: 'min-width: 160px;',
|
|
173
|
+
}),
|
|
174
|
+
BgWidget.searchFilter(gvc.event(e => {
|
|
175
|
+
vm.query = `${e.value}`.trim();
|
|
176
|
+
gvc.notifyDataChange(vm.tableId);
|
|
177
|
+
gvc.notifyDataChange(id);
|
|
178
|
+
}), vm.query || '', '搜尋'),
|
|
179
|
+
BgWidget.funnelFilter({
|
|
180
|
+
gvc,
|
|
181
|
+
callback: () => ListComp.showRightMenu(productFunnel),
|
|
182
|
+
}),
|
|
183
|
+
BgWidget.updownFilter({
|
|
184
|
+
gvc,
|
|
185
|
+
callback: (value) => {
|
|
186
|
+
vm.orderString = value;
|
|
187
|
+
gvc.notifyDataChange(vm.tableId);
|
|
188
|
+
gvc.notifyDataChange(id);
|
|
189
|
+
},
|
|
190
|
+
default: vm.orderString || 'default',
|
|
191
|
+
options: FilterOptions.productListOrderBy,
|
|
192
|
+
}),
|
|
193
|
+
];
|
|
194
|
+
const filterTags = ListComp.getFilterTags(productFunnel);
|
|
195
|
+
return BgListComponent.listBarRWD(filterList, filterTags);
|
|
196
|
+
}),
|
|
197
|
+
});
|
|
198
|
+
})(),
|
|
199
|
+
gvc.bindView({
|
|
200
|
+
bind: vm.tableId,
|
|
201
|
+
view: () => {
|
|
202
|
+
const limit = 20;
|
|
203
|
+
return BgWidget.tableV3({
|
|
204
|
+
gvc: gvc,
|
|
205
|
+
getData: vmi => {
|
|
206
|
+
function loop() {
|
|
207
|
+
vm.apiJSON = {
|
|
208
|
+
page: vmi.page - 1,
|
|
209
|
+
limit: limit,
|
|
210
|
+
search: vm.query || undefined,
|
|
211
|
+
searchType: vm.queryType || undefined,
|
|
212
|
+
orderBy: vm.orderString || undefined,
|
|
213
|
+
status: (() => {
|
|
214
|
+
if (vm.filter.status && vm.filter.status.length > 0) {
|
|
215
|
+
return vm.filter.status.join(',');
|
|
343
216
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if (ShoppingProductSetting.select_page_index !== vmi.page - 1 &&
|
|
350
|
-
ShoppingProductSetting.select_page_index <= vmi.pageSize) {
|
|
351
|
-
vmi.page = ShoppingProductSetting.select_page_index + 1;
|
|
352
|
-
loop();
|
|
217
|
+
return undefined;
|
|
218
|
+
})(),
|
|
219
|
+
channel: (() => {
|
|
220
|
+
if (vm.filter.channel && vm.filter.channel.length > 0) {
|
|
221
|
+
return vm.filter.channel.join(',');
|
|
353
222
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
223
|
+
return undefined;
|
|
224
|
+
})(),
|
|
225
|
+
filter_visible: `${type !== 'hidden'}`,
|
|
226
|
+
collection: vm.filter.collection,
|
|
227
|
+
accurate_search_collection: true,
|
|
228
|
+
productType: type === 'hidden' ? 'product' : type,
|
|
229
|
+
general_tag: (() => {
|
|
230
|
+
if (vm.filter.general_tag && vm.filter.general_tag.length > 0) {
|
|
231
|
+
return vm.filter.general_tag.join(',');
|
|
357
232
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
233
|
+
return undefined;
|
|
234
|
+
})(),
|
|
235
|
+
manager_tag: (() => {
|
|
236
|
+
if (vm.filter.manager_tag && vm.filter.manager_tag.length > 0) {
|
|
237
|
+
return vm.filter.manager_tag.join(',');
|
|
238
|
+
}
|
|
239
|
+
return undefined;
|
|
240
|
+
})(),
|
|
241
|
+
};
|
|
242
|
+
ApiShop.getProduct(vm.apiJSON).then(data => {
|
|
243
|
+
function getDatalist() {
|
|
244
|
+
return data.response.data.map((dd) => {
|
|
245
|
+
var _b;
|
|
246
|
+
return [
|
|
247
|
+
{
|
|
248
|
+
key: '商品',
|
|
249
|
+
value: html ` <div class="d-flex align-items-center">
|
|
250
|
+
${BgWidget.validImageBox({
|
|
251
|
+
gvc: gvc,
|
|
252
|
+
image: dd.content.preview_image[0],
|
|
253
|
+
width: 40,
|
|
254
|
+
class: 'rounded border me-2',
|
|
255
|
+
})}
|
|
256
|
+
<div class="d-flex flex-column" style="">
|
|
257
|
+
${dd.content.shopee_id
|
|
258
|
+
? html `<div style="margin-bottom: -10px;">
|
|
259
|
+
<div
|
|
260
|
+
class="insignia"
|
|
261
|
+
style="background: orangered;color: white;"
|
|
262
|
+
>
|
|
263
|
+
蝦皮
|
|
264
|
+
</div>
|
|
265
|
+
</div> `
|
|
266
|
+
: ''}
|
|
267
|
+
<div>${Tool.truncateString(dd.content.title)}</div>
|
|
268
|
+
</div>
|
|
269
|
+
</div>`,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
key: '售價',
|
|
273
|
+
value: (() => {
|
|
274
|
+
var _b;
|
|
275
|
+
const numArray = ((_b = dd.content.variants) !== null && _b !== void 0 ? _b : [])
|
|
276
|
+
.map((dd) => {
|
|
277
|
+
return parseInt(`${dd.sale_price}`, 10);
|
|
278
|
+
})
|
|
279
|
+
.filter((dd) => {
|
|
280
|
+
return !isNaN(dd);
|
|
389
281
|
});
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
282
|
+
if (numArray.length == 0) {
|
|
283
|
+
return '尚未設定';
|
|
284
|
+
}
|
|
285
|
+
return `$ ${Math.min(...numArray).toLocaleString()}`;
|
|
286
|
+
})(),
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
key: '庫存',
|
|
290
|
+
value: (() => {
|
|
291
|
+
let sum = 0;
|
|
292
|
+
let countStock = 0;
|
|
293
|
+
dd.content.variants.forEach((variant) => {
|
|
294
|
+
if (variant.show_understocking == 'true') {
|
|
295
|
+
countStock++;
|
|
296
|
+
sum += variant.stock;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
if (countStock == 0) {
|
|
300
|
+
return html ` 無追蹤庫存 `;
|
|
301
|
+
}
|
|
302
|
+
return html `${countStock}個子類
|
|
303
|
+
${sum > 1
|
|
304
|
+
? `有${sum}件庫存`
|
|
305
|
+
: html ` <span style="color:#8E0E2B">有${sum} 件庫存</span>`}`;
|
|
306
|
+
})(),
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
key: '已售出',
|
|
310
|
+
value: ((_b = dd.total_sales) !== null && _b !== void 0 ? _b : '0').toLocaleString(),
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
key: '狀態',
|
|
314
|
+
value: gvc.bindView(() => {
|
|
315
|
+
const id = gvc.glitter.getUUID();
|
|
316
|
+
return {
|
|
317
|
+
bind: id,
|
|
318
|
+
view: () => {
|
|
319
|
+
return ShoppingProductSetting.getOnboardStatus(dd.content);
|
|
320
|
+
},
|
|
321
|
+
divCreate: {
|
|
322
|
+
style: 'min-width: 60px;',
|
|
323
|
+
option: [
|
|
324
|
+
{
|
|
325
|
+
key: 'onclick',
|
|
326
|
+
value: gvc.event((e, event) => {
|
|
327
|
+
event.stopPropagation();
|
|
328
|
+
}),
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
}),
|
|
334
|
+
},
|
|
335
|
+
].map(dd => {
|
|
336
|
+
dd.value = html ` <div style="line-height:40px;">${dd.value}</div>`;
|
|
337
|
+
return dd;
|
|
393
338
|
});
|
|
394
|
-
setInterval(() => {
|
|
395
|
-
n === selCount && setTimeout(() => resolve(), 200);
|
|
396
|
-
}, 500);
|
|
397
|
-
}).then(() => {
|
|
398
|
-
dialog.dataLoading({ visible: false });
|
|
399
|
-
gvc.notifyDataChange(vm.id);
|
|
400
339
|
});
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
340
|
+
}
|
|
341
|
+
vm.dataList = data.response.data;
|
|
342
|
+
vmi.pageSize = Math.ceil(data.response.total / limit);
|
|
343
|
+
vmi.originalData = vm.dataList;
|
|
344
|
+
vmi.tableData = getDatalist();
|
|
345
|
+
vmi.loading = false;
|
|
346
|
+
if (ShoppingProductSetting.select_page_index !== vmi.page - 1 &&
|
|
347
|
+
ShoppingProductSetting.select_page_index <= vmi.pageSize) {
|
|
348
|
+
vmi.page = ShoppingProductSetting.select_page_index + 1;
|
|
349
|
+
loop();
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
ShoppingProductSetting.select_page_index = vmi.page - 1;
|
|
353
|
+
vmi.callback();
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
loop();
|
|
358
|
+
},
|
|
359
|
+
rowClick: (data, index) => {
|
|
360
|
+
vm.replaceData = vm.dataList[index].content;
|
|
361
|
+
ShoppingProductSetting.select_language = window.parent.store_info.language_setting.def;
|
|
362
|
+
vm.type = 'replace';
|
|
363
|
+
},
|
|
364
|
+
tabClick: vmi => {
|
|
365
|
+
ShoppingProductSetting.select_page_index = vmi.page - 1;
|
|
366
|
+
},
|
|
367
|
+
filter: [
|
|
368
|
+
{
|
|
369
|
+
name: '上架',
|
|
370
|
+
event: checkedData => {
|
|
371
|
+
const selCount = checkedData.length;
|
|
372
|
+
dialog.dataLoading({ visible: true });
|
|
373
|
+
new Promise(resolve => {
|
|
374
|
+
let n = 0;
|
|
375
|
+
checkedData.map((dd) => {
|
|
376
|
+
dd.content.active_schedule = this.getActiveDatetime();
|
|
377
|
+
dd.content.status = 'active';
|
|
378
|
+
function run() {
|
|
379
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
380
|
+
return ApiPost.put({
|
|
381
|
+
postData: dd.content,
|
|
382
|
+
token: window.parent.config.token,
|
|
383
|
+
type: 'manager',
|
|
384
|
+
}).then(res => {
|
|
385
|
+
res.result ? n++ : run();
|
|
423
386
|
});
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
setInterval(() => {
|
|
428
|
-
n === selCount && setTimeout(() => resolve(), 200);
|
|
429
|
-
}, 500);
|
|
430
|
-
}).then(() => {
|
|
431
|
-
dialog.dataLoading({ visible: false });
|
|
432
|
-
gvc.notifyDataChange(vm.id);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
run();
|
|
433
390
|
});
|
|
434
|
-
|
|
435
|
-
|
|
391
|
+
setInterval(() => {
|
|
392
|
+
n === selCount && setTimeout(() => resolve(), 200);
|
|
393
|
+
}, 500);
|
|
394
|
+
}).then(() => {
|
|
395
|
+
dialog.dataLoading({ visible: false });
|
|
396
|
+
gvc.notifyDataChange(vm.id);
|
|
397
|
+
});
|
|
436
398
|
},
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
399
|
+
option: true,
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: '下架',
|
|
403
|
+
event: checkedData => {
|
|
404
|
+
const selCount = checkedData.length;
|
|
405
|
+
dialog.dataLoading({ visible: true });
|
|
406
|
+
new Promise(resolve => {
|
|
407
|
+
let n = 0;
|
|
408
|
+
checkedData.map((dd) => {
|
|
409
|
+
dd.content.active_schedule = this.getInactiveDatetime();
|
|
410
|
+
dd.content.status = 'active';
|
|
411
|
+
function run() {
|
|
412
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
413
|
+
return ApiPost.put({
|
|
414
|
+
postData: dd.content,
|
|
415
|
+
token: window.parent.config.token,
|
|
416
|
+
type: 'manager',
|
|
451
417
|
}).then(res => {
|
|
452
|
-
|
|
453
|
-
if (res.result) {
|
|
454
|
-
vm.dataList = undefined;
|
|
455
|
-
gvc.notifyDataChange(vm.id);
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
dialog.errorMessage({
|
|
459
|
-
text: '刪除失敗',
|
|
460
|
-
});
|
|
461
|
-
}
|
|
418
|
+
res.result ? n++ : run();
|
|
462
419
|
});
|
|
463
|
-
}
|
|
464
|
-
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
run();
|
|
465
423
|
});
|
|
466
|
-
|
|
424
|
+
setInterval(() => {
|
|
425
|
+
n === selCount && setTimeout(() => resolve(), 200);
|
|
426
|
+
}, 500);
|
|
427
|
+
}).then(() => {
|
|
428
|
+
dialog.dataLoading({ visible: false });
|
|
429
|
+
gvc.notifyDataChange(vm.id);
|
|
430
|
+
});
|
|
467
431
|
},
|
|
468
|
-
|
|
469
|
-
filterCallback: (dataArray) => {
|
|
470
|
-
vm.checkedData = dataArray;
|
|
432
|
+
option: true,
|
|
471
433
|
},
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
434
|
+
{
|
|
435
|
+
name: '刪除',
|
|
436
|
+
event: checkedData => {
|
|
437
|
+
dialog.checkYesOrNot({
|
|
438
|
+
text: '是否確認刪除所選項目?',
|
|
439
|
+
callback: response => {
|
|
440
|
+
if (response) {
|
|
441
|
+
dialog.dataLoading({ visible: true });
|
|
442
|
+
ApiShop.delete({
|
|
443
|
+
id: checkedData
|
|
444
|
+
.map((dd) => {
|
|
445
|
+
return dd.id;
|
|
446
|
+
})
|
|
447
|
+
.join(`,`),
|
|
448
|
+
}).then(res => {
|
|
449
|
+
dialog.dataLoading({ visible: false });
|
|
450
|
+
if (res.result) {
|
|
451
|
+
vm.dataList = undefined;
|
|
452
|
+
gvc.notifyDataChange(vm.id);
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
dialog.errorMessage({
|
|
456
|
+
text: '刪除失敗',
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
});
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
],
|
|
466
|
+
filterCallback: (dataArray) => {
|
|
467
|
+
vm.checkedData = dataArray;
|
|
468
|
+
},
|
|
469
|
+
});
|
|
470
|
+
},
|
|
471
|
+
}),
|
|
472
|
+
].join('')))}
|
|
473
|
+
${BgWidget.minHeightContainer(240)}
|
|
474
|
+
`);
|
|
487
475
|
},
|
|
488
476
|
});
|
|
489
477
|
case 'replace':
|