Commit ac32d32a authored by 吴春's avatar 吴春

1

parent 6b967c80
......@@ -82,21 +82,34 @@
</style>
<template>
<div class="flexOne">
<div style="text-align:right;padding:10px">
<div class="query-box">
<ul>
<li> <span><em>{{$t('objFill.nianfen')}}</em>
<YearLimit :clearable="false" :dateTime="year" @change="getTime"></YearLimit>
</span></li>
<li> <div style="text-align:right;">
<input type="button" class="hollowFixedBtn" name="" id="" :value="$t('pub.searchBtn')" @click="getList()" />
<input type="button" class="hollowFixedBtn" :value="$t('pub.addBtn')" @click="add"/>
</div>
</div></li>
</ul>
</div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading='loading'>
<tr>
<th>{{$t('fnc.jine')}}</th>
<th>{{$t('restaurant.res_commissionColumn')}}</th>
<th>{{$t('objFill.nianfen')}}</th>
<th>{{$t('objFill.v101.Rest.chaozrxinm')}}</th>
<th>{{$t('hotel.table_operattime')}}</th>
<th>{{$t('system.table_operation')}}</th>
</tr>
<tr v-for="(item,index) in DataList" :key="index+500">
<td>{{item.Money}}</td>
<td>{{item.Money}} <当前年份交易额<= {{item.MaxMoney}}</td>
<td>{{item.Ratio}}</td>
<td>{{item.Year}}</td>
<td>{{item.UpdateByName}}</td>
<td>{{item.UpdateTime}}</td>
<td>
......@@ -127,19 +140,28 @@
<td colspan="6" align="center">{{$t('system.content_noData')}}</td>
</tr>
</table>
<!-- <el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage"
layout="total,prev, pager, next, jumper" :page-size=msg.pageSize :total=total>
</el-pagination> -->
<el-dialog
:title="$t('tips.tips')"
:visible.sync="dialogVisible"
width="400px">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item :label="$t('fnc.jine')" prop="Money">
<el-input v-model="ruleForm.Money" @keyup.native="checkPrice(ruleForm,'Money')"></el-input>
<el-form-item :label="$t('objFill.jinefanwei')" required>
<el-col :span="11">
<el-form-item prop="Money">
<el-input v-model="ruleForm.Money" size="mini" @keyup.native="checkPrice(ruleForm,'Money')" type="number"></el-input>
</el-form-item>
</el-col>
<el-col style="text-align:center;" :span="2"> -</el-col>
<el-col :span="11">
<el-form-item prop="MaxMoney">
<el-input v-model="ruleForm.MaxMoney" size="mini" @keyup.native="checkPrice(ruleForm,'MaxMoney')" type="number"></el-input>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item :label="$t('restaurant.res_commissionColumn')+'(‰)'" prop="Ratio">
<el-input v-model="ruleForm.Ratio" @keyup.native="checkPrice(ruleForm,'Ratio')"></el-input>
<el-input v-model="ruleForm.Ratio" @keyup.native="checkPrice(ruleForm,'Ratio')" type="number"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
......@@ -152,21 +174,70 @@
</template>
<script>
import YearLimit from '../public/YearLimit.vue';
export default {
components: {YearLimit},
data() {
// 自定义验证规则
const validatePriceMoney = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('rule.qsrjine')));
}
if (Number(value) >= Number(this.ruleForm.MaxMoney)) {
callback(new Error('必须小于'+this.ruleForm.MaxMoney));
} else {
callback();
}
};
const validatePriceMaxMoney = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('rule.qsrjine')));
}
if (Number(value) <= Number(this.ruleForm.Money)) {
callback(new Error('必须大于'+this.ruleForm.Money));
} else {
callback();
}
};
return {
dialogVisible:false,
loading: true,
//分页
total: 0,
pageSize: '',
year:"",
currentPage:1,
DataList:[],
dateList:[],
yearList:[],
Msg:{Year:0,},
rules: {
Money: [
{ required: true, message: this.$t('rule.qsrjine'), trigger: 'blur' },
],
Money: [
{ required: true, message: this.$t('rule.qsrjine'), trigger: 'blur' },
{ validator: validatePriceMoney, trigger: 'blur' }
// { validator: (rule, value, callback) => {
// if (value > this.ruleForm.MaxMoney) {
// callback(new Error('必须小于'+this.ruleForm.MaxMoney));
// } else {
// callback();
// }
// }, trigger: 'blur' }
],
MaxMoney: [
{ required: true, message: this.$t('rule.qsrjine'), trigger: 'blur' },
{ validator: validatePriceMaxMoney, trigger: 'blur' }
// { validator: (rule, value, callback) => {
// if (value <= this.ruleForm.Money) {
// callback(new Error('必须大于'+this.ruleForm.Money));
// } else {
// callback();
// }
// }, trigger: 'blur' }
],
// [
// { required: true, message: this.$t('rule.qsrjine'), trigger: 'blur' },
// ],
Ratio: [
{ required: true, message: this.$t('objFill.v101.Rest.qingshurfybl'), trigger: 'blur' },
],
......@@ -174,18 +245,37 @@
ruleForm:{
Id:0,
Money:"",
MaxMoney:"",
Year:"",
Ratio:"",
},
}
},
created(){
var nowTime=new Date();
if (this.$route.query.year) {
this.year = this.$route.query.year;
this.Msg.Year= this.year;
this.ruleForm.Year=this.year;
} else {
this.year = nowTime.getFullYear().toString();
this.Msg.Year=this.year;
this.ruleForm.Year=this.year;
}
console.log("this.ruleForm.Year",this.ruleForm.Year);
},
mounted() {
let userInfo = this.getLocalStorage();
this.getList();
},
methods: {
getTime(Date){
this.Msg.Year=Date
this.ruleForm.Year=Date
this.year=Date
this.getList();
},
Delete(item){
this.$confirm(this.$t('tips.shifoushanchu'), this.$t('tips.tips'), {
confirmButtonText: this.$t('pub.sureBtn'),
......@@ -211,6 +301,7 @@
this.ruleForm={
Id:item.Id,
Money:item.Money,
MaxMoney:item.MaxMoney,
Ratio:item.Ratio,
}
this.dialogVisible=true;
......@@ -219,6 +310,7 @@
this.ruleForm={
Id:0,
Money:"",
MaxMoney:"",
Ratio:"",
}
this.dialogVisible=true;
......@@ -227,12 +319,14 @@
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.ruleForm.Year=this.year;
this.apipost('customer_post_SetCustomerCommissionRatio', this.ruleForm, res => {
if (res.data.resultCode == 1) {
this.getList();
this.dialogVisible=false;
this.$refs["ruleForm"].resetFields();
this.getList();
this.dialogVisible=false;
this.$refs["ruleForm"].resetFields();
} else {
this.Error(res.data.message)
}
}, err => {
})
......@@ -241,9 +335,10 @@
}
});
},
getList() { //获取数据
this.loading = true;
this.apipost('customer_post_GetCustomerCommissionRatioList', {}, res => {
this.apipost('customer_post_GetCustomerCommissionRatioList', this.Msg, res => {
this.loading = false
if (res.data.resultCode == 1) {
this.DataList = res.data.data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment