|
|
@@ -47,17 +47,23 @@
|
|
|
<div class="product-grid">
|
|
|
<div class="p-card" v-for="(p, i) in baseProducts" :key="i">
|
|
|
<div class="p-img-box">
|
|
|
- <img :src="p.image" @error="handleImgError" />
|
|
|
+ <img :src="p.image || p.productImage" @error="handleImgError" />
|
|
|
</div>
|
|
|
<div class="p-info">
|
|
|
<div class="p-name">
|
|
|
<span class="tag-zy">{{ p.isSelf == 1 ? '自营' : '非自营' }}</span>
|
|
|
- {{ p.name }}
|
|
|
+ {{ p.name || p.itemName || '' }}
|
|
|
</div>
|
|
|
<div class="p-price-row">
|
|
|
<span class="p-currency">¥</span>
|
|
|
- <span class="p-price">{{ p.price }}</span>
|
|
|
- <span class="p-decimal" v-if="p.dec !== '00'">.{{ p.dec }}</span>
|
|
|
+ <template v-if="p.price">
|
|
|
+ <span class="p-price">{{ p.price.split('.')[0] }}</span>
|
|
|
+ <span class="p-decimal">.{{ p.price.split('.')[1] }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-if="p.memberPrice">
|
|
|
+ <span class="p-price">{{ p.memberPrice.split('.')[0] }}</span>
|
|
|
+ <span class="p-decimal">.{{ p.memberPrice.split('.')[1] }}</span>
|
|
|
+ </template>
|
|
|
<span class="tag-ep">企业价</span>
|
|
|
</div>
|
|
|
<div class="p-actions">
|
|
|
@@ -69,8 +75,8 @@
|
|
|
</svg>
|
|
|
</button>
|
|
|
<button class="btn-buy" @click="onPath('/item?id=' + p.id + '&productNo=' + p.productNo)">
|
|
|
- <span class="txt-normal">加入采购清单</span>
|
|
|
- <span class="txt-hover">注册企业用户可享</span>
|
|
|
+ <span class="txt-normal">加入购物车</span>
|
|
|
+ <span class="txt-hover">加入购物车</span>
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -86,6 +92,7 @@
|
|
|
import { recommendThemeConfig } from '@/api/home/index-enterprise';
|
|
|
import { onPath } from '@/utils/siteConfig';
|
|
|
import { addProductShoppingCart } from '@/api/goods/index';
|
|
|
+import { getPcProductPage } from '@/api/search/index';
|
|
|
|
|
|
const categories = ref<any>([]);
|
|
|
const baseProducts = ref<any>([]);
|
|
|
@@ -99,7 +106,26 @@ recommendThemeConfig({}).then((res) => {
|
|
|
item.goodsList = JSON.parse(item.selectedProductIds);
|
|
|
}
|
|
|
});
|
|
|
- baseProducts.value = categories.value[0].goodsList;
|
|
|
+ if (categories.value[0].categoryPath) {
|
|
|
+ categories.value[0].pageNum = 1;
|
|
|
+ categories.value[0].pageSize = 20;
|
|
|
+ categories.value[0].topCategoryId = '';
|
|
|
+ categories.value[0].mediumCategoryId = '';
|
|
|
+ categories.value[0].bottomCategoryId = '';
|
|
|
+ const categoryList = categories.value[0].categoryPath.split(',');
|
|
|
+ if (categoryList.length > 0) {
|
|
|
+ categories.value[0].topCategoryId = categoryList[0];
|
|
|
+ }
|
|
|
+ if (categoryList.length > 1) {
|
|
|
+ categories.value[0].mediumCategoryId = categoryList[1];
|
|
|
+ }
|
|
|
+ if (categoryList.length > 2) {
|
|
|
+ categories.value[0].bottomCategoryId = categoryList[2];
|
|
|
+ }
|
|
|
+ getList();
|
|
|
+ } else {
|
|
|
+ baseProducts.value = categories.value[0].goodsList;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -110,7 +136,44 @@ const showNext = ref(true);
|
|
|
|
|
|
const onCurrentCat = (index: any) => {
|
|
|
currentCat.value = index;
|
|
|
- baseProducts.value = categories.value[index].goodsList;
|
|
|
+ if (categories.value[index].categoryPath) {
|
|
|
+ categories.value[index].pageNum = 1;
|
|
|
+ categories.value[index].pageSize = 20;
|
|
|
+ categories.value[index].topCategoryId = '';
|
|
|
+ categories.value[index].mediumCategoryId = '';
|
|
|
+ categories.value[index].bottomCategoryId = '';
|
|
|
+ const categoryList = categories.value[index].categoryPath.split(',');
|
|
|
+ if (categoryList.length > 0) {
|
|
|
+ categories.value[index].topCategoryId = categoryList[0];
|
|
|
+ }
|
|
|
+ if (categoryList.length > 1) {
|
|
|
+ categories.value[index].mediumCategoryId = categoryList[1];
|
|
|
+ }
|
|
|
+ if (categoryList.length > 2) {
|
|
|
+ categories.value[index].bottomCategoryId = categoryList[2];
|
|
|
+ }
|
|
|
+ getList();
|
|
|
+ } else {
|
|
|
+ baseProducts.value = categories.value[index].goodsList;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const getList = () => {
|
|
|
+ const datas = {
|
|
|
+ pageNum: categories.value[currentCat.value].pageNum,
|
|
|
+ pageSize: categories.value[currentCat.value].pageSize,
|
|
|
+ topCategoryId: categories.value[currentCat.value].topCategoryId,
|
|
|
+ mediumCategoryId: categories.value[currentCat.value].mediumCategoryId,
|
|
|
+ bottomCategoryId: categories.value[currentCat.value].bottomCategoryId
|
|
|
+ };
|
|
|
+ getPcProductPage(datas).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ baseProducts.value = res.rows ? res.rows : [];
|
|
|
+ // dataList.value = res.rows ? res.rows : [];
|
|
|
+ // // 判断是否还有更多数据
|
|
|
+ // hasMore.value = dataList.value.length === httpObj.value.pageSize;
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
const checkScroll = () => {
|
|
|
if (!navListRef.value) return;
|