Commit 8b7dfc07 by zhangxw

权益服务项目优化需求开发

1 parent 9d5e1911
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<el-input class="cost-input" placeholder="请输入每月投保成本" @input="changePrice($event, gradeFormObj, 'monthlyInsuranceCost')" :disabled="disabled" v-model="gradeFormObj.monthlyInsuranceCost"></el-input> <el-input class="cost-input" placeholder="请输入每月投保成本" @input="changePrice($event, gradeFormObj, 'monthlyInsuranceCost')" :disabled="disabled" v-model="gradeFormObj.monthlyInsuranceCost"></el-input>
</div> </div>
<div slot="specConfigSlot"> <div slot="specConfigSlot">
<ServicesTable :disabled="disabled" class="services-table" v-for="item in gradeList" :key="item.serviceGrade" :tableData="item"></ServicesTable> <ServicesTable :disabled="disabled" class="services-table" v-for="item in gradeList" :routeInfo="routeInfo" :key="item.serviceGrade" :tableData="item"></ServicesTable>
<div v-if="!disabled" class="add-btn" @click="handleAddGrade"> <div v-if="!disabled" class="add-btn" @click="handleAddGrade">
<i class="el-icon-circle-plus-outline"></i> <i class="el-icon-circle-plus-outline"></i>
新增规格 新增规格
...@@ -410,6 +410,7 @@ export default { ...@@ -410,6 +410,7 @@ export default {
this.gradeList.forEach(item => { this.gradeList.forEach(item => {
const { id, serviceGrade, serviceOverview, serviceDetail, salePeriodData, gradeConfigList } = item const { id, serviceGrade, serviceOverview, serviceDetail, salePeriodData, gradeConfigList } = item
let _gradeConfigList = [] let _gradeConfigList = []
if (!gradeConfigList?.length) throw new Error(`请配置规格${serviceGrade}的价格区间`)
gradeConfigList.forEach((ele, eleIdx) => { gradeConfigList.forEach((ele, eleIdx) => {
let { priceCoefficient, minPrice, maxPrice, childSalePeriodData, computeFlag } = ele let { priceCoefficient, minPrice, maxPrice, childSalePeriodData, computeFlag } = ele
if (this.isEmpty(minPrice) || this.isEmpty(maxPrice) || (this.isEmpty(priceCoefficient) && computeFlag == 0)) { if (this.isEmpty(minPrice) || this.isEmpty(maxPrice) || (this.isEmpty(priceCoefficient) && computeFlag == 0)) {
......
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
</tr> </tr>
<tr v-for="(item, index) in tableData.gradeConfigList" :key="index"> <tr v-for="(item, index) in tableData.gradeConfigList" :key="index">
<td class="price"> <td class="price">
<el-input :placeholder="placeholder" @input="changePrice($event, item, 'minPrice')" :disabled="disabled" v-model="item.minPrice"></el-input> <el-input :placeholder="placeholder" @input="changePrice($event, item, 'minPrice')" :disabled="disabled || routeInfo.id" v-model="item.minPrice"></el-input>
<span class="sign">-</span> <span class="sign">-</span>
<el-input :placeholder="placeholder" @input="changePrice($event, item, 'maxPrice')" :disabled="disabled" v-model="item.maxPrice"></el-input> <el-input :placeholder="placeholder" @input="changePrice($event, item, 'maxPrice')" :disabled="disabled || routeInfo.id" v-model="item.maxPrice"></el-input>
</td> </td>
<td><el-switch v-model="item.computeFlag" :active-value="0" @change="changeComputeFlag($event, item, index)" :inactive-value="1" :disabled="disabled"></el-switch></td> <td><el-switch v-model="item.computeFlag" :active-value="0" @change="changeComputeFlag($event, item, index)" :inactive-value="1" :disabled="disabled"></el-switch></td>
<td> <td>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<td :key="eIdx"><el-input v-model="item.childSalePeriodData[eIdx].salesCost" :placeholder="placeholder" @input="changePrice($event, item.childSalePeriodData[eIdx], 'salesCost')" :disabled="disabled"></el-input></td> <td :key="eIdx"><el-input v-model="item.childSalePeriodData[eIdx].salesCost" :placeholder="placeholder" @input="changePrice($event, item.childSalePeriodData[eIdx], 'salesCost')" :disabled="disabled"></el-input></td>
</template> </template>
</template> </template>
<td class="del-btn"><span v-if="index > 2 && !disabled" class="btn" @click="delSection(index)">删除</span></td> <td class="del-btn"><span v-if="!disabled" class="btn" @click="delSection(index)">删除</span></td>
</tr> </tr>
<tr> <tr>
<td class="add-btn" :colspan="tableData.salePeriodData.length * 2 + 4"><span v-if="!disabled" class="btn" @click="addSection">新增价格区间</span></td> <td class="add-btn" :colspan="tableData.salePeriodData.length * 2 + 4"><span v-if="!disabled" class="btn" @click="addSection">新增价格区间</span></td>
...@@ -111,6 +111,12 @@ export default { ...@@ -111,6 +111,12 @@ export default {
key: { key: {
type: String, type: String,
default: '' default: ''
},
routeInfo: {
type: Object,
default: () => {
return {}
}
} }
}, },
data() { data() {
...@@ -188,7 +194,7 @@ export default { ...@@ -188,7 +194,7 @@ export default {
}, },
addSection() { addSection() {
// 获取最后一个的最大价格赋值到新增的最小价格 // 获取最后一个的最大价格赋值到新增的最小价格
const minPrice = this.tableData.gradeConfigList[this.tableData.gradeConfigList.length - 1].maxPrice const minPrice = this.tableData.gradeConfigList[this.tableData.gradeConfigList.length - 1]?.maxPrice || ''
const arr = this.tableData.salePeriodData.map(item => { const arr = this.tableData.salePeriodData.map(item => {
return { servicePeriod: item.servicePeriod, standardShelfCost: '', standardSalesCost: '', shelfCost: '', salesCost: '' } return { servicePeriod: item.servicePeriod, standardShelfCost: '', standardSalesCost: '', shelfCost: '', salesCost: '' }
}) })
...@@ -205,7 +211,7 @@ export default { ...@@ -205,7 +211,7 @@ export default {
this.tableData.gradeConfigList.push(sectionItem) this.tableData.gradeConfigList.push(sectionItem)
}, },
delSection(idx) { delSection(idx) {
const minPrice = this.tableData.gradeConfigList[idx - 1].maxPrice const minPrice = this.tableData.gradeConfigList[idx - 1]?.maxPrice
this.tableData.gradeConfigList.splice(idx, 1) this.tableData.gradeConfigList.splice(idx, 1)
if (this.tableData.gradeConfigList.length > idx) { if (this.tableData.gradeConfigList.length > idx) {
this.$set(this.tableData.gradeConfigList[idx], 'minPrice', minPrice) this.$set(this.tableData.gradeConfigList[idx], 'minPrice', minPrice)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!