| | |
| | | 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 |
| | |
| | | cardInfo : "", |
| | | loginUser : "", |
| | | rechargeMoney : 0, |
| | | achieveTypeList : [], |
| | | payMethods: [{ |
| | | value: '现金支付', |
| | | img: '/images/pay/cash.png', |
| | |
| | | userList: [], |
| | | treeSelect : [], |
| | | payMoneys : [], |
| | | order:{}, |
| | | printPaper : false, |
| | | }, |
| | | created : function() { |
| | |
| | | } |
| | | }); |
| | | |
| | | //获取登录用户信息 |
| | | |
| | | // 业绩类型 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/getLoginUser', |
| | | url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX', |
| | | callback: function (data) { |
| | | _this.loginUser = data.mapInfo.user; |
| | | _this.achieveTypeList = data.rows; |
| | | |
| | | _this.achieveList.push({ |
| | | saleId: _this.loginUser.suId, |
| | | achieveMoney: 0, |
| | | commission : 0, |
| | | isShare: false, |
| | | //获取登录用户信息 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/getLoginUser', |
| | | callback: function (data) { |
| | | _this.loginUser = data.mapInfo.user; |
| | | |
| | | _this.achieveList.push({ |
| | | saleId: _this.loginUser.suId, |
| | | 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() { |
| | |
| | | _this.achieveList.forEach(achieve => { |
| | | let achieveNew = { |
| | | beaultId: achieve.saleId, |
| | | t1: achieve.achieveMoney, |
| | | t3: '现金业绩', |
| | | goodsCash: achieve.goodsCash, |
| | | achieveType: achieve.achieveType, |
| | | projPercentage: achieve.commission, |
| | | payMethod:"现金", |
| | | }; |
| | | achaeveList.push(achieveNew); |
| | | }) |
| | | _this.cardInfo.bjmoney = _this.rechargeMoney; |
| | | _this.cardInfo.achaeveList = achaeveList; |
| | | let url = basePath + "/admin/moneyCardUse/cz"; |
| | | if (_this.checkAchieveMoney()) { |
| | | let url = basePath + "/admin/moneyCardUse/cz"; |
| | | |
| | | console.log(_this.cardInfo); |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | data: _this.cardInfo, |
| | | url: url, |
| | | callback: function (data) { |
| | | if (_this.printPaper) { |
| | | _this.print(); |
| | | console.log(_this.cardInfo); |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | data: _this.cardInfo, |
| | | url: url, |
| | | callback: function (data) { |
| | | _this.order.id = data.mapInfo.orderId; |
| | | |
| | | if (_this.printPaper) { |
| | | _this.$message.success(data.info); |
| | | _this.print(); |
| | | } else { |
| | | _this.$message.success({ |
| | | message : data.info, |
| | | duration : 1000, |
| | | onClose() { |
| | | _this.closeFrame(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if(parent.myGrid) { |
| | | parent.myGrid.serchData(); |
| | | } |
| | | |
| | | if (parent.app) { |
| | | parent.app.vipInfoFn(); |
| | | } |
| | | |
| | | // _this.closeFrame(); |
| | | } |
| | | |
| | | if(parent.myGrid) { |
| | | parent.myGrid.serchData(); |
| | | } |
| | | |
| | | if (parent.app) { |
| | | parent.app.vipInfoFn(); |
| | | } |
| | | |
| | | _this.closeFrame(); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | cancelSubmit() { |
| | | this.closeFrame(); |
| | |
| | | title: "打印订单", |
| | | area: ['250px', '550px'], |
| | | maxmin: true, |
| | | content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + this.order.id], |
| | | content: [basePath + '/admin/order/printOrder?id=' + this.order.id], |
| | | cancel: function (index, layero) { |
| | | _this.closeFram(); |
| | | _this.closeFrame(); |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | 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; |
| | | console.log(this.achieveList); |
| | | let rechargeMoney=parseFloat(_this.rechargeMoney); |
| | | 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); |
| | | } |
| | | }else{ |
| | | this.$message.error("业绩分配金额请填写数字"); |
| | | isOk=false; |
| | | return; |
| | | } |
| | | }; |
| | | for(money in jsqMap ){ |
| | | if(money > rechargeMoney) { |
| | | this.$message.error("业绩分配金额大于支付金额"); |
| | | isOk = false; |
| | | return; |
| | | } |
| | | } |
| | | |
| | | |
| | | console.log("isOk",isOk); |
| | | return isOk; |
| | | }, |
| | | } |
| | | }); |