Explorar o código

商城搜索历史功能完善

LXT-NJ\Admin hai 1 ano
pai
achega
684ff68a42
Modificáronse 4 ficheiros con 67 adicións e 45 borrados
  1. 14 13
      pages/dingdan/index.vue
  2. 5 6
      pages/gouwuche/index.vue
  3. 3 0
      pages/shop/index.vue
  4. 45 26
      pages/shopsoso/index.vue

+ 14 - 13
pages/dingdan/index.vue

@@ -26,18 +26,19 @@ export default {
 			list2:[ '全部','待付款','已付款','已完成'],
 			activeIndex:0,
 			test: [
-				{
-				img: '../../static/img/83.png',
-				title: '丝缎质感纹理风衣',
-				label: '黑色 - 6518/320',
-				size:'S',
-				price: '1299',
-				id: 3,
-				buy: 0,
-				itemId: 0,
-				checked:false,
-				status:0
-			}],
+			// 	{
+			// 	img: '../../static/img/83.png',
+			// 	title: '丝缎质感纹理风衣',
+			// 	label: '黑色 - 6518/320',
+			// 	size:'S',
+			// 	price: '1299',
+			// 	id: 3,
+			// 	buy: 0,
+			// 	itemId: 0,
+			// 	checked:false,
+			// 	status:0
+			// },
+			],
 			typeclick:4,//1加入购物车,2购物车
 			page:1,
 			pagesize:5,
@@ -146,7 +147,7 @@ export default {
 				url:'/pages/pingjia/index?id='+ids
 				})		
 		},
-		loadMore(index){ //加载更多
+		loadMore(){ //加载更多
 			if(this.isBottom) return;
 			this.page++;
 			let that=this;

+ 5 - 6
pages/gouwuche/index.vue

@@ -1,9 +1,9 @@
 <template>
 	<view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
 		<tm-menubars title="消息列表" :shadow="0" :showback="true"></tm-menubars>
-		<view class="zhuti shangpin">
-			<tm-sheet :padding="[0, 0]" class="jiaoxi xiao">
-				<view v-for="item in test">
+		<view class="zhuti shangpin" v-if="test.length>0">
+			<tm-sheet :padding="[0, 0]" class="jiaoxi xiao" >
+				<view v-for="item in test" >
 					<tm-checkbox @change="choose" style="float: left;padding:2px !important;margin-top:9%;"
 						v-model="item.checked" label=""></tm-checkbox>
 					<tm-cartCellListFood @change="shuliangjia(item)" class="shuliang" :typeclick="typeclick"
@@ -12,7 +12,6 @@
 			</tm-sheet>
 		</view>
 		<view class="dibu">
-
 			<tm-listitem class="liebiao" value="免费" :round="24" :shadow="12" title="邮费" :show-right-icon="false">
 			</tm-listitem>
 			<tm-listitem class="liebiao jiageList" :value="'¥'+zongjia" :round="24" :shadow="12" title="价格"
@@ -122,11 +121,11 @@
 					}
 				}).then(res => {
 					if (res.data.code == 200) {
-						this.getList()
 						that.$refs.toast.show({
 							model: 'success',
 							label: res.data.msg
 						})
+						this.getList()
 					} else {
 						that.$refs.toast.show({
 							model: 'error',
@@ -161,7 +160,7 @@
 					data: {}
 				}).then(res => {
 					if (res.data.code == 200) {
-						if (res.data.data.length != 0) {
+						if (res.data.data.length > 0) {
 							that.test = [];
 							for (let i = 0; i < res.data.data.length; i++) {
 								var obj = {

+ 3 - 0
pages/shop/index.vue

@@ -115,6 +115,9 @@ export default {
 	onLoad() {
 		
 	},
+	onShow() {
+		this.getGwc()
+	},
 	created() {
 		this.sys = uni.getSystemInfoSync();
 		this.getSort()

+ 45 - 26
pages/shopsoso/index.vue

@@ -32,7 +32,7 @@
 			<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.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
+		<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">
@@ -45,16 +45,16 @@
 							</view>
 							<view class="mt-2 flex-between flex-center">
 								<view class="touxiang mt-30">
-									<text class="text-white text-size-m text-weight-b">{{item.market_price}}</text>
+									<text class="text-white text-size-m text-weight-b">{{item.sale_price}}</text>
 								</view>
 								<view >
-									<image @click="jiarufuFun(item)" class="remenzan" src="/static/img/86.png" mode="widthFix"></image>
+									<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="this.listdata.length!=0">
+					<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>
@@ -91,6 +91,7 @@ export default {
 			sosotype:1,
 			page:1,
 			pagesize:8,
+			total:0,
 			jia:1,
 			num:1,
 		};
@@ -111,21 +112,19 @@ export default {
 		getlishi(){
 			var that=this;
 			myRequest({
-				url: "/api/SearchHistory/searchList",
+				url: "/api/ShopGoods/shopSearchList",
 				method:'get',
 				data:{}
 			}).then(res => {
 				if (res.data.code == 200) {
 					that.libiaoList=res.data.data;
-				}else{
-					
-				}
+				}else{}
 			})
 		},
 		qingkong(){
 			var that=this;
 			myRequest({
-				url: "/api/SearchHistory/deleteSearch",
+				url: "/api/ShopGoods/deleteShopSearch",
 				method:'get',
 				data:{}
 			}).then(res => {
@@ -138,6 +137,7 @@ export default {
 			})
 		},
 		sousuo(name){
+			console.log(name,'nam');
 			this.soso=name;
 			this.sosoFun();
 		},
@@ -150,11 +150,16 @@ export default {
 			}).then(res=>{
 				if(res.data.code==200){
 					that.listdata=[];
-					if(res.data.data.data){
+					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',
@@ -169,25 +174,38 @@ export default {
 			// this.randouh()
 		},
 		jiarufuFun(data){
-			uni.navigateTo({
-				url: "/pages/gouwuche/index",
-			})
+			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
+					}
+				}).then(res => {
+					if (res.data.code == 200) {
+						that.$refs.toast.show({model:'success',label:res.data.msg})
+						// that.getGwc()
+					}else{
+						that.$refs.toast.show({model:'error',label:res.data.msg})
+					}
+				})
+			// }else{
+			// 	uni.navigateTo({
+			// 		url: "/pages/shopdetail/index",
+			// 	})
+			// }
+			// uni.navigateTo({
+			// 	url: "/pages/gouwuche/index",
+			// })
 			// console.log(data)
 			// this.gouwuche.push(data)
 		},
-		randouh(){
-			let list2 = [],that=this;
-			for(let i=0;i<8;i++){
-				list2.push({
-					image:'../../static/img/90.png',
-					text:'帽子',
-					jiage:'¥ 359.00',
-					xiaol:'128'
-				})
-			}
-			this.listdata=this.listdata.concat(list2)
-			console.log(this.listdata)
-		},
 		goindex(){
 			uni.navigateBack();
 		},
@@ -207,6 +225,7 @@ export default {
 					this.num=2
 				}
 			}
+			this.sosoFun()
 		},
 	},
 }