Selaa lähdekoodia

首页品牌查询

caojunjie 1 vuosi sitten
vanhempi
commit
808e0027e8

+ 254 - 171
pages/tabBar/home.vue

@@ -4,24 +4,49 @@
 			<view style="margin: 10rpx 20rpx;margin-top: 20rpx;">
 				<u-search placeholder="请输入商品名称" inputAlign="center" bgColor="#fff" shape="square" v-model="search.cname"
 					@search="searchButton" @custom="searchButton" :animation="true"></u-search>
-			</view>
-			<view v-if="false" style="margin: -15rpx auto 10rpx auto;display: flex;padding: 0 20rpx;z-index: 999;" >
-				<u-tag :text="search.brandNmae" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable
-					:show="false" @close="close" @click="close"></u-tag>
-				<!-- <u-tag text="原厂" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="originalFactory"
-					:show="originalFactory" @close="yuanchangclose('originalFactory')" @click="yuanchangclose('originalFactory')"></u-tag>
-				<u-tag text="自修补" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="selfRecovery"
-					:show="selfRecovery" @close="yuanchangclose('selfRecovery')" @click="yuanchangclose('selfRecovery')"></u-tag>
-				<u-tag text="防爆" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="explosionProof"
-					:show="explosionProof" @close="yuanchangclose('explosionProof')" @click="yuanchangclose('explosionProof')"></u-tag> -->
+			</view>
+			<view v-if="false" style="margin: -15rpx auto 10rpx auto;display: flex;padding: 0 20rpx;z-index: 999;" >
+				<u-tag :text="search.brandNmae" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable
+					:show="false" @close="close" @click="close"></u-tag>
+				<!-- <u-tag text="原厂" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="originalFactory"
+					:show="originalFactory" @close="yuanchangclose('originalFactory')" @click="yuanchangclose('originalFactory')"></u-tag>
+				<u-tag text="自修补" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="selfRecovery"
+					:show="selfRecovery" @close="yuanchangclose('selfRecovery')" @click="yuanchangclose('selfRecovery')"></u-tag>
+				<u-tag text="防爆" borderColor="#FD4B09" color="#FD4B09" plain size="medium" closable v-if="explosionProof"
+					:show="explosionProof" @close="yuanchangclose('explosionProof')" @click="yuanchangclose('explosionProof')"></u-tag> -->
 			</view>
 		</view>
 		<view :style="{marginTop:show == true?'108rpx':'108rpx'}">
 			<u-swiper :list="list3" indicator indicatorMode="dot" circular></u-swiper>
-		</view>
+		</view>
+		
 		<view style="background-color: #fff;margin-bottom: 20rpx;">
-			<view style="padding: 20rpx 0 0 0;">
-				<u-grid :border="false" @click="click" col="4">
+			<view class="cardBox classification">
+				<view class="classificationBox" v-for="(item,index) in brandList" :key="item.id"
+				 @click="click(index)"> 
+				 	<view class="classificationBox_img">
+				 		<image :src="item.brandFilesList[0].url" mode=""></image>
+				 	</view>
+				 	<view class="classificationBox_text" :style="PPindex == index?'color:#3c9cff':''">{{item.cname}}</view>
+				</view>
+				<view class="classificationBox" @click="Moreprojectsfun"
+				 v-if="brandList.length >= 7 && gengduofalse">
+				 	<view class="classificationBox_img">
+				 		<image src="../../static/images/view/buyGoods/gengduo.png" 
+						style="width: 60rpx;height: 60rpx;" mode=""></image>
+				 	</view>
+				 	<view class="classificationBox_text">更多项目</view>
+				</view>
+				<view class="classificationBox" @click="shohuifun"
+				v-if="brandList.length >= zsbrandList.length && zsbrandList.length > 8">
+				 	<view class="classificationBox_img">
+				 		<image src="../../static/images/view/buyGoods/fanhui.png" 
+						style="width: 60rpx;height: 60rpx;" mode=""></image>
+				 	</view>
+				 	<view class="classificationBox_text">收回项目</view>
+				</view>
+				
+				<!-- <u-grid :border="false" @click="click" col="4">
 					<u-grid-item v-for="(item,index) in brandList" :key="index">
 						<view v-if="item.brandFilesList.length>0" style="text-align: center;">
 							<view v-for="(li,i) in item.brandFilesList" :key="i" :src="li.url">
@@ -35,42 +60,16 @@
 							<view style="font-size: 28rpx;">{{item.cname}}</view>
 						</view>
 					</u-grid-item>
-				</u-grid>
-			</view>
-			
-			
-			<view style="margin-top: 10rpx;display: flex;">
-				 <u-tabs :list="dianjiqielist" v-model="groupModel" @click="groupChange"></u-tabs>
-				<!-- <u-radio-group
-				    v-model="groupModel"
-				    placement="row"
-				    @change="groupChange"
-				  >
-				    <u-radio
-				      :customStyle="{margin: '0 10px'}"
-				      v-for="(item, index) in dianjiqielist"
-				      :key="index"
-				      :label="item.name"
-				      :name="item.name" >
-				    </u-radio>
-				  </u-radio-group> -->
-				<!-- <view style="display: flex;align-items: center;" @click="dianjiqiehuan('')">
-					<view style="margin-right: 10rpx;" 
-					:style="originalFactory?'color:#4070fc':''">全部</view>
-				</view>
-				<view style="display: flex;align-items: center;" @click="dianjiqiehuan('originalFactory')">
-					<view style="margin-right: 10rpx;"
-					 :style="originalFactory?'color:#4070fc':''">静音棉</view>
-				</view>
-				<view style="display: flex;align-items: center;" @click="dianjiqiehuan('selfRecovery')">
-					<view style="margin-right: 10rpx;" :style="selfRecovery?'color:#4070fc':''">自修补</view>
-				</view>
-				<view style="display: flex;align-items: center;" @click="dianjiqiehuan('explosionProof')">
-					<view style="margin-right: 10rpx;" :style="explosionProof?'color:#4070fc':''">防爆</view>
-				</view> -->
-			</view>
-			
-			
+				</u-grid> -->
+				
+			</view>
+
+
+			<view style="margin-top: 10rpx;display: flex;">
+				 <u-tabs :list="dianjiqielist" v-model="groupModel" @click="groupChange"></u-tabs>
+			</view>
+
+
 			<view style="padding: 20rpx 20rpx;">
 				<u-divider text="爆品推荐"></u-divider>
 			</view>
@@ -131,9 +130,9 @@
 	import {
 		appList,
 		userDept,
-		validationCorpEmpty,
-		
-		brandDescList,
+		validationCorpEmpty,
+
+		brandDescList,
 		brandDescDetail
 	} from '@/api/tabBar/home.js'
 	import {
@@ -141,7 +140,7 @@
 	} from '@/api/tabBar/classification.js'
 	export default {
 		data() {
-			return {
+			return {
 				show:false,
 				search: {},
 				page: {
@@ -152,29 +151,33 @@
 				status: 'loadmore',
 				dataList: [],
 				list3: [],
-				brandList: [],
-				// 静音棉
-				originalFactory:0,
-				// 自修补
-				selfRecovery:0,
-				// 防爆
-				explosionProof:0,
-				dianjiqielist:[
-					{
-						name: '全部',
-					},
-					{
-						name: '静音棉',
-					},
-					{
-						name: '自修补',
-					},
-					{
-						name: '防爆',
-					}
-				],
-				groupModel:null,
-				PPindex:null,
+				brandList: [],
+				// 静音棉
+				originalFactory:0,
+				// 自修补
+				selfRecovery:0,
+				// 防爆
+				explosionProof:0,
+				dianjiqielist:[
+					{
+						name: '全部',
+					},
+					{
+						name: '静音棉',
+					},
+					{
+						name: '自修补',
+					},
+					{
+						name: '防爆',
+					}
+				],
+				groupModel:null,
+				PPindex:null,
+				// 品牌
+				zsbrandList:[],
+				brandDescfor:7,
+				gengduofalse:true,
 			}
 		},
 		onReachBottom() {
@@ -186,15 +189,16 @@
 				this.status = 'nomore'
 			}
 		},
-		onShow() {
-			// 轮播图
-			brandDescList({type:'LBT'}).then(res=>{
-				brandDescDetail({id:res.data.records[0].id}).then(res=>{
-					// this.list3 = res.data.brandFilesList
-					this.list3 = res.data.brandFilesList.map(item=>{
-						return item.url
-					})
-				})
+		onShow() {
+			// 轮播图
+			brandDescList({type:'LBT'}).then(res=>{
+				brandDescDetail({id:res.data.records[0].id}).then(res=>{
+					console.log(res,193);
+					// this.list3 = res.data.brandFilesList
+					this.list3 = res.data.brandFilesList.map(item=>{
+						return item.url
+					})
+				})
 			})
 			uni.showLoading({
 				title: '加载中',
@@ -210,7 +214,17 @@
 				})
 				//获取所有品牌
 				listAll({type:'PP', enableOrNot:'1'}).then(res => {
-					this.brandList = res.data
+					this.zsbrandList = res.data
+					if (this.zsbrandList.length <= 8) {
+						this.gengduofalse = false
+						this.brandList = this.zsbrandList
+					}else {
+						for(let i in res.data) {
+							if (i < this.brandDescfor) {
+								this.brandList.push(res.data[i])
+							}
+						}
+					}
 				})
 				this.page = {
 					total: 0,
@@ -225,58 +239,87 @@
 			})
 		},
 		methods: {
-			groupChange(e){
-				console.log(e,228);
-				if (e.name == '静音棉') {
-					this.originalFactory = 1
-					this.selfRecovery = 0
-					this.explosionProof = 0
-				}else if (e.name == '自修补') {
-					this.originalFactory = 0
-					this.selfRecovery = 1
-					this.explosionProof = 0
-				}else if (e.name == '防爆') {
-					this.originalFactory = 0
-					this.selfRecovery = 0
-					this.explosionProof = 1
-				}else {
-					this.originalFactory = 0
-					this.selfRecovery = 0
-					this.explosionProof = 0
+			// 更多项目盒子
+			Moreprojectsfun(){
+				this.brandDescfor += 4
+				this.brandList = []
+				console.log(123);
+				for(let i in this.zsbrandList) {
+					if (i < this.brandDescfor) {
+						this.brandList.push(this.zsbrandList[i])
+					}
+				}
+				if (this.brandDescfor >= this.zsbrandList.length) {
+					this.gengduofalse = false
 				}
-				this.page.current = 1
-				this.dataList = []
-				this.onSearch()
-				
 			},
-			// 点击筛选条件
-			dianjiqiehuan(name){
-				if (this[name] == 0) {
-					this[name] = 1
-				}else {
-					this[name] = 0
+			// 收回项目
+			shohuifun(){
+				this.brandDescfor = 7
+				this.brandList = []
+				for(let i in this.zsbrandList) {
+					if (i < this.brandDescfor) {
+						this.brandList.push(this.zsbrandList[i])
+					}
 				}
-				this.click()
+				this.gengduofalse = true
+				// if (this.brandDescfor >= this.zsbrandList.length) {
+				// 	this.gengduofalse = false
+				// }
 			},
+			
+			groupChange(e){
+				console.log(e,228);
+				if (e.name == '静音棉') {
+					this.originalFactory = 1
+					this.selfRecovery = 0
+					this.explosionProof = 0
+				}else if (e.name == '自修补') {
+					this.originalFactory = 0
+					this.selfRecovery = 1
+					this.explosionProof = 0
+				}else if (e.name == '防爆') {
+					this.originalFactory = 0
+					this.selfRecovery = 0
+					this.explosionProof = 1
+				}else {
+					this.originalFactory = 0
+					this.selfRecovery = 0
+					this.explosionProof = 0
+				}
+				this.page.current = 1
+				this.dataList = []
+				this.onSearch()
+
+			},
+			// 点击筛选条件
+			dianjiqiehuan(name){
+				if (this[name] == 0) {
+					this[name] = 1
+				}else {
+					this[name] = 0
+				}
+				this.click()
+			},
 			// 获取列表数据
 			onSearch() {
 				uni.showLoading({
 					title: '加载中',
 					mask: true
-				});
-				let obj = {}
-				if(this.originalFactory){
-					obj.originalFactory = 1
-				}
-				if (this.selfRecovery){
-					obj.selfRecovery = 1
-				}
-				if (this.explosionProof) {
-					obj.explosionProof = 1
+				});
+				let obj = {}
+				if(this.originalFactory){
+					obj.originalFactory = 1
+				}
+				if (this.selfRecovery){
+					obj.selfRecovery = 1
+				}
+				if (this.explosionProof) {
+					obj.explosionProof = 1
 				}
 				appList({
 					size: this.page.size,
-					current: this.page.current,
+					current: this.page.current,
 					...obj,
 					...this.search
 				}).then(res => {
@@ -289,49 +332,49 @@
 				}).catch(err => {
 					uni.hideLoading();
 				})
-			},
-			close(){
-				this.show = false
-				this.search.brandId = ''
-				this.search.brandName = ''
-			},
-			// 原厂点击差号
-			yuanchangclose(type){
-				if (type == 'originalFactory') {
-					this.originalFactory = false
-				}else if (type == 'selfRecovery') {
-					this.selfRecovery = false
-				}else {
-					this.explosionProof = false
-				}
-				this.click()
-			},
-			
-			click(name) {
-				if (name != undefined) {
-					this.page = {
-						total: 0,
-						size: 10,
-						current: 1,
-					}
-					this.dataList = []
-					if (this.PPindex == name) {
-						this.PPindex = null
-						delete this.search.brandId
-						delete this.search.brandNmae
-					}else {
-						this.PPindex = name
-						
-						this.search = {
-							...this.search,
-							brandId: this.brandList[this.PPindex].id,
-							brandNmae: this.brandList[this.PPindex].cname,
-						}
-					}
-					
-				}
-				this.show = true
-				
+			},
+			close(){
+				this.show = false
+				this.search.brandId = ''
+				this.search.brandName = ''
+			},
+			// 原厂点击差号
+			yuanchangclose(type){
+				if (type == 'originalFactory') {
+					this.originalFactory = false
+				}else if (type == 'selfRecovery') {
+					this.selfRecovery = false
+				}else {
+					this.explosionProof = false
+				}
+				this.click()
+			},
+
+			click(name) {
+				if (name != undefined) {
+					this.page = {
+						total: 0,
+						size: 10,
+						current: 1,
+					}
+					this.dataList = []
+					if (this.PPindex == name) {
+						this.PPindex = null
+						delete this.search.brandId
+						delete this.search.brandNmae
+					}else {
+						this.PPindex = name
+
+						this.search = {
+							...this.search,
+							brandId: this.brandList[this.PPindex].id,
+							brandNmae: this.brandList[this.PPindex].cname,
+						}
+					}
+
+				}
+				this.show = true
+
 				this.onSearch()
 			},
 			searchButton(value) {
@@ -341,7 +384,7 @@
 					size: 10,
 					current: 1
 				}
-				this.search = {
+				this.search = {
 					...this.search,
 					cname: value,
 				}
@@ -387,5 +430,45 @@
 		top: 0;
 		z-index: 8;
 		background-color: #f2f2f2;
+	}
+	.cardBox {
+		margin-top: 20rpx;
+		background: #fff;
+		border-radius: 12rpx;
+		width: 100%;
+		padding: 40rpx;
+		box-sizing: border-box;
+		.classificationBox {
+			width: 25%;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			margin: 10rpx 0;
+			.classificationBox_img {
+				width: 70rpx;
+				height: 70rpx;
+				// filter: grayscale(100%) hue-rotate(180deg) brightness(0.5) contrast(200%);
+				// mix-blend-mode: screen;
+				// background-color: #FF00FF;
+			}
+			.classificationBox_text {
+				margin-top: 10rpx;
+				font-size: 28rpx;
+				color: #101010;
+			}
+			.brandDescColor {
+				color: #92c3fd;
+				// border: 2rpx solid;
+			}
+		}
+	}
+	.classification {
+		display: flex;
+		flex-wrap: wrap;
+		min-height: 180rpx;
+	}
+	image {
+		width: 100%;
+		height: 100%;
 	}
-</style>
+</style>

BIN
static/images/view/buyGoods/fanhui.png


BIN
static/images/view/buyGoods/gengduo.png