ts-glitter 22.4.6 → 22.4.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/lib/glitterBundle/Glitter.css +74 -62
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-product.js +49 -32
- package/lowcode/backend-manager/bg-product.ts +57 -39
- package/lowcode/backend-manager/bg-widget.js +17 -0
- package/lowcode/backend-manager/bg-widget.ts +18 -0
- package/lowcode/cms-plugin/information/information-module.js +5 -5
- package/lowcode/cms-plugin/information/information-module.ts +9 -5
- package/lowcode/cms-plugin/menus-setting.js +69 -55
- package/lowcode/cms-plugin/menus-setting.ts +77 -61
- package/lowcode/cms-plugin/module/form-module.js +109 -89
- package/lowcode/cms-plugin/module/form-module.ts +680 -650
- package/lowcode/cms-plugin/module/product-excel.js +1 -0
- package/lowcode/cms-plugin/module/product-excel.ts +2 -0
- package/lowcode/cms-plugin/pos-pages/payment-page.js +28 -10
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +29 -10
- package/lowcode/cms-plugin/shopping-allowance-manager.js +0 -1
- package/lowcode/cms-plugin/shopping-allowance-manager.ts +0 -1
- package/lowcode/cms-plugin/shopping-collections.js +367 -193
- package/lowcode/cms-plugin/shopping-collections.ts +664 -243
- package/lowcode/cms-plugin/shopping-information.js +392 -38
- package/lowcode/cms-plugin/shopping-information.ts +479 -87
- package/lowcode/cms-plugin/shopping-product-setting.js +2 -2
- package/lowcode/cms-plugin/shopping-product-setting.ts +2 -2
- package/lowcode/cms-plugin/shopping-setting-advance.js +906 -766
- package/lowcode/cms-plugin/shopping-setting-advance.ts +977 -841
- package/lowcode/cms-plugin/shopping-setting-basic.js +1547 -1285
- package/lowcode/cms-plugin/shopping-setting-basic.ts +1742 -1466
- package/lowcode/cms-plugin/stock-stores.js +1 -0
- package/lowcode/cms-plugin/stock-stores.ts +1 -0
- package/lowcode/cms-plugin/user-list.js +47 -12
- package/lowcode/cms-plugin/user-list.ts +52 -14
- package/lowcode/css/editor.css +6 -0
- package/lowcode/glitterBundle/Glitter.css +74 -62
- package/lowcode/jslib/nestable/index.html +317 -0
- package/lowcode/jslib/nestable/jquery.nestable.js +484 -0
- package/lowcode/official_view_component/form-widget/input-custom.js +98 -6
- package/lowcode/official_view_component/form-widget/input-custom.ts +121 -16
- package/lowcode/public-components/headers/header-class.js +63 -0
- package/lowcode/public-components/headers/header-class.ts +65 -0
- package/lowcode/public-components/headers/sy-02.js +386 -400
- package/lowcode/public-components/headers/sy-02.ts +482 -492
- package/lowcode/public-components/headers/sy-03.js +42 -43
- package/lowcode/public-components/headers/sy-03.ts +46 -43
- package/lowcode/public-components/headers/sy-04.js +43 -41
- package/lowcode/public-components/headers/sy-04.ts +48 -41
- package/lowcode/public-components/headers/sy-05.js +30 -27
- package/lowcode/public-components/headers/sy-05.ts +33 -27
- package/lowcode/public-components/product/product-list.js +160 -148
- package/lowcode/public-components/product/product-list.ts +186 -165
- package/lowcode/public-models/product.ts +26 -1
- package/lowcode/src/glitterBundle/Glitter.css +74 -62
- package/package.json +1 -1
- package/rxmnt81tnk.json +1 -0
- package/src/api-public/controllers/shop.js +10 -4
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +14 -9
- package/src/api-public/services/ezpay/tool.d.ts +1 -0
- package/src/api-public/services/mail.js +1 -1
- package/src/api-public/services/mail.js.map +1 -1
- package/src/api-public/services/mail.ts +1 -1
- package/src/api-public/services/monitor.js.map +1 -1
- package/src/api-public/services/monitor.ts +2 -0
- package/src/api-public/services/schedule.d.ts +0 -1
- package/src/api-public/services/schedule.js +12 -35
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +15 -39
- package/src/api-public/services/shopee.js +7 -17
- package/src/api-public/services/shopping.d.ts +27 -6
- package/src/api-public/services/shopping.js +364 -85
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +510 -101
- package/src/api-public/services/updated-table-checked.js +58 -1
- package/src/api-public/services/updated-table-checked.js.map +1 -1
- package/src/api-public/services/updated-table-checked.ts +62 -1
- package/src/api-public/services/user-update.js +14 -0
- package/src/api-public/services/user-update.js.map +1 -1
- package/src/api-public/services/user-update.ts +15 -0
- package/src/api-public/services/user.js +1 -1
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +1 -1
- package/src/app-project/serverless/src/modules/database.d.ts +1 -1
- package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
- package/src/helper/glitter-util.d.ts +1 -0
- package/src/index.js +7 -4
- package/src/index.js.map +1 -1
- package/src/index.ts +45 -36
- package/src/modules/firebase.js +1 -0
- package/src/modules/firebase.js.map +1 -1
- package/src/modules/firebase.ts +1 -0
- package/src/seo-config.d.ts +2 -1
- package/src/seo-config.js +28 -22
- package/src/seo-config.js.map +1 -1
- package/src/seo-config.ts +33 -26
- package/src/services/saas-table-check.js.map +1 -1
- package/src/services/ses.js +4 -3
- package/src/services/ses.js.map +1 -1
- package/src/services/system-schedule.js.map +1 -1
- package/src/services/system-schedule.ts +1 -0
|
@@ -12,26 +12,136 @@ import { BgProduct } from '../backend-manager/bg-product.js';
|
|
|
12
12
|
import { ApiUser } from '../glitter-base/route/user.js';
|
|
13
13
|
import { QuestionInfo } from './module/question-info.js';
|
|
14
14
|
import { Tool } from '../modules/tool.js';
|
|
15
|
+
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
15
16
|
const html = String.raw;
|
|
17
|
+
const css = String.raw;
|
|
16
18
|
export class ShoppingSettingAdvance {
|
|
17
19
|
static main(obj) {
|
|
18
20
|
const gvc = obj.gvc;
|
|
19
21
|
const postMD = obj.postMD;
|
|
20
22
|
const vm = obj.vm2;
|
|
23
|
+
const section_ID = {
|
|
24
|
+
tag: gvc.glitter.getUUID(),
|
|
25
|
+
};
|
|
21
26
|
const categoryTitles = {
|
|
22
27
|
commodity: '商品',
|
|
23
28
|
course: '課程',
|
|
29
|
+
reserve: '預約'
|
|
24
30
|
};
|
|
31
|
+
const id = section_ID.tag;
|
|
25
32
|
const carTitle = categoryTitles[postMD.product_category] || '商品';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
34
|
+
function drawReverseSection() {
|
|
35
|
+
var _a;
|
|
36
|
+
if (carTitle == "reserve") {
|
|
37
|
+
return ``;
|
|
38
|
+
}
|
|
39
|
+
gvc.addStyle(css `
|
|
40
|
+
.available-input{
|
|
41
|
+
height: 40px;
|
|
42
|
+
padding: 0 18px;
|
|
43
|
+
flex: 1 0 0;
|
|
44
|
+
gap: 10px;
|
|
45
|
+
border-radius: 10px;
|
|
46
|
+
border: 1px solid #DDD;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
`);
|
|
50
|
+
postMD.available_time = (_a = postMD.available_time) !== null && _a !== void 0 ? _a : {
|
|
51
|
+
earliest: {
|
|
52
|
+
value: "1",
|
|
53
|
+
unit: "month",
|
|
54
|
+
},
|
|
55
|
+
latest: {
|
|
56
|
+
value: "1",
|
|
57
|
+
unit: "day",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
return BgWidget.mainCard(html `
|
|
61
|
+
<div class="d-flex flex-column" style="gap: 18px;">
|
|
62
|
+
<div class="tx_700">預約設定</div>
|
|
63
|
+
<div class="d-flex flex-column" style="gap: 8px;">
|
|
64
|
+
<div class="d-flex flex-column" style="gap: 4px">
|
|
65
|
+
<div class="tx_700">最早可預約時間</div>
|
|
66
|
+
<div class="tx_gray_14">最早可接受預約的時間,例如提前1個月</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="d-flex " style="gap: 18px;">
|
|
69
|
+
<div class="d-flex align-items-center available-input w-50">
|
|
70
|
+
<input class="border-0 w-100" type="number" onchange="${gvc.event((e) => {
|
|
71
|
+
if (postMD.available_time.earliest.unit == 'day') {
|
|
72
|
+
if (Number(e.value) > 30) {
|
|
73
|
+
dialog.infoMessage({
|
|
74
|
+
text: "請設定小於30天",
|
|
75
|
+
callback: () => {
|
|
76
|
+
e.value = postMD.available_time.latest.value;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (Number(e.value) > Number(postMD.available_time.latest.value)) {
|
|
81
|
+
dialog.infoMessage({
|
|
82
|
+
text: "最早可預約時間需早於最晚可預約時間",
|
|
83
|
+
callback: () => {
|
|
84
|
+
e.value = postMD.available_time.latest.value;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
postMD.available_time.earliest.value = e.value;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
postMD.available_time.earliest.value = e.value;
|
|
92
|
+
}
|
|
93
|
+
})}">
|
|
94
|
+
</div>
|
|
95
|
+
<div class="w-50" style="box-sizing: border-box">
|
|
96
|
+
${BgWidget.select({
|
|
97
|
+
default: postMD.available_time.earliest.unit,
|
|
98
|
+
gvc: gvc,
|
|
99
|
+
options: [
|
|
100
|
+
{
|
|
101
|
+
value: "月",
|
|
102
|
+
key: "month"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: "日",
|
|
106
|
+
key: "day"
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
callback(value) {
|
|
110
|
+
postMD.available_time.earliest.unit = value;
|
|
111
|
+
},
|
|
112
|
+
})}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<div >
|
|
117
|
+
<div class="d-flex flex-column" style="gap: 4px;margin-bottom: 8px;">
|
|
118
|
+
<div class="tx_700">最晚可預約時間</div>
|
|
119
|
+
<div class="tx_gray_14">最晚可接受預約的時間,例如提前1天前</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="d-flex align-items-center available-input w-100 flex-shrink-0">
|
|
122
|
+
<input class="border-0 w-100" type="number" onchange="${gvc.event((e) => {
|
|
123
|
+
if (e.value > 30) {
|
|
124
|
+
dialog.infoMessage({
|
|
125
|
+
text: "請設定小於30天",
|
|
126
|
+
callback: () => {
|
|
127
|
+
e.value = postMD.available_time.latest.value;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
postMD.available_time.latest.value = e.value;
|
|
133
|
+
}
|
|
134
|
+
})}">
|
|
135
|
+
<div class="ms-auto tx_gray_16">天</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
`);
|
|
140
|
+
}
|
|
141
|
+
function drawTagSection() {
|
|
142
|
+
var _a;
|
|
143
|
+
return BgWidget.mainCard([
|
|
144
|
+
html `
|
|
35
145
|
<div class="guide5-4">
|
|
36
146
|
<div class="d-flex align-items-center justify-content-between">
|
|
37
147
|
<div>
|
|
@@ -42,219 +152,221 @@ export class ShoppingSettingAdvance {
|
|
|
42
152
|
${BgWidget.grayNote('用戶於前台搜尋標籤,即可搜尋到此' + carTitle)} ${BgWidget.mbContainer(4)}
|
|
43
153
|
</div>
|
|
44
154
|
${BgWidget.blueNote('使用現有標籤', gvc.event(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
155
|
+
var _a;
|
|
156
|
+
BgProduct.useProductTags({
|
|
157
|
+
gvc,
|
|
158
|
+
config_key: 'product_general_tags',
|
|
159
|
+
config_lang: vm.language,
|
|
160
|
+
def: (_a = postMD.product_tag.language[vm.language]) !== null && _a !== void 0 ? _a : [],
|
|
161
|
+
callback: tags => {
|
|
162
|
+
postMD.product_tag.language[vm.language] = tags;
|
|
163
|
+
gvc.notifyDataChange(id);
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
}))}
|
|
57
167
|
</div>
|
|
58
168
|
${BgWidget.multipleInput(gvc, postMD.product_tag.language[vm.language], {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
169
|
+
save: def => {
|
|
170
|
+
postMD.product_tag.language[vm.language] = def;
|
|
171
|
+
},
|
|
172
|
+
})}
|
|
63
173
|
</div>
|
|
64
174
|
`,
|
|
65
|
-
|
|
175
|
+
html `
|
|
66
176
|
<div class="d-flex align-items-center justify-content-between">
|
|
67
177
|
<div>
|
|
68
178
|
<div style="color: #393939; font-weight: 700;">${carTitle}管理員標籤</div>
|
|
69
179
|
${BgWidget.grayNote('操作後台人員登記與分類用,不會顯示於前台')} ${BgWidget.mbContainer(4)}
|
|
70
180
|
</div>
|
|
71
181
|
${BgWidget.blueNote('使用現有標籤', gvc.event(() => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
182
|
+
var _a;
|
|
183
|
+
BgProduct.useProductTags({
|
|
184
|
+
gvc,
|
|
185
|
+
config_key: 'product_manager_tags',
|
|
186
|
+
def: (_a = postMD.product_customize_tag) !== null && _a !== void 0 ? _a : [],
|
|
187
|
+
callback: tags => {
|
|
188
|
+
postMD.product_customize_tag = tags;
|
|
189
|
+
gvc.notifyDataChange(id);
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}))}
|
|
83
193
|
</div>
|
|
84
194
|
${BgWidget.multipleInput(gvc, (_a = postMD.product_customize_tag) !== null && _a !== void 0 ? _a : [], {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
195
|
+
save: def => {
|
|
196
|
+
postMD.product_customize_tag = [...new Set(def)];
|
|
197
|
+
},
|
|
198
|
+
}, true)}
|
|
89
199
|
`,
|
|
90
|
-
|
|
200
|
+
html ` <div class="d-flex align-items-center gap-2">
|
|
91
201
|
<div style="color: #393939; font-weight: 700;">${carTitle}促銷標籤</div>
|
|
92
202
|
${BgWidget.questionButton(gvc.event(() => {
|
|
93
|
-
|
|
94
|
-
|
|
203
|
+
QuestionInfo.promoteLabel(gvc);
|
|
204
|
+
}))}
|
|
95
205
|
</div>
|
|
96
206
|
${BgWidget.mbContainer(8)}
|
|
97
207
|
${gvc.bindView((() => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
208
|
+
const id = gvc.glitter.getUUID();
|
|
209
|
+
let options = [];
|
|
210
|
+
ApiUser.getPublicConfig('promo-label', 'manager').then(data => {
|
|
211
|
+
var _a;
|
|
212
|
+
if (data.result && Array.isArray((_a = data.response) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
213
|
+
options = [
|
|
214
|
+
...data.response.value.map(({ id, title }) => ({
|
|
215
|
+
key: id,
|
|
216
|
+
value: title,
|
|
217
|
+
})),
|
|
218
|
+
{ key: '', value: '不設定' },
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
gvc.notifyDataChange(id);
|
|
222
|
+
});
|
|
223
|
+
return {
|
|
224
|
+
bind: id,
|
|
225
|
+
view: () => {
|
|
226
|
+
return BgWidget.select({
|
|
227
|
+
gvc: obj.gvc,
|
|
228
|
+
default: postMD.label || '',
|
|
229
|
+
options: options,
|
|
230
|
+
callback: (text) => {
|
|
231
|
+
postMD.label = text || undefined;
|
|
111
232
|
gvc.notifyDataChange(id);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
callback: (text) => {
|
|
121
|
-
postMD.label = text || undefined;
|
|
122
|
-
gvc.notifyDataChange(id);
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
})())}`,
|
|
128
|
-
postMD.product_category === 'course'
|
|
129
|
-
? ''
|
|
130
|
-
: html ` <div class="d-flex align-items-center">
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
})())}`,
|
|
238
|
+
postMD.product_category === 'course'
|
|
239
|
+
? ''
|
|
240
|
+
: html ` <div class="d-flex align-items-center">
|
|
131
241
|
<div style="color: #393939; font-weight: 700;">數量單位</div>
|
|
132
242
|
${BgWidget.languageInsignia(vm.language, 'margin-left:5px;')}
|
|
133
243
|
</div>
|
|
134
244
|
${BgWidget.grayNote('例如 : 坪、件、個、打,預設單位為件。')}
|
|
135
245
|
${BgWidget.editeInput({
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
246
|
+
gvc: obj.gvc,
|
|
247
|
+
default: `${postMD.unit[vm.language] || ''}`,
|
|
248
|
+
title: '',
|
|
249
|
+
type: 'text',
|
|
250
|
+
placeHolder: '件',
|
|
251
|
+
callback: (text) => {
|
|
252
|
+
postMD.unit[vm.language] = text;
|
|
253
|
+
gvc.notifyDataChange(id);
|
|
254
|
+
},
|
|
255
|
+
})}`,
|
|
256
|
+
html `
|
|
147
257
|
<div class="d-flex align-items-center">
|
|
148
258
|
<div style="color: #393939; font-weight: 700;">排序權重</div>
|
|
149
259
|
</div>
|
|
150
260
|
${BgWidget.grayNote('數字越大商品排序會越靠前。')}
|
|
151
261
|
${BgWidget.editeInput({
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
262
|
+
gvc: obj.gvc,
|
|
263
|
+
default: `${postMD.sort_weight || ''}`,
|
|
264
|
+
title: '',
|
|
265
|
+
type: 'text',
|
|
266
|
+
placeHolder: '數字越大商品排序會越靠前',
|
|
267
|
+
callback: (text) => {
|
|
268
|
+
postMD.sort_weight = text;
|
|
269
|
+
gvc.notifyDataChange(id);
|
|
270
|
+
},
|
|
271
|
+
})}
|
|
162
272
|
`,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
273
|
+
]
|
|
274
|
+
.filter(Boolean)
|
|
275
|
+
.join(BgWidget.mbContainer(18)));
|
|
276
|
+
}
|
|
277
|
+
function drawBuyLimit() {
|
|
278
|
+
return BgWidget.mainCard([
|
|
279
|
+
html `
|
|
168
280
|
<div class="d-flex flex-column guide5-4">
|
|
169
281
|
<div style="font-weight: 700;" class="mb-2">${carTitle}購買限制</div>
|
|
170
282
|
</div>
|
|
171
283
|
`,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
284
|
+
...(postMD.productType.giveaway
|
|
285
|
+
? []
|
|
286
|
+
: [
|
|
287
|
+
{
|
|
288
|
+
title: `最低需要${carTitle}多少`,
|
|
289
|
+
key: 'min_qty',
|
|
290
|
+
checked: postMD.min_qty,
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
title: `最高只能${carTitle}多少`,
|
|
294
|
+
key: 'max_qty',
|
|
295
|
+
checked: postMD.max_qty,
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
title: `需連同特定${carTitle}一併購買`,
|
|
299
|
+
key: 'match_by_with',
|
|
300
|
+
checked: postMD.match_by_with,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
title: `過往購買過特定${carTitle}才能購買此${carTitle}`,
|
|
304
|
+
key: 'legacy_by_with',
|
|
305
|
+
checked: postMD.legacy_by_with,
|
|
306
|
+
},
|
|
307
|
+
].map(dd => {
|
|
308
|
+
const stringArray = [
|
|
309
|
+
BgWidget.inlineCheckBox({
|
|
310
|
+
title: '',
|
|
311
|
+
gvc: gvc,
|
|
312
|
+
def: [dd.checked ? dd.key : ''],
|
|
313
|
+
array: [
|
|
190
314
|
{
|
|
191
|
-
title:
|
|
192
|
-
|
|
193
|
-
checked: postMD.legacy_by_with,
|
|
315
|
+
title: dd.title,
|
|
316
|
+
value: dd.key,
|
|
194
317
|
},
|
|
195
|
-
]
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
type: 'multiple',
|
|
229
|
-
}),
|
|
230
|
-
];
|
|
231
|
-
if (dd.checked) {
|
|
232
|
-
switch (dd.key) {
|
|
233
|
-
case 'min_qty':
|
|
234
|
-
case 'max_qty':
|
|
235
|
-
stringArray.push(html ` <div class="d-flex align-items-center fw-500" style="gap:10px;">
|
|
318
|
+
],
|
|
319
|
+
callback: () => {
|
|
320
|
+
const handleToggle = (key, defaultValue) => {
|
|
321
|
+
if (postMD[key]) {
|
|
322
|
+
delete postMD[key];
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
postMD[key] = defaultValue;
|
|
326
|
+
}
|
|
327
|
+
gvc.notifyDataChange(id);
|
|
328
|
+
};
|
|
329
|
+
switch (dd.key) {
|
|
330
|
+
case 'min_qty':
|
|
331
|
+
case 'max_qty':
|
|
332
|
+
handleToggle(dd.key, 1);
|
|
333
|
+
break;
|
|
334
|
+
case 'match_by_with':
|
|
335
|
+
case 'legacy_by_with':
|
|
336
|
+
handleToggle(dd.key, []);
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
type: 'multiple',
|
|
341
|
+
}),
|
|
342
|
+
];
|
|
343
|
+
if (dd.checked) {
|
|
344
|
+
switch (dd.key) {
|
|
345
|
+
case 'min_qty':
|
|
346
|
+
case 'max_qty':
|
|
347
|
+
stringArray.push(html ` <div class="d-flex align-items-center fw-500" style="gap:10px;">
|
|
236
348
|
${BgWidget.editeInput({
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
349
|
+
gvc: obj.gvc,
|
|
350
|
+
default: `${postMD[dd.key] || ''}`,
|
|
351
|
+
title: '',
|
|
352
|
+
type: 'number',
|
|
353
|
+
placeHolder: `1`,
|
|
354
|
+
callback: (text) => {
|
|
355
|
+
postMD[dd.key] = parseInt(text, 10);
|
|
356
|
+
gvc.notifyDataChange(id);
|
|
357
|
+
},
|
|
358
|
+
})}
|
|
247
359
|
件
|
|
248
360
|
</div>`);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
361
|
+
break;
|
|
362
|
+
case 'match_by_with':
|
|
363
|
+
stringArray.push(obj.gvc.bindView(() => {
|
|
364
|
+
const id = gvc.glitter.getUUID();
|
|
365
|
+
return {
|
|
366
|
+
bind: id,
|
|
367
|
+
view: () => {
|
|
368
|
+
try {
|
|
369
|
+
return html `
|
|
258
370
|
<div style="font-weight: 700;" class=" d-flex flex-column">
|
|
259
371
|
${BgWidget.grayNote(`購物車必須連同包含以下其中一個${postMD.product_category === 'course' ? `課程或商品` : `商品`}才可結帳`)}
|
|
260
372
|
</div>
|
|
@@ -266,82 +378,82 @@ export class ShoppingSettingAdvance {
|
|
|
266
378
|
<div class="tx_normal">商品列表</div>
|
|
267
379
|
</div>
|
|
268
380
|
${BgWidget.grayButton('選擇商品', gvc.event(() => {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
381
|
+
BgProduct.productsDialog({
|
|
382
|
+
gvc: gvc,
|
|
383
|
+
default: postMD.match_by_with,
|
|
384
|
+
callback: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
385
|
+
postMD.match_by_with = value;
|
|
386
|
+
gvc.notifyDataChange(id);
|
|
387
|
+
}),
|
|
388
|
+
filter: dd => dd.key !== postMD.id,
|
|
389
|
+
});
|
|
390
|
+
}), { textStyle: 'font-weight: 400;' })}
|
|
279
391
|
</div>
|
|
280
392
|
${gvc.bindView(() => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
393
|
+
const vm = {
|
|
394
|
+
id: gvc.glitter.getUUID(),
|
|
395
|
+
loading: true,
|
|
396
|
+
data: [],
|
|
397
|
+
};
|
|
398
|
+
BgProduct.getProductOpts(postMD.match_by_with).then(res => {
|
|
399
|
+
vm.data = res;
|
|
400
|
+
vm.loading = false;
|
|
401
|
+
gvc.notifyDataChange(vm.id);
|
|
402
|
+
});
|
|
403
|
+
return {
|
|
404
|
+
bind: vm.id,
|
|
405
|
+
view: () => __awaiter(this, void 0, void 0, function* () {
|
|
406
|
+
if (vm.loading) {
|
|
407
|
+
return BgWidget.spinner();
|
|
408
|
+
}
|
|
409
|
+
return vm.data
|
|
410
|
+
.map((opt, index) => {
|
|
411
|
+
return html ` <div
|
|
300
412
|
class="d-flex align-items-center form-check-label c_updown_label gap-3"
|
|
301
413
|
>
|
|
302
414
|
<span class="tx_normal">${index + 1} .</span>
|
|
303
415
|
${BgWidget.validImageBox({
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
416
|
+
gvc: gvc,
|
|
417
|
+
image: opt.image,
|
|
418
|
+
width: 40,
|
|
419
|
+
})}
|
|
308
420
|
<div class="tx_normal ${opt.note ? 'mb-1' : ''}">
|
|
309
421
|
${opt.value}
|
|
310
422
|
</div>
|
|
311
423
|
${opt.note
|
|
312
|
-
|
|
313
|
-
|
|
424
|
+
? html ` <div class="tx_gray_12">${opt.note}</div> `
|
|
425
|
+
: ''}
|
|
314
426
|
</div>`;
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
427
|
+
})
|
|
428
|
+
.join('');
|
|
429
|
+
}),
|
|
430
|
+
divCreate: {
|
|
431
|
+
class: `d-flex py-2 flex-column`,
|
|
432
|
+
style: `gap:10px;`,
|
|
433
|
+
},
|
|
434
|
+
};
|
|
435
|
+
})}
|
|
324
436
|
`;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
437
|
+
}
|
|
438
|
+
catch (e) {
|
|
439
|
+
console.error(e);
|
|
440
|
+
return '';
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
divCreate: {
|
|
444
|
+
class: `w-100`,
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
}));
|
|
448
|
+
break;
|
|
449
|
+
case 'legacy_by_with':
|
|
450
|
+
stringArray.push(obj.gvc.bindView(() => {
|
|
451
|
+
const id = gvc.glitter.getUUID();
|
|
452
|
+
return {
|
|
453
|
+
bind: id,
|
|
454
|
+
view: () => {
|
|
455
|
+
try {
|
|
456
|
+
return html `
|
|
345
457
|
<div style="font-weight: 700;" class=" d-flex flex-column">
|
|
346
458
|
${BgWidget.grayNote(`已購買過的訂單記錄中,必須包含以下${postMD.product_category === 'course' ? `課程或商品` : `商品`}才可以結帳`)}
|
|
347
459
|
</div>
|
|
@@ -353,192 +465,197 @@ export class ShoppingSettingAdvance {
|
|
|
353
465
|
<div class="tx_normal">商品列表</div>
|
|
354
466
|
</div>
|
|
355
467
|
${BgWidget.grayButton('選擇商品', gvc.event(() => {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
468
|
+
BgProduct.productsDialog({
|
|
469
|
+
gvc: gvc,
|
|
470
|
+
default: postMD.match_by_with,
|
|
471
|
+
callback: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
472
|
+
postMD.match_by_with = value;
|
|
473
|
+
gvc.notifyDataChange(id);
|
|
474
|
+
}),
|
|
475
|
+
filter: dd => dd.key !== postMD.id,
|
|
476
|
+
});
|
|
477
|
+
}), { textStyle: 'font-weight: 400;' })}
|
|
366
478
|
</div>
|
|
367
479
|
${gvc.bindView(() => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
480
|
+
const vm = {
|
|
481
|
+
id: gvc.glitter.getUUID(),
|
|
482
|
+
loading: true,
|
|
483
|
+
data: [],
|
|
484
|
+
};
|
|
485
|
+
BgProduct.getProductOpts(postMD.match_by_with).then(res => {
|
|
486
|
+
vm.data = res;
|
|
487
|
+
vm.loading = false;
|
|
488
|
+
gvc.notifyDataChange(vm.id);
|
|
489
|
+
});
|
|
490
|
+
return {
|
|
491
|
+
bind: vm.id,
|
|
492
|
+
view: () => __awaiter(this, void 0, void 0, function* () {
|
|
493
|
+
if (vm.loading) {
|
|
494
|
+
return BgWidget.spinner();
|
|
495
|
+
}
|
|
496
|
+
return vm.data
|
|
497
|
+
.map((opt, index) => {
|
|
498
|
+
return html ` <div
|
|
387
499
|
class="d-flex align-items-center form-check-label c_updown_label gap-3"
|
|
388
500
|
>
|
|
389
501
|
<span class="tx_normal">${index + 1} .</span>
|
|
390
502
|
${BgWidget.validImageBox({
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
503
|
+
gvc: gvc,
|
|
504
|
+
image: opt.image,
|
|
505
|
+
width: 40,
|
|
506
|
+
})}
|
|
395
507
|
<div class="tx_normal ${opt.note ? 'mb-1' : ''}">
|
|
396
508
|
${opt.value}
|
|
397
509
|
</div>
|
|
398
510
|
${opt.note
|
|
399
|
-
|
|
400
|
-
|
|
511
|
+
? html ` <div class="tx_gray_12">${opt.note}</div> `
|
|
512
|
+
: ''}
|
|
401
513
|
</div>`;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
514
|
+
})
|
|
515
|
+
.join('');
|
|
516
|
+
}),
|
|
517
|
+
divCreate: {
|
|
518
|
+
class: `d-flex py-2 flex-column`,
|
|
519
|
+
style: `gap:10px;`,
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
})}
|
|
411
523
|
`;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
524
|
+
}
|
|
525
|
+
catch (e) {
|
|
526
|
+
console.error(e);
|
|
527
|
+
return '';
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
divCreate: {
|
|
531
|
+
class: `w-100`,
|
|
532
|
+
},
|
|
533
|
+
};
|
|
534
|
+
}));
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return stringArray.join('');
|
|
539
|
+
})),
|
|
540
|
+
].join(''));
|
|
541
|
+
}
|
|
542
|
+
function drawTaxSection() {
|
|
543
|
+
var _a;
|
|
544
|
+
return BgWidget.mainCard([
|
|
545
|
+
html `
|
|
431
546
|
<div class="d-flex flex-column guide5-4">
|
|
432
547
|
<div style="font-weight: 700;" class="mb-2">商品稅額</div>
|
|
433
548
|
</div>
|
|
434
549
|
`,
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
550
|
+
BgWidget.select({
|
|
551
|
+
gvc: gvc,
|
|
552
|
+
callback: text => {
|
|
553
|
+
postMD.tax = text;
|
|
554
|
+
},
|
|
555
|
+
default: (_a = postMD.tax) !== null && _a !== void 0 ? _a : '5',
|
|
556
|
+
options: [
|
|
557
|
+
{
|
|
558
|
+
key: '5',
|
|
559
|
+
value: '一般稅額(5%)',
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
key: '0',
|
|
563
|
+
value: '免稅商品(0%)',
|
|
564
|
+
},
|
|
565
|
+
],
|
|
566
|
+
}),
|
|
567
|
+
].join(''));
|
|
568
|
+
}
|
|
569
|
+
function drawSpecialPriceSection() {
|
|
570
|
+
return BgWidget.mainCard((() => {
|
|
571
|
+
const priceVM = {
|
|
572
|
+
id: gvc.glitter.getUUID(),
|
|
573
|
+
loading: true,
|
|
574
|
+
typeData: [],
|
|
575
|
+
showPriceDetail: false,
|
|
576
|
+
};
|
|
577
|
+
const isDesktop = document.body.clientWidth > 768;
|
|
578
|
+
const getIndexStyle = (index) => index === 0
|
|
579
|
+
? `height: 100%; padding: 0; min-width: ${isDesktop ? 250 : 200}px; max-width: ${isDesktop ? 250 : 200}px;position: sticky; left: 0; background: #fff; box-shadow: 1px 0px 0px 0px rgba(0, 0, 0, 0.10);`
|
|
580
|
+
: 'height: 100%; padding: 0; text-align: center; justify-content: center; min-width: 126px;';
|
|
581
|
+
const resetPostList = (result, type) => {
|
|
582
|
+
var _a, _b, _c;
|
|
583
|
+
const existingPrices = new Map((_a = postMD.multi_sale_price) === null || _a === void 0 ? void 0 : _a.filter(m => {
|
|
584
|
+
return m.type === type;
|
|
585
|
+
}).map(m => {
|
|
586
|
+
return [m.key, new Map(m.variants.map(v => [v.spec.join(','), v.price]))];
|
|
587
|
+
}));
|
|
588
|
+
postMD.multi_sale_price = [
|
|
589
|
+
...((_c = (_b = postMD.multi_sale_price) === null || _b === void 0 ? void 0 : _b.filter(item => item.type !== type)) !== null && _c !== void 0 ? _c : []),
|
|
590
|
+
...result.map(key => ({
|
|
591
|
+
type,
|
|
592
|
+
key,
|
|
593
|
+
variants: postMD.variants.map(v => {
|
|
594
|
+
var _a, _b;
|
|
595
|
+
return ({
|
|
596
|
+
spec: v.spec,
|
|
597
|
+
price: (_b = (_a = existingPrices.get(key)) === null || _a === void 0 ? void 0 : _a.get(v.spec.join(','))) !== null && _b !== void 0 ? _b : 0,
|
|
598
|
+
});
|
|
451
599
|
}),
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
},
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
title: '門市專屬價格開啟',
|
|
507
|
-
note: '開啟後即可為各個門市設置專屬的價格',
|
|
508
|
-
type: 'store',
|
|
509
|
-
event: () => {
|
|
510
|
-
BgProduct.setStorePriceSetting(toggleObject('store'));
|
|
511
|
-
},
|
|
512
|
-
},
|
|
513
|
-
{
|
|
514
|
-
title: '顧客標籤價格開啟',
|
|
515
|
-
note: '開啟後即可為各個顧客標籤設置專屬的價格',
|
|
516
|
-
type: 'tags',
|
|
517
|
-
event: () => {
|
|
518
|
-
BgProduct.setUserTagPriceSetting(toggleObject('tags'));
|
|
519
|
-
},
|
|
520
|
-
},
|
|
521
|
-
];
|
|
522
|
-
return gvc.bindView({
|
|
523
|
-
bind: priceVM.id,
|
|
524
|
-
view: () => {
|
|
525
|
-
if (priceVM.loading)
|
|
526
|
-
return BgWidget.spinner();
|
|
527
|
-
const toggleList = createToggleList();
|
|
528
|
-
const particularKeys = priceVM.typeData.filter(item => {
|
|
529
|
-
var _a;
|
|
530
|
-
return (_a = postMD.multi_sale_price) === null || _a === void 0 ? void 0 : _a.some(m => m.type === item.type && m.key === item.key);
|
|
531
|
-
});
|
|
532
|
-
try {
|
|
533
|
-
return html `
|
|
600
|
+
})),
|
|
601
|
+
];
|
|
602
|
+
gvc.notifyDataChange(priceVM.id);
|
|
603
|
+
};
|
|
604
|
+
const toggleObject = (type) => {
|
|
605
|
+
return {
|
|
606
|
+
gvc,
|
|
607
|
+
postData: postMD.multi_sale_price
|
|
608
|
+
? postMD.multi_sale_price.filter(item => item.type === type).map(item => item.key)
|
|
609
|
+
: [],
|
|
610
|
+
callback: (result) => resetPostList(result, type),
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
const createToggleList = () => [
|
|
614
|
+
{
|
|
615
|
+
title: '會員等級價格開啟',
|
|
616
|
+
note: '開啟後即可為各個會員等級設置專屬的價格',
|
|
617
|
+
type: 'level',
|
|
618
|
+
event: () => {
|
|
619
|
+
BgProduct.setMemberPriceSetting(toggleObject('level'));
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
title: '門市專屬價格開啟',
|
|
624
|
+
note: '開啟後即可為各個門市設置專屬的價格',
|
|
625
|
+
type: 'store',
|
|
626
|
+
event: () => {
|
|
627
|
+
BgProduct.setStorePriceSetting(toggleObject('store'));
|
|
628
|
+
},
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
title: '顧客標籤價格開啟',
|
|
632
|
+
note: '開啟後即可為各個顧客標籤設置專屬的價格',
|
|
633
|
+
type: 'tags',
|
|
634
|
+
event: () => {
|
|
635
|
+
BgProduct.setUserTagPriceSetting(toggleObject('tags'));
|
|
636
|
+
},
|
|
637
|
+
},
|
|
638
|
+
];
|
|
639
|
+
return gvc.bindView({
|
|
640
|
+
bind: priceVM.id,
|
|
641
|
+
view: () => {
|
|
642
|
+
if (priceVM.loading)
|
|
643
|
+
return BgWidget.spinner();
|
|
644
|
+
const toggleList = createToggleList();
|
|
645
|
+
const particularKeys = priceVM.typeData.filter(item => {
|
|
646
|
+
var _a;
|
|
647
|
+
return (_a = postMD.multi_sale_price) === null || _a === void 0 ? void 0 : _a.some(m => m.type === item.type && m.key === item.key);
|
|
648
|
+
});
|
|
649
|
+
try {
|
|
650
|
+
return html `
|
|
534
651
|
<div class="title-container px-0 mb-2">
|
|
535
652
|
<div style="color:#393939;font-weight: 700;">專屬價格</div>
|
|
536
653
|
<div class="flex-fill"></div>
|
|
537
654
|
</div>
|
|
538
655
|
${toggleList
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
656
|
+
.map(item => {
|
|
657
|
+
var _a;
|
|
658
|
+
return html `
|
|
542
659
|
<div class="d-flex align-items-center">
|
|
543
660
|
<div>
|
|
544
661
|
<div class="d-flex align-items-center gap-2 mb-1">
|
|
@@ -549,15 +666,15 @@ export class ShoppingSettingAdvance {
|
|
|
549
666
|
style="cursor: pointer;"
|
|
550
667
|
type="checkbox"
|
|
551
668
|
onchange="${gvc.event(e => {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
669
|
+
var _a;
|
|
670
|
+
if (e.checked) {
|
|
671
|
+
item.event();
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
postMD.multi_sale_price = (_a = postMD.multi_sale_price) === null || _a === void 0 ? void 0 : _a.filter(m => m.type !== item.type);
|
|
675
|
+
gvc.notifyDataChange(priceVM.id);
|
|
676
|
+
}
|
|
677
|
+
})}"
|
|
561
678
|
${((_a = postMD.multi_sale_price) === null || _a === void 0 ? void 0 : _a.some(m => m.type === item.type)) ? `checked` : ''}
|
|
562
679
|
/>
|
|
563
680
|
</div>
|
|
@@ -570,10 +687,10 @@ export class ShoppingSettingAdvance {
|
|
|
570
687
|
</div>
|
|
571
688
|
</div>
|
|
572
689
|
`;
|
|
573
|
-
|
|
574
|
-
|
|
690
|
+
})
|
|
691
|
+
.join(`<div class="w-100 my-3 border-top"></div>`)}
|
|
575
692
|
${particularKeys.length > 1
|
|
576
|
-
|
|
693
|
+
? html `
|
|
577
694
|
<div
|
|
578
695
|
class="d-flex justify-content-start align-items-center mt-2 my-1"
|
|
579
696
|
style="border-radius: 10px; padding: 10px 20px; background: #F7F7F7;"
|
|
@@ -583,269 +700,273 @@ export class ShoppingSettingAdvance {
|
|
|
583
700
|
>
|
|
584
701
|
</div>
|
|
585
702
|
`
|
|
586
|
-
|
|
703
|
+
: ''}
|
|
587
704
|
${postMD.multi_sale_price && postMD.multi_sale_price.length > 0
|
|
588
|
-
|
|
705
|
+
? html ` <div class="mt-3 d-grid" style="overflow: scroll;" id="scrollDiv">
|
|
589
706
|
<div class="d-flex">
|
|
590
707
|
${['商品名稱', '成本', '原價', '售價', ...particularKeys.map(item => item.name)]
|
|
591
|
-
|
|
708
|
+
.map((item, index) => html `
|
|
592
709
|
<div style="${getIndexStyle(index)}">
|
|
593
710
|
<div>${item}</div>
|
|
594
711
|
${BgWidget.horizontalLine({ margin: '1rem 0 0;' })}
|
|
595
712
|
</div>
|
|
596
713
|
`)
|
|
597
|
-
|
|
714
|
+
.join('')}
|
|
598
715
|
</div>
|
|
599
716
|
<div class="w-100 d-flex flex-column">
|
|
600
717
|
${postMD.variants
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
718
|
+
.map((variant, index) => {
|
|
719
|
+
const { spec, cost = 0, sale_price, preview_image, compare_price } = variant;
|
|
720
|
+
return html ` <div class="d-flex align-items-center">
|
|
604
721
|
${[
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
722
|
+
[
|
|
723
|
+
BgWidget.validImageBox({
|
|
724
|
+
gvc,
|
|
725
|
+
image: preview_image,
|
|
726
|
+
width: 40,
|
|
727
|
+
style: 'border-radius: 5px;',
|
|
728
|
+
}),
|
|
729
|
+
gvc.bindView({
|
|
730
|
+
bind: `spec-bar-${index}`,
|
|
731
|
+
dataList: [{ obj: priceVM, key: 'showPriceDetail' }],
|
|
732
|
+
view: () => {
|
|
733
|
+
return html `
|
|
617
734
|
<div>
|
|
618
735
|
${spec && spec.length > 0
|
|
619
|
-
|
|
620
|
-
|
|
736
|
+
? spec.join(' / ')
|
|
737
|
+
: Tool.truncateString(postMD.title, 10)}
|
|
621
738
|
</div>
|
|
622
739
|
${priceVM.showPriceDetail
|
|
623
|
-
|
|
740
|
+
? html ` <div style="color: #8D8D8D;">
|
|
624
741
|
定價 : ${compare_price.toLocaleString()} / 售價 :
|
|
625
742
|
${sale_price.toLocaleString()}
|
|
626
743
|
</div>`
|
|
627
|
-
|
|
744
|
+
: ''}
|
|
628
745
|
`;
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
746
|
+
},
|
|
747
|
+
divCreate: {
|
|
748
|
+
class: 'ms-2',
|
|
749
|
+
style: 'font-size: 14px;',
|
|
750
|
+
},
|
|
751
|
+
}),
|
|
752
|
+
].join(''),
|
|
753
|
+
`$ ${cost.toLocaleString()}`,
|
|
754
|
+
`$ ${compare_price.toLocaleString()}`,
|
|
755
|
+
`$ ${sale_price.toLocaleString()}`,
|
|
756
|
+
...particularKeys.map(item => gvc.bindView((() => {
|
|
757
|
+
const id = gvc.glitter.getUUID();
|
|
758
|
+
return {
|
|
759
|
+
bind: id,
|
|
760
|
+
view: () => {
|
|
761
|
+
var _a, _b;
|
|
762
|
+
const priceObj = (_a = postMD.multi_sale_price) === null || _a === void 0 ? void 0 : _a.find(m => m.type === item.type && m.key === item.key);
|
|
763
|
+
const variantObj = priceObj === null || priceObj === void 0 ? void 0 : priceObj.variants.find(v => v.spec.join(',') === spec.join(','));
|
|
764
|
+
return BgWidget.editeInput({
|
|
765
|
+
gvc,
|
|
766
|
+
title: '',
|
|
767
|
+
default: `${(_b = variantObj === null || variantObj === void 0 ? void 0 : variantObj.price) !== null && _b !== void 0 ? _b : 0}`,
|
|
768
|
+
placeHolder: '',
|
|
769
|
+
callback: value => {
|
|
770
|
+
const n = parseInt(`${value !== null && value !== void 0 ? value : 0}`, 10);
|
|
771
|
+
if (variantObj && !isNaN(n) && n > 0) {
|
|
772
|
+
variantObj.price = n;
|
|
773
|
+
}
|
|
774
|
+
gvc.notifyDataChange(id);
|
|
775
|
+
},
|
|
776
|
+
});
|
|
777
|
+
},
|
|
778
|
+
divCreate: {
|
|
779
|
+
style: 'width: 120px;',
|
|
780
|
+
},
|
|
781
|
+
};
|
|
782
|
+
})())),
|
|
783
|
+
]
|
|
784
|
+
.map((item, index) => html `
|
|
668
785
|
<div class="d-flex align-items-center" style="${getIndexStyle(index)}">
|
|
669
786
|
${item}
|
|
670
787
|
</div>
|
|
671
788
|
`)
|
|
672
|
-
|
|
789
|
+
.join('')}
|
|
673
790
|
</div>`;
|
|
674
|
-
|
|
675
|
-
|
|
791
|
+
})
|
|
792
|
+
.join('')}
|
|
676
793
|
</div>
|
|
677
794
|
</div>`
|
|
678
|
-
|
|
795
|
+
: ''}
|
|
679
796
|
`;
|
|
797
|
+
}
|
|
798
|
+
catch (error) {
|
|
799
|
+
console.error(error);
|
|
800
|
+
return '';
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
onCreate: () => {
|
|
804
|
+
if (priceVM.loading) {
|
|
805
|
+
Promise.all([
|
|
806
|
+
ApiUser.getUserGroupList('level').then(r => {
|
|
807
|
+
if (r.result && r.response && Array.isArray(r.response.data)) {
|
|
808
|
+
return r.response.data.map((item) => ({
|
|
809
|
+
type: 'level',
|
|
810
|
+
key: item.tag || 'default',
|
|
811
|
+
name: item.title.replace('會員等級 - ', ''),
|
|
812
|
+
}));
|
|
680
813
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (r.result && r.response && Array.isArray(r.response.data)) {
|
|
691
|
-
return r.response.data.map((item) => ({
|
|
692
|
-
type: 'level',
|
|
693
|
-
key: item.tag || 'default',
|
|
694
|
-
name: item.title.replace('會員等級 - ', ''),
|
|
695
|
-
}));
|
|
696
|
-
}
|
|
697
|
-
return [];
|
|
698
|
-
}),
|
|
699
|
-
ApiUser.getPublicConfig('store_manager', 'manager').then((r) => {
|
|
700
|
-
if (r.result && Array.isArray(r.response.value.list)) {
|
|
701
|
-
return r.response.value.list.map((d) => ({
|
|
702
|
-
type: 'store',
|
|
703
|
-
key: d.id,
|
|
704
|
-
name: d.name,
|
|
705
|
-
}));
|
|
706
|
-
}
|
|
707
|
-
return [];
|
|
708
|
-
}),
|
|
709
|
-
ApiUser.getPublicConfig('user_general_tags', 'manager').then((r) => {
|
|
710
|
-
if (r.result && Array.isArray(r.response.value.list)) {
|
|
711
|
-
return r.response.value.list.map((tag) => ({
|
|
712
|
-
type: 'tags',
|
|
713
|
-
key: tag,
|
|
714
|
-
name: tag,
|
|
715
|
-
}));
|
|
716
|
-
}
|
|
717
|
-
return [];
|
|
718
|
-
}),
|
|
719
|
-
]).then((dlist) => {
|
|
720
|
-
priceVM.typeData = dlist.flat();
|
|
721
|
-
priceVM.loading = false;
|
|
722
|
-
gvc.notifyDataChange(priceVM.id);
|
|
723
|
-
});
|
|
814
|
+
return [];
|
|
815
|
+
}),
|
|
816
|
+
ApiUser.getPublicConfig('store_manager', 'manager').then((r) => {
|
|
817
|
+
if (r.result && Array.isArray(r.response.value.list)) {
|
|
818
|
+
return r.response.value.list.map((d) => ({
|
|
819
|
+
type: 'store',
|
|
820
|
+
key: d.id,
|
|
821
|
+
name: d.name,
|
|
822
|
+
}));
|
|
724
823
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
if (isDesktop) {
|
|
735
|
-
scrollDiv.addEventListener('scroll', () => {
|
|
736
|
-
setStatus(scrollDiv);
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
else {
|
|
740
|
-
scrollDiv.addEventListener('touchmove', () => {
|
|
741
|
-
setStatus(scrollDiv);
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
}
|
|
824
|
+
return [];
|
|
825
|
+
}),
|
|
826
|
+
ApiUser.getPublicConfig('user_general_tags', 'manager').then((r) => {
|
|
827
|
+
if (r.result && Array.isArray(r.response.value.list)) {
|
|
828
|
+
return r.response.value.list.map((tag) => ({
|
|
829
|
+
type: 'tags',
|
|
830
|
+
key: tag,
|
|
831
|
+
name: tag,
|
|
832
|
+
}));
|
|
745
833
|
}
|
|
746
|
-
|
|
834
|
+
return [];
|
|
835
|
+
}),
|
|
836
|
+
]).then((dlist) => {
|
|
837
|
+
priceVM.typeData = dlist.flat();
|
|
838
|
+
priceVM.loading = false;
|
|
839
|
+
gvc.notifyDataChange(priceVM.id);
|
|
747
840
|
});
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
const scrollDiv = document.getElementById('scrollDiv');
|
|
844
|
+
if (scrollDiv) {
|
|
845
|
+
function setStatus(scrollDiv, delta = 360) {
|
|
846
|
+
const status = scrollDiv.scrollLeft > delta;
|
|
847
|
+
if (priceVM.showPriceDetail !== status) {
|
|
848
|
+
priceVM.showPriceDetail = status;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
if (isDesktop) {
|
|
852
|
+
scrollDiv.addEventListener('scroll', () => {
|
|
853
|
+
setStatus(scrollDiv);
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
else {
|
|
857
|
+
scrollDiv.addEventListener('touchmove', () => {
|
|
858
|
+
setStatus(scrollDiv);
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
});
|
|
865
|
+
})());
|
|
866
|
+
}
|
|
867
|
+
function drawLogisticsSection() {
|
|
868
|
+
return postMD.product_category === 'commodity'
|
|
869
|
+
? BgWidget.mainCard(obj.gvc.bindView(() => {
|
|
870
|
+
var _a;
|
|
871
|
+
let loading = true;
|
|
872
|
+
let dataList = [];
|
|
873
|
+
postMD.designated_logistics = (_a = postMD.designated_logistics) !== null && _a !== void 0 ? _a : { group: '' };
|
|
874
|
+
return {
|
|
875
|
+
bind: 'designatedLogistics',
|
|
876
|
+
view: () => {
|
|
877
|
+
if (loading) {
|
|
878
|
+
return '';
|
|
879
|
+
}
|
|
880
|
+
return html ` <div class="tx_700">指定物流配送方式</div>
|
|
762
881
|
${BgWidget.mbContainer(18)}
|
|
763
882
|
${gvc.bindView(() => {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
883
|
+
const id = gvc.glitter.getUUID();
|
|
884
|
+
return {
|
|
885
|
+
bind: id,
|
|
886
|
+
view: () => {
|
|
887
|
+
return html `
|
|
769
888
|
<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
770
889
|
${BgWidget.selectFilter({
|
|
890
|
+
gvc: gvc,
|
|
891
|
+
callback: text => {
|
|
892
|
+
postMD.designated_logistics.type = text;
|
|
893
|
+
gvc.notifyDataChange(id);
|
|
894
|
+
},
|
|
895
|
+
default: postMD.designated_logistics.type,
|
|
896
|
+
options: [
|
|
897
|
+
{
|
|
898
|
+
key: 'all',
|
|
899
|
+
value: '全部',
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
key: 'designated',
|
|
903
|
+
value: '指定物流群組',
|
|
904
|
+
},
|
|
905
|
+
].filter(item => {
|
|
906
|
+
return !(item.key === 'designated' && dataList.length === 0);
|
|
907
|
+
}),
|
|
908
|
+
style: 'width: 100%;',
|
|
909
|
+
})}
|
|
910
|
+
<div>
|
|
911
|
+
${(() => {
|
|
912
|
+
switch (postMD.designated_logistics.type) {
|
|
913
|
+
case 'designated':
|
|
914
|
+
return BgWidget.selectDropList({
|
|
771
915
|
gvc: gvc,
|
|
772
|
-
callback:
|
|
773
|
-
postMD.designated_logistics.
|
|
916
|
+
callback: (value) => {
|
|
917
|
+
postMD.designated_logistics.group = value;
|
|
774
918
|
gvc.notifyDataChange(id);
|
|
775
919
|
},
|
|
776
|
-
default: postMD.designated_logistics.
|
|
777
|
-
options:
|
|
778
|
-
{
|
|
779
|
-
key:
|
|
780
|
-
value:
|
|
781
|
-
}
|
|
782
|
-
{
|
|
783
|
-
key: 'designated',
|
|
784
|
-
value: '指定物流群組',
|
|
785
|
-
},
|
|
786
|
-
].filter(item => {
|
|
787
|
-
return !(item.key === 'designated' && dataList.length === 0);
|
|
920
|
+
default: postMD.designated_logistics.group || [],
|
|
921
|
+
options: dataList.map((data) => {
|
|
922
|
+
return {
|
|
923
|
+
key: data.key,
|
|
924
|
+
value: data.name,
|
|
925
|
+
};
|
|
788
926
|
}),
|
|
789
927
|
style: 'width: 100%;',
|
|
790
|
-
})
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
return BgWidget.selectDropList({
|
|
796
|
-
gvc: gvc,
|
|
797
|
-
callback: (value) => {
|
|
798
|
-
postMD.designated_logistics.group = value;
|
|
799
|
-
gvc.notifyDataChange(id);
|
|
800
|
-
},
|
|
801
|
-
default: postMD.designated_logistics.group || [],
|
|
802
|
-
options: dataList.map((data) => {
|
|
803
|
-
return {
|
|
804
|
-
key: data.key,
|
|
805
|
-
value: data.name,
|
|
806
|
-
};
|
|
807
|
-
}),
|
|
808
|
-
style: 'width: 100%;',
|
|
809
|
-
});
|
|
810
|
-
default:
|
|
811
|
-
return '';
|
|
812
|
-
}
|
|
813
|
-
})()}
|
|
928
|
+
});
|
|
929
|
+
default:
|
|
930
|
+
return '';
|
|
931
|
+
}
|
|
932
|
+
})()}
|
|
814
933
|
</div>
|
|
815
934
|
</div>
|
|
816
935
|
`;
|
|
817
|
-
},
|
|
818
|
-
};
|
|
819
|
-
})}`;
|
|
820
|
-
},
|
|
821
|
-
onCreate: () => {
|
|
822
|
-
if (loading) {
|
|
823
|
-
ApiUser.getPublicConfig('logistics_group', 'manager').then(r => {
|
|
824
|
-
dataList = (() => {
|
|
825
|
-
try {
|
|
826
|
-
return r.response.value;
|
|
827
|
-
}
|
|
828
|
-
catch (error) {
|
|
829
|
-
return dataList;
|
|
830
|
-
}
|
|
831
|
-
})();
|
|
832
|
-
loading = false;
|
|
833
|
-
gvc.notifyDataChange('designatedLogistics');
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
936
|
},
|
|
837
937
|
};
|
|
838
|
-
})
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
938
|
+
})}`;
|
|
939
|
+
},
|
|
940
|
+
onCreate: () => {
|
|
941
|
+
if (loading) {
|
|
942
|
+
ApiUser.getPublicConfig('logistics_group', 'manager').then(r => {
|
|
943
|
+
dataList = (() => {
|
|
944
|
+
try {
|
|
945
|
+
return r.response.value;
|
|
946
|
+
}
|
|
947
|
+
catch (error) {
|
|
948
|
+
return dataList;
|
|
949
|
+
}
|
|
950
|
+
})();
|
|
951
|
+
loading = false;
|
|
952
|
+
gvc.notifyDataChange('designatedLogistics');
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
},
|
|
956
|
+
};
|
|
957
|
+
}))
|
|
958
|
+
: '';
|
|
959
|
+
}
|
|
960
|
+
function drawRelateProductSection() {
|
|
961
|
+
return BgWidget.mainCard(obj.gvc.bindView(() => {
|
|
962
|
+
const id = gvc.glitter.getUUID();
|
|
963
|
+
return {
|
|
964
|
+
bind: id,
|
|
965
|
+
view: () => {
|
|
966
|
+
var _a;
|
|
967
|
+
postMD.relative_product = (_a = postMD.relative_product) !== null && _a !== void 0 ? _a : [];
|
|
968
|
+
try {
|
|
969
|
+
return html `
|
|
849
970
|
<div style="font-weight: 700;" class="mb-3 d-flex flex-column">
|
|
850
971
|
相關商品 ${BgWidget.grayNote('相關商品將會顯示於商品頁底部')}
|
|
851
972
|
</div>
|
|
@@ -857,155 +978,174 @@ export class ShoppingSettingAdvance {
|
|
|
857
978
|
<div class="tx_normal">商品列表</div>
|
|
858
979
|
</div>
|
|
859
980
|
${BgWidget.grayButton('選擇商品', gvc.event(() => {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
981
|
+
BgProduct.productsDialog({
|
|
982
|
+
gvc: gvc,
|
|
983
|
+
default: postMD.relative_product,
|
|
984
|
+
callback: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
985
|
+
postMD.relative_product = value;
|
|
986
|
+
gvc.notifyDataChange(id);
|
|
987
|
+
}),
|
|
988
|
+
filter: dd => dd.key !== postMD.id,
|
|
989
|
+
});
|
|
990
|
+
}), { textStyle: 'font-weight: 400;' })}
|
|
870
991
|
</div>
|
|
871
992
|
${gvc.bindView(() => {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
993
|
+
const vm = {
|
|
994
|
+
id: gvc.glitter.getUUID(),
|
|
995
|
+
loading: true,
|
|
996
|
+
data: [],
|
|
997
|
+
};
|
|
998
|
+
BgProduct.getProductOpts(postMD.relative_product).then(res => {
|
|
999
|
+
vm.data = res;
|
|
1000
|
+
vm.loading = false;
|
|
1001
|
+
gvc.notifyDataChange(vm.id);
|
|
1002
|
+
});
|
|
1003
|
+
return {
|
|
1004
|
+
bind: vm.id,
|
|
1005
|
+
view: () => __awaiter(this, void 0, void 0, function* () {
|
|
1006
|
+
if (vm.loading) {
|
|
1007
|
+
return BgWidget.spinner();
|
|
1008
|
+
}
|
|
1009
|
+
return vm.data
|
|
1010
|
+
.map((opt, index) => {
|
|
1011
|
+
return html ` <div
|
|
891
1012
|
class="d-flex align-items-center form-check-label c_updown_label gap-3"
|
|
892
1013
|
>
|
|
893
1014
|
<span class="tx_normal">${index + 1} .</span>
|
|
894
1015
|
${BgWidget.validImageBox({
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
1016
|
+
gvc: gvc,
|
|
1017
|
+
image: opt.image,
|
|
1018
|
+
width: 40,
|
|
1019
|
+
})}
|
|
899
1020
|
<div class="tx_normal ${opt.note ? 'mb-1' : ''}">${opt.value}</div>
|
|
900
1021
|
${opt.note ? html ` <div class="tx_gray_12">${opt.note}</div> ` : ''}
|
|
901
1022
|
</div>`;
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1023
|
+
})
|
|
1024
|
+
.join('');
|
|
1025
|
+
}),
|
|
1026
|
+
divCreate: {
|
|
1027
|
+
class: `d-flex py-2 flex-column`,
|
|
1028
|
+
style: `gap:10px;`,
|
|
1029
|
+
},
|
|
1030
|
+
};
|
|
1031
|
+
})}
|
|
911
1032
|
`;
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1033
|
+
}
|
|
1034
|
+
catch (e) {
|
|
1035
|
+
console.error(e);
|
|
1036
|
+
return '';
|
|
1037
|
+
}
|
|
1038
|
+
},
|
|
1039
|
+
divCreate: {
|
|
1040
|
+
class: `w-100`,
|
|
1041
|
+
},
|
|
1042
|
+
};
|
|
1043
|
+
}));
|
|
1044
|
+
}
|
|
1045
|
+
function drawNoticeSection() {
|
|
1046
|
+
return BgWidget.mainCard(obj.gvc.bindView(() => {
|
|
1047
|
+
const id = gvc.glitter.getUUID();
|
|
1048
|
+
return {
|
|
1049
|
+
bind: id,
|
|
1050
|
+
view: () => {
|
|
1051
|
+
var _a, _b;
|
|
1052
|
+
postMD.relative_product = (_a = postMD.relative_product) !== null && _a !== void 0 ? _a : [];
|
|
1053
|
+
try {
|
|
1054
|
+
return html `
|
|
932
1055
|
<div style="font-weight: 700;" class="mb-3 d-flex flex-column">
|
|
933
1056
|
${carTitle}通知 ${BgWidget.grayNote(`購買此${carTitle}會收到的通知信,內容為空則不寄送。`)}
|
|
934
1057
|
</div>
|
|
935
1058
|
${BgWidget.richTextEditor({
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
},
|
|
941
|
-
title: '內容編輯',
|
|
942
|
-
quick_insert: BgWidget.richTextQuickList.filter(item => {
|
|
943
|
-
return !['訂單號碼', '訂單金額'].includes(item.title);
|
|
944
|
-
}),
|
|
945
|
-
})}
|
|
946
|
-
`;
|
|
947
|
-
}
|
|
948
|
-
catch (e) {
|
|
949
|
-
console.error(e);
|
|
950
|
-
return '';
|
|
951
|
-
}
|
|
952
|
-
},
|
|
953
|
-
divCreate: {
|
|
954
|
-
class: `w-100`,
|
|
1059
|
+
gvc: gvc,
|
|
1060
|
+
content: (_b = postMD.email_notice) !== null && _b !== void 0 ? _b : '',
|
|
1061
|
+
callback: content => {
|
|
1062
|
+
postMD.email_notice = content;
|
|
955
1063
|
},
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1064
|
+
title: '內容編輯',
|
|
1065
|
+
quick_insert: BgWidget.richTextQuickList.filter(item => {
|
|
1066
|
+
return !['訂單號碼', '訂單金額'].includes(item.title);
|
|
1067
|
+
}),
|
|
1068
|
+
})}
|
|
1069
|
+
`;
|
|
1070
|
+
}
|
|
1071
|
+
catch (e) {
|
|
1072
|
+
console.error(e);
|
|
1073
|
+
return '';
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
divCreate: {
|
|
1077
|
+
class: `w-100`,
|
|
1078
|
+
},
|
|
1079
|
+
};
|
|
1080
|
+
}));
|
|
1081
|
+
}
|
|
1082
|
+
function drawAIDesSection() {
|
|
1083
|
+
return BgWidget.mainCard(obj.gvc.bindView(() => {
|
|
1084
|
+
const id = obj.gvc.glitter.getUUID();
|
|
1085
|
+
return {
|
|
1086
|
+
bind: id,
|
|
1087
|
+
view: () => {
|
|
1088
|
+
return [
|
|
1089
|
+
html ` <div class="title-container px-0">
|
|
965
1090
|
<div style="color:#393939;font-weight: 700;">AI 選品</div>
|
|
966
1091
|
<div class="flex-fill"></div>
|
|
967
1092
|
${BgWidget.grayButton('設定描述語句', gvc.event(() => {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1093
|
+
let description = postMD.ai_description;
|
|
1094
|
+
BgWidget.settingDialog({
|
|
1095
|
+
gvc: gvc,
|
|
1096
|
+
title: '描述語句',
|
|
1097
|
+
innerHTML: gvc => {
|
|
1098
|
+
return BgWidget.textArea({
|
|
1099
|
+
gvc: gvc,
|
|
1100
|
+
title: '',
|
|
1101
|
+
default: postMD.ai_description || '',
|
|
1102
|
+
placeHolder: `請告訴我這是什麼商品,範例:現代極簡風格的淺灰色布藝沙發,可以同時乘坐3個人,配金屬腳座,採用鈦合金製作十分的堅固。`,
|
|
1103
|
+
callback: text => {
|
|
1104
|
+
description = text;
|
|
1105
|
+
},
|
|
1106
|
+
style: `min-height:100px;`,
|
|
1107
|
+
});
|
|
1108
|
+
},
|
|
1109
|
+
footer_html: gvc => {
|
|
1110
|
+
return [
|
|
1111
|
+
BgWidget.save(gvc.event(() => {
|
|
1112
|
+
postMD.ai_description = description;
|
|
1113
|
+
gvc.notifyDataChange(id);
|
|
1114
|
+
gvc.closeDialog();
|
|
1115
|
+
})),
|
|
1116
|
+
].join('');
|
|
1117
|
+
},
|
|
1118
|
+
});
|
|
1119
|
+
}), {
|
|
1120
|
+
textStyle: 'width:100%;',
|
|
1121
|
+
})}
|
|
997
1122
|
</div>`,
|
|
998
|
-
|
|
1123
|
+
html `
|
|
999
1124
|
<div>
|
|
1000
1125
|
${postMD.ai_description
|
|
1001
|
-
|
|
1002
|
-
|
|
1126
|
+
? `您設定的描述語句:${postMD.ai_description}`
|
|
1127
|
+
: BgWidget.grayNote('尚未設定描述語句,透過設定描述語句,可以幫助AI更準確的定位產品。')}
|
|
1003
1128
|
</div>
|
|
1004
1129
|
`,
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1130
|
+
].join(BgWidget.mbContainer(18));
|
|
1131
|
+
},
|
|
1132
|
+
};
|
|
1133
|
+
}));
|
|
1134
|
+
}
|
|
1135
|
+
return BgWidget.container(gvc.bindView(() => {
|
|
1136
|
+
return {
|
|
1137
|
+
bind: id,
|
|
1138
|
+
view: () => {
|
|
1139
|
+
return [
|
|
1140
|
+
drawReverseSection(),
|
|
1141
|
+
drawTagSection(),
|
|
1142
|
+
drawBuyLimit(),
|
|
1143
|
+
drawTaxSection(),
|
|
1144
|
+
drawSpecialPriceSection(),
|
|
1145
|
+
drawLogisticsSection(),
|
|
1146
|
+
drawRelateProductSection(),
|
|
1147
|
+
drawNoticeSection(),
|
|
1148
|
+
drawAIDesSection(),
|
|
1009
1149
|
]
|
|
1010
1150
|
.filter(Boolean)
|
|
1011
1151
|
.join(html ` <div class="my-3"></div>`);
|