index.vue 10 KB

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