|
@@ -2319,7 +2319,24 @@ const getProductData = async (id: string) =>
|
|
|
request.post('/common/getProductsData', { id }).then((response) => {
|
|
|
const res = response.data
|
|
|
if (res.code !== 1) return
|
|
|
- // console.log(res.result)
|
|
|
+ // 推荐供应商. 用来快速选择供应商的.
|
|
|
+ if (
|
|
|
+ Array.isArray(res.result.SUPPLIER_PRICING) &&
|
|
|
+ res.result.SUPPLIER_PRICING.length
|
|
|
+ ) {
|
|
|
+ for (const item of res.result.SUPPLIER_PRICING) {
|
|
|
+ if (
|
|
|
+ item.Supplier?.id &&
|
|
|
+ !computedRecommandVendorID.value.includes(item.Supplier.id)
|
|
|
+ ) {
|
|
|
+ recommandVendor.value.push({
|
|
|
+ id: item.Supplier.id,
|
|
|
+ name: item.Supplier.name,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (userInfo.value.Organization === 'PrimePac') {
|
|
|
return '产品名称:\n尺寸:\n材质:\n工艺:\n颜色:\n其他备注:'
|
|
|
} else {
|
|
@@ -2328,14 +2345,11 @@ const getProductData = async (id: string) =>
|
|
|
})
|
|
|
|
|
|
const recommandVendor = ref<IRecommandVendor[]>([])
|
|
|
-const getRecommamdSupplier = async (id: string) =>
|
|
|
- request.post('/common/getProductsOftenLists', { id }).then((response) => {
|
|
|
- const res = response.data
|
|
|
- if (res.code !== 1) return
|
|
|
- recommandVendor.value = recommandVendor.value.concat(
|
|
|
- Array.isArray(res.result) ? res.result : [],
|
|
|
- )
|
|
|
- })
|
|
|
+// 用来去重
|
|
|
+const computedRecommandVendorID = computed(() =>
|
|
|
+ recommandVendor.value.map((i: any) => i.id),
|
|
|
+)
|
|
|
+
|
|
|
// 根据url传递过来的用户ID获取的用户身份信息
|
|
|
const userInfo = ref({} as IUser)
|
|
|
const p3 = request
|
|
@@ -2367,7 +2381,7 @@ Promise.all([
|
|
|
p2,
|
|
|
p3,
|
|
|
getAccountsData,
|
|
|
- getRecommamdSupplier(route.params.id as string),
|
|
|
+ // getRecommamdSupplier(route.params.id as string),
|
|
|
])
|
|
|
.then((array: any[]) => {
|
|
|
// console.log(array, 'all res')
|
|
@@ -2399,6 +2413,7 @@ Promise.all([
|
|
|
|
|
|
if (!temp.length) return
|
|
|
form.value.productList = []
|
|
|
+ recommandVendor.value = []
|
|
|
temp.forEach((item: any) => {
|
|
|
getProductData(item.product.id).then((ctx) => {
|
|
|
form.value.productList.push(
|