7 changed files with 1034 additions and 209 deletions
@ -0,0 +1,56 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
export default { |
||||
|
// 查询分页列表
|
||||
|
listPage: function(data) { |
||||
|
return request({ |
||||
|
url: '/scm/v1/scmvehrebate/listPage', |
||||
|
method: 'post', |
||||
|
data: data, |
||||
|
headers: { 'Content-Type': 'application/json' } |
||||
|
}) |
||||
|
}, |
||||
|
// 选择车辆信息--查询分页列表
|
||||
|
pageList: function(data) { |
||||
|
return request({ |
||||
|
url: '/base/v1/basevehicle/vehicleRebateList', |
||||
|
method: 'post', |
||||
|
data: data, |
||||
|
headers: { 'Content-Type': 'application/json' } |
||||
|
}) |
||||
|
}, |
||||
|
// 删除
|
||||
|
delete: function(params) { |
||||
|
return request({ |
||||
|
url: '/scm/v1/scmvehrebate/delBySids', |
||||
|
method: 'DELETE', |
||||
|
data: params, |
||||
|
headers: { 'Content-Type': 'application/json' } |
||||
|
}) |
||||
|
}, |
||||
|
// 新增保存修改记录
|
||||
|
save: function(data) { |
||||
|
return request({ |
||||
|
url: '/scm/v1/scmvehrebate/save', |
||||
|
method: 'post', |
||||
|
data: data, |
||||
|
headers: { 'Content-Type': 'application/json' } |
||||
|
}) |
||||
|
}, |
||||
|
// 编辑保存修改记录
|
||||
|
update: function(data) { |
||||
|
return request({ |
||||
|
url: '/scm/v1/scmvehrebate/update', |
||||
|
method: 'post', |
||||
|
data: data, |
||||
|
headers: { 'Content-Type': 'application/json' } |
||||
|
}) |
||||
|
}, |
||||
|
// 通过sid查询一条记录
|
||||
|
fetchBySid: function(data) { |
||||
|
return request({ |
||||
|
url: '/scm/v1/scmvehrebate/fetchDetailsBySid/' + data, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,333 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<div> |
||||
|
<div class="tab-header webtop"> |
||||
|
<div>选择车辆页面</div> |
||||
|
<div> |
||||
|
<el-button type="primary" size="small" @click="AddUpdateReturn">确定</el-button> |
||||
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<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="品牌:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.brandSid" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in carBrand_list" :key="item.sid" :label="item.brandName" :value="item.sid"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="功能:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.vehicleType" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in vehicleType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="系列:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.productLine" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in productLine_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="变速箱:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.gearboxType" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in gearboxType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="驱动:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.driveForm" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in driveForm_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="排放标准:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.emissionStandard" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in emissionStandard_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="马力:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.power" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in power_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="燃料:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.fuelType" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in fuelType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="版本:" class="searchlist"> |
||||
|
<el-select v-model="listQuery.params.vehicleVersion" placeholder="请选择" filterable clearable> |
||||
|
<el-option v-for="item in vehicleVersion_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="车型:" class="searchlist"> |
||||
|
<el-input v-model="listQuery.params.vehicleAlias" placeholder="" clearable style="width: 150px"/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="快捷检索:" class="searchlist"> |
||||
|
<el-input v-model="listQuery.params.modelName" placeholder="" clearable style="width: 150px"/> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<div class="btn" style="text-align: center;"> |
||||
|
<el-button type="primary" icon="el-icon-search" @click="handleFilter" size="small">查询</el-button> |
||||
|
<el-button type="primary" icon="el-icon-refresh" @click="handleReset" size="small">重置</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<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> |
||||
|
<div class=""> |
||||
|
<el-table :key="tableKey" ref="multipleTable" v-loading="listLoading" :data="list" border style="width: 100%" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column width="50px" type="selection" align="center"/> |
||||
|
<el-table-column width="80px" label="序号" type="index" :index="indexMethod" align="center"/> |
||||
|
<el-table-column label="品牌" align="center"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span>{{ scope.row.brandName }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="车型" align="center"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span>{{ scope.row.vehicleAlias }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="车架号" align="center"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span>{{ scope.row.vinNo }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
<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> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Pagination from '@/components/pagination' |
||||
|
import req from '@/api/bikerebate/bicyclerebatemanagement' |
||||
|
import { typeValues, brandDown, getPathSidByUserSid } from '@/api/cheliang/dictcommons.js' |
||||
|
|
||||
|
export default { |
||||
|
name: 'xuanzecheliang', |
||||
|
components: { |
||||
|
Pagination |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
useOrg: '', |
||||
|
buyerOrgSid: '', |
||||
|
carBrand_list: [], |
||||
|
vehicleType_list: [], |
||||
|
productLine_list: [], |
||||
|
gearboxType_list: [], |
||||
|
driveForm_list: [], |
||||
|
emissionStandard_list: [], |
||||
|
power_list: [], |
||||
|
fuelType_list: [], |
||||
|
vehicleVersion_list: [], |
||||
|
isSearchShow: false, |
||||
|
searchxianshitit: '隐藏查询条件', |
||||
|
tableKey: 0, |
||||
|
showbackState: 30, |
||||
|
sids: [], |
||||
|
list: [], |
||||
|
number: '', |
||||
|
listLoading: false, |
||||
|
listQuery: { |
||||
|
current: 1, |
||||
|
size: 10, |
||||
|
params: { |
||||
|
brandSid: '', |
||||
|
driveForm: '', |
||||
|
emissionStandard: '', |
||||
|
fuelType: '', |
||||
|
gearboxType: '', |
||||
|
modelName: '', |
||||
|
power: '', |
||||
|
productLine: '', |
||||
|
vehicleAlias: '', |
||||
|
vehicleType: '', |
||||
|
vehicleVersion: '', |
||||
|
userSid: '', |
||||
|
buyerOrgSid: '', |
||||
|
vinNoList: [] |
||||
|
}, |
||||
|
total: 1 |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
// 搜索条件效果 |
||||
|
clicksearchShow() { |
||||
|
this.isSearchShow = !this.isSearchShow |
||||
|
if (this.isSearchShow) { |
||||
|
this.searchxianshitit = '隐藏查询条件' |
||||
|
} else { |
||||
|
this.searchxianshitit = '显示查询条件' |
||||
|
} |
||||
|
}, |
||||
|
init() { |
||||
|
this.getPathSid() |
||||
|
this.shujuzidian() |
||||
|
this.getList() |
||||
|
}, |
||||
|
getPathSid() { |
||||
|
const userSid = window.sessionStorage.getItem('userSid') |
||||
|
getPathSidByUserSid({ userSid: userSid }).then((res) => { |
||||
|
if (res.success) { |
||||
|
this.useOrg = res.data |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
shujuzidian() { |
||||
|
// 下拉框-品牌 |
||||
|
brandDown({ useOrg: this.useOrg }).then((res) => { |
||||
|
if (res.success) { |
||||
|
this.carBrand_list = res.data |
||||
|
console.log('下拉框请求品牌', res.data) |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'vehicleFunction' }).then((res) => { |
||||
|
if (res.success) { |
||||
|
this.vehicleType_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'productLine' }).then((res) => { |
||||
|
if (res.code === '200') { |
||||
|
this.productLine_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'driver' }).then((res) => { |
||||
|
if (res.code === '200') { |
||||
|
this.driveForm_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'horsepower' }).then((res) => { |
||||
|
if (res.code === '200') { |
||||
|
this.power_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'vehicleVersion' }).then((res) => { |
||||
|
if (res.code === '200') { |
||||
|
this.vehicleVersion_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'fuelType' }).then((res) => { |
||||
|
if (res.code === '200') { |
||||
|
this.fuelType_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'gearbox' }).then((res) => { |
||||
|
if (res.code === '200') { |
||||
|
this.gearboxType_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'emissionStandard' }).then((res) => { |
||||
|
if (res.code === '200') { |
||||
|
this.emissionStandard_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
indexMethod(index) { |
||||
|
var pagestart = (this.listQuery.current - 1) * this.listQuery.size |
||||
|
var pageindex = index + 1 + pagestart |
||||
|
return pageindex |
||||
|
}, |
||||
|
// 返回 |
||||
|
handleReturn() { |
||||
|
this.$emit('doback') |
||||
|
}, |
||||
|
// 查询列表信息 |
||||
|
getList() { |
||||
|
this.listLoading = true |
||||
|
this.listQuery.params.userSid = window.sessionStorage.getItem('userSid') |
||||
|
this.listQuery.params.buyerOrgSid = this.buyerOrgSid |
||||
|
req.pageList(this.listQuery).then((response) => { |
||||
|
this.listLoading = false |
||||
|
if (response.success) { |
||||
|
this.listQuery.total = response.data.total |
||||
|
this.list = response.data.records |
||||
|
} |
||||
|
}) |
||||
|
this.listQuery.params.vinNoList = [] |
||||
|
}, |
||||
|
// 查询按钮 |
||||
|
handleFilter() { |
||||
|
this.getList() |
||||
|
}, |
||||
|
// 重置按钮 |
||||
|
handleReset() { |
||||
|
this.listQuery = { |
||||
|
current: 1, |
||||
|
size: 10, |
||||
|
params: { |
||||
|
brandSid: '', |
||||
|
driveForm: '', |
||||
|
emissionStandard: '', |
||||
|
fuelType: '', |
||||
|
gearboxType: '', |
||||
|
modelName: '', |
||||
|
power: '', |
||||
|
productLine: '', |
||||
|
vehicleAlias: '', |
||||
|
vehicleType: '', |
||||
|
vehicleVersion: '', |
||||
|
userSid: '', |
||||
|
vinNoList: [] |
||||
|
}, |
||||
|
total: 0 |
||||
|
} |
||||
|
this.getList() |
||||
|
}, |
||||
|
handleSelectionChange(row) { |
||||
|
this.sids = [] |
||||
|
const aa = [] |
||||
|
row.forEach((element) => { |
||||
|
aa.push({ |
||||
|
vinNo: element.vinNo, |
||||
|
vehSid: element.sid, |
||||
|
brandName: element.brandName, |
||||
|
brandSid: element.carBrand, |
||||
|
manufactorSettlementPrice: element.costPrice, |
||||
|
freight: element.freight, |
||||
|
vehModelName: element.vehicleAlias, |
||||
|
vehModelSid: element.modelSid |
||||
|
}) |
||||
|
}) |
||||
|
this.sids = aa |
||||
|
}, |
||||
|
showData(value, buyerOrgSid) { |
||||
|
const aa = [] |
||||
|
if (value.length > 0) { |
||||
|
for (var i = 0; i < value.length; i++) { |
||||
|
aa.push(value[i].vinNo) |
||||
|
} |
||||
|
this.listQuery.params.vinNoList = aa |
||||
|
} else { |
||||
|
this.listQuery.params.vinNoList = [] |
||||
|
} |
||||
|
this.buyerOrgSid = buyerOrgSid |
||||
|
this.init() |
||||
|
}, |
||||
|
// 添加修改返回 |
||||
|
AddUpdateReturn() { |
||||
|
if (this.sids.length > 0) { |
||||
|
this.$emit('backData', this.sids) |
||||
|
} else { |
||||
|
this.$notify({ |
||||
|
title: '提示', |
||||
|
message: '请选择至少一条车型记录!', |
||||
|
type: 'error', |
||||
|
duration: 2000 |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style scoped> |
||||
|
</style> |
@ -0,0 +1,303 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<div> |
||||
|
<!--标题按钮部分开始--> |
||||
|
<div class="tab-header webtop"> |
||||
|
<!--标题--> |
||||
|
<div>{{ viewTitle }}</div> |
||||
|
<!--start 添加修改按钮--> |
||||
|
<div> |
||||
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="save()">保存 |
||||
|
</el-button> |
||||
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!--标题按钮部分结束--> |
||||
|
<!--Start 新增修改部分--> |
||||
|
<div class="listconadd"> |
||||
|
<div class="titwu"><span>单车返利</span></div> |
||||
|
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formadd"> |
||||
|
<el-row style="border-top: 1px solid #E0E3EB"> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>返利类型</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item> |
||||
|
<el-select v-model="formobj.rebateTypeValue" placeholder="请选择" filterable clearable @change="changeRebateType"> |
||||
|
<el-option v-for="item in rebateType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictValue"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>厂家返利名称</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item><el-input v-model="formobj.rebateName" class="addinputw" placeholder="" clearable></el-input></el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>所属年月</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item><el-date-picker v-model="formobj.palceGenDate" type="date" clearable value-format="yyyy-MM-dd" placeholder="选择日期"/></el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>计算方式</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item> |
||||
|
<el-select v-model="formobj.calculationModeValue" placeholder="请选择" filterable clearable @change="changeCalculationMode"> |
||||
|
<el-option v-for="item in calculationMode_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictValue"/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>计算标准(%)</span> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item><el-input v-model="formobj.calculationStandard" @keyup.native="UpNumber" clearable placeholder="" class="addinputw"></el-input></el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<div class="title"> |
||||
|
<div>返利车辆</div> |
||||
|
</div> |
||||
|
<el-row> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>车架号</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item> |
||||
|
<span>{{ formobj.vinNo }}</span> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>厂家结算价</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item> |
||||
|
<span>{{ formobj.manufactorSettlementPrice }}</span> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>其中运费</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item> |
||||
|
<span>{{ formobj.freight }}</span> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>预计返利</span> |
||||
|
</el-col> |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item> |
||||
|
<span>{{ estimateRebate() }}</span> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4" class="tleftb"> |
||||
|
<span>备注</span> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item> |
||||
|
<el-input v-model="formobj.remarks" clearable placeholder="" class="addinputw"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!--End 添加修改部分--> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import req from '@/api/bikerebate/bicyclerebatemanagement' |
||||
|
import { typeValues } from '@/api/cheliang/dictcommons' |
||||
|
|
||||
|
export default { |
||||
|
name: 'bicyclerebatemanagementEdit', |
||||
|
data() { |
||||
|
return { |
||||
|
viewTitle: '', |
||||
|
rebateType_list: [], // 返利类型 |
||||
|
calculationMode_list: [], // 计算方式 |
||||
|
// 表单数据 |
||||
|
formobj: { |
||||
|
rebateTypeKey: '', |
||||
|
rebateTypeValue: '', |
||||
|
rebateName: '', |
||||
|
palceGenDate: '', |
||||
|
calculationModeKey: '', |
||||
|
calculationModeValue: '', |
||||
|
calculationStandard: '', |
||||
|
sid: '', |
||||
|
createOrgSid: '', |
||||
|
createOrgName: '', |
||||
|
useOrgSid: '', |
||||
|
useOrgName: '', |
||||
|
vinNo: '', |
||||
|
manufactorSettlementPrice: '', |
||||
|
freight: '', |
||||
|
estimateRebate: '', |
||||
|
remarks: '' |
||||
|
}, |
||||
|
rules: {}, |
||||
|
submitdisabled: false |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
init() { |
||||
|
typeValues({ type: 'rebateType' }).then((res) => { |
||||
|
if (res.success) { |
||||
|
this.rebateType_list = res.data |
||||
|
} |
||||
|
}) |
||||
|
typeValues({ type: 'calculationMode' }).then((resp) => { |
||||
|
if (resp.success) { |
||||
|
this.calculationMode_list = resp.data |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
UpNumber(e) { |
||||
|
if (this.formobj.calculationModeValue === '') { |
||||
|
this.formobj.calculationStandard = '' |
||||
|
this.$message({ showClose: true, type: 'error', message: '请先选择计算方式' }) |
||||
|
return |
||||
|
} else { |
||||
|
if (this.formobj.calculationModeKey === '001') { |
||||
|
e.target.value = e.target.value.replace(/[^\d.]/g, '') // 清除“数字”和“.”"-"以外的字符 |
||||
|
e.target.value = e.target.value.replace(/^00/, '0.') // 开头不能有两个0 |
||||
|
e.target.value = e.target.value.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的 |
||||
|
e.target.value = e.target.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数 |
||||
|
if (e.target.value.indexOf('.') < 0 && e.target.value !== '' && e.target.value !== '-') { |
||||
|
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额 |
||||
|
e.target.value = parseFloat(e.target.value) |
||||
|
} |
||||
|
this.formobj.calculationStandard = e.target.value |
||||
|
} else if (this.formobj.calculationModeKey === '002') { |
||||
|
e.target.value = e.target.value.replace(/[^\d]/g, '') // 清除“数字”和“.”"-"以外的字符 |
||||
|
e.target.value = e.target.value.replace(/^00/, '0') // 开头不能有两个0 |
||||
|
if (e.target.value.indexOf('.') < 0 && e.target.value !== '' && e.target.value !== '-') { |
||||
|
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额 |
||||
|
console.log(e.target.value) |
||||
|
e.target.value = parseFloat(e.target.value) |
||||
|
} |
||||
|
this.formobj.calculationStandard = e.target.value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
estimateRebate() { |
||||
|
if (this.formobj.calculationModeKey === '001') { |
||||
|
var price = '' |
||||
|
price = parseFloat(this.formobj.manufactorSettlementPrice) - parseFloat(this.formobj.freight) |
||||
|
this.formobj.estimateRebate = this.multiplication(price, (parseFloat(this.formobj.calculationStandard) / 100)) |
||||
|
} else if (this.formobj.calculationModeKey === '002') { |
||||
|
this.formobj.estimateRebate = this.formobj.calculationStandard |
||||
|
} |
||||
|
return this.formobj.estimateRebate |
||||
|
}, |
||||
|
multiplication(arg1, arg2) { |
||||
|
var m = 0 |
||||
|
var s1 = arg1.toString() |
||||
|
var s2 = arg2.toString() |
||||
|
try { |
||||
|
m += s1.split('.')[1].length |
||||
|
} catch (e) {} |
||||
|
try { |
||||
|
m += s2.split('.')[1].length |
||||
|
} catch (e) {} |
||||
|
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m) |
||||
|
}, |
||||
|
changeRebateType(value) { |
||||
|
let bb = null |
||||
|
this.rebateType_list.forEach((e) => { |
||||
|
if (e.dictValue === value) { |
||||
|
bb = { |
||||
|
key: e.dictKey, |
||||
|
value: e.dictValue |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
this.formobj.rebateTypeKey = bb.key |
||||
|
}, |
||||
|
changeCalculationMode(value) { |
||||
|
let bb = null |
||||
|
this.calculationMode_list.forEach((e) => { |
||||
|
if (e.dictValue === value) { |
||||
|
bb = { |
||||
|
key: e.dictKey, |
||||
|
value: e.dictValue |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
this.formobj.calculationModeKey = bb.key |
||||
|
}, |
||||
|
showEdit(row) { |
||||
|
this.init() |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs['form_obj'].clearValidate() |
||||
|
}) |
||||
|
this.viewTitle = '【编辑】单车返利' |
||||
|
req.fetchBySid(row.sid).then((resp) => { |
||||
|
this.formobj = resp.data |
||||
|
}).catch((e) => { |
||||
|
this.formobj = row |
||||
|
}) |
||||
|
}, |
||||
|
save() { |
||||
|
this.$refs['form_obj'].validate((valid) => { |
||||
|
if (valid) { |
||||
|
this.submitdisabled = true |
||||
|
req.update(this.formobj).then((resp) => { |
||||
|
this.submitdisabled = false |
||||
|
if (resp.success) { |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
type: 'success', |
||||
|
message: resp.msg |
||||
|
}) |
||||
|
this.handleReturn('true') |
||||
|
} |
||||
|
}).catch(() => { |
||||
|
this.submitdisabled = false |
||||
|
}) |
||||
|
} else { |
||||
|
return false |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 返回(===既判断) |
||||
|
handleReturn(isreload) { |
||||
|
if (isreload === 'true') this.$emit('reloadlist') |
||||
|
// 表单数据 |
||||
|
this.formobj = { |
||||
|
rebateTypeKey: '', |
||||
|
rebateTypeValue: '', |
||||
|
rebateName: '', |
||||
|
palceGenDate: '', |
||||
|
calculationModeKey: '', |
||||
|
calculationModeValue: '', |
||||
|
calculationStandard: '', |
||||
|
sid: '', |
||||
|
createOrgSid: '', |
||||
|
createOrgName: '', |
||||
|
useOrgSid: '', |
||||
|
useOrgName: '', |
||||
|
vinNo: '', |
||||
|
manufactorSettlementPrice: '', |
||||
|
freight: '', |
||||
|
estimateRebate: '', |
||||
|
remarks: '' |
||||
|
} |
||||
|
this.$refs['form_obj'].resetFields() |
||||
|
this.$emit('doback') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style scoped> |
||||
|
</style> |
||||
|
|
Loading…
Reference in new issue