lhl 3 سال پیش
والد
کامیت
0df92a7d5f
4فایلهای تغییر یافته به همراه276 افزوده شده و 175 حذف شده
  1. 4 4
      api/whole.js
  2. 182 140
      pages/product/newPeople.vue
  3. 66 17
      pages/product/wholesaleDetail.vue
  4. 24 14
      pages/public/login.vue

+ 4 - 4
api/whole.js

@@ -10,18 +10,18 @@ export function getWholeTimeArea(data) {
 }
 
 // 获取批发商品列表
-export function getWholeList(data,time) {
+export function getWholeList(data) {
 	return request({
-		url: '/api/whole/list/' + time,
+		url: '/api/whole/list/',
 		method: 'get',
 		data
 	});
 }
 
 // 获取批发商品详情
-export function getWholeDetai(data,) {
+export function getWholeDetai(data,id,time,status,is_new) {
 	return request({
-		url: '/api/whole/detail/:id/[:time]/[:status]' + time,
+		url: '/api/whole/detail/' + id + '/' + time + '/' + status + '/' + is_new,
 		method: 'get',
 		data
 	});

+ 182 - 140
pages/product/newPeople.vue

@@ -1,153 +1,195 @@
-<template>
-	<view class="newPeople">
-		<!-- <view class="header">
-			<view class="inputSearch" @click="clickSearch">
-				<image src="@/static/img/search.png"></image>
-				请输入关键词
-			</view>
-		</view> -->
+<template>
+	<view class="newPeople">
+		<!-- <view class="header">
+			<view class="inputSearch" @click="clickSearch">
+				<image src="@/static/img/search.png"></image>
+				请输入关键词
+			</view>
+		</view> -->
 		<!-- <data-list :data='data'></data-list> -->
 		<view class="good-wrap">
-			<view class="good" v-for="item in 9" @click="navto('/pages/product/wholesaleDetail')">
-				<image src="" mode="" class="goo-img"></image>
+			<view class="good" v-for="item in list"
+				@click="navto('/pages/product/wholesaleDetail?id=' + item.id + '&time=' + item.time_id + '&status=' + item.status + '&is_new=' + is_new)">
+				<image :src="item.image" mode="" class="goo-img"></image>
 				<view class="good-tit clamp">
-					无患子植物家居眼罩无患子植物家居眼罩无患子植物家居眼罩
+					{{item.title}}
 				</view>
 				<view class="good-price flex">
 					<view class="new-price">
-						¥2690
+						¥{{item.price}}
 					</view>
 					<view class="old-price">
-						¥3600
+						¥{{item.ot_price}}
 					</view>
 				</view>
 			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-import { loadIndexs } from '@/api/index.js';
-import dataList from '@/components/datalist.vue'
-import { getNewList } from '@/api/whole.js'
-	export default {
-		data() {
-			return {
-				// data: {
-				// 	page: 1,
-				// 	limit: 10,
-				// 	sum: 0,
-				// 	loadingType: 'loadmore',
-				// 	data: []
-				// }
-			}
-		},
-		components: {
-			dataList
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	import {
+		loadIndexs
+	} from '@/api/index.js';
+	import {
+		getUserInfo
+	} from '@/api/user.js'
+	import dataList from '@/components/datalist.vue'
+	import {
+		getNewList
+	} from '@/api/whole.js'
+	export default {
+		data() {
+			return {
+				list: [],
+				is_new: 1,
+				// data: {
+				// 	page: 1,
+				// 	limit: 10,
+				// 	sum: 0,
+				// 	loadingType: 'loadmore',
+				// 	data: []
+				// }
+			}
+		},
+		components: {
+			dataList
 		},
 		onLoad() {
 			this.getNewList()
-		},
-		// mounted() {
-		// 	this.init()
-		// },
-		methods: {
-			// 點擊搜索框
-			clickSearch() {
-				uni.navigateTo({
-					url: '/pages/product/search'
-				});
-			},
-			init() {
-				this.getData()
+			this.getUserInfo()
+		},
+		// mounted() {
+		// 	this.init()
+		// },
+		methods: {
+			...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
+			getUserInfo() {
+				getUserInfo().then(res => {
+					console.log(res)
+					this.setUserInfo(res.data);
+					this.is_new = res.data.is_whole
+				})
+			},
+			navto(url) {
+				uni.navigateTo({
+					url: url
+				})
+			},
+			// 點擊搜索框
+			clickSearch() {
+				uni.navigateTo({
+					url: '/pages/product/search'
+				});
+			},
+			init() {
+				this.getData()
 			},
 			getNewList() {
 				getNewList().then(res => {
-					console.log(res,'getNewList')
+					console.log(res, 'getNewList')
+					this.list = res.data
+				})
+			},
+			getData() {
+				loadIndexs().then(res => {
+					this.data = res.data.info.bastList
+					this.loadingType = 'nomore'
 				})
-			},
-			getData() {
-				loadIndexs().then(res => {
-					this.data = res.data.info.bastList
-					this.loadingType = 'nomore'
-				})
-			}
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-$grey: #95A0B1;
-$text: #333333;
-$red: #FF4C4C;
-	.newPeople {
-		.header {
-			background-color: #fff;
-			padding: 30rpx;
-			.inputSearch {
-				line-height: 35rpx;
-				text-align: center;
-				color: $grey;
-				padding: 10rpx 20rpx;
-				border-radius: 50rpx;
-				background-color: $page-color-base;
-				image {
-					width: 32rpx;
-					height: 32rpx;
-					margin: 0 20rpx;
-					margin-bottom: -3rpx;
-				}
-			}
-		}
-		.list {
-			padding: 20rpx;
-			display: flex;
-			justify-content: space-between;
-			flex-wrap: wrap;
-			.item {
-				background-color: #fff;
-				border-radius: 10rpx;
-				overflow: hidden;
-				// box-shadow: 2rpx 2rpx 10rpx #e1e1e1;
-				margin: 10rpx 0;
-				width: 48%;
-				height: 0;
-				padding-bottom: calc(48% + 120rpx);
-				.img {
-					border-radius: 10rpx;
-					overflow: hidden;
-					width: 100%;
-					height: 0;
-					padding-bottom: 100%;
-					image {
-						width: 100%;
-						height: 100%;
-					}
-				}
-				.name {
-					margin: 0 10rpx;
-					font-size: 30rpx;
-					font-weight: bold;
-				}
-				.allprice {
-					padding: 20rpx 0;
-					.price {
-						color: $red;
-					}
-					.ot-price {
-						color: $grey;
-						text-decoration: line-through;
-						font-size: 26rpx;
-					}
-				}
-			}
-		}
-		.load {
-			text-align: center;
-			color: $grey;
-			font-size: 28rpx;
-		}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	$grey: #95A0B1;
+	$text: #333333;
+	$red: #FF4C4C;
+
+	.newPeople {
+		.header {
+			background-color: #fff;
+			padding: 30rpx;
+
+			.inputSearch {
+				line-height: 35rpx;
+				text-align: center;
+				color: $grey;
+				padding: 10rpx 20rpx;
+				border-radius: 50rpx;
+				background-color: $page-color-base;
+
+				image {
+					width: 32rpx;
+					height: 32rpx;
+					margin: 0 20rpx;
+					margin-bottom: -3rpx;
+				}
+			}
+		}
+
+		.list {
+			padding: 20rpx;
+			display: flex;
+			justify-content: space-between;
+			flex-wrap: wrap;
+
+			.item {
+				background-color: #fff;
+				border-radius: 10rpx;
+				overflow: hidden;
+				// box-shadow: 2rpx 2rpx 10rpx #e1e1e1;
+				margin: 10rpx 0;
+				width: 48%;
+				height: 0;
+				padding-bottom: calc(48% + 120rpx);
+
+				.img {
+					border-radius: 10rpx;
+					overflow: hidden;
+					width: 100%;
+					height: 0;
+					padding-bottom: 100%;
+
+					image {
+						width: 100%;
+						height: 100%;
+					}
+				}
+
+				.name {
+					margin: 0 10rpx;
+					font-size: 30rpx;
+					font-weight: bold;
+				}
+
+				.allprice {
+					padding: 20rpx 0;
+
+					.price {
+						color: $red;
+					}
+
+					.ot-price {
+						color: $grey;
+						text-decoration: line-through;
+						font-size: 26rpx;
+					}
+				}
+			}
+		}
+
+		.load {
+			text-align: center;
+			color: $grey;
+			font-size: 28rpx;
+		}
 	}
+
 	.good-wrap {
 		display: flex;
 		// padding: 0 0 20rpx 20rpx;
@@ -155,7 +197,7 @@ $red: #FF4C4C;
 		padding-top: 20rpx;
 		flex-wrap: wrap;
 	}
-	
+
 	.good {
 		width: 345rpx;
 		height: 480rpx;
@@ -164,34 +206,34 @@ $red: #FF4C4C;
 		background: #FFFFFF;
 		box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
 		border-radius: 10rpx;
-	
+
 		.goo-img {
 			width: 345rpx;
 			height: 345rpx;
 			border-radius: 10rpx 10rpx 0 0;
 			background-color: #bfa;
 		}
-	
+
 		.good-tit {
 			padding: 15rpx 20rpx;
 			font-size: 30rpx;
 			font-family: PingFang SC;
 			font-weight: bold;
 			color: #333333;
-			line-height: 35rpx;
+			// line-height: 35rpx;
 		}
-	
+
 		.good-price {
 			padding-left: 20rpx;
 			justify-content: flex-start;
-	
+
 			.new-price {
 				font-size: 36rpx;
 				font-family: PingFang SC;
 				font-weight: bold;
 				color: #FF4C4C;
 			}
-	
+
 			.old-price {
 				padding-left: 8rpx;
 				font-size: 26rpx;
@@ -199,8 +241,8 @@ $red: #FF4C4C;
 				font-weight: bold;
 				text-decoration: line-through;
 				color: #999999;
-	
+
 			}
 		}
-	}
+	}
 </style>

+ 66 - 17
pages/product/wholesaleDetail.vue

@@ -5,31 +5,36 @@
 		<!-- 价格 -->
 		<view class="good-price flex">
 			<view class="new-price">
-				¥2690
+				¥{{goodItem.price}}
 			</view>
 			<view class="old-price">
-				¥3600
+				¥{{goodItem.ot_price}}
 			</view>
 		</view>
 		<!-- 标题 -->
 		<view class="good-tit">
-			GUCCI古驰马衔扣1955系列单肩包女包春秋新款送礼佳品
+			{{goodItem.title}}
 		</view>
 		<content-text :description="description"></content-text>
 		<view class="btn-ts" style="height: 130rpx; background-color: #fff;">
-			
+
 		</view>
-		<view class="btm-btn">
+		<view class="btm-btn" @click="reservePackage">
 			立即预约
 		</view>
-	</view>
-</template>
-
+	</view>
+</template>
+
 <script>
 	// 头部轮播图
 	import topSwiper from './common/topSwiper.vue';
 	// 图文详情
 	import contentText from './common/contentText.vue';
+
+	import {
+		getWholeDetai,
+		reservePackage
+	} from '@/api/whole.js'
 	export default {
 		components: {
 			topSwiper,
@@ -37,24 +42,58 @@
 		},
 		data() {
 			return {
-				imgList: [1,2]
+				imgList: [],
+				goodItem: {},
+				good_id: '',
+				time_id: '',
+				status: 1,
+				is_new: 0,//是否是新人 0->是 1->不是
+				description: ''
 			}
 		},
 		onLoad(opt) {
-			
+			this.good_id = opt.id
+			this.time_id = opt.time
+			this.status = opt.status
+			this.is_new = opt.is_new == 0 ? 1 : 0
+			this.getWholeDetai()
 		},
 		methods: {
-			
+			getWholeDetai() {
+				let obj = this
+				getWholeDetai({}, obj.good_id, obj.time_id, obj.status, obj.is_new).then(({
+					data
+				}) => {
+					obj.goodItem = data.storeInfo
+					obj.imgList = data.storeInfo.images
+					obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
+				})
+			},
+			reservePackage() {
+				let obj = this
+				let updata = {
+					whole_id: obj.good_id,
+					time_id: obj.time_id,
+					price: obj.goodItem.price,
+					to_uid: obj.is_new == 0 ? '':0,
+					first_price: obj.is_new == 0?'':0,
+					last_id: obj.is_new== 0? '': 0
+				}
+				reservePackage(updata).then(res => {
+					console.log(res)
+				})
+			}
 		}
-	}
-</script>
-
+	}
+</script>
+
 <style lang="scss" scoped>
 	.good-price {
 		padding-left: 20rpx;
 		padding-top: 20rpx;
 		justify-content: flex-start;
 		background-color: #fff;
+
 		// align-items: f;
 		.new-price {
 			font-size: 50rpx;
@@ -62,6 +101,7 @@
 			font-weight: bold;
 			color: #FF4C4C;
 		}
+
 		.old-price {
 			padding-left: 8rpx;
 			font-size: 33rpx;
@@ -69,14 +109,16 @@
 			font-weight: bold;
 			text-decoration: line-through;
 			color: #999999;
-			
+
 		}
-		
+
 	}
+
 	.good-tit {
 		padding: 20rpx;
 		background-color: #fff;
 	}
+
 	.btm-btn {
 		position: fixed;
 		bottom: 35rpx;
@@ -93,5 +135,12 @@
 		font-family: PingFang SC;
 		font-weight: 500;
 		color: #FFFFFF;
-	}
+		// background-color: #fff;
+	}
+
+	/* 商品详情中限制图片大小 */
+	/deep/ .rich-img {
+		width: 100% !important;
+		height: auto;
+	}
 </style>

+ 24 - 14
pages/public/login.vue

@@ -201,21 +201,31 @@ export default {
 						obj.login();
 						// 保存返回用户数据
 						obj.setUserInfo(e.data);
-						let ur = uni.getStorageSync('present')|| '/pages/index/index';
+						let ur = uni.getStorageSync('present')|| '/pages/index/index';
+						if(e.data.wx_qr) {
+							uni.switchTab({
+								url: ur,
+								fail(e) {
+									uni.navigateTo({
+										url: ur,
+										fail(e) {
+											uni.navigateTo({
+												url: '/pages/index/index',
+											});
+										}
+									});
+								}
+							});
+						}else {
+							obj.$api.msg('请完善用户信息');
+							setTimeout(() => {
+								uni.navigateTo({
+									url: '/pages/set/userinfo'
+								});
+							}, 1000);
+						}
 						//成功跳转首页
-						uni.switchTab({
-							url: ur,
-							fail(e) {
-								uni.navigateTo({
-									url: ur,
-									fail(e) {
-										uni.navigateTo({
-											url: '/pages/index/index',
-										});
-									}
-								});
-							}
-						});
+						
 					});
 				})
 				.catch(function(e) {