lhl 2 سال پیش
والد
کامیت
ba01370dc9
1فایلهای تغییر یافته به همراه142 افزوده شده و 66 حذف شده
  1. 142 66
      src/views/order/orderList.vue

+ 142 - 66
src/views/order/orderList.vue

@@ -12,17 +12,14 @@
 			<!-- 搜索区域 -->
 			<el-row>
 				<el-col>
-					 
+
 					<div class="flex" style="justify-content: flex-end;padding-bottom: 20px;">
 						<!-- <el-button style="margin-right: 20px;">物流费用:{{expenses || '0'}}</el-button> -->
 						<el-button style="margin-right: 20px;">退单申请数量:{{refund_count || '0'}}</el-button>
 						<el-select v-model="queryInfo.status" placeholder="请选择订单状态">
-						   <el-option
-						     v-for="item in options"
-						     :label="item.label"
-						     :value="item.value">
-						   </el-option>
-						 </el-select>
+							<el-option v-for="item in options" :label="item.label" :value="item.value">
+							</el-option>
+						</el-select>
 						<div class="redr" style="margin-left: 20px;">
 							<el-button>重新导入</el-button>
 							<input type="file" ref="fileInputt" @change="readTxtFile('fileInputt')" class="dr-int" />
@@ -102,17 +99,20 @@
 							<div class="flex">
 								<!-- <el-button v-if="scope.row.status > 2"
 									@click="getExpressDelivery(scope.row)">查看物流</el-button> -->
-									<el-button v-if="scope.row.status == 1">待签收</el-button>
-									<el-button v-if="scope.row.status == 2" @click="batchOrder(scope.row)">待签收</el-button>
-									<el-button v-if="scope.row.status == 3">已签收</el-button>
-									<el-button v-if="scope.row.status == 5" >理赔中</el-button>
-									<el-button v-if="scope.row.status == 6" >结算中</el-button>
-									<el-button v-if="scope.row.status == 7" >已完成</el-button>
-									<el-button v-if="showBtn(scope.row.confirm_time_check) && scope.row.status == 3"
-										@click="handleOrder('您确定立即申请退货?',scope.row)" type="primary">申请退货</el-button>
-									<el-button v-if="scope.row.status ==4 && scope.row.refund_status == 0" type="danger">等待商家审核</el-button>
-									
-								
+								<el-button v-if="scope.row.status == 1">待签收</el-button>
+								<el-button v-if="scope.row.status == 2" @click="batchOrder(scope.row)"
+									type="primary">待签收</el-button>
+								<el-button v-if="scope.row.status == 3">已签收</el-button>
+								<el-button v-if="scope.row.status == 5">理赔中</el-button>
+								<el-button v-if="scope.row.status == 6">结算中</el-button>
+								<el-button v-if="scope.row.status == 7">已完成</el-button>
+								<el-button v-if="showBtn(scope.row.confirm_time_check) && scope.row.status == 3"
+									@click="handleOrder('您确定立即申请退货?',scope.row)" type="primary">申请退货</el-button>
+								<el-button v-if="scope.row.status ==4 && scope.row.auth_status == 0">等待商家审核</el-button>
+								<el-button
+									v-if="scope.row.status ==4 && scope.row.auth_status == 1 && scope.row.refund_status == 0">运输中</el-button>
+								<el-button
+									v-if="scope.row.status ==4 && scope.row.auth_status == 1 && scope.row.refund_status == 1">已退款</el-button>
 							</div>
 
 
@@ -186,37 +186,40 @@
 		name: 'Order',
 		data() {
 			return {
+				currentIndex: 0,
+				order: {},
 				refund_count: 0,
 				expenses: 0,
-				auth:false,
+				auth: false,
 				options: [{
-				          value: -1,
-				          label: '全部'
-				        }, {
-				          value: 1,
-				          label: '待发货',
-				        }, {
-				          value: 2,
-				          label: '已发货'
-				        }, {
-				          value: 3,
-				          label: '已收货'
-				        }, {
-				          value: 4,
-				          label: '退款中'
-				        }, {
-				          value: 5,
-				          label: '理赔中'
-				        },
-						{
-						  value: 6,
-						  label: '结算中'
-						},
-						{
-						  value: 7,
-						  label: '已完成'
-						}],
-				today: new Date(new Date().setHours(0,0,0,0)-0*24*60*60*1000).getTime(),
+						value: -1,
+						label: '全部'
+					}, {
+						value: 1,
+						label: '待发货',
+					}, {
+						value: 2,
+						label: '已发货'
+					}, {
+						value: 3,
+						label: '已收货'
+					}, {
+						value: 4,
+						label: '退款中'
+					}, {
+						value: 5,
+						label: '理赔中'
+					},
+					{
+						value: 6,
+						label: '结算中'
+					},
+					{
+						value: 7,
+						label: '已完成'
+					}
+				],
+				today: new Date(new Date().setHours(0, 0, 0, 0) - 0 * 24 * 60 * 60 * 1000).getTime(),
 				newTime: new Date().getTime(),
 				yjloading: false,
 				logProgInfo: [],
@@ -242,7 +245,7 @@
 			}
 		},
 		watch: {
-			showStatus(n,o){
+			showStatus(n, o) {
 				// console.log(n);
 				this.getList('reload')
 			}
@@ -251,7 +254,7 @@
 			this.getUserInfo()
 		},
 		computed: {
-			...mapState(['orderToken','userInfo']),
+			...mapState(['orderToken', 'userInfo']),
 			showStatus() {
 				return this.queryInfo.status
 			}
@@ -263,6 +266,7 @@
 				this.queryInfo.token = this.orderToken.join(',')
 				this.getList()
 			}
+
 		},
 		filters: {
 			showname(val) {
@@ -270,7 +274,7 @@
 			},
 			showPhone(val) {
 				let str = val + ''
-				let arr =str.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
+				let arr = str.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
 				return arr
 			},
 			showStatus(val) {
@@ -309,7 +313,7 @@
 			}
 		},
 		methods: {
-			...mapMutations(['setOrderToken','setUserInfo']),
+			...mapMutations(['setOrderToken', 'setUserInfo']),
 			getUserInfo() {
 				getUserInfo().then(res => {
 					this.setUserInfo(res.data)
@@ -373,6 +377,11 @@
 								// console.log(res);
 								item.loading = false
 								item.tag = res.msg
+								if(item.status == 3 && res.data.status == 4) {
+									item.auth_status = 0
+								}
+								item.status = res.data.status
+								console.log(item.status,'ddddddddddd');
 								this.$msg.success('已提交,请等待审核处理')
 								this.loading = false
 							}).catch(err => {
@@ -387,27 +396,66 @@
 
 			},
 			batchOrder(item) {
+				let that = this
 				item.loading = true
 				batchOrder({
 					id: item.id
 				}).then(res => {
 					// this.$msg.success(res.msg)
 					item.tag = res.msg
+					item.lasttime = (that.today / 1000).toFixed(0)
+					// if(res.msg == '')
+					if(item.status == 3 && res.data.status == 4) {
+						item.auth_status = 0
+					}
+					item.status = res.data.status
+					console.log(item.status,'ddddddddddd');
 					item.loading = false
 					item.loaded = true
 					// this.getList()
 				})
 			},
-			goyj(arr,i = 0) {
+			goyj(arr, i = 0) {
 				this.auth = true
-				try{
-				this.oneWork(arr, i)	
-				}catch(e){
-					//TODO handle the exception
+				try {
+					this.oneWork(arr, i)
+				} catch (e) {
 					this.auth = false
 				}
-				
-				
+
+			},
+			chooseNest() {
+				let that = this;
+				that.order = that.list.find((item, index) => {
+					if (item.status < 5 && item.lasttime * 1000 < that.today) {
+						// if (item.status < 5 ) {
+						that.currentIndex = index
+						return item
+					} else {
+						++that.num
+					}
+				})
+				return that.order
+				// if (that.list.length == 0) {
+				// 	return that.$msg.error('当前没有订单需要处理')
+				// } else {
+
+				that.order = that.list.find((item, index) => {
+					if (item.status < 5 && item.lasttime * 1000 < that.today) {
+						// if (item.status < 5 ) {
+						that.currentIndex = index
+						return item
+					} else {
+						++that.num
+					}
+				})
+				// 	console.log(that.num,'that.num');
+				// 	if (!that.order) {
+				// 		that.$msg.error('当前页面订单处理完成,请勿重复处理')
+				// 	} else {
+
+				// 	}
+				// }
 			},
 			oneWork(arr, i = 0) {
 				// batchOrder({
@@ -416,17 +464,27 @@
 				// 	this.$msg.success(res.msg)
 				// 	this.getList()
 				// })
-				console.log('ddd');
+				// console.log('ddd');
 				let that = this
-				if(!this.auth) {
+				if (!this.auth) {
 					return
 				}
+				that.order = that.list.find((item, index) => {
+					if (item.status < 5 && item.lasttime * 1000 < that.today) {
+						// if (item.status < 5 ) {
+						that.currentIndex = index
+						return item
+					}
+				})
+				if (!that.order) {
+					return that.$msg.error('当前页面订单已处理完成,请勿重复处理')
+					
+				}
 				that.yjloading = true
 				if (i < arr.length) {
-					if(arr[i].lasttime*1000 > this.today) {
-						++this.num
-					}
-					if (arr[i].status < 5 && arr[i].lasttime*1000 < this.today) {
+
+					if (arr[i].status < 5 && arr[i].lasttime * 1000 < this.today) {
+						// if (arr[i].status < 5 ) {
 						if (arr[i].loaded) {
 							that.oneWork(arr, ++i)
 						} else {
@@ -440,7 +498,13 @@
 									arr[i].tag = res.msg
 									arr[i].loading = false
 									arr[i].loaded = true
+									if(arr[i].auth_status == 3 && res.data.status == 4) {
+										arr[i].auth_status = 0
+									}
+									arr[i].status = res.data.status
+									
 									that.yjloading = false
+									
 									that.oneWork(arr, ++i)
 								}).catch(err => {
 									console.log(i);
@@ -450,16 +514,20 @@
 							}, 2000)
 						}
 					} else {
+						++this.num
+						console.log('daozhe');
 						that.oneWork(arr, ++i)
 					}
 				} else {
 					that.yjloading = false
 					this.auth = false
 					console.log(that.num);
-					if(that.num != that.list.length) {
+					if (that.num != that.list.length) {
 						that.num = 0
+						// console.log('yjcl');
+
 						this.getList('yjcl')
-					}else {
+					} else {
 						that.$msg.success('一键处理完成')
 					}
 				}
@@ -494,6 +562,7 @@
 			},
 			getList(type) {
 				let that = this
+				that.list = []
 				if (that.dataloading) {
 					return
 				}
@@ -502,6 +571,7 @@
 				}
 				that.dataloading = true
 				getOrderList(that.queryInfo).then(res => {
+
 					that.total = res.data.count
 					that.expenses = res.data.expenses
 					that.refund_count = res.data.refund_count
@@ -510,11 +580,14 @@
 						item.loaded = false
 						return item
 					})
+					// that.list = res.data.data
+					// that.chooseNest()
 					that.dataloading = false
 					if (type == 'yjcl') {
 						// that.oneWork(this.list)
 						that.goyj(this.list)
 					}
+
 				}).catch(err => {
 					that.dataloading = false
 				})
@@ -522,10 +595,12 @@
 			handleSizeChange(newPageSize) {
 				this.queryInfo.limit = newPageSize
 				this.queryInfo.page = 1
+				this.list = []
 				this.getList()
 			},
 			handleCurrentChange(newPageNum) {
 				this.queryInfo.page = newPageNum
+				this.list = []
 				this.getList()
 			},
 			qrsh() {
@@ -601,11 +676,12 @@
 		left: 0;
 		width: 100%;
 		height: 100%;
+		z-index: 999;
 		display: flex;
 		flex-direction: column;
 		align-items: center;
 		justify-content: center;
-		
+
 		.mask-loading {
 			font-size: 100px;
 			color: #409eff;