You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
315 lines
10 KiB
315 lines
10 KiB
<template>
|
|
<div class="app-container">
|
|
<div v-show="viewState == 1">
|
|
<div class="tab-header webtop">
|
|
<!-- 标题 -->
|
|
<div>{{ title }}定调价策略申请</div>
|
|
<!-- start 添加修改按钮 -->
|
|
<div>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submintdate">提交</el-button>
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
|
</div>
|
|
<!-- end 添加修改按钮 -->
|
|
<!-- end 详情按钮 -->
|
|
</div>
|
|
<div class="listconadd">
|
|
<el-form ref="form_obj" :model="formobj" class="formaddcopy02">
|
|
<el-row class="first_row">
|
|
<el-col :span="8">
|
|
<div class="span-sty">申请人</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<div class="span-sty">申请部门</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<div class="span-sty">申请日期</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createTime }}</span></el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<div class="span-sty">备注</div>
|
|
<el-form-item>
|
|
<el-input v-model="formobj.remarks" placeholder="" class="addinputw addinputInfo" type="textarea" :rows="4" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div class="title titleOne">
|
|
<div>商品类别列表</div>
|
|
<el-button type="primary" size="mini" class="btntopblueline" @click="categoryAdd()">添加</el-button>
|
|
</div>
|
|
<el-table v-loading="listLoading" :data="formobj.smsPricestrategyBillDetailList" border style="width: 100%;">
|
|
<el-table-column fixed width="80" label="序号" type="index" :index="indexMethod" align="center"/>
|
|
<el-table-column fixed label="操作" wid align="center" width="200">
|
|
<template slot-scope="scope">
|
|
<el-button type="primary" size="mini" @click="deleteGoodsType(scope.$index)">删除</el-button>
|
|
<el-button type="primary" size="mini" @click="editPriceStrategy(scope.row)">编辑</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="类别编码" prop="goodsTypeCode" align="center"/>
|
|
<el-table-column label="类别名称" prop="goodsTypeName" align="center"/>
|
|
<el-table-column label="价格策略" align="center">
|
|
<template slot-scope="scope">
|
|
{{ calculation(scope.row) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="策略明细" align="center" width="600">
|
|
<template slot-scope="scope">
|
|
{{ calculation2(scope.row) }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<!-- 选择商品类别 -->
|
|
<choosecategory v-show="viewState == 2" ref="choosecategory" @backData="backData" @doback="resetState"/>
|
|
<!-- 编辑价格策略 -->
|
|
<editPriceStrategy v-show="viewState == 3" ref="editPriceStrategy" @backData2="backData2" @doback="resetState"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/storage/adjustment.js'
|
|
import {
|
|
getCurrentDate
|
|
} from '@/utils/index.js'
|
|
import choosecategory from './relation/choosecategory'
|
|
import editPriceStrategy from './relation/editPriceStrategy'
|
|
import {
|
|
getOrgSidByPath
|
|
} from '@/api/Common/dictcommons'
|
|
|
|
export default {
|
|
components: {
|
|
choosecategory,
|
|
editPriceStrategy
|
|
},
|
|
data() {
|
|
return {
|
|
title: '【新增】',
|
|
viewState: 1,
|
|
listLoading: false,
|
|
submitdisabled: false,
|
|
formobj: {
|
|
sid: '',
|
|
createByName: window.sessionStorage.getItem('name'),
|
|
billNo: '',
|
|
deptName: window.sessionStorage.getItem('defaultOrgPathName').substring(window
|
|
.sessionStorage.getItem('defaultOrgPathName').lastIndexOf('/') + 1),
|
|
deptSid: window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage
|
|
.getItem('defaultOrgPath').lastIndexOf('/') + 1),
|
|
remarks: '',
|
|
createBySid: window.sessionStorage.getItem('userSid'),
|
|
createTime: getCurrentDate(),
|
|
procDefId: '',
|
|
nodeId: '',
|
|
procInstId: '',
|
|
nodeState: '',
|
|
taskId: '',
|
|
finishTime: '',
|
|
useOrgSid: '',
|
|
useOrgName: '',
|
|
smsPricestrategyBillDetailList: []
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
calculation(row) {
|
|
var info = ''
|
|
if (row.strategyType == 1) {
|
|
info = '固定比例'
|
|
}
|
|
if (row.strategyType == 2) {
|
|
info = '价格区间'
|
|
}
|
|
return info
|
|
},
|
|
calculation2(row) {
|
|
var info = ''
|
|
if (row.strategyType == 2) {
|
|
for (var i = 0; i < row.smsPricestrategyBillGoodstypedetailList.length; i++) {
|
|
info += row.smsPricestrategyBillGoodstypedetailList[i].rangeStart + '-' + row
|
|
.smsPricestrategyBillGoodstypedetailList[i].rangeEnd + ' ' + row
|
|
.smsPricestrategyBillGoodstypedetailList[i]
|
|
.markupRate + '%;'
|
|
}
|
|
} else {
|
|
info = row.gdMarkupRate + '%'
|
|
}
|
|
return info
|
|
},
|
|
deleteGoodsType(index) {
|
|
this.formobj.smsPricestrategyBillDetailList.splice(index, 1)
|
|
},
|
|
editPriceStrategy(row) {
|
|
this.viewState = 3
|
|
const aa = []
|
|
this.$refs['editPriceStrategy'].showAdd(aa, row)
|
|
},
|
|
backData(value) {
|
|
this.viewState = 1
|
|
for (var i = 0; i < value.length; i++) {
|
|
this.formobj.smsPricestrategyBillDetailList.push(
|
|
{
|
|
goodsTypeSid: value[i].sid,
|
|
goodsTypeCode: value[i].goodsTypeCode,
|
|
goodsTypeName: value[i].goodsTypeName,
|
|
strategyType: '',
|
|
strategyTypeValue: '',
|
|
gdMarkupRate: '',
|
|
strategyDetail: '',
|
|
smsPricestrategyBillGoodstypedetailList: []
|
|
}
|
|
)
|
|
}
|
|
},
|
|
backData2(value) {
|
|
this.viewState = 1
|
|
var info = ''
|
|
if (value.strategyType == 2) {
|
|
for (var i = 0; i < value.smsPricestrategyBillGoodstypedetailList.length; i++) {
|
|
info += value.smsPricestrategyBillGoodstypedetailList[i].rangeStart + '-' + value
|
|
.smsPricestrategyBillGoodstypedetailList[i].rangeEnd + ' ' + value
|
|
.smsPricestrategyBillGoodstypedetailList[i]
|
|
.markupRate + '%;'
|
|
}
|
|
}
|
|
const choose = this.formobj.smsPricestrategyBillDetailList.filter((item) => item.goodsTypeSid == value.goodsTypeSid)
|
|
choose[0].smsPricestrategyBillGoodstypedetailList = value.smsPricestrategyBillGoodstypedetailList
|
|
choose[0].strategyType = value.strategyType
|
|
if (value.strategyType == 1) {
|
|
choose[0].strategyTypeValue = '固定比例'
|
|
choose[0].strategyDetail = value.gdMarkupRate
|
|
}
|
|
if (value.strategyType == 2) {
|
|
choose[0].strategyTypeValue = '价格区间'
|
|
choose[0].strategyDetail = info
|
|
}
|
|
},
|
|
resetState() {
|
|
this.viewState = 1
|
|
},
|
|
categoryAdd() {
|
|
this.viewState = 2
|
|
const aa = []
|
|
this.$refs['choosecategory'].showData(aa, this.formobj.createOrgSid)
|
|
},
|
|
indexMethod(index) {
|
|
return index + 1
|
|
},
|
|
saveOrUpdate() {
|
|
this.$refs['form_obj'].validate((valid) => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req.save(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
|
|
})
|
|
}
|
|
})
|
|
},
|
|
submintdate() {
|
|
if (this.formobj.smsPricestrategyBillDetailList.length == 0) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'warning',
|
|
message: '请添加商品类别'
|
|
})
|
|
return
|
|
}
|
|
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
|
|
})
|
|
}
|
|
})
|
|
},
|
|
handleReturn(isreload) {
|
|
if (isreload === 'true') this.$emit('reloadlist')
|
|
this.submitdisabled = false
|
|
this.formobj = {}
|
|
this.$emit('doback')
|
|
},
|
|
showAdd() {
|
|
this.title = '【新增】'
|
|
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => {
|
|
if (res.success) {
|
|
this.formobj.createOrgSid = res.data
|
|
this.formobj.useOrgSid = res.data
|
|
}
|
|
})
|
|
},
|
|
showEdit(row) {
|
|
this.title = '【编辑】'
|
|
req.init(row.sid).then(resp => {
|
|
if (resp.success) {
|
|
this.formobj = resp.data
|
|
}
|
|
}).catch(e => {
|
|
this.formobj = {}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
/deep/ .el-form-item__error {
|
|
margin-left: 120px !important;
|
|
}
|
|
|
|
.must {
|
|
color: #f00;
|
|
}
|
|
|
|
.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);
|
|
}
|
|
|
|
.first_row {
|
|
border-top: 1px solid #E0E3EB;
|
|
}
|
|
|
|
.titleOne {
|
|
padding: 7px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
|