lhl 2 years ago
parent
commit
ad3a8d0718

+ 9 - 9
src/assets/js/admun.js

@@ -13,15 +13,15 @@ let imgs = [
 	img5,
 ]
 let munList = [
-	// {
-	// 	id: 20,
-	// 	authName: '首页',
-	// 	children: [{
-	// 		id: 21,
-	// 		authName: '统计',
-	// 		path: 'home/statistics'
-	// 	}, ]
-	// }, 
+	{
+		id: 20,
+		authName: '首页',
+		children: [{
+			id: 21,
+			authName: '统计',
+			path: 'home/statistics'
+		}, ]
+	}, 
 	{
 		id: 1,
 		authName: 'Token管理',

+ 18 - 0
src/request/agent.js

@@ -10,6 +10,16 @@ export function getIndex(data) {
 	});
 }
 
+//获取快递信息、
+export function getExpressDelivery(data) {
+	//index/getExpressDelivery
+	return request({
+		url: '/api/index/getExpressDelivery',
+		method: 'get',
+		params:data
+	});
+}
+
 // 获取验证码列表
 export function getRegList(data) {
 	return request({
@@ -88,4 +98,12 @@ export function getUserInfo(data) {
 		method: 'get',
 		params:data
 	});
+}
+
+export function dataCount(data) {
+	return request({
+		url: '/api/agent/data_count',
+		method: 'get',
+		params:data
+	});
 }

+ 17 - 0
src/request/user.js

@@ -116,3 +116,20 @@ export function getOrderList(data) {
 		params:data
 	});
 }
+
+
+export function batchOrder(data) {
+	return request({
+		url: '/api/user/batch_order',
+		method: 'post',
+		data
+	});
+}
+
+export function dataCount(data) {
+	return request({
+		url: '/api/user/data_count',
+		method: 'get',
+		params:data
+	});
+}

+ 9 - 1
src/router.js

@@ -35,7 +35,7 @@ let router = new Router({
 			path: '/home',
 			name: 'home',
 			component: () => import('./views/Home.vue'),
-			redirect: '/home/regList',
+			redirect: '/home/statistics',
 			meta: {
 				title: ''
 			},
@@ -151,6 +151,14 @@ let router = new Router({
 						title: '统计'
 					}
 				},
+				{
+					path: 'dlstatistics',
+					name: 'dlstatistics',
+					component: () => import('./views/home/dlstatistics.vue'),
+					meta: {
+						title: '统计'
+					}
+				},
 				{
 					path: 'setPas',
 					name: 'setPas',

+ 1 - 1
src/store.js

@@ -5,7 +5,7 @@ Vue.use(Vuex)
 
 export default new Vuex.Store({
   state: {
-	www: "http://fh.frp.liuniu946.com",
+	www: (window.location.protocol + '//' + window.location.host).indexOf('http://localhost') != -1 ?'http://www.pingguozhushou.shop':(window.location.protocol + '//' + window.location.host),
 	hasLogin:false,
 	userInfo: {},
 	baseInfo: {},//基础信息

+ 3 - 1
src/views/Home.vue

@@ -105,7 +105,9 @@
 		},
 		methods: {
 			kf() {
-				window.open(this.baseInfo.service_kf)
+				if(this.baseInfo.service_kf) {
+					window.open(this.baseInfo.service_kf)
+				}
 			},
 			logout() {
 				window.sessionStorage.clear()

+ 51 - 34
src/views/Login.vue

@@ -21,6 +21,7 @@
 					</el-form-item>
 					<!--按钮-->
 					<el-form-item class="btns">
+						<span class="go-new hand" @click="currentIndex = 1">没有账号?立即注册</span>
 						<el-button type="primary" @click="login">登录</el-button>
 						<!-- <el-button type="info" @click="resetLoginForm">重置</el-button> -->
 					</el-form-item>
@@ -31,10 +32,10 @@
 						<el-input placeholder="请输入用户名" prefix-icon="el-icon-s-custom"
 							v-model="loginForm.username" type="text"></el-input>
 					</el-form-item>
-					<el-form-item prop="email">
+					<!-- <el-form-item prop="email">
 						<el-input placeholder="请输入邮箱" prefix-icon="el-icon-message"
 							v-model="loginForm.email" type="email"></el-input>
-					</el-form-item>
+					</el-form-item> -->
 					<!-- 邀请码 -->
 					<el-form-item prop="email">
 						<el-input placeholder="请输入邀请码" prefix-icon="el-icon-user"
@@ -91,6 +92,10 @@
 				}
 			}
 		},
+		created() {
+			let a = Date.now();
+			this.loginForm.email = a + '@gmail.com'
+		},
 		methods: {
 			...mapMutations(['setUserInfo']),
 			resetLoginForm() {
@@ -104,9 +109,9 @@
 				if(that.loginForm.email == '') {
 					return that.$msg.error('请输入邮箱')
 				}
-				if(!validateEmail(that.loginForm.email)) {
-					return that.$msg.error('请输入正确的邮箱')
-				}
+				// if(!validateEmail(that.loginForm.email)) {
+				// 	return that.$msg.error('请输入正确的邮箱')
+				// }
 				if (that.loginForm.code == '') {
 					return that.$msg.error('请输入邀请码')
 				}
@@ -161,19 +166,20 @@
 	};
 </script>
 
-<style Lang='scss' scoped>
+<style lang='scss' scoped>
+/* 	body {
+	} */
 	.login-wrapper {
+		/* background-color: ; */
 		position: absolute;
 		width: 100%;
 		height: 100%;
-		background-image: url(../assets/img/basebg.png);
+		background-image: url(../assets/img/basebg.png) ;
+		background-size:100% 100%;
 	}
 
 	.login-box {
 		width: 450px;
-		/* height: 250px; */
-		/* background-color: #fff; */
-		padding-top: 50px;
 		border-radius: 3px;
 		display: flex;
 		flex-direction: column;
@@ -205,13 +211,15 @@
 	}
 
 	.login-form-box {
-		width: 410px;
+		width: 450px;
 		/* height: 200px; */
-		padding: 20px;
 		justify-self: end;
 		transform: translate(0, -10%);
 		background-color: #fff;
 		border-radius: 20px;
+		.login-form {
+			padding: 20px ;
+		}
 	}
 
 	.btns {
@@ -222,29 +230,38 @@
 		justify-content: center;
 		font-size: 16px;
 		color: #444;
-		margin-bottom: 20px;
-		.nav-item {
-			padding: 10px 0;
-			margin-right:24px;
-			position: relative;
+		
+		border-radius: 20px 20px 0 0;
+		overflow: hidden;
+		
+	}
+	.nav-item {
+		width: 50%;
+		position: relative;
+		text-align: center;
+		line-height: 50px;
+		/* width: 64px;
+		height: ; */
+	}
+	.action {
+		font-weight: bold;
+		color: black;
+		background-color: #056de8;
+		color: #fff;
+		&::after {
+			content: '';
+			position: absolute;
+			width: 100%;
+			height: 3px;
 			
-			/* width: 64px;
-			height: ; */
-		}
-		.action {
-			font-weight: bold;
-			color: black;
-			&::after {
-				content: '';
-				position: absolute;
-				width: 100%;
-				height: 3px;
-				background-color: #056de8;
-				bottom: 0px;
-				left: 0;
-				right: 0;
-				margin: auto;
-			}
+			bottom: 0px;
+			left: 0;
+			right: 0;
+			margin: auto;
 		}
 	}
+	.go-new {
+		padding-right: 20px;
+		color:  #056de8;
+	}
 </style>

+ 0 - 1
src/views/home/addOrder.vue

@@ -40,7 +40,6 @@
 							<el-form-item label="联系方式" :label-width="formLabelWidth">
 								<div class="flex"><el-input v-model="xdForm.phone" type="number" :disabled="loading || auto_order"></el-input><el-button
 										style="margin-left: 10px;" @click="sjPhone">随机</el-button></div>
-
 							</el-form-item>
 							<el-form-item label="收货地址" :label-width="formLabelWidth">
 								<div class="flex"><el-input v-model="xdForm.address" type="text" :disabled="loading || auto_order"></el-input><el-button

+ 422 - 0
src/views/home/dlstatistics.vue

@@ -0,0 +1,422 @@
+<template>
+	<div class="order-wrapper">
+		<!-- <breadcrumb :item-name="['订单管理', '订单列表']"></breadcrumb> -->
+		<el-card>
+			<div class="tj flex">
+				<div class="tj-item">
+					<div class="tit">代理订单</div>
+					<div class="val">{{tj.agent_order||0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">异常代理订单</div>
+					<div class="val">{{tj.agent_order_error|| 0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">未使用注册码</div>
+					<div class="val">{{tj.code_0|| 0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">已使用注册码</div>
+					<div class="val">{{tj.code_1||0}}</div>
+				</div>
+			</div>
+
+		</el-card>
+
+	</div>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+
+	import {
+		createCode,
+		getUserList,
+		getIndex,
+		dataCount
+	} from '@/request/agent.js'
+	import {
+		getRechangeList,
+		rechange,
+		getTokenList,
+		createOrder,
+		getUserInfo,
+		payAuto,
+
+	} from '@/request/user.js'
+	import {
+		showTime,
+		sj
+	} from '@/assets/js/tools.js'
+	import {
+		imgs
+	} from '@/assets/js/admun.js'
+	import {
+		set
+	} from 'core-js/library/core/dict';
+	export default {
+		components: {
+			// SlideVerify
+		},
+		name: 'Order',
+		data() {
+			return {
+				showStop: false,
+				dialogVisible: false,
+				xdForm: {
+					phone: '',
+					address: '',
+					minPrice: '',
+					maxPrice: ''
+				},
+				imgs: imgs,
+				msg: '888',
+				loading: false,
+				formLabelWidth: '100px',
+				form: {
+					recharge_num: '',
+					image: ''
+				},
+				dialogTableVisible: false,
+				xiadanDia: false, //下单弹窗
+				queryInfo: {
+					keyword: '',
+					page: 1,
+					limit: 10
+				},
+				list: [],
+				total: 0,
+				dataloading: false,
+				headers: {},
+				tokenList: [],
+				token: {},
+				ybToken: {},
+				minPriceList: [],
+				maxPriceList: [],
+				tipList: [],
+				auto_order: false, //是否启动自动下单
+				tj: {}
+			}
+		},
+		computed: {
+			...mapState(['baseInfo', 'userInfo'])
+		},
+		created() {
+			// this.getUserInfo()
+			// this.getIndex()
+			// this.getList()
+			// this.getTokenList()
+			this.dataCount()
+			this.headers['token'] = window.sessionStorage.getItem('token')
+			// console.log(this.imgs, 'imgs');
+		},
+		methods: {
+			...mapMutations(['setBaseInfo', 'setUserInfo', 'jUserMoney']),
+			dataCount() {
+				dataCount().then(res => {
+					console.log(res);
+					this.tj = res.data
+				})
+			},
+			stopAuto() {
+				this.auto_order = false
+				this.showStop = false
+			},
+			getUserInfo() {
+				getUserInfo().then(res => {
+					this.setUserInfo(res.data)
+				})
+			},
+			pd(arr, i = 0) {
+				let that = this
+				let len = arr.length - 1
+				if (i <= len) {
+					if (i == 0) {
+						that.tipList.unshift(arr[i])
+						that.pd(arr, ++i)
+					} else {
+						setTimeout(() => {
+							that.tipList.unshift(arr[i])
+							if (arr[i].title.indexOf('支付金额:') != -1) {
+								// let price = zfInfo.title.replace(/支付金额:/,'')*1
+								that.jUserMoney(-1 * arr[i].title.replace(/支付金额:/, ''))
+							}
+							that.pd(arr, ++i)
+						}, arr[i - 1].time * 1000)
+					}
+				} else {
+					that.xdForm.phone = ''
+					that.xdForm.address = ''
+					that.loading = false
+					if (that.auto_order) {
+						that.chooseNext()
+					} else {
+						that.xdForm.minPrice = ''
+						that.xdForm.maxPrice = ''
+					}
+				}
+			},
+			ktAuto() {
+				let that = this
+				if (that.userInfo.money * 1 < that.baseInfo.auto_order * 1) {
+					return that.$msg.error('您当前余额不足')
+				}
+				payAuto().then(res => {
+					that.getUserInfo()
+					that.dialogVisible = false
+					that.auto_order = true
+					that.chooseNext()
+					//自动下单启动
+				})
+			},
+			openZd() {
+				let that = this
+				if (that.loading) {
+					return that.$msg.error('当前处于下单状态,请等待下单完成')
+				}
+				if (that.userInfo.auto_order == 0) {
+					that.dialogVisible = true
+				} else {
+					//自动下单启动
+					if (that.xdForm.minPrice == '') {
+						return that.$msg.error('请选择最低价格')
+					}
+					if (that.xdForm.maxPrice == '') {
+						return that.$msg.error('请选择最高价格')
+					}
+					that.auto_order = true
+					that.chooseNext()
+
+
+				}
+			},
+			//选择下一个可用token
+			chooseNext() {
+				let that = this
+				that.token = that.tokenList.find(item => item.bl == false)
+				if (that.auto_order) {
+					if (that.token) {
+						if (that.xdForm.minPrice == '') {
+							return that.$msg.error('请选择最低价格')
+						}
+						if (that.xdForm.maxPrice == '') {
+							return that.$msg.error('请选择最高价格')
+						}
+						that.sjAddress()
+						that.sjPhone()
+						// that.$msg.success('开启自动下单,请勿进行操作')
+						// 启动
+						that.createOrder()
+					} else {
+						//停止
+						that.auto_order = false
+					}
+
+				}
+			},
+			createOrder() {
+				let that = this
+				if (that.loading) {
+					return
+				}
+				if (that.token.bl) {
+					if (that.auto_order) {
+
+					} else {
+						return this.$msg.error('该TOKEN,当天使用次数已满!')
+					}
+				}
+				if (that.xdForm.minPrice == '') {
+					return that.$msg.error('请选择最低价格')
+				}
+				if (that.xdForm.maxPrice == '') {
+					return that.$msg.error('请选择最高价格')
+				}
+				if (that.xdForm.minPrice * 1 > that.xdForm.maxPrice * 1) {
+					return that.$msg.error('最高价格需大于最低价格')
+				}
+				if (that.xdForm.phone == '') {
+					return that.$msg.error('请输入手机号码')
+				}
+				if (!/(^1[2|3|4|5|6|7|8|9][0-9]{9}$)/.test(that.xdForm.phone)) {
+					return that.$msg.error('请输入正确的手机号码')
+				}
+				if (that.xdForm.address == '') {
+					return that.$msg.error('请输入收货地址')
+				}
+				that.loading = true
+				createOrder({
+					min_price: that.xdForm.minPrice,
+					max_price: that.xdForm.maxPrice,
+					address: that.xdForm.address,
+					phone: that.xdForm.phone,
+					token: that.token.token
+				}).then(res => {
+
+					//更新token
+					that.token.count++
+					if (that.token.count == 2) {
+						that.token.bl = true
+					}
+					// 加载tip
+
+					that.pd(res.data, 0)
+
+				}).catch(err => {
+					console.log(err);
+					that.loading = false
+				})
+			},
+			getIndex() {
+				getIndex().then(res => {
+					this.setBaseInfo(res.data)
+					let arr = [],
+						arr2 = []
+					res.data.price_min.forEach(item => {
+						let a = {
+							value: item * 1,
+							label: item
+						}
+						arr.push(a)
+					})
+					res.data.price_max.forEach(item => {
+						let a = {
+							value: item * 1,
+							label: item
+						}
+						arr2.push(a)
+					})
+					this.minPriceList = arr
+					this.maxPriceList = arr2
+				})
+			},
+			showTime,
+			sjPhone() {
+				if (this.loading) {
+					return
+				}
+				this.xdForm.phone = sj(this.baseInfo.sys_phone)
+			},
+			sjAddress() {
+				if (this.loading) {
+					return
+				}
+				this.xdForm.address = sj(this.baseInfo.system_address)
+			},
+			closeXd() {
+				this.xiadanDia = false
+				this.xdForm.phone = ''
+				this.xdForm.address = ''
+			},
+			onSuccess() {
+				console.log('success');
+				this.token = this.ybToken
+				this.xdForm.minPrice = ''
+				this.xdForm.maxPrice = ''
+				this.dialogTableVisible = false
+			},
+			onFail() {
+				console.log('fail');
+			},
+			onRefresh() {
+				console.log('refresh');
+			},
+			getTokenList() {
+				getTokenList().then(res => {
+					this.tokenList = res.data.map(item => {
+						item.count = item.count * 1
+						return item
+					})
+					// 获取第一次选择的token
+					this.chooseNext()
+					console.log(this.token, 'this.token');
+				})
+			},
+			chooseToken(item) {
+				// console.log(item,'ddddd');
+				if (this.loading) {
+					return
+				}
+				if (item.bl) {
+					return this.$msg.error('该TOKEN,当天使用次数已满!')
+				}
+				this.ybToken = item
+				this.dialogTableVisible = true
+			},
+			handleAvatarSuccess(res, file) {
+				this.form.image = res.data.fullurl;
+			},
+			beforeAvatarUpload(file) {
+				// const isJPG = file.type === 'image/jpeg/png';
+				// const isLt2M = file.size / 1024 / 1024 < 2;
+
+				// if (!isJPG) {
+				// 	this.$message.error('上传头像图片只能是 JPG 格式!');
+				// }
+				// if (!isLt2M) {
+				// 	this.$message.error('上传头像图片大小不能超过 2MB!');
+				// }
+				// return isJPG && isLt2M;
+				return true
+			},
+			handleAvatarError() {
+
+			},
+			getList(type) {
+				let that = this
+				if (type == 'reload') {
+					that.queryInfo.page = 1
+					that.dataloading = false
+				}
+				if (that.dataloading) {
+					return
+				}
+
+				that.dataloading = true
+				getRechangeList(that.queryInfo).then(res => {
+					that.total = res.data.count
+					that.list = res.data.data
+					that.dataloading = false
+				}).catch(err => {
+					that.dataloading = false
+				})
+			},
+			handleSizeChange(newPageSize) {
+				this.queryInfo.limit = newPageSize
+				this.getList()
+			},
+			handleCurrentChange(newPageNum) {
+				this.queryInfo.page = newPageNum
+				this.getList()
+			},
+		},
+
+	}
+</script>
+
+<style lang="scss" scoped>
+	.tj {
+		width: 500px;
+		flex-wrap: wrap;
+
+		.tj-item {
+			width: 120px;
+			height: 120px;
+			border-radius: 20px;
+			box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.4);
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
+			align-items: center;
+			margin: 20px;
+
+			.val {
+				margin-top: 20px;
+				color: rgb(15, 131, 254);
+			}
+		}
+	}
+</style>

+ 133 - 6
src/views/home/orderList.vue

@@ -6,7 +6,7 @@
 			<el-row>
 				<el-col>
 					<div class="flex" style="justify-content: flex-end;padding-bottom: 20px;">
-						<!-- <el-button type="primary" @click="openBuy">购买Token</el-button> -->
+						<el-button type="primary" @click="oneWork">一键处理订单</el-button>
 						<el-button type="primary" icon="el-icon-refresh-right" @click="getList('reload')">刷新</el-button>
 					</div>
 
@@ -21,13 +21,21 @@
 			</el-row>
 			<!-- 订单表格区域 -->
 			<el-table :data="list" border style="width: 100%" max-height="620">
+				<!-- <el-table-column fixed="left" type="selection" width="55">
+				</el-table-column> -->
 				<el-table-column prop="id" label="id" width="80">
 				</el-table-column>
 				<el-table-column prop="order_id" label="订单编号" width="200">
 				</el-table-column>
 				<el-table-column prop="sys_address" label="是否系统默认" width="170">
 					<template slot-scope="scope">
-						<span :style="{'color': (scope.row.sys_address == 1 || scope.row.sys_phone == 1 )? '': '#67c23a'}">{{(scope.row.sys_address == 1 || scope.row.sys_phone == 1 )? '是': '否'}}</span>
+						<span
+							:style="{'color': (scope.row.sys_address == 1 || scope.row.sys_phone == 1 )? '': '#67c23a'}">{{(scope.row.sys_address == 1 || scope.row.sys_phone == 1 )? '是': '否'}}</span>
+					</template>
+				</el-table-column>
+				<el-table-column prop="status" label="订单状态" width="170">
+					<template slot-scope="scope">
+						{{scope.row.status| showStatus}}
 					</template>
 				</el-table-column>
 				<el-table-column prop="consignee_phone" label="收货手机号" width="200">
@@ -53,7 +61,19 @@
 						{{showTime(scope.row.createtime)}}
 					</template>
 				</el-table-column>
-				
+				<el-table-column fixed="right" label="操作" width="150">
+					<template slot-scope="scope">
+						<el-button type="text" size="small" v-if="scope.row.status == 2"
+							@click="handleOrder('是否确认收货?',scope.row)">确认收货</el-button>
+						<el-button type="text" size="small" v-if="scope.row.status == 4" @click="handleOrder('是否确认申请理赔?',scope.row)">申请理赔</el-button>
+						<!-- <el-button type="text" size="small" >结算</el-button> -->
+						<el-button type="text" size="small" v-if="scope.row.status == 1"
+							@click="handleOrder('是否确认申请退款?',scope.row)">申请退款</el-button>
+							
+						<el-button type="text" size="small" v-if="scope.row.status == 2"
+							@click="getExpressDelivery(scope.row)">查看物流</el-button>
+					</template>
+				</el-table-column>
 			</el-table>
 			<!-- 分页区域 -->
 			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
@@ -76,6 +96,21 @@
 				<el-button type="primary" @click="goBuy">确 定</el-button>
 			</div>
 		</el-dialog>
+		<el-dialog
+		  title="物流进度"
+		  :visible.sync="logProgDialogVisible"
+		  width="30%"
+		>
+		  <el-timeline>
+		    <el-timeline-item
+		      v-for="(activity, index) in logProgInfo"
+		      :key="index"
+		      :timestamp="activity.time"
+		    >
+		      {{ activity.context }}
+		    </el-timeline-item>
+		  </el-timeline>
+		</el-dialog>
 	</div>
 </template>
 
@@ -85,14 +120,24 @@
 		getCodeList,
 		createToken,
 		getTokenList,
-		
+		getExpressDelivery
 	} from '@/request/agent.js'
-	import { getOrderList } from '@/request/user.js'
-	import { showTime } from '@/assets/js/tools.js'
+	import {
+		getOrderList,
+		batchOrder
+	} from '@/request/user.js'
+	import {
+		showTime
+	} from '@/assets/js/tools.js'
+	import {
+		Switch
+	} from 'element-ui'
 	export default {
 		name: 'Order',
 		data() {
 			return {
+				logProgInfo: [],
+				logProgDialogVisible: false,
 				loading: false,
 				formLabelWidth: '80px',
 				form: {
@@ -108,13 +153,91 @@
 				list: [],
 				total: 0,
 				dataloading: false,
+				sqtkitem: {},
 			}
 		},
 		created() {
 			this.getList()
 		},
+		computed: {
+
+		},
+		filters: {
+			showStatus(val) {
+				let str = ''
+				if (val) {
+					switch (val) {
+						case 0:
+							str = '待支付'
+							break;
+						case 1:
+							str = '待发货'
+							break;
+						case 2:
+							str = '待收货'
+							break;
+						case 3:
+							str = '待收货'
+							break;
+						case 4:
+							str = '已完成'
+							break;
+						case 5:
+							str = '已退款'
+							break;
+						case 5:
+							str = '已结算'
+							break;
+						default:
+							break;
+					}
+				}
+				return str
+			}
+		},
 		methods: {
 			showTime,
+			getExpressDelivery(item) {
+				getExpressDelivery({
+					code: 'yuantong',
+					sn: item.delivery_sn
+				}).then(res => {
+					console.log(res);
+					this.logProgInfo = res.data.data
+					this.logProgDialogVisible = true
+				})
+			},
+			handleOrder(tit, item) {
+				this.$confirm(tit, '提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					callback: action => {
+						if(action == 'confirm') {
+							batchOrder({
+								id: item.id,
+								status: item.status
+							}).then(res => {
+								// console.log(res);
+								this.$msg.success('已提交,请等待审核处理')
+							})
+						}
+					}
+				});
+			},
+			sqlp(item) {
+
+			},
+			oneWork() {
+				batchOrder({
+					id: 0
+				}).then(res => {
+					this.$msg.success(res.msg)
+					this.getList()
+				})
+			},
+			handleSelectionChange(val) {
+				console.log(val);
+			},
 			openBuy() {
 				this.dialogTableVisible = true
 			},
@@ -163,12 +286,16 @@
 			},
 			handleSizeChange(newPageSize) {
 				this.queryInfo.limit = newPageSize
+				this.queryInfo.page = 1
 				this.getList()
 			},
 			handleCurrentChange(newPageNum) {
 				this.queryInfo.page = newPageNum
 				this.getList()
 			},
+			qrsh() {
+
+			}
 		},
 
 	}

+ 1 - 1
src/views/home/rechangeList.vue

@@ -60,7 +60,7 @@
 				
 			</el-form>
 			<div class="t-r">
-				到账: {{((form.recharge_num*1 || 0)*(baseInfo.to_rmb*1)).toFixed(2)}}元s
+				到账: {{((form.recharge_num*1 || 0)*(baseInfo.to_rmb*1)).toFixed(2)}}元
 			</div>
 			<div class="t-r">
 				当前余额: {{userInfo.money*1}}元

+ 429 - 1
src/views/home/statistics.vue

@@ -1,8 +1,436 @@
 <template>
+	<div class="order-wrapper">
+		<!-- <breadcrumb :item-name="['订单管理', '订单列表']"></breadcrumb> -->
+		<el-card>
+			<div class="tj flex">
+				<div class="tj-item">
+					<div class="tit">手续费</div>
+					<div class="val">{{tj.commission||0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">赔付金</div>
+					<div class="val">{{tj.compensation|| 0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">订单数</div>
+					<div class="val">{{tj.order|| 0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">异常订单</div>
+					<div class="val">{{tj.order_error||0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">token数</div>
+					<div class="val">{{tj.tokon||0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">转账金额</div>
+					<div class="val">{{tj.transfer|| 0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">提现到账</div>
+					<div class="val">{{tj.withdraw||0}}</div>
+				</div>
+				<div class="tj-item">
+					<div class="tit">提现审核中</div>
+					<div class="val">{{tj.withdraw_0 || 0}}</div>
+				</div>
+			</div>
+			
+		</el-card>
+		
+	</div>
 </template>
 
 <script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+
+	import {
+		createCode,
+		getUserList,
+		getIndex,
+
+	} from '@/request/agent.js'
+	import {
+		getRechangeList,
+		rechange,
+		getTokenList,
+		createOrder,
+		getUserInfo,
+		payAuto,
+		dataCount
+	} from '@/request/user.js'
+	import {
+		showTime,
+		sj
+	} from '@/assets/js/tools.js'
+	import {
+		imgs
+	} from '@/assets/js/admun.js'
+	import {
+		set
+	} from 'core-js/library/core/dict';
+	export default {
+		components: {
+			// SlideVerify
+		},
+		name: 'Order',
+		data() {
+			return {
+				showStop:false,
+				dialogVisible: false,
+				xdForm: {
+					phone: '',
+					address: '',
+					minPrice: '',
+					maxPrice: ''
+				},
+				imgs: imgs,
+				msg: '888',
+				loading: false,
+				formLabelWidth: '100px',
+				form: {
+					recharge_num: '',
+					image: ''
+				},
+				dialogTableVisible: false,
+				xiadanDia: false, //下单弹窗
+				queryInfo: {
+					keyword: '',
+					page: 1,
+					limit: 10
+				},
+				list: [],
+				total: 0,
+				dataloading: false,
+				headers: {},
+				tokenList: [],
+				token: {},
+				ybToken: {},
+				minPriceList: [],
+				maxPriceList: [],
+				tipList: [],
+				auto_order: false,//是否启动自动下单
+				tj: {}
+			}
+		},
+		computed: {
+			...mapState(['baseInfo', 'userInfo'])
+		},
+		created() {
+			// this.getUserInfo()
+			// this.getIndex()
+			// this.getList()
+			// this.getTokenList()
+			this.dataCount()
+			this.headers['token'] = window.sessionStorage.getItem('token')
+			// console.log(this.imgs, 'imgs');
+		},
+		methods: {
+			...mapMutations(['setBaseInfo', 'setUserInfo','jUserMoney']),
+			dataCount() {
+				dataCount().then(res => {
+					console.log(res);
+					this.tj = res.data
+				})
+			},
+			stopAuto() {
+				this.auto_order = false
+				this.showStop =false
+			},
+			getUserInfo() {
+				getUserInfo().then(res => {
+					this.setUserInfo(res.data)
+				})
+			},
+			pd(arr, i = 0) {
+				let that = this
+				let len = arr.length - 1
+				if (i <= len) {
+					if (i == 0) {
+						that.tipList.unshift(arr[i])
+						that.pd(arr, ++i)
+					} else {
+						setTimeout(() => {
+							that.tipList.unshift(arr[i])
+							if(arr[i].title.indexOf('支付金额:') != -1) {
+								// let price = zfInfo.title.replace(/支付金额:/,'')*1
+								that.jUserMoney(-1*arr[i].title.replace(/支付金额:/,''))
+							}
+							that.pd(arr, ++i)
+						}, arr[i - 1].time * 1000)
+					}
+				}else {
+					that.xdForm.phone = ''
+					that.xdForm.address = ''
+					that.loading = false
+					if(that.auto_order) {
+						that.chooseNext()
+					}else {
+						that.xdForm.minPrice = ''
+						that.xdForm.maxPrice = ''
+					}
+				}
+			},
+			ktAuto() {
+				let that = this
+				if (that.userInfo.money * 1 < that.baseInfo.auto_order * 1) {
+					return that.$msg.error('您当前余额不足')
+				}
+				payAuto().then(res => {
+					that.getUserInfo()
+						that.dialogVisible = false
+						that.auto_order = true
+						that.chooseNext()
+					//自动下单启动
+				})
+			},
+			openZd() {
+				let that = this
+				if(that.loading) {
+					return that.$msg.error('当前处于下单状态,请等待下单完成')
+				}
+				if (that.userInfo.auto_order == 0) {
+					that.dialogVisible = true
+				} else {
+					//自动下单启动
+					if(that.xdForm.minPrice == '') {
+						return that.$msg.error('请选择最低价格')
+					}
+					if(that.xdForm.maxPrice == '') {
+						return that.$msg.error('请选择最高价格')
+					}
+					that.auto_order = true
+					that.chooseNext()
+					
+					
+				}
+			},
+			//选择下一个可用token
+			chooseNext() {
+				let that = this
+				that.token = that.tokenList.find(item => item.bl == false ) 
+				if(that.auto_order) {
+					if(that.token) {
+						if(that.xdForm.minPrice == '') {
+							return that.$msg.error('请选择最低价格')
+						}
+						if(that.xdForm.maxPrice == '') {
+							return that.$msg.error('请选择最高价格')
+						}
+						that.sjAddress()
+						that.sjPhone()
+						// that.$msg.success('开启自动下单,请勿进行操作')
+						// 启动
+						that.createOrder()
+					}else {
+						//停止
+						that.auto_order = false
+					}
+					
+				}
+			},
+			createOrder() {
+				let that = this
+				if(that.loading ) {
+					return
+				}
+				if ( that.token.bl) {
+					if(that.auto_order) {
+						
+					}else {
+						return this.$msg.error('该TOKEN,当天使用次数已满!')
+					}
+				}
+				if(that.xdForm.minPrice == '') {
+					return that.$msg.error('请选择最低价格')
+				}
+				if(that.xdForm.maxPrice == '') {
+					return that.$msg.error('请选择最高价格')
+				}
+				if(that.xdForm.minPrice*1 > that.xdForm.maxPrice*1) {
+					return that.$msg.error('最高价格需大于最低价格')
+				}
+				if(that.xdForm.phone == '') {
+					return that.$msg.error('请输入手机号码')
+				}
+				if (!/(^1[2|3|4|5|6|7|8|9][0-9]{9}$)/.test(that.xdForm.phone)) {
+					return that.$msg.error('请输入正确的手机号码')
+				}
+				if(that.xdForm.address == '') {
+					return that.$msg.error('请输入收货地址')
+				}
+				that.loading = true
+				createOrder({
+					min_price: that.xdForm.minPrice,
+					max_price: that.xdForm.maxPrice,
+					address: that.xdForm.address,
+					phone: that.xdForm.phone,
+					token: that.token.token
+				}).then(res => {
+					
+					//更新token
+					that.token.count++
+					if(that.token.count == 2) {
+						that.token.bl = true
+					}
+					// 加载tip
+					
+					that.pd(res.data, 0)
+
+				}).catch(err => {
+					console.log(err);
+					that.loading = false
+				})
+			},
+			getIndex() {
+				getIndex().then(res => {
+					this.setBaseInfo(res.data)
+					let arr = [],
+						arr2 = []
+					res.data.price_min.forEach(item => {
+						let a = {
+							value: item * 1,
+							label: item
+						}
+						arr.push(a)
+					})
+					res.data.price_max.forEach(item => {
+						let a = {
+							value: item * 1,
+							label: item
+						}
+						arr2.push(a)
+					})
+					this.minPriceList = arr
+					this.maxPriceList = arr2
+				})
+			},
+			showTime,
+			sjPhone() {
+				if(this.loading) {
+					return
+				}
+				this.xdForm.phone = sj(this.baseInfo.sys_phone)
+			},
+			sjAddress() {
+				if(this.loading) {
+					return
+				}
+				this.xdForm.address = sj(this.baseInfo.system_address)
+			},
+			closeXd() {
+				this.xiadanDia = false
+				this.xdForm.phone = ''
+				this.xdForm.address = ''
+			},
+			onSuccess() {
+				console.log('success');
+				this.token = this.ybToken
+				this.xdForm.minPrice = ''
+				this.xdForm.maxPrice = ''
+				this.dialogTableVisible = false
+			},
+			onFail() {
+				console.log('fail');
+			},
+			onRefresh() {
+				console.log('refresh');
+			},
+			getTokenList() {
+				getTokenList().then(res => {
+					this.tokenList = res.data.map(item => {
+						item.count = item.count*1
+						return item
+					})
+					// 获取第一次选择的token
+					this.chooseNext()
+					console.log(this.token, 'this.token');
+				})
+			},
+			chooseToken(item) {
+				// console.log(item,'ddddd');
+				if(this.loading) {
+					return
+				}
+				if (item.bl) {
+					return this.$msg.error('该TOKEN,当天使用次数已满!')
+				}
+				this.ybToken = item
+				this.dialogTableVisible = true
+			},
+			handleAvatarSuccess(res, file) {
+				this.form.image = res.data.fullurl;
+			},
+			beforeAvatarUpload(file) {
+				// const isJPG = file.type === 'image/jpeg/png';
+				// const isLt2M = file.size / 1024 / 1024 < 2;
+
+				// if (!isJPG) {
+				// 	this.$message.error('上传头像图片只能是 JPG 格式!');
+				// }
+				// if (!isLt2M) {
+				// 	this.$message.error('上传头像图片大小不能超过 2MB!');
+				// }
+				// return isJPG && isLt2M;
+				return true
+			},
+			handleAvatarError() {
+
+			},
+			getList(type) {
+				let that = this
+				if (type == 'reload') {
+					that.queryInfo.page = 1
+					that.dataloading = false
+				}
+				if (that.dataloading) {
+					return
+				}
+
+				that.dataloading = true
+				getRechangeList(that.queryInfo).then(res => {
+					that.total = res.data.count
+					that.list = res.data.data
+					that.dataloading = false
+				}).catch(err => {
+					that.dataloading = false
+				})
+			},
+			handleSizeChange(newPageSize) {
+				this.queryInfo.limit = newPageSize
+				this.getList()
+			},
+			handleCurrentChange(newPageNum) {
+				this.queryInfo.page = newPageNum
+				this.getList()
+			},
+		},
+
+	}
 </script>
 
-<style>
+<style lang="scss" scoped>
+	.tj {
+		width: 500px;
+		flex-wrap: wrap;
+		.tj-item {
+			width: 120px;
+			height: 120px;
+			border-radius: 20px;
+			box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.4);
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
+			align-items: center;
+			margin: 20px;
+			.val {
+				margin-top: 20px;
+				color: rgb(15, 131, 254);
+			}
+		}
+	}
 </style>