detailsPage.vue 41 KB

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