瀏覽代碼

修复部分bug及页面优化

hwb0 3 年之前
父節點
當前提交
566bcc37eb

文件差異過大導致無法顯示
+ 149 - 248
common/weapp-qrcode.js


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

@@ -25,7 +25,7 @@
 					<view class="txt" @click="toRule">同意<text>《盲票购买协议》</text></view>
 					<view class="checked">
 						<u-checkbox-group>
-							<u-checkbox :value="checked" :checked="checked" shape="circle" activeColor="#E96737"
+							<u-checkbox :value="checked" :checked="checked" size="24" shape="circle" activeColor="#E96737"
 								@change="changeChecked"></u-checkbox>
 						</u-checkbox-group>
 					</view>
@@ -82,8 +82,8 @@
 					url: '/pages/about/notice'
 				})
 			},
-			
-			toRule(){
+
+			toRule() {
 				uni.navigateTo({
 					url: '/pages/about/rule'
 				})
@@ -157,6 +157,10 @@
 							})
 							_this.close()
 						}
+					} else if (res.code == 1020) {
+						payIng = false
+						_this.close()
+						uni.$u.toast(res.msg);
 					} else {
 						payIng = false
 						_this.close()

+ 3 - 3
pages/choice/index.vue

@@ -27,14 +27,14 @@
 			</view>
 		</view>
 
-		<u-popup :show="tipShow" :round="10" mode="center">
+		<u-popup :show="tipShow" :round="10" mode="center" :safeAreaInsetBottom="false">
 			<view class="null-prize">
 				<view class="title">该盲票已被他人买走了</view>
 				<view class="btn" @click="toIndex">确认</view>
 			</view>
 		</u-popup>
 
-		<u-popup :show="comfirmShow" :round="10" mode="center">
+		<u-popup :show="comfirmShow" :round="10" mode="center" :safeAreaInsetBottom="false">
 			<view class="confirm-prize">
 				<view class="flex confirm-prize-info">
 					<image :src="actionInfo.picUrl" mode="aspectFill"></image>
@@ -320,7 +320,7 @@
 		align-items: center;
 		justify-content: center;
 		width: 80vw;
-		padding: 40rpx 0 0;
+		padding: 40rpx 0;
 
 		&-info {
 			width: 80%;

+ 34 - 31
pages/goods/detail.vue

@@ -70,19 +70,20 @@
 				</view>
 			</view>
 		</u-popup>
-		
+
 		<u-popup :show="tipShow" mode="center">
-		        <view class="tip-show">
-		            <view class="flex tip-show-title">
-						<u-icon name="checkmark-circle" color="#EB7009" size="24"></u-icon>
-						<text>兑换成功,已放入奖品库</text>
-					</view>
-					<view class="flex tip-show-btn">
-						<view class="close" @click="tipShow = false">关闭</view>
-						<navigator class="prize" :url="`/pages/prize/index`" hover-class="navigator-hover" @click="tipShow = false">前往查看</navigator>
-					</view>
-		        </view>
-			</u-popup>
+			<view class="tip-show">
+				<view class="flex tip-show-title">
+					<u-icon name="checkmark-circle" color="#EB7009" size="24"></u-icon>
+					<text>兑换成功,已放入奖品库</text>
+				</view>
+				<view class="flex tip-show-btn">
+					<view class="close" @click="tipShow = false">关闭</view>
+					<navigator class="prize" :url="`/pages/prize/index`" hover-class="navigator-hover"
+						@click="tipShow = false">前往查看</navigator>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -110,7 +111,7 @@
 		onLoad(opthios) {
 			this.goodsId = opthios.id
 		},
-		onShow(){
+		onShow() {
 			this.getDetail()
 		},
 		methods: {
@@ -188,7 +189,7 @@
 			valChange(e, item) {
 				let value = e.value
 				this.$set(item, 'exchangePrice', value * item.exValue)
-				if(this.payInfo.quantity < value){
+				if (this.payInfo.quantity < value) {
 					uni.$u.toast('库存不足');
 				}
 			},
@@ -217,12 +218,12 @@
 					skuId: this.payInfo.skuId,
 					orderNum: this.orderNum,
 				}
-				if(flag) return
-				if(this.payInfo.quantity == 0){
+				if (flag) return
+				if (this.payInfo.quantity == 0) {
 					uni.$u.toast('库存不足');
 					return
 				}
-				if(this.payInfo.quantity < this.orderNum){
+				if (this.payInfo.quantity < this.orderNum) {
 					uni.$u.toast('库存不足');
 					return
 				}
@@ -230,14 +231,14 @@
 					title: '兑换中'
 				});
 				flag = true
-				$http.post('/api/v1/mp/user/exchange/submit', data).then(res=>{
+				$http.post('/api/v1/mp/user/exchange/submit', data).then(res => {
 					uni.hideLoading();
 					flag = false
-					if(res.code == 0){
+					if (res.code == 0) {
 						this.choiceShow = false
 						this.tipShow = true
 						this.getDetail()
-					}else{
+					} else if (res.code == 1021) {
 						uni.$u.toast(res.msg);
 					}
 				}).catch(() => {
@@ -460,24 +461,25 @@
 			}
 		}
 	}
-	
-	.tip-show{
+
+	.tip-show {
 		width: 80vw;
 		background-color: #FFFFFF;
 		border-radius: 10rpx;
 		padding: 60rpx 40rpx;
-		
-		&-title{
+
+		&-title {
 			margin-bottom: 64rpx;
-			text{
+
+			text {
 				margin-left: 20rpx;
 			}
 		}
-		
-		&-btn{
+
+		&-btn {
 			justify-content: space-around;
-			
-			.close{
+
+			.close {
 				width: 160rpx;
 				height: 60rpx;
 				line-height: 60rpx;
@@ -487,8 +489,8 @@
 				text-align: center;
 				border: 1px solid rgba(235, 112, 9, 100);
 			}
-			
-			.prize{
+
+			.prize {
 				width: 160rpx;
 				height: 60rpx;
 				line-height: 60rpx;
@@ -517,6 +519,7 @@
 
 		.btn {
 			padding: 20rpx 0;
+
 			/deep/ button {
 				width: 640rpx;
 				height: 90rpx;

+ 7 - 0
pages/index/index.vue

@@ -77,6 +77,7 @@
 			};
 		},
 		onShow(opthios) {
+			this.loginState = uni.getStorageSync('token') ? true : false
 			this.getList()
 		},
 		methods: {
@@ -156,6 +157,12 @@
 			},
 
 			toPrize() {
+				if (!this.loginState) {
+					uni.navigateTo({
+						url: "/pages/login/index"
+					})	
+					return
+				}
 				uni.navigateTo({
 					url: '/pages/prize/index'
 				})

+ 1 - 1
pages/lucky/index.vue

@@ -22,7 +22,7 @@
 
 		<pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="getDetailInfo" />
 
-		<u-popup :show="showNull" :round="10" mode="center">
+		<u-popup :show="showNull" :round="10" mode="center" :safeAreaInsetBottom="false">
 			<view class="null-prize">
 				<view class="title">该盲票已兑奖</view>
 				<view class="btn" @click="toIndex">确认</view>

+ 8 - 4
pages/order/settlement.vue

@@ -3,7 +3,7 @@
 		<u-navbar title="提交订单" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
 		<view class="settlement">
 			<view class="settlement-address">
-				<view class="flex settlement-address-top">
+				<view class="flex settlement-address-top" v-if="info.addr !== null">
 					<view class="settlement-address-top__left">配送地址</view>
 					<view class="flex settlement-address-top__right" @click="toAddress">
 						<view class="">更改地址</view>
@@ -11,10 +11,10 @@
 					</view>
 				</view>
 				<view class="settlement-address-desc" v-if="info.addr !== null">
-					<view class="settlement-address-desc__item">{{ `${ addr.province }-${ addr.city }-${ addr.area }` }}
-						{{ addr.addr }}
+					<view class="settlement-address-desc__item">{{ `${ addr.province || '-' }-${ addr.city || '-' }-${ addr.area || '-' }` }}
+						{{ addr.addr || '-' }}
 					</view>
-					<view class="settlement-address-desc__item">{{ addr.receiver }} {{ addr.mobile }}</view>
+					<view class="settlement-address-desc__item">{{ addr.receiver || '-' }} {{ addr.mobile || '-' }}</view>
 				</view>
 				<view class="settlement-address-form" v-else>
 					<view class="address-add">
@@ -127,6 +127,10 @@
 		},
 		methods: {
 			save() {
+				if(this.info.addr == null){
+					uni.$u.toast('请先保存配送地址');
+					return
+				}
 				let _this = this
 				let payIng = false
 				if (payIng) return

+ 3 - 7
pages/prize/detail.vue

@@ -16,7 +16,7 @@
 				</view>
 			</view>
 			<view class="flex detail-code">
-				<canvas style="width: 426rpx;height: 426rpx;" canvas-id="couponQrcode"></canvas>
+				<canvas style="width: 220px;height: 220px;" canvas-id="couponQrcode"></canvas>
 			</view>
 			<view class="detail-explain">
 				<view class="txt">使用说明:</view>
@@ -115,12 +115,8 @@
 		}
 
 		&-code {
-			padding: 60rpx 0;
-
-			image {
-				width: 426rpx;
-				height: 426rpx;
-			}
+			width: 100%;
+			height: 550rpx;
 		}
 
 		&-explain {

+ 5 - 2
pages/prize/index.vue

@@ -19,7 +19,7 @@
 				<view class="flex prize-goods-list-item" v-for="(item, index) in list" :key="index">
 					<view class="flex checkbox">
 						<u-checkbox-group>
-							<u-checkbox :value="item.checked" shape="circle" :checked="item.checked" activeColor="#E96737"
+							<u-checkbox size="24" :value="item.checked" shape="circle" :checked="item.checked" activeColor="#E96737"
 								@change="changeChecked($event, item)"></u-checkbox>
 						</u-checkbox-group>
 					</view>
@@ -66,7 +66,7 @@
 				<view class="flex checkbox">
 					<view class="all">全选</view>
 					<u-checkbox-group>
-						<u-checkbox :value="checkedAll" shape="circle" :checked="checkedAll" activeColor="#E96737"
+						<u-checkbox v-model="checkedAll" shape="circle" size="24" :checked="checkedAll" activeColor="#E96737"
 							@change="changeCheckedAll($event)"></u-checkbox>
 					</u-checkbox-group>
 				</view>
@@ -115,6 +115,7 @@
 					title: '加载中'
 				});
 				this.loading = true
+				this.checkedAll = false
 				$http.post(`${ url }?pageNum=${_this.pageNum}&pageSize=20`, data).then(res => {
 					uni.hideLoading();
 					this.loading = false
@@ -149,6 +150,7 @@
 					this.state = 1
 				}
 				this.pageList()
+				this.checkedAll = false
 			},
 
 			changeChecked(e, item) {
@@ -159,6 +161,7 @@
 			},
 			
 			changeCheckedAll(e) {
+				this.checkedAll = e
 				this.list.forEach(item => {
 					item.checked = e
 				})

+ 20 - 1
pages/process/index.vue

@@ -42,13 +42,32 @@
 				$http.post('/api/v1/mp/user/ticket/query', {
 					orderId: this.id,
 				}).then(res => {
-					uni.hideLoading();
 					if (res.code == 0) {
+						uni.hideLoading();
 						this.info = res.data
 						let picUrlArr = res.data.picUrl.split(',')
 						picUrlArr.forEach(item => {
 							this.picUrlArr.push(env.filePublic + item)
 						})
+					} else if (res.code == 1022) {
+						let time = setInterval(() => {
+							uni.showLoading({
+								title: '加载中'
+							});
+							$http.post('/api/v1/mp/user/ticket/query', {
+								orderId: this.id,
+							}).then(ele => {
+								if (ele.code == 0) {
+									uni.hideLoading();
+									clearInterval(time)
+									this.info = ele.data
+									let picUrlArr = ele.data.picUrl.split(',')
+									picUrlArr.forEach(item => {
+										this.picUrlArr.push(env.filePublic + item)
+									})
+								}
+							})
+						}, 1000)
 					}
 				}).catch(() => {
 					uni.hideLoading();

+ 0 - 2
pages/ticketBox/detail.vue

@@ -96,9 +96,7 @@
 							let picUrlArr = item.picUrl.split(',')
 							item.picUrl = env.filePublic + picUrlArr[0]
 						})
-
 						this.prizeList = prizeList
-						console.log(this.prizeList);
 					}
 				}).catch(() => {
 					uni.hideLoading();

+ 13 - 2
pages/user/index.vue

@@ -85,10 +85,9 @@
 
 		onShow() {
 			this.loginState = uni.getStorageSync('token') ? true : false
-			this.userInfo = uni.getStorageSync('userInfo')
-			this.avatar = env.filePublic + this.userInfo.avatar
 			if (this.loginState) {
 				this.getInit()
+				this.getBaseInfo()
 			}
 		},
 
@@ -107,6 +106,18 @@
 					uni.hideLoading();
 				})
 			},
+			
+			getBaseInfo() {
+				$http.post('/api/v1/mp/user/getLoginUserinfo', {}).then(res => {
+					console.log(res);
+					if (res.code == 0) {
+						this.userInfo = res.data
+						this.avatar = env.filePublic + res.data.avatar
+					}
+				}).catch(() => {
+					
+				})
+			},
 
 			// 跳转登录
 			toLogin() {

+ 1 - 1
utils/request.js

@@ -38,7 +38,7 @@ const $http = (url, data, methods) => {
 					uni.navigateTo({
 						url: "/pages/login/index"
 					})	
-				} else if (res.data && res.data.code !== 0 && res.data.code !== 1016 && res.data.code !== 1018) {
+				} else if (res.data && res.data.code !== 0 && res.data.code !== 1016 && res.data.code !== 1018 && res.data.code !== 1022) {
 					uni.showToast({
 						title: res.data.msg || '请求错误,请重试。',
 						icon: 'none',

部分文件因文件數量過多而無法顯示