6 changed files with 1033 additions and 1 deletions
@ -0,0 +1,44 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export default { |
|||
// 查询分页列表
|
|||
listPage: function(params) { |
|||
return request({ |
|||
url: '/as/v1/asservicepackage/listPage', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
fetchBySid: function(data) { |
|||
return request({ |
|||
url: '/as/v1/asservicepackage/fetchDetailsBySid/' + data, |
|||
method: 'get' |
|||
}) |
|||
}, |
|||
saveOrUpdate: function(data) { |
|||
return request({ |
|||
url: '/as/v1/asservicepackage/savePackage', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
deleteBySids: function(data) { |
|||
return request({ |
|||
url: '/as/v1/asservicepackage/delBySids', |
|||
method: 'DELETE', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
// 获取商品信息
|
|||
selGoodsInfo: function(data) { |
|||
return request({ |
|||
url: '/as/v1/asservicepackage/selGoodsInfo', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
}, |
|||
} |
@ -0,0 +1,255 @@ |
|||
<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.packageName" placeholder="" clearable/> |
|||
</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="true" 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="packageName" label="套餐" align="center" /> |
|||
<el-table-column prop="remarks" label="备注" align="center" /> |
|||
</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> |
|||
<!--新增及修改 --> |
|||
<setmealAdd v-show="viewState == 2 || viewState == 3" ref="divAdd" @doback="resetState" @reloadlist="getList"/> |
|||
<!--详情--> |
|||
<setmealInfo v-show="viewState == 4" ref="divInfo" @doback="resetState" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Pagination from '@/components/pagination' |
|||
import pageye from '@/components/pagination/pageye' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
import req from '@/api/setmeal/setmeal' |
|||
import setmealAdd from './setmealAdd' |
|||
import setmealInfo from './setmealInfo' |
|||
|
|||
export default { |
|||
name: 'SetMeal', |
|||
components: { |
|||
Pagination, |
|||
pageye, |
|||
ButtonBar, |
|||
setmealAdd, |
|||
setmealInfo |
|||
}, |
|||
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: { |
|||
packageName: '', |
|||
orgPath: '' |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
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.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: { |
|||
packageName: '', |
|||
orgPath: '' |
|||
} |
|||
} |
|||
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,569 @@ |
|||
<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="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<div class="listconadd"> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
<el-row style="border-top: 1px solid #e0e3eb"> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">套餐名称</div> |
|||
<el-form-item><el-input class="addinputInfo addinputw" v-model="formobj.packageName" clearable placeholder="" /></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.remarks" clearable placeholder="" /></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<div class="title">服务项目列表</div> |
|||
<el-table :key="serviceKey" :data="formobj.itemVos" :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" :render-header="serviceHeader"> |
|||
<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="300"> |
|||
<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="sitemName" label="项目名称" align="center" width="130" /> |
|||
<el-table-column prop="sitemCode" label="拼音缩写" align="center" width="100" /> |
|||
<el-table-column prop="serviceType" label="分类" align="center" width="100" /> |
|||
<el-table-column prop="manufacturer" label="厂家" align="center" width="100" /> |
|||
<el-table-column prop="goodsModel" label="车型" align="center" min-width="300" /> |
|||
</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.sitemName" @input="serviceInput(scope.row.sitemName)" 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" 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" 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.hours" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="销售价" align="center" width="130"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="computeGSS(scope.row)" v-model="scope.row.price" 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" 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> |
|||
<div class="title">商品列表</div> |
|||
<el-table :key="commodityKey" :data="formobj.goodsVos" :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" :render-header="commodityHeader"> |
|||
<template slot-scope="scope"> |
|||
<i class="el-icon-delete" @click="commodityDelete(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="commodityData" v-loading="commodityLoading" highlight-current-row @current-change="commodityCurrentChange($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="commodityQuery.current" :page-size="commodityQuery.size" layout="total, pager" :total="commodityQuery.total" /> |
|||
</div> |
|||
<el-input slot="reference" v-model="scope.row.goodsName" @input="commodityInput(scope.row.goodsName)" clearable placeholder="商品名称、零件号、车型"/> |
|||
</el-popover> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="goodsModel" label="车型" align="center" min-width="300" /> |
|||
<el-table-column prop="goodsCode" label="零件号" align="center" width="100" /> |
|||
<el-table-column prop="unit" label="计量单位" align="center" width="100" /> |
|||
<el-table-column prop="specification" label="规格" align="center" width="100" /> |
|||
<el-table-column prop="warehouse" label="仓库" align="center" width="100" /> |
|||
<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 @input="commodityComputeYHAndXSJE(scope.row)" v-model="scope.row.price" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="数量" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="commodityComputeYHAndXSJE(scope.row)" v-model="scope.row.count" clearable placeholder="" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="折扣" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-input @input="commodityComputeYHAndXSJE(scope.row)" v-model="scope.row.discount" 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> |
|||
<div class="title">附加项目列表</div> |
|||
<el-table :key="subjoinKey" :data="formobj.attachItemVos" :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" :render-header="subjoinHeader"> |
|||
<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 prop="price" label="销售价" align="center" min-width="300" /> |
|||
</el-table> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/setmeal/setmeal' |
|||
import maintenanceitem from '@/api/maintenanceitem/maintenanceitem' |
|||
import additionitem from '@/api/additionitem/additionitem' |
|||
import { getServiceType, selSubjectInfo } from '@/api/Common/dictcommons' |
|||
|
|||
export default { |
|||
name: 'SetMealAdd', |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
submitdisabled: false, |
|||
index: 0, |
|||
// service服务项目 |
|||
serviceKey: 0, |
|||
serviceLoading: false, |
|||
serviceQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
sitemName: '', |
|||
orgPath: '' |
|||
} |
|||
}, |
|||
serviceType_list: [], |
|||
subject_list: [], |
|||
serviceData: [], |
|||
// commodity商品 |
|||
commodityKey: 1, |
|||
commodityLoading: false, |
|||
commodityQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
name: '' |
|||
} |
|||
}, |
|||
commodityData: [], |
|||
// subjoin附加项目 |
|||
subjoinKey: 2, |
|||
subjoinLoading: false, |
|||
subjoinQuery: { |
|||
current: 1, |
|||
size: 2, |
|||
total: 0, |
|||
params: { |
|||
aitemName: '', |
|||
orgPath: '' |
|||
} |
|||
}, |
|||
subjoinData: [], |
|||
formobj: { |
|||
sid: '', |
|||
createBySid: '', |
|||
useOrgSid: '', |
|||
packageName: '', |
|||
remarks: '', |
|||
createOrgSid: '', |
|||
orgPath: '', |
|||
itemVos: [], |
|||
goodsVos: [], |
|||
attachItemVos: [] |
|||
}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
methods: { |
|||
init() { |
|||
getServiceType({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { |
|||
if (res.success) { |
|||
this.serviceType_list = res.data |
|||
} |
|||
}) |
|||
selSubjectInfo({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { |
|||
if (res.success) { |
|||
this.subject_list = res.data |
|||
} |
|||
}) |
|||
}, |
|||
showAdd() { |
|||
this.viewTitle = '【新增】套餐' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
this.init() |
|||
}, |
|||
showEdit(row) { |
|||
this.viewTitle = '【新增】套餐' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
this.init() |
|||
req.fetchBySid(row.sid).then((res) => { |
|||
if (res.success) { |
|||
this.formobj = res.data |
|||
} |
|||
}) |
|||
}, |
|||
// 在头部标题上添加“新增”图标 |
|||
serviceHeader(h, { column }) { |
|||
return h( |
|||
'div', |
|||
[ |
|||
h('span', column.label), |
|||
h('i', { |
|||
class: 'add-btn-icon el-icon-plus', |
|||
style: 'color: red;font-size:20px', |
|||
on: { |
|||
click: this.serviceAdd // 点击执行函数 |
|||
} |
|||
}) |
|||
] |
|||
) |
|||
}, |
|||
serviceAdd() { |
|||
this.formobj.itemVos.push({ |
|||
sitemSid: '', |
|||
sitemName: '', |
|||
serviceTypeSid: '', |
|||
serviceType: '', |
|||
hourPrice: '10', |
|||
hours: '0', |
|||
examineHourPrice: '0', |
|||
price: '0', |
|||
subjectSid: '', |
|||
subject: '', |
|||
discount: '10', |
|||
discountAmount: '0', |
|||
amount: '0' |
|||
}) |
|||
}, |
|||
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.itemVos.splice(index, 1) |
|||
}, |
|||
serviceCurrentChange(value, row) { |
|||
row.sitemName = value.sitemName |
|||
row.sitemSid = value.sid |
|||
row.serviceType = value.serviceType |
|||
row.serviceTypeSid = value.serviceTypeSid |
|||
row.hourPrice = value.hourPrice |
|||
row.hours = value.hours |
|||
row.examineHourPrice = value.examineHourPrice |
|||
row.price = value.price |
|||
row.subjectSid = '' |
|||
row.subject = '' |
|||
row.discount = '10' |
|||
row.discountAmount = '0' |
|||
row.amount = Math.round((parseFloat(row.price) - parseFloat(row.discountAmount)) * 100) / 100 |
|||
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 |
|||
} |
|||
}, |
|||
// 在头部标题上添加“新增”图标 |
|||
commodityHeader(h, { column }) { |
|||
return h( |
|||
'div', |
|||
[ |
|||
h('span', column.label), |
|||
h('i', { |
|||
class: 'add-btn-icon el-icon-plus', |
|||
style: 'color: red;font-size:20px', |
|||
on: { |
|||
click: this.commodityAdd // 点击执行函数 |
|||
} |
|||
}) |
|||
] |
|||
) |
|||
}, |
|||
commodityAdd() { |
|||
this.formobj.goodsVos.push({ |
|||
goodsSid: '', |
|||
goodsName: '', |
|||
goodsCode: '', |
|||
goodsModelSid: '', |
|||
goodsModel: '', |
|||
unit: '', |
|||
warehouseSid: '', |
|||
warehouse: '', |
|||
subjectSid: '', |
|||
subject: '', |
|||
price: '0', |
|||
count: '0', |
|||
discount: '10', |
|||
discountAmount: '0', |
|||
amount: '0', |
|||
specification: '' |
|||
}) |
|||
}, |
|||
commodityInput(value) { |
|||
this.commodityQuery.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|||
this.commodityQuery.params.name = value |
|||
this.commodityLoading = true |
|||
req.selGoodsInfo(this.commodityQuery).then((response) => { |
|||
if (response.success) { |
|||
this.commodityLoading = false |
|||
this.commodityData = response.data.records |
|||
this.commodityQuery.total = response.data.total |
|||
} else { |
|||
this.serviceLoading = false |
|||
this.commodityData = [] |
|||
this.commodityQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
commodityDelete(index) { |
|||
this.formobj.goodsVos.splice(index, 1) |
|||
}, |
|||
commodityCurrentChange(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() |
|||
}, |
|||
// 计算优惠、销售金额 |
|||
commodityComputeYHAndXSJE(row) { |
|||
// 计算优惠(销售价 * (1 - (折扣 * 0.1))) |
|||
row.discountAmount = Math.round(((parseFloat(row.price === '' ? '0' : row.price) * parseFloat(row.count === '' ? '0' : row.count)) * 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.count === '' ? '0' : row.count)) - parseFloat(row.discountAmount === '' ? '0' : row.discountAmount)) * 100) / 100 |
|||
} |
|||
}, |
|||
// 在头部标题上添加“新增”图标 |
|||
subjoinHeader(h, { column }) { |
|||
return h( |
|||
'div', |
|||
[ |
|||
h('span', column.label), |
|||
h('i', { |
|||
class: 'add-btn-icon el-icon-plus', |
|||
style: 'color: red;font-size:20px', |
|||
on: { |
|||
click: this.subjoinAdd // 点击执行函数 |
|||
} |
|||
}) |
|||
] |
|||
) |
|||
}, |
|||
subjoinAdd() { |
|||
this.formobj.attachItemVos.push({ |
|||
aitemSid: '', |
|||
aitemName: '', |
|||
price: '0' |
|||
}) |
|||
}, |
|||
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.attachItemVos.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 |
|||
this.formobj.createBySid = window.sessionStorage.getItem('userSid') |
|||
this.formobj.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|||
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 |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
this.formobj = { |
|||
sid: '', |
|||
createBySid: '', |
|||
useOrgSid: '', |
|||
packageName: '', |
|||
remarks: '', |
|||
createOrgSid: '', |
|||
orgPath: '', |
|||
itemVos: [], |
|||
goodsVos: [], |
|||
attachItemVos: [] |
|||
} |
|||
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> |
@ -0,0 +1,129 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState == 1"> |
|||
<div class="tab-header webtop"> |
|||
<div>{{ viewTitle }}</div> |
|||
<div> |
|||
<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-row style="border-top: 1px solid #e0e3eb"> |
|||
<el-col :span="8"> |
|||
<div class="span-sty">套餐名称</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.packageName }}</span></el-form-item> |
|||
</el-col> |
|||
<el-col :span="16"> |
|||
<div class="span-sty">备注</div> |
|||
<el-form-item><span class="addinputInfo">{{ formobj.remarks }}</span></el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<div class="title">服务项目列表</div> |
|||
<el-table :key="serviceKey" :data="formobj.itemVos" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column prop="sitemName" label="项目名称" align="center" min-width="200" /> |
|||
<el-table-column prop="serviceType" label="工种" align="center" width="100" /> |
|||
<el-table-column prop="subject" label="科目" align="center" width="100" /> |
|||
<el-table-column prop="examineHourPrice" label="考核工时" align="center" width="100" /> |
|||
<el-table-column prop="hourPrice" label="工时单价" align="center" width="100" /> |
|||
<el-table-column prop="hours" label="工时数" align="center" width="100" /> |
|||
<el-table-column prop="price" label="销售价" align="center" width="100" /> |
|||
<el-table-column prop="discount" label="折扣" align="center" width="100" /> |
|||
<el-table-column prop="discountAmount" label="优惠" align="center" width="100" /> |
|||
<el-table-column prop="amount" label="金额" align="center" width="100" /> |
|||
</el-table> |
|||
<div class="title">商品列表</div> |
|||
<el-table :key="commodityKey" :data="formobj.goodsVos" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column prop="goodsName" label="商品名称" align="center" width="200" /> |
|||
<el-table-column prop="goodsModel" label="车型" align="center" min-width="300" /> |
|||
<el-table-column prop="goodsCode" label="零件号" align="center" width="100" /> |
|||
<el-table-column prop="unit" label="单位" align="center" width="100" /> |
|||
<el-table-column prop="specification" label="规格" align="center" width="100" /> |
|||
<el-table-column prop="warehouse" label="仓库" align="center" width="100" /> |
|||
<el-table-column prop="subject" label="科目" align="center" width="100" /> |
|||
<el-table-column prop="price" label="销售价" align="center" width="130" /> |
|||
<el-table-column prop="count" label="数量" align="center" width="100" /> |
|||
<el-table-column prop="discount" label="折扣" align="center" width="100" /> |
|||
<el-table-column prop="discountAmount" label="优惠" align="center" width="100" /> |
|||
<el-table-column prop="amount" label="金额" align="center" width="100" /> |
|||
</el-table> |
|||
<div class="title">附加项目列表</div> |
|||
<el-table :key="subjoinKey" :data="formobj.attachItemVos" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column prop="aitemName" label="项目名称" align="center" /> |
|||
<el-table-column prop="price" label="销售价" align="center" /> |
|||
</el-table> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/setmeal/setmeal' |
|||
|
|||
export default { |
|||
name: 'SetMealInfo', |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
submitdisabled: false, |
|||
index: 0, |
|||
// service服务项目 |
|||
serviceKey: 0, |
|||
// commodity商品 |
|||
commodityKey: 1, |
|||
// subjoin附加项目 |
|||
subjoinKey: 2, |
|||
formobj: { |
|||
sid: '', |
|||
createBySid: '', |
|||
useOrgSid: '', |
|||
packageName: '', |
|||
remarks: '', |
|||
createOrgSid: '', |
|||
orgPath: '', |
|||
itemVos: [], |
|||
goodsVos: [], |
|||
attachItemVos: [] |
|||
}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
methods: { |
|||
showInfo(row) { |
|||
this.viewTitle = '套餐详情' |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
req.fetchBySid(row.sid).then((res) => { |
|||
if (res.success) { |
|||
this.formobj = res.data |
|||
} |
|||
}) |
|||
}, |
|||
handleReturn() { |
|||
this.formobj = { |
|||
sid: '', |
|||
createBySid: '', |
|||
useOrgSid: '', |
|||
packageName: '', |
|||
remarks: '', |
|||
createOrgSid: '', |
|||
orgPath: '', |
|||
itemVos: [], |
|||
goodsVos: [], |
|||
attachItemVos: [] |
|||
} |
|||
this.$emit('doback') |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
Loading…
Reference in new issue