From a1fa84b13ffdf8f9ba9f474466bbe915d27522c7 Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Thu, 15 Apr 2021 23:20:24 +0800
Subject: [PATCH] modify
---
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html | 141 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 108 insertions(+), 33 deletions(-)
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
index 12f1b8c..d3837fd 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
+++ b/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,28 +233,40 @@
}
});
- //获取登录用户信息
+
+ // 业绩类型
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() {
@@ -280,37 +306,40 @@
_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) {
+ if (_this.printPaper) {
+ _this.print();
+ }
+
+ 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();
@@ -379,10 +408,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;
},
}
});
--
Gitblit v1.9.1