backMoney.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 退费管理
  6. </h2>
  7. <div class="m-core">
  8. <!-- 搜索类型 -->
  9. <save-form
  10. :inline="true"
  11. class="searchForm"
  12. :model="searchForm"
  13. @submit="search"
  14. @reset="onReSet"
  15. >
  16. <el-form-item prop="organId">
  17. <el-select
  18. class="multiple"
  19. v-model.trim="searchForm.organId"
  20. clearable
  21. filterable
  22. placeholder="请选择分部"
  23. >
  24. <el-option
  25. v-for="(item, index) in selects.branchs"
  26. :key="index"
  27. :label="item.name"
  28. :value="item.id"
  29. ></el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-date-picker
  34. style="width: 410px"
  35. v-model.trim="searchForm.orderDate"
  36. type="daterange"
  37. value-format="yyyy-MM-dd"
  38. @change="searchOrderDate"
  39. range-separator="至"
  40. start-placeholder="申请开始日期"
  41. end-placeholder="申请结束日期"
  42. :picker-options="{
  43. firstDayOfWeek: 1,
  44. }"
  45. >
  46. </el-date-picker>
  47. </el-form-item>
  48. <el-form-item>
  49. <el-button native-type="submit" type="danger">搜索</el-button>
  50. <el-button native-type="reset" type="primary">重置</el-button>
  51. </el-form-item>
  52. </save-form>
  53. <!-- 列表 -->
  54. <div class="tableWrap">
  55. <el-table
  56. :data="tableList"
  57. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  58. >
  59. <el-table-column
  60. align="center"
  61. width="150"
  62. prop="createTime"
  63. label="申请时间"
  64. >
  65. <template slot-scope="scope">
  66. <div>
  67. {{ scope.row.createTime | dateForMinFormat }}
  68. </div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" prop="orderNo" label="原订单编号">
  72. </el-table-column>
  73. <el-table-column
  74. align="center"
  75. prop="studentPaymentOrder.expectAmount"
  76. label="应付金额"
  77. >
  78. <template slot-scope="scope">
  79. <div>
  80. {{ scope.row.studentPaymentOrder.expectAmount | moneyFormat }}
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. align="center"
  86. prop="studentPaymentOrder.actualAmount"
  87. label="实付金额"
  88. >
  89. <template slot-scope="scope">
  90. <div>
  91. {{ scope.row.studentPaymentOrder.actualAmount | moneyFormat }}
  92. </div>
  93. </template>
  94. </el-table-column>
  95. <el-table-column align="center" prop="user.username" label="学员姓名">
  96. </el-table-column>
  97. <el-table-column align="center" prop="remark" label="退费说明">
  98. </el-table-column>
  99. <el-table-column
  100. align="center"
  101. prop="expectAmount"
  102. label="预退费金额"
  103. >
  104. <template slot-scope="scope">
  105. <div>
  106. {{ scope.row.expectAmount | moneyFormat }}
  107. </div>
  108. </template>
  109. </el-table-column>
  110. <el-table-column
  111. align="center"
  112. prop="actualAmount"
  113. label="实退费金额"
  114. >
  115. <template slot-scope="scope">
  116. <div>
  117. {{ scope.row.actualAmount | moneyFormat }}
  118. </div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="center" label="退费状态">
  122. <template slot-scope="scope">
  123. {{ scope.row.status | returnStatus }}
  124. </template>
  125. </el-table-column>
  126. <el-table-column align="center" label="操作">
  127. <template
  128. slot-scope="scope"
  129. v-if="scope.row.status == 'WAIT_PAYMENT'"
  130. >
  131. <el-button
  132. @click="onBackMoney(scope.row)"
  133. v-permission="'vipGroupManage/applyRefundAudit'"
  134. type="text"
  135. >退费</el-button
  136. >
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <pagination
  141. sync
  142. :total.sync="pageInfo.total"
  143. :page.sync="pageInfo.page"
  144. :limit.sync="pageInfo.limit"
  145. :page-sizes="pageInfo.page_size"
  146. @pagination="getList"
  147. />
  148. </div>
  149. <el-dialog
  150. title="退费确认"
  151. :visible.sync="backStatus"
  152. @close="onFormClose('ruleForm')"
  153. width="500px"
  154. >
  155. <el-form :model="form" :rules="rules" ref="ruleForm">
  156. <el-form-item
  157. label="退费路径"
  158. prop="name"
  159. :label-width="formLabelWidth"
  160. >
  161. <el-input disabled value="余额" autocomplete="off"></el-input>
  162. </el-form-item>
  163. <el-form-item
  164. label="退费金额"
  165. prop="amount"
  166. :label-width="formLabelWidth"
  167. >
  168. <el-input
  169. v-model.trim.number="form.amount"
  170. autocomplete="off"
  171. ></el-input>
  172. </el-form-item>
  173. </el-form>
  174. <span slot="footer" class="dialog-footer">
  175. <el-button
  176. type="danger"
  177. @click="onTeachingSubmit('ruleForm', 'REJECT')"
  178. >拒绝退费</el-button
  179. >
  180. <el-button
  181. type="primary"
  182. @click="onTeachingSubmit('ruleForm', 'DONE')"
  183. >确认退费</el-button
  184. >
  185. </span>
  186. </el-dialog>
  187. </div>
  188. </div>
  189. </template>
  190. <script>
  191. import pagination from "@/components/Pagination/index";
  192. import { studentRefundsQueryPage, applyRefundAudit } from "@/api/orderManager";
  193. import { getEmployeeOrgan } from "@/api/buildTeam";
  194. import { getTimes } from "@/utils";
  195. import store from "@/store";
  196. export default {
  197. components: { pagination },
  198. name: "backMoney",
  199. data() {
  200. return {
  201. searchForm: {
  202. startTime: null,
  203. endTime: null,
  204. organId: null,
  205. orderDate: [],
  206. },
  207. tableList: [],
  208. organList: [],
  209. pageInfo: {
  210. // 分页规则
  211. limit: 10, // 限制显示条数
  212. page: 1, // 当前页
  213. total: 0, // 总条数
  214. page_size: [10, 20, 40, 50], // 选择限制显示条数
  215. },
  216. backStatus: false,
  217. formLabelWidth: "100px",
  218. form: {
  219. id: null,
  220. amount: null,
  221. },
  222. rules: {
  223. amount: [
  224. {
  225. required: true,
  226. type: "number",
  227. message: "请输入金额",
  228. trigger: "blur",
  229. },
  230. ],
  231. },
  232. };
  233. },
  234. mounted() {
  235. // getEmployeeOrgan().then(res => {
  236. // if (res.code == 200) {
  237. // this.organList = res.data;
  238. // }
  239. // })
  240. this.$store.dispatch("setBranchs");
  241. if (this.searchForm?.orderDate?.length < 1) {
  242. var now = new Date();
  243. var startDate = new Date(
  244. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  245. )
  246. .toISOString()
  247. .slice(0, 10);
  248. var endDate = new Date(
  249. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  250. )
  251. .toISOString()
  252. .slice(0, 10);
  253. this.searchForm.orderDate = [];
  254. this.searchForm.orderDate.push(startDate);
  255. this.searchForm.orderDate.push(endDate);
  256. }
  257. this.getList();
  258. },
  259. methods: {
  260. search() {
  261. this.pageInfo.page = 1;
  262. this.getList();
  263. },
  264. onTeachingSubmit(formName, status) {
  265. // 添加数据
  266. this.$refs[formName].validate((valid) => {
  267. if (valid) {
  268. this.form.status = status;
  269. applyRefundAudit(this.form).then((res) => {
  270. if (res.code == 200) {
  271. this.$message.success("操作成功");
  272. this.backStatus = false;
  273. this.getList();
  274. } else {
  275. this.$message.error(res.msg);
  276. }
  277. });
  278. } else {
  279. return false;
  280. }
  281. });
  282. },
  283. getList() {
  284. let { orderDate, ...rest } = this.searchForm;
  285. let params = {
  286. ...rest,
  287. page: this.pageInfo.page,
  288. rows: this.pageInfo.limit,
  289. ...getTimes(orderDate, ["startTime", "endTime"]),
  290. };
  291. // let params = this.searchForm;
  292. // params.rows = this.pageInfo.limit;
  293. // params.page = this.pageInfo.page;
  294. // if (this.orderDate?.length > 0) {
  295. // params.startTime = this.orderDate[0];
  296. // params.endTime = this.orderDate[1];
  297. // } else {
  298. // params.startTime = null;
  299. // params.endTime = null;
  300. // }
  301. studentRefundsQueryPage(params).then((res) => {
  302. let result = res.data;
  303. if (res.code == 200) {
  304. this.tableList = result.rows;
  305. this.pageInfo.total = result.total;
  306. }
  307. });
  308. },
  309. searchOrderDate(value) {
  310. if (value) {
  311. this.searchForm.startTime = value[0] + " 00:00:00";
  312. this.searchForm.endTime = value[1] + " 23:59:59";
  313. } else {
  314. this.searchForm.startTime = null;
  315. this.searchForm.endTime = null;
  316. }
  317. },
  318. onReSet() {
  319. this.orderDate = null;
  320. this.searchForm = {
  321. startTime: null,
  322. endTime: null,
  323. };
  324. },
  325. onFormClose(formName) {
  326. // 关闭弹窗重置验证
  327. this.$refs[formName].clearValidate();
  328. },
  329. onBackMoney(row) {
  330. // 退费
  331. this.backStatus = true;
  332. this.form = {
  333. id: row.id,
  334. amount: row.expectAmount,
  335. };
  336. // applyRefundAudit()
  337. },
  338. },
  339. };
  340. </script>
  341. <style lang="scss">
  342. </style>