detailsPage.vue 42 KB

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