553 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
		
		
			
		
	
	
			553 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
|  | <template> | ||
|  | 	<view class="content"> | ||
|  | 		<view class="container"> | ||
|  | 			<headers :titles="titles" :type="titles" @chiledEvent="clickChild()"> | ||
|  | 				<u-icon name="arrow-left" color="#fff" size="22"> | ||
|  | 				</u-icon> | ||
|  | 			</headers> | ||
|  | 			<!-- 			<view class="my-header"> | ||
|  | 				<view class="my-icons" @click="gobock()"> | ||
|  | 					<slot></slot> | ||
|  | 				</view> | ||
|  | 				<view class="my-text">{{titles}}</view> | ||
|  | 			</view> --> | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 			<view class="tablist"> | ||
|  | 				<view class="tabbox" v-for="(item,index) in tablist" :key="index" @click="getindex(index)"> | ||
|  | 					<view class="">{{item}}</view> | ||
|  | 					<view class="gang" v-if="tabindex == index"></view> | ||
|  | 				</view> | ||
|  | 			</view> | ||
|  | 
 | ||
|  | 			<view class="box_" v-for="item,index in orderList" :key="index"> | ||
|  | 				<view class="b-bx"> | ||
|  | 					<!-- <view class="title_">京博加油站</view> --> | ||
|  | 					<view class="zt-size" v-if="item.orderStatus == 'paid'">已支付</view> | ||
|  | 					<view class="zt-size" v-if="item.orderStatus == 'refund'">已退款</view> | ||
|  | 					<view class="zt-size" v-if="item.orderStatus == 'unpaid'">未支付</view> | ||
|  | 				</view> | ||
|  | 				<view class="centne"> | ||
|  | 					<view class="right-centne"> | ||
|  | 						<view class="h_"> <text class="hao_">订单号:</text> <text>{{item.orderNo}}</text> | ||
|  | 						</view> | ||
|  | 						<view class="h_"><text class="hao_">消费类型:</text>{{item.content}}</view> | ||
|  | 						<template v-if="item.content == '储值卡充值'"> | ||
|  | 						</template> | ||
|  | 						<template v-else> | ||
|  | 							<view class="h_"><text class="hao_">油号:</text>{{item.oilName}}</view> | ||
|  | 							<view class="h_"><text class="hao_">升数:</text>{{item.shengshu}}L</view> | ||
|  | 						</template> | ||
|  | 						<view class="h_"><text class="hao_">下单时间:</text>{{item.payTime}}</view> | ||
|  | 						<view class="b-bx" v-if="!item.content == '储值卡充值'"> | ||
|  | 							<view class=""> <text class="hao_">应付:</text>¥{{item.goodsMoney}}</view> | ||
|  | 							<view class=""><text class="hao_">优惠:</text>¥{{item.discountAmount?item.discountAmount:0}} | ||
|  | 							</view> | ||
|  | 						</view> | ||
|  | 					</view> | ||
|  | 				</view> | ||
|  | 				<view class="end-box"> | ||
|  | 					实付:¥{{item.payMoney}} | ||
|  | 					<u-button v-if="item.orderStatus == 'paid'" | ||
|  | 						style="width: 60px;float: right; margin-left: 5px; height: 21px	;" type="primary" | ||
|  | 						@click="openRef(item)" text="退款"></u-button> | ||
|  | 
 | ||
|  | 				</view> | ||
|  | 
 | ||
|  | 			</view> | ||
|  | 			<view style="width: 100%; height: 20px; "></view> | ||
|  | 			<!-- customStyle="width: 300px;" --> | ||
|  | 			<!-- customStyle="full-screen-popup" --> | ||
|  | 			<u-popup :show="showPop" mode="right" @close="closePop" @open="openPop"> | ||
|  | 				<view class="wrap_test" style="margin-top: 100px;"> | ||
|  | 					<view class="time-bs"> | ||
|  | 						<view class="time-box" @click="showStartTime = true">{{form.startTime?form.startTime:'开始日期'}} | ||
|  | 						</view> | ||
|  | 						<view class="">-</view> | ||
|  | 						<view class="time-box" @click="showEndTime = true">{{form.endTime?form.endTime:'结束日期'}}</view> | ||
|  | 					</view> | ||
|  | 					<view class="time-bs2"> | ||
|  | 						<view class="time-box2" @click="showType = true">{{payType?payType:'选择交易类型'}} | ||
|  | 						</view> | ||
|  | 					</view> | ||
|  | 					<!-- 		<u--input class="time-bs2" placeholder="选择交易类型" border="surround" v-model="form.type" | ||
|  | 						@click="showType = true" disabled></u--input> --> | ||
|  | 					<view style="display: flex;justify-content: space-between;"> | ||
|  | 						<u-button style="width: 100px;" type="primary" text="确定" @click="clickBu"></u-button> | ||
|  | 						<u-button style="width: 100px;" type="warning" text="取消" @click="clickBu2"></u-button> | ||
|  | 					</view> | ||
|  | 
 | ||
|  | 				</view> | ||
|  | 
 | ||
|  | 
 | ||
|  | 			</u-popup> | ||
|  | 
 | ||
|  | 
 | ||
|  | 			<u-modal :show="showModal" showCancelButton content='是否确认退款' @confirm="ref()" | ||
|  | 				@cancel="showModal = false"></u-modal> | ||
|  | 
 | ||
|  | 			<u-datetime-picker :show="showStartTime" v-model="startTimeValue" mode="datetime" @confirm="clickStart" | ||
|  | 				@close="showStartTime = false" @cancel="showStartTime = false"></u-datetime-picker> | ||
|  | 
 | ||
|  | 			<u-datetime-picker :show="showEndTime" v-model="endTimeValue" mode="datetime" @confirm="clickEnd" | ||
|  | 				@close="showEndTime = false" @cancel="showEndTime = false"></u-datetime-picker> | ||
|  | 
 | ||
|  | 			<u-picker :show="showType" :columns="columns" keyName="label" @confirm="clickType" | ||
|  | 				@cancel="showType = false"></u-picker> | ||
|  | 		</view> | ||
|  | 	</view> | ||
|  | </template> | ||
|  | 
 | ||
|  | <script> | ||
|  | 	import config from '@/config' | ||
|  | 	import request from "../../utils/request"; | ||
|  | 	import headers from '../../components/header/headers.vue' | ||
|  | 
 | ||
|  | 	export default { | ||
|  | 		data() { | ||
|  | 			return { | ||
|  | 				orderData: {}, | ||
|  | 				titles: "订单列表", | ||
|  | 				tabindex: 0, | ||
|  | 				showPop: false, | ||
|  | 				showModal: false, | ||
|  | 				tablist: [ | ||
|  | 					"全部", | ||
|  | 					"已完成", | ||
|  | 					"已退款", | ||
|  | 					"支付失败", | ||
|  | 				], | ||
|  | 				orderList: [], | ||
|  | 				baseUrl: config.baseUrl, | ||
|  | 				form: { | ||
|  | 					page: 1, | ||
|  | 					pageSize: 1000, | ||
|  | 					status: '', | ||
|  | 					startTime: '', | ||
|  | 					endTime: '', | ||
|  | 					payType: '' | ||
|  | 				}, | ||
|  | 				showType: false, | ||
|  | 				payType: '', | ||
|  | 				columns: [ | ||
|  | 					[{ | ||
|  | 							label: '无', | ||
|  | 							id: '0' | ||
|  | 						}, | ||
|  | 						{ | ||
|  | 							label: '支付宝', | ||
|  | 							id: 'ALIPAY' | ||
|  | 						}, { | ||
|  | 							label: '微信', | ||
|  | 							id: 'WECHAT' | ||
|  | 						}, { | ||
|  | 							label: '现金', | ||
|  | 							id: 'CASH' | ||
|  | 						} | ||
|  | 					] | ||
|  | 				], | ||
|  | 
 | ||
|  | 				startTime: "", | ||
|  | 				endTime: "", | ||
|  | 				startTimeValue: "", | ||
|  | 				endTimeValue: "", | ||
|  | 				showStartTime: false, | ||
|  | 				showEndTime: false, | ||
|  | 			} | ||
|  | 		}, | ||
|  | 		onShow() { | ||
|  | 			// this.actList = ["1", "1", "1", "1", "1", ]
 | ||
|  | 			// this.status = "nomore" 底部刷新结束
 | ||
|  | 			this.getPageListByPos(); | ||
|  | 		}, | ||
|  | 		onPullDownRefresh() { | ||
|  | 			console.log("刷新"); | ||
|  | 			uni.stopPullDownRefresh() | ||
|  | 		}, | ||
|  | 		onReachBottom() { | ||
|  | 			// this.show = true
 | ||
|  | 			setTimeout(() => { | ||
|  | 				console.log("加载执行"); | ||
|  | 			}, 2000) | ||
|  | 		}, | ||
|  | 		components: { | ||
|  | 			headers | ||
|  | 		}, | ||
|  | 
 | ||
|  | 		methods: { | ||
|  | 			getindex(index) { | ||
|  | 				this.orderList = [] | ||
|  | 				this.tabindex = index | ||
|  | 
 | ||
|  | 				if (index == 0) { | ||
|  | 					this.form.status = '' | ||
|  | 				} else if (index == 1) { | ||
|  | 					this.form.status = 'paid' | ||
|  | 				} else if (index == 2) { | ||
|  | 					this.form.status = 'refund' | ||
|  | 				} else if (index == 3) { | ||
|  | 					this.form.status = 'unpaid' | ||
|  | 				} | ||
|  | 
 | ||
|  | 				this.getPageListByPos() | ||
|  | 
 | ||
|  | 
 | ||
|  | 			}, | ||
|  | 			openRef(data) { | ||
|  | 				this.showModal = true | ||
|  | 				this.orderData = {} | ||
|  | 				this.orderData = data | ||
|  | 			}, | ||
|  | 			ref() { | ||
|  | 				let form = { | ||
|  | 					orderNo: this.orderData.orderNo, | ||
|  | 					storeId: this.orderData.storeId, | ||
|  | 					refundRemark: "pos机退款", | ||
|  | 					type: "canRefund", | ||
|  | 					isOilVouchers: true, | ||
|  | 					isGoods: true, | ||
|  | 					isOil: true, | ||
|  | 					isOilCard: true, // 是否推掉油卡
 | ||
|  | 					isOilFuel: true, //是否推掉储值卡
 | ||
|  | 					refundAmt: this.orderData.oilPayAmount | ||
|  | 				} | ||
|  | 				request({ | ||
|  | 					url: 'business/allOrderInfo/refund', | ||
|  | 					method: 'post', | ||
|  | 					data: form | ||
|  | 				}).then((res) => { | ||
|  | 					if (res.code == 200) { | ||
|  | 						uni.showToast({ | ||
|  | 							title: "退款成功", | ||
|  | 							icon: "none" | ||
|  | 						}) | ||
|  | 					} else { | ||
|  | 						uni.showToast({ | ||
|  | 							title: res.data, | ||
|  | 							icon: "none" | ||
|  | 						}) | ||
|  | 					} | ||
|  | 					this.showModal = false | ||
|  | 					this.getPageListByPos(); | ||
|  | 
 | ||
|  | 				}) | ||
|  | 			}, | ||
|  | 			goback() { | ||
|  | 				uni.navigateBack() | ||
|  | 			}, | ||
|  | 			gobock() { | ||
|  | 				uni.navigateBack() | ||
|  | 			}, | ||
|  | 
 | ||
|  | 			getPageListByPos() { | ||
|  | 				if (this.form.startTime && this.form.endTime) { | ||
|  | 					this.form.params = { | ||
|  | 						beginTime: this.form.startTime, | ||
|  | 						endTime: this.form.endTime | ||
|  | 					} | ||
|  | 				} | ||
|  | 
 | ||
|  | 				request({ | ||
|  | 					url: 'business/allOrderInfo/getPageListByPos', | ||
|  | 					method: 'get', | ||
|  | 					params: this.form | ||
|  | 				}).then((res) => { | ||
|  | 					if (res.code == 200) { | ||
|  | 						this.orderList = res.data.records; | ||
|  | 					} else { | ||
|  | 						uni.showToast({ | ||
|  | 							title: res.data, | ||
|  | 							icon: "none" | ||
|  | 						}) | ||
|  | 					} | ||
|  | 				}) | ||
|  | 			}, | ||
|  | 			clickChild() { | ||
|  | 				this.showPop = true | ||
|  | 			}, | ||
|  | 			clickBu() { | ||
|  | 				this.showPop = false | ||
|  | 				this.getPageListByPos() | ||
|  | 			}, | ||
|  | 			clickBu2() { | ||
|  | 				this.showPop = false | ||
|  | 				this.form = { | ||
|  | 						page: 1, | ||
|  | 						pageSize: 1000, | ||
|  | 						status: '', | ||
|  | 						startTime: '', | ||
|  | 						endTime: '', | ||
|  | 						payType: '' | ||
|  | 					}, | ||
|  | 					this.getPageListByPos() | ||
|  | 
 | ||
|  | 			}, | ||
|  | 			closePop() {}, | ||
|  | 			openPop() {}, | ||
|  | 			clickType(e) { | ||
|  | 
 | ||
|  | 				this.showType = false | ||
|  | 
 | ||
|  | 				let data = e.value[0] | ||
|  | 				if (data.id == 0) { | ||
|  | 					this.payType = '' | ||
|  | 					this.form.payType = '' | ||
|  | 				} else { | ||
|  | 					this.payType = data.label | ||
|  | 					this.form.payType = data.id | ||
|  | 				} | ||
|  | 
 | ||
|  | 				console.log(data) | ||
|  | 			}, | ||
|  | 			// changeType(e) {
 | ||
|  | 			// 	console.log(e)
 | ||
|  | 			// 	this.showType = false
 | ||
|  | 			// },
 | ||
|  | 			clickStartTime(e) { | ||
|  | 				this.showStartTime = true | ||
|  | 				console.log(123, e) | ||
|  | 				// const date = new Date(timestamp);
 | ||
|  | 
 | ||
|  | 			}, | ||
|  | 			clickEndTime(e) { | ||
|  | 				this.showEndTime = true | ||
|  | 
 | ||
|  | 			}, | ||
|  | 			clickStart(e) { | ||
|  | 				this.showStartTime = false | ||
|  | 				this.form.startTime = this.formatDateToYYMMDDHHMM(new Date(e.value)); | ||
|  | 
 | ||
|  | 				this.getIndexData(); | ||
|  | 
 | ||
|  | 			}, | ||
|  | 			clickEnd(e) { | ||
|  | 				this.showEndTime = false | ||
|  | 				this.form.endTime = this.formatDateToYYMMDDHHMM(new Date(e.value)); | ||
|  | 
 | ||
|  | 				this.getIndexData(); | ||
|  | 			}, | ||
|  | 
 | ||
|  | 			formatDateToYYMMDDHHMM(date) { | ||
|  | 				const year = String(date.getFullYear()); // 获取两位数的年份
 | ||
|  | 				const month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份,并确保是两位数
 | ||
|  | 				const day = String(date.getDate()).padStart(2, '0'); // 获取日期,并确保是两位数
 | ||
|  | 				const hours = String(date.getHours()).padStart(2, '0'); // 获取小时,并确保是两位数
 | ||
|  | 				const minutes = String(date.getMinutes()).padStart(2, '0'); // 获取分钟,并确保是两位数
 | ||
|  | 
 | ||
|  | 				// return `${year}/${month}/${day} ${hours}:${minutes}`;
 | ||
|  | 				return `${year}/${month}/${day}`; | ||
|  | 			} | ||
|  | 		} | ||
|  | 	} | ||
|  | </script> | ||
|  | 
 | ||
|  | <style scoped lang="scss"> | ||
|  | 	.content { | ||
|  | 		background: #f8f8f8; | ||
|  | 		// background: linear-gradient(180deg, #B2D2FC 0%, #B2D2FC 14%, rgba(255, 255, 255, 0.84) 24%, rgba(255, 255, 255, 0.84) 100%);
 | ||
|  | 		height: 100vh; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.container { | ||
|  | 		width: 100%; | ||
|  | 		background: #f8f8f8; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding-top: 88px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.img-box { | ||
|  | 		image { | ||
|  | 			width: 100%; | ||
|  | 			height: 100%; | ||
|  | 		} | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.tablist { | ||
|  | 		width: 100%; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 
 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.tabbox { | ||
|  | 		width: 25%; | ||
|  | 		height: 40px; | ||
|  | 		text-align: center; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding-top: 15px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.gang { | ||
|  | 		width: 36px; | ||
|  | 		height: 2px; | ||
|  | 		background: #0864E9; | ||
|  | 		margin: 5px auto; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.box_ { | ||
|  | 		width: 95%; | ||
|  | 		border-radius: 8px; | ||
|  | 		background: #fff; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 15px; | ||
|  | 		margin: 15px auto; | ||
|  | 
 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.b-bx { | ||
|  | 		width: 100%; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 		margin-bottom: 10px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.title_ { | ||
|  | 		font-weight: bold; | ||
|  | 		font-size: 16px; | ||
|  | 		color: #333333; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.zt-size { | ||
|  | 		font-weight: bold; | ||
|  | 		font-size: 16px; | ||
|  | 		color: #FD504E; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.centne { | ||
|  | 		display: flex; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.touxiang { | ||
|  | 		width: 60px; | ||
|  | 		height: 60px; | ||
|  | 		border-radius: 50%; | ||
|  | 		background: #D9D9D9; | ||
|  | 		margin-right: 15px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.right-centne { | ||
|  | 		width: 100%; | ||
|  | 		font-size: 14px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.h_ { | ||
|  | 		width: 100%; | ||
|  | 		margin-bottom: 5px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.end-box { | ||
|  | 		width: 100%; | ||
|  | 		text-align: right; | ||
|  | 		font-weight: bold; | ||
|  | 		font-size: 16px; | ||
|  | 		color: #0864E9; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.time { | ||
|  | 		font-weight: 500; | ||
|  | 		font-size: 14px; | ||
|  | 		color: #333333; | ||
|  | 		margin: 0px auto; | ||
|  | 		margin-top: 15px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.time-bs { | ||
|  | 		width: 100%; | ||
|  | 		box-sizing: border-box; | ||
|  | 		background: #FFFFFF; | ||
|  | 		padding: 15px; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-around; | ||
|  | 
 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.time-bs2 { | ||
|  | 		width: 100%; | ||
|  | 		box-sizing: border-box; | ||
|  | 		background: #FFFFFF; | ||
|  | 		padding: 30px; | ||
|  | 		// display: flex;
 | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-around; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.time-box { | ||
|  | 		border: 1px solid #0864E9; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 5px 15px; | ||
|  | 		border-radius: 8px; | ||
|  | 		font-size: 14px; | ||
|  | 		color: #333; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: center; | ||
|  | 
 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.time-box2 { | ||
|  | 		border: 1px solid #0864E9; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 5px 15px; | ||
|  | 		border-radius: 8px; | ||
|  | 		font-size: 14px; | ||
|  | 		color: #333; | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: center; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.hao_ { | ||
|  | 		width: 30%; | ||
|  | 		font-weight: bold; | ||
|  | 		margin-right: 5px; | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.my-header { | ||
|  | 		width: 100%; | ||
|  | 		height: 88px; | ||
|  | 		// background: linear-gradient(180deg, #B2D2FC 0%, rgba(255, 255, 255, 0.84) 100%);
 | ||
|  | 		display: flex; | ||
|  | 		align-items: center; | ||
|  | 		justify-content: space-between; | ||
|  | 		color: #fff; | ||
|  | 		box-sizing: border-box; | ||
|  | 		padding: 0px 15px; | ||
|  | 		padding-top: 40px; | ||
|  | 		z-index: 99999; | ||
|  | 		background: #0864e9; | ||
|  | 		position: fixed; | ||
|  | 		top: 0px; | ||
|  | 
 | ||
|  | 		.my-icons { | ||
|  | 			width: 50px; | ||
|  | 			height: 50px; | ||
|  | 		} | ||
|  | 
 | ||
|  | 		.my-text { | ||
|  | 			font-weight: bold; | ||
|  | 		} | ||
|  | 
 | ||
|  | 
 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.wrap_test { | ||
|  | 		width: 100vw; | ||
|  | 		height: 100vh; | ||
|  | 
 | ||
|  | 
 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	.full-screen-popup { | ||
|  | 		width: 100%; | ||
|  | 		height: 100%; | ||
|  | 		top: 0; | ||
|  | 		left: 0; | ||
|  | 		margin: 0; | ||
|  | 		padding: 0; | ||
|  | 		box-sizing: border-box; | ||
|  | 	} | ||
|  | </style> |