contractStatistics.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <div id="customer-statistics-container" class="customer-statistics-container">
  3. <div class="search-zone">
  4. <div class="search-box">
  5. <el-input v-model="searchParams.Keyword" placeholder="请输入客户名称" clearable class="search-item"
  6. @input="searchList" prefix-icon="el-icon-search" style="width: 240px;" ></el-input>
  7. <el-cascader :options="serviceList" style="width: 240px;margin: 0 0 8px 20px;" filterable v-model="checkedService"
  8. @change="serviceChange" placeholder="请选择套餐信息" clearable collapse-tags :show-all-levels="false"
  9. :props="{multiple:true,label:'title',value:'service_template_id',children:'children',emitPath:false}" key="serivce" >
  10. </el-cascader>
  11. <div class="date-box">
  12. <el-date-picker v-model="searchDate" type="daterange" @change="currentDateTab=0" style="max-width: 240px;margin-right: 20px;"
  13. value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  14. <el-select v-model="searchParams.TimeType" placeholder="请选择日期类型" @change="searchList"
  15. style="width: 240px;margin-right: 20px;" clearable>
  16. <el-option :label="item.label" :value="item.value" v-for="item in timeTypeData" :key="item.value"></el-option>
  17. </el-select>
  18. <div class="composition-button-tabs">
  19. <el-button size="large" v-for="(item,index) in dateButtonData" :key="item.tabId"
  20. class="date-button"
  21. :class="[index==0?'first-button':index==(dateButtonData.length-1)?'last-button':'inner-button',currentDateTab==item.tabId?'selectTab':'']"
  22. @click="changeDateType(item)">{{ item.text }}</el-button>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="amount-show-zone">
  28. <div class="amount-show-item" style="margin-right: 20px;">
  29. <div class="amount-item-head" @click="foldOrUnfold(0)"
  30. :style="{cursor:tableData.length>0?'pointer':'',padding:invoiceIsFold?'8px 20px 8px 20px':'20px'}">
  31. <div class="amount-item-head-title" >
  32. 已开票合计金额(换算后):{{ invoiceAmountTotal }}(CNY)
  33. </div>
  34. <div class="fold-expand-row" v-show="tableData.length>0">
  35. <span class="amount-item-head-icon">
  36. {{ invoiceIsFold?'展开':'收起' }}
  37. </span>
  38. <i class="el-icon-arrow-down" :style="!invoiceIsFold && 'transform: rotate(180deg)'" style="color: #409EFF;"></i>
  39. </div>
  40. </div>
  41. <div class="amount-item-body-package" :style="{height:invoiceIsFold?'0':'66px'}">
  42. <div class="amount-item-body">
  43. <div class="amount-item-body-box" v-for="item in invoiceAmountList" :key="item.code">
  44. <img :src="item.flag_img" style="height: 40px;width: 40px;margin-right: 20px;" />
  45. <div class="amount-item-body-info">
  46. <span>{{ item.name }}({{ item.code }})</span>
  47. <span>{{ item.amount }}</span>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="amount-show-item">
  54. <div class="amount-item-head" @click="foldOrUnfold(1)"
  55. :style="{cursor:tableData.length>0?'pointer':'',padding:placementIsFold?'8px 20px 8px 20px':'20px'}">
  56. <div class="amount-item-head-title" >
  57. 已到款合计金额(换算后):{{ placementAmountTotal }}(CNY)
  58. </div>
  59. <div class="fold-expand-row" v-show="tableData.length>0">
  60. <span class="amount-item-head-icon">
  61. {{ placementIsFold?'展开':'收起' }}
  62. </span>
  63. <i class="el-icon-arrow-down" :style="!placementIsFold && 'transform: rotate(180deg)'" style="color: #409EFF;"></i>
  64. </div>
  65. </div>
  66. <div class="amount-item-body-package" :style="{height:placementIsFold?'0':'66px'}">
  67. <div class="amount-item-body">
  68. <div class="amount-item-body-box" v-for="item in placementAmountList" :key="item.code">
  69. <img :src="item.flag_img" style="height: 40px;width: 40px;margin-right: 20px;" />
  70. <div class="amount-item-body-info">
  71. <span>{{ item.name }}({{ item.code }})</span>
  72. <span>{{ item.amount }}</span>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <div class="table-zone">
  80. <el-table :data="tableData" border ref="tableRef" max-height="580" @sort-change="sortChange" >
  81. <el-table-column label="序号" align="center" prop="serialNumber" width="60">
  82. <template slot-scope="{row}">
  83. {{ row.serialNumber }}
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="客户名称" prop="company_name" align="center">
  87. <template slot-scope="{row,$index}">
  88. <el-tooltip :content="row.company_name" placement="top" :disabled="disabledCheck($index)">
  89. <div class="company-name-column"><span class="company-name-span">{{ row.company_name }}</span></div>
  90. </el-tooltip>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="是否新客户" prop="contract_type" align="center">
  94. <template slot-scope="{row}">
  95. {{ row.contract_type==1?'是':'否' }}
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="合同有效期" prop="date" align="center" show-overflow-tooltip >
  99. <template slot-scope="{row}">
  100. {{ row.date }}
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="开票日" show-overflow-tooltip sortable="custom" prop="invoice_time" align="center">
  104. <template slot-scope="{row}">
  105. {{ row.invoice_time }}
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="开票金额" prop="invoice_amount" align="center">
  109. <template slot-scope="{row}">
  110. {{ row.invoice_amount }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="到款日" show-overflow-tooltip sortable="custom" prop="payment_date" align="center">
  114. <template slot-scope="{row}">
  115. {{ row.payment_date }}
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="到款金额" prop="payment_amount" align="center">
  119. <template slot-scope="{row}">
  120. {{ row.payment_amount }}
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="付款方式" prop="pay_type" align="center">
  124. <template slot-scope="{row}">
  125. <span>{{ payTypeArray[row.pay_type]?payTypeArray[row.pay_type].type:'' }}</span>
  126. </template>
  127. </el-table-column>
  128. <template v-if="isAdmin">
  129. <el-table-column label="销售" prop="seller_name" align="center">
  130. <template slot-scope="{row}">
  131. {{ row.seller_name }}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="销售组别" prop="seller_group_name" align="center">
  135. <template slot-scope="{row}">
  136. {{ row.seller_group_name }}
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="销售类型" prop="seller_type" align="center">
  140. <template slot-scope="{row}">
  141. {{ row.seller_type==1?'FICC销售':'权益销售' }}
  142. </template>
  143. </el-table-column>
  144. </template>
  145. <el-table-column label="套餐信息" prop="services_name" align="center">
  146. <template slot-scope="{row}">
  147. {{ row.services_name }}
  148. </template>
  149. </el-table-column>
  150. <template #empty>
  151. <div class="table-noData">
  152. <img src="~@/assets/img/cus_m/nodata.png">
  153. <span>暂无数据</span>
  154. </div>
  155. </template>
  156. </el-table>
  157. <!-- 分页 -->
  158. <m-page :pageSize="searchParams.PageSize" :page_no="searchParams.CurrentIndex"
  159. style="display: flex;justify-content: flex-end;margin-top: 20px;"
  160. :total="total" @handleCurrentChange="changePageNo" />
  161. </div>
  162. </div>
  163. </template>
  164. <script>
  165. import mPage from '@/components/mPage.vue';
  166. import {customInterence} from '@/api/api.js'
  167. export default {
  168. name:'contractStatistics',
  169. components:{mPage},
  170. data() {
  171. const startDate=this.$moment().startOf('year').format('YYYY-MM-DD')
  172. const endDate=this.$moment(new Date()).format('YYYY-MM-DD')
  173. this.payTypeArray=[{id:0,type:''},{id:1,type:'年付'},{id:2,type:'半年付'},{id:3,type:'季付'},{id:4,type:'次付'}]
  174. this.timeTypeData=[{label:'开票日期',value:1},{label:'到款日期',value:2},{label:'开票日期&到款日期',value:3}]
  175. this.dateButtonData=[{text:'近1周',tabId:1,type:'week',diff:1},{text:'近1月',tabId:2,type:'month',diff:1},
  176. {text:'近2月',tabId:3,type:'month',diff:2},{text:'近3月',tabId:4,type:'month',diff:3}]
  177. return {
  178. serviceList:[],
  179. checkedService:[],
  180. searchParams:{
  181. CurrentIndex:1,
  182. PageSize:10,
  183. Keyword:'',
  184. ServiceType:'',
  185. StartDate:startDate,
  186. EndDate:endDate,
  187. // 1-开票日期 2-到款日期 3-开票日期&到款日期
  188. TimeType:1,
  189. SortType:'',
  190. SortParam:'',
  191. },
  192. currentDateTab:0,
  193. searchDate:[startDate,endDate],
  194. tableData:[],
  195. total:0,
  196. invoiceAmountTotal:0,
  197. invoiceAmountList:[],
  198. placementAmountTotal:0,
  199. placementAmountList:[],
  200. invoiceIsFold:true,//开票合计是否收起
  201. placementIsFold:true,//到款合计是否收起
  202. domList:[]
  203. }
  204. },
  205. created(){
  206. this.getSimpleServiceList()
  207. this.getList()
  208. },
  209. watch:{
  210. searchDate(newVal){
  211. if(newVal){
  212. this.searchParams.StartDate=newVal[0]
  213. this.searchParams.EndDate=newVal[1]
  214. }else{
  215. this.searchParams.StartDate=''
  216. this.searchParams.EndDate=''
  217. }
  218. this.searchList()
  219. }
  220. },
  221. computed:{
  222. isAdmin(){
  223. return localStorage.getItem('Role').indexOf('admin')!=-1
  224. }
  225. },
  226. methods: {
  227. getSimpleServiceList(){
  228. customInterence.getSimpleServiceList().then(res=>{
  229. if(res.Ret!=200) return
  230. this.serviceList = res.Data || []
  231. // 后端最外层的数据没有给 service_template_id 删除tag时会报错,手动加
  232. this.serviceList.map((item,index) =>{
  233. item.service_template_id = 500+index
  234. })
  235. })
  236. },
  237. getList(){
  238. // console.log(this.searchParams);
  239. customInterence.getCTContractStatistics(this.searchParams).then(res=>{
  240. if(res.Ret!=200) return
  241. this.tableData=[]
  242. let tempData = res.Data.data_list || []
  243. this.total = res.Data.Paging.Totals
  244. this.invoiceAmountTotal=res.Data.invoice_total
  245. this.invoiceAmountList = res.Data.invoice_currency_total || []
  246. this.placementAmountTotal=res.Data.payment_total
  247. this.placementAmountList = res.Data.payment_currency_total || []
  248. tempData.map((item,index) =>{
  249. item.invoice_payment_list.map((it,ind) =>{
  250. this.tableData.push({
  251. serialNumber:this.searchParams.PageSize*(this.searchParams.CurrentIndex-1)+index+1,
  252. ...item,date:item.start_date+'至'+item.end_date,...it
  253. })
  254. })
  255. })
  256. })
  257. },
  258. searchList(){
  259. this.searchParams.CurrentIndex=1
  260. this.getList()
  261. },
  262. changePageNo(pageNo){
  263. this.searchParams.CurrentIndex = pageNo
  264. this.getList()
  265. },
  266. serviceChange(value){
  267. this.searchParams.ServiceType = value.join(',')
  268. this.searchList()
  269. },
  270. changeDateType({tabId,type,diff}){
  271. if(this.currentDateTab==tabId) return
  272. this.currentDateTab=tabId
  273. let startOfType='month'
  274. if(type=='week'){
  275. startOfType='isoWeek'
  276. }
  277. this.searchDate=[this.$moment().startOf(startOfType).subtract((diff-1), type+'s').format('YYYY-MM-DD'),
  278. this.$moment().format('YYYY-MM-DD')]
  279. },
  280. foldOrUnfold(type){
  281. if(this.tableData.length==0){
  282. return
  283. }
  284. // type: 0-开票 1-到款
  285. if(type){
  286. this.placementIsFold = !this.placementIsFold
  287. }else{
  288. this.invoiceIsFold = !this.invoiceIsFold
  289. }
  290. },
  291. sortChange({order,prop}){
  292. this.searchParams.SortType=order=='descending'?'desc':order=='ascending'?'asc':''
  293. this.searchParams.SortParam=order?prop:''
  294. this.searchList()
  295. },
  296. disabledCheck(e){
  297. if(!this.domList[e]) return true
  298. return this.domList[e].offsetWidth<=this.domList[e].parentNode.offsetWidth
  299. }
  300. },
  301. mounted(){
  302. this.$nextTick(()=>{
  303. this.domList=$('.company-name-span')
  304. // console.log(this.domList);
  305. })
  306. },
  307. updated(){
  308. this.domList=$('.company-name-span')
  309. // console.log(this.domList);
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .customer-statistics-container{
  315. min-height: calc(100vh - 110px);
  316. .search-zone{
  317. margin-bottom: 20px;
  318. padding: 20px 30px 12px;
  319. background-color: white;
  320. border-radius: 4px;
  321. .search-box{
  322. margin-left: -20px;
  323. display: flex;
  324. align-items: center;
  325. flex-wrap: wrap;
  326. .search-item{
  327. width: 232px;
  328. margin: 0 0 8px 20px;
  329. }
  330. .date-box{
  331. display: flex;
  332. align-items: center;
  333. margin: 0 0 8px 20px;
  334. .composition-button-tabs{
  335. white-space: nowrap;
  336. .date-button{
  337. height: 40px;
  338. color: #999999;
  339. border: 1px solid #DCDFE6;
  340. margin: 0;
  341. width: 60px;
  342. padding: 12px 6px;
  343. }
  344. .first-button{
  345. border-color: #DCDFE6;
  346. border-style: solid;
  347. border-width: 1px 0 1px 1px;
  348. border-radius: 4px 0 0 4px;
  349. }
  350. .inner-button{
  351. border: 1px solid #DCDFE6;
  352. border-radius: 0;
  353. }
  354. .last-button{
  355. border-color: #DCDFE6;
  356. border-style: solid;
  357. border-width: 1px 1px 1px 0;
  358. border-radius:0 4px 4px 0 ;
  359. }
  360. .selectTab{
  361. color:white;
  362. background-color: #409EFF;
  363. }
  364. }
  365. }
  366. }
  367. }
  368. .amount-show-zone{
  369. display: flex;
  370. align-items: flex-start;
  371. flex-wrap: wrap;
  372. margin-bottom: 10px;
  373. .amount-show-item{
  374. margin-bottom: 10px;
  375. background: #FFFFFF;
  376. // border: 1px solid #DCDFE6;
  377. // box-shadow: 0px 4px 12px rgba(153, 153, 153, 0.08);
  378. border-radius: 8px;
  379. width: 725px;
  380. box-sizing: border-box;
  381. .amount-item-head{
  382. transition: all 0.1s ease;
  383. display: flex;
  384. align-items: center;
  385. justify-content: space-between;
  386. .amount-item-head-title{
  387. font-weight: 600;
  388. font-size: 18px;
  389. color: #000000;
  390. }
  391. .fold-expand-row{
  392. display: flex;
  393. align-items: center;
  394. .amount-item-head-icon{
  395. font-weight: 400;
  396. font-size: 14px;
  397. color: #409EFF;
  398. margin-right: 4px;
  399. }
  400. }
  401. }
  402. .amount-item-body-package{
  403. overflow: hidden;
  404. transition: height 0.1s ease;
  405. .amount-item-body{
  406. padding: 6px 20px 16px;
  407. box-sizing: border-box;
  408. display: flex;
  409. align-items: center;
  410. justify-content: space-between;
  411. .amount-item-body-box{
  412. display: flex;
  413. align-items: center;
  414. width: 220px;
  415. .amount-item-body-info{
  416. display: flex;
  417. flex-direction: column;
  418. justify-content: space-between;
  419. span{
  420. font-weight: 400;
  421. font-size: 14px;
  422. color: #666666;
  423. margin-bottom: 2px;
  424. &:last-child{
  425. font-weight: 700;
  426. font-size: 16px;
  427. color: #333333;
  428. }
  429. }
  430. }
  431. }
  432. }
  433. }
  434. }
  435. }
  436. .table-zone{
  437. padding: 20px 30px 65px;
  438. background-color: white;
  439. border-radius: 4px;
  440. .company-name-column{
  441. max-width: 100%;
  442. display: inline-block;
  443. white-space: nowrap;
  444. overflow: hidden;
  445. text-overflow: ellipsis;
  446. }
  447. .table-noData{
  448. display: flex;
  449. flex-direction: column;
  450. align-items: center;
  451. justify-content: center;
  452. margin: 18vh 0;
  453. img{
  454. height: 110px;
  455. width: 136px;
  456. }
  457. span{
  458. font-weight: 400;
  459. font-size: 16px;
  460. color: #999999;
  461. }
  462. }
  463. }
  464. }
  465. </style>