detail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 {statisticsDetails} 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: 'salesAmount',
  69. type: 'sum'
  70. },
  71. {
  72. name: 'freight',
  73. type: 'sum'
  74. },
  75. {
  76. name: 'paymentAmountTl',
  77. type: 'sum'
  78. }
  79. ],
  80. searchIcon: true,
  81. searchIndex: 2,
  82. menu: false,
  83. column: [
  84. {
  85. label: "客户",
  86. prop: "customerName",
  87. overHidden: true,
  88. },
  89. {
  90. label: "订单号",
  91. prop: "ordNo",
  92. overHidden: true,
  93. },
  94. {
  95. label: "业务时间",
  96. prop: "businesDate",
  97. overHidden: true,
  98. },
  99. {
  100. label: "金额",
  101. prop: "salesAmount",
  102. overHidden: true,
  103. },
  104. {
  105. label: "运费",
  106. prop: "freight",
  107. overHidden: true,
  108. },
  109. {
  110. label: "实收金额",
  111. prop: "paymentAmountTl",
  112. overHidden: true,
  113. }
  114. ],
  115. },
  116. }
  117. },
  118. created() {
  119. if (this.detailData) {
  120. this.queryData(this.detailData);
  121. }
  122. },
  123. methods: {
  124. cellStyle() {
  125. return "padding:0;height:40px;";
  126. },
  127. // 日期格式化
  128. dateFormatting(date) {
  129. const year = date.getFullYear().toString().padStart(4, '0');
  130. const month = (date.getMonth() + 1).toString().padStart(2, '0');
  131. const day = date.getDate().toString().padStart(2, '0');
  132. console.log(`${year}-${month}-${day}`)
  133. return `${year}-${month}-${day}`
  134. },
  135. queryData(detailData) {
  136. this.loading = true;
  137. const date = new Date(detailData.businesDate);
  138. const y = date.getFullYear()
  139. const m = date.getMonth()
  140. const startDate = new Date(y, m, 1);
  141. const endDate = new Date(y, m + 1, 0);
  142. const requestData = {
  143. 'customerId': detailData.customerId,
  144. 'bsType': 'XS',
  145. 'current': 1,
  146. 'size': 999999999,
  147. 'salerId':detailData.salerId,
  148. 'businesDateList[0]' : this.dateFormatting(startDate) + " 00:00:00",
  149. 'businesDateList[1]' : this.dateFormatting(endDate) + " 23:59:59"
  150. };
  151. this.customerId = detailData.customerId
  152. this.startDate = this.dateFormatting(startDate) + " 00:00:00"
  153. this.endDate = this.dateFormatting(endDate) + " 23:59:59"
  154. statisticsDetails(requestData).then(res => {
  155. this.dataList = res.data.data;
  156. }).finally(() => {
  157. this.loading = false;
  158. this.option.height = window.innerHeight - 180;
  159. this.crudIndex++;
  160. })
  161. // detail(id, 'd', this.tradeType).then(res => {
  162. // this.dataList = res.data.data.records;
  163. // }).finally(() => {
  164. // this.loading = false;
  165. // this.option.height = window.innerHeight - 180;
  166. // this.crudIndex++;
  167. // })
  168. },
  169. backToList() {
  170. this.$emit("goBack");
  171. },
  172. //导出
  173. outExport() {
  174. console.log(this.tradeType)
  175. this.$confirm('是否导出应收总账详情信息?', '提示', {
  176. confirmButtonText: '确定',
  177. cancelButtonText: '取消',
  178. type: 'warning'
  179. }).then(() => {
  180. window.open(
  181. `/api/blade-sales-part/order/statistics-exportDetails?${
  182. this.website.tokenHeader
  183. }=${getToken()}&exportType=2&customerId=${this.customerId}&salerId=${this.salerId}&bsType=CG&businesDateList[0]=${this.startDate}&businesDateList[1]=${this.endDate}`
  184. );
  185. }).catch(() => {
  186. this.$message({
  187. type: 'info',
  188. message: '已取消' //
  189. });
  190. })
  191. },
  192. // 跳转页面
  193. jumpPage(row, index) {
  194. if (this.tradeType == '' || this.tradeType == 'JXS') {
  195. this.$router.$avueRouter.closeTag("/dealer/sales/index");
  196. this.$router.push({
  197. path: "/dealer/sales/index",
  198. query: {
  199. params: row.srcParentId
  200. },
  201. });
  202. }
  203. },
  204. },
  205. }
  206. </script>
  207. <style scoped>
  208. </style>