|
@ -210,59 +210,86 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<!-- 套餐免费额度配置 --> |
|
|
|
|
|
<el-divider content-position="left">套餐免费额度配置</el-divider> |
|
|
|
|
|
|
|
|
<!-- 免费宠物数量配置 --> |
|
|
|
|
|
<el-divider content-position="left">免费宠物数量配置</el-divider> |
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<el-col :span="12"> |
|
|
|
|
|
<el-form-item label="免费阈值金额" prop="freeQuota.threshold"> |
|
|
|
|
|
<el-input-number |
|
|
|
|
|
v-model="priceConfig.freeQuota.threshold" |
|
|
|
|
|
:min="0" |
|
|
|
|
|
:precision="2" |
|
|
|
|
|
placeholder="免费阈值金额"> |
|
|
|
|
|
</el-input-number> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
<el-col :span="24"> |
|
|
|
|
|
<el-alert |
|
|
|
|
|
title="免费宠物数量配置说明" |
|
|
|
|
|
type="info" |
|
|
|
|
|
:closable="false" |
|
|
|
|
|
show-icon> |
|
|
|
|
|
<div slot="description"> |
|
|
|
|
|
配置每种宠物类型的免费数量,超出免费数量的宠物将按照对应的额外费用收费。 |
|
|
|
|
|
<br>例如:配置猫免费3只,用户有5只猫时,前3只免费,后2只按猫的额外费用收费。 |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-alert> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<!-- 免费规则配置 --> |
|
|
|
|
|
|
|
|
<!-- 免费宠物数量配置表格 --> |
|
|
<el-card class="box-card" style="margin-bottom: 20px;"> |
|
|
<el-card class="box-card" style="margin-bottom: 20px;"> |
|
|
<div slot="header"> |
|
|
<div slot="header"> |
|
|
<span>免费规则配置</span> |
|
|
|
|
|
<el-button style="float: right; padding: 3px 0" type="text" @click="addFreeRule">添加规则</el-button> |
|
|
|
|
|
|
|
|
<span>免费宠物数量配置</span> |
|
|
</div> |
|
|
</div> |
|
|
<el-table :data="priceConfig.freeQuota.rules" style="width: 100%"> |
|
|
|
|
|
<el-table-column label="类型" width="160"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
<el-select v-model="scope.row.type" placeholder="选择类型"> |
|
|
|
|
|
<el-option label="猫" value="cat"></el-option> |
|
|
|
|
|
<el-option label="小型犬" value="smallDog"></el-option> |
|
|
|
|
|
<el-option label="中型犬" value="mediumDog"></el-option> |
|
|
|
|
|
<el-option label="混合类型" value="mixed"></el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="数量" width="160"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
<el-input-number v-model="scope.row.count" :min="0" size="mini"></el-input-number> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="免费金额" width="160"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
<el-input-number v-model="scope.row.freeAmount" :min="0" :precision="2" size="mini"></el-input-number> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="描述"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
<el-input v-model="scope.row.description" size="mini"></el-input> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="操作" width="100"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
<el-button type="danger" size="mini" @click="removeFreeRule(scope.$index)">删除</el-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-card class="box-card" style="margin-bottom: 20px;"> |
|
|
|
|
|
<div slot="header"> |
|
|
|
|
|
<span>猫</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<el-form-item label="免费数量" prop="freePetConfig.cat.freeCount" label-width="80px"> |
|
|
|
|
|
<el-input-number |
|
|
|
|
|
v-model="priceConfig.freePetConfig.cat.freeCount" |
|
|
|
|
|
:min="0" |
|
|
|
|
|
placeholder="免费数量"> |
|
|
|
|
|
</el-input-number> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-card> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-card class="box-card" style="margin-bottom: 20px;"> |
|
|
|
|
|
<div slot="header"> |
|
|
|
|
|
<span>小型犬</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<el-form-item label="免费数量" prop="freePetConfig.smallDog.freeCount" label-width="80px"> |
|
|
|
|
|
<el-input-number |
|
|
|
|
|
v-model="priceConfig.freePetConfig.smallDog.freeCount" |
|
|
|
|
|
:min="0" |
|
|
|
|
|
placeholder="免费数量"> |
|
|
|
|
|
</el-input-number> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-card> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-card class="box-card" style="margin-bottom: 20px;"> |
|
|
|
|
|
<div slot="header"> |
|
|
|
|
|
<span>中型犬</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<el-form-item label="免费数量" prop="freePetConfig.mediumDog.freeCount" label-width="80px"> |
|
|
|
|
|
<el-input-number |
|
|
|
|
|
v-model="priceConfig.freePetConfig.mediumDog.freeCount" |
|
|
|
|
|
:min="0" |
|
|
|
|
|
placeholder="免费数量"> |
|
|
|
|
|
</el-input-number> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-card> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-card class="box-card" style="margin-bottom: 20px;"> |
|
|
|
|
|
<div slot="header"> |
|
|
|
|
|
<span>大型犬</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<el-form-item label="免费数量" prop="freePetConfig.largeDog.freeCount" label-width="80px"> |
|
|
|
|
|
<el-input-number |
|
|
|
|
|
v-model="priceConfig.freePetConfig.largeDog.freeCount" |
|
|
|
|
|
:min="0" |
|
|
|
|
|
placeholder="免费数量"> |
|
|
|
|
|
</el-input-number> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-card> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
</el-card> |
|
|
</el-card> |
|
|
|
|
|
|
|
|
<!-- 节假日配置 --> |
|
|
<!-- 节假日配置 --> |
|
@ -438,35 +465,20 @@ |
|
|
price: 10 // 猫基础费用 |
|
|
price: 10 // 猫基础费用 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
// 套餐免费额度配置 |
|
|
|
|
|
freeQuota: { |
|
|
|
|
|
threshold: 30, // 免费阈值金额 |
|
|
|
|
|
rules: [ |
|
|
|
|
|
{ |
|
|
|
|
|
type: 'cat', |
|
|
|
|
|
count: 3, |
|
|
|
|
|
freeAmount: 30, |
|
|
|
|
|
description: '3只及以上猫免费30元' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
type: 'smallDog', |
|
|
|
|
|
count: 2, |
|
|
|
|
|
freeAmount: 30, |
|
|
|
|
|
description: '2只及以上小型犬免费30元' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
type: 'mediumDog', |
|
|
|
|
|
count: 1, |
|
|
|
|
|
freeAmount: 30, |
|
|
|
|
|
description: '1只及以上中型犬免费30元' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
type: 'mixed', |
|
|
|
|
|
count: 0, |
|
|
|
|
|
freeAmount: 25, |
|
|
|
|
|
description: '混合类型免费25元(1猫1小型犬)' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
// 免费宠物数量配置 |
|
|
|
|
|
freePetConfig: { |
|
|
|
|
|
cat: { |
|
|
|
|
|
freeCount: 3 // 猫免费数量 |
|
|
|
|
|
}, |
|
|
|
|
|
smallDog: { |
|
|
|
|
|
freeCount: 2 // 小型犬免费数量 |
|
|
|
|
|
}, |
|
|
|
|
|
mediumDog: { |
|
|
|
|
|
freeCount: 1 // 中型犬免费数量 |
|
|
|
|
|
}, |
|
|
|
|
|
largeDog: { |
|
|
|
|
|
freeCount: 0 // 大型犬免费数量 |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
// 节假日配置 - 后台配置的节假日列表 |
|
|
// 节假日配置 - 后台配置的节假日列表 |
|
|
holidays: [ |
|
|
holidays: [ |
|
@ -495,6 +507,22 @@ |
|
|
], |
|
|
], |
|
|
'basePrice.perKm': [ |
|
|
'basePrice.perKm': [ |
|
|
{ required: true, message: '请输入每公里费用', trigger: 'blur' } |
|
|
{ required: true, message: '请输入每公里费用', trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
'freePetConfig.cat.freeCount': [ |
|
|
|
|
|
{ required: true, message: '请输入猫咪免费数量', trigger: 'blur' }, |
|
|
|
|
|
{ type: 'number', min: 0, message: '免费数量不能小于0', trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
'freePetConfig.smallDog.freeCount': [ |
|
|
|
|
|
{ required: true, message: '请输入小型犬免费数量', trigger: 'blur' }, |
|
|
|
|
|
{ type: 'number', min: 0, message: '免费数量不能小于0', trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
'freePetConfig.mediumDog.freeCount': [ |
|
|
|
|
|
{ required: true, message: '请输入中型犬免费数量', trigger: 'blur' }, |
|
|
|
|
|
{ type: 'number', min: 0, message: '免费数量不能小于0', trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
'freePetConfig.largeDog.freeCount': [ |
|
|
|
|
|
{ required: true, message: '请输入大型犬免费数量', trigger: 'blur' }, |
|
|
|
|
|
{ type: 'number', min: 0, message: '免费数量不能小于0', trigger: 'blur' } |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
@ -528,7 +556,21 @@ |
|
|
if (response.rows && response.rows.length > 0) { |
|
|
if (response.rows && response.rows.length > 0) { |
|
|
const config = response.rows[0]; |
|
|
const config = response.rows[0]; |
|
|
if (config.paramValueText) { |
|
|
if (config.paramValueText) { |
|
|
this.priceConfig = JSON.parse(config.paramValueText); |
|
|
|
|
|
|
|
|
const savedConfig = JSON.parse(config.paramValueText); |
|
|
|
|
|
// 合并配置,确保新字段有默认值 |
|
|
|
|
|
this.priceConfig = { |
|
|
|
|
|
...this.priceConfig, |
|
|
|
|
|
...savedConfig |
|
|
|
|
|
}; |
|
|
|
|
|
// 确保freePetConfig字段存在 |
|
|
|
|
|
if (!this.priceConfig.freePetConfig) { |
|
|
|
|
|
this.priceConfig.freePetConfig = { |
|
|
|
|
|
cat: { freeCount: 3 }, |
|
|
|
|
|
smallDog: { freeCount: 2 }, |
|
|
|
|
|
mediumDog: { freeCount: 1 }, |
|
|
|
|
|
largeDog: { freeCount: 0 } |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
// 设置节假日日期 |
|
|
// 设置节假日日期 |
|
|
this.holidayDates = this.priceConfig.holidays || []; |
|
|
this.holidayDates = this.priceConfig.holidays || []; |
|
|
} |
|
|
} |
|
@ -591,20 +633,6 @@ |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 添加免费规则 |
|
|
|
|
|
addFreeRule() { |
|
|
|
|
|
this.priceConfig.freeQuota.rules.push({ |
|
|
|
|
|
type: 'cat', |
|
|
|
|
|
count: 0, |
|
|
|
|
|
freeAmount: 0, |
|
|
|
|
|
description: '' |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 删除免费规则 |
|
|
|
|
|
removeFreeRule(index) { |
|
|
|
|
|
this.priceConfig.freeQuota.rules.splice(index, 1); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取城市名称 |
|
|
// 获取城市名称 |
|
|
getCityName(city) { |
|
|
getCityName(city) { |
|
|