index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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="会员昵称" prop="nickname">
  5. <el-input
  6. v-model="queryParams.nickname"
  7. placeholder="请输入会员昵称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="手机号" prop="phone">
  14. <el-input
  15. v-model="queryParams.phone"
  16. placeholder="请输入会员手机号"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-table height="500" border v-loading="loading" :data="userPromoterApplyList" @selection-change="handleSelectionChange">
  28. <el-table-column type="selection" width="55" align="center" />
  29. <el-table-column label="ID" align="center" prop="applyId" />
  30. <el-table-column label="会员昵称" align="center" prop="nickname" />
  31. <el-table-column label="会员手机号" align="center" prop="phone" />
  32. <el-table-column label="你为什么想成为果雨健康推广大使?" align="center" prop="contentJson" >
  33. <template slot-scope="scope">
  34. {{JSON.parse(scope.row.contentJson).question1}}
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="你是否了解果雨健康推广大使?" align="center" prop="contentJson" >
  38. <template slot-scope="scope">
  39. {{JSON.parse(scope.row.contentJson).question2}}
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="、你最有意向推广的产品是哪一款?" align="center" prop="contentJson" >
  43. <template slot-scope="scope">
  44. {{JSON.parse(scope.row.contentJson).question3}}
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="提交时间" align="center" prop="createTime" />
  48. </el-table>
  49. <pagination
  50. v-show="total>0"
  51. :total="total"
  52. :page.sync="queryParams.pageNum"
  53. :limit.sync="queryParams.pageSize"
  54. @pagination="getList"
  55. />
  56. <!-- 添加或修改推广员申请对话框 -->
  57. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  58. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  59. <el-form-item label="会员ID" prop="userId">
  60. <el-input v-model="form.userId" placeholder="请输入会员ID" />
  61. </el-form-item>
  62. <el-form-item label="提交内容" prop="contentJson">
  63. <el-input v-model="form.contentJson" placeholder="请输入提交内容" />
  64. </el-form-item>
  65. </el-form>
  66. <div slot="footer" class="dialog-footer">
  67. <el-button type="primary" @click="submitForm">确 定</el-button>
  68. <el-button @click="cancel">取 消</el-button>
  69. </div>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import { listUserPromoterApply, getUserPromoterApply, delUserPromoterApply, addUserPromoterApply, updateUserPromoterApply, exportUserPromoterApply } from "@/api/hisStore/userPromoterApply";
  75. export default {
  76. name: "UserPromoterApply",
  77. data() {
  78. return {
  79. // 遮罩层
  80. loading: true,
  81. // 选中数组
  82. ids: [],
  83. // 非单个禁用
  84. single: true,
  85. // 非多个禁用
  86. multiple: true,
  87. // 显示搜索条件
  88. showSearch: true,
  89. // 总条数
  90. total: 0,
  91. // 推广员申请表格数据
  92. userPromoterApplyList: [],
  93. // 弹出层标题
  94. title: "",
  95. // 是否显示弹出层
  96. open: false,
  97. // 查询参数
  98. queryParams: {
  99. pageNum: 1,
  100. pageSize: 10,
  101. userId: null,
  102. contentJson: null,
  103. },
  104. // 表单参数
  105. form: {},
  106. // 表单校验
  107. rules: {
  108. }
  109. };
  110. },
  111. created() {
  112. this.getList();
  113. },
  114. methods: {
  115. /** 查询推广员申请列表 */
  116. getList() {
  117. this.loading = true;
  118. listUserPromoterApply(this.queryParams).then(response => {
  119. this.userPromoterApplyList = response.rows;
  120. this.total = response.total;
  121. this.loading = false;
  122. });
  123. },
  124. // 取消按钮
  125. cancel() {
  126. this.open = false;
  127. this.reset();
  128. },
  129. // 表单重置
  130. reset() {
  131. this.form = {
  132. applyId: null,
  133. userId: null,
  134. contentJson: null,
  135. createTime: null
  136. };
  137. this.resetForm("form");
  138. },
  139. /** 搜索按钮操作 */
  140. handleQuery() {
  141. this.queryParams.pageNum = 1;
  142. this.getList();
  143. },
  144. /** 重置按钮操作 */
  145. resetQuery() {
  146. this.resetForm("queryForm");
  147. this.handleQuery();
  148. },
  149. // 多选框选中数据
  150. handleSelectionChange(selection) {
  151. this.ids = selection.map(item => item.applyId)
  152. this.single = selection.length!==1
  153. this.multiple = !selection.length
  154. },
  155. /** 新增按钮操作 */
  156. handleAdd() {
  157. this.reset();
  158. this.open = true;
  159. this.title = "添加推广员申请";
  160. },
  161. /** 修改按钮操作 */
  162. handleUpdate(row) {
  163. this.reset();
  164. const applyId = row.applyId || this.ids
  165. getUserPromoterApply(applyId).then(response => {
  166. this.form = response.data;
  167. this.open = true;
  168. this.title = "修改推广员申请";
  169. });
  170. },
  171. /** 提交按钮 */
  172. submitForm() {
  173. this.$refs["form"].validate(valid => {
  174. if (valid) {
  175. if (this.form.applyId != null) {
  176. updateUserPromoterApply(this.form).then(response => {
  177. if (response.code === 200) {
  178. this.msgSuccess("修改成功");
  179. this.open = false;
  180. this.getList();
  181. }
  182. });
  183. } else {
  184. addUserPromoterApply(this.form).then(response => {
  185. if (response.code === 200) {
  186. this.msgSuccess("新增成功");
  187. this.open = false;
  188. this.getList();
  189. }
  190. });
  191. }
  192. }
  193. });
  194. },
  195. /** 删除按钮操作 */
  196. handleDelete(row) {
  197. const applyIds = row.applyId || this.ids;
  198. this.$confirm('是否确认删除推广员申请编号为"' + applyIds + '"的数据项?', "警告", {
  199. confirmButtonText: "确定",
  200. cancelButtonText: "取消",
  201. type: "warning"
  202. }).then(function() {
  203. return delUserPromoterApply(applyIds);
  204. }).then(() => {
  205. this.getList();
  206. this.msgSuccess("删除成功");
  207. }).catch(function() {});
  208. },
  209. /** 导出按钮操作 */
  210. handleExport() {
  211. const queryParams = this.queryParams;
  212. this.$confirm('是否确认导出所有推广员申请数据项?', "警告", {
  213. confirmButtonText: "确定",
  214. cancelButtonText: "取消",
  215. type: "warning"
  216. }).then(function() {
  217. return exportUserPromoterApply(queryParams);
  218. }).then(response => {
  219. this.download(response.msg);
  220. }).catch(function() {});
  221. }
  222. }
  223. };
  224. </script>