商户
This commit is contained in:
parent
c05c65a4e2
commit
6359692ea0
@ -0,0 +1,131 @@
|
||||
package com.ruoyi.winery.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.itextpdf.styledxmlparser.jsoup.nodes.Document;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.winery.utils.RichTextUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.ruoyi.winery.service.IAppMerchantService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商户Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/winery/merchant" )
|
||||
public class AppMerchantController extends BaseController {
|
||||
|
||||
private final IAppMerchantService iAppMerchantService;
|
||||
|
||||
/**
|
||||
* 查询商户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppMerchant appMerchant)
|
||||
{
|
||||
startPage();
|
||||
LambdaQueryWrapper<AppMerchant> lqw = Wrappers.lambdaQuery(appMerchant);
|
||||
if (StringUtils.isNotBlank(appMerchant.getName())){
|
||||
lqw.like(AppMerchant::getName ,appMerchant.getName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appMerchant.getSubtitle())){
|
||||
lqw.eq(AppMerchant::getSubtitle ,appMerchant.getSubtitle());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appMerchant.getAvatar())){
|
||||
lqw.eq(AppMerchant::getAvatar ,appMerchant.getAvatar());
|
||||
}
|
||||
if (StringUtils.isNotBlank(appMerchant.getDesc())){
|
||||
lqw.eq(AppMerchant::getDesc ,appMerchant.getDesc());
|
||||
}
|
||||
List<AppMerchant> list = iAppMerchantService.list(lqw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:export')" )
|
||||
@Log(title = "商户" , businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export" )
|
||||
public AjaxResult export(AppMerchant appMerchant) {
|
||||
LambdaQueryWrapper<AppMerchant> lqw = new LambdaQueryWrapper<AppMerchant>(appMerchant);
|
||||
List<AppMerchant> list = iAppMerchantService.list(lqw);
|
||||
ExcelUtil<AppMerchant> util = new ExcelUtil<AppMerchant>(AppMerchant. class);
|
||||
return util.exportExcel(list, "merchant" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:query')" )
|
||||
@GetMapping(value = "/{id}" )
|
||||
public AjaxResult getInfo(@PathVariable("id" ) String id) {
|
||||
return AjaxResult.success(iAppMerchantService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:add')" )
|
||||
@Log(title = "商户" , businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppMerchant appMerchant) {
|
||||
String richText = appMerchant.getDesc();
|
||||
if (richText != null && StringUtils.isNotEmpty(richText)) {
|
||||
Document doc = RichTextUtil.setImgStyle(richText, "width: 100%");
|
||||
appMerchant.setDesc(doc.body().children().toString());
|
||||
}
|
||||
return toAjax(iAppMerchantService.save(appMerchant) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:edit')" )
|
||||
@Log(title = "商户" , businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppMerchant appMerchant) {
|
||||
String richText = appMerchant.getDesc();
|
||||
if (richText != null && StringUtils.isNotEmpty(richText)) {
|
||||
Document doc = RichTextUtil.setImgStyle(richText, "width: 100%");
|
||||
appMerchant.setDesc(doc.body().children().toString());
|
||||
}
|
||||
return toAjax(iAppMerchantService.updateById(appMerchant) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('winery:merchant:remove')" )
|
||||
@Log(title = "商户" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}" )
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(iAppMerchantService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.ruoyi.winery.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商户对象 app_merchant
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_merchant")
|
||||
public class AppMerchant implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/** 商户名称 */
|
||||
@Excel(name = "商户名称")
|
||||
private String name;
|
||||
|
||||
/** 副标题 */
|
||||
@Excel(name = "副标题")
|
||||
private String subtitle;
|
||||
|
||||
/** 图标 */
|
||||
@Excel(name = "图标")
|
||||
private String avatar;
|
||||
|
||||
/** 介绍 */
|
||||
@Excel(name = "介绍")
|
||||
private String desc;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.mapper;
|
||||
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 商户Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
public interface AppMerchantMapper extends BaseMapper<AppMerchant> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.winery.service;
|
||||
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 商户Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
public interface IAppMerchantService extends IService<AppMerchant> {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.winery.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.winery.mapper.AppMerchantMapper;
|
||||
import com.ruoyi.winery.domain.AppMerchant;
|
||||
import com.ruoyi.winery.service.IAppMerchantService;
|
||||
|
||||
/**
|
||||
* 商户Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-19
|
||||
*/
|
||||
@Service
|
||||
public class AppMerchantServiceImpl extends ServiceImpl<AppMerchantMapper, AppMerchant> implements IAppMerchantService {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.winery.mapper.AppMerchantMapper">
|
||||
|
||||
<resultMap type="AppMerchant" id="AppMerchantResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="subtitle" column="subtitle" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="desc" column="desc" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
53
ruoyi-ui/src/api/winery/merchant.js
Normal file
53
ruoyi-ui/src/api/winery/merchant.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询商户列表
|
||||
export function listMerchant(query) {
|
||||
return request({
|
||||
url: '/winery/merchant/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询商户详细
|
||||
export function getMerchant(id) {
|
||||
return request({
|
||||
url: '/winery/merchant/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增商户
|
||||
export function addMerchant(data) {
|
||||
return request({
|
||||
url: '/winery/merchant',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改商户
|
||||
export function updateMerchant(data) {
|
||||
return request({
|
||||
url: '/winery/merchant',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商户
|
||||
export function delMerchant(id) {
|
||||
return request({
|
||||
url: '/winery/merchant/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出商户
|
||||
export function exportMerchant(query) {
|
||||
return request({
|
||||
url: '/winery/merchant/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -46,14 +46,8 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="明细状态:
|
||||
5.退款申请
|
||||
6.退款中
|
||||
7.退款成功" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择明细状态:
|
||||
5.退款申请
|
||||
6.退款中
|
||||
7.退款成功" clearable size="small">
|
||||
<el-form-item label="明细状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择明细状态" clearable size="small">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -130,10 +124,7 @@
|
||||
<el-table-column label="订单ID" align="center" prop="orderId" />
|
||||
<el-table-column label="商品ID" align="center" prop="goodsId" />
|
||||
<el-table-column label="商品数量" align="center" prop="goodsCount" />
|
||||
<el-table-column label="明细状态:
|
||||
5.退款申请
|
||||
6.退款中
|
||||
7.退款成功" align="center" prop="status" />
|
||||
<el-table-column label="明细状态" align="center" prop="status" />
|
||||
<el-table-column label="统一退单号" align="center" prop="refundNo" />
|
||||
<el-table-column label="退款时间" align="center" prop="refundTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
@ -159,7 +150,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
@ -186,10 +177,7 @@
|
||||
<el-form-item label="商品数量" prop="goodsCount">
|
||||
<el-input v-model="form.goodsCount" placeholder="请输入商品数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="明细状态:
|
||||
5.退款申请
|
||||
6.退款中
|
||||
7.退款成功">
|
||||
<el-form-item label="明细状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
@ -268,10 +256,7 @@ export default {
|
||||
{ required: true, message: "商品ID不能为空", trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "明细状态:
|
||||
5.退款申请
|
||||
6.退款中
|
||||
7.退款成功不能为空", trigger: "blur" }
|
||||
{ required: true, message: "明细状态不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
|
302
ruoyi-ui/src/views/winery/merchant/index.vue
Normal file
302
ruoyi-ui/src/views/winery/merchant/index.vue
Normal file
@ -0,0 +1,302 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="商户名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入商户名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="副标题" prop="subtitle">
|
||||
<el-input
|
||||
v-model="queryParams.subtitle"
|
||||
placeholder="请输入副标题"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="图标" prop="avatar">
|
||||
<el-input
|
||||
v-model="queryParams.avatar"
|
||||
placeholder="请输入图标"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" prop="desc">
|
||||
<el-input
|
||||
v-model="queryParams.desc"
|
||||
placeholder="请输入介绍"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['winery:merchant:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['winery:merchant:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['winery:merchant:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['winery:merchant:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="merchantList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="ID" align="center" prop="id" v-if="false"/>
|
||||
<el-table-column label="商户名称" align="center" prop="name" />
|
||||
<el-table-column label="副标题" align="center" prop="subtitle" />
|
||||
<el-table-column label="图标" align="center" prop="avatar" />
|
||||
<el-table-column label="介绍" align="center" prop="desc" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['winery:merchant:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['winery:merchant:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商户对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="商户名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入商户名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="副标题" prop="subtitle">
|
||||
<el-input v-model="form.subtitle" placeholder="请输入副标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图标" prop="avatar">
|
||||
<el-input v-model="form.avatar" placeholder="请输入图标" />
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" prop="desc">
|
||||
<el-input v-model="form.desc" placeholder="请输入介绍" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMerchant, getMerchant, delMerchant, addMerchant, updateMerchant, exportMerchant } from "@/api/winery/merchant";
|
||||
|
||||
export default {
|
||||
name: "Merchant",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商户表格数据
|
||||
merchantList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
subtitle: undefined,
|
||||
avatar: undefined,
|
||||
desc: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询商户列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMerchant(this.queryParams).then(response => {
|
||||
this.merchantList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
subtitle: undefined,
|
||||
avatar: undefined,
|
||||
desc: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商户";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getMerchant(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商户";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateMerchant(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addMerchant(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除商户编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delMerchant(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有商户数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return exportMerchant(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user