2025-06-03 11:53:46 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-card>
|
2025-06-07 15:51:05 +08:00
|
|
|
|
<template v-slot:header>
|
|
|
|
|
<div class="clearfix">
|
|
|
|
|
<div class="flex-center">
|
|
|
|
|
<h2>积分获取规则</h2>
|
|
|
|
|
<el-button class="ml-auto" type="primary" @click="saveData">保存 </el-button>
|
|
|
|
|
</div>
|
2025-06-03 11:53:46 +08:00
|
|
|
|
</div>
|
2025-06-07 15:51:05 +08:00
|
|
|
|
</template>
|
2025-06-03 11:53:46 +08:00
|
|
|
|
<el-form :model="incomeVal" label-width="180px">
|
|
|
|
|
<el-form-item label="签到活动状态">
|
2025-06-07 15:51:05 +08:00
|
|
|
|
<el-switch v-model="incomeVal.signStatus" :active-value="1" :inactive-value="0" />
|
2025-06-03 11:53:46 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="每日签到固定积分">
|
2025-06-07 15:51:05 +08:00
|
|
|
|
<el-input type="number" v-model="incomeVal.signCount" style="width: 200px" placeholder="每天签到获取的积分">
|
|
|
|
|
<template v-slot:append>
|
2025-06-03 11:53:46 +08:00
|
|
|
|
<span>积分</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="消费获得积分">
|
|
|
|
|
<div class="flex-center">
|
|
|
|
|
<span class="mr5">每消费</span>
|
2025-06-07 15:51:05 +08:00
|
|
|
|
<el-input type="number" v-model="incomeVal.orderAmount" style="width: 200px" placeholder="每天签到获取的积分">
|
|
|
|
|
<template v-slot:append>
|
2025-06-03 11:53:46 +08:00
|
|
|
|
<span>元</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
<span class="ml5 mr5">,获得</span>
|
2025-06-07 15:51:05 +08:00
|
|
|
|
<el-input type="number" v-model="incomeVal.orderCount" style="width: 200px" placeholder="每天签到获取的积分">
|
|
|
|
|
<template v-slot:append>
|
2025-06-03 11:53:46 +08:00
|
|
|
|
<span>积分</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-06-07 15:51:05 +08:00
|
|
|
|
import { addOrUpdate, getConfigKey2 } from '@/api/system/config';
|
2025-06-03 11:53:46 +08:00
|
|
|
|
|
2025-06-07 15:51:05 +08:00
|
|
|
|
const key = 'activity-integral-income-set-key';
|
2025-06-03 11:53:46 +08:00
|
|
|
|
|
|
|
|
|
const defaultIncomeVal = {
|
|
|
|
|
signStatus: 1,
|
|
|
|
|
signCount: 1,
|
|
|
|
|
orderAmount: 1,
|
|
|
|
|
orderCount: 1
|
2025-06-07 15:51:05 +08:00
|
|
|
|
};
|
2025-06-03 11:53:46 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
incomeObj: {},
|
2025-06-07 15:51:05 +08:00
|
|
|
|
incomeVal: {}
|
|
|
|
|
};
|
2025-06-03 11:53:46 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
initData() {
|
2025-06-07 15:51:05 +08:00
|
|
|
|
getConfigKey2(key).then((res) => {
|
2025-06-03 11:53:46 +08:00
|
|
|
|
if (res.data) {
|
2025-06-07 15:51:05 +08:00
|
|
|
|
this.incomeObj = res.data;
|
|
|
|
|
this.incomeVal = JSON.parse(res.data.configValue);
|
2025-06-03 11:53:46 +08:00
|
|
|
|
} else {
|
2025-06-07 15:51:05 +08:00
|
|
|
|
this.incomeVal = { ...defaultIncomeVal };
|
2025-06-03 11:53:46 +08:00
|
|
|
|
this.incomeObj = {
|
|
|
|
|
configValue: JSON.stringify(this.incomeVal),
|
|
|
|
|
configKey: key,
|
|
|
|
|
configType: 'N',
|
|
|
|
|
configName: '积分获取规则',
|
|
|
|
|
configId: null
|
2025-06-07 15:51:05 +08:00
|
|
|
|
};
|
2025-06-03 11:53:46 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2025-06-07 15:51:05 +08:00
|
|
|
|
saveData() {
|
|
|
|
|
const self = this;
|
|
|
|
|
this.$modal
|
|
|
|
|
.confirm('是否确认要保存积分获取规则?')
|
|
|
|
|
.then(function () {
|
|
|
|
|
self.incomeObj.configValue = JSON.stringify(self.incomeVal);
|
|
|
|
|
return addOrUpdate(self.incomeObj);
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
this.initData();
|
|
|
|
|
this.$modal.msgSuccess('保存成功');
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {});
|
|
|
|
|
}
|
2025-06-03 11:53:46 +08:00
|
|
|
|
},
|
|
|
|
|
created() {
|
2025-06-07 15:51:05 +08:00
|
|
|
|
this.initData();
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-06-03 11:53:46 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.number-input {
|
|
|
|
|
width: 120px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.jc {
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
</style>
|