Browse Source

分类商品跳转

yuxingxing 2 years ago
parent
commit
f86b6be83e
2 changed files with 117 additions and 59 deletions
  1. 116 58
      pages/goods/goods_list_mall/index.vue
  2. 1 1
      pages/goods_cate/goods_cate1.vue

+ 116 - 58
pages/goods/goods_list_mall/index.vue

@@ -5,7 +5,7 @@
 				<view class='item' :class='is_switch == true ? "" : "on"' hover-class='none'
 					v-for="(item, index) in productList" :key="index" @click="godDetail(item)">
 					<view class='pictrue' :class='is_switch == true ? "" : "on"'>
-						<image :src='item.image' :class='is_switch == true ? "" : "on"'></image>
+						<image :src='item.goodsCover' :class='is_switch == true ? "" : "on"'></image>
 						<span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'"
 							v-if="item.activity && item.activity.type === '1'">{{ $t(`秒杀`) }}</span>
 						<span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'"
@@ -14,15 +14,23 @@
 							v-if="item.activity && item.activity.type === '3'">{{ $t(`拼团`) }}</span>
 					</view>
 					<view class='text' :class='is_switch == true ? "" : "on"'>
-						<view class='name line1'>{{ item.store_name }}</view>
+						<view class="text-info">
+							<view class="title">
+								<u-text :prefixIcon="item.isHot == 1 ? 'bookmark' : ''"
+									iconStyle="font-size: 16px; color:red;min-height: 30px;" :lines="2" bold block
+									size="12" :text="item.goodsName"></u-text>
+							</view>
+							<view class="tags">赠送{{ item.obtainIntegral }}红积分</view>
+						</view>
+						<!-- <view class='name line1'>{{ item.goodsName }}</view> -->
 						<view class='money font-color' :class='is_switch == true ? "" : "on"'>{{ $t(`¥`) }}<text
-								class='num'>{{ item.price }}</text></view>
+								class='num'>{{ item.salePrice }}</text></view>
 						<view class='vip acea-row row-between-wrapper' :class='is_switch == true ? "" : "on"'>
-							<view class='vip-money' v-if="item.vip_price && item.vip_price > 0">
-								{{ $t(`¥`) }}{{ item.vip_price }}
+							<!-- <view class='vip-money' v-if="item.salePrice && item.salePrice > 0">
+								{{ $t(`¥`) }}{{ item.salePrice }}
 								<image src='../../../static/images/vip.png'></image>
-							</view>
-							<view>{{ $t(`已售`) }} {{ item.sales }}{{ $t(item.unit_name) || $t(`件`) }}</view>
+							</view> -->
+							<!-- <view>{{ $t(`已售`) }} {{ item.sales }}{{ $t(item.unit_name) || $t(`件`) }}</view> -->
 						</view>
 					</view>
 				</view>
@@ -31,7 +39,7 @@
 				</view>
 			</view>
 		</view>
-		<view class='noCommodity' v-if="productList.length == 0 && where.page > 1">
+		<view class='noCommodity' v-if="productList.length == 0 && where.current > 1">
 			<view class='emptyBox'>
 				<image :src="imgHost + '/statics/images/no-thing.png'"></image>
 			</view>
@@ -46,9 +54,8 @@
 <script>
 import home from '@/components/home';
 import {
-	getProductslist,
-	getProductHot
-} from '@/api/store.js';
+	getGoodsInfo
+} from '@/api/home.js';
 import recommend from '@/components/recommend';
 import {
 	mapGetters
@@ -71,14 +78,10 @@ export default {
 			productList: [],
 			is_switch: true,
 			where: {
-				sid: 0,
-				keyword: '',
-				priceOrder: '',
-				salesOrder: '',
-				news: 0,
-				page: 1,
-				limit: 20,
-				cid: 0,
+				zoneType: 3,
+				goodsCategoryId: 0,
+				current: 1,
+				size: 20,
 			},
 			price: 0,
 			stock: 0,
@@ -94,13 +97,10 @@ export default {
 		};
 	},
 	onLoad: function (options) {
-		this.where.cid = options.cid || 0;
-		this.$set(this.where, 'sid', options.sid || 0);
+		// this.where.goodsCategoryId = options.cid || 0;
+		this.$set(this.where, 'goodsCategoryId', options.sid || 0);
 		this.title = options.title || '';
-		this.$set(this.where, 'keyword', options.searchValue || '');
-		this.$set(this.where, 'productId', options.productId || '');
 		this.get_product_list();
-
 		uni.setNavigationBarTitle({
 			title: options.title
 		});
@@ -122,7 +122,7 @@ export default {
 			let that = this;
 			that.$set(that.where, 'keyword', e.detail.value);
 			that.loadend = false;
-			that.$set(that.where, 'page', 1)
+			that.$set(that.where, 'current', 1)
 			this.get_product_list(true);
 		},
 		/**
@@ -131,10 +131,11 @@ export default {
 		get_host_product: function () {
 			let that = this;
 			if (that.hotScroll) return
-			getProductHot(
-				that.hotPage,
-				that.hotLimit,
-			).then(res => {
+			getGoodsInfo({
+				current: that.hotPage,
+				size: that.hotLimit,
+				isRecom: 1
+			}).then(res => {
 				that.hotPage++
 				that.hotScroll = res.data.length < that.hotLimit
 				that.hostProduct = that.hostProduct.concat(res.data)
@@ -171,7 +172,7 @@ export default {
 					break;
 			}
 			this.loadend = false;
-			this.$set(this.where, 'page', 1);
+			this.$set(this.where, 'current', 1);
 			this.get_product_list(true);
 		},
 		//设置where条件
@@ -193,34 +194,34 @@ export default {
 			if (isPage === true) that.$set(that, 'productList', []);
 			that.loading = true;
 			that.loadTitle = '';
-			uni.request({
-				url: 'api/mock/Productslist',
-				success: res => {
-					let list = res.data;
-					let productList = that.$util.SplitArray(list, that.productList);
-					let loadend = list.length < that.where.limit;
-					that.loadend = loadend;
-					that.loading = false;
-					that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
-					that.$set(that, 'productList', productList);
-					that.$set(that.where, 'page', that.where.page + 1);
-					if (!that.productList.length) this.get_host_product();
-				}
-			})
-			// getProductslist(that.where).then(res => {
-			// 	let list = res.data;
-			// 	let productList = that.$util.SplitArray(list, that.productList);
-			// 	let loadend = list.length < that.where.limit;
-			// 	that.loadend = loadend;
-			// 	that.loading = false;
-			// 	that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
-			// 	that.$set(that, 'productList', productList);
-			// 	that.$set(that.where, 'page', that.where.page + 1);
-			// 	if (!that.productList.length) this.get_host_product();
-			// }).catch(err => {
-			// 	that.loading = false;
-			// 	that.loadTitle = that.$t(`加载更多`);
-			// });
+			// uni.request({
+			// 	url: 'api/mock/Productslist',
+			// 	success: res => {
+			// 		let list = res.data;
+			// 		let productList = that.$util.SplitArray(list, that.productList);
+			// 		let loadend = list.length < that.where.size;
+			// 		that.loadend = loadend;
+			// 		that.loading = false;
+			// 		that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
+			// 		that.$set(that, 'productList', productList);
+			// 		that.$set(that.where, 'current', that.where.current + 1);
+			// 		if (!that.productList.length) this.get_host_product();
+			// 	}
+			// })
+			getGoodsInfo(that.where).then(res => {
+				let list = res.data;
+				let productList = that.$util.SplitArray(list, that.productList);
+				let loadend = list.length < that.where.size;
+				that.loadend = loadend;
+				that.loading = false;
+				that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
+				that.$set(that, 'productList', productList);
+				that.$set(that.where, 'current', that.where.current + 1);
+				if (!that.productList.length) this.get_host_product();
+			}).catch(err => {
+				that.loading = false;
+				that.loadTitle = that.$t(`加载更多`);
+			});
 		},
 	},
 	onPullDownRefresh() {
@@ -387,6 +388,63 @@ export default {
 	margin-top: 7rpx;
 }
 
+.text-info {
+	.title {
+		color: #222222;
+	}
+
+	.tags {
+		display: inline-block;
+		font-size: 20rpx;
+		padding: 6rpx;
+		background-color: #FCE9EC;
+		color: #EB4C63;
+		margin: 6rpx 0;
+	}
+
+	.old-price {
+		margin-top: 4rpx;
+		font-size: 26rpx;
+		color: #f51414;
+		// text-decoration: line-through;
+
+		text {
+			margin-right: 2px;
+			font-size: 20rpx;
+		}
+	}
+
+	.price {
+		display: flex;
+		align-items: flex-end;
+		font-size: 36rpx;
+		font-weight: 550;
+
+		text {
+			padding-bottom: 4rpx;
+			font-size: 26rpx;
+			font-weight: normal;
+		}
+
+		.txt {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			width: 28rpx;
+			height: 28rpx;
+			margin-left: 15rpx;
+			margin-bottom: 10rpx;
+			border-radius: 4rpx;
+			font-size: 20rpx;
+			font-weight: normal;
+
+			&.on {
+				margin-left: 0;
+			}
+		}
+	}
+}
+
 .productList .list .item .text .vip.on {
 	margin-top: 12rpx;
 }

+ 1 - 1
pages/goods_cate/goods_cate1.vue

@@ -40,7 +40,7 @@
 							<view class='list acea-row'>
 								<block v-for="(itemn, indexn) in productList2" :key="indexn">
 									<navigator hover-class='none'
-										:url='"/pages/goods/goods_list/index?sid=" + itemn.id + "&title=" + itemn.title'
+										:url='"/pages/goods/goods_list_mall/index?sid=" + itemn.id + "&title=" + itemn.title'
 										class='item acea-row row-column row-middle'>
 										<view class='picture'>
 											<image :src='itemn.logo' v-if="itemn.logo"></image>