detailsPage.vue 39 KB

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