detailsInfo.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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="forms.totalAmount"></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="forms.unpaidAmount"></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="forms.paidAmount"></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 {
  166. // getList,
  167. getCorpsAll, gainUser, getCorpType, getAllgoods } from "@/api/basicData/salesOrder";
  168. import { getList,getKh,getSk,topList,getZd} from "@/api/tirePartsMall/salesManagement/saleOrder";
  169. import { pageStatistics, remove, addCorpType, customerList } from "@/api/basicData/customerTransactions";
  170. import { getDetails, getSellList } from "@/api/basicData/client";
  171. import { getList as getLists } from "@/api/collectionSettlement/index.js";
  172. import { getDetails as getDetail} from "@/api/tirePartsMall/basicData/customerInformation"
  173. import { validatenull } from "@/util/validate";
  174. export default {
  175. name: "index",
  176. data() {
  177. return {
  178. loading: false,
  179. loading2: false,
  180. form: {
  181. paidAmount:0,
  182. totalAmount:0,
  183. unpaidAmount:0,
  184. debitAmount: 0,
  185. deliveringAmount: 0,
  186. advancePayment: 0,
  187. balanceAmount: 0,
  188. settlmentAmount: 0
  189. },
  190. forms:{
  191. paidAmount:0,
  192. totalAmount:0,
  193. unpaidAmount:0,
  194. },
  195. page: {
  196. pageSize: 10,
  197. currentPage: 1,
  198. total: 0,
  199. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  200. },
  201. page2: {
  202. pageSize: 20,
  203. currentPage: 1,
  204. total: 0,
  205. pageSizes: [20]
  206. },
  207. activeName: "first",
  208. search: {},
  209. search2: {},
  210. sellOption: {},
  211. capitalOption: {},
  212. sellList: [],
  213. capitalList: [],
  214. corpsAddrList: [],
  215. pickerOptions: {
  216. shortcuts: [
  217. {
  218. text: '当天',
  219. onClick(picker) {
  220. const date = new Date();
  221. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  222. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  223. picker.$emit('pick', [start, end]);
  224. }
  225. },
  226. {
  227. text: '昨天',
  228. onClick(picker) {
  229. const date = new Date();
  230. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 0, 0, 0);
  231. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 23, 59, 59);
  232. picker.$emit('pick', [start, end]);
  233. }
  234. }, {
  235. text: '当月',
  236. onClick(picker) {
  237. const date = new Date();
  238. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  239. const end = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59);
  240. picker.$emit('pick', [start, end]);
  241. }
  242. }, {
  243. text: '当季',
  244. onClick(picker) {
  245. const date = new Date();
  246. const start = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3, 1, 0, 0, 0);
  247. const end = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3 + 3, 0, 23, 59, 59);
  248. picker.$emit('pick', [start, end]);
  249. }
  250. }, {
  251. text: '当年',
  252. onClick(picker) {
  253. const date = new Date();
  254. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  255. const end = new Date(date.getFullYear() + 1, 0, 0, 23, 59, 59);
  256. picker.$emit('pick', [start, end]);
  257. }
  258. }, {
  259. text: '最近一周',
  260. onClick(picker) {
  261. const date = new Date();
  262. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7, 0, 0, 0);
  263. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  264. picker.$emit('pick', [start, end]);
  265. }
  266. }, {
  267. text: '最近二周',
  268. onClick(picker) {
  269. const date = new Date();
  270. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 2, 0, 0, 0);
  271. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  272. picker.$emit('pick', [start, end]);
  273. }
  274. }, {
  275. text: '最近三周',
  276. onClick(picker) {
  277. const date = new Date();
  278. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 3, 0, 0, 0);
  279. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  280. picker.$emit('pick', [start, end]);
  281. }
  282. }]
  283. },
  284. };
  285. },
  286. props: {
  287. detailData: {
  288. type: Object
  289. }
  290. },
  291. filters: {
  292. nameFileter(val) {
  293. return validatenull(val) ? '-' : val
  294. }
  295. },
  296. async created() {
  297. this.sellOption = await this.getColumnData(
  298. this.getColumnName(277.3),
  299. sellOption
  300. );
  301. // this.getWorkDicts("order_status_pjjl").then(res => {
  302. // this.findObject(this.sellOption.column, "actualPaymentStatus").dicData = res.data.data;
  303. // this.findObject(this.sellOption.column, "status").dicData = res.data.data;
  304. // });
  305. this.capitalOption = await this.getColumnData(
  306. this.getColumnName(277.4),
  307. capitalOption
  308. );
  309. // this.sellOption.height = window.innerHeight - 330;
  310. console.log(this.detailData);
  311. if (this.detailData.id) {
  312. console.log('this.detailData.id');
  313. this.getDetail(this.detailData.id);
  314. }
  315. this.getAllWorkDicts()
  316. this.$refs.crud.dicInit()
  317. this.$refs.crud2.dicInit()
  318. },
  319. methods: {
  320. getAllWorkDicts() {
  321. getZd().then(res => {
  322. this.findObject(this.sellOption.column, "createUser").dicData = res.data.data.records;
  323. })
  324. // getCorpType({ corpType: 'KH' }).then(res => {
  325. // this.findObject(this.sellOption.column, "corpType").dicData = res.data.data
  326. // });
  327. // getAllgoods().then(res => {
  328. // this.findObject(this.sellOption.column, "cname").dicData = res.data.data
  329. // });
  330. // this.getWorkDicts("account").then(res => {
  331. // this.findObject(this.capitalOption.column, "account").dicData = res.data.data;
  332. // });
  333. console.log('22222');
  334. getKh().then(res=>{
  335. this.findObject(this.capitalOption.column, "corpName").dicData = res.data.data
  336. })
  337. getSk().then(res=>{
  338. this.findObject(this.capitalOption.column, "accountName").dicData = res.data.data.records
  339. })
  340. this.getWorkDicts("payment_Status").then(res => {
  341. this.findObject(this.capitalOption.column, "financeStatus").dicData = res.data.data;
  342. });
  343. topList().then(res=>{
  344. this.findObject(this.capitalOption.column, "salesCompanyName").dicData = res.data.data
  345. })
  346. },
  347. cellStyle() {
  348. return "padding:0;height:40px;";
  349. },
  350. searchCriteriaSwitch(type) {
  351. if (type) {
  352. this.sellOption.height = this.sellOption.height - 46;
  353. } else {
  354. this.sellOption.height = this.sellOption.height + 46;
  355. }
  356. this.$refs.crud.getTableHeight();
  357. },
  358. //点击搜索按钮触发
  359. searchChange(params, done) {
  360. this.page.currentPage = 1;
  361. this.onLoad(this.page, params);
  362. done();
  363. },
  364. refreshChange() {
  365. this.onLoad(this.page, this.search);
  366. },
  367. currentChange(val) {
  368. this.page.currentPage = val;
  369. },
  370. sizeChange(val) {
  371. this.page.currentPage = 1;
  372. this.page.pageSize = val;
  373. },
  374. onLoad(page, params = {}) {
  375. let data = this.deepClone(Object.assign(params, this.search));
  376. // data.billType = 'XS';
  377. // data.tradeType = 'YPJ';
  378. // if (data.businesDate) {
  379. // data.orderStartDate = data.businesDate[0];
  380. // data.orderEndDate = data.businesDate[1];
  381. // }
  382. // delete data.businesDate
  383. // data.corpId = this.detailData.id;
  384. this.loading = true;
  385. console.log(data);
  386. //id: id, status: '待确认,待发货,已发货,退款请核', bsType: 'XS'
  387. data.status = '待确认,待发货,已发货,退款请核'
  388. // this.search.storageId = this.search.storageName
  389. // this.search.createId = this.search.createUser
  390. // delete this.search.storageName
  391. params.createId = params.createUser
  392. params.storageId = params.storageName
  393. delete params.storageName
  394. delete params.createUser
  395. console.log(params);
  396. getList({ customerId: this.detailData.id, status: '待确认,待发货,已发货,退款请核', bsType: 'XS', current:page.currentPage,
  397. size:page.pageSize,...params})
  398. .then(res => {
  399. this.sellList = res.data.data.records ? res.data.data.records : [];
  400. this.page.total = res.data.data.total;
  401. })
  402. .finally(() => {
  403. this.loading = false;
  404. });
  405. },
  406. onLoad2(page, params = {}) {
  407. let data = this.deepClone(Object.assign(params, this.search2));
  408. if (data.settlementDate) {
  409. data.settlementStartDate = data.settlementDate[0];
  410. data.settlementEndDate = data.settlementDate[1];
  411. }
  412. delete data.settlementDate
  413. data.corpId = this.detailData.id;
  414. data.accountId = data.accountName
  415. data.salesCompanyId = data.salesCompanyName
  416. delete data.corpName
  417. delete data.accountName
  418. delete data.salesCompanyName
  419. this.loading = true;
  420. params = {
  421. current: page.currentPage,
  422. size: page.pageSize,
  423. billType: "SK",
  424. dc: 'd',
  425. ...data
  426. }
  427. getLists(params)
  428. .then(res => {
  429. this.capitalList = res.data.data.records ? res.data.data.records : [];
  430. this.page2.total = res.data.data.total;
  431. })
  432. .finally(() => {
  433. this.loading = false;
  434. });
  435. },
  436. searchCriteriaSwitch2(type) {
  437. if (type) {
  438. this.capitalOption.height = this.capitalOption.height - 46;
  439. } else {
  440. this.capitalOption.height = this.capitalOption.height + 46;
  441. }
  442. this.$refs.crud2.getTableHeight();
  443. },
  444. //点击搜索按钮触发
  445. searchChange2(params, done) {
  446. this.page2.currentPage = 1;
  447. this.onLoad2(this.page2, params);
  448. done();
  449. },
  450. refreshChange2() {
  451. this.onLoad2(this.page2, this.search2);
  452. },
  453. currentChange2(val) {
  454. this.page2.currentPage = val;
  455. },
  456. sizeChange2(val) {
  457. this.page2.currentPage = 1;
  458. this.page2.pageSize = val;
  459. },
  460. getDetail(id) {
  461. this.loading = true
  462. getDetail({ id: id })
  463. .then(res => {
  464. this.form = res.data.data;
  465. }).finally(() => {
  466. this.loading = false;
  467. });
  468. pageStatistics({ id: id })
  469. .then(res => {
  470. this.forms = res.data.data;
  471. this.corpsAddrList = res.data.data.corpsAddrList;
  472. })
  473. .finally(() => {
  474. this.loading = false;
  475. });
  476. },
  477. editCustomer() {
  478. this.$emit('editOpen', this.form, 2)
  479. },
  480. editOrder(row) {
  481. if (this.$store.getters.pjxsStatus) {
  482. return this.$alert("销售单已存在,请保存销售单再进行操作", "温馨提示", {
  483. confirmButtonText: "确定",
  484. type: "warning",
  485. callback: action => {
  486. console.log(action);
  487. }
  488. });
  489. }
  490. this.$router.push({
  491. path: '/salesOrder/index',
  492. query: { orderId: row.id },
  493. });
  494. },
  495. async saveColumn() {
  496. const inSave = await this.saveColumnData(
  497. this.getColumnName(277.3),
  498. this.sellOption
  499. );
  500. if (inSave) {
  501. this.$nextTick(() => {
  502. this.$refs.crud.doLayout();
  503. });
  504. this.$message.success("保存成功");
  505. //关闭窗口
  506. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  507. }
  508. },
  509. async resetColumn() {
  510. this.sellOption = sellOption;
  511. const inSave = await this.delColumnData(
  512. this.getColumnName(277.3),
  513. sellOption
  514. );
  515. if (inSave) {
  516. this.$nextTick(() => {
  517. this.$refs.crud.doLayout();
  518. });
  519. this.getAllWorkDicts()
  520. this.$message.success("重置成功");
  521. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  522. }
  523. },
  524. async saveColumn2() {
  525. const inSave = await this.saveColumnData(
  526. this.getColumnName(277.4),
  527. this.capitalOption
  528. );
  529. if (inSave) {
  530. this.$nextTick(() => {
  531. this.$refs.crud2.doLayout();
  532. });
  533. this.$message.success("保存成功");
  534. //关闭窗口
  535. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  536. }
  537. },
  538. async resetColumn2() {
  539. this.capitalOption = capitalOption;
  540. const inSave = await this.delColumnData(
  541. this.getColumnName(277.4),
  542. capitalOption
  543. );
  544. if (inSave) {
  545. this.$nextTick(() => {
  546. this.$refs.crud2.doLayout();
  547. });
  548. this.getAllWorkDicts()
  549. this.$message.success("重置成功");
  550. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  551. }
  552. },
  553. //返回列表
  554. backToList() {
  555. this.$emit("goBack");
  556. }
  557. }
  558. };
  559. </script>
  560. <style lang="scss" scoped>
  561. .page-crad ::v-deep .basic-container__card {
  562. height: 94.2vh;
  563. }
  564. .stat-td {
  565. text-align: center;
  566. position: relative;
  567. }
  568. .stat-img {
  569. width: 95%;
  570. height: 75px;
  571. }
  572. .stat-tip {
  573. position: absolute;
  574. left: 15px;
  575. top: 5px;
  576. .money {
  577. color: #fff;
  578. font-size: 28px;
  579. font-weight: 600;
  580. }
  581. .title {
  582. color: #fff;
  583. font-size: 14px;
  584. text-align: left;
  585. margin-top: 4px;
  586. }
  587. }
  588. .client_info {
  589. font-size: 14px;
  590. color: #333;
  591. line-height: 20px;
  592. margin-top: 10px;
  593. margin-bottom: 10px;
  594. }
  595. </style>