客户管理套餐去除生效和失效日期
This commit is contained in:
+9
-16
@@ -73,14 +73,6 @@ public class BmsCustomerPriceSetServiceImpl implements IBmsCustomerPriceSetServi
|
||||
{
|
||||
throw new ServiceException("仅生效中的套餐允许绑定,当前套餐状态不可用");
|
||||
}
|
||||
if (bind.getPrBegindate() == null)
|
||||
{
|
||||
throw new ServiceException("绑定生效日期不能为空");
|
||||
}
|
||||
if (bind.getPrEnddate() != null && bind.getPrBegindate().after(bind.getPrEnddate()))
|
||||
{
|
||||
throw new ServiceException("失效日期不能早于生效日期");
|
||||
}
|
||||
if (bind.getBindPriority() == null || bind.getBindPriority() < 1)
|
||||
{
|
||||
bind.setBindPriority(1);
|
||||
@@ -105,6 +97,15 @@ public class BmsCustomerPriceSetServiceImpl implements IBmsCustomerPriceSetServi
|
||||
if (existing != null)
|
||||
{
|
||||
bind.setCustomerPricesetId(existing.getCustomerPricesetId());
|
||||
// 弹框已不再采集生效/失效日期,未传入时保留库中原值
|
||||
if (bind.getPrBegindate() == null)
|
||||
{
|
||||
bind.setPrBegindate(existing.getPrBegindate());
|
||||
}
|
||||
if (bind.getPrEnddate() == null)
|
||||
{
|
||||
bind.setPrEnddate(existing.getPrEnddate());
|
||||
}
|
||||
rows = bindMapper.updateBind(bind);
|
||||
}
|
||||
else
|
||||
@@ -144,14 +145,6 @@ public class BmsCustomerPriceSetServiceImpl implements IBmsCustomerPriceSetServi
|
||||
{
|
||||
throw new ServiceException("仅生效中的套餐允许绑定,当前套餐状态不可用");
|
||||
}
|
||||
if (req.getPrBegindate() == null)
|
||||
{
|
||||
throw new ServiceException("绑定生效日期不能为空");
|
||||
}
|
||||
if (req.getPrEnddate() != null && req.getPrBegindate().after(req.getPrEnddate()))
|
||||
{
|
||||
throw new ServiceException("失效日期不能早于生效日期");
|
||||
}
|
||||
Integer priority = (req.getBindPriority() == null || req.getBindPriority() < 1) ? 1 : req.getBindPriority();
|
||||
boolean overwrite = Boolean.TRUE.equals(req.getOverwriteExisting());
|
||||
|
||||
|
||||
@@ -661,7 +661,6 @@
|
||||
filterable
|
||||
placeholder="请选择生效中的套餐"
|
||||
style="width: 100%;"
|
||||
@change="onPriceSetChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in priceSetOptions"
|
||||
@@ -685,30 +684,6 @@
|
||||
<el-input-number v-model="priceSetForm.bindPriority" :min="1" controls-position="right" style="width: 100%;" />
|
||||
<div class="pane-tip">数字越小优先级越高,1 为最高</div>
|
||||
</el-form-item>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生效日期" prop="prBegindate">
|
||||
<el-date-picker
|
||||
v-model="priceSetForm.prBegindate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="失效日期" prop="prEnddate">
|
||||
<el-date-picker
|
||||
v-model="priceSetForm.prEnddate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="长期有效"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="priceSetNote">
|
||||
<el-input v-model="priceSetForm.priceSetNote" type="textarea" :rows="2" maxlength="100" show-word-limit placeholder="绑定备注(选填)" />
|
||||
</el-form-item>
|
||||
@@ -835,8 +810,7 @@ const priceSetForm = ref({})
|
||||
|
||||
const priceSetRules = {
|
||||
priceSetId: [{ required: true, message: '请选择价格套餐', trigger: 'change' }],
|
||||
bindPriority: [{ required: true, message: '优先级不能为空', trigger: 'blur' }],
|
||||
prBegindate: [{ required: true, message: '绑定生效日期不能为空', trigger: 'change' }]
|
||||
bindPriority: [{ required: true, message: '优先级不能为空', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
const selectedPriceSet = computed(() =>
|
||||
@@ -871,26 +845,18 @@ function openPriceSetDialog(row) {
|
||||
ensurePriceSetOptions()
|
||||
priceSetForm.value = row
|
||||
? { ...row }
|
||||
: { priceSetId: null, bindPriority: 1, prBegindate: null, prEnddate: null, priceSetNote: null }
|
||||
: { priceSetId: null, bindPriority: 1, priceSetNote: null }
|
||||
priceSetDialogTitle.value = row || boundPriceSets.value.length ? '更换套餐' : '绑定套餐'
|
||||
priceSetDialogVisible.value = true
|
||||
nextTick(() => proxy.$refs['priceSetRef'] && proxy.$refs['priceSetRef'].clearValidate())
|
||||
}
|
||||
|
||||
/** 选择套餐后,生效日期未填时默认今天 */
|
||||
function onPriceSetChange(priceSetId) {
|
||||
if (!priceSetId || priceSetForm.value.prBegindate) return
|
||||
priceSetForm.value.prBegindate = proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
function submitPriceSetForm() {
|
||||
proxy.$refs['priceSetRef'].validate(valid => {
|
||||
if (!valid) return
|
||||
if (priceSetForm.value.prEnddate && priceSetForm.value.prBegindate > priceSetForm.value.prEnddate) {
|
||||
proxy.$modal.msgWarning('失效日期不能早于生效日期')
|
||||
return
|
||||
}
|
||||
const payload = { ...priceSetForm.value, customerId: form.value.customerId }
|
||||
delete payload.prBegindate
|
||||
delete payload.prEnddate
|
||||
priceSetSaving.value = true
|
||||
saveCustomerPriceSet(payload).then(() => {
|
||||
proxy.$modal.msgSuccess('保存成功')
|
||||
|
||||
@@ -261,20 +261,6 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生效日期" prop="prBegindate">
|
||||
<el-date-picker v-model="batchForm.prBegindate" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="失效日期" prop="prEnddate">
|
||||
<el-date-picker v-model="batchForm.prEnddate" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="长期有效" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="优先级">
|
||||
<el-input-number v-model="batchForm.bindPriority" :min="1" controls-position="right" style="width: 100%;" />
|
||||
<div class="batch-tip">数字越小优先级越高,1 为最高</div>
|
||||
@@ -563,8 +549,7 @@ const batchFormRef = ref(null)
|
||||
const priceSetOptions = ref([])
|
||||
const batchForm = ref({})
|
||||
const batchRules = {
|
||||
priceSetId: [{ required: true, message: '请选择价格套餐', trigger: 'change' }],
|
||||
prBegindate: [{ required: true, message: '绑定生效日期不能为空', trigger: 'change' }]
|
||||
priceSetId: [{ required: true, message: '请选择价格套餐', trigger: 'change' }]
|
||||
}
|
||||
|
||||
/** 勾选客户中已绑定套餐的数量 */
|
||||
@@ -579,8 +564,6 @@ function handleBatchBindPriceSet() {
|
||||
batchForm.value = {
|
||||
priceSetId: null,
|
||||
bindPriority: 1,
|
||||
prBegindate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
|
||||
prEnddate: null,
|
||||
priceSetNote: null,
|
||||
overwriteExisting: false
|
||||
}
|
||||
@@ -596,10 +579,6 @@ function handleBatchBindPriceSet() {
|
||||
function submitBatchBind() {
|
||||
batchFormRef.value.validate(valid => {
|
||||
if (!valid) return
|
||||
if (batchForm.value.prEnddate && batchForm.value.prBegindate > batchForm.value.prEnddate) {
|
||||
proxy.$modal.msgWarning('失效日期不能早于生效日期')
|
||||
return
|
||||
}
|
||||
const total = selectedRows.value.length
|
||||
const bound = boundCount.value
|
||||
const setName = (priceSetOptions.value.find(o => o.priceSetId === batchForm.value.priceSetId) || {}).priceSetName || ''
|
||||
@@ -615,8 +594,6 @@ function submitBatchBind() {
|
||||
customerIds: selectedRows.value.map(r => r.customerId),
|
||||
priceSetId: batchForm.value.priceSetId,
|
||||
bindPriority: batchForm.value.bindPriority,
|
||||
prBegindate: batchForm.value.prBegindate,
|
||||
prEnddate: batchForm.value.prEnddate,
|
||||
priceSetNote: batchForm.value.priceSetNote,
|
||||
overwriteExisting: batchForm.value.overwriteExisting
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user