purchasingAccountTable.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. <el-divider direction="vertical"></el-divider>
  23. <el-button v-if="!item.hasInvoiceApply" :disabled="isButtonDisabled(item)" type="primary" @click="handleChoose(item,true)">
  24. 收票
  25. </el-button>
  26. <span v-else style="color: red">{{'已申请' }}</span>
  27. </div>
  28. </div>
  29. <div v-for="(j,i) in item.subList" :key="i">
  30. <ele-pro-table :show-summary="true" :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
  31. :columns="getColumns(j)" max-height="500px" style="margin-bottom: 10px"
  32. :sub-title="subTypeList[j.subType]+j.statementSubOrderCode" :datasource="j.detailList"
  33. cache-key="systemRoleTable17-11121" class="time-form">
  34. </ele-pro-table>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. export default {
  42. components: {},
  43. inject:['invoiceType'],
  44. props: ['datasource', 'dialogType','dataForm'],
  45. computed: {
  46. getColumns() {
  47. return (j)=>{
  48. let basicFields = [
  49. {
  50. width: 60,
  51. label: '序号',
  52. type: 'index',
  53. columnKey: 'index',
  54. align: 'center',
  55. },
  56. {
  57. minWidth: 130,
  58. prop: 'productOperateTime',
  59. label: this.subColumnsTypeList[j.subType],
  60. align: 'center',
  61. slot: 'productOperateTime',
  62. showOverflowTooltip: true
  63. },
  64. {
  65. minWidth: 120,
  66. prop: 'productCode',
  67. label: '产品编码',
  68. slot: 'productCode',
  69. align: 'center',
  70. showOverflowTooltip: true
  71. },
  72. {
  73. minWidth: 140,
  74. prop: 'productName',
  75. label: '产品名称',
  76. slot: 'productName',
  77. align: 'center',
  78. showOverflowTooltip: true
  79. },
  80. {
  81. minWidth: 100,
  82. prop: 'specification',
  83. label: '规格',
  84. align: 'center',
  85. slot: 'specification',
  86. showOverflowTooltip: true
  87. },
  88. {
  89. minWidth: 100,
  90. prop: 'modelType',
  91. label: '型号',
  92. align: 'center',
  93. slot: 'modelType',
  94. showOverflowTooltip: true
  95. },
  96. // {
  97. // minWidth: 100,
  98. // prop: 'orderNo',
  99. // label: '销售订单编码',
  100. // align: 'center',
  101. // slot: 'orderNo',
  102. // showOverflowTooltip: true
  103. // },
  104. // {
  105. // minWidth: 100,
  106. // prop: 'pricingWay',
  107. // label: '计价方式',
  108. // align: 'center',
  109. // slot: 'pricingWay',
  110. // showOverflowTooltip: true,
  111. // formatter: (_row, _column, cellValue) => {
  112. // return _row.pricingWay == 1 ? '按数量计价' : '按重量计价'
  113. // }
  114. // },
  115. {
  116. minWidth: 100,
  117. prop: 'totalCount',
  118. label: '数量',
  119. align: 'center',
  120. slot: 'totalCount'
  121. },
  122. {
  123. minWidth: 120,
  124. prop: 'measuringUnit',
  125. label: '计量单位',
  126. align: 'center',
  127. slot: 'measuringUnit'
  128. },
  129. {
  130. width: 100,
  131. prop: 'sendTotalWeight',
  132. label: '发货总重',
  133. slot: 'sendTotalWeight',
  134. align: "center",
  135. headerSlot: 'headerTotalCount'
  136. },
  137. {
  138. width: 100,
  139. prop: 'receiveTotalWeight',
  140. label: '收货总重',
  141. slot: 'receiveTotalWeight',
  142. align: "center"
  143. },
  144. {
  145. width: 100,
  146. prop: 'increaseTotalWeight',
  147. label: '增重重量',
  148. slot: 'increaseTotalWeight',
  149. align: "center"
  150. },
  151. {
  152. width: 100,
  153. prop: 'weightUnit',
  154. label: '重量单位',
  155. slot: 'weightUnit',
  156. align: "center"
  157. },
  158. // {
  159. // minWidth: 90,
  160. // prop: 'singlePrice',
  161. // label: '单价',
  162. // align: 'center',
  163. // slot: 'singlePrice'
  164. // },
  165. {
  166. minWidth: 100,
  167. prop: 'discountSinglePrice',
  168. label: '单价',
  169. align: 'center',
  170. slot: 'discountSinglePrice'
  171. },
  172. {
  173. minWidth: 120,
  174. prop: 'discountTotalPrice',
  175. label: '合计金额',
  176. slot: 'discountTotalPrice',
  177. align: 'center',
  178. },
  179. // {
  180. // minWidth: 100,
  181. // prop: 'discountTotalPrice',
  182. // label: '折让合计金额',
  183. // align: 'center',
  184. // slot: 'discountTotalPrice'
  185. // },
  186. ]
  187. let permissionType = {
  188. // 'add': [
  189. // {
  190. // columnKey: 'action',
  191. // label: '操作',
  192. // width: 120,
  193. // align: 'center',
  194. // resizable: false,
  195. // slot: 'action',
  196. // fixed: 'right',
  197. // showOverflowTooltip: true
  198. // }
  199. // ],
  200. // 'update': [
  201. // {
  202. // columnKey: 'action',
  203. // label: '操作',
  204. // width: 120,
  205. // align: 'center',
  206. // resizable: false,
  207. // slot: 'action',
  208. // fixed: 'right',
  209. // showOverflowTooltip: true
  210. // }
  211. // ],
  212. }
  213. permissionType[this.dialogType] && basicFields.push(...permissionType[this.dialogType])
  214. return basicFields
  215. }
  216. },
  217. isButtonDisabled() {
  218. return (item) => {
  219. return this.invoiceType() != 2;
  220. }
  221. },
  222. },
  223. data() {
  224. return {
  225. rules: {},
  226. form: {},
  227. subTypeList:{
  228. 20:'收货单:',
  229. 21:'退货单:',
  230. },
  231. subColumnsTypeList:{
  232. 20:'收货日期',
  233. 21:'退货日期',
  234. },
  235. };
  236. },
  237. methods: {
  238. handleChoose(val, flag) {
  239. this.$emit('getAccountInfo', val)
  240. },
  241. getSummaries(param) {
  242. const {columns, data} = param;
  243. const sums = [];
  244. let fields = ['totalPrice', 'paidPrice', 'notPaidPrice', 'invoicedPrice', 'notInvoicedPrice','discountTotalPrice']
  245. columns.forEach((column, index) => {
  246. if (index === 0) {
  247. sums[index] = '合计';
  248. return;
  249. }
  250. const values = fields.includes(column.property) ? data.map(item => Number(item[column.property])) : []
  251. if (!values.every(value => isNaN(value))) {
  252. sums[index] = values.reduce((prev, curr) => {
  253. const value = Number(curr);
  254. if (!isNaN(value)) {
  255. return prev + curr;
  256. } else {
  257. return prev;
  258. }
  259. }, 0);
  260. sums[index] = (sums[index]).toFixed(2)
  261. } else {
  262. sums[index] = '';
  263. }
  264. });
  265. return sums;
  266. }
  267. }
  268. };
  269. </script>
  270. <style lang="scss" scoped>
  271. .headbox {
  272. display: flex;
  273. justify-content: space-between;
  274. align-items: center;
  275. .amount {
  276. font-size: 14px;
  277. font-weight: bold;
  278. padding-right: 30px;
  279. }
  280. }
  281. .time-form .el-form-item {
  282. margin-bottom: 0 !important;
  283. }
  284. ::v-deep .period {
  285. display: flex;
  286. .borderleftnone {
  287. .el-input--medium .el-input__inner {
  288. border-top-right-radius: 0;
  289. border-bottom-right-radius: 0;
  290. }
  291. }
  292. .borderrightnone {
  293. .el-input--medium .el-input__inner {
  294. border-top-left-radius: 0;
  295. border-bottom-left-radius: 0;
  296. }
  297. }
  298. }
  299. ::v-deep .time-form tbody > tr:hover > td {
  300. background-color: transparent !important;
  301. }
  302. ::v-deep .time-form .el-table tr {
  303. background-color: #ffffff;
  304. }
  305. .pricebox {
  306. display: flex;
  307. justify-content: flex-start;
  308. align-items: center;
  309. font-weight: bold;
  310. }
  311. ::v-deep.el-divider {
  312. margin: 10px;
  313. font-weight: bold;
  314. }
  315. </style>