Helius
2021-03-12 816f0844bf9d14a4e1fba967cee931ebc1fb9cc2
modify cz-form
1 files modified
84 ■■■■■ changed files
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html 84 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
@@ -101,9 +101,22 @@
                            width="50">
                    </el-table-column>
                    <el-table-column
                            label="业绩类型" width="150">
                        <template slot-scope="scope">
                            <el-select v-model="scope.row.achieveType" @change="calculationAchieve" placeholder="请选择业绩类型">
                                <el-option
                                        v-for="item in achieveTypeList"
                                        :key="item.value"
                                        :label="item.value"
                                        :value="item.value">
                                </el-option>
                            </el-select>
                        </template>
                    </el-table-column>
                    <el-table-column
                            label="业绩" width="100">
                        <template slot-scope="scope">
                            <el-input v-model="scope.row.achieveMoney"></el-input>
                            <el-input @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input>
                        </template>
                    </el-table-column>
                    <el-table-column
@@ -169,6 +182,7 @@
            cardInfo : "",
            loginUser : "",
            rechargeMoney : 0,
            achieveTypeList : [],
            payMethods: [{
                value: '现金支付',
                img: '/images/pay/cash.png',
@@ -219,6 +233,14 @@
                }
            });
            // 业绩类型
            AjaxProxy.requst({
                app: _this,
                url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX',
                callback: function (data) {
                    _this.achieveTypeList = data.rows;
            //获取登录用户信息
            AjaxProxy.requst({
                app: _this,
@@ -228,19 +250,23 @@
                    _this.achieveList.push({
                        saleId: _this.loginUser.suId,
                        achieveMoney: 0,
                                goodsCash: 0,
                                achieveType : _this.achieveTypeList[0].value,
                        commission : 0,
                        isShare: false,
                    });
                }
            });
                }
            });
        },
        methods : {
            //修改充值金额同步修改业绩
            changeRechargeMoney(){
                let aMoeny=(this.rechargeMoney/this.achieveList.length).toFixed(2);
                this.achieveList.forEach(item=>{
                    item.achieveMoney=aMoeny;
                    item.goodsCash=aMoeny;
                });
            },
            submitRecharge() {
@@ -280,14 +306,15 @@
                _this.achieveList.forEach(achieve => {
                    let achieveNew = {
                        beaultId: achieve.saleId,
                        t1: achieve.achieveMoney,
                        t3: '现金业绩',
                        goodsCash: achieve.goodsCash,
                        achieveType: achieve.achieveType,
                        projPercentage: achieve.commission,
                    };
                    achaeveList.push(achieveNew);
                })
                _this.cardInfo.bjmoney = _this.rechargeMoney;
                _this.cardInfo.achaeveList = achaeveList;
                if (_this.checkAchieveMoney()) {
                let url = basePath + "/admin/moneyCardUse/cz";
                console.log(_this.cardInfo);
@@ -311,6 +338,7 @@
                        _this.closeFrame();
                    }
                });
                }
            },
            cancelSubmit() {
                this.closeFrame();
@@ -379,10 +407,56 @@
                row2 = JSON.parse(JSON.stringify(row));
                row2.isShare = true;
                this.achieveList.push(row2);
                this.calculationAchieve();
            },
            calculationAchieve() {
                let _this = this;
                let jsqMap = {};
                this.achieveList.forEach(achieve=>{
                    key=achieve.achieveType;
                    if(!jsqMap[key]) {
                        jsqMap[key]=1;
                    } else {
                        jsqMap[key]++;
                    }
                });
                this.achieveList.forEach(achieve=>{
                    key = achieve.achieveType;
                    achieve.goodsCash=(_this.rechargeMoney/jsqMap[key]).toFixed(2);
                });
            },
            //删除业绩
            delAchieve(index, row) {
                this.achieveList.splice(index, 1);
                this.calculationAchieve();
            },
            checkAchieveMoney(){
                console.log("校验业绩是否大于订单收款金额");
                let _this = this;
                let jsqMap={};
                let isOk=true;
                for(let i=0 ; i< this.achieveList.length; i++){
                    let achieve=this.achieveList[i];
                    if(!isNaN(achieve.goodsCash)  ){
                        key=achieve.achieveType;
                        if(!jsqMap[key]){
                            jsqMap[key]=parseFloat(achieve.goodsCash);
                        }else{
                            jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash);
                        }
                        if(jsqMap[key]>_this.rechargeMoney) {
                            this.$message.error("业绩分配金额大于支付金额");
                            isOk = false;
                            return;
                        }
                    }else{
                        this.$message.error("业绩分配金额请填写数字");
                        isOk=false;
                        return;
                    }
                };
                console.log("isOk",isOk);
                return isOk;
            },
        }
    });