detailsPage.vue 20 KB

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