Compare commits
2 Commits
7e8cbdb6dd
...
919ec0710b
Author | SHA1 | Date |
---|---|---|
|
919ec0710b | |
|
1a9c11f4ca |
|
@ -108,7 +108,9 @@
|
|||
<el-table-column label="会员权益" align="left">
|
||||
<template slot-scope="scope">
|
||||
<span style="color: #666; line-height: 1.5;">
|
||||
{{ generateMemberBenefits(scope.row) }}
|
||||
{{
|
||||
scope.row.benefitsInfo || generateMemberBenefits(scope.row)
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -184,16 +186,25 @@
|
|||
<el-switch v-model="scope.row.enableBirthdayCoupons"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="生日优惠券操作" width="130" align="center">
|
||||
<el-table-column label="生日优惠券操作" width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.enableBirthdayCoupons"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleAddCoupon(scope.row)"
|
||||
>
|
||||
添加优惠券
|
||||
</el-button>
|
||||
<div v-if="scope.row.enableBirthdayCoupons">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleAddCoupon(scope.row)"
|
||||
>
|
||||
{{
|
||||
scope.row.birthdayCouponsName ? "编辑优惠券" : "添加优惠券"
|
||||
}}
|
||||
</el-button>
|
||||
<div
|
||||
v-if="scope.row.birthdayCouponsName"
|
||||
style="margin-top: 5px; font-size: 12px; color: #666;"
|
||||
>
|
||||
{{ scope.row.birthdayCouponsName }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开启生日双倍积分" align="center">
|
||||
|
@ -203,22 +214,25 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleAddLevel(scope.$index)"
|
||||
style="margin-right: 5px;"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="mini"
|
||||
@click="handleDeleteLevel(scope.$index)"
|
||||
:disabled="editLevelData.length <= 1"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<!-- 只有最后一条记录显示操作按钮 -->
|
||||
<div v-if="scope.$index === editLevelData.length - 1">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleAddLevel()"
|
||||
style="margin-right: 5px;"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="mini"
|
||||
@click="handleDeleteLevel(scope.$index)"
|
||||
:disabled="editLevelData.length <= 1"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -249,11 +263,7 @@
|
|||
align="center"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="taskDescription"
|
||||
label="任务描述"
|
||||
align="center"
|
||||
>
|
||||
<el-table-column prop="taskDesc" label="任务描述" align="center">
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启用" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
|
@ -284,32 +294,36 @@
|
|||
<el-form :model="couponForm" label-width="120px">
|
||||
<el-form-item label="优惠券名称" required>
|
||||
<el-input
|
||||
v-model="couponForm.name"
|
||||
v-model="couponForm.birthdayCouponsName"
|
||||
placeholder="生日优惠券"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券门槛金额" required>
|
||||
<el-select v-model="couponForm.discountAmount" style="width: 100%">
|
||||
<el-option label="10元" value="10元"></el-option>
|
||||
<el-option label="20元" value="20元"></el-option>
|
||||
<el-option label="50元" value="50元"></el-option>
|
||||
<el-option label="100元" value="100元"></el-option>
|
||||
</el-select>
|
||||
<el-input-number
|
||||
v-model="couponForm.birthdayCouponsThreshold"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 100%"
|
||||
placeholder="请输入门槛金额"
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券减免金额" required>
|
||||
<el-select v-model="couponForm.minAmount" style="width: 100%">
|
||||
<el-option label="1元" value="1元"></el-option>
|
||||
<el-option label="2元" value="2元"></el-option>
|
||||
<el-option label="5元" value="5元"></el-option>
|
||||
<el-option label="10元" value="10元"></el-option>
|
||||
</el-select>
|
||||
<el-input-number
|
||||
v-model="couponForm.birthdayCouponsMinus"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 100%"
|
||||
placeholder="请输入减免金额"
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券有效时间" required>
|
||||
<el-select v-model="couponForm.validityPeriod" style="width: 100%">
|
||||
<el-option label="7天" value="7天"></el-option>
|
||||
<el-option label="15天" value="15天"></el-option>
|
||||
<el-option label="30天" value="30天"></el-option>
|
||||
<el-option label="60天" value="60天"></el-option>
|
||||
<el-select
|
||||
v-model="couponForm.couponsEffectiveTimeType"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="当天" :value="1"></el-option>
|
||||
<el-option label="7天" :value="2"></el-option>
|
||||
<el-option label="本月" :value="3"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -590,11 +604,12 @@ export default {
|
|||
showReviewDialog: false,
|
||||
// 弹框表单数据
|
||||
couponForm: {
|
||||
name: "",
|
||||
discountAmount: "",
|
||||
minAmount: "",
|
||||
validityPeriod: ""
|
||||
birthdayCouponsName: "",
|
||||
birthdayCouponsThreshold: 0,
|
||||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1
|
||||
},
|
||||
currentEditingLevel: null, // 当前正在编辑优惠券的等级
|
||||
// 积分任务设置数据(按接口格式)
|
||||
dailySignSettings: {
|
||||
taskEnable: false,
|
||||
|
@ -649,60 +664,84 @@ export default {
|
|||
editPointsValidityDays: 365,
|
||||
levelDetailData: [
|
||||
{
|
||||
level: "LV1",
|
||||
levelName: "LV1",
|
||||
levelDisplayName: "铜牌会员",
|
||||
minGrowthValue: 0,
|
||||
maxGrowthValue: 100,
|
||||
startGrowthValue: 0,
|
||||
endGrowthValue: 100,
|
||||
requiredGrowthValue: "100",
|
||||
memberCount: "1,250",
|
||||
membershipCount: 1250,
|
||||
memberBenefits: "新会员双倍积分,享受基础会员价格优惠",
|
||||
enableDiscount: true,
|
||||
discountRate: 5,
|
||||
enableExchange: false,
|
||||
enableBirthdayCoupon: true,
|
||||
enableBirthdayPoints: false
|
||||
enablePointsRedemption: false,
|
||||
enableBirthdayCoupons: true,
|
||||
enableBirthdayReward: false,
|
||||
birthdayCouponsName: "",
|
||||
birthdayCouponsThreshold: 0,
|
||||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1,
|
||||
benefitsInfo: ""
|
||||
},
|
||||
{
|
||||
level: "LV2",
|
||||
levelName: "LV2",
|
||||
levelDisplayName: "银牌会员",
|
||||
minGrowthValue: 101,
|
||||
maxGrowthValue: 500,
|
||||
startGrowthValue: 101,
|
||||
endGrowthValue: 500,
|
||||
requiredGrowthValue: "500",
|
||||
memberCount: "850",
|
||||
membershipCount: 850,
|
||||
memberBenefits: "享受9.5折优惠,每月专属优惠券,生日礼品",
|
||||
enableDiscount: true,
|
||||
discountRate: 10,
|
||||
enableExchange: true,
|
||||
enableBirthdayCoupon: true,
|
||||
enableBirthdayPoints: true
|
||||
enablePointsRedemption: true,
|
||||
enableBirthdayCoupons: true,
|
||||
enableBirthdayReward: true,
|
||||
birthdayCouponsName: "",
|
||||
birthdayCouponsThreshold: 0,
|
||||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1,
|
||||
benefitsInfo: ""
|
||||
},
|
||||
{
|
||||
level: "LV3",
|
||||
levelName: "LV3",
|
||||
levelDisplayName: "金牌会员",
|
||||
minGrowthValue: 501,
|
||||
maxGrowthValue: 1200,
|
||||
startGrowthValue: 501,
|
||||
endGrowthValue: 1200,
|
||||
requiredGrowthValue: "1,200",
|
||||
memberCount: "450",
|
||||
membershipCount: 450,
|
||||
memberBenefits: "享受9折优惠,免费配送服务,专属客服支持",
|
||||
enableDiscount: true,
|
||||
discountRate: 15,
|
||||
enableExchange: true,
|
||||
enableBirthdayCoupon: true,
|
||||
enableBirthdayPoints: true
|
||||
enablePointsRedemption: true,
|
||||
enableBirthdayCoupons: true,
|
||||
enableBirthdayReward: true,
|
||||
birthdayCouponsName: "",
|
||||
birthdayCouponsThreshold: 0,
|
||||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1,
|
||||
benefitsInfo: ""
|
||||
},
|
||||
{
|
||||
level: "LV4",
|
||||
levelName: "LV4",
|
||||
levelDisplayName: "钻石会员",
|
||||
minGrowthValue: 1201,
|
||||
maxGrowthValue: 9999,
|
||||
startGrowthValue: 1201,
|
||||
endGrowthValue: 9999,
|
||||
requiredGrowthValue: "2,500",
|
||||
memberCount: "180",
|
||||
membershipCount: 180,
|
||||
memberBenefits: "享受8.5折优惠,优先配送,专属活动邀请,年度礼品",
|
||||
enableDiscount: true,
|
||||
discountRate: 20,
|
||||
enableExchange: true,
|
||||
enableBirthdayCoupon: true,
|
||||
enableBirthdayPoints: true
|
||||
enablePointsRedemption: true,
|
||||
enableBirthdayCoupons: true,
|
||||
enableBirthdayReward: true,
|
||||
birthdayCouponsName: "",
|
||||
birthdayCouponsThreshold: 0,
|
||||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1,
|
||||
benefitsInfo: ""
|
||||
}
|
||||
],
|
||||
editLevelData: [],
|
||||
|
@ -725,6 +764,12 @@ export default {
|
|||
if (this.shopId && this.shopName && !this.isBatchMode) {
|
||||
this.isEditMode = false; // 默认进入查看模式
|
||||
}
|
||||
|
||||
// 为现有数据生成会员权益信息
|
||||
this.levelDetailData = this.levelDetailData.map(level => ({
|
||||
...level,
|
||||
benefitsInfo: level.benefitsInfo || this.generateMemberBenefits(level)
|
||||
}));
|
||||
},
|
||||
mounted() {
|
||||
if (this.isBatchMode) {
|
||||
|
@ -759,7 +804,8 @@ export default {
|
|||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1,
|
||||
enableBirthdayReward: false,
|
||||
membershipCount: 0
|
||||
membershipCount: 0,
|
||||
benefitsInfo: ""
|
||||
}
|
||||
];
|
||||
},
|
||||
|
@ -794,11 +840,12 @@ export default {
|
|||
|
||||
// 重置表单数据
|
||||
this.couponForm = {
|
||||
name: "",
|
||||
discountAmount: "",
|
||||
minAmount: "",
|
||||
validityPeriod: ""
|
||||
birthdayCouponsName: "",
|
||||
birthdayCouponsThreshold: 0,
|
||||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1
|
||||
};
|
||||
this.currentEditingLevel = null;
|
||||
|
||||
// 重置积分任务设置数据
|
||||
this.dailySignSettings = {
|
||||
|
@ -915,7 +962,8 @@ export default {
|
|||
birthdayCouponsMinus: level.birthdayCouponsMinus || 0,
|
||||
couponsEffectiveTimeType: level.couponsEffectiveTimeType || 1,
|
||||
enableBirthdayReward: level.enableBirthdayReward,
|
||||
membershipCount: level.membershipCount || 0
|
||||
membershipCount: level.membershipCount || 0,
|
||||
benefitsInfo: level.benefitsInfo || ""
|
||||
}));
|
||||
} else {
|
||||
// 如果没有等级设置列表,查看模式下不显示数据
|
||||
|
@ -950,19 +998,23 @@ export default {
|
|||
generateMemberBenefits(level) {
|
||||
const benefits = [];
|
||||
|
||||
// 会员折扣权益
|
||||
if (level.enableDiscount && level.discountRate) {
|
||||
const discount = (100 - level.discountRate) / 10;
|
||||
benefits.push(`享受${discount}折优惠`);
|
||||
}
|
||||
|
||||
// 积分兑换权益
|
||||
if (level.enablePointsRedemption) {
|
||||
benefits.push("积分兑换商品");
|
||||
}
|
||||
|
||||
// 生日优惠券权益
|
||||
if (level.enableBirthdayCoupons) {
|
||||
benefits.push("生日专属优惠券");
|
||||
benefits.push("有生日优惠券");
|
||||
}
|
||||
|
||||
// 生日双倍积分权益
|
||||
if (level.enableBirthdayReward) {
|
||||
benefits.push("生日双倍积分");
|
||||
}
|
||||
|
@ -990,7 +1042,8 @@ export default {
|
|||
birthdayCouponsMinus: level.birthdayCouponsMinus,
|
||||
couponsEffectiveTimeType: level.couponsEffectiveTimeType,
|
||||
enableBirthdayReward: level.enableBirthdayReward,
|
||||
membershipCount: level.membershipCount
|
||||
membershipCount: level.membershipCount,
|
||||
benefitsInfo: this.generateMemberBenefits(level)
|
||||
})),
|
||||
dailySignSettings: {
|
||||
...this.dailySignSettings,
|
||||
|
@ -1136,18 +1189,51 @@ export default {
|
|||
},
|
||||
|
||||
handleSaveEdit() {
|
||||
// 保存编辑的数据
|
||||
this.levelDetailData = JSON.parse(JSON.stringify(this.editLevelData));
|
||||
// 保存编辑的数据,并为每个等级生成会员权益信息
|
||||
this.levelDetailData = JSON.parse(JSON.stringify(this.editLevelData)).map(
|
||||
level => ({
|
||||
...level,
|
||||
benefitsInfo: this.generateMemberBenefits(level)
|
||||
})
|
||||
);
|
||||
this.pointsValidityDays = this.editPointsValidityDays;
|
||||
|
||||
// 更新积分任务的启用状态:将 isEnabled 映射到 taskEnable
|
||||
this.updateTaskEnableStatus();
|
||||
|
||||
this.isEditMode = false;
|
||||
|
||||
// 调用保存接口
|
||||
this.saveSettingsData();
|
||||
},
|
||||
|
||||
// 更新积分任务的启用状态:将 isEnabled 映射到 taskEnable
|
||||
updateTaskEnableStatus() {
|
||||
if (this.editPointsTaskData && this.editPointsTaskData.length > 0) {
|
||||
this.editPointsTaskData.forEach(task => {
|
||||
switch (task.taskName) {
|
||||
case "每日签到":
|
||||
this.dailySignSettings.taskEnable = task.isEnabled;
|
||||
break;
|
||||
case "浏览商品":
|
||||
this.viewGoodsSettings.taskEnable = task.isEnabled;
|
||||
break;
|
||||
case "购买商品":
|
||||
this.buyGoodsSettings.taskEnable = task.isEnabled;
|
||||
break;
|
||||
case "分享商品":
|
||||
this.shareGoodsSettings.taskEnable = task.isEnabled;
|
||||
break;
|
||||
case "评价商品":
|
||||
this.commentGoodsSettings.taskEnable = task.isEnabled;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 新增会员等级
|
||||
handleAddLevel(index) {
|
||||
handleAddLevel() {
|
||||
// 创建新的等级数据
|
||||
const newLevel = {
|
||||
level: `LV${this.editLevelData.length + 1}`,
|
||||
|
@ -1163,12 +1249,12 @@ export default {
|
|||
birthdayCouponsMinus: 0,
|
||||
couponsEffectiveTimeType: 1,
|
||||
enableBirthdayReward: false,
|
||||
membershipCount: 0
|
||||
membershipCount: 0,
|
||||
benefitsInfo: ""
|
||||
};
|
||||
|
||||
// 在指定位置后插入新等级
|
||||
this.editLevelData.splice(index + 1, 0, newLevel);
|
||||
this.$message.success("新增等级成功");
|
||||
// 总是在最后添加新等级
|
||||
this.editLevelData.push(newLevel);
|
||||
},
|
||||
|
||||
// 删除会员等级
|
||||
|
@ -1185,28 +1271,77 @@ export default {
|
|||
})
|
||||
.then(() => {
|
||||
this.editLevelData.splice(index, 1);
|
||||
this.$message.success("删除等级成功");
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户取消删除
|
||||
});
|
||||
},
|
||||
|
||||
handleAddCoupon() {
|
||||
handleAddCoupon(level) {
|
||||
this.currentEditingLevel = level;
|
||||
this.showCouponDialog = true;
|
||||
|
||||
// 如果等级已有优惠券配置,则回显数据
|
||||
this.couponForm = {
|
||||
name: "生日优惠券",
|
||||
discountAmount: "10元",
|
||||
minAmount: "1元",
|
||||
validityPeriod: "请选择有效时间"
|
||||
birthdayCouponsName: level.birthdayCouponsName || "生日优惠券",
|
||||
birthdayCouponsThreshold: level.birthdayCouponsThreshold || 0,
|
||||
birthdayCouponsMinus: level.birthdayCouponsMinus || 0,
|
||||
couponsEffectiveTimeType: level.couponsEffectiveTimeType || 1
|
||||
};
|
||||
},
|
||||
|
||||
// 检查积分任务配置是否为空或未配置
|
||||
isTaskConfigEmpty(taskSettings) {
|
||||
if (!taskSettings || !taskSettings.taskConfigDetail) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const config = taskSettings.taskConfigDetail;
|
||||
|
||||
// 检查关键配置字段是否都为0或空
|
||||
// 对于每日签到,检查所有天数配置
|
||||
if (config.hasOwnProperty("oneDay")) {
|
||||
return (
|
||||
!config.oneDay &&
|
||||
!config.twoDay &&
|
||||
!config.threeDay &&
|
||||
!config.fourDay &&
|
||||
!config.fiveDay &&
|
||||
!config.sixDay &&
|
||||
!config.sevenDay
|
||||
);
|
||||
}
|
||||
|
||||
// 对于浏览商品,检查浏览积分
|
||||
if (config.hasOwnProperty("oneGoodsViewPoints")) {
|
||||
return !config.oneGoodsViewPoints;
|
||||
}
|
||||
|
||||
// 对于购买商品,检查积分比例
|
||||
if (config.hasOwnProperty("pointsRatioAmount")) {
|
||||
return !config.pointsRatioAmount;
|
||||
}
|
||||
|
||||
// 对于分享商品,检查分享积分
|
||||
if (config.hasOwnProperty("oneSharePoints")) {
|
||||
return !config.oneSharePoints;
|
||||
}
|
||||
|
||||
// 对于评价商品,检查文字和图文评价积分
|
||||
if (config.hasOwnProperty("textCommentPoints")) {
|
||||
return !config.textCommentPoints && !config.imageTextCommentPoints;
|
||||
}
|
||||
|
||||
// 默认情况:检查所有值是否都为0或空
|
||||
const values = Object.values(config);
|
||||
return values.every(value => !value || value === 0);
|
||||
},
|
||||
|
||||
// 弹框相关方法
|
||||
handleEditSignIn() {
|
||||
this.showSignInDialog = true;
|
||||
// 如果没有记录ID,设置默认值
|
||||
if (!this.recordId) {
|
||||
// 如果配置为空或未配置,设置默认值
|
||||
if (this.isTaskConfigEmpty(this.dailySignSettings)) {
|
||||
this.dailySignSettings.taskConfigDetail = {
|
||||
oneDay: 1,
|
||||
twoDay: 2,
|
||||
|
@ -1221,8 +1356,8 @@ export default {
|
|||
|
||||
handleEditBrowse() {
|
||||
this.showBrowseDialog = true;
|
||||
// 如果没有记录ID,设置默认值
|
||||
if (!this.recordId) {
|
||||
// 如果配置为空或未配置,设置默认值
|
||||
if (this.isTaskConfigEmpty(this.viewGoodsSettings)) {
|
||||
this.viewGoodsSettings.taskConfigDetail = {
|
||||
oneGoodsViewPoints: 1,
|
||||
enableDailyPointsLimit: true,
|
||||
|
@ -1233,8 +1368,8 @@ export default {
|
|||
|
||||
handleEditPurchase() {
|
||||
this.showPurchaseDialog = true;
|
||||
// 如果没有记录ID,设置默认值
|
||||
if (!this.recordId) {
|
||||
// 如果配置为空或未配置,设置默认值
|
||||
if (this.isTaskConfigEmpty(this.buyGoodsSettings)) {
|
||||
this.buyGoodsSettings.taskConfigDetail = {
|
||||
pointsRatioAmount: 1,
|
||||
enableDailyPointsLimit: true,
|
||||
|
@ -1245,8 +1380,8 @@ export default {
|
|||
|
||||
handleEditShare() {
|
||||
this.showShareDialog = true;
|
||||
// 如果没有记录ID,设置默认值
|
||||
if (!this.recordId) {
|
||||
// 如果配置为空或未配置,设置默认值
|
||||
if (this.isTaskConfigEmpty(this.shareGoodsSettings)) {
|
||||
this.shareGoodsSettings.taskConfigDetail = {
|
||||
oneSharePoints: 5,
|
||||
enableDailyPointsLimit: true,
|
||||
|
@ -1257,8 +1392,8 @@ export default {
|
|||
|
||||
handleEditReview() {
|
||||
this.showReviewDialog = true;
|
||||
// 如果没有记录ID,设置默认值
|
||||
if (!this.recordId) {
|
||||
// 如果配置为空或未配置,设置默认值
|
||||
if (this.isTaskConfigEmpty(this.commentGoodsSettings)) {
|
||||
this.commentGoodsSettings.taskConfigDetail = {
|
||||
textCommentPoints: 3,
|
||||
imageTextCommentPoints: 5,
|
||||
|
@ -1270,31 +1405,133 @@ export default {
|
|||
|
||||
// 保存弹框数据
|
||||
saveCouponForm() {
|
||||
// this.$message.success("优惠券添加成功");
|
||||
// 验证表单数据
|
||||
if (!this.couponForm.birthdayCouponsName) {
|
||||
this.$message.error("请输入优惠券名称");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!this.couponForm.birthdayCouponsThreshold &&
|
||||
this.couponForm.birthdayCouponsThreshold !== 0
|
||||
) {
|
||||
this.$message.error("请输入优惠券门槛金额");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!this.couponForm.birthdayCouponsMinus &&
|
||||
this.couponForm.birthdayCouponsMinus !== 0
|
||||
) {
|
||||
this.$message.error("请输入优惠券减免金额");
|
||||
return;
|
||||
}
|
||||
if (!this.couponForm.couponsEffectiveTimeType) {
|
||||
this.$message.error("请选择优惠券有效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
// 将优惠券数据设置到当前等级对象中
|
||||
if (this.currentEditingLevel) {
|
||||
this.currentEditingLevel.birthdayCouponsName = this.couponForm.birthdayCouponsName;
|
||||
this.currentEditingLevel.birthdayCouponsThreshold = this.couponForm.birthdayCouponsThreshold;
|
||||
this.currentEditingLevel.birthdayCouponsMinus = this.couponForm.birthdayCouponsMinus;
|
||||
this.currentEditingLevel.couponsEffectiveTimeType = this.couponForm.couponsEffectiveTimeType;
|
||||
}
|
||||
|
||||
this.showCouponDialog = false;
|
||||
this.currentEditingLevel = null;
|
||||
},
|
||||
|
||||
saveSignInForm() {
|
||||
// 生成任务描述并保存
|
||||
const taskDesc = this.generateDailySignDescription();
|
||||
this.dailySignSettings.taskDesc = taskDesc;
|
||||
|
||||
// 同时更新editPointsTaskData中的任务描述
|
||||
if (this.editPointsTaskData && this.editPointsTaskData.length > 0) {
|
||||
const task = this.editPointsTaskData.find(
|
||||
t => t.taskName === "每日签到"
|
||||
);
|
||||
if (task) {
|
||||
task.taskDesc = taskDesc;
|
||||
}
|
||||
}
|
||||
|
||||
this.showSignInDialog = false;
|
||||
// this.$message.success("每日签到设置已更新");
|
||||
},
|
||||
|
||||
saveBrowseForm() {
|
||||
// 生成任务描述并保存
|
||||
const taskDesc = this.generateViewGoodsDescription();
|
||||
this.viewGoodsSettings.taskDesc = taskDesc;
|
||||
|
||||
// 同时更新editPointsTaskData中的任务描述
|
||||
if (this.editPointsTaskData && this.editPointsTaskData.length > 0) {
|
||||
const task = this.editPointsTaskData.find(
|
||||
t => t.taskName === "浏览商品"
|
||||
);
|
||||
if (task) {
|
||||
task.taskDesc = taskDesc;
|
||||
}
|
||||
}
|
||||
|
||||
this.showBrowseDialog = false;
|
||||
// this.$message.success("浏览商品设置已更新");
|
||||
},
|
||||
|
||||
savePurchaseForm() {
|
||||
// 生成任务描述并保存
|
||||
const taskDesc = this.generateBuyGoodsDescription();
|
||||
this.buyGoodsSettings.taskDesc = taskDesc;
|
||||
|
||||
// 同时更新editPointsTaskData中的任务描述
|
||||
if (this.editPointsTaskData && this.editPointsTaskData.length > 0) {
|
||||
const task = this.editPointsTaskData.find(
|
||||
t => t.taskName === "购买商品"
|
||||
);
|
||||
if (task) {
|
||||
task.taskDesc = taskDesc;
|
||||
}
|
||||
}
|
||||
|
||||
this.showPurchaseDialog = false;
|
||||
// this.$message.success("购买商品设置已更新");
|
||||
},
|
||||
|
||||
saveShareForm() {
|
||||
// 生成任务描述并保存
|
||||
const taskDesc = this.generateShareGoodsDescription();
|
||||
this.shareGoodsSettings.taskDesc = taskDesc;
|
||||
|
||||
// 同时更新editPointsTaskData中的任务描述
|
||||
if (this.editPointsTaskData && this.editPointsTaskData.length > 0) {
|
||||
const task = this.editPointsTaskData.find(
|
||||
t => t.taskName === "分享商品"
|
||||
);
|
||||
if (task) {
|
||||
task.taskDesc = taskDesc;
|
||||
}
|
||||
}
|
||||
|
||||
this.showShareDialog = false;
|
||||
// this.$message.success("分享商品设置已更新");
|
||||
},
|
||||
|
||||
saveReviewForm() {
|
||||
// 生成任务描述并保存
|
||||
const taskDesc = this.generateCommentGoodsDescription();
|
||||
this.commentGoodsSettings.taskDesc = taskDesc;
|
||||
|
||||
// 同时更新editPointsTaskData中的任务描述
|
||||
if (this.editPointsTaskData && this.editPointsTaskData.length > 0) {
|
||||
const task = this.editPointsTaskData.find(
|
||||
t => t.taskName === "评价商品"
|
||||
);
|
||||
if (task) {
|
||||
task.taskDesc = taskDesc;
|
||||
}
|
||||
}
|
||||
|
||||
this.showReviewDialog = false;
|
||||
// this.$message.success("评价商品设置已更新");
|
||||
},
|
||||
|
@ -1329,6 +1566,108 @@ export default {
|
|||
LV4: "#f5222d"
|
||||
};
|
||||
return colorMap[levelName] || "#666";
|
||||
},
|
||||
|
||||
// 生成每日签到任务描述
|
||||
generateDailySignDescription() {
|
||||
const config = this.dailySignSettings.taskConfigDetail;
|
||||
if (
|
||||
!config ||
|
||||
(!config.oneDay &&
|
||||
!config.twoDay &&
|
||||
!config.threeDay &&
|
||||
!config.fourDay &&
|
||||
!config.fiveDay &&
|
||||
!config.sixDay &&
|
||||
!config.sevenDay)
|
||||
) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
const descriptions = [];
|
||||
if (config.oneDay) descriptions.push(`第一天签到${config.oneDay}分`);
|
||||
if (config.twoDay) descriptions.push(`第二天${config.twoDay}分`);
|
||||
if (config.threeDay) descriptions.push(`第三天${config.threeDay}分`);
|
||||
if (config.fourDay) descriptions.push(`第四天${config.fourDay}分`);
|
||||
if (config.fiveDay) descriptions.push(`第五天${config.fiveDay}分`);
|
||||
if (config.sixDay) descriptions.push(`第六天${config.sixDay}分`);
|
||||
if (config.sevenDay) descriptions.push(`连续7天${config.sevenDay}分`);
|
||||
|
||||
return descriptions.length > 0 ? descriptions.join(",") : "-";
|
||||
},
|
||||
|
||||
// 生成浏览商品任务描述
|
||||
generateViewGoodsDescription() {
|
||||
const config = this.viewGoodsSettings.taskConfigDetail;
|
||||
if (!config || !config.oneGoodsViewPoints) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
let description = `浏览一个商品获得${config.oneGoodsViewPoints}分`;
|
||||
if (config.enableDailyPointsLimit && config.dailyPointsLimit) {
|
||||
description += `,每天最多获得${config.dailyPointsLimit}分`;
|
||||
}
|
||||
|
||||
return description;
|
||||
},
|
||||
|
||||
// 生成购买商品任务描述
|
||||
generateBuyGoodsDescription() {
|
||||
const config = this.buyGoodsSettings.taskConfigDetail;
|
||||
if (!config || !config.pointsRatioAmount) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
let description = `购买${config.pointsRatioAmount}元=1分`;
|
||||
if (config.enableDailyPointsLimit && config.dailyPointsLimit) {
|
||||
description += `,每天最多获得${config.dailyPointsLimit}分`;
|
||||
}
|
||||
|
||||
return description;
|
||||
},
|
||||
|
||||
// 生成分享商品任务描述
|
||||
generateShareGoodsDescription() {
|
||||
const config = this.shareGoodsSettings.taskConfigDetail;
|
||||
if (!config || !config.oneSharePoints) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
let description = `分享一个商品获得${config.oneSharePoints}分`;
|
||||
if (config.enableDailyPointsLimit && config.dailyPointsLimit) {
|
||||
const maxTimes = Math.floor(
|
||||
config.dailyPointsLimit / config.oneSharePoints
|
||||
);
|
||||
description += `,每天最多获得${maxTimes}次`;
|
||||
}
|
||||
|
||||
return description;
|
||||
},
|
||||
|
||||
// 生成评价商品任务描述
|
||||
generateCommentGoodsDescription() {
|
||||
const config = this.commentGoodsSettings.taskConfigDetail;
|
||||
if (
|
||||
!config ||
|
||||
(!config.textCommentPoints && !config.imageTextCommentPoints)
|
||||
) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
const descriptions = [];
|
||||
if (config.textCommentPoints) {
|
||||
descriptions.push(`文字评价获得${config.textCommentPoints}分`);
|
||||
}
|
||||
if (config.imageTextCommentPoints) {
|
||||
descriptions.push(`图文评价获得${config.imageTextCommentPoints}分`);
|
||||
}
|
||||
|
||||
let description = descriptions.join(",");
|
||||
if (config.enableDailyPointsLimit && config.dailyPointsLimit) {
|
||||
description += `,每天最多获得${config.dailyPointsLimit}分`;
|
||||
}
|
||||
|
||||
return description;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -1339,32 +1678,32 @@ export default {
|
|||
"marketId"
|
||||
]),
|
||||
|
||||
// 积分任务数据,固定任务描述,开启状态从设置对象中获取
|
||||
// 积分任务数据,优先使用编辑弹框中配置的数据进行生成展示
|
||||
pointsTaskData() {
|
||||
return [
|
||||
{
|
||||
taskName: "每日签到",
|
||||
taskDescription: "第一天签到1分,第二天2分,第三天3分,连续7天10分",
|
||||
taskDesc: this.generateDailySignDescription(),
|
||||
isEnabled: this.dailySignSettings.taskEnable
|
||||
},
|
||||
{
|
||||
taskName: "浏览商品",
|
||||
taskDescription: "浏览一个商品获得1分,每天最多获得2分",
|
||||
taskDesc: this.generateViewGoodsDescription(),
|
||||
isEnabled: this.viewGoodsSettings.taskEnable
|
||||
},
|
||||
{
|
||||
taskName: "购买商品",
|
||||
taskDescription: "购买1元=1分,每天最多获得500分",
|
||||
taskDesc: this.generateBuyGoodsDescription(),
|
||||
isEnabled: this.buyGoodsSettings.taskEnable
|
||||
},
|
||||
{
|
||||
taskName: "分享商品",
|
||||
taskDescription: "分享一个商品获得5分,每天最多获得3次",
|
||||
taskDesc: this.generateShareGoodsDescription(),
|
||||
isEnabled: this.shareGoodsSettings.taskEnable
|
||||
},
|
||||
{
|
||||
taskName: "评价商品",
|
||||
taskDescription: "评价一个商品获得3分,每天最多获得5次",
|
||||
taskDesc: this.generateCommentGoodsDescription(),
|
||||
isEnabled: this.commentGoodsSettings.taskEnable
|
||||
}
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue