lockdownUser.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="用户ID" prop="userId">
  5. <el-input
  6. v-model="queryParams.userId"
  7. placeholder="请输入用户ID"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="用户昵称" prop="nickName">
  14. <el-input
  15. v-model="queryParams.nickName"
  16. placeholder="请输入用户昵称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="连续天数" prop="consecutiveDays">
  23. <el-input
  24. v-model="queryParams.consecutiveDays"
  25. placeholder="请输入连续天数"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="开始日期" prop="startDate">
  32. <el-date-picker clearable size="small"
  33. v-model="queryParams.startDate"
  34. type="date"
  35. value-format="yyyy-MM-dd"
  36. placeholder="选择连续开始日期">
  37. </el-date-picker>
  38. </el-form-item>
  39. <el-form-item label="结束日期" prop="endDate">
  40. <el-date-picker clearable size="small"
  41. v-model="queryParams.endDate"
  42. type="date"
  43. value-format="yyyy-MM-dd"
  44. placeholder="选择连续结束日期">
  45. </el-date-picker>
  46. </el-form-item>
  47. <el-form-item label="提现次数" prop="withdrawCount">
  48. <el-input
  49. v-model="queryParams.withdrawCount"
  50. placeholder="请输入连续期间提现次数"
  51. clearable
  52. size="small"
  53. @keyup.enter.native="handleQuery"
  54. />
  55. </el-form-item>
  56. <el-form-item label="连续金额" prop="totalAmount">
  57. <el-input
  58. v-model="queryParams.totalAmount"
  59. placeholder="请输入连续期间提现总金额"
  60. clearable
  61. size="small"
  62. @keyup.enter.native="handleQuery"
  63. />
  64. </el-form-item>
  65. <el-form-item>
  66. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  67. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  68. </el-form-item>
  69. </el-form>
  70. <el-row :gutter="10" class="mb8">
  71. <el-col :span="1.5">
  72. <el-button
  73. type="success"
  74. plain
  75. icon="el-icon-edit"
  76. size="mini"
  77. :disabled="single"
  78. @click="handleUpdateUser"
  79. v-hasPermi="['his:user:disabledUsers']"
  80. >禁用</el-button>
  81. </el-col>
  82. <el-col :span="1.5">
  83. <el-button
  84. type="warning"
  85. plain
  86. icon="el-icon-download"
  87. size="mini"
  88. :loading="exportLoading"
  89. @click="handleExport"
  90. v-hasPermi="['his:consecutiveWithdrawRecord:export']"
  91. >导出</el-button>
  92. </el-col>
  93. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  94. </el-row>
  95. <el-table border v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
  96. <el-table-column type="selection" width="55" align="center" />
  97. <el-table-column label="用户ID" align="center" prop="userId" />
  98. <el-table-column label="用户昵称" align="center" prop="nickName" />
  99. <el-table-column label="连续天数" align="center" prop="consecutiveDays" />
  100. <el-table-column label="连续开始日期" align="center" prop="startDate" width="180">
  101. <template slot-scope="scope">
  102. <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="连续结束日期" align="center" prop="endDate" width="180">
  106. <template slot-scope="scope">
  107. <span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="连续期间提现次数" align="center" prop="withdrawCount" />
  111. <el-table-column label="连续期间提现总金额" align="center" prop="totalAmount" />
  112. <el-table-column label="备注" align="center" prop="remark" />
  113. </el-table>
  114. <pagination
  115. v-show="total>0"
  116. :total="total"
  117. :page.sync="queryParams.pageNum"
  118. :limit.sync="queryParams.pageSize"
  119. @pagination="getList"
  120. />
  121. <!-- 添加或修改连续提现记录对话框 -->
  122. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  123. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  124. <el-form-item label="用户ID" prop="userId">
  125. <el-input v-model="form.userId" placeholder="请输入用户ID" />
  126. </el-form-item>
  127. <el-form-item label="连续天数" prop="consecutiveDays">
  128. <el-input v-model="form.consecutiveDays" placeholder="请输入连续天数" />
  129. </el-form-item>
  130. <el-form-item label="连续开始日期" prop="startDate">
  131. <el-date-picker clearable size="small"
  132. v-model="form.startDate"
  133. type="date"
  134. value-format="yyyy-MM-dd"
  135. placeholder="选择连续开始日期">
  136. </el-date-picker>
  137. </el-form-item>
  138. <el-form-item label="连续结束日期" prop="endDate">
  139. <el-date-picker clearable size="small"
  140. v-model="form.endDate"
  141. type="date"
  142. value-format="yyyy-MM-dd"
  143. placeholder="选择连续结束日期">
  144. </el-date-picker>
  145. </el-form-item>
  146. <el-form-item label="连续期间提现次数" prop="withdrawCount">
  147. <el-input v-model="form.withdrawCount" placeholder="请输入连续期间提现次数" />
  148. </el-form-item>
  149. <el-form-item label="连续期间提现总金额" prop="totalAmount">
  150. <el-input v-model="form.totalAmount" placeholder="请输入连续期间提现总金额" />
  151. </el-form-item>
  152. <el-form-item label="备注" prop="remark">
  153. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  154. </el-form-item>
  155. </el-form>
  156. <div slot="footer" class="dialog-footer">
  157. <el-button type="primary" @click="submitForm">确 定</el-button>
  158. <el-button @click="cancel">取 消</el-button>
  159. </div>
  160. </el-dialog>
  161. <el-dialog :title="updateUser.title" :visible.sync="updateUser.open" width="500px" append-to-body>
  162. <el-form label-width="80px">
  163. <el-form-item label="禁用备注" prop="remark">
  164. <el-input v-model="userRemark" placeholder="请输入禁用备注" />
  165. </el-form-item>
  166. </el-form>
  167. <div slot="footer" class="dialog-footer">
  168. <el-button type="primary" @click="submitUserForm">确 定</el-button>
  169. <el-button @click="cancel">取 消</el-button>
  170. </div>
  171. </el-dialog>
  172. </div>
  173. </template>
  174. <script>
  175. import { listRecord, getRecord, delRecord, addRecord, updateRecord, exportRecord } from "@/api/his/consecutiveWithdrawRecord";
  176. import { disabledUsers } from "@/api/his/user";
  177. export default {
  178. name: "Record",
  179. data() {
  180. return {
  181. userRemark: "",
  182. updateUser:{
  183. title:"",
  184. open:false
  185. },
  186. // 遮罩层
  187. loading: true,
  188. // 导出遮罩层
  189. exportLoading: false,
  190. // 选中数组
  191. ids: [],
  192. userIds: [],
  193. // 非单个禁用
  194. single: true,
  195. // 非多个禁用
  196. multiple: true,
  197. // 显示搜索条件
  198. showSearch: true,
  199. // 总条数
  200. total: 0,
  201. // 连续提现记录表格数据
  202. recordList: [],
  203. // 弹出层标题
  204. title: "",
  205. // 是否显示弹出层
  206. open: false,
  207. // 查询参数
  208. queryParams: {
  209. pageNum: 1,
  210. pageSize: 10,
  211. userId: null,
  212. consecutiveDays: null,
  213. startDate: null,
  214. endDate: null,
  215. withdrawCount: null,
  216. totalAmount: null,
  217. status: null,
  218. },
  219. // 表单参数
  220. form: {},
  221. // 表单校验
  222. rules: {
  223. userId: [
  224. { required: true, message: "用户ID不能为空", trigger: "blur" }
  225. ],
  226. consecutiveDays: [
  227. { required: true, message: "连续天数不能为空", trigger: "blur" }
  228. ],
  229. startDate: [
  230. { required: true, message: "连续开始日期不能为空", trigger: "blur" }
  231. ],
  232. endDate: [
  233. { required: true, message: "连续结束日期不能为空", trigger: "blur" }
  234. ],
  235. withdrawCount: [
  236. { required: true, message: "连续期间提现次数不能为空", trigger: "blur" }
  237. ],
  238. totalAmount: [
  239. { required: true, message: "连续期间提现总金额不能为空", trigger: "blur" }
  240. ]
  241. }
  242. };
  243. },
  244. created() {
  245. this.getList();
  246. },
  247. methods: {
  248. /** 查询连续提现记录列表 */
  249. getList() {
  250. this.loading = true;
  251. listRecord(this.queryParams).then(response => {
  252. this.recordList = response.rows;
  253. this.total = response.total;
  254. this.loading = false;
  255. });
  256. },
  257. // 取消按钮
  258. cancel() {
  259. this.open = false;
  260. this.reset();
  261. },
  262. // 表单重置
  263. reset() {
  264. this.form = {
  265. id: null,
  266. userId: null,
  267. consecutiveDays: null,
  268. startDate: null,
  269. endDate: null,
  270. withdrawCount: null,
  271. totalAmount: null,
  272. status: 0,
  273. remark: null,
  274. createTime: null,
  275. updateTime: null
  276. };
  277. this.resetForm("form");
  278. },
  279. /** 搜索按钮操作 */
  280. handleQuery() {
  281. this.queryParams.pageNum = 1;
  282. this.getList();
  283. },
  284. /** 重置按钮操作 */
  285. resetQuery() {
  286. this.resetForm("queryForm");
  287. this.handleQuery();
  288. },
  289. // 多选框选中数据
  290. handleSelectionChange(selection) {
  291. this.ids = selection.map(item => item.id)
  292. this.userIds = selection.map(item => item.userId)
  293. this.single = selection.length!==1
  294. this.multiple = !selection.length
  295. },
  296. /** 新增按钮操作 */
  297. handleAdd() {
  298. this.reset();
  299. this.open = true;
  300. this.title = "添加连续提现记录";
  301. },
  302. /** 修改按钮操作 */
  303. handleUpdate(row) {
  304. this.reset();
  305. const id = row.id || this.ids
  306. getRecord(id).then(response => {
  307. this.form = response.data;
  308. this.open = true;
  309. this.title = "修改连续提现记录";
  310. });
  311. },
  312. /** 修改按钮操作 */
  313. handleUpdateUser() {
  314. this.updateUser.open = true;
  315. this.updateUser.title = "禁用用户";
  316. },
  317. /** 提交按钮 */
  318. submitForm() {
  319. this.$refs["form"].validate(valid => {
  320. if (valid) {
  321. if (this.form.id != null) {
  322. updateRecord(this.form).then(response => {
  323. this.msgSuccess("修改成功");
  324. this.open = false;
  325. this.getList();
  326. });
  327. } else {
  328. addRecord(this.form).then(response => {
  329. this.msgSuccess("新增成功");
  330. this.open = false;
  331. this.getList();
  332. });
  333. }
  334. }
  335. });
  336. },
  337. submitUserForm(){
  338. const params = {userIds: this.userIds,remark: this.userRemark};
  339. disabledUsers(params).then(response => {
  340. this.msgSuccess("禁用成功");
  341. this.updateUser.open = false;
  342. this.getList();
  343. });
  344. },
  345. /** 删除按钮操作 */
  346. handleDelete(row) {
  347. const ids = row.id || this.ids;
  348. this.$confirm('是否确认删除连续提现记录编号为"' + ids + '"的数据项?', "警告", {
  349. confirmButtonText: "确定",
  350. cancelButtonText: "取消",
  351. type: "warning"
  352. }).then(function() {
  353. return delRecord(ids);
  354. }).then(() => {
  355. this.getList();
  356. this.msgSuccess("删除成功");
  357. }).catch(() => {});
  358. },
  359. /** 导出按钮操作 */
  360. handleExport() {
  361. const queryParams = this.queryParams;
  362. this.$confirm('是否确认导出所有连续提现记录数据项?', "警告", {
  363. confirmButtonText: "确定",
  364. cancelButtonText: "取消",
  365. type: "warning"
  366. }).then(() => {
  367. this.exportLoading = true;
  368. return exportRecord(queryParams);
  369. }).then(response => {
  370. this.download(response.msg);
  371. this.exportLoading = false;
  372. }).catch(() => {});
  373. }
  374. }
  375. };
  376. </script>