From 3ae92c6fa55922af770ebc8e9355c5c0255e69cd Mon Sep 17 00:00:00 2001
From: xuxy <1059738716@qq.com>
Date: 星期一, 12 八月 2024 21:54:23 +0800
Subject: [PATCH] update花店详情

---
 sub_pages/customer/shop/shop.vue |  186 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 134 insertions(+), 52 deletions(-)

diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue
index d653f30..2e44cdb 100644
--- a/sub_pages/customer/shop/shop.vue
+++ b/sub_pages/customer/shop/shop.vue
@@ -53,7 +53,7 @@
 			</view>
 		</view>
 		<view class="brand-info">
-			<view v-if="flg==='0'" class="brand-info-0">
+			<view v-show="flg==='0'||flg==='1'" class="brand-info-0">
 				<view class="search-container  flex"
 					style="padding-left: 20rpx;padding-right: 20rpx;padding-top: 20rpx">
 					<view class="flex1 input">
@@ -67,7 +67,7 @@
 						</u-input>
 					</view>
 				</view>
-				<view class="component-filter-container" style="padding-top: 12rpx;">
+				<view class="component-filter-container" style="padding-top: 12rpx;" v-show="flg==='0'">
 					<view class="flex1" @click.stop="$refs.popup_column.open()">
 						排序{{ query.columnStr&&('-'+query.columnStr) || '' }}
 						<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
@@ -77,68 +77,78 @@
 						<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
 					</view>
 				</view>
-				<view class="top-title m-t-12">
+				<view class="top-title m-t-12" v-show="flg==='0'">
 					报价已包含打包费、材料费、交易佣金
 				</view>
-				<view class="component-shop-item flex" v-for="(item,index) of list" :key="index">
-					<view class="img" @click.stop="toDetail(item)">
-						<image class="img img100" :src="item.cover" lazy-load>
-						</image>
-						<view class="level">
-							{{item.levelStr||''}}
-						</view>
+				<no-data v-if="(!list||list.length==0)&&true" style="width: 100%;margin-top: 120rpx;"></no-data>
+				<view class="flex m-t-12 flex-wrap-normal">
+				<view class="type-list"  v-if="flg==='1'">
+					<view v-for="(item,index) of catgoryTree" @click="changeType(item)"
+						:class="[query.categoryRoot===item.id?'current':'']" :key="index" class="p10 flex type-item">
+						{{item.name || '-'}}
 					</view>
+				</view>
+				<view class="flex1">
+					
+				
+					<view class="component-shop-item flex" v-for="(item,index) of list" :key="index" :class="flg==='1'?'flg-category':''">
+						<view class="img" @click.stop="toDetail(item)">
+							<image class="img img100" :src="item.cover" lazy-load>
+							</image>
+							<view class="level">
+								{{item.levelStr||''}}
+							</view>
+						</view>
 
-					<view class="m-l-12 info-container flex1">
-						<view class="title" @click.stop="toDetail(item)">
-							{{item.name}}
-							<view class="price">
-								¥{{item.price}}/扎
-							</view>
-						</view>
-						<view class="shop-name" @click.stop="toDetail(item)">
-							{{item.categoryStr}}
-						</view>
-						<view class="other-info flex" @click.stop="toDetail(item)">
-							<view class="m-r-15">
-								已售:{{item.sales || 0}}
-							</view>
-							<view class="m-r-15">
-								剩余:{{item.stock || 0}}
-							</view>
-							<view class="m-r-15">
-								{{item.unit}}
-							</view>
-						</view>
-						<view class="bottom-buttons  flex">
-							<view class="m-l-0 m-r-a">
-								<view class="m-r-15 desc-gray other-info">
-									颜色:{{item.color||'-'}}
+						<view class="m-l-12 info-container flex1">
+							<view class="title" @click.stop="toDetail(item)">
+								{{item.name}}
+								<view class="price">
+									¥{{item.price}}/扎
 								</view>
 							</view>
-							<view class="icons flex">
-								<uni-icons v-if="item.shopnum&&item.shopnum>=1" type="minus" size="32"
-									@click.stop="addnum(item,-1)"></uni-icons>
-								<view class="curnums" @click.stop="updateItemNum(item)"
-									v-if="item.shopnum&&item.shopnum>=1">
-									{{ item.shopnum }}
+							<view class="shop-name" @click.stop="toDetail(item)">
+								{{item.categoryStr}}
+							</view>
+							<view class="other-info flex" @click.stop="toDetail(item)">
+								<view class="m-r-15">
+									已售:{{item.sales || 0}}
 								</view>
-								<uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32"
-									@click.stop="addnum(item,1)"></uni-icons>
+								<view class="m-r-15">
+									剩余:{{item.stock || 0}}
+								</view>
+								<view class="m-r-15">
+									{{item.unit}}
+								</view>
+							</view>
+							<view class="bottom-buttons  flex">
+								<view class="m-l-0 m-r-a">
+									<view class="m-r-15 desc-gray other-info">
+										颜色:{{item.color||'-'}}
+									</view>
+								</view>
+								<view class="icons flex">
+									<uni-icons v-if="item.shopnum&&item.shopnum>=1" type="minus" size="32"
+										@click.stop="addnum(item,-1)"></uni-icons>
+									<view class="curnums" @click.stop="updateItemNum(item)"
+										v-if="item.shopnum&&item.shopnum>=1">
+										{{ item.shopnum }}
+									</view>
+									<uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32"
+										@click.stop="addnum(item,1)"></uni-icons>
+								</view>
 							</view>
 						</view>
 					</view>
 				</view>
-
+				</view>
 			</view>
 
-			<view v-show="flg==='1'" class="brand-info-1">
+			<!-- <view v-show="flg==='1'" class="brand-info-1">
 				<trade :hidefooter="true" :supplierId="id" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade">
 				</trade>
-				<!-- // 构建一个分类树 -->
-				<!-- catgoryTree -->
-
 			</view>
+			 -->
 			<view v-if="flg==='2'" class="brand-info-3">
 				<view class="title">
 					基础信息
@@ -252,6 +262,7 @@
 					levelStr: '',
 					level: '',
 					name: '',
+					categoryRoot:'',
 				},
 				level_show: false,
 				level_columns: [
@@ -399,7 +410,13 @@
 			},
 			async changeTab(flg) {
 				console.log('changeTab', flg)
+				if ('0' === ('' + flg)) {
+					//刷新list数据
+					this.query.categoryRoot = ''
+					this.refreshList('post')
+				}
 				if ('1' === ('' + flg)) {
+					this.list = []
 					if (!this.catgoryTree) {
 						this.$message.showLoading()
 						const {
@@ -416,18 +433,34 @@
 						if (code === 0) {
 							// data 分类树
 							this.catgoryTree = data || []
-							let tmp = this
-							this.$nextTick(() => {
-								tmp.$refs.trade.refInit(tmp.catgoryTree)
-							})
+							// let tmp = this
+							// this.$nextTick(() => {
+							// 	tmp.$refs.trade.refInit(tmp.catgoryTree)
+							// })
 						}
 						this.$message.hideLoading()
 					}
+					//如果存在第一个分类,根据一级分类查询
+					if(this.catgoryTree.length>0){
+						this.query.categoryRoot =this.catgoryTree[0].id
+						//然后刷新
+						this.refreshList('post')
+						
+					}
+					
 				}
 				this.flg = '' + flg
 				//如果没有加载数据,需要加载一下
 
 
+			},
+			changeType(item) {
+				if(item.id!==this.query.categoryRoot){
+					this.query.categoryRoot = item.id || ''
+					this.refreshList('post')
+					//拼接二级分类,然后查询商品列表
+				}
+				
 			},
 			buttonSearchFlow() {
 				// this.query.name = this.search_flow || ''
@@ -518,6 +551,55 @@
 			padding: 40rpx 32rpx;
 			height: calc(100vh - 450rpx);
 			padding-top: 0rpx;
+			
+			.type-list {
+				max-width: 140rpx;
+				min-width: 140rpx;
+				background: #EEF7F5;
+				border-radius: 8rpx;
+				min-height: calc(100vh - 600rpx);
+				// max-height: calc(100vh - 600rpx);
+				overflow-y: scroll;
+				margin-right: 10rpx;
+			
+				.type-item {
+					text-align: center;
+					font-weight: 400;
+					font-size: 24rpx;
+					color: #000000;
+					display: block;
+					line-height: 60rpx;
+					// padding-left: 30rpx;
+					// padding-right: 30rpx;
+				}
+			
+				.type-item.current {
+					font-weight: 600;
+					color: #04BA97;
+				}
+			}
+			.flg-category.component-shop-item{
+				.img{
+					width: 140rpx;
+					height: 140rpx;
+					margin-top: 10rpx;
+				}
+				.info-container{
+					.title {
+						margin-top: 0rpx;
+					}
+					.shop-name{
+						
+					}
+					.other-info {
+						margin-bottom: 60rpx;
+					}
+					.bottom-buttons{
+						    bottom: -50rpx;
+					}
+				}
+
+			}
 
 			.brand-info-0 {
 				.top-title {

--
Gitblit v1.9.3