detailsInfo.vue 20 KB

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