payMoney.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. <template>
  2. <div>
  3. <div
  4. class="dialogTableTitle flex a-center jlr"
  5. style="
  6. display: flex;
  7. justify-content: space-between;
  8. align-items: center;
  9. margin: 10px 0;
  10. "
  11. >
  12. <div>
  13. <el-button
  14. type="primary"
  15. :disabled="browseStatus"
  16. @click.prevent="addpayment()"
  17. size="small"
  18. >新行
  19. </el-button>
  20. <el-button
  21. type="primary"
  22. size="small"
  23. @click="saveForm"
  24. :disabled="browseStatus"
  25. >保 存</el-button
  26. >
  27. <el-button
  28. type="danger"
  29. size="small"
  30. @click.prevent="handleSelect"
  31. :disabled="browseStatus"
  32. >作业费协议</el-button
  33. >
  34. <el-button
  35. type="primary"
  36. size="small"
  37. v-if="browseStatus"
  38. @click="feeChange"
  39. >
  40. 费用变更
  41. </el-button>
  42. </div>
  43. </div>
  44. <el-table
  45. :data="warehouseCrList"
  46. ref="table"
  47. tooltip-effect="dark"
  48. border
  49. stripe
  50. show-summary
  51. :summary-method="warehouseDrSummaries"
  52. >
  53. <el-table-column type="selection" width="55" align="center" />
  54. <el-table-column label="序号" type="index" width="80"> </el-table-column>
  55. <el-table-column
  56. prop="fCorpid"
  57. header-align="center"
  58. align="center"
  59. width="300px"
  60. label="客户名称"
  61. >
  62. <template slot-scope="scope">
  63. <el-select
  64. v-model="scope.row.fCorpid"
  65. filterable
  66. clearable
  67. placeholder="客户名称"
  68. :disabled="browseStatus || scope.row.fBillstatus == 6"
  69. >
  70. <el-option
  71. v-for="(item, index) in fMblnoOptions"
  72. :key="index.fId"
  73. :label="item.fName"
  74. :value="item.fId"
  75. ></el-option>
  76. </el-select>
  77. </template>
  78. </el-table-column>
  79. <el-table-column
  80. prop="fFeeid"
  81. header-align="center"
  82. align="center"
  83. width="240px"
  84. label="费用名称"
  85. >
  86. <template slot-scope="scope">
  87. <el-select
  88. v-model="scope.row.fFeeid"
  89. clearable
  90. filterable
  91. placeholder="费用名称"
  92. :disabled="browseStatus || scope.row.fBillstatus == 6"
  93. >
  94. <el-option
  95. v-for="(item, index) in fCNameOptions"
  96. :key="index.fId"
  97. :label="item.fName"
  98. :value="item.fId"
  99. ></el-option>
  100. </el-select>
  101. </template>
  102. </el-table-column>
  103. <el-table-column
  104. prop="fBusinessType"
  105. header-align="center"
  106. align="center"
  107. width="180px"
  108. label="作业类型"
  109. >
  110. <template slot-scope="scope">
  111. <el-select
  112. style="width: 80%"
  113. v-model="scope.row.fBusinessType"
  114. filterable
  115. disabled
  116. >
  117. <el-option
  118. v-for="(item, index) in businessTypeOption"
  119. :key="index.dictValue"
  120. :label="item.dictLabel"
  121. :value="item.dictValue"
  122. ></el-option>
  123. </el-select>
  124. </template>
  125. </el-table-column>
  126. <el-table-column
  127. prop="fFeeUnitid"
  128. header-align="center"
  129. align="center"
  130. width="180px"
  131. label="计价单位"
  132. >
  133. <template slot-scope="scope">
  134. <el-select
  135. v-model="scope.row.fFeeUnitid"
  136. placeholder="请选择计价单位"
  137. clearable
  138. :disabled="browseStatus || scope.row.fBillstatus == 6"
  139. @change="changeFeeUnit(scope.row)"
  140. >
  141. <el-option
  142. v-for="(item, index) in fFeetUnitOptions"
  143. :key="index.dictValue"
  144. :label="item.dictLabel"
  145. :value="item.dictValue"
  146. />
  147. </el-select>
  148. </template>
  149. </el-table-column>
  150. <el-table-column
  151. prop="fQty"
  152. header-align="center"
  153. align="center"
  154. width="150px"
  155. label="数量"
  156. >
  157. <template slot-scope="scope">
  158. <el-input
  159. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, "$1$2.$3")'
  160. v-model="scope.row.fQty"
  161. :disabled="browseStatus || scope.row.fBillstatus == 6"
  162. @change="changeContractAmt(scope.row)"
  163. placeholder="数量"
  164. show-word-limit
  165. />
  166. </template>
  167. </el-table-column>
  168. <el-table-column
  169. prop="fUnitprice"
  170. header-align="center"
  171. align="center"
  172. width="150px"
  173. label="单价"
  174. >
  175. <template slot-scope="scope">
  176. <el-input
  177. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  178. v-model="scope.row.fUnitprice"
  179. :disabled="browseStatus || scope.row.fSrcTypeId !== 0 || scope.row.fBillstatus == 6"
  180. @change="changeContractAmt(scope.row)"
  181. placeholder="单价"
  182. show-word-limit
  183. />
  184. </template>
  185. </el-table-column>
  186. <el-table-column
  187. prop="fAmount"
  188. header-align="center"
  189. align="center"
  190. width="150px"
  191. label="金额"
  192. >
  193. <template slot-scope="scope">
  194. <el-input
  195. disabled
  196. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  197. v-model="scope.row.fAmount"
  198. placeholder="金额"
  199. show-word-limit
  200. />
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. prop="fStltypeid"
  205. header-align="center"
  206. align="center"
  207. width="130px"
  208. label="结算方式"
  209. >
  210. <template slot-scope="scope">
  211. <el-select
  212. v-model="scope.row.fStltypeid"
  213. placeholder="请选择结算表票结、月结"
  214. :disabled="browseStatus || scope.row.fBillstatus == 6"
  215. >
  216. <el-option
  217. v-for="(item, index) in fStltypeOptions"
  218. :key="index.dictValue"
  219. :label="item.dictLabel"
  220. :value="item.dictValue"
  221. ></el-option>
  222. </el-select>
  223. </template>
  224. </el-table-column>
  225. <el-table-column
  226. prop="fCurrency"
  227. header-align="center"
  228. align="center"
  229. width="150px"
  230. label="币别"
  231. >
  232. <template slot-scope="scope">
  233. <el-input
  234. v-model="scope.row.fCurrency"
  235. :disabled="browseStatus || scope.row.fBillstatus == 6"
  236. placeholder="币别"
  237. show-word-limit
  238. />
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. prop="fExrate"
  243. header-align="center"
  244. align="center"
  245. width="150px"
  246. label="汇率"
  247. >
  248. <template slot-scope="scope">
  249. <el-input
  250. v-model="scope.row.fExrate"
  251. :disabled="browseStatus || scope.row.fBillstatus == 6"
  252. placeholder="汇率"
  253. show-word-limit
  254. />
  255. </template>
  256. </el-table-column>
  257. <el-table-column
  258. prop="fTaxrate"
  259. header-align="center"
  260. align="center"
  261. width="150px"
  262. label="税率"
  263. >
  264. <template slot-scope="scope">
  265. <el-input
  266. v-model="scope.row.fTaxrate"
  267. :disabled="browseStatus || scope.row.fBillstatus == 6"
  268. placeholder="税率"
  269. show-word-limit
  270. />
  271. </template>
  272. </el-table-column>
  273. <el-table-column
  274. prop="fMblno"
  275. header-align="center"
  276. align="center"
  277. width="130px"
  278. label="提单号"
  279. >
  280. <template slot-scope="scope">
  281. <el-input
  282. v-model="scope.row.fMblno"
  283. :disabled="browseStatus || scope.row.fBillstatus == 6"
  284. placeholder="提单号"
  285. show-word-limit
  286. />
  287. </template>
  288. </el-table-column>
  289. <el-table-column
  290. prop="fProductName"
  291. header-align="center"
  292. align="center"
  293. width="140px"
  294. label="品名"
  295. >
  296. <template slot-scope="scope">
  297. <el-input
  298. v-model="scope.row.fProductName"
  299. :disabled="browseStatus || scope.row.fBillstatus == 6"
  300. placeholder="品名"
  301. show-word-limit
  302. />
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. prop="fMarks"
  307. header-align="center"
  308. align="center"
  309. width="130px"
  310. label="品牌"
  311. >
  312. <template slot-scope="scope">
  313. <el-input
  314. v-model="scope.row.fMarks"
  315. :disabled="browseStatus || scope.row.fBillstatus == 6"
  316. placeholder="品牌"
  317. show-word-limit
  318. />
  319. </template>
  320. </el-table-column>
  321. <el-table-column
  322. prop="fSrcTypeId"
  323. header-align="center"
  324. align="center"
  325. width="130px"
  326. label="来源"
  327. >
  328. <template slot-scope="scope">
  329. <span v-if="scope.row.fSrcTypeId === 0">录入</span>
  330. <span v-if="scope.row.fSrcTypeId !== 0">协议</span>
  331. </template>
  332. </el-table-column>
  333. <el-table-column
  334. prop="remarks"
  335. header-align="center"
  336. align="center"
  337. width="150px"
  338. label="备注"
  339. >
  340. <template slot-scope="scope">
  341. <el-input
  342. v-model="scope.row.remarks"
  343. :disabled="browseStatus || scope.row.fBillstatus == 6"
  344. placeholder="备注"
  345. show-word-limit
  346. />
  347. </template>
  348. </el-table-column>
  349. <el-table-column
  350. header-align="center"
  351. align="center"
  352. width="200px"
  353. label="操作"
  354. >
  355. <template slot-scope="scope">
  356. <!-- <el-button size="small">审核费用</el-button> -->
  357. <el-button
  358. @click.native.prevent="deleteRow(scope.$index, warehouseCrList)"
  359. size="small"
  360. :disabled="browseStatus || scope.row.fBillstatus == 6"
  361. >移除</el-button
  362. >
  363. <el-button
  364. size="small"
  365. @click="listCheck(scope.row)"
  366. v-if="scope.row.fBillstatus < 6"
  367. >请核</el-button>
  368. <el-button
  369. size="small"
  370. @click="revokeListCheck(scope.row)"
  371. v-if="scope.row.fBillstatus == 6"
  372. >撤销请核</el-button>
  373. </template>
  374. </el-table-column>
  375. </el-table>
  376. <!-- 选择作业费协议数据 -->
  377. <el-dialog
  378. v-dialogDrag
  379. title="作业费协议"
  380. :close-on-click-modal="false"
  381. :modal="false"
  382. style="box-shadow: 0 1px 3px rgba(0, 0, 0, 0) !important"
  383. :visible.sync="warehousingagreements"
  384. width="70%"
  385. >
  386. <template slot="作业费协议">
  387. <div class="avue-crud__dialog__header">
  388. <span class="el-dialog__title">
  389. <span
  390. style="
  391. display: inline-block;
  392. width: 3px;
  393. height: 20px;
  394. margin-right: 5px;
  395. float: left;
  396. margin-top: 2px;
  397. "
  398. ></span>
  399. </span>
  400. </div>
  401. </template>
  402. <el-menu
  403. :default-active="activeIndex"
  404. v-if="Navigation === true"
  405. class="el-menu-demo"
  406. mode="horizontal"
  407. @select="handleSelect"
  408. >
  409. <el-menu-item index="1">车队作业费</el-menu-item>
  410. <el-menu-item index="2">劳务作业费</el-menu-item>
  411. </el-menu>
  412. <el-table
  413. :data="tasklegList"
  414. ref="table"
  415. tooltip-effect="dark"
  416. width="100%"
  417. border
  418. stripe
  419. @selection-change="whgenlegSelectionChange"
  420. >
  421. <el-table-column type="selection" width="55"> </el-table-column>
  422. <el-table-column label="行号" type="index" width="80">
  423. </el-table-column>
  424. <el-table-column
  425. prop="fCorpname"
  426. header-align="center"
  427. align="center"
  428. label="客户名称"
  429. />
  430. <el-table-column
  431. prop="fName"
  432. header-align="center"
  433. align="center"
  434. label="费用名称"
  435. />
  436. <el-table-column
  437. prop="fFeeUnitid"
  438. header-align="center"
  439. align="center"
  440. width="180px"
  441. label="计价单位"
  442. >
  443. <template slot-scope="scope">
  444. <el-select
  445. v-model="scope.row.fFeeUnitid"
  446. placeholder="请选择计价单位"
  447. @change="changeFeeUnit(scope.row)"
  448. disabled
  449. clearable
  450. >
  451. <el-option
  452. v-for="(dict, index) in fFeetUnitOptions"
  453. :key="index.dictValue"
  454. :label="dict.dictLabel"
  455. :value="dict.dictValue"
  456. />
  457. </el-select>
  458. </template>
  459. </el-table-column>
  460. <el-table-column
  461. prop="fPrice"
  462. header-align="center"
  463. align="center"
  464. label="单价"
  465. width="100px"
  466. />
  467. <el-table-column
  468. prop="remark"
  469. header-align="center"
  470. align="center"
  471. label="备注"
  472. />
  473. </el-table>
  474. <pagination
  475. v-show="whgenlegTotal > 0"
  476. :total="whgenlegTotal"
  477. :page.sync="pageNum"
  478. :limit.sync="pageSize"
  479. @pagination="getWhgenlegList"
  480. />
  481. <div slot="footer" class="dialog-footer">
  482. <el-button type="primary" @click="zhgenlegData">导 入</el-button>
  483. <el-button
  484. @click="
  485. warehousingagreements = false;
  486. Navigation = false;
  487. "
  488. >取 消</el-button
  489. >
  490. </div>
  491. </el-dialog>
  492. </div>
  493. </template>
  494. <script>
  495. import { operationAgreement } from "@/api/agreement/agreement";
  496. import {feesCheck,revokefeeCheck} from "@/api/warehouseBusiness/warehouseInStock";
  497. export default {
  498. name: 'payMoney',
  499. props: {
  500. browseStatus: {
  501. type: Boolean,
  502. default: false,
  503. },
  504. warehouseCrList: {
  505. type: Array,
  506. default: [],
  507. },
  508. businessTypeOption: {
  509. type: Array,
  510. default: [],
  511. },
  512. fMblnoOptions: {
  513. type: Array,
  514. default: [],
  515. },
  516. fCNameOptions: {
  517. type: Array,
  518. default: [],
  519. },
  520. fFeetUnitOptions: {
  521. type: Array,
  522. default: [],
  523. },
  524. fStltypeOptions: {
  525. type: Array,
  526. default: [],
  527. },
  528. fGrossweight: {
  529. type: Number,
  530. default: null,
  531. },
  532. fQty: {
  533. type: Number,
  534. default: null,
  535. },
  536. fNetweight: {
  537. type: Number,
  538. default: null,
  539. },
  540. fCntqty: {
  541. type: Number,
  542. default: null,
  543. },
  544. form: {
  545. type: Object,
  546. default: null,
  547. },
  548. },
  549. data() {
  550. return {
  551. warehousingagreements: false,
  552. dialogWhgenlegList: [],
  553. whgenlegTotal: 0,
  554. Navigation: false,
  555. tasklegList: [],
  556. // dialogWhgenlegList: [],
  557. pageNum: 1,
  558. pageSize: 10,
  559. };
  560. },
  561. methods: {
  562. feeChange() {
  563. this.$emit("feeChangeC", 'C');
  564. },
  565. saveForm() {
  566. this.$emit("chiSave");
  567. },
  568. addpayment() {
  569. this.$emit("chiAdd");
  570. },
  571. // 付款合计
  572. warehouseDrSummaries(param) {
  573. const { columns, data } = param;
  574. const sums = [];
  575. columns.forEach((column, index) => {
  576. if (index === 0) {
  577. sums[index] = "合计";
  578. return;
  579. }
  580. const values = data.map((item) => Number(item[column.property]));
  581. if (
  582. column.property === "fAmount"
  583. // column.property === "fUnitprice" ||
  584. // column.property === "fAmount" ||
  585. // column.property === "fQty"
  586. ) {
  587. sums[index] = values.reduce((prev, curr) => {
  588. const value = Number(curr);
  589. if (!isNaN(value)) {
  590. return prev + curr;
  591. } else {
  592. return prev;
  593. }
  594. }, 0);
  595. sums[index] = sums[index].toFixed(2);
  596. }
  597. });
  598. return sums;
  599. },
  600. deleteRow(index, rows) {
  601. rows.splice(index, 1);
  602. },
  603. // 变更计价单位
  604. changeFeeUnit(row) {
  605. if (!row.fFeeUnitid) {
  606. return false;
  607. }
  608. if (row.fFeeUnitid === "2") {
  609. this.$set(row, "fQty", (this.fGrossweight / 1000).toFixed(2));
  610. } else if (row.fFeeUnitid === "1") {
  611. this.$set(row, "fQty", this.fQty.toFixed(2));
  612. } else if (row.fFeeUnitid === "3") {
  613. this.$set(row, "fQty", (this.fNetweight / 1000).toFixed(2));
  614. } else if (row.fFeeUnitid === "7") {
  615. this.$set(row, "fQty", this.fCntqty);
  616. } else {
  617. this.$set(row, "fQty", 0);
  618. }
  619. if (row.fUnitprice) {
  620. this.$set(
  621. row,
  622. "fAmount",
  623. parseFloat(Number(row.fUnitprice) * Number(row.fQty)).toFixed(2)
  624. );
  625. }
  626. },
  627. // 数量计算
  628. changeContractAmt(row) {
  629. let fQty = 0;
  630. let fUnitprice = 0;
  631. if (row.fUnitprice) {
  632. fUnitprice = row.fUnitprice;
  633. }
  634. if (row.fQty) {
  635. fQty = row.fQty;
  636. }
  637. this.$set(row, "fAmount", Number(fUnitprice) * Number(fQty)).toFixed(2);
  638. },
  639. handleSelect() {
  640. if (!this.form.fCorpid) {
  641. this.$message({
  642. message: "请维护客户",
  643. type: "warning",
  644. });
  645. } else if (this.form.fProductName == undefined) {
  646. this.$message({
  647. message: "请维护入库明细品名",
  648. type: "warning",
  649. });
  650. } else {
  651. this.pageNum = 1;
  652. this.pageSize = 10;
  653. this.dialogWhgenlegList = [];
  654. this.whgenlegTotal = 0;
  655. this.warehousingagreements = true;
  656. this.getWhgenlegList();
  657. }
  658. },
  659. // 查询作业费信息
  660. getWhgenlegList() {
  661. let data = {};
  662. this.Navigation = false;
  663. data = {
  664. pageNum: this.pageNum,
  665. pageSize: this.pageSize,
  666. fTaskType: 1,
  667. fFleet: this.form.fFleet,
  668. };
  669. operationAgreement(data).then((response) => {
  670. response.rows.map((e) => {
  671. if (e.fFeeUnitid) {
  672. e.fFeeUnitid = e.fFeeUnitid.toString();
  673. }
  674. });
  675. this.tasklegList = response.rows;
  676. this.whgenlegTotal = response.total;
  677. });
  678. },
  679. // 库存总账多选框
  680. whgenlegSelectionChange(selection) {
  681. this.dialogWhgenlegList = selection;
  682. },
  683. //导入收付款信息明细
  684. zhgenlegData() {
  685. if (this.dialogWhgenlegList.length === 0) {
  686. this.$message({
  687. message: "请选择需要导入的数据",
  688. type: "warning",
  689. });
  690. } else {
  691. this.dialogWhgenlegList.map((e) => {
  692. let qty = 1;
  693. if (e.fFeeUnitid == 1) {
  694. qty = this.fQty;
  695. } else if (e.fFeeUnitid == 2) {
  696. qty = (this.fGrossweight / 1000).toFixed(2);
  697. } else if (e.fFeeUnitid == 3) {
  698. qty = (this.fNetweight / 1000).toFixed(2);
  699. } else if (e.fFeeUnitid == 7) {
  700. qty = this.fCntqty;
  701. }
  702. let fAmount = 0;
  703. fAmount = e.fPrice * qty;
  704. this.warehouseCrList.push({
  705. fQty: qty,
  706. fCorpid: e.fCorpid,
  707. fFeeid: e.feeFId,
  708. fFeeUnitid: e.fFeeUnitid,
  709. fUnitprice: e.fPrice,
  710. fCurrency: "RMB",
  711. fExrate: 1,
  712. fAmount: fAmount,
  713. fTaxrate: this.fTaxrate,
  714. fMblno: this.form.fMblno,
  715. fProductName: this.form.fProductName,
  716. fMarks: this.form.fMarks,
  717. fBusinessType: this.form.fBusinessType,
  718. fSrcTypeId: e.fId,
  719. });
  720. });
  721. this.warehousingagreements = false;
  722. }
  723. },
  724. // 费用明细请核
  725. listCheck(row) {
  726. feesCheck(row.fId).then(res => {
  727. this.$message.success('请核成功')
  728. if (res.data.fDc == 'D') {
  729. let index = this.warehouseDrList.findIndex(item => item.fId == res.data.fId)
  730. this.warehouseDrList.splice(index, 1, res.data)
  731. } else {
  732. let index = this.warehouseCrList.findIndex(item => item.fId == res.data.fId)
  733. this.warehouseCrList.splice(index, 1, res.data)
  734. }
  735. })
  736. },
  737. // 费用明细撤销请核
  738. revokeListCheck(row) {
  739. revokefeeCheck(row.fId).then(res => {
  740. this.$message.success('操作成功')
  741. if (res.data.fDc == 'D') {
  742. let index = this.warehouseDrList.findIndex(item => item.fId == res.data.fId)
  743. this.warehouseDrList.splice(index, 1, res.data)
  744. } else {
  745. let index = this.warehouseCrList.findIndex(item => item.fId == res.data.fId)
  746. this.warehouseCrList.splice(index, 1, res.data)
  747. }
  748. })
  749. },
  750. },
  751. watch: {
  752. browseStatus(val) {
  753. this.browseStatus = val;
  754. },
  755. warehouseCrList(val) {
  756. this.warehouseCrList = val;
  757. },
  758. },
  759. };
  760. </script>
  761. <style scoped lang="scss">
  762. </style>