detailsInfo.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button type="primary" size="small" @click="editCustomer">
  12. 编辑
  13. </el-button>
  14. </div>
  15. </div>
  16. </div>
  17. <containerTitle title="基础信息" style="margin-top: 60px"></containerTitle>
  18. <basic-container v-loading="loading">
  19. <span style="font-size: 18px;font-weight: 600;">{{ form.cname }}</span>
  20. <containerTitle title="应收款项" style="margin-top:5px"></containerTitle>
  21. <table border="0" width="100%" v-loading="loading">
  22. <tr>
  23. <td class="stat-td">
  24. <img src="@/assets/img/contractAmountBg.png" class="stat-img">
  25. <div class="stat-tip">
  26. <div class="money">
  27. <span style="font-size:20px;">¥</span>
  28. <avue-count-up :end="form.debitAmount"></avue-count-up>
  29. </div>
  30. <div class="title">合同金额</div>
  31. </div>
  32. </td>
  33. <td class="stat-td">
  34. <img src="@/assets/img/deliveredBg.png" class="stat-img">
  35. <div class="stat-tip">
  36. <div class="money">
  37. <span style="font-size:20px;">¥</span>
  38. <avue-count-up :end="form.deliveringAmount"></avue-count-up>
  39. </div>
  40. <div class="title">已送货</div>
  41. </div>
  42. </td>
  43. <td class="stat-td">
  44. <img src="@/assets/img/advanceCollectionBg.png" class="stat-img">
  45. <div class="stat-tip">
  46. <div class="money">
  47. <span style="font-size:20px;">¥</span>
  48. <avue-count-up :end="form.advancePayment"></avue-count-up>
  49. </div>
  50. <div class="title">预收款</div>
  51. </div>
  52. </td>
  53. <td class="stat-td">
  54. <img src="@/assets/img/uncollectedBg.png" class="stat-img">
  55. <div class="stat-tip">
  56. <div class="money">
  57. <span style="font-size:20px;">¥</span>
  58. <avue-count-up :end="form.balanceAmount"></avue-count-up>
  59. </div>
  60. <div class="title">未收款</div>
  61. </div>
  62. </td>
  63. <td class="stat-td">
  64. <img src="@/assets/img/receivableBg.png" class="stat-img">
  65. <div class="stat-tip">
  66. <div class="money">
  67. <span style="font-size:20px;">¥</span>
  68. <avue-count-up :end="form.settlmentAmount"></avue-count-up>
  69. </div>
  70. <div class="title">已收款</div>
  71. </div>
  72. </td>
  73. </tr>
  74. </table>
  75. </basic-container>
  76. <containerTitle title="明细信息"></containerTitle>
  77. <basic-container v-loading="loading">
  78. <el-tabs v-model="activeName">
  79. <el-tab-pane label="销售记录" name="first">
  80. <avue-crud ref="crud" :option="sellOption" :data="sellList" :page.sync="page" :search.sync="search"
  81. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  82. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading"
  83. @saveColumn="saveColumn" @resetColumn="resetColumn" :cell-style="cellStyle"
  84. @search-criteria-switch="searchCriteriaSwitch">
  85. <template slot="menuLeft">
  86. <!-- <el-button type="primary" size="mini">新建销售单
  87. </el-button> -->
  88. <el-button size="mini">收款
  89. </el-button>
  90. <el-button size="mini">送货
  91. </el-button>
  92. </template>
  93. <template slot="corpIdSearch">
  94. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  95. </template>
  96. <template slot-scope="{ row, index }" slot="corpId">
  97. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.corpsName
  98. }}
  99. </span>
  100. </template>
  101. <template slot="businesDateSearch">
  102. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期"
  103. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  104. :default-time="['00:00:00', '23:59:59']" :picker-options="pickerOptions">
  105. </el-date-picker>
  106. </template>
  107. </avue-crud>
  108. </el-tab-pane>
  109. <el-tab-pane label="资金往来" name="second">
  110. <avue-crud ref="crud2" :option="capitalOption" :data="capitalList" :page.sync="page2"
  111. :search.sync="search2" @search-change="searchChange2" @current-change="currentChange2"
  112. @size-change="sizeChange2" @refresh-change="refreshChange2" @on-load="onLoad2"
  113. :table-loading="loading2" @saveColumn="saveColumn2" @resetColumn="resetColumn2"
  114. :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch2">
  115. <template slot="menuLeft">
  116. <el-button size="mini">收款
  117. </el-button>
  118. </template>
  119. <template slot="settlementDateSearch">
  120. <el-date-picker v-model="search2.settlementDate" type="daterange" start-placeholder="开始日期"
  121. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  122. :default-time="['00:00:00', '23:59:59']" :picker-options="pickerOptions">
  123. </el-date-picker>
  124. </template>
  125. </avue-crud>
  126. </el-tab-pane>
  127. <el-tab-pane label="客户信息" name="third">
  128. <div style="display:flex;justify-content: flex-end;">
  129. <el-button size="mini">禁用</el-button>
  130. <el-button type="primary" size="mini">打印</el-button>
  131. </div>
  132. <el-row class="client_info">
  133. <el-col :span="4">客户名称</el-col>
  134. <el-col :span="4">{{ form.cname | nameFileter }}</el-col>
  135. <el-col :span="4">期初欠款</el-col>
  136. <el-col :span="4">{{ form.arrears | nameFileter }}</el-col>
  137. <el-col :span="4">电话</el-col>
  138. <el-col :span="4">{{ form.tel | nameFileter }}</el-col>
  139. </el-row>
  140. <el-row class="client_info">
  141. <el-col :span="4">备用电话</el-col>
  142. <el-col :span="4">{{ form.telephone | nameFileter }}</el-col>
  143. <el-col :span="4">传真</el-col>
  144. <el-col :span="4">{{ form.fax | nameFileter }}</el-col>
  145. <el-col :span="4">邮箱</el-col>
  146. <el-col :span="4">{{ form.mailbox | nameFileter }}</el-col>
  147. </el-row>
  148. <el-row class="client_info">
  149. <el-col :span="4">备注</el-col>
  150. <el-col :span="20">{{ form.remarks | nameFileter }}</el-col>
  151. </el-row>
  152. <el-row class="client_info" v-for="(item, index) in corpsAddrList" :key="index">
  153. <el-col :span="2"><i class="el-icon-location"></i></el-col>
  154. <el-col :span="4">送货地址</el-col>
  155. <el-col :span="18">{{ item.detailedAddress }}</el-col>
  156. </el-row>
  157. </el-tab-pane>
  158. </el-tabs>
  159. </basic-container>
  160. </div>
  161. </template>
  162. <script>
  163. import { optionList, sellOption, capitalOption } from "./js/optionList";
  164. import { getList, getCorpsAll, gainUser, getCorpType, getAllgoods } from "@/api/basicData/salesOrder";
  165. import { getDetails,getSellList } from "@/api/basicData/client";
  166. import { validatenull } from "@/util/validate";
  167. export default {
  168. name: "index",
  169. data() {
  170. return {
  171. loading: false,
  172. loading2: false,
  173. form: {
  174. debitAmount: 0,
  175. deliveringAmount: 0,
  176. advancePayment: 0,
  177. balanceAmount: 0,
  178. settlmentAmount: 0
  179. },
  180. page: {
  181. pageSize: 10,
  182. currentPage: 1,
  183. total: 0,
  184. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  185. },
  186. page2: {
  187. pageSize: 20,
  188. currentPage: 1,
  189. total: 0,
  190. pageSizes: [20]
  191. },
  192. activeName: "first",
  193. search: {},
  194. search2: {},
  195. sellOption: {},
  196. capitalOption: {},
  197. sellList: [],
  198. capitalList: [],
  199. corpsAddrList: [],
  200. pickerOptions: {
  201. shortcuts: [
  202. {
  203. text: '当天',
  204. onClick(picker) {
  205. const date = new Date();
  206. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  207. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  208. picker.$emit('pick', [start, end]);
  209. }
  210. },
  211. {
  212. text: '昨天',
  213. onClick(picker) {
  214. const date = new Date();
  215. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 0, 0, 0);
  216. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 23, 59, 59);
  217. picker.$emit('pick', [start, end]);
  218. }
  219. }, {
  220. text: '当月',
  221. onClick(picker) {
  222. const date = new Date();
  223. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  224. const end = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59);
  225. picker.$emit('pick', [start, end]);
  226. }
  227. }, {
  228. text: '当季',
  229. onClick(picker) {
  230. const date = new Date();
  231. const start = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3, 1, 0, 0, 0);
  232. const end = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3 + 3, 0, 23, 59, 59);
  233. picker.$emit('pick', [start, end]);
  234. }
  235. }, {
  236. text: '当年',
  237. onClick(picker) {
  238. const date = new Date();
  239. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  240. const end = new Date(date.getFullYear() + 1, 0, 0, 23, 59, 59);
  241. picker.$emit('pick', [start, end]);
  242. }
  243. }, {
  244. text: '最近一周',
  245. onClick(picker) {
  246. const date = new Date();
  247. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7, 0, 0, 0);
  248. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  249. picker.$emit('pick', [start, end]);
  250. }
  251. }, {
  252. text: '最近二周',
  253. onClick(picker) {
  254. const date = new Date();
  255. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 2, 0, 0, 0);
  256. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  257. picker.$emit('pick', [start, end]);
  258. }
  259. }, {
  260. text: '最近三周',
  261. onClick(picker) {
  262. const date = new Date();
  263. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 3, 0, 0, 0);
  264. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  265. picker.$emit('pick', [start, end]);
  266. }
  267. }]
  268. },
  269. };
  270. },
  271. props: {
  272. detailData: {
  273. type: Object
  274. }
  275. },
  276. filters: {
  277. nameFileter(val) {
  278. return validatenull(val) ? '-' : val
  279. }
  280. },
  281. async created() {
  282. this.sellOption = await this.getColumnData(
  283. this.getColumnName(208.1),
  284. sellOption
  285. );
  286. this.capitalOption = await this.getColumnData(
  287. this.getColumnName(223),
  288. capitalOption
  289. );
  290. // this.sellOption.height = window.innerHeight - 330;
  291. if (this.detailData.id) {
  292. this.getDetail(this.detailData.id);
  293. }
  294. this.getAllWorkDicts()
  295. },
  296. methods: {
  297. getAllWorkDicts() {
  298. gainUser().then(res => {
  299. this.findObject(this.sellOption.column, "createUser").dicData = res.data.data;
  300. })
  301. getCorpType({ corpType: 'KH' }).then(res => {
  302. this.findObject(this.sellOption.column, "corpType").dicData = res.data.data
  303. });
  304. getAllgoods().then(res => {
  305. this.findObject(this.sellOption.column, "cname").dicData = res.data.data
  306. });
  307. this.getWorkDicts("account").then(res => {
  308. this.findObject(this.capitalOption.column, "account").dicData = res.data.data;
  309. });
  310. },
  311. cellStyle() {
  312. return "padding:0;height:40px;";
  313. },
  314. searchCriteriaSwitch(type) {
  315. if (type) {
  316. this.sellOption.height = this.sellOption.height - 46;
  317. } else {
  318. this.sellOption.height = this.sellOption.height + 46;
  319. }
  320. this.$refs.crud.getTableHeight();
  321. },
  322. //点击搜索按钮触发
  323. searchChange(params, done) {
  324. this.page.currentPage = 1;
  325. this.onLoad(this.page, params);
  326. done();
  327. },
  328. refreshChange() {
  329. this.onLoad(this.page, this.search);
  330. },
  331. currentChange(val) {
  332. this.page.currentPage = val;
  333. },
  334. sizeChange(val) {
  335. this.page.currentPage = 1;
  336. this.page.pageSize = val;
  337. },
  338. onLoad(page, params = {}) {
  339. let data = this.deepClone(Object.assign(params, this.search));
  340. data.billType = 'XS';
  341. data.tradeType = 'YPJ';
  342. if (data.businesDate) {
  343. data.orderStartDate = data.businesDate[0];
  344. data.orderEndDate = data.businesDate[1];
  345. }
  346. delete data.businesDate
  347. data.corpId = this.detailData.id;
  348. this.loading = true;
  349. getList(
  350. page.currentPage,
  351. page.pageSize,
  352. data
  353. )
  354. .then(res => {
  355. this.sellList = res.data.data.records ? res.data.data.records : [];
  356. this.page.total = res.data.data.total;
  357. })
  358. .finally(() => {
  359. this.loading = false;
  360. });
  361. },
  362. onLoad2(page, params = {}) {
  363. let data = this.deepClone(Object.assign(params, this.search2));
  364. if (data.settlementDate) {
  365. data.settlementStartDate = data.settlementDate[0];
  366. data.settlementEndDate = data.settlementDate[1];
  367. }
  368. delete data.settlementDate
  369. data.corpId = this.detailData.id;
  370. this.loading = true;
  371. getSellList(
  372. page.currentPage,
  373. page.pageSize,
  374. data
  375. )
  376. .then(res => {
  377. this.capitalList = res.data.data.records ? res.data.data.records : [];
  378. this.page2.total = res.data.data.total;
  379. })
  380. .finally(() => {
  381. this.loading = false;
  382. });
  383. },
  384. searchCriteriaSwitch2(type) {
  385. if (type) {
  386. this.capitalOption.height = this.capitalOption.height - 46;
  387. } else {
  388. this.capitalOption.height = this.capitalOption.height + 46;
  389. }
  390. this.$refs.crud2.getTableHeight();
  391. },
  392. //点击搜索按钮触发
  393. searchChange2(params, done) {
  394. this.page2.currentPage = 1;
  395. this.onLoad2(this.page2, params);
  396. done();
  397. },
  398. refreshChange2() {
  399. this.onLoad2(this.page2, this.search2);
  400. },
  401. currentChange2(val) {
  402. this.page2.currentPage = val;
  403. },
  404. sizeChange2(val) {
  405. this.page2.currentPage = 1;
  406. this.page2.pageSize = val;
  407. },
  408. getDetail(id) {
  409. this.loading = true
  410. getDetails({ id: id })
  411. .then(res => {
  412. this.form = res.data.data;
  413. this.corpsAddrList = res.data.data.corpsAddrList;
  414. })
  415. .finally(() => {
  416. this.loading = false;
  417. });
  418. },
  419. editCustomer(){
  420. this.$emit('editOpen',this.form,1)
  421. },
  422. async saveColumn() {
  423. const inSave = await this.saveColumnData(
  424. this.getColumnName(208.1),
  425. this.sellOption
  426. );
  427. if (inSave) {
  428. this.$nextTick(() => {
  429. this.$refs.crud.doLayout();
  430. });
  431. this.$message.success("保存成功");
  432. //关闭窗口
  433. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  434. }
  435. },
  436. async resetColumn() {
  437. this.sellOption = sellOption;
  438. const inSave = await this.delColumnData(
  439. this.getColumnName(208.1),
  440. sellOption
  441. );
  442. if (inSave) {
  443. this.$nextTick(() => {
  444. this.$refs.crud.doLayout();
  445. });
  446. this.getAllWorkDicts()
  447. this.$message.success("重置成功");
  448. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  449. }
  450. },
  451. async saveColumn2() {
  452. const inSave = await this.saveColumnData(
  453. this.getColumnName(223),
  454. this.capitalOption
  455. );
  456. if (inSave) {
  457. this.$nextTick(() => {
  458. this.$refs.crud2.doLayout();
  459. });
  460. this.$message.success("保存成功");
  461. //关闭窗口
  462. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  463. }
  464. },
  465. async resetColumn2() {
  466. this.capitalOption = capitalOption;
  467. const inSave = await this.delColumnData(
  468. this.getColumnName(223),
  469. capitalOption
  470. );
  471. if (inSave) {
  472. this.$nextTick(() => {
  473. this.$refs.crud2.doLayout();
  474. });
  475. this.getAllWorkDicts()
  476. this.$message.success("重置成功");
  477. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  478. }
  479. },
  480. //返回列表
  481. backToList() {
  482. this.$emit("goBack");
  483. }
  484. }
  485. };
  486. </script>
  487. <style lang="scss" scoped>
  488. .page-crad ::v-deep .basic-container__card {
  489. height: 94.2vh;
  490. }
  491. .stat-td {
  492. text-align: center;
  493. position: relative;
  494. }
  495. .stat-img {
  496. width: 95%;
  497. height: 75px;
  498. }
  499. .stat-tip {
  500. position: absolute;
  501. left: 15px;
  502. top: 5px;
  503. .money {
  504. color: #fff;
  505. font-size: 28px;
  506. font-weight: 600;
  507. }
  508. .title {
  509. color: #fff;
  510. font-size: 14px;
  511. text-align: left;
  512. margin-top: 4px;
  513. }
  514. }
  515. .client_info {
  516. font-size: 14px;
  517. color: #333;
  518. line-height: 20px;
  519. margin-top: 10px;
  520. margin-bottom: 10px;
  521. }
  522. </style>