加入费用折扣

This commit is contained in:
java110 2020-11-25 01:45:40 +08:00
parent fa96cb24b6
commit f3dd4fb405
7 changed files with 184 additions and 76 deletions

View File

@ -17,7 +17,7 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label">折扣类型</label>
<div class="col-sm-10">
<select class="custom-select" v-model="addFeeDiscountInfo.discountType">
<select class="custom-select" v-model="addFeeDiscountInfo.discountType" @change="_changeAddFeeDiscountType()">
<option selected disabled value="">必填,请选择折扣类型</option>
<option value="1001">优惠</option>
<option value="2002">违约</option>
@ -26,14 +26,25 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label">规则</label>
<div class="col-sm-10">
<input v-model="addFeeDiscountInfo.ruleId" type="text" placeholder="必填,请填写规则" class="form-control">
<select v-model="addFeeDiscountInfo.ruleId" class="form-control" @change="_changeAddFeeDiscountRule()">
<option value="">必填,请选择规则</option>
<option v-for="(item,index) in addFeeDiscountInfo.rules" :value="item.ruleId">{{item.ruleName}}</option>
</select>
</div>
</div>
<div class="form-group row" v-for="(item,index) in addFeeDiscountInfo.feeDiscountRuleSpecs">
<label class="col-sm-2 col-form-label">{{item.specName}}</label>
<div class="col-sm-10">
<input v-model="item.specValue" type="text" :placeholder="item.remark"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">描述</label>
<div class="col-sm-10">
<input v-model="addFeeDiscountInfo.discountDesc" type="text" placeholder="必填,请填写描述"
class="form-control">
<textarea v-model="addFeeDiscountInfo.discountDesc" placeholder="可选,请填写描述"
class="form-control"></textarea>
</div>
</div>

View File

@ -12,6 +12,9 @@
discountType: '',
ruleId: '',
discountDesc: '',
rules: [],
feeDiscountRuleSpecs: []
}
},
_initMethod: function () {
@ -19,6 +22,7 @@
},
_initEvent: function () {
vc.on('addFeeDiscount', 'openAddFeeDiscountModal', function () {
$('#addFeeDiscountModel').modal('show');
});
},
@ -64,14 +68,10 @@
},
],
'addFeeDiscountInfo.discountDesc': [
{
limit: "required",
param: "",
errInfo: "描述不能为空"
},
{
limit: "maxLength",
param: "",
param: "500",
errInfo: "描述不能超过500位"
},
],
@ -97,7 +97,7 @@
}
vc.http.apiPost(
'feeDiscount.saveFeeDiscount',
'/feeDiscount/saveFeeDiscount',
JSON.stringify(vc.component.addFeeDiscountInfo),
{
emulateJSON: true
@ -129,8 +129,48 @@
discountType: '',
ruleId: '',
discountDesc: '',
rules: [],
feeDiscountRuleSpecs: []
};
},
_loadAddFeeDiscountRules: function () {
if ($that.addFeeDiscountInfo.discountType == '') {
return;
}
var param = {
params: {
page: 1,
row: 100,
discountType: $that.addFeeDiscountInfo.discountType
}
};
//发送get请求
vc.http.apiGet('/feeDiscount/queryFeeDiscountRule',
param,
function (json, res) {
var _feeDiscountManageInfo = JSON.parse(json);
$that.addFeeDiscountInfo.rules = _feeDiscountManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_changeAddFeeDiscountRule: function () {
let _rules = $that.addFeeDiscountInfo.rules;
_rules.forEach(item => {
if (item.ruleId == $that.addFeeDiscountInfo.ruleId) {
item.feeDiscountRuleSpecs.forEach(specItem => {
specItem.specValue = "";
})
$that.addFeeDiscountInfo.feeDiscountRuleSpecs = item.feeDiscountRuleSpecs;
}
});
},
_changeAddFeeDiscountType: function () {
$that._loadAddFeeDiscountRules();
}
}
});

View File

@ -21,7 +21,7 @@
deleteFeeDiscount: function () {
vc.component.deleteFeeDiscountInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'feeDiscount.deleteFeeDiscount',
'/feeDiscount/deleteFeeDiscount',
JSON.stringify(vc.component.deleteFeeDiscountInfo),
{
emulateJSON: true

View File

@ -26,14 +26,25 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label">规则</label>
<div class="col-sm-10">
<input v-model="editFeeDiscountInfo.ruleId" type="text" placeholder="必填,请填写规则" class="form-control">
<select v-model="editFeeDiscountInfo.ruleId" class="form-control" @change="_changeEditFeeDiscountRule()">
<option value="">必填,请选择规则</option>
<option v-for="(item,index) in editFeeDiscountInfo.rules" :value="item.ruleId">{{item.ruleName}}</option>
</select>
</div>
</div>
<div class="form-group row" v-for="(item,index) in editFeeDiscountInfo.feeDiscountRuleSpecs">
<label class="col-sm-2 col-form-label">{{item.specName}}</label>
<div class="col-sm-10">
<input v-model="item.specValue" type="text" :placeholder="item.remark"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">描述</label>
<div class="col-sm-10">
<input v-model="editFeeDiscountInfo.discountDesc" type="text" placeholder="必填,请填写描述"
class="form-control">
<textarea v-model="editFeeDiscountInfo.discountDesc" placeholder="可选,请填写描述"
class="form-control"></textarea>
</div>
</div>

View File

@ -8,6 +8,8 @@
discountType: '',
ruleId: '',
discountDesc: '',
rules: [],
feeDiscountRuleSpecs: []
}
},
@ -19,6 +21,8 @@
vc.component.refreshEditFeeDiscountInfo();
$('#editFeeDiscountModel').modal('show');
vc.copyObject(_params, vc.component.editFeeDiscountInfo);
$that.editFeeDiscountInfo.feeDiscountRuleSpecs = _params.feeDiscountSpecs;
$that._loadEditFeeDiscountRules();
vc.component.editFeeDiscountInfo.communityId = vc.getCurrentCommunity().communityId;
});
},
@ -64,14 +68,10 @@
},
],
'editFeeDiscountInfo.discountDesc': [
{
limit: "required",
param: "",
errInfo: "描述不能为空"
},
{
limit: "maxLength",
param: "",
param: "500",
errInfo: "描述不能超过500位"
},
],
@ -91,7 +91,7 @@
}
vc.http.apiPost(
'feeDiscount.updateFeeDiscount',
'/feeDiscount/updateFeeDiscount',
JSON.stringify(vc.component.editFeeDiscountInfo),
{
emulateJSON: true
@ -120,8 +120,49 @@
discountType: '',
ruleId: '',
discountDesc: '',
rules: [],
feeDiscountRuleSpecs: []
}
},
_loadEditFeeDiscountRules: function () {
if ($that.editFeeDiscountInfo.discountType == '') {
return;
}
var param = {
params: {
page: 1,
row: 100,
discountType: $that.editFeeDiscountInfo.discountType
}
};
//发送get请求
vc.http.apiGet('/feeDiscount/queryFeeDiscountRule',
param,
function (json, res) {
var _feeDiscountManageInfo = JSON.parse(json);
$that.editFeeDiscountInfo.rules = _feeDiscountManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_changeEditFeeDiscountRule: function () {
let _rules = $that.editFeeDiscountInfo.rules;
_rules.forEach(item => {
if (item.ruleId == $that.editFeeDiscountInfo.ruleId) {
item.feeDiscountRuleSpecs.forEach(specItem => {
specItem.specValue = "";
})
$that.editFeeDiscountInfo.feeDiscountRuleSpecs = item.feeDiscountRuleSpecs;
}
});
},
_changeEditFeeDiscountType: function () {
$that._loadEditFeeDiscountRules();
}
}
});

View File

@ -69,8 +69,10 @@
<tr v-for="feeDiscount in feeDiscountManageInfo.feeDiscounts">
<td class="text-center">{{feeDiscount.discountId}}</td>
<td class="text-center">{{feeDiscount.discountName}}</td>
<td class="text-center">{{feeDiscount.discountType}}</td>
<td class="text-center">{{feeDiscount.ruleName}}</td>
<td class="text-center">{{feeDiscount.discountType == '1001'?'优惠':'违约'}}</td>
<td class="text-center">
<div v-for="(item,index) in feeDiscount.feeDiscountSpecs">{{item.specName}}{{item.specValue}}</div>
</td>
<td class="text-center">{{feeDiscount.createTime}}</td>
<td class="text-center">
<div class="btn-group">

View File

@ -1,85 +1,88 @@
/**
入驻小区
**/
(function(vc){
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data:{
feeDiscountManageInfo:{
feeDiscounts:[],
total:0,
records:1,
moreCondition:false,
discountId:'',
conditions:{
discountName:'',
discountType:'',
ruleName:'',
data: {
feeDiscountManageInfo: {
feeDiscounts: [],
total: 0,
records: 1,
moreCondition: false,
discountId: '',
conditions: {
discountName: '',
discountType: '',
ruleName: '',
communityId:vc.getCurrentCommunity().communityId
}
}
},
_initMethod:function(){
_initMethod: function () {
vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent:function(){
vc.on('feeDiscountManage','listFeeDiscount',function(_param){
vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
_initEvent: function () {
vc.on('feeDiscountManage', 'listFeeDiscount', function (_param) {
vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination','page_event',function(_currentPage){
vc.component._listFeeDiscounts(_currentPage,DEFAULT_ROWS);
vc.on('pagination', 'page_event', function (_currentPage) {
vc.component._listFeeDiscounts(_currentPage, DEFAULT_ROWS);
});
},
methods:{
_listFeeDiscounts:function(_page, _rows){
methods: {
_listFeeDiscounts: function (_page, _rows) {
vc.component.feeDiscountManageInfo.conditions.page = _page;
vc.component.feeDiscountManageInfo.conditions.row = _rows;
var param = {
params:vc.component.feeDiscountManageInfo.conditions
};
//发送get请求
vc.http.apiGet('feeDiscount.listFeeDiscounts',
param,
function(json,res){
var _feeDiscountManageInfo=JSON.parse(json);
vc.component.feeDiscountManageInfo.total = _feeDiscountManageInfo.total;
vc.component.feeDiscountManageInfo.records = _feeDiscountManageInfo.records;
vc.component.feeDiscountManageInfo.feeDiscounts = _feeDiscountManageInfo.data;
vc.emit('pagination','init',{
total:vc.component.feeDiscountManageInfo.records,
currentPage:_page
});
},function(errInfo,error){
console.log('请求失败处理');
}
);
var param = {
params: vc.component.feeDiscountManageInfo.conditions
};
//发送get请求
vc.http.apiGet('/feeDiscount/queryFeeDiscount',
param,
function (json, res) {
var _feeDiscountManageInfo = JSON.parse(json);
vc.component.feeDiscountManageInfo.total = _feeDiscountManageInfo.total;
vc.component.feeDiscountManageInfo.records = _feeDiscountManageInfo.records;
vc.component.feeDiscountManageInfo.feeDiscounts = _feeDiscountManageInfo.data;
vc.emit('pagination', 'init', {
total: vc.component.feeDiscountManageInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddFeeDiscountModal:function(){
vc.emit('addFeeDiscount','openAddFeeDiscountModal',{});
_openAddFeeDiscountModal: function () {
vc.emit('addFeeDiscount', 'openAddFeeDiscountModal', {});
},
_openEditFeeDiscountModel:function(_feeDiscount){
vc.emit('editFeeDiscount','openEditFeeDiscountModal',_feeDiscount);
_openEditFeeDiscountModel: function (_feeDiscount) {
vc.emit('editFeeDiscount', 'openEditFeeDiscountModal', _feeDiscount);
},
_openDeleteFeeDiscountModel:function(_feeDiscount){
vc.emit('deleteFeeDiscount','openDeleteFeeDiscountModal',_feeDiscount);
_openDeleteFeeDiscountModel: function (_feeDiscount) {
vc.emit('deleteFeeDiscount', 'openDeleteFeeDiscountModal', _feeDiscount);
},
_queryFeeDiscountMethod:function(){
_queryFeeDiscountMethod: function () {
vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition:function(){
if(vc.component.feeDiscountManageInfo.moreCondition){
_moreCondition: function () {
if (vc.component.feeDiscountManageInfo.moreCondition) {
vc.component.feeDiscountManageInfo.moreCondition = false;
}else{
} else {
vc.component.feeDiscountManageInfo.moreCondition = true;
}
}
}
});
})(window.vc);