ソースを参照

修改退款存在的问题

CarlYang 3 年 前
コミット
5096509235

+ 1 - 1
pages/applyRefund/applyRefund.vue

@@ -75,7 +75,7 @@
 				// 是否有未完成上传的图片标识
 				let isHas = false
 				this.$refs.uUpload.lists.forEach(item => {
-					if (item.progress === 100) {
+					if (item.progress === 100 && item.response) {
 						const url = item?.response?.data?.url
 						if (url) {
 							files.push(url)

+ 5 - 1
pages/applyRefundDetails/applyRefundAchieveDetails.vue

@@ -43,9 +43,13 @@
 					orderId: orderId
 				})
 					.then(res => {
-						console.log(res)
 						if (res.code === 200) {
 							this.details = res.data
+						} else {
+							this.$refs.uToast.show({
+								title: res.msg,
+								type: 'error'
+							})
 						}
 					})
 					.catch(err => {

+ 1 - 0
pages/applyRefundDetails/applyRefundDetails.scss

@@ -4,6 +4,7 @@
 	min-height: calc(100vh - 44px);
 	.refund-details-list {
 		background-color: #fff;
+		padding: 30rpx 0;
 		.refund-details-list-item {
 			display: flex;
 			padding: 0 17px;

+ 12 - 8
pages/applyRefundDetails/applyRefundDetails.vue

@@ -13,25 +13,25 @@
 				<view class="rdli-label">退款原因:</view>
 				<view class="rdli-content">{{details.refundReason}}</view>
 			</view>
-			<view class="refund-details-list-item">
+			<view class="refund-details-list-item" v-if="details.images && details.images.length > 0">
 				<view class="rdli-label">图片:</view>
 				<view class="rdli-content">
-					<view
+					<u-lazy-load
 						class="image"
 						v-for="(item, index) in details.images"
-						:key="index">
-						<image :src="item"></image>
-					</view>
+						:key="index"
+						:image="item"
+						img-mode="aspectFill"></u-lazy-load>
 				</view>
 			</view>
 		</view>
 		<view class="apply-button" v-if="details.refundStatus === 0">
-			<u-button type="primary">申请中</u-button>
+			<u-button type="primary" disabled>申请中</u-button>
 		</view>
 		<view class="refund-details-status" v-if="details.refundStatus === 2">
 			<view class="refund-details-status-item">
 				<view>处理时间:</view>
-				<view>{{details.applyTime}}</view>
+				<view>{{details.auditTime}}</view>
 			</view>
 			<view class="refund-details-status-item">
 				<view>处理结果:</view>
@@ -63,9 +63,13 @@
 					orderId: orderId
 				})
 					.then(res => {
-						console.log(res)
 						if (res.code === 200) {
 							this.details = res.data
+						} else {
+							this.$refs.uToast.show({
+								title: res.msg,
+								type: 'error'
+							})
 						}
 					})
 					.catch(err => {

+ 40 - 4
pages/center/index.vue

@@ -62,8 +62,9 @@
 		</view> -->
 		<view class="u-m-t-20">
 			<u-cell-group>
-				<u-cell-item title="消息中心" @click="openPage('pages/message/message')">
+				<u-cell-item title="消息中心" @click="openPage('pages/message/message', true)">
 					<u-icon slot="icon" custom-prefix="custom-icon" size="35" name="xiaoxi"></u-icon>
+					<u-badge type="success" :count="messageNum" :offset="[35, 60]"></u-badge>
 				</u-cell-item>
 			</u-cell-group>
 		</view>
@@ -112,11 +113,12 @@
 				userInfo: [],
 				code: null,
 				phoneNo: '16608538666',
-				logoutPop: false
+				logoutPop: false,
+				messageNum: 0
 			}
 		},
 		onLoad() {
-			
+			this.getMsgNum()
 		},
 		onShow() {
 			if(this.$store.state.vuex_hasLogin){
@@ -134,10 +136,44 @@
 			};
 		},
 		methods: {
-			openPage(path) {
+			openPage(path, flag) {
 				this.$u.route({ 
 					url: path
 				})
+				if (flag) {
+					uni.setStorage({
+					    key: 'messageBack',
+					    data: 'pages/center/index'
+					})
+				}
+			},
+			// 获取消息未读条数
+			getMsgNum() {
+				this.$u.api.getIndexData()
+				.then(res=>{
+					if (res.code === 200) {
+						let num = 0
+						if (res.data.news) {
+							res.data.news.forEach(item => {
+								if (item.readFlag == 0) {
+									num += 1
+								}
+							})
+						}
+						this.messageNum = num
+					} else {
+						this.$refs.uToast.show({
+							title: res.msg,
+							type: 'error'
+						})
+					}
+				})
+				.catch(err => {
+					this.$refs.uToast.show({
+						title: '系统错误!',
+						type: 'error'
+					})
+				})
 			},
 			//登录判断
 			login(status){

+ 0 - 2
pages/center/monthly/monthly.vue

@@ -68,8 +68,6 @@
 			},
 			// 下拉刷新操作
 			queryList(pageNo, pageSize) {
-				console.log(pageNo)
-				console.log(pageSize)
 				this.$u.api.getMonthList({
 						pageSize: pageSize,
 						pageNum: pageNo,

+ 58 - 42
pages/center/order/order.vue

@@ -14,20 +14,34 @@
 										<view class="car">{{orderItem.vehicleNo}}</view>
 										<view class="addr">{{orderItem.roadName}}</view>
 									</view>
+									<!-- 
+									    显示申请退款按钮满足一下条件:
+										1.允许退款allowRefund等于1 并且
+										2.退款状态auditStatus等于2 已驳回 或者
+										3.退款状态auditStatus不能为空 并且不能等于0
+									-->
 									<view
 										class="order-top-right apply-refund"
-										v-show="current === 3 && orderItem.allowRefund == 1 && (orderItem.refundStatus === 2 || !orderItem.refundStatus && orderItem.refundStatus !== 0)"
+										v-show="orderItem.allowRefund == 1 &&
+										(orderItem.auditStatus == 2 || !orderItem.auditStatus && orderItem.auditStatus != 0)"
 										@click.stop="applyRefund(orderItem)"
 										>申请退款</view>
+									<!--
+									    显示申请状态满足以下条件
+										申请状态存在或者审核状态存在(由于0比较特殊,所以单独拉出来判断)
+									-->
 									<view
 										class="order-top-right apply-refund"
 										@click.stop="applyRefundDetails(orderItem)"
-										v-show="current === 3 && (orderItem.refundStatus || orderItem.refundStatus == 0)">
-										{{orderItem.refundStatus | verifyRefundStatus}}
+										v-if="orderItem.refundStatus ||
+										orderItem.refundStatus == 0 ||
+										orderItem.auditStatus ||
+										orderItem.auditStatus == 0">
+										{{orderItem | verifyRefundStatus}}
 									</view>
 									<view
 										class="order-top-right"
-										v-show="!orderItem.refundStatus && orderItem.refundStatus != 0"
+										v-else
 										:class="{'order-top-right-finished': orderItem.orderStatus == '4'}">
 										{{orderItem.orderStatus | verifyStatusFilter}}
 									</view>
@@ -126,20 +140,20 @@ export default {
 				for(let item of res.data.rows){
 					this.orderList[orderType.index].push(item);
 				}
-				console.log('this.list[orderType.index]',this.list[orderType.index]);
+				// console.log('this.list[orderType.index]',this.list[orderType.index]);
 				this.list[this.current].total = res.data.total;
 				this.list[orderType.index].pageNum++;
 				if(this.orderList[this.current].length>=this.list[this.current].total){
 					this.loadStatus.splice(this.list[orderType.index].index,1,"nomore");
 				};
-				console.log(JSON.parse(JSON.stringify(this.orderList[this.swiperCurrent])));
-				console.log('this.list[this.current]',this.list[this.current]);
+				// console.log(JSON.parse(JSON.stringify(this.orderList[this.swiperCurrent])));
+				// console.log('this.list[this.current]',this.list[this.current]);
 			}).catch(err=>{
 				this.$refs.uToast.show({
 					title: err.msg,
 					type: 'error',
 				});
-				console.log('getOrderList ',err)
+				// console.log('getOrderList ',err)
 			});
 			
 			this.loadStatus.splice(this.current,1,"loadmore")
@@ -158,19 +172,17 @@ export default {
 			this.swiperCurrent = current;
 			this.current = current;
 		},
+		/**
+		 * 跳转详情
+		 * 未发起退款或者未退款成功的
+		 * */
 		goDetails(item){
-			if (item.refundStatus === 1) { // 退款完成
-				this.$u.route('pages/applyRefundDetails/applyRefundAchieveDetails', {
-					orderId: item.orderId
-				})
-			} else {
-				this.$u.route({ // 未发起退款或者未退款成功的
-					url: 'pages/center/order/orderDetails/orderDetails',
-					params: {
-						orderId: item.id
-					}
-				});
-			}
+			this.$u.route({
+				url: 'pages/center/order/orderDetails/orderDetails',
+				params: {
+					orderId: item.id
+				}
+			});
 		},
 		jumpChargeStandard(item) {
 			this.$u.route({
@@ -187,11 +199,21 @@ export default {
 				payAmount: item.actualAmount
 			})
 		},
-		// 申请退款详情
+		/**
+		 * 申请退款详情
+		 * 只要申请退款状态等于1并且审批状态等于1跳转到退款完成详情页
+		 * 否则跳转到退款过程页
+		 * */
 		applyRefundDetails(item) {
-			this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
-				orderId: item.orderId
-			})
+			if (item.refundStatus === 1 && item.auditStatus === 1) {
+				this.$u.route('pages/applyRefundDetails/applyRefundAchieveDetails', {
+					orderId: item.orderId
+				})
+			} else {
+				this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
+					orderId: item.orderId
+				})
+			}
 		}
 	},
 	filters:{
@@ -203,28 +225,22 @@ export default {
 			} else if(value === 2){
 				return '欠费未缴';				
 			} else if(value === 4){
-				return '已完成';				
+				return '已完成';		
 			} else {
 			  return '';
 			}
 		},
-		verifyRefundStatus(value) {
-			switch(value) {
-				case 0:
-					return '申请退款中';
-					break;
-				case 1:
-					return '已通过';
-					break;
-				case 2:
-					return '已驳回';
-					break;
-				case 3:
-					return '退款失败';
-					break;
-				default:
-					return null;
-					break;
+		verifyRefundStatus(item) {
+			if (item.auditStatus === 0) {
+				return '申请退款中';
+			} else if (item.auditStatus === 1) {
+				if (item.refundStatus === 0) {
+					return '退款失败'
+				} else if (item.refundStatus === 1) {
+					return '退款成功'
+				}
+			} else if (item.auditStatus === 2) {
+				return '已驳回'
 			}
 		}
 	}

+ 23 - 3
pages/index/index.vue

@@ -14,7 +14,7 @@
 		
 		<u-city-select v-model="cityOpen" @city-change="cityChange" :areaCode='["52", "5201"]' ></u-city-select>
 		
-		<view class="notice-bar-wrap u-flex" v-if="noticeList.length >= 1" @click="openPage('pages/message/message')">
+		<view class="notice-bar-wrap u-flex" v-if="noticeList.length >= 1" @click="openPage('pages/message/message', true)">
 			<u-icon custom-prefix="custom-icon" size="50" name="xiaoxi" color="#008CFF"></u-icon>
 			<u-notice-bar
 				class="u-flex-1"
@@ -281,18 +281,32 @@
 			},
 			// 切换无感和手动
 			orderNavclick(){
+				uni.showLoading({
+				    title: '加载中'
+				})
 				this.$u.api.feePay({vehicleId: this.recordList[1]})
 					.then( res=>{
 						if(res.code == 200){
 							this.handleGetIndexData()
 						}
+						uni.hideLoading()
 					})
 			},
-			// 宫格菜单跳转
-			openPage(path) {
+			/**
+			 * 跳转页面
+			 * path 跳转路径
+			 * flag 是否存储
+			 * */
+			openPage(path, flag) {
 				this.$u.route({ 
 					url: path
 				})
+				if (flag) {
+					uni.setStorage({
+					    key: 'messageBack',
+					    data: 'pages/index/index'
+					})
+				}
 			},
 			// 搜索
 			handleSearch(){
@@ -316,6 +330,9 @@
 			},
 			// 获取首页数据
 			handleGetIndexData(){
+				uni.showLoading({
+				    title: '加载中'
+				})
 				this.$u.api.getIndexData()
 				.then(res=>{
 					if (res.code === 200) {
@@ -365,17 +382,20 @@
 							newsList.push(item.content)
 						})
 						this.noticeList = newsList;
+						uni.hideLoading()
 					} else {
 						this.$refs.uToast.show({
 							title: res.msg,
 							type: 'error'
 						})
+						uni.hideLoading()
 					}
 				}).catch(err=>{
 					this.$refs.uToast.show({
 						title: '系统异常',
 						type: 'error'
 					})
+					uni.hideLoading()
 				});
 			},
 			// 去支付,选择支付方式

+ 9 - 1
pages/message/message.vue

@@ -53,7 +53,15 @@
 		methods: {
 			// 返回上一页
 			customBack() {
-				uni.navigateBack()
+				uni.getStorage({
+				    key: 'messageBack',
+				    success: (res) => {
+						this.$u.route({
+							type: 'switchTab',
+							url: res.data
+						})
+				    }
+				})
 			},
 			/*下拉刷新的回调*/
 			downCallback() {

+ 23 - 19
pages/message/messageInfo.vue

@@ -1,9 +1,10 @@
 <template>
 	<view class="info">
 		<u-navbar
-			title-color="#fff" 
-			:custom-back="customBack" 
-			:border-bottom="false" back-icon-color="#CCE8FF" 
+			title-color="#fff"
+			:custom-back="customBack"
+			:border-bottom="false"
+			back-icon-color="#CCE8FF"
 			:background="{background: '#008CFF' }"
 			title="消息详情"></u-navbar>
 		<view class="time">{{details.createTime}}</view>
@@ -26,46 +27,49 @@
 			if (details) {
 				this.details = details
 			}
-			
 		},
 		methods: {
-			customBack(){
+			customBack() {
 				this.$u.route({
 					url: 'pages/message/message'
 				});
 			}
 		}
-		
+
 	}
 </script>
 
 <style>
-/* #ifndef H5 */
-page {
-	height: 100%;
-	background-color: #F6F6FF;
-}
-/* #endif */
+	/* #ifndef H5 */
+	page {
+		height: 100%;
+		background-color: #F6F6FF;
+	}
+
+	/* #endif */
 </style>
 
 <style lang="scss" scoped>
-	.info{
+	.info {
 		padding: 40rpx 40rpx;
-		
+
 	}
-	.box{
+
+	.box {
 		margin-top: 20rpx;
 		background-color: white;
 		border-radius: 15rpx;
-		.title{
+
+		.title {
 			padding-top: 20rpx;
 			text-align: center;
 			font-size: 40rpx;
 		}
 	}
-	.content{
-		text-indent:2em;
+
+	.content {
+		text-indent: 2em;
 		padding: 20rpx 40rpx;
 		line-height: 44rpx;
 	}
-</style>
+</style>