mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-23 21:36:37 +08:00
优惠代码
This commit is contained in:
parent
baa0729a79
commit
9a18c02c28
8
app.js
8
app.js
@ -36,14 +36,14 @@ let opts = {
|
||||
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
|
||||
|
||||
|
||||
app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
|
||||
app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts));
|
||||
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
|
||||
//app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts));
|
||||
|
||||
//app.use('/callComponent',proxy('http://127.0.0.1:8012',opts));
|
||||
//app.use('/app',proxy('http://127.0.0.1:8012',opts));
|
||||
|
||||
//app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
|
||||
//app.use('/app',proxy('http://192.168.1.16:8012',opts));
|
||||
app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
|
||||
app.use('/app',proxy('http://192.168.1.16:8012',opts));
|
||||
|
||||
//app.listen(3000);
|
||||
app.use(express.json());
|
||||
|
||||
@ -5,16 +5,19 @@
|
||||
<div class="ibox-title">
|
||||
<h5>折扣信息</h5>
|
||||
<div class="ibox-tools" style="top:10px;">
|
||||
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddFeeDiscountModal()">
|
||||
<!-- <button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddFeeDiscountModal()">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
特殊折扣
|
||||
</button>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">
|
||||
<input type="checkbox" class="i-checks" v-bind:checked="payFeeDiscountInfo.quanDiscount == true" @click="checkAllDiscount($event)" >
|
||||
</th>
|
||||
<th class="text-center">折扣类型</th>
|
||||
<th class="text-center">折扣名称</th>
|
||||
<th class="text-center">规则</th>
|
||||
@ -23,13 +26,16 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="feeDiscount in payFeeDiscountInfo.feeDiscounts">
|
||||
<td class="text-center">
|
||||
<input type="checkbox" class="i-checks checkDiscountItem" v-bind:value="feeDiscount.discountId" v-model="payFeeDiscountInfo.selectDiscountIds" >
|
||||
</td>
|
||||
<td class="text-center">{{feeDiscount.discountType == '1001'?'优惠':'违约'}}</td>
|
||||
<td class="text-center">{{feeDiscount.discountName}}</td>
|
||||
<td class="text-center">
|
||||
<div v-for="(item,index) in feeDiscount.feeDiscountSpecs">
|
||||
{{item.specName}}:{{item.specValue}}</div>
|
||||
</td>
|
||||
<td class="text-center">30</td>
|
||||
<td class="text-center">{{feeDiscount.discountPrice}}元</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
||||
@ -9,7 +9,25 @@
|
||||
payFeeDiscountInfo: {
|
||||
feeDiscounts: [],
|
||||
feeId: '',
|
||||
cycles: 1
|
||||
communityId: vc.getCurrentCommunity().communityId,
|
||||
cycles: 1,
|
||||
quanDiscount: false,
|
||||
selectDiscountIds: [],
|
||||
}
|
||||
},
|
||||
watch: { // 监视双向绑定的数据数组
|
||||
payFeeDiscountInfo: {
|
||||
handler() { // 数据数组有变化将触发此函数
|
||||
if ($that.payFeeDiscountInfo.selectDiscountIds.length == $that.payFeeDiscountInfo.feeDiscounts.length) {
|
||||
$that.payFeeDiscountInfo.quanDiscount = true;
|
||||
} else {
|
||||
$that.payFeeDiscountInfo.quanDiscount = false;
|
||||
}
|
||||
|
||||
//计算优惠
|
||||
$that._computeFeeDiscount();
|
||||
},
|
||||
deep: true // 深度监视
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
@ -18,14 +36,14 @@
|
||||
_initEvent: function () {
|
||||
vc.on('payFeeDiscount', 'computeFeeDiscount', function (_param) {
|
||||
vc.copyObject(_param, $that.payFeeDiscountInfo);
|
||||
if ($that.payFeeDiscountInfo.cycles < 0) {
|
||||
return;
|
||||
}
|
||||
vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_listFeeDiscounts: function (_page, _rows) {
|
||||
|
||||
vc.component.payFeeDiscountInfo.conditions.page = _page;
|
||||
vc.component.payFeeDiscountInfo.conditions.row = _rows;
|
||||
let param = {
|
||||
params: {
|
||||
page: DEFAULT_PAGE,
|
||||
@ -37,11 +55,15 @@
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.apiGet('/feeDiscount/queryFeeDiscount',
|
||||
vc.http.apiGet('/feeDiscount/computeFeeDiscount',
|
||||
param,
|
||||
function (json, res) {
|
||||
let _payFeeDiscountInfo = JSON.parse(json);
|
||||
$that.payFeeDiscountInfo.feeDiscounts = _payFeeDiscountInfo.data;
|
||||
$that.payFeeDiscountInfo.feeDiscounts.forEach(item => {
|
||||
$that.payFeeDiscountInfo.selectDiscountIds.push(item.discountId);
|
||||
item.discountPrice = Math.ceil(item.discountPrice);
|
||||
})
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
@ -50,24 +72,37 @@
|
||||
_openAddFeeDiscountModal: function () {
|
||||
vc.emit('addFeeDiscount', 'openAddFeeDiscountModal', {});
|
||||
},
|
||||
_openEditFeeDiscountModel: function (_feeDiscount) {
|
||||
vc.emit('editFeeDiscount', 'openEditFeeDiscountModal', _feeDiscount);
|
||||
},
|
||||
_openDeleteFeeDiscountModel: function (_feeDiscount) {
|
||||
vc.emit('deleteFeeDiscount', 'openDeleteFeeDiscountModal', _feeDiscount);
|
||||
},
|
||||
_queryFeeDiscountMethod: function () {
|
||||
vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
|
||||
},
|
||||
_moreCondition: function () {
|
||||
if (vc.component.payFeeDiscountInfo.moreCondition) {
|
||||
vc.component.payFeeDiscountInfo.moreCondition = false;
|
||||
} else {
|
||||
vc.component.payFeeDiscountInfo.moreCondition = true;
|
||||
checkAllDiscount: function (e) {
|
||||
var checkObj = document.querySelectorAll('.checkDiscountItem'); // 获取所有checkbox项
|
||||
if (e.target.checked) { // 判定全选checkbox的勾选状态
|
||||
for (var i = 0; i < checkObj.length; i++) {
|
||||
if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中
|
||||
let _value = checkObj[i].value;
|
||||
vc.component.payFeeDiscountInfo.selectDiscountIds.push(_value);
|
||||
}
|
||||
}
|
||||
} else { // 如果是去掉全选则清空checkbox选项绑定数组
|
||||
vc.component.payFeeDiscountInfo.selectDiscountIds = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
_computeFeeDiscount: function () {
|
||||
let _totalDiscountMoney = 0.0;
|
||||
let _selectDiscount = [];
|
||||
$that.payFeeDiscountInfo.selectDiscountIds.forEach(item => {
|
||||
$that.payFeeDiscountInfo.feeDiscounts.forEach(disItem => {
|
||||
if (item == disItem.discountId) {
|
||||
_totalDiscountMoney += parseFloat(disItem.discountPrice);
|
||||
_selectDiscount.push(disItem);
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
vc.emit('payFeeOrder', 'changeDiscountPrice', {
|
||||
totalDiscountMoney: _totalDiscountMoney,
|
||||
selectDiscount: _selectDiscount
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -159,6 +159,10 @@
|
||||
<label class="col-sm-3 col-form-label">实收金额:</label>
|
||||
<label class="col-sm-8 col-form-label">{{payFeeOrderInfo.receivedAmount}}</label>
|
||||
</div>
|
||||
<div class="row" >
|
||||
<label class="col-sm-3 col-form-label">优惠金额:</label>
|
||||
<label class="col-sm-8 col-form-label">{{payFeeOrderInfo.totalDiscountMoney}}</label>
|
||||
</div>
|
||||
<div class="row" >
|
||||
<label class="col-sm-3 col-form-label">备注:</label>
|
||||
<label class="col-sm-8 col-form-label">{{payFeeOrderInfo.remark}}</label>
|
||||
@ -171,4 +175,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<vc:create path="property/payFeeDiscount"></vc:create>
|
||||
</div>
|
||||
@ -23,7 +23,9 @@
|
||||
squarePrice: 0.0,
|
||||
additionalAmount: 0.0,
|
||||
receiptId: '',
|
||||
showEndTime:''
|
||||
showEndTime: '',
|
||||
selectDiscount: [],
|
||||
totalDiscountMoney:0.0
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
@ -40,7 +42,7 @@
|
||||
$that.payFeeOrderInfo.builtUpArea = vc.getParam('builtUpArea');
|
||||
$that.payFeeOrderInfo.squarePrice = vc.getParam('squarePrice');
|
||||
$that.payFeeOrderInfo.additionalAmount = vc.getParam('additionalAmount');
|
||||
|
||||
|
||||
|
||||
|
||||
$that.payFeeOrderInfo.paymentCycles = [];
|
||||
@ -56,7 +58,26 @@
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('payFeeOrder', 'changeDiscountPrice', function (_param) {
|
||||
let _totalFeePrice = $that.payFeeOrderInfo.totalFeePrice;
|
||||
|
||||
if (_totalFeePrice < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let _totalDiscountMoney = _param.totalDiscountMoney;
|
||||
|
||||
//如果应收小区 优惠金额 则不优惠
|
||||
if (_totalFeePrice < _totalDiscountMoney) {
|
||||
return;
|
||||
}
|
||||
|
||||
$that.payFeeOrderInfo.selectDiscount = _param.selectDiscount;
|
||||
|
||||
$that.payFeeOrderInfo.totalDiscountMoney = _totalDiscountMoney;
|
||||
|
||||
$that.payFeeOrderInfo.receivedAmount = _totalFeePrice - _totalDiscountMoney;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
payFeeValidate: function () {
|
||||
@ -106,11 +127,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(/(^[1-9]\d*$)/.test($that.payFeeOrderInfo.cycles))) {
|
||||
if (!(/(^[1-9]\d*$)/.test($that.payFeeOrderInfo.cycles))) {
|
||||
$that.payFeeOrderInfo.showEndTime = '';
|
||||
}else{
|
||||
console.log('cycle',$that.payFeeOrderInfo.cycles)
|
||||
$that.payFeeOrderInfo.showEndTime = vc.addMonth(new Date($that.payFeeOrderInfo.endTime),parseInt($that.payFeeOrderInfo.cycles));
|
||||
} else {
|
||||
console.log('cycle', $that.payFeeOrderInfo.cycles)
|
||||
$that.payFeeOrderInfo.showEndTime = vc.addMonth(new Date($that.payFeeOrderInfo.endTime), parseInt($that.payFeeOrderInfo.cycles));
|
||||
}
|
||||
//关闭model
|
||||
$("#doPayFeeModal").modal('show');
|
||||
@ -178,6 +199,11 @@
|
||||
}
|
||||
vc.component.payFeeOrderInfo.totalFeePrice = $that._mathCeil(Math.floor(parseFloat(_newCycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100);
|
||||
vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice;
|
||||
|
||||
vc.emit('payFeeDiscount', 'computeFeeDiscount', {
|
||||
feeId: $that.payFeeOrderInfo.feeId,
|
||||
cycles: _cycles
|
||||
});
|
||||
},
|
||||
changeCycle: function (_cycles) {
|
||||
if (_cycles == '') {
|
||||
@ -185,6 +211,11 @@
|
||||
}
|
||||
vc.component.payFeeOrderInfo.totalFeePrice = $that._mathCeil(Math.floor(parseFloat(_cycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100);
|
||||
vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice;
|
||||
|
||||
vc.emit('payFeeDiscount', 'computeFeeDiscount', {
|
||||
feeId: $that.payFeeOrderInfo.feeId,
|
||||
cycles: _cycles
|
||||
});
|
||||
},
|
||||
_back: function () {
|
||||
$('#payFeeResult').modal("hide");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user