detailsInfo.vue 24 KB

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