猫妈狗爸伴宠师小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

523 lines
18 KiB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" size="medium" class="ry_form">
  4. <!-- <el-form-item label="修改人" prop="updatorBy">-->
  5. <!-- <el-input-->
  6. <!-- v-model="queryParams.updatorBy"-->
  7. <!-- placeholder="请输入修改人"-->
  8. <!-- clearable-->
  9. <!-- size="small"-->
  10. <!-- @keyup.enter.native="handleQuery"-->
  11. <!-- />-->
  12. <!-- </el-form-item>-->
  13. <el-form-item label="用户昵称" prop="userName">
  14. <el-input
  15. v-model="queryParams.userName"
  16. placeholder="请输入用户昵称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <!-- <el-form-item label="用户状态" prop="userState">-->
  23. <!-- <el-input-->
  24. <!-- v-model="queryParams.userState"-->
  25. <!-- placeholder="请输入用户状态"-->
  26. <!-- clearable-->
  27. <!-- size="small"-->
  28. <!-- @keyup.enter.native="handleQuery"-->
  29. <!-- />-->
  30. <!-- </el-form-item>-->
  31. <el-form-item label="用户电话" prop="userTelephone">
  32. <el-input
  33. v-model="queryParams.userTelephone"
  34. placeholder="请输入用户电话"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <!-- <el-form-item label="只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段" prop="unionid">-->
  41. <!-- <el-input-->
  42. <!-- v-model="queryParams.unionid"-->
  43. <!-- placeholder="请输入只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段"-->
  44. <!-- clearable-->
  45. <!-- size="small"-->
  46. <!-- @keyup.enter.native="handleQuery"-->
  47. <!-- />-->
  48. <!-- </el-form-item>-->
  49. <!-- <el-form-item label="用户的标识,对当前公众号唯一" prop="openid">-->
  50. <!-- <el-input-->
  51. <!-- v-model="queryParams.openid"-->
  52. <!-- placeholder="请输入用户的标识,对当前公众号唯一"-->
  53. <!-- clearable-->
  54. <!-- size="small"-->
  55. <!-- @keyup.enter.native="handleQuery"-->
  56. <!-- />-->
  57. <!-- </el-form-item>-->
  58. <!-- <el-form-item label="过期时间" prop="expiresIn">-->
  59. <!-- <el-input-->
  60. <!-- v-model="queryParams.expiresIn"-->
  61. <!-- placeholder="请输入过期时间"-->
  62. <!-- clearable-->
  63. <!-- size="small"-->
  64. <!-- @keyup.enter.native="handleQuery"-->
  65. <!-- />-->
  66. <!-- </el-form-item>-->
  67. <!-- <el-form-item label="过期时间" prop="expireTime">-->
  68. <!-- <el-date-picker-->
  69. <!-- clearable-->
  70. <!-- size="small"-->
  71. <!-- v-model="queryParams.expireTime"-->
  72. <!-- type="datetime"-->
  73. <!-- value-format="yyyy-MM-dd HH:mm:ss"-->
  74. <!-- placeholder="选择过期时间">-->
  75. <!-- </el-date-picker>-->
  76. <!-- </el-form-item>-->
  77. <el-form-item label="是否合伙人" prop="userHh">
  78. <el-input
  79. v-model="queryParams.userHh"
  80. placeholder="请输入是否合伙人"
  81. clearable
  82. size="small"
  83. @keyup.enter.native="handleQuery"
  84. />
  85. </el-form-item>
  86. <el-form-item label="是否伴宠师" prop="userBcs">
  87. <el-input
  88. v-model="queryParams.userBcs"
  89. placeholder="请输入是否伴宠师"
  90. clearable
  91. size="small"
  92. @keyup.enter.native="handleQuery"
  93. />
  94. </el-form-item>
  95. <!-- <el-form-item label="钱包金额" prop="price">-->
  96. <!-- <el-input-->
  97. <!-- v-model="queryParams.price"-->
  98. <!-- placeholder="请输入钱包金额"-->
  99. <!-- clearable-->
  100. <!-- size="small"-->
  101. <!-- @keyup.enter.native="handleQuery"-->
  102. <!-- />-->
  103. <!-- </el-form-item>-->
  104. <!-- <el-form-item label="邀请码" prop="invitationCode">-->
  105. <!-- <el-input-->
  106. <!-- v-model="queryParams.invitationCode"-->
  107. <!-- placeholder="请输入邀请码"-->
  108. <!-- clearable-->
  109. <!-- size="small"-->
  110. <!-- @keyup.enter.native="handleQuery"-->
  111. <!-- />-->
  112. <!-- </el-form-item>-->
  113. <el-form-item class="flex_one tr">
  114. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  115. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  116. </el-form-item>
  117. </el-form>
  118. <el-row :gutter="10" class="mb8">
  119. <!-- <el-col :span="1.5">-->
  120. <!-- <el-button-->
  121. <!-- type="primary"-->
  122. <!-- plain-->
  123. <!-- icon="el-icon-plus"-->
  124. <!-- size="mini"-->
  125. <!-- @click="handleAdd"-->
  126. <!-- v-hasPermi="['model:AppUsers:add']"-->
  127. <!-- >新增</el-button>-->
  128. <!-- </el-col>-->
  129. <el-col :span="1.5">
  130. <el-button
  131. type="success"
  132. plain
  133. icon="el-icon-edit"
  134. size="mini"
  135. :disabled="single"
  136. @click="handleUpdate"
  137. v-hasPermi="['model:AppUsers:edit']"
  138. >修改</el-button>
  139. </el-col>
  140. <el-col :span="1.5">
  141. <el-button
  142. type="danger"
  143. plain
  144. icon="el-icon-delete"
  145. size="mini"
  146. :disabled="multiple"
  147. @click="handleDelete"
  148. v-hasPermi="['model:AppUsers:remove']"
  149. >删除</el-button>
  150. </el-col>
  151. <!-- <el-col :span="1.5">-->
  152. <!-- <el-button-->
  153. <!-- type="warning"-->
  154. <!-- plain-->
  155. <!-- icon="el-icon-download"-->
  156. <!-- size="mini"-->
  157. <!-- :loading="exportLoading"-->
  158. <!-- @click="handleExport"-->
  159. <!-- v-hasPermi="['model:AppUsers:export']"-->
  160. <!-- >导出</el-button>-->
  161. <!-- </el-col>-->
  162. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  163. </el-row>
  164. <el-table v-loading="loading" :data="AppUsersList" @selection-change="handleSelectionChange">
  165. <el-table-column type="selection" width="55" align="center" />
  166. <el-table-column label="用户编号" align="center" prop="userId" />
  167. <!-- <el-table-column label="备注" align="center" prop="remark" v-if="columns[0].visible"/>-->
  168. <!-- <el-table-column label="修改人" align="center" prop="updatorBy" v-if="columns[1].visible"/>-->
  169. <!-- <el-table-column label="用户头像" align="center" prop="userImage" />-->
  170. <el-table-column label="用户头像" align="center" prop="userImage">
  171. <template slot-scope="{ row }">
  172. <el-image v-if="row.userImage" :src="row.userImage" :preview-src-list="[row.userImage]" class="small-img circle-img"/>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="用户昵称" align="center" prop="userName" />
  176. <!-- <el-table-column label="用户状态" align="center" prop="userState" v-if="columns[4].visible"/>-->
  177. <el-table-column label="用户电话" align="center" prop="userTelephone" />
  178. <!-- <el-table-column label="只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段" align="center" prop="unionid" v-if="columns[6].visible"/>-->
  179. <el-table-column label="用户微信标识" align="center" prop="openid" />
  180. <!-- <el-table-column label="token" align="center" prop="accessToken" v-if="columns[8].visible"/>-->
  181. <!-- <el-table-column label="过期时间" align="center" prop="expiresIn" v-if="columns[9].visible"/>-->
  182. <!-- <el-table-column label="刷新token" align="center" prop="refreshToken" v-if="columns[10].visible"/>-->
  183. <!-- <el-table-column label="过期时间" align="center" prop="expireTime" width="180" v-if="columns[11].visible">-->
  184. <!-- <template slot-scope="scope">-->
  185. <!-- <span>{{ parseTime(scope.row.expireTime, '')}}</span>-->
  186. <!-- </template>-->
  187. <!-- </el-table-column>-->
  188. <el-table-column label="是否合伙人" align="center" prop="userHh" />
  189. <el-table-column label="是否伴宠师" align="center" prop="userBcs" />
  190. <el-table-column label="钱包金额" align="center" prop="price"/>
  191. <el-table-column label="邀请码" align="center" prop="invitationCode" />
  192. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  193. <template slot-scope="scope">
  194. <el-button
  195. size="mini"
  196. type="text"
  197. icon="el-icon-edit"
  198. @click="handleUpdate(scope.row)"
  199. v-hasPermi="['model:AppUsers:edit']"
  200. >修改</el-button>
  201. <el-button
  202. size="mini"
  203. type="text"
  204. icon="el-icon-delete"
  205. @click="handleDelete(scope.row)"
  206. v-hasPermi="['model:AppUsers:remove']"
  207. >删除</el-button>
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. <pagination
  212. v-show="total>0"
  213. :total="total"
  214. :page.sync="queryParams.pageNum"
  215. :limit.sync="queryParams.pageSize"
  216. @pagination="getList"
  217. />
  218. <!-- 添加或修改用户对话框 -->
  219. <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
  220. <el-form ref="form" :model="form" :rules="rules" label-width="108px" inline class="dialog-form-two">
  221. <!-- <el-form-item label="逻辑删除" prop="delFlag">-->
  222. <!-- <el-input v-model="form.delFlag" placeholder="请输入逻辑删除" />-->
  223. <!-- </el-form-item>-->
  224. <!-- <el-form-item label="备注" prop="remark">-->
  225. <!-- <el-input v-model="form.remark" placeholder="请输入备注" />-->
  226. <!-- </el-form-item>-->
  227. <!-- <el-form-item label="修改人" prop="updatorBy">-->
  228. <!-- <el-input v-model="form.updatorBy" placeholder="请输入修改人" />-->
  229. <!-- </el-form-item>-->
  230. <el-form-item label="用户头像">
  231. <!-- <imageUpload v-model="form.userImage"/>-->
  232. <oss-image-upload v-model="form.userImage" :limit="1"></oss-image-upload>
  233. </el-form-item>
  234. <el-form-item label="用户昵称" prop="userName">
  235. <el-input v-model="form.userName" placeholder="请输入用户昵称" />
  236. </el-form-item>
  237. <!-- <el-form-item label="用户状态" prop="userState">-->
  238. <!-- <el-input v-model="form.userState" placeholder="请输入用户状态" />-->
  239. <!-- </el-form-item>-->
  240. <el-form-item label="用户电话" prop="userTelephone">
  241. <el-input v-model="form.userTelephone" placeholder="请输入用户电话" />
  242. </el-form-item>
  243. <!-- <el-form-item label="只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段" prop="unionid">-->
  244. <!-- <el-input v-model="form.unionid" placeholder="请输入只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段" />-->
  245. <!-- </el-form-item>-->
  246. <el-form-item label="用户微信标识" prop="openid">
  247. <el-input v-model="form.openid" placeholder="请输入用户的标识,对当前公众号唯一" />
  248. </el-form-item>
  249. <!-- <el-form-item label="token" prop="accessToken">-->
  250. <!-- <el-input v-model="form.accessToken" type="textarea" placeholder="请输入内容" />-->
  251. <!-- </el-form-item>-->
  252. <!-- <el-form-item label="过期时间" prop="expiresIn">-->
  253. <!-- <el-input v-model="form.expiresIn" placeholder="请输入过期时间" />-->
  254. <!-- </el-form-item>-->
  255. <!-- <el-form-item label="刷新token" prop="refreshToken">-->
  256. <!-- <el-input v-model="form.refreshToken" type="textarea" placeholder="请输入内容" />-->
  257. <!-- </el-form-item>-->
  258. <!-- <el-form-item label="过期时间" prop="expireTime">-->
  259. <!-- <el-date-picker clearable size="small"-->
  260. <!-- v-model="form.expireTime"-->
  261. <!-- type="datetime"-->
  262. <!-- value-format="yyyy-MM-dd HH:mm:ss"-->
  263. <!-- placeholder="选择过期时间">-->
  264. <!-- </el-date-picker>-->
  265. <!-- </el-form-item>-->
  266. <el-form-item label="是否合伙人" prop="userHh">
  267. <el-input v-model="form.userHh" placeholder="请输入是否合伙人" />
  268. </el-form-item>
  269. <el-form-item label="是否伴宠师" prop="userBcs">
  270. <el-input v-model="form.userBcs" placeholder="请输入是否伴宠师" />
  271. </el-form-item>
  272. <el-form-item label="钱包金额" prop="price">
  273. <el-input v-model="form.price" placeholder="请输入钱包金额" />
  274. </el-form-item>
  275. <el-form-item label="邀请码" prop="invitationCode">
  276. <el-input v-model="form.invitationCode" placeholder="请输入邀请码" />
  277. </el-form-item>
  278. </el-form>
  279. <div slot="footer" class="dialog-footer">
  280. <el-button type="primary" @click="submitForm"> </el-button>
  281. <el-button @click="cancel"> </el-button>
  282. </div>
  283. </el-dialog>
  284. </div>
  285. </template>
  286. <script>
  287. import { listAppUsers, getAppUsers, delAppUsers, addAppUsers, updateAppUsers, exportAppUsers } from "@/api/model/AppUsers";
  288. export default {
  289. name: "AppUsers",
  290. data() {
  291. return {
  292. // 遮罩层
  293. loading: true,
  294. // 导出遮罩层
  295. exportLoading: false,
  296. // 选中数组
  297. ids: [],
  298. // 非单个禁用
  299. single: true,
  300. // 非多个禁用
  301. multiple: true,
  302. // 显示搜索条件
  303. showSearch: true,
  304. // 总条数
  305. total: 0,
  306. // 用户表格数据
  307. AppUsersList: [],
  308. // 弹出层标题
  309. title: "",
  310. // 是否显示弹出层
  311. open: false,
  312. // 查询参数
  313. queryParams: {
  314. pageNum: 1,
  315. pageSize: 10,
  316. updatorBy: null,
  317. userImage: null,
  318. userName: null,
  319. userState: null,
  320. userTelephone: null,
  321. unionid: null,
  322. openid: null,
  323. accessToken: null,
  324. expiresIn: null,
  325. refreshToken: null,
  326. expireTime: null,
  327. userHh: null,
  328. userBcs: null,
  329. price: null,
  330. invitationCode: null,
  331. },
  332. // 表单参数
  333. form: {},
  334. // 表单校验
  335. rules: {
  336. userName: [
  337. { required: true, message: "用户昵称不能为空", trigger: "blur" }
  338. ],
  339. },
  340. columns: [
  341. { key: 4, label: "备注", visible: true },
  342. { key: 6, label: "修改人", visible: true },
  343. { key: 7, label: "用户头像", visible: false },
  344. { key: 8, label: "用户昵称", visible: true },
  345. { key: 9, label: "用户状态", visible: true },
  346. { key: 10, label: "用户电话", visible: false },
  347. { key: 11, label: "只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段", visible: false },
  348. { key: 12, label: "用户的标识,对当前公众号唯一", visible: false },
  349. { key: 13, label: "token", visible: false },
  350. { key: 14, label: "过期时间", visible: false },
  351. { key: 15, label: "刷新token", visible: false },
  352. { key: 16, label: "过期时间", visible: false },
  353. { key: 17, label: "是否合伙人", visible: false },
  354. { key: 18, label: "是否伴宠师", visible: false },
  355. { key: 19, label: "钱包金额", visible: false },
  356. { key: 20, label: "邀请码", visible: false },
  357. ],
  358. };
  359. },
  360. created() {
  361. this.getList();
  362. },
  363. methods: {
  364. /** 查询用户列表 */
  365. getList() {
  366. this.loading = true;
  367. listAppUsers(this.queryParams).then(response => {
  368. this.AppUsersList = response.rows;
  369. this.total = response.total;
  370. this.loading = false;
  371. });
  372. },
  373. // 取消按钮
  374. cancel() {
  375. this.open = false;
  376. this.reset();
  377. },
  378. // 表单重置
  379. reset() {
  380. this.form = {
  381. userId: null,
  382. createBy: null,
  383. createTime: null,
  384. delFlag: null,
  385. remark: null,
  386. updateTime: null,
  387. updatorBy: null,
  388. userImage: null,
  389. userName: null,
  390. userState: null,
  391. userTelephone: null,
  392. unionid: null,
  393. openid: null,
  394. accessToken: null,
  395. expiresIn: null,
  396. refreshToken: null,
  397. expireTime: null,
  398. userHh: null,
  399. userBcs: null,
  400. price: null,
  401. invitationCode: null,
  402. };
  403. this.resetForm("form");
  404. },
  405. /** 搜索按钮操作 */
  406. handleQuery() {
  407. this.queryParams.pageNum = 1;
  408. this.getList();
  409. },
  410. /** 重置按钮操作 */
  411. resetQuery() {
  412. this.resetForm("queryForm");
  413. this.handleQuery();
  414. },
  415. // 多选框选中数据
  416. handleSelectionChange(selection) {
  417. this.ids = selection.map(item => item.userId)
  418. this.single = selection.length!==1
  419. this.multiple = !selection.length
  420. },
  421. /** 新增按钮操作 */
  422. handleAdd() {
  423. this.reset();
  424. this.open = true;
  425. this.title = "添加用户";
  426. },
  427. /** 修改按钮操作 */
  428. handleUpdate(row) {
  429. this.reset();
  430. const userId = row.userId || this.ids
  431. getAppUsers(userId).then(response => {
  432. this.form = response.data;
  433. this.open = true;
  434. this.title = "修改用户";
  435. });
  436. },
  437. /** 提交按钮 */
  438. submitForm() {
  439. this.$refs["form"].validate(valid => {
  440. if (valid) {
  441. if (this.form.userId != null) {
  442. updateAppUsers(this.form).then(response => {
  443. this.$modal.msgSuccess("修改成功");
  444. this.open = false;
  445. this.getList();
  446. });
  447. } else {
  448. addAppUsers(this.form).then(response => {
  449. this.$modal.msgSuccess("新增成功");
  450. this.open = false;
  451. this.getList();
  452. });
  453. }
  454. }
  455. });
  456. },
  457. /** 删除按钮操作 */
  458. handleDelete(row) {
  459. const userIds = row.userId || this.ids;
  460. this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
  461. return delAppUsers(userIds);
  462. }).then(() => {
  463. this.getList();
  464. this.$modal.msgSuccess("删除成功");
  465. }).catch(() => {});
  466. },
  467. /** 导出按钮操作 */
  468. handleExport() {
  469. const queryParams = this.queryParams;
  470. this.$modal.confirm('是否确认导出所有用户数据项?').then(() => {
  471. this.exportLoading = true;
  472. return exportAppUsers(queryParams);
  473. }).then(response => {
  474. this.download(response.msg);
  475. this.exportLoading = false;
  476. }).catch(() => {});
  477. }
  478. }
  479. };
  480. </script>