eventManagement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--用户数据-->
  5. <el-col :span="24" :xs="24">
  6. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  7. <el-form-item label="批次号" prop="realName">
  8. <el-input
  9. v-model="queryParams.realName"
  10. placeholder="请输入批次号"
  11. clearable
  12. style="width: 240px"
  13. @keyup.enter.native="handleQuery"
  14. />
  15. </el-form-item>
  16. <el-form-item label="优惠卷名称" prop="memberCode" label-width="88px">
  17. <el-input
  18. v-model="queryParams.memberCode"
  19. placeholder="请输入优惠卷名称"
  20. clearable
  21. style="width: 240px"
  22. @keyup.enter.native="handleQuery"
  23. />
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  27. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  28. </el-form-item>
  29. </el-form>
  30. <el-row :gutter="10" class="mb8">
  31. <el-col :span="1.5">
  32. <el-button
  33. type="primary"
  34. plain
  35. icon="el-icon-plus"
  36. size="mini"
  37. @click="handleAdd"
  38. v-hasPermi="configPermi.add"
  39. >新增</el-button>
  40. </el-col>
  41. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  42. </el-row>
  43. <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
  44. <el-table-column type="index" label="序号" align="center" />
  45. <el-table-column label="优惠券名称" align="center" key="realName" prop="realName" v-if="columns[0].visible" :show-overflow-tooltip="true" />
  46. <el-table-column label="券种类型" align="center" key="type" prop="type" v-if="columns[1].visible" :show-overflow-tooltip="true">
  47. <template slot-scope="scope">
  48. <dict-tag :options="dict.type.tourism_memberInformation_user_type" :value="scope.row.type"/>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="券种说明" align="center" key="levelName" prop="levelName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
  52. <el-table-column label="发放数量" align="center" key="mobile" prop="mobile" v-if="columns[3].visible" :show-overflow-tooltip="true" />
  53. <el-table-column label="适用对象" align="center" key="cardId" prop="cardId" v-if="columns[4].visible" :show-overflow-tooltip="true" />
  54. <el-table-column label="领取限制" align="center" key="credit" prop="credit" v-if="columns[5].visible" :show-overflow-tooltip="true" />
  55. <el-table-column label="使用有效期" align="center" key="balance" prop="balance" v-if="columns[6].visible" :show-overflow-tooltip="true" />
  56. <el-table-column label="适用产品" align="center" key="buyCount" prop="buyCount" v-if="columns[7].visible" :show-overflow-tooltip="true" />
  57. <el-table-column label="已领取统计" align="center" key="consumeTotal" prop="consumeTotal" v-if="columns[8].visible" :show-overflow-tooltip="true" />
  58. <el-table-column label="创建时间" align="center" key="consumeTotal1" prop="consumeTotal1" v-if="columns[9].visible" :show-overflow-tooltip="true" />
  59. <el-table-column label="禁用/启用" align="center" key="status" v-if="columns[10].visible">
  60. <template slot-scope="scope">
  61. <switchBox
  62. :defaultChecked="true"
  63. v-model="scope.row.status"
  64. @changeFun="openAttraction(scope.row)"
  65. :disabled="false"
  66. :active-value="1"
  67. :inactive-value="0"
  68. />
  69. </template>
  70. </el-table-column>
  71. <el-table-column
  72. label="操作"
  73. align="center"
  74. width="160"
  75. class-name="small-padding fixed-width"
  76. >
  77. <template slot-scope="scope" >
  78. <el-button
  79. size="mini"
  80. type="text"
  81. icon="el-icon-delete"
  82. @click="handleDelete(scope.row)"
  83. v-hasPermi="configPermi.delect"
  84. >删除</el-button>
  85. <el-button
  86. size="mini"
  87. type="text"
  88. icon="el-icon-edit"
  89. @click="handleUpdate(scope.row)"
  90. v-hasPermi="configPermi.edit"
  91. >修改</el-button>
  92. <el-button
  93. size="mini"
  94. type="text"
  95. icon="el-icon-document"
  96. @click="handleDetails(scope.row)"
  97. v-hasPermi="configPermi.details"
  98. >详情</el-button>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <pagination
  103. v-show="total>0"
  104. :total="total"
  105. :page.sync="queryParams.pageNum"
  106. :limit.sync="queryParams.pageSize"
  107. @pagination="getList"
  108. />
  109. </el-col>
  110. </el-row>
  111. <!-- 详情 -->
  112. <detailsBox ref="detailsBox" />
  113. <addAndEdit ref="addAndEdit" @refresh="getList" />
  114. </div>
  115. </template>
  116. <script>
  117. import {
  118. listTableApi,
  119. delTableParamsApi,
  120. addTableApi
  121. } from "@/api/CURD";
  122. import detailsBox from "./detailsBox/eventManagementDetails.vue"
  123. import addAndEdit from "./formBox/eventManagementForm.vue"
  124. export default {
  125. name: "User",
  126. dicts: ['tourism_memberInformation_user_type','tourism_memberInformation_status','tourism_memberInformation_sex'],
  127. components: {detailsBox,addAndEdit},
  128. data() {
  129. return {
  130. title: "优惠券管理",// 通用标题
  131. configPermi: {
  132. add: [''], // 新增权限
  133. details: ['electronicMembership:memberInformation:details'], // 详情权限
  134. delect: ['electronicMembership:memberInformation:delect'], // 删除权限
  135. edit: [''], // 编辑权限
  136. upload: [''],// 导入权限
  137. export: [''],// 导出权限
  138. },
  139. configUrl: {
  140. list: '/member/memberInfo/list', // 列表地址
  141. delect: '', // 删除地址
  142. upload: '',// 导入地址
  143. download:'', // 下载模板地址
  144. export: '',// 导出地址
  145. updateStatus: '', // 编辑地址
  146. },
  147. // 遮罩层
  148. loading: true,
  149. // 选中数组
  150. ids: [],
  151. // 非单个禁用
  152. single: true,
  153. // 非多个禁用
  154. multiple: true,
  155. // 显示搜索条件
  156. showSearch: true,
  157. // 总条数
  158. total: 0,
  159. // 用户表格数据
  160. tableList: null,
  161. // 查询参数
  162. queryParams: {
  163. pageNum: 1,
  164. pageSize: 10,
  165. },
  166. dateRange: [],
  167. // 控制列表是否显示
  168. columns: [
  169. { key: 0, label: `优惠券名称`, visible: true },
  170. { key: 1, label: `券种类型`, visible: true },
  171. { key: 2, label: `券种说明`, visible: true },
  172. { key: 2.5, label: `发放数量`, visible: true },
  173. { key: 3, label: `适用对象`, visible: true },
  174. { key: 4, label: `领取限制`, visible: true },
  175. { key: 5, label: `使用有效期`, visible: true },
  176. { key: 6, label: `适用产品`, visible: true },
  177. { key: 7, label: `已领取统计`, visible: true },
  178. { key: 8, label: `创建时间`, visible: true },
  179. { key: 9, label: `禁用/启用`, visible: true },
  180. ],
  181. };
  182. },
  183. created() {
  184. this.getList();
  185. },
  186. methods: {
  187. /** 查询用户列表 */
  188. getList() {
  189. this.loading = true;
  190. listTableApi(
  191. this.configUrl.list,
  192. this.addDateRange(
  193. this.queryParams,
  194. this.dateRange)).then(response => {
  195. this.tableList = response.data.rows;
  196. this.total = response.data.total;
  197. this.loading = false;
  198. }
  199. ).catch (error=>{
  200. console.error('获取列表失败!!!!',error)
  201. this.tableList = [];
  202. this.total = 0;
  203. this.loading = false
  204. })
  205. },
  206. /** 搜索按钮操作 */
  207. handleQuery() {
  208. this.queryParams.pageNum = 1;
  209. this.getList();
  210. },
  211. /** 重置按钮操作 */
  212. resetQuery() {
  213. this.dateRange = [];
  214. this.queryParams = {
  215. pageNum: 1,
  216. pageSize: 10,
  217. }
  218. this.handleQuery();
  219. },
  220. // 多选框选中数据
  221. handleSelectionChange(selection) {
  222. this.ids = selection.map(item => item.id);
  223. this.single = selection.length != 1;
  224. this.multiple = !selection.length;
  225. },
  226. /** 新增按钮操作 */
  227. handleAdd() {
  228. if(this.$refs.addAndEdit) {
  229. this.$refs.addAndEdit.initData(this.title + '新增', "ADD",{})
  230. }
  231. },
  232. /** 修改按钮操作 */
  233. handleUpdate(row) {
  234. if(this.$refs.addAndEdit) {
  235. this.$refs.addAndEdit.initData(this.title + '编辑', "EDITInit",{...row})
  236. }
  237. },
  238. handleDetails(row){
  239. if(this.$refs.detailsBox) {
  240. this.$refs.detailsBox.initData(this.title + '详情', "EDITInit",{...row})
  241. }
  242. },
  243. /** 删除按钮操作 */
  244. handleDelete(row) {
  245. const ids = row.id || this.ids;
  246. return
  247. this.$modal.confirm('是否确认删除数据项?').then( () => {
  248. return delTableParamsApi(this.configUrl.delect,{
  249. id: ids
  250. });
  251. }).then(() => {
  252. this.getList();
  253. this.$modal.msgSuccess("删除成功");
  254. }).catch((e) => {
  255. console.error("删除失败====",e)
  256. });
  257. },
  258. /** 导出按钮操作 */
  259. handleExport() {
  260. this.download(this.configUrl.export, {
  261. ...this.queryParams
  262. }, `${this.title }_${new Date().getTime()}.xlsx`)
  263. },
  264. /** 导入按钮操作 */
  265. handleImport() {
  266. if(this.$refs.upload) {
  267. this.$refs.upload.initData({
  268. width: '400px',
  269. // 弹出层标题(用户导入)
  270. title: this.title + "导入",
  271. // 下载模板地址
  272. importTemplate: this.configUrl.download,
  273. // 上传的地址
  274. url: this.configUrl.upload
  275. })
  276. }
  277. },
  278. /** 开/闭 园 */
  279. openAttraction(row) {
  280. console.log("row======",row)
  281. return
  282. this.$modal.confirm(`是否确认${row.status == 0 ? '启用' : '禁用'} ${row.realName||''}吗?`).then( () => {
  283. return addTableApi(this.configUrl.updateStatus,{
  284. id: row.id,
  285. status: row.status == 1 ? 0 : 1
  286. });
  287. }).then(() => {
  288. this.getList();
  289. this.$modal.msgSuccess(`${row.status == 0 ? '启用' : '禁用'}成功`);
  290. }).catch((e) => {
  291. console.error("失败====",e)
  292. });
  293. },
  294. }
  295. };
  296. </script>