inventoryTable.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  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.returnProducts || []) }}元</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. console.log(this.dataForm)
  160. let basicFields = [
  161. {
  162. width: 60,
  163. label: '序号',
  164. type: 'index',
  165. columnKey: 'index',
  166. align: 'center',
  167. fixed: 'left'
  168. },
  169. {
  170. minWidth: 130,
  171. prop: 'statementSubOrderNo',
  172. label: type == 'deliveryProducts'?'发货单编码':'退货单编码',
  173. align: 'center',
  174. slot: 'statementSubOrderNo',
  175. showOverflowTooltip: true
  176. },
  177. {
  178. minWidth: 130,
  179. prop: 'productOperateTime',
  180. label: type == 'deliveryProducts'?'发货日期':'退货日期',
  181. align: 'center',
  182. slot: 'productOperateTime',
  183. showOverflowTooltip: true
  184. },
  185. {
  186. minWidth: 120,
  187. prop: 'productCode',
  188. label: '产品编码',
  189. slot: 'productCode',
  190. align: 'center',
  191. showOverflowTooltip: true
  192. },
  193. {
  194. minWidth: 140,
  195. prop: 'productName',
  196. label: '产品名称',
  197. slot: 'productName',
  198. align: 'center',
  199. showOverflowTooltip: true
  200. },
  201. // {
  202. // minWidth: 140,
  203. // prop: 'subType',
  204. // label: '退货产品类型',
  205. // slot: 'subType',
  206. // align: 'center',
  207. // show:j.subType==11,
  208. // showOverflowTooltip: true,formatter(_row, _column, cellValue){
  209. // return cellValue==12?'实物赔偿':'原货'
  210. // }
  211. // },
  212. {
  213. minWidth: 100,
  214. prop: 'specification',
  215. label: '规格',
  216. align: 'center',
  217. slot: 'specification',
  218. showOverflowTooltip: true
  219. },
  220. {
  221. minWidth: 100,
  222. prop: 'modelType',
  223. label: '型号',
  224. align: 'center',
  225. slot: 'modelType',
  226. showOverflowTooltip: true
  227. },
  228. // {
  229. // prop: 'provenance',
  230. // label: '产地',
  231. // slot: 'provenance',
  232. // align: 'center',
  233. // // show:this.contractBookType==2,
  234. // minWidth: 200,
  235. // showOverflowTooltip: true,
  236. // formatter: (row, column) => {
  237. // return row.provenance && row.provenance.length
  238. // ? row.provenance
  239. // .map((item) => this.getDictValue('产地', item ))
  240. // .join(',')
  241. // : '';
  242. // }
  243. // },
  244. {
  245. minWidth: 100,
  246. prop: 'pricingWay',
  247. label: '计价方式',
  248. align: 'center',
  249. slot: 'pricingWay',
  250. showOverflowTooltip: true,
  251. formatter: (_row, _column, cellValue) => {
  252. let pricingWay = pricingWayList.find(item => item.id == cellValue)
  253. return pricingWay ? pricingWay.name : ''
  254. }
  255. },
  256. {
  257. minWidth: 100,
  258. prop: 'totalCount',
  259. label: '数量',
  260. align: 'center',
  261. slot: 'totalCount'
  262. },
  263. {
  264. minWidth: 120,
  265. prop: 'measuringUnit',
  266. label: '计量单位',
  267. align: 'center',
  268. slot: 'measuringUnit'
  269. },
  270. {
  271. width: 100,
  272. prop: 'receiveTotalWeight',
  273. label: '收货总重',
  274. slot: 'receiveTotalWeight',
  275. align: "center"
  276. },
  277. {
  278. width: 100,
  279. prop: 'sendTotalWeight',
  280. label: '发货总重',
  281. slot: 'sendTotalWeight',
  282. align: "center",
  283. headerSlot: 'headerTotalCount'
  284. },
  285. {
  286. width: 100,
  287. prop: 'increaseTotalWeight',
  288. label: '增重重量',
  289. slot: 'increaseTotalWeight',
  290. align: "center"
  291. },
  292. {
  293. width: 100,
  294. prop: 'weightUnit',
  295. label: '重量单位',
  296. slot: 'weightUnit',
  297. align: "center"
  298. },
  299. {
  300. minWidth: 90,
  301. prop: 'singlePrice',
  302. label: '单价',
  303. align: 'center',
  304. slot: 'singlePrice',
  305. },
  306. {
  307. minWidth: 100,
  308. prop: 'taxRate',
  309. label: '税率',
  310. align: 'center',
  311. },
  312. {
  313. width: 150,
  314. prop: 'noTaxSinglePrice',
  315. label: '不含税单价',
  316. align: 'center'
  317. },
  318. {
  319. minWidth: 120,
  320. prop: 'totalPrice',
  321. label: '合计',
  322. slot: 'totalPrice',
  323. align: 'center',
  324. },
  325. {
  326. minWidth: 100,
  327. prop: 'discountRatio',
  328. label: '折让比例',
  329. align: 'center',
  330. },
  331. {
  332. minWidth: 100,
  333. prop: 'discountSinglePrice',
  334. label: '折让单价',
  335. align: 'center',
  336. },
  337. {
  338. minWidth: 120,
  339. prop: 'discountTotalPrice',
  340. label: '折让合计',
  341. slot: 'discountTotalPrice',
  342. align: 'center',
  343. },
  344. ]
  345. let permissionType = {
  346. // 'financeLeader': [
  347. // {
  348. // minWidth: 130,
  349. // prop: 'receivedPrice',
  350. // label: '已收款金额',
  351. // align: 'center',
  352. // slot: 'receivedPrice',
  353. // headerSlot: 'headerReceivedPrice'
  354. // },
  355. // {
  356. // minWidth: 130,
  357. // prop: 'receivablePrice',
  358. // label: '应收款金额',
  359. // align: 'center',
  360. // slot: 'receivablePrice',
  361. // },
  362. // {
  363. // minWidth: 140,
  364. // prop: 'receivableDate',
  365. // label: '应收款日期',
  366. // align: 'center',
  367. // slot: 'receivableDate',
  368. // headerSlot: 'headerReceivableDate'
  369. // },
  370. // {
  371. // minWidth: 130,
  372. // prop: 'invoicedPrice',
  373. // label: '已开票金额',
  374. // align: 'center',
  375. // slot: 'invoicedPrice',
  376. // headerSlot: 'headerInvoicedPrice'
  377. // },
  378. // {
  379. // minWidth: 130,
  380. // prop: 'notInvoicedPrice',
  381. // label: '未开票金额',
  382. // align: 'center',
  383. // slot: 'notInvoicedPrice'
  384. // },
  385. // ],
  386. // 'leader': [
  387. // {
  388. // minWidth: 130,
  389. // prop: 'receivedPrice',
  390. // label: '已收款金额',
  391. // align: 'center',
  392. // slot: 'receivedPrice'
  393. // },
  394. // {
  395. // minWidth: 130,
  396. // prop: 'receivablePrice',
  397. // label: '应收款金额',
  398. // align: 'center',
  399. // slot: 'receivablePrice'
  400. // },
  401. // {
  402. // minWidth: 140,
  403. // prop: 'receivableDate',
  404. // label: '应收款日期',
  405. // align: 'center',
  406. // slot: 'receivableDate'
  407. // },
  408. // {
  409. // minWidth: 130,
  410. // prop: 'invoicedPrice',
  411. // label: '已开票金额',
  412. // align: 'center',
  413. // slot: 'invoicedPrice'
  414. // },
  415. // {
  416. // minWidth: 130,
  417. // prop: 'notInvoicedPrice',
  418. // label: '未开票金额',
  419. // align: 'center',
  420. // slot: 'notInvoicedPrice'
  421. // },
  422. // ],
  423. // 'uploadReceipt': [
  424. // {
  425. // minWidth: 130,
  426. // prop: 'receivedPrice',
  427. // label: '已收款金额',
  428. // align: 'center',
  429. // slot: 'receivedPrice'
  430. // },
  431. // {
  432. // minWidth: 130,
  433. // prop: 'receivablePrice',
  434. // label: '应收款金额',
  435. // align: 'center',
  436. // slot: 'receivablePrice'
  437. // },
  438. // {
  439. // minWidth: 140,
  440. // prop: 'receivableDate',
  441. // label: '应收款日期',
  442. // align: 'center',
  443. // slot: 'receivableDate'
  444. // },
  445. // {
  446. // minWidth: 130,
  447. // prop: 'invoicedPrice',
  448. // label: '已开票金额',
  449. // align: 'center',
  450. // slot: 'invoicedPrice'
  451. // },
  452. // {
  453. // minWidth: 130,
  454. // prop: 'notInvoicedPrice',
  455. // label: '未开票金额',
  456. // align: 'center',
  457. // slot: 'notInvoicedPrice'
  458. // },
  459. // ],
  460. }
  461. permissionType[this.taskDefinitionKey] && basicFields.push(...permissionType[this.taskDefinitionKey])
  462. return basicFields
  463. }
  464. },
  465. getTitle(){
  466. return (item, type)=>{
  467. // let title=this.subTypeList[j.subType]+(j.statementSubOrderCode||'')+' '
  468. // if(j.subType==11&&j.subExecType){
  469. // if(j.subExecType=='10'){
  470. // title=title+' 退货方式:全部原货 '
  471. // }
  472. // if(j.subExecType=='20'){
  473. // title=title+' 退货方式:部分原货+实物赔偿'
  474. // }
  475. // if(j.subExecType=='30'){
  476. // title=title+' 退货方式:部分原货+现金赔偿 '+' 赔偿金额:'+j.amountPayablePrice
  477. // }
  478. // if(j.subExecType=='40'){
  479. // title=title+' 退货方式:全部实物赔偿'
  480. // }
  481. // if(j.subExecType=='50'){
  482. // title=title+' 退货方式:全部现金赔偿 '+' 赔偿金额:'+j.amountPayablePrice
  483. // }
  484. // }
  485. console.log(item[type])
  486. const total = item[type]?.reduce((prev, curr) => {
  487. console.log(curr.discountTotalPrice)
  488. return prev + Number(curr.discountTotalPrice || 0) + '元';
  489. }, 0);
  490. return `对账金额合计:${total}`
  491. }
  492. },
  493. },
  494. data() {
  495. return {
  496. activeNames: [],
  497. rules: {},
  498. form: {},
  499. subTypeList:{
  500. 10:'发货单:',
  501. 11:'退货单:',
  502. 12:'实物赔偿清单:',
  503. 30:'调拨单:',
  504. },
  505. subColumnsTypeList:{
  506. 10: '发货',
  507. 11: '退货',
  508. 30: '调拨'
  509. },
  510. };
  511. },
  512. watch: {
  513. datasource: {
  514. handler(newVal, oldVal) {
  515. if (newVal.length > 0) {
  516. this.activeNames = newVal.map((item, index) => index);
  517. console.log('this.activeNames~~~', this.activeNames)
  518. }
  519. },
  520. deep: true
  521. }
  522. },
  523. created(){
  524. this.requestDict('产地');
  525. },
  526. mounted() {
  527. // this.activeNames = this.datasource.map((item, index) => index);
  528. },
  529. methods: {
  530. remove(tableIndex, lineIndex, delType) {
  531. let params = {
  532. tableIndex,
  533. lineIndex,
  534. delType
  535. }
  536. this.$emit('handleRemove', params)
  537. },
  538. getSummaries(param) {
  539. const {columns, data} = param;
  540. const sums = [];
  541. let fields = ['totalPrice', 'notInvoicedPrice', 'invoicedPrice', 'receivablePrice', 'receivedPrice', 'discountTotalPrice']
  542. columns.forEach((column, index) => {
  543. if (index === 0) {
  544. sums[index] = '合计';
  545. return;
  546. }
  547. const values = fields.includes(column.property) ? data.map(item => Number(item[column.property])) : []
  548. if (!values.every(value => isNaN(value))) {
  549. sums[index] = values.reduce((prev, curr) => {
  550. const value = Number(curr);
  551. if (!isNaN(value)) {
  552. return prev + curr;
  553. } else {
  554. return prev;
  555. }
  556. }, 0);
  557. sums[index] = (sums[index]).toFixed(2)
  558. } else {
  559. sums[index] = '';
  560. }
  561. });
  562. return sums;
  563. },
  564. getSummariesA(table) {
  565. return table.reduce((prev, curr) => {
  566. return prev + Number(curr.discountTotalPrice || 0)
  567. }, 0)
  568. }
  569. }
  570. };
  571. </script>
  572. <style lang="scss" scoped>
  573. .collapse-title {
  574. display: flex;
  575. justify-content: space-between;
  576. align-items: center;
  577. width: 96%;
  578. }
  579. .collapse-title-left {
  580. display: flex;
  581. /* justify-content: center; */
  582. align-items: center;
  583. font-size: 16px;
  584. }
  585. .collapse-title-index {
  586. width: 24px;
  587. height: 24px;
  588. background: #63a103;
  589. display: inline-block;
  590. text-align: center;
  591. line-height: 24px;
  592. border-radius: 50%;
  593. color: #fff;
  594. margin-right: 10px;
  595. font-size: 14px;
  596. }
  597. .collapse-title-right {
  598. display:grid;
  599. grid-auto-flow: column;
  600. gap: 18px;
  601. }
  602. .headbox {
  603. display: flex;
  604. justify-content: space-between;
  605. align-items: center;
  606. .amount {
  607. font-size: 14px;
  608. font-weight: bold;
  609. padding-right: 30px;
  610. }
  611. }
  612. .time-form .el-form-item {
  613. margin-bottom: 0 !important;
  614. }
  615. ::v-deep .period {
  616. display: flex;
  617. .borderleftnone {
  618. .el-input--medium .el-input__inner {
  619. border-top-right-radius: 0;
  620. border-bottom-right-radius: 0;
  621. }
  622. }
  623. .borderrightnone {
  624. .el-input--medium .el-input__inner {
  625. border-top-left-radius: 0;
  626. border-bottom-left-radius: 0;
  627. }
  628. }
  629. }
  630. ::v-deep .time-form tbody > tr:hover > td {
  631. background-color: transparent !important;
  632. }
  633. ::v-deep .time-form .el-table tr {
  634. background-color: #ffffff;
  635. }
  636. .pricebox {
  637. display: flex;
  638. justify-content: flex-start;
  639. align-items: center;
  640. font-weight: bold;
  641. }
  642. ::v-deep.el-divider {
  643. margin: 10px;
  644. font-weight: bold;
  645. }
  646. </style>