detailsPage.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="goBack(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button size="small" style="margin-right: 8px" :disabled="!form.id"
  11. @click="$refs.print.openDialog()">打印账单
  12. </el-button>
  13. <el-button size="small" style="margin-right: 8px" :disabled="!form.id"
  14. @click="$refs.report.openDialog()">报表设计
  15. </el-button>
  16. <el-button v-if="!editDisabled" class="el-button--small-yh" type="success" size="small"
  17. :disabled="isSaveBtn || form.orderStatus == '已确认'" @click="submitFee">确认收款
  18. </el-button>
  19. <el-button v-if="!editDisabled" class="el-button--small-yh" type="warning" size="small"
  20. :disabled="isSaveBtn || form.orderStatus != '已确认'" @click="revokeFee">撤销收款
  21. </el-button>
  22. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
  23. v-if="editDisabled"
  24. :disabled="showLock || !(roleName.indexOf('admin') != -1 || roleName.indexOf('允许修改他人业务') != -1 || saberUserInfo.user_id == form.createUser)"
  25. @click="inEdit">编 辑
  26. </el-button>
  27. <el-button v-if="!editDisabled" class="el-button--small-yh" style="margin-left: 6px;" type="primary"
  28. size="small" :disabled="isSaveBtn" @click="submit">保 存
  29. </el-button>
  30. </div>
  31. </div>
  32. <div style="margin-top: 50px">
  33. <trade-card title="基础信息">
  34. <avue-form :option="optionForm" v-model="form" ref="form">
  35. </avue-form>
  36. </trade-card>
  37. <trade-card title="费用明细">
  38. <fee-infosimple feeType="D" :form="form" :disabled="editDisabled" @getDetails="getDetails"></fee-infosimple>
  39. </trade-card>
  40. <containerTitle title="上传附件"></containerTitle>
  41. <c-upload :data="form.filesCenterList" :enumerationValue="76"
  42. deleteUrl="/api/blade-los/filescenter/remove" display :disabled="editDisabled"></c-upload>
  43. <business-reports :id="form.id" ref="print" businessValue="MYDL-STL" :type="true"></business-reports>
  44. <reports :id="form.id" :assemblyForm="form" businessValue="MYDL-STL" ref="report"></reports>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import { submit, getDetail, confirmCollectionOfPayments, revokeCollectionOfPayments } from "@/api/tradeAgency/exchangePurchasing";
  50. import { contrastObj, contrastList } from "@/util/contrastData";
  51. import feeInfosimple from "@/components/tradeAgency/fee-infosimple";
  52. import dicSelect from "@/components/dicSelect/main";
  53. import businessReports from "@/components/tradeAgency/businessReports.vue";
  54. import reports from "@/components/tradeAgency/reports.vue";
  55. import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
  56. import { dateFormat } from "@/util/date";
  57. import _ from "lodash";
  58. export default {
  59. name: "detailsPage",
  60. data() {
  61. return {
  62. editDisabled: false,
  63. form: {},
  64. oldForm: {},
  65. optionForm: {
  66. menuBtn: false,
  67. span: 8,
  68. disabled: true,
  69. column: [
  70. {
  71. label: '客户',
  72. prop: "corpName",
  73. disabled: true,
  74. },
  75. {
  76. label: '业务号',
  77. prop: "businessNo",
  78. disabled: true,
  79. },
  80. {
  81. label: '合同号',
  82. prop: "contractNo",
  83. disabled: true,
  84. },
  85. {
  86. label: '提单号',
  87. prop: "billNoJoin",
  88. disabled: true,
  89. },
  90. {
  91. label: '业务日期',
  92. prop: "businessDate",
  93. type: "date",
  94. format: "yyyy-MM-dd",
  95. valueFormat: "yyyy-MM-dd HH:mm:ss",
  96. disabled: false,
  97. rules: [{
  98. required: true,
  99. message: " ",
  100. trigger: "blur"
  101. }]
  102. },
  103. {
  104. label: '金额',
  105. prop: "goodsValue",
  106. disabled: true,
  107. },
  108. {
  109. label: '付汇美元金额',
  110. prop: "paymentInUsd",
  111. disabled: true,
  112. },
  113. {
  114. label: '当天汇率',
  115. prop: "exchangeRate",
  116. disabled: true,
  117. },
  118. {
  119. label: '实付金额',
  120. prop: "actualAmount",
  121. disabled: true,
  122. },
  123. {
  124. label: '邮电费',
  125. prop: "postElectricFee",
  126. disabled: true,
  127. },
  128. {
  129. label: '手续费',
  130. prop: "serviceCharge",
  131. disabled: true,
  132. },
  133. {
  134. label: '申报单号',
  135. prop: "declarationNumber",
  136. disabled: false,
  137. },
  138. {
  139. label: '国内收货人',
  140. prop: "domesticConsigneeCname",
  141. disabled: true,
  142. },
  143. {
  144. label: '银行助记码',
  145. prop: "domesticBankMnemonicCode",
  146. disabled: true,
  147. },
  148. {
  149. label: '银行',
  150. prop: "domesticBank",
  151. disabled: true,
  152. },
  153. {
  154. label: '币别',
  155. prop: "domesticCurrency",
  156. disabled: true,
  157. },
  158. {
  159. label: '所属公司',
  160. prop: "affiliatedCompanyName",
  161. disabled: true,
  162. },
  163. {
  164. label: '付费方式',
  165. prop: "advanceRatio",
  166. type: "select",
  167. dicUrl: "/api/blade-system/dict-biz/dictionary?code=advance_ratio",
  168. props: {
  169. label: "dictValue",
  170. value: "dictValue"
  171. },
  172. disabled: false
  173. },
  174. {
  175. label: '备注',
  176. prop: "remarks",
  177. type: 'textarea',
  178. span: 12,
  179. disabled: false,
  180. minRows: 2,
  181. }
  182. ]
  183. },
  184. option: {},
  185. optionBack: {
  186. height: 'auto',
  187. calcHeight: 30,
  188. menuWidth: 140,
  189. border: true,
  190. index: true,
  191. addBtn: false,
  192. viewBtn: false,
  193. editBtn: false,
  194. delBtn: false,
  195. menu: false,
  196. refreshBtn: false,
  197. align: 'center',
  198. column: [
  199. {
  200. label: "提单号",
  201. prop: "billNo",
  202. overHidden: true
  203. },
  204. {
  205. label: "箱号",
  206. prop: "boxNo",
  207. overHidden: true
  208. },
  209. {
  210. label: "铅封号",
  211. prop: "leadSealNo",
  212. overHidden: true
  213. },
  214. {
  215. label: "开船日期",
  216. prop: "etd",
  217. overHidden: true
  218. },
  219. {
  220. label: "预计到港",
  221. prop: "estimateReachHarbor",
  222. width: "120",
  223. overHidden: true
  224. },
  225. {
  226. label: "HSCODE",
  227. prop: "hsCode",
  228. overHidden: true
  229. },
  230. {
  231. label: "厂号",
  232. prop: "factoryNumber",
  233. overHidden: true
  234. },
  235. {
  236. label: "标签品名",
  237. prop: "labelProductName",
  238. overHidden: true
  239. },
  240. {
  241. label: "商品类别",
  242. prop: "goodsType",
  243. overHidden: true
  244. },
  245. {
  246. label: "件数",
  247. prop: "quantity",
  248. overHidden: true
  249. },
  250. {
  251. label: "净重(kg)",
  252. prop: "netWeight",
  253. overHidden: true
  254. },
  255. {
  256. label: "单价",
  257. prop: "price",
  258. overHidden: true
  259. },
  260. {
  261. label: "毛重(kg)",
  262. prop: "grossWeight",
  263. overHidden: true
  264. },
  265. {
  266. label: "金额",
  267. prop: "amount",
  268. overHidden: true
  269. },
  270. {
  271. label: "备注",
  272. prop: "remarks",
  273. overHidden: true
  274. }
  275. ]
  276. },
  277. showLock: false,
  278. roleName: [],
  279. saberUserInfo: ''
  280. }
  281. },
  282. components: {
  283. dicSelect,
  284. feeInfosimple,
  285. businessReports,
  286. reports
  287. },
  288. props: {
  289. detailData: Object
  290. },
  291. async created() {
  292. this.roleName = localStorage.getItem('roleName').split(',')
  293. this.saberUserInfo = JSON.parse(localStorage.getItem("saber-userInfo")).content
  294. this.option = await this.getColumnData(this.getColumnName(384), this.optionBack);
  295. if (this.detailData.id) {
  296. this.showLock = true
  297. this.editDisabled = true
  298. this.getDetails(this.detailData.id)
  299. }
  300. if (this.$route.query.billNo) {
  301. this.showLock = true
  302. this.getDetails(this.$route.query.billNo)
  303. }
  304. if (this.$route.query.params) {
  305. this.showLock = true
  306. this.getDetails(this.$route.query.params)
  307. }
  308. },
  309. methods: {
  310. inLock() {
  311. const data = {
  312. moduleName: "MYDL-D",
  313. tableName: "MYDL-D_Detail",
  314. billId: this.form.id,
  315. no: localStorage.getItem("browserID"),
  316. billNo: this.form.contractNo
  317. };
  318. this.inDetailsKey(this.$route.name, {
  319. moduleName: "MYDL-D",
  320. tableName: "MYDL-D_Detail",
  321. billId: this.form.id,
  322. billNo: this.form.contractNo
  323. });
  324. this.checkLock(data).then(res => {
  325. if (res.data.code == 200) {
  326. this.onLock(data).then(res => {
  327. if (res.data.code == 200) {
  328. this.showLock = false
  329. }
  330. });
  331. }
  332. });
  333. },
  334. getDetails(id) {
  335. const loading = this.$loading({
  336. lock: true,
  337. text: '加载中',
  338. spinner: 'el-icon-loading',
  339. background: 'rgba(255,255,255,0.7)'
  340. });
  341. getDetail({ id: id }).then(res => {
  342. if (res.data.data.orderStatus == '已确认') this.optionForm.disabled = true
  343. this.form = res.data.data
  344. this.oldForm = this.deepClone(res.data.data)
  345. this.inLock()
  346. // this.form.filesCenterList=[]
  347. }).finally(() => {
  348. loading.close()
  349. })
  350. },
  351. inEdit() {
  352. this.editDisabled = false
  353. if (this.form.orderStatus != '已确认') {
  354. this.optionForm.disabled = false
  355. }
  356. },
  357. submit(type) {
  358. this.$refs["form"].validate((valid, done) => {
  359. done();
  360. if (valid) {
  361. const loading = this.$loading({
  362. lock: true,
  363. text: '加载中',
  364. spinner: 'el-icon-loading',
  365. background: 'rgba(255,255,255,0.7)'
  366. });
  367. submit(this.form).then(res => {
  368. this.$message.success("保存成功");
  369. if (type == 'goBack') {
  370. if (this.form.id) {
  371. this.unLock({
  372. moduleName: "MYDL-D",
  373. tableName: "MYDL-D_Detail",
  374. billId: this.form.id,
  375. billNo: this.form.contractNo
  376. });
  377. }
  378. this.$emit("goBack", type);
  379. this.$emit('updateKey')
  380. }
  381. this.getDetails(res.data.data.id)
  382. }).finally(() => {
  383. loading.close();
  384. })
  385. } else {
  386. return false;
  387. }
  388. });
  389. },
  390. submitFee() {
  391. bcurrencyGetExrate({ date: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'), dc: "D" }).then(res => {
  392. res.data.data.forEach(e => {
  393. if (e.code == 'USD') {
  394. this.$prompt('<br/>请输入当天汇率:', '确定收费', {
  395. confirmButtonText: '确定',
  396. cancelButtonText: '取消',
  397. inputValue: e.exrate,
  398. dangerouslyUseHTMLString: true,
  399. closeOnClickModal: false,
  400. }).then(({ value }) => {
  401. let obj = {}
  402. obj = {
  403. ...this.form,
  404. exchangeRate: value
  405. }
  406. const loading = this.$loading({
  407. lock: true,
  408. text: '加载中',
  409. spinner: 'el-icon-loading',
  410. background: 'rgba(255,255,255,0.7)'
  411. });
  412. confirmCollectionOfPayments(obj).then(res => {
  413. this.getDetails(res.data.data.id)
  414. this.$message.success("确认成功");
  415. }).finally(() => {
  416. loading.close();
  417. })
  418. })
  419. }
  420. })
  421. })
  422. },
  423. revokeFee() {
  424. this.$confirm('撤销收费?', '提示', {
  425. confirmButtonText: '确定',
  426. cancelButtonText: '取消',
  427. type: 'warning'
  428. }).then(() => {
  429. const loading = this.$loading({
  430. lock: true,
  431. text: '加载中',
  432. spinner: 'el-icon-loading',
  433. background: 'rgba(255,255,255,0.7)'
  434. });
  435. revokeCollectionOfPayments(this.form).then(res => {
  436. this.getDetails(res.data.data.id)
  437. this.$message.success("撤销成功");
  438. }).finally(() => {
  439. loading.close();
  440. })
  441. })
  442. },
  443. //自定义列保存
  444. async saveColumn(ref, option, optionBack, code) {
  445. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  446. if (inSave) {
  447. this.$message.success("保存成功");
  448. //关闭窗口
  449. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  450. }
  451. },
  452. //自定义列重置
  453. async resetColumn(ref, option, optionBack, code) {
  454. this[option] = this[optionBack];
  455. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  456. if (inSave) {
  457. this.$message.success("重置成功");
  458. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  459. }
  460. },
  461. goBack(type) {
  462. if (contrastObj(this.form, this.oldForm) || contrastList(this.form.filesCenterList, this.oldForm.filesCenterList)) {
  463. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  464. confirmButtonText: "确定",
  465. cancelButtonText: "取消",
  466. type: "warning"
  467. })
  468. .then(() => {
  469. this.submit('goBack')
  470. })
  471. .catch(() => {
  472. if (this.form.id) {
  473. this.unLock({
  474. moduleName: "MYDL-D",
  475. tableName: "MYDL-D_Detail",
  476. billId: this.form.id,
  477. billNo: this.form.contractNo
  478. });
  479. }
  480. this.$emit("goBack", type);
  481. this.$emit('updateKey')
  482. });
  483. } else {
  484. if (this.form.id) {
  485. this.unLock({
  486. moduleName: "MYDL-D",
  487. tableName: "MYDL-D_Detail",
  488. billId: this.form.id,
  489. billNo: this.form.contractNo
  490. });
  491. }
  492. this.$emit("goBack", type);
  493. this.$emit('updateKey')
  494. }
  495. },
  496. }
  497. }
  498. </script>
  499. <style lang="scss" scoped>
  500. ::v-deep .el-form-item {
  501. margin-bottom: 8px !important;
  502. }
  503. ::v-deep .el-table .cell {
  504. padding: 0 2px !important;
  505. .el-form-item {
  506. margin-bottom: 0px !important;
  507. }
  508. }
  509. ::v-deep .avue-crud .el-table .el-form-item__label {
  510. left: -1px;
  511. }
  512. ::v-deep#out-table .back-one {
  513. background: #ecf5ff !important;
  514. }
  515. ::v-deep#out-table .back-two {
  516. background: #ecf5ff !important;
  517. }
  518. ::v-deep .el-table--small td,
  519. .el-table--small th {
  520. padding: 2px !important;
  521. }
  522. </style>