418 lines
		
	
	
		
			9.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
		
		
			
		
	
	
			418 lines
		
	
	
		
			9.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
|  | <template> | ||
|  | 	<view class="content"> | ||
|  | 		<view class="container"> | ||
|  | 			<view class="my-header"> | ||
|  | 				<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view> | ||
|  | 				<view class="my-text">子卡管理</view> | ||
|  | 				<view class="my-icons"></view> | ||
|  | 			</view> | ||
|  | 			<!-- 顶部区域 --> | ||
|  | 			<view class="tap-top"> | ||
|  | 				<view class="tap-box" :class="{ 'act' : tindex == index }" v-for="(item,index) in tapList" :key="index" | ||
|  | 					@click="tapindex(index)"> | ||
|  | 					<view class="">{{ item.text }}</view> | ||
|  | 					<view class="gang" :class="{ 'lan' : tindex == index }"></view> | ||
|  | 				</view> | ||
|  | 			</view> | ||
|  | 			<!-- <view class="hong-card"> | ||
|  | 				<view class="top-hang"> | ||
|  | 					<view class="hgang"></view> | ||
|  | 					<view class="">加油站名称</view> | ||
|  | 				</view> | ||
|  | 				<view class="title-box">储值卡</view> | ||
|  | 				<view class="red-bottom"> | ||
|  | 					<view class="x-size"> | ||
|  | 						<view class="">卡券卡密</view> | ||
|  | 						<view class="">**** **** **** 970</view> | ||
|  | 					</view> | ||
|  | 					<view class="r-anniu"> | ||
|  | 						<span>去完成</span> | ||
|  | 					</view> | ||
|  | 				</view> | ||
|  | 			</view> --> | ||
|  | 			<view v-if="tindex==0"> | ||
|  | 				<view class="hong-card" v-for="item in list" :key="item.id" @click="toCheck(item.cardChildPhones)"> | ||
|  | 					<view class="top-hang"> | ||
|  | 						<view class="hgang"></view> | ||
|  | 						<view class="">{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view> | ||
|  | 					</view> | ||
|  | 					<view class="title-box">储值卡</view> | ||
|  | 					<view class="red-bottom"> | ||
|  | 						<view class="x-size"> | ||
|  | 							<view class="">子卡手机号</view> | ||
|  | 							<view class="">{{item.cardChildPhones}}</view> | ||
|  | 						</view> | ||
|  | 						<view class="r-anniu"> | ||
|  | 							<span>查看订单</span> | ||
|  | 						</view> | ||
|  | 					</view> | ||
|  | 				</view> | ||
|  | 				<view class="x_anniu" @click="goDetail()"> | ||
|  | 					<uni-icons type="plusempty" color="#fff" size="30"></uni-icons> | ||
|  | 				</view> | ||
|  | 
 | ||
|  | 				<u-empty v-if="list.length == 0" mode="coupon" text="内容为空" | ||
|  | 					icon="http://cdn.uviewui.com/uview/empty/coupon.png"> | ||
|  | 				</u-empty> | ||
|  | 			</view> | ||
|  | 
 | ||
|  | 			<view v-if="tindex==1"> | ||
|  | 				<scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollList" style="height: 78vh;" | ||
|  | 					@scrolltolower="scrolltolower"> | ||
|  | 					<!-- 油品订单列表 --> | ||
|  | 					<view class="box-order" v-for="(item,index) in orderList" :key="index"> | ||
|  | 						<view class="or-box-top"> | ||
|  | 							<view class="">{{store.name}}</view> | ||
|  | 							<!-- <view class="chengg">{{getPayName(payList,item.orderStatus)}}</view> --> | ||
|  | 							<view class="chengg" v-if="item.status=='paid'">已支付</view> | ||
|  | 							<view class="chengg" v-else-if="item.status=='payFail'">支付失败</view> | ||
|  | 							<view class="chengg" v-else>未支付</view> | ||
|  | 						</view> | ||
|  | 				 | ||
|  | 						<!-- <view class="but-box"> | ||
|  | 							<view class="huis">订单类型</view> | ||
|  | 							<view class="">油品订单</view> | ||
|  | 						</view> --> | ||
|  | 						<view class="but-box"> | ||
|  | 							<view class="huis">订单金额</view> | ||
|  | 							<view class="">¥{{item.amount}}</view> | ||
|  | 						</view> | ||
|  | 						<view class="but-box"> | ||
|  | 							<view class="huis">支付金额</view> | ||
|  | 							<view class="reds">¥{{item.payAmount}}</view> | ||
|  | 						</view> | ||
|  | 						<view class="but-box"> | ||
|  | 							<view class="huis">订单时间</view> | ||
|  | 							<view class="" v-if="item.orderStatus=='paid'">{{item.payTime}}</view> | ||
|  | 							<view class="" v-else>{{item.createTime}}</view> | ||
|  | 						</view> | ||
|  | 						<view class="but-box"> | ||
|  | 							<view class="huis">订单备注</view> | ||
|  | 							<view class="">{{item.remark}}</view> | ||
|  | 						</view> | ||
|  | 						<!-- <view v-if="item.orderStatus=='paid'" class="end-box" @click="goComment()"> | ||
|  | 							<view class="anniu"> | ||
|  | 								<text>评价有礼</text> | ||
|  | 							</view> | ||
|  | 						</view> | ||
|  | 						<view v-else-if="item.orderStatus=='unpaid'" class="end-box" @click="goPayment()"> | ||
|  | 							<view class="anniu"> | ||
|  | 								<text>去支付</text> | ||
|  | 							</view> | ||
|  | 						</view> --> | ||
|  | 					</view> | ||
|  | 					 | ||
|  | 					<u-empty v-if="orderList.length == 0" mode="coupon" text="内容为空" | ||
|  | 						icon="http://cdn.uviewui.com/uview/empty/coupon.png"> | ||
|  | 					</u-empty> | ||
|  | 				</scroll-view> | ||
|  | 			</view> | ||
|  | 			 | ||
|  | 		</view> | ||
|  | 	</view> | ||
|  | </template> | ||
|  | 
 | ||
|  | <script> | ||
|  | 	import request from '../../utils/request' | ||
|  | 	export default { | ||
|  | 		data() { | ||
|  | 			return { | ||
|  | 				title: '', | ||
|  | 				tindex: 0, | ||
|  | 				tapList: [{ | ||
|  | 						text: "子卡管理" | ||
|  | 					}, | ||
|  | 					{ | ||
|  | 						text: "交易统计" | ||
|  | 					}, | ||
|  | 
 | ||
|  | 				], | ||
|  | 				list: [], | ||
|  | 				storeId: uni.getStorageSync("storeId"), | ||
|  | 				// 店铺信息
 | ||
|  | 				store:{}, | ||
|  | 				scrollTop: 0, | ||
|  | 				orderList:[], | ||
|  | 				map:{ | ||
|  | 					page:1, | ||
|  | 					pageSize:10, | ||
|  | 					storeId: uni.getStorageSync("storeId"), | ||
|  | 					cardChildPhones:'', | ||
|  | 				}, | ||
|  | 				total:0, | ||
|  | 			} | ||
|  | 		}, | ||
|  | 		onShow() { | ||
|  | 			this.getCardValueChildren() | ||
|  | 			this.getStore() | ||
|  | 		}, | ||
|  | 		components: { | ||
|  | 
 | ||
|  | 		}, | ||
|  | 		methods: { | ||
|  | 			// 查询当前子卡手机号消费信息
 | ||
|  | 			toCheck(mobile){ | ||
|  | 				this.map.cardChildPhones = mobile; | ||
|  | 				this.map.page = 1; | ||
|  | 				this.getMyOrder() | ||
|  | 				this.tindex = 1; | ||
|  | 			}, | ||
|  | 			parseTime(dateTime) { | ||
|  | 				let date = new Date(dateTime); | ||
|  | 				let y = date.getFullYear() + "-"; | ||
|  | 				let mon = ((date.getMonth() + 1 < 10) ? ('0' + date.getMonth()) : date.getMonth()) + "-"; | ||
|  | 				let d = ((date.getDate() < 10) ? ('0' + date.getDate()) : date.getDate()) + " "; | ||
|  | 				let h = ((date.getHours() < 10) ? ('0' + date.getHours()) : date.getHours()) + ":"; | ||
|  | 				let m = ((date.getMinutes() < 10) ? ('0' + date.getMinutes()) : date.getMinutes()) + ":"; | ||
|  | 				let s = ((date.getSeconds() < 10) ? ('0' + date.getSeconds()) : date.getSeconds()); | ||
|  | 				return y + mon + d + h + m + s; | ||
|  | 			}, | ||
|  | 			// 滚动区域
 | ||
|  | 			scrolltolower() { | ||
|  | 				if (this.orderList.length < this.total) { | ||
|  | 					this.map.page++; | ||
|  | 					this.getMyOrder() | ||
|  | 				} | ||
|  | 			}, | ||
|  | 			getMyOrder(){ | ||
|  | 				request({ | ||
|  | 					url: "business/order/cardValueChildOrder/list", | ||
|  | 					method: 'get', | ||
|  | 					params:this.map, | ||
|  | 				}).then((res) => { | ||
|  | 					if (res.code == 200) { | ||
|  | 						if (this.map.page == 1) { | ||
|  | 							this.orderList = res.data.records | ||
|  | 						} else { | ||
|  | 							this.orderList = _this.orderList.concat(res.data.records) | ||
|  | 						} | ||
|  | 						this.total = res.data.total | ||
|  | 					} | ||
|  | 				}) | ||
|  | 			}, | ||
|  | 			// 获取当前店铺信息
 | ||
|  | 			getStore(){ | ||
|  | 				request({ | ||
|  | 					url: "business/storeInformation/store/"+this.storeId, | ||
|  | 					method: 'get', | ||
|  | 				}).then((res) => { | ||
|  | 					// console.log(res)
 | ||
|  | 					this.store = res.data | ||
|  | 				}) | ||
|  | 			}, | ||
|  | 			// 获取子卡信息
 | ||
|  | 			getCardValueChildren(){ | ||
|  | 				request({ | ||
|  | 					url: "cardValudChildrens/list/"+this.storeId, | ||
|  | 					method: 'get', | ||
|  | 				}).then((res) => { | ||
|  | 					// console.log(res)
 | ||
|  | 					this.list = res.data | ||
|  | 				}) | ||
|  | 			}, | ||
|  | 			tapindex(index) { | ||
|  | 				this.tindex = index | ||
|  | 				console.log(index); | ||
|  | 				if (index==0){ | ||
|  | 					this.getCardValueChildren() | ||
|  | 				} | ||
|  | 				if (index==1){ | ||
|  | 					this.getMyOrder() | ||
|  | 				} | ||
|  | 			}, | ||
|  | 			goDetail() { | ||
|  | 				uni.navigateTo({ | ||
|  | 					url: '/pagesMy/CardManagement/Detail' | ||
|  | 				}) | ||
|  | 			}, | ||
|  | 			goback() { | ||
|  | 				uni.navigateBack() | ||
|  | 			} | ||
|  | 		} | ||
|  | 	} | ||
|  | </script> | ||
|  | 
 | ||
|  | <style scoped lang="scss"> | ||
|  | 	.content { | ||
|  | 		background: #f4f5f6; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.container { | ||
|  | 		width: 100%; | ||
|  | 		height: 100vh; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding-top: 88px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.my-header { | ||
|  | 		width: 100%; | ||
|  | 		height: 88px; | ||
|  | 		background: #ffffff; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 		color: #000; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 0px 15px; | ||
|  | 		padding-top: 40px; | ||
|  | 
 | ||
|  | 		.my-icons { | ||
|  | 			width: 20px; | ||
|  | 
 | ||
|  | 		} | ||
|  | 
 | ||
|  | 		position: fixed; | ||
|  | 		top: 0px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.tap-top { | ||
|  | 		width: 100%; | ||
|  | 		height: 50px; | ||
|  | 		background-color: #ffffff; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.tap-box { | ||
|  | 		width: 50%; | ||
|  | 		text-align: center; | ||
|  | 		color: #666666; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.gang { | ||
|  | 		width: 35px; | ||
|  | 		height: 4px; | ||
|  | 		// background: #0000ff;
 | ||
|  | 		margin: 0 auto; | ||
|  | 		margin-top: 10px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.act { | ||
|  | 		font-weight: bold; | ||
|  | 		color: #000; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.lan { | ||
|  | 		background: #0000ff; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.hong-card { | ||
|  | 		width: 95%; | ||
|  | 		margin: 10px auto; | ||
|  | 		height: 114px; | ||
|  | 		background: linear-gradient(90deg, #EC703B 0%, #EA392A 100%); | ||
|  | 		border-radius: 8px 8px 8px 8px; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 10px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.top-hang { | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		width: 100%; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding-bottom: 5px; | ||
|  | 		border-bottom: 1px dashed #ffffff; | ||
|  | 		color: #ffffff; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.hgang { | ||
|  | 		width: 3px; | ||
|  | 		height: 12px; | ||
|  | 		background: #F8A82F; | ||
|  | 		border-radius: 2px; | ||
|  | 		margin-right: 5px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.title-box { | ||
|  | 		font-size: 18px; | ||
|  | 		font-weight: bold; | ||
|  | 		color: #ffffff; | ||
|  | 		margin: 5px 0px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.red-bottom { | ||
|  | 		width: 100%; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.x-size { | ||
|  | 		font-size: 12px; | ||
|  | 		font-weight: 400; | ||
|  | 		color: rgba(255, 255, 255, 0.6); | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.r-anniu { | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: center; | ||
|  | 		color: #ffffff; | ||
|  | 		width: 74px; | ||
|  | 		height: 30px; | ||
|  | 		background: #F8A82F; | ||
|  | 		font-size: 14px; | ||
|  | 		border-radius: 50px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.x_anniu { | ||
|  | 		position: fixed; | ||
|  | 		bottom: 50px; | ||
|  | 		right: 30px; | ||
|  | 		width: 50px; | ||
|  | 		height: 50px; | ||
|  | 		border-radius: 50%; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: center; | ||
|  | 		background-color: #0000ff; | ||
|  | 	} | ||
|  | 	.box-order { | ||
|  | 		width: 95%; | ||
|  | 		border-radius: 8px; | ||
|  | 		background: #ffffff; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 10px; | ||
|  | 		margin: 10px auto; | ||
|  | 	} | ||
|  | 	 | ||
|  | 	.or-box-top { | ||
|  | 		width: 100%; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 5px 0px; | ||
|  | 		border-bottom: 1px solid #e5e5e5; | ||
|  | 	 | ||
|  | 	} | ||
|  | 	 | ||
|  | 	.chengg { | ||
|  | 		color: #1678ff; | ||
|  | 	} | ||
|  | 	.but-box { | ||
|  | 		width: 100%; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 		font-size: 14px; | ||
|  | 		margin: 5px 0px; | ||
|  | 	} | ||
|  | 	 | ||
|  | 	.reds { | ||
|  | 		color: red; | ||
|  | 	} | ||
|  | 	 | ||
|  | 	.huis { | ||
|  | 		color: #666666; | ||
|  | 	} | ||
|  | 	 | ||
|  | 	.end-box { | ||
|  | 		width: 100%; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: flex-end; | ||
|  | 	} | ||
|  | </style> |