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.
311 lines
11 KiB
311 lines
11 KiB
<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>
|
|
</div>
|
|
</div>
|
|
<div class="">
|
|
<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.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 class="addinputInfo" style="width: 80%" v-model="formobj.remarks" clearable placeholder=""/>
|
|
</el-form-item>
|
|
<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">商品类别列表</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 choosecategory from './relation/choosecategory'
|
|
import editPriceStrategy from './relation/editPriceStrategy'
|
|
|
|
export default {
|
|
components: {
|
|
choosecategory,
|
|
editPriceStrategy
|
|
},
|
|
data() {
|
|
return {
|
|
viewTitle: "【新增】",
|
|
viewState: 1,
|
|
listLoading: false,
|
|
submitdisabled: false,
|
|
formobj: {
|
|
"sid": "",
|
|
"createByName": "",
|
|
"billNo": "",
|
|
"deptName": "",
|
|
"deptSid": "",
|
|
"remarks": "",
|
|
"createBySid": "",
|
|
"createTime": "",
|
|
"procDefId": "",
|
|
"nodeId": "",
|
|
"procInstId": "",
|
|
"nodeState": "",
|
|
"taskId": "",
|
|
"finishTime": "",
|
|
"useOrgSid": "",
|
|
"useOrgName": "",
|
|
"smsPricestrategyBillDetailList": []
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
console.log('url:' + window.location.href)
|
|
var one = window.location.href.indexOf('&data') + 6
|
|
const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用
|
|
const obj = JSON.parse(decodeURIComponent(data))
|
|
this.showInfo(obj.businessSid)
|
|
},
|
|
mounted() {
|
|
window.parent.postMessage({
|
|
cmd: 'returnHeight',
|
|
params: {
|
|
// 告诉父级页面,子页面的弹框高度。
|
|
code: 2,
|
|
data: 500 + 'px'
|
|
}
|
|
}, '*')
|
|
},
|
|
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
|
|
},
|
|
showInfo(sid) {
|
|
this.viewTitle = '【编辑】定调价策略申请'
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
req.init(sid).then((res) => {
|
|
if (res.success) {
|
|
this.formobj = res.data
|
|
this.formobj.instanceId = res.data.procInstId
|
|
}
|
|
})
|
|
},
|
|
saveOrUpdate() {
|
|
if (this.formobj.smsPricestrategyBillDetailList.length > 0) {
|
|
for (var i = 0; i < this.formobj.smsPricestrategyBillDetailList.length; i++) {
|
|
if (this.formobj.smsPricestrategyBillDetailList[i].strategyType = '') {
|
|
this.$message({ showClose: true, type: 'warning', message: '商品类别列表中价格策略不能为空' })
|
|
return
|
|
}
|
|
}
|
|
} else {
|
|
this.$message({ showClose: true, type: 'warning', message: '商品类别列表不能为空' })
|
|
return
|
|
}
|
|
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: '保存成功'
|
|
})
|
|
// 子页面向父级页面传递值(关闭弹框)
|
|
window.parent.postMessage({
|
|
cmd: 'returnHeight',
|
|
params: {
|
|
// 操作成功,告诉父级页面关闭弹框
|
|
code: 1
|
|
}
|
|
}, '*')
|
|
} else {
|
|
this.submitdisabled = false
|
|
}
|
|
}).catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
submit() {
|
|
if (this.formobj.smsPricestrategyBillDetailList.length > 0) {
|
|
for (var i = 0; i < this.formobj.smsPricestrategyBillDetailList.length; i++) {
|
|
if (this.formobj.smsPricestrategyBillDetailList[i].strategyType = '') {
|
|
this.$message({ showClose: true, type: 'warning', message: '商品类别列表中价格策略不能为空' })
|
|
return
|
|
}
|
|
}
|
|
} else {
|
|
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: '提交成功'
|
|
})
|
|
// 子页面向父级页面传递值(关闭弹框)
|
|
window.parent.postMessage({
|
|
cmd: 'returnHeight',
|
|
params: {
|
|
// 操作成功,告诉父级页面关闭弹框
|
|
code: 1
|
|
}
|
|
}, '*')
|
|
} else {
|
|
this.submitdisabled = false
|
|
}
|
|
}).catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.span-sty {
|
|
width: 130px !important;
|
|
}
|
|
|
|
.addinputInfo {
|
|
margin-left: 120px !important;
|
|
}
|
|
</style>
|
|
|