detailsPage.vue 41 KB

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