incomeOut.vue 14 KB

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