index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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="afterSalesId">
  5. <el-input
  6. v-model="queryParams.afterSalesId"
  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="goodsId">
  14. <el-input
  15. v-model="queryParams.goodsId"
  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="productId">
  23. <el-input
  24. v-model="queryParams.productId"
  25. placeholder="请输入商品id"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="逻辑删除" prop="isDel">
  32. <el-input
  33. v-model="queryParams.isDel"
  34. placeholder="请输入逻辑删除"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="逻辑删除" prop="productAttrValueId">
  41. <el-input
  42. v-model="queryParams.productAttrValueId"
  43. placeholder="请输入逻辑删除"
  44. clearable
  45. size="small"
  46. @keyup.enter.native="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  51. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <el-row :gutter="10" class="mb8">
  55. <el-col :span="1.5">
  56. <el-button
  57. type="primary"
  58. plain
  59. icon="el-icon-plus"
  60. size="mini"
  61. @click="handleAdd"
  62. v-hasPermi="['live:liveAfterSalesItem:add']"
  63. >新增</el-button>
  64. </el-col>
  65. <el-col :span="1.5">
  66. <el-button
  67. type="success"
  68. plain
  69. icon="el-icon-edit"
  70. size="mini"
  71. :disabled="single"
  72. @click="handleUpdate"
  73. v-hasPermi="['live:liveAfterSalesItem:edit']"
  74. >修改</el-button>
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="danger"
  79. plain
  80. icon="el-icon-delete"
  81. size="mini"
  82. :disabled="multiple"
  83. @click="handleDelete"
  84. v-hasPermi="['live:liveAfterSalesItem:remove']"
  85. >删除</el-button>
  86. </el-col>
  87. <el-col :span="1.5">
  88. <el-button
  89. type="warning"
  90. plain
  91. icon="el-icon-download"
  92. size="mini"
  93. :loading="exportLoading"
  94. @click="handleExport"
  95. v-hasPermi="['live:liveAfterSalesItem:export']"
  96. >导出</el-button>
  97. </el-col>
  98. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  99. </el-row>
  100. <el-table border v-loading="loading" :data="liveAfterSalesItemList" @selection-change="handleSelectionChange">
  101. <el-table-column type="selection" width="55" align="center" />
  102. <el-table-column label="主键id" align="center" prop="id" />
  103. <el-table-column label="售后id" align="center" prop="afterSalesId" />
  104. <el-table-column label="直播商品ID" align="center" prop="goodsId" />
  105. <el-table-column label="商品id" align="center" prop="productId" />
  106. <el-table-column label="退货东西的详情信息" align="center" prop="jsonInfo" />
  107. <el-table-column label="逻辑删除" align="center" prop="isDel" />
  108. <el-table-column label="逻辑删除" align="center" prop="productAttrValueId" />
  109. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  110. <template slot-scope="scope">
  111. <el-button
  112. size="mini"
  113. type="text"
  114. icon="el-icon-edit"
  115. @click="handleUpdate(scope.row)"
  116. v-hasPermi="['live:liveAfterSalesItem:edit']"
  117. >修改</el-button>
  118. <el-button
  119. size="mini"
  120. type="text"
  121. icon="el-icon-delete"
  122. @click="handleDelete(scope.row)"
  123. v-hasPermi="['live:liveAfterSalesItem:remove']"
  124. >删除</el-button>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <pagination
  129. v-show="total>0"
  130. :total="total"
  131. :page.sync="queryParams.pageNum"
  132. :limit.sync="queryParams.pageSize"
  133. @pagination="getList"
  134. />
  135. <!-- 添加或修改售后子对话框 -->
  136. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  137. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  138. <el-form-item label="售后id" prop="afterSalesId">
  139. <el-input v-model="form.afterSalesId" placeholder="请输入售后id" />
  140. </el-form-item>
  141. <el-form-item label="直播商品ID" prop="goodsId">
  142. <el-input v-model="form.goodsId" placeholder="请输入直播商品ID" />
  143. </el-form-item>
  144. <el-form-item label="商品id" prop="productId">
  145. <el-input v-model="form.productId" placeholder="请输入商品id" />
  146. </el-form-item>
  147. <el-form-item label="退货东西的详情信息" prop="jsonInfo">
  148. <el-input v-model="form.jsonInfo" type="textarea" placeholder="请输入内容" />
  149. </el-form-item>
  150. <el-form-item label="逻辑删除" prop="isDel">
  151. <el-input v-model="form.isDel" placeholder="请输入逻辑删除" />
  152. </el-form-item>
  153. <el-form-item label="逻辑删除" prop="productAttrValueId">
  154. <el-input v-model="form.productAttrValueId" placeholder="请输入逻辑删除" />
  155. </el-form-item>
  156. </el-form>
  157. <div slot="footer" class="dialog-footer">
  158. <el-button type="primary" @click="submitForm">确 定</el-button>
  159. <el-button @click="cancel">取 消</el-button>
  160. </div>
  161. </el-dialog>
  162. </div>
  163. </template>
  164. <script>
  165. import { listLiveAfterSalesItem, getLiveAfterSalesItem, delLiveAfterSalesItem, addLiveAfterSalesItem, updateLiveAfterSalesItem, exportLiveAfterSalesItem } from "@/api/live/liveAfterSalesItem";
  166. export default {
  167. name: "LiveAfterSalesItem",
  168. data() {
  169. return {
  170. // 遮罩层
  171. loading: true,
  172. // 导出遮罩层
  173. exportLoading: false,
  174. // 选中数组
  175. ids: [],
  176. // 非单个禁用
  177. single: true,
  178. // 非多个禁用
  179. multiple: true,
  180. // 显示搜索条件
  181. showSearch: true,
  182. // 总条数
  183. total: 0,
  184. // 售后子表格数据
  185. liveAfterSalesItemList: [],
  186. // 弹出层标题
  187. title: "",
  188. // 是否显示弹出层
  189. open: false,
  190. // 查询参数
  191. queryParams: {
  192. pageNum: 1,
  193. pageSize: 10,
  194. afterSalesId: null,
  195. goodsId: null,
  196. productId: null,
  197. jsonInfo: null,
  198. isDel: null,
  199. productAttrValueId: null
  200. },
  201. // 表单参数
  202. form: {},
  203. // 表单校验
  204. rules: {
  205. jsonInfo: [
  206. { required: true, message: "退货东西的详情信息不能为空", trigger: "blur" }
  207. ],
  208. }
  209. };
  210. },
  211. created() {
  212. this.getList();
  213. },
  214. methods: {
  215. /** 查询售后子列表 */
  216. getList() {
  217. this.loading = true;
  218. listLiveAfterSalesItem(this.queryParams).then(response => {
  219. this.liveAfterSalesItemList = response.rows;
  220. this.total = response.total;
  221. this.loading = false;
  222. });
  223. },
  224. // 取消按钮
  225. cancel() {
  226. this.open = false;
  227. this.reset();
  228. },
  229. // 表单重置
  230. reset() {
  231. this.form = {
  232. id: null,
  233. afterSalesId: null,
  234. goodsId: null,
  235. productId: null,
  236. jsonInfo: null,
  237. isDel: null,
  238. productAttrValueId: null
  239. };
  240. this.resetForm("form");
  241. },
  242. /** 搜索按钮操作 */
  243. handleQuery() {
  244. this.queryParams.pageNum = 1;
  245. this.getList();
  246. },
  247. /** 重置按钮操作 */
  248. resetQuery() {
  249. this.resetForm("queryForm");
  250. this.handleQuery();
  251. },
  252. // 多选框选中数据
  253. handleSelectionChange(selection) {
  254. this.ids = selection.map(item => item.id)
  255. this.single = selection.length!==1
  256. this.multiple = !selection.length
  257. },
  258. /** 新增按钮操作 */
  259. handleAdd() {
  260. this.reset();
  261. this.open = true;
  262. this.title = "添加售后子";
  263. },
  264. /** 修改按钮操作 */
  265. handleUpdate(row) {
  266. this.reset();
  267. const id = row.id || this.ids
  268. getLiveAfterSalesItem(id).then(response => {
  269. this.form = response.data;
  270. this.open = true;
  271. this.title = "修改售后子";
  272. });
  273. },
  274. /** 提交按钮 */
  275. submitForm() {
  276. this.$refs["form"].validate(valid => {
  277. if (valid) {
  278. if (this.form.id != null) {
  279. updateLiveAfterSalesItem(this.form).then(response => {
  280. this.msgSuccess("修改成功");
  281. this.open = false;
  282. this.getList();
  283. });
  284. } else {
  285. addLiveAfterSalesItem(this.form).then(response => {
  286. this.msgSuccess("新增成功");
  287. this.open = false;
  288. this.getList();
  289. });
  290. }
  291. }
  292. });
  293. },
  294. /** 删除按钮操作 */
  295. handleDelete(row) {
  296. const ids = row.id || this.ids;
  297. this.$confirm('是否确认删除售后子编号为"' + ids + '"的数据项?', "警告", {
  298. confirmButtonText: "确定",
  299. cancelButtonText: "取消",
  300. type: "warning"
  301. }).then(function() {
  302. return delLiveAfterSalesItem(ids);
  303. }).then(() => {
  304. this.getList();
  305. this.msgSuccess("删除成功");
  306. }).catch(() => {});
  307. },
  308. /** 导出按钮操作 */
  309. handleExport() {
  310. const queryParams = this.queryParams;
  311. this.$confirm('是否确认导出所有售后子数据项?', "警告", {
  312. confirmButtonText: "确定",
  313. cancelButtonText: "取消",
  314. type: "warning"
  315. }).then(() => {
  316. this.exportLoading = true;
  317. return exportLiveAfterSalesItem(queryParams);
  318. }).then(response => {
  319. this.download(response.msg);
  320. this.exportLoading = false;
  321. }).catch(() => {});
  322. }
  323. }
  324. };
  325. </script>