Selaa lähdekoodia

Merge branch 'master' of http://git.liuniu946.com/lhl/tlfb

hwq 3 vuotta sitten
vanhempi
commit
95e5e39c39

+ 9 - 0
api/whole.js

@@ -80,4 +80,13 @@ export function packageAudit(data) {
 		method: 'post',
 		data
 	});
+}
+
+//获取普通批发商品详情
+export function getWholeInfo(data,id) {
+	return request({
+		url: '/api/package/info/' + id,
+		method: 'get',
+		data
+	});
 }

+ 6 - 0
pages.json

@@ -488,6 +488,12 @@
 			"style": {
 				"navigationBarTitleText": "商品详情"
 			}
+		},
+		{
+			"path": "pages/product/realyWhole",
+			"style": {
+				"navigationBarTitleText": "商品详情"
+			}
 		}
 	],
 	"subPackages": [{

+ 2 - 1
pages/index/index.vue

@@ -30,7 +30,8 @@
 		</view>
 		<!-- 分类 -->
 		<view class="cate-section">
-			<navigator url="/pages/product/newPeople" v-if="userInfo.is_whole == 0">
+			<!-- <navigator url="/pages/product/newPeople" v-if="userInfo.is_whole == 0"> -->
+				<navigator url="/pages/product/newPeople">
 				<view class="cate-item">
 					<image src="/static/img/index-nav1.png"></image>
 					<text>新人专区</text>

+ 178 - 0
pages/product/realyWhole.vue

@@ -0,0 +1,178 @@
+<template>
+	<view class="content">
+		<!-- 轮播图 -->
+		<top-swiper :imgList="imgList"></top-swiper>
+		<!-- 价格 -->
+		<view class="good-price flex">
+			<view class="new-price">
+				¥{{goodItem.price}}
+			</view>
+			<view class="old-price" v-if="goodItem.whole && (goodItem.whole.ot_price*1 > goodItem.price*1)">
+				¥{{goodItem.whole.ot_price}}
+			</view>
+		</view>
+		<!-- 标题 -->
+		<view class="good-tit">
+			{{goodItem.title}}
+		</view>
+		<content-text :description="description"></content-text>
+		<view class="btn-ts" style="height: 130rpx; background-color: #fff;"></view>
+		<view class="btm-btn" @click="loading? '':reservePackage()">
+			立即预约
+		</view>
+	</view>
+</template>
+
+<script>
+	// 头部轮播图
+	import topSwiper from './common/topSwiper.vue';
+	// 图文详情
+	import contentText from './common/contentText.vue';
+
+	import {
+		getWholeDetai,
+		reservePackage,
+		getWholeInfo
+	} from '@/api/whole.js'
+	export default {
+		components: {
+			topSwiper,
+			contentText
+		},
+		data() {
+			return {
+				imgList: [],
+				goodItem: {},
+				good_id: '',
+				time_id: '',
+				status: 1,
+				is_new: '',
+				description: '',
+				loading: true,
+			}
+		},
+		onLoad(opt) {
+			if (opt.id) {
+				this.good_id = opt.id
+			}
+			if (opt.time) {
+				this.time_id = opt.time
+				// console.log()
+			}
+			this.getWholeDetai()
+		},
+		methods: {
+			getWholeDetai() {
+				let obj = this
+
+				getWholeInfo({}, obj.good_id).then(({
+					data
+				}) => {
+					console.log(data)
+					obj.goodItem = data
+					obj.imgList = data.whole.images
+					obj.description = data.whole.description.replace(/\<img/gi, '<img class="rich-img"')
+					obj.loading = false
+				})
+
+			},
+			// 预约包
+			reservePackage() {
+				let obj = this
+				if (obj.goodItem.isSeckillEnd.status == 0) {
+					obj.$api.msg('今日该场次已结束')
+					return
+				}
+				if (obj.goodItem.isSeckillEnd.status == 2) {
+					obj.$api.msg('今日该场次未开始,请稍后')
+					return
+				}
+				let updata = {
+					whole_id: obj.goodItem.whole.id,
+					time_id: obj.time_id,
+					price: obj.goodItem.price,
+					to_uid: obj.goodItem.to_uid,
+					first_price: obj.goodItem.first_price,
+					last_id: obj.goodItem.id
+				}
+				console.log(updata, 'updata')
+				obj.loading = true
+				reservePackage(updata).then(res => {
+					uni.showToast({
+						title: '预约成功',
+						duration: 2000
+					});
+					setTimeout(function() {
+						uni.navigateTo({
+							url: '/pages/user/myWholesale'
+						});
+					}, 800);
+				}).catch(err => {
+					obj.loading = false
+					console.log(err)
+					this.getWholeDetai()
+				})
+			}
+
+		},
+
+	}
+</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;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #FF4C4C;
+		}
+
+		.old-price {
+			padding-left: 8rpx;
+			font-size: 33rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			text-decoration: line-through;
+			color: #999999;
+
+		}
+
+	}
+
+	.good-tit {
+		padding: 20rpx;
+		background-color: #fff;
+	}
+
+	.btm-btn {
+		position: fixed;
+		bottom: 35rpx;
+		left: 0;
+		right: 0;
+		margin: auto;
+		width: 699rpx;
+		height: 90rpx;
+		line-height: 90rpx;
+		text-align: center;
+		background: linear-gradient(90deg, #FE6F61 0%, #FF4343 100%);
+		border-radius: 45rpx;
+		font-size: 36rpx;
+		font-family: PingFang SC;
+		font-weight: 500;
+		color: #FFFFFF;
+		// background-color: #fff;
+	}
+
+	/* 商品详情中限制图片大小 */
+	/deep/ .rich-img {
+		width: 100% !important;
+		height: auto;
+	}
+</style>

+ 11 - 10
pages/product/wholesale.vue

@@ -12,7 +12,7 @@
 		</view>
 
 		<view class="center-btn flex" @click="navto('/pages/user/myWholesale')">
-			<image src="" mode="" class="center-logo"></image>
+			<image src="../../static/icon/pf-logo.png" mode="" class="center-logo"></image>
 			<view class="center-tit">
 				<view class="tit-top">
 					批发订单
@@ -134,15 +134,16 @@
 		methods: {
 			gotoDetail(item) {
 				let obj = this
-				if(obj.status == 1 ) {
-					obj.navto('/pages/product/wholesaleDetail?id=' + item.id + '&time=' + item.time_id + '&status=' + item.status)
-				}
-				if(obj.status == 0) {
-					obj.$api.msg('今日该场次已结束')
-				}
-				if(obj.status == 2) {
-					obj.$api.msg('今日该场次未开始,请稍后')
-				}
+				obj.navto('/pages/product/realyWhole?id=' + item.id + '&time=' + item.time_id)
+				// if(obj.status == 1 ) {
+				// 	obj.navto('/pages/product/wholesaleDetail?id=' + item.id)
+				// }
+				// if(obj.status == 0) {
+				// 	obj.$api.msg('今日该场次已结束')
+				// }
+				// if(obj.status == 2) {
+				// 	obj.$api.msg('今日该场次未开始,请稍后')
+				// }
 			},
 			navto(url) {
 				uni.navigateTo({

+ 31 - 18
pages/product/wholesaleDetail.vue

@@ -33,7 +33,8 @@
 
 	import {
 		getWholeDetai,
-		reservePackage
+		reservePackage,
+		getWholeInfo
 	} from '@/api/whole.js'
 	export default {
 		components: {
@@ -53,19 +54,26 @@
 			}
 		},
 		onLoad(opt) {
-			this.good_id = opt.id
-			this.time_id = opt.time
-			this.status = opt.status
-			if(opt.is_new) {
+			if (opt.id) {
+				this.good_id = opt.id
+			}
+			if (opt.time) {
+				this.time_id = opt.time
+			}
+			if (opt.status) {
+				this.status = opt.status
+			}
+
+			if (opt.is_new) {
 				this.is_new = opt.is_new
 			}
-			
+
 			this.getWholeDetai()
 		},
 		methods: {
 			getWholeDetai() {
 				let obj = this
-				if(obj.is_new) {
+				if (obj.is_new) {
 					getWholeDetai({}, obj.good_id, obj.time_id, obj.status, 1).then(({
 						data
 					}) => {
@@ -73,16 +81,21 @@
 						obj.imgList = data.storeInfo.images
 						obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
 					})
-				}else {
-					getWholeDetai({}, obj.good_id, obj.time_id, obj.status,0).then(({
-						data
-					}) => {
+				} else {
+					getWholeInfo({},obj.good_id).then(({data}) => {
 						obj.goodItem = data.storeInfo
 						obj.imgList = data.storeInfo.images
 						obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
 					})
+					// getWholeDetai({}, obj.good_id, obj.time_id, obj.status, 0).then(({
+					// 	data
+					// }) => {
+					// 	obj.goodItem = data.storeInfo
+					// 	obj.imgList = data.storeInfo.images
+					// 	obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
+					// })
 				}
-				
+
 			},
 			// 预约包
 			reservePackage() {
@@ -91,22 +104,22 @@
 					whole_id: obj.good_id,
 					time_id: obj.time_id,
 					price: obj.goodItem.price,
-					to_uid: obj.is_new == 'isn' ? 0:'',
-					first_price: obj.is_new =='isn'?0:'',
-					last_id: obj.is_new== 'isn'? 0: ''
+					to_uid: obj.is_new == 'isn' ? 0 : '',
+					first_price: obj.is_new == 'isn' ? 0 : '',
+					last_id: obj.is_new == 'isn' ? 0 : ''
 				}
 				obj.loading = true
 				reservePackage(updata).then(res => {
 					uni.showToast({
-						title:'预约成功',
-						duration:2000
+						title: '预约成功',
+						duration: 2000
 					});
 					setTimeout(function() {
 						uni.navigateTo({
 							url: '/pages/user/myWholesale'
 						});
 					}, 800);
-				}).catch( err => {
+				}).catch(err => {
 					obj.loading = false
 					console.log(err)
 				})

BIN
static/icon/pf-logo.png