detailsPage.vue 39 KB

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