index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div>
  3. <basic-container class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. :before-open="beforeOpen"
  9. :page.sync="page"
  10. :search.sync="search"
  11. :cell-style="cellStyle"
  12. @search-change="searchChange"
  13. @current-change="currentChange"
  14. @size-change="sizeChange"
  15. @refresh-change="refreshChange"
  16. @search-reset="searchReset"
  17. @on-load="onLoad"
  18. :table-loading="loading"
  19. :summary-method="summaryMethod"
  20. @saveColumn="saveColumn"
  21. @resetColumn="resetColumn"
  22. @search-criteria-switch="searchCriteriaSwitch"
  23. >
  24. <template slot="menuLeft">
  25. <el-button
  26. type="info"
  27. size="small"
  28. icon="el-icon-download"
  29. @click="outExport"
  30. :disabled="dataList.length == 0"
  31. >导出</el-button
  32. >
  33. </template>
  34. <template slot="corpIdSearch">
  35. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  36. </template>
  37. <!-- <template slot="dcSearch">-->
  38. <!-- <el-select-->
  39. <!-- v-model="search.dc"-->
  40. <!-- filterable-->
  41. <!-- >-->
  42. <!-- <el-option-->
  43. <!-- label="收"-->
  44. <!-- value="d"-->
  45. <!-- />-->
  46. <!-- <el-option-->
  47. <!-- label="付"-->
  48. <!-- value="c"-->
  49. <!-- />-->
  50. <!-- </el-select>-->
  51. <!-- </template>-->
  52. <template slot="corpId" slot-scope="{ row }">
  53. <span>{{ row.corpName }}</span>
  54. </template>
  55. <template slot="dc" slot-scope="{ row }">
  56. <span>{{ row.dc == "d" ? "收" : "付" }}</span>
  57. </template>
  58. </avue-crud>
  59. </basic-container>
  60. </div>
  61. </template>
  62. <script>
  63. import { getToken } from "@/util/auth";
  64. import { getList, getProfitItem } from "@/api/statisticAnalysis/salesProfit";
  65. import { micrometerFormat } from "@/util/validate";
  66. import _ from "lodash";
  67. import { getAccList, exportAcctList } from "@/api/statisticAnalysis/payment";
  68. export default {
  69. name: "index",
  70. data() {
  71. return {
  72. form: {},
  73. search: {
  74. dc: "d"
  75. },
  76. dataList: [],
  77. loading: false,
  78. detailData: {},
  79. page: {
  80. pageSize: 20,
  81. currentPage: 1,
  82. total: 0,
  83. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  84. },
  85. option: {
  86. searchShow: true,
  87. searchMenuSpan: 16,
  88. align: "center",
  89. searchSpan: 8,
  90. border: true,
  91. index: true,
  92. addBtn: false,
  93. viewBtn: false,
  94. editBtn: false,
  95. delBtn: false,
  96. showSummary: true,
  97. searchIcon: true,
  98. searchIndex: 2,
  99. menu: false,
  100. column: [
  101. {
  102. label: "订单号",
  103. prop: "accSysNo",
  104. width: 100,
  105. search: true
  106. },
  107. {
  108. label: "订单日期",
  109. prop: "businesDate",
  110. overHidden: true,
  111. width: 100,
  112. hide: true,
  113. showColumn: false,
  114. search: true,
  115. format: "yyyy-MM-dd",
  116. valueFormat: "yyyy-MM-dd",
  117. type: "date",
  118. unlinkPanels: true,
  119. searchRange: true
  120. },
  121. {
  122. label: "客户名称",
  123. prop: "corpId",
  124. overHidden: true,
  125. width: 100,
  126. search: true,
  127. formatter: row => {
  128. return row.corpsName;
  129. }
  130. },
  131. {
  132. label: "收付类别",
  133. prop: "dc",
  134. overHidden: true,
  135. hide: true,
  136. showColumn: false,
  137. search: true,
  138. width: 100,
  139. searchValue: "c",
  140. type: "select",
  141. dicData: [
  142. {
  143. label: "收",
  144. value: "d"
  145. },
  146. {
  147. label: "付",
  148. value: "c"
  149. }
  150. ]
  151. },
  152. {
  153. label: "商品名称",
  154. prop: "goodName",
  155. overHidden: true,
  156. width: 100
  157. },
  158. {
  159. label: "型号",
  160. prop: "goodType",
  161. overHidden: true,
  162. width: 100
  163. },
  164. {
  165. label: "数量",
  166. prop: "quantity",
  167. overHidden: true,
  168. width: 100
  169. },
  170. {
  171. label: "销售单价",
  172. prop: "price",
  173. overHidden: true,
  174. width: 100
  175. },
  176. {
  177. label: "金额",
  178. prop: "amount",
  179. overHidden: true,
  180. width: 100
  181. },
  182. {
  183. label: "币别",
  184. prop: "currency",
  185. overHidden: true,
  186. width: 100
  187. },
  188. {
  189. label: "汇率",
  190. prop: "exchangeRate",
  191. overHidden: true,
  192. width: 100
  193. },
  194. {
  195. label: "结算金额",
  196. prop: "settlementAmount",
  197. overHidden: true,
  198. width: 100
  199. },
  200. {
  201. label: "发票号",
  202. prop: "invoice",
  203. overHidden: true,
  204. width: 100
  205. },
  206. {
  207. label: "备注",
  208. prop: "remarks",
  209. overHidden: true,
  210. width: 100
  211. }
  212. ]
  213. },
  214. tradeType: ""
  215. };
  216. },
  217. filters: {
  218. decimalFormat(num) {
  219. return num ? Number(num).toFixed(2) : "0.00";
  220. }
  221. },
  222. created() {},
  223. methods: {
  224. cellStyle() {
  225. return "padding:0;height:40px;";
  226. },
  227. searchCriteriaSwitch(type) {
  228. if (type) {
  229. this.option.height = this.option.height - 46;
  230. } else {
  231. this.option.height = this.option.height + 46;
  232. }
  233. this.$refs.crud.getTableHeight();
  234. },
  235. //点击搜索按钮触发
  236. searchChange(params, done) {
  237. if (params.businesDate) {
  238. params.contractStartDate = params.businesDate[0];
  239. params.contractEndDate = params.businesDate[1];
  240. }
  241. delete params.businesDate;
  242. this.page.currentPage = 1;
  243. this.onLoad(this.page, params);
  244. done();
  245. },
  246. refreshChange() {
  247. this.onLoad(this.page, this.search);
  248. },
  249. searchReset() {
  250. this.search = {
  251. dc: "c"
  252. };
  253. this.onLoad(this.page, this.search);
  254. },
  255. currentChange(val) {
  256. this.page.currentPage = val;
  257. },
  258. sizeChange(val) {
  259. this.page.currentPage = 1;
  260. this.page.pageSize = val;
  261. },
  262. getSysType() {
  263. const sysType = localStorage.getItem("sysitemType");
  264. if (sysType == 6) {
  265. this.tradeType = "JXS";
  266. } else if (sysType == 5) {
  267. this.tradeType = "SW";
  268. } else if (sysType == 4) {
  269. this.tradeType = "CK";
  270. } else if (sysType == 3) {
  271. this.tradeType = "JK";
  272. } else if (sysType == 2) {
  273. this.tradeType = "GN";
  274. } else if (sysType == 1) {
  275. this.tradeType = "XX";
  276. }
  277. },
  278. onLoad(page, params) {
  279. this.getSysType();
  280. this.dataList.forEach(item => {
  281. this.$refs.crud.toggleRowExpansion(item, false);
  282. });
  283. let queryParams = Object.assign(
  284. { tradeType: this.tradeType },
  285. params,
  286. this.search,
  287. {
  288. size: page.pageSize,
  289. current: page.currentPage
  290. }
  291. );
  292. if (this.search.businesDate && this.search.businesDate.length > 0) {
  293. queryParams = {
  294. ...queryParams,
  295. accDateStart: this.search.businesDate[0],
  296. accDateEnd: this.search.businesDate[1]
  297. };
  298. }
  299. delete queryParams.businesDate;
  300. this.loading = true;
  301. getAccList(queryParams)
  302. .then(res => {
  303. this.dataList = res.data.data.records ? res.data.data.records : [];
  304. this.page.total = res.data.data.total;
  305. this.option.height = window.innerHeight - 210;
  306. this.$nextTick(() => {
  307. this.$refs.crud.doLayout();
  308. });
  309. })
  310. .finally(() => {
  311. this.loading = false;
  312. });
  313. },
  314. editOpen(row) {
  315. if (row.billType == "BJ") {
  316. this.$router.push({
  317. path: "/exportTrade/customerInquiry/index",
  318. query: {
  319. id: row.id
  320. }
  321. });
  322. } else {
  323. this.$router.push({
  324. path: "/exportTrade/salesContract/index",
  325. query: {
  326. id: row.id
  327. }
  328. });
  329. }
  330. },
  331. outExport() {
  332. let accDateStart = "";
  333. let accDateEnd = "";
  334. if (this.search.businesDate && this.search.businesDate.length > 0) {
  335. accDateStart = this.search.businesDate[0];
  336. accDateEnd = this.search.businesDate[1];
  337. }
  338. let a = { ...this.search };
  339. // let itemList = JSON.stringify(a)
  340. // let result = itemList.replace(/""/g, "null");
  341. // a = JSON.parse(result)
  342. // if (!a.corpId) {
  343. // a.corpId = ''
  344. // }
  345. window.open(
  346. `/api/trade-finance/acc/exportAccMessage?${
  347. this.website.tokenHeader
  348. }=${getToken()}&corpId=${
  349. a.corpId
  350. }&accDateStart=${accDateStart}&accDateEnd=${accDateEnd}&dc=${
  351. a.dc
  352. }&accSysNo=${a.accSysNo}&tradeType=${this.tradeType}`
  353. );
  354. },
  355. summaryMethod({ columns, data }) {
  356. const sums = [];
  357. if (columns.length > 0) {
  358. columns.forEach((item, index) => {
  359. sums[0] = "合计";
  360. if (item.property == "purchasePrice" || item.property == "amount") {
  361. let amountSum = 0;
  362. let purchaseAmountSum = 0;
  363. data.forEach(e => {
  364. amountSum = _.add(amountSum, Number(e.amount));
  365. purchaseAmountSum = _.add(
  366. purchaseAmountSum,
  367. Number(e.purchasePrice)
  368. );
  369. });
  370. //入库金额总计
  371. if (item.property == "purchasePrice") {
  372. sums[index] = micrometerFormat(purchaseAmountSum);
  373. }
  374. if (item.property == "amount") {
  375. sums[index] = micrometerFormat(amountSum);
  376. }
  377. }
  378. });
  379. }
  380. return sums;
  381. }
  382. }
  383. };
  384. </script>
  385. <style scoped>
  386. .page-crad ::v-deep .basic-container__card {
  387. height: 94.2vh;
  388. }
  389. .itemTable ::v-deep .el-table {
  390. width: 100%;
  391. }
  392. </style>