detail.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. </div>
  10. <basic-container class="page-crad" style="margin-top: 30px">
  11. <avue-crud
  12. ref="crud"
  13. :option="option"
  14. :data="dataList"
  15. :table-loading="loading"
  16. :cell-style="cellStyle"
  17. :key="crudIndex"
  18. >
  19. <template slot="menuLeft">
  20. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  21. </template>
  22. <template slot="accSysNo" slot-scope="scope">
  23. <span style="color: #409EFF;cursor: pointer" @click.stop="jumpPage(scope.row,scope.index)">{{ scope.row.accSysNo }}</span>
  24. </template>
  25. </avue-crud>
  26. </basic-container>
  27. </div>
  28. </template>
  29. <script>
  30. import {detail} from "@/api/statisticAnalysis/collectLedger";
  31. import {getList} from "@/api/tirePartsMall/salesManagement/saleOrder";
  32. import { getToken } from "@/util/auth";
  33. export default {
  34. name: "detail",
  35. props: {
  36. detailData: {
  37. type: Object
  38. },
  39. tradeType: {
  40. type: [Number, String]
  41. }
  42. },
  43. data() {
  44. return {
  45. startDate: '',
  46. endDate: '',
  47. customerId: '',
  48. crudIndex: 0,
  49. dataList: [],
  50. loading: false,
  51. option: {
  52. searchShow: true,
  53. align: "center",
  54. searchSpan: 8,
  55. border: true,
  56. index: true,
  57. addBtn: false,
  58. viewBtn: false,
  59. editBtn: false,
  60. delBtn: false,
  61. cellBtn: false,
  62. cancelBtn: false,
  63. refreshBtn: false,
  64. showSummary: true,
  65. summaryText: '合计',
  66. sumColumnList: [
  67. {
  68. name: 'totalMoney',
  69. type: 'sum'
  70. },
  71. {
  72. name: 'true',
  73. type: 'sum'
  74. }
  75. ],
  76. searchIcon: true,
  77. searchIndex: 2,
  78. menu: false,
  79. column: [
  80. {
  81. label: "客户",
  82. prop: "customerName",
  83. overHidden: true,
  84. },
  85. {
  86. label: "订单号",
  87. prop: "ordNo",
  88. overHidden: true,
  89. },
  90. {
  91. label: "业务时间",
  92. prop: "businesDate",
  93. overHidden: true,
  94. },
  95. {
  96. label: "应收金额",
  97. prop: "totalMoney",
  98. overHidden: true,
  99. },
  100. {
  101. label: "实收金额",
  102. prop: "paymentAmountTl",
  103. overHidden: true,
  104. }
  105. ],
  106. },
  107. }
  108. },
  109. created() {
  110. if (this.detailData) {
  111. this.queryData(this.detailData);
  112. }
  113. },
  114. methods: {
  115. cellStyle() {
  116. return "padding:0;height:40px;";
  117. },
  118. // 日期格式化
  119. dateFormatting(date) {
  120. const year = date.getFullYear().toString().padStart(4, '0');
  121. const month = (date.getMonth() + 1).toString().padStart(2, '0');
  122. const day = date.getDate().toString().padStart(2, '0');
  123. console.log(`${year}-${month}-${day}`)
  124. return `${year}-${month}-${day}`
  125. },
  126. queryData(detailData) {
  127. this.loading = true;
  128. const date = new Date(detailData.businesDate);
  129. const y = date.getFullYear()
  130. const m = date.getMonth()
  131. const startDate = new Date(y, m, 1);
  132. const endDate = new Date(y, m + 1, 0);
  133. const requestData = {
  134. 'customerId': detailData.customerId,
  135. 'bsType': 'XS',
  136. 'current': 1,
  137. 'size': 999999999,
  138. 'businesDateList[0]' : this.dateFormatting(startDate) + " 00:00:00",
  139. 'businesDateList[1]' : this.dateFormatting(endDate) + " 23:59:59"
  140. };
  141. this.customerId = detailData.customerId
  142. this.startDate = this.dateFormatting(startDate) + " 00:00:00"
  143. this.endDate = this.dateFormatting(endDate) + " 23:59:59"
  144. getList(requestData).then(res => {
  145. this.dataList = res.data.data.records;
  146. }).finally(() => {
  147. this.loading = false;
  148. this.option.height = window.innerHeight - 180;
  149. this.crudIndex++;
  150. })
  151. // detail(id, 'd', this.tradeType).then(res => {
  152. // this.dataList = res.data.data.records;
  153. // }).finally(() => {
  154. // this.loading = false;
  155. // this.option.height = window.innerHeight - 180;
  156. // this.crudIndex++;
  157. // })
  158. },
  159. backToList() {
  160. this.$emit("goBack");
  161. },
  162. //导出
  163. outExport() {
  164. console.log(this.tradeType)
  165. this.$confirm('是否导出应收总账详情信息?', '提示', {
  166. confirmButtonText: '确定',
  167. cancelButtonText: '取消',
  168. type: 'warning'
  169. }).then(() => {
  170. window.open(
  171. `/api/blade-sales-part/order/statistics-exportDetails?${
  172. this.website.tokenHeader
  173. }=${getToken()}&exportType=2&customerId=${this.customerId}&bsType=CG&businesDateList[0]=${this.startDate}&businesDateList[1]=${this.endDate}`
  174. );
  175. }).catch(() => {
  176. this.$message({
  177. type: 'info',
  178. message: '已取消' //
  179. });
  180. })
  181. },
  182. // 跳转页面
  183. jumpPage(row, index) {
  184. if (this.tradeType == '' || this.tradeType == 'JXS') {
  185. this.$router.$avueRouter.closeTag("/dealer/sales/index");
  186. this.$router.push({
  187. path: "/dealer/sales/index",
  188. query: {
  189. params: row.srcParentId
  190. },
  191. });
  192. }
  193. },
  194. },
  195. }
  196. </script>
  197. <style scoped>
  198. </style>