From 9bbcd9f08c311e5082271d9eb4db8dd19de87b0e Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 11 Nov 2021 14:46:37 +0800
Subject: [PATCH] fix

---
 zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html |   66 +++++++++++++++++++++++++++++++++
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml                        |   52 +++++++++++++++++++++----
 2 files changed, 109 insertions(+), 9 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
index 762117a..091ac7f 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -1294,13 +1294,27 @@
 						 ) x group by x.vip_id
 		) d on c.id=d.vip_id
 		where 1=1
-		 <if test="record.companyId != null">
-			 and a.company_id=#{record.companyId}
-		 </if>
-		  <if test="record.shopId != null">
-			  and a.shop_id=#{record.shopId}
-		  </if>
-		and date_format(b.datatime, '%Y-%m')=date_format(now(), '%Y-%m')
+		<if test="record.companyId != null">
+		 and a.company_id=#{record.companyId}
+		</if>
+		<if test="record.shopId != null">
+		  and a.shop_id=#{record.shopId}
+		</if>
+		<if test="record.beginTime != null">
+			and date_format(b.datatime, '%Y-%m-%d') > date_format(#{record.beginTime}, '%Y-%m-%d')
+		</if>
+		<if test="record.endTime != null">
+			and date_format(#{record.endTime}, '%Y-%m-%d') > date_format(b.datatime, '%Y-%m-%d')
+		</if>
+		<if test="record.beaultId != null">
+			and a.su_id=#{record.beaultId}
+		</if>
+		<if test="record.vipQueryKey != null and record.vipQueryKey != ''">
+			and c.vip_name like concat('%', #{record.vipQueryKey}, '%')
+		</if>
+		<if test="record.beginTime == null and record.endTime == null">
+			and date_format(b.datatime, '%Y-%m') = date_format(now(), '%Y-%m')
+		</if>
 		group by date_format(b.datatime, '%Y-%m-%d'), a.su_id, c.ID
 		<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
 			order by date_format(b.datatime, '%Y-%m-%d') desc, a.su_id
@@ -1325,8 +1339,28 @@
 			 from sys_users a
 					  left join achieve_new b on a.su_id=b.beault_id
 					  left join sys_vip_info c on b.vip_id=c.ID
-			 where a.company_id=#{record.companyId} and a.shop_id=#{record.shopId}
-			   and date_format(b.datatime, '%Y-%m')=date_format(now(), '%Y-%m')
+			where 1=1
+			<if test="record.companyId != null">
+				and a.company_id=#{record.companyId}
+			</if>
+			<if test="record.shopId != null">
+				and a.shop_id=#{record.shopId}
+			</if>
+			<if test="record.beginTime != null">
+				and date_format(b.datatime, '%Y-%m-%d') > date_format(#{record.beginTime}, '%Y-%m-%d')
+			</if>
+			<if test="record.endTime != null">
+				and date_format(#{record.endTime}, '%Y-%m-%d') > date_format(b.datatime, '%Y-%m-%d')
+			</if>
+			<if test="record.beaultId != null">
+				and a.su_id=#{record.beaultId}
+			</if>
+			<if test="record.vipQueryKey != null and record.vipQueryKey != ''">
+				and c.vip_name like concat('%', #{record.vipQueryKey}, '%')
+			</if>
+			<if test="record.beginTime == null and record.endTime == null">
+				and date_format(b.datatime, '%Y-%m') = date_format(now(), '%Y-%m')
+			</if>
 			 group by date_format(b.datatime, '%Y-%m-%d'), a.su_id, c.ID
 		) a
 	</select>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html
index 96c526e..b2e5261 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html
@@ -26,9 +26,41 @@
 		border: 1px solid #DCDFE6;
 		background-color: white;
 	}
+	.search-form {
+		background-color: white;
+		padding-top: 10px;
+		padding-left: 20px;
+		padding-bottom: 10px;
+	}
 </style>
 <body>
 <div id="app" style="">
+	<el-row class="search-form">
+		<el-form ref="form" :model="form" inline>
+			<el-form-item label="日期范围">
+				<el-date-picker v-model="form.timeRange"
+								type="datetimerange"
+								range-separator="至"
+								start-placeholder="开始日期"
+								end-placeholder="结束日期">
+				</el-date-picker>
+			</el-form-item>
+			<el-form-item label="业绩归属人">
+				<el-select v-model="form.beaultId" placeholder="请选择">
+					<el-option v-for="item in achieveUsers"
+							   :key="item.suId"
+							   :label="item.suName"
+							   :value="item.suId"></el-option>
+				</el-select>
+			</el-form-item>
+			<el-form-item label="会员">
+				<el-input v-model="form.vipQueryKey"></el-input>
+			</el-form-item>
+			<el-button type="primary" @click="search" >搜索</el-button>
+			<el-button @click="resetForm('form')">重置</el-button>
+<!--			<el-button type="warning" @click="exportExcel">导出</el-button>-->
+		</el-form>
+	</el-row>
 	<el-row class="table-style">
 		<el-table :data="tableData" style="width: 100%">
 			<el-table-column type="index" width="30" fixed="left"></el-table-column>
@@ -91,6 +123,11 @@
 		el : "#app",
 		data : {
 			tableData : [],
+			form : {
+				timeRange : '',
+				vipQueryKey : '',
+				beaultId : ''
+			},
 			page : {
 				currentPage : 1,
 				size : 10,
@@ -99,13 +136,21 @@
 		},
 		created : function() {
 			this.queryTableData();
+			this.queryAchieveUsers();
 		},
 		methods : {
 			queryTableData() {
 				let _this = this;
 				let params = {};
 				let page = _this.page;
+				let form = _this.form;
 
+				if (form.timeRange) {
+					params.beginTime = form.timeRange?moment(form.timeRange[0]).format("YYYY-MM-DD HH:mm"):'';
+					params.endTime = form.timeRange?moment(form.timeRange[1]).format("YYYY-MM-DD HH:mm"):'';
+				}
+				params.vipQueryKey=form.vipQueryKey;
+				params.beaultId=form.beaultId;
 				params.limit = page.size;
 				params.offset = (page.currentPage - 1) * page.size;
 				AjaxProxy.requst({
@@ -118,6 +163,27 @@
 					}
 				});
 			},
+			queryAchieveUsers() {
+				let _this = this;
+				AjaxProxy.requst({
+					app: _this,
+					url: basePath + '/admin/getShopStaffByRoleName',
+					callback: function (data) {
+						_this.achieveUsers = data.rows;
+					}
+				});
+			},
+			resetForm(formName) {
+				// this.$refs[formName].resetFields();
+				this.form = {
+					timeRange : '',
+					vipQueryKey : '',
+					beaultId : ''
+				}
+			},
+			search() {
+				this.queryTableData();
+			},
 			handleSizeChange(val) {
 				this.page.size = val;
 				this.queryTableData();

--
Gitblit v1.9.1