detailsPage.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242
  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. />
  306. <upload-file
  307. ref="uploadFile"
  308. title="合同附件"
  309. :disabled="viewDisabled"
  310. :orderFilesList="orderFilesList"
  311. delUrl=""
  312. />
  313. </el-form>
  314. </div>
  315. <el-dialog
  316. title="付款记录"
  317. append-to-body
  318. class="el-dialogDeep"
  319. :visible.sync="applicationDialog"
  320. width="60%"
  321. :close-on-click-modal="false"
  322. :destroy-on-close="true"
  323. :close-on-press-escape="false"
  324. v-dialog-drag
  325. >
  326. <bill-application
  327. :billId="form.id"
  328. @choceApplication="choceApplication"
  329. >
  330. </bill-application>
  331. </el-dialog>
  332. <el-dialog
  333. append-to-body
  334. title="账单"
  335. class="el-dialogDeep"
  336. :visible.sync="applyPaymentDialog"
  337. width="70%"
  338. :close-on-click-modal="false"
  339. :destroy-on-close="true"
  340. :close-on-press-escape="false"
  341. v-dialog-drag
  342. >
  343. <apply-payment
  344. :billType="billType"
  345. :billData="billData"
  346. @choceFun="choceFun"
  347. >
  348. </apply-payment>
  349. </el-dialog>
  350. <el-dialog
  351. append-to-body
  352. title="账单"
  353. class="el-dialogDeep"
  354. :visible.sync="financialAccountDialog"
  355. width="70%"
  356. :close-on-click-modal="false"
  357. :destroy-on-close="true"
  358. :close-on-press-escape="false"
  359. v-dialog-drag
  360. >
  361. <financial-account
  362. :billType="billType"
  363. :billData="billData"
  364. @choceFun="choceFun"
  365. >
  366. </financial-account>
  367. </el-dialog>
  368. </div>
  369. </template>
  370. <script>
  371. import customerContact from "./config/customerContact.json"
  372. import {detailListData, submitData} from "@/api/importTrade/purchase";
  373. import feeInfo from "@/components/fee-info/main";
  374. import uploadFile from "@/components/upload-file/main";
  375. import _ from "lodash";
  376. import { isPercentage,roundNumbers } from "@/util/validate";
  377. import billApplication from "@/components/bill/billApplication";
  378. //商品详情接口
  379. import { corpsattn } from "@/api/basicData/configuration"
  380. import { contrastObj,contrastList } from "@/util/contrastData";
  381. import ApplyPayment from "../../../components/finance/applyPayment";
  382. import financialAccount from "../../../components/finance/financialAccount";
  383. import { pleaseCheck } from "@/api/basicData/configuration"
  384. export default {
  385. name: "detailsPage",
  386. props: {
  387. detailData: {
  388. type: Object
  389. }
  390. },
  391. filters: {
  392. isPercentage(val) {
  393. return isPercentage(val);
  394. },
  395. roundNumbers(val){
  396. return roundNumbers(val);
  397. }
  398. },
  399. components: {
  400. ApplyPayment,
  401. financialAccount,
  402. feeInfo,
  403. uploadFile,
  404. billApplication
  405. },
  406. data() {
  407. return {
  408. form: {},
  409. disabled: false,
  410. customerContact: {},
  411. contactsForm: {},
  412. contactsData: [],
  413. itemTypeList:[],
  414. buttonLoading:false,
  415. applyPaymentDialog:false,
  416. applicationDialog:false,
  417. financialAccountDialog:false,
  418. commodityData: false,
  419. takeDisabled:false, //收货状态
  420. viewDisabled:false,//查看状态
  421. checkDisabled:false,
  422. tableData: [],
  423. billType:"",
  424. billData:{},
  425. contractTypeDic:[],
  426. currencyDic:[],
  427. selectContact:[],//选中采购明细
  428. selectKind: -1,//选择采购明细的货品
  429. paymentTypeDic:[],
  430. orderFeesList:[],
  431. orderFilesList:[],
  432. itemConfiguration:{
  433. multipleChoices:false,
  434. multiple:false,
  435. disabled:false,
  436. searchShow:true,
  437. collapseTags:false,
  438. placeholder:'请点击右边按钮选择',
  439. dicData:[]
  440. },
  441. //对比新旧数据信息
  442. oldContactsData:[],
  443. oldForm:{},
  444. oldFeesList:[],
  445. oldFilesList:[],
  446. // 基础信息
  447. basicData: {
  448. column: [
  449. {
  450. label: '系统编号',
  451. prop: 'sysNo',
  452. disabled:true,
  453. rules: [
  454. {
  455. required: false,
  456. message: ' ',
  457. trigger: 'blur'
  458. }
  459. ]
  460. }, {
  461. label: '供应商',
  462. prop: 'corpId',
  463. span: 16,
  464. dicData: [],
  465. rules: [
  466. {
  467. required: true,
  468. message: ' ',
  469. trigger: 'blur'
  470. }
  471. ]
  472. },{
  473. label: '合同号',
  474. prop: 'orderNo',
  475. rules: [
  476. {
  477. required: true,
  478. message: ' ',
  479. trigger: 'blur'
  480. }
  481. ]
  482. },
  483. {
  484. label: '所属公司',
  485. prop: 'belongToCorpId',
  486. span: 16,
  487. dicData: [],
  488. rules: [
  489. {
  490. required: true,
  491. message: ' ',
  492. trigger: 'blur'
  493. }
  494. ]
  495. },
  496. {
  497. label: '合同日期',
  498. prop: 'businesDate',
  499. type:'date',
  500. rules: [
  501. {
  502. required: false,
  503. message: ' ',
  504. trigger: 'blur'
  505. }
  506. ]
  507. },
  508. {
  509. label: '合同金额',
  510. prop: 'orderAmount',
  511. rules: [
  512. {
  513. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  514. message: ' ',
  515. trigger: 'blur'
  516. }
  517. ]
  518. },
  519. {
  520. label: '合同重量(吨)',
  521. prop: 'contractWeight',
  522. rules: [
  523. {
  524. required: false,
  525. message: ' ',
  526. trigger: 'blur'
  527. }
  528. ]
  529. },
  530. {
  531. label: '合同类型',
  532. prop: 'orderType',
  533. // type:'select',
  534. dicData: [],
  535. rules: [
  536. {
  537. required: false,
  538. message: ' ',
  539. trigger: 'blur'
  540. }
  541. ]
  542. },
  543. {
  544. label: '要求发货日期',
  545. prop: 'requiredDeliveryDate',
  546. type:'date',
  547. rules: [
  548. {
  549. required: true,
  550. message: ' ',
  551. trigger: 'blur'
  552. }
  553. ]
  554. }, {
  555. label: '要求到货日期',
  556. prop: 'requiredArrivalDate',
  557. type:'date',
  558. rules: [
  559. {
  560. required: true,
  561. message: ' ',
  562. trigger: 'blur'
  563. }
  564. ]
  565. },
  566. {
  567. label: '单价',
  568. prop: 'salesPrice',
  569. rules: [
  570. {
  571. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  572. message: ' ',
  573. trigger: 'blur'
  574. }
  575. ]
  576. }, {
  577. label: '币别',
  578. prop: 'currency'
  579. }, {
  580. label: '汇率',
  581. prop: 'exchangeRate',
  582. },
  583. {
  584. label: '人民币金额',
  585. prop: 'rmbAmount',
  586. rules: [
  587. {
  588. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  589. message: ' ',
  590. trigger: 'blur'
  591. }
  592. ]
  593. },
  594. {
  595. label: '预付(保证)金额',
  596. prop: 'advancePayment',
  597. rules: [
  598. {
  599. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  600. message: ' ',
  601. trigger: 'blur'
  602. }
  603. ]
  604. },
  605. {
  606. label: '付款方式',
  607. prop: 'paymentType',
  608. },
  609. {
  610. label: '付款/开证日期',
  611. prop: 'accountsCollectionDate',
  612. type:'date',
  613. rules: [
  614. {
  615. required: false,
  616. message: ' ',
  617. trigger: 'blur'
  618. }
  619. ]
  620. },
  621. {
  622. label: '信用证到期日',
  623. prop: 'creditDate',
  624. type:'date',
  625. rules: [
  626. {
  627. required: false,
  628. message: ' ',
  629. trigger: 'blur'
  630. }
  631. ]
  632. },
  633. {
  634. label: '最迟付款日期',
  635. prop: 'latestDate',
  636. type:'date',
  637. rules: [
  638. {
  639. required: false,
  640. message: ' ',
  641. trigger: 'blur'
  642. }
  643. ]
  644. },
  645. {
  646. label: '已付人民币金额',
  647. prop: 'settlmentAmount',
  648. disabled: true,
  649. },
  650. {
  651. label: '已付外币金额',
  652. prop: 'foreignSettlmentAmount',
  653. disabled: true,
  654. },
  655. {
  656. label: '到港日期',
  657. prop: 'dateOfArrival',
  658. type:'date',
  659. rules: [
  660. {
  661. required: false,
  662. message: ' ',
  663. trigger: 'blur'
  664. }
  665. ]
  666. },
  667. {
  668. label: '已退人民币金额',
  669. prop: 'refundSettlmentAmount',
  670. disabled: true,
  671. },
  672. {
  673. label: '已退外币金额',
  674. prop: 'refundForeignSettlmentAmount',
  675. disabled: true,
  676. },
  677. {
  678. label: '业务员',
  679. prop: 'salesName',
  680. dicData: [],
  681. rules: [
  682. {
  683. required: false,
  684. message: ' ',
  685. trigger: 'blur'
  686. }
  687. ]
  688. },
  689. {
  690. label: '发票重量',
  691. prop: 'invoiceWeight',
  692. disabled: true,
  693. rules: [
  694. {
  695. required: false,
  696. message: ' ',
  697. trigger: 'blur'
  698. }
  699. ]
  700. },
  701. {
  702. label: '码单重量',
  703. prop: 'billWeight',
  704. disabled: true,
  705. rules: [
  706. {
  707. required: false,
  708. message: ' ',
  709. trigger: 'blur'
  710. }
  711. ]
  712. },
  713. {
  714. label: "备注",
  715. span: 24,
  716. prop: "orderRemark",
  717. mock: {
  718. type: 'county'
  719. }
  720. }
  721. ],
  722. },
  723. }
  724. },
  725. async created() {
  726. this.customerContact = await this.getColumnData(this.getColumnName(37), customerContact);
  727. //币别
  728. this.getWorkDicts("currency").then(res =>{
  729. this.currencyDic = res.data.data
  730. if(!this.detailData.id){
  731. this.$set(this.form,"currency","USD")
  732. this.currencyChange("USD")
  733. }
  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.view){
  742. this.viewDisabled = true
  743. this.checkDisabled = true
  744. }
  745. if (this.detailData.id) {
  746. this.buttonLoading = true;
  747. let id = this.detailData.id.replace(/\"/g, "")
  748. detailListData(id).then(res => {
  749. this.afterEcho(res.data.data)
  750. }).finally(()=>{
  751. this.buttonLoading = false;
  752. })
  753. }
  754. },
  755. methods: {
  756. //选择货品物种
  757. valueName(value,row){
  758. this.itemTypeList = value.list
  759. this.$set(row,"priceCategory",value.id)
  760. this.$set(row,"itemId",value.id) //将id 赋值给itemId 提单号查询合同号时使用
  761. },
  762. //到货日期不能小于发货日期
  763. dateChange(){
  764. if(this.form.requiredArrivalDate && this.form.requiredDeliveryDate &&this.form.requiredArrivalDate < this.form.requiredDeliveryDate ){
  765. this.$message.error("到货日期不能小于发货日期")
  766. this.$set(this.form,"requiredArrivalDate",'')
  767. }
  768. },
  769. //单价
  770. priceChange(row) {
  771. if (row.price && row.billWeight) {
  772. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  773. }
  774. },
  775. //码单重量
  776. billWeightChange(row) {
  777. if (row.billWeight && row.price) {
  778. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  779. }
  780. },
  781. //带出汇率
  782. currencyChange(value){
  783. this.currencyDic.forEach(item =>{
  784. if(item.dictValue === value){
  785. this.$set(this.form,"exchangeRate",item.remark)
  786. }
  787. })
  788. if(this.form.orderAmount && this.form.orderAmount){
  789. this.$set(this.form,"rmbAmount",_.multiply(this.form.orderAmount, this.form.exchangeRate).toFixed(2))
  790. }
  791. },
  792. //计算人民币金额
  793. RMBChange(value){
  794. if(this.form.orderAmount && this.form.orderAmount){
  795. this.$set(this.form,"rmbAmount",_.multiply(this.form.orderAmount, this.form.exchangeRate).toFixed(2))
  796. }
  797. },
  798. //合计
  799. totalChange(){
  800. let invoiceList = this.contactsData.map(item => {
  801. if(item.invoiceWeight){
  802. return parseFloat(item.invoiceWeight);
  803. }else return 0
  804. });
  805. let billList = this.contactsData.map(item => {
  806. if(item.billWeight){
  807. return parseFloat(item.billWeight);
  808. }else return 0
  809. });
  810. this.$set(this.form,"invoiceWeight",invoiceList.reduce((n,m) => n + m)) //数组内和
  811. this.$set(this.form,"billWeight",billList.reduce((n,m) => n + m))
  812. },
  813. //费用明细回调
  814. beforeFinance(feesData,callback){
  815. let params = {}
  816. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  817. || contrastList(feesData,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  818. ){
  819. this.$confirm("数据发生变化,请先提交保存?", {
  820. confirmButtonText: "保存",
  821. cancelButtonText: "取消",
  822. type: "warning"
  823. }).then(() => {
  824. this.editCustomer();
  825. }).finally(()=>{
  826. params.valid = false
  827. callback(params)
  828. })
  829. }else{
  830. params.valid = true
  831. params.parentId = this.form.id
  832. params.srcOrderno = this.form.orderNo
  833. callback(params)
  834. }
  835. },
  836. //生成账单之后需要更新明细列表的属性
  837. afterFinance(){
  838. detailListData(this.form.id).then(res => {
  839. this.afterEcho(res.data.data)
  840. })
  841. },
  842. //修改提交触发
  843. editCustomer(status) {
  844. this.$refs["form"].validate((valid) => {
  845. if (valid) {
  846. let orderFeesList = this.$refs.feeInfo.submitData();
  847. for (let i = 0; i < orderFeesList.length; i++) {
  848. if (orderFeesList[i].corpId === (null || "")) {
  849. return this.$message.error(`请输入费用明细第${i + 1}行的结算中心`);
  850. }
  851. if (orderFeesList[i].itemId === (null || "")) {
  852. return this.$message.error(`请输入费用明细第${i + 1}行的费用名称`);
  853. }
  854. }
  855. const orderFilesList = this.$refs.uploadFile.submitData();
  856. for (let j = 0; j < this.contactsData.length; j++) {
  857. if (this.contactsData[j].billNo === (null || "")) {
  858. return this.$message.error(`请输入采购明细第${j + 1}行的提单号`);
  859. }
  860. if (this.contactsData[j].priceCategory === (null || "")) {
  861. return this.$message.error(`请输入采购明细第${j + 1}行的货物品种`);
  862. }
  863. if (this.contactsData[j].itemType === (null || "")) {
  864. return this.$message.error(`请输入采购明细第${j + 1}行的规格型号`);
  865. }
  866. if (this.contactsData[j].orderQuantity === (null || "")) {
  867. return this.$message.error(`请输入采购明细第${j + 1}行的件数`);
  868. }
  869. if (this.contactsData[j].invoiceWeight === (null || "")) {
  870. return this.$message.error(`请输入采购明细第${j + 1}行的发票重量`);
  871. }
  872. }
  873. if(this.contactsData.length !==0){
  874. let invoiceList = this.contactsData.map(item => {
  875. if(item.amount){
  876. return parseFloat(item.amount);
  877. }else return 0
  878. });
  879. this.form.invoiceAmount = invoiceList.reduce((n,m) => n + m)
  880. }
  881. this.form.billNo =Array.from(new Set(this.contactsData.map(item =>{return item.billNo}))).join(",")
  882. let submitDto = {
  883. ...this.form,
  884. tradeType:"JK",
  885. billType:"CG",
  886. itemsVOList: this.contactsData,
  887. orderFeesList: orderFeesList,
  888. orderFilesList: orderFilesList
  889. };
  890. this.buttonLoading = true;
  891. submitData(submitDto).then(res => {
  892. if(res.data.success){
  893. this.form.id = res.data.data
  894. this.$message.success("操作成功!")
  895. detailListData(this.form.id).then(res => {
  896. this.afterEcho(res.data.data)
  897. })
  898. }
  899. }).finally(()=>{
  900. this.buttonLoading = false
  901. })
  902. if(status === true){
  903. this.$emit("goBack");
  904. }
  905. } else {
  906. return false;
  907. }
  908. });
  909. },
  910. //回调
  911. afterEcho(form){
  912. this.form = form;
  913. this.oldForm = Object.assign({},form);
  914. if(form.itemsVOList){
  915. this.contactsData = form.itemsVOList
  916. this.oldContactsData = this.deepClone(form.itemsVOList)
  917. //明细列表内是否有 已经收货的 如果有 则禁用一些输入框
  918. this.takeDisabled = this.contactsData.map(item =>{if(item.actualQuantity != 0 || item.actualWeight != 0) return true}).some(item => {return item == true})
  919. this.basicData.column.forEach(item =>{
  920. if(item.prop == "businesDate" || item.prop == "requiredDeliveryDate" || item.prop == "requiredArrivalDate" || item.prop == "latestDate"){
  921. item.disabled = this.takeDisabled
  922. }
  923. })
  924. }
  925. if(form.orderFeesList){
  926. this.orderFeesList = form.orderFeesList
  927. this.oldFeesList = this.deepClone(form.orderFeesList)
  928. }
  929. if( form.orderFilesList){
  930. this.orderFilesList = form.orderFilesList
  931. this.oldFilesList = this.deepClone(form.orderFilesList)
  932. }
  933. if(this.detailData.status === 'copy'){
  934. this.copyData()
  935. }
  936. },
  937. openDisabled(){
  938. this.viewDisabled = false
  939. this.checkDisabled = false
  940. },
  941. selectionContact(row){
  942. this.selectContact = row;
  943. },
  944. //进入收货单
  945. beforePage(){
  946. if(this.verificationData()){
  947. if(this.$store.getters.takeStatus){
  948. this.$alert("收货单页面已存在,请关闭收货单再进行操作", "温馨提示", {
  949. confirmButtonText: "确定",
  950. type: 'warning',
  951. callback: action => {
  952. }
  953. });
  954. }else{
  955. const params = {
  956. id:this.form.id,
  957. orderItemIds:this.selectContact.map(i=>{return i.$index})
  958. }
  959. //关闭一下存在的列表页
  960. this.$router.$avueRouter.closeTag('/importTrade/receipt/index');
  961. this.$router.push({
  962. path: "/importTrade/receipt/index",
  963. query: {
  964. params: params
  965. },
  966. });
  967. }
  968. }
  969. },
  970. beforeBillData(bool,type){
  971. this.billType = type
  972. //采购明细提单号 list
  973. this.billData = {
  974. srcOrderno:this.form.orderNo,
  975. itemType:"采购", //区分采购还是销售
  976. optionType:'JK', //区分贸易类型
  977. billNoList: Array.from(new Set( this.contactsData.map(item =>{return item.billNo}))),
  978. price:this.form.salesPrice,
  979. corpsName:this.form.corpsName,
  980. corpId:this.form.corpId,
  981. accDate:this.form.businesDate,
  982. currency:this.form.currency,
  983. exchangeRate:this.form.exchangeRate,
  984. srcParentId:this.form.id,
  985. }
  986. if(bool){ //申请货款
  987. this.billData.srcId = -1
  988. }
  989. },
  990. // 付款
  991. applyPayment(type){
  992. if(this.verificationData()){
  993. this.beforeBillData(true,type);
  994. this.financialAccountDialog = true;
  995. }
  996. },
  997. //请核
  998. auditCheck(){
  999. if(this.verificationData()){
  1000. this.$confirm("确定审核此订单?", {
  1001. confirmButtonText: "确定",
  1002. cancelButtonText: "取消",
  1003. type: "warning"
  1004. }).then(()=>{
  1005. this.buttonLoading = true
  1006. const data = {
  1007. id : this.form.id,
  1008. checkType: 'cgqh',
  1009. url: '/purchase/contract/index',
  1010. pageStatus:"this.$store.getters.importCGStatus",
  1011. pageLabel:"采购订单(I)",
  1012. checkFlag: 1,
  1013. }
  1014. pleaseCheck(data).then(res=>{
  1015. if(res.data.success){
  1016. this.$message.success("操作成功!")
  1017. this.viewDisabled = true
  1018. }
  1019. })
  1020. }).finally(()=>{
  1021. this.buttonLoading = false
  1022. })
  1023. }
  1024. },
  1025. //新增商品明细保存触发
  1026. rowSave(row, done, loading) {
  1027. // this.contactsData.push(row)
  1028. done()
  1029. },
  1030. //修改商品信息触发
  1031. rowUpdate(row, index, done, loading) {
  1032. done(row);
  1033. },
  1034. //删除商品信息触发
  1035. rowDel(row, index, donerowDel) {
  1036. this.$confirm("确定将选择数据删除?", {
  1037. confirmButtonText: "确定",
  1038. cancelButtonText: "取消",
  1039. type: "warning"
  1040. }).then(() => {
  1041. //商品判断是否需要调用删除接口
  1042. if (row.id) {
  1043. corpsattn(row.id).then(res => {
  1044. this.$message({
  1045. type: "success",
  1046. message: "操作成功!"
  1047. });
  1048. this.contactsData.splice(index, 1);
  1049. })
  1050. } else {
  1051. this.$message({
  1052. type: "success",
  1053. message: "操作成功!"
  1054. });
  1055. this.contactsData.splice(index, 1);
  1056. }
  1057. }).finally(()=>{
  1058. this.totalChange()
  1059. })
  1060. },
  1061. //关闭账单
  1062. choceFun(){
  1063. this.financialAccountDialog = false
  1064. },
  1065. //打开申请记录
  1066. openApplicationDialog(){
  1067. this.applicationDialog = true
  1068. },
  1069. //关闭申记录
  1070. choceApplication(){
  1071. this.applicationDialog = false
  1072. },
  1073. //商品编辑
  1074. rowCell(row, index) {
  1075. this.$refs.crudContact.rowCell(row, index)
  1076. },
  1077. //录入明细
  1078. commoditySelection() {
  1079. const params = {
  1080. price:this.form.salesPrice
  1081. }
  1082. this.$refs.crudContact.rowCellAdd(params);
  1083. },
  1084. //点击行可编辑
  1085. handleRowClick(row, event, column) {
  1086. },
  1087. verificationData(){
  1088. this.orderFeesList = this.$refs.feeInfo.submitData();
  1089. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  1090. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  1091. ) {
  1092. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  1093. confirmButtonText: "保存",
  1094. cancelButtonText: "取消",
  1095. type: "warning",
  1096. }).then(() => {
  1097. this.editCustomer()
  1098. }).catch(()=>{
  1099. return false
  1100. })
  1101. }else{
  1102. return true
  1103. }
  1104. },
  1105. createData(){
  1106. if(this.verificationData()){
  1107. this.$confirm("确定创建新的单据吗?", "提示", {
  1108. confirmButtonText: "保存",
  1109. cancelButtonText: "取消",
  1110. type: "warning",
  1111. }).then(() => {
  1112. this.form = {}
  1113. this.oldForm = {}
  1114. this.contactsData = []
  1115. this.oldContactsData = []
  1116. this.orderFeesList = []
  1117. this.oldFeesList = []
  1118. this.orderFilesList = []
  1119. this.oldFilesList = []
  1120. })
  1121. }
  1122. },
  1123. copyData(){
  1124. if(this.verificationData()){
  1125. this.takeDisabled = false
  1126. this.basicData.column.forEach(item =>{
  1127. if(item.prop == "businesDate" || item.prop == "requiredDeliveryDate" || item.prop == "requiredArrivalDate" || item.prop == "latestDate" || item.prop == ""){
  1128. item.disabled = this.takeDisabled
  1129. }
  1130. })
  1131. delete this.form.id //删除id
  1132. this.$set(this.form,"sysNo","")//系统编号
  1133. this.$set(this.form,"orderNo","")//合同号
  1134. this.$set(this.form,"settlmentAmount","")//已付人民币
  1135. this.$set(this.form,"foreignSettlmentAmount","")//已付外币
  1136. this.$set(this.form,"refundSettlmentAmount","")//已退人民币
  1137. this.$set(this.form,"refundForeignSettlmentAmount","")//已退外币
  1138. this.contactsData.forEach(item =>{
  1139. delete item.id //删除id
  1140. item.actualQuantity = "" //已收件数
  1141. item.actualWeight = "" //已收发票
  1142. })
  1143. this.orderFeesList.forEach(item =>{
  1144. delete item.id //删除id
  1145. })
  1146. this.oldForm = {}
  1147. this.oldContactsData = []
  1148. this.oldFeesList = []
  1149. this.oldFilesList = []
  1150. this.$message.success("复制成功!")
  1151. }
  1152. },
  1153. backToList() {
  1154. this.orderFeesList = this.$refs.feeInfo.submitData();
  1155. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  1156. || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
  1157. ){
  1158. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  1159. confirmButtonText: "保存",
  1160. cancelButtonText: "取消",
  1161. type: "warning",
  1162. }).then(() => {
  1163. this.editCustomer(true)
  1164. }).catch(()=>{
  1165. this.$emit("goBack");
  1166. })
  1167. }else{
  1168. this.$emit("goBack");
  1169. }
  1170. },
  1171. //列保存触发
  1172. async saveColumn() {
  1173. const inSave = await this.saveColumnData(
  1174. this.getColumnName(37),
  1175. this.customerContact
  1176. );
  1177. if (inSave) {
  1178. this.$message.success("保存成功");
  1179. //关闭窗口
  1180. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1181. }
  1182. },
  1183. async resetColumn() {
  1184. const inSave = await this.delColumnData(
  1185. this.getColumnName(36),
  1186. customerContact
  1187. );
  1188. if (inSave) {
  1189. this.$message.success("重置成功");
  1190. this.customerContact = customerContact;
  1191. //关闭窗口
  1192. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1193. }
  1194. },
  1195. },
  1196. }
  1197. </script>
  1198. <style scoped lang="scss">
  1199. .upper_right_button{
  1200. display: flex;
  1201. position: fixed;
  1202. right: 12px;
  1203. top: 47px;
  1204. align-items: flex-start;
  1205. }
  1206. .required_fields{
  1207. color: #F56C6C;
  1208. display:inline-block;
  1209. width: 7%
  1210. }
  1211. ::v-deep .el-form-item {
  1212. margin-bottom: 0;
  1213. }
  1214. //el-icon-plus avue-upload__icon
  1215. .avue-upload /deep/ .avue-upload__icon {
  1216. line-height: 178px !important;
  1217. }
  1218. ::v-deep .el-form-item__content{
  1219. line-height: 32px;
  1220. }
  1221. </style>