detailsPage.vue 38 KB

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