Browse Source

修改相关页面的点击详情功能

LXT-NJ\Admin 1 year ago
parent
commit
d68a5a6676

+ 3 - 3
pages/index/index.vue

@@ -111,7 +111,7 @@
 							<view class="py-10 text-size-s dianz mingri">
 								<text class="text-white">亿万新品趋势洞察</text>
 							</view>
-							<view class="mt-10" v-for="item in shopGoodsList" @click="xiangqing()">
+							<view class="mt-10" v-for="item in shopGoodsList" @click="xiangqing(item)">
 								<image class="chuandaimg fl" :src="item.image" mode="widthFix"></image>
 								<view class="chuandazi fr">
 									<view class="text-size-m text-weight-b text-overflow-2">{{item.goods_name}}</view>
@@ -293,9 +293,9 @@
 					this.chengshi=e[1];
 				}
 			},
-			xiangqing(){
+			xiangqing(data){
 				uni.navigateTo({
-					url: "/pages/shopdetail/index",
+					url: "/pages/shopdetail/index?cartId="+data.id+'&classId='+data.category_id,
 				})
 			},
 			// 获取用户服务列表

+ 1 - 1
pages/shop/index.vue

@@ -407,7 +407,7 @@
 			goXiangQing(data) {
 				console.log(data);
 				uni.navigateTo({
-					url: "/pages/shopdetail/index?id=" + data.id + '&classId=' + data.category_id,
+					url: "/pages/shopdetail/index?cartId=" + data.id + '&classId=' + data.category_id,
 				})
 			},
 			lunboFun(e) {

+ 1 - 1
pages/shopdetail/index.vue

@@ -125,7 +125,7 @@
 		},
 		onLoad(ops) {
 			console.log(ops);
-			this.ids = ops.id;
+			this.ids = ops.cartId;
 			this.cartId = ops.classId;
 		},
 		created() {

+ 315 - 193
pages/shopsoso/index.vue

@@ -3,7 +3,8 @@
 		<tm-menubars title="" :shadow="0" :showback="false"></tm-menubars>
 		<view class="C1b1b1b pb-10">
 			<view class="sousuo">
-				<tm-pickersCity class="dingwei fl" btn-color="bg-gradient-blue-accent" @confirm="okCity" :default-value="addr">
+				<tm-pickersCity class="dingwei fl" btn-color="bg-gradient-blue-accent" @confirm="okCity"
+					:default-value="addr">
 					<view>
 						<text class="text-size-n">{{addr[1]}}</text>
 						<tm-icons :size="24" color="white" name="icon-angle-down"></tm-icons>
@@ -13,30 +14,34 @@
 					<tm-search @confirm="sosoFun" class="fl" v-model="soso" color="white" confirm-text=""></tm-search>
 					<text class="quxiao fr" @click="goindex()">取消</text>
 				</view>
-			  <view style="clear: both;"></view>
-			  <view v-if="sosotype==1">
-			  	<text class="text-size-m fl mt-30">搜索记录</text>
-			  	<view class="fr mt-30 qingchu" @click="qingkong" v-if="libiaoList.length !=0">
-			  		<text class="text-size-s fl">清空记录</text>
-			  		<tm-badges :offset="[0,-5]" icon="icon-times"></tm-badges>
-			  	</view>
-			  </view>
-			  <view v-if="sosotype==2">
-			  	<tm-dropDownMenu @change="change" :type="typeclick" un-color="white" :list="list2"></tm-dropDownMenu>
-			  </view>
-			  <view style="clear: both;"></view>
-			</view>	
+				<view style="clear: both;"></view>
+				<view v-if="sosotype==1">
+					<text class="text-size-m fl mt-30">搜索记录</text>
+					<view class="fr mt-30 qingchu" @click="qingkong" v-if="libiaoList.length !=0">
+						<text class="text-size-s fl">清空记录</text>
+						<tm-badges :offset="[0,-5]" icon="icon-times"></tm-badges>
+					</view>
+				</view>
+				<view v-if="sosotype==2">
+					<tm-dropDownMenu @change="change" :type="typeclick" un-color="white" :list="list2">
+					</tm-dropDownMenu>
+				</view>
+				<view style="clear: both;"></view>
+			</view>
 		</view>
 		<!-- 列表 -->
 		<tm-grouplist class="liebiao mt-40" v-if="sosotype==1 && libiaoList.length !=0">
-			<tm-listitem v-for="item in libiaoList" @click="sousuo(item.name)" :title="item.name" left-icon="" show-left-icon :show-right-icon="false">
+			<tm-listitem v-for="item in libiaoList" @click="sousuo(item.name)" :title="item.name" left-icon=""
+				show-left-icon :show-right-icon="false">
 			</tm-listitem>
 		</tm-grouplist>
-		<tm-empty v-if="sosotype==1 && libiaoList==undefined" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
-		<div class="zhuti"  v-if="sosotype==2">
-			<tm-sheet class="kuang" style="padding-bottom: 30px !important;"  v-if="listdata.length!=0">
+		<tm-empty v-if="sosotype==1 && libiaoList==undefined" label="暂无数据" color="white" icon="icon-paperplane-fill">
+		</tm-empty>
+		<div class="zhuti" v-if="sosotype==2">
+			<tm-sheet class="kuang" style="padding-bottom: 30px !important;" v-if="listdata.length!=0">
 				<view style="width: 94%;margin:0 auto;" class="remen">
-					<view v-for="(item,index) in listdata"  class="round-5 contone black mt-20" :class="index%2==0?'fl':'fr'" @click="goDetail(item.category_id)">
+					<view v-for="(item,index) in listdata" class="round-5 contone black mt-20"
+						:class="index%2==0?'fl':'fr'" @click="goDetail(item)">
 						<image class="logo" :src="item.image" mode="widthFix"></image>
 						<view class="pa-15 text-size-s">
 							<view class="text-overflow-2">
@@ -47,14 +52,16 @@
 								<view class="touxiang mt-30">
 									<text class="text-white text-size-m text-weight-b">¥{{item.sale_price}}</text>
 								</view>
-								<view >
-									<image @click.stop="jiarufuFun(item)" class="remenzan" src="/static/img/86.png" mode="widthFix"></image>
+								<view>
+									<image @click.stop="jiarufuFun(item)" class="remenzan" src="/static/img/86.png"
+										mode="widthFix"></image>
 								</view>
 							</view>
 						</view>
 					</view>
 					<view style="clear: both;"></view>
-					<view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()" v-if="listdata.length<total">
+					<view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()"
+						v-if="listdata.length<total">
 						<image src="/static/img/30.png" mode="widthFix"></image>
 						<text class="text-size-s">下拉加载更多~</text>
 					</view>
@@ -65,198 +72,279 @@
 		<!-- 弹出层消息 -->
 		<tm-message ref="toast"></tm-message>
 	</view>
-</template>	
+</template>
 <script>
-import{myRequest} from '@/api/request.js'
-export default {
-	data() {
-		return {
-			libiaoList:[],
-			activeIndex:0,
-			soso:'',
-			addr:['江西省','南昌市','西湖区'],
-			value:'',
-			list2: [{
+	import {
+		myRequest
+	} from '@/api/request.js'
+	export default {
+		data() {
+			return {
+				libiaoList: [],
+				activeIndex: 0,
+				soso: '',
+				addr: ['江西省', '南昌市', '西湖区'],
+				value: '',
+				list2: [{
 					title: '最近上新',
-					shang:true
+					shang: true
 				}, {
 					title: '价格',
-					shang:true
-				},{
+					shang: true
+				}, {
 					title: '销量',
-					shang:true
+					shang: true
 				}],
-			typeclick:1,
-			listdata:[],
-			sosotype:1,
-			page:1,
-			pagesize:8,
-			total:0,
-			jia:1,
-			num:1,
-		};
-	},
-	onLoad() {
-		
-	},
-	created() {
-		this.sys = uni.getSystemInfoSync();	
-		this.getlishi()
-	},
-	methods: {
-		goDetail(cartId){
-			uni.navigateTo({
-				url:'/pages/shopdetail/index?cartId='+cartId
-			})
-		},
-		getlishi(){
-			var that=this;
-			myRequest({
-				url: "/api/ShopGoods/shopSearchList",
-				method:'get',
-				data:{}
-			}).then(res => {
-				if (res.data.code == 200) {
-					that.libiaoList=res.data.data;
-				}else{}
-			})
+				typeclick: 1,
+				listdata: [],
+				sosotype: 1,
+				page: 1,
+				pagesize: 8,
+				total: 0,
+				jia: 1,
+				num: 1,
+			};
 		},
-		qingkong(){
-			var that=this;
-			myRequest({
-				url: "/api/ShopGoods/deleteShopSearch",
-				method:'get',
-				data:{}
-			}).then(res => {
-				if (res.data.code == 200) {
-					that.getlishi();
-					that.$refs.toast.show({model:'success',label:res.data.msg})
-				}else{
-					
-				}
-			})
+		onLoad() {
+
 		},
-		sousuo(name){
-			console.log(name,'nam');
-			this.soso=name;
-			this.sosoFun();
+		created() {
+			this.sys = uni.getSystemInfoSync();
+			this.getlishi()
 		},
-		sosoFun(){
-			let that=this;
-			myRequest({
-				url:'/api/ShopGoods/shopGoodsSearch',
-				method:'post',
-				data:{search:that.soso,page:that.page,pagesize:that.pagesize,sale_price:that.jia,sale_num:that.num}
-			}).then(res=>{
-				if(res.data.code==200){
-					that.listdata=[];
-					if(res.data.data.length!=0){
-						that.total=res.data.data.total;
-					if(res.data.data.data.length>0){
-					that.listdata=res.data.data.data;	
-					}else{
-						that.listdata=[];
+		methods: {
+			// /去详情
+			goDetail(data) {
+				uni.navigateTo({
+					url: '/pages/shopdetail/index?cartId=' + data.id+'&classId='+data.category_id
+				})
+			},
+			// 历史记录列表
+			getlishi() {
+				var that = this;
+				myRequest({
+					url: "/api/ShopGoods/shopSearchList",
+					method: 'get',
+					data: {}
+				}).then(res => {
+					if (res.data.code == 200) {
+						that.libiaoList = res.data.data;
+					} else {}
+				})
+			},
+			qingkong() {
+				var that = this;
+				myRequest({
+					url: "/api/ShopGoods/deleteShopSearch",
+					method: 'get',
+					data: {}
+				}).then(res => {
+					if (res.data.code == 200) {
+						that.getlishi();
+						that.$refs.toast.show({
+							model: 'success',
+							label: res.data.msg
+						})
+					} else {
+
 					}
-					}else{
-						that.listdata=[];
-					}	
-				}else{
-					that.$refs.toast.show({
-						model: 'error',
-						label: res.data.msg
-					})
-				}
-			})
-			this.sosotype=2
-		},
-		
-		gengmore(){
-			// this.randouh()
-		},
-		jiarufuFun(data){
-			var that=this;
-			console.log(data)
-			// if(data.type==2){
+				})
+			},
+			sousuo(name) {
+				console.log(name, 'nam');
+				this.soso = name;
+				this.sosoFun();
+			},
+			sosoFun() {
+				let that = this;
+				myRequest({
+					url: '/api/ShopGoods/shopGoodsSearch',
+					method: 'post',
+					data: {
+						search: that.soso,
+						page: that.page,
+						pagesize: that.pagesize,
+						sale_price: that.jia,
+						sale_num: that.num
+					}
+				}).then(res => {
+					if (res.data.code == 200) {
+						that.listdata = [];
+						if (res.data.data.length != 0) {
+							that.total = res.data.data.total;
+							if (res.data.data.data.length > 0) {
+								that.listdata = res.data.data.data;
+							} else {
+								that.listdata = [];
+							}
+						} else {
+							that.listdata = [];
+						}
+					} else {
+						that.$refs.toast.show({
+							model: 'error',
+							label: res.data.msg
+						})
+					}
+				})
+				this.sosotype = 2
+			},
+
+			gengmore() {
+				// this.randouh()
+			},
+			jiarufuFun(data) {
+				var that = this;
+				console.log(data)
+				// if(data.type==2){
 				myRequest({
 					url: "/api/ShopCart/addShopCart",
-					method:'post',
-					data:{
-						goods_id:data.id,
-						goods_name:data.goods_name,
-						goods_image:data.image,
-						goods_price:data.sale_price,
-						goods_num:1
+					method: 'post',
+					data: {
+						goods_id: data.id,
+						goods_name: data.goods_name,
+						goods_image: data.image,
+						goods_price: data.sale_price,
+						goods_num: 1
 					}
 				}).then(res => {
 					if (res.data.code == 200) {
-						that.$refs.toast.show({model:'success',label:res.data.msg})
-					}else{
-						that.$refs.toast.show({model:'error',label:res.data.msg})
+						that.$refs.toast.show({
+							model: 'success',
+							label: res.data.msg
+						})
+					} else {
+						that.$refs.toast.show({
+							model: 'error',
+							label: res.data.msg
+						})
 					}
 				})
-			// uni.navigateTo({
-			// 	url: "/pages/gouwuche/index",
-			// })
-			// console.log(data)
-			// this.gouwuche.push(data)
-		},
-		goindex(){
-			uni.navigateBack();
-		},
-		change(e){
-			console.log(e);
-			if(e.title=='价格'){
-				if(e.shang){
-					this.jia=1
-				}else{
-					this.jia=2
-				}
-				console.log(e.shang);
-			}else{
-				if(e.shang){
-					this.num=1
-				}else{
-					this.num=2
+				// uni.navigateTo({
+				// 	url: "/pages/gouwuche/index",
+				// })
+				// console.log(data)
+				// this.gouwuche.push(data)
+			},
+			goindex() {
+				uni.navigateBack();
+			},
+			change(e) {
+				console.log(e);
+				if (e.title == '价格') {
+					if (e.shang) {
+						this.jia = 1
+					} else {
+						this.jia = 2
+					}
+					console.log(e.shang);
+				} else {
+					if (e.shang) {
+						this.num = 1
+					} else {
+						this.num = 2
+					}
 				}
-			}
-			this.sosoFun()
+				this.sosoFun()
+			},
 		},
-	},
-}
+	}
 </script>
 
 <style lang="scss">
-	/deep/ .tm-menubars .body{background-color: #1b1b1b !important;}
-	/deep/ .zhuti{padding: 10px 10px;}
-	/deep/ .kuang{margin:0 !important;padding: 0px !important;}
-	/deep/ .icon-search{
+	/deep/ .tm-menubars .body {
+		background-color: #1b1b1b !important;
+	}
+
+	/deep/ .zhuti {
+		padding: 10px 10px;
+	}
+
+	/deep/ .kuang {
+		margin: 0 !important;
+		padding: 0px !important;
+	}
+
+	/deep/ .icon-search {
 		font-size: 23px !important;
 		color: #8E8E93 !important;
 	}
-	/deep/ .tm-search{
+
+	/deep/ .tm-search {
 		width: 66%;
 		background-color: #414141 !important;
 		border-radius: 10px;
 	}
-	/deep/ .tm-search .grey-darken-5{
+
+	/deep/ .tm-search .grey-darken-5 {
 		background-color: #414141 !important;
 	}
-	.qingchu{background: #303440;padding:5px 15px;border-radius: 20px;width: 62px;}
-	/deep/ .liebiao .grey-darken-4.bk{background-color: #0D0D0D !important;}
-	/deep/ .liebiao .py-24{padding-top: 15px;padding-bottom: 15px;}
-	/deep/ .tm-grouplist{margin:0 10px !important;}
-	.quxiao{color: #707070;line-height: 47px;}
-	/deep/ .tm--badges--cm{border: 1px solid #303440 !important;
-	background-color: #303440 !important;right: -7px !important;top: 6px !important;}
-	/deep/ .tm--badges{display: inherit !important;}
-	.qingchu{background: #303440;padding:5px 15px;border-radius: 20px;width: 62px;}
-	/deep/ .liebiao .grey-darken-4.bk{background-color: #0D0D0D !important;}
-	/deep/ .liebiao .py-24{padding-top: 15px;padding-bottom: 15px;}
-	/deep/ .tm-grouplist{margin:0 10px !important;}
-	
-	/deep/ .qiehuan2 .tm-tabs-con-item-border{display: none;}
-	/deep/ .qiehuan1 .text-primary{color: white !important;}
-	/deep/ .qiehuan2 .tm-tabs-con-item-text{
+
+	.qingchu {
+		background: #303440;
+		padding: 5px 15px;
+		border-radius: 20px;
+		width: 62px;
+	}
+
+	/deep/ .liebiao .grey-darken-4.bk {
+		background-color: #0D0D0D !important;
+	}
+
+	/deep/ .liebiao .py-24 {
+		padding-top: 15px;
+		padding-bottom: 15px;
+	}
+
+	/deep/ .tm-grouplist {
+		margin: 0 10px !important;
+	}
+
+	.quxiao {
+		color: #707070;
+		line-height: 47px;
+	}
+
+	/deep/ .tm--badges--cm {
+		border: 1px solid #303440 !important;
+		background-color: #303440 !important;
+		right: -7px !important;
+		top: 6px !important;
+	}
+
+	/deep/ .tm--badges {
+		display: inherit !important;
+	}
+
+	.qingchu {
+		background: #303440;
+		padding: 5px 15px;
+		border-radius: 20px;
+		width: 62px;
+	}
+
+	/deep/ .liebiao .grey-darken-4.bk {
+		background-color: #0D0D0D !important;
+	}
+
+	/deep/ .liebiao .py-24 {
+		padding-top: 15px;
+		padding-bottom: 15px;
+	}
+
+	/deep/ .tm-grouplist {
+		margin: 0 10px !important;
+	}
+
+	/deep/ .qiehuan2 .tm-tabs-con-item-border {
+		display: none;
+	}
+
+	/deep/ .qiehuan1 .text-primary {
+		color: white !important;
+	}
+
+	/deep/ .qiehuan2 .tm-tabs-con-item-text {
 		font-size: 14px;
 		background: none !important;
 		height: 28px;
@@ -267,7 +355,8 @@ export default {
 		padding-right: 14px;
 		margin-top: 17%;
 	}
-	/deep/ .qiehuan2 .text-weight-b{
+
+	/deep/ .qiehuan2 .text-weight-b {
 		font-size: 14px;
 		background: #303440 !important;
 		height: 28px;
@@ -279,13 +368,46 @@ export default {
 		margin-top: 17%;
 		color: white !important;
 	}
-	.dingwei{width: 21%;margin-top:3%;}
-	.shuruk{width: 77%;}
-	.sousuo{width:94%;margin:0 auto;}
-	.quxiao{color: #707070;line-height: 47px;}
-	.contone{width: 48%;}
-	.logo{width: 100%;}
-	.remenzan{width: 18px !important;margin-top: 10px;}
-	.more{text-align: center;}
-	.more image{margin-right: 10px;vertical-align: middle;width: 30px;}
+
+	.dingwei {
+		width: 21%;
+		margin-top: 3%;
+	}
+
+	.shuruk {
+		width: 77%;
+	}
+
+	.sousuo {
+		width: 94%;
+		margin: 0 auto;
+	}
+
+	.quxiao {
+		color: #707070;
+		line-height: 47px;
+	}
+
+	.contone {
+		width: 48%;
+	}
+
+	.logo {
+		width: 100%;
+	}
+
+	.remenzan {
+		width: 18px !important;
+		margin-top: 10px;
+	}
+
+	.more {
+		text-align: center;
+	}
+
+	.more image {
+		margin-right: 10px;
+		vertical-align: middle;
+		width: 30px;
+	}
 </style>

+ 7 - 2
pages/shouyedetail/index.vue

@@ -87,6 +87,7 @@ export default {
 				data: {id:that.id}
 			}).then(res => {
 				if (res.data.code == 200) {
+					console.log(res.data.data.details,'shuju1');
 					that.datall=res.data.data.data;
 					that.moren=that.datall.images[0]
 					res.data.data.details.forEach(item => {
@@ -96,7 +97,10 @@ export default {
 							label: item.shopGoods.goods_details,
 							goods_id:item.shop_goods_id,
 							id: item.shopGoods.id,
-							price:item.shopGoods.sale_price
+							price:item.shopGoods.sale_price,
+							category_id:item.shopGoods.category_id,
+							sale_num:item.shopGoods.sale_num,
+							
 						})
 					})
 				} else {
@@ -108,8 +112,9 @@ export default {
 			})
 		},
 		jiarufuFun(data){
+			console.log(data,'前往');
 			uni.navigateTo({
-				url: "/pages/shopdetail/index",
+				url: "/pages/shopdetail/index?cartId="+data.data.id+'&classId='+data.data.category_id,
 			})
 			console.log(data)
 		},

+ 3 - 3
pages/sort/index.vue

@@ -4,7 +4,7 @@
 		<div class="zhuti">
 			<tm-sheet class="kuang" style="padding-bottom: 30px !important;" v-if="listdata.length!=0" >
 				<view style="width: 94%;margin:0 auto;" class="remen">
-					<view v-for="(item,index) in listdata"  class="round-5 contone black mt-20" :class="index%2==0?'fl':'fr'" @click="goDetail(item.category_id)">
+					<view v-for="(item,index) in listdata"  class="round-5 contone black mt-20" :class="index%2==0?'fl':'fr'" @click="goDetail(item)">
 						<image class="logo" :src="item.image" mode="widthFix"></image>
 						<view class="pa-15 text-size-s">
 							<view class="text-overflow-2">
@@ -137,9 +137,9 @@ export default {
 			uni.navigateBack();
 		},
 		
-		goDetail(id){
+		goDetail(data){
 			uni.navigateTo({
-				url:'/pages/shopdetail/index?cartId='+id
+				url:'/pages/shopdetail/index?cartId='+data.id+'&classId='+data.category_id
 			})
 		},