detailsPage.vue 38 KB

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