income.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 订单管理
  6. </h2>
  7. <div class="m-core">
  8. <div
  9. class="newBand"
  10. @click="onOrderExport"
  11. v-permission="{ child: 'export/orderList', parent: '/income' }"
  12. >
  13. 报表导出
  14. </div>
  15. <!-- 搜索类型 -->
  16. <save-form
  17. :inline="true"
  18. class="searchForm"
  19. :model="searchForm"
  20. @submit="search"
  21. @reset="onReSet"
  22. >
  23. <el-form-item>
  24. <el-input
  25. placeholder="学生编号/姓名/手机号"
  26. type="text"
  27. clearable
  28. v-model.trim="searchForm.search"
  29. ></el-input>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-input
  33. placeholder="交易流水号"
  34. clearable
  35. type="text"
  36. v-model.trim="searchForm.transNo"
  37. ></el-input>
  38. </el-form-item>
  39. <el-form-item>
  40. <el-input
  41. placeholder="订单号"
  42. clearable
  43. type="text"
  44. v-model.trim="searchForm.orderNo"
  45. ></el-input>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-input
  49. placeholder="收款账户"
  50. clearable
  51. type="text"
  52. v-model.trim="searchForm.merNos"
  53. ></el-input>
  54. </el-form-item>
  55. <el-form-item>
  56. <el-input
  57. placeholder="余额支付大于等于"
  58. clearable
  59. type="number"
  60. @mousewheel.native.prevent
  61. v-model.trim="searchForm.balancePaymentAmount"
  62. ></el-input>
  63. </el-form-item>
  64. <el-form-item>
  65. <el-input
  66. placeholder="余额支付小于等于"
  67. clearable
  68. type="number"
  69. @mousewheel.native.prevent
  70. v-model.trim="searchForm.lessBalancePaymentAmount"
  71. ></el-input>
  72. </el-form-item>
  73. <el-form-item>
  74. <el-input
  75. placeholder="现金支付大于等于"
  76. clearable
  77. type="number"
  78. @mousewheel.native.prevent
  79. v-model.trim="searchForm.actualAmount"
  80. ></el-input>
  81. </el-form-item>
  82. <el-form-item>
  83. <el-input
  84. placeholder="现金支付小于等于"
  85. clearable
  86. type="number"
  87. @mousewheel.native.prevent
  88. v-model.trim="searchForm.lessActualAmount"
  89. ></el-input>
  90. </el-form-item>
  91. <el-form-item prop="organId">
  92. <el-select
  93. class="multiple"
  94. v-model.trim="searchForm.organId"
  95. filterable
  96. clearable
  97. @clear="onClear('organId')"
  98. placeholder="请选择分部"
  99. >
  100. <el-option
  101. v-for="(item, index) in selects.branchs"
  102. :key="index"
  103. :label="item.name"
  104. :value="item.id"
  105. ></el-option>
  106. </el-select>
  107. </el-form-item>
  108. <el-form-item>
  109. <el-date-picker
  110. v-model="searchForm.orderDate"
  111. style="width: 410px"
  112. type="daterange"
  113. value-format="yyyy-MM-dd"
  114. range-separator="至"
  115. :picker-options="{
  116. firstDayOfWeek: 1,
  117. }"
  118. start-placeholder="订单开始日期"
  119. end-placeholder="订单结束日期"
  120. ></el-date-picker>
  121. </el-form-item>
  122. <el-form-item>
  123. <el-select
  124. v-model.trim="searchForm.paymentType"
  125. clearable
  126. filterable
  127. @clear="onClear('paymentType')"
  128. placeholder="交易类型"
  129. >
  130. <el-option
  131. v-for="(item, index) in orderStatus"
  132. :key="index"
  133. :label="item.label"
  134. :value="item.value"
  135. ></el-option>
  136. </el-select>
  137. </el-form-item>
  138. <el-form-item>
  139. <el-select
  140. v-model.trim="searchForm.paymentStatus"
  141. clearable
  142. filterable
  143. @clear="onClear('paymentStatus')"
  144. placeholder="交易状态"
  145. >
  146. <el-option
  147. v-for="(item, index) in dealStatus"
  148. :key="index"
  149. :label="item.label"
  150. :value="item.value"
  151. ></el-option>
  152. </el-select>
  153. </el-form-item>
  154. <el-form-item>
  155. <el-button native-type="submit" type="danger">搜索</el-button>
  156. <el-button native-type="reset" type="primary">重置</el-button>
  157. </el-form-item>
  158. </save-form>
  159. <!-- 列表 -->
  160. <!-- totalUserBalance: 20452784.02
  161. totalExpectAmount: 0
  162. totalActualAmount: 0
  163. totalAdvanceAmount: 0
  164. totalRevenueAmount: 0 -->
  165. <div style="font-size: 14px; color: #f85043; padding-bottom: 10px">
  166. <!-- 应收总金额:{{ totalExpectAmount }}元 &nbsp;&nbsp;&nbsp;&nbsp;
  167. 现金实收总额:{{ totalActualAmount }}元 &nbsp;&nbsp;&nbsp;&nbsp;
  168. 余额实收总额:{{ Number((totalExpectAmount - totalActualAmount).toFixed(2)) }}元 -->
  169. <!-- 营收金额=2-3
  170. 实收金额=应收总额(包含余额支付)
  171. 预收金额=充值总额(发生消费,记负数)
  172. 预收余额=充值总余额 -->
  173. 营收金额:{{ totalRevenueAmount | moneyFormat }}元<i
  174. style="width: 10px; display: inline-block"
  175. ></i>
  176. 实收金额:{{ totalActualAmount | moneyFormat }}元<i
  177. style="width: 10px; display: inline-block"
  178. ></i>
  179. 预收金额:{{ totalAdvanceAmount | moneyFormat }}元<i
  180. style="width: 10px; display: inline-block"
  181. ></i>
  182. 预收余额:{{ totalUserBalance | moneyFormat }}元
  183. </div>
  184. <div class="tableWrap">
  185. <el-table
  186. :data="tableList"
  187. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  188. >
  189. <el-table-column
  190. align="center"
  191. prop="transNo"
  192. label="所属分部"
  193. >
  194. <template slot-scope="scope">
  195. <div>
  196. <copy-text>{{ scope.row.organName }}</copy-text>
  197. </div>
  198. </template>
  199. </el-table-column>
  200. <el-table-column
  201. align="center"
  202. width="180px"
  203. prop="transNo"
  204. label="交易流水号"
  205. >
  206. <template slot-scope="scope">
  207. <div>
  208. <copy-text>{{ scope.row.transNo }}</copy-text>
  209. </div>
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. align="center"
  214. width="210px"
  215. prop="orderNo"
  216. label="订单号"
  217. >
  218. <template slot-scope="scope">
  219. <div>
  220. <copy-text>{{ scope.row.orderNo }}</copy-text>
  221. </div>
  222. </template>
  223. </el-table-column>
  224. <el-table-column
  225. align="center"
  226. width="150"
  227. prop="createTime"
  228. label="订单日期"
  229. >
  230. <template slot-scope="scope">{{
  231. scope.row.createTime | dateForMinFormat
  232. }}</template>
  233. </el-table-column>
  234. <el-table-column align="center" width="100px" label="交易类型">
  235. <template slot-scope="scope">{{
  236. scope.row.type | orderType
  237. }}</template>
  238. </el-table-column>
  239. <el-table-column align="center" prop="expectAmount" label="应付金额">
  240. <template slot-scope="scope">
  241. <div>
  242. {{ scope.row.expectAmount | moneyFormat }}
  243. </div>
  244. </template>
  245. </el-table-column>
  246. <el-table-column
  247. align="center"
  248. prop="balancePaymentAmount"
  249. label="余额支付"
  250. >
  251. <template slot-scope="scope">
  252. <div>
  253. {{ scope.row.balancePaymentAmount | moneyFormat }}
  254. </div>
  255. </template>
  256. </el-table-column>
  257. <el-table-column align="center" prop="actualAmount" label="现金支付">
  258. <template slot-scope="scope">
  259. <div>
  260. {{ scope.row.actualAmount | moneyFormat }}
  261. </div>
  262. </template>
  263. </el-table-column>
  264. <el-table-column align="center" label="学员姓名">
  265. <template slot-scope="scope">
  266. <copy-text v-if="scope.row.user.username"> {{ scope.row.user.username }}</copy-text>
  267. <span v-if="scope.row.user.username && scope.row.user.phone"
  268. >/</span
  269. >
  270. <copy-text v-if="scope.row.user.phone">
  271. {{ scope.row.user.phone }}
  272. </copy-text>
  273. </template>
  274. </el-table-column>
  275. <el-table-column
  276. align="center"
  277. prop="paymentChannel"
  278. label="交易方式"
  279. >
  280. <template slot-scope="scope">{{
  281. scope.row.paymentChannel | paymentChannelStatus
  282. }}</template>
  283. </el-table-column>
  284. <!-- <el-table-column align="center"
  285. label="收款账户">
  286. <template slot-scope="scope">{{ scope.row.merNos }}</template>
  287. </el-table-column> -->
  288. <el-table-column align="center" label="交易状态">
  289. <template slot-scope="scope">{{
  290. scope.row.status | dealStatus
  291. }}</template>
  292. </el-table-column>
  293. <el-table-column align="center" label="备注" width="220px">
  294. <template slot-scope="scope">
  295. <overflow-text width="200px" :text="scope.row.memo"/>
  296. </template>
  297. </el-table-column>
  298. <el-table-column align="center" width="150px" label="操作">
  299. <template slot-scope="scope">
  300. <el-button
  301. v-if="
  302. scope.row.status != 'SUCCESS' && scope.row.actualAmount > 0
  303. "
  304. v-permission="'order/getOrderStatus'"
  305. @click="onGetOrderStatus(scope.row)"
  306. type="text"
  307. >查询订单状态</el-button
  308. >
  309. </template>
  310. </el-table-column>
  311. </el-table>
  312. <pagination
  313. sync
  314. :total.sync="pageInfo.total"
  315. :page.sync="pageInfo.page"
  316. :limit.sync="pageInfo.limit"
  317. :page-sizes="pageInfo.page_size"
  318. @pagination="getList"
  319. />
  320. </div>
  321. </div>
  322. </div>
  323. </template>
  324. <script>
  325. import pagination from "@/components/Pagination/index";
  326. import { orderQueryPage, getOrderStatus } from "@/api/orderManager";
  327. import { getEmployeeOrgan } from "@/api/buildTeam";
  328. import store from "@/store";
  329. import cleanDeep from "clean-deep";
  330. import { orderStatus, dealStatus } from "@/utils/searchArray";
  331. import axios from "axios";
  332. import qs from "qs";
  333. import { getToken } from "@/utils/auth";
  334. import load from "@/utils/loading";
  335. import { getTimes } from "@/utils";
  336. export default {
  337. components: { pagination },
  338. name: "income",
  339. data() {
  340. return {
  341. orderStatus: orderStatus,
  342. dealStatus: dealStatus,
  343. searchForm: {
  344. search: null,
  345. orderStartDate: null,
  346. orderEndDate: null,
  347. paymentStatus: "SUCCESS",
  348. paymentType: null,
  349. organId: null,
  350. actualAmount: null,
  351. balancePaymentAmount: null,
  352. orderNo: null,
  353. transNo: null,
  354. merNos: null,
  355. lessBalancePaymentAmount: null,
  356. lessActualAmount: null,
  357. orderDate: [],
  358. },
  359. tableList: [],
  360. organList: [],
  361. pageInfo: {
  362. // 分页规则
  363. limit: 10, // 限制显示条数
  364. page: 1, // 当前页
  365. total: 0, // 总条数
  366. page_size: [10, 20, 40, 50], // 选择限制显示条数
  367. },
  368. totalUserBalance: 0,
  369. totalActualAmount: 0,
  370. totalAdvanceAmount: 0,
  371. totalRevenueAmount: 0,
  372. };
  373. },
  374. created(){
  375. if (this.searchForm.orderDate?.length < 1) {
  376. this.getNow()
  377. }
  378. },
  379. mounted() {
  380. this.$store.dispatch("setBranchs");
  381. this.getList();
  382. },
  383. methods: {
  384. getNow() {
  385. var now = new Date();
  386. var startDate = new Date(
  387. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  388. )
  389. .toISOString()
  390. .slice(0, 10);
  391. // + " 00:00:00" + " 23:59:59"
  392. var endDate = new Date(
  393. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  394. )
  395. .toISOString()
  396. .slice(0, 10);
  397. this.searchForm.orderDate = [];
  398. this.searchForm.orderDate.push(startDate);
  399. this.searchForm.orderDate.push(endDate);
  400. },
  401. onClear(type) {
  402. if (type == "paymentType") {
  403. this.searchForm.paymentType = null;
  404. } else if (type == "paymentStatus") {
  405. this.searchForm.paymentStatus = null;
  406. } else if (type == "organId") {
  407. this.searchForm.organId = null;
  408. }
  409. },
  410. onOrderExport() {
  411. // 报表导出
  412. let url = "/api-web/export/orderList";
  413. let searchForm = this.searchForm;
  414. let data = {
  415. orderType: 0,
  416. search: searchForm.search,
  417. orderNo: searchForm.orderNo,
  418. transNo: searchForm.transNo,
  419. merNos: searchForm.merNos,
  420. actualAmount: searchForm.actualAmount,
  421. balancePaymentAmount: searchForm.balancePaymentAmount,
  422. paymentStatus: searchForm.paymentStatus,
  423. paymentType: searchForm.paymentType,
  424. organId: searchForm.organId,
  425. lessBalancePaymentAmount: searchForm.lessBalancePaymentAmount,
  426. lessActualAmount: searchForm.lessActualAmount,
  427. };
  428. if (this.searchForm.orderDate && this.searchForm.orderDate.length > 0) {
  429. data.orderStartDate = this.searchForm.orderDate[0];
  430. data.orderEndDate = this.searchForm.orderDate[1];
  431. } else {
  432. data.orderStartDate = null;
  433. data.orderEndDate = null;
  434. }
  435. const options = {
  436. method: "POST",
  437. headers: {
  438. Authorization: getToken(),
  439. },
  440. data: qs.stringify(cleanDeep(data)),
  441. url,
  442. responseType: "json",
  443. };
  444. this.$confirm("您确定导出报表", "提示", {
  445. confirmButtonText: "确定",
  446. cancelButtonText: "取消",
  447. type: "warning",
  448. })
  449. .then(() => {
  450. load.startLoading();
  451. axios(options)
  452. .then((res) => {
  453. load.endLoading();
  454. this.$message.info(res.data.data);
  455. // this.$confirm(res.data.data, "提示", {
  456. // confirmButtonText: "确定",
  457. // cancelButtonText: "取消",
  458. // type: "warning",
  459. // }).then(() => {
  460. // }).catch(err => {
  461. // })
  462. })
  463. .catch((error) => {
  464. this.$message.error("导出数据失败,请联系管理员");
  465. load.endLoading();
  466. });
  467. })
  468. .catch(() => {});
  469. },
  470. search() {
  471. this.pageInfo.page = 1;
  472. this.getList();
  473. },
  474. getList() {
  475. let { orderDate, ...rest } = this.searchForm;
  476. let params = {
  477. ...rest,
  478. page: this.pageInfo.page,
  479. rows: this.pageInfo.limit,
  480. ...getTimes(orderDate, ["orderStartDate", "orderEndDate"]),
  481. };
  482. // let params = JSON.parse(JSON.stringify(this.searchForm));
  483. // params.rows = this.pageInfo.limit;
  484. // params.page = this.pageInfo.page;
  485. // params.orderNo = params.orderNo ? params.orderNo : null;
  486. // params.transNo = params.transNo ? params.transNo : null;
  487. // params.merNos = params.merNos ? params.merNos : null;
  488. // params.actualAmount = params.actualAmount ? params.actualAmount : null;
  489. // params.balancePaymentAmount = params.balancePaymentAmount
  490. // ? params.balancePaymentAmount
  491. // : null;
  492. // if (this.orderDate && this.orderDate.length > 0) {
  493. // params.orderStartDate = this.orderDate[0];
  494. // params.orderEndDate = this.orderDate[1];
  495. // } else {
  496. // params.orderStartDate = null;
  497. // params.orderEndDate = null;
  498. // }
  499. orderQueryPage(cleanDeep(params)).then((res) => {
  500. let result = res.data;
  501. if (res.code == 200) {
  502. this.tableList = result.rows;
  503. this.pageInfo.total = result.total;
  504. this.totalUserBalance = result.totalUserBalance
  505. ? result.totalUserBalance
  506. : 0;
  507. this.totalActualAmount = result.totalActualAmount
  508. ? result.totalActualAmount
  509. : 0;
  510. this.totalAdvanceAmount = result.totalAdvanceAmount
  511. ? result.totalAdvanceAmount
  512. : 0;
  513. this.totalRevenueAmount = result.totalRevenueAmount
  514. ? result.totalRevenueAmount
  515. : 0;
  516. }
  517. });
  518. },
  519. onGetOrderStatus(row) {
  520. this.$confirm("您确定查询该订单状态", "提示", {
  521. confirmButtonText: "确定",
  522. cancelButtonText: "取消",
  523. type: "warning",
  524. })
  525. .then(() => {
  526. getOrderStatus({ id: row.id }).then((res) => {
  527. this.getList();
  528. });
  529. })
  530. .catch((err) => {});
  531. },
  532. onReSet() {
  533. // 重置搜索
  534. this.searchForm = {
  535. search: null,
  536. orderStartDate: null,
  537. orderEndDate: null,
  538. paymentStatus: 'SUCCESS',
  539. paymentType: null,
  540. organId: null,
  541. actualAmount: null,
  542. balancePaymentAmount: null,
  543. orderNo: null,
  544. transNo: null,
  545. merNos: null,
  546. lessBalancePaymentAmount: null,
  547. lessActualAmount: null,
  548. orderDate:[]
  549. };
  550. // this.pageInfo.page = 1;
  551. this.getNow()
  552. this.getList();
  553. },
  554. },
  555. };
  556. </script>
  557. <style lang="scss">
  558. </style>