RoyaltyRecogn.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  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 disabled @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" disabled @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" disabled 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:250px"
  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. <el-form-item label-width="80px" label="是否确认">
  36. <el-select style="width:120px" filterable v-model="countersign" placeholder="请选择人员">
  37. <el-option v-for="(item,index) in countersignarr" :key="index" :label="item.lable" :value="item.value"></el-option>
  38. </el-select>
  39. </el-form-item>
  40. <el-form-item label-width="80px" label="是否发放">
  41. <el-select style="width:120px" filterable v-model="grant" placeholder="请选择人员">
  42. <el-option v-for="(item,index) in grantarr" :key="index" :label="item.lable" :value="item.value"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <div style="margin-left: 10px;">
  46. <el-button @click="ComputeRoyalties" type="primary">查 询</el-button>
  47. <!-- <el-button @click="derivelist" type="primary">导出提成列表</el-button> -->
  48. <el-button @click="RoyaltyConfirmByUser" type="primary">确认</el-button>
  49. </div>
  50. </div>
  51. </el-form>
  52. </div>
  53. <div class="royaltypg-table">
  54. <el-table
  55. height="750"
  56. :data="tableData"
  57. border
  58. @selection-change="handleSelectionChange"
  59. style="width: 100%">
  60. <el-table-column
  61. type="selection"
  62. width="55">
  63. </el-table-column>
  64. <el-table-column
  65. prop="date"
  66. label="序号"
  67. width="50">
  68. <template slot-scope="scope">
  69. {{ scope.$index + 1 }}
  70. </template>
  71. </el-table-column>
  72. <el-table-column
  73. prop="teamName"
  74. label="团名"
  75. width="400">
  76. </el-table-column>
  77. <el-table-column
  78. prop="visitDate"
  79. label="结束日期"
  80. width="100">
  81. <template slot-scope="scope">
  82. {{processingdate(scope.row.visitDate)}}
  83. </template>
  84. </el-table-column>
  85. <el-table-column
  86. prop="teamLvStr"
  87. label="级别"
  88. width="80">
  89. </el-table-column>
  90. <el-table-column
  91. prop="temp"
  92. label="提成明细">
  93. <template slot-scope="scope">
  94. <el-popover
  95. placement="top-start"
  96. title="明细"
  97. width="700"
  98. trigger="hover">
  99. <div class="temp-ul">
  100. <div class="temp-li" v-for="(item,index) in scope.row.chiArr" :key="index">
  101. {{ item }}
  102. </div>
  103. </div>
  104. <span slot="reference">{{scope.row.temp}}</span>
  105. </el-popover>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. prop="price"
  110. label="提成金额 "
  111. width="180">
  112. <template slot-scope="scope">
  113. {{ processingprice(scope.row.price)+ ' 元' }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. prop="price"
  118. label="是否确认"
  119. width="80">
  120. <template slot-scope="scope">
  121. {{ scope.row.isConfirm==1?'已确认':'未确认'}}
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. prop="price"
  126. label="是否发放"
  127. width="80">
  128. <template slot-scope="scope">
  129. {{ scope.row.isSeed==1?'已发放':'未发放'}}
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <div class="numpice">
  134. 该时间段提成总额:&nbsp;{{ numpices }} 元
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import {debounce} from '../../store/statice'
  142. export default {
  143. data () {
  144. return {
  145. pickerOptions: {
  146. shortcuts: [{
  147. text: '最近一周',
  148. onClick(picker) {
  149. const end = new Date();
  150. const start = new Date();
  151. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  152. picker.$emit('pick', [start, end]);
  153. }
  154. }, {
  155. text: '最近一个月',
  156. onClick(picker) {
  157. const end = new Date();
  158. const start = new Date();
  159. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  160. picker.$emit('pick', [start, end]);
  161. }
  162. }, {
  163. text: '最近三个月',
  164. onClick(picker) {
  165. const end = new Date();
  166. const start = new Date();
  167. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  168. picker.$emit('pick', [start, end]);
  169. }
  170. },{
  171. text: '最近一年',
  172. onClick(picker) {
  173. const end = new Date();
  174. const start = new Date();
  175. start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
  176. picker.$emit('pick', [start, end]);
  177. }
  178. }]
  179. },
  180. cost:0,
  181. value:'',
  182. values:'',
  183. depvalue:'',
  184. depvalues:'',
  185. uservalue:'',
  186. uservalues:'',
  187. value2:[],
  188. CorporationOption:[],
  189. depOption:[],
  190. userOption:[],
  191. tableData: [],
  192. numpices:0,
  193. multipleSelection: [],
  194. countersign:-1,
  195. countersignarr:[
  196. {
  197. lable:'全部',
  198. value:-1
  199. },
  200. {
  201. lable:'未确认',
  202. value:0
  203. },
  204. {
  205. lable:'已确认',
  206. value:1
  207. },
  208. ],
  209. grant:-1,
  210. grantarr:[
  211. {
  212. lable:'全部',
  213. value:-1
  214. },
  215. {
  216. lable:'未发放',
  217. value:0
  218. },
  219. {
  220. lable:'已发放',
  221. value:1
  222. },
  223. ],
  224. }
  225. },
  226. methods:{
  227. //处理日期
  228. processingdate(vals){
  229. vals=vals+""
  230. return vals.split(' ')[0]
  231. },
  232. //处理金额
  233. processingprice(val){
  234. if(Number(val)){
  235. return val.toFixed(2);
  236. }else{
  237. return val
  238. }
  239. },
  240. handleSizeChange(val) {
  241. console.log(`每页 ${val} 条`);
  242. },
  243. handleCurrentChange(val) {
  244. console.log(`当前页: ${val}`);
  245. },
  246. addcost:debounce(function(){
  247. this.cost++
  248. console.log(this.cost)
  249. },1000,true),
  250. //获取公司
  251. daraSource(){
  252. var url = "/api/register/daraSource"
  253. var that = this
  254. this.$axios({
  255. method: 'post',
  256. url: url,
  257. headers: {
  258. Authorization: 'Bearer '
  259. }
  260. }).then(function (res) {
  261. if(res.data.code==200){
  262. that.CorporationOption=res.data.data;
  263. for (let i = 0; i < that.CorporationOption.length; i++) {
  264. if(that.values==that.CorporationOption[i].companyName){
  265. that.value=that.CorporationOption[i].companyId
  266. }
  267. }
  268. that.Corporationchange(that.value);
  269. console.log(that.CorporationOption)
  270. }else{
  271. that.$message({
  272. message: res.data.msg,
  273. type: 'warning'
  274. });
  275. }
  276. })
  277. },
  278. //导出
  279. derivelist(){
  280. if(this.uservalue==""||this.value2.length<=0){
  281. this.$message({
  282. message:"请选择查询条件",
  283. type: 'warning'
  284. });
  285. return
  286. }
  287. var url = "/api/Financial/ExportRoyaltyExcel"
  288. var that = this
  289. this.$axios({
  290. method: 'post',
  291. url: url,
  292. headers: {
  293. Authorization: 'Bearer '
  294. },
  295. data:{
  296. userId:that.uservalue,
  297. startDate:that.getdate(this.value2[0]),
  298. endDate:that.getdate(this.value2[1])
  299. }
  300. }).then(function (res) {
  301. if(res.data.code==200){
  302. window.open(res.data.data.url);
  303. that.$message({
  304. message: res.data.msg,
  305. type: 'success'
  306. });
  307. }else{
  308. that.$message({
  309. message: res.data.msg,
  310. type: 'warning'
  311. });
  312. }
  313. })
  314. },
  315. //公司切换
  316. Corporationchange(val){
  317. this.depOption=[];
  318. this.depvalue='';
  319. this.userOption=[];
  320. this.uservalue='';
  321. for(let i=0;i<this.CorporationOption.length;i++){
  322. if(val==this.CorporationOption[i].companyId){
  323. this.depOption=this.CorporationOption[i].subDep;
  324. }
  325. }
  326. for(let j=0;j<this.depOption.length;j++){
  327. if(this.depvalues==this.depOption[j].depName){
  328. this.depvalue=this.depOption[j].depId
  329. }
  330. }
  331. this.depchange(this.depvalue)
  332. },
  333. //部门切换
  334. depchange(val){
  335. this.userOption=[];
  336. this.uservalue='';
  337. this.QueryUserByDepart(val)
  338. },
  339. //获取员工
  340. QueryUserByDepart(val){
  341. var url = "/api/System/QueryUserByDepart"
  342. var that = this
  343. this.$axios({
  344. method: 'post',
  345. url: url,
  346. headers: {
  347. Authorization: 'Bearer '
  348. },
  349. data:{
  350. departId:val,
  351. }
  352. }).then(function (res) {
  353. if(res.data.code==200){
  354. that.userOption=res.data.data;
  355. that.uservalue=that.uservalues;
  356. }else{
  357. that.$message({
  358. message: res.data.msg,
  359. type: 'warning'
  360. });
  361. }
  362. })
  363. },
  364. //table 多选
  365. handleSelectionChange(val) {
  366. console.log(val);
  367. this.multipleSelection = val;
  368. },
  369. //处理时间
  370. getdate(val){
  371. var date=new Date(val);
  372. var y=date.getFullYear();
  373. var m=date.getMonth()+1<10?'0'+(date.getMonth()+1):date.getMonth()+1;
  374. var d=date.getDate()<10?'0'+date.getDate():date.getDate();
  375. return y+'-'+m+'-'+d
  376. },
  377. //查询
  378. ComputeRoyalties(){
  379. if(this.uservalue==""||this.value2.length<=0){
  380. this.$message({
  381. message:"请选择查询条件",
  382. type: 'warning'
  383. });
  384. return
  385. }
  386. this.tableData=[];
  387. var url = "/api/Financial/QueryRoyaltyInfo"
  388. var that = this
  389. this.$axios({
  390. method: 'post',
  391. url: url,
  392. headers: {
  393. Authorization: 'Bearer '
  394. },
  395. data:{
  396. userId:that.uservalue,
  397. startDate:that.getdate(this.value2[0]),
  398. endDate:that.getdate(this.value2[1]),
  399. confirm:that.countersign,
  400. send:that.grant
  401. }
  402. }).then(function (res) {
  403. if(res.data.code==200){
  404. that.tableData=res.data.data.list;
  405. that.numpices=res.data.data.costPrice;
  406. }else{
  407. that.$message({
  408. message: res.data.msg,
  409. type: 'warning'
  410. });
  411. }
  412. })
  413. },
  414. //提成确认
  415. RoyaltyConfirmByUser(){
  416. if (this.multipleSelection.length==0) {
  417. this.$message({
  418. message:"请选中数据",
  419. type: 'warning'
  420. });
  421. return
  422. }
  423. let dataarr=[];
  424. for(let i=0;i<this.multipleSelection.length;i++){
  425. dataarr.push(this.multipleSelection[i].id);
  426. }
  427. var url = "/api/Financial/RoyaltyConfirmByUser"
  428. var that = this
  429. this.$axios({
  430. method: 'post',
  431. url: url,
  432. headers: {
  433. Authorization: 'Bearer '
  434. },
  435. data:{
  436. data:dataarr,
  437. state:1,
  438. }
  439. }).then(function (res) {
  440. if(res.data.code==200){
  441. that.$message({
  442. message: res.data.msg,
  443. type: 'success'
  444. });
  445. }else{
  446. that.$message({
  447. message: res.data.msg,
  448. type: 'warning'
  449. });
  450. }
  451. })
  452. },
  453. },
  454. created(){
  455. },
  456. mounted(){
  457. this.uservalues = JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  458. this.depvalues = JSON.parse(localStorage.getItem('userinif')).userInfo.depName;
  459. this.values = JSON.parse(localStorage.getItem('userinif')).userInfo.companyName;
  460. this.daraSource();
  461. }
  462. }
  463. </script>
  464. <style>
  465. .royaltypg-all{
  466. background-color: #fff;
  467. padding: 10px;
  468. box-shadow: 0 0 5px #0005;
  469. border-radius: 10px;
  470. height: 100%;
  471. min-height: 830px;
  472. }
  473. .royaltypg-hand-search{
  474. display: flex;
  475. flex-wrap: wrap;
  476. }
  477. .royaltypg-hand-search .el-form-item{
  478. margin-bottom: 0;
  479. }
  480. .royaltypg-table{
  481. margin-top: 20px;
  482. }
  483. .royaltypg-all .block{
  484. margin-top: 15px;
  485. text-align: center;
  486. }
  487. .temp-li{
  488. border-top: 1px solid #EBEEF5;
  489. border-right: 1px solid #EBEEF5;
  490. border-left: 1px solid #EBEEF5;
  491. padding: 10px;
  492. }
  493. .temp-li:nth-last-child(1){
  494. border-bottom: 1px solid #EBEEF5;
  495. }
  496. .numpice{
  497. text-align: right;
  498. font-size:14px ;
  499. color: #555;
  500. }
  501. </style>