lhl 2 years ago
parent
commit
3227825817
2 changed files with 109 additions and 71 deletions
  1. 5 0
      api/order.js
  2. 104 71
      pages/goods/order_list/serve.vue

+ 5 - 0
api/order.js

@@ -406,4 +406,9 @@ export function SubscribeCreate(data) {
 
 export function storecompleteSubscribe(data) {
 	return request.post(`store/order/complete_subscribe`, data);
+}
+
+//提交退款申请
+export function SqRefund(data) {
+	return request.post(`v2/Subscribe/refund_order`, data);
 }

+ 104 - 71
pages/goods/order_list/serve.vue

@@ -1,7 +1,7 @@
 <template>
 	<view :style="colorStyle">
 		<view class="my-order">
-			
+
 			<view class="nav acea-row row-around" style="position: fixed;top: 0;">
 				<view class="item" :class="orderStatus === 0 ? 'on' : ''" @click="statusClick(0)">
 					<view>待服务</view>
@@ -15,13 +15,13 @@
 					<view>已完成</view>
 					<!-- <view class="num">{{ orderData.unshipped_count || 0 }}</view> -->
 				</view>
-				<view class="item" :class="orderStatus == 3 ? 'on' : ''" @click="statusClick(3)">
-					<view>退款</view>
+				<view class="item" :class="orderStatus == -1 ? 'on' : ''" @click="statusClick(-1)">
+					<view>退款</view>
 					<!-- <view class="num ">{{ orderData.received_count || 0 }}</view> -->
 				</view>
 			</view>
 			<view class="nav">
-				
+
 			</view>
 			<Loading :loaded="loaded" :loading="loading"></Loading>
 			<view class="list">
@@ -68,7 +68,7 @@
 							<view class="text acea-row row-between">
 								<view class="name line2">{{ items.store_name }}</view>
 								<view class="money">
-									<view >¥{{ items.pay_price }}</view>
+									<view>¥{{ items.pay_price }}</view>
 									<view>x1</view>
 									<!-- <view v-if="items.refund_num && item._status._type != -2" class="return">{{ items.refund_num }}件退款中</view> -->
 								</view>
@@ -81,7 +81,7 @@
 							<view class="">
 								预约时间: {{ showTime(item.reservation_time) }}
 							</view>
-						
+
 						</view>
 						<view class="address acea-row row-between-wrapper" style="padding: 10rpx 30rpx;">
 							<view class="addressCon">
@@ -92,28 +92,29 @@
 									{{item.store.detailed_address || ''}}
 								</view>
 							</view>
-							<view class="icon acea-row row-middle" >
+							<view class="icon acea-row row-middle">
 								<view class="iconfont icon-dianhua" @click.stop="call(item.store.phone)"></view>
 								<view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(item.store)"></view>
 							</view>
 						</view>
-						
+
 						<view class="totalPrice">
 							共{{ item.info.length || 0 }}件商品,总金额
 							<text class="money">¥{{ showTolPrice(item.info) }}</text>
 						</view>
 					</view>
-					<view class="bottom acea-row row-right row-middle" >
+					<view class="bottom acea-row row-right row-middle" v-if="item.status != 2">
 						<!-- <view class="icon acea-row row-middle" style="justify-self: flex-start;">
 							<view class="iconfont icon-dianhua" @click.stop="call(item.store.phone)"></view>
 							<view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(tem.store)"></view>
 						</view> -->
 						<view class="bnt cancelBnt" v-if="item.status == 0 || item.status==1"
-							@click="cancelOrder(index, item.order_id)">取消订单</view>
+							@click="cancelOrder(index, item.id)">取消订单</view>
+						<view class="bnt cancelBnt" v-if="item.status == -1 && (item.refund_status == 1 ||  item.refund_status == 2 || item.refund_status == 3)">退款审核中</view>
 						<!-- <view class="bnt bg-color" v-if="item._status._type == 0"
 							@click="goPay(item.pay_price, item.order_id)">立即付款</view> -->
 						<!-- <view class="bnt bg-color" v-else-if="item._status._type == 3"
-							@click="goOrderDetails(item.order_id)">去评价</view> --> 
+							@click="goOrderDetails(item.order_id)">去评价</view> -->
 						<!-- <view class="bnt bg-color"
 							v-else-if="item.seckill_id < 1 && item.bargain_id < 1 && item.combination_id < 1 && item._status._type == 4"
 							@click="goOrderDetails(item.order_id)">
@@ -148,7 +149,8 @@
 		orderData,
 		orderCancel,
 		orderDel,
-		orderPay
+		orderPay,
+		SqRefund
 	} from '@/api/order.js';
 	import {
 		getUserInfo,
@@ -175,9 +177,10 @@
 			home,
 			emptyPage
 		},
-		mixins:[colors],
+		mixins: [colors],
 		data() {
 			return {
+				itemList: ['不想买了', '信息填错了', '买错商品了', '卖家缺货'],
 				loaded: false,
 				loading: false, //是否加载中
 				loadend: false, //是否加载完毕
@@ -233,18 +236,19 @@
 		 * 生命周期函数--监听页面加载
 		 */
 		onLoad(options) {
-			if (options.status) this.orderStatus = (options.status==undefined && options.status!=0)?'':parseInt(options.status);
+			if (options.status) this.orderStatus = (options.status == undefined && options.status != 0) ? '' : parseInt(
+				options.status);
 		},
 		methods: {
 			showTime(time) {
-				var date =  new Date(time*1000);
+				var date = new Date(time * 1000);
 				var year = date.getFullYear(); // 获取年份
 				var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
 				var day = ("0" + date.getDate()).slice(-2); // 获取日期
 				var hours = ("0" + date.getHours()).slice(-2); // 获取小时
 				var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
 				var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
-				
+
 				var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
 				return dateString
 			},
@@ -282,16 +286,16 @@
 			showTolPrice(list) {
 				let price = 0;
 				list.forEach(item => {
-					price += item.pay_price*1
+					price += item.pay_price * 1
 				})
 				return price.toFixed(2)
 			},
-			getFun(){
+			getFun() {
 				// this.getOrderData();
 				this.getOrderList();
 				this.getUserInfo();
 			},
-			onLoadFun(){
+			onLoadFun() {
 				this.getFun();
 				this.isShowAuth = false;
 			},
@@ -361,35 +365,62 @@
 					return that.$util.Tips({
 						title: '缺少订单号无法取消订单'
 					});
-					uni.showModal({
-						title: '取消订单',
-						content: '您是否确认取消此订单',
-						confirmText: '确认',
-						cancelText: '再想想',
-						success: (res) => {
-							if (res.confirm) {
-								orderCancel(order_id)
-									.then(res => {
-										return that.$util.Tips({
-												title: res.msg,
-												icon: 'success'
-											},
-											function() {
-												that.orderList.splice(index, 1);
-												that.$set(that, 'orderList', that.orderList);
-												that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
-												that.getOrderData();
-											}
-										);
-									})
-									.catch(err => {
-										return that.$util.Tips({
-											title: err
-										});
-									});
-							}
-						}
-					})
+				// uni.showModal({
+				// 	title: '取消订单',
+				// 	content: '您是否确认取消此订单',
+				// 	confirmText: '确认',
+				// 	cancelText: '再想想',
+				// 	success: (res) => {
+				// 		if (res.confirm) {
+				// 			orderCancel(order_id)
+				// 				.then(res => {
+				// 					return that.$util.Tips({
+				// 							title: res.msg,
+				// 							icon: 'success'
+				// 						},
+				// 						function() {
+				// 							that.orderList.splice(index, 1);
+				// 							that.$set(that, 'orderList', that.orderList);
+				// 							that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
+				// 							that.getOrderData();
+				// 						}
+				// 					);
+				// 				})
+				// 				.catch(err => {
+				// 					return that.$util.Tips({
+				// 						title: err
+				// 					});
+				// 				});
+				// 		}
+				// 	}
+				// })
+				uni.showActionSheet({
+					itemList: that.itemList,
+					success(e) {
+						console.log(e)
+						console.log(that.itemList[e.tapIndex])
+						SqRefund({
+								id: order_id
+							}).then(res => {
+								return that.$util.Tips({
+										title: res.msg,
+										icon: 'success'
+									},
+									function() {
+										that.orderList.splice(index, 1);
+										that.$set(that, 'orderList', that.orderList);
+										that.$set(that.orderData, 'unpaid_count', that.orderData
+											.unpaid_count - 1);
+										that.getOrderData();
+									}
+								);
+							}).catch(err => {
+								return that.$util.Tips({
+									title: err
+								});
+							});
+					}
+				})
 			},
 			/**
 			 * 打开支付组件
@@ -458,7 +489,7 @@
 			 * 切换类型
 			 */
 			statusClick: function(status) {
-				if(this.loading) return
+				if (this.loading) return
 				if (status === this.orderStatus) return;
 				this.orderStatus = status;
 				this.loadend = false;
@@ -482,14 +513,14 @@
 					})
 					.then(res => {
 						let list = res.data.list || [];
-						console.log(list,'list')
-						if(that.orderStatus == 0) {
+						console.log(list, 'list')
+						if (that.orderStatus == 0) {
 							that.orderData.order_count = res.data.count;
-						}else if(that.orderStatus == 1) {
+						} else if (that.orderStatus == 1) {
 							that.orderData.unpaid_count = res.data.count;
-						}else if(that.orderStatus == 2) {
+						} else if (that.orderStatus == 2) {
 							that.orderData.unshipped_count = res.data.count;
-						}else if(that.orderStatus == 3) {
+						} else if (that.orderStatus == 3) {
 							that.orderData.received_count = res.data.count;
 						}
 						let loadend = list.length < that.limit;
@@ -512,15 +543,16 @@
 			delOrder: function(order_id, index) {
 				let that = this;
 				uni.showModal({
-				    title: '删除订单',
-				    content: '确定删除该订单',
-				    success: function (res) {
-				        if (res.confirm) {
+					title: '删除订单',
+					content: '确定删除该订单',
+					success: function(res) {
+						if (res.confirm) {
 							orderDel(order_id)
 								.then(res => {
 									that.orderList.splice(index, 1);
 									that.$set(that, 'orderList', that.orderList);
-									that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
+									that.$set(that.orderData, 'unpaid_count', that
+										.orderData.unpaid_count - 1);
 									that.getOrderData();
 									return that.$util.Tips({
 										title: '删除成功',
@@ -532,14 +564,14 @@
 										title: err
 									});
 								});
-				        } else if (res.cancel) {
+						} else if (res.cancel) {
 							return that.$util.Tips({
-										title: '已取消'
-									});
-				        }
-				    }
+								title: '已取消'
+							});
+						}
+					}
 				});
-				
+
 			}
 		},
 		onReachBottom: function() {
@@ -586,7 +618,7 @@
 		width: 750rpx;
 		height: 90rpx;
 		border-radius: 6rpx;
-		margin: 0 auto ;
+		margin: 0 auto;
 	}
 
 	.my-order .nav .item {
@@ -668,8 +700,8 @@
 	.my-order .list .item .item-info .text .money {
 		text-align: right;
 	}
-	
-	.my-order .list .item .item-info .text .money .return{
+
+	.my-order .list .item .item-info .text .money .return {
 		// color: var(--view-priceColor);
 		margin-top: 10rpx;
 		font-size: 24rpx;
@@ -687,7 +719,7 @@
 	.my-order .list .item .totalPrice .money {
 		font-size: 28rpx;
 		font-weight: bold;
-		color:  var(--view-priceColor);
+		color: var(--view-priceColor);
 	}
 
 	.my-order .list .item .bottom {
@@ -733,12 +765,13 @@
 	.line2 {
 		word-break: break-all;
 	}
+
 	.showstore {
 		border-bottom: none !important;
 		text-align: left !important;
 		padding-bottom: 10rpx !important;
 	}
-	
+
 	.icon {
 		.iconfont {
 			width: 44rpx;
@@ -752,4 +785,4 @@
 			margin-left: 26rpx;
 		}
 	}
-</style>
+</style>