|
@@ -62,23 +62,25 @@
|
|
|
<div class="c-item">
|
|
|
<label class="c-label">车辆类型:</label>
|
|
|
<el-select v-model="m.carType" placeholder="请选择" @change="carTypeChange">
|
|
|
- <el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
|
|
|
+ <el-option :label="item.name" :value="item.name"
|
|
|
+ v-for="(item,index) in carTypeList">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <sa-item v-if="m.carType.indexOf('重')!==-1" type="num" name="载重(kg)" placeholder="请输入车辆载重"
|
|
|
- v-model="m.carWeight" br>
|
|
|
+ <sa-item v-if="m.carType.indexOf('重')!==-1" type="num" name="载重(kg)"
|
|
|
+ placeholder="请输入车辆载重" v-model="m.carWeight" br>
|
|
|
</sa-item>
|
|
|
<div class="c-item">
|
|
|
<label class="c-label">作业时间:</label>
|
|
|
- <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="m.operateTime"></el-date-picker>
|
|
|
+ <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ v-model="m.operateTime"></el-date-picker>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>收费明细<label style="color: red;">(总共{{totalPrice}}元)</label></span>
|
|
|
- <el-select v-model="m.itemTypeId" placeholder="请选择" @change="getItems"
|
|
|
+ <el-select v-model="m.itemTypeId" placeholder="请选择" @change="itemChange"
|
|
|
style="float: right; padding: 3px 0">
|
|
|
<el-option v-for="(item,index) in itemTypeList" :label="item.name"
|
|
|
:value="item.id">
|
|
@@ -114,7 +116,7 @@
|
|
|
</div>
|
|
|
<!-- ------- 底部按钮 ------- -->
|
|
|
<div class="s-foot">
|
|
|
- <el-button type="primary" @click="ok()" v-if="sa.isAuth('tb-business-add')">确定</el-button>
|
|
|
+ <el-button type="primary" @click="ok()">确定</el-button>
|
|
|
<el-button @click="sa.closeCurrIframe()">取消</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -144,17 +146,19 @@
|
|
|
}, // 实体对象
|
|
|
itemTypeList: [],
|
|
|
items: [],
|
|
|
- businessItems:[],
|
|
|
+ businessItems: [],
|
|
|
checkList: [],
|
|
|
- customerList:[],
|
|
|
- carTypeList:[],
|
|
|
- currentCustomerId:''
|
|
|
+ customerList: [],
|
|
|
+ carTypeList: [],
|
|
|
+ currentCustomerId: ''
|
|
|
},
|
|
|
computed: {
|
|
|
+
|
|
|
+
|
|
|
totalPrice() {
|
|
|
let checkList = this.checkList;
|
|
|
let items = this.items
|
|
|
- .filter(obj => checkList.indexOf(obj.id) !== -1);
|
|
|
+ .filter(obj => checkList.indexOf(obj.id) !== -1);
|
|
|
let price = 0;
|
|
|
for (let i in items) {
|
|
|
let item = items[i];
|
|
@@ -164,28 +168,55 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ itemChange() {
|
|
|
+ sa.ajax('/TbItem/getTypeItemList', {
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 30,
|
|
|
+ typeId: this.m.itemTypeId
|
|
|
+ }, function(resp) {
|
|
|
+ let list = resp.data;
|
|
|
+ if (this.m.carType) {
|
|
|
+ list = list.filter(obj => obj.itemType && obj.itemType.indexOf(this.m
|
|
|
+ .carType) !== -1);
|
|
|
+ }
|
|
|
+ this.items = list;
|
|
|
+ this.checkList = list.filter(obj => obj.need == 1 || obj.itemType.indexOf(this.m
|
|
|
+ .carType) !== -1).map(obj => obj.id);
|
|
|
+ let businessItems = this.businessItems;
|
|
|
+ list.forEach(obj => {
|
|
|
+ businessItems.forEach(item => {
|
|
|
+ if (obj.id == item.itemId) {
|
|
|
+ obj.remark = item.remark;
|
|
|
+ obj.num = item.num;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }.bind(this))
|
|
|
+ },
|
|
|
getCustomer() {
|
|
|
sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
|
|
|
let id = resp.data;
|
|
|
- if (id == 1) {} else {
|
|
|
+ if (id == 1) {
|
|
|
+ this.getCustomerList();
|
|
|
+ } else {
|
|
|
this.m.customerId = id;
|
|
|
}
|
|
|
this.currentCustomerId = id;
|
|
|
}.bind(this));
|
|
|
},
|
|
|
- carTypeChange(v){
|
|
|
+ carTypeChange(v) {
|
|
|
this.getItems();
|
|
|
},
|
|
|
getItemType() {
|
|
|
sa.ajax('/TbItem/getItemType', function(resp) {
|
|
|
- this.carTypeList= resp.data;
|
|
|
+ this.carTypeList = resp.data;
|
|
|
}.bind(this))
|
|
|
},
|
|
|
getCustomerList() {
|
|
|
sa.ajax('/TbCostomer/getList', {
|
|
|
pageNo: 1,
|
|
|
pageSize: 30,
|
|
|
- sortType:20,
|
|
|
+ sortType: 20,
|
|
|
judgeStatus: 2
|
|
|
}, function(res) {
|
|
|
this.customerList = res.data; // 数据
|
|
@@ -195,6 +226,7 @@
|
|
|
sa.ajax('/TbItemType/getList', sa.removeNull(this.p), function(res) {
|
|
|
let list = res.data;
|
|
|
this.itemTypeList = list;
|
|
|
+
|
|
|
this.getItems();
|
|
|
}.bind(this));
|
|
|
},
|
|
@@ -205,16 +237,19 @@
|
|
|
typeId: this.m.itemTypeId
|
|
|
}, function(resp) {
|
|
|
let list = resp.data;
|
|
|
- if(this.m.carType){
|
|
|
- list=list.filter(obj=>obj.itemType&&obj.itemType.indexOf(this.m.carType)!==-1);
|
|
|
+ if (this.m.carType) {
|
|
|
+ list = list.filter(obj => obj.itemType && obj.itemType.indexOf(this.m
|
|
|
+ .carType) !== -1);
|
|
|
}
|
|
|
this.items = list;
|
|
|
- let businessItems=this.businessItems;
|
|
|
- list.forEach(obj=>{
|
|
|
- businessItems.forEach(item=>{
|
|
|
- if(obj.id==item.itemId){
|
|
|
- obj.remark=item.remark;
|
|
|
- obj.num=item.num;
|
|
|
+ this.checkList = list.filter(obj => obj.need == 1 || obj.itemType.indexOf(this.m
|
|
|
+ .carType) !== -1).map(obj => obj.id);
|
|
|
+ let businessItems = this.businessItems;
|
|
|
+ list.forEach(obj => {
|
|
|
+ businessItems.forEach(item => {
|
|
|
+ if (obj.id == item.itemId) {
|
|
|
+ obj.remark = item.remark;
|
|
|
+ obj.num = item.num;
|
|
|
}
|
|
|
})
|
|
|
})
|
|
@@ -230,7 +265,7 @@
|
|
|
let itemList = this.items;
|
|
|
let list = itemList.filter(obj => checkList.indexOf(obj.id) !== -1);
|
|
|
m.itemJson = JSON.stringify(list);
|
|
|
- m.items=null;
|
|
|
+ m.items = null;
|
|
|
sa.ajax('/api/editOtherBusiness', sa.removeNull(m), function(resp) {
|
|
|
parent.app.f5(); // 刷新父页面列表
|
|
|
sa.closeCurrIframe(); // 关闭本页
|
|
@@ -240,19 +275,21 @@
|
|
|
sa.ajax('/TbBusiness/getOtherBusinessById', {
|
|
|
id: this.id
|
|
|
}, function(resp) {
|
|
|
- let data=resp.data;
|
|
|
+ let data = resp.data;
|
|
|
this.m = data
|
|
|
- this.businessItems=data.items;
|
|
|
- this.checkList=data.items.map(obj=>obj.itemId);
|
|
|
+ this.businessItems = data.items;
|
|
|
+ this.checkList = data.items.map(obj => obj.itemId);
|
|
|
+ console.log(this.checkList);
|
|
|
this.getItemTypeList();
|
|
|
this.getItemType();
|
|
|
}.bind(this))
|
|
|
}
|
|
|
},
|
|
|
mounted: function() {
|
|
|
- this.getCustomer();
|
|
|
this.getOtherBusinessById();
|
|
|
- this.getCustomerList();
|
|
|
+ this.getCustomer();
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
</script>
|