完成提成界面
This commit is contained in:
		
							
								
								
									
										5
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "dayjs": "^1.9.1"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,11 @@
 | 
			
		||||
package com.ruoyi.web.controller.custom;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.framework.web.domain.server.Sys;
 | 
			
		||||
import com.ruoyi.system.domain.CusSalesman;
 | 
			
		||||
import com.ruoyi.system.service.ISysUserService;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
@@ -22,24 +27,25 @@ import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 业务提成比例Controller
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author wonder
 | 
			
		||||
 * @date 2020-09-24
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/custom/commision")
 | 
			
		||||
public class SysCommisionController extends BaseController
 | 
			
		||||
{
 | 
			
		||||
public class SysCommisionController extends BaseController {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ISysCommisionService sysCommisionService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ISysUserService userService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询业务提成比例列表
 | 
			
		||||
     */
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('custom:commision:list')")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('commision:config:list')")
 | 
			
		||||
    @GetMapping("/list")
 | 
			
		||||
    public TableDataInfo list(SysCommision sysCommision)
 | 
			
		||||
    {
 | 
			
		||||
    public TableDataInfo list(SysCommision sysCommision) {
 | 
			
		||||
        startPage();
 | 
			
		||||
        List<SysCommision> list = sysCommisionService.selectSysCommisionList(sysCommision);
 | 
			
		||||
        return getDataTable(list);
 | 
			
		||||
@@ -48,11 +54,10 @@ public class SysCommisionController extends BaseController
 | 
			
		||||
    /**
 | 
			
		||||
     * 导出业务提成比例列表
 | 
			
		||||
     */
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('custom:commision:export')")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('commision:config:export')")
 | 
			
		||||
    @Log(title = "业务提成比例", businessType = BusinessType.EXPORT)
 | 
			
		||||
    @GetMapping("/export")
 | 
			
		||||
    public AjaxResult export(SysCommision sysCommision)
 | 
			
		||||
    {
 | 
			
		||||
    public AjaxResult export(SysCommision sysCommision) {
 | 
			
		||||
        List<SysCommision> list = sysCommisionService.selectSysCommisionList(sysCommision);
 | 
			
		||||
        ExcelUtil<SysCommision> util = new ExcelUtil<SysCommision>(SysCommision.class);
 | 
			
		||||
        return util.exportExcel(list, "commision");
 | 
			
		||||
@@ -61,43 +66,86 @@ public class SysCommisionController extends BaseController
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取业务提成比例详细信息
 | 
			
		||||
     */
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('custom:commision:query')")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('commision:config:query')")
 | 
			
		||||
    @GetMapping(value = "/{ruleId}")
 | 
			
		||||
    public AjaxResult getInfo(@PathVariable("ruleId") Long ruleId)
 | 
			
		||||
    {
 | 
			
		||||
    public AjaxResult getInfo(@PathVariable("ruleId") Long ruleId) {
 | 
			
		||||
        return AjaxResult.success(sysCommisionService.selectSysCommisionById(ruleId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增业务提成比例
 | 
			
		||||
     */
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('custom:commision:add')")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('commision:config:add')")
 | 
			
		||||
    @Log(title = "业务提成比例", businessType = BusinessType.INSERT)
 | 
			
		||||
    @PostMapping
 | 
			
		||||
    public AjaxResult add(@RequestBody SysCommision sysCommision)
 | 
			
		||||
    {
 | 
			
		||||
    public AjaxResult add(@RequestBody SysCommision sysCommision) {
 | 
			
		||||
        return toAjax(sysCommisionService.insertSysCommision(sysCommision));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改业务提成比例
 | 
			
		||||
     */
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('custom:commision:edit')")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('commision:config:edit')")
 | 
			
		||||
    @Log(title = "业务提成比例", businessType = BusinessType.UPDATE)
 | 
			
		||||
    @PutMapping
 | 
			
		||||
    public AjaxResult edit(@RequestBody SysCommision sysCommision)
 | 
			
		||||
    {
 | 
			
		||||
    public AjaxResult edit(@RequestBody SysCommision sysCommision) {
 | 
			
		||||
        return toAjax(sysCommisionService.updateSysCommision(sysCommision));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除业务提成比例
 | 
			
		||||
     */
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('custom:commision:remove')")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('commision:config:remove')")
 | 
			
		||||
    @Log(title = "业务提成比例", businessType = BusinessType.DELETE)
 | 
			
		||||
	@DeleteMapping("/{ruleIds}")
 | 
			
		||||
    public AjaxResult remove(@PathVariable Long[] ruleIds)
 | 
			
		||||
    {
 | 
			
		||||
    @DeleteMapping("/{ruleIds}")
 | 
			
		||||
    public AjaxResult remove(@PathVariable Long[] ruleIds) {
 | 
			
		||||
        return toAjax(sysCommisionService.deleteSysCommisionByIds(ruleIds));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/salesman")
 | 
			
		||||
    public AjaxResult getSalesman() {
 | 
			
		||||
        AjaxResult ajax = AjaxResult.success();
 | 
			
		||||
        List<CusSalesman> list = userService.selectSalesman();
 | 
			
		||||
        ajax.put(AjaxResult.DATA_TAG, list);
 | 
			
		||||
        return ajax;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('commision:detail:list')")
 | 
			
		||||
    @GetMapping("/detail")
 | 
			
		||||
    public TableDataInfo getDetail(SysCommision sysCommision) {
 | 
			
		||||
        startPage();
 | 
			
		||||
        List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision);
 | 
			
		||||
        for (SysCommision detail : list) {
 | 
			
		||||
            SysCommision tmpQueryCom = new SysCommision();
 | 
			
		||||
            tmpQueryCom.setUserId(detail.getUserId());
 | 
			
		||||
            List<SysCommision> tmpComList = sysCommisionService.selectSysCommisionList(tmpQueryCom);
 | 
			
		||||
 | 
			
		||||
            boolean comHit = false;
 | 
			
		||||
            for (int i = 0; i < tmpComList.size(); i++) {
 | 
			
		||||
                SysCommision com = tmpComList.get(i);
 | 
			
		||||
                long dAmount = detail.getAmount().longValue();
 | 
			
		||||
                long cAmount = com.getAmount().longValue();
 | 
			
		||||
                if (dAmount < cAmount && i == 0) {
 | 
			
		||||
                    comHit = false;
 | 
			
		||||
                    break;
 | 
			
		||||
                } else if (i == tmpComList.size() - 1 && dAmount > cAmount) {
 | 
			
		||||
                    comHit = true;
 | 
			
		||||
                    detail.setRate(com.getRate());
 | 
			
		||||
                    break;
 | 
			
		||||
                } else if (dAmount >= cAmount && dAmount < tmpComList.get(i + 1).getAmount().longValue()) {
 | 
			
		||||
                    comHit = true;
 | 
			
		||||
                    detail.setRate(com.getRate());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (!comHit) {
 | 
			
		||||
                detail.setRate(0L);
 | 
			
		||||
                detail.setCommision(BigDecimal.ZERO);
 | 
			
		||||
            } else {
 | 
			
		||||
                long amount = detail.getAmount().longValue();
 | 
			
		||||
                amount = amount * detail.getRate() / 100;
 | 
			
		||||
                detail.setCommision(new BigDecimal(amount));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return getDataTable(list);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,16 @@ public class CusUserPost implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private String postId;
 | 
			
		||||
 | 
			
		||||
    private String postName;
 | 
			
		||||
 | 
			
		||||
    public void setPostName(String postName) {
 | 
			
		||||
        this.postName = postName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getPostName() {
 | 
			
		||||
        return postName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getPostCode() {
 | 
			
		||||
        return postCode;
 | 
			
		||||
    }
 | 
			
		||||
@@ -55,6 +65,7 @@ public class CusUserPost implements Serializable {
 | 
			
		||||
                ", userName='" + userName + '\'' +
 | 
			
		||||
                ", postCode='" + postCode + '\'' +
 | 
			
		||||
                ", postid='" + postId + '\'' +
 | 
			
		||||
                ", postName='" + postName + '\'' +
 | 
			
		||||
                '}';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,88 +9,135 @@ import java.math.BigDecimal;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 业务提成比例对象 sys_commision
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author wonder
 | 
			
		||||
 * @date 2020-09-24
 | 
			
		||||
 */
 | 
			
		||||
public class SysCommision extends BaseEntity
 | 
			
		||||
{
 | 
			
		||||
public class SysCommision extends BaseEntity {
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /** 编号 */
 | 
			
		||||
    /**
 | 
			
		||||
     * 编号
 | 
			
		||||
     */
 | 
			
		||||
    private Long ruleId;
 | 
			
		||||
 | 
			
		||||
    /** 业务员 */
 | 
			
		||||
    /**
 | 
			
		||||
     * 业务员
 | 
			
		||||
     */
 | 
			
		||||
    private Long userId;
 | 
			
		||||
 | 
			
		||||
    /** 业务员 */
 | 
			
		||||
    @Excel(name = "业务员")
 | 
			
		||||
    private String nickName;
 | 
			
		||||
    /**
 | 
			
		||||
     * 职位id
 | 
			
		||||
     */
 | 
			
		||||
    private Long postId;
 | 
			
		||||
 | 
			
		||||
    /** 金额 */
 | 
			
		||||
    /**
 | 
			
		||||
     * 业务员
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "业务员")
 | 
			
		||||
    private String userName;
 | 
			
		||||
 | 
			
		||||
    @Excel(name = "职位")
 | 
			
		||||
    private String postName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 金额
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "金额")
 | 
			
		||||
    private BigDecimal amount;
 | 
			
		||||
 | 
			
		||||
    /** 分成比例 */
 | 
			
		||||
    @Excel(name = "分成比例")
 | 
			
		||||
    /**
 | 
			
		||||
     * 分成比例
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "比例", suffix = "%")
 | 
			
		||||
    private Long rate;
 | 
			
		||||
 | 
			
		||||
    public void setRuleId(Long ruleId) 
 | 
			
		||||
    {
 | 
			
		||||
    /**
 | 
			
		||||
     * 提成
 | 
			
		||||
     */
 | 
			
		||||
    @Excel(name = "提成")
 | 
			
		||||
    private BigDecimal commision;
 | 
			
		||||
 | 
			
		||||
    public BigDecimal getCommision() {
 | 
			
		||||
        return commision;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCommision(BigDecimal commision) {
 | 
			
		||||
        this.commision = commision;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Long getPostId() {
 | 
			
		||||
        return postId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPostId(Long postId) {
 | 
			
		||||
        this.postId = postId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPostName(String postName) {
 | 
			
		||||
        this.postName = postName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getPostName() {
 | 
			
		||||
        return postName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRuleId(Long ruleId) {
 | 
			
		||||
        this.ruleId = ruleId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Long getRuleId() 
 | 
			
		||||
    {
 | 
			
		||||
    public Long getRuleId() {
 | 
			
		||||
        return ruleId;
 | 
			
		||||
    }
 | 
			
		||||
    public void setUserId(Long userId) 
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    public void setUserId(Long userId) {
 | 
			
		||||
        this.userId = userId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Long getUserId() 
 | 
			
		||||
    {
 | 
			
		||||
    public Long getUserId() {
 | 
			
		||||
        return userId;
 | 
			
		||||
    }
 | 
			
		||||
    public void setNickName(String nickName) 
 | 
			
		||||
    {
 | 
			
		||||
        this.nickName = nickName;
 | 
			
		||||
 | 
			
		||||
    public void setUserName(String userName) {
 | 
			
		||||
        this.userName = userName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getNickName() 
 | 
			
		||||
    {
 | 
			
		||||
        return nickName;
 | 
			
		||||
    public String getUserName() {
 | 
			
		||||
        return userName;
 | 
			
		||||
    }
 | 
			
		||||
    public void setAmount(BigDecimal amount) { this.amount = amount; }
 | 
			
		||||
 | 
			
		||||
    public BigDecimal getAmount()
 | 
			
		||||
    {
 | 
			
		||||
    public void setAmount(BigDecimal amount) {
 | 
			
		||||
        this.amount = amount;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public BigDecimal getAmount() {
 | 
			
		||||
        return amount;
 | 
			
		||||
    }
 | 
			
		||||
    public void setRate(Long rate) 
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    public void setRate(Long rate) {
 | 
			
		||||
        this.rate = rate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Long getRate() 
 | 
			
		||||
    {
 | 
			
		||||
    public Long getRate() {
 | 
			
		||||
        return rate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString() {
 | 
			
		||||
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
 | 
			
		||||
            .append("ruleId", getRuleId())
 | 
			
		||||
            .append("userId", getUserId())
 | 
			
		||||
            .append("nickName", getNickName())
 | 
			
		||||
            .append("amount", getAmount())
 | 
			
		||||
            .append("rate", getRate())
 | 
			
		||||
            .append("createBy", getCreateBy())
 | 
			
		||||
            .append("createTime", getCreateTime())
 | 
			
		||||
            .append("updateBy", getUpdateBy())
 | 
			
		||||
            .append("updateTime", getUpdateTime())
 | 
			
		||||
            .append("remark", getRemark())
 | 
			
		||||
            .toString();
 | 
			
		||||
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
 | 
			
		||||
                .append("ruleId", getRuleId())
 | 
			
		||||
                .append("userId", getUserId())
 | 
			
		||||
                .append("userName", getUserName())
 | 
			
		||||
                .append("postId", getPostId())
 | 
			
		||||
                .append("postName", getPostName())
 | 
			
		||||
                .append("amount", getAmount())
 | 
			
		||||
                .append("commision", getCommision())
 | 
			
		||||
                .append("rate", getRate())
 | 
			
		||||
                .append("createBy", getCreateBy())
 | 
			
		||||
                .append("createTime", getCreateTime())
 | 
			
		||||
                .append("updateBy", getUpdateBy())
 | 
			
		||||
                .append("updateTime", getUpdateTime())
 | 
			
		||||
                .append("remark", getRemark())
 | 
			
		||||
                .toString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -58,4 +58,6 @@ public interface SysCommisionMapper
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int deleteSysCommisionByIds(Long[] ruleIds);
 | 
			
		||||
 | 
			
		||||
    public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -58,4 +58,6 @@ public interface ISysCommisionService
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int deleteSysCommisionById(Long ruleId);
 | 
			
		||||
 | 
			
		||||
    public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -93,4 +93,9 @@ public class SysCommisionServiceImpl implements ISysCommisionService
 | 
			
		||||
    {
 | 
			
		||||
        return sysCommisionMapper.deleteSysCommisionById(ruleId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision) {
 | 
			
		||||
        return sysCommisionMapper.selectSysCommisionDetail(sysCommision);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,12 +9,13 @@
 | 
			
		||||
        <result property="userName" column="nick_name"/>
 | 
			
		||||
        <result property="postId" column="post_id"/>
 | 
			
		||||
        <result property="postCode" column="post_code"/>
 | 
			
		||||
        <result property="postName" column="post_name"/>
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <sql id="selectCusUserPostVo">
 | 
			
		||||
        SELECT u.user_id, u.nick_name, p.post_id, p.post_code
 | 
			
		||||
        SELECT u.user_id, u.nick_name, p.post_id, p.post_code, p.post_name
 | 
			
		||||
        FROM sys_user u, sys_post p, sys_user_post up
 | 
			
		||||
        WHERE up.user_id = u.user_id AND p.post_id = up.post_id
 | 
			
		||||
        WHERE up.user_id = u.user_id AND p.post_id = up.post_id AND p.post_id > 4
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
    <select id="selectAllCusUserPost" parameterType="CusUserPost" resultMap="CusUserPostResult">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,45 +1,108 @@
 | 
			
		||||
<?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">
 | 
			
		||||
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.ruoyi.custom.mapper.SysCommisionMapper">
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    <resultMap type="SysCommision" id="SysCommisionResult">
 | 
			
		||||
        <result property="ruleId"    column="rule_id"    />
 | 
			
		||||
        <result property="userId"    column="user_id"    />
 | 
			
		||||
        <result property="nickName"    column="nick_name"    />
 | 
			
		||||
        <result property="amount"    column="amount"    />
 | 
			
		||||
        <result property="rate"    column="rate"    />
 | 
			
		||||
        <result property="createBy"    column="create_by"    />
 | 
			
		||||
        <result property="createTime"    column="create_time"    />
 | 
			
		||||
        <result property="updateBy"    column="update_by"    />
 | 
			
		||||
        <result property="updateTime"    column="update_time"    />
 | 
			
		||||
        <result property="remark"    column="remark"    />
 | 
			
		||||
        <result property="ruleId" column="rule_id"/>
 | 
			
		||||
        <result property="userId" column="user_id"/>
 | 
			
		||||
        <result property="postId" column="post_id"/>
 | 
			
		||||
        <result property="userName" column="user_name"/>
 | 
			
		||||
        <result property="postName" column="post_name"/>
 | 
			
		||||
        <result property="amount" column="amount"/>
 | 
			
		||||
        <result property="rate" column="rate"/>
 | 
			
		||||
        <result property="createBy" column="create_by"/>
 | 
			
		||||
        <result property="createTime" column="create_time"/>
 | 
			
		||||
        <result property="updateBy" column="update_by"/>
 | 
			
		||||
        <result property="updateTime" column="update_time"/>
 | 
			
		||||
        <result property="remark" column="remark"/>
 | 
			
		||||
        <result property="commision" column="commision"/>
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <sql id="selectSysCommisionVo">
 | 
			
		||||
        select rule_id, user_id, nick_name, amount, rate, create_by, create_time, update_by, update_time, remark from sys_commision
 | 
			
		||||
    <resultMap id="SysCommisionDetailResult" type="SysCommision">
 | 
			
		||||
        <result property="userId" column="user_id"/>
 | 
			
		||||
        <result property="userName" column="user_name"/>
 | 
			
		||||
        <result property="postId" column="post_id"/>
 | 
			
		||||
        <result property="postName" column="post_name"/>
 | 
			
		||||
        <result property="amount" column="amount"/>
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <sql id="groupAmountVo">
 | 
			
		||||
        SELECT ${column} AS user_id, SUM(amount) AS amount
 | 
			
		||||
        FROM sys_order
 | 
			
		||||
        WHERE ${column} IS NOT NULL
 | 
			
		||||
        <if test="beginTime != null and beginTime != ''"> AND date_format(order_time,'%y%m%d') >= date_format(${beginTime},'%y%m%d')</if>
 | 
			
		||||
        <if test="endTime != null and endTime != ''">AND date_format(order_time,'%y%m%d') <= date_format(${endTime},'%y%m%d')</if>
 | 
			
		||||
        GROUP BY ${column}
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
    <select id="selectSysCommisionDetail" parameterType="SysCommision" resultMap="SysCommisionResult">
 | 
			
		||||
        SELECT * FROM view_user_post pa
 | 
			
		||||
        JOIN (
 | 
			
		||||
            <include refid="groupAmountVo">
 | 
			
		||||
                <property name="column" value="pre_sale_id"/>
 | 
			
		||||
                <property name="beginTime" value="#{beginTime}"/>
 | 
			
		||||
                <property name="endTime" value="#{endTime}"/>
 | 
			
		||||
            </include>
 | 
			
		||||
            UNION
 | 
			
		||||
            <include refid="groupAmountVo">
 | 
			
		||||
                <property name="column" value="after_sale_id"/>
 | 
			
		||||
                <property name="beginTime" value="#{beginTime}"/>
 | 
			
		||||
                <property name="endTime" value="#{endTime}"/>
 | 
			
		||||
            </include>
 | 
			
		||||
            UNION
 | 
			
		||||
            <include refid="groupAmountVo">
 | 
			
		||||
                <property name="column" value="nutritionist_id"/>
 | 
			
		||||
                <property name="beginTime" value="#{beginTime}"/>
 | 
			
		||||
                <property name="endTime" value="#{endTime}"/>
 | 
			
		||||
            </include>
 | 
			
		||||
            UNION
 | 
			
		||||
            <include refid="groupAmountVo">
 | 
			
		||||
                <property name="column" value="nutri_assis_id"/>
 | 
			
		||||
                <property name="beginTime" value="#{beginTime}"/>
 | 
			
		||||
                <property name="endTime" value="#{endTime}"/>
 | 
			
		||||
            </include>
 | 
			
		||||
            UNION
 | 
			
		||||
            <include refid="groupAmountVo">
 | 
			
		||||
                <property name="column" value="operator_id"/>
 | 
			
		||||
                <property name="beginTime" value="#{beginTime}"/>
 | 
			
		||||
                <property name="endTime" value="#{endTime}"/>
 | 
			
		||||
            </include>
 | 
			
		||||
        ) AS a USING(user_id)
 | 
			
		||||
        <where>
 | 
			
		||||
            <if test="postId != null and postId != ''">and post_id = #{postId}</if>
 | 
			
		||||
            <if test="userId != null and userId != ''">and user_id = #{userId}</if>
 | 
			
		||||
        </where>
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <sql id="selectSysCommisionVo">
 | 
			
		||||
        SELECT * FROM (
 | 
			
		||||
            SELECT * FROM view_user_post AS pa
 | 
			
		||||
            JOIN (SELECT * FROM sys_commision WHERE rate > 0) AS c USING(user_id)
 | 
			
		||||
            ORDER BY user_id, amount
 | 
			
		||||
        ) as t
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <select id="selectSysCommisionList" parameterType="SysCommision" resultMap="SysCommisionResult">
 | 
			
		||||
        <include refid="selectSysCommisionVo"/>
 | 
			
		||||
        <where>  
 | 
			
		||||
            <if test="userId != null "> and user_id = #{userId}</if>
 | 
			
		||||
            <if test="amount != null "> and amount = #{amount}</if>
 | 
			
		||||
            <if test="rate != null "> and rate = #{rate}</if>
 | 
			
		||||
        <where>
 | 
			
		||||
            <if test="userId != null ">and user_id = #{userId}</if>
 | 
			
		||||
            <if test="postId != null ">and post_id = #{postId}</if>
 | 
			
		||||
        </where>
 | 
			
		||||
    </select>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    <select id="selectSysCommisionById" parameterType="Long" resultMap="SysCommisionResult">
 | 
			
		||||
        <include refid="selectSysCommisionVo"/>
 | 
			
		||||
        where rule_id = #{ruleId}
 | 
			
		||||
    </select>
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    <insert id="insertSysCommision" parameterType="SysCommision" useGeneratedKeys="true" keyProperty="ruleId">
 | 
			
		||||
        insert into sys_commision
 | 
			
		||||
        <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
			
		||||
            <if test="userId != null">user_id,</if>
 | 
			
		||||
            <if test="nickName != null">nick_name,</if>
 | 
			
		||||
            <if test="amount != null">amount,</if>
 | 
			
		||||
            <if test="rate != null">rate,</if>
 | 
			
		||||
            <if test="createBy != null">create_by,</if>
 | 
			
		||||
@@ -47,10 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
            <if test="updateBy != null">update_by,</if>
 | 
			
		||||
            <if test="updateTime != null">update_time,</if>
 | 
			
		||||
            <if test="remark != null">remark,</if>
 | 
			
		||||
         </trim>
 | 
			
		||||
        </trim>
 | 
			
		||||
        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
			
		||||
            <if test="userId != null">#{userId},</if>
 | 
			
		||||
            <if test="nickName != null">#{nickName},</if>
 | 
			
		||||
            <if test="amount != null">#{amount},</if>
 | 
			
		||||
            <if test="rate != null">#{rate},</if>
 | 
			
		||||
            <if test="createBy != null">#{createBy},</if>
 | 
			
		||||
@@ -58,14 +120,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
            <if test="updateBy != null">#{updateBy},</if>
 | 
			
		||||
            <if test="updateTime != null">#{updateTime},</if>
 | 
			
		||||
            <if test="remark != null">#{remark},</if>
 | 
			
		||||
         </trim>
 | 
			
		||||
        </trim>
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
    <update id="updateSysCommision" parameterType="SysCommision">
 | 
			
		||||
        update sys_commision
 | 
			
		||||
        <trim prefix="SET" suffixOverrides=",">
 | 
			
		||||
            <if test="userId != null">user_id = #{userId},</if>
 | 
			
		||||
            <if test="nickName != null">nick_name = #{nickName},</if>
 | 
			
		||||
            <if test="amount != null">amount = #{amount},</if>
 | 
			
		||||
            <if test="rate != null">rate = #{rate},</if>
 | 
			
		||||
            <if test="createBy != null">create_by = #{createBy},</if>
 | 
			
		||||
@@ -82,10 +143,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
    <delete id="deleteSysCommisionByIds" parameterType="String">
 | 
			
		||||
        delete from sys_commision where rule_id in 
 | 
			
		||||
        delete from sys_commision where rule_id in
 | 
			
		||||
        <foreach item="ruleId" collection="array" open="(" separator="," close=")">
 | 
			
		||||
            #{ruleId}
 | 
			
		||||
        </foreach>
 | 
			
		||||
    </delete>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
@@ -52,8 +52,8 @@
 | 
			
		||||
            <if test="plannerAssisId != null ">and planner_assis_id = #{plannerAssisId}</if>
 | 
			
		||||
            <if test="operatorId != null ">and operator_id = #{operatorId}</if>
 | 
			
		||||
            <if test="recommender != null  and recommender != ''">and recommender = #{recommender}</if>
 | 
			
		||||
            <if test="beginTime != null ">and order_time >= #{beginTime}</if>
 | 
			
		||||
            <if test="endTime != null ">and order_time <= #{endTime}</if>
 | 
			
		||||
            <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')</if>
 | 
			
		||||
            <if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')</if>
 | 
			
		||||
            <if test="serveMonth != null ">and serve_month = #{serveMonth}</if>
 | 
			
		||||
            <if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
 | 
			
		||||
        </where>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,36 @@
 | 
			
		||||
package com.ruoyi.system.domain;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
public class CusSalesman implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    private String userId;
 | 
			
		||||
 | 
			
		||||
    private String userName;
 | 
			
		||||
 | 
			
		||||
    public String getUserName() {
 | 
			
		||||
        return userName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getUserId() {
 | 
			
		||||
        return userId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setUserName(String userName) {
 | 
			
		||||
        this.userName = userName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setUserId(String userId) {
 | 
			
		||||
        this.userId = userId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString() {
 | 
			
		||||
        return "CusSalesman{" +
 | 
			
		||||
                "userId='" + userId + '\'' +
 | 
			
		||||
                ", userName='" + userName + '\'' +
 | 
			
		||||
                '}';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
package com.ruoyi.system.mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.system.domain.CusSalesman;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
 | 
			
		||||
@@ -21,6 +23,8 @@ public interface SysUserMapper
 | 
			
		||||
 | 
			
		||||
    public List<SysUser> selectAllUser();
 | 
			
		||||
 | 
			
		||||
    public List<CusSalesman> selectSalesman();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过用户名查询用户
 | 
			
		||||
     * 
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import com.ruoyi.system.domain.CusSalesman;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 用户 业务层
 | 
			
		||||
@@ -20,6 +21,8 @@ public interface ISysUserService
 | 
			
		||||
 | 
			
		||||
    public List<SysUser> selectAllUser();
 | 
			
		||||
 | 
			
		||||
    public List<CusSalesman> selectSalesman();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过用户名查询用户
 | 
			
		||||
     * 
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.system.domain.CusSalesman;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
@@ -70,6 +71,11 @@ public class SysUserServiceImpl implements ISysUserService {
 | 
			
		||||
        return userMapper.selectAllUser();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<CusSalesman> selectSalesman() {
 | 
			
		||||
        return userMapper.selectSalesman();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过用户名查询用户
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
			
		||||
<mapper namespace="com.ruoyi.system.mapper.SysUserMapper">
 | 
			
		||||
 | 
			
		||||
	<resultMap id="CusSalesmanResult" type="CusSalesman" >
 | 
			
		||||
		<id	    property="userId"       column="user_id"/>
 | 
			
		||||
		<result property="userName"     column="nick_name"/>
 | 
			
		||||
	</resultMap>
 | 
			
		||||
 | 
			
		||||
	<resultMap type="SysUser" id="SysUserResult">
 | 
			
		||||
		<id     property="userId"       column="user_id"      />
 | 
			
		||||
		<result property="deptId"       column="dept_id"      />
 | 
			
		||||
@@ -26,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
		<association property="dept"    column="dept_id" javaType="SysDept" resultMap="deptResult" />
 | 
			
		||||
		<collection  property="roles"   javaType="java.util.List"        resultMap="RoleResult" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<resultMap id="deptResult" type="SysDept">
 | 
			
		||||
		<id     property="deptId"   column="dept_id"     />
 | 
			
		||||
		<result property="parentId" column="parent_id"   />
 | 
			
		||||
@@ -35,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
		<result property="leader"   column="leader"      />
 | 
			
		||||
		<result property="status"   column="dept_status" />
 | 
			
		||||
	</resultMap>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<resultMap id="RoleResult" type="SysRole">
 | 
			
		||||
		<id     property="roleId"       column="role_id"        />
 | 
			
		||||
		<result property="roleName"     column="role_name"      />
 | 
			
		||||
@@ -50,7 +55,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
		left join sys_dept d on u.dept_id = d.dept_id
 | 
			
		||||
		where u.del_flag = '0'
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<select id="selectSalesman" parameterType="CusSalesman" resultMap="CusSalesmanResult">
 | 
			
		||||
        select user_id, nick_name from sys_user where dept_id='103'
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
	<sql id="selectUserVo">
 | 
			
		||||
        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, 
 | 
			
		||||
        d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
 | 
			
		||||
@@ -60,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
		    left join sys_user_role ur on u.user_id = ur.user_id
 | 
			
		||||
		    left join sys_role r on r.role_id = ur.role_id
 | 
			
		||||
    </sql>
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
 | 
			
		||||
		select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
 | 
			
		||||
		left join sys_dept d on u.dept_id = d.dept_id
 | 
			
		||||
@@ -86,29 +95,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
		<!-- 数据范围过滤 -->
 | 
			
		||||
		${params.dataScope}
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
 | 
			
		||||
	    <include refid="selectUserVo"/>
 | 
			
		||||
		where u.user_name = #{userName}
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
 | 
			
		||||
		<include refid="selectUserVo"/>
 | 
			
		||||
		where u.user_id = #{userId}
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<select id="checkUserNameUnique" parameterType="String" resultType="int">
 | 
			
		||||
		select count(1) from sys_user where user_name = #{userName} limit 1
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
 | 
			
		||||
		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
 | 
			
		||||
		select user_id, email from sys_user where email = #{email} limit 1
 | 
			
		||||
	</select>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
 | 
			
		||||
 		insert into sys_user(
 | 
			
		||||
 			<if test="userId != null and userId != 0">user_id,</if>
 | 
			
		||||
@@ -140,7 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
 			sysdate()
 | 
			
		||||
 		)
 | 
			
		||||
	</insert>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<update id="updateUser" parameterType="SysUser">
 | 
			
		||||
 		update sys_user
 | 
			
		||||
 		<set>
 | 
			
		||||
@@ -161,28 +170,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		||||
 		</set>
 | 
			
		||||
 		where user_id = #{userId}
 | 
			
		||||
	</update>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<update id="updateUserStatus" parameterType="SysUser">
 | 
			
		||||
 		update sys_user set status = #{status} where user_id = #{userId}
 | 
			
		||||
	</update>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<update id="updateUserAvatar" parameterType="SysUser">
 | 
			
		||||
 		update sys_user set avatar = #{avatar} where user_name = #{userName}
 | 
			
		||||
	</update>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<update id="resetUserPwd" parameterType="SysUser">
 | 
			
		||||
 		update sys_user set password = #{password} where user_name = #{userName}
 | 
			
		||||
	</update>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<delete id="deleteUserById" parameterType="Long">
 | 
			
		||||
 		delete from sys_user where user_id = #{userId}
 | 
			
		||||
 	</delete>
 | 
			
		||||
 	
 | 
			
		||||
 | 
			
		||||
 	<delete id="deleteUserByIds" parameterType="Long">
 | 
			
		||||
 		update sys_user set del_flag = '2' where user_id in
 | 
			
		||||
 		<foreach collection="array" item="userId" open="(" separator="," close=")">
 | 
			
		||||
 			#{userId}
 | 
			
		||||
        </foreach> 
 | 
			
		||||
        </foreach>
 | 
			
		||||
 	</delete>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
</mapper> 
 | 
			
		||||
@@ -1,53 +1,69 @@
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
// 查询业务提成比例列表
 | 
			
		||||
export function listCommision(query) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/list',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: query
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查询业务提成比例详细
 | 
			
		||||
export function getCommision(ruleId) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/' + ruleId,
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 新增业务提成比例
 | 
			
		||||
export function addCommision(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 修改业务提成比例
 | 
			
		||||
export function updateCommision(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision',
 | 
			
		||||
    method: 'put',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 删除业务提成比例
 | 
			
		||||
export function delCommision(ruleId) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/' + ruleId,
 | 
			
		||||
    method: 'delete'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 导出业务提成比例
 | 
			
		||||
export function exportCommision(query) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/export',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: query
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
// 查询业务提成比例列表
 | 
			
		||||
export function listCommision(query) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/list',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: query
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查询提成明细
 | 
			
		||||
export function detailCommision(query) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/detail',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: query
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查询业务提成比例详细
 | 
			
		||||
export function getCommision(ruleId) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/' + ruleId,
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 新增业务提成比例
 | 
			
		||||
export function addCommision(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision',
 | 
			
		||||
    method: 'post',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 修改业务提成比例
 | 
			
		||||
export function updateCommision(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision',
 | 
			
		||||
    method: 'put',
 | 
			
		||||
    data: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 删除业务提成比例
 | 
			
		||||
export function delCommision(ruleId) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/' + ruleId,
 | 
			
		||||
    method: 'delete'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 导出业务提成比例
 | 
			
		||||
export function exportCommision(query) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/export',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: query
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getSalesman() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/commision/salesman',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,7 @@
 | 
			
		||||
import request from '@/utils/request'
 | 
			
		||||
 | 
			
		||||
// 查询销售订单列表
 | 
			
		||||
export function listOrder(query) {
 | 
			
		||||
  const [beginTime, endTime] = query.orderTime || [null, null];
 | 
			
		||||
  const params = {
 | 
			
		||||
    ...query,
 | 
			
		||||
    beginTime,
 | 
			
		||||
    endTime,
 | 
			
		||||
    orderTime: null
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
export function listOrder(params) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/custom/order/list',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
 
 | 
			
		||||
@@ -61,8 +61,8 @@ export function addDateRange(params, dateRange) {
 | 
			
		||||
  search.beginTime = "";
 | 
			
		||||
  search.endTime = "";
 | 
			
		||||
  if (null != dateRange && '' != dateRange) {
 | 
			
		||||
    search.beginTime = this.dateRange[0];
 | 
			
		||||
    search.endTime = this.dateRange[1];
 | 
			
		||||
    search.beginTime = dateRange[0];
 | 
			
		||||
    search.endTime = dateRange[1];
 | 
			
		||||
  }
 | 
			
		||||
  return search;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										448
									
								
								ruoyi-ui/src/views/custom/commision/config/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										448
									
								
								ruoyi-ui/src/views/custom/commision/config/index.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,448 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
 | 
			
		||||
      <el-form-item label="职位" prop="postId">
 | 
			
		||||
        <el-select v-model="queryParams.postId" placeholder="请选择职位" clearable size="small" @change="searchPostChange">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in postIdOptions"
 | 
			
		||||
            :key="dict.dictValue"
 | 
			
		||||
            :label="dict.dictLabel"
 | 
			
		||||
            :value="dict.dictValue"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="业务员" prop="userId">
 | 
			
		||||
        <el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in searchUserIdOptions"
 | 
			
		||||
            :key="dict.dictValue"
 | 
			
		||||
            :label="dict.dictLabel"
 | 
			
		||||
            :value="dict.dictValue"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </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="['commision:config: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="['commision:config: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="['commision:config:remove']"-->
 | 
			
		||||
      <!--        >删除-->
 | 
			
		||||
      <!--        </el-button>-->
 | 
			
		||||
      <!--      </el-col>-->
 | 
			
		||||
      <!--      <el-col :span="1.5">-->
 | 
			
		||||
      <!--        <el-button-->
 | 
			
		||||
      <!--          type="warning"-->
 | 
			
		||||
      <!--          icon="el-icon-download"-->
 | 
			
		||||
      <!--          size="mini"-->
 | 
			
		||||
      <!--          @click="handleExport"-->
 | 
			
		||||
      <!--          v-hasPermi="['commision:config:export']"-->
 | 
			
		||||
      <!--        >导出-->
 | 
			
		||||
      <!--        </el-button>-->
 | 
			
		||||
      <!--      </el-col>-->
 | 
			
		||||
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
 | 
			
		||||
    </el-row>
 | 
			
		||||
 | 
			
		||||
    <el-table v-loading="loading" :data="commisionList" :span-method="objectSpanMethod"
 | 
			
		||||
              @selection-change="handleSelectionChange">
 | 
			
		||||
      <el-table-column label="业务员" align="center" prop="userName"/>
 | 
			
		||||
      <el-table-column label="职位" align="center" prop="postName"/>
 | 
			
		||||
      <el-table-column label="金额" align="center" prop="amount"/>
 | 
			
		||||
      <el-table-column label="比例" align="center" prop="rate">
 | 
			
		||||
        <template scope="scope">
 | 
			
		||||
          {{scope.row.rate + '%'}}
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column label="备注" align="center" prop="remark"/>
 | 
			
		||||
      <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="['commision:config:edit']"
 | 
			
		||||
          >修改
 | 
			
		||||
          </el-button>
 | 
			
		||||
          <el-button
 | 
			
		||||
            size="mini"
 | 
			
		||||
            type="text"
 | 
			
		||||
            icon="el-icon-delete"
 | 
			
		||||
            @click="handleDelete(scope.row)"
 | 
			
		||||
            v-hasPermi="['commision:config: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-row :gutter="15">
 | 
			
		||||
        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="职位" prop="postId">
 | 
			
		||||
              <el-select v-model="form.postId" placeholder="请选择职位" @change="postChange">
 | 
			
		||||
                <el-option
 | 
			
		||||
                  v-for="dict in postIdOptions"
 | 
			
		||||
                  :key="dict.dictValue"
 | 
			
		||||
                  :label="dict.dictLabel"
 | 
			
		||||
                  :value="parseInt(dict.dictValue)"
 | 
			
		||||
                ></el-option>
 | 
			
		||||
              </el-select>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="业务员" prop="userId">
 | 
			
		||||
              <el-select v-model="form.userId" placeholder="请选择业务员">
 | 
			
		||||
                <el-option
 | 
			
		||||
                  v-for="dict in userIdOptions"
 | 
			
		||||
                  :key="dict.dictValue"
 | 
			
		||||
                  :label="dict.dictLabel"
 | 
			
		||||
                  :value="parseInt(dict.dictValue)"
 | 
			
		||||
                ></el-option>
 | 
			
		||||
              </el-select>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="金额" prop="amount">
 | 
			
		||||
              <el-input v-model="form.amount" placeholder="请输入金额"/>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="12">
 | 
			
		||||
            <el-form-item label="分成比例" prop="rate">
 | 
			
		||||
              <el-input v-model="form.rate" placeholder="请输入比例"/>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="24">
 | 
			
		||||
            <el-form-item label="备注" prop="remark">
 | 
			
		||||
              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
 | 
			
		||||
            </el-form-item>
 | 
			
		||||
          </el-col>
 | 
			
		||||
        </el-form>
 | 
			
		||||
      </el-row>
 | 
			
		||||
      <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 {
 | 
			
		||||
    listCommision,
 | 
			
		||||
    getCommision,
 | 
			
		||||
    delCommision,
 | 
			
		||||
    addCommision,
 | 
			
		||||
    updateCommision,
 | 
			
		||||
    exportCommision,
 | 
			
		||||
  } from "@/api/custom/commision";
 | 
			
		||||
 | 
			
		||||
  import {getOptions} from "@/api/custom/order";
 | 
			
		||||
 | 
			
		||||
  export default {
 | 
			
		||||
    name: "CommisionConfig",
 | 
			
		||||
    data() {
 | 
			
		||||
      return {
 | 
			
		||||
        // 遮罩层
 | 
			
		||||
        loading: true,
 | 
			
		||||
        // 选中数组
 | 
			
		||||
        ids: [],
 | 
			
		||||
        // 非单个禁用
 | 
			
		||||
        single: true,
 | 
			
		||||
        // 非多个禁用
 | 
			
		||||
        multiple: true,
 | 
			
		||||
        // 显示搜索条件
 | 
			
		||||
        showSearch: false,
 | 
			
		||||
        // 总条数
 | 
			
		||||
        total: 0,
 | 
			
		||||
        // 业务提成比例表格数据
 | 
			
		||||
        commisionList: [],
 | 
			
		||||
        // 弹出层标题
 | 
			
		||||
        title: "",
 | 
			
		||||
        // 是否显示弹出层
 | 
			
		||||
        open: false,
 | 
			
		||||
        // 业务员字典
 | 
			
		||||
        userIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        postIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        totalUserIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        searchUserIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        options: {},
 | 
			
		||||
        // 查询参数
 | 
			
		||||
        queryParams: {
 | 
			
		||||
          pageNum: 1,
 | 
			
		||||
          pageSize: 10,
 | 
			
		||||
          userId: null,
 | 
			
		||||
          postId: null,
 | 
			
		||||
          amount: null,
 | 
			
		||||
          rate: null,
 | 
			
		||||
        },
 | 
			
		||||
        // 表单参数
 | 
			
		||||
        form: {},
 | 
			
		||||
        // 表单校验
 | 
			
		||||
        rules: {
 | 
			
		||||
          userId: [
 | 
			
		||||
            {required: true, message: "业务员不能为空", trigger: "change"}
 | 
			
		||||
          ],
 | 
			
		||||
          postId: [
 | 
			
		||||
            {required: true, message: "职位不能为空", trigger: "change"}
 | 
			
		||||
          ],
 | 
			
		||||
          amount: [
 | 
			
		||||
            {required: true, message: "金额不能为空", trigger: "blur"}
 | 
			
		||||
          ],
 | 
			
		||||
          rate: [
 | 
			
		||||
            {required: true, message: "分成比例不能为空", trigger: "blur"}
 | 
			
		||||
          ],
 | 
			
		||||
        }
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
    created() {
 | 
			
		||||
      this.getList();
 | 
			
		||||
      getOptions().then(response => {
 | 
			
		||||
        this.options = response.data.reduce((opts, cur) => {
 | 
			
		||||
          if (cur.postCode.startsWith('planner')) {
 | 
			
		||||
            return opts;
 | 
			
		||||
          }
 | 
			
		||||
          if (!opts[cur.postId]) {
 | 
			
		||||
            opts[cur.postId] = [];
 | 
			
		||||
          }
 | 
			
		||||
          opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName});
 | 
			
		||||
 | 
			
		||||
          if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) {
 | 
			
		||||
            this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName});
 | 
			
		||||
          }
 | 
			
		||||
          if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) {
 | 
			
		||||
            this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName});
 | 
			
		||||
          }
 | 
			
		||||
          return opts;
 | 
			
		||||
        }, {});
 | 
			
		||||
        this.searchUserIdOptions = this.totalUserIdOptions.slice();
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
      /** 查询业务提成比例列表 */
 | 
			
		||||
      getList() {
 | 
			
		||||
        this.loading = true;
 | 
			
		||||
        listCommision(this.queryParams).then(response => {
 | 
			
		||||
          this.commisionList = response.rows.reduce((arr, cur, idx, oriArr) => {
 | 
			
		||||
            for (let i = 0; i < arr.length; i++) {
 | 
			
		||||
              if (arr[i].some(e => e.userId === cur.userId)) {
 | 
			
		||||
                arr[i].push(cur);
 | 
			
		||||
                break;
 | 
			
		||||
              } else if (i === arr.length - 1) {
 | 
			
		||||
                arr.push([cur]);
 | 
			
		||||
                break;
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
            if (idx === 0) {
 | 
			
		||||
              arr.push([cur]);
 | 
			
		||||
            }
 | 
			
		||||
            if (idx === oriArr.length - 1) {
 | 
			
		||||
              const finalArr = [];
 | 
			
		||||
              arr.forEach(tmpArr => {
 | 
			
		||||
                tmpArr.sort((a, b) => a.amount - b.amount)
 | 
			
		||||
                  .forEach((elm, elmIdx) => {
 | 
			
		||||
                    finalArr.push({
 | 
			
		||||
                      ...elm,
 | 
			
		||||
                      userSpan: elmIdx ? {
 | 
			
		||||
                        rowspan: 0,
 | 
			
		||||
                        colspan: 0
 | 
			
		||||
                      } : {
 | 
			
		||||
                        rowspan: tmpArr.length,
 | 
			
		||||
                        colspan: 1
 | 
			
		||||
                      },
 | 
			
		||||
                      postSpan: elmIdx ? {
 | 
			
		||||
                        rowspan: 0,
 | 
			
		||||
                        colspan: 0
 | 
			
		||||
                      } : {
 | 
			
		||||
                        rowspan: tmpArr.length,
 | 
			
		||||
                        colspan: 1
 | 
			
		||||
                      }
 | 
			
		||||
                    })
 | 
			
		||||
                  })
 | 
			
		||||
              });
 | 
			
		||||
              return finalArr;
 | 
			
		||||
            }
 | 
			
		||||
            return arr;
 | 
			
		||||
          }, []);
 | 
			
		||||
          this.total = response.total;
 | 
			
		||||
          this.loading = false;
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
      // 业务员字典翻译
 | 
			
		||||
      userIdFormat(row, column) {
 | 
			
		||||
        return this.selectDictLabel(this.userIdOptions, row.userId);
 | 
			
		||||
      },
 | 
			
		||||
      // 取消按钮
 | 
			
		||||
      cancel() {
 | 
			
		||||
        this.open = false;
 | 
			
		||||
        this.reset();
 | 
			
		||||
      },
 | 
			
		||||
      // 表单重置
 | 
			
		||||
      reset() {
 | 
			
		||||
        this.userIdOptions = [];
 | 
			
		||||
        this.form = {
 | 
			
		||||
          ruleId: null,
 | 
			
		||||
          userId: null,
 | 
			
		||||
          userName: null,
 | 
			
		||||
          amount: null,
 | 
			
		||||
          rate: null,
 | 
			
		||||
          createBy: null,
 | 
			
		||||
          createTime: null,
 | 
			
		||||
          updateBy: null,
 | 
			
		||||
          updateTime: null,
 | 
			
		||||
          remark: null
 | 
			
		||||
        };
 | 
			
		||||
        this.resetForm("form");
 | 
			
		||||
      },
 | 
			
		||||
      /** 搜索按钮操作 */
 | 
			
		||||
      handleQuery() {
 | 
			
		||||
        this.queryParams.pageNum = 1;
 | 
			
		||||
        this.getList();
 | 
			
		||||
      },
 | 
			
		||||
      /** 重置按钮操作 */
 | 
			
		||||
      resetQuery() {
 | 
			
		||||
        this.resetForm("queryForm");
 | 
			
		||||
        this.handleQuery();
 | 
			
		||||
        this.searchUserIdOptions = this.totalUserIdOptions.slice();
 | 
			
		||||
      },
 | 
			
		||||
      // 多选框选中数据
 | 
			
		||||
      handleSelectionChange(selection) {
 | 
			
		||||
        this.ids = selection.map(item => item.ruleId)
 | 
			
		||||
        this.single = selection.length !== 1
 | 
			
		||||
        this.multiple = !selection.length
 | 
			
		||||
      },
 | 
			
		||||
      /** 新增按钮操作 */
 | 
			
		||||
      handleAdd() {
 | 
			
		||||
        this.reset();
 | 
			
		||||
        this.open = true;
 | 
			
		||||
        this.title = "添加业务提成比例";
 | 
			
		||||
      },
 | 
			
		||||
      /** 修改按钮操作 */
 | 
			
		||||
      handleUpdate(row) {
 | 
			
		||||
        this.reset();
 | 
			
		||||
        const ruleId = row.ruleId || this.ids
 | 
			
		||||
        getCommision(ruleId).then(response => {
 | 
			
		||||
          this.form = response.data;
 | 
			
		||||
          this.open = true;
 | 
			
		||||
          this.title = "修改业务提成比例";
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
      /** 提交按钮 */
 | 
			
		||||
      submitForm() {
 | 
			
		||||
        this.$refs["form"].validate(valid => {
 | 
			
		||||
          if (valid) {
 | 
			
		||||
            if (this.form.ruleId != null) {
 | 
			
		||||
              updateCommision(this.form).then(response => {
 | 
			
		||||
                if (response.code === 200) {
 | 
			
		||||
                  this.msgSuccess("修改成功");
 | 
			
		||||
                  this.open = false;
 | 
			
		||||
                  this.getList();
 | 
			
		||||
                }
 | 
			
		||||
              });
 | 
			
		||||
            } else {
 | 
			
		||||
              addCommision(this.form).then(response => {
 | 
			
		||||
                if (response.code === 200) {
 | 
			
		||||
                  this.msgSuccess("新增成功");
 | 
			
		||||
                  this.open = false;
 | 
			
		||||
                  this.getList();
 | 
			
		||||
                }
 | 
			
		||||
              });
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
      /** 删除按钮操作 */
 | 
			
		||||
      handleDelete(row) {
 | 
			
		||||
        const ruleIds = row.ruleId || this.ids;
 | 
			
		||||
        this.$confirm('是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?', "警告", {
 | 
			
		||||
          confirmButtonText: "确定",
 | 
			
		||||
          cancelButtonText: "取消",
 | 
			
		||||
          type: "warning"
 | 
			
		||||
        }).then(function () {
 | 
			
		||||
          return delCommision(ruleIds);
 | 
			
		||||
        }).then(() => {
 | 
			
		||||
          this.getList();
 | 
			
		||||
          this.msgSuccess("删除成功");
 | 
			
		||||
        }).catch(function () {
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
      /** 导出按钮操作 */
 | 
			
		||||
      handleExport() {
 | 
			
		||||
        const queryParams = this.queryParams;
 | 
			
		||||
        this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
 | 
			
		||||
          confirmButtonText: "确定",
 | 
			
		||||
          cancelButtonText: "取消",
 | 
			
		||||
          type: "warning"
 | 
			
		||||
        }).then(function () {
 | 
			
		||||
          return exportCommision(queryParams);
 | 
			
		||||
        }).then(response => {
 | 
			
		||||
          this.download(response.msg);
 | 
			
		||||
        }).catch(function () {
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
      objectSpanMethod({row, column, rowIndex, columnIndex}) {
 | 
			
		||||
        if (columnIndex === 0) {
 | 
			
		||||
          return row.userSpan;
 | 
			
		||||
        } else if (columnIndex === 1) {
 | 
			
		||||
          return row.postSpan;
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      postChange(postId) {
 | 
			
		||||
        this.userIdOptions = this.options[postId];
 | 
			
		||||
      },
 | 
			
		||||
      searchPostChange(postId) {
 | 
			
		||||
        if(!postId) {
 | 
			
		||||
          this.searchUserIdOptions = this.totalUserIdOptions.slice();
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
        this.searchUserIdOptions = this.options[postId];
 | 
			
		||||
        this.queryParams.userId = null;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										218
									
								
								ruoyi-ui/src/views/custom/commision/detail/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										218
									
								
								ruoyi-ui/src/views/custom/commision/detail/index.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,218 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
 | 
			
		||||
      <el-form-item label="职位" prop="postId">
 | 
			
		||||
        <el-select v-model="queryParams.postId" placeholder="请选择职位" clearable size="small" @change="searchPostChange">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in postIdOptions"
 | 
			
		||||
            :key="dict.dictValue"
 | 
			
		||||
            :label="dict.dictLabel"
 | 
			
		||||
            :value="dict.dictValue"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="业务员" prop="userId">
 | 
			
		||||
        <el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in searchUserIdOptions"
 | 
			
		||||
            :key="dict.dictValue"
 | 
			
		||||
            :label="dict.dictLabel"
 | 
			
		||||
            :value="dict.dictValue"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="月份" prop="month">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="month"
 | 
			
		||||
          @change="monthRangeChange"
 | 
			
		||||
          type="month"
 | 
			
		||||
          placeholder="选择月">
 | 
			
		||||
        </el-date-picker>
 | 
			
		||||
      </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="warning"
 | 
			
		||||
          icon="el-icon-download"
 | 
			
		||||
          size="mini"
 | 
			
		||||
          @click="handleExport"
 | 
			
		||||
          v-hasPermi="['commision:detail:export']"
 | 
			
		||||
        >导出
 | 
			
		||||
        </el-button>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
 | 
			
		||||
    </el-row>
 | 
			
		||||
 | 
			
		||||
    <el-table v-loading="loading" :data="commisionList"
 | 
			
		||||
              @selection-change="handleSelectionChange">
 | 
			
		||||
      <el-table-column label="业务员" align="center" prop="userName"/>
 | 
			
		||||
      <el-table-column label="职位" align="center" prop="postName"/>
 | 
			
		||||
      <el-table-column label="总金额" align="center" prop="amount"/>
 | 
			
		||||
      <el-table-column label="比例" align="center" prop="rate">
 | 
			
		||||
        <template scope="scope">
 | 
			
		||||
          {{scope.row.rate + '%'}}
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column label="提成" align="center" prop="commision"/>
 | 
			
		||||
    </el-table>
 | 
			
		||||
 | 
			
		||||
    <pagination
 | 
			
		||||
      v-show="total>0"
 | 
			
		||||
      :total="total"
 | 
			
		||||
      :page.sync="queryParams.pageNum"
 | 
			
		||||
      :limit.sync="queryParams.pageSize"
 | 
			
		||||
      @pagination="getList"
 | 
			
		||||
    />
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
  import {
 | 
			
		||||
    detailCommision,
 | 
			
		||||
    exportCommision,
 | 
			
		||||
  } from "@/api/custom/commision";
 | 
			
		||||
 | 
			
		||||
  import {getOptions} from "@/api/custom/order";
 | 
			
		||||
 | 
			
		||||
  import dayjs from 'dayjs';
 | 
			
		||||
 | 
			
		||||
  export default {
 | 
			
		||||
    name: "CommisionDetail",
 | 
			
		||||
    data() {
 | 
			
		||||
      return {
 | 
			
		||||
        // 遮罩层
 | 
			
		||||
        loading: true,
 | 
			
		||||
        // 选中数组
 | 
			
		||||
        ids: [],
 | 
			
		||||
        // 非单个禁用
 | 
			
		||||
        single: true,
 | 
			
		||||
        // 非多个禁用
 | 
			
		||||
        multiple: true,
 | 
			
		||||
        // 显示搜索条件
 | 
			
		||||
        showSearch: false,
 | 
			
		||||
        // 总条数
 | 
			
		||||
        total: 0,
 | 
			
		||||
        //
 | 
			
		||||
        month: dayjs(),
 | 
			
		||||
        // 业务提成比例表格数据
 | 
			
		||||
        commisionList: [],
 | 
			
		||||
        // 是否显示弹出层
 | 
			
		||||
        open: false,
 | 
			
		||||
        // 业务员字典
 | 
			
		||||
        userIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        postIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        totalUserIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        searchUserIdOptions: [],
 | 
			
		||||
        //
 | 
			
		||||
        options: {},
 | 
			
		||||
        // 查询参数
 | 
			
		||||
        queryParams: {
 | 
			
		||||
          pageNum: 1,
 | 
			
		||||
          pageSize: 10,
 | 
			
		||||
          userId: null,
 | 
			
		||||
          postId: null,
 | 
			
		||||
        },
 | 
			
		||||
      };
 | 
			
		||||
    },
 | 
			
		||||
    created() {
 | 
			
		||||
      this.getList();
 | 
			
		||||
      getOptions().then(response => {
 | 
			
		||||
        this.options = response.data.reduce((opts, cur) => {
 | 
			
		||||
          if (cur.postCode.startsWith('planner')) {
 | 
			
		||||
            return opts;
 | 
			
		||||
          }
 | 
			
		||||
          if (!opts[cur.postId]) {
 | 
			
		||||
            opts[cur.postId] = [];
 | 
			
		||||
          }
 | 
			
		||||
          opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName});
 | 
			
		||||
 | 
			
		||||
          if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) {
 | 
			
		||||
            this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName});
 | 
			
		||||
          }
 | 
			
		||||
          if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) {
 | 
			
		||||
            this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName});
 | 
			
		||||
          }
 | 
			
		||||
          return opts;
 | 
			
		||||
        }, {});
 | 
			
		||||
        this.searchUserIdOptions = this.totalUserIdOptions.slice();
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
      /** 查询业务提成比例列表 */
 | 
			
		||||
      getList() {
 | 
			
		||||
        this.loading = true;
 | 
			
		||||
        const dateRange = [dayjs(this.month).startOf('month').format('YYYY-MM-DD'), dayjs(this.month).endOf('month').format('YYYY-MM-DD')];
 | 
			
		||||
        console.log(dateRange)
 | 
			
		||||
        detailCommision(this.addDateRange(this.queryParams, dateRange)).then(response => {
 | 
			
		||||
          this.commisionList = response.rows;
 | 
			
		||||
          this.total = response.total;
 | 
			
		||||
          this.loading = false;
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
      // 业务员字典翻译
 | 
			
		||||
      userIdFormat(row, column) {
 | 
			
		||||
        return this.selectDictLabel(this.userIdOptions, row.userId);
 | 
			
		||||
      },
 | 
			
		||||
      // 表单重置
 | 
			
		||||
      reset() {
 | 
			
		||||
        this.userIdOptions = [];
 | 
			
		||||
        this.resetForm("form");
 | 
			
		||||
      },
 | 
			
		||||
      /** 搜索按钮操作 */
 | 
			
		||||
      handleQuery() {
 | 
			
		||||
        this.queryParams.pageNum = 1;
 | 
			
		||||
        this.getList();
 | 
			
		||||
      },
 | 
			
		||||
      /** 重置按钮操作 */
 | 
			
		||||
      resetQuery() {
 | 
			
		||||
        this.resetForm("queryForm");
 | 
			
		||||
        this.handleQuery();
 | 
			
		||||
        this.searchUserIdOptions = this.totalUserIdOptions.slice();
 | 
			
		||||
      },
 | 
			
		||||
      // 多选框选中数据
 | 
			
		||||
      handleSelectionChange(selection) {
 | 
			
		||||
        this.ids = selection.map(item => item.ruleId)
 | 
			
		||||
        this.single = selection.length !== 1
 | 
			
		||||
        this.multiple = !selection.length
 | 
			
		||||
      },
 | 
			
		||||
      /** 导出按钮操作 */
 | 
			
		||||
      handleExport() {
 | 
			
		||||
        const queryParams = this.queryParams;
 | 
			
		||||
        this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
 | 
			
		||||
          confirmButtonText: "确定",
 | 
			
		||||
          cancelButtonText: "取消",
 | 
			
		||||
          type: "warning"
 | 
			
		||||
        }).then(function () {
 | 
			
		||||
          return exportCommision(queryParams);
 | 
			
		||||
        }).then(response => {
 | 
			
		||||
          this.download(response.msg);
 | 
			
		||||
        }).catch(function () {
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
      monthRangeChange(time) {
 | 
			
		||||
        this.month = time;
 | 
			
		||||
      },
 | 
			
		||||
      postChange(postId) {
 | 
			
		||||
        this.userIdOptions = this.options[postId];
 | 
			
		||||
      },
 | 
			
		||||
      searchPostChange(postId) {
 | 
			
		||||
        if(!postId) {
 | 
			
		||||
          this.searchUserIdOptions = this.totalUserIdOptions.slice();
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
        this.searchUserIdOptions = this.options[postId];
 | 
			
		||||
        this.queryParams.userId = null;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
</script>
 | 
			
		||||
@@ -1,326 +0,0 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
 | 
			
		||||
      <el-form-item label="业务员" prop="userId">
 | 
			
		||||
        <el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in userIdOptions"
 | 
			
		||||
            :key="dict.dictValue"
 | 
			
		||||
            :label="dict.dictLabel"
 | 
			
		||||
            :value="dict.dictValue"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="金额" prop="amount">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="queryParams.amount"
 | 
			
		||||
          placeholder="请输入金额"
 | 
			
		||||
          clearable
 | 
			
		||||
          size="small"
 | 
			
		||||
          @keyup.enter.native="handleQuery"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="分成比例" prop="rate">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="queryParams.rate"
 | 
			
		||||
          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="['custom:commision: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="['custom:commision: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="['custom:commision:remove']"
 | 
			
		||||
        >删除</el-button>
 | 
			
		||||
      </el-col>
 | 
			
		||||
      <el-col :span="1.5">
 | 
			
		||||
        <el-button
 | 
			
		||||
          type="warning"
 | 
			
		||||
          icon="el-icon-download"
 | 
			
		||||
          size="mini"
 | 
			
		||||
          @click="handleExport"
 | 
			
		||||
          v-hasPermi="['custom:commision:export']"
 | 
			
		||||
        >导出</el-button>
 | 
			
		||||
      </el-col>
 | 
			
		||||
	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
 | 
			
		||||
    </el-row>
 | 
			
		||||
 | 
			
		||||
    <el-table v-loading="loading" :data="commisionList" @selection-change="handleSelectionChange">
 | 
			
		||||
      <el-table-column type="selection" width="55" align="center" />
 | 
			
		||||
      <el-table-column label="编号" align="center" prop="ruleId" />
 | 
			
		||||
      <el-table-column label="业务员" align="center" prop="nickName" />
 | 
			
		||||
      <el-table-column label="金额" align="center" prop="amount" />
 | 
			
		||||
      <el-table-column label="分成比例" align="center" prop="rate" />
 | 
			
		||||
      <el-table-column label="备注" align="center" prop="remark" />
 | 
			
		||||
      <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="['custom:commision:edit']"
 | 
			
		||||
          >修改</el-button>
 | 
			
		||||
          <el-button
 | 
			
		||||
            size="mini"
 | 
			
		||||
            type="text"
 | 
			
		||||
            icon="el-icon-delete"
 | 
			
		||||
            @click="handleDelete(scope.row)"
 | 
			
		||||
            v-hasPermi="['custom:commision: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="userId">
 | 
			
		||||
          <el-select v-model="form.userId" placeholder="请选择业务员">
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="dict in userIdOptions"
 | 
			
		||||
              :key="dict.dictValue"
 | 
			
		||||
              :label="dict.dictLabel"
 | 
			
		||||
              :value="parseInt(dict.dictValue)"
 | 
			
		||||
            ></el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item label="业务员" prop="nickName">
 | 
			
		||||
          <el-input v-model="form.nickName" placeholder="请输入业务员" />
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item label="金额" prop="amount">
 | 
			
		||||
          <el-input v-model="form.amount" placeholder="请输入金额" />
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item label="分成比例" prop="rate">
 | 
			
		||||
          <el-input v-model="form.rate" placeholder="请输入分成比例" />
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item label="备注" prop="remark">
 | 
			
		||||
          <el-input v-model="form.remark" type="textarea" 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 { listCommision, getCommision, delCommision, addCommision, updateCommision, exportCommision } from "@/api/custom/commision";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "Commision",
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      // 遮罩层
 | 
			
		||||
      loading: true,
 | 
			
		||||
      // 选中数组
 | 
			
		||||
      ids: [],
 | 
			
		||||
      // 非单个禁用
 | 
			
		||||
      single: true,
 | 
			
		||||
      // 非多个禁用
 | 
			
		||||
      multiple: true,
 | 
			
		||||
      // 显示搜索条件
 | 
			
		||||
      showSearch: true,
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 业务提成比例表格数据
 | 
			
		||||
      commisionList: [],
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
      title: "",
 | 
			
		||||
      // 是否显示弹出层
 | 
			
		||||
      open: false,
 | 
			
		||||
      // 业务员字典
 | 
			
		||||
      userIdOptions: [],
 | 
			
		||||
      // 查询参数
 | 
			
		||||
      queryParams: {
 | 
			
		||||
        pageNum: 1,
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
        userId: null,
 | 
			
		||||
        amount: null,
 | 
			
		||||
        rate: null,
 | 
			
		||||
      },
 | 
			
		||||
      // 表单参数
 | 
			
		||||
      form: {},
 | 
			
		||||
      // 表单校验
 | 
			
		||||
      rules: {
 | 
			
		||||
        userId: [
 | 
			
		||||
          { required: true, message: "业务员不能为空", trigger: "change" }
 | 
			
		||||
        ],
 | 
			
		||||
        amount: [
 | 
			
		||||
          { required: true, message: "金额不能为空", trigger: "blur" }
 | 
			
		||||
        ],
 | 
			
		||||
        rate: [
 | 
			
		||||
          { required: true, message: "分成比例不能为空", trigger: "blur" }
 | 
			
		||||
        ],
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    this.getList();
 | 
			
		||||
    this.getDicts("sys_saller").then(response => {
 | 
			
		||||
      this.userIdOptions = response.data;
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    /** 查询业务提成比例列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      this.loading = true;
 | 
			
		||||
      listCommision(this.queryParams).then(response => {
 | 
			
		||||
        this.commisionList = response.rows;
 | 
			
		||||
        this.total = response.total;
 | 
			
		||||
        this.loading = false;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    // 业务员字典翻译
 | 
			
		||||
    userIdFormat(row, column) {
 | 
			
		||||
      return this.selectDictLabel(this.userIdOptions, row.userId);
 | 
			
		||||
    },
 | 
			
		||||
    // 取消按钮
 | 
			
		||||
    cancel() {
 | 
			
		||||
      this.open = false;
 | 
			
		||||
      this.reset();
 | 
			
		||||
    },
 | 
			
		||||
    // 表单重置
 | 
			
		||||
    reset() {
 | 
			
		||||
      this.form = {
 | 
			
		||||
        ruleId: null,
 | 
			
		||||
        userId: null,
 | 
			
		||||
        nickName: null,
 | 
			
		||||
        amount: null,
 | 
			
		||||
        rate: null,
 | 
			
		||||
        createBy: null,
 | 
			
		||||
        createTime: null,
 | 
			
		||||
        updateBy: null,
 | 
			
		||||
        updateTime: null,
 | 
			
		||||
        remark: null
 | 
			
		||||
      };
 | 
			
		||||
      this.resetForm("form");
 | 
			
		||||
    },
 | 
			
		||||
    /** 搜索按钮操作 */
 | 
			
		||||
    handleQuery() {
 | 
			
		||||
      this.queryParams.pageNum = 1;
 | 
			
		||||
      this.getList();
 | 
			
		||||
    },
 | 
			
		||||
    /** 重置按钮操作 */
 | 
			
		||||
    resetQuery() {
 | 
			
		||||
      this.resetForm("queryForm");
 | 
			
		||||
      this.handleQuery();
 | 
			
		||||
    },
 | 
			
		||||
    // 多选框选中数据
 | 
			
		||||
    handleSelectionChange(selection) {
 | 
			
		||||
      this.ids = selection.map(item => item.ruleId)
 | 
			
		||||
      this.single = selection.length!==1
 | 
			
		||||
      this.multiple = !selection.length
 | 
			
		||||
    },
 | 
			
		||||
    /** 新增按钮操作 */
 | 
			
		||||
    handleAdd() {
 | 
			
		||||
      this.reset();
 | 
			
		||||
      this.open = true;
 | 
			
		||||
      this.title = "添加业务提成比例";
 | 
			
		||||
    },
 | 
			
		||||
    /** 修改按钮操作 */
 | 
			
		||||
    handleUpdate(row) {
 | 
			
		||||
      this.reset();
 | 
			
		||||
      const ruleId = row.ruleId || this.ids
 | 
			
		||||
      getCommision(ruleId).then(response => {
 | 
			
		||||
        this.form = response.data;
 | 
			
		||||
        this.open = true;
 | 
			
		||||
        this.title = "修改业务提成比例";
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    /** 提交按钮 */
 | 
			
		||||
    submitForm() {
 | 
			
		||||
      this.$refs["form"].validate(valid => {
 | 
			
		||||
        if (valid) {
 | 
			
		||||
          if (this.form.ruleId != null) {
 | 
			
		||||
            updateCommision(this.form).then(response => {
 | 
			
		||||
              if (response.code === 200) {
 | 
			
		||||
                this.msgSuccess("修改成功");
 | 
			
		||||
                this.open = false;
 | 
			
		||||
                this.getList();
 | 
			
		||||
              }
 | 
			
		||||
            });
 | 
			
		||||
          } else {
 | 
			
		||||
            addCommision(this.form).then(response => {
 | 
			
		||||
              if (response.code === 200) {
 | 
			
		||||
                this.msgSuccess("新增成功");
 | 
			
		||||
                this.open = false;
 | 
			
		||||
                this.getList();
 | 
			
		||||
              }
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    /** 删除按钮操作 */
 | 
			
		||||
    handleDelete(row) {
 | 
			
		||||
      const ruleIds = row.ruleId || this.ids;
 | 
			
		||||
      this.$confirm('是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?', "警告", {
 | 
			
		||||
          confirmButtonText: "确定",
 | 
			
		||||
          cancelButtonText: "取消",
 | 
			
		||||
          type: "warning"
 | 
			
		||||
        }).then(function() {
 | 
			
		||||
          return delCommision(ruleIds);
 | 
			
		||||
        }).then(() => {
 | 
			
		||||
          this.getList();
 | 
			
		||||
          this.msgSuccess("删除成功");
 | 
			
		||||
        }).catch(function() {});
 | 
			
		||||
    },
 | 
			
		||||
    /** 导出按钮操作 */
 | 
			
		||||
    handleExport() {
 | 
			
		||||
      const queryParams = this.queryParams;
 | 
			
		||||
      this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
 | 
			
		||||
          confirmButtonText: "确定",
 | 
			
		||||
          cancelButtonText: "取消",
 | 
			
		||||
          type: "warning"
 | 
			
		||||
        }).then(function() {
 | 
			
		||||
          return exportCommision(queryParams);
 | 
			
		||||
        }).then(response => {
 | 
			
		||||
          this.download(response.msg);
 | 
			
		||||
        }).catch(function() {});
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
@@ -124,7 +124,7 @@
 | 
			
		||||
        <el-col :span="12">
 | 
			
		||||
          <el-form-item label="成交日期" prop="orderTime">
 | 
			
		||||
            <el-date-picker
 | 
			
		||||
              v-model="queryParams.orderTime"
 | 
			
		||||
              v-model="daterange"
 | 
			
		||||
              type="daterange"
 | 
			
		||||
              size="small"
 | 
			
		||||
              align="right"
 | 
			
		||||
@@ -407,6 +407,9 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
  import {listOrder, getOrder, delOrder, addOrder, updateOrder, exportOrder, getOptions} from "@/api/custom/order";
 | 
			
		||||
  import dayjs from 'dayjs';
 | 
			
		||||
  const beginTime = dayjs().startOf('month').format('YYYY-MM-DD');
 | 
			
		||||
  const endTime = dayjs().format('YYYY-MM-DD');
 | 
			
		||||
 | 
			
		||||
  export default {
 | 
			
		||||
    name: "Order",
 | 
			
		||||
@@ -430,6 +433,8 @@
 | 
			
		||||
        title: "",
 | 
			
		||||
        // 是否显示弹出层
 | 
			
		||||
        open: false,
 | 
			
		||||
        //
 | 
			
		||||
        daterange: [beginTime, endTime],
 | 
			
		||||
        // 收款方式字典
 | 
			
		||||
        payTypeIdOptions: [],
 | 
			
		||||
        // 售前字典
 | 
			
		||||
@@ -468,7 +473,6 @@
 | 
			
		||||
          plannerAssisId: null,
 | 
			
		||||
          operatorId: null,
 | 
			
		||||
          recommender: null,
 | 
			
		||||
          orderTime: null,
 | 
			
		||||
          reviewStatus: null,
 | 
			
		||||
        },
 | 
			
		||||
        // 表单参数
 | 
			
		||||
@@ -558,7 +562,7 @@
 | 
			
		||||
      /** 查询销售订单列表 */
 | 
			
		||||
      getList() {
 | 
			
		||||
        this.loading = true;
 | 
			
		||||
        listOrder(this.queryParams).then(response => {
 | 
			
		||||
        listOrder(this.addDateRange(this.queryParams, this.daterange)).then(response => {
 | 
			
		||||
          this.orderList = response.rows;
 | 
			
		||||
          this.total = response.total;
 | 
			
		||||
          this.loading = false;
 | 
			
		||||
@@ -639,6 +643,7 @@
 | 
			
		||||
      },
 | 
			
		||||
      /** 重置按钮操作 */
 | 
			
		||||
      resetQuery() {
 | 
			
		||||
        this.daterange = [beginTime, endTime];
 | 
			
		||||
        this.resetForm("queryForm");
 | 
			
		||||
        this.handleQuery();
 | 
			
		||||
      },
 | 
			
		||||
 
 | 
			
		||||
@@ -692,7 +692,7 @@ drop table if exists sys_commision;
 | 
			
		||||
create table sys_commision (
 | 
			
		||||
  rule_id          bigint(20)      not null auto_increment    comment '编号',
 | 
			
		||||
  user_id          bigint(20)                                 comment '用户ID',
 | 
			
		||||
  nick_name        varchar(30)     not null                   comment '用户昵称',
 | 
			
		||||
  post_id          bigint(20)                                 comment '职位ID',
 | 
			
		||||
  amount           decimal(10,2)                              comment '金额',
 | 
			
		||||
  rate             float                                      comment '分成比例',
 | 
			
		||||
  create_by        varchar(64)     default ''                 comment '创建者',
 | 
			
		||||
@@ -735,4 +735,10 @@ create table sys_order (
 | 
			
		||||
) engine=innodb auto_increment=1 comment = '销售订单表';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CREATE VIEW view_user_post AS (
 | 
			
		||||
  SELECT up.user_id, u.nick_name AS user_name, p.post_id, p.post_name
 | 
			
		||||
  FROM sys_post p, sys_user u, sys_user_post up
 | 
			
		||||
  WHERE p.post_id = up.post_id AND u.user_id = up.user_id
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								yarn.lock
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								yarn.lock
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 | 
			
		||||
# yarn lockfile v1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
dayjs@^1.9.1:
 | 
			
		||||
  version "1.9.1"
 | 
			
		||||
  resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.9.1.tgz#201a755f7db5103ed6de63ba93a984141c754541"
 | 
			
		||||
  integrity sha512-01NCTBg8cuMJG1OQc6PR7T66+AFYiPwgDvdJmvJBn29NGzIG+DIFxPLNjHzwz3cpFIvG+NcwIjP9hSaPVoOaDg==
 | 
			
		||||
		Reference in New Issue
	
	Block a user