优化代码

This commit is contained in:
java110 2022-10-12 18:52:37 +08:00
parent c4692ffd69
commit 33926c3125
3 changed files with 175 additions and 2 deletions

View File

@ -32,8 +32,6 @@
<td class="text-center">{{coupon.couponName}}</td>
<td class="text-center">{{coupon.paName}}</td>
<td class="text-center">{{coupon.quantity}}</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,98 @@
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5><span><vc:i18n name="查询条件"></vc:i18n></span></h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入车牌号','parkingCouponCar')" v-model="parkingCouponCarInfo.conditions.carNumLike" class=" form-control">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请输入商家店铺名称','parkingCouponCar')" v-model="parkingCouponCarInfo.conditions.shopNameLike" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<select class="custom-select" v-model="parkingCouponCarInfo.conditions.state">
<option selected value="">{{vc.i18n('请选择状态','parkingCouponCar')}}</option>
<option value="1001">{{vc.i18n('未使用','parkingCouponCar')}}</option>
<option value="2002">{{vc.i18n('已使用','parkingCouponCar')}}</option>
<option value="3003">{{vc.i18n('作废','parkingCouponCar')}}</option>
</select>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryParkingCouponCarMethod()">
<i class="glyphicon glyphicon-search"></i> <span><vc:i18n name="查询"></vc:i18n></span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5><span><vc:i18n name="车辆停车劵" namespace="parkingCouponCar"></vc:i18n></span></h5>
<div class="ibox-tools" style="top:10px;">
</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"><span><vc:i18n name='车辆' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='优惠券' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='商家店铺' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='停车场' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='赠送方式' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='优惠方式' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='面值' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='开始时间' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='结束时间' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='赠送时间' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='状态' namespace='parkingCouponCar'></vc:i18n></span></th>
<th class="text-center"><span><vc:i18n name='说明' namespace='parkingCouponCar'></vc:i18n></span></th>
</tr>
</thead>
<tbody>
<tr v-for="parkingCouponCar in parkingCouponCarInfo.parkingCouponCars">
<td class="text-center">{{parkingCouponCar.carNum}}</td>
<td class="text-center">{{parkingCouponCar.couponName}}</td>
<td class="text-center">{{parkingCouponCar.shopName}}</td>
<td class="text-center">{{parkingCouponCar.paName}}</td>
<td class="text-center">{{parkingCouponCar.giveWayName}}</td>
<td class="text-center">{{parkingCouponCar.typeCdName}}</td>
<td class="text-center">{{parkingCouponCar.value}}</td>
<td class="text-center">{{parkingCouponCar.startTime}}</td>
<td class="text-center">{{parkingCouponCar.endTime}}</td>
<td class="text-center">{{parkingCouponCar.createTime}}</td>
<td class="text-center">{{parkingCouponCar.stateName}}</td>
<td class="text-center">{{parkingCouponCar.remark}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,77 @@
/**
入驻小区
**/
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
parkingCouponCarInfo: {
parkingCouponCars: [],
total: 0,
records: 1,
moreCondition: false,
couponId: '',
conditions: {
couponId: '',
shopNameLike: '',
carNumLike: '',
state: '',
communityId: vc.getCurrentCommunity().communityId
}
}
},
_initMethod: function() {
vc.component._listParkingCouponCars(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function() {
vc.on('parkingCouponCar', 'listParkingCouponCar', function(_param) {
vc.component._listParkingCouponCars(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function(_currentPage) {
vc.component._listParkingCouponCars(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listParkingCouponCars: function(_page, _rows) {
vc.component.parkingCouponCarInfo.conditions.page = _page;
vc.component.parkingCouponCarInfo.conditions.row = _rows;
let param = {
params: vc.component.parkingCouponCarInfo.conditions
};
//发送get请求
vc.http.apiGet('/parkingCouponCar.listParkingCouponCar',
param,
function(json, res) {
let _parkingCouponCarInfo = JSON.parse(json);
vc.component.parkingCouponCarInfo.total = _parkingCouponCarInfo.total;
vc.component.parkingCouponCarInfo.records = _parkingCouponCarInfo.records;
vc.component.parkingCouponCarInfo.parkingCouponCars = _parkingCouponCarInfo.data;
vc.emit('pagination', 'init', {
total: vc.component.parkingCouponCarInfo.records,
currentPage: _page
});
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_queryParkingCouponCarMethod: function() {
vc.component._listParkingCouponCars(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function() {
if (vc.component.parkingCouponCarInfo.moreCondition) {
vc.component.parkingCouponCarInfo.moreCondition = false;
} else {
vc.component.parkingCouponCarInfo.moreCondition = true;
}
}
}
});
})(window.vc);