|
@@ -225,7 +225,7 @@ export default {
|
|
|
this.form = res.data
|
|
|
this.isFreeFlow = res.data.isFreeFlow === 1 ? true : false
|
|
|
// 将 freeActivityId 转换为字符串
|
|
|
- this.form.freeActivityId = res.data.freeActivityId ? String(res.data.freeActivityId) : undefined
|
|
|
+ this.form.freeActivityId = res.data.freeActivityId ? String(res.data.freeActivityId) : null
|
|
|
this.deviceIds = res.data.deviceIds.split(',')
|
|
|
// console.log("获取到详情2:", JSON.stringify(res.data))
|
|
|
// console.log("设备id:", res.data.id, ":", res.data.name, ":", res.data.freeActivityId)
|
|
@@ -264,18 +264,21 @@ export default {
|
|
|
// 如果freeOptions为空,清空freeActivityId
|
|
|
if (this.freeOptions.length === 0) {
|
|
|
this.$message.warning('没有可用的流量套餐!');
|
|
|
- this.form.freeActivityId = undefined;
|
|
|
+ this.form.freeActivityId = null;
|
|
|
}
|
|
|
// 如果freeOptions有值且freeActivityId有值,检查是否存在对应的选项
|
|
|
- else if (this.form.freeActivityId !== undefined) {
|
|
|
+
|
|
|
+ else if (this.form.freeActivityId != null) {
|
|
|
+ console.log("找匹配的流量套餐1:", this.form.freeActivityId);
|
|
|
+
|
|
|
const exists = this.freeOptions.some(item => {
|
|
|
// console.log("item.id:", item.id, "freeActivityId:", this.form.freeActivityId);
|
|
|
return String(item.id) === String(this.form.freeActivityId);
|
|
|
});
|
|
|
- console.log("找匹配的流量套餐:", this.form.freeActivityId, exists);
|
|
|
- if (!exists) {
|
|
|
+ console.log("找匹配的流量套餐2:", this.form.freeActivityId, exists);
|
|
|
+ if (exists) {
|
|
|
this.$message.warning('原关联的流量套餐已不可用,请重新选择!');
|
|
|
- this.form.freeActivityId = undefined;
|
|
|
+ this.form.freeActivityId = null;
|
|
|
} else {
|
|
|
}
|
|
|
}
|
|
@@ -291,11 +294,11 @@ export default {
|
|
|
this.form.platformIds = JSON.stringify(this.platformIds)
|
|
|
this.form.isFreeFlow = this.isFreeFlow ? 1 : 0
|
|
|
console.log('提交:', this.form)
|
|
|
- if (this.form.isFreeFlow && this.form.freeActivityId === undefined) {
|
|
|
+ if (this.form.isFreeFlow && this.form.freeActivityId == null) {
|
|
|
this.$message.warning('请选择赠送流量套餐!');
|
|
|
return;
|
|
|
} else if (this.form.isFreeFlow != true) {
|
|
|
- this.form.freeActivityId = undefined;
|
|
|
+ this.form.freeActivityId = null;
|
|
|
}
|
|
|
if (this.form.id) {
|
|
|
edit(this.form).then(res => {
|