detailsPage.vue 41 KB

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