新增批发云市场

This commit is contained in:
weipengfei 2024-03-30 13:42:44 +08:00
parent 4843d46b80
commit a5290e30e2
2 changed files with 184 additions and 17 deletions

View File

@ -499,7 +499,7 @@ import { Toast } from '../../../libs/uniApi';
}) })
}, },
merClassifly() { merClassifly() {
merClassifly(259).then(res => { merClassifly().then(res => {
this.store_category = [{ this.store_category = [{
category_name: '全部', category_name: '全部',
merchant_category_id: '', merchant_category_id: '',

View File

@ -207,6 +207,56 @@
height: 305rpx; height: 305rpx;
} }
} }
.goods_list {
.goods {
width: 690rpx;
height: 200rpx;
margin: 30rpx auto;
margin-top: 0;
background-color: #fff;
border-radius: 24rpx;
display: flex;
.avatar {
height: 160rpx;
width: 160rpx;
margin: 20rpx;
border-radius: 12rpx;
overflow: hidden;
position: relative;
}
.content {
margin: 20rpx 0;
width: 470rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.content-head {
width: 470rpx;
display: flex;
justify-content: space-between;
align-items: flex-end;
font-size: 28rpx;
color: #333;
.title {
width: 360rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.content-two {
display: flex;
font-size: 24rpx;
color: #666;
}
}
}
}
</style> </style>
<template> <template>
<view class="wholeSale"> <view class="wholeSale">
@ -231,6 +281,8 @@
<!-- 内容 --> <!-- 内容 -->
<view class="wholeSale-con" style="padding-top: calc(var(--status-bar-height) + 120rpx);"> <view class="wholeSale-con" style="padding-top: calc(var(--status-bar-height) + 120rpx);">
<u-subsection v-if="tabsCurr==2" :list="subList" @change="changeSub" :current="subCurr" mode="subsection" activeColor="#40ae36" fontSize="14" style="margin-bottom: 24rpx;"></u-subsection>
<view class="wholeSale-nav"> <view class="wholeSale-nav">
<!-- <u-icon class="icon" name="arrow-left" size="20" @click="navBack"></u-icon> --> <!-- <u-icon class="icon" name="arrow-left" size="20" @click="navBack"></u-icon> -->
<!-- 搜索 --> <!-- 搜索 -->
@ -252,18 +304,29 @@
<block v-for="(item,index) in store_category" :key="index"> <block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}" <view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)"> @click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx" shape="circle"> <block v-if="subCurr!=0 || (subCurr==0 && tabsCurr!=2)">
<template v-slot:loading> <u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx" shape="circle">
<u-loading-icon color="#999" size="15" /> <template v-slot:loading>
</template> <u-loading-icon color="#999" size="15" />
</u--image> </template>
<text class="category-item-text">{{item.cate_name}}</text> </u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</block>
<block v-else>
<u--image class="category-item-img" width="108rpx" :src="item.background" height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.category_name}}</text>
</block>
</view> </view>
</block> </block>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 商品小分类 --> <!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1"> <view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true"> <scroll-view scroll-x="true">
@ -279,7 +342,7 @@
</view> </view>
<!-- 综合查询 --> <!-- 综合查询 -->
<view class="comprehensive"> <view class="comprehensive" v-if="subCurr!=0 || (subCurr==0 && tabsCurr!=2)">
<view class="comprehensive-price" :class="{'comp-color': orderCurr==1}" @click="toOrder('price', 1)"> <view class="comprehensive-price" :class="{'comp-color': orderCurr==1}" @click="toOrder('price', 1)">
<text>价格</text> <text>价格</text>
<image v-if="orderCurr==1" style="width: 15rpx;height: 21rpx;" <image v-if="orderCurr==1" style="width: 15rpx;height: 21rpx;"
@ -300,7 +363,7 @@
</view> </view>
</view> </view>
<!-- 综合查询 --> <!-- 综合查询 -->
<view class="comprehensive" v-if="deduction_rate"> <view class="comprehensive" v-if="deduction_rate && tabsCurr==1">
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}" <view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}"
@click="changeDeduction('')"> @click="changeDeduction('')">
<text>全部</text> <text>全部</text>
@ -324,7 +387,56 @@
</view> </view>
<!-- 流水瀑布 --> <!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" :sale_type="2" /> <WaterfallsFlow v-if="subCurr!=0 || (subCurr==0 && tabsCurr!=2)" :wfList='hostProduct' @itemTap="goDetail" :type="0" :sale_type="2" />
<!-- 列表 -->
<view class="goods_list">
<view class="goods" v-for="(item, index) in shopList" :key="index" @click="goStore(item.mer_id)">
<view class="avatar">
<!-- <image style="width: 100%;height: 100%;" :src="item.mer_avatar" mode="aspectFill" lazy-load>
</image> -->
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
</view>
<view class="content">
<view class="content-head">
<view class="title">{{item.mer_name}}</view>
<text style="font-size: 21.03rpx;color: #aaa;" v-if="item.sales>=100">月销{{item.sales}}</text>
</view>
<view class="content-two">
<view class="score">
<view class="star">
<view
:style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
</view>
</view>
<text style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
<text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true" src="/static/images/GXSC/SJ.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text class="address">{{item.mer_address}}</text>
</view>
</view>
</view>
</view>
<loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 40rpx 0 150rpx; 0"></loadmore> <loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 40rpx 0 150rpx; 0"></loadmore>
<view class='pictrue' v-if="!isLoading && hostProduct.length == 0"> <view class='pictrue' v-if="!isLoading && hostProduct.length == 0">
<image :src="`${domain}/static/images/noCart.png`"></image> <image :src="`${domain}/static/images/noCart.png`"></image>
@ -344,7 +456,9 @@
import { import {
getStoreCategory, getStoreCategory,
getProductslist, getProductslist,
getCategoryIndexList getCategoryIndexList,
merClassifly,
storeMerchantList
} from "@/api/store.js" } from "@/api/store.js"
import customTab from '@/components/customTab'; import customTab from '@/components/customTab';
import { import {
@ -379,12 +493,16 @@
name: '名优特产批发', name: '名优特产批发',
val: 3 val: 3
}], }],
tabsCurr: 1, tabsCurr: 2,
orderCurr: 3, // orderCurr: 3, //
subList: ['批发商户', '批发市场'],
subCurr: 0,
newData: {}, newData: {},
activeRouter: '', activeRouter: '',
hostProduct: [], hostProduct: [],
shopList: [], //
store_category: [], // store_category: [], //
store_category_shop: [], //
store_category_children: [], // store_category_children: [], //
cate_change: 0, cate_change: 0,
cate_change_children: 0, cate_change_children: 0,
@ -411,23 +529,39 @@
}, },
onLoad() { onLoad() {
this.getNav(); this.getNav();
this.getStoreCategory(); this.initData();
this.getProductslist(true);
}, },
onPageScroll() { onPageScroll() {
uni.$emit('scroll'); uni.$emit('scroll');
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.getProductslist(true, true); this.initData(true, true);
}, },
onReachBottom() { onReachBottom() {
this.getProductslist(); this.initData();
}, },
methods: { methods: {
initData(re, stop){
if(!stop) this.getStoreCategory();
if (this.tabsCurr==2&&this.subCurr==0) this.storeMerchantList(re, stop);
else this.getProductslist(re, stop);
},
changeDeduction(e) { changeDeduction(e) {
this.where.deduction_rate = e; this.where.deduction_rate = e;
this.getProductslist(true); this.getProductslist(true);
}, },
changeSub(e){
this.where = {
page: 1,
limit: this.where.limit,
sale_type: this.where.sale_type,
keyword: this.where.keyword,
}
this.cate_change = 0;
this.cate_change_children = 0;
this.subCurr = e;
this.initData(true);
},
toOrder(type, index = -1) { toOrder(type, index = -1) {
this.orderCurr = index; this.orderCurr = index;
if (type == 'price') { if (type == 'price') {
@ -477,6 +611,10 @@
changeCate(e) { changeCate(e) {
this.cate_change = e; this.cate_change = e;
this.store_category_children = []; this.store_category_children = [];
if(this.tabsCurr==2&&this.subCurr==0) {
this.where.merchant_category_id = this.store_category[e].merchant_category_id;
return this.storeMerchantList(true);
}
if (this.store_category[e].children) this.store_category_children = [...this.store_category[e].children]; if (this.store_category[e].children) this.store_category_children = [...this.store_category[e].children];
this.store_category_children.unshift({ this.store_category_children.unshift({
cate_name: '全部', cate_name: '全部',
@ -502,6 +640,13 @@
if (this.tabsCurr == 1) getStoreCategory(259).then(res => { if (this.tabsCurr == 1) getStoreCategory(259).then(res => {
this.initStoreCate(res); this.initStoreCate(res);
}) })
if (this.tabsCurr == 2 && this.subCurr==0) merClassifly().then(res => {
this.store_category = [{
category_name: '全部',
merchant_category_id: '',
background: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/de2be202312151001024597.png'
}, ...res.data];
})
else getCategoryIndexList().then(res => { else getCategoryIndexList().then(res => {
this.initStoreCate(res); this.initStoreCate(res);
}) })
@ -535,6 +680,22 @@
this.where.page++; this.where.page++;
}) })
}, },
storeMerchantList(reLoad = false, stop) {
if(reLoad){
this.where.page = 1;
this.shopList = [];
this.isLoading = 0;
}
if(this.isLoading==-1)return;
this.isLoading = 1;
storeMerchantList(this.where).then(res => {
if(stop) uni.stopPullDownRefresh()
this.shopList = [...this.shopList, ...res.data.list];
this.isLoading = 0;
if(res.data.list.length<this.where.limit) this.isLoading = -1;
this.where.page++;
})
},
goDetail(item) { goDetail(item) {
goShopDetail(item, this.uid, 2).then(res => { goShopDetail(item, this.uid, 2).then(res => {
if (this.isLogin) { if (this.isLogin) {
@ -554,7 +715,13 @@
toLogin(); toLogin();
} }
}) })
} },
//
goStore(id) {
uni.navigateTo({
url: `/pages/store/home/index?id=${id}&sale_type=${this.where.sale_type}`
})
},
} }
} }
</script> </script>