tuikuan.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="24" class="first-row">
  5. <div class="tag">退费管理</div>
  6. </el-col>
  7. </el-row>
  8. <el-row>
  9. <el-col :span="24" class="second-row">
  10. <el-form :inline="true" class="demo-form-inline">
  11. <el-form-item label="" class="riqi">
  12. <el-date-picker v-model="select_datetime" type="daterange" range-separator="至" @change="dateChange" start-placeholder="开始日期"
  13. end-placeholder="结束日期" value-format="yyyy-MM-dd">
  14. </el-date-picker>
  15. </el-form-item>
  16. <el-form-item label="" class="shuibiaoId">
  17. <el-input v-model="searchformUser" clearable placeholder="联系人/手机号"></el-input>
  18. </el-form-item>
  19. <el-form-item>
  20. <el-button type="primary" icon="el-icon-search" @click="onSearch">搜索</el-button>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-document" @click="onExport">导出</el-button>
  24. </el-form-item>
  25. </el-form>
  26. </el-col>
  27. </el-row>
  28. <el-row>
  29. <el-col :span="24">
  30. <div class="">
  31. <span class="item">总计:<span class="green_txt">{{ amount }}</span>元</span> <span class="item">总交易笔数:<span
  32. class="green_txt">{{ total_times }}</span>笔</span> <span </div>
  33. </el-col>
  34. </el-row>
  35. <hr style="background-color: #CCCCCC;height: 1px;border: 0;">
  36. <el-row>
  37. <el-col :span="24" class="third-row">
  38. <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" highlight-current-row>
  39. <el-table-column align="center" label="序号" type="index" :index="indexMethod" width="100px">
  40. </el-table-column>
  41. <el-table-column align="center" label="户号">
  42. <template slot-scope="scope">{{ scope.row.card_number }}</template>
  43. </el-table-column>
  44. <el-table-column prop="user_name" label="联系人" align="center"></el-table-column>
  45. <el-table-column prop="order_num" label="交易流水号" align="center"></el-table-column>
  46. <el-table-column prop="handler_man" label="操作账号" align="center">
  47. </el-table-column>
  48. <el-table-column prop="account" label="支付金额(元)" align="center" :formatter="formatBalance" show-overflow-tooltip></el-table-column>
  49. <el-table-column prop="time" label="支付时间" align="center" width="200px"></el-table-column>
  50. </el-table>
  51. <div style="margin-top: 20px" class="table-footer">
  52. <div class="pages">
  53. <el-pagination layout="prev, pager, next" :current-page.sync="currentPage" :hide-on-single-page="true" :page-size="pageRows"
  54. :total="rows_total" @current-change="handleCurrentChange('page')"></el-pagination>
  55. </div>
  56. </div>
  57. </el-col>
  58. </el-row>
  59. </div>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. amount: 0.0.toFixed(2),
  66. total_times: 0,
  67. select_datetime: [],
  68. startTime: '',
  69. endTime: '',
  70. searchformUser: '', // 查找的姓名
  71. select_month: '', // 选择的月份
  72. // 余额列表
  73. tableData: [], // 余额列表
  74. rows_total: 0, // 余额列表总记录数
  75. currentPage: 1, // 余额列表当前页
  76. pageRows: 8, // 每页记录数
  77. viewdialogFormVisible: false,
  78. showOrderStatus: {
  79. userName: '',
  80. orderState: '',
  81. balance: 0,
  82. result: -1
  83. }
  84. }
  85. },
  86. created() {
  87. var level = sessionStorage.getItem('level');
  88. if (level === '2') {
  89. // 获取总金额
  90. this.get_total_amount();
  91. // 获取余额列表
  92. let params = {
  93. page: this.currentPage,
  94. rows: this.pageRows
  95. };
  96. // 初始化日期为今天天 至 明天
  97. this.initDate();
  98. } else {
  99. this.$message.error('请使用【退款专用账号】登录!');
  100. }
  101. },
  102. methods: {
  103. get_total_amount() {
  104. var _this = this;
  105. let formData = new FormData();
  106. if (typeof _this.startTime != 'undefined' && _this.startTime != '') {
  107. formData.append("begin_time", _this.startTime);
  108. }
  109. if (typeof _this.endTime != 'undefined' && _this.endTime != '') {
  110. formData.append("end_time", _this.endTime);
  111. }
  112. if (_this.searchformUser != '' && typeof _this.searchformUser != 'undefined') {
  113. params.user_name = this.searchformUser
  114. }
  115. this.$axios.post('/jxch-smartmp/HotWaters/waterrefund_total.action', formData)
  116. .then(res => {
  117. // console.log(res.data);
  118. if (res.data.code == 200) {
  119. _this.amount = res.data.data;
  120. } else {
  121. _this.$message.error(res.data.message);
  122. }
  123. })
  124. .catch(err => {
  125. // console.log(err);
  126. _this.$message.error('【获取退款总金额】请求异常: ' + err);
  127. });
  128. },
  129. /**
  130. * 序号的计算
  131. */
  132. indexMethod(index) {
  133. return (this.currentPage - 1) * this.pageRows + index + 1;
  134. },
  135. /**
  136. * 格式化列数据
  137. */
  138. formatBalance: (row, column, cellValue, index) => {
  139. // row: 行数据
  140. // column: 列属性
  141. // cellValue: 单元格数据值
  142. // index: 行索引,注意:2.3.9版本以后才有。
  143. return cellValue.toFixed(2)
  144. },
  145. /**
  146. * 退款列表
  147. */
  148. get_amount_list(params) {
  149. var _this = this
  150. this.$axios.get('/jxch-smartmp/HotWaters/waterrefund_list.action', {
  151. params: params
  152. })
  153. .then(res => {
  154. // console.log(res.data);
  155. if (typeof res.data.rows != 'undefined' && res.data.rows != '' && JSON.stringify(res.data) !=
  156. '{}') {
  157. // _this.$message.success('数据加载成功!');
  158. _this.tableData = res.data.rows
  159. _this.rows_total = res.data.total
  160. } else {
  161. _this.$message.success('【退款列表】暂无数据!');
  162. }
  163. })
  164. .catch(err => {
  165. // console.log(err);
  166. _this.$message.error('【退款列表】请求异常: ' + err);
  167. })
  168. },
  169. /**
  170. * 退款列表改变页码
  171. * @param {Object} param
  172. */
  173. handleCurrentChange(param) {
  174. // console.log(param);
  175. this.currentPage = this.currentPage
  176. var params = {
  177. page: this.currentPage,
  178. rows: this.pageRows,
  179. }
  180. if (param != 'init') {
  181. if (this.startTime != '' && typeof this.startTime != 'undefined') {
  182. params.begin_time = this.startTime
  183. }
  184. if (this.endTime != '' && typeof this.endTime != 'undefined') {
  185. params.end_time = this.endTime
  186. }
  187. if (this.searchformUser != '' && typeof this.searchformUser != 'undefined') {
  188. params.user_name = this.searchformUser
  189. }
  190. }
  191. // 获取退款列表
  192. this.get_amount_list(params)
  193. },
  194. /**
  195. * 初始化日期时间
  196. */
  197. initDate() {
  198. //当前设定的日期时间
  199. let d = new Date;
  200. var year1 = d.getFullYear(); // 获取当前年份
  201. var mon1 = d.getMonth() + 1; // 获取当前月份
  202. var day1 = d.getDate(); // 获取当前日
  203. //前一天设定的日期时间
  204. d.setTime(d.getTime() - 24 * 60 * 60 * 1000);
  205. var year2 = d.getFullYear(); // 获取当前年份
  206. var mon2 = d.getMonth() + 1; // 获取当前月份
  207. var day2 = d.getDate(); // 获取当前日
  208. this.startTime = this.getDate(year2, mon2, day2)
  209. this.endTime = this.getDate(year1, mon1, day1)
  210. this.select_datetime.push(this.startTime)
  211. this.select_datetime.push(this.endTime)
  212. // 显示列表
  213. this.handleCurrentChange('init')
  214. },
  215. /**
  216. * 获取指定格式 年、月、日
  217. * @param {Object} y
  218. * @param {Object} m
  219. * @param {Object} d
  220. */
  221. getDate(y, m, d) {
  222. m = m > 9 ? m : '0' + m;
  223. d = d > 9 ? d : '0' + d;
  224. return y + "-" + m + "-" + d;
  225. },
  226. /**
  227. * 选择起止日期
  228. * @param {Object} val
  229. */
  230. dateChange(val) {
  231. this.startTime = val[0]
  232. this.endTime = val[1]
  233. if (this.startTime == this.endTime) {
  234. this.$message.error('起止日期不能为同一天!')
  235. } else {
  236. }
  237. },
  238. /**
  239. * 查找姓名对应的 余额列表
  240. */
  241. onSearch() {
  242. this.currentPage = 1
  243. this.handleCurrentChange('search')
  244. },
  245. /**
  246. * 导出为Excel表格
  247. */
  248. onExport() {
  249. var _this = this;
  250. let formData = new FormData();
  251. if (typeof _this.startTime != 'undefined' && _this.startTime != '') {
  252. formData.append("begin_time", _this.startTime);
  253. }
  254. if (typeof _this.endTime != 'undefined' && _this.endTime != '') {
  255. formData.append("end_time", _this.endTime);
  256. }
  257. this.$axios.post('/jxch-smartmp/HotWaters/watertoRefundExcel.action', formData)
  258. .then(res => {
  259. if (typeof res.data.downurl != 'undefined' && res.data.downurl != '' && JSON
  260. .stringify(res.data) != '{}') {
  261. // console.log(res.data.downurl);
  262. window.open('https://jtishfw.ncjti.edu.cn/jxch-smartmp' + res.data.downurl);
  263. } else {
  264. _this.$message.error(res.data.message);
  265. }
  266. })
  267. .catch(err => {
  268. // console.log(err);
  269. _this.$message.error('【导出表格】请求异常: ' + err);
  270. })
  271. }
  272. }
  273. }
  274. </script>
  275. <style scoped>
  276. @import url("tuikuan.css");
  277. </style>