Browse Source

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

xuhaolan 3 years ago
parent
commit
7ac5e055be

+ 1 - 1
components/datalist.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="dataList">
 		<view class="list">
-			<view class="item" v-for="d in data" @click="navto('/pages/product/product?id=' + d.id + '&is_gold=' + 1)">
+			<view class="item" v-for="d in data" @click="navto('/pages/product/product?id=' + d.id + '&is_integral=' + 1)">
 				<view class="img">
 					<image :src="d.image" mode=""></image>
 				</view>

+ 13 - 0
pages.json

@@ -102,6 +102,19 @@
 				}
 			}
 		},
+		{
+			"path": "pages/product/jindouProduct",
+			"style": {
+				"navigationBarBackgroundColor": "transparent",
+				"navigationBarTextStyle": "white",
+				"app-plus": {
+					"titleNView": {
+						"type": "float",
+						"titleText": "金豆专区"
+					}
+				}
+			}
+		},
 		{
 			"path": "pages/product/store",
 			"style": {

+ 1 - 1
pages/index/child/goldenBean.vue

@@ -16,7 +16,7 @@
 					</view>
 				</view>
 				<view class="right">
-					<image src="@/static/img/right.png" @click="navto('/pages/product/exchange')"></image>
+					<image src="@/static/img/right.png" @click="navto('/pages/product/jindouProduct')"></image>
 				</view>
 			</view>
 			<view class="footer">

+ 9 - 3
pages/order/createOrder.vue

@@ -52,10 +52,10 @@
 		</view>
 		<!-- 金额明细 -->
 		<view class="yt-list">
-			<!-- <view class="yt-list-cell b-b" v-if="goodsType == 0">
-				<text class="cell-tit clamp">积分抵扣{{ '(当前积分:' + integralAll + ')' }}</text>
+			<view class="yt-list-cell b-b" v-if="is_integral == 1">
+				<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>
@@ -135,6 +135,7 @@ export default {
 			// 收货地址
 			addressData: {},
 			is_gold:0,
+			is_integral:0,
 			// 店铺地址
 			shopAddress: {
 				name: '',
@@ -168,6 +169,10 @@ export default {
 		};
 	},
 	onLoad(option) {
+		// 判断是否是金券商品
+		if (option.is_integral){
+			this.is_integral = option.is_integral
+		}
 		// 判断是否是金豆商品
 		if (option.is_gold){
 			this.is_gold = option.is_gold
@@ -281,6 +286,7 @@ export default {
 		},
 		loadData() {
 			let obj = this;
+			console.log(123456)
 			confirm({ cartId: obj.cartId+'' }).then(({ data }) => {
 				obj.addressData = data.addressInfo || {};
 				obj.shopList = data.cartInfo; //商品列表

+ 4 - 1
pages/product/common/productBottom.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="page-bottom" v-if="is_gold == 0">
+	<view class="page-bottom" v-if="is_gold == 0 && is_integral == 0">
 		<view class="p-b-btn" :class="{ active: goodsObjact.userCollect }" @click="toFavorite(goodsObjact)">
 			<text class="iconfont " :class="{ iconlike: !goodsObjact.userCollect, iconlikefill: goodsObjact.userCollect }"></text>
 			<text>收藏</text>
@@ -33,6 +33,9 @@ export default {
 		},
 		is_gold: {
 			default: 0
+		},
+		is_integral: {
+			default: 0
 		}
 	},
 	data() {

+ 6 - 9
pages/product/exchange.vue

@@ -6,7 +6,7 @@
 		<view class="header">
 			<view class="data">
 				<view class="title">
-					我的金
+					我的金
 				</view>
 				<view class="quantity">
 					{{ userInfo.integral }}
@@ -33,13 +33,10 @@ import { mapState, mapMutations } from 'vuex';
 	export default {
 		data() {
 			return {
-				data: {
-					page: 1,
-					limit: 10,
-					loadingType: 'loadmore',
-					data: []
-				}
-				
+				page: 1,
+				limit: 10,
+				loadingType: 'loadmore',
+				data: []
 			}
 		},
 		components: {
@@ -63,7 +60,7 @@ import { mapState, mapMutations } from 'vuex';
 				getProducts({
 					page: this.page,
 					limit: this.limit,
-					is_gold: 1
+					is_integral: 1
 				})
 					.then(function(res) {
 						obj.data = res.data

+ 131 - 0
pages/product/jindouProduct.vue

@@ -0,0 +1,131 @@
+<template>
+	<view class="exchange">
+		<view class="bg">
+			<!-- <image src="@/static/img/bargainBg.jpg" mode=""></image> -->
+		</view>
+		<view class="header">
+			<view class="data">
+				<view class="title">
+					我的金豆
+				</view>
+				<view class="quantity">
+					{{ userInfo.gold }}
+				</view>
+				<view class="button">
+					查看明细
+				</view>
+			</view>
+		</view>
+		<view class="line">
+			热门兑换
+		</view>
+		<view class="dataList">
+			<data-list :data='data'></data-list>
+		</view>
+		
+	</view>
+</template>
+
+<script>
+import { getProducts } from '@/api/product.js';
+import dataList from '@/components/datalist.vue';
+import { mapState, mapMutations } from 'vuex';
+	export default {
+		data() {
+			return {
+				data: {
+					page: 1,
+					limit: 10,
+					loadingType: 'loadmore',
+					data: []
+				}
+				
+			}
+		},
+		components: {
+			dataList
+		},
+		computed: {
+			...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
+		},
+		onLoad() {
+			this.getData()
+		},
+		methods: {
+			// 點擊搜索框
+			clickSearch() {
+				uni.navigateTo({
+					url: '/pages/product/search'
+				});
+			},
+			getData() {
+				const obj = this
+				getProducts({
+					page: this.page,
+					limit: this.limit,
+					is_gold: 1
+				})
+					.then(function(res) {
+						obj.data = res.data
+					})
+					.catch(res => {
+					});
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+$grey: #95A0B1;
+$text: #333333;
+$red: #FF4C4C;
+	.exchange {
+		.bg {
+			width: 100%;
+			height: 400rpx;
+			background-color: $red;
+			image {
+				width: 100%;
+			}
+		}
+		.header {
+			.data {
+				padding-top: 120rpx;
+				width: 100%;
+				text-align: center;
+				position: absolute;
+				top: 0;
+				color: #fff;
+				height: 400rpx;
+				.quantity,.title,.button {
+					margin: 10rpx auto;
+				}
+				.title {
+					font-size: 24rpx;
+				}
+				.quantity {
+					font-size: 54rpx;
+					font-weight: bold;
+				}
+				.button {
+					padding: 10rpx;
+					border: solid 1rpx #fff;
+					border-radius: 40rpx;
+					font-size: 24rpx;
+					width: 160rpx;
+				}
+			}
+		}
+		.line {
+			background-color: #fff;
+			font-size: 28rpx;
+			padding: 30rpx;
+			color: $red;
+			font-weight: bold;
+			text-align: center;
+		}
+		.dataList {
+			background-color: #fff;
+		}
+	}
+</style>

+ 12 - 2
pages/product/newPeople.vue

@@ -9,7 +9,7 @@
 		<!-- <data-list :data='data'></data-list> -->
 		<view class="good-wrap">
 			<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)">
+				 @click="tobuy(item)">
 				<image :src="item.image" mode="" class="goo-img"></image>
 				<view class="good-tit clamp">
 					{{item.title}}
@@ -61,6 +61,8 @@
 		},
 		onLoad() {
 			this.getNewList()
+		},
+		onShow() {
 			this.getUserInfo()
 		},
 		// mounted() {
@@ -68,11 +70,19 @@
 		// },
 		methods: {
 			...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
+			tobuy(item) {
+				if(this.is_new == 'isn') {
+					this.navto('/pages/product/wholesaleDetail?id=' + item.id + '&time=' + item.time_id + '&status=' + item.status + '&is_new=' + this.is_new)
+				}else {
+					this.$api.msg('您已不是新人,无法预约新人专区商品')
+				}
+				
+			},
 			getUserInfo() {
 				getUserInfo().then(res => {
 					console.log(res)
 					this.setUserInfo(res.data);
-					this.is_new = res.data.is_whole
+					this.is_new = res.data.is_whole == 0? 'isn': 'non'
 				})
 			},
 			navto(url) {

+ 9 - 2
pages/product/product.vue

@@ -20,7 +20,7 @@
 		<!-- 底部高度撑开 -->
 		<view class="contentBottomHeight"></view>
 		<!-- 底部操作菜单 -->
-		<product-bottom @buy="buy" :goodsObjact="goodsObjact" :goodsid="goodsid" @specOPne="specOPne" :is_gold="is_gold"></product-bottom>
+		<product-bottom @buy="buy" :goodsObjact="goodsObjact" :goodsid="goodsid" @specOPne="specOPne" :is_gold="is_gold" :is_integral="is_integral"></product-bottom>
 		<!-- 规格-模态层弹窗 -->
 		<view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
 			<!-- 遮罩层 -->
@@ -114,6 +114,7 @@ export default {
 			list: '', //商品详情的数据
 			type: 1, //默认支付方式add为
 			is_gold: 0,//是否是金豆商品
+			is_integral:0,//是否是金券商品
 			goodsType: 0,
 			goodsNumber: 1, //购买数量
 			goodsid: '', //商品id
@@ -172,6 +173,11 @@ export default {
 		//保存商品id
 		this.goodsid = options.id;
 		this.goodsType = options.type;
+		
+		// 判断是否是金券商品
+		if (options.is_integral){
+			obj.is_integral = options.is_integral
+		}
 		// 判断是否是金豆商品
 		if (options.is_gold){
 			obj.is_gold = options.is_gold
@@ -335,6 +341,7 @@ export default {
 			let obj = this;
 			// 创建传值对象
 			let data = {
+				is_integral:obj.is_integral,//是否是金券商品
 				cartNum: obj.goodsNumber, //商品数量
 				new: 1,
 				productId: obj.goodsid, //商品编号
@@ -351,7 +358,7 @@ export default {
 					if (obj.type == 1) {
 						// 跳转到支付页
 						uni.navigateTo({
-							url: '/pages/order/createOrder?id=' + da.cartId + '&is_gold=' + obj.is_gold
+							url: '/pages/order/createOrder?id=' + da.cartId + '&is_gold=' + obj.is_gold + '&is_integral=' + obj.is_integral
 						});
 					}
 					if (obj.type == 2) {

+ 16 - 4
pages/product/wholesale.vue

@@ -27,10 +27,10 @@
 			<!-- <empty v-if="loadingType == 'noMore' && list.length === 0"></empty> -->
 			<view class="good-wrap">
 
-				<view class="good" v-for="item in list" @click="navto('/pages/product/wholesaleDetail')">
-					<image src="" mode="" class="goo-img"></image>
+				<view class="good" v-for="item in list" @click="gotoDetail(item)">
+					<image :src="item.whole.image" mode="" class="goo-img"></image>
 					<view class="good-tit clamp">
-						{{item.order_id}}
+						{{item.whole.title}}
 					</view>
 					<view class="good-price flex">
 						<view class="new-price">
@@ -132,6 +132,18 @@
 			}
 		},
 		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('今日该场次未开始,请稍后')
+				}
+			},
 			navto(url) {
 				uni.navigateTo({
 					url: url
@@ -273,7 +285,7 @@
 			width: 345rpx;
 			height: 345rpx;
 			border-radius: 10rpx 10rpx 0 0;
-			background-color: #bfa;
+			// background-color: #bfa;
 		}
 
 		.good-tit {

+ 43 - 15
pages/product/wholesaleDetail.vue

@@ -19,7 +19,7 @@
 		<view class="btn-ts" style="height: 130rpx; background-color: #fff;">
 
 		</view>
-		<view class="btm-btn" @click="reservePackage">
+		<view class="btm-btn" @click="loading? '':reservePackage()">
 			立即预约
 		</view>
 	</view>
@@ -47,40 +47,68 @@
 				good_id: '',
 				time_id: '',
 				status: 1,
-				is_new: 0,//是否是新人 0->是 1->不是
-				description: ''
+				is_new: '',
+				description: '',
+				loading: false,
 			}
 		},
 		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
+			if(opt.is_new) {
+				this.is_new = opt.is_new
+			}
+			
 			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"')
-				})
+				if(obj.is_new) {
+					getWholeDetai({}, obj.good_id, obj.time_id, obj.status, 1).then(({
+						data
+					}) => {
+						obj.goodItem = data.storeInfo
+						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
+					}) => {
+						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
+					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 => {
-					console.log(res)
+					uni.showToast({
+						title:'预约成功',
+						duration:2000
+					});
+					setTimeout(function() {
+						uni.navigateTo({
+							url: '/pages/user/myWholesale'
+						});
+					}, 800);
+				}).catch( err => {
+					obj.loading = false
+					console.log(err)
 				})
 			}
 		}

+ 5 - 4
pages/user/myWholesale.vue

@@ -92,7 +92,7 @@
 					</view>
 					<uni-load-more :status="navList[1].loadingType"></uni-load-more>
 				</scroll-view>
-				
+
 			</swiper-item>
 		</swiper>
 		<uni-popup ref="lookimg" type="center">
@@ -286,10 +286,11 @@
 				// 重新加载地址
 				let navItem = this.navList[this.tabCurrentIndex]
 				navItem.orderList = []
-				navItem.page = 1,
-					navItem.loadingType = 'more'
+				navItem.page = 1
+				navItem.loadingType = 'more'
+				navItem.loaded = false
+				this.getMyPackage()
 
-				this.loadAddress()
 			},
 			// 同意
 			passPackage(item) {