inventoryTable.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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>
  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. </ele-pro-table>
  31. </div>
  32. </template>
  33. <div v-else>
  34. <ele-pro-table :show-summary="true" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
  35. :columns="getColumns({subType:10})" sub-title="赔付订单" max-height="500px" style="margin-bottom: 10px"
  36. :toolkit="[]" :datasource="item.detailList"
  37. cache-key="systemRoleTable17-11121" class="time-form">
  38. <!-- <template v-slot:productName="{ row,$index }">-->
  39. <!-- <el-popover-->
  40. <!-- placement="right"-->
  41. <!-- width="60%"-->
  42. <!-- trigger="hover">-->
  43. <!-- <ele-pro-table ref="childrenTable"-->
  44. <!-- row-key="id"-->
  45. <!-- max-height="300px"-->
  46. <!-- :needPage="false" :columns="childrenColumns" :toolkit="[]"-->
  47. <!-- :datasource="row.productList"-->
  48. <!-- cache-key="systemRoleTable17-222" class="time-form">-->
  49. <!-- </ele-pro-table>-->
  50. <!-- <el-button type="text" slot="reference">{{ row.productName }}</el-button>-->
  51. <!-- </el-popover>-->
  52. <!-- </template>-->
  53. </ele-pro-table>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import dictMixins from '@/mixins/dictMixins';
  61. export default {
  62. mixins: [dictMixins],
  63. components: {},
  64. props: ['datasource', 'dataForm','dialogType', 'taskDefinitionKey', 'priceObj'],
  65. computed: {
  66. getColumns() {
  67. return (j)=>{
  68. let basicFields = [
  69. {
  70. width: 60,
  71. label: '序号',
  72. type: 'index',
  73. columnKey: 'index',
  74. align: 'center',
  75. },
  76. {
  77. minWidth: 130,
  78. prop: 'productOperateTime',
  79. label: this.subColumnsTypeList[j.subType],
  80. align: 'center',
  81. slot: 'productOperateTime',
  82. showOverflowTooltip: true
  83. },
  84. {
  85. minWidth: 120,
  86. prop: 'productCode',
  87. label: '产品编码',
  88. slot: 'productCode',
  89. align: 'center',
  90. showOverflowTooltip: true
  91. },
  92. {
  93. minWidth: 140,
  94. prop: 'productName',
  95. label: '产品名称',
  96. slot: 'productName',
  97. align: 'center',
  98. showOverflowTooltip: true
  99. },
  100. {
  101. minWidth: 140,
  102. prop: 'subType',
  103. label: '退货产品类型',
  104. slot: 'subType',
  105. align: 'center',
  106. show:j.subType==11,
  107. showOverflowTooltip: true,formatter(_row, _column, cellValue){
  108. return cellValue==12?'实物赔偿':'原货'
  109. }
  110. },
  111. {
  112. minWidth: 100,
  113. prop: 'specification',
  114. label: '规格',
  115. align: 'center',
  116. slot: 'specification',
  117. showOverflowTooltip: true
  118. },
  119. {
  120. minWidth: 100,
  121. prop: 'modelType',
  122. label: '型号',
  123. align: 'center',
  124. slot: 'modelType',
  125. showOverflowTooltip: true
  126. },
  127. {
  128. prop: 'provenance',
  129. label: '产地',
  130. slot: 'provenance',
  131. align: 'center',
  132. // show:this.contractBookType==2,
  133. minWidth: 200,
  134. showOverflowTooltip: true,
  135. formatter: (row, column) => {
  136. return row.provenance && row.provenance.length
  137. ? row.provenance
  138. .map((item) => this.getDictValue('产地', item ))
  139. .join(',')
  140. : '';
  141. }
  142. },
  143. {
  144. minWidth: 100,
  145. prop: 'pricingWay',
  146. label: '计价方式',
  147. align: 'center',
  148. slot: 'pricingWay',
  149. showOverflowTooltip: true,
  150. formatter: (_row, _column, cellValue) => {
  151. return _row.pricingWay == 1 ? '按数量计价' : '按重量计价'
  152. }
  153. },
  154. {
  155. minWidth: 100,
  156. prop: 'totalCount',
  157. label: '数量',
  158. align: 'center',
  159. slot: 'totalCount'
  160. },
  161. {
  162. minWidth: 120,
  163. prop: 'measuringUnit',
  164. label: '计量单位',
  165. align: 'center',
  166. slot: 'measuringUnit'
  167. },
  168. {
  169. width: 100,
  170. prop: 'receiveTotalWeight',
  171. label: '收货总重',
  172. slot: 'receiveTotalWeight',
  173. align: "center"
  174. },
  175. {
  176. width: 100,
  177. prop: 'sendTotalWeight',
  178. label: '发货总重',
  179. slot: 'sendTotalWeight',
  180. align: "center",
  181. headerSlot: 'headerTotalCount'
  182. },
  183. {
  184. width: 100,
  185. prop: 'increaseTotalWeight',
  186. label: '增重重量',
  187. slot: 'increaseTotalWeight',
  188. align: "center"
  189. },
  190. {
  191. width: 100,
  192. prop: 'weightUnit',
  193. label: '重量单位',
  194. slot: 'weightUnit',
  195. align: "center"
  196. },
  197. // {
  198. // minWidth: 90,
  199. // prop: 'singlePrice',
  200. // label: '单价',
  201. // align: 'center',
  202. // slot: 'singlePrice'
  203. // },
  204. {
  205. minWidth: 90,
  206. prop: 'singlePrice',
  207. label: '单价',
  208. align: 'center',
  209. slot: 'singlePrice',
  210. show:j.subType==11
  211. },
  212. {
  213. minWidth: 100,
  214. prop: 'discountSinglePrice',
  215. label: '单价',
  216. align: 'center',
  217. slot: 'discountSinglePrice',
  218. show:j.subType!=11
  219. },
  220. {
  221. minWidth: 120,
  222. prop: 'totalPrice',
  223. label: '合计金额',
  224. slot: 'totalPrice',
  225. align: 'center',
  226. show:j.subType==11
  227. },
  228. {
  229. minWidth: 120,
  230. prop: 'discountTotalPrice',
  231. label: '合计金额',
  232. slot: 'discountTotalPrice',
  233. align: 'center',
  234. show:j.subType!=11
  235. },
  236. // {
  237. // minWidth: 100,
  238. // prop: 'discountTotalPrice',
  239. // label: '折让合计金额',
  240. // align: 'center',
  241. // slot: 'discountTotalPrice'
  242. // },
  243. ]
  244. let permissionType = {
  245. // 'financeLeader': [
  246. // {
  247. // minWidth: 130,
  248. // prop: 'receivedPrice',
  249. // label: '已收款金额',
  250. // align: 'center',
  251. // slot: 'receivedPrice',
  252. // headerSlot: 'headerReceivedPrice'
  253. // },
  254. // {
  255. // minWidth: 130,
  256. // prop: 'receivablePrice',
  257. // label: '应收款金额',
  258. // align: 'center',
  259. // slot: 'receivablePrice',
  260. // },
  261. // {
  262. // minWidth: 140,
  263. // prop: 'receivableDate',
  264. // label: '应收款日期',
  265. // align: 'center',
  266. // slot: 'receivableDate',
  267. // headerSlot: 'headerReceivableDate'
  268. // },
  269. // {
  270. // minWidth: 130,
  271. // prop: 'invoicedPrice',
  272. // label: '已开票金额',
  273. // align: 'center',
  274. // slot: 'invoicedPrice',
  275. // headerSlot: 'headerInvoicedPrice'
  276. // },
  277. // {
  278. // minWidth: 130,
  279. // prop: 'notInvoicedPrice',
  280. // label: '未开票金额',
  281. // align: 'center',
  282. // slot: 'notInvoicedPrice'
  283. // },
  284. // ],
  285. // 'leader': [
  286. // {
  287. // minWidth: 130,
  288. // prop: 'receivedPrice',
  289. // label: '已收款金额',
  290. // align: 'center',
  291. // slot: 'receivedPrice'
  292. // },
  293. // {
  294. // minWidth: 130,
  295. // prop: 'receivablePrice',
  296. // label: '应收款金额',
  297. // align: 'center',
  298. // slot: 'receivablePrice'
  299. // },
  300. // {
  301. // minWidth: 140,
  302. // prop: 'receivableDate',
  303. // label: '应收款日期',
  304. // align: 'center',
  305. // slot: 'receivableDate'
  306. // },
  307. // {
  308. // minWidth: 130,
  309. // prop: 'invoicedPrice',
  310. // label: '已开票金额',
  311. // align: 'center',
  312. // slot: 'invoicedPrice'
  313. // },
  314. // {
  315. // minWidth: 130,
  316. // prop: 'notInvoicedPrice',
  317. // label: '未开票金额',
  318. // align: 'center',
  319. // slot: 'notInvoicedPrice'
  320. // },
  321. // ],
  322. // 'uploadReceipt': [
  323. // {
  324. // minWidth: 130,
  325. // prop: 'receivedPrice',
  326. // label: '已收款金额',
  327. // align: 'center',
  328. // slot: 'receivedPrice'
  329. // },
  330. // {
  331. // minWidth: 130,
  332. // prop: 'receivablePrice',
  333. // label: '应收款金额',
  334. // align: 'center',
  335. // slot: 'receivablePrice'
  336. // },
  337. // {
  338. // minWidth: 140,
  339. // prop: 'receivableDate',
  340. // label: '应收款日期',
  341. // align: 'center',
  342. // slot: 'receivableDate'
  343. // },
  344. // {
  345. // minWidth: 130,
  346. // prop: 'invoicedPrice',
  347. // label: '已开票金额',
  348. // align: 'center',
  349. // slot: 'invoicedPrice'
  350. // },
  351. // {
  352. // minWidth: 130,
  353. // prop: 'notInvoicedPrice',
  354. // label: '未开票金额',
  355. // align: 'center',
  356. // slot: 'notInvoicedPrice'
  357. // },
  358. // ],
  359. }
  360. permissionType[this.taskDefinitionKey] && basicFields.push(...permissionType[this.taskDefinitionKey])
  361. return basicFields
  362. }
  363. },
  364. getTitle(){
  365. return (j)=>{
  366. let title=this.subTypeList[j.subType]+(j.statementSubOrderCode||'')+' '
  367. if(j.subType==11&&j.subExecType){
  368. if(j.subExecType=='10'){
  369. title=title+' 退货方式:全部原货 '
  370. }
  371. if(j.subExecType=='20'){
  372. title=title+' 退货方式:部分原货+实物赔偿'
  373. }
  374. if(j.subExecType=='30'){
  375. title=title+' 退货方式:部分原货+现金赔偿 '+' 赔偿金额:'+j.amountPayablePrice
  376. }
  377. if(j.subExecType=='40'){
  378. title=title+' 退货方式:全部实物赔偿'
  379. }
  380. if(j.subExecType=='50'){
  381. title=title+' 退货方式:全部现金赔偿 '+' 赔偿金额:'+j.amountPayablePrice
  382. }
  383. }
  384. return title
  385. }
  386. }
  387. },
  388. created(){
  389. this.requestDict('产地');
  390. },
  391. data() {
  392. return {
  393. subTypeList:{
  394. 10:'发货单:',
  395. 11:'退货单:',
  396. 12:'实物赔偿清单:',
  397. },
  398. subColumnsTypeList:{
  399. 10:'发货日期',
  400. 11:'退货日期',
  401. },
  402. };
  403. },
  404. watch: {},
  405. methods: {
  406. handleEditCost(row, p1, p2) {
  407. if (!row[p1]) return row[p2] = row.totalPrice.toFixed(2)
  408. row[p2] = (row.totalPrice - row[p1]).toFixed(2)
  409. },
  410. getSummaries(param) {
  411. const {columns, data} = param;
  412. const sums = [];
  413. let fields = ['totalPrice', 'notInvoicedPrice', 'invoicedPrice', 'receivablePrice', 'receivedPrice','discountTotalPrice']
  414. columns.forEach((column, index) => {
  415. if (index === 0) {
  416. sums[index] = '合计';
  417. return;
  418. }
  419. const values = fields.includes(column.property) ? data.map(item => Number(item[column.property])) : []
  420. if (!values.every(value => isNaN(value))) {
  421. sums[index] = values.reduce((prev, curr) => {
  422. const value = Number(curr);
  423. if (!isNaN(value)) {
  424. return prev + curr;
  425. } else {
  426. return prev;
  427. }
  428. }, 0);
  429. sums[index] = sums[index].toFixed(2)
  430. } else {
  431. sums[index] = '';
  432. }
  433. });
  434. return sums;
  435. }
  436. }
  437. };
  438. </script>
  439. <style lang="scss" scoped>
  440. .headbox {
  441. display: flex;
  442. justify-content: space-between;
  443. align-items: center;
  444. .amount {
  445. font-size: 14px;
  446. font-weight: bold;
  447. padding-right: 30px;
  448. }
  449. }
  450. .time-form .el-form-item {
  451. margin-bottom: 0 !important;
  452. }
  453. ::v-deep .period {
  454. display: flex;
  455. .borderleftnone {
  456. .el-input--medium .el-input__inner {
  457. border-top-right-radius: 0;
  458. border-bottom-right-radius: 0;
  459. }
  460. }
  461. .borderrightnone {
  462. .el-input--medium .el-input__inner {
  463. border-top-left-radius: 0;
  464. border-bottom-left-radius: 0;
  465. }
  466. }
  467. }
  468. ::v-deep .time-form tbody > tr:hover > td {
  469. background-color: transparent !important;
  470. }
  471. ::v-deep .time-form .el-table tr {
  472. background-color: #ffffff;
  473. }
  474. .pricebox {
  475. display: flex;
  476. justify-content: flex-start;
  477. align-items: center;
  478. font-weight: bold;
  479. }
  480. ::v-deep.el-divider {
  481. margin: 10px;
  482. font-weight: bold;
  483. }
  484. </style>