detail.vue 6.6 KB

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