ts-glitter 22.0.5 → 22.0.8
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 +4 -1
- package/lowcode/Entry.ts +5 -1
- package/lowcode/cms-plugin/order/order-module.ts +1 -0
- package/lowcode/cms-plugin/shopping-product-setting.js +106 -68
- package/lowcode/cms-plugin/shopping-product-setting.ts +128 -100
- package/lowcode/cms-plugin/shopping-product-stock.js +70 -0
- package/lowcode/cms-plugin/shopping-product-stock.ts +86 -0
- package/lowcode/dialog/image-preview.js +33 -0
- package/lowcode/dialog/image-preview.ts +39 -0
- package/lowcode/glitterBundle/Glitter.js +31 -0
- package/lowcode/glitterBundle/Glitter.ts +38 -0
- package/lowcode/jslib/barcode-min.js +2 -0
- package/lowcode/r.html +411 -739
- package/package.json +1 -1
package/lowcode/Entry.js
CHANGED
|
@@ -92,6 +92,9 @@ export class Entry {
|
|
|
92
92
|
location.href = shopp;
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
+
if (navigator.userAgent.includes('Googlebot')) {
|
|
96
|
+
Language.setLanguage(window.language);
|
|
97
|
+
}
|
|
95
98
|
if (window.language !== Language.getLanguage()) {
|
|
96
99
|
const url = new URL(`${glitter.root_path}${Language.getLanguageLinkPrefix()}${window.glitter_page}${new URL(location.href).search}`);
|
|
97
100
|
if (glitter.getUrlParameter('appName')) {
|
|
@@ -151,7 +154,7 @@ export class Entry {
|
|
|
151
154
|
}
|
|
152
155
|
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
|
|
153
156
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
154
|
-
glitter.share.editerVersion = 'V_22.0.
|
|
157
|
+
glitter.share.editerVersion = 'V_22.0.8';
|
|
155
158
|
glitter.share.start = new Date();
|
|
156
159
|
const vm = { appConfig: [] };
|
|
157
160
|
window.saasConfig = {
|
package/lowcode/Entry.ts
CHANGED
|
@@ -95,6 +95,10 @@ export class Entry {
|
|
|
95
95
|
location.href = shopp;
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
+
//Google爬蟲的話語言為網址連結
|
|
99
|
+
if(navigator.userAgent.includes('Googlebot')){
|
|
100
|
+
Language.setLanguage((window as any).language)
|
|
101
|
+
}
|
|
98
102
|
if ((window as any).language !== Language.getLanguage()) {
|
|
99
103
|
const url = new URL(
|
|
100
104
|
`${glitter.root_path}${Language.getLanguageLinkPrefix()}${(window as any).glitter_page}${new URL(location.href).search}`
|
|
@@ -155,7 +159,7 @@ export class Entry {
|
|
|
155
159
|
}
|
|
156
160
|
(window as any).renderClock = (window as any).renderClock ?? createClock();
|
|
157
161
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
158
|
-
glitter.share.editerVersion = 'V_22.0.
|
|
162
|
+
glitter.share.editerVersion = 'V_22.0.8';
|
|
159
163
|
glitter.share.start = new Date();
|
|
160
164
|
const vm = { appConfig: [] };
|
|
161
165
|
(window as any).saasConfig = {
|
|
@@ -779,30 +779,35 @@ export class ShoppingProductSetting {
|
|
|
779
779
|
})));
|
|
780
780
|
}
|
|
781
781
|
if (postMD.product_category === 'commodity') {
|
|
782
|
-
map_.push(BgWidget.mainCard(
|
|
783
|
-
|
|
782
|
+
map_.push(BgWidget.mainCard(gvc.bindView(() => {
|
|
783
|
+
const id = gvc.glitter.getUUID();
|
|
784
|
+
return {
|
|
785
|
+
bind: id,
|
|
786
|
+
view: () => {
|
|
787
|
+
var _b;
|
|
788
|
+
return ` <div class="d-flex flex-column" style="gap:18px;">
|
|
784
789
|
<div class="d-flex flex-column guide5-7" style="gap:18px;">
|
|
785
790
|
<div style="font-weight: 700;">商品材積</div>
|
|
786
791
|
<div class="row">
|
|
787
792
|
${[
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
793
|
+
{
|
|
794
|
+
title: '長度',
|
|
795
|
+
value: 'v_length',
|
|
796
|
+
unit: '公分',
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
title: '寬度',
|
|
800
|
+
value: 'v_width',
|
|
801
|
+
unit: '公分',
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
title: '高度',
|
|
805
|
+
value: 'v_height',
|
|
806
|
+
unit: '公分',
|
|
807
|
+
},
|
|
808
|
+
]
|
|
809
|
+
.map(dd => {
|
|
810
|
+
return html ` <div
|
|
806
811
|
style="display: flex;justify-content: center;align-items: center;gap: 10px;position: relative;"
|
|
807
812
|
class=" col-12 col-sm-4 mb-2"
|
|
808
813
|
>
|
|
@@ -812,14 +817,14 @@ export class ShoppingProductSetting {
|
|
|
812
817
|
style="border-radius: 10px;border: 1px solid #DDD;height: 40px;width: calc(100% - 50px);"
|
|
813
818
|
type="number"
|
|
814
819
|
onchange="${gvc.event(e => {
|
|
815
|
-
|
|
816
|
-
|
|
820
|
+
variant[dd.value] = e.value;
|
|
821
|
+
})}"
|
|
817
822
|
value="${variant[dd.value]}"
|
|
818
823
|
/>
|
|
819
824
|
<div style="color: #8D8D8D;position: absolute;right: 25px;top: 7px;">${dd.unit}</div>
|
|
820
825
|
</div>`;
|
|
821
|
-
|
|
822
|
-
|
|
826
|
+
})
|
|
827
|
+
.join('')}
|
|
823
828
|
</div>
|
|
824
829
|
</div>
|
|
825
830
|
<div style="font-weight: 700;">商品重量</div>
|
|
@@ -828,23 +833,38 @@ export class ShoppingProductSetting {
|
|
|
828
833
|
class="col-6"
|
|
829
834
|
style="display: flex;height: 40px;padding: 10px 18px;align-items: center;gap: 10px;border-radius: 10px;border: 1px solid #DDD;"
|
|
830
835
|
placeholder="請輸入商品重量"
|
|
831
|
-
value="${variant.weight || 0}"
|
|
836
|
+
value="${(variant.weight || 0) * (variant.unit !== 'k' ? 1 : 1000)}"
|
|
832
837
|
onchange="${gvc.event(e => {
|
|
833
|
-
|
|
834
|
-
|
|
838
|
+
variant.weight = parseFloat(e.value) * (variant.unit !== 'k' ? 1 : 0.001);
|
|
839
|
+
})}"
|
|
835
840
|
/>
|
|
841
|
+
|
|
836
842
|
<div class="col-6" style="display: flex;align-items: center;gap: 10px;">
|
|
837
843
|
<div style="white-space: nowrap;">單位</div>
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
+
${BgWidget.select({
|
|
845
|
+
title: '',
|
|
846
|
+
default: (_b = variant.unit) !== null && _b !== void 0 ? _b : 'kg',
|
|
847
|
+
callback: (value) => {
|
|
848
|
+
variant.unit = value;
|
|
849
|
+
gvc.notifyDataChange(id);
|
|
850
|
+
},
|
|
851
|
+
options: [
|
|
852
|
+
{
|
|
853
|
+
key: 'kg', value: '公斤'
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
key: 'k', value: '公克'
|
|
857
|
+
}
|
|
858
|
+
],
|
|
859
|
+
gvc: gvc
|
|
860
|
+
})}
|
|
844
861
|
</div>
|
|
845
862
|
</div>
|
|
846
|
-
</div
|
|
847
|
-
|
|
863
|
+
</div>`;
|
|
864
|
+
},
|
|
865
|
+
divCreate: {}
|
|
866
|
+
};
|
|
867
|
+
})));
|
|
848
868
|
}
|
|
849
869
|
map_.push(BgWidget.mainCard(html `
|
|
850
870
|
<div class="d-flex flex-column" style="gap: 18px;">
|
|
@@ -999,44 +1019,62 @@ export class ShoppingProductSetting {
|
|
|
999
1019
|
<div class="flex-fill"></div>
|
|
1000
1020
|
${(() => {
|
|
1001
1021
|
const ba = [];
|
|
1002
|
-
|
|
1022
|
+
ba.push(BgWidget.grayButton('一維條碼列印', gvc.event((e, event) => {
|
|
1023
|
+
event.stopPropagation();
|
|
1003
1024
|
if (window.parent.glitter.share.PayConfig.posType === 'SUNMI') {
|
|
1004
|
-
|
|
1005
|
-
IminModule.printCodeSumi(`variants-` + variant.barcode);
|
|
1006
|
-
}), { icon: `fa-solid fa-rectangle-barcode` }));
|
|
1007
|
-
ba.push(BgWidget.grayButton('QRCODE列印', gvc.event(() => {
|
|
1008
|
-
IminModule.printQrCodeSumi(`variants-` + variant.barcode);
|
|
1009
|
-
}), { icon: `fa-solid fa-qrcode` }));
|
|
1025
|
+
IminModule.printCodeSumi(`variants-` + variant.barcode);
|
|
1010
1026
|
}
|
|
1011
1027
|
else {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1028
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
1029
|
+
if (!variant.barcode) {
|
|
1030
|
+
dialog.errorMessage({ text: '請先設定商品條碼' });
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
window.parent.glitter.addMtScript([
|
|
1034
|
+
{
|
|
1035
|
+
src: gvc.glitter.root_path + 'jslib/barcode-min.js',
|
|
1036
|
+
},
|
|
1037
|
+
], () => {
|
|
1038
|
+
if (!window.parent.document.querySelector("#barcode_preview")) {
|
|
1039
|
+
window.parent.glitter.$('body').append('<svg id="barcode_preview" style="display:none;"></svg>');
|
|
1040
|
+
}
|
|
1041
|
+
window.parent.JsBarcode("#barcode_preview", variant.barcode);
|
|
1042
|
+
var svg = window.parent.glitter.$("#barcode_preview")[0];
|
|
1043
|
+
var xml = new XMLSerializer().serializeToString(svg);
|
|
1044
|
+
var base64 = 'data:image/svg+xml;base64,' + btoa(xml);
|
|
1045
|
+
gvc.glitter.ut.print_img(base64);
|
|
1046
|
+
}, () => { });
|
|
1015
1047
|
}
|
|
1016
|
-
}
|
|
1017
|
-
ba.push(BgWidget.grayButton('
|
|
1018
|
-
|
|
1019
|
-
if (
|
|
1020
|
-
|
|
1021
|
-
return;
|
|
1048
|
+
}), { icon: `fa-solid fa-rectangle-barcode` }));
|
|
1049
|
+
ba.push(BgWidget.grayButton('QRCODE列印', gvc.event((e, event) => {
|
|
1050
|
+
event.stopPropagation();
|
|
1051
|
+
if (window.parent.glitter.share.PayConfig.posType === 'SUNMI') {
|
|
1052
|
+
IminModule.printQrCodeSumi(`variants-` + variant.barcode);
|
|
1022
1053
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1054
|
+
else {
|
|
1055
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
1056
|
+
if (!variant.barcode) {
|
|
1057
|
+
dialog.errorMessage({ text: '請先設定商品條碼' });
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
window.parent.glitter.addMtScript([
|
|
1061
|
+
{
|
|
1062
|
+
src: 'https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js',
|
|
1063
|
+
},
|
|
1064
|
+
], () => {
|
|
1065
|
+
window.parent.QRCode.toDataURL(`variants-` + variant.barcode, {
|
|
1066
|
+
width: 200,
|
|
1067
|
+
margin: 2,
|
|
1068
|
+
}, function (err, url) {
|
|
1069
|
+
if (err) {
|
|
1070
|
+
console.error(err);
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
gvc.glitter.ut.print_img(url);
|
|
1074
|
+
});
|
|
1075
|
+
}, () => { });
|
|
1076
|
+
}
|
|
1077
|
+
}), { icon: `fa-solid fa-qrcode` }));
|
|
1040
1078
|
return ba.join(`<div class="mx-2"></div>`);
|
|
1041
1079
|
})()}
|
|
1042
1080
|
</div>
|
|
@@ -906,30 +906,34 @@ export class ShoppingProductSetting {
|
|
|
906
906
|
}
|
|
907
907
|
if (postMD.product_category === 'commodity') {
|
|
908
908
|
map_.push(
|
|
909
|
-
BgWidget.mainCard(
|
|
910
|
-
|
|
909
|
+
BgWidget.mainCard(gvc.bindView(()=>{
|
|
910
|
+
const id=gvc.glitter.getUUID()
|
|
911
|
+
return {
|
|
912
|
+
bind:id,
|
|
913
|
+
view:()=>{
|
|
914
|
+
return ` <div class="d-flex flex-column" style="gap:18px;">
|
|
911
915
|
<div class="d-flex flex-column guide5-7" style="gap:18px;">
|
|
912
916
|
<div style="font-weight: 700;">商品材積</div>
|
|
913
917
|
<div class="row">
|
|
914
918
|
${[
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
919
|
+
{
|
|
920
|
+
title: '長度',
|
|
921
|
+
value: 'v_length',
|
|
922
|
+
unit: '公分',
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
title: '寬度',
|
|
926
|
+
value: 'v_width',
|
|
927
|
+
unit: '公分',
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
title: '高度',
|
|
931
|
+
value: 'v_height',
|
|
932
|
+
unit: '公分',
|
|
933
|
+
},
|
|
934
|
+
]
|
|
935
|
+
.map(dd => {
|
|
936
|
+
return html` <div
|
|
933
937
|
style="display: flex;justify-content: center;align-items: center;gap: 10px;position: relative;"
|
|
934
938
|
class=" col-12 col-sm-4 mb-2"
|
|
935
939
|
>
|
|
@@ -939,14 +943,14 @@ export class ShoppingProductSetting {
|
|
|
939
943
|
style="border-radius: 10px;border: 1px solid #DDD;height: 40px;width: calc(100% - 50px);"
|
|
940
944
|
type="number"
|
|
941
945
|
onchange="${gvc.event(e => {
|
|
942
|
-
|
|
943
|
-
|
|
946
|
+
variant[dd.value] = e.value;
|
|
947
|
+
})}"
|
|
944
948
|
value="${variant[dd.value]}"
|
|
945
949
|
/>
|
|
946
950
|
<div style="color: #8D8D8D;position: absolute;right: 25px;top: 7px;">${dd.unit}</div>
|
|
947
951
|
</div>`;
|
|
948
|
-
|
|
949
|
-
|
|
952
|
+
})
|
|
953
|
+
.join('')}
|
|
950
954
|
</div>
|
|
951
955
|
</div>
|
|
952
956
|
<div style="font-weight: 700;">商品重量</div>
|
|
@@ -955,24 +959,39 @@ export class ShoppingProductSetting {
|
|
|
955
959
|
class="col-6"
|
|
956
960
|
style="display: flex;height: 40px;padding: 10px 18px;align-items: center;gap: 10px;border-radius: 10px;border: 1px solid #DDD;"
|
|
957
961
|
placeholder="請輸入商品重量"
|
|
958
|
-
value="${variant.weight || 0}"
|
|
962
|
+
value="${(variant.weight || 0) * (variant.unit!=='k' ? 1:1000)}"
|
|
959
963
|
onchange="${gvc.event(e => {
|
|
960
|
-
|
|
961
|
-
|
|
964
|
+
variant.weight = parseFloat(e.value) * (variant.unit!=='k' ? 1:0.001);
|
|
965
|
+
})}"
|
|
962
966
|
/>
|
|
967
|
+
|
|
963
968
|
<div class="col-6" style="display: flex;align-items: center;gap: 10px;">
|
|
964
969
|
<div style="white-space: nowrap;">單位</div>
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
970
|
+
${BgWidget.select({
|
|
971
|
+
title:'',
|
|
972
|
+
default:variant.unit ?? 'kg',
|
|
973
|
+
callback:(value)=>{
|
|
974
|
+
variant.unit=value;
|
|
975
|
+
gvc.notifyDataChange(id)
|
|
976
|
+
},
|
|
977
|
+
options:[
|
|
978
|
+
{
|
|
979
|
+
key:'kg',value:'公斤'
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
key:'k',value:'公克'
|
|
983
|
+
}
|
|
984
|
+
],
|
|
985
|
+
gvc:gvc
|
|
986
|
+
})}
|
|
971
987
|
</div>
|
|
972
988
|
</div>
|
|
973
|
-
</div
|
|
974
|
-
|
|
975
|
-
|
|
989
|
+
</div>`
|
|
990
|
+
},
|
|
991
|
+
divCreate:{}
|
|
992
|
+
}
|
|
993
|
+
})
|
|
994
|
+
))
|
|
976
995
|
}
|
|
977
996
|
map_.push(
|
|
978
997
|
BgWidget.mainCard(html`
|
|
@@ -1144,77 +1163,86 @@ export class ShoppingProductSetting {
|
|
|
1144
1163
|
<div class="flex-fill"></div>
|
|
1145
1164
|
${(() => {
|
|
1146
1165
|
const ba = [];
|
|
1147
|
-
if ((window.parent as any).glitter.share.PayConfig.deviceType === 'pos') {
|
|
1148
|
-
if ((window.parent as any).glitter.share.PayConfig.posType === 'SUNMI') {
|
|
1149
|
-
ba.push(
|
|
1150
|
-
BgWidget.grayButton(
|
|
1151
|
-
'ㄧ條碼列印',
|
|
1152
|
-
gvc.event(() => {
|
|
1153
|
-
IminModule.printCodeSumi(`variants-` + variant.barcode);
|
|
1154
|
-
}),
|
|
1155
|
-
{ icon: `fa-solid fa-rectangle-barcode` }
|
|
1156
|
-
)
|
|
1157
|
-
);
|
|
1158
|
-
ba.push(
|
|
1159
|
-
BgWidget.grayButton(
|
|
1160
|
-
'QRCODE列印',
|
|
1161
|
-
gvc.event(() => {
|
|
1162
|
-
IminModule.printQrCodeSumi(`variants-` + variant.barcode);
|
|
1163
|
-
}),
|
|
1164
|
-
{ icon: `fa-solid fa-qrcode` }
|
|
1165
|
-
)
|
|
1166
|
-
);
|
|
1167
|
-
} else {
|
|
1168
|
-
ba.push(
|
|
1169
|
-
BgWidget.grayButton(
|
|
1170
|
-
'條碼列印',
|
|
1171
|
-
gvc.event(() => {
|
|
1172
|
-
IminModule.printCode(`variants-` + variant.barcode);
|
|
1173
|
-
}),
|
|
1174
|
-
{ icon: `fa-solid fa-rectangle-barcode` }
|
|
1175
|
-
)
|
|
1176
|
-
);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
1166
|
ba.push(
|
|
1180
1167
|
BgWidget.grayButton(
|
|
1181
|
-
'
|
|
1182
|
-
gvc.event(() => {
|
|
1183
|
-
|
|
1184
|
-
if (
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1168
|
+
'一維條碼列印',
|
|
1169
|
+
gvc.event((e,event) => {
|
|
1170
|
+
event.stopPropagation();
|
|
1171
|
+
if ((window.parent as any).glitter.share.PayConfig.posType === 'SUNMI'){
|
|
1172
|
+
IminModule.printCodeSumi(`variants-` + variant.barcode);
|
|
1173
|
+
}else{
|
|
1174
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
1175
|
+
if (!variant.barcode) {
|
|
1176
|
+
dialog.errorMessage({ text: '請先設定商品條碼' });
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
(window.parent as any).glitter.addMtScript(
|
|
1180
|
+
[
|
|
1181
|
+
{
|
|
1182
|
+
src: gvc.glitter.root_path+'jslib/barcode-min.js',
|
|
1183
|
+
},
|
|
1184
|
+
],
|
|
1185
|
+
() => {
|
|
1186
|
+
if(! (window.parent as any).document.querySelector("#barcode_preview")){
|
|
1187
|
+
(window.parent as any).glitter.$('body').append('<svg id="barcode_preview" style="display:none;"></svg>');
|
|
1188
|
+
}
|
|
1189
|
+
(window.parent as any).JsBarcode("#barcode_preview", variant.barcode);
|
|
1190
|
+
|
|
1191
|
+
var svg = (window.parent as any).glitter.$("#barcode_preview")[0];
|
|
1192
|
+
|
|
1193
|
+
var xml = new XMLSerializer().serializeToString(svg);
|
|
1194
|
+
|
|
1195
|
+
var base64 = 'data:image/svg+xml;base64,' + btoa(xml);
|
|
1196
|
+
|
|
1197
|
+
gvc.glitter.ut.print_img(base64)
|
|
1192
1198
|
},
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1199
|
+
() => {}
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
}),
|
|
1203
|
+
{ icon: `fa-solid fa-rectangle-barcode` }
|
|
1204
|
+
)
|
|
1205
|
+
);
|
|
1206
|
+
ba.push(
|
|
1207
|
+
BgWidget.grayButton(
|
|
1208
|
+
'QRCODE列印',
|
|
1209
|
+
gvc.event((e,event) => {
|
|
1210
|
+
event.stopPropagation();
|
|
1211
|
+
if ((window.parent as any).glitter.share.PayConfig.posType === 'SUNMI'){
|
|
1212
|
+
IminModule.printQrCodeSumi(`variants-` + variant.barcode);
|
|
1213
|
+
}else{
|
|
1214
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
1215
|
+
if (!variant.barcode) {
|
|
1216
|
+
dialog.errorMessage({ text: '請先設定商品條碼' });
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
(window.parent as any).glitter.addMtScript(
|
|
1220
|
+
[
|
|
1197
1221
|
{
|
|
1198
|
-
|
|
1199
|
-
margin: 2,
|
|
1222
|
+
src: 'https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js',
|
|
1200
1223
|
},
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1224
|
+
],
|
|
1225
|
+
() => {
|
|
1226
|
+
(window.parent as any).QRCode.toDataURL(
|
|
1227
|
+
`variants-` + variant.barcode,
|
|
1228
|
+
{
|
|
1229
|
+
width: 200,
|
|
1230
|
+
margin: 2,
|
|
1231
|
+
},
|
|
1232
|
+
function (err: any, url: any) {
|
|
1233
|
+
if (err) {
|
|
1234
|
+
console.error(err);
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
gvc.glitter.ut.print_img(url)
|
|
1205
1238
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
}
|
|
1212
|
-
);
|
|
1213
|
-
},
|
|
1214
|
-
() => {}
|
|
1215
|
-
);
|
|
1239
|
+
);
|
|
1240
|
+
},
|
|
1241
|
+
() => {}
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
1216
1244
|
}),
|
|
1217
|
-
{ icon: `fa-
|
|
1245
|
+
{ icon: `fa-solid fa-qrcode` }
|
|
1218
1246
|
)
|
|
1219
1247
|
);
|
|
1220
1248
|
return ba.join(`<div class="mx-2"></div>`);
|
|
@@ -8,6 +8,7 @@ import { BgProduct } from '../backend-manager/bg-product.js';
|
|
|
8
8
|
import { ShoppingProductSetting } from './shopping-product-setting.js';
|
|
9
9
|
import { Tool } from '../modules/tool.js';
|
|
10
10
|
import { TableStorage } from './module/table-storage.js';
|
|
11
|
+
import { IminModule } from './pos-pages/imin-module.js';
|
|
11
12
|
const html = String.raw;
|
|
12
13
|
export class StockList {
|
|
13
14
|
static main(gvc, option = {
|
|
@@ -87,6 +88,75 @@ export class StockList {
|
|
|
87
88
|
dd.product_content.preview_image[0];
|
|
88
89
|
}
|
|
89
90
|
return [
|
|
91
|
+
{
|
|
92
|
+
key: '條碼列印',
|
|
93
|
+
value: `<div class="d-flex" style="gap:5px;">
|
|
94
|
+
${[
|
|
95
|
+
`<div class="c_filter_view" style="cursor:pointer;" onclick="${gvc.event((e, event) => {
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
const variant = dd.variant_content;
|
|
98
|
+
if (window.parent.glitter.share.PayConfig.posType === 'SUNMI') {
|
|
99
|
+
IminModule.printCodeSumi(`variants-` + dd.variant_content.barcode);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
103
|
+
if (!variant.barcode) {
|
|
104
|
+
dialog.errorMessage({ text: '請先設定商品條碼' });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
window.parent.glitter.addMtScript([
|
|
108
|
+
{
|
|
109
|
+
src: gvc.glitter.root_path + 'jslib/barcode-min.js',
|
|
110
|
+
},
|
|
111
|
+
], () => {
|
|
112
|
+
if (!window.parent.document.querySelector("#barcode_preview")) {
|
|
113
|
+
window.parent.glitter.$('body').append('<svg id="barcode_preview" style="display:none;"></svg>');
|
|
114
|
+
}
|
|
115
|
+
window.parent.JsBarcode("#barcode_preview", dd.variant_content.barcode);
|
|
116
|
+
var svg = window.parent.glitter.$("#barcode_preview")[0];
|
|
117
|
+
var xml = new XMLSerializer().serializeToString(svg);
|
|
118
|
+
var base64 = 'data:image/svg+xml;base64,' + btoa(xml);
|
|
119
|
+
gvc.glitter.ut.print_img(base64);
|
|
120
|
+
}, () => { });
|
|
121
|
+
}
|
|
122
|
+
})}">
|
|
123
|
+
<i class="fa-solid fa-rectangle-barcode" aria-hidden="true"></i>
|
|
124
|
+
</div>`,
|
|
125
|
+
`<div class="c_filter_view" style="cursor:pointer;" onclick="${gvc.event((e, event) => {
|
|
126
|
+
event.stopPropagation();
|
|
127
|
+
const variant = dd.variant_content;
|
|
128
|
+
if (window.parent.glitter.share.PayConfig.posType === 'SUNMI') {
|
|
129
|
+
IminModule.printQrCodeSumi(`variants-` + dd.variant_content.barcode);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
133
|
+
if (!variant.barcode) {
|
|
134
|
+
dialog.errorMessage({ text: '請先設定商品條碼' });
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
window.parent.glitter.addMtScript([
|
|
138
|
+
{
|
|
139
|
+
src: 'https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js',
|
|
140
|
+
},
|
|
141
|
+
], () => {
|
|
142
|
+
window.parent.QRCode.toDataURL(`variants-` + variant.barcode, {
|
|
143
|
+
width: 200,
|
|
144
|
+
margin: 2,
|
|
145
|
+
}, function (err, url) {
|
|
146
|
+
if (err) {
|
|
147
|
+
console.error(err);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
gvc.glitter.ut.print_img(url);
|
|
151
|
+
});
|
|
152
|
+
}, () => { });
|
|
153
|
+
}
|
|
154
|
+
})}">
|
|
155
|
+
<i class="fa-solid fa-qrcode" aria-hidden="true"></i>
|
|
156
|
+
</div>`
|
|
157
|
+
].join('')}
|
|
158
|
+
</div>`
|
|
159
|
+
},
|
|
90
160
|
{
|
|
91
161
|
key: '商品名稱',
|
|
92
162
|
value: html ` <div class="d-flex align-items-center gap-3" style="min-width: 250px;">
|