incomeOut.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  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="{
  12. child: 'export/tenantPaymentOrder',
  13. parent: '/incomeOut',
  14. }"
  15. >
  16. 报表导出
  17. </div>
  18. <!-- 搜索类型 -->
  19. <save-form
  20. :inline="true"
  21. class="searchForm"
  22. :model="searchForm"
  23. @reset="onReSet"
  24. @submit="search"
  25. >
  26. <el-form-item>
  27. <el-input
  28. v-model.trim="searchForm.phone"
  29. @keyup.enter.native="search"
  30. clearable
  31. placeholder="手机号"
  32. ></el-input>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-input
  36. placeholder="现金支付大于等于"
  37. type="number"
  38. clearable
  39. @mousewheel.native.prevent
  40. v-model.trim="searchForm.actualAmount"
  41. ></el-input>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-date-picker
  45. v-model.trim="searchForm.orderDate"
  46. style="width: 410px"
  47. type="daterange"
  48. value-format="yyyy-MM-dd"
  49. @change="searchOrderDate"
  50. range-separator="至"
  51. start-placeholder="订单开始日期"
  52. :picker-options="{
  53. firstDayOfWeek: 1,
  54. }"
  55. end-placeholder="订单结束日期"
  56. ></el-date-picker>
  57. </el-form-item>
  58. <el-form-item>
  59. <el-select
  60. v-model.trim="searchForm.status"
  61. clearable
  62. filterable
  63. @clear="onClear('paymentStatus')"
  64. placeholder="交易状态"
  65. >
  66. <el-option
  67. v-for="(item, index) in dealStatus"
  68. :key="index"
  69. :label="item.label"
  70. :value="item.value"
  71. ></el-option>
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item>
  75. <el-button native-type="submit" type="danger">搜索</el-button>
  76. <el-button native-type="reset" type="primary">重置</el-button>
  77. </el-form-item>
  78. </save-form>
  79. <!-- 列表 -->
  80. <div style="font-size: 14px; color: #f85043; padding-bottom: 10px">
  81. 应收总金额:{{ totalExpectAmount | moneyFormat }}元
  82. &nbsp;&nbsp;&nbsp;&nbsp; 现金实收总额:{{
  83. totalActualAmount | moneyFormat
  84. }}元 &nbsp;&nbsp;&nbsp;&nbsp;
  85. <!-- 余额实收总额:{{ Number((totalExpectAmount - totalActualAmount).toFixed(2)) }}元 -->
  86. </div>
  87. <div class="tableWrap">
  88. <el-table
  89. :data="tableList"
  90. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  91. >
  92. <el-table-column
  93. align="center"
  94. width="180px"
  95. prop="transNo"
  96. label="交易流水号"
  97. >
  98. </el-table-column>
  99. <el-table-column
  100. align="center"
  101. width="210px"
  102. prop="orderNo"
  103. label="订单号"
  104. ></el-table-column>
  105. <el-table-column
  106. align="center"
  107. width="150"
  108. prop="createTime"
  109. label="订单日期"
  110. >
  111. <template slot-scope="scope">{{
  112. scope.row.createTime | dateForMinFormat
  113. }}</template>
  114. </el-table-column>
  115. <el-table-column align="center" width="125px" label="时间/分钟">
  116. <template slot-scope="scope">
  117. <p>{{ "购买" + scope.row.transMinutes + "分钟" }}</p>
  118. <p>{{ "赠送" + scope.row.giveMinutes + "分钟" }}</p>
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="center" prop="expectAmount" label="应付金额">
  122. <template slot-scope="scope">
  123. <div>
  124. {{ scope.row.expectAmount | moneyFormat }}
  125. </div>
  126. </template>
  127. </el-table-column>
  128. <!-- <el-table-column align="center" prop="balancePaymentAmount" label="余额支付"></el-table-column> -->
  129. <el-table-column align="center" prop="actualAmount" label="现金支付">
  130. <template slot-scope="scope">
  131. <div>
  132. {{ scope.row.actualAmount | moneyFormat }}
  133. </div>
  134. </template>
  135. </el-table-column>
  136. <el-table-column align="center" label="用户姓名">
  137. <template slot-scope="scope">
  138. <div v-if="scope.row.user">{{ scope.row.user.username }}</div>
  139. </template>
  140. </el-table-column>
  141. <el-table-column align="center" label="手机号">
  142. <template slot-scope="scope">
  143. <copy-text v-if="scope.row.user">{{
  144. scope.row.user.phone
  145. }}</copy-text>
  146. </template>
  147. </el-table-column>
  148. <el-table-column
  149. align="center"
  150. prop="paymentChannel"
  151. label="交易方式"
  152. >
  153. <template slot-scope="scope">{{
  154. scope.row.paymentChannel | paymentChannelStatus
  155. }}</template>
  156. </el-table-column>
  157. <el-table-column align="center" label="收款账户">
  158. <template slot-scope="scope">{{ scope.row.merNos }}</template>
  159. </el-table-column>
  160. <el-table-column align="center" label="交易状态">
  161. <template slot-scope="scope">{{
  162. scope.row.status | dealStatus
  163. }}</template>
  164. </el-table-column>
  165. <el-table-column align="center" label="备注">
  166. <template slot-scope="scope">{{
  167. scope.row.memo ? scope.row.memo : "-"
  168. }}</template>
  169. </el-table-column>
  170. </el-table>
  171. <pagination
  172. sync
  173. :total.sync="pageInfo.total"
  174. :page.sync="pageInfo.page"
  175. :limit.sync="pageInfo.limit"
  176. :page-sizes="pageInfo.page_size"
  177. @pagination="getList"
  178. />
  179. </div>
  180. </div>
  181. </div>
  182. </template>
  183. <script>
  184. import pagination from "@/components/Pagination/index";
  185. import { tenantPaymentOrder } from "@/api/orderManager";
  186. // import { getEmployeeOrgan } from '@/api/buildTeam'
  187. import store from "@/store";
  188. import { orderStatus, dealStatus } from "@/utils/searchArray";
  189. import axios from "axios";
  190. import qs from "qs";
  191. import { getToken } from "@/utils/auth";
  192. import load from "@/utils/loading";
  193. import { getTimes } from "@/utils";
  194. import cleanDeep from 'clean-deep'
  195. export default {
  196. components: { pagination },
  197. name: "income",
  198. data() {
  199. return {
  200. orderStatus: orderStatus,
  201. dealStatus: dealStatus,
  202. searchForm: {
  203. orderStartDate: null,
  204. orderEndDate: null,
  205. status: "SUCCESS",
  206. paymentType: null,
  207. organId: null,
  208. phone: null,
  209. actualAmount: null,
  210. balancePaymentAmount: null,
  211. orderDate: [],
  212. },
  213. tableList: [],
  214. organList: [],
  215. pageInfo: {
  216. // 分页规则
  217. limit: 10, // 限制显示条数
  218. page: 1, // 当前页
  219. total: 0, // 总条数
  220. page_size: [10, 20, 40, 50], // 选择限制显示条数
  221. },
  222. totalExpectAmount: 0, //应收总金额
  223. totalActualAmount: 0, //实收总金额
  224. };
  225. },
  226. mounted() {
  227. // getEmployeeOrgan().then(res => {
  228. // if (res.code == 200) {
  229. // this.organList = res.data;
  230. // }
  231. // });
  232. if (this.searchForm.orderDate?.length < 1) {
  233. this.getNow()
  234. }
  235. this.getList();
  236. },
  237. methods: {
  238. getNow() {
  239. var now = new Date();
  240. var startDate = new Date(
  241. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  242. )
  243. .toISOString()
  244. .slice(0, 10);
  245. // + " 00:00:00" + " 23:59:59"
  246. var endDate = new Date(
  247. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  248. )
  249. .toISOString()
  250. .slice(0, 10);
  251. this.searchForm.orderDate = [];
  252. this.searchForm.orderDate.push(startDate);
  253. this.searchForm.orderDate.push(endDate);
  254. },
  255. onClear(type) {
  256. if (type == "paymentType") {
  257. this.searchForm.paymentType = null;
  258. } else if (type == "paymentStatus") {
  259. this.searchForm.paymentStatus = null;
  260. } else if (type == "organId") {
  261. this.searchForm.organId = null;
  262. }
  263. },
  264. onOrderExport() {
  265. // 报表导出
  266. let url = "/api-web/export/tenantPaymentOrder";
  267. const { orderDate, ...rest } = this.searchForm;
  268. let data = {
  269. orderType: 0,
  270. ...rest,
  271. ...getTimes(orderDate, ["orderStartDate", "orderEndDate"]),
  272. };
  273. const options = {
  274. method: "POST",
  275. headers: {
  276. Authorization: getToken(),
  277. },
  278. data: qs.stringify(cleanDeep(data)),
  279. url,
  280. responseType: "blob",
  281. };
  282. this.$confirm("您确定导出报表", "提示", {
  283. confirmButtonText: "确定",
  284. cancelButtonText: "取消",
  285. type: "warning",
  286. })
  287. .then(() => {
  288. load.startLoading();
  289. axios(options)
  290. .then((res) => {
  291. let blob = new Blob([res.data], {
  292. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  293. type: "application/vnd.ms-excel;charset=utf-8",
  294. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  295. });
  296. let text = new Response(blob).text();
  297. text.then((res) => {
  298. // 判断是否报错
  299. if (res.indexOf("code") != -1) {
  300. let json = JSON.parse(res);
  301. this.$message.error(json.msg);
  302. } else {
  303. let objectUrl = URL.createObjectURL(blob);
  304. let link = document.createElement("a");
  305. let nowTime = new Date();
  306. let ymd =
  307. nowTime.getFullYear() +
  308. "" +
  309. (nowTime.getMonth() + 1) +
  310. "" +
  311. nowTime.getDate() +
  312. "" +
  313. nowTime.getHours() +
  314. "" +
  315. nowTime.getMinutes();
  316. let fname = "报表导出" + new Date().getTime()+'.xls'; //下载文件的名字
  317. link.href = objectUrl;
  318. link.setAttribute("download", fname);
  319. document.body.appendChild(link);
  320. link.click();
  321. }
  322. });
  323. load.endLoading();
  324. })
  325. .catch((error) => {
  326. this.$message.error("导出数据失败,请联系管理员");
  327. load.endLoading();
  328. });
  329. })
  330. .catch(() => {});
  331. },
  332. search() {
  333. this.pageInfo.page = 1;
  334. this.getList();
  335. },
  336. getList() {
  337. let { orderDate, ...rest } = this.searchForm;
  338. let params = {
  339. ...rest,
  340. page: this.pageInfo.page,
  341. rows: this.pageInfo.limit,
  342. ...getTimes(orderDate, ["orderStartDate", "orderEndDate"]),
  343. };
  344. tenantPaymentOrder(params).then((res) => {
  345. let result = res.data;
  346. if (res.code == 200) {
  347. this.tableList = result.rows;
  348. this.pageInfo.total = result.total;
  349. this.totalExpectAmount = result.totalExpectAmount
  350. ? result.totalExpectAmount
  351. : 0;
  352. this.totalActualAmount = result.totalActualAmount
  353. ? result.totalActualAmount
  354. : 0;
  355. }
  356. });
  357. },
  358. searchOrderDate(value) {
  359. if (value) {
  360. this.searchForm.orderStartDate = value[0];
  361. this.searchForm.orderEndDate = value[1];
  362. } else {
  363. this.searchForm.orderStartDate = null;
  364. this.searchForm.orderEndDate = null;
  365. }
  366. },
  367. onReSet() {
  368. // 重置搜索
  369. this.searchForm = {
  370. orderStartDate: null,
  371. orderEndDate: null,
  372. paymentStatus: null,
  373. paymentType: null,
  374. organId: null,
  375. phone: null,
  376. status: "SUCCESS",
  377. orderDate: [],
  378. };
  379. this.getNow()
  380. this.getList();
  381. },
  382. },
  383. };
  384. </script>
  385. <style lang="scss">
  386. </style>