Browse Source

Merge branch 'dev' into 'zfb'

Dev

See merge request quanshu/mp-ui-user!35
hunagwb 3 years ago
parent
commit
742fd93afd

+ 1 - 4
src/packageGoods/goods/list.vue

@@ -97,9 +97,6 @@
 				this.tagIds = opthios.tagIds
 				this.categoryId = Number(opthios.categoryId)
 			}
-		},
-		
-		onShow() {
 			this.pageList()
 		},
 		
@@ -169,7 +166,7 @@
 			if (this.total > this.pageNum * 20) {
 				setTimeout(() => {
 					++this.pageNum
-					this.getList()
+					this.pageList()
 				}, 500)
 			} else {
 				uni.$u.toast('已经到底了')

+ 0 - 1
src/packageGoods/order/logistics.vue

@@ -66,7 +66,6 @@
 				</u-steps-item>
 			</u-steps>
 			<!-- #endif -->
-			
 		</view>
 		<view class="logistics" v-else-if="deliverListData[listIndex][0].companyName">
 			<view style="color: #b1b1b1;">

+ 1 - 1
src/packageOther/about/index.vue

@@ -10,7 +10,7 @@
 		<view class="about">
 			<view class="flex about-logo">
 				<image src="../../static/public/logo.png" mode="scaleToFill"></image>
-				<view class="edition">v 2.1.1</view>
+				<view class="edition">v 2.1.2</view>
 			</view>
 			<view class="about-action">
 				<u-cell-group :border="false">

+ 8 - 6
src/packagePrize/choice/index.vue

@@ -31,8 +31,8 @@
 					<view class="info flex" @click="selectPrize(index)">
 						<image :src="item.picUrl" mode="aspectFill"></image>
 						<view class="info-content flex">
-							<view class="info-content__title ells-one" v-if="item.prizeType && item.prizeType.value != 'coin'">{{ item.title }}</view>
-							<view class="info-content__title ells-one" v-else>盲豆</view>
+							<view class="info-content__title ells" v-if="item.prizeType && item.prizeType.value != 'coin'">{{ item.title }}</view>
+							<view class="info-content__title ells" v-else>盲豆</view>
 							<view class="info-content__price" v-if="item.prizeType && item.prizeType.value != 'coin'">¥{{ $numberFormat(item.value) }}</view>
 							<view class="info-content__price" v-else>{{ item.value }}个</view>
 						</view>
@@ -59,7 +59,7 @@
 				<view class="choice-info-content">
 					<view class="choice-info-content-price" v-if="actionInfo.prizeType && actionInfo.prizeType.value != 'coin'"><text>¥</text>{{ $numberFormat(actionInfo.value) }}</view>
 					<view class="choice-info-content-price" v-else>{{ actionInfo.value }}个</view>
-					<view class="choice-info-content-title ells-one" v-if="actionInfo.prizeType && actionInfo.prizeType.value != 'coin'">{{ actionInfo.title }}</view>
+					<view class="choice-info-content-title ells" v-if="actionInfo.prizeType && actionInfo.prizeType.value != 'coin'">{{ actionInfo.title }}</view>
 					<view class="choice-info-content-title" v-else>盲豆</view>
 					<view class="choice-info-content-btn flex">
 						<view class="choice-info-content-btn-content flex"  @click="toPrize(actionInfo.prizeType)">
@@ -387,13 +387,13 @@
 					justify-content: flex-start;
 					
 					image {
-						width: 110rpx;
-						height: 110rpx;
+						width: 120rpx;
+						height: 120rpx;
 						margin-right: 34rpx;
 					}
 					
 					&-content {
-						height: 110rpx;
+						height: 120rpx;
 						flex: 1;
 						align-items: flex-start;
 						flex-direction: column;
@@ -401,7 +401,9 @@
 						
 						&__title {
 							width: 100%;
+							height: 70rpx;
 							font-size: 30rpx;
+							line-height: 35rpx;
 						}
 						
 						&__price {

+ 237 - 0
src/packagePrize/components/sku-popup/sku-popup.vue

@@ -0,0 +1,237 @@
+<template>
+	<u-popup :show="popupShow" round="17" mode="bottom" @close="close" :closeable="true" @touchmove.prevent.stop>
+		<view class="choiceShow-wrap">
+			<!-- 商品信息 -->
+			<view class="flex goods">
+				<view class="goods-left">
+					<view class="goods-left__image flex">
+						<image class="image-goods" :src="payInfo.picUrl" mode="aspectFit"></image>
+					</view>
+					<view class="goods-left-content flex">
+						<view class="goods-left-content__title ells">{{ detailInfo.title }}</view>
+					</view>
+				</view>
+			</view>
+			<!-- sku -->
+			<view class="sku" v-for="(item, index) in skuList" :key="index">
+				<view class="sku-title">{{ item.name }}</view>
+				<view class="flex sku-list">
+					<view
+						class="sku-list-item"
+						:class="{'action': item.actionIndex == indexs}"
+						v-for="(ele, indexs) in item.value" :key="indexs" @click="getSku(ele, item, indexs)">
+						{{ ele }}
+					</view>
+				</view>
+			</view>
+
+			<!-- 按钮 -->
+			<view class="flex btn">
+				<view class="btn-right">
+					<view class="confirm" @click="confirmPrize">确定</view>
+				</view>
+			</view>
+		</view>
+	</u-popup>
+</template>
+
+<script>
+	import env from '@/config/env.js'
+	import $http from '@/utils/request.js'
+	export default {
+		name: "exchange-popup",
+		props: {
+			popupShow: {
+				type: [Boolean],
+				default: false
+			},
+			skuListInit: {
+				type: Array,
+				default: () => []
+			},
+			skuListPopup: {
+				type: Array,
+				default: () => []
+			},
+			detailInfo: {
+				type: [Object],
+				default: {}
+			},
+			popupInfo: {
+				type: [Object],
+				default: {}
+			}
+		},
+		data() {
+			return {
+				payInfo: {},
+				skuList: []
+			};
+		},
+		
+		created() {
+			this.payInfo = this.popupInfo
+			this.skuList = this.skuListPopup
+		},
+		
+		methods: {
+			getSku(e, item, indexs) {
+				this.$set(item, 'txt', `${item.name}:${e}`)
+				this.$set(item, 'actionIndex', indexs)
+				let actionSku = this.skuList.map(item => {
+					return item.txt
+				}).join(';')
+				let sku = this.skuListInit.find(item => {
+					return item.properties == actionSku
+				})
+				this.payInfo = {
+					...sku,
+					exValue: sku.exchangePrice,
+					picUrl: env.filePublic + sku.picUrl,
+					storageId: this.detailInfo.storageId,
+				}
+			},
+			
+			confirmPrize() {
+				let data = {
+					properties: this.payInfo.properties,
+					skuId: this.payInfo.skuId,
+					storageId: this.payInfo.storageId,
+				}
+				this.$emit('success',data)
+			},
+			
+			close() {
+				this.$emit('close')
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.choiceShow-wrap {
+		min-height: 400rpx;
+		padding: 34rpx;
+		
+		// 商品
+		.goods {
+			justify-content: space-between;
+			margin-bottom: 66rpx;
+			
+			&-left {
+				flex: 1;
+				display: flex;
+				
+				&__image {
+					width: 154rpx;
+					height: 154rpx;
+					border: 1px solid #EEEEEE;
+					border-radius: 18rpx;
+					margin-right: 24rpx;
+					
+					.image-goods {
+						width: 154rpx;
+						height: 154rpx;
+					}
+				}
+				
+				&-content {
+					height: 154rpx;
+					flex-direction: column;
+					align-items: flex-start;
+					justify-content: space-between;
+					padding: 34rpx 0;
+					
+					.image-goods {
+						width: 154rpx;
+						height: 154rpx;
+						border-radius: 18rpx;
+						border: 1px solid #EEEEEE;
+						margin-right: 24rpx;
+					}
+					
+					&__title {
+						font-size: 30rpx;
+						line-height: 30rpx;
+						font-weight: bold;
+						height: 30rpx;
+						overflow: hidden;
+					}
+					
+					&__coin {
+						color: #FA822C;
+						
+						.image-coin {
+							width: 34rpx;
+							height: 30rpx;
+						}
+					}
+				}
+			}
+			
+			&-right {
+				color: #666;
+			}
+		}
+		
+		// sku
+		.sku {
+			&-title {
+				font-size: 30rpx;
+				line-height: 30rpx;
+				font-weight: bold;
+				margin-bottom: 34rpx;
+			}
+	
+			&-list {
+				justify-content: flex-start;
+				flex-wrap: wrap;
+	
+				&-item {
+					padding: 20rpx 66rpx;
+					border-radius: 36rpx;
+					margin-right: 18rpx;
+					background: #F5F6F8;
+					margin-bottom: 34rpx;
+				}
+	
+				.action {
+					background-color: rgba(250, 130, 44, .25);
+					color: #FA822C;
+				}
+			}
+		}
+		
+		// 数量
+		.quantity {
+			justify-content: space-between;
+			margin: 34rpx 0;
+			
+			&-title {
+				font-size: 30rpx;
+				line-height: 30rpx;
+				font-weight: bold;
+			}
+		}
+	
+		// 按钮
+		.btn {
+			padding-top: 36rpx;
+			border-top: 1px solid #eee;
+			text-align: center;
+	
+			&-right {
+				.confirm {
+					width: 414rpx;
+					height: 88rpx;
+					line-height: 88rpx;
+					background: #FA822C;
+					border-radius: 44rpx;
+					font-size: 36rpx;
+					color: #fff;
+					text-align: center;
+				}
+			}
+		}
+	}
+</style>

+ 209 - 1
src/packagePrize/prize/index.vue

@@ -140,13 +140,45 @@
 				<u-icon name="arrow-right" size="15" color="#999"></u-icon>
 			</view>
 		</view>
+		
+		<!-- 兑换成功 -->
+		<u-popup :show="tipShow" mode="center">
+			<view class="tip-show">
+				<view class="tip-show-title">
+					<view>确认选择后,如需变更规格,请联系客服</view>
+				</view>
+				<view class="tip-show-titletwo">
+					<view>当前规格:{{tipData.properties}}</view>	
+				</view>
+				<view class="flex tip-show-btn">
+					<view class="close" @click="tipShow = false">取消</view>
+					<view class="prize" @click="tipSecction">确认选择</view>
+				</view>
+			</view>
+		</u-popup>
+		
+		<!-- 商品选择sku -->
+		<sku-popup 
+			:popup-show="skuPopupShow" 
+			:detailInfo="info" 
+			:popup-info="payInfo"
+			:sku-list-init="skuListInit" 
+			:sku-list-popup="skuList" 
+			@close="close"
+			@success="skuSuccess"
+			v-if="skuPopupShow"
+		/>
 	</view>
 </template>
 
 <script>
 	import env from '../../config/env.js'
 	import $http from '@/utils/request.js'
+	import skuPopup from '../components/sku-popup/sku-popup.vue'
 	export default {
+		components: {
+			skuPopup
+		},
 		data() {
 			return {
 				loading: false,
@@ -172,6 +204,15 @@
 				pagesNum: "",
 				
 				statusIndex: 1,
+				
+				info: {},
+				skuPopupShow: false,//选择框
+				skuList: [],
+				skuListInit: [],
+				tipShow: false,
+				tipData: {},
+				payInfo: {},
+				// infoItem: {},
 			};
 		},
 		onShow() {
@@ -223,6 +264,7 @@
 					this.loading = false
 				})
 			},
+			
 			getListTwo(){
 				let _this = this
 				let url = '/api/v1/mp/user/prize/recovery/list'
@@ -232,7 +274,6 @@
 					uni.hideLoading();
 					this.loading = false
 					if (res.code == 0) {
-						console.log(res);
 						res.rows.forEach(item => {
 							item.status = 3
 							item.goodsNum = item.num
@@ -293,8 +334,79 @@
 				this.pageList()
 				this.checkedAll = false
 			},
+			
+			close() {
+				this.skuPopupShow = false
+				this.tipShow = false
+			},
+			skuSuccess(data) {
+				this.tipData = data
+				this.close()
+				this.tipShow = true
+				// this.pageList()
+			},
+			
+			tipSecction() {
+				uni.showLoading({
+					title: '兑换中'
+				});
+				$http.post('/api/v1/mp/user/mine/prize/saveSku', this.tipData).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						for (var i = 0; i < this.list.length; i++) {
+							if(this.list[i].storageId == this.info.storageId){
+								this.$set(this.list[i],"properties",this.tipData.properties)
+							}
+						}
+						this.close()
+					} else if (res.code == 1021) {
+						uni.$u.toast(res.msg);
+					}
+				}).catch(() => {
+					uni.hideLoading();
+				})
+			},
 
 			changeChecked(e, item) {
+				if(item.checked == false && item.isMoreSku == 1 && item.inType.value != 2 && item.properties == ""){
+					$http.post('/api/v1/mp/user/exchange/goods/detail', {
+						goodsId: item.goodsId,
+						noToken: true
+					}).then(res => {
+						this.info = item
+						this.skuPopupShow = true
+						this.skuListInit = res.data.skuList
+						if (res.data.skuList.length) {
+							let skuProp = JSON.parse(res.data.skuProp)
+							skuProp.forEach(item => {
+								item.actionIndex = 0,
+									item.txt = `${item.name}:${item.value[0]}`
+							})
+							let actionSku = skuProp.map(item => {
+								return item.txt
+							}).join(';')
+							let sku = res.data.skuList.find(item => {
+								return item.properties == actionSku
+							})
+							this.payInfo = {
+								...sku,
+								exValue: sku.exchangePrice,
+								storageId: item.storageId,
+								price: sku.value,
+								picUrl: env.filePublic + sku.picUrl
+							}
+							this.skuList = skuProp
+						} else {
+							this.payInfo = {
+								...res.data,
+								price: this.info.value,
+								exValue: this.info.exchangePrice,
+								picUrl: this.picUrlArr[0],
+								storageId: item.storageId,
+							}
+						}
+					})
+				}
 				this.$set(item, 'checked', e)
 				let flag = this.list.every(item => item.checked == true)
 				this.checkedAll = flag
@@ -319,6 +431,49 @@
 			// 立即提货
 			toSettlement() {
 				let arr = []
+				for (var i = 0; i < this.list.length; i++) {
+					//选中 && 是多sku && 不为盲豆兑换 && sku为空
+					if(this.list[i].checked && this.list[i].isMoreSku == 1 && this.list[i].inType.value != 2 && this.list[i].properties == ""){
+							$http.post('/api/v1/mp/user/exchange/goods/detail', {
+								goodsId: this.list[i].goodsId,
+								noToken: true
+							}).then(res => {
+								this.info = this.list[i]
+								this.skuPopupShow = true
+								this.skuListInit = res.data.skuList
+								if (res.data.skuList.length) {
+									let skuProp = JSON.parse(res.data.skuProp)
+									skuProp.forEach(item => {
+										item.actionIndex = 0,
+											item.txt = `${item.name}:${item.value[0]}`
+									})
+									let actionSku = skuProp.map(item => {
+										return item.txt
+									}).join(';')
+									let sku = res.data.skuList.find(item => {
+										return item.properties == actionSku
+									})
+									this.payInfo = {
+										...sku,
+										exValue: sku.exchangePrice,
+										storageId: this.list[i].storageId,
+										price: sku.value,
+										picUrl: env.filePublic + sku.picUrl
+									}
+									this.skuList = skuProp
+								} else {
+									this.payInfo = {
+										...res.data,
+										price: this.info.value,
+										exValue: this.info.exchangePrice,
+										picUrl: this.picUrlArr[0],
+										storageId: this.list[i].storageId,
+									}
+								}
+							})
+						return
+					}
+				} 
 				this.list.forEach(item => {
 					if (item.checked) {
 						arr.push(item)
@@ -701,4 +856,57 @@
 			}
 		}
 	}
+	
+	
+	.tip-show {
+		width: 80vw;
+		background-color: #FFFFFF;
+		border-radius: 10rpx;
+		padding: 60rpx 40rpx;
+	
+		&-title {
+			margin-bottom: 64rpx;
+	
+			view {
+				margin-left: 20rpx;
+			}
+		}
+		&-titletwo {
+			margin-bottom: 64rpx;
+			
+			view {
+				margin-left: 20rpx;
+				color: #999; font-size: 26rpx;
+			}
+		}
+	
+		&-btn {
+			justify-content: space-around;
+	
+			.close {
+				width: 160rpx;
+				height: 60rpx;
+				line-height: 60rpx;
+				border-radius: 8rpx;
+				color: rgba(235, 112, 9, 100);
+				font-size: 28rpx;
+				text-align: center;
+				border: 1px solid rgba(235, 112, 9, 100);
+			}
+	
+			.prize {
+				width: 160rpx;
+				height: 60rpx;
+				line-height: 60rpx;
+				border-radius: 8rpx;
+				color: rgba(235, 112, 9, 100);
+				font-size: 28rpx;
+				text-align: center;
+				background-color: rgba(235, 112, 9, 100);
+				color: rgba(255, 255, 255, 100);
+				font-size: 14px;
+			}
+		}
+	}
+	
 </style>

+ 22 - 14
src/pages/lucky/index.vue

@@ -9,7 +9,8 @@
 					</view>
 					<view class="luck-info-content flex">
 						<view class="luck-info-content-num">
-							<image src="../../static/lucky/lucky_gkmp.png" mode="scaleToFill"></image>
+							<image src="../../static/lucky/lucky_gkmp.png" mode="scaleToFill" v-if="info.salePrice == 0"></image>
+							<image src="../../static/lucky/zi.png" mode="scaleToFill" v-else></image>
 						</view>
 						<view class="luck-info-content-img">
 							<view class="luck-info-content-img-word">
@@ -31,11 +32,12 @@
 								</view>
 							</view>
 						</view>
-						<view class="luck-info-content-btn" @click="pay" v-if="info.status == 1 && info.salePrice != 0">
-							支付{{ info.salePrice / 100 }}元 立即刮开盲票</view>
-						<view class="luck-info-content-btn" @click="payDetail"
-							v-else-if="info.status == 1 && info.salePrice == 0">收下盲票,立即刮开盲票</view>
-						<view class=" code" v-else>开奖啦!</view>
+						<view class="luck-info-content-btn" style="width: 500rpx;" @click="pay" v-if="info.status == 1 && info.salePrice != 0">
+							支付{{ info.salePrice / 100 }}元,立即刮奖</view>
+						<view class="luck-info-content-btn" style="width: 500rpx;" @click="payDetail"
+							v-else-if="info.status == 1 && info.salePrice == 0">收下盲票,立即刮奖</view>
+						<!-- <view class=" code" v-else>开奖啦!</view> -->
+						<view class="luck-info-content-btn" style="width: 500rpx;" @click="toChoice" v-if="Choice">领取奖品</view>
 					</view>
 					<view class="luck-info-close flex">
 						<navigator open-type="exit" target="miniProgram" hover-class="none"
@@ -98,6 +100,8 @@
 				status: 2,
 				showAction: false,
 				infoimg: false,
+				Choice: false,
+				ChoiceData: '',
 			};
 		},
 
@@ -106,7 +110,6 @@
 				this.serialNo = options.id
 				this.getDetail()
 			}
-
 			if (options.q) {
 				let obj = urlParameter(decodeURIComponent(options.q))
 				this.serialNo = obj.id
@@ -134,7 +137,6 @@
 								uni.redirectTo({
 									url: `/packagePrize/choice/index?id=${ res.data.ticketId }&type=offLine`
 								})
-
 							} else {
 								this.luckyShow = true
 								uni.showModal({
@@ -188,9 +190,8 @@
 							setTimeout(() => {
 								this.infoimg = true
 								setTimeout(() => {
-									uni.redirectTo({
-										url: `/packagePrize/choice/index?id=${ res.data.ticketId }&type=offLine`
-									})
+									this.ChoiceData = res.data.ticketId
+									this.Choice = true
 								}, 500)
 							}, 500)
 						} else {
@@ -211,9 +212,9 @@
 										setTimeout(() => {
 											this.infoimg = true
 											setTimeout(() => {
-												uni.redirectTo({
-													url: `/packagePrize/choice/index?id=${ res.data.ticketId }&type=offLine`
-												})
+												this.ChoiceData = res.data.ticketId
+												this.Choice = true
+												
 											}, 500)
 										}, 500)
 									}
@@ -229,6 +230,13 @@
 					uni.hideLoading();
 				})
 			},
+			
+			//跳转奖品页
+			toChoice(){
+				uni.redirectTo({
+					url: `/packagePrize/choice/index?id=${ this.ChoiceData }&type=offLine`
+				})
+			},
 
 			close() {
 				this.payShow = false

BIN
src/static/lucky/zi.png