detailsPage.vue 42 KB

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