4 changed files with 1099 additions and 0 deletions
@ -0,0 +1,66 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export default { |
|||
// 查询分页列表
|
|||
listPage: function(params) { |
|||
return request({ |
|||
url: '/as/v1/AsBusrepairBill/listPage', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
customerListPage: function(params) { |
|||
return request({ |
|||
url: '/as/v1/AsServiceItem/listPage', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
saveOrUpdate: function(data) { |
|||
return request({ |
|||
url: '/as/v1/AsBusrepairBill/saveBill', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
submit: function(data) { |
|||
return request({ |
|||
url: '/as/v1/AsBusrepairBill/submitNextNode', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
fetchBySid: function(data) { |
|||
return request({ |
|||
url: '/as/v1/AsBusrepairBill/fetchDetailsBySid/' + data, |
|||
method: 'get' |
|||
}) |
|||
}, |
|||
deleteBySids: function(data) { |
|||
return request({ |
|||
url: '/as/v1/AsBusrepairBill/delBySids', |
|||
method: 'DELETE', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
// 根据分公司全路径sid查询本分公司下的品牌,再根据品牌查询相应的关联车型信息
|
|||
getVehModel: function(data) { |
|||
return request({ |
|||
url: '/as/v1/AsServiceItem/getVehModel', |
|||
method: 'get', |
|||
params: data |
|||
}) |
|||
}, |
|||
getManufacturers: function(data) { |
|||
return request({ |
|||
url: '/as/v1/AsServiceItem/getManufacturers', |
|||
method: 'get', |
|||
params: data |
|||
}) |
|||
} |
|||
} |
@ -0,0 +1,286 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--列表页面--> |
|||
<div v-show="viewState == 1"> |
|||
<button-bar view-title="维修单管理" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/> |
|||
<!--Start查询列表部分--> |
|||
<div class="main-content"> |
|||
<div class="searchcon"> |
|||
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button> |
|||
<div v-show="isSearchShow" class="search"> |
|||
<el-form ref="listQueryform" :inline="true" :model="listQuery" label-width="100px" class="tab-header"> |
|||
<el-form-item label="客户"> |
|||
<el-input v-model="listQuery.params.customerName" placeholder="" clearable/> |
|||
</el-form-item> |
|||
<el-form-item label="联系电话"> |
|||
<el-input v-model="listQuery.params.mobile" placeholder="" clearable/> |
|||
</el-form-item> |
|||
<el-form-item label="车牌号"> |
|||
<el-input v-model="listQuery.params.vehMark" placeholder="" clearable/> |
|||
</el-form-item> |
|||
<el-form-item label="车型"> |
|||
<el-input v-model="listQuery.params.vehModel" placeholder="" clearable/> |
|||
</el-form-item> |
|||
<el-form-item label="创建日期"> |
|||
<el-date-picker v-model="listQuery.params.startTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker> |
|||
<span style="padding: 0 8px">至</span> |
|||
<el-date-picker v-model="listQuery.params.endTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div class="btn" style="text-align: center;"> |
|||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleFilter">查询</el-button> |
|||
<el-button type="primary" icon="el-icon-refresh" size="small" @click="handleReset">重置</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!--End查询列表部分--> |
|||
<div class="listtop"> |
|||
<div class="tit">维修单列表</div> |
|||
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
<!--Start 主页面主要部分 --> |
|||
<div class=""> |
|||
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" align="center" width="50"/> |
|||
<el-table-column label="序号" type="index" width="80" :index="indexMethod" align="center"/> |
|||
<el-table-column label="操作" width="180px" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="primary" size="mini" @click="toEdit(scope.row)">办理</el-button> |
|||
<el-button type="primary" size="mini" @click="toInfo(scope.row)">查看</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="billNo" label="单据编号" align="center" width="180" /> |
|||
<el-table-column prop="billType" label="单据类型" align="center" width="120" /> |
|||
<el-table-column prop="customerName" label="客户名称" align="center" width="120" /> |
|||
<el-table-column prop="vehMark" label="车牌号" align="center" width="120" /> |
|||
<el-table-column prop="vinNo" label="车架号" align="center" width="120" /> |
|||
<el-table-column prop="createTime" label="创建日期" align="center" width="120" /> |
|||
<el-table-column prop="entryTime" label="进场时间" align="center" width="120" /> |
|||
<el-table-column prop="estimatedFinishTime" label="预计完工时间" align="center" width="100" /> |
|||
<el-table-column prop="subject" label="科目" align="center" width="100" /> |
|||
<el-table-column prop="nodeName" label="当前环节" align="center" width="100" /> |
|||
<el-table-column prop="nodeTime" label="进入当前环节时间" align="center" width="160" /> |
|||
</el-table> |
|||
</div> |
|||
<!--End 主页面主要部分--> |
|||
<div class="pages"> |
|||
<div class="tit"/> |
|||
<!-- 翻页 --> |
|||
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
<!--End查询列表部分--> |
|||
</div> |
|||
</div> |
|||
<!--新增及修改 --> |
|||
<repairbillAdd v-show="viewState == 2 || viewState == 3" ref="divAdd" @doback="resetState" @reloadlist="getList"/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Pagination from '@/components/pagination' |
|||
import pageye from '@/components/pagination/pageye' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
import req from '@/api/operation/repairbill' |
|||
import repairbillAdd from './repairbillAdd' |
|||
export default { |
|||
name: 'RepairBill', |
|||
components: { |
|||
Pagination, |
|||
pageye, |
|||
ButtonBar, |
|||
repairbillAdd |
|||
}, |
|||
data() { |
|||
return { |
|||
btndisabled: false, |
|||
btnList: [ |
|||
{ |
|||
type: 'primary', |
|||
size: 'small', |
|||
icon: 'plus', |
|||
btnKey: 'toAdd', |
|||
btnLabel: '新增' |
|||
}, |
|||
{ |
|||
type: 'danger', |
|||
size: 'small', |
|||
icon: 'del', |
|||
btnKey: 'doDel', |
|||
btnLabel: '删除' |
|||
}, |
|||
{ |
|||
type: 'info', |
|||
size: 'small', |
|||
icon: 'cross', |
|||
btnKey: 'doClose', |
|||
btnLabel: '关闭' |
|||
} |
|||
], |
|||
isSearchShow: false, |
|||
searchxianshitit: '显示查询条件', |
|||
viewState: 1, // 1、列表 2、新增 3、编辑 4、查看 |
|||
tableKey: 0, |
|||
list: [], |
|||
sids: [], // 用于导出的时候保存已选择的SIDs |
|||
FormLoading: false, |
|||
listLoading: false, |
|||
// 翻页 |
|||
listQuery: { |
|||
current: 1, |
|||
size: 10, |
|||
total: 0, |
|||
params: { |
|||
startTime: '', |
|||
endTime: '', |
|||
customerName: '', |
|||
mobile: '', |
|||
vehMark: '', |
|||
vehModel: '', |
|||
orgPath: '', |
|||
nodeCode: '' |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
created() { |
|||
// 初始化变量 |
|||
this.getList() |
|||
}, |
|||
mounted() { |
|||
this.$refs['btnbar'].setButtonList(this.btnList) |
|||
}, |
|||
methods: { |
|||
// 搜索条件效果 |
|||
clicksearchShow() { |
|||
this.isSearchShow = !this.isSearchShow |
|||
if (this.isSearchShow) { |
|||
this.searchxianshitit = '隐藏查询条件' |
|||
} else { |
|||
this.searchxianshitit = '显示查询条件' |
|||
} |
|||
}, |
|||
btnHandle(btnKey) { |
|||
console.log('XXXXXXXXXXXXXXX ' + btnKey) |
|||
switch (btnKey) { |
|||
case 'toAdd': |
|||
this.toAdd() |
|||
break |
|||
case 'doDel': |
|||
this.doDel() |
|||
break |
|||
case 'doClose': |
|||
this.doClose() |
|||
break |
|||
default: |
|||
break |
|||
} |
|||
}, |
|||
// 信息条数 获取点击时当前的sid |
|||
handleSelectionChange(row) { |
|||
const aa = [] |
|||
row.forEach(element => { |
|||
aa.push(element.sid) |
|||
}) |
|||
this.sids = aa |
|||
}, |
|||
// 表中序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.listQuery.current - 1) * this.listQuery.size |
|||
var pageindex = index + 1 + pagestart |
|||
return pageindex |
|||
}, |
|||
// 查询列表信息 |
|||
getList() { |
|||
this.listLoading = true |
|||
this.listQuery.params.nodeCode = '1' |
|||
this.listQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|||
req.listPage(this.listQuery).then(response => { |
|||
this.listLoading = false |
|||
if (response.success) { |
|||
this.list = response.data.records |
|||
this.listQuery.total = response.data.total |
|||
} else { |
|||
this.list = [] |
|||
this.listQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
// 查询按钮 |
|||
handleFilter() { |
|||
this.listQuery.current = 1 |
|||
this.getList() |
|||
}, |
|||
// 点击重置 |
|||
handleReset() { |
|||
this.listQuery = { |
|||
current: 1, |
|||
size: 10, |
|||
total: 0, |
|||
params: { |
|||
startTime: '', |
|||
endTime: '', |
|||
customerName: '', |
|||
mobile: '', |
|||
vehMark: '', |
|||
vehModel: '', |
|||
orgPath: '', |
|||
nodeCode: '' |
|||
} |
|||
} |
|||
this.getList() |
|||
}, |
|||
toAdd() { |
|||
this.viewState = 2 |
|||
this.$refs['divAdd'].showAdd() |
|||
}, |
|||
toEdit(row) { |
|||
this.viewState = 3 |
|||
this.$refs['divAdd'].showEdit(row) |
|||
}, |
|||
toInfo(row) { |
|||
this.viewState = 4 |
|||
this.$refs['divInfo'].showInfo(row) |
|||
}, |
|||
// 删除 |
|||
doDel() { |
|||
if (this.sids.length === 0) { |
|||
this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' }) |
|||
return |
|||
} |
|||
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?' |
|||
this.$confirm(tip, '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
const loading = this.$loading({ |
|||
lock: true, |
|||
text: 'Loading', |
|||
spinner: 'el-icon-loading', |
|||
background: 'rgba(0, 0, 0, 0.7)' |
|||
}) |
|||
req.deleteBySids(this.sids).then(resp => { |
|||
if (resp.success) { |
|||
this.$message({ type: 'success', message: resp.msg, showClose: true }) |
|||
} |
|||
this.getList() |
|||
loading.close() |
|||
}).catch(e => { |
|||
loading.close() |
|||
}) |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
// 修改、编辑、详情返回列表页面 |
|||
resetState() { |
|||
this.viewState = 1 |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch('tagsView/delView', this.$route) |
|||
this.$router.go(-1) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
</style> |
@ -0,0 +1,741 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState == 1"> |
|||
<div class="tab-header webtop"> |
|||
<div>{{ viewTitle }}</div> |
|||
<div> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate()">保存</el-button> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submit()">提交</el-button> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="settleAccounts()">结算</el-button> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<div class="listconadd"> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
<el-collapse v-model="activeNames"> |
|||
<el-collapse-item title="客户信息" name="1"> |
|||
<el-row style="border-top: 1px solid #e0e3eb"> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">客户</div> |
|||
<el-form-item> |
|||
<el-popover placement="right" width="600" trigger="click"> |
|||
<div> |
|||
<el-table :data="clientData" v-loading="clientLoading" highlight-current-row @current-change="clientCurrentChange"> |
|||
<el-table-column fixed prop="vehMark" label="车辆拍照" align="center" width="130" /> |
|||
<el-table-column prop="name" label="客户" align="center" width="100" /> |
|||
<el-table-column prop="mobile" label="联系方式" align="center" min-width="300" /> |
|||
<el-table-column prop="orgName" label="客户单位" align="center" width="100" /> |
|||
</el-table> |
|||
<el-pagination :page.sync="clientQuery.current" :page-size="clientQuery.size" layout="total, pager" :total="clientQuery.total" /> |
|||
</div> |
|||
<el-input slot="reference" class="addinputInfo" style="width: 20%" v-model="formobj.customerName" @input="clientInput(formobj.customerName)" clearable placeholder="车辆牌照"/> |
|||
</el-popover> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">客户</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.customerName }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">车辆牌照</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.vehMark }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">联系电话</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.mobile }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">车架号</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.vinNo }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">行驶里程</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.mileage }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">单位</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.customerOrg }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">车型</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.vehModel }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">会员卡号</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.memberCarNumber }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">油量</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.oil }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">当前里程</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.currentMileage }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-collapse-item> |
|||
<el-collapse-item title="单据信息" name="2"> |
|||
<el-row style="border-top: 1px solid #E0E3EB"> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">单据编号</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.billNo }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">进场时间</div> |
|||
<el-form-item><el-date-picker class="addinputInfo" v-model="formobj.entryTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">预计完工</div> |
|||
<el-form-item><el-date-picker class="addinputInfo" v-model="formobj.estimatedFinishTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期" /></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">科目</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.vehModel }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">服务顾问</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.memberCarNumber }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">快捷备注</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.shotRemarks }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">备注(打印)</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.printRemarks }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">备注</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.remarks }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">主修人</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.mainRepairers }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-collapse-item> |
|||
<el-collapse-item title="送修人信息" name="3"> |
|||
</el-collapse-item> |
|||
<el-collapse-item title="保险信息" name="4"> |
|||
</el-collapse-item> |
|||
<el-collapse-item title="发票信息" name="5"> |
|||
</el-collapse-item> |
|||
</el-collapse> |
|||
<el-table :key="serviceKey" :data="formobj.sitemVos" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column align="center" width="70"> |
|||
<template slot="header"> |
|||
<i class="add-btn-icon el-icon-plus" style="color: red;font-size:20px" @click="serviceAdd"></i> |
|||
</template> |
|||
<template slot-scope="scope"> |
|||
<i class="el-icon-delete" @click="serviceDelete(scope.$index)"></i> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="服务项目" align="center" min-width="200"> |
|||
<template slot-scope="scope"> |
|||
<el-popover placement="right" width="600" trigger="click"> |
|||
<div> |
|||
<el-table :data="serviceData" v-loading="serviceLoading" highlight-current-row @current-change="serviceCurrentChange($event, scope.row)"> |
|||
<el-table-column fixed prop="goodsName" label="商品名称" align="center" width="130" /> |
|||
<el-table-column prop="goodsCode" label="零件号" align="center" width="100" /> |
|||
<el-table-column prop="goodsModel" label="车型" align="center" min-width="300" /> |
|||
<el-table-column prop="warehouse" label="仓库" align="center" width="" /> |
|||
<el-table-column prop="price" label="销售价" align="center" width="100" /> |
|||
<el-table-column prop="count" label="数量" align="center" width="100" /> |
|||
</el-table> |
|||
<el-pagination :page.sync="serviceQuery.current" :page-size="serviceQuery.size" layout="total, pager" :total="serviceQuery.total" /> |
|||
</div> |
|||
<el-input slot="reference" v-model="scope.row.goodsName" @input="serviceInput(scope.row.goodsName)" clearable placeholder="项目名称、拼音"/> |
|||
</el-popover> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="工种" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-select v-model="scope.row.serviceType" placeholder="请选择" @change="serviceTypeChange($event, scope.row)" clearable filterable> |
|||
<el-option v-for="item in serviceType_list" :key="item.serviceTypeSid" :label="item.serviceType" :value="item.serviceType"></el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="科目" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-select v-model="scope.row.subject" placeholder="请选择" @change="subjectChange($event, scope.row)" clearable filterable> |
|||
<el-option v-for="item in subject_list" :key="item.subjectSid" :label="item.subject" :value="item.subject"></el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="考核工时" align="center" width="130"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.examineHourPrice" @keyup.native="scope.row.examineHourPrice = getNumber(scope.row.examineHourPrice, 2)" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="工时单价" align="center" width="130"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="computeXSJ(scope.row)" v-model="scope.row.hourPrice" @keyup.native="scope.row.hourPrice = getNumber(scope.row.hourPrice, 2)" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="工时数" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="computeXSJ(scope.row)" v-model="scope.row.hours" @keyup.native="scope.row.hours = getNumber(scope.row.hours, 2)" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="销售价" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="computeGSS(scope.row)" v-model="scope.row.price" @keyup.native="scope.row.price = getNumber(scope.row.price, 2)" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="折扣" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="computeYHAndXSJE(scope.row)" v-model="scope.row.discount" @keyup.native="scope.row.discount = getNumber(scope.row.discount, 2)" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="discountAmount" label="优惠" align="center" width="100" /> |
|||
<el-table-column prop="amount" label="销售金额" align="center" width="100" /> |
|||
<el-table-column label="备注" align="center" width="200"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.remarks" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="title">附加项目列表</div> |
|||
<el-table :key="subjoinKey" :data="formobj.aitemVos" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column align="center" width="70"> |
|||
<template slot="header"> |
|||
<i class="add-btn-icon el-icon-plus" style="color: red;font-size:20px" @click="subjoinAdd"></i> |
|||
</template> |
|||
<template slot-scope="scope"> |
|||
<i class="el-icon-delete" @click="subjoinDelete(scope.$index)"></i> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="附加项目" align="center" width="200"> |
|||
<template slot-scope="scope"> |
|||
<el-popover placement="right" width="500" trigger="click"> |
|||
<div> |
|||
<el-table :data="subjoinData" v-loading="subjoinLoading" highlight-current-row @current-change="subjoinCurrentChange($event, scope.row)"> |
|||
<el-table-column fixed prop="aitemName" label="项目名称" align="center" /> |
|||
<el-table-column prop="aitemCode" label="拼音缩写" align="center" /> |
|||
<el-table-column prop="price" label="销售金额" align="center" /> |
|||
</el-table> |
|||
<el-pagination :page.sync="subjoinQuery.current" :page-size="subjoinQuery.size" layout="total, pager" :total="subjoinQuery.total" /> |
|||
</div> |
|||
<el-input slot="reference" v-model="scope.row.aitemName" @input="subjoinInput(scope.row.aitemName)" clearable placeholder="项目名称、拼音"/> |
|||
</el-popover> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="销售价" align="center" width="150"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.price" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="备注" align="center" min-width="200"> |
|||
<template slot-scope="scope"> |
|||
<el-input v-model="scope.row.remarks" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">合计金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ jeTotal }} = 工时费:{{ gsfTotal }} + 附加费:{{ fjfTotal }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty">应收金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ ysjeTotal }} = 合计金额:{{ jeTotal }} - 优惠:<el-input style="width: 100px" v-model="formobj.discountAmount" clearable placeholder="" /> - 优惠券:<el-input style="width: 100px" v-model="formobj.coupon" clearable placeholder="" /> - 积分抵扣:<el-input style="width: 100px" v-model="formobj.scoreDeduct" clearable placeholder="" /></span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
<el-dialog :visible.sync="settleVisible" width="70%"> |
|||
<el-form :model="formobj" class="formaddcopy02"> |
|||
<el-row style="border-top: 1px solid #e0e3eb"> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">应付金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.payableAmount }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="16"> |
|||
<div class="span-sty">预付款抵扣</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.prepaymentdeductAmount" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">结算方式</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.settleValue" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">结算金额</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.settleAmount" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">结算时间</div> |
|||
<el-form-item><el-date-picker class="addinputInfo addinputw" v-model="formobj.settleTime" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期" /></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">其他结算方式</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.otherSettleKey" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">其他结算金额</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.otherSettleValue" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">欠款金额</div> |
|||
<el-form-item><span class="addinputInfo">{{ debts }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div style="text-align:center;margin-top: 20px;"> |
|||
<el-button type="primary" size="mini" @click="confirm">确 定</el-button> |
|||
<el-button type="info " size="mini" @click="settleVisible = false">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/operation/repairbill' |
|||
import maintenanceitem from '@/api/basicinformation/maintenanceitem' |
|||
import additionitem from '@/api/basicinformation/additionitem' |
|||
import { getServiceType, selSubjectInfo } from '@/api/Common/dictcommons' |
|||
|
|||
export default { |
|||
name: 'RepairBillAdd', |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
submitdisabled: false, |
|||
settleVisible: false, // 结算弹框 |
|||
activeNames: '1', |
|||
index: 0, |
|||
// client客户 |
|||
clientKey: 1, |
|||
clientLoading: false, |
|||
clientQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
queryName: '', |
|||
useOrgSid: '' |
|||
} |
|||
}, |
|||
clientData: [], |
|||
// service服务 |
|||
serviceKey: 1, |
|||
serviceLoading: false, |
|||
serviceQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
sitemName: '', |
|||
orgPath: '' |
|||
} |
|||
}, |
|||
serviceData: [], |
|||
// subjoin附加项目 |
|||
subjoinKey: 2, |
|||
subjoinLoading: false, |
|||
subjoinQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
aitemName: '', |
|||
orgPath: '' |
|||
} |
|||
}, |
|||
subjoinData: [], |
|||
formobj: { |
|||
sid: '', |
|||
createByName: '', |
|||
operator: '', |
|||
billNo: '', |
|||
billType: '', |
|||
entryTime: '', |
|||
estimatedFinishTime: '', |
|||
subjectSid: '', |
|||
subject: '', |
|||
waitorSid: '', |
|||
waitorName: '', |
|||
mainRepairers: '', |
|||
barCode: '', |
|||
shotRemarks: '', |
|||
printRemarks: '', |
|||
discountAmount: '', |
|||
coupon: '', |
|||
scoreDeduct: '', |
|||
nodeName: '', |
|||
nodeTime: '', |
|||
outDoorState: '', |
|||
outDoorTime: '', |
|||
useOrgSid: '', |
|||
createOrgSid: '', |
|||
customerSid: '', |
|||
customerName: '', |
|||
mobile: '', |
|||
customerOrg: '', |
|||
memberCardSid: '', |
|||
memberCarNumber: '', |
|||
vehMark: '', |
|||
vinNo: '', |
|||
vehModel: '', |
|||
mileage: '', |
|||
oil: '', |
|||
currentMileage: '', |
|||
invoiceVo: { |
|||
isInvoicing: '', |
|||
invoiceType: '', |
|||
invoiceTitle: '', |
|||
taxpayerNo: '', |
|||
invoiceCode: '', |
|||
taxRate: '' |
|||
}, |
|||
insuranceVo: { |
|||
responsibility: '', |
|||
otherInsuranceType: '', |
|||
insuranceCompany1: '', |
|||
insuranceCompany2: '', |
|||
insurer: '', |
|||
claimBillNo: '', |
|||
investigator: '', |
|||
lossAdjuster: '', |
|||
isSpecialSign: '', |
|||
accidentType: '' |
|||
}, |
|||
otherVo: { |
|||
manufacturer: '', |
|||
senderName: '', |
|||
senderMobile: '' |
|||
}, |
|||
sitemVos: [], |
|||
aitemVos: [], |
|||
goodsDetailsVos: [] |
|||
}, |
|||
serviceType_list: [], |
|||
subject_list: [], |
|||
rules: {} |
|||
} |
|||
}, |
|||
computed: { |
|||
gsfTotal() { |
|||
let gsf = '0' |
|||
if (this.formobj.sitemVos.length > 0) { |
|||
this.formobj.sitemVos.forEach((e) => { |
|||
if (e.goodsName !== '') { |
|||
gsf = Math.round((parseFloat(gsf) + parseFloat(e.price !== '' ? e.price : '0')) * 100) / 100 |
|||
} |
|||
}) |
|||
} |
|||
return gsf |
|||
}, |
|||
fjfTotal() { |
|||
let fjf = '0' |
|||
if (this.formobj.aitemVos.length > 0) { |
|||
this.formobj.aitemVos.forEach((e) => { |
|||
if (e.aitemName !== '') { |
|||
fjf = Math.round((parseFloat(fjf) + parseFloat(e.price !== '' ? e.price : '0')) * 100) / 100 |
|||
} |
|||
}) |
|||
} |
|||
return fjf |
|||
}, |
|||
// 计算合计金额 |
|||
jeTotal() { |
|||
let je = '0' |
|||
je = Math.round((parseFloat(je) + parseFloat(this.gsfTotal) + parseFloat(this.fjfTotal)) * 100) / 100 |
|||
return je |
|||
}, |
|||
// 计算应收金额 |
|||
ysjeTotal() { |
|||
let ysje = '0' |
|||
ysje = Math.round((parseFloat(ysje) + parseFloat(this.jeTotal) - parseFloat(this.formobj.discountAmount !== '' ? this.formobj.discountAmount : '0') - parseFloat(this.formobj.coupon !== '' ? this.formobj.coupon : '0') - parseFloat(this.formobj.scoreDeduct !== '' ? this.formobj.scoreDeduct : '0')) * 100) / 100 |
|||
return ysje |
|||
} |
|||
}, |
|||
methods: { |
|||
init() { |
|||
getServiceType({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => { |
|||
if (resp.success) { |
|||
this.serviceType_list = resp.data |
|||
} |
|||
}) |
|||
selSubjectInfo({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => { |
|||
if (resp.success) { |
|||
this.subject_list = resp.data |
|||
} |
|||
}) |
|||
}, |
|||
getNumber(val, limit) { |
|||
val = val.replace(/[^0-9.]/g, '') // 保留数字 |
|||
val = val.replace(/^00/, '0.') // 开头不能有两个0 |
|||
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0. |
|||
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个 |
|||
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点 |
|||
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0 |
|||
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$' |
|||
const reg = new RegExp(str) |
|||
if (limit === 0) { |
|||
// 不需要小数点 |
|||
val = val.replace(reg, '$1') |
|||
} else { |
|||
// 通过正则保留小数点后指定的位数 |
|||
val = val.replace(reg, '$1.$2') |
|||
} |
|||
return val |
|||
}, |
|||
showAdd() { |
|||
this.viewTitle = '【新增】维修单' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
}, |
|||
showEdit() { |
|||
this.viewTitle = '【编辑】维修单' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
}, |
|||
clientInput(value) { |
|||
this.clientQuery.params.queryName = value |
|||
this.clientLoading = true |
|||
req.customerListPage(this.clientQuery).then((response) => { |
|||
if (response.success) { |
|||
this.clientLoading = false |
|||
this.clientData = response.data.records |
|||
this.clientQuery.total = response.data.total |
|||
} else { |
|||
this.serviceLoading = false |
|||
this.clientData = [] |
|||
this.clientQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
clientCurrentChange(value) { |
|||
// this.formobj.customerName = value.name |
|||
// this.formobj.vehMark = value.vehMark |
|||
// this.formobj.mobile = value.mobile |
|||
document.body.click() |
|||
}, |
|||
serviceAdd() { |
|||
this.formobj.sitemVos.push({ |
|||
serviceItemSid: '', |
|||
serviceItem: '', |
|||
serviceTypeSid: '', |
|||
serviceType: '', |
|||
subjectSid: '', |
|||
subject: '', |
|||
examineHourPrice: '', |
|||
hourPrice: '', |
|||
hours: '', |
|||
price: '', |
|||
discount: '', |
|||
discountAmount: '', |
|||
amount: '', |
|||
repairerSid: '', |
|||
groupSid: '', |
|||
groupName: '' |
|||
}) |
|||
}, |
|||
serviceInput(value) { |
|||
this.serviceQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|||
this.serviceQuery.params.sitemName = value |
|||
this.serviceLoading = true |
|||
maintenanceitem.listPage(this.serviceQuery).then((response) => { |
|||
if (response.success) { |
|||
this.serviceLoading = false |
|||
this.serviceData = response.data.records |
|||
this.serviceQuery.total = response.data.total |
|||
} else { |
|||
this.serviceLoading = false |
|||
this.serviceData = [] |
|||
this.serviceQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
serviceDelete(index) { |
|||
this.formobj.sitemVos.splice(index, 1) |
|||
}, |
|||
serviceCurrentChange(value, row) { |
|||
row.goodsSid = value.goodsSid |
|||
row.goodsName = value.goodsName |
|||
row.goodsCode = value.goodsCode |
|||
row.goodsModelSid = value.goodsModelSid |
|||
row.goodsModel = value.goodsModel |
|||
row.unit = value.unit |
|||
row.warehouse = value.warehouse |
|||
row.warehouseSid = value.warehouseSid |
|||
row.subjectSid = '' |
|||
row.subject = '' |
|||
row.count = value.count |
|||
row.price = value.price |
|||
row.discount = value.discount |
|||
row.discountAmount = value.discountAmount |
|||
row.amount = value.amount |
|||
row.specification = value.specification |
|||
document.body.click() |
|||
}, |
|||
serviceTypeChange(value, row) { |
|||
const choose = this.serviceType_list.filter((item) => item.serviceType === value) |
|||
if (choose !== null && choose.length > 0) { |
|||
row.serviceTypeSid = choose[0].serviceTypeSid |
|||
} else { |
|||
row.serviceTypeSid = '' |
|||
} |
|||
}, |
|||
subjectChange(value, row) { |
|||
const choose = this.subject_list.filter((item) => item.subject === value) |
|||
if (choose !== null && choose.length > 0) { |
|||
row.subjectSid = choose[0].subjectSid |
|||
} else { |
|||
row.subjectSid = '' |
|||
} |
|||
}, |
|||
// 计算销售价=工时数*工时单价 |
|||
computeXSJ(row) { |
|||
row.price = Math.round((parseFloat(row.hourPrice === '' ? '0' : row.hourPrice) * parseFloat(row.hours === '' ? '0' : row.hours)) * 100) / 100 |
|||
this.computeYHAndXSJE(row) |
|||
}, |
|||
// 计算工时数=销售价除以工时单价 |
|||
computeGSS(row) { |
|||
row.hours = Math.round((parseFloat(row.price === '' ? '0' : row.price) / parseFloat(row.hourPrice === '' ? '0' : row.hourPrice)) * 100) / 100 |
|||
this.computeYHAndXSJE(row) |
|||
}, |
|||
// 计算优惠、销售金额 |
|||
computeYHAndXSJE(row) { |
|||
// 计算优惠(销售价 * (1 - (折扣 * 0.1))) |
|||
row.discountAmount = Math.round((parseFloat(row.price === '' ? '0' : row.price) * Math.round((parseFloat(1) - parseFloat(row.discount === '' ? '0' : row.discount) * parseFloat(0.1)) * 100) / 100) * 100) / 100 |
|||
// 计算销售金额(销售价 - 优惠) |
|||
if (row.price == 0) { |
|||
row.amount = '0' |
|||
} else { |
|||
row.amount = Math.round((parseFloat(row.price === '' ? '0' : row.price) - parseFloat(row.discountAmount === '' ? '0' : row.discountAmount)) * 100) / 100 |
|||
} |
|||
}, |
|||
subjoinAdd() { |
|||
this.formobj.aitemVos.push({ |
|||
aitemSid: '', |
|||
aitemName: '', |
|||
price: '' |
|||
}) |
|||
}, |
|||
subjoinInput(value) { |
|||
this.subjoinQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|||
this.subjoinQuery.params.aitemName = value |
|||
this.subjoinLoading = true |
|||
additionitem.listPage(this.subjoinQuery).then((response) => { |
|||
if (response.success) { |
|||
this.subjoinLoading = false |
|||
this.subjoinData = response.data.records |
|||
this.subjoinQuery.total = response.data.total |
|||
} else { |
|||
this.subjoinLoading = false |
|||
this.subjoinData = [] |
|||
this.subjoinQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
subjoinDelete(index) { |
|||
this.formobj.aitemVos.splice(index, 1) |
|||
}, |
|||
subjoinCurrentChange(value, row) { |
|||
row.aitemSid = value.sid |
|||
row.aitemName = value.aitemName |
|||
row.price = value.price |
|||
document.body.click() |
|||
}, |
|||
saveOrUpdate() { |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
req.saveOrUpdate(this.formobj).then((res) => { |
|||
if (res.success) { |
|||
this.$message({ showClose: true, type: 'success', message: '保存成功' }) |
|||
this.handleReturn('true') |
|||
} else { |
|||
this.submitdisabled = false |
|||
} |
|||
}).catch(() => { |
|||
this.submitdisabled = false |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
submit() { |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
req.submit(this.formobj).then((res) => { |
|||
if (res.success) { |
|||
this.$message({ showClose: true, type: 'success', message: '提交成功' }) |
|||
this.handleReturn('true') |
|||
} else { |
|||
this.submitdisabled = false |
|||
} |
|||
}).catch(() => { |
|||
this.submitdisabled = false |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
settleAccounts() { |
|||
this.settleVisible = true |
|||
// this.formobj.payableAmount = this.yfjeTotal |
|||
}, |
|||
confirm() { |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
req.settlement(this.formobj).then((res) => { |
|||
if (res.success) { |
|||
this.$message({ showClose: true, type: 'success', message: '结算成功' }) |
|||
this.handleReturn('true') |
|||
} else { |
|||
this.submitdisabled = false |
|||
} |
|||
}).catch(() => { |
|||
this.submitdisabled = false |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
this.formobj = {} |
|||
this.submitdisabled = false |
|||
this.$emit('doback') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.span-sty { |
|||
width: 130px !important; |
|||
} |
|||
.addinputInfo { |
|||
margin-left: 120px !important; |
|||
} |
|||
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .addinputw { |
|||
margin-left: 120px !important; |
|||
width: calc(100% - 115px); |
|||
} |
|||
</style> |
Loading…
Reference in new issue