index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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="优惠券领取ID" prop="issueId">
  14. <el-input
  15. v-model="queryParams.issueId"
  16. placeholder="请输入优惠券领取ID"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="优惠券领取ID" prop="isDel">
  23. <el-input
  24. v-model="queryParams.isDel"
  25. placeholder="请输入优惠券领取ID"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  33. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. icon="el-icon-plus"
  41. size="mini"
  42. @click="handleAdd"
  43. v-hasPermi="['store:storeCouponIssueUser:add']"
  44. >新增</el-button>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-button
  48. type="success"
  49. icon="el-icon-edit"
  50. size="mini"
  51. :disabled="single"
  52. @click="handleUpdate"
  53. v-hasPermi="['store:storeCouponIssueUser:edit']"
  54. >修改</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="danger"
  59. icon="el-icon-delete"
  60. size="mini"
  61. :disabled="multiple"
  62. @click="handleDelete"
  63. v-hasPermi="['store:storeCouponIssueUser:remove']"
  64. >删除</el-button>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-button
  68. type="warning"
  69. icon="el-icon-download"
  70. size="mini"
  71. @click="handleExport"
  72. v-hasPermi="['store:storeCouponIssueUser:export']"
  73. >导出</el-button>
  74. </el-col>
  75. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  76. </el-row>
  77. <el-table height="500" border v-loading="loading" :data="storeCouponIssueUserList" @selection-change="handleSelectionChange">
  78. <el-table-column type="selection" width="55" align="center" />
  79. <el-table-column label="优惠券领取ID" align="center" prop="id" />
  80. <el-table-column label="领取优惠券用户ID" align="center" prop="userId" />
  81. <el-table-column label="优惠券领取ID" align="center" prop="issueId" />
  82. <el-table-column label="领取时间" align="center" prop="isDel" />
  83. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  84. <template slot-scope="scope">
  85. <el-button
  86. size="mini"
  87. type="text"
  88. icon="el-icon-edit"
  89. @click="handleUpdate(scope.row)"
  90. v-hasPermi="['store:storeCouponIssueUser:edit']"
  91. >修改</el-button>
  92. <el-button
  93. size="mini"
  94. type="text"
  95. icon="el-icon-delete"
  96. @click="handleDelete(scope.row)"
  97. v-hasPermi="['store:storeCouponIssueUser:remove']"
  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. <!-- 添加或修改优惠券用户领取记录对话框 -->
  110. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  111. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  112. <el-form-item label="领取优惠券用户ID" prop="userId">
  113. <el-input v-model="form.userId" placeholder="请输入领取优惠券用户ID" />
  114. </el-form-item>
  115. <el-form-item label="优惠券领取ID" prop="issueId">
  116. <el-input v-model="form.issueId" placeholder="请输入优惠券领取ID" />
  117. </el-form-item>
  118. <el-form-item label="优惠券领取ID" prop="isDel">
  119. <el-input v-model="form.isDel" placeholder="请输入优惠券领取ID" />
  120. </el-form-item>
  121. </el-form>
  122. <div slot="footer" class="dialog-footer">
  123. <el-button type="primary" @click="submitForm">确 定</el-button>
  124. <el-button @click="cancel">取 消</el-button>
  125. </div>
  126. </el-dialog>
  127. </div>
  128. </template>
  129. <script>
  130. import { listStoreCouponIssueUser, getStoreCouponIssueUser, delStoreCouponIssueUser, addStoreCouponIssueUser, updateStoreCouponIssueUser, exportStoreCouponIssueUser } from "@/api/live/liveCouponIssueUser";
  131. export default {
  132. name: "StoreCouponIssueUser",
  133. data() {
  134. return {
  135. // 遮罩层
  136. loading: true,
  137. // 选中数组
  138. ids: [],
  139. // 非单个禁用
  140. single: true,
  141. // 非多个禁用
  142. multiple: true,
  143. // 显示搜索条件
  144. showSearch: true,
  145. // 总条数
  146. total: 0,
  147. // 优惠券用户领取记录表格数据
  148. storeCouponIssueUserList: [],
  149. // 弹出层标题
  150. title: "",
  151. // 是否显示弹出层
  152. open: false,
  153. // 查询参数
  154. queryParams: {
  155. pageNum: 1,
  156. pageSize: 10,
  157. userId: null,
  158. issueId: null,
  159. isDel: null
  160. },
  161. // 表单参数
  162. form: {},
  163. // 表单校验
  164. rules: {
  165. }
  166. };
  167. },
  168. created() {
  169. this.getList();
  170. },
  171. methods: {
  172. /** 查询优惠券用户领取记录列表 */
  173. getList() {
  174. this.loading = true;
  175. listStoreCouponIssueUser(this.queryParams).then(response => {
  176. this.storeCouponIssueUserList = response.rows;
  177. this.total = response.total;
  178. this.loading = false;
  179. });
  180. },
  181. // 取消按钮
  182. cancel() {
  183. this.open = false;
  184. this.reset();
  185. },
  186. // 表单重置
  187. reset() {
  188. this.form = {
  189. id: null,
  190. userId: null,
  191. issueId: null,
  192. createTime: null,
  193. updateTime: null,
  194. isDel: null
  195. };
  196. this.resetForm("form");
  197. },
  198. /** 搜索按钮操作 */
  199. handleQuery() {
  200. this.queryParams.pageNum = 1;
  201. this.getList();
  202. },
  203. /** 重置按钮操作 */
  204. resetQuery() {
  205. this.resetForm("queryForm");
  206. this.handleQuery();
  207. },
  208. // 多选框选中数据
  209. handleSelectionChange(selection) {
  210. this.ids = selection.map(item => item.id)
  211. this.single = selection.length!==1
  212. this.multiple = !selection.length
  213. },
  214. /** 新增按钮操作 */
  215. handleAdd() {
  216. this.reset();
  217. this.open = true;
  218. this.title = "添加优惠券用户领取记录";
  219. },
  220. /** 修改按钮操作 */
  221. handleUpdate(row) {
  222. this.reset();
  223. const id = row.id || this.ids
  224. getStoreCouponIssueUser(id).then(response => {
  225. this.form = response.data;
  226. this.open = true;
  227. this.title = "修改优惠券用户领取记录";
  228. });
  229. },
  230. /** 提交按钮 */
  231. submitForm() {
  232. this.$refs["form"].validate(valid => {
  233. if (valid) {
  234. if (this.form.id != null) {
  235. updateStoreCouponIssueUser(this.form).then(response => {
  236. if (response.code === 200) {
  237. this.msgSuccess("修改成功");
  238. this.open = false;
  239. this.getList();
  240. }
  241. });
  242. } else {
  243. addStoreCouponIssueUser(this.form).then(response => {
  244. if (response.code === 200) {
  245. this.msgSuccess("新增成功");
  246. this.open = false;
  247. this.getList();
  248. }
  249. });
  250. }
  251. }
  252. });
  253. },
  254. /** 删除按钮操作 */
  255. handleDelete(row) {
  256. const ids = row.id || this.ids;
  257. this.$confirm('是否确认删除优惠券用户领取记录编号为"' + ids + '"的数据项?', "警告", {
  258. confirmButtonText: "确定",
  259. cancelButtonText: "取消",
  260. type: "warning"
  261. }).then(function() {
  262. return delStoreCouponIssueUser(ids);
  263. }).then(() => {
  264. this.getList();
  265. this.msgSuccess("删除成功");
  266. }).catch(function() {});
  267. },
  268. /** 导出按钮操作 */
  269. handleExport() {
  270. const queryParams = this.queryParams;
  271. this.$confirm('是否确认导出所有优惠券用户领取记录数据项?', "警告", {
  272. confirmButtonText: "确定",
  273. cancelButtonText: "取消",
  274. type: "warning"
  275. }).then(function() {
  276. return exportStoreCouponIssueUser(queryParams);
  277. }).then(response => {
  278. this.download(response.msg);
  279. }).catch(function() {});
  280. }
  281. }
  282. };
  283. </script>