hwq há 3 anos atrás
pai
commit
9119bc5036

+ 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>

+ 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) {