ts-glitter 16.5.2 → 16.5.3
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 +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-recommend.js +20 -287
- package/lowcode/backend-manager/bg-recommend.ts +21 -311
- package/package.json +1 -1
- package/src/api-public/services/recommend.js +4 -3
- package/src/api-public/services/recommend.js.map +1 -1
- package/src/api-public/services/recommend.ts +4 -3
- package/src/index.js +95 -92
- package/src/index.js.map +1 -1
- package/src/index.ts +89 -85
package/lowcode/Entry.js
CHANGED
|
@@ -79,7 +79,7 @@ export class Entry {
|
|
|
79
79
|
}
|
|
80
80
|
window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
|
|
81
81
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
82
|
-
glitter.share.editerVersion = 'V_16.5.
|
|
82
|
+
glitter.share.editerVersion = 'V_16.5.3';
|
|
83
83
|
glitter.share.start = new Date();
|
|
84
84
|
const vm = {
|
|
85
85
|
appConfig: [],
|
package/lowcode/Entry.ts
CHANGED
|
@@ -78,7 +78,7 @@ export class Entry {
|
|
|
78
78
|
}
|
|
79
79
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
80
80
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
81
|
-
glitter.share.editerVersion = 'V_16.5.
|
|
81
|
+
glitter.share.editerVersion = 'V_16.5.3';
|
|
82
82
|
glitter.share.start = new Date();
|
|
83
83
|
const vm: {
|
|
84
84
|
appConfig: any;
|
|
@@ -757,7 +757,6 @@ export class BgRecommend {
|
|
|
757
757
|
newOrder.productCheck.map((product, index) => {
|
|
758
758
|
var _a, _b;
|
|
759
759
|
let selectVariant = product.content.variants[parseInt((_a = product.selectIndex) !== null && _a !== void 0 ? _a : 0)];
|
|
760
|
-
console.log(`selectVariant=>`, selectVariant);
|
|
761
760
|
selectVariant.preview_image = (_b = selectVariant.preview_image) !== null && _b !== void 0 ? _b : '';
|
|
762
761
|
let productIMG = typeof selectVariant.preview_image == 'string' ? selectVariant.preview_image : selectVariant.preview_image[0];
|
|
763
762
|
productIMG = productIMG
|
|
@@ -776,33 +775,6 @@ export class BgRecommend {
|
|
|
776
775
|
<div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100%;">
|
|
777
776
|
${product.content.title}
|
|
778
777
|
</div>
|
|
779
|
-
<div class="d-flex" style="gap:8px;font-weight: 400;">
|
|
780
|
-
${(() => {
|
|
781
|
-
if (selectVariant.spec.length > 0) {
|
|
782
|
-
let tempHTML = ``;
|
|
783
|
-
selectVariant.spec.map((spec) => {
|
|
784
|
-
tempHTML += html ` <div
|
|
785
|
-
style="display: flex;height: 22px;padding: 4px 6px;justify-content: center;align-items: center;gap: 10px;border-radius: 7px;background: #EAEAEA;"
|
|
786
|
-
>
|
|
787
|
-
${spec}
|
|
788
|
-
</div>`;
|
|
789
|
-
});
|
|
790
|
-
return tempHTML;
|
|
791
|
-
}
|
|
792
|
-
else {
|
|
793
|
-
return html `
|
|
794
|
-
<div
|
|
795
|
-
style="display: flex;height: 22px;padding: 4px 6px;justify-content: center;align-items: center;gap: 10px;border-radius: 7px;background: #EAEAEA;"
|
|
796
|
-
>
|
|
797
|
-
單一規格
|
|
798
|
-
</div>
|
|
799
|
-
`;
|
|
800
|
-
}
|
|
801
|
-
})()}
|
|
802
|
-
</div>
|
|
803
|
-
<div style="color: #8D8D8D;font-size: 14px;font-weight: 400;">
|
|
804
|
-
存貨單位 (SKU): ${selectVariant.sku.length ? selectVariant.sku : 'sku未指定'}
|
|
805
|
-
</div>
|
|
806
778
|
</div>
|
|
807
779
|
</div>
|
|
808
780
|
<div
|
|
@@ -862,271 +834,32 @@ export class BgRecommend {
|
|
|
862
834
|
return html `
|
|
863
835
|
<div
|
|
864
836
|
class="w-100 d-flex justify-content-center align-items-center"
|
|
865
|
-
style="color: #36B;"
|
|
837
|
+
style="color: #36B;gap:5px;"
|
|
866
838
|
onclick="${gvc.event(() => {
|
|
867
839
|
let confirm = true;
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
newOrder.
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
搜尋商品
|
|
886
|
-
</div>
|
|
887
|
-
<div class="w-100" style="display: flex;flex-direction: column;align-items: flex-start;gap: 12px;">
|
|
888
|
-
<div
|
|
889
|
-
class="w-100"
|
|
890
|
-
style="display: flex;padding: 0px 24px;flex-direction: column;align-items: center;gap: 18px;"
|
|
891
|
-
>
|
|
892
|
-
<div
|
|
893
|
-
style="display: flex;justify-content: center;align-items: flex-start;gap: 12px;align-self: stretch;"
|
|
894
|
-
>
|
|
895
|
-
<div class="w-100 position-relative">
|
|
896
|
-
<i
|
|
897
|
-
class="fa-regular fa-magnifying-glass"
|
|
898
|
-
style="font-size: 18px; color: #A0A0A0; position: absolute; left: 18px; top: 50%; transform: translateY(-50%);"
|
|
899
|
-
aria-hidden="true"
|
|
900
|
-
></i>
|
|
901
|
-
<input
|
|
902
|
-
class="form-control h-100"
|
|
903
|
-
style="border-radius: 10px; border: 1px solid #DDD; padding-left: 50px;"
|
|
904
|
-
placeholder="輸入商品名稱或商品貨號"
|
|
905
|
-
oninput="${gvc.event((e) => {
|
|
906
|
-
searchLoading = false;
|
|
907
|
-
newOrder.query = e.value;
|
|
908
|
-
newOrder.productArray = [];
|
|
909
|
-
gvc.notifyDataChange('productArray');
|
|
910
|
-
})}"
|
|
911
|
-
value="${(_a = newOrder.query) !== null && _a !== void 0 ? _a : ''}"
|
|
912
|
-
/>
|
|
913
|
-
</div>
|
|
914
|
-
|
|
915
|
-
${BgWidget.updownFilter({
|
|
916
|
-
gvc,
|
|
917
|
-
callback: (value) => {
|
|
918
|
-
searchLoading = false;
|
|
919
|
-
newOrder.orderString = value;
|
|
920
|
-
newOrder.productArray = [];
|
|
921
|
-
gvc.notifyDataChange('productArray');
|
|
922
|
-
},
|
|
923
|
-
default: newOrder.orderString || 'default',
|
|
924
|
-
options: FilterOptions.productOrderBy,
|
|
925
|
-
})}
|
|
926
|
-
</div>
|
|
927
|
-
<div
|
|
928
|
-
style="height:350px;display: flex;justify-content: center;align-items: flex-start;padding-right: 24px;align-self: stretch;overflow-y: scroll;"
|
|
929
|
-
>
|
|
930
|
-
${gvc.bindView({
|
|
931
|
-
bind: 'productArray',
|
|
932
|
-
view: () => {
|
|
933
|
-
if (!searchLoading) {
|
|
934
|
-
ApiShop.getProduct({
|
|
935
|
-
page: 0,
|
|
936
|
-
limit: 20,
|
|
937
|
-
search: newOrder.query,
|
|
938
|
-
orderBy: newOrder.orderString,
|
|
939
|
-
}).then((data) => {
|
|
940
|
-
searchLoading = true;
|
|
941
|
-
newOrder.productArray = data.response.data;
|
|
942
|
-
gvc.notifyDataChange('productArray');
|
|
943
|
-
});
|
|
944
|
-
return BgWidget.spinner();
|
|
945
|
-
}
|
|
946
|
-
if (newOrder.productArray.length == 0) {
|
|
947
|
-
return html ` <div
|
|
948
|
-
class="w-100 h-100 d-flex align-items-center justify-content-center"
|
|
949
|
-
style="color:#8D8D8D;"
|
|
950
|
-
>
|
|
951
|
-
查無此商品
|
|
952
|
-
</div>`;
|
|
953
|
-
}
|
|
954
|
-
return newOrder.productArray
|
|
955
|
-
.map((product, productIndex) => {
|
|
956
|
-
return gvc.bindView({
|
|
957
|
-
bind: `product${productIndex}`,
|
|
958
|
-
view: () => {
|
|
959
|
-
return html `
|
|
960
|
-
${(() => {
|
|
961
|
-
if (product.select) {
|
|
962
|
-
return html ` <svg
|
|
963
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
964
|
-
width="16"
|
|
965
|
-
height="16"
|
|
966
|
-
viewBox="0 0 16 16"
|
|
967
|
-
fill="none"
|
|
968
|
-
onclick="${gvc.event(() => {
|
|
969
|
-
product.select = false;
|
|
970
|
-
gvc.notifyDataChange(`product${productIndex}`);
|
|
971
|
-
})}"
|
|
972
|
-
>
|
|
973
|
-
<rect
|
|
974
|
-
width="16"
|
|
975
|
-
height="16"
|
|
976
|
-
rx="3"
|
|
977
|
-
fill="#393939"
|
|
978
|
-
/>
|
|
979
|
-
<path
|
|
980
|
-
d="M4.5 8.5L7 11L11.5 5"
|
|
981
|
-
stroke="white"
|
|
982
|
-
stroke-width="2"
|
|
983
|
-
stroke-linecap="round"
|
|
984
|
-
stroke-linejoin="round"
|
|
985
|
-
/>
|
|
986
|
-
</svg>`;
|
|
987
|
-
}
|
|
988
|
-
else {
|
|
989
|
-
return html `
|
|
990
|
-
<div
|
|
991
|
-
style="display: flex;align-items: center;justify-content: center;height: 60px;width: 16px;cursor: pointer;"
|
|
992
|
-
onclick="${gvc.event(() => {
|
|
993
|
-
product.select = true;
|
|
994
|
-
if (product.content.variants.length > 1) {
|
|
995
|
-
product.selectIndex = window.parent.document.querySelector('.varitantSelect').value;
|
|
996
|
-
}
|
|
997
|
-
gvc.notifyDataChange(`product${productIndex}`);
|
|
998
|
-
})}"
|
|
999
|
-
>
|
|
1000
|
-
<div
|
|
1001
|
-
style="width: 16px;height: 16px;border-radius: 3px;border: 1px solid #DDD;cursor: pointer;"
|
|
1002
|
-
></div>
|
|
1003
|
-
</div>
|
|
1004
|
-
`;
|
|
1005
|
-
}
|
|
1006
|
-
})()}
|
|
1007
|
-
<div
|
|
1008
|
-
style="width: 50px;height: 50px;border-radius: 5px;background: url('${product
|
|
1009
|
-
.content
|
|
1010
|
-
.preview_image[0]}') lightgray 50% / cover no-repeat;"
|
|
1011
|
-
></div>
|
|
1012
|
-
<div class="flex-fill d-flex flex-column">
|
|
1013
|
-
<div
|
|
1014
|
-
style="color:#393939;font-size: 14px;font-weight: 400;margin-bottom: 4px;"
|
|
1015
|
-
>
|
|
1016
|
-
${product.content.title}
|
|
1017
|
-
</div>
|
|
1018
|
-
${(() => {
|
|
1019
|
-
if (product.content.variants.length > 1) {
|
|
1020
|
-
return html `
|
|
1021
|
-
<select
|
|
1022
|
-
class="w-100 d-flex align-items-center form-select varitantSelect"
|
|
1023
|
-
style="border-radius: 10px;border: 1px solid #DDD;padding: 6px 18px;"
|
|
1024
|
-
onchange="${gvc.event((e) => {
|
|
1025
|
-
product.selectIndex = e.value;
|
|
1026
|
-
})}"
|
|
1027
|
-
>
|
|
1028
|
-
${(() => {
|
|
1029
|
-
let optionHTML = ``;
|
|
1030
|
-
product.content.variants.map((variant, index) => {
|
|
1031
|
-
optionHTML += html `
|
|
1032
|
-
<option
|
|
1033
|
-
value="${index}"
|
|
1034
|
-
${(() => {
|
|
1035
|
-
if (product.selectIndex ==
|
|
1036
|
-
index)
|
|
1037
|
-
return `selected`;
|
|
1038
|
-
else
|
|
1039
|
-
return ``;
|
|
1040
|
-
})()}
|
|
1041
|
-
>
|
|
1042
|
-
${variant.spec.join(', ')}
|
|
1043
|
-
</option>
|
|
1044
|
-
`;
|
|
1045
|
-
});
|
|
1046
|
-
return optionHTML;
|
|
1047
|
-
})()}
|
|
1048
|
-
</select>
|
|
1049
|
-
`;
|
|
1050
|
-
}
|
|
1051
|
-
else {
|
|
1052
|
-
return `<div class="d-flex align-items-center" style="height: 34px;color: #8D8D8D;font-size: 14px;font-weight: 400;">單一規格</div>`;
|
|
1053
|
-
}
|
|
1054
|
-
})()}
|
|
1055
|
-
</div>
|
|
1056
|
-
`;
|
|
1057
|
-
},
|
|
1058
|
-
divCreate: {
|
|
1059
|
-
style: `display: flex;padding: 0px 12px;align-items: center;gap: 18px;align-self: stretch;`,
|
|
1060
|
-
},
|
|
1061
|
-
});
|
|
1062
|
-
})
|
|
1063
|
-
.join('');
|
|
1064
|
-
},
|
|
1065
|
-
divCreate: {
|
|
1066
|
-
class: `d-flex flex-column h-100`,
|
|
1067
|
-
style: `gap: 18px;width:100%;`,
|
|
1068
|
-
},
|
|
1069
|
-
})}
|
|
1070
|
-
</div>
|
|
1071
|
-
</div>
|
|
1072
|
-
<div
|
|
1073
|
-
class="w-100"
|
|
1074
|
-
style="display: flex;padding: 12px 20px;align-items: center;justify-content: end;gap: 10px;"
|
|
1075
|
-
>
|
|
1076
|
-
${BgWidget.cancel(gvc.event(() => {
|
|
1077
|
-
confirm = false;
|
|
1078
|
-
gvc.closeDialog();
|
|
1079
|
-
}))}
|
|
1080
|
-
${BgWidget.save(gvc.event(() => {
|
|
1081
|
-
confirm = true;
|
|
1082
|
-
newOrder.productTemp = [];
|
|
1083
|
-
newOrder.productArray.map((product) => {
|
|
1084
|
-
if (product.select) {
|
|
1085
|
-
newOrder.productTemp.push(product);
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
gvc.closeDialog();
|
|
1089
|
-
}))}
|
|
1090
|
-
</div>
|
|
1091
|
-
</div>
|
|
1092
|
-
</div>`;
|
|
1093
|
-
},
|
|
1094
|
-
divCreate: {},
|
|
1095
|
-
});
|
|
1096
|
-
}, 'addProduct', {
|
|
1097
|
-
dismiss: () => {
|
|
1098
|
-
if (confirm) {
|
|
1099
|
-
if (newOrder.productCheck.length > 0) {
|
|
1100
|
-
const updateProductCheck = (tempData) => {
|
|
1101
|
-
var _a;
|
|
1102
|
-
const productData = newOrder.productCheck.find((p) => {
|
|
1103
|
-
return p.id === tempData.id && p.selectIndex === tempData.selectIndex;
|
|
1104
|
-
});
|
|
1105
|
-
if (productData) {
|
|
1106
|
-
const index = parseInt((_a = productData.selectIndex) !== null && _a !== void 0 ? _a : '0', 10);
|
|
1107
|
-
productData.content.variants[index].qty++;
|
|
1108
|
-
tempData.add = true;
|
|
1109
|
-
}
|
|
1110
|
-
else {
|
|
1111
|
-
newOrder.productCheck.push(tempData);
|
|
1112
|
-
}
|
|
1113
|
-
};
|
|
1114
|
-
newOrder.productTemp.forEach(updateProductCheck);
|
|
1115
|
-
}
|
|
1116
|
-
else {
|
|
1117
|
-
newOrder.productCheck = newOrder.productTemp;
|
|
1118
|
-
}
|
|
1119
|
-
gvc.notifyDataChange(['listProduct', 'addProduct']);
|
|
1120
|
-
}
|
|
840
|
+
BgProduct.productsDialog({
|
|
841
|
+
gvc: gvc,
|
|
842
|
+
default: newOrder.productCheck.map((dd) => {
|
|
843
|
+
return dd.id;
|
|
844
|
+
}),
|
|
845
|
+
callback: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
846
|
+
const dialog = new ShareDialog(glitter);
|
|
847
|
+
dialog.dataLoading({ visible: true });
|
|
848
|
+
const pd = yield ApiShop.getProduct({ limit: 1000, page: 0, id_list: value.join(',') });
|
|
849
|
+
newOrder.productCheck = pd.response.data;
|
|
850
|
+
dialog.dataLoading({ visible: false });
|
|
851
|
+
gvc.notifyDataChange(id);
|
|
852
|
+
}),
|
|
853
|
+
filter: (d1) => {
|
|
854
|
+
return !newOrder.productCheck.find((dd) => {
|
|
855
|
+
return dd.id === d1;
|
|
856
|
+
});
|
|
1121
857
|
},
|
|
1122
858
|
});
|
|
1123
859
|
})}"
|
|
1124
860
|
>
|
|
1125
|
-
|
|
1126
|
-
<
|
|
1127
|
-
<path d="M1.5 7.23926H12.5" stroke="#3366BB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
1128
|
-
<path d="M6.76172 1.5L6.76172 12.5" stroke="#3366BB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
1129
|
-
</svg>
|
|
861
|
+
設定分潤商品
|
|
862
|
+
<i class="fa-duotone fa-solid fa-gear"></i>
|
|
1130
863
|
</div>
|
|
1131
864
|
`;
|
|
1132
865
|
},
|