ts-glitter 21.4.4 → 21.4.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 +18 -18
- package/lowcode/Entry.ts +18 -19
- package/lowcode/backend-manager/bg-product.js +8 -6
- package/lowcode/backend-manager/bg-product.ts +17 -15
- package/lowcode/backend-manager/bg-recommend.js +16 -5
- package/lowcode/backend-manager/bg-recommend.ts +15 -5
- package/lowcode/backend-manager/bg-widget.js +160 -160
- package/lowcode/backend-manager/bg-widget.ts +169 -166
- package/lowcode/cms-plugin/POS-setting.js +75 -23
- package/lowcode/cms-plugin/POS-setting.ts +87 -30
- package/lowcode/cms-plugin/menus-setting.js +165 -37
- package/lowcode/cms-plugin/menus-setting.ts +144 -21
- package/lowcode/cms-plugin/module/order-excel.js +8 -8
- package/lowcode/cms-plugin/module/order-excel.ts +10 -10
- package/lowcode/cms-plugin/module/stock-excel.js +184 -0
- package/lowcode/cms-plugin/module/stock-excel.ts +205 -0
- package/lowcode/cms-plugin/module/vendor-excel.js +375 -0
- package/lowcode/cms-plugin/module/vendor-excel.ts +450 -0
- package/lowcode/cms-plugin/order/order-module.js +6 -4
- package/lowcode/cms-plugin/order/order-module.ts +16 -14
- package/lowcode/cms-plugin/pos-pages/models.ts +6 -2
- package/lowcode/cms-plugin/pos-pages/products-page.js +589 -469
- package/lowcode/cms-plugin/pos-pages/products-page.ts +657 -491
- package/lowcode/cms-plugin/shopping-product-setting.js +7 -10
- package/lowcode/cms-plugin/shopping-product-setting.ts +12 -10
- package/lowcode/cms-plugin/shopping-setting-basic.js +2 -5
- package/lowcode/cms-plugin/shopping-setting-basic.ts +2 -5
- package/lowcode/cms-plugin/stock-history.js +39 -26
- package/lowcode/cms-plugin/stock-history.ts +58 -49
- package/lowcode/cms-plugin/stock-vendors.js +18 -13
- package/lowcode/cms-plugin/stock-vendors.ts +31 -16
- package/lowcode/glitterBundle/html-component/global-widget.js +162 -136
- package/lowcode/glitterBundle/html-component/global-widget.ts +430 -382
- package/lowcode/public-components/blogs/blogs-01.js +22 -9
- package/lowcode/public-components/blogs/blogs-01.ts +28 -14
- package/package.json +1 -1
- package/src/api-public/services/schedule.js +6 -1
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +4 -1
|
@@ -1,88 +1,277 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { ApiShop } from '../../glitter-base/route/shopping.js';
|
|
11
2
|
import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
12
|
-
import { POSSetting } from '../POS-setting.js';
|
|
13
3
|
import { Swal } from '../../modules/sweetAlert.js';
|
|
4
|
+
import { POSSetting } from '../POS-setting.js';
|
|
14
5
|
import { PaymentPage } from './payment-page.js';
|
|
15
6
|
import { PayConfig } from './pay-config.js';
|
|
7
|
+
import { BgProduct } from '../../backend-manager/bg-product.js';
|
|
16
8
|
const html = String.raw;
|
|
17
9
|
export class ProductsPage {
|
|
18
10
|
static main(obj) {
|
|
19
|
-
const swal = new Swal(obj.gvc);
|
|
20
11
|
const gvc = obj.gvc;
|
|
12
|
+
const swal = new Swal(gvc);
|
|
21
13
|
const vm = obj.vm;
|
|
22
14
|
const orderDetail = obj.orderDetail;
|
|
23
15
|
const dialog = new ShareDialog(gvc.glitter);
|
|
16
|
+
const isPhone = document.body.offsetWidth < 800;
|
|
24
17
|
orderDetail.total = orderDetail.total || 0;
|
|
25
18
|
const pVM = {
|
|
26
19
|
pageSize: 0,
|
|
27
20
|
pageIndex: 1,
|
|
28
21
|
limit: 50,
|
|
22
|
+
loadOption: 'collection',
|
|
23
|
+
selectOption: 'collection',
|
|
29
24
|
};
|
|
30
25
|
function loadData() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
26
|
+
const resetOption = pVM.selectOption !== pVM.loadOption;
|
|
27
|
+
const category = (resetOption ? null : vm.categories.find(c => c.select)) || { key: 'all' };
|
|
28
|
+
dialog.dataLoading({ visible: true });
|
|
35
29
|
ApiShop.getProduct({
|
|
36
30
|
page: pVM.pageIndex - 1,
|
|
37
|
-
collection: category.key == 'all' ? '' : category.key,
|
|
38
31
|
limit: pVM.limit,
|
|
39
32
|
search: vm.query,
|
|
33
|
+
collection: pVM.selectOption === 'collection' && category.key !== 'all' ? category.key : '',
|
|
34
|
+
general_tag: pVM.selectOption === 'general_tag' && category.key !== 'all' ? category.key : '',
|
|
35
|
+
manager_tag: pVM.selectOption === 'manager_tag' && category.key !== 'all' ? category.key : '',
|
|
40
36
|
status: 'inRange',
|
|
41
37
|
channel: POSSetting.config.where_store.includes('store_') ? 'pos' : 'exhibition',
|
|
42
38
|
whereStore: POSSetting.config.where_store,
|
|
43
39
|
orderBy: 'created_time_desc',
|
|
44
40
|
}).then(res => {
|
|
45
|
-
|
|
46
|
-
dialog.dataLoading({ visible: false });
|
|
47
|
-
}
|
|
41
|
+
dialog.dataLoading({ visible: false });
|
|
48
42
|
vm.productSearch = res.response.data;
|
|
43
|
+
pVM.loadOption = pVM.selectOption;
|
|
49
44
|
pVM.pageSize = Math.ceil(res.response.total / parseInt(pVM.limit, 10));
|
|
50
|
-
gvc.notifyDataChange(
|
|
45
|
+
gvc.notifyDataChange('productShow');
|
|
51
46
|
});
|
|
52
47
|
}
|
|
53
48
|
loadData();
|
|
54
49
|
gvc.glitter.share.reloadProduct = loadData;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
gvc.addStyle(`
|
|
51
|
+
.pos-select {
|
|
52
|
+
font-size: 18px;
|
|
53
|
+
width: ${isPhone ? '100%' : '131px'};
|
|
54
|
+
height: 51px;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
display: flex;
|
|
57
|
+
padding: 12px;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
border-radius: 10px;
|
|
61
|
+
box-shadow: 0px 0px 7px 0px rgba(0, 0, 0, 0.1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.pos-category {
|
|
65
|
+
font-size: 18px;
|
|
66
|
+
width: 131px;
|
|
67
|
+
height: 51px;
|
|
68
|
+
margin-right: 16px;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
display: flex;
|
|
71
|
+
padding: 12px 24px;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
align-items: center;
|
|
74
|
+
border-radius: 10px;
|
|
75
|
+
box-shadow: 0px 0px 7px 0px rgba(0, 0, 0, 0.1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.pos-product-card {
|
|
79
|
+
flex-basis: 188px;
|
|
80
|
+
flex-grow: 1;
|
|
81
|
+
border-radius: 10px;
|
|
82
|
+
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.08);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.pos-bgr-image {
|
|
86
|
+
border-radius: 10px 10px 0 0;
|
|
87
|
+
background: 50% / cover no-repeat;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.pos-product-title {
|
|
91
|
+
font-size: 18px;
|
|
92
|
+
width: 100%;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
display: -webkit-box;
|
|
95
|
+
-webkit-line-clamp: 2;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
word-break: break-word;
|
|
98
|
+
-webkit-box-orient: vertical;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.pos-product-container {
|
|
102
|
+
overflow: scroll;
|
|
103
|
+
max-height: 100%;
|
|
104
|
+
padding-bottom: 100px !important;
|
|
105
|
+
${isPhone
|
|
106
|
+
? `
|
|
107
|
+
padding-left: 12px;
|
|
108
|
+
padding-right: 12px;
|
|
109
|
+
justify-content: space-between;
|
|
110
|
+
`
|
|
111
|
+
: `
|
|
112
|
+
gap: 26px;
|
|
113
|
+
margin-left: 32px;
|
|
114
|
+
margin-right: 32px;
|
|
115
|
+
`}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.pos-drawer {
|
|
119
|
+
height: 100%;
|
|
120
|
+
width: 352px;
|
|
121
|
+
max-width: 100%;
|
|
122
|
+
overflow: auto;
|
|
123
|
+
background: #fff;
|
|
124
|
+
box-shadow: 1px 0 10px 0 rgba(0, 0, 0, 0.1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.pos-check-container {
|
|
128
|
+
height: 50px;
|
|
129
|
+
margin-bottom: 24px;
|
|
130
|
+
margin-top: ${gvc.glitter.share.top_inset}px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.pos-check-loading {
|
|
134
|
+
background: #ffb400;
|
|
135
|
+
color: #393939;
|
|
136
|
+
gap: 10px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.pos-cart-list {
|
|
140
|
+
color: #393939;
|
|
141
|
+
font-size: 32px;
|
|
142
|
+
font-weight: 700;
|
|
143
|
+
letter-spacing: 3px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.pos-cart-image {
|
|
147
|
+
height: 67px;
|
|
148
|
+
width: 66px;
|
|
149
|
+
margin-right: 12px;
|
|
150
|
+
min-height: 67px;
|
|
151
|
+
min-width: 66px;
|
|
152
|
+
background: 50% / cover;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.pos-spec {
|
|
156
|
+
color: #949494;
|
|
157
|
+
font-size: 16px;
|
|
158
|
+
font-style: normal;
|
|
159
|
+
font-weight: 500;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.pos-count-button {
|
|
163
|
+
display: flex;
|
|
164
|
+
width: 30px;
|
|
165
|
+
height: 30px;
|
|
166
|
+
padding: 8px;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
align-items: center;
|
|
169
|
+
border-radius: 10px;
|
|
170
|
+
background: #393939;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.pos-count-input {
|
|
174
|
+
width: 50px;
|
|
175
|
+
height: 25px;
|
|
176
|
+
color: #393939;
|
|
177
|
+
font-size: 18px;
|
|
178
|
+
font-weight: 500;
|
|
179
|
+
text-align: center;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.pos-subtotal {
|
|
183
|
+
color: #393939;
|
|
184
|
+
font-size: 18px;
|
|
185
|
+
font-style: normal;
|
|
186
|
+
font-weight: 500;
|
|
187
|
+
letter-spacing: 0.72px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.pos-price-container {
|
|
191
|
+
margin-top: 24px;
|
|
192
|
+
border-radius: 10px;
|
|
193
|
+
border: 1px solid #ddd;
|
|
194
|
+
background: #fff;
|
|
195
|
+
display: flex;
|
|
196
|
+
padding: 24px;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
justify-content: center;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.pos-goto-checkout {
|
|
202
|
+
margin-top: 32px;
|
|
203
|
+
display: flex;
|
|
204
|
+
padding: 12px 24px;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
align-items: center;
|
|
207
|
+
border-radius: 10px;
|
|
208
|
+
background: #393939;
|
|
209
|
+
font-size: 20px;
|
|
210
|
+
font-style: normal;
|
|
211
|
+
font-weight: 500;
|
|
212
|
+
color: #fff;
|
|
213
|
+
}
|
|
214
|
+
`);
|
|
215
|
+
const selectOptionView = gvc.bindView({
|
|
216
|
+
bind: 'selectOption',
|
|
217
|
+
view: () => {
|
|
218
|
+
const options = [
|
|
219
|
+
{ key: 'collection', title: '商品類別' },
|
|
220
|
+
{ key: 'general_tag', title: '商品標籤' },
|
|
221
|
+
{ key: 'manager_tag', title: '管理員標籤' },
|
|
222
|
+
];
|
|
223
|
+
return html ` <select
|
|
224
|
+
class="pos-select"
|
|
225
|
+
onchange="${gvc.event(e => {
|
|
226
|
+
pVM.selectOption = e.value;
|
|
227
|
+
vm.categorySearch = true;
|
|
228
|
+
loadData();
|
|
229
|
+
gvc.notifyDataChange(['category', 'productShow']);
|
|
230
|
+
})}"
|
|
231
|
+
>
|
|
232
|
+
${options.map(opt => html `<option value="${opt.key}">${opt.title}</option>`)}
|
|
233
|
+
</select>`;
|
|
234
|
+
},
|
|
235
|
+
divCreate: {
|
|
236
|
+
class: 'position-sticky',
|
|
237
|
+
style: 'left: 0;',
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
const categoryView = gvc.bindView({
|
|
241
|
+
bind: 'category',
|
|
64
242
|
view: () => {
|
|
65
243
|
try {
|
|
66
244
|
if (vm.categorySearch) {
|
|
67
|
-
|
|
245
|
+
vm.categories = [{ key: 'all', value: '全部商品', select: true }];
|
|
246
|
+
function render() {
|
|
68
247
|
vm.categorySearch = false;
|
|
69
|
-
r.response.value.forEach((data) => {
|
|
70
|
-
vm.categories.push({
|
|
71
|
-
key: data.code,
|
|
72
|
-
value: data.title,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
248
|
gvc.notifyDataChange('category');
|
|
76
|
-
}
|
|
249
|
+
}
|
|
250
|
+
const selectOptionRecord = {
|
|
251
|
+
collection: () => ApiShop.getCollection().then(r => {
|
|
252
|
+
r.response.value.map((data) => {
|
|
253
|
+
vm.categories.push({ key: data.code, value: data.title });
|
|
254
|
+
});
|
|
255
|
+
render();
|
|
256
|
+
}),
|
|
257
|
+
general_tag: () => BgProduct.getProductGeneralTag().then(tags => {
|
|
258
|
+
tags.map((data) => vm.categories.push({ key: data.key, value: data.name }));
|
|
259
|
+
render();
|
|
260
|
+
}),
|
|
261
|
+
manager_tag: () => BgProduct.getProductManagerTag().then(tags => {
|
|
262
|
+
tags.map((data) => vm.categories.push({ key: data.key, value: data.name }));
|
|
263
|
+
render();
|
|
264
|
+
}),
|
|
265
|
+
};
|
|
266
|
+
const selectEvent = selectOptionRecord[pVM.selectOption];
|
|
267
|
+
selectEvent ? selectEvent() : selectOptionRecord.collection();
|
|
77
268
|
}
|
|
78
|
-
|
|
79
|
-
.map((data) => {
|
|
269
|
+
const categoryButton = vm.categories.map(data => {
|
|
80
270
|
return html `
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
onclick="${gvc.event(() => {
|
|
271
|
+
<div
|
|
272
|
+
class="pos-category"
|
|
273
|
+
style="${(data === null || data === void 0 ? void 0 : data.select) ? 'background: #393939; color: #FFF;' : 'background: #FFF; color: #393939;'}"
|
|
274
|
+
onclick="${gvc.event(() => {
|
|
86
275
|
vm.categories.forEach(category => {
|
|
87
276
|
category.select = false;
|
|
88
277
|
});
|
|
@@ -91,12 +280,12 @@ export class ProductsPage {
|
|
|
91
280
|
loadData();
|
|
92
281
|
gvc.notifyDataChange(['category', 'productShow']);
|
|
93
282
|
})}"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
})
|
|
99
|
-
|
|
283
|
+
>
|
|
284
|
+
${data.value}
|
|
285
|
+
</div>
|
|
286
|
+
`;
|
|
287
|
+
});
|
|
288
|
+
return categoryButton.join('');
|
|
100
289
|
}
|
|
101
290
|
catch (e) {
|
|
102
291
|
console.error(e);
|
|
@@ -104,397 +293,314 @@ export class ProductsPage {
|
|
|
104
293
|
}
|
|
105
294
|
},
|
|
106
295
|
divCreate: {
|
|
107
|
-
class:
|
|
108
|
-
style:
|
|
296
|
+
class: 'd-flex px-0 px-md-3 w-100 position-relative',
|
|
297
|
+
style: 'overflow: scroll;',
|
|
109
298
|
},
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
rowItem =
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
299
|
+
});
|
|
300
|
+
const productShowView = gvc.bindView({
|
|
301
|
+
bind: 'productShow',
|
|
302
|
+
view: () => {
|
|
303
|
+
const parent = document.querySelector(`.left-panel`);
|
|
304
|
+
let rowItem = Math.floor((parent.offsetWidth - 72) / 188);
|
|
305
|
+
rowItem = rowItem * 188 + 26 * (rowItem - 1) > parent.offsetWidth - 72 ? rowItem - 1 : rowItem;
|
|
306
|
+
if (isPhone) {
|
|
307
|
+
rowItem = 2;
|
|
308
|
+
}
|
|
309
|
+
let maxwidth = (parent.offsetWidth - 72 - (rowItem - 1) * 26) / rowItem;
|
|
310
|
+
if (isPhone) {
|
|
311
|
+
maxwidth += 30;
|
|
312
|
+
}
|
|
313
|
+
if (vm.productSearch.length > 0) {
|
|
314
|
+
return (vm.productSearch
|
|
315
|
+
.map(data => {
|
|
316
|
+
var _a;
|
|
317
|
+
let selectVariant = data.content.variants[0];
|
|
318
|
+
data.content.specs.forEach((spec) => {
|
|
319
|
+
spec.option[0].select = true;
|
|
320
|
+
});
|
|
321
|
+
const paddingBottomPercent = (() => {
|
|
322
|
+
if (PayConfig.pos_config.prdouct_card_layout) {
|
|
323
|
+
const wi = PayConfig.pos_config.prdouct_card_layout.split(':').map((dd) => parseInt(dd, 10));
|
|
324
|
+
return parseInt(`${(wi[0] / wi[1]) * 100}`, 10);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
return 56;
|
|
328
|
+
}
|
|
329
|
+
})();
|
|
330
|
+
const image = data.content.preview_image[0] || this.noImage;
|
|
331
|
+
return html `
|
|
332
|
+
<div
|
|
333
|
+
class="d-flex flex-column mb-4 mb-sm-0 pos-product-card"
|
|
334
|
+
style="max-width: ${maxwidth}px;"
|
|
335
|
+
onclick="${gvc.event(() => {
|
|
336
|
+
POSSetting.productDialog({
|
|
337
|
+
gvc,
|
|
338
|
+
selectVariant,
|
|
339
|
+
defaultData: data,
|
|
340
|
+
orderDetail,
|
|
341
|
+
callback: data => {
|
|
342
|
+
selectVariant = data;
|
|
343
|
+
},
|
|
133
344
|
});
|
|
134
|
-
|
|
345
|
+
})}"
|
|
346
|
+
>
|
|
347
|
+
<div
|
|
348
|
+
class="w-100 pos-bgr-image"
|
|
349
|
+
style="padding-bottom: ${paddingBottomPercent}%; background-image: url('${image}');"
|
|
350
|
+
></div>
|
|
351
|
+
<div class="d-flex flex-column" style="padding: 12px 10px; gap: 4px;">
|
|
352
|
+
<div class="pos-product-title">${data.content.title || 'No Name'}</div>
|
|
353
|
+
<div class="w-100 align-items-center justify-content-end text-end fw-500 fs-5">
|
|
354
|
+
$ ${parseInt(`${(_a = data.content.min_price) !== null && _a !== void 0 ? _a : 0}`, 10).toLocaleString()}
|
|
355
|
+
</div>
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
`;
|
|
359
|
+
})
|
|
360
|
+
.join('') +
|
|
361
|
+
html `
|
|
362
|
+
<div class="w-100">
|
|
363
|
+
${this.pageSplitV2(gvc, pVM.pageSize, pVM.pageIndex, p => {
|
|
364
|
+
pVM.pageIndex = p;
|
|
365
|
+
document.querySelector('html').scrollTo(0, 0);
|
|
366
|
+
loadData();
|
|
367
|
+
})}
|
|
368
|
+
</div>
|
|
369
|
+
`);
|
|
370
|
+
}
|
|
371
|
+
return POSSetting.emptyView('查無相關商品');
|
|
372
|
+
},
|
|
373
|
+
divCreate: {
|
|
374
|
+
class: `d-flex flex-wrap w-100 product-show pos-product-container ${isPhone ? '' : 'p-2'}`,
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
const checkId = gvc.glitter.getUUID();
|
|
378
|
+
let checking = true;
|
|
379
|
+
let interVal = undefined;
|
|
380
|
+
function checkStock() {
|
|
381
|
+
checking = true;
|
|
382
|
+
PaymentPage.storeHistory(orderDetail);
|
|
383
|
+
checking = false;
|
|
384
|
+
gvc.notifyDataChange(checkId);
|
|
385
|
+
}
|
|
386
|
+
gvc.glitter.share.checkStock = checkStock;
|
|
387
|
+
checkStock();
|
|
388
|
+
function checkStockInterVal() {
|
|
389
|
+
clearInterval(interVal);
|
|
390
|
+
interVal = setTimeout(() => checkStock(), 300);
|
|
391
|
+
}
|
|
392
|
+
const checkView = gvc.bindView({
|
|
393
|
+
bind: checkId,
|
|
394
|
+
view: () => {
|
|
395
|
+
if (!checking) {
|
|
396
|
+
return html ` <div class="pos-cart-list">購物清單</div>`;
|
|
397
|
+
}
|
|
398
|
+
return html ` <div class="w-100">
|
|
399
|
+
<div class="d-flex align-items-center justify-content-center mb-4 p-2 fw-500 rounded-3 pos-check-loading">
|
|
400
|
+
<div class="spinner-border" style="width: 20px; height: 20px;"></div>
|
|
401
|
+
庫存檢查中...
|
|
402
|
+
</div>
|
|
403
|
+
</div>`;
|
|
404
|
+
},
|
|
405
|
+
divCreate: {
|
|
406
|
+
class: 'd-flex flex-column pos-check-container',
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
const orderView = gvc.bindView({
|
|
410
|
+
bind: 'order',
|
|
411
|
+
dataList: [{ obj: vm, key: 'order' }],
|
|
412
|
+
view: () => {
|
|
413
|
+
var _a;
|
|
414
|
+
orderDetail.subtotal = 0;
|
|
415
|
+
orderDetail.lineItems.forEach(item => {
|
|
416
|
+
orderDetail.subtotal += item.sale_price * item.count;
|
|
417
|
+
});
|
|
418
|
+
return html `
|
|
419
|
+
<div class="d-flex flex-column" style="gap: 18px;">
|
|
420
|
+
${orderDetail.lineItems
|
|
421
|
+
.map((item, index) => {
|
|
422
|
+
const image = item.preview_image || this.noImage;
|
|
423
|
+
return html `
|
|
424
|
+
${index > 0 ? html `<div class="w-100" style="background-color: #DDD; height: 1px;"></div>` : ''}
|
|
425
|
+
<div class="d-flex align-items-center" style="min-height: 87px;">
|
|
426
|
+
<div class="rounded-3 pos-cart-image" style="background-image: url('${image}');"></div>
|
|
427
|
+
<div class="d-flex flex-column flex-fill">
|
|
428
|
+
<div>${item.title}</div>
|
|
429
|
+
<div class="d-flex gap-2">
|
|
430
|
+
${item.spec.length > 0
|
|
431
|
+
? item.spec.map(spec => html `<div class="pos-spec">${spec}</div>`).join('')
|
|
432
|
+
: '單一規格'}
|
|
433
|
+
</div>
|
|
434
|
+
<div class="d-flex align-items-center" style="margin-top: 6px;">
|
|
135
435
|
<div
|
|
136
|
-
class="
|
|
137
|
-
style="max-width:${maxwidth}px;flex-basis: 188px;flex-grow: 1;border-radius: 10px;box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.08);"
|
|
436
|
+
class="pos-count-button"
|
|
138
437
|
onclick="${gvc.event(() => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
orderDetail,
|
|
144
|
-
callback: data => {
|
|
145
|
-
selectVariant = data;
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
})}"
|
|
438
|
+
item.count = item.count < 2 ? item.count : item.count - 1;
|
|
439
|
+
checkStockInterVal();
|
|
440
|
+
gvc.notifyDataChange('order');
|
|
441
|
+
})}"
|
|
149
442
|
>
|
|
150
|
-
|
|
151
|
-
class="w-100"
|
|
152
|
-
style="border-radius: 10px 10px 0 0;;padding-bottom: ${(() => {
|
|
153
|
-
if (PayConfig.pos_config.prdouct_card_layout) {
|
|
154
|
-
const wi = PayConfig.pos_config.prdouct_card_layout.split(':').map((dd) => {
|
|
155
|
-
return parseInt(dd, 10);
|
|
156
|
-
});
|
|
157
|
-
return parseInt(`${wi[0] / wi[1] * 100}`, 10);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
return `56`;
|
|
161
|
-
}
|
|
162
|
-
})()}%;background: 50%/cover no-repeat url('${(_b = (_a = data
|
|
163
|
-
.content.preview_image[0]) !== null && _a !== void 0 ? _a : image) !== null && _b !== void 0 ? _b : image}');"
|
|
164
|
-
></div>
|
|
165
|
-
<div class="d-flex flex-column" style="padding: 12px 10px;gap: 4px;">
|
|
166
|
-
<div
|
|
167
|
-
style="font-size: 18px;width: 100%;overflow: hidden;display: -webkit-box;-webkit-line-clamp: 2;text-overflow: ellipsis;word-break: break-word;-webkit-box-orient: vertical;"
|
|
168
|
-
>
|
|
169
|
-
${(_c = data.content.title) !== null && _c !== void 0 ? _c : 'no name'}
|
|
170
|
-
</div>
|
|
171
|
-
<div
|
|
172
|
-
class="w-100 align-items-center justify-content-end"
|
|
173
|
-
style="font-size: 16px;font-weight: 700;text-align: right;"
|
|
174
|
-
>
|
|
175
|
-
NT.${parseInt(`${(_d = data.content.min_price) !== null && _d !== void 0 ? _d : 0}`, 10).toLocaleString()}
|
|
176
|
-
</div>
|
|
177
|
-
</div>
|
|
443
|
+
${this.minusSVG}
|
|
178
444
|
</div>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
else {
|
|
202
|
-
return {
|
|
203
|
-
class: `d-flex flex-wrap w-100 product-show p-2`,
|
|
204
|
-
style: `gap:26px;overflow:scroll;max-height:100%;padding-bottom:100px !important;margin-left:32px;margin-right:32px;`,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
})}
|
|
210
|
-
</div>
|
|
211
|
-
${(() => {
|
|
212
|
-
const checkId = gvc.glitter.getUUID();
|
|
213
|
-
let checking = true;
|
|
214
|
-
let interVal = 0;
|
|
215
|
-
function checkStock() {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
-
checking = true;
|
|
218
|
-
PaymentPage.storeHistory(orderDetail);
|
|
219
|
-
checking = false;
|
|
220
|
-
gvc.notifyDataChange(checkId);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
gvc.glitter.share.checkStock = checkStock;
|
|
224
|
-
checkStock();
|
|
225
|
-
function checkStockInterVal() {
|
|
226
|
-
clearInterval(interVal);
|
|
227
|
-
interVal = setTimeout(() => checkStock(), 300);
|
|
228
|
-
}
|
|
229
|
-
const view = html ` <div
|
|
230
|
-
class=""
|
|
231
|
-
style="height: 100%;width: 352px;max-width:100%;overflow: auto;${document.body.clientWidth > 800
|
|
232
|
-
? `padding: 36px 24px;`
|
|
233
|
-
: `padding: 10px 12px;`};background: #FFF;box-shadow: 1px 0 10px 0 rgba(0, 0, 0, 0.10);"
|
|
234
|
-
>
|
|
235
|
-
${gvc.bindView(() => {
|
|
236
|
-
return {
|
|
237
|
-
bind: checkId,
|
|
238
|
-
view: () => {
|
|
239
|
-
if (checking) {
|
|
240
|
-
return html ` <div class="w-100 ">
|
|
241
|
-
<div
|
|
242
|
-
class="d-flex align-items-center justify-content-center mb-4 p-2 fw-500 rounded-3"
|
|
243
|
-
style="background: #ffb400;color:#393939;gap:10px;"
|
|
244
|
-
>
|
|
245
|
-
<div class="spinner-border" style="width:20px;height: 20px;"></div>
|
|
246
|
-
庫存檢查中...
|
|
445
|
+
<input
|
|
446
|
+
class="border-0 pos-count-input"
|
|
447
|
+
value="${item.count}"
|
|
448
|
+
onchange="${gvc.event(e => {
|
|
449
|
+
const category = orderDetail.lineItems[index].product_category;
|
|
450
|
+
const n = category === 'weighing' ? parseFloat(e.value) : parseInt(e.value);
|
|
451
|
+
item.count = isNaN(n) ? 0 : n;
|
|
452
|
+
checkStockInterVal();
|
|
453
|
+
gvc.notifyDataChange('order');
|
|
454
|
+
})}"
|
|
455
|
+
/>
|
|
456
|
+
<div
|
|
457
|
+
class="pos-count-button"
|
|
458
|
+
onclick="${gvc.event(() => {
|
|
459
|
+
item.count++;
|
|
460
|
+
checkStockInterVal();
|
|
461
|
+
gvc.notifyDataChange('order');
|
|
462
|
+
})}"
|
|
463
|
+
>
|
|
464
|
+
${this.plusSVG}
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
247
467
|
</div>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
468
|
+
<div class="h-100 d-flex flex-column align-items-end justify-content-between">
|
|
469
|
+
<div
|
|
470
|
+
onclick="${gvc.event(() => {
|
|
471
|
+
const rmProd = orderDetail.lineItems[index];
|
|
472
|
+
PaymentPage.rmProductHistory(rmProd.id);
|
|
473
|
+
orderDetail.lineItems.splice(index, 1);
|
|
474
|
+
if (document.querySelector('.js-cart-count')) {
|
|
475
|
+
document.querySelector('.js-cart-count').recreateView();
|
|
254
476
|
}
|
|
477
|
+
gvc.notifyDataChange('order');
|
|
478
|
+
})}"
|
|
479
|
+
>
|
|
480
|
+
${this.xmarkSVG}
|
|
481
|
+
</div>
|
|
482
|
+
<div class="pos-subtotal">$${(item.sale_price * item.count).toLocaleString()}</div>
|
|
483
|
+
</div>
|
|
484
|
+
</div>
|
|
485
|
+
`;
|
|
486
|
+
})
|
|
487
|
+
.join('')}
|
|
488
|
+
</div>
|
|
489
|
+
<div class="w-100 pos-price-container">
|
|
490
|
+
<div class="w-100 d-flex flex-column gap-2">
|
|
491
|
+
${[
|
|
492
|
+
{
|
|
493
|
+
left: '小計總額',
|
|
494
|
+
right: parseInt(((_a = orderDetail.subtotal) !== null && _a !== void 0 ? _a : 0), 10).toLocaleString(),
|
|
255
495
|
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
style: `height:50px; margin-bottom:24px;margin-top:${gvc.glitter.share.top_inset}px;`,
|
|
259
|
-
},
|
|
260
|
-
};
|
|
261
|
-
})}
|
|
262
|
-
${gvc.bindView({
|
|
263
|
-
bind: 'order',
|
|
264
|
-
dataList: [{ obj: vm, key: 'order' }],
|
|
265
|
-
view: () => {
|
|
266
|
-
orderDetail.subtotal = 0;
|
|
267
|
-
orderDetail.lineItems.forEach(item => {
|
|
268
|
-
orderDetail.subtotal += item.sale_price * item.count;
|
|
269
|
-
});
|
|
496
|
+
]
|
|
497
|
+
.map(data => {
|
|
270
498
|
return html `
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
<path
|
|
314
|
-
d="M9.64314 5C9.64314 5.3457 9.32394 5.625 8.92885 5.625H1.07171C0.676618 5.625 0.357422 5.3457 0.357422 5C0.357422 4.6543 0.676618 4.375 1.07171 4.375H8.92885C9.32394 4.375 9.64314 4.6543 9.64314 5Z"
|
|
315
|
-
fill="white"
|
|
316
|
-
/>
|
|
317
|
-
</svg>
|
|
318
|
-
</div>
|
|
319
|
-
<input
|
|
320
|
-
class="border-0"
|
|
321
|
-
style="width: 50px;height: 25px;color: #393939;font-size: 18px;font-weight: 500;text-align: center"
|
|
322
|
-
value="${item.count}"
|
|
323
|
-
onchange="${gvc.event(e => {
|
|
324
|
-
const category = orderDetail.lineItems[index].product_category;
|
|
325
|
-
const n = category === 'weighing' ? parseFloat(e.value) : parseInt(e.value);
|
|
326
|
-
item.count = isNaN(n) ? 0 : n;
|
|
327
|
-
checkStockInterVal();
|
|
328
|
-
gvc.notifyDataChange('order');
|
|
329
|
-
})}"
|
|
330
|
-
/>
|
|
331
|
-
<div
|
|
332
|
-
style="display: flex;width: 30px;height: 30px;padding: 8px;justify-content: center;align-items: center;border-radius: 10px;background: #393939;"
|
|
333
|
-
onclick="${gvc.event(() => {
|
|
334
|
-
item.count++;
|
|
335
|
-
checkStockInterVal();
|
|
336
|
-
gvc.notifyDataChange('order');
|
|
337
|
-
})}"
|
|
338
|
-
>
|
|
339
|
-
<svg
|
|
340
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
341
|
-
width="10"
|
|
342
|
-
height="10"
|
|
343
|
-
viewBox="0 0 10 10"
|
|
344
|
-
fill="none"
|
|
345
|
-
>
|
|
346
|
-
<path
|
|
347
|
-
d="M5.76923 0.769231C5.76923 0.34375 5.42548 0 5 0C4.57452 0 4.23077 0.34375 4.23077 0.769231V4.23077H0.769231C0.34375 4.23077 0 4.57452 0 5C0 5.42548 0.34375 5.76923 0.769231 5.76923H4.23077V9.23077C4.23077 9.65625 4.57452 10 5 10C5.42548 10 5.76923 9.65625 5.76923 9.23077V5.76923H9.23077C9.65625 5.76923 10 5.42548 10 5C10 4.57452 9.65625 4.23077 9.23077 4.23077H5.76923V0.769231Z"
|
|
348
|
-
fill="white"
|
|
349
|
-
/>
|
|
350
|
-
</svg>
|
|
351
|
-
</div>
|
|
352
|
-
</div>
|
|
353
|
-
</div>
|
|
354
|
-
<div class="h-100 d-flex flex-column align-items-end justify-content-between">
|
|
355
|
-
<div
|
|
356
|
-
class=""
|
|
357
|
-
onclick="${gvc.event(() => {
|
|
358
|
-
const rmProd = orderDetail.lineItems[index];
|
|
359
|
-
PaymentPage.rmProductHistory(rmProd.id);
|
|
360
|
-
orderDetail.lineItems.splice(index, 1);
|
|
361
|
-
if (document.querySelector('.js-cart-count')) {
|
|
362
|
-
document.querySelector('.js-cart-count').recreateView();
|
|
499
|
+
<div class="w-100 d-flex">
|
|
500
|
+
<div style="font-size: 18px; font-style: normal; font-weight: 700;">${data.left}</div>
|
|
501
|
+
<div class="ms-auto" style="font-size: 16px; font-weight: 700;">$ ${data.right}</div>
|
|
502
|
+
</div>
|
|
503
|
+
`;
|
|
504
|
+
})
|
|
505
|
+
.join('')}
|
|
506
|
+
</div>
|
|
507
|
+
</div>
|
|
508
|
+
`;
|
|
509
|
+
},
|
|
510
|
+
onCreate: () => {
|
|
511
|
+
obj.gvc.glitter.share.scan_back = (text) => {
|
|
512
|
+
dialog.dataLoading({ visible: true });
|
|
513
|
+
ApiShop.getProduct({
|
|
514
|
+
page: 0,
|
|
515
|
+
limit: 50000,
|
|
516
|
+
accurate_search_text: true,
|
|
517
|
+
search: text,
|
|
518
|
+
status: 'inRange',
|
|
519
|
+
channel: POSSetting.config.where_store.includes('store_') ? 'pos' : 'exhibition',
|
|
520
|
+
whereStore: POSSetting.config.where_store,
|
|
521
|
+
orderBy: 'created_time_desc',
|
|
522
|
+
}).then(res => {
|
|
523
|
+
dialog.dataLoading({ visible: false });
|
|
524
|
+
if (res.response.data[0]) {
|
|
525
|
+
const data = res.response.data[0];
|
|
526
|
+
const selectVariant = data.content.variants.find((d1) => d1.barcode === text);
|
|
527
|
+
if (!orderDetail.lineItems.find(dd => {
|
|
528
|
+
return dd.id + dd.spec.join('-') === data.id + selectVariant.spec.join('-');
|
|
529
|
+
})) {
|
|
530
|
+
orderDetail.lineItems.push({
|
|
531
|
+
id: data.id,
|
|
532
|
+
title: data.content.title,
|
|
533
|
+
preview_image: selectVariant.preview_image.length > 1
|
|
534
|
+
? selectVariant.preview_image
|
|
535
|
+
: data.content.preview_image[0],
|
|
536
|
+
spec: selectVariant.spec,
|
|
537
|
+
count: 0,
|
|
538
|
+
sale_price: selectVariant.sale_price,
|
|
539
|
+
sku: selectVariant.sku,
|
|
540
|
+
});
|
|
363
541
|
}
|
|
542
|
+
orderDetail.lineItems.find(dd => {
|
|
543
|
+
return dd.id + dd.spec.join('-') === data.id + selectVariant.spec.join('-');
|
|
544
|
+
}).count++;
|
|
364
545
|
gvc.notifyDataChange('order');
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
<div style="font-size: 18px;font-style: normal;font-weight: 700;">${data.left}</div>
|
|
408
|
-
<div class="ms-auto" style="font-size: 16px;font-weight: 700;">$ ${data.right}</div>
|
|
409
|
-
</div>
|
|
410
|
-
`;
|
|
411
|
-
})
|
|
412
|
-
.join(``);
|
|
413
|
-
})()}
|
|
414
|
-
</div>
|
|
415
|
-
</div>
|
|
416
|
-
`;
|
|
417
|
-
},
|
|
418
|
-
onCreate: () => {
|
|
419
|
-
const dialog = new ShareDialog(gvc.glitter);
|
|
420
|
-
obj.gvc.glitter.share.scan_back = (text) => {
|
|
421
|
-
dialog.dataLoading({ visible: true });
|
|
422
|
-
ApiShop.getProduct({
|
|
423
|
-
page: 0,
|
|
424
|
-
limit: 50000,
|
|
425
|
-
accurate_search_text: true,
|
|
426
|
-
search: text,
|
|
427
|
-
status: 'inRange',
|
|
428
|
-
channel: POSSetting.config.where_store.includes('store_') ? 'pos' : 'exhibition',
|
|
429
|
-
whereStore: POSSetting.config.where_store,
|
|
430
|
-
orderBy: 'created_time_desc',
|
|
431
|
-
}).then(res => {
|
|
432
|
-
dialog.dataLoading({ visible: false });
|
|
433
|
-
if (res.response.data[0]) {
|
|
434
|
-
const data = res.response.data[0];
|
|
435
|
-
const selectVariant = res.response.data[0].content.variants.find((d1) => d1.barcode === text);
|
|
436
|
-
if (!orderDetail.lineItems.find(dd => {
|
|
437
|
-
return dd.id + dd.spec.join('-') === data.id + selectVariant.spec.join('-');
|
|
438
|
-
})) {
|
|
439
|
-
orderDetail.lineItems.push({
|
|
440
|
-
id: data.id,
|
|
441
|
-
title: data.content.title,
|
|
442
|
-
preview_image: selectVariant.preview_image.length > 1
|
|
443
|
-
? selectVariant.preview_image
|
|
444
|
-
: data.content.preview_image[0],
|
|
445
|
-
spec: selectVariant.spec,
|
|
446
|
-
count: 0,
|
|
447
|
-
sale_price: selectVariant.sale_price,
|
|
448
|
-
sku: selectVariant.sku,
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
orderDetail.lineItems.find(dd => {
|
|
452
|
-
return dd.id + dd.spec.join('-') === data.id + selectVariant.spec.join('-');
|
|
453
|
-
}).count++;
|
|
454
|
-
gvc.notifyDataChange('order');
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
swal.toast({ icon: 'error', title: '無此商品' });
|
|
458
|
-
}
|
|
459
|
-
gvc.notifyDataChange(`order`);
|
|
460
|
-
});
|
|
461
|
-
};
|
|
462
|
-
},
|
|
463
|
-
})}
|
|
464
|
-
|
|
465
|
-
<div
|
|
466
|
-
style="margin-top: 32px;display: flex;padding: 12px 24px;justify-content: center;align-items: center;border-radius: 10px;background: #393939;font-size: 20px;font-style: normal;font-weight: 500;color: #FFF;"
|
|
467
|
-
onclick="${gvc.event(() => {
|
|
468
|
-
vm.type = 'payment';
|
|
469
|
-
gvc.glitter.closeDrawer();
|
|
470
|
-
})}"
|
|
471
|
-
>
|
|
472
|
-
前往結帳
|
|
473
|
-
</div>
|
|
474
|
-
</div>`;
|
|
475
|
-
if (document.body.offsetWidth < 800) {
|
|
476
|
-
gvc.glitter.setDrawer(view, () => { });
|
|
477
|
-
return '';
|
|
478
|
-
}
|
|
479
|
-
else {
|
|
480
|
-
return view;
|
|
481
|
-
}
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
swal.toast({ icon: 'error', title: '無此商品' });
|
|
549
|
+
}
|
|
550
|
+
gvc.notifyDataChange(`order`);
|
|
551
|
+
});
|
|
552
|
+
};
|
|
553
|
+
},
|
|
554
|
+
});
|
|
555
|
+
const gotoCheckoutView = html `<div
|
|
556
|
+
class="pos-goto-checkout"
|
|
557
|
+
onclick="${gvc.event(() => {
|
|
558
|
+
vm.type = 'payment';
|
|
559
|
+
gvc.glitter.closeDrawer();
|
|
560
|
+
})}"
|
|
561
|
+
>
|
|
562
|
+
前往結帳
|
|
563
|
+
</div>`;
|
|
564
|
+
const drawerView = html ` <div
|
|
565
|
+
class="pos-drawer"
|
|
566
|
+
style="${isPhone ? 'padding: 10px 12px;' : 'padding: 36px 24px;'};"
|
|
567
|
+
>
|
|
568
|
+
${checkView} ${orderView} ${gotoCheckoutView}
|
|
569
|
+
</div>`;
|
|
570
|
+
return html `
|
|
571
|
+
<div
|
|
572
|
+
class="left-panel"
|
|
573
|
+
style="overflow: hidden; ${isPhone ? 'width: calc(100%); padding-top: 0' : 'width: calc(100% - 352px);'}"
|
|
574
|
+
>
|
|
575
|
+
<div
|
|
576
|
+
class="d-flex ${isPhone ? 'flex-column gap-2' : ''}"
|
|
577
|
+
style="${isPhone ? 'padding: 16px 8px;' : 'padding: 24px;'}"
|
|
578
|
+
>
|
|
579
|
+
${selectOptionView} ${categoryView}
|
|
580
|
+
</div>
|
|
581
|
+
${productShowView}
|
|
582
|
+
</div>
|
|
583
|
+
${(() => {
|
|
584
|
+
if (!isPhone)
|
|
585
|
+
return drawerView;
|
|
586
|
+
gvc.glitter.setDrawer(drawerView, () => { });
|
|
587
|
+
return '';
|
|
482
588
|
})()}
|
|
483
589
|
`;
|
|
484
590
|
}
|
|
485
591
|
}
|
|
486
592
|
ProductsPage.pageSplitV2 = (gvc, countPage, nowPage, callback) => {
|
|
487
|
-
const generator = (n) => {
|
|
488
|
-
return html `<li class="page-item my-0 mx-0">
|
|
489
|
-
<div class="page-link-v2" onclick="${gvc.event(() => callback(n))}">${n}</div>
|
|
490
|
-
</li>`;
|
|
491
|
-
};
|
|
492
593
|
const glitter = gvc.glitter;
|
|
493
|
-
|
|
594
|
+
const vm = {
|
|
494
595
|
id: glitter.getUUID(),
|
|
495
596
|
loading: false,
|
|
496
597
|
dataList: [],
|
|
497
598
|
};
|
|
599
|
+
const generator = (n) => {
|
|
600
|
+
return html `<li class="page-item m-0">
|
|
601
|
+
<div class="page-link-v2" onclick="${gvc.event(() => callback(n))}">${n}</div>
|
|
602
|
+
</li>`;
|
|
603
|
+
};
|
|
498
604
|
return gvc.bindView({
|
|
499
605
|
bind: vm.id,
|
|
500
606
|
view: () => {
|
|
@@ -503,57 +609,54 @@ ProductsPage.pageSplitV2 = (gvc, countPage, nowPage, callback) => {
|
|
|
503
609
|
<div class="spinner-border"></div>
|
|
504
610
|
</div>`;
|
|
505
611
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
<
|
|
509
|
-
<
|
|
510
|
-
<
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
>
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
<
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
<
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
>
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
`;
|
|
554
|
-
}
|
|
612
|
+
return html `
|
|
613
|
+
<nav class="d-flex my-3 justify-content-center">
|
|
614
|
+
<ul class="pagination pagination-rounded mb-0">
|
|
615
|
+
<li class="page-item me-0">
|
|
616
|
+
<div
|
|
617
|
+
class="page-link-v2 page-link-prev"
|
|
618
|
+
aria-label="Previous"
|
|
619
|
+
style="cursor:pointer"
|
|
620
|
+
onclick="${gvc.event(() => {
|
|
621
|
+
nowPage - 1 > 0 && callback(nowPage - 1);
|
|
622
|
+
})}"
|
|
623
|
+
>
|
|
624
|
+
<i class="fa-solid fa-angle-left angle-style"></i>
|
|
625
|
+
</div>
|
|
626
|
+
</li>
|
|
627
|
+
${glitter.print(() => {
|
|
628
|
+
let result = '';
|
|
629
|
+
for (let i = Math.max(1, nowPage - 4); i < nowPage; i++) {
|
|
630
|
+
result += generator(i);
|
|
631
|
+
}
|
|
632
|
+
return result;
|
|
633
|
+
})}
|
|
634
|
+
<li class="page-item active mx-0" style="border-radius: 100%">
|
|
635
|
+
<div class="page-link-v2 page-link-active">${nowPage}</div>
|
|
636
|
+
</li>
|
|
637
|
+
${glitter.print(() => {
|
|
638
|
+
let result = '';
|
|
639
|
+
for (let i = nowPage + 1; i <= Math.min(nowPage + 4, countPage); i++) {
|
|
640
|
+
result += generator(i);
|
|
641
|
+
}
|
|
642
|
+
return result;
|
|
643
|
+
})}
|
|
644
|
+
<li class="page-item ms-0">
|
|
645
|
+
<div
|
|
646
|
+
class="page-link-v2 page-link-next"
|
|
647
|
+
aria-label="Next"
|
|
648
|
+
style="cursor:pointer"
|
|
649
|
+
onclick="${gvc.event(() => {
|
|
650
|
+
nowPage + 1 <= countPage && callback(nowPage + 1);
|
|
651
|
+
})}"
|
|
652
|
+
>
|
|
653
|
+
<i class="fa-solid fa-angle-right angle-style"></i>
|
|
654
|
+
</div>
|
|
655
|
+
</li>
|
|
656
|
+
</ul>
|
|
657
|
+
</nav>
|
|
658
|
+
`;
|
|
555
659
|
},
|
|
556
|
-
divCreate: {},
|
|
557
660
|
onCreate: () => {
|
|
558
661
|
if (vm.loading) {
|
|
559
662
|
vm.loading = false;
|
|
@@ -562,3 +665,20 @@ ProductsPage.pageSplitV2 = (gvc, countPage, nowPage, callback) => {
|
|
|
562
665
|
},
|
|
563
666
|
});
|
|
564
667
|
};
|
|
668
|
+
ProductsPage.noImage = 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg';
|
|
669
|
+
ProductsPage.xmarkSVG = html `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
670
|
+
<path d="M1 1L13 13" stroke="#949494" stroke-width="2" stroke-linecap="round" />
|
|
671
|
+
<path d="M13 1L1 13" stroke="#949494" stroke-width="2" stroke-linecap="round" />
|
|
672
|
+
</svg>`;
|
|
673
|
+
ProductsPage.minusSVG = html `<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
674
|
+
<path
|
|
675
|
+
d="M9.64314 5C9.64314 5.3457 9.32394 5.625 8.92885 5.625H1.07171C0.676618 5.625 0.357422 5.3457 0.357422 5C0.357422 4.6543 0.676618 4.375 1.07171 4.375H8.92885C9.32394 4.375 9.64314 4.6543 9.64314 5Z"
|
|
676
|
+
fill="white"
|
|
677
|
+
/>
|
|
678
|
+
</svg>`;
|
|
679
|
+
ProductsPage.plusSVG = html `<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
680
|
+
<path
|
|
681
|
+
d="M5.76923 0.769231C5.76923 0.34375 5.42548 0 5 0C4.57452 0 4.23077 0.34375 4.23077 0.769231V4.23077H0.769231C0.34375 4.23077 0 4.57452 0 5C0 5.42548 0.34375 5.76923 0.769231 5.76923H4.23077V9.23077C4.23077 9.65625 4.57452 10 5 10C5.42548 10 5.76923 9.65625 5.76923 9.23077V5.76923H9.23077C9.65625 5.76923 10 5.42548 10 5C10 4.57452 9.65625 4.23077 9.23077 4.23077H5.76923V0.769231Z"
|
|
682
|
+
fill="white"
|
|
683
|
+
/>
|
|
684
|
+
</svg>`;
|