소스 검색

bug 修复

lilei 4 년 전
부모
커밋
adce7803e0
4개의 변경된 파일114개의 추가작업 그리고 39개의 파일을 삭제
  1. 9 0
      api/luckyDraw.js
  2. 11 5
      pages/index/index.vue
  3. 21 9
      pagesA/luckDraw/luckDraw.vue
  4. 73 25
      pagesA/luckDraw/myJp.vue

+ 9 - 0
api/luckyDraw.js

@@ -41,4 +41,13 @@ export const findWinPrize = params => {
     url: `luckyDrawCust/findWinPrize`,
     method: 'get',
   })
+};
+
+// 领奖
+export const receive = params => {
+  return axios.request({
+    url: `luckyDrawCust/receive`,
+    method: 'post',
+	data: params
+  })
 };

+ 11 - 5
pages/index/index.vue

@@ -104,8 +104,6 @@
 		onLoad() {
 			// 检查更新
 			this.checkUpdate()
-			// 判断是否有抽奖活动
-			this.getLuckDraw()
 			// 查询购物车列表
 			this.getCartList()
 			// 刷新购物车列表
@@ -140,6 +138,8 @@
 			console.log(res)
 		},
 		onShow() {
+			// 判断是否有抽奖活动
+			this.getLuckDraw()
 			// 获取订单状态数据字典
 			// this.getCodeList('RUBBISH_TYPE','vuex_rubbishType')
 			// 获取顶部轮播图
@@ -263,9 +263,15 @@
 				let row = this.imageTopList[index]
 				console.log(index,row)
 				if(row.jumpType !== 'NONE'){
-					uni.navigateTo({
-						url: row.jumpUrl
-					})
+					if(row.jumpUrl.indexOf('pagesA/luckDraw') >= 0){
+						uni.navigateTo({
+							url:this.hasLogin ? row.jumpUrl :"/pages/login/login"
+						})
+					}else{
+						uni.navigateTo({
+							url: row.jumpUrl
+						})
+					}
 				}
 			},
 			// 查询购物车

+ 21 - 9
pagesA/luckDraw/luckDraw.vue

@@ -6,6 +6,7 @@
 				<text>我的奖品</text>
 			</view>
 			<almost-lottery
+				ref="lottery"
 				:prize-list="prizeList"
 				:prize-index="prizeIndex"
 				@reset-index="prizeIndex = -1"
@@ -27,7 +28,7 @@
 					<text>{{ reTimes }}</text>
 				</view>
 				<view v-else @click="showPayWin('win_4')">
-					支付10乐豆继续抽奖 >
+					支付{{luckDraw.purchaseTimesGold}}乐豆继续抽奖 >
 				</view>
 			</view>
 		</view>
@@ -97,7 +98,7 @@
 					抱歉,您的免费抽奖次数已用完!
 				</view>
 				<view @click="toPay" class="lottery-confrim-btn">
-					支付10乐豆继续抽奖
+					支付{{luckDraw.purchaseTimesGold}}乐豆继续抽奖
 				</view>
 			</view>
 			<view class="lottery-content win_2" v-if="winTypes == 'win_2'">
@@ -175,7 +176,7 @@ export default {
 			showSetPswModal: false,
 			animateUp: false,
 			timer: null,
-			scrollTextHeight: 400,
+			scrollTextHeight: 0,
 			hjList: [
 				{
 					time: '2019年1月',
@@ -251,13 +252,23 @@ export default {
 			weightArr: []
 		};
 	},
+	watch: {
+		showLottery(newValue, oldValue) {
+			if(!newValue){
+				console.log(!newValue)
+				this.handleInitCanvas()
+			}
+		}
+	},
 	methods: {
 		// 重新生成
 		handleInitCanvas() {
 			clearCacheFile();
 			this.targetName = '';
-			this.prizeList = [];
-			this.getPrizeList();
+			this.prizeIndex = -1
+			this.$refs.lottery.targetAngle = 0
+			// this.prizeList = [];
+			// this.getPrizeList();
 		},
 		// 获取奖品列表
 		async getPrizeList() {
@@ -304,7 +315,7 @@ export default {
 						ok: temp.length,
 						data: temp
 					});
-				}, 500);
+				}, 100);
 			});
 		},
 		// 获取免费抽奖次数
@@ -481,11 +492,12 @@ export default {
 		},
 	},
 	onShow() {
-		this.timer = setInterval(this.scrollAnimate, 2000);
-		this.getScrollTextHeight()
+		if(this.scrollTextHeight == 0){
+			this.getScrollTextHeight()
+			this.timer = setInterval(this.scrollAnimate, 2000);
+		}
 		// 查询免费抽奖次数
 		this.getCustomerTimes()
-		// this.reTimes = this.$store.state.vuex_LuckDrawTimes
 	},
 	onLoad() {
 		this.luckDraw = this.$store.state.vuex_LuckDraw

+ 73 - 25
pagesA/luckDraw/myJp.vue

@@ -3,32 +3,37 @@
 		<view class="list" v-for="(item,index) in list" :key="item.id">
 			<view>奖品{{index+1}}</view>
 			<view class="names">{{item.prizeDesc}}</view>
-			<view class="viewsDetail" @click="viewsDetail">查看详情</view>
-			<view class="lingjiang" @click="lingjiang(0)">领奖</view>
+			<view class="lingjiang" v-if="item.state == 'WAIT_RECEIVE'" @click="lingjiang(item)">领奖</view>
+			<view class="viewsDetail" v-else @click="viewsDetail(item)">查看详情</view>
+		</view>
+		<view v-if="list.length == 0">
+			<u-empty text="还未中奖" :icon-size="50" mode="list"></u-empty>
 		</view>
 		
 		<!-- 查看详情弹框 -->
-		<u-popup v-model="showViews" mode="center" close-icon-color="#ffffff" closeable :border-radius="30" width="500rpx" height="650rpx">
+		<u-popup v-model="showViews" mode="center" close-icon-color="#ffffff" closeable :border-radius="30" width="500rpx">
 			<view class="lottery-content">
 				<view class="lottery-title">物流信息</view>
 				<view class="lottery-form">
 					<view>
 						<view class="labes">收件人</view>
-						<view>李磊</view>
+						<view>{{curRevice.receiverName}}</view>
 					</view>
 					<view>
 						<view class="labes">联系电话</view>
-						<view>1379964646</view>
+						<view>{{curRevice.receiverPhone}}</view>
 					</view>
 					<view>
 						<view class="labes">收货地址</view>
-						<view>陕西省咸阳市某某街某某 某小区某某单元1100号</view>
+						<view>{{curRevice.receiveAddress}}</view>
 					</view>
 					<view>
 						<view class="labes">物流单号</view>
 						<view>
-							<!-- <text>暂未发货,如收货信息有误, 请联系13312345678</text> -->
-							<text>中国邮政(单号:16546464645)</text> <u-button @click="copyWlCode" size="mini">复制</u-button>
+							<view v-if="curRevice.state == 'WAIT_SEND_EXPRESS'">暂未发货,如收货信息有误, 请联系客服电话<text class="tell" @click="callPhone">{{kfPhone}}</text></view>
+							<view v-else>
+								中国邮政 <text class="tell">(单号:16546464645)</text> <u-button @click="copyWlCode" size="mini">复制</u-button>
+							</view>
 						</view>
 					</view>
 				</view>
@@ -84,13 +89,14 @@
 <script>
 import Address from '@/components/address.vue'
 import {findAddressBycustomerNo, saveAddress} from '@/api/receiveAddress.js'
-import { findWinPrize } from '@/api/luckyDraw.js'
+import { findWinPrize, receive } from '@/api/luckyDraw.js'
 export default {
 	components: {
 		Address
 	},
 	data() {
 		return {
+			kfPhone:'', // 客服电话
 			showViews: false, // 查看详情弹框
 			showAddr: false ,// 实物奖品,收货地址弹框
 			showLjLd: false, // 虚拟奖品领奖弹框
@@ -103,7 +109,8 @@ export default {
 			areaName: '', //地址
 			areaInfo: {},  //  省市区
 			areaIdArr: [],  //  省市区id数组
-			list: []
+			list: [],
+			curRevice: null
 		}
 	},
 	// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
@@ -113,6 +120,7 @@ export default {
 	onLoad(option) {
 		console.log(option,'option')
 		this.getfindWinPrize()
+		this.kfPhone = this.$store.state.vuex_kfMobile
 	},
 	onUnload() {
 		this.form = {
@@ -122,6 +130,12 @@ export default {
 		}
 	},
 	methods: {
+		// 电话客服
+		callPhone () {
+			uni.makePhoneCall({
+			    phoneNumber: this.kfPhone
+			})
+		},
 		getfindWinPrize(){
 			findWinPrize().then(res => {
 				if(res.status == 200){
@@ -158,16 +172,22 @@ export default {
 			uni.navigateBack()
 		},
 		// 查看详情
-		viewsDetail(){
-			this.showViews = true
+		viewsDetail(item){
+			this.curRevice = item
+			if(item.prizeType == 'GOODS'){
+				this.showViews = true
+			}else{
+				this.showLjLd = true
+			}
 		},
 		// 领奖
-		lingjiang(type){
-			if(type){
+		lingjiang(item){
+			this.curRevice = item
+			if(item.prizeType == 'GOODS'){
 				this.showAddr = true
 				this.getAddress()
 			}else{
-				this.showLjLd = true
+				this.saveReceive()
 			}
 		},
 		// 复制单号
@@ -220,17 +240,46 @@ export default {
 					if(this.form.id) {
 						params.id = this.form.id
 					}
+					// 保存我的收货地址
 					saveAddress(params).then(res=>{
 						if(res.status == 200) {
-							uni.showToast({
-								title: res.message,
-								icon: 'none'
-							})
-							this.showAddr = false
+							// 保存领奖收货信息
+							this.saveReceive(params)
 						} 
 					})
 				}
 			});
+		},
+		// 领奖
+		saveReceive(params){
+			let item = this.curRevice
+			let isGoods = item.prizeType == 'GOODS'
+			let data = {
+				"luckyDrawWinNo": this.curRevice.luckyDrawWinNo
+			}
+			// 实物,发货地址
+			if(isGoods){
+				data.receiverName = params.receiverName
+				data.receiverPhone = params.receiverPhone
+				data.receiveAddress = params.receiveAreasName +' '+ params.receiveAddress
+			}
+			receive(data).then(res => {
+				if(res.status == 200){
+					uni.showToast({
+						title: res.message,
+						icon: 'none'
+					})
+					
+					if(isGoods){
+						this.showAddr = false
+					}else{
+						this.showLjLd = true
+					}
+					
+					this.list = []
+					this.getfindWinPrize()
+				}
+			})
 		}
 	} 
 }
@@ -266,7 +315,9 @@ export default {
 				width: 25%;
 			}
 		}
-		
+		.tell{
+			color: #0A98D5;
+		}
 		.lottery-content{
 			height: 100%;
 			position: relative;
@@ -276,9 +327,6 @@ export default {
 				width: 100%;
 				display: flex;
 				justify-content: center;
-				position: absolute;
-				bottom: 0;
-				left: 0;
 				font-size: 32rpx;
 				border-top: 1px solid #eee;
 				padding: 30rpx 0;
@@ -319,7 +367,7 @@ export default {
 				line-height: 42rpx;
 			}
 			.lottery-u-form{
-				padding: 50rpx 50rpx 150rpx;
+				padding: 50rpx;
 				.receiveAddress{
 					width: 100%;
 					line-height: 1.5em;