xiaoyong931011
2021-03-15 f5bd8fc9b87627f38b015d4bc4e22b3353ec4d6d
分销员后台0315
2 files added
4 files modified
346 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoSettingAction.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoUserAction.java 84 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/UpdateTgjhDto.java 17 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/UpdateTgtpDto.java 17 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java 34 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-user.html 191 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoSettingAction.java
@@ -100,9 +100,6 @@
               }
           }
       }
       return result;
    }
    
zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoUserAction.java
@@ -10,7 +10,10 @@
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.StringUtils;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao;
import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao;
import com.matrix.system.fenxiao.dto.*;
@@ -22,9 +25,12 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController
@@ -39,6 +45,8 @@
    private BizUserDao bizUserDao;
    @Autowired
    private ShopSalesmanGradeDao shopSalesmanGradeDao;
    @Autowired
    private BusParameterSettingsDao busParameterSettingsDao;
    
    /**
     * 分销员详情页面信息
@@ -102,6 +110,82 @@
    }
    
    /**
     *推广图片
     */
    @ApiOperation(value = "推广图片")
    @PostMapping(value = "/updateTgtp")
    public @ResponseBody
    AjaxResult updateTgtp(@RequestBody UpdateTgtpDto updateTgtpDto) {
        return shopSalesmanApplyService.updateTgtp(updateTgtpDto);
    }
    /**
     *推广图片
     */
    @RequestMapping(value = "/loadTgtpSetting")
    public AjaxResult loadTgtpSetting() {
       AjaxResult result= AjaxResult.buildSuccessInstance("查询成功");
       SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
       Long companyId = user.getCompanyId();
       //推广文案
       String[] FXKGCode={FenxiaoSettingConstant.FX_TG_POSTER};
       String[] FXKGName={"推广图片"};
       List<FenXiaoSettingVo> fxkgRuleSettingsVo = getRuleSettingsVo(FXKGCode,FXKGName,companyId);
       result.putInMap("tgtp", fxkgRuleSettingsVo.get(0));
       return result;
    }
    /**
     *推广计划更新
     */
    @ApiOperation(value = "推广计划更新")
    @PostMapping(value = "/updateTgjh")
    public @ResponseBody
    AjaxResult updateTgjh(@RequestBody UpdateTgjhDto updateTgjhDto) {
        return shopSalesmanApplyService.updateTgjh(updateTgjhDto);
    }
    /**
     *查询推广计划
     */
    @RequestMapping(value = "/loadTgwaSetting")
    public AjaxResult loadTgwaSetting() {
       AjaxResult result= AjaxResult.buildSuccessInstance("查询成功");
       SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
       Long companyId = user.getCompanyId();
       //推广文案
       String[] FXKGCode={FenxiaoSettingConstant.FX_TG_PLAN};
       String[] FXKGName={"推广文案"};
       List<FenXiaoSettingVo> fxkgRuleSettingsVo = getRuleSettingsVo(FXKGCode,FXKGName,companyId);
       result.putInMap("tgwa", fxkgRuleSettingsVo.get(0));
       return result;
    }
    /**
     *获取对应的规则设置数据
     * @param ArrayCode
     * @param ArrayName
     * @param companyId
     * @return
     */
    private List<FenXiaoSettingVo> getRuleSettingsVo(String[] ArrayCode,String[] ArrayName,Long companyId){
        List<BusParameterSettings> dataList = busParameterSettingsDao.selectByCodesAndCompanyId(Arrays.asList(ArrayCode), companyId);
        List<FenXiaoSettingVo> scoreRuleSettingsVos=new ArrayList<FenXiaoSettingVo>();
        int index=0;
        for (BusParameterSettings item:dataList){
            FenXiaoSettingVo paramVo=new FenXiaoSettingVo();
            BeanUtils.copyProperties(item,paramVo);
            paramVo.setParamName(ArrayName[index]);
            scoreRuleSettingsVos.add(paramVo);
            index++;
        }
        return scoreRuleSettingsVos;
    }
    /**
     * 分佣方案
     */
    @ApiOperation(value = "查询分佣方案")
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/UpdateTgjhDto.java
New file
@@ -0,0 +1,17 @@
package com.matrix.system.fenxiao.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "UpdateTgjhDto", description = "参数")
public class UpdateTgjhDto {
    @ApiModelProperty(value = "方案名称")
    private String tgfa;
    @ApiModelProperty(hidden = true)
    private Long companyId;
}
zq-erp/src/main/java/com/matrix/system/fenxiao/dto/UpdateTgtpDto.java
New file
@@ -0,0 +1,17 @@
package com.matrix.system.fenxiao.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "UpdateTgjhDto", description = "参数")
public class UpdateTgtpDto {
    @ApiModelProperty(value = "方案名称")
    private String imageUrl;
    @ApiModelProperty(hidden = true)
    private Long companyId;
}
zq-erp/src/main/java/com/matrix/system/fenxiao/service/ShopSalesmanApplyService.java
@@ -26,6 +26,8 @@
import com.matrix.system.fenxiao.dto.ShopSalesmanDetailDto;
import com.matrix.system.fenxiao.dto.UnbundlingSaleManDto;
import com.matrix.system.fenxiao.dto.UpdateFyfaDto;
import com.matrix.system.fenxiao.dto.UpdateTgjhDto;
import com.matrix.system.fenxiao.dto.UpdateTgtpDto;
import com.matrix.system.fenxiao.entity.ShopSalesmanApply;
import com.matrix.system.fenxiao.entity.ShopSalesmanGrade;
import com.matrix.system.fenxiao.vo.FyfaManageVo;
@@ -326,6 +328,14 @@
        if(StrUtil.isEmpty(name)) {
            return AjaxResult.buildFailInstance("请输入方案名称");
        }
        Double sealesCommission = updateFyfaDto.getSealesCommission();
        if(StrUtil.isEmpty(sealesCommission.toString())) {
            return AjaxResult.buildFailInstance("请输入正确的推广提成");
        }
        Double invitationCommission = updateFyfaDto.getInvitationCommission();
        if(StrUtil.isEmpty(invitationCommission.toString())) {
            return AjaxResult.buildFailInstance("请输入正确的邀请提成");
        }
        //设置用户公司ID
        QueryUtil.setQueryLimitCom(updateFyfaDto);
        selectById.setCompanyId(updateFyfaDto.getCompanyId());
@@ -336,6 +346,30 @@
        shopSalesmanGradeDao.updateById(selectById);
        return AjaxResult.buildFailInstance("操作成功");
    }
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult updateTgjh(UpdateTgjhDto updateTgjhDto) {
        //设置用户公司ID
        QueryUtil.setQueryLimitCom(updateTgjhDto);
        //获取推广计划的Param
        Long companyId = updateTgjhDto.getCompanyId();
        BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_PLAN, companyId);
        busParameterSettings.setParamValue3(updateTgjhDto.getTgfa());
        busParameterSettingsDao.updateByModel(busParameterSettings);
        return AjaxResult.buildFailInstance("保存成功");
    }
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult updateTgtp(UpdateTgtpDto updateTgtpDto) {
        //设置用户公司ID
        QueryUtil.setQueryLimitCom(updateTgtpDto);
        //获取推广计划的Param
        Long companyId = updateTgtpDto.getCompanyId();
        BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_TG_POSTER, companyId);
        busParameterSettings.setParamValue(updateTgtpDto.getImageUrl());
        busParameterSettingsDao.updateByModel(busParameterSettings);
        return AjaxResult.buildFailInstance("保存成功");
    }
    
    
zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-user.html
@@ -29,6 +29,29 @@
            margin: 0px 0px 10px 0px;
            text-align: right;
        }
        .avatar-uploader .el-upload {
            border: 1px dashed #d9d9d9;
            border-radius: 6px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        .avatar-uploader .el-upload:hover {
            border-color: #409EFF;
        }
        .avatar-uploader-icon {
            font-size: 28px;
            color: #8c939d;
            width: 178px;
            height: 178px;
            line-height: 178px;
            text-align: center;
        }
        .avatar {
            width: 178px;
            height: 178px;
            display: block;
        }
    </style>
</head>
@@ -76,7 +99,7 @@
                                        type="selection">
                                </el-table-column>
                                <el-table-column
                                        label="分销员">
                                        label="分销员" width="120">
                                    <template slot-scope="scope">
                                        <img :src="scope.row.avatarUrl" width="40" height="40" class="head_pic"/>
                                        {{scope.row.nickname}}
@@ -84,11 +107,11 @@
                                </el-table-column>
                                <el-table-column
                                        prop="parentUser"
                                        label="邀请人" width="100">
                                        label="邀请人">
                                </el-table-column>
                                <el-table-column
                                        prop="lowerLevelNum"
                                        label="下级客户数" width="100">
                                        label="下级客户数">
                                </el-table-column>
                                <el-table-column
                                        prop="totalRevenue"
@@ -164,14 +187,14 @@
                                    prop="sealesCommission"
                                    label="推广提成 %">
                                <template slot-scope="scope">
                                    <el-input class="edit-input" v-model="scope.row.sealesCommission" oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="推广提成 %"></el-input>
                                    <el-input class="edit-input" v-model="scope.row.sealesCommission" oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="推广提成"></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    prop="invitationCommission"
                                    label="邀请提成 %">
                                <template slot-scope="scope">
                                    <el-input class="edit-input" v-model="scope.row.invitationCommission" oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="邀请提成 %"></el-input>
                                    <el-input class="edit-input" v-model="scope.row.invitationCommission" oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="邀请提成"></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column
@@ -206,34 +229,32 @@
                </el-tab-pane>
                <el-tab-pane label="推广文案" name="third">
                    <el-row>
                        <script style="width: 100%; height: 500px" id="description" name="description"
                                type="text/plain"></script>
                    <p class="el-big-title">文案描述</p>
                    <el-row justify="center" type="flex">
                            <script style="height: 400px;width: 375px;" id="description" name="description"
                                    type="text/plain">
                            </script>
                    </el-row>
                    <el-row justify="center" type="flex">
                        <el-button type="primary" @click="submit()">保存</el-button>
                        <el-button type="primary" size="mini" @click="wamsSubmit()">保存</el-button>
                    </el-row>
                </el-tab-pane>
                <el-tab-pane label="分享图片上传" name="fourth">
                    <el-row>
                        <div class="ibox-content">
                            <form class="form-horizontal" id="dataform"
                                  onsubmit="javascripr:return false;">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">门店照片</label>
                                    <div class="col-sm-8">
                                        <input autocomplete="off"   v-model="fxtp.paramValue" name="shopImag" id="info6"
                                               class="form-control  upload-input" type="text" /> <a
                                            class="btn btn-primary radius upload-a">选择图片
                                    </a>
                                    </div>
                                </div>
                                <el-row justify="center" type="flex">
                                    <el-button type="primary" @click="submittp(paramValue)">保存</el-button>
                                </el-row>
                            </form>
                        </div>
                <el-tab-pane label="推广图片" name="fourth">
                    <p class="el-big-title">上传图片</p>
                    <el-row justify="center" type="flex">
                        <el-upload
                                class="avatar-uploader"
                                action="/admin/multipleUploadFile/doUpload"
                                :show-file-list="false"
                                :on-success="handleAvatarSuccess"
                                :before-upload="beforeAvatarUpload">
                            <img v-if="imageUrl" :src="imageUrl" class="avatar">
                            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                        </el-upload>
                    </el-row>
                    <el-row justify="center" type="flex">
                        <el-button type="primary" size="mini" @click="tgtpSubmit()">保存</el-button>
                    </el-row>
                </el-tab-pane>
@@ -253,20 +274,19 @@
<script>
    //百度编辑器
    MUI.initImgUpload(".upload-input");
    var ue = {};
    var ue = {
        initialFrameWidth :750
    };
    var app = new Vue({
        el: '#app',
        data: {
            height:'calc(100vh - 240px)',
            fxy:[],
            fenxiaoGrade: "",
            tgwa: "",
            activeName: 'first',
            multipleSelection: [],
            fxtp:{},
            mdjf:[],
            scjf:[],
            fenxiaoGrade: "",
            //推广文案
            tgwa: {},
            //图片上传
            imageUrl: '',
            //分佣方案
            fyfaList:{
                rows:[],
@@ -274,7 +294,6 @@
                pageSize:10,
                currentPage:1,
            },
            //分销员管理
            shenheAgreeType : 2,
            shenheDisagreeType : 3,
@@ -300,16 +319,12 @@
                pageSize:10,
                currentPage:1,
            },
            height:'calc(100vh - 240px)',
        },
        created: function () {
            this.loadInfo();
            window.addEventListener("keydown", this.keydown);
            //初始化编辑器
            ue = UE.getEditor('description');
            //百度编辑器
            MUI.initImgUpload(".upload-input");
        },
        mounted: function () {
        },
@@ -319,25 +334,84 @@
                let _this = this;
                _this.loadParamSetting();
                _this.loadFyfaSetting();
                _this.loadTgwaSetting();
                _this.loadTgtpSetting();
                _this.getSalemanGradeList();
            },
            submittp(paramValue) {
                alert(paramValue);
            //推广文案
            loadTgwaSetting() {
                let _this = this;
                AjaxProxy.requst({
                    app: _this,
                    data:[],
                    url: basePath + '/fenXiao/fenXiaoUser/loadTgwaSetting',
                    callback: function (data) {
                        _this.tgwa = data.mapInfo.tgwa;
                        var ue = UE.getEditor('description');
                        ue.ready(function() {//编辑器初始化完成再赋值
                            ue.setContent(_this.tgwa.paramValue3);  //赋值给UEditor
                        });
                    }
                });
            },
            toggleSelection(rows) {
                if (rows) {
                    rows.forEach(row => {
                        this.$refs.multipleTable.toggleRowSelection(row);
                    });
                } else {
                    this.$refs.multipleTable.clearSelection();
            wamsSubmit(){
                let _this = this;
                let tgfa = ue.getContent();
                let data= {
                    tgfa:tgfa,
                };
                AjaxProxy.requst({
                    app: _this,
                    data:data,
                    url: basePath + '/fenXiao/fenXiaoUser/updateTgjh',
                    callback: function (data) {
                        _this.$message.success(data.info);
                        _this.loadTgwaSetting();
                    }
                });
            },
            //图片上传
            loadTgtpSetting() {
                let _this = this;
                AjaxProxy.requst({
                    app: _this,
                    data:[],
                    url: basePath + '/fenXiao/fenXiaoUser/loadTgtpSetting',
                    callback: function (data) {
                        _this.imageUrl = data.mapInfo.tgtp.paramValue;
                    }
                });
            },
            tgtpSubmit(){
                let _this = this;
                let imageUrl = _this.imageUrl;
                let data= {
                    imageUrl:imageUrl,
                };
                AjaxProxy.requst({
                    app: _this,
                    data:data,
                    url: basePath + '/fenXiao/fenXiaoUser/updateTgtp',
                    callback: function (data) {
                        _this.$message.success(data.info);
                        _this.loadTgtpSetting();
                    }
                });
            },
            handleAvatarSuccess(res, file) {
                this.imageUrl = URL.createObjectURL(file.raw);
            },
            beforeAvatarUpload(file) {
                const isJPG = file.type === 'image/jpeg';
                const isLt2M = file.size / 1024 / 1024 < 2;
                if (!isJPG) {
                    this.$message.error('上传头像图片只能是 JPG 格式!');
                }
            },
            handleSelectionChange(val) {
                this.multipleSelection = val;
            },
            handleClick(row) {
                console.log(row);
                if (!isLt2M) {
                    this.$message.error('上传头像图片大小不能超过 2MB!');
                }
                return isJPG && isLt2M;
            },
            //分佣方案
            loadFyfaSetting() {
@@ -614,9 +688,6 @@
                        _this.loadParamSetting();
                    }
                });
            },
            submit() {
            }
        }
    })