ts-glitter 13.9.8 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lowcode/Entry.js +2 -2
- package/lowcode/Entry.ts +2 -2
- package/lowcode/backend-manager/bg-product.js +49 -21
- package/lowcode/backend-manager/bg-product.ts +81 -50
- package/lowcode/cms-plugin/shopping-market-america.js +103 -0
- package/lowcode/cms-plugin/shopping-market-america.ts +117 -0
- package/lowcode/cms-plugin/shopping-product-setting.js +1287 -1453
- package/lowcode/cms-plugin/shopping-product-setting.ts +3927 -4093
- package/lowcode/jspage/function-page/setting_editor.js +9 -0
- package/lowcode/jspage/function-page/setting_editor.ts +10 -0
- package/lowcode/public-components/checkout/index.js +205 -179
- package/lowcode/public-components/checkout/index.ts +257 -231
- package/package.json +1 -1
- package/src/api-public/services/auto-send-email.js.map +1 -1
- package/src/api-public/services/shopping.d.ts +2 -1
- package/src/api-public/services/shopping.js +30 -29
- package/src/api-public/services/shopping.js.map +1 -5
- package/src/api-public/services/shopping.ts +64 -30
- package/src/api-public/services/sms.js.map +1 -1
package/lowcode/Entry.js
CHANGED
|
@@ -70,7 +70,7 @@ export class Entry {
|
|
|
70
70
|
}
|
|
71
71
|
window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
|
|
72
72
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
73
|
-
glitter.share.editerVersion = '
|
|
73
|
+
glitter.share.editerVersion = 'V_14.0.1';
|
|
74
74
|
glitter.share.start = new Date();
|
|
75
75
|
const vm = {
|
|
76
76
|
appConfig: [],
|
|
@@ -572,7 +572,7 @@ export class Entry {
|
|
|
572
572
|
function loopVersion() {
|
|
573
573
|
ApiPageConfig.getGlitterVersion().then((res) => {
|
|
574
574
|
console.log('glitterVersion:', res.response.result);
|
|
575
|
-
if (!glitter.share.editerVersion.includes(res.response.result)) {
|
|
575
|
+
if (res.result && (!glitter.share.editerVersion.includes(res.response.result))) {
|
|
576
576
|
const dialog = new ShareDialog(glitter);
|
|
577
577
|
dialog.checkYesOrNot({
|
|
578
578
|
text: '新版本已發佈,是否進行更新?',
|
package/lowcode/Entry.ts
CHANGED
|
@@ -72,7 +72,7 @@ export class Entry {
|
|
|
72
72
|
}
|
|
73
73
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
74
74
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
75
|
-
glitter.share.editerVersion = '
|
|
75
|
+
glitter.share.editerVersion = 'V_14.0.1';
|
|
76
76
|
glitter.share.start = new Date();
|
|
77
77
|
const vm: {
|
|
78
78
|
appConfig: any;
|
|
@@ -645,7 +645,7 @@ export class Entry {
|
|
|
645
645
|
function loopVersion() {
|
|
646
646
|
ApiPageConfig.getGlitterVersion().then((res) => {
|
|
647
647
|
console.log('glitterVersion:', res.response.result);
|
|
648
|
-
if (!glitter.share.editerVersion.includes(res.response.result)) {
|
|
648
|
+
if (res.result && (!glitter.share.editerVersion.includes(res.response.result))) {
|
|
649
649
|
const dialog = new ShareDialog(glitter);
|
|
650
650
|
dialog.checkYesOrNot({
|
|
651
651
|
text: '新版本已發佈,是否進行更新?',
|
|
@@ -14,7 +14,7 @@ export class BgProduct {
|
|
|
14
14
|
title: '選擇商品',
|
|
15
15
|
select_data: add_items,
|
|
16
16
|
select_mode: true,
|
|
17
|
-
filter_variants: obj.filter_variants
|
|
17
|
+
filter_variants: obj.filter_variants,
|
|
18
18
|
}, 'hidden')}
|
|
19
19
|
</div>
|
|
20
20
|
<div class="c_dialog_bar">
|
|
@@ -34,6 +34,7 @@ export class BgProduct {
|
|
|
34
34
|
return obj.gvc.glitter.innerDialog((gvc) => {
|
|
35
35
|
const vm = {
|
|
36
36
|
id: obj.gvc.glitter.getUUID(),
|
|
37
|
+
ids: [],
|
|
37
38
|
loading: true,
|
|
38
39
|
checkClass: BgWidget.getCheckedClass(gvc),
|
|
39
40
|
def: JSON.parse(JSON.stringify(obj.default)),
|
|
@@ -47,7 +48,7 @@ export class BgProduct {
|
|
|
47
48
|
view: () => {
|
|
48
49
|
var _a;
|
|
49
50
|
if (vm.loading) {
|
|
50
|
-
return BgWidget.spinner()
|
|
51
|
+
return html `<div class="my-5">${BgWidget.spinner()}</div>`;
|
|
51
52
|
}
|
|
52
53
|
return html ` <div class="bg-white shadow rounded-3" style="width: 100%; overflow-y: auto;">
|
|
53
54
|
<div class="w-100 d-flex align-items-center p-3 border-bottom">
|
|
@@ -81,16 +82,39 @@ export class BgProduct {
|
|
|
81
82
|
options: FilterOptions.productOrderBy,
|
|
82
83
|
})}
|
|
83
84
|
</div>
|
|
84
|
-
${obj.gvc.map(vm.options
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
${obj.gvc.map(vm.options
|
|
86
|
+
.filter((dd) => {
|
|
87
|
+
return !obj.filter || obj.filter(dd);
|
|
88
|
+
})
|
|
89
|
+
.map((opt, index) => {
|
|
87
90
|
const id = gvc.glitter.getUUID();
|
|
91
|
+
vm.ids.push({
|
|
92
|
+
key: opt.key,
|
|
93
|
+
id: id,
|
|
94
|
+
});
|
|
88
95
|
function call() {
|
|
89
|
-
if (obj.
|
|
90
|
-
|
|
96
|
+
if (obj.single) {
|
|
97
|
+
const tempArray = JSON.parse(JSON.stringify(obj.default));
|
|
98
|
+
const tempKey = tempArray[0];
|
|
99
|
+
obj.default = [];
|
|
100
|
+
vm.ids
|
|
101
|
+
.filter((item) => {
|
|
102
|
+
return tempArray.includes(item.key);
|
|
103
|
+
})
|
|
104
|
+
.map((item) => {
|
|
105
|
+
gvc.notifyDataChange(item.id);
|
|
106
|
+
});
|
|
107
|
+
if (tempKey !== opt.key) {
|
|
108
|
+
obj.default = [opt.key];
|
|
109
|
+
}
|
|
91
110
|
}
|
|
92
111
|
else {
|
|
93
|
-
obj.default.
|
|
112
|
+
if (obj.default.includes(opt.key)) {
|
|
113
|
+
obj.default = obj.default.filter((item) => item !== opt.key);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
obj.default.push(opt.key);
|
|
117
|
+
}
|
|
94
118
|
}
|
|
95
119
|
gvc.notifyDataChange(id);
|
|
96
120
|
}
|
|
@@ -99,22 +123,25 @@ export class BgProduct {
|
|
|
99
123
|
bind: id,
|
|
100
124
|
view: () => {
|
|
101
125
|
return html `<input
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
class="form-check-input mt-0 ${vm.checkClass}"
|
|
127
|
+
type="checkbox"
|
|
128
|
+
id="${opt.key}"
|
|
129
|
+
name="radio_${vm.id}_${index}"
|
|
130
|
+
onclick="${obj.gvc.event(() => call())}"
|
|
131
|
+
${obj.default.includes(opt.key) ? 'checked' : ''}
|
|
132
|
+
/>
|
|
133
|
+
<div
|
|
134
|
+
class="d-flex align-items-center form-check-label c_updown_label cursor_pointer gap-3"
|
|
135
|
+
onclick="${obj.gvc.event(() => call())}"
|
|
136
|
+
>
|
|
137
|
+
${BgWidget.validImageBox({
|
|
111
138
|
gvc: gvc,
|
|
112
139
|
image: opt.image,
|
|
113
140
|
width: 40,
|
|
114
141
|
})}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
142
|
+
<div class="tx_normal ${opt.note ? 'mb-1' : ''}">${opt.value}</div>
|
|
143
|
+
${opt.note ? html ` <div class="tx_gray_12">${opt.note}</div> ` : ''}
|
|
144
|
+
</div>`;
|
|
118
145
|
},
|
|
119
146
|
divCreate: {
|
|
120
147
|
class: `d-flex align-items-center`,
|
|
@@ -159,10 +186,11 @@ export class BgProduct {
|
|
|
159
186
|
return '';
|
|
160
187
|
}
|
|
161
188
|
})(),
|
|
162
|
-
productType: obj.productType
|
|
189
|
+
productType: obj.productType,
|
|
163
190
|
}).then((data) => {
|
|
164
191
|
vm.options = data.response.data.map((product) => {
|
|
165
192
|
var _a;
|
|
193
|
+
console.log(product.content);
|
|
166
194
|
return {
|
|
167
195
|
key: product.content.id,
|
|
168
196
|
value: product.content.title,
|
|
@@ -19,18 +19,22 @@ type CollectionItem = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export class BgProduct {
|
|
22
|
-
static variantsSelector(obj: { gvc: GVC; title?: string; filter_variants: string[]; callback: (value: any) => void
|
|
22
|
+
static variantsSelector(obj: { gvc: GVC; title?: string; filter_variants: string[]; callback: (value: any) => void; show_mode: 'hidden' | 'all' }) {
|
|
23
23
|
let add_items: any = [];
|
|
24
24
|
return (window.parent as any).glitter.innerDialog((gvc: GVC) => {
|
|
25
25
|
return html`
|
|
26
26
|
<div class="bg-white shadow rounded-3 ">
|
|
27
27
|
<div class="px-3" style="max-height: calc(100vh - 100px);overflow-y: auto;">
|
|
28
|
-
${StockList.main(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
${StockList.main(
|
|
29
|
+
gvc,
|
|
30
|
+
{
|
|
31
|
+
title: '選擇商品',
|
|
32
|
+
select_data: add_items,
|
|
33
|
+
select_mode: true,
|
|
34
|
+
filter_variants: obj.filter_variants,
|
|
35
|
+
},
|
|
36
|
+
'hidden'
|
|
37
|
+
)}
|
|
34
38
|
</div>
|
|
35
39
|
<div class="c_dialog_bar">
|
|
36
40
|
${BgWidget.cancel(
|
|
@@ -51,10 +55,11 @@ export class BgProduct {
|
|
|
51
55
|
}, 'variantsSelector');
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
static productsDialog(obj: { gvc: GVC; title?: string; default: (number | string)[]; callback: (value: any) => void
|
|
58
|
+
static productsDialog(obj: { gvc: GVC; title?: string; default: (number | string)[]; callback: (value: any) => void; filter?: (data: any) => boolean; productType?: string; single?: boolean }) {
|
|
55
59
|
return obj.gvc.glitter.innerDialog((gvc: GVC) => {
|
|
56
60
|
const vm = {
|
|
57
61
|
id: obj.gvc.glitter.getUUID(),
|
|
62
|
+
ids: [] as { key: string | number; id: string }[],
|
|
58
63
|
loading: true,
|
|
59
64
|
checkClass: BgWidget.getCheckedClass(gvc),
|
|
60
65
|
def: JSON.parse(JSON.stringify(obj.default)),
|
|
@@ -68,7 +73,7 @@ export class BgProduct {
|
|
|
68
73
|
bind: vm.id,
|
|
69
74
|
view: () => {
|
|
70
75
|
if (vm.loading) {
|
|
71
|
-
return BgWidget.spinner()
|
|
76
|
+
return html`<div class="my-5">${BgWidget.spinner()}</div>`;
|
|
72
77
|
}
|
|
73
78
|
return html` <div class="bg-white shadow rounded-3" style="width: 100%; overflow-y: auto;">
|
|
74
79
|
<div class="w-100 d-flex align-items-center p-3 border-bottom">
|
|
@@ -107,49 +112,74 @@ export class BgProduct {
|
|
|
107
112
|
})}
|
|
108
113
|
</div>
|
|
109
114
|
${obj.gvc.map(
|
|
110
|
-
vm.options
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
vm.options
|
|
116
|
+
.filter((dd) => {
|
|
117
|
+
return !obj.filter || obj.filter(dd);
|
|
118
|
+
})
|
|
119
|
+
.map((opt, index) => {
|
|
120
|
+
const id = gvc.glitter.getUUID();
|
|
121
|
+
vm.ids.push({
|
|
122
|
+
key: opt.key,
|
|
123
|
+
id: id,
|
|
124
|
+
});
|
|
114
125
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
126
|
+
function call() {
|
|
127
|
+
if (obj.single) {
|
|
128
|
+
const tempArray = JSON.parse(JSON.stringify(obj.default));
|
|
129
|
+
const tempKey = tempArray[0];
|
|
130
|
+
obj.default = [];
|
|
131
|
+
vm.ids
|
|
132
|
+
.filter((item) => {
|
|
133
|
+
return tempArray.includes(item.key);
|
|
134
|
+
})
|
|
135
|
+
.map((item) => {
|
|
136
|
+
gvc.notifyDataChange(item.id);
|
|
137
|
+
});
|
|
138
|
+
if (tempKey !== opt.key) {
|
|
139
|
+
obj.default = [opt.key];
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
if (obj.default.includes(opt.key)) {
|
|
143
|
+
obj.default = obj.default.filter((item) => item !== opt.key);
|
|
144
|
+
} else {
|
|
145
|
+
obj.default.push(opt.key);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
gvc.notifyDataChange(id);
|
|
120
149
|
}
|
|
121
|
-
gvc.notifyDataChange(id);
|
|
122
|
-
}
|
|
123
150
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
gvc
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
return gvc.bindView(() => {
|
|
152
|
+
return {
|
|
153
|
+
bind: id,
|
|
154
|
+
view: () => {
|
|
155
|
+
return html`<input
|
|
156
|
+
class="form-check-input mt-0 ${vm.checkClass}"
|
|
157
|
+
type="checkbox"
|
|
158
|
+
id="${opt.key}"
|
|
159
|
+
name="radio_${vm.id}_${index}"
|
|
160
|
+
onclick="${obj.gvc.event(() => call())}"
|
|
161
|
+
${obj.default.includes(opt.key) ? 'checked' : ''}
|
|
162
|
+
/>
|
|
163
|
+
<div
|
|
164
|
+
class="d-flex align-items-center form-check-label c_updown_label cursor_pointer gap-3"
|
|
165
|
+
onclick="${obj.gvc.event(() => call())}"
|
|
166
|
+
>
|
|
167
|
+
${BgWidget.validImageBox({
|
|
168
|
+
gvc: gvc,
|
|
169
|
+
image: opt.image,
|
|
170
|
+
width: 40,
|
|
171
|
+
})}
|
|
172
|
+
<div class="tx_normal ${opt.note ? 'mb-1' : ''}">${opt.value}</div>
|
|
173
|
+
${opt.note ? html` <div class="tx_gray_12">${opt.note}</div> ` : ''}
|
|
174
|
+
</div>`;
|
|
175
|
+
},
|
|
176
|
+
divCreate: {
|
|
177
|
+
class: `d-flex align-items-center`,
|
|
178
|
+
style: `gap: 24px`,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
})
|
|
153
183
|
)}
|
|
154
184
|
</div>
|
|
155
185
|
<div class="c_dialog_bar">
|
|
@@ -197,9 +227,10 @@ export class BgProduct {
|
|
|
197
227
|
return '';
|
|
198
228
|
}
|
|
199
229
|
})(),
|
|
200
|
-
productType:obj.productType
|
|
230
|
+
productType: obj.productType,
|
|
201
231
|
}).then((data) => {
|
|
202
232
|
vm.options = data.response.data.map((product: { content: { id: number; title: string; preview_image: string[] } }) => {
|
|
233
|
+
console.log(product.content);
|
|
203
234
|
return {
|
|
204
235
|
key: product.content.id,
|
|
205
236
|
value: product.content.title,
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
11
|
+
import { ApiUser } from '../glitter-base/route/user.js';
|
|
12
|
+
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
13
|
+
export class MarketAmerica {
|
|
14
|
+
static main(gvc) {
|
|
15
|
+
return (BgWidget.container(gvc.bindView(() => {
|
|
16
|
+
const id = gvc.glitter.getUUID();
|
|
17
|
+
const key = 'marketAmerica';
|
|
18
|
+
const vm = {
|
|
19
|
+
loading: true,
|
|
20
|
+
data: {
|
|
21
|
+
offer_ID: '',
|
|
22
|
+
advertiser_ID: '',
|
|
23
|
+
commission: '',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
ApiUser.getPublicConfig(key, 'manager').then((dd) => {
|
|
27
|
+
vm.loading = false;
|
|
28
|
+
dd.response.value && (vm.data = dd.response.value);
|
|
29
|
+
gvc.notifyDataChange(id);
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
bind: id,
|
|
33
|
+
view: () => {
|
|
34
|
+
if (vm.loading) {
|
|
35
|
+
return BgWidget.spinner();
|
|
36
|
+
}
|
|
37
|
+
const html = String.raw;
|
|
38
|
+
return [
|
|
39
|
+
html `<div class="title-container">
|
|
40
|
+
${BgWidget.title('美安串接')}
|
|
41
|
+
<div class="flex-fill"></div>
|
|
42
|
+
</div>`,
|
|
43
|
+
BgWidget.mbContainer(18),
|
|
44
|
+
BgWidget.mainCard(html `
|
|
45
|
+
<div class="d-flex flex-column" style="gap:12px;">
|
|
46
|
+
<div class="tx_700">注意事項</div>
|
|
47
|
+
<div>如要與美安進行同步串接,務必確認上傳之商品圖片皆為.jpg格式。</div>
|
|
48
|
+
</div>
|
|
49
|
+
`),
|
|
50
|
+
BgWidget.mbContainer(18),
|
|
51
|
+
BgWidget.container(BgWidget.mainCard([
|
|
52
|
+
html `<div class="tx_700">串接綁定</div>`,
|
|
53
|
+
BgWidget.editeInput({
|
|
54
|
+
gvc: gvc,
|
|
55
|
+
title: html `<div class="d-flex align-items-center" style="gap:10px;">Offer ID</div>`,
|
|
56
|
+
default: vm.data.offer_ID,
|
|
57
|
+
placeHolder: '請填入Offer ID',
|
|
58
|
+
callback: (text) => {
|
|
59
|
+
vm.data.offer_ID = text;
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
BgWidget.editeInput({
|
|
63
|
+
gvc: gvc,
|
|
64
|
+
title: html `<div class="d-flex align-items-center" style="gap:10px;">Advertiser ID</div>`,
|
|
65
|
+
default: vm.data.advertiser_ID,
|
|
66
|
+
placeHolder: '請填入Advertiser ID',
|
|
67
|
+
callback: (text) => {
|
|
68
|
+
vm.data.advertiser_ID = text;
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
BgWidget.editeInput({
|
|
72
|
+
gvc: gvc,
|
|
73
|
+
title: html `<div class="d-flex align-items-center" style="gap:10px;">佣金%數</div>`,
|
|
74
|
+
default: vm.data.commission,
|
|
75
|
+
type: 'number',
|
|
76
|
+
placeHolder: '請填入佣金%數',
|
|
77
|
+
callback: (text) => {
|
|
78
|
+
vm.data.commission = text;
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
].join(BgWidget.mbContainer(12)))),
|
|
82
|
+
html `<div class="update-bar-container">
|
|
83
|
+
${BgWidget.save(gvc.event(() => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
85
|
+
dialog.dataLoading({ visible: true });
|
|
86
|
+
ApiUser.setPublicConfig({
|
|
87
|
+
key: key,
|
|
88
|
+
value: vm.data,
|
|
89
|
+
user_id: 'manager',
|
|
90
|
+
}).then(() => {
|
|
91
|
+
dialog.dataLoading({ visible: false });
|
|
92
|
+
dialog.successMessage({ text: '設定成功' });
|
|
93
|
+
gvc.closeDialog();
|
|
94
|
+
});
|
|
95
|
+
})))}
|
|
96
|
+
</div>`,
|
|
97
|
+
].join('');
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
})) + BgWidget.mbContainer(120));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
window.glitter.setModule(import.meta.url, MarketAmerica);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { GVC } from '../glitterBundle/GVController.js';
|
|
2
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
3
|
+
import { ApiUser } from '../glitter-base/route/user.js';
|
|
4
|
+
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
5
|
+
|
|
6
|
+
export class MarketAmerica {
|
|
7
|
+
public static main(gvc: GVC) {
|
|
8
|
+
return (
|
|
9
|
+
BgWidget.container(
|
|
10
|
+
gvc.bindView(() => {
|
|
11
|
+
const id = gvc.glitter.getUUID();
|
|
12
|
+
const key = 'marketAmerica';
|
|
13
|
+
const vm: {
|
|
14
|
+
loading: boolean;
|
|
15
|
+
data: {
|
|
16
|
+
offer_ID:string,
|
|
17
|
+
advertiser_ID:string,
|
|
18
|
+
commission:string,
|
|
19
|
+
};
|
|
20
|
+
} = {
|
|
21
|
+
loading: true,
|
|
22
|
+
data: {
|
|
23
|
+
offer_ID: '',
|
|
24
|
+
advertiser_ID: '',
|
|
25
|
+
commission: '',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
ApiUser.getPublicConfig(key, 'manager').then((dd) => {
|
|
31
|
+
vm.loading = false;
|
|
32
|
+
dd.response.value && (vm.data = dd.response.value);
|
|
33
|
+
gvc.notifyDataChange(id);
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
bind: id,
|
|
37
|
+
view: () => {
|
|
38
|
+
if (vm.loading) {
|
|
39
|
+
return BgWidget.spinner();
|
|
40
|
+
}
|
|
41
|
+
const html = String.raw;
|
|
42
|
+
return [
|
|
43
|
+
html`<div class="title-container">
|
|
44
|
+
${BgWidget.title('美安串接')}
|
|
45
|
+
<div class="flex-fill"></div>
|
|
46
|
+
</div>`,
|
|
47
|
+
BgWidget.mbContainer(18),
|
|
48
|
+
BgWidget.mainCard(html`
|
|
49
|
+
<div class="d-flex flex-column" style="gap:12px;">
|
|
50
|
+
<div class="tx_700">注意事項</div>
|
|
51
|
+
<div>如要與美安進行同步串接,務必確認上傳之商品圖片皆為.jpg格式。</div>
|
|
52
|
+
</div>
|
|
53
|
+
`),
|
|
54
|
+
BgWidget.mbContainer(18),
|
|
55
|
+
BgWidget.container(
|
|
56
|
+
BgWidget.mainCard(
|
|
57
|
+
[
|
|
58
|
+
html`<div class="tx_700">串接綁定</div>`,
|
|
59
|
+
BgWidget.editeInput({
|
|
60
|
+
gvc: gvc,
|
|
61
|
+
title: html`<div class="d-flex align-items-center" style="gap:10px;">Offer ID</div>`,
|
|
62
|
+
default: vm.data.offer_ID,
|
|
63
|
+
placeHolder: '請填入Offer ID',
|
|
64
|
+
callback: (text) => {
|
|
65
|
+
vm.data.offer_ID = text;
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
BgWidget.editeInput({
|
|
69
|
+
gvc: gvc,
|
|
70
|
+
title: html`<div class="d-flex align-items-center" style="gap:10px;">Advertiser ID</div>`,
|
|
71
|
+
default: vm.data.advertiser_ID,
|
|
72
|
+
placeHolder: '請填入Advertiser ID',
|
|
73
|
+
callback: (text) => {
|
|
74
|
+
vm.data.advertiser_ID = text;
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
BgWidget.editeInput({
|
|
78
|
+
gvc: gvc,
|
|
79
|
+
title: html`<div class="d-flex align-items-center" style="gap:10px;">佣金%數</div>`,
|
|
80
|
+
default: vm.data.commission,
|
|
81
|
+
type: 'number',
|
|
82
|
+
placeHolder: '請填入佣金%數',
|
|
83
|
+
callback: (text) => {
|
|
84
|
+
vm.data.commission = text;
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
].join(BgWidget.mbContainer(12))
|
|
88
|
+
)
|
|
89
|
+
),
|
|
90
|
+
html`<div class="update-bar-container">
|
|
91
|
+
${BgWidget.save(
|
|
92
|
+
gvc.event(async () => {
|
|
93
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
94
|
+
dialog.dataLoading({ visible: true });
|
|
95
|
+
|
|
96
|
+
ApiUser.setPublicConfig({
|
|
97
|
+
key: key,
|
|
98
|
+
value: vm.data,
|
|
99
|
+
user_id: 'manager',
|
|
100
|
+
}).then(() => {
|
|
101
|
+
dialog.dataLoading({ visible: false });
|
|
102
|
+
dialog.successMessage({ text: '設定成功' });
|
|
103
|
+
gvc.closeDialog();
|
|
104
|
+
});
|
|
105
|
+
})
|
|
106
|
+
)}
|
|
107
|
+
</div>`,
|
|
108
|
+
].join('');
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
})
|
|
112
|
+
) + BgWidget.mbContainer(120)
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
(window as any).glitter.setModule(import.meta.url, MarketAmerica);
|