detail.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <el-col :xs="24" :sm="24" :md="10" :lg="10" :xl="12">
  5. <div class="grid-content bg-purple">
  6. <span style="font-weight: 600">合同基础信息</span>
  7. <div class="titlein">
  8. <span class="titlename">合同名称</span>
  9. <span class="meatatitle">{{ contract.name }}</span>
  10. </div>
  11. <div class="titlein">
  12. <span class="titlename">合同编号</span>
  13. <span class="meatatitle">{{ contract.contractNo }}</span>
  14. </div>
  15. <div class="titlein">
  16. <span class="titlename">合同附件</span>
  17. <div style="display: flex">
  18. <div class="imgbox">
  19. <FileShow :files="contract.picList" />
  20. </div>
  21. </div>
  22. </div>
  23. <div class="titlein">
  24. <span class="titlename">发票附件</span>
  25. <div style="display: flex">
  26. <div class="imgbox">
  27. <FileShow :files="contract.invoicePicList" />
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </el-col>
  33. <el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="12">
  34. <div class="jas">
  35. <div class="titlein jas">
  36. <span class="titlename">贸易合同</span>
  37. <div style="display: flex">
  38. <div class="imgbox">
  39. <FileShow :files="contract.tradePicList" />
  40. </div>
  41. </div>
  42. </div>
  43. <div class="yusa jas">
  44. <div class="boxas">
  45. <span style="color: #fff">合同状态:</span>
  46. <span style="color: #d05c39">{{
  47. contract.contractStatusText
  48. }}</span>
  49. </div>
  50. <span class="aoiisp"
  51. >审核结果:
  52. <p style="color: #d8ab5a">{{ contract.statusText }}</p></span
  53. >
  54. </div>
  55. <!-- 审核反馈和审核截图框 -->
  56. <div class="yusa">
  57. <el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="10" class="jas">
  58. <el-form ref="form" :model="contract" label-width="0px">
  59. <span class="sah">审核反馈:</span>
  60. <el-form-item label="">
  61. <el-input
  62. v-permission="['salesman', 'admin']"
  63. v-model="contract.feedback"
  64. type="textarea"
  65. />
  66. <div v-permission="['supplier']">{{ contract.feedback }}</div>
  67. </el-form-item>
  68. </el-form>
  69. </el-col>
  70. <el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="14" class="jas">
  71. <span class="sah">审核截图:</span>
  72. <div style="display: flex; justify-content: flex-end">
  73. <div class="imgbox">
  74. <FileUpload
  75. v-permission="['salesman', 'admin']"
  76. v-model="contract.feedbackPics"
  77. accept=".jpg, .jpeg, .png, .pdf"
  78. />
  79. <FileShow
  80. v-permission="['supplier']"
  81. :files="contract.feedbackPics"
  82. />
  83. </div>
  84. </div>
  85. </el-col>
  86. </div>
  87. <div slot="" class="clearfix">
  88. <!-- <el-button
  89. type="primary"
  90. style="float: right; margin-left: 10px"
  91. >导出
  92. </el-button> -->
  93. <el-button
  94. v-if="contract.status !== 0 && contract.contractStatus === 0"
  95. type="danger"
  96. style="float: right"
  97. @click="deletedContract"
  98. >删除</el-button
  99. >
  100. <el-button
  101. v-if="contract.contractStatus === 1"
  102. type="primary"
  103. style="float: right"
  104. @click="recoverContract"
  105. >恢复
  106. </el-button>
  107. <el-button
  108. v-permission="['salesman', 'admin']"
  109. type="warning"
  110. style="float: right"
  111. @click="failed"
  112. >审核失败
  113. </el-button>
  114. <el-button
  115. v-permission="['salesman', 'admin']"
  116. type="success"
  117. style="float: right"
  118. @click="success"
  119. >审核成功
  120. </el-button>
  121. </div>
  122. </div>
  123. </el-col>
  124. </el-card>
  125. <el-card class="box-card">
  126. <el-table
  127. :row-key="getRowKey"
  128. v-loading="listLoading"
  129. :data="temporaryList"
  130. element-loading-text="Loading"
  131. border
  132. fit
  133. highlight-current-row
  134. @select="handleSelectionChange"
  135. @select-all="handleAll"
  136. >
  137. <el-table-column align="center" label="" width="55" type="selection" :reserve-selection="true" />
  138. <el-table-column label="汇票名称" align="center" prop="name" />
  139. <el-table-column label="汇票编号" align="center" prop="draftNo" />
  140. <el-table-column label="承兑人" align="center" prop="acceptorName" />
  141. <el-table-column label="金额" align="center">
  142. <template slot-scope="scope">
  143. {{ scope.row.money }}
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="服务费" align="center">
  147. <template slot-scope="scope">
  148. {{ scope.row.serviceMoney }}
  149. </template>
  150. </el-table-column>
  151. <el-table-column
  152. label="汇票状态"
  153. align="center"
  154. prop="draftStatusText"
  155. />
  156. <el-table-column label="审核状态" align="center">
  157. <template slot-scope="scope">
  158. {{ scope.row.statusText }}
  159. </template>
  160. </el-table-column>
  161. <el-table-column
  162. align="center"
  163. prop="created_at"
  164. label="操作"
  165. width="250"
  166. >
  167. <template slot-scope="scope">
  168. <el-tag
  169. v-permission="['salesman', 'admin']"
  170. v-show="contract.status !== 0"
  171. type="primary"
  172. style="cursor: pointer; margin-right: 15px"
  173. @click="tapDetail(scope.row.id)"
  174. >查看详情</el-tag
  175. >
  176. <el-tag
  177. v-permission="['supplier']"
  178. type="primary"
  179. style="cursor: pointer; margin-right: 15px"
  180. @click="tapDetail(scope.row.id)"
  181. >查看详情</el-tag
  182. >
  183. <el-tag
  184. v-permission="['supplier']"
  185. v-show="scope.row.status == 2"
  186. type="success"
  187. style="cursor: pointer; margin-right: 15px"
  188. @click="addNewBill(scope.row.id)"
  189. >重新提交</el-tag
  190. >
  191. <el-tag
  192. v-if="scope.row.draftStatus == 1"
  193. type="success"
  194. style="margin-right: 15px; cursor: pointer"
  195. @click="recover(scope.row.id)"
  196. >恢复</el-tag
  197. >
  198. <el-tag
  199. v-if="contract.status != 0 && scope.row.draftStatus == 0"
  200. type="danger"
  201. style="margin-right: 15px; cursor: pointer"
  202. @click="deleted(scope.row.id)"
  203. >删除</el-tag
  204. >
  205. </template>
  206. </el-table-column>
  207. </el-table>
  208. <div class="pagesip">
  209. <el-button
  210. v-permission="['salesman', 'admin']"
  211. v-show="contract.status !== 0"
  212. type="primary"
  213. @click="batSuccessed"
  214. >审核成功</el-button
  215. >
  216. <el-button
  217. v-permission="['salesman', 'admin']"
  218. v-show="contract.status !== 0"
  219. type="primary"
  220. @click="batFailed"
  221. >审核失败</el-button
  222. >
  223. <el-button
  224. v-if="contract.status !== 0 && role === 2"
  225. type="primary"
  226. @click="addNewBill('')"
  227. >
  228. 新增汇票</el-button
  229. >
  230. <el-button
  231. v-if="contract.status !== 0"
  232. type="success"
  233. style="float: right"
  234. @click="recoverContractDraft"
  235. >恢复
  236. </el-button>
  237. <el-button
  238. v-if="contract.status !== 0"
  239. type="danger"
  240. style="float: right"
  241. @click="deletedContractDraft"
  242. >删除</el-button
  243. >
  244. <el-button
  245. type="primary"
  246. style="float: right; margin-left: 10px"
  247. @click="ExportsContractDraft"
  248. >导出
  249. </el-button>
  250. <el-button
  251. type="primary"
  252. size="small"
  253. style="
  254. background-color: #d8ab5a;
  255. border-color: #d8ab5a;
  256. margin: 0 20px;
  257. "
  258. @click="jumpFirstPage"
  259. >首页
  260. </el-button>
  261. <el-pagination
  262. ref="pagination"
  263. background
  264. layout="prev, pager, next"
  265. :total="list.length"
  266. :page-size="10"
  267. prev-text="上一页"
  268. next-text="下一页"
  269. :hide-on-single-page="false"
  270. @current-change="handleCurrentChange"
  271. />
  272. <el-button
  273. type="primary"
  274. size="small"
  275. style="
  276. background-color: #d8ab5a;
  277. border-color: #d8ab5a;
  278. margin: 0 20px;
  279. "
  280. @click="jumpLastPage"
  281. >尾页
  282. </el-button>
  283. <el-button type="primary" size="small" @click="back">返回 </el-button>
  284. </div>
  285. </el-card>
  286. </div>
  287. </template>
  288. <script>
  289. import { dataConversionUtil } from "../../utils/Excel.js";
  290. import logo from "@/assets/pdf.png";
  291. export default {
  292. data() {
  293. return {
  294. dialogVisible: false,
  295. role: "",
  296. srcList: [],
  297. temporaryList: [],
  298. list: [],
  299. listLoading: false,
  300. contract: {},
  301. currentPage: 1,
  302. multipleSelection: [],
  303. pagesize: 9999,
  304. form: "",
  305. invoicePicList: [],
  306. picList: [],
  307. tradePicList: [],
  308. pdf: logo,
  309. /* 审核反馈和审核截图的数据 */
  310. feed: {
  311. id: "",
  312. feedback: "",
  313. feedbackPicList: [],
  314. approveStatus: "",
  315. },
  316. exportExcelData1: [], //导出列表缓存数据整页
  317. exportExcelData2: [], //导出列表缓存数据单选
  318. };
  319. },
  320. mounted() {
  321. this.role = this.$store.state.user.userInfo.type;
  322. this.checked = this.$store.state.user.checked;
  323. this.getData();
  324. },
  325. methods: {
  326. // 批量审核汇票 成功
  327. batSuccessed() {
  328. const ids = Array.from(this.multipleSelection, ({ id }) => id);
  329. this.$request({
  330. url: "/api/Contract/contractDraft/manager",
  331. method: "post",
  332. data: {
  333. ids: ids,
  334. operateType: 3,
  335. },
  336. }).then((res) => {
  337. if (res.code === 200) {
  338. this.$message({
  339. type: "success",
  340. message: res.msg,
  341. });
  342. } else {
  343. this.$message({
  344. type: "danger",
  345. message: res.msg,
  346. });
  347. }
  348. this.getData();
  349. });
  350. },
  351. // 批量审核汇票失败
  352. batFailed() {
  353. const ids = Array.from(this.multipleSelection, ({ id }) => id);
  354. this.$request({
  355. url: "/api/Contract/contractDraft/manager",
  356. method: "post",
  357. data: {
  358. ids: ids,
  359. operateType: 4,
  360. },
  361. }).then((res) => {
  362. if (res.code === 200) {
  363. this.$message({
  364. type: "success",
  365. message: res.msg,
  366. });
  367. } else {
  368. this.$message({
  369. type: "danger",
  370. message: res.msg,
  371. });
  372. }
  373. this.getData();
  374. });
  375. },
  376. getData() {
  377. const id = this.$route.query.id;
  378. this.$request({
  379. url: "/api/Contract/" + id,
  380. method: "get",
  381. }).then((res) => {
  382. this.contract = res.data;
  383. this.invoicePicList = this.contract.invoicePicList;
  384. this.picList = this.contract.picList;
  385. this.list = res.data.contractDraft.result;
  386. this.tradePicList = this.contract.tradePicList;
  387. this.getPageData();
  388. });
  389. },
  390. isPDF(url) {
  391. const fileType = ["pdf"];
  392. const index = url.lastIndexOf(".");
  393. const type = url.substr(index + 1);
  394. return fileType.indexOf(type) === -1;
  395. },
  396. addNewBill(id) {
  397. const cid = this.$route.query.id;
  398. this.$router.push({
  399. name: "addnewbill",
  400. query: {
  401. cid: cid,
  402. id: id,
  403. },
  404. });
  405. },
  406. tapDetail(id) {
  407. this.$router.push({
  408. name: "billDetail",
  409. query: {
  410. id: id,
  411. },
  412. });
  413. },
  414. handleCurrentChange(val) {
  415. this.currentPage = val;
  416. this.getPageData();
  417. },
  418. jumpFirstPage() {
  419. this.$refs.pagination.handleCurrentChange(1);
  420. this.$emit("handleCurrentChange", 1);
  421. },
  422. jumpLastPage() {
  423. const font = this.$refs.pagination;
  424. const cpage = Math.ceil(font.total / font.pageSize);
  425. font.handleCurrentChange(cpage);
  426. },
  427. getPageData() {
  428. const start = (this.currentPage - 1) * this.pagesize;
  429. const end = start + this.pagesize;
  430. this.srcList = this.list.slice(start, end);
  431. this.temporaryList = this.srcList;
  432. },
  433. getRowKey(row) {
  434. return row.id;
  435. },
  436. /* 批量导出 */
  437. handleAll(data) {
  438. this.multipleSelection=data
  439. },
  440. handleSelectionChange(data) {
  441. this.multipleSelection=data
  442. },
  443. /* 批量导出 */
  444. ExportsContractDraft() {
  445. if (this.multipleSelection == "") {
  446. this.Exports()
  447. } else {
  448. var tableHeader = [
  449. [
  450. "序号",
  451. "汇票名称",
  452. "汇票编号",
  453. "承兑人",
  454. "金额",
  455. "服务费",
  456. "汇票状态",
  457. "审核状态",
  458. ],
  459. ];
  460. var dataList = [];
  461. this.multipleSelection.forEach((item, index) => {
  462. dataList.push([
  463. index + 1,
  464. item.name,
  465. item.draftNo,
  466. item.acceptorName,
  467. item.money,
  468. item.serviceMoney,
  469. item.draftStatusText,
  470. item.statusText,
  471. ]);
  472. });
  473. dataConversionUtil.dataToExcel("汇票列表", tableHeader, dataList);
  474. this.$message.success("导出成功!");
  475. }
  476. },
  477. /* 全部导出 */
  478. Exports() {
  479. this.multipleSelection = this.temporaryList;
  480. setTimeout(() => {
  481. var tableHeader = [
  482. [
  483. "序号",
  484. "汇票名称",
  485. "汇票编号",
  486. "承兑人",
  487. "金额",
  488. "服务费",
  489. "汇票状态",
  490. "审核状态",
  491. ],
  492. ];
  493. var dataList = [];
  494. this.multipleSelection.forEach((item, index) => {
  495. dataList.push([
  496. index + 1,
  497. item.name,
  498. item.draftNo,
  499. item.acceptorName,
  500. item.money,
  501. item.serviceMoney,
  502. item.draftStatusText,
  503. item.statusText,
  504. ]);
  505. });
  506. dataConversionUtil.dataToExcel("汇票列表", tableHeader, dataList);
  507. this.$message.success("导出成功!");
  508. }, 1000);
  509. },
  510. /* 审核成功发送请求 */
  511. success() {
  512. this.feed.feedback = this.contract.feedback;
  513. /* 反馈图片赋值 */
  514. this.feed.feedbackPicList = this.contract.feedbackPics;
  515. /* 合同id赋值 */
  516. this.feed.id = this.$route.query.id;
  517. /* 反馈内容赋值 */
  518. this.feed.approveStatus = 1;
  519. this.$request({
  520. url: "/api/Contract/approveContract",
  521. method: "post",
  522. data: this.feed,
  523. }).then((res) => {
  524. if (res.code === 200) {
  525. this.$message({
  526. type: "success",
  527. message: res.msg,
  528. });
  529. this.getData();
  530. } else {
  531. this.$message({
  532. type: "error",
  533. message: "提交失败",
  534. });
  535. this.getData();
  536. }
  537. });
  538. },
  539. /* 审核失败发送请求 */
  540. failed() {
  541. this.feed.feedback = this.contract.feedback;
  542. /* 反馈图片赋值 */
  543. this.feed.feedbackPicList = this.contract.feedbackPics;
  544. /* 合同id赋值 */
  545. this.feed.id = this.$route.query.id;
  546. this.feed.approveStatus = 2;
  547. this.$request({
  548. url: "/api/Contract/approveContract",
  549. method: "post",
  550. data: this.feed,
  551. }).then((res) => {
  552. if (res.code === 200) {
  553. this.$message({
  554. type: "success",
  555. message: res.msg,
  556. });
  557. this.getData();
  558. } else {
  559. this.$message({
  560. type: "error",
  561. message: "提交失败",
  562. });
  563. this.getData();
  564. }
  565. });
  566. },
  567. recoverContract() {
  568. const id = this.$route.query.id;
  569. this.$request({
  570. url: "/api/Contract/manage",
  571. method: "post",
  572. data: {
  573. ids: [id],
  574. operateType: 2,
  575. },
  576. }).then((res) => {
  577. if (res.code === 200) {
  578. this.$message({
  579. type: "success",
  580. message: res.msg,
  581. });
  582. this.getData();
  583. } else {
  584. this.$message({
  585. type: "error",
  586. message: "提交失败",
  587. });
  588. this.getData();
  589. }
  590. });
  591. },
  592. deletedContract() {
  593. const id = this.$route.query.id;
  594. this.$request({
  595. url: "/api/Contract/manage",
  596. method: "post",
  597. data: {
  598. ids: [id],
  599. operateType: 1,
  600. },
  601. }).then((res) => {
  602. if (res.code === 200) {
  603. this.$message({
  604. type: "success",
  605. message: res.msg,
  606. });
  607. this.getData();
  608. } else {
  609. this.$message({
  610. type: "error",
  611. message: "提交失败",
  612. });
  613. this.getData();
  614. }
  615. });
  616. },
  617. recoverContractDraft() {
  618. const ids = Array.from(this.multipleSelection, ({ id }) => id);
  619. this.$request({
  620. url: "/api/Contract/contractDraft/manager",
  621. method: "post",
  622. data: {
  623. ids: ids,
  624. operateType: 2,
  625. },
  626. }).then((res) => {
  627. if (res.code === 200) {
  628. this.$message({
  629. type: "success",
  630. message: res.msg,
  631. });
  632. this.getData();
  633. } else {
  634. this.$message({
  635. type: "error",
  636. message: "提交失败",
  637. });
  638. this.getData();
  639. }
  640. });
  641. },
  642. deletedContractDraft() {
  643. const ids = Array.from(this.multipleSelection, ({ id }) => id);
  644. this.$request({
  645. url: "/api/Contract/contractDraft/manager",
  646. method: "post",
  647. data: {
  648. ids: ids,
  649. operateType: 1,
  650. },
  651. }).then((res) => {
  652. if (res.code === 200) {
  653. this.$message({
  654. type: "success",
  655. message: res.msg,
  656. });
  657. this.getData();
  658. } else {
  659. this.$message({
  660. type: "error",
  661. message: "提交失败",
  662. });
  663. this.getData();
  664. }
  665. });
  666. },
  667. recover(id) {
  668. this.$request({
  669. url: "/api/Contract/contractDraft/manager",
  670. method: "post",
  671. data: {
  672. ids: [id],
  673. operateType: 2,
  674. },
  675. }).then((res) => {
  676. if (res.code === 200) {
  677. this.$message({
  678. type: "success",
  679. message: res.msg,
  680. });
  681. this.getData();
  682. } else {
  683. this.$message({
  684. type: "error",
  685. message: "提交失败",
  686. });
  687. this.getData();
  688. }
  689. });
  690. },
  691. deleted(id) {
  692. this.$request({
  693. url: "/api/Contract/contractDraft/manager",
  694. method: "post",
  695. data: {
  696. ids: [id],
  697. operateType: 1,
  698. },
  699. }).then((res) => {
  700. if (res.code === 200) {
  701. this.$message({
  702. type: "success",
  703. message: res.msg,
  704. });
  705. this.getData();
  706. } else {
  707. this.$message({
  708. type: "error",
  709. message: "提交失败",
  710. });
  711. this.getData();
  712. }
  713. });
  714. },
  715. back() {
  716. this.$router.go(-1);
  717. },
  718. },
  719. };
  720. </script>
  721. <style lang="scss" scoped>
  722. .box-card {
  723. width: 98%;
  724. margin: 0 auto;
  725. margin-top: 10px;
  726. }
  727. .el-textarea__inner {
  728. padding: 30px 0;
  729. }
  730. .imgbox {
  731. margin-left: 15px;
  732. }
  733. .titlein {
  734. display: flex;
  735. justify-content: space-between;
  736. margin: 20px 0;
  737. .titlename {
  738. color: #bebdbb;
  739. }
  740. .meatatitle {
  741. color: #1f242a;
  742. }
  743. }
  744. .yusa {
  745. display: flex;
  746. }
  747. .jas {
  748. margin: 20px 20px;
  749. margin-bottom: 0;
  750. }
  751. .sah {
  752. display: block;
  753. color: #68625b;
  754. padding-bottom: 10px;
  755. }
  756. .grid-content {
  757. margin: 15px 20px;
  758. }
  759. .bors {
  760. height: 100%;
  761. }
  762. .aoiisp {
  763. margin-left: 20px;
  764. display: flex;
  765. align-items: center;
  766. }
  767. .pagesip {
  768. width: 100%;
  769. margin: 20px auto;
  770. display: flex;
  771. // align-items: center;
  772. justify-content: flex-end;
  773. }
  774. .el-pagination.is-background .el-pager li:not(.disabled).active {
  775. background-color: #d8ab5a;
  776. }
  777. .el-col {
  778. margin-bottom: 20px;
  779. }
  780. .boxas {
  781. font-size: 18px;
  782. width: 211px;
  783. height: 40px;
  784. background: linear-gradient(to right, #ffe1ad, #d8ab5a);
  785. box-shadow: 0 10px 20px 1px rgba(179, 116, 5, 0.2);
  786. border-radius: 0 26px 26px 0;
  787. line-height: 40px;
  788. text-align: center;
  789. }
  790. .el-button--danger{
  791. margin-left: 10px;
  792. }
  793. ::v-deep .el-textarea__inner{
  794. height: 150px !important;
  795. }
  796. </style>