|
@@ -59,7 +59,8 @@
|
|
|
</el-select>
|
|
|
<span>每消费</span>
|
|
|
<el-input-number v-model="item.saleAmt" size="small" :min="0"/>
|
|
|
- <span>元</span>
|
|
|
+ <span v-if="item.ruleType=='3'">L</span>
|
|
|
+ <span v-else>元</span>
|
|
|
<el-input-number v-model="item.integral" size="small" :min="0"/>
|
|
|
<span>积分</span>
|
|
|
</el-form-item>
|
|
@@ -101,6 +102,11 @@
|
|
|
<el-input-number v-model="item.integral" size="small" :min="0"/>
|
|
|
<span>积分</span>
|
|
|
</el-form-item>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ @click="delNoil()"
|
|
|
+ size="small"
|
|
|
+ >清空非油品积分规则</el-button>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -218,8 +224,7 @@
|
|
|
</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>
|
|
|
+ <el-button type="primary" @click="submitForm" :disabled="flage" >确 定</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -261,6 +266,8 @@ name: "ruleDetail",
|
|
|
ruleForm:{
|
|
|
imgFileList:[]
|
|
|
},
|
|
|
+ flage:false,
|
|
|
+ num :0,
|
|
|
pickerTime:"",
|
|
|
dialogVisible: false,
|
|
|
// 是否显示弹出层
|
|
@@ -306,43 +313,7 @@ name: "ruleDetail",
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- //判断是否是做修改
|
|
|
- if(this.$route.query.stationId!=null && this.$route.query.stationId!="" && this.$route.query.parentId !=null &&this.$route.query.parentId !=""){
|
|
|
- this.queryParams.stationId=this.$route.query.stationId;
|
|
|
- let id=this.$route.query.parentId;
|
|
|
- if(id!=null && id != ""){
|
|
|
- getRule(id).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- if(this.form.notOilList.length==0 ){
|
|
|
- this.form.notOilList=[{}];
|
|
|
- }
|
|
|
- if(this.form.itemsDetail.length==0 ){
|
|
|
- this.form.itemsDetail=[{}];
|
|
|
- }
|
|
|
- let datepicker = this.form.datePicker;
|
|
|
- if(datepicker=="1"){
|
|
|
- this.workDaytrue=true;
|
|
|
- if(this.form.datePickerTime!=null){
|
|
|
- this.collectClickWorkDay= this.form.datePickerTime.split(',').map(parseFloat);
|
|
|
- }
|
|
|
- }else if(datepicker=="2"){
|
|
|
- this.moonDaytrue=true;
|
|
|
- if(this.form.datePickerTime!=null){
|
|
|
- this.collectClickCalendar= this.form.datePickerTime.split(',').map(parseFloat);
|
|
|
- }
|
|
|
- }else{
|
|
|
- this.datetrue=true;
|
|
|
- if(this.form.datePickerTime!=null){
|
|
|
- this.pickerTime= this.form.datePickerTime.split(',');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- oilNameInfo(this.queryParams).then(response => {
|
|
|
- this.oilNameOptions = response.rows;
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- this.getDicts("is_flag").then(response => {
|
|
|
+ this.getDicts("status").then(response => {
|
|
|
this.integralFlagOptions = response.data;
|
|
|
});
|
|
|
this.getDicts("rule_type").then(response => {
|
|
@@ -369,35 +340,45 @@ name: "ruleDetail",
|
|
|
this.deptInfo = response.data;
|
|
|
if(this.deptInfo.jiBie==2){
|
|
|
this.form.stationId=this.deptInfo.deptId;
|
|
|
- this.form.stationNanme=this.deptInfo.deptName;
|
|
|
+ this.form.stationName=this.deptInfo.deptName;
|
|
|
this.queryParams.stationId=this.deptInfo.deptId;
|
|
|
listRuleOne(this.queryParams).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- if(response.data.hasOwnProperty('notOilList') && this.form.notOilList.length==0 ){
|
|
|
- this.form.notOilList=[{}];
|
|
|
- }
|
|
|
- if(response.data.hasOwnProperty('itemsDetail') &&this.form.itemsDetail.length==0 ){
|
|
|
- this.form.itemsDetail=[{}];
|
|
|
- }else{
|
|
|
- this.rowsnum= this.form.itemsDetail.length-1;
|
|
|
- let itemDetail = this.form.itemsDetail;
|
|
|
- this.sjfa(itemDetail);
|
|
|
- }
|
|
|
- let datepicker = this.form.datePicker;
|
|
|
- if(datepicker=="1"){
|
|
|
- this.workDaytrue=true;
|
|
|
- if(this.form.datePickerTime!=null){
|
|
|
- this.collectClickWorkDay= this.form.datePickerTime.split(',').map(parseFloat);
|
|
|
+ if(response.hasOwnProperty('data')){
|
|
|
+ this.form = response.data;
|
|
|
+ if(response.data.hasOwnProperty('notOilList')){
|
|
|
+ if(this.form.notOilList.length==0){
|
|
|
+ this.form.notOilList=[{}];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.form.notOilList=[{}];
|
|
|
}
|
|
|
- }else if(datepicker=="2"){
|
|
|
- this.moonDaytrue=true;
|
|
|
- if(this.form.datePickerTime!=null){
|
|
|
- this.collectClickCalendar= this.form.datePickerTime.split(',').map(parseFloat);
|
|
|
+ if(response.data.hasOwnProperty('itemsDetail') ){
|
|
|
+ if(this.form.itemsDetail.length==0){
|
|
|
+ this.form.itemsDetail=[{}];
|
|
|
+ }else{
|
|
|
+ let itemDetail = this.form.itemsDetail;
|
|
|
+ this.sjfa(itemDetail);
|
|
|
+ this.rowsnum= this.form.itemsDetail.length-1;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.form.itemsDetail=[{}];
|
|
|
}
|
|
|
- }else{
|
|
|
- this.datetrue=true;
|
|
|
- if(this.form.datePickerTime!=null){
|
|
|
- this.pickerTime= this.form.datePickerTime.split(',');
|
|
|
+ let datepicker = this.form.datePicker;
|
|
|
+ if(datepicker=="1"){
|
|
|
+ this.workDaytrue=true;
|
|
|
+ if(this.form.datePickerTime!=null){
|
|
|
+ this.collectClickWorkDay= this.form.datePickerTime.split(',').map(parseFloat);
|
|
|
+ }
|
|
|
+ }else if(datepicker=="2"){
|
|
|
+ this.moonDaytrue=true;
|
|
|
+ if(this.form.datePickerTime!=null){
|
|
|
+ this.collectClickCalendar= this.form.datePickerTime.split(',').map(parseFloat);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.datetrue=true;
|
|
|
+ if(this.form.datePickerTime!=null){
|
|
|
+ this.pickerTime= this.form.datePickerTime.split(',');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -409,23 +390,25 @@ name: "ruleDetail",
|
|
|
}
|
|
|
});
|
|
|
//查看当前积分设置
|
|
|
- this.queryRule.stationId= this.$store.selectDeptId;
|
|
|
- if(this.queryRule.stationId==null || this.queryRule.stationId==""){
|
|
|
- this.queryRule.stationId =this.$store.state.user.deptId;
|
|
|
+ this.queryRule.stationId= this.$store.selectDeptId;
|
|
|
+ if(this.queryRule.stationId==null || this.queryRule.stationId==""){
|
|
|
+ this.queryRule.stationId =this.$store.state.user.deptId;
|
|
|
+ }
|
|
|
+ getStationPay(this.queryRule).then(response => {
|
|
|
+ this.ruleForm = response.data;
|
|
|
+ if(this.ruleForm.integralFlag == ""){
|
|
|
+ this.ruleForm.integralFlag ="0";
|
|
|
}
|
|
|
- getStationPay(this.queryRule).then(response => {
|
|
|
- this.ruleForm = response.data;
|
|
|
- console.log("this.ruleForm",this.ruleForm);
|
|
|
- if(this.ruleForm.integralFlag == ""){
|
|
|
- this.ruleForm.integralFlag ="0";
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
async sjfa(itemDetail ){
|
|
|
for(let j = 0; j < itemDetail.length; j++) {
|
|
|
this.queryParams.stationId = this.form.stationId;
|
|
|
this.queryParams.oilName = itemDetail[j].oilName;
|
|
|
+ if(itemDetail[j].gread ===""){
|
|
|
+ itemDetail[j].gread = "所有人";
|
|
|
+ }
|
|
|
const response = await gradeList(this.queryParams);
|
|
|
response.rows.push({grade:"所有人"});
|
|
|
this.gradeOptions.push(response.rows);
|
|
@@ -447,6 +430,12 @@ name: "ruleDetail",
|
|
|
del(index) {
|
|
|
this.form.itemsDetail.splice(index, 1);
|
|
|
this.rowsnum=this.form.itemsDetail.length-1;
|
|
|
+ if(this.form.itemsDetail.length<=0){
|
|
|
+ this.addItem();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ delNoil(){
|
|
|
+ this.form.notOilList =[{}];
|
|
|
},
|
|
|
queryreset() {
|
|
|
this.queryParams={
|
|
@@ -477,8 +466,8 @@ name: "ruleDetail",
|
|
|
this.queryParams.stationId = this.form.stationId;
|
|
|
this.queryParams.oilName=obj.oilName;
|
|
|
gradeList(this.queryParams).then(response => {
|
|
|
- response.rows.push({grade:"所有人"});
|
|
|
const temp = [...this.gradeOptions]
|
|
|
+ response.rows.push({grade:"所有人"});
|
|
|
temp[index] = response.rows;
|
|
|
this.gradeOptions = temp;
|
|
|
});
|
|
@@ -521,9 +510,9 @@ name: "ruleDetail",
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
if (this.form.id != null) {
|
|
|
- console.log("notOilList",this.form.notOilList);
|
|
|
- if(this.form.notOilList!=null&&this.form.notOilList.length==0 && this.form.notOilList[0].hasOwnProperty(saleAmt)){
|
|
|
- if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
|
|
|
+ if(this.form.notOilList!=null&&this.form.notOilList.length==0 ){
|
|
|
+ }else{
|
|
|
+ if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
|
|
|
this.form.notOilList=[{}];
|
|
|
}
|
|
|
}
|
|
@@ -540,11 +529,7 @@ name: "ruleDetail",
|
|
|
if(itemsDetail!=null&&itemsDetail.length>1){
|
|
|
for (var i = 0; i < itemsDetail.length; i++) {
|
|
|
for (var j = i + 1; j < itemsDetail.length; j++) {
|
|
|
- console.log("i--oilName:",itemsDetail[i].oilName);
|
|
|
- console.log("J--oilName:",itemsDetail[j].oilName);
|
|
|
if (itemsDetail[i].oilName == itemsDetail[j].oilName) {
|
|
|
- console.log("i--oilName:",itemsDetail[i].gread);
|
|
|
- console.log("J--oilName:",itemsDetail[j].gread);
|
|
|
if(itemsDetail[i].gread==itemsDetail[j].gread){
|
|
|
flag=false;
|
|
|
break;
|
|
@@ -572,38 +557,45 @@ name: "ruleDetail",
|
|
|
this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
|
|
|
}
|
|
|
} else {
|
|
|
- let datepicker = this.form.datePicker;
|
|
|
- if(datepicker=="1"){
|
|
|
- this.form.datePickerTime=this.collectClickWorkDay.toString();
|
|
|
- }else if(datepicker=="2"){
|
|
|
- this.form.datePickerTime=this.collectClickCalendar.toString();
|
|
|
- }else{
|
|
|
- this.form.datePickerTime = this.pickerTime.toString();
|
|
|
- }
|
|
|
- if(this.form.notOilList!=null&&this.form.notOilList.length>0||this.form.notOilList[0].hasOwnProperty(saleAmt)){
|
|
|
- if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
|
|
|
- this.form.notOilList=[];
|
|
|
+ if(this.num===0){
|
|
|
+ let datepicker = this.form.datePicker;
|
|
|
+ if(datepicker=="1"){
|
|
|
+ this.form.datePickerTime=this.collectClickWorkDay.toString();
|
|
|
+ }else if(datepicker=="2"){
|
|
|
+ this.form.datePickerTime=this.collectClickCalendar.toString();
|
|
|
+ }else{
|
|
|
+ this.form.datePickerTime = this.pickerTime.toString();
|
|
|
}
|
|
|
- }
|
|
|
- let itemsDetail =this.form.itemsDetail;
|
|
|
- let flag= true;
|
|
|
- if(itemsDetail!=null&&itemsDetail.length>0){
|
|
|
- for (var i = 0; i < itemsDetail.length; i++) {
|
|
|
- for (var j = i + 1; j < itemsDetail.length; j++) {
|
|
|
- if (itemsDetail[i].ruleType == itemsDetail[j].ruleType &&itemsDetail[i].oilName == itemsDetail[j].oilName&& itemsDetail[i].gread==itemsDetail[j].gread) {
|
|
|
- flag=false;
|
|
|
- break;
|
|
|
+ if(this.form.notOilList!=null&&this.form.notOilList.length>0||this.form.notOilList[0].hasOwnProperty(saleAmt)){
|
|
|
+ if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
|
|
|
+ this.form.notOilList=[{}];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.form.notOilList=[{}];
|
|
|
+ }
|
|
|
+ let itemsDetail =this.form.itemsDetail;
|
|
|
+ let flag= true;
|
|
|
+ if(itemsDetail!=null&&itemsDetail.length>0){
|
|
|
+ for (var i = 0; i < itemsDetail.length; i++) {
|
|
|
+ for (var j = i + 1; j < itemsDetail.length; j++) {
|
|
|
+ if (itemsDetail[i].ruleType == itemsDetail[j].ruleType &&itemsDetail[i].oilName == itemsDetail[j].oilName&& itemsDetail[i].gread==itemsDetail[j].gread) {
|
|
|
+ flag=false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (flag) break;
|
|
|
+ if (flag) break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if(flag){
|
|
|
- addRule(this.form).then(response => {
|
|
|
- this.msgSuccess("新增成功");
|
|
|
- });
|
|
|
+ if(flag){
|
|
|
+ addRule(this.form).then(response => {
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
|
|
|
+ }
|
|
|
+ this.num=this.num+1;
|
|
|
}else{
|
|
|
- this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
|
|
|
+ this.msgSuccess("已新增成功!如需修改请刷新页面");
|
|
|
}
|
|
|
}
|
|
|
}
|