猫妈狗爸伴宠师小程序后端代码
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.

326 lines
10 KiB

11 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="detailsName">
  5. <el-input
  6. v-model="queryParams.detailsName"
  7. placeholder="请输入明细名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="交易金额" prop="detailsPrice">
  14. <el-input
  15. v-model="queryParams.detailsPrice"
  16. placeholder="请输入交易金额"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="交易类型: 1为收入明细,2为支出明细" prop="transactionType">
  23. <el-select v-model="queryParams.transactionType" placeholder="请选择交易类型: 1为收入明细,2为支出明细" clearable size="small">
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="伴宠师ID" prop="usersId">
  27. <el-input
  28. v-model="queryParams.usersId"
  29. placeholder="请输入伴宠师ID"
  30. clearable
  31. size="small"
  32. @keyup.enter.native="handleQuery"
  33. />
  34. </el-form-item>
  35. <el-form-item class="flex_one tr">
  36. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  37. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  38. </el-form-item>
  39. </el-form>
  40. <el-row :gutter="10" class="mb8">
  41. <el-col :span="1.5">
  42. <el-button
  43. type="primary"
  44. plain
  45. icon="el-icon-plus"
  46. size="mini"
  47. @click="handleAdd"
  48. v-hasPermi="['model:AppDeposit:add']"
  49. >新增</el-button>
  50. </el-col>
  51. <el-col :span="1.5">
  52. <el-button
  53. type="success"
  54. plain
  55. icon="el-icon-edit"
  56. size="mini"
  57. :disabled="single"
  58. @click="handleUpdate"
  59. v-hasPermi="['model:AppDeposit:edit']"
  60. >修改</el-button>
  61. </el-col>
  62. <el-col :span="1.5">
  63. <el-button
  64. type="danger"
  65. plain
  66. icon="el-icon-delete"
  67. size="mini"
  68. :disabled="multiple"
  69. @click="handleDelete"
  70. v-hasPermi="['model:AppDeposit:remove']"
  71. >删除</el-button>
  72. </el-col>
  73. <el-col :span="1.5">
  74. <el-button
  75. type="warning"
  76. plain
  77. icon="el-icon-download"
  78. size="mini"
  79. :loading="exportLoading"
  80. @click="handleExport"
  81. v-hasPermi="['model:AppDeposit:export']"
  82. >导出</el-button>
  83. </el-col>
  84. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  85. </el-row>
  86. <el-table v-loading="loading" :data="AppDepositList" @selection-change="handleSelectionChange">
  87. <el-table-column type="selection" width="55" align="center" />
  88. <el-table-column label="保证金编号" align="center" prop="id" />
  89. <el-table-column label="明细名称" align="center" prop="detailsName" v-if="columns[0].visible"/>
  90. <el-table-column label="交易金额" align="center" prop="detailsPrice" v-if="columns[1].visible"/>
  91. <el-table-column label="交易类型: 1为收入明细,2为支出明细" align="center" prop="transactionType" v-if="columns[2].visible"/>
  92. <el-table-column label="伴宠师ID" align="center" prop="usersId" v-if="columns[3].visible"/>
  93. <el-table-column label="备注" align="center" prop="remark" v-if="columns[4].visible"/>
  94. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  95. <template slot-scope="scope">
  96. <el-button
  97. size="mini"
  98. type="text"
  99. icon="el-icon-edit"
  100. @click="handleUpdate(scope.row)"
  101. v-hasPermi="['model:AppDeposit:edit']"
  102. >修改</el-button>
  103. <el-button
  104. size="mini"
  105. type="text"
  106. icon="el-icon-delete"
  107. @click="handleDelete(scope.row)"
  108. v-hasPermi="['model:AppDeposit:remove']"
  109. >删除</el-button>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. <pagination
  114. v-show="total>0"
  115. :total="total"
  116. :page.sync="queryParams.pageNum"
  117. :limit.sync="queryParams.pageSize"
  118. @pagination="getList"
  119. />
  120. <!-- 添加或修改保证金记录对话框 -->
  121. <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
  122. <el-form ref="form" :model="form" :rules="rules" label-width="108px" inline class="dialog-form-two">
  123. <el-form-item label="明细名称" prop="detailsName">
  124. <el-input v-model="form.detailsName" placeholder="请输入明细名称" />
  125. </el-form-item>
  126. <el-form-item label="交易金额" prop="detailsPrice">
  127. <el-input v-model="form.detailsPrice" placeholder="请输入交易金额" />
  128. </el-form-item>
  129. <el-form-item label="伴宠师ID" prop="usersId">
  130. <el-input v-model="form.usersId" placeholder="请输入伴宠师ID" />
  131. </el-form-item>
  132. <el-form-item label="备注" prop="remark">
  133. <el-input v-model="form.remark" placeholder="请输入备注" />
  134. </el-form-item>
  135. <el-form-item label="删除标志" prop="delFlag">
  136. <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
  137. </el-form-item>
  138. </el-form>
  139. <div slot="footer" class="dialog-footer">
  140. <el-button type="primary" @click="submitForm"> </el-button>
  141. <el-button @click="cancel"> </el-button>
  142. </div>
  143. </el-dialog>
  144. </div>
  145. </template>
  146. <script>
  147. import { listAppDeposit, getAppDeposit, delAppDeposit, addAppDeposit, updateAppDeposit, exportAppDeposit } from "@/api/model/AppDeposit";
  148. export default {
  149. name: "AppDeposit",
  150. data() {
  151. return {
  152. // 遮罩层
  153. loading: true,
  154. // 导出遮罩层
  155. exportLoading: false,
  156. // 选中数组
  157. ids: [],
  158. // 非单个禁用
  159. single: true,
  160. // 非多个禁用
  161. multiple: true,
  162. // 显示搜索条件
  163. showSearch: true,
  164. // 总条数
  165. total: 0,
  166. // 保证金记录表格数据
  167. AppDepositList: [],
  168. // 弹出层标题
  169. title: "",
  170. // 是否显示弹出层
  171. open: false,
  172. // 查询参数
  173. queryParams: {
  174. pageNum: 1,
  175. pageSize: 10,
  176. detailsName: null,
  177. detailsPrice: null,
  178. transactionType: null,
  179. usersId: null,
  180. },
  181. // 表单参数
  182. form: {},
  183. // 表单校验
  184. rules: {
  185. },
  186. columns: [
  187. { key: 1, label: "明细名称", visible: true },
  188. { key: 2, label: "交易金额", visible: true },
  189. { key: 3, label: "交易类型: 1为收入明细,2为支出明细", visible: true },
  190. { key: 4, label: "伴宠师ID", visible: true },
  191. { key: 5, label: "备注", visible: true },
  192. ],
  193. };
  194. },
  195. created() {
  196. this.getList();
  197. },
  198. methods: {
  199. /** 查询保证金记录列表 */
  200. getList() {
  201. this.loading = true;
  202. listAppDeposit(this.queryParams).then(response => {
  203. this.AppDepositList = response.rows;
  204. this.total = response.total;
  205. this.loading = false;
  206. });
  207. },
  208. // 取消按钮
  209. cancel() {
  210. this.open = false;
  211. this.reset();
  212. },
  213. // 表单重置
  214. reset() {
  215. this.form = {
  216. id: null,
  217. detailsName: null,
  218. detailsPrice: null,
  219. transactionType: null,
  220. usersId: null,
  221. remark: null,
  222. createTime: null,
  223. createBy: null,
  224. updateTime: null,
  225. updateBy: null,
  226. delFlag: null,
  227. };
  228. this.resetForm("form");
  229. },
  230. /** 搜索按钮操作 */
  231. handleQuery() {
  232. this.queryParams.pageNum = 1;
  233. this.getList();
  234. },
  235. /** 重置按钮操作 */
  236. resetQuery() {
  237. this.resetForm("queryForm");
  238. this.handleQuery();
  239. },
  240. // 多选框选中数据
  241. handleSelectionChange(selection) {
  242. this.ids = selection.map(item => item.id)
  243. this.single = selection.length!==1
  244. this.multiple = !selection.length
  245. },
  246. /** 新增按钮操作 */
  247. handleAdd() {
  248. this.reset();
  249. this.open = true;
  250. this.title = "添加保证金记录";
  251. },
  252. /** 修改按钮操作 */
  253. handleUpdate(row) {
  254. this.reset();
  255. const id = row.id || this.ids
  256. getAppDeposit(id).then(response => {
  257. this.form = response.data;
  258. this.open = true;
  259. this.title = "修改保证金记录";
  260. });
  261. },
  262. /** 提交按钮 */
  263. submitForm() {
  264. this.$refs["form"].validate(valid => {
  265. if (valid) {
  266. if (this.form.id != null) {
  267. updateAppDeposit(this.form).then(response => {
  268. this.$modal.msgSuccess("修改成功");
  269. this.open = false;
  270. this.getList();
  271. });
  272. } else {
  273. addAppDeposit(this.form).then(response => {
  274. this.$modal.msgSuccess("新增成功");
  275. this.open = false;
  276. this.getList();
  277. });
  278. }
  279. }
  280. });
  281. },
  282. /** 删除按钮操作 */
  283. handleDelete(row) {
  284. const ids = row.id || this.ids;
  285. this.$modal.confirm('是否确认删除保证金记录编号为"' + ids + '"的数据项?').then(function() {
  286. return delAppDeposit(ids);
  287. }).then(() => {
  288. this.getList();
  289. this.$modal.msgSuccess("删除成功");
  290. }).catch(() => {});
  291. },
  292. /** 导出按钮操作 */
  293. handleExport() {
  294. const queryParams = this.queryParams;
  295. this.$modal.confirm('是否确认导出所有保证金记录数据项?').then(() => {
  296. this.exportLoading = true;
  297. return exportAppDeposit(queryParams);
  298. }).then(response => {
  299. this.download(response.msg);
  300. this.exportLoading = false;
  301. }).catch(() => {});
  302. }
  303. }
  304. };
  305. </script>