incomeOut.vue 12 KB

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