inventoryTableNew.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <template>
  2. <div>
  3. <!-- <div v-for="(item) in datasource" style="margin-bottom: 10px">
  4. <div>
  5. <div style="margin-bottom: 10px;font-weight: bold;">
  6. <div>
  7. <el-divider direction="vertical"></el-divider>
  8. <span><span>{{ index + 1 }}</span> 销售订单:</span>
  9. <span>{{ item.orderNo }}</span>
  10. <el-divider direction="vertical"></el-divider> -->
  11. <!-- <span>计价方式:</span>
  12. <span> {{ item.pricingWay == 1 ? '按数量计费' : '按重量计费' }}</span> -->
  13. <!-- <el-divider direction="vertical"></el-divider> -->
  14. <!-- <span>总金额:</span>
  15. <span>{{item.amountTotalPrice}}</span>
  16. <el-divider direction="vertical"></el-divider>
  17. <span>应收金额:</span>
  18. <span>{{item.amountReceivablePrice}}</span>
  19. <el-divider direction="vertical"></el-divider>
  20. <span>应付金额:</span>
  21. <span>{{item.amountPayablePrice}}</span>
  22. </div>
  23. </div>
  24. <template v-if="item.orderType!=6">
  25. <div v-for="(j,i) in item.subList" :key="i">
  26. <ele-pro-table :show-summary="true" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
  27. :columns="getColumns(j)" max-height="500px" style="margin-bottom: 10px"
  28. :sub-title="getTitle(j)" :toolkit="[]" :datasource="j.detailList"
  29. cache-key="systemRoleTable17-11121" class="time-form">
  30. <template v-slot:action="{ row,$index }">
  31. <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
  32. <template v-slot:reference>
  33. <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
  34. 删除
  35. </el-link>
  36. </template>
  37. </el-popconfirm>
  38. </template>
  39. </ele-pro-table>
  40. </div>
  41. </template>
  42. <div v-else>
  43. <ele-pro-table :show-summary="true" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
  44. :columns="getColumns({subType:10})" sub-title="赔付订单" max-height="500px" style="margin-bottom: 10px"
  45. :toolkit="[]" :datasource="item.detailList"
  46. cache-key="systemRoleTable17-11121" class="time-form">
  47. <template v-slot:action="{ row,$index }">
  48. <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
  49. <template v-slot:reference>
  50. <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
  51. 删除
  52. </el-link>
  53. </template>
  54. </el-popconfirm>
  55. </template> -->
  56. <!-- <template v-slot:productName="{ row,$index }">-->
  57. <!-- <el-popover-->
  58. <!-- placement="right"-->
  59. <!-- width="60%"-->
  60. <!-- trigger="hover">-->
  61. <!-- <ele-pro-table ref="childrenTable"-->
  62. <!-- row-key="id"-->
  63. <!-- max-height="300px"-->
  64. <!-- :needPage="false" :columns="childrenColumns" :toolkit="[]"-->
  65. <!-- :datasource="row.productList"-->
  66. <!-- cache-key="systemRoleTable17-222" class="time-form">-->
  67. <!-- </ele-pro-table>-->
  68. <!-- <el-button type="text" slot="reference">{{ row.productName }}</el-button>-->
  69. <!-- </el-popover>-->
  70. <!-- </template>-->
  71. <!-- </ele-pro-table>
  72. </div>
  73. </div>
  74. </div> -->
  75. <el-collapse v-model="activeNames">
  76. <el-collapse-item v-for="(item, index) in datasource" :key="index" :name="index">
  77. <template slot="title">
  78. <div class="collapse-title">
  79. <div class="collapse-title-left"><span class="collapse-title-index">{{ index + 1 }}</span> 销售订单:{{ item.orderNo }}</div>
  80. <div class="collapse-title-right">
  81. <span>订单金额:{{ item.amountTotalPrice || 0 }}元</span>
  82. <span>已对账金额:{{ item.statementAmount || 0 }}元</span>
  83. <span>未对账金额:{{ item.unStatementAmount || 0 }}元</span>
  84. </div>
  85. </div>
  86. </template>
  87. <div>
  88. <el-tabs type="border-card">
  89. <el-tab-pane label="调拨单">
  90. <ele-pro-table :show-summary="false" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
  91. :columns="getColumns(item, 'deliveryProducts')" max-height="500px" style="margin-bottom: 10px" :datasource="item.deliveryProducts || []"
  92. cache-key="systemRoleTable17-11121" class="time-form">
  93. <template v-slot:toolbar>
  94. <div class="headbox">
  95. <div>
  96. <span class="amount">对账金额合计:{{ getSummariesA(item.deliveryProducts || []) }}元</span>
  97. </div>
  98. </div>
  99. </template>
  100. <template v-slot:action="{ row,$index }">
  101. <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
  102. <template v-slot:reference>
  103. <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
  104. 删除
  105. </el-link>
  106. </template>
  107. </el-popconfirm>
  108. </template>
  109. </ele-pro-table>
  110. </el-tab-pane>
  111. <el-tab-pane label="退货单">
  112. <ele-pro-table :show-summary="false" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
  113. :columns="getColumns(item, 'returnProducts')" max-height="500px" style="margin-bottom: 10px" :datasource="item.returnProducts || []"
  114. cache-key="systemRoleTable17-11122" class="time-form">
  115. <template v-slot:toolbar>
  116. <div class="headbox">
  117. <div>
  118. <span class="amount">对账金额合计:{{ getSummariesA(item.deliveryProducts || []) }}元</span>
  119. </div>
  120. </div>
  121. </template>
  122. <template v-slot:action="{ row,$index }">
  123. <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
  124. <template v-slot:reference>
  125. <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
  126. 删除
  127. </el-link>
  128. </template>
  129. </el-popconfirm>
  130. </template>
  131. </ele-pro-table>
  132. </el-tab-pane>
  133. </el-tabs>
  134. </div>
  135. </el-collapse-item>
  136. </el-collapse>
  137. <!-- <el-row v-if="dialogType=='view'" style="margin-top: 10px">-->
  138. <!-- <el-col :span="6" style="float: right;">-->
  139. <!-- <el-descriptions class="margin-top" direction="vertical" :column="3" size="small" border>-->
  140. <!-- <el-descriptions-item label="本期应收款总额">{{ dataForm.amountReceivablePrice }}</el-descriptions-item>-->
  141. <!-- <el-descriptions-item label="截止上期欠款">-->
  142. <!-- <template>{{ dataForm.previousPeriodEndDebt }}</template>-->
  143. <!-- </el-descriptions-item>-->
  144. <!-- </el-descriptions>-->
  145. <!-- </el-col>-->
  146. <!-- </el-row>-->
  147. </div>
  148. </template>
  149. <script>
  150. import dictMixins from '@/mixins/dictMixins';
  151. import { pricingWayList } from '@/enum/dict';
  152. export default {
  153. mixins: [dictMixins],
  154. components: {},
  155. props: ['datasource', 'dialogType', 'dataForm'],
  156. computed: {
  157. getColumns() {
  158. return (item, type)=>{
  159. let basicFields = [
  160. {
  161. width: 60,
  162. label: '序号',
  163. type: 'index',
  164. columnKey: 'index',
  165. align: 'center',
  166. fixed: 'left'
  167. },
  168. {
  169. minWidth: 130,
  170. prop: 'statementSubOrderNo',
  171. label: type == 'deliveryProducts'?'发货单编码':'退货单编码',
  172. align: 'center',
  173. slot: 'statementSubOrderNo',
  174. showOverflowTooltip: true
  175. },
  176. {
  177. minWidth: 130,
  178. prop: 'productOperateTime',
  179. label: type == 'deliveryProducts'?'发货日期':'退货日期',
  180. align: 'center',
  181. slot: 'productOperateTime',
  182. showOverflowTooltip: true
  183. },
  184. {
  185. minWidth: 120,
  186. prop: 'productCode',
  187. label: '产品编码',
  188. slot: 'productCode',
  189. align: 'center',
  190. showOverflowTooltip: true
  191. },
  192. {
  193. minWidth: 140,
  194. prop: 'productName',
  195. label: '产品名称',
  196. slot: 'productName',
  197. align: 'center',
  198. showOverflowTooltip: true
  199. },
  200. // {
  201. // minWidth: 140,
  202. // prop: 'subType',
  203. // label: '退货产品类型',
  204. // slot: 'subType',
  205. // align: 'center',
  206. // show:j.subType==11,
  207. // showOverflowTooltip: true,formatter(_row, _column, cellValue){
  208. // return cellValue==12?'实物赔偿':'原货'
  209. // }
  210. // },
  211. {
  212. minWidth: 100,
  213. prop: 'specification',
  214. label: '规格',
  215. align: 'center',
  216. slot: 'specification',
  217. showOverflowTooltip: true
  218. },
  219. {
  220. minWidth: 100,
  221. prop: 'modelType',
  222. label: '型号',
  223. align: 'center',
  224. slot: 'modelType',
  225. showOverflowTooltip: true
  226. },
  227. // {
  228. // prop: 'provenance',
  229. // label: '产地',
  230. // slot: 'provenance',
  231. // align: 'center',
  232. // // show:this.contractBookType==2,
  233. // minWidth: 200,
  234. // showOverflowTooltip: true,
  235. // formatter: (row, column) => {
  236. // return row.provenance && row.provenance.length
  237. // ? row.provenance
  238. // .map((item) => this.getDictValue('产地', item ))
  239. // .join(',')
  240. // : '';
  241. // }
  242. // },
  243. {
  244. minWidth: 100,
  245. prop: 'pricingWay',
  246. label: '计价方式',
  247. align: 'center',
  248. slot: 'pricingWay',
  249. showOverflowTooltip: true,
  250. formatter: (_row, _column, cellValue) => {
  251. let pricingWay = pricingWayList.find(item => item.id == cellValue)
  252. return pricingWay ? pricingWay.name : ''
  253. }
  254. },
  255. {
  256. minWidth: 100,
  257. prop: 'totalCount',
  258. label: '数量',
  259. align: 'center',
  260. slot: 'totalCount'
  261. },
  262. {
  263. minWidth: 120,
  264. prop: 'measuringUnit',
  265. label: '计量单位',
  266. align: 'center',
  267. slot: 'measuringUnit'
  268. },
  269. {
  270. width: 100,
  271. prop: 'receiveTotalWeight',
  272. label: '收货总重',
  273. slot: 'receiveTotalWeight',
  274. align: "center"
  275. },
  276. {
  277. width: 100,
  278. prop: 'sendTotalWeight',
  279. label: '发货总重',
  280. slot: 'sendTotalWeight',
  281. align: "center",
  282. headerSlot: 'headerTotalCount'
  283. },
  284. {
  285. width: 100,
  286. prop: 'increaseTotalWeight',
  287. label: '增重重量',
  288. slot: 'increaseTotalWeight',
  289. align: "center"
  290. },
  291. {
  292. width: 100,
  293. prop: 'weightUnit',
  294. label: '重量单位',
  295. slot: 'weightUnit',
  296. align: "center"
  297. },
  298. {
  299. minWidth: 90,
  300. prop: 'singlePrice',
  301. label: '单价',
  302. align: 'center',
  303. slot: 'singlePrice',
  304. },
  305. {
  306. minWidth: 100,
  307. prop: 'taxRate',
  308. label: '税率',
  309. align: 'center',
  310. },
  311. {
  312. width: 150,
  313. prop: 'notTaxSinglePrice',
  314. label: '不含税单价',
  315. align: 'center'
  316. },
  317. {
  318. minWidth: 120,
  319. prop: 'totalPrice',
  320. label: '合计',
  321. slot: 'totalPrice',
  322. align: 'center',
  323. },
  324. {
  325. minWidth: 100,
  326. prop: 'discountRate',
  327. label: '折让比列',
  328. align: 'center',
  329. },
  330. {
  331. minWidth: 100,
  332. prop: 'discountSinglePrice',
  333. label: '折让单价',
  334. align: 'center',
  335. },
  336. {
  337. minWidth: 120,
  338. prop: 'discountTotalPrice',
  339. label: '折让合计',
  340. slot: 'discountTotalPrice',
  341. align: 'center',
  342. },
  343. ]
  344. let permissionType = {
  345. // 'financeLeader': [
  346. // {
  347. // minWidth: 130,
  348. // prop: 'receivedPrice',
  349. // label: '已收款金额',
  350. // align: 'center',
  351. // slot: 'receivedPrice',
  352. // headerSlot: 'headerReceivedPrice'
  353. // },
  354. // {
  355. // minWidth: 130,
  356. // prop: 'receivablePrice',
  357. // label: '应收款金额',
  358. // align: 'center',
  359. // slot: 'receivablePrice',
  360. // },
  361. // {
  362. // minWidth: 140,
  363. // prop: 'receivableDate',
  364. // label: '应收款日期',
  365. // align: 'center',
  366. // slot: 'receivableDate',
  367. // headerSlot: 'headerReceivableDate'
  368. // },
  369. // {
  370. // minWidth: 130,
  371. // prop: 'invoicedPrice',
  372. // label: '已开票金额',
  373. // align: 'center',
  374. // slot: 'invoicedPrice',
  375. // headerSlot: 'headerInvoicedPrice'
  376. // },
  377. // {
  378. // minWidth: 130,
  379. // prop: 'notInvoicedPrice',
  380. // label: '未开票金额',
  381. // align: 'center',
  382. // slot: 'notInvoicedPrice'
  383. // },
  384. // ],
  385. // 'leader': [
  386. // {
  387. // minWidth: 130,
  388. // prop: 'receivedPrice',
  389. // label: '已收款金额',
  390. // align: 'center',
  391. // slot: 'receivedPrice'
  392. // },
  393. // {
  394. // minWidth: 130,
  395. // prop: 'receivablePrice',
  396. // label: '应收款金额',
  397. // align: 'center',
  398. // slot: 'receivablePrice'
  399. // },
  400. // {
  401. // minWidth: 140,
  402. // prop: 'receivableDate',
  403. // label: '应收款日期',
  404. // align: 'center',
  405. // slot: 'receivableDate'
  406. // },
  407. // {
  408. // minWidth: 130,
  409. // prop: 'invoicedPrice',
  410. // label: '已开票金额',
  411. // align: 'center',
  412. // slot: 'invoicedPrice'
  413. // },
  414. // {
  415. // minWidth: 130,
  416. // prop: 'notInvoicedPrice',
  417. // label: '未开票金额',
  418. // align: 'center',
  419. // slot: 'notInvoicedPrice'
  420. // },
  421. // ],
  422. // 'uploadReceipt': [
  423. // {
  424. // minWidth: 130,
  425. // prop: 'receivedPrice',
  426. // label: '已收款金额',
  427. // align: 'center',
  428. // slot: 'receivedPrice'
  429. // },
  430. // {
  431. // minWidth: 130,
  432. // prop: 'receivablePrice',
  433. // label: '应收款金额',
  434. // align: 'center',
  435. // slot: 'receivablePrice'
  436. // },
  437. // {
  438. // minWidth: 140,
  439. // prop: 'receivableDate',
  440. // label: '应收款日期',
  441. // align: 'center',
  442. // slot: 'receivableDate'
  443. // },
  444. // {
  445. // minWidth: 130,
  446. // prop: 'invoicedPrice',
  447. // label: '已开票金额',
  448. // align: 'center',
  449. // slot: 'invoicedPrice'
  450. // },
  451. // {
  452. // minWidth: 130,
  453. // prop: 'notInvoicedPrice',
  454. // label: '未开票金额',
  455. // align: 'center',
  456. // slot: 'notInvoicedPrice'
  457. // },
  458. // ],
  459. }
  460. permissionType[this.taskDefinitionKey] && basicFields.push(...permissionType[this.taskDefinitionKey])
  461. return basicFields
  462. }
  463. },
  464. getTitle(){
  465. return (item, type)=>{
  466. // let title=this.subTypeList[j.subType]+(j.statementSubOrderCode||'')+' '
  467. // if(j.subType==11&&j.subExecType){
  468. // if(j.subExecType=='10'){
  469. // title=title+' 退货方式:全部原货 '
  470. // }
  471. // if(j.subExecType=='20'){
  472. // title=title+' 退货方式:部分原货+实物赔偿'
  473. // }
  474. // if(j.subExecType=='30'){
  475. // title=title+' 退货方式:部分原货+现金赔偿 '+' 赔偿金额:'+j.amountPayablePrice
  476. // }
  477. // if(j.subExecType=='40'){
  478. // title=title+' 退货方式:全部实物赔偿'
  479. // }
  480. // if(j.subExecType=='50'){
  481. // title=title+' 退货方式:全部现金赔偿 '+' 赔偿金额:'+j.amountPayablePrice
  482. // }
  483. // }
  484. console.log(item[type])
  485. const total = item[type]?.reduce((prev, curr) => {
  486. console.log(curr.discountTotalPrice)
  487. return prev + Number(curr.discountTotalPrice || 0) + '元';
  488. }, 0);
  489. return `对账金额合计:${total}`
  490. }
  491. },
  492. getFHDatasource() {
  493. return (item)=>{
  494. return item.subList?.detailList
  495. }
  496. }
  497. },
  498. created(){
  499. this.requestDict('产地');
  500. },
  501. data() {
  502. return {
  503. activeNames: [],
  504. rules: {},
  505. form: {},
  506. subTypeList:{
  507. 10:'发货单:',
  508. 11:'退货单:',
  509. 12:'实物赔偿清单:',
  510. 30:'调拨单:',
  511. },
  512. subColumnsTypeList:{
  513. 10: '发货',
  514. 11: '退货',
  515. 30: '调拨'
  516. },
  517. };
  518. },
  519. mounted() {
  520. this.activeNames = this.datasource.map((item, index) => index.toString());
  521. console.log('activeNames~~~', this.activeNames)
  522. },
  523. methods: {
  524. remove(tableIndex, lineIndex, delType) {
  525. let params = {
  526. tableIndex,
  527. lineIndex,
  528. delType
  529. }
  530. this.$emit('handleRemove', params)
  531. },
  532. getSummaries(param) {
  533. const {columns, data} = param;
  534. const sums = [];
  535. let fields = ['totalPrice', 'notInvoicedPrice', 'invoicedPrice', 'receivablePrice', 'receivedPrice', 'discountTotalPrice']
  536. columns.forEach((column, index) => {
  537. if (index === 0) {
  538. sums[index] = '合计';
  539. return;
  540. }
  541. const values = fields.includes(column.property) ? data.map(item => Number(item[column.property])) : []
  542. if (!values.every(value => isNaN(value))) {
  543. sums[index] = values.reduce((prev, curr) => {
  544. const value = Number(curr);
  545. if (!isNaN(value)) {
  546. return prev + curr;
  547. } else {
  548. return prev;
  549. }
  550. }, 0);
  551. sums[index] = (sums[index]).toFixed(2)
  552. } else {
  553. sums[index] = '';
  554. }
  555. });
  556. return sums;
  557. },
  558. getSummariesA(table) {
  559. return table.reduce((prev, curr) => {
  560. return prev + Number(curr.discountTotalPrice || 0)
  561. }, 0)
  562. }
  563. }
  564. };
  565. </script>
  566. <style lang="scss" scoped>
  567. .collapse-title {
  568. display: flex;
  569. justify-content: space-between;
  570. align-items: center;
  571. width: 96%;
  572. }
  573. .collapse-title-left {
  574. display: flex;
  575. /* justify-content: center; */
  576. align-items: center;
  577. font-size: 16px;
  578. }
  579. .collapse-title-index {
  580. width: 24px;
  581. height: 24px;
  582. background: #63a103;
  583. display: inline-block;
  584. text-align: center;
  585. line-height: 24px;
  586. border-radius: 50%;
  587. color: #fff;
  588. margin-right: 10px;
  589. font-size: 14px;
  590. }
  591. .collapse-title-right {
  592. display:grid;
  593. grid-auto-flow: column;
  594. gap: 18px;
  595. }
  596. .headbox {
  597. display: flex;
  598. justify-content: space-between;
  599. align-items: center;
  600. .amount {
  601. font-size: 14px;
  602. font-weight: bold;
  603. padding-right: 30px;
  604. }
  605. }
  606. .time-form .el-form-item {
  607. margin-bottom: 0 !important;
  608. }
  609. ::v-deep .period {
  610. display: flex;
  611. .borderleftnone {
  612. .el-input--medium .el-input__inner {
  613. border-top-right-radius: 0;
  614. border-bottom-right-radius: 0;
  615. }
  616. }
  617. .borderrightnone {
  618. .el-input--medium .el-input__inner {
  619. border-top-left-radius: 0;
  620. border-bottom-left-radius: 0;
  621. }
  622. }
  623. }
  624. ::v-deep .time-form tbody > tr:hover > td {
  625. background-color: transparent !important;
  626. }
  627. ::v-deep .time-form .el-table tr {
  628. background-color: #ffffff;
  629. }
  630. .pricebox {
  631. display: flex;
  632. justify-content: flex-start;
  633. align-items: center;
  634. font-weight: bold;
  635. }
  636. ::v-deep.el-divider {
  637. margin: 10px;
  638. font-weight: bold;
  639. }
  640. </style>