detailsPage.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. <template>
  2. <div class="borderless">
  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="backToList">返回列表
  7. </el-button>
  8. <div class="upper_right_button">
  9. <el-button type="primary"
  10. class="el-button--small-yh"
  11. size="small"
  12. :loading="buttonLoading"
  13. :disabled="true"
  14. @click.stop="">请核
  15. </el-button>
  16. <el-button type="warning"
  17. size="small"
  18. class="el-button--small-yh "
  19. :loading="buttonLoading"
  20. @click.stop="applyPayment()">申请货款
  21. </el-button>
  22. <el-button type="info"
  23. size="small"
  24. :loading="buttonLoading"
  25. @click="applicationDialog = true,
  26. applicationData = contactsData"
  27. >查看申请记录
  28. </el-button>
  29. <el-button type="success"
  30. size="small"
  31. :loading="buttonLoading"
  32. class="el-button--small-yh "
  33. :disabled="true"
  34. @click.stop="">复制新单
  35. </el-button>
  36. <el-button
  37. class="el-button--small-yh "
  38. type="primary"
  39. size="small"
  40. :disabled="disabled"
  41. @click="editCustomer"
  42. :loading="buttonLoading"
  43. >{{form.id?'确认修改':'确认新增'}}
  44. </el-button>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="customer-main">
  49. <el-form :model="form" ref="form" label-width="130px">
  50. <containerTitle title="基础信息"></containerTitle>
  51. <basic-container style="margin-bottom: 10px">
  52. <el-row>
  53. <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:8" :key="index">
  54. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  55. <el-date-picker v-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]" :disabled="item.disabled?true:false" size="small" type="date" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  56. <el-select v-else-if="item.type === 'select'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  57. <el-option
  58. v-for="(data, index) in item.dicData"
  59. :key="index"
  60. :label="data.label"
  61. :value="data.value"
  62. ></el-option>
  63. </el-select>
  64. <el-input type="age" v-else-if="item.prop === 'orderAmount'" v-model="form[item.prop]" :disabled="takeDisabled" size="small" autocomplete="off" @input="currencyChange" placeholder="请输入"></el-input>
  65. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :disabled="takeDisabled" :configuration="configuration"/>
  66. <selectComponent v-else-if="item.prop === 'purchaserId'" v-model="form[item.prop]" :disabled="takeDisabled" :configuration="pConfiguration"/>
  67. <selectComponent v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]" :disabled="takeDisabled" :configuration="bConfiguration"/>
  68. <el-select v-else-if="item.prop === 'orderType'" style="width: 100%" v-model="form[item.prop]" :disabled="takeDisabled" size="small" placeholder="请选择" clearable filterable>
  69. <el-option v-for="(item,index) in contractTypeDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  70. </el-select>
  71. <el-select v-else-if="item.prop === 'currency'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" @change="currencyChange" clearable filterable>
  72. <el-option v-for="(item,index) in currencyDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  73. </el-select>
  74. <el-select v-else-if="item.prop === 'paymentType'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  75. <el-option v-for="(item,index) in paymentTypeDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  76. </el-select>
  77. <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入"></el-input>
  78. <el-input type="age" v-else v-model="form[item.prop]" :disabled="item.disabled?true:false || takeDisabled" size="small" autocomplete="off" placeholder="请输入"></el-input>
  79. </el-form-item>
  80. </el-col>
  81. </el-row>
  82. </basic-container>
  83. <!-- 采购明细-->
  84. <containerTitle title="采购明细"></containerTitle>
  85. <basic-container style="margin-bottom: 10px">
  86. <avue-crud
  87. :option="customerContact"
  88. v-model="contactsForm"
  89. :data="contactsData"
  90. ref="crudContact"
  91. @row-save="rowSave"
  92. @selection-change="selectionContact"
  93. @row-click="handleRowClick"
  94. @row-update="rowUpdate"
  95. @row-del="rowDel"
  96. @saveColumn="saveColumn"
  97. >
  98. <template slot="priceCategory" slot-scope="{ row, index}">
  99. <goods-select
  100. v-if="row.$cellEdit"
  101. v-model="row.priceCategoryNames"
  102. @valueName="(value) => valueName(value,row)"
  103. :configuration="itemConfiguration"
  104. >
  105. </goods-select>
  106. <span v-else>{{ row.priceCategoryNames }}</span>
  107. </template>
  108. <template slot="itemType" slot-scope="{ row, index }">
  109. <el-select
  110. v-if="row.$cellEdit"
  111. v-model="row.itemType"
  112. size="small"
  113. style="width:90% !important;"
  114. filterable
  115. allow-create
  116. default-first-option
  117. clearable
  118. >
  119. <el-option
  120. v-for="(item,index) in row.specificationList"
  121. :key="index"
  122. :label="item.value"
  123. :value="item.value"
  124. >
  125. </el-option>
  126. </el-select>
  127. <span v-else>{{ row.itemType }}</span>
  128. </template>
  129. <template slot="orderQuantity" slot-scope="{ row }">
  130. <span v-if="row.$cellEdit" class="required_fields">*</span>
  131. <el-input
  132. v-if="row.$cellEdit"
  133. v-model="row.orderQuantity"
  134. placeholder="请输入"
  135. size="small"
  136. style="width: 93%"
  137. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  138. ></el-input>
  139. <span v-else>{{ row.orderQuantity }}</span>
  140. </template>
  141. <template slot="price" slot-scope="{ row }">
  142. <el-input
  143. v-if="row.$cellEdit"
  144. v-model="row.price"
  145. placeholder="请输入"
  146. size="small"
  147. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  148. @input="priceChange(row)"
  149. ></el-input>
  150. <span v-else>{{ row.price }}</span>
  151. </template>
  152. <template slot="invoiceWeight" slot-scope="{ row }">
  153. <el-input
  154. v-if="row.$cellEdit"
  155. v-model="row.invoiceWeight"
  156. placeholder="请输入"
  157. size="small"
  158. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  159. @change="totalChange(row.invoiceWeight)"
  160. ></el-input>
  161. <span v-else>{{ row.invoiceWeight }}</span>
  162. </template>
  163. <template slot="billWeight" slot-scope="{ row }">
  164. <el-input
  165. v-if="row.$cellEdit"
  166. v-model="row.billWeight"
  167. placeholder="请输入"
  168. size="small"
  169. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  170. @input="billWeightChange(row)"
  171. @change="totalChange(row.billWeight)"
  172. ></el-input>
  173. <span v-else>{{ row.billWeight }}</span>
  174. </template>
  175. <template slot="amount" slot-scope="{ row }">
  176. <el-input
  177. v-if="row.$cellEdit"
  178. v-model="row.amount"
  179. placeholder="请输入"
  180. size="small"
  181. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  182. ></el-input>
  183. <span v-else>{{ row.amount }}</span>
  184. </template>
  185. <template slot-scope="{row,index}" slot="menu">
  186. <el-button
  187. type="text"
  188. size="small"
  189. :disabled="row.actualQuantity !=0"
  190. @click="rowCell(row,index)"
  191. >{{ row.$cellEdit ? '修改完成' : '修改' }}
  192. </el-button>
  193. <el-button
  194. type="text"
  195. size="small"
  196. :disabled="row.actualQuantity !=0"
  197. @click="rowDel(row,index)"
  198. >删除
  199. </el-button>
  200. </template>
  201. <template slot="menuLeft" slot-scope="{size}">
  202. <el-button type="primary"
  203. icon="el-icon-plus"
  204. size="small"
  205. @click="commoditySelection"
  206. >录入明细
  207. </el-button>
  208. <el-button type="warning"
  209. size="small"
  210. :disabled="selectContact.length == 0"
  211. @click="beforePage(false)"
  212. >生成收货单
  213. </el-button>
  214. </template>
  215. </avue-crud>
  216. </basic-container>
  217. <fee-info
  218. ref="feeInfo"
  219. :orderFeesList="orderFeesList"
  220. feeUrl=""
  221. />
  222. <upload-file
  223. ref="uploadFile"
  224. title="合同附件"
  225. :orderFilesList="orderFilesList"
  226. delUrl=""
  227. />
  228. </el-form>
  229. </div>
  230. <el-dialog
  231. title="申请记录"
  232. append-to-body
  233. class="el-dialogDeep"
  234. :visible.sync="applicationDialog"
  235. width="60%"
  236. :close-on-click-modal="false"
  237. :destroy-on-close="true"
  238. :close-on-press-escape="false"
  239. v-dialog-drag
  240. >
  241. <basic-container>
  242. <avue-crud :option="customerContact"
  243. :table-loading="applicationLoading"
  244. :data="applicationData"
  245. ref="applicationCrud"
  246. @refresh-change="applicationRefreshChange"
  247. :page.sync="applicationPage"
  248. @on-load="applicationOnLoad"></avue-crud>
  249. </basic-container>
  250. <span slot="footer" class="dialog-footer">
  251. <el-button @click="applicationDialog = false ">关 闭</el-button>
  252. </span>
  253. </el-dialog>
  254. <el-dialog
  255. append-to-body
  256. title="账单"
  257. class="el-dialogDeep"
  258. :visible.sync="applyPaymentDialog"
  259. width="70%"
  260. :close-on-click-modal="false"
  261. :destroy-on-close="true"
  262. :close-on-press-escape="false"
  263. v-dialog-drag
  264. >
  265. <apply-payment
  266. :billType="billType"
  267. :billData="billData"
  268. @choceFun="choceFun"
  269. >
  270. </apply-payment>
  271. </el-dialog>
  272. </div>
  273. </template>
  274. <script>
  275. import customerContact from "./config/customerContact.json"
  276. import uploadList from './config/uploadList.json'
  277. import advantageProject from "./config/advantageProject.json"
  278. import {getDeptLazyTree,customerList} from "@/api/basicData/basicFeesDesc";
  279. import optionTwoCost from "./config/mainListCost.json"
  280. import {detailListData, submitData,getSysNo} from "@/api/importTrade/purchase";
  281. import commodity from "./config/commodity.json"
  282. import feeInfo from "@/components/fee-info/main";
  283. import uploadFile from "@/components/upload-file/main";
  284. import _ from "lodash";
  285. //商品详情接口
  286. import {corpsattn, corpsbank, getDeptLazyTreeS} from "@/api/basicData/configuration"
  287. import { getList } from "@/api/basicData/commodityType"
  288. import { contrastObj,contrastList } from "@/util/contrastData";
  289. import {getSpecification} from "@/api/exportTrade/purchaseContract";
  290. import option from "./config/mainList.json";
  291. import ApplyPayment from "../../../components/finance/applyPayment";
  292. export default {
  293. name: "detailsPage",
  294. props: {
  295. detailData: {
  296. type: Object
  297. }
  298. },
  299. data() {
  300. return {
  301. form: {},
  302. disabled: false,
  303. customerContact: {},
  304. contactsForm: {},
  305. contactsData: [],
  306. buttonLoading:false,
  307. applyPaymentDialog:false,
  308. commodityData: false,
  309. takeDisabled:false, //收货状态
  310. tableData: [],
  311. billType:"采购申请货款",
  312. billData:{},
  313. contractTypeDic:[],
  314. currencyDic:[],
  315. selectContact:[],//选中采购明细
  316. selectKind: -1,//选择采购明细的货品
  317. paymentTypeDic:[],
  318. orderFeesList:[],
  319. orderFilesList:[],
  320. treeDeptId: '',
  321. configuration:{
  322. multipleChoices:false,
  323. multiple:false,
  324. disabled:false,
  325. searchShow:true,
  326. collapseTags:false,
  327. placeholder:'请点击右边按钮选择',
  328. dicData:[]
  329. },
  330. pConfiguration:{
  331. multipleChoices:false,
  332. multiple:false,
  333. disabled:false,
  334. searchShow:true,
  335. collapseTags:false,
  336. placeholder:'请点击右边按钮选择',
  337. dicData:[]
  338. },
  339. bConfiguration:{
  340. multipleChoices:false,
  341. multiple:false,
  342. disabled:false,
  343. searchShow:true,
  344. collapseTags:false,
  345. placeholder:'请点击右边按钮选择',
  346. dicData:[]
  347. },
  348. itemConfiguration:{
  349. multipleChoices:false,
  350. multiple:false,
  351. disabled:false,
  352. searchShow:true,
  353. collapseTags:false,
  354. placeholder:'请点击右边按钮选择',
  355. dicData:[]
  356. },
  357. // 合同上传数据
  358. uploadList: uploadList,
  359. // 合同数据
  360. bankOfDepositData: [],
  361. bankOfDepositForm: {},
  362. // 其他费用
  363. advantageProject: advantageProject,
  364. advantageProjectData: [],
  365. advantageProjectForm: {},
  366. dialogCost: false,
  367. choiceData: false,
  368. treeOptionCost:{
  369. nodeKey: 'id',
  370. lazy: true,
  371. treeLoad: function (node, resolve) {
  372. const parentId = (node.level === 0) ? 0 : node.data.id;
  373. getDeptLazyTree(parentId).then(res => {
  374. resolve(res.data.data.map(item => {
  375. return {
  376. ...item,
  377. leaf: !item.hasChildren
  378. }
  379. }))
  380. });
  381. },
  382. addBtn: false,
  383. menu: false,
  384. size: 'small',
  385. props: {
  386. labelText: '标题',
  387. label: 'title',
  388. value: 'value',
  389. children: 'children'
  390. }
  391. },
  392. // 导入其他费用配置
  393. optionTwoCost: optionTwoCost,
  394. loadingCost: false,
  395. dataCost:[],
  396. pageCost:{
  397. pageSize: 10,
  398. currentPage: 1,
  399. total: 0
  400. },
  401. tableDataCost: [],
  402. treeDeptIdCost: '',
  403. choiceIndex: '',
  404. //查看申请记录
  405. applicationDialog:false,
  406. applicationLoading:false,
  407. applicationData:[],
  408. applicationPage:{
  409. pageSize: 10,
  410. currentPage: 1,
  411. total: 0
  412. },
  413. //对比新旧数据信息
  414. oldContactsData:[],
  415. oldForm:{},
  416. oldFeesList:[],
  417. oldFilesList:[],
  418. // 基础信息
  419. basicData: {
  420. column: [
  421. {
  422. label: '系统编号',
  423. prop: 'sysNo',
  424. disabled:true,
  425. rules: [
  426. {
  427. required: false,
  428. message: ' ',
  429. trigger: 'blur'
  430. }
  431. ]
  432. }, {
  433. label: '供应商',
  434. prop: 'corpId',
  435. span: 16,
  436. dicData: [],
  437. rules: [
  438. {
  439. required: true,
  440. message: ' ',
  441. trigger: 'blur'
  442. }
  443. ]
  444. },{
  445. label: '合同号',
  446. prop: 'orderNo',
  447. disabled:this.takeDisabled,
  448. rules: [
  449. {
  450. required: false,
  451. message: ' ',
  452. trigger: 'blur'
  453. }
  454. ]
  455. }, {
  456. label: '采购商',
  457. prop: 'purchaserId',
  458. disabled:this.takeDisabled,
  459. span: 16,
  460. dicData: [],
  461. rules: [
  462. {
  463. required: true,
  464. message: ' ',
  465. trigger: 'blur'
  466. }
  467. ]
  468. },
  469. {
  470. label: '合同日期',
  471. prop: 'businesDate',
  472. disabled: this.takeDisabled,
  473. type:'date',
  474. rules: [
  475. {
  476. required: false,
  477. message: ' ',
  478. trigger: 'blur'
  479. }
  480. ]
  481. },
  482. {
  483. label: '所属公司',
  484. prop: 'belongToCorpId',
  485. disabled:this.takeDisabled,
  486. span: 16,
  487. dicData: [],
  488. rules: [
  489. {
  490. required: false,
  491. message: ' ',
  492. trigger: 'blur'
  493. }
  494. ]
  495. },
  496. {
  497. label: '合同金额',
  498. prop: 'orderAmount',
  499. disabled:this.takeDisabled,
  500. rules: [
  501. {
  502. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  503. message: ' ',
  504. trigger: 'blur'
  505. }
  506. ]
  507. }, {
  508. label: '合同重量',
  509. prop: 'contractWeight',
  510. disabled:this.takeDisabled,
  511. rules: [
  512. {
  513. required: false,
  514. message: ' ',
  515. trigger: 'blur'
  516. }
  517. ]
  518. },
  519. {
  520. label: '合同类型',
  521. prop: 'orderType',
  522. // type:'select',
  523. dicData: [],
  524. rules: [
  525. {
  526. required: false,
  527. message: ' ',
  528. trigger: 'blur'
  529. }
  530. ]
  531. },
  532. {
  533. label: '业务员',
  534. prop: 'salesName',
  535. dicData: [],
  536. rules: [
  537. {
  538. required: false,
  539. message: ' ',
  540. trigger: 'blur'
  541. }
  542. ]
  543. },
  544. {
  545. label: '要求发货日期',
  546. prop: 'requiredDeliveryDate',
  547. type:'date',
  548. rules: [
  549. {
  550. required: true,
  551. message: ' ',
  552. trigger: 'blur'
  553. }
  554. ]
  555. }, {
  556. label: '要求到货日期',
  557. prop: 'requiredArrivalDate',
  558. type:'date',
  559. rules: [
  560. {
  561. required: true,
  562. message: ' ',
  563. trigger: 'blur'
  564. }
  565. ]
  566. },
  567. {
  568. label: '单价',
  569. prop: 'salesPrice',
  570. rules: [
  571. {
  572. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  573. message: ' ',
  574. trigger: 'blur'
  575. }
  576. ]
  577. }, {
  578. label: '币别',
  579. prop: 'currency'
  580. }, {
  581. label: '汇率',
  582. prop: 'exchangeRate',
  583. }, {
  584. label: '人民币金额',
  585. prop: 'rmbAmount',
  586. rules: [
  587. {
  588. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  589. message: ' ',
  590. trigger: 'blur'
  591. }
  592. ]
  593. }, {
  594. label: '付款方式',
  595. prop: 'paymentType',
  596. },
  597. {
  598. label: '到港日期',
  599. prop: 'dateOfArrival',
  600. type:'date',
  601. rules: [
  602. {
  603. required: false,
  604. message: ' ',
  605. trigger: 'blur'
  606. }
  607. ]
  608. }, {
  609. label: '付款/开证日期',
  610. prop: 'accountsCollectionDate',
  611. type:'date',
  612. rules: [
  613. {
  614. required: false,
  615. message: ' ',
  616. trigger: 'blur'
  617. }
  618. ]
  619. },
  620. {
  621. label: '信用证到期日',
  622. prop: 'creditDate',
  623. type:'date',
  624. rules: [
  625. {
  626. required: false,
  627. message: ' ',
  628. trigger: 'blur'
  629. }
  630. ]
  631. },
  632. {
  633. label: '预付(保证)金额',
  634. prop: 'advancePayment',
  635. rules: [
  636. {
  637. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  638. message: ' ',
  639. trigger: 'blur'
  640. }
  641. ]
  642. },{
  643. label: '已付金额',
  644. prop: 'settlmentAmount',
  645. disabled: true,
  646. rules: [
  647. {
  648. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  649. message: ' ',
  650. trigger: 'blur'
  651. }
  652. ]
  653. },
  654. {
  655. label: '发票重量',
  656. prop: 'invoiceWeight',
  657. disabled: true,
  658. rules: [
  659. {
  660. required: false,
  661. message: ' ',
  662. trigger: 'blur'
  663. }
  664. ]
  665. },
  666. {
  667. label: '码单重量',
  668. prop: 'billWeight',
  669. disabled: true,
  670. rules: [
  671. {
  672. required: false,
  673. message: ' ',
  674. trigger: 'blur'
  675. }
  676. ]
  677. },
  678. {
  679. label: "备注",
  680. span: 24,
  681. prop: "orderRemark",
  682. mock: {
  683. type: 'county'
  684. }
  685. }
  686. ],
  687. },
  688. }
  689. },
  690. async created() {
  691. this.customerContact = await this.getColumnData(this.getColumnName(37), customerContact);
  692. //币别
  693. this.getWorkDicts("entrance_currency").then(res =>{
  694. this.currencyDic = res.data.data
  695. })
  696. this.getWorkDicts("contractType").then(res =>{
  697. this.contractTypeDic = res.data.data
  698. })
  699. this.getWorkDicts("payment_term").then(res =>{
  700. this.paymentTypeDic = res.data.data
  701. })
  702. if (this.detailData.id) {
  703. this.buttonLoading = true;
  704. let id = this.detailData.id.replace(/\"/g, "")
  705. detailListData(id).then(res => {
  706. this.form = res.data.data;
  707. this.oldForm = Object.assign({},res.data.data);
  708. this.configuration.dicData = this.form.corpsName
  709. this.pConfiguration.dicData = this.form.purchaserName
  710. if(res.data.data.itemsVOList){
  711. this.contactsData = res.data.data.itemsVOList
  712. this.oldContactsData = this.deepClone(res.data.data.itemsVOList)
  713. //明细列表内是否有 已经收货的 如果有 则禁用一些输入框
  714. this.takeDisabled = this.contactsData.map(item =>{if(item.actualQuantity != 0) return true}).some(item => {return item == true})
  715. }
  716. if(res.data.data.orderFeesList){
  717. this.orderFeesList = res.data.data.orderFeesList
  718. this.oldFeesList = this.deepClone(res.data.data.orderFeesList)
  719. }
  720. if( res.data.data.orderFilesList){
  721. this.orderFilesList = res.data.data.orderFilesList
  722. this.oldFilesList = this.deepClone(res.data.data.orderFilesList)
  723. }
  724. }).finally(()=>{
  725. this.buttonLoading = false;
  726. })
  727. }else{
  728. this.$set(this.form,"currency","USD")
  729. this.$set(this.form,"exchangeRate",6.3686)
  730. }
  731. },
  732. components: {
  733. ApplyPayment,
  734. feeInfo,
  735. uploadFile
  736. },
  737. methods: {
  738. valueName(value,row){
  739. this.$set(row,"priceCategory",value)
  740. this.$set(row,"itemId",value) //将id 赋值给itemId 提单号查询合同号时使用
  741. },
  742. //单价
  743. priceChange(row) {
  744. if (row.price && row.billWeight) {
  745. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  746. }
  747. },
  748. //码单重量
  749. billWeightChange(row) {
  750. if (row.billWeight && row.price) {
  751. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  752. }
  753. },
  754. //带出人民币
  755. currencyChange(){
  756. if(this.form.orderAmount){
  757. if(this.form.currency === "CNY"){
  758. this.form.exchangeRate = 1
  759. this.$set(this.form,"rmbAmount",this.form.orderAmount)
  760. }else{
  761. if(this.form.exchangeRate != 6.368600){
  762. this.$set(this.form,"rmbAmount",_.multiply(this.form.orderAmount, this.form.exchangeRate).toFixed(2))
  763. }else{
  764. this.form.exchangeRate = 6.3686
  765. this.$set(this.form,"rmbAmount",_.multiply(this.form.orderAmount, 6.3686).toFixed(2))
  766. }
  767. }
  768. }else{
  769. this.$set(this.form,"rmbAmount","")
  770. }
  771. },
  772. //合计
  773. totalChange(){
  774. let invoiceList = this.contactsData.map(item => {
  775. if(item.invoiceWeight){
  776. return parseFloat(item.invoiceWeight);
  777. }else return 0
  778. });
  779. let billList = this.contactsData.map(item => {
  780. if(item.billWeight){
  781. return parseFloat(item.billWeight);
  782. }else return 0
  783. });
  784. this.$set(this.form,"invoiceWeight",invoiceList.reduce((n,m) => n + m)) //数组内和
  785. this.$set(this.form,"billWeight",billList.reduce((n,m) => n + m))
  786. },
  787. //件数
  788. // quantityChange(row) {
  789. // if (!row.orderQuantity) {
  790. // row.orderQuantity = "";
  791. // row.amount = 0
  792. // } else {
  793. // row.amount =_.multiply(row.orderQuantity,row.price).toFixed(2);
  794. // }
  795. // },
  796. //修改提交触发
  797. editCustomer(status) {
  798. this.$refs["form"].validate((valid) => {
  799. if (valid) {
  800. let orderFeesList = this.$refs.feeInfo.submitData();
  801. for (let i = 0; i < orderFeesList.length; i++) {
  802. if (orderFeesList[i].corpId == null) {
  803. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  804. }
  805. if (orderFeesList[i].price == 0) {
  806. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  807. }
  808. if (orderFeesList[i].orderQuantity == 0) {
  809. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  810. }
  811. }
  812. const orderFilesList = this.$refs.uploadFile.submitData();
  813. for (let j = 0; j < this.contactsData.length; j++) {
  814. if (this.contactsData[j].billNo === "") {
  815. return this.$message.error(`请输入采购明细第${j + 1}行的提单号`);
  816. }
  817. if (this.contactsData[j].priceCategory === "") {
  818. return this.$message.error(`请输入采购明细第${j + 1}行的货物品种`);
  819. }
  820. if (this.contactsData[j].orderQuantity === "") {
  821. return this.$message.error(`请输入采购明细第${j + 1}行的数量`);
  822. }
  823. if (this.contactsData[j].orderQuantity == 0) {
  824. return this.$message.error(`采购明细第${j + 1}行的数量不能为0`);
  825. }
  826. }
  827. this.form.billNo = this.contactsData.map(item =>{return item.billNo}).join(",")
  828. let submitDto = {
  829. ...this.form,
  830. tradeType:"JK",
  831. billType:"CG",
  832. itemsVOList: this.contactsData,
  833. orderFeesList: orderFeesList,
  834. orderFilesList: orderFilesList
  835. };
  836. this.buttonLoading = true;
  837. submitData(submitDto).then(res => {
  838. if(res.data.success){
  839. this.form.id = res.data.data
  840. this.$message.success("操作成功!")
  841. detailListData(this.form.id).then(res => {
  842. this.form = res.data.data;
  843. this.oldForm = Object.assign({},res.data.data);
  844. this.configuration.dicData = this.form.corpsName
  845. this.pConfiguration.dicData = this.form.purchaserName
  846. if(res.data.data.itemsVOList){
  847. this.contactsData = res.data.data.itemsVOList
  848. this.oldContactsData = this.deepClone(res.data.data.itemsVOList)
  849. }
  850. if(res.data.data.orderFeesList){
  851. this.orderFeesList = res.data.data.orderFeesList
  852. this.oldFeesList = this.deepClone(res.data.data.orderFeesList)
  853. }
  854. if( res.data.data.orderFilesList){
  855. this.orderFilesList = res.data.data.orderFilesList
  856. this.oldFilesList = this.deepClone(res.data.data.orderFilesList)
  857. }
  858. })
  859. }
  860. }).finally(()=>{
  861. this.buttonLoading = false
  862. })
  863. if(status === true){
  864. this.$emit("goBack");
  865. }
  866. } else {
  867. return false;
  868. }
  869. });
  870. },
  871. selectionContact(row){
  872. this.selectContact = row;
  873. },
  874. beforePage(type){
  875. let id = this.selectContact.map(item=>{
  876. return item.id ? true : false
  877. })
  878. if(id.findIndex(item => item != true) == -1){
  879. const params = {
  880. id:this.form.id,
  881. orderItemIds:this.selectContact.map(i=>{return i.$index})
  882. }
  883. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  884. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  885. ){
  886. this.$confirm("您已改动数据,是否先保存在进行操作!", {
  887. confirmButtonText: "保存",
  888. cancelButtonText: "取消",
  889. type: "warning"
  890. }).then(() => {
  891. this.editCustomer();
  892. })
  893. }else{
  894. if(type){
  895. //进入付款管理
  896. // if(this.$store.getters.payStatus){
  897. // this.$alert("付款页面已存在,请关闭付款页面再进行操作", "温馨提示", {
  898. // confirmButtonText: "确定",
  899. // type: 'warning',
  900. // callback: action => {
  901. // }
  902. // });
  903. // }else{
  904. // this.$router.$avueRouter.closeTag('/financialManagement/payment');
  905. // this.$router.push({
  906. // path: "/financialManagement/payment",
  907. // query: {params: params},
  908. // });
  909. // }
  910. }else{
  911. //进入收货单
  912. if(this.$store.getters.takeStatus){
  913. this.$alert("收货单页面已存在,请关闭收货单再进行操作", "温馨提示", {
  914. confirmButtonText: "确定",
  915. type: 'warning',
  916. callback: action => {
  917. }
  918. });
  919. }else{
  920. //关闭一下存在的列表页
  921. this.$router.$avueRouter.closeTag('/importTrade/receipt/index');
  922. this.$router.push({
  923. path: "/importTrade/receipt/index",
  924. query: {params: params},
  925. });
  926. }
  927. }
  928. }
  929. }else{
  930. this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
  931. confirmButtonText: "保存",
  932. cancelButtonText: "取消",
  933. type: "warning"
  934. }).then(() => {
  935. this.editCustomer();
  936. })
  937. }
  938. },
  939. beforeBillData(type){
  940. //采购明细提单号 list
  941. this.billData = {
  942. srcOrderno:this.form.orderNo,
  943. itemType:"采购",
  944. optionType:'JK',
  945. billNoList: this.contactsData.map(item =>{return item.billNo}),
  946. corpsName:this.form.corpsName,
  947. corpId:this.form.corpId,
  948. accDate:this.form.businesDate,
  949. currency:this.form.currency,
  950. exchangeRate:this.form.exchangeRate,
  951. srcParentId:this.form.id,
  952. }
  953. if(type){ //申请货款
  954. this.billData.srcId = -1
  955. }
  956. },
  957. // 付款
  958. applyPayment(){
  959. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  960. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  961. ){
  962. this.$confirm("您已改动数据,是否先保存在进行操作!", {
  963. confirmButtonText: "保存",
  964. cancelButtonText: "取消",
  965. type: "warning"
  966. }).then(() => {
  967. this.editCustomer();
  968. })
  969. }else{
  970. this.beforeBillData(true);
  971. this.applyPaymentDialog = true;
  972. }
  973. },
  974. //新增商品明细保存触发
  975. rowSave(row, done, loading) {
  976. // this.contactsData.push(row)
  977. done()
  978. },
  979. //修改商品信息触发
  980. rowUpdate(row, index, done, loading) {
  981. done(row);
  982. },
  983. //删除商品信息触发
  984. rowDel(row, index, donerowDel) {
  985. this.$confirm("确定将选择数据删除?", {
  986. confirmButtonText: "确定",
  987. cancelButtonText: "取消",
  988. type: "warning"
  989. }).then(() => {
  990. //商品判断是否需要调用删除接口
  991. if (row.id) {
  992. corpsattn(row.id).then(res => {
  993. this.$message({
  994. type: "success",
  995. message: "操作成功!"
  996. });
  997. this.contactsData.splice(index, 1);
  998. })
  999. } else {
  1000. this.$message({
  1001. type: "success",
  1002. message: "操作成功!"
  1003. });
  1004. this.contactsData.splice(index, 1);
  1005. }
  1006. })
  1007. },
  1008. //关闭账单
  1009. choceFun(){
  1010. this.applyPaymentDialog = false
  1011. },
  1012. //刷新
  1013. applicationRefreshChange(){
  1014. },
  1015. //申请记录
  1016. applicationOnLoad(){
  1017. },
  1018. //商品编辑
  1019. rowCell(row, index) {
  1020. this.$refs.crudContact.rowCell(row, index)
  1021. },
  1022. //录入明细
  1023. commoditySelection() {
  1024. const params = {
  1025. price:this.form.salesPrice
  1026. }
  1027. this.$refs.crudContact.rowCellAdd(params);
  1028. },
  1029. //点击行可编辑
  1030. handleRowClick(row, event, column) {
  1031. },
  1032. backToList() {
  1033. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  1034. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  1035. ){
  1036. this.$confirm("是否保存当前页面?", "提示", {
  1037. confirmButtonText: "保存",
  1038. cancelButtonText: "取消",
  1039. type: "warning",
  1040. }).then(() => {
  1041. this.editCustomer(true)
  1042. }).catch(()=>{
  1043. this.$emit("goBack");
  1044. })
  1045. }else{
  1046. this.$emit("goBack");
  1047. }
  1048. },
  1049. //列保存触发
  1050. async saveColumn() {
  1051. const inSave = await this.saveColumnData(
  1052. this.getColumnName(37),
  1053. this.customerContact
  1054. );
  1055. if (inSave) {
  1056. this.$message.success("保存成功");
  1057. //关闭窗口
  1058. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1059. }
  1060. },
  1061. },
  1062. }
  1063. </script>
  1064. <style scoped lang="scss">
  1065. .upper_right_button{
  1066. display: flex;
  1067. position: fixed;
  1068. right: 12px;
  1069. top: 47px;
  1070. }
  1071. .required_fields{
  1072. color: #F56C6C;
  1073. display:inline-block;
  1074. width: 7%
  1075. }
  1076. ::v-deep .el-form-item {
  1077. margin-bottom: 0;
  1078. }
  1079. //el-icon-plus avue-upload__icon
  1080. .avue-upload /deep/ .avue-upload__icon {
  1081. line-height: 178px !important;
  1082. }
  1083. ::v-deep .el-form-item__content{
  1084. line-height: 32px;
  1085. }
  1086. </style>