royaltypg.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <div>
  3. <div class="royaltypg-all">
  4. <div class="royaltypg-hand">
  5. <el-form label-width="50px">
  6. <div class="royaltypg-hand-search">
  7. <el-form-item label="公司">
  8. <el-select style="width:200px" @change="Corporationchange" v-model="value" placeholder="请选择公司">
  9. <el-option v-for="(iten,index) in CorporationOption" :key="index" :label="iten.companyName" :value="iten.companyId"></el-option>
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="部门">
  13. <el-select style="width:120px" @change="depchange" v-model="depvalue" placeholder="请选择部门">
  14. <el-option v-for="(item,index) in depOption" :key="index" :label="item.depName" :value="item.depId"></el-option>
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="人员">
  18. <el-select style="width:120px" filterable v-model="uservalue" placeholder="请选择人员">
  19. <el-option v-for="(item,index) in userOption" :key="index" :label="item.cnName" :value="item.id"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="日期">
  23. <el-date-picker
  24. style="width:300px"
  25. v-model="value2"
  26. type="daterange"
  27. align="right"
  28. unlink-panels
  29. range-separator="至"
  30. start-placeholder="开始日期"
  31. end-placeholder="结束日期"
  32. :picker-options="pickerOptions">
  33. </el-date-picker>
  34. </el-form-item>
  35. <div style="margin-left: 10px;">
  36. <el-button style="margin-left: 10px;" @click="ComputeRoyalties" type="primary">查 询</el-button>
  37. <el-button @click="derivelist" type="primary">导出提成列表</el-button>
  38. <el-button @click="RoyaltyConfirmByFin" type="primary">发送通知给国交同事进行提成确认</el-button>
  39. <el-button type="primary">查看已确定</el-button>
  40. </div>
  41. </div>
  42. </el-form>
  43. </div>
  44. <div class="royaltypg-table">
  45. <el-table
  46. height="750"
  47. :data="tableData"
  48. border
  49. @selection-change="handleSelectionChange"
  50. style="width: 100%">
  51. <el-table-column
  52. type="selection"
  53. width="55">
  54. </el-table-column>
  55. <el-table-column
  56. prop="date"
  57. label="序号"
  58. width="50">
  59. <template slot-scope="scope">
  60. {{ scope.$index + 1 }}
  61. </template>
  62. </el-table-column>
  63. <el-table-column
  64. prop="teamName"
  65. label="团名"
  66. width="400">
  67. </el-table-column>
  68. <el-table-column
  69. prop="visitDate"
  70. label="结束日期"
  71. width="100">
  72. <template slot-scope="scope">
  73. {{processingdate(scope.row.visitDate)}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column
  77. prop="teamLvStr"
  78. label="级别"
  79. width="80">
  80. </el-table-column>
  81. <el-table-column
  82. prop="temp"
  83. label="提成明细">
  84. <template slot-scope="scope">
  85. <el-popover
  86. placement="top-start"
  87. title="明细"
  88. width="700"
  89. trigger="hover">
  90. <div class="temp-ul">
  91. <div class="temp-li" v-for="(item,index) in scope.row.chiArr" :key="index">
  92. {{ item }}
  93. </div>
  94. </div>
  95. <span slot="reference">{{scope.row.temp}}</span>
  96. </el-popover>
  97. </template>
  98. </el-table-column>
  99. <el-table-column
  100. prop="price"
  101. label="提成金额 "
  102. width="180">
  103. <template slot-scope="scope">
  104. {{ processingprice(scope.row.price)+ ' 元' }}
  105. </template>
  106. </el-table-column>
  107. <!-- <el-table-column
  108. prop="name"
  109. label="本团是否亏损或无利润"
  110. width="180">
  111. </el-table-column>
  112. <el-table-column
  113. prop="address"
  114. label="发放月份">
  115. </el-table-column> -->
  116. </el-table>
  117. <div class="numpice">
  118. 该时间段提成总额:&nbsp;{{ numpices }} 元
  119. </div>
  120. <!-- <div class="block">
  121. <el-pagination
  122. @size-change="handleSizeChange"
  123. @current-change="handleCurrentChange"
  124. :current-page="currentPage4"
  125. :page-sizes="[100, 200, 300, 400]"
  126. :page-size="100"
  127. layout="total, sizes, prev, pager, next, jumper"
  128. :total="400">
  129. </el-pagination>
  130. </div> -->
  131. </div>
  132. </div>
  133. </div>
  134. </template>
  135. <script>
  136. import {debounce} from '../../store/statice'
  137. export default {
  138. data () {
  139. return {
  140. pickerOptions: {
  141. shortcuts: [{
  142. text: '最近一周',
  143. onClick(picker) {
  144. const end = new Date();
  145. const start = new Date();
  146. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  147. picker.$emit('pick', [start, end]);
  148. }
  149. }, {
  150. text: '最近一个月',
  151. onClick(picker) {
  152. const end = new Date();
  153. const start = new Date();
  154. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  155. picker.$emit('pick', [start, end]);
  156. }
  157. }, {
  158. text: '最近三个月',
  159. onClick(picker) {
  160. const end = new Date();
  161. const start = new Date();
  162. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  163. picker.$emit('pick', [start, end]);
  164. }
  165. }]
  166. },
  167. cost:0,
  168. value:'',
  169. depvalue:'',
  170. uservalue:'',
  171. value2:[],
  172. CorporationOption:[],
  173. depOption:[],
  174. userOption:[],
  175. tableData: [],
  176. currentPage4: 4,
  177. numpices:0,
  178. multipleSelection: []
  179. }
  180. },
  181. methods:{
  182. //处理日期
  183. processingdate(vals){
  184. vals=vals+""
  185. return vals.split(' ')[0]
  186. },
  187. //处理金额
  188. processingprice(val){
  189. if(Number(val)){
  190. return val.toFixed(2);
  191. }else{
  192. return val
  193. }
  194. },
  195. handleSizeChange(val) {
  196. console.log(`每页 ${val} 条`);
  197. },
  198. handleCurrentChange(val) {
  199. console.log(`当前页: ${val}`);
  200. },
  201. addcost:debounce(function(){
  202. this.cost++
  203. console.log(this.cost)
  204. },1000,true),
  205. //获取公司
  206. daraSource(){
  207. var url = "/api/register/daraSource"
  208. var that = this
  209. this.$axios({
  210. method: 'post',
  211. url: url,
  212. headers: {
  213. Authorization: 'Bearer '
  214. }
  215. }).then(function (res) {
  216. if(res.data.code==200){
  217. that.CorporationOption=res.data.data;
  218. console.log(that.CorporationOption)
  219. }else{
  220. that.$message({
  221. message: res.data.msg,
  222. type: 'warning'
  223. });
  224. }
  225. })
  226. },
  227. //导出
  228. derivelist(){
  229. if(this.uservalue==""||this.value2.length<=0){
  230. this.$message({
  231. message:"请选择查询条件",
  232. type: 'warning'
  233. });
  234. return
  235. }
  236. var url = "/api/Financial/ExportRoyaltyExcel"
  237. var that = this
  238. this.$axios({
  239. method: 'post',
  240. url: url,
  241. headers: {
  242. Authorization: 'Bearer '
  243. },
  244. data:{
  245. userId:that.uservalue,
  246. startDate:that.getdate(this.value2[0]),
  247. endDate:that.getdate(this.value2[1])
  248. }
  249. }).then(function (res) {
  250. if(res.data.code==200){
  251. window.open(res.data.data.url);
  252. that.$message({
  253. message: res.data.msg,
  254. type: 'success'
  255. });
  256. }else{
  257. that.$message({
  258. message: res.data.msg,
  259. type: 'warning'
  260. });
  261. }
  262. })
  263. },
  264. //公司切换
  265. Corporationchange(val){
  266. this.depOption=[];
  267. this.depvalue='';
  268. this.userOption=[];
  269. this.uservalue='';
  270. for(let i=0;i<this.CorporationOption.length;i++){
  271. if(val==this.CorporationOption[i].companyId){
  272. this.depOption=this.CorporationOption[i].subDep;
  273. }
  274. }
  275. },
  276. //部门切换
  277. depchange(val){
  278. this.userOption=[];
  279. this.uservalue='';
  280. this.QueryUserByDepart(val)
  281. },
  282. //获取员工
  283. QueryUserByDepart(val){
  284. var url = "/api/System/QueryUserByDepart"
  285. var that = this
  286. this.$axios({
  287. method: 'post',
  288. url: url,
  289. headers: {
  290. Authorization: 'Bearer '
  291. },
  292. data:{
  293. departId:val,
  294. }
  295. }).then(function (res) {
  296. if(res.data.code==200){
  297. that.userOption=res.data.data
  298. }else{
  299. that.$message({
  300. message: res.data.msg,
  301. type: 'warning'
  302. });
  303. }
  304. })
  305. },
  306. //table 多选
  307. handleSelectionChange(val) {
  308. console.log(val);
  309. this.multipleSelection = val;
  310. },
  311. //处理时间
  312. getdate(val){
  313. var date=new Date(val);
  314. var y=date.getFullYear();
  315. var m=date.getMonth()+1<10?'0'+(date.getMonth()+1):date.getMonth()+1;
  316. var d=date.getDate()<10?'0'+date.getDate():date.getDate();
  317. return y+'-'+m+'-'+d
  318. },
  319. //提成结算
  320. ComputeRoyalties(){
  321. if(this.uservalue==""||this.value2.length<=0){
  322. this.$message({
  323. message:"请选择查询条件",
  324. type: 'warning'
  325. });
  326. return
  327. }
  328. this.tableData=[];
  329. var url = "/api/Financial/ComputeRoyalties"
  330. var that = this
  331. this.$axios({
  332. method: 'post',
  333. url: url,
  334. headers: {
  335. Authorization: 'Bearer '
  336. },
  337. data:{
  338. userId:that.uservalue,
  339. startDate:that.getdate(this.value2[0]),
  340. endDate:that.getdate(this.value2[1])
  341. }
  342. }).then(function (res) {
  343. if(res.data.code==200){
  344. that.tableData=res.data.data.resultArr;
  345. that.numpices=res.data.data.totalPrice;
  346. }else{
  347. that.$message({
  348. message: res.data.msg,
  349. type: 'warning'
  350. });
  351. }
  352. })
  353. },
  354. //提成通知
  355. RoyaltyConfirmByFin(){
  356. var url = "/api/Financial/RoyaltyConfirmByFin"
  357. var that = this
  358. this.$axios({
  359. method: 'post',
  360. url: url,
  361. headers: {
  362. Authorization: 'Bearer '
  363. },
  364. data:{
  365. startData:that.getdate(this.value2[0]),
  366. endData:that.getdate(this.value2[1]),
  367. userId:that.uservalue,
  368. deparId:that.depvalue,
  369. companyId:that.value,
  370. computeRoyaltiesList:that.multipleSelection,
  371. }
  372. }).then(function (res) {
  373. if(res.data.code==200){
  374. that.$message({
  375. message: res.data.msg,
  376. type: 'success'
  377. });
  378. }else{
  379. that.$message({
  380. message: res.data.msg,
  381. type: 'warning'
  382. });
  383. }
  384. })
  385. },
  386. },
  387. mounted(){
  388. this.daraSource()
  389. }
  390. }
  391. </script>
  392. <style>
  393. .royaltypg-all{
  394. background-color: #fff;
  395. padding: 10px;
  396. box-shadow: 0 0 5px #0005;
  397. border-radius: 10px;
  398. height: 100%;
  399. min-height: 830px;
  400. }
  401. .royaltypg-hand-search{
  402. display: flex;
  403. flex-wrap: wrap;
  404. }
  405. .royaltypg-hand-search .el-form-item{
  406. margin-bottom: 0;
  407. }
  408. .royaltypg-table{
  409. margin-top: 20px;
  410. }
  411. .royaltypg-all .block{
  412. margin-top: 15px;
  413. text-align: center;
  414. }
  415. .temp-li{
  416. border-top: 1px solid #EBEEF5;
  417. border-right: 1px solid #EBEEF5;
  418. border-left: 1px solid #EBEEF5;
  419. padding: 10px;
  420. }
  421. .temp-li:nth-last-child(1){
  422. border-bottom: 1px solid #EBEEF5;
  423. }
  424. .numpice{
  425. text-align: right;
  426. font-size:14px ;
  427. color: #555;
  428. }
  429. </style>