Browse Source

首页购买后跳转购买成功页

DELL 3 years ago
parent
commit
ecf6c058fa

+ 3 - 3
src/components/pay-popup/pay-popup.vue

@@ -35,10 +35,10 @@
 						</u-checkbox-group>
 					</view>
 					<!-- #ifndef MP-ALIPAY -->
-					<view class="txt" @click="toRule">同意《盲票购买协议》</text></view>
+					<view class="txt" @click="toRule">同意《商品购买协议》</text></view>
 					<!-- #endif -->
 					<!-- #ifdef MP-ALIPAY -->
-					<view class="txt">同意《盲票购买协议》</text></view>
+					<view class="txt">同意《商品购买协议》</text></view>
 					<!-- #endif -->
 				</view>
 				<view class="flex btn">
@@ -107,7 +107,7 @@
 
 			toRule() {
 				uni.navigateTo({
-					url: '/packageOther/rule/index'
+					url: '/packageOther/rule/purchase'
 				})
 			},
 

+ 15 - 10
src/packageGoods/ticket/index.vue

@@ -1,15 +1,18 @@
 <template>
 	<view>
 		<!-- #ifdef MP-ALIPAY -->
-		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="盲票列表" leftIconSize="0">
+		<!-- <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="盲票列表" leftIconSize="0"> -->
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="商品列表" leftIconSize="0">
 		</u-navbar>
 		<!-- #endif -->
 		<!-- #ifndef MP-ALIPAY -->
-		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="盲票列表"></u-navbar>
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="商品列表"></u-navbar>
 		<!-- #endif -->
 		<view class="ticket-box">
 			<view class="flex ticket-box-list">
-				<navigator :url="`/pages/ticketBox/detail?boxId=${ item.boxId }`" class="flex ticket-box-list-item"
+				<!-- <navigator :url="`/pages/ticketBox/detail?boxId=${ item.boxId }`" class="flex ticket-box-list-item"
+					hover-class="navigator-hover" v-for="(item, index) in list" :key="index"> -->
+				<navigator :url="`/packagePrize/goods/index?id=${ item.refId }&boxId=${ item.boxId }`" class="flex ticket-box-list-item"
 					hover-class="navigator-hover" v-for="(item, index) in list" :key="index">
 					<image :src="item.picUrl" mode="aspectFill"></image>
 					<view class="info">
@@ -30,8 +33,10 @@
 			</view>
 			<view class="flex empty" v-if="!list.length">
 				<view class="center">
-					<image class="center-img" src="https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/v2/nodata_3.png" mode="scaleToFill"></image>
-					<view class="center-font">还没有盲票</view>
+					<image class="center-img"
+						src="https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/v2/nodata_3.png"
+						mode="scaleToFill"></image>
+					<view class="center-font">还没有商品</view>
 				</view>
 			</view>
 		</view>
@@ -48,7 +53,7 @@
 				pageNum: 1,
 				total: 0,
 				list: [],
-				ids: []
+				ids: [],
 			};
 		},
 		onLoad(options) {
@@ -69,7 +74,7 @@
 					noToken: true,
 					boxIds: this.ids
 				}
-				$http.post(`/api/v1/mp/user/mall/ticket/list?pageNum=${this.pageNum}&pageSize=20`, data).then(
+				$http.post(`/api/v1/mp/user/mall/ticket/goods/list?pageNum=${this.pageNum}&pageSize=20`, data).then(
 					res => {
 						uni.hideLoading();
 						if (res.code == 0) {
@@ -160,15 +165,15 @@
 
 		.empty {
 			height: 50vh;
-			
+
 			.center {
 				text-align: center;
-			
+
 				&-img {
 					width: 228rpx;
 					height: 320rpx;
 				}
-			
+
 				&-font {
 					font-size: 30rpx;
 					font-weight: 400;

File diff suppressed because it is too large
+ 25 - 0
src/packageOther/rule/purchase.vue


+ 332 - 0
src/packagePrize/goods/index.vue

@@ -0,0 +1,332 @@
+<template>
+	<view>
+		<!-- #ifdef MP-ALIPAY -->
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="商品详情" leftIconSize="0">
+		</u-navbar>
+		<!-- #endif -->
+		<!-- #ifndef MP-ALIPAY -->
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="商品详情"></u-navbar>
+		<!-- #endif -->
+
+		<view class="detail">
+			<view class="detail-swiper">
+				<u-swiper :list="picUrlArr" height="375" radius="0" :indicator="true" :circular="true"
+					indicatorMode="dot" indicatorActiveColor="#FA822C"></u-swiper>
+			</view>
+			<!-- 详情 -->
+			<view class="detail-info">
+				<view class="detail-info-left">
+					<view class="detail-info-left__title ells">{{ info.title }}</view>
+				</view>
+				<view class="detail-infotwo flex">
+					<view class="detail-infotwo-num">
+						<view class="">¥{{ $numberFormat(info.value) }}</view>
+						<view class="txt" v-if="info.originPrice">¥<text>{{ info.originPrice }}</text></view>
+					</view>
+					<view class="detail-info-right">销量:30个</view>
+				</view>
+
+			</view>
+			<view class="detail-goods">产品介绍</view>
+			<view class="detail-description">
+				<u-parse :content="description" :selectable="true"></u-parse>
+			</view>
+			<view style="detail-merchant" @click="toCompanyData" v-if="info.merchantInfo?true:false">
+				<view class="detail-merchant-warp">
+					<view class="detail-merchant-warp-one">商家信息</view>
+					<view class="detail-merchant-warp-two">
+						<view style="float: left;">前往查看</view>
+						<u-icon style="float: right;" name="arrow-right" size="18"></u-icon>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="footer-fixed">
+			<view class="footer-fixed-content flex">
+				<view class="footer-fixed-content__price" >
+					<button @click="exchange">立即购买</button>
+				</view>
+			</view>
+		</view>
+		<!-- 支付弹框组件 -->
+		<pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="toProcess" v-if="payShow" />
+	</view>
+</template>
+
+<script>
+	import env from '../../config/env.js'
+	import $http from '@/utils/request.js'
+	import appId from '@/config/appId.js'
+	import { formatRichText } from '@/utils/util.js'
+	import PayPopup from '../../components/pay-popup/pay-popup.vue'
+	export default {
+		components: {
+			PayPopup,
+		},
+		data() {
+			return {
+				boxId: '',
+				picUrlArr: [],
+				info: {},
+				prizeList: [],
+				description: '',
+				goodsId: '',
+
+				payShow: false,
+				payInfo: {},
+				purchasePopupShow: false
+			};
+		},
+		onLoad(opthios) {
+			this.getDetail(opthios.id)
+			this.goodsId = opthios.id
+			this.boxId = opthios.boxId
+		},
+		methods: {
+			getDetail(id) {
+				uni.showLoading({
+					title: '加载中'
+				});
+				$http.post('/api/v1/mp/user/exchange/goods/detail', {
+					noToken: true,
+					goodsId: id
+				}).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						this.info = res.data
+						let picUrlArr = res.data.picUrl.split(',')
+						picUrlArr.forEach(item => {
+							this.picUrlArr.push(env.filePublic + item + '?imageView2/2/w/750')
+						})
+						// 处理富文本
+						// #ifndef MP-ALIPAY
+						const description = res.data.description.replaceAll(".jpg\"", ".jpg?imageView2/2/w/750\"")
+							.replaceAll(".jpeg\"", ".jpeg?imageView2/2/w/750\"").replaceAll(".png\"",
+								".png?imageView2/2/w/750\"");
+						this.description = formatRichText(description);
+						// #endif
+
+						// #ifdef MP-ALIPAY
+						res.data.description.split(".jpg\"").join(".jpg?imageView2/2/w/750\"")
+						res.data.description.split(".jpeg\"").join(".jpeg?imageView2/2/w/750\"")
+						res.data.description.split(".png\"").join(".png?imageView2/2/w/750\"")
+						this.description = formatRichText(res.data.description);
+						// #endif
+
+					}
+				}).catch(() => {
+					uni.hideLoading();
+				})
+			},
+
+			close() {
+				this.payShow = false
+			},
+			toProcess(id) {
+				this.payShow = false
+				uni.navigateTo({
+					url: `/packagePrize/purchase/index?boxId=${ this.boxId }&orderId=${ id }&isTry=0`
+				})
+			},
+			
+			exchange() {
+				console.log(this.info);
+				let data = {
+					couponIds: [],
+					autoCoupon: 1,
+					boxId: this.boxId,
+					orderNum: 1,
+					appSource: appId
+				}
+				$http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
+					if (res.code == 0) {
+						let info = {
+							...res.data,
+							...this.info,
+							picUrl: env.filePublic + res.data.picUrl.split(',')[0],
+						}
+						this.payInfo = info
+						this.payShow = true
+					}
+				})
+			},
+
+			toCompanyData() {
+				uni.navigateTo({
+					url: `/packageGoods/goods/company?goodsId=${ this.goodsId }`
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.detail {
+
+		// 商品轮播
+		&-swiper {
+			background-color: #FFFFFF;
+		}
+
+		// 详情
+		&-infotwo {
+			background-color: #fff;
+			justify-content: space-between;
+
+			&-num {
+				view {
+					display: inline-block;
+					color: #F9822C;
+					line-height: 80rpx;
+					font-size: 32rpx;
+					font-weight: bold;
+				}
+
+				.txt {
+					margin-left: 14rpx;
+					font-size: 26rpx;
+					color: #666666;
+					font-weight: 400;
+					text-decoration: line-through;
+				}
+			}
+
+		}
+
+		&-info {
+			background-color: #fff;
+			justify-content: space-between;
+			padding: 34rpx;
+			margin-bottom: 22rpx;
+
+			&-left {
+				flex: 1;
+
+				&__title {
+					font-size: 34rpx;
+					line-height: 40rpx;
+					max-height: 80rpx;
+					overflow: hidden;
+					// margin-bottom: 26rpx;
+					font-weight: bold;
+				}
+
+				&__coin {
+					display: flex;
+					line-height: 30rpx;
+					margin-bottom: 26rpx;
+
+					.content {
+						color: #FA822C;
+						margin-right: 34rpx;
+						font-weight: bold;
+						font-size: 30rpx;
+
+						image {
+							width: 34rpx;
+							height: 30rpx;
+						}
+
+						text {
+							font-weight: normal;
+						}
+					}
+
+					.txt {
+						font-size: 26rpx;
+						color: #666666;
+						text-decoration: line-through;
+					}
+				}
+
+				&__price {
+					line-height: 24rpx;
+					color: #666666;
+				}
+			}
+
+			&-right {
+				color: #666666;
+			}
+		}
+
+		&-goods {
+			height: 90rpx;
+			text-align: center;
+			line-height: 90rpx;
+			font-weight: bold;
+			font-size: 30rpx;
+			background-color: #FFFFFF;
+		}
+
+		&-description {
+			image {
+				width: 100%;
+			}
+		}
+
+		&-merchant {
+			height: 88rpx;
+			// text-align: center;
+			line-height: 88rpx;
+			font-weight: bold;
+			background-color: #FFFFFF;
+
+			&-warp {
+				height: 88rpx;
+				width: 100%;
+				background-color: #ffffff;
+
+				&-one {
+					float: left;
+					margin: 20rpx;
+					font-weight: 600;
+				}
+
+				&-two {
+					float: right;
+					margin: 20rpx;
+					font-weight: 600;
+				}
+			}
+		}
+
+		// 设置ios刘海屏底部横线安全区域
+		padding-bottom: constant(safe-area-inset-bottom);
+		padding-bottom: env(safe-area-inset-bottom);
+	}
+
+	.footer-fixed {
+		position: fixed;
+		bottom: var(--window-bottom);
+		left: 0;
+		right: 0;
+		z-index: 11;
+		box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
+		background: #fff;
+		// 设置ios刘海屏底部横线安全区域
+		padding-bottom: constant(safe-area-inset-bottom);
+		padding-bottom: env(safe-area-inset-bottom);
+
+		&-content {
+			justify-content: space-around;
+			height: 132rpx;
+			background-color: #fff;
+
+			&__price {
+
+				button {
+					line-height: 82rpx;
+					width: 420rpx;
+					height: 82rpx;
+					font-size: 30rpx;
+					background: #F9822C;
+					border-radius: 20px;
+					color: #fff;
+					margin-right: 20rpx;
+				}
+
+			}
+		}
+	}
+</style>

+ 108 - 0
src/packagePrize/purchase/index.vue

@@ -0,0 +1,108 @@
+<template>
+	<view>
+		<!-- #ifdef MP-ALIPAY -->
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="购买成功" leftIconSize="0">
+		</u-navbar>
+		<!-- #endif -->
+		<!-- #ifndef MP-ALIPAY -->
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="购买成功"></u-navbar>
+		<!-- #endif -->
+		<view class="purchase">
+			<image class="imgOne" src="https://mp-public-test-1307117429.cos.ap-shanghai.myqcloud.com/v2/buy_suc.png"
+				mode="scaleToFill"></image>
+			<image class="imgTwo" :src="picUrl" mode="scaleToFill"></image>
+		</view>
+
+		<view class="package">
+			<button @click="toProcess()">立即抽奖</button>
+			<text>已购买的商品请稍后在“我的”-“仓库”中进行查看和提货</text>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import env from '../../config/env.js'
+	import $http from '@/utils/request.js'
+	export default {
+		data() {
+			return {
+				boxId: 0,
+				orderId: 0,
+				picUrl: '',
+			}
+		},
+		onLoad(opthios) {
+			this.boxId = opthios.boxId
+			this.orderId = opthios.orderId
+			this.getPicUrl()
+		},
+		methods: {
+			getPicUrl() {
+				$http.post('/api/v1/mp/user/mall/ticket/detail', {
+					boxId: this.boxId,
+					noToken: true
+				}).then(res => {
+					if (res.code == 0) {
+						this.picUrl = env.filePublic + res.data.picUrl.split(',')[0]
+					}
+				})
+			},
+			// 线上立即刮票成功,跳转到刮奖过程
+			toProcess() {
+				uni.navigateTo({
+					url: `/packagePrize/rolling/index?boxId=${ this.boxId }&orderId=${ this.orderId }&isTry=0`
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.purchase {
+		position: relative;
+		padding-top: 100rpx;
+		width: 592rpx;
+		height: 788rpx;
+		margin: 0 auto;
+
+		.imgOne {
+			width: 100%;
+			height: 100%;
+		}
+
+		.imgTwo {
+			z-index: 10;
+			width: 100%;
+			width: 520rpx;
+			height: 430rpx;
+			position: absolute;
+			top: 320rpx;
+			left: 36rpx;
+		}
+	}
+
+	.package {
+		margin-top: 100rpx;
+		text-align: center;
+
+		button {
+			margin: 0 auto;
+			width: 666rpx;
+			height: 98rpx;
+			background: linear-gradient(180deg, #FEA052 0%, #FF8D2F 100%);
+			border-radius: 56rpx;
+			color: #fff;
+		}
+
+		text {
+			margin-top: 54rpx;
+			display: inline-block;
+			width: 570rpx;
+			color: #666666;
+			font-size: 26rpx;
+			line-height: 32rpx;
+			letter-spacing: 1px;
+		}
+	}
+</style>

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

@@ -1,12 +1,14 @@
 <template>
 	<view>
 		<!-- #ifdef MP-ALIPAY -->
-		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="盲票开启" v-if="rollingShow"
-			leftIconSize="0"></u-navbar>
+		<!-- <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="盲票开启" v-if="rollingShow"
+			leftIconSize="0"></u-navbar> -->
+			<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="抽奖中" v-if="rollingShow"
+				leftIconSize="0"></u-navbar>
 		<!-- #endif -->
 
 		<!-- #ifndef MP-ALIPAY -->
-		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="盲票开启" v-if="rollingShow">
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="抽奖中" v-if="rollingShow">
 		</u-navbar>
 		<!-- #endif -->
 
@@ -113,7 +115,7 @@
 				</view>
 			</view>
 			<view class="prize-tip flex" v-if="isTry == 0" @click="back">
-				<view class="txt">再来一张</view>
+				<view class="txt">返回首页</view>
 			</view>
 		</view>
 	</view>
@@ -453,8 +455,8 @@
 			},
 
 			back() {
-				uni.navigateBack({
-					delta: 1
+				uni.switchTab({
+					url:'/pages/index/index'
 				})
 			},
 

+ 7 - 0
src/pages.json

@@ -99,6 +99,8 @@
 				},
 				{
 					"path": "goods/detail"
+				}, {
+					"path": "goods/index"
 				},
 				{
 					"path": "prize/index"
@@ -111,6 +113,9 @@
 					"style": {
 						"navigationBarTextStyle": "white"
 					}
+				},
+				{
+					"path": "purchase/index"
 				}
 			]
 		},
@@ -155,6 +160,8 @@
 				},
 				{
 					"path": "rule/index"
+				},{
+					"path": "rule/purchase"
 				}
 			]
 		}

+ 9 - 19
src/pages/index/index.vue

@@ -95,7 +95,7 @@
 							</image>
 						</view>
 						<view class="ticket-btn-center-wrap flex">
-							<view class="ticket-btn-center-wrap__title">立即<br />购买</view>
+							<view class="ticket-btn-center-wrap__title">购买<br />有礼</view>
 						</view>
 					</view>
 					<view class="ticket-btn-right flex" @click="toTicket">
@@ -446,10 +446,10 @@
 							this.payShow = true
 						}
 					}).catch(() => {
-						uni.$u.toast('开刮失败,请重试!');
+						uni.$u.toast('购买失败,请重试!');
 					})
 				} else {
-					uni.$u.toast('盲票正在准备中');
+					uni.$u.toast('商品正在准备中');
 				}
 
 			},
@@ -498,34 +498,24 @@
 			},
 
 			toRollingGame() {
-				if (!uni.getStorageSync('token')) {
-					uni.navigateTo({
-						url: '/pages/login/index'
-					})
-					return
-				}
-				if (this.ticketInfo && this.ticketInfo.boxId) {
-					uni.navigateTo({
-						url: `/packagePrize/rolling/index?boxId=${ this.ticketInfo.boxId }&isTry=1`
-					})
-				} else {
-					uni.$u.toast('盲票正在准备中');
-				}
-
+				uni.switchTab({
+					url: '/pages/core/index'
+				})
 			},
 
 			// 线上立即刮票成功,跳转到刮奖过程
 			toProcess(id) {
 				this.payShow = false
 				uni.navigateTo({
-					url: `/packagePrize/rolling/index?boxId=${ this.ticketInfo.boxId }&orderId=${ id }&isTry=0`
+					url: `/packagePrize/purchase/index?boxId=${ this.ticketInfo.boxId }&orderId=${ id }&isTry=0`
 				})
 			},
 
 			// 点击盲票,跳转盲票详情
 			toTicketBox(item) {
+				//跳转商品详情
 				uni.navigateTo({
-					url: `/pages/ticketBox/detail?boxId=${ item.boxId }`
+					url: `/packagePrize/goods/index?id=${ item.refId }&boxId=${ this.ticketInfo.boxId }`
 				})
 			},
 

Some files were not shown because too many files changed in this diff