heyang 3 vuotta sitten
vanhempi
commit
236b4720fa

+ 4 - 0
microserviceUserH5/static/css/springFestivalActivity.css

@@ -584,6 +584,10 @@ ul, li {
   margin-top: 0.24rem;
 }
 
+.operate-btn{
+  background: linear-gradient(180deg, #FFFBE0 0%, #FFF6C4 56%, #FFFBE0 100%);
+}
+
 #toast-container>.toast-error {
   background-image: none !important;
 }

+ 39 - 33
microserviceUserH5/vcloud/springFestivalActivity.html

@@ -54,11 +54,7 @@
 				</div>
 				<div class="line"></div>
 				<div class="data-list">
-					<div class="data-row">
-						<div class="award-card">星曜天卡</div>
-						<div class="record-time">12月14日13:21:23</div>
-						<div class="record-operate">已使用</div>
-					</div>
+					
 				</div>
 			</div>
 			<div class="sure-btn">确定</div>
@@ -145,6 +141,7 @@
 			isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
 		let activityState = 0,
 		    surplus = 0,
+			receive = 0,
 			notReceive = 0;
 		if(id !== ''){
 			operate(3);
@@ -204,6 +201,9 @@
 						}
 						if(notReceive > 0){
 				            $('.tab-wrap').eq(0).css('display', 'flex');
+				            $('.record-wrap').eq(0).css('marginTop', '0.2rem');
+				            $('.record-wrap').eq(0).css('height', '5.48rem');
+				            $('.data-list').eq(0).css('height', '4.38rem');
 						}else{
 				            $('.tab-wrap').eq(0).css('display', 'none');
 				            $('.record-wrap').eq(0).css('marginTop', '1.6rem');
@@ -261,14 +261,14 @@
 		},false);
 		//点击领取按钮
 		$('.tab-wrap')[0].addEventListener('click',(e) => {
-			let index = e.target.dataset.index;
-			console.log(index)
-			if(index == 1){
+			receive = e.target.dataset.index;
+			if(receive == 1){
 				$('.award-change-btn')[0].className = 'award-change-btn'
 			}else{
 				$('.award-change-btn')[1].className = 'award-change-btn'
 			}
-			$('.award-change-btn')[index].className = 'award-change-btn active'
+			getAward();
+			$('.award-change-btn')[receive].className = 'award-change-btn active'
 		},false);
 		//点击抽奖
 		$('.once')[0].addEventListener('click',() => {
@@ -459,7 +459,6 @@
 					$('.distribution-dialog').animate({top: '5.24rem'},"fast");
 					$('.distribution-mask').show();
 					document.documentElement.style.overflow='hidden';
-					window.native.activatePhone(2);
 				} else {
 				    window.native.startMain();
 				}
@@ -475,6 +474,22 @@
 			$('.award-record-mask').show();
 			document.documentElement.style.overflow='hidden';
 		},false);
+		//点击使用按钮
+		$('.data-list')[0].addEventListener('click',(e) => {
+			if (e.target.className === 'record-operate operate-btn') {
+				let awardId = e.target.dataset.awardId;
+				let awardName = e.target.dataset.awardName;
+				if (isMiniprogram) { // 小程序
+					wx.miniProgram.navigateTo({
+						url: '/packageA/order/buy/index?type=activity'
+					})
+				} else if (isAndroid) { // 安卓
+					window.native.activatePhone(2, awardId, awardName);
+				} else if (isiOS) {
+					window.webkit.messageHandlers.activatePhone.postMessage({ type: 2, awardId: awardId, awardName: awardName });
+				}
+			}
+		},false);
 		//获取抽奖记录
 		function getAward(){
 			$.ajax({
@@ -486,35 +501,26 @@
 				data:JSON.stringify({
 					pageNum: 1,
 					pageSize: 10,
-					receive: 0
+					receive: receive
 				}),
 				contentType: "application/json",
 				dataType: 'json',
 				cache: false,
 				success: function (res) {
 					if(res.status === 0){
-						// $('.activity-time').eq(0).text(time);
-						// let str = '';
-						// for (var i = 0; i < cardData.length; i++) {
-						// 	str += `<div class="card-item">
-						// 				<img class="card" src="../static/img/springFestivalActivity/${cardData[i].imgName}.png" />
-						// 				<div class="card-text">星曜${cardData[i].name}卡</div>
-						// 			</div>`
-						// }
-						// activityState = res.data.activityState;
-						// surplus = res.data.surplus;
-						// notReceive = res.data.notReceive;
-						// $('.rest-times-number').eq(0).text(surplus);
-						// $('.times-text-number').eq(0).text(surplus);
-						// if(res.data.addition === 1){
-						// 	$('.gift-box')[0].className = 'gift-box have-buff'
-						// } else {
-						// 	$('.gift-box')[0].className = 'gift-box'
-						// }
-						// if(notReceive > 0){
-							
-						// }
-						// $('.card-wrap').eq(0).append(str)
+						$('.data-list').eq(0).text('');
+						let str = '',
+						    records = res.data.records;
+						for (var i = 0; i < records.length; i++) {
+							str += `<div class="data-row">
+										<div class="award-card">星曜${records[i].effectiveTimeStr}卡</div>
+										<div class="record-time">${records[i].createTime}</div>
+										<div class="${records[i].receiveType === 0?'record-operate':'record-operate operate-btn'}"
+										data-awardId="${records[i].id}" data-awardName="${records[i].effectiveTimeStr}">
+										${records[i].receiveType === 0?'已使用':'使用'}</div>
+									</div>`
+						}
+						$('.data-list').eq(0).append(str)
 					}else{
 						stopManyClick(() =>{
 							toastr.error(res.msg)