purchaseTotal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <div class="purchaseTotal">
  3. <div class="bar-title" style="overflow: hidden;">
  4. <span style="font-size: 16px; font-weight: bold; color: #000"
  5. >申购统计</span
  6. >
  7. <Poptip placement="bottom">
  8. <Icon type="ios-alert-outline" size="20" style="margin:0 10px 0 5px;position: relative;top:-3px" />
  9. <div class="api" slot="content" style="padding:10px">
  10. 取申购审批通过,生成合同后的数据;<br>
  11. 合同未质检取合同金额,已质检取质检金额
  12. </div>
  13. </Poptip>
  14. <span v-if="this.params.beginTime">({{(this.params.beginTime ? this.params.beginTime.slice(0,11) : '') + '-' + (this.params.endTime ? this.params.endTime.slice(0,11) : '')}})</span>
  15. <date-select v-model="params" @change="selectTime"></date-select>
  16. </div>
  17. <div class="total-header" style="padding-top:10px">
  18. <div class="card-warp" style="width: 13.5%; margin-right: 1%">
  19. <Card dis-hover style="color:#3f92f9;font-weight: bold;">
  20. <div>申购金额</div>
  21. <div class="big-num" style="color:#3f92f9;font-weight: bold;">{{totalData.money[0]}}</div>
  22. </Card>
  23. </div>
  24. <div class="card-warp" style="width: 38.5%; margin-right: 1%">
  25. <Card dis-hover>
  26. <ul>
  27. <li>
  28. <div>面料采购</div>
  29. <div class="big-num">{{totalData.money[1]}}</div>
  30. </li>
  31. <li>
  32. <div>墨水采购</div>
  33. <div class="big-num">{{totalData.money[2]}}</div>
  34. </li>
  35. <li>
  36. <div>其他</div>
  37. <div class="big-num">{{totalData.money[3]}}</div>
  38. </li>
  39. </ul>
  40. </Card>
  41. </div>
  42. <div class="card-warp" style="width: 46%">
  43. <Card dis-hover>
  44. <ul>
  45. <li style="width: 25%">
  46. <div>45天账期</div>
  47. <div class="big-num">{{totalData.money[4]}}</div>
  48. </li>
  49. <li style="width: 25%">
  50. <div>30天账期</div>
  51. <div class="big-num">{{totalData.money[5]}}</div>
  52. </li>
  53. <li style="width: 25%">
  54. <div>15天账期</div>
  55. <div class="big-num">{{totalData.money[6]}}</div>
  56. </li>
  57. <li style="width: 25%">
  58. <div>预付款</div>
  59. <div class="big-num">{{totalData.money[7]}}</div>
  60. </li>
  61. </ul>
  62. </Card>
  63. </div>
  64. </div>
  65. <div style="background: #fff; padding: 10px; margin: 10px 0">
  66. <Tabs v-model="salesVolumeCompanyTotalType" @on-click="tabsChange">
  67. <TabPane
  68. :label="
  69. (h) => {
  70. return h('div', [
  71. h('span', companyMoneyName[index] + '('),
  72. h(
  73. 'span',
  74. { style: { color: 'red' } },
  75. i.length
  76. ),
  77. h('span', ')'),
  78. ])
  79. }
  80. "
  81. :name="index"
  82. v-for="(i,index) in totalData.statisticsSupplier" :key="index"
  83. ></TabPane>
  84. </Tabs>
  85. <div>
  86. <Button
  87. style="margin: 0 10px 5px 0"
  88. :type="
  89. params.supplierId == null ? 'primary' : 'default'
  90. "
  91. @click="changeCompany(null, 0)"
  92. >全部</Button
  93. >
  94. <Button
  95. style="margin: 0 10px 5px 0"
  96. @click="changeCompany(i.supplierId, index)"
  97. v-for="(i, index) in company"
  98. :type="
  99. params.supplierId == i.supplierId
  100. ? 'primary'
  101. : 'default'
  102. "
  103. :key="i.supplierId"
  104. >
  105. {{ i.supplierName
  106. }}<span
  107. :style="
  108. params.supplierId == i.supplierId
  109. ? 'color:#ffc107'
  110. : 'color:red'
  111. "
  112. >
  113. ({{ i.money }})</span
  114. >
  115. </Button>
  116. </div>
  117. </div>
  118. <div class="table">
  119. <Table :columns="columns" :data="listData"></Table>
  120. <div style="text-align:center;margin-top:10px">
  121. <Page
  122. :current="params.pageNum"
  123. :total="params.total"
  124. :page-size="params.pageSize"
  125. :show-total="true"
  126. show-elevator
  127. @on-change="changePage"
  128. />
  129. </div>
  130. </div>
  131. </div>
  132. </template>
  133. <script>
  134. import { exportExcel } from '@/libs/util'
  135. import dateSelect from '@/components/dateSelect/dateSelect'
  136. import axios from 'axios'
  137. export default {
  138. name: 'test',
  139. components:{
  140. dateSelect
  141. },
  142. data() {
  143. return {
  144. topIndex: '',
  145. dataArea: [],
  146. dataArea2:null,
  147. beginTime: '',
  148. endTime: '',
  149. dateTabIndex: 0,
  150. dateTabs: [
  151. { label: '本日' },
  152. { label: '本周' },
  153. { label: '本月' },
  154. { label: '今年' },
  155. ],
  156. company:[],
  157. companyMoneyName:[
  158. '全部',
  159. '50万以上',
  160. '20-50万',
  161. '10-20万',
  162. '5-10万',
  163. '5万以下'
  164. ],
  165. id: '',
  166. selectList: [],
  167. formData: {},
  168. storeType: '',
  169. show: false,
  170. listData: [],
  171. columns: [
  172. {
  173. title: '序号',
  174. type: 'index',
  175. width: 60,
  176. align: 'center',
  177. },
  178. {
  179. title: '供应商',
  180. key: 'supplierName',
  181. minWidth: 150,
  182. },
  183. {
  184. title: '合同编码',
  185. key: 'contractCode',
  186. minWidth: 150,
  187. sortable: true,
  188. },
  189. {
  190. title: '物料名称',
  191. key: 'materialName',
  192. minWidth: 200,
  193. sortable: true,
  194. },
  195. {
  196. title: '采购数量',
  197. key: 'quantity',
  198. minWidth: 100,
  199. },
  200. {
  201. title: '单价',
  202. key: 'price',
  203. minWidth: 100,
  204. },
  205. {
  206. title: '合同金额',
  207. key: 'totalAmount',
  208. minWidth: 100,
  209. },
  210. {
  211. title: '质检金额',
  212. key: 'adjustAmount',
  213. minWidth: 100,
  214. },
  215. {
  216. title: '审批时间',
  217. key: 'approvalTime',
  218. minWidth: 100,
  219. },
  220. ],
  221. salesVolumeCompanyTotalType:null,
  222. params: {
  223. pageNum: 1,
  224. pageSize: 10,
  225. total: 0,
  226. supplierId:null,
  227. beginTime:null,
  228. endTime:null,
  229. },
  230. totalData:{
  231. statisticsSupplier:[],
  232. money:{0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0},
  233. },
  234. }
  235. },
  236. methods: {
  237. selectTime(){
  238. this.params.supplierId = null
  239. this.getList()
  240. this.getTotal()
  241. },
  242. changeCompany(_id){
  243. this.params.supplierId = _id
  244. this.params.pageNum = 1
  245. this.getList()
  246. },
  247. tabsChange(_index){
  248. console.log(this.totalData.statisticsSupplier)
  249. this.company = this.totalData.statisticsSupplier[_index]
  250. },
  251. topTabClick(index) {
  252. if (index === this.topIndex) {
  253. this.topIndex = ''
  254. this.params.stockTagType = ''
  255. } else {
  256. this.topIndex = index
  257. this.params.stockTagType = index
  258. }
  259. this.params.pageNum = 1
  260. this.getList()
  261. },
  262. dateClick2(date){
  263. const dateDayNum = new Date(date).getDate()
  264. const dateMonthNum = new Date(date).getMonth()
  265. const dateYearNum = new Date(date).getFullYear()
  266. this.beginTime = dateYearNum + '-' + dateMonthNum + '-1'
  267. this.endTime = dateYearNum + '-' + dateMonthNum + '-' + new Date(dateYearNum, (dateMonthNum * 1 + 2), 0).getDate()
  268. this.dataArea = []
  269. this.getList()
  270. this.getTotal()
  271. },
  272. dateClick(date) {
  273. this.beginTime = date[0]
  274. this.endTime = date[1]
  275. this.dataArea2 = null
  276. this.getList()
  277. this.getTotal()
  278. },
  279. /* 选项卡切换 */
  280. dateTabToggle(index) {
  281. this.params.pageNum = 1
  282. this.dateTabIndex = index
  283. this.params.supplierIdList = ''
  284. this.params.supplierIdListCopy = ''
  285. this.salesVolumeCompanyTotalType = null
  286. this.dataArea2 = null
  287. if (index === 0) {
  288. let time = new Date().getTime()
  289. this.beginTime = this.$dayjs(time).format('YYYY-MM-DD HH:mm:ss')
  290. this.endTime = this.$dayjs(time).format('YYYY-MM-DD HH:mm:ss')
  291. this.dataArea = [this.beginTime, this.endTime]
  292. } else if (index === 1) {
  293. let Nowdate = new Date()
  294. let WeekFirstDay = Nowdate.getDay()
  295. ? new Date(Nowdate - (Nowdate.getDay() - 1) * 86400000)
  296. : new Date(Nowdate - (Nowdate.getDay() + 6) * 86400000)
  297. let WeekLastDay = new Date(
  298. (WeekFirstDay / 1000 + 6 * 86400) * 1000
  299. )
  300. this.beginTime = this.$dayjs(WeekFirstDay).format(
  301. 'YYYY-MM-DD HH:mm:ss'
  302. )
  303. this.endTime = this.$dayjs(WeekLastDay).format(
  304. 'YYYY-MM-DD HH:mm:ss'
  305. )
  306. this.dataArea = [this.beginTime, this.endTime]
  307. } else if (index === 2) {
  308. let now = new Date() // 当前日期
  309. let nowMonth = now.getMonth() // 当前月
  310. let nowYear = now.getFullYear() // 当前年
  311. // 本月的开始时间
  312. let monthStartDate = new Date(nowYear, nowMonth, 1)
  313. // 本月的结束时间
  314. let monthEndDate = new Date(nowYear, nowMonth + 1, 0)
  315. this.beginTime = this.$dayjs(monthStartDate).format(
  316. 'YYYY-MM-DD HH:mm:ss'
  317. )
  318. this.endTime = this.$dayjs(monthEndDate).format(
  319. 'YYYY-MM-DD HH:mm:ss'
  320. )
  321. this.dataArea = [this.beginTime, this.endTime]
  322. } else if (index === 3) {
  323. let now = new Date() // 当前日期
  324. let nowYear = now.getFullYear() // 当前年
  325. // 本年的开始时间
  326. let monthStartDate = new Date(nowYear, 0, 1)
  327. // 本年的结束时间
  328. let monthEndDate = new Date(nowYear, 11, 31)
  329. this.beginTime = this.$dayjs(monthStartDate).format(
  330. 'YYYY-MM-DD HH:mm:ss'
  331. )
  332. this.endTime = this.$dayjs(monthEndDate).format(
  333. 'YYYY-MM-DD HH:mm:ss'
  334. )
  335. this.dataArea = [this.beginTime, this.endTime]
  336. }
  337. this.getList()
  338. this.getTotal()
  339. },
  340. changePage(pageNum) {
  341. this.params.pageNum = pageNum
  342. this.getList()
  343. },
  344. getList() {
  345. this.$Spin.show()
  346. this.$post('/api/storage-restructure/applyPurchase/amountPage',{
  347. ...this.params,
  348. }).then(res=>{
  349. console.log(res)
  350. this.listData = res.data.records
  351. this.params.total = res.data.total
  352. this.$Spin.hide()
  353. })
  354. },
  355. getTotal(){
  356. this.$post('/api/storage-restructure/applyPurchase/amountStatistics',{
  357. ...this.params,
  358. }).then(res=>{
  359. this.totalData = res.data
  360. this.company = this.totalData.statisticsSupplier[0]
  361. this.$Spin.hide()
  362. })
  363. },
  364. },
  365. mounted() {
  366. this.getList()
  367. this.getTotal()
  368. },
  369. }
  370. </script>
  371. <style lang="less">
  372. .purchaseTotal {
  373. .big-num{
  374. font-size: 20px;
  375. font-weight: bold;
  376. color: #000;
  377. }
  378. .total-header {
  379. display: flex;
  380. margin-top: 10px;
  381. .card-warp {
  382. line-height: 30px;
  383. text-align: center;
  384. ul {
  385. display: flex;
  386. li {
  387. list-style: none;
  388. width: 33.3%;
  389. text-align: center;
  390. color:#666;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. .date-filter-wrap {
  397. display: flex;
  398. align-items: center;
  399. .date-filter {
  400. width: 300px;
  401. overflow: hidden;
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: center;
  405. background-color: #ffffff;
  406. border-radius: 4px;
  407. &.other {
  408. width: auto;
  409. .date-tab {
  410. white-space: nowrap;
  411. padding: 9px;
  412. .num {
  413. font-weight: bold;
  414. font-size: 14px;
  415. &.red {
  416. color: red;
  417. cursor: pointer;
  418. text-decoration: underline;
  419. }
  420. }
  421. &.active {
  422. background-color: #333333;
  423. }
  424. }
  425. }
  426. .date-tab {
  427. flex: 1;
  428. padding: 9px 4px;
  429. line-height: 1;
  430. text-align: center;
  431. border: 1px solid #e6e6e6;
  432. border-radius: 2px;
  433. border-right: none;
  434. cursor: pointer;
  435. font-weight: 500;
  436. &:first-child {
  437. border-radius: 4px 0 0 4px;
  438. }
  439. &:last-child {
  440. border-radius: 0 4px 4px 0;
  441. border-right: 1px solid #e6e6e6;
  442. }
  443. &.active {
  444. background-color: #3f92f9;
  445. color: #ffffff;
  446. }
  447. }
  448. }
  449. }
  450. </style>