Browse Source

Merge branch 'master' of http://git.liuniu946.com/hwq/newyqg

hwq 3 years ago
parent
commit
fda6e8b788
6 changed files with 521 additions and 302 deletions
  1. 7 7
      pages.json
  2. 5 5
      pages/index/index.vue
  3. 8 4
      pages/order/createOrder.vue
  4. 299 203
      pages/product/classify.vue
  5. 197 79
      pages/product/new.vue
  6. 5 4
      pages/product/product.vue

+ 7 - 7
pages.json

@@ -235,13 +235,13 @@
 		},
 		{
 			"path": "pages/product/classify",
-			"style": {
-				"navigationStyle": "custom",
-				"app-plus": {
-					"titleNView": {
-						"type": "transparent"
-					}
-				}
+			"style": {
+				"navigationBarTitleText": "",
+				"app-plus": {
+					"titleNView": {
+						"type": "none"
+					}
+				}
 			}
 		},
 		{

+ 5 - 5
pages/index/index.vue

@@ -31,15 +31,15 @@
 			</view>
 		</view>
 		<view class="navbar flex">
-			<view class="navbar-item" @click="nav('/pages/product/classify')">
+			<view class="navbar-item" @click="nav('/pages/product/classify?type=4')">
 				<image class="nitem-image" src="../../static/img/index-inco1.png" mode=""></image>
 				<view class="nitem-font">随意嗨购</view>
 			</view>
-			<view class="navbar-item" @click="nav('/pages/product/classify')">
+			<!-- <view class="navbar-item" @click="nav('/pages/product/classify')">
 				<image class="nitem-image" src="../../static/img/index-inco2.png" mode=""></image>
 				<view class="nitem-font">赠艺金券</view>
-			</view>
-			<view class="navbar-item" @click="nav('/pages/product/classify')">
+			</view> -->
+			<view class="navbar-item" @click="nav('/pages/product/classify?type=1')">
 				<image class="nitem-image" src="../../static/img/index-inco3.png" mode=""></image>
 				<view class="nitem-font">置换</view>
 			</view>
@@ -59,7 +59,7 @@
 				<image class="nitem-image" src="../../static/img/index-inco7.png" mode=""></image>
 				<view class="nitem-font">服务专区</view>
 			</view>
-			<view class="navbar-item" @click="nav('/pages/hall/hall')">
+			<view class="navbar-item" @click="nav('/pages/product/classify?type=3')">
 				<image class="nitem-image" src="../../static/img/index-inco8.png" mode=""></image>
 				<view class="nitem-font">大品牌区</view>
 			</view>

+ 8 - 4
pages/order/createOrder.vue

@@ -1,8 +1,8 @@
 <template>
 	<view>
-		<view class="navbar">
+	<!-- 	<view class="navbar">
 			<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
-		</view>
+		</view> -->
 
 		<!-- 地址 -->
 		<navigator v-if="tabCurrentIndex == 0" url="/pages/set/address?source=1" class="address-section">
@@ -93,10 +93,10 @@
 				<text class="cell-tit clamp">优惠金额</text>
 				<text class="cell-tip red">-¥35</text>
 			</view> -->
-			<view class="yt-list-cell b-b">
+			<!-- <view class="yt-list-cell b-b">
 				<text class="cell-tit clamp">积分抵扣{{ '(当前积分:' + integralAll + ')' }}</text>
 				<view class="cell-tip"><radio @click="checkedPoints = !checkedPoints" color=" #5dbc7c" :checked="checkedPoints" /></view>
-			</view>
+			</view> -->
 			<view class="yt-list-cell b-b">
 				<text class="cell-tit clamp">运费</text>
 				<text class="cell-tip">{{ Postage }}</text>
@@ -110,6 +110,10 @@
 			<view class="yt-list-cell b-b">
 				<text class="cell-tit clamp">商品金额</text>
 				<text class="cell-tip">¥{{ payAllMoney }}</text>
+			</view>
+			<view class="yt-list-cell b-b">
+				<text class="cell-tit clamp">商品金额</text>
+				<text class="cell-tip">¥{{ payAllMoney }}</text>
 			</view>
 			<view class="yt-list-cell b-b" v-if="checkedPoints && integralShow">
 				<text class="cell-tit clamp">积分抵扣</text>

+ 299 - 203
pages/product/classify.vue

@@ -1,204 +1,300 @@
-<template>
-	<view class="container">
-		<!-- 头部轮播 -->
-		<view class="carousel-section">
-			<swiper class="carousel" autoplay="true" duration="400" interval="5000">
-				<swiper-item v-for="(item, index) in bannerImg" :key="index" class="carousel-item" @click="bannerNavToUrl(item)">
-					<image :src="item.img" mode=" scaleToFill" />
-				</swiper-item>
-			</swiper>
-		</view>
-		<view class="type-title-box flex">
-			<view class="title-border"></view>
-			<view class="title-content">
-				<text v-if="type == 1">精品推荐</text>
-				<text v-if="type == 2">热门榜单</text>
-				<text v-if="type == 3">首发新品</text>
-				<text v-if="type == 4">促销单品</text>
-			</view>
-			<view class="title-border"></view>
-		</view>
-
-		<view class="goodsList-box">
-			<view class="goodsList-item flex" :key="ind" v-for="(ls, ind) in list">
-				<image :src="ls.image" mode=" scaleToFill"></image>
-				<view class="goodsList-content">
-					<view class="title">
-						<text>{{ ls.store_name }}</text>
-					</view>
-					<view class="goods-money flex">
-						<view class="money-box">
-							<view class="money">
-								<text class="font-size-sm">¥</text>
-								{{ ls.price }}
-							</view>
-							<view class="otMoney-box">
-								<text class="otMoney">¥{{ ls.ot_price }}</text>
-								<text class="sales">已售{{ ls.sales }}件</text>
-							</view>
-						</view>
-						<view @click="navTo(ls)" class="cart iconfont iconcart"></view>
-					</view>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-import { groomList } from '@/api/product.js';
-export default {
-	data() {
-		return {
-			list: [],
-			bannerImg: []
-		};
-	},
-	onLoad(option) {
-		// 获取查询对象
-		this.type = option.type;
-		// 加载基础数据
-		this.loadData();
-	},
-	methods: {
-		navTo: function(ls) {
-			uni.navigateTo({
-				url: '/pages/product/product?id=' + ls.id
-			});
-		},
-		// 请求载入数据
-		async loadData() {
-			groomList({}, this.type)
-				.then(({ data }) => {
-					// 保存轮播图
-					this.bannerImg = data.banner;
-					// 保存商品信息
-					this.list = data.list;
-				})
-				.catch(e => {
-					console.log(e);
-				});
-		},
-		// 轮播图跳转
-		bannerNavToUrl(item) {
-			// #ifdef H5
-			if (item.wap_link.indexOf('http') > 0) {
-				window.location.href = item.wap_link;
-			}
-			// #endif
-			if (item.wap_link) {
-				uni.navigateTo({
-					url: item.wap_link
-				});
-			}
-		}
-	}
-};
-</script>
-
-<style lang="scss">
-page {
-	background: $page-color-base;
-}
-.carousel-section {
-	padding: 0;
-	.titleNview-placing {
-		padding-top: 0;
-		height: 0;
-	}
-	.swiper-dots {
-		left: 45rpx;
-		bottom: 40rpx;
-	}
-	.carousel {
-		width: 100%;
-		height: 360rpx;
-		.carousel-item {
-			width: 100%;
-			height: 100%;
-			overflow: hidden;
-		}
-		image {
-			width: 100%;
-			height: 100%;
-		}
-	}
-}
-// 中间标题样式
-.type-title-box {
-	padding: 40rpx;
-	.title-content {
-		height: 100%;
-		width: 200rpx;
-		text-align: center;
-		font-size: $font-lg;
-		font-weight: 500;
-		color: $font-color-dark;
-	}
-	.title-border {
-		width: 250rpx;
-		height: 2rpx;
-		background-color: #e9e9e9;
-	}
-}
-// 商品列表
-.goodsList-box {
-	.goodsList-item {
-		margin-bottom: 40rpx;
-		background-color: #ffffff;
-		padding: 30rpx;
-		image {
-			flex-shrink: 0;
-			border-radius: $border-radius-sm;
-			height: 180rpx;
-			width: 180rpx;
-		}
-		.goodsList-content {
-			margin-left: 20rpx;
-			flex-grow: 1;
-			height: 180rpx;
-			position: relative;
-			.title {
-				font-size: $font-base;
-				color: $font-color-dark;
-				font-weight: 500;
-			}
-			.goods-money {
-				position: absolute;
-				left: 0;
-				bottom: 0;
-				width:100%;
-				.money-box {
-					.money {
-						font-size: $font-lg;
-						color: $color-red;
-						font-weight: bold;
-					}
-					.otMoney-box {
-						font-size: $font-sm;
-						.otMoney {
-							color: $font-color-dark;
-							padding-right: 20rpx;
-						}
-						.sales {
-							color: $font-color-light;
-						}
-					}
-				}
-				.cart {
-					border: 1px solid $color-red;
-					color: $color-red;
-					font-size: $font-base;
-					font-weight: bold;
-					border-radius: 99px;
-					width: 55rpx;
-					height: 55rpx;
-					display: flex;
-					justify-content: center;
-					align-items: center;
-				}
-			}
-		}
-	}
-}
+<template>
+	<view class="container">
+		<empty v-if="loaded === true && list.length === 0"></empty>
+		<view class="hotgoods">
+			<view class="hotgoods-item" v-for="item in list" :key="item.id" @click="navToDetailPage(item)">
+				<view class="image-wrapper">
+					<image :src="item.image" mode="scaleToFill"></image>
+				</view>
+				<view class="title clamp margin-c-20">{{ item.store_name }}</view>
+				<view class="hot-price">
+					<view class="price">
+						<text class="font-size-sm">¥</text>
+						{{ item.price }}
+					</view>
+				</view>
+			</view>
+		</view>
+		<uni-load-more :status="loadingType"></uni-load-more>
+	</view>
+</template>
+
+<script>
+	import empty from '@/components/empty';
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+	import {
+		groomList
+	} from '@/api/product.js';
+	export default {
+		data() {
+			return {
+				list: [],
+				bannerImg: [],
+				type: 1, //1->置换
+				loadingType: 'more',
+				loaded:false,
+				page: 1,
+				limit:20
+			};
+		},
+		components: {
+			uniLoadMore,
+			empty
+		},
+		onReachBottom() {
+			this.loadData();
+		},
+		onLoad(option) {
+			// 获取查询对象
+			if (option.type) {
+				this.type = option.type;
+				uni.setNavigationBarTitle({
+					title: option.type == 1? '置换': (option.type == 4? '随意嗨购':(option.type == 3? '大牌专区': ''))
+				})
+			}
+			// 加载基础数据
+			this.loadData();
+		},
+		methods: {
+			navTo: function(ls) {
+				uni.navigateTo({
+					url: '/pages/product/product?id=' + ls.id
+				});
+			},
+			// 请求载入数据
+			async loadData() {
+				let obj = this
+				if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
+					return
+				}
+				obj.loadingType = 'loading'
+				groomList({
+					page: obj.page,
+					limit:obj.limit
+				}, this.type)
+					.then(({
+						data
+					}) => {
+						// 保存轮播图
+						obj.bannerImg = data.banner;
+						// 保存商品信息
+						obj.list = this.list.concat(data.list)
+						obj.loaded = true
+						obj.page++
+						if(obj.limit == data.list.length) {
+							obj.loadingType = 'more'
+						}else {
+							obj.loadingType = 'noMore'
+						}
+					})
+					.catch(e => {
+						console.log(e);
+					});
+			},
+			// 轮播图跳转
+			bannerNavToUrl(item) {
+				// #ifdef H5
+				if (item.wap_link.indexOf('http') > 0) {
+					window.location.href = item.wap_link;
+				}
+				// #endif
+				if (item.wap_link) {
+					uni.navigateTo({
+						url: item.wap_link
+					});
+				}
+			},
+			navToDetailPage(e) {
+				uni.navigateTo({
+					url: '/pages/product/product?id=' + e.id
+				})
+			}
+		}
+	};
+</script>
+
+<style lang="scss">
+	page {
+		background: $page-color-base;
+	}
+
+	.carousel-section {
+		padding: 0;
+
+		.titleNview-placing {
+			padding-top: 0;
+			height: 0;
+		}
+
+		.swiper-dots {
+			left: 45rpx;
+			bottom: 40rpx;
+		}
+
+		.carousel {
+			width: 100%;
+			height: 360rpx;
+
+			.carousel-item {
+				width: 100%;
+				height: 100%;
+				overflow: hidden;
+			}
+
+			image {
+				width: 100%;
+				height: 100%;
+			}
+		}
+	}
+
+	// 中间标题样式
+	.type-title-box {
+		padding: 40rpx;
+
+		.title-content {
+			height: 100%;
+			width: 200rpx;
+			text-align: center;
+			font-size: $font-lg;
+			font-weight: 500;
+			color: $font-color-dark;
+		}
+
+		.title-border {
+			width: 250rpx;
+			height: 2rpx;
+			background-color: #e9e9e9;
+		}
+	}
+
+	// 商品列表
+	.goodsList-box {
+		.goodsList-item {
+			margin-bottom: 40rpx;
+			background-color: #ffffff;
+			padding: 30rpx;
+
+			image {
+				flex-shrink: 0;
+				border-radius: $border-radius-sm;
+				height: 180rpx;
+				width: 180rpx;
+			}
+
+			.goodsList-content {
+				margin-left: 20rpx;
+				flex-grow: 1;
+				height: 180rpx;
+				position: relative;
+
+				.title {
+					font-size: $font-base;
+					color: $font-color-dark;
+					font-weight: 500;
+				}
+
+				.goods-money {
+					position: absolute;
+					left: 0;
+					bottom: 0;
+					width: 100%;
+
+					.money-box {
+						.money {
+							font-size: $font-lg;
+							color: $color-red;
+							font-weight: bold;
+						}
+
+						.otMoney-box {
+							font-size: $font-sm;
+
+							.otMoney {
+								color: $font-color-dark;
+								padding-right: 20rpx;
+							}
+
+							.sales {
+								color: $font-color-light;
+							}
+						}
+					}
+
+					.cart {
+						border: 1px solid $color-red;
+						color: $color-red;
+						font-size: $font-base;
+						font-weight: bold;
+						border-radius: 99px;
+						width: 55rpx;
+						height: 55rpx;
+						display: flex;
+						justify-content: center;
+						align-items: center;
+					}
+				}
+			}
+		}
+	}
+
+	.hotgoods {
+		margin-top: 38rpx;
+		width: 100%;
+		display: flex;
+		flex-wrap: wrap;
+		padding: 0 32rpx;
+
+		.hotgoods-item {
+			width: 48%;
+			background-color: #ffffff;
+			border-radius: 12rpx;
+			margin-bottom: 24rpx;
+
+			&:nth-child(2n + 1) {
+				margin-right: 24rpx;
+			}
+
+			.image-wrapper {
+				width: 100%;
+				height: 330rpx;
+				// background: red;
+				border-radius: 3px;
+				overflow: hidden;
+
+				image {
+					width: 100%;
+					height: 100%;
+					opacity: 1;
+					border-radius: 12rpx 12rpx 0 0;
+				}
+			}
+
+			.title {
+				font-size: $font-base;
+				color: $font-color-dark;
+				font-weight: bold;
+				line-height: 80rpx;
+			}
+
+			.hot-price {
+				display: flex;
+				justify-content: space-between;
+				padding: 0 16rpx 12rpx;
+
+				.price {
+					font-size: 36rpx;
+					font-weight: bold;
+					color: #FD3B39;
+				}
+
+				.cart-icon {
+					image {
+						width: 44rpx;
+						height: 44rpx;
+					}
+				}
+			}
+		}
+	}
 </style>

+ 197 - 79
pages/product/new.vue

@@ -1,80 +1,198 @@
-<template>
-	<view class="center">
-		<view class="top">
-			<image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
-			<view class="title">
-				新品
-			</view>
-		</view>
-		<swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
-			<swiper-item class="carousel-item" @click="bannerNavToUrl(item)"><image src="../../static/img/new.png" /></swiper-item>
-		</swiper>
-		<view class="hotgoods" v-if="firstList.length != 0">
-			<view class="hotgoods-item" v-for="item in firstList" :key="item.id" @click="navToDetailPage(item)">
-				<view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
-				<view class="title clamp margin-c-20">{{ item.store_name }}</view>
-				<view class="hot-price">
-					<view class="price">
-						<text class="font-size-sm">¥</text>
-						{{ item.price }}
-					</view>
-				</view>
-			</view>
-		</view>
-		<u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar" ></u-tabbar>
-	</view>
-</template>
-
-<script>
-import { tabbar1 } from '@/utils/tabbar.js';
-export default {
-	data() {
-		return {
-			current: 3,
-			tabbar: tabbar1,
-			firstList:[],
-		}
-	}
-}
-</script>
-
-<style lang="less">
-page,
-.center {
-	min-height: 100%;
-	height: auto;
-	background: #FFFFFF;
-}
-.top {
-	position: relative;
-	width: 100%;
-	height: 400rpx;
-	.top-bg {
-		position: absolute;
-		top: 0;
-		left: 0;
-		right: 0;
-		width: 100%;
-		height: 100%;
-	}
-	.title {
-		position: relative;
-		z-index: 2;
-		padding: 30rpx 0;
-		font-size: 34rpx;
-		font-family: PingFang SC;
-		font-weight: bold;
-		color: #FFFFFF;
-		text-align: center;
-	}
-}
-.carousel {
-	width: 700rpx;
-	height: 300rpx;
-	margin: -280rpx auto 0;
-	image {
-		width: 700rpx;
-		height: 300rpx;
-	}
-}
+<template>
+	<view class="center">
+		<view class="top">
+			<image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
+			<view class="title">
+				新品
+			</view>
+		</view>
+		<swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
+			<swiper-item class="carousel-item" @click="bannerNavToUrl(item)">
+				<image src="../../static/img/new.png" />
+			</swiper-item>
+		</swiper>
+		<view class="hotgoods" v-if="firstList.length != 0">
+			<view class="hotgoods-item" v-for="item in firstList" :key="item.id" @click="navToDetailPage(item)">
+				<view class="image-wrapper">
+					<image :src="item.image" mode="scaleToFill"></image>
+				</view>
+				<view class="title clamp margin-c-20">{{ item.store_name }}</view>
+				<view class="hot-price">
+					<view class="price">
+						<text class="font-size-sm">¥</text>
+						{{ item.price }}
+					</view>
+				</view>
+			</view>
+		</view>
+		<u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar"></u-tabbar>
+	</view>
+</template>
+
+<script>
+	import {
+		tabbar1
+	} from '@/utils/tabbar.js';
+	import {
+		groomList
+	} from '@/api/product.js';
+	export default {
+		data() {
+			return {
+				current: 3,
+				tabbar: tabbar1,
+				firstList: [],
+				type: 2,
+				page: 1,
+				limit: 20,
+				loaded: false,
+				loadingType: 'more'
+			}
+		},
+		onLoad() {
+			this.loadData()
+		},
+		methods: {
+			loadData() {
+				let obj = this
+				if (obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
+					return
+				}
+				obj.loadingType = 'loading'
+				groomList({
+						page: obj.page,
+						limit: obj.limit
+					}, this.type)
+					.then(({
+						data
+					}) => {
+						// 保存轮播图
+						obj.bannerImg = data.banner;
+						// 保存商品信息
+						obj.firstList = this.firstList.concat(data.list)
+						obj.loaded = true
+						obj.page++
+						if (obj.limit == data.list.length) {
+							obj.loadingType = 'more'
+						} else {
+							obj.loadingType = 'noMore'
+						}
+					})
+					.catch(e => {
+						console.log(e);
+					});
+			},
+			navToDetailPage(e) {
+				uni.navigateTo({
+					url: '/pages/product/product?id=' + e.id
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page,
+	.center {
+		min-height: 100%;
+		height: auto;
+		background: #FFFFFF;
+	}
+
+	.top {
+		position: relative;
+		width: 100%;
+		height: 400rpx;
+
+		.top-bg {
+			position: absolute;
+			top: 0;
+			left: 0;
+			right: 0;
+			width: 100%;
+			height: 100%;
+		}
+
+		.title {
+			position: relative;
+			z-index: 2;
+			padding: 30rpx 0;
+			font-size: 34rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #FFFFFF;
+			text-align: center;
+		}
+	}
+
+	.carousel {
+		width: 700rpx;
+		height: 300rpx;
+		margin: -280rpx auto 0;
+
+		image {
+			width: 700rpx;
+			height: 300rpx;
+		}
+	}
+
+	.hotgoods {
+		margin-top: 38rpx;
+		width: 100%;
+		display: flex;
+		flex-wrap: wrap;
+		padding: 0 32rpx;
+
+		.hotgoods-item {
+			width: 48%;
+			background-color: #ffffff;
+			border-radius: 12rpx;
+			margin-bottom: 24rpx;
+
+			&:nth-child(2n + 1) {
+				margin-right: 24rpx;
+			}
+
+			.image-wrapper {
+				width: 100%;
+				height: 330rpx;
+				// background: red;
+				border-radius: 3px;
+				overflow: hidden;
+
+				image {
+					width: 100%;
+					height: 100%;
+					opacity: 1;
+					border-radius: 12rpx 12rpx 0 0;
+				}
+			}
+
+			.title {
+				font-size: $font-base;
+				color: $font-color-dark;
+				font-weight: bold;
+				line-height: 80rpx;
+			}
+
+			.hot-price {
+				display: flex;
+				justify-content: space-between;
+				padding: 0 16rpx 12rpx;
+
+				.price {
+					font-size: 36rpx;
+					font-weight: bold;
+					color: #FD3B39;
+				}
+
+				.cart-icon {
+					image {
+						width: 44rpx;
+						height: 44rpx;
+					}
+				}
+			}
+		}
+	}
 </style>

+ 5 - 4
pages/product/product.vue

@@ -35,9 +35,10 @@
 			<text class="title" v-if="goodsType == 1">{{ goodsObjact.title }}</text>
 			<view class="price-box" v-if="goodsType == 0">
 				<text class="price-tip">¥</text>
-				<text class="price">{{ goodsObjact.price }}</text>
+				<text class="price">{{ goodsObjact.price }}<text v-if="details.integral" style="padding-left: 8rpx;">+{{details.integral}} 趣豆</text></text>
 				<text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text>
-				<!-- <text class="coupon-tip">7折</text> -->
+				<!-- <text class="coupon-tip">7折</text> -->
+				
 			</view>
 			<text class="title" v-if="goodsType == 0">{{ goodsObjact.store_name }}</text>
 			<view class="bot-row">
@@ -46,14 +47,14 @@
 				<text style="text-align: right;">{{ storeObjact.address | address }}</text>
 			</view>
 		</view>
-		<view class="c-list">
+		<!-- <view class="c-list">
 			<view class="c-row b-b">
 				<text class="tit">赠送</text>
 				<view class="con">
 					<text class="selected-text">购买赠送<text class="num">200</text>艺金券</text>
 				</view>
 			</view>
-		</view>
+		</view> -->
 		<view class="c-list">
 			<view class="c-row b-b" @click="toggleSpec">
 				<text class="tit">购买数量</text>