Commit 1538ca7b authored by chenwei's avatar chenwei

问题修复

parent 8849fbe9
......@@ -4524,7 +4524,6 @@
"礼品ID": "Gift ID",
"允许兑换次数": "Allow redemption times",
"已兑换次数": "Redemption times",
"剩余次数": "Remaining times",
"添加礼品": "Add Gift",
"查看礼品": "View gifts",
"中文礼品名称": "Chinese gift name",
......
......@@ -227,7 +227,7 @@
</template>
</el-table-column>
<el-table-column
:label="$t('剩余次数')"
:label="$t('剩余数量')"
align="center"
prop="quantityRemain"
/>
......
......@@ -238,7 +238,7 @@
prop="exchangeCount"
></el-table-column>
<el-table-column
:label="$t('剩余次数')"
:label="$t('剩余数量')"
align="center"
prop="quantityRemain"
></el-table-column>
......
......@@ -108,19 +108,24 @@
</el-form-item>
</el-form>
<el-row class="mb8">
<el-button
type="success"
size="mini"
icon="el-icon-plus"
@click="handleNewScoreRule"
>{{ $t("添加规则") }}</el-button>
>{{ $t("添加规则") }}</el-button
>
<right-toolbar
:show-search.sync="showSearch"
@queryTable="handleQueryPagination"
/>
<el-tooltip v-hasPermi="['ecw:memberManagement:enableMemberPointsSystem']" :content="`${$t('开启会员积分系统')} : ${switchState} `" placement="top" class="switchBtn">
<el-tooltip
v-hasPermi="['ecw:memberManagement:enableMemberPointsSystem']"
:content="`${$t('开启会员积分系统')} : ${switchState} `"
placement="top"
class="switchBtn"
>
<el-switch
v-model="switchState"
:active-value="true"
......@@ -135,6 +140,7 @@
v-loading="loading"
:data="integrationRuleList"
>
<el-table-column :label="$t('编号')" align="center" prop="code" />
<el-table-column width="140" :label="$t('指标类型')" align="center">
<template slot-scope="scope">
{{
......@@ -152,26 +158,24 @@
<el-table-column :label="$t('开始时间')" align="center">
<template #default="{ row }">
{{ parseTime(row.startTime) || "/" }}</template>
{{ parseTime(row.startTime) || "/" }}</template
>
</el-table-column>
<el-table-column :label="$t('结束时间')" align="center">
<template #default="{ row }">
{{ parseTime(row.endTime) || "/" }}</template>
{{ parseTime(row.endTime) || "/" }}</template
>
</el-table-column>
<el-table-column
:label="$t('单次积分')"
align="center"
prop="getScoreOnce"
/>
<el-table-column :label="$t('单次积分')" align="center">
<template #default="{ row }"> {{ row.getScoreOnce || "--" }}</template>
</el-table-column>
<el-table-column
:label="$t('累计最高积分')"
align="center"
prop="maxScoreTotal"
>
<template #default="{ row }">
{{ row.maxScoreTotal || "--" }}</template>
<template #default="{ row }"> {{ row.maxScoreTotal || "--" }}</template>
</el-table-column>
<el-table-column
:label="$t('规则说明')"
......@@ -181,23 +185,31 @@
<el-table-column :label="$t('展示平台')" align="center">
<template #default="{ row }">
{{ handlePlatform(row.showPlatform) || "/" }}</template>
{{ handlePlatform(row.showPlatform) || "/" }}</template
>
</el-table-column>
<el-table-column :label="$t('状态')" align="center">
<template #default="{ row }">
{{ $l(handleStatus(row.status), "label") || "/" }}</template>
{{ $l(handleStatus(row.status), "label") || "/" }}</template
>
</el-table-column>
<el-table-column :label="$t('创建人')" align="center" prop="creator" />
<el-table-column :label="$t('创建时间')" align="center">
<template #default="{ row }">
{{ parseTime(row.createTime) || "/" }}</template>
{{ parseTime(row.createTime) || "/" }}</template
>
</el-table-column>
<el-table-column :label="$t('最后更新人')" align="center" prop="updater" />
<el-table-column
:label="$t('最后更新人')"
align="center"
prop="updater"
/>
<el-table-column :label="$t('最后更新时间')" align="center">
<template #default="{ row }">
{{ parseTime(row.updateTime) || "/" }}</template>
{{ parseTime(row.updateTime) || "/" }}</template
>
</el-table-column>
<el-table-column width="220px" :label="$t('操作')" align="center">
<template slot-scope="scope">
......@@ -205,42 +217,49 @@
size="mini"
type="text"
@click="handleViewDetails(scope.row)"
>{{ $t("查看") }}</el-button>
>{{ $t("查看") }}</el-button
>
<el-button
size="mini"
type="text"
:disabled="scope.row.status != '1'"
@click="handleCloseButton(scope.row)"
>{{ $t("关闭") }}</el-button>
>{{ $t("关闭") }}</el-button
>
<el-button
size="mini"
type="text"
@click="handleCopyButton(scope.row)"
>{{ $t("复制") }}</el-button>
>{{ $t("复制") }}</el-button
>
<el-button
size="mini"
type="text"
:disabled="scope.row.status != '1'"
@click="handleDelayButton(scope.row)"
>{{ $t("延期") }}</el-button>
>{{ $t("延期") }}</el-button
>
<el-button
size="mini"
:disabled="scope.row.status != '2'"
type="text"
@click="handleDelete(scope.row)"
>{{ $t("删除") }}</el-button>
>{{ $t("删除") }}</el-button
>
<el-button
size="mini"
type="text"
:disabled="scope.row.status != '2'"
@click="handleUpdate(scope.row)"
>{{ $t("编辑") }}</el-button>
>{{ $t("编辑") }}</el-button
>
<el-button
size="mini"
type="text"
:disabled="scope.row.status != '2'"
@click="handleEnabledStatus(scope.row)"
>{{ $t("启用") }}</el-button>
>{{ $t("启用") }}</el-button
>
</template>
</el-table-column>
</el-table>
......@@ -279,7 +298,7 @@
</div>
</template>
<script>
import { getDictDatas, DICT_TYPE } from '@/utils/dict'
import { getDictDatas, DICT_TYPE } from "@/utils/dict";
import {
getScoreRecordList,
integralRuleStatus,
......@@ -287,10 +306,10 @@ import {
integralRuleDelay,
integralRuleDelete,
switchRuleSet,
switchRuleGet
} from '@/api/ecw/memberManagement'
switchRuleGet,
} from "@/api/ecw/memberManagement";
export default {
name: 'IntegralRecord',
name: "IntegralRecord",
data() {
return {
switchState: true,
......@@ -300,235 +319,240 @@ export default {
loading: true,
dialogPostponeVisible: false,
integrationRuleList: [],
postponeIntegralID: '',
postponeDatetime: '',
postponeIntegralID: "",
postponeDatetime: "",
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7
}
return time.getTime() < Date.now() - 8.64e7;
},
},
queryParams: {
type: '',
title: '',
desc: '',
status: '',
getScoreOnceSymbol: '',
getScoreOnce: '',
maxScoreTotalSymbol: '',
maxScoreTotal: '',
type: "",
title: "",
desc: "",
status: "1",
getScoreOnceSymbol: "",
getScoreOnce: "",
maxScoreTotalSymbol: "",
maxScoreTotal: "",
page: 1,
rows: 10
}
}
rows: 10,
},
};
},
computed: {
isChinese() {
return this.$i18n.locale === 'zh_CN'
}
return this.$i18n.locale === "zh_CN";
},
},
created() {
this.handleQuery()
this.getSwitchRuleStatus()
this.handleQuery();
this.getSwitchRuleStatus();
},
activated() {
this.handleQuery()
this.handleQuery();
},
methods: {
openSwitch(status) {
this.$modal
.confirm(this.$t('是否确认{val}会员积分系统', { val: status ? this.$t('开启') : this.$t('关闭') }))
.then(async() => {
.confirm(
this.$t("是否确认{val}会员积分系统", {
val: status ? this.$t("开启") : this.$t("关闭"),
})
)
.then(async () => {
// return integralRuleDelete({ id: row.id })
const { code } = await switchRuleSet({ switchState: status })
const { code } = await switchRuleSet({ switchState: status });
if (code === 0) {
this.$modal.msgSuccess(this.$t('成功'))
this.$modal.msgSuccess(this.$t("成功"));
}
})
.catch(() => {
this.switchState = !status
})
this.switchState = !status;
});
},
getSwitchRuleStatus() {
switchRuleGet().then(res => {
this.switchState = res.data
})
switchRuleGet().then((res) => {
this.switchState = res.data;
});
},
// 编辑操作按钮
handleUpdate(row) {
this.$router.push({
path: '/memberManagement/addIntegrationRuleOperation',
query: { id: row.id, pageStatus: 'edit' }
})
path: "/memberManagement/addIntegrationRuleOperation",
query: { id: row.id, pageStatus: "edit" },
});
},
// 查看按钮操作
handleViewDetails(row) {
this.$router.push({
path: '/memberManagement/addIntegrationRuleOperation',
query: { id: row.id, pageStatus: 'view' }
})
path: "/memberManagement/addIntegrationRuleOperation",
query: { id: row.id, pageStatus: "view" },
});
},
// 延期按钮操作
handleDelayButton(row) {
this.postponeIntegralID = row.id
this.dialogPostponeVisible = true
this.postponeIntegralID = row.id;
this.dialogPostponeVisible = true;
},
confirmPostponeIntegral() {
integralRuleDelay({
id: this.postponeIntegralID,
endTime: this.postponeDatetime
endTime: this.postponeDatetime,
}).then((res) => {
this.postponeDatetime = ''
this.$modal.msgSuccess(this.$t('延期成功'))
})
this.postponeDatetime = "";
this.$modal.msgSuccess(this.$t("延期成功"));
});
},
// 删除按钮操作
handleDelete(row) {
this.$modal
.confirm(this.$t('是否确认删除此礼品规则'))
.then(function() {
return integralRuleDelete({ id: row.id })
.confirm(this.$t("是否确认删除此礼品规则"))
.then(function () {
return integralRuleDelete({ id: row.id });
})
.then(() => {
this.handleQuery()
this.$modal.msgSuccess(this.$t('删除成功'))
this.handleQuery();
this.$modal.msgSuccess(this.$t("删除成功"));
})
.catch(() => {})
.catch(() => {});
},
// 启用按钮操作
handleEnabledStatus(row) {
this.$modal
.confirm(this.$t('是否确认启用此礼品规则'))
.then(function() {
return integralRuleStatus({ id: row.id, status: '1' })
.confirm(this.$t("是否确认启用此礼品规则"))
.then(function () {
return integralRuleStatus({ id: row.id, status: "1" });
})
.then(() => {
this.handleQuery()
this.$modal.msgSuccess(this.$t('启用成功'))
this.handleQuery();
this.$modal.msgSuccess(this.$t("启用成功"));
})
.catch(() => {})
.catch(() => {});
},
// 复制按钮操作
handleCopyButton(row) {
this.$modal
.confirm(this.$t('是否确认复制积分规则'))
.then(function() {
return integralRuleCopy({ id: row.id })
.confirm(this.$t("是否确认复制积分规则"))
.then(function () {
return integralRuleCopy({ id: row.id });
})
.then(() => {
this.handleQuery()
this.$modal.msgSuccess(this.$t('复制成功'))
this.handleQuery();
this.$modal.msgSuccess(this.$t("复制成功"));
})
.catch(() => {})
.catch(() => {});
},
// 关闭按钮操作
handleCloseButton(row) {
this.$modal
.confirm(this.$t('是否确认关闭此礼品规则'))
.then(function() {
return integralRuleStatus({ id: row.id, status: '3' })
.confirm(this.$t("是否确认关闭此礼品规则"))
.then(function () {
return integralRuleStatus({ id: row.id, status: "3" });
})
.then(() => {
this.handleQuery()
this.$modal.msgSuccess(this.$t('关闭成功'))
this.handleQuery();
this.$modal.msgSuccess(this.$t("关闭成功"));
})
.catch(() => {})
.catch(() => {});
},
// new score rule func
handleNewScoreRule() {
this.$router.push({
path: '/memberManagement/addIntegrationRuleOperation',
query: { pageStatus: 'new' }
})
path: "/memberManagement/addIntegrationRuleOperation",
query: { pageStatus: "new" },
});
},
// 积分来源
handleSourceType(id) {
return this.getDictDatas(DICT_TYPE.SCORE_RULE_TYPE).filter(
(item) => item.value == id
)[0]
)[0];
},
// 活动状态
handleStatus(id) {
return this.getDictDatas(DICT_TYPE.GIFT_STATUS).filter(
(item) => item.value == id
)[0]
)[0];
},
arraysEqual(arr1, arr2) {
return arr1.filter((current) => {
return !!arr2.find((item) => item == current.value.toString())
})
return !!arr2.find((item) => item == current.value.toString());
});
},
// 展示平台
handlePlatform(platformId) {
const platformIdLabel = []
const platformIdLabel = [];
if (this.isChinese) {
this.arraysEqual(
this.getDictDatas(DICT_TYPE.PLATFORM_TYPE),
platformId.split(',')
platformId.split(",")
).forEach((element) => {
platformIdLabel.push(element.label)
})
platformIdLabel.push(element.label);
});
} else {
this.arraysEqual(
this.getDictDatas(DICT_TYPE.PLATFORM_TYPE),
platformId.split(',')
platformId.split(",")
).forEach((element) => {
platformIdLabel.push(element.labelEn)
})
platformIdLabel.push(element.labelEn);
});
}
return platformIdLabel.join()
return platformIdLabel.join();
},
handleQuery() {
this.queryParams.page = 1
const params = { ...this.queryParams }
this.queryParams.page = 1;
const params = { ...this.queryParams };
this.addBeginAndEndTime(
params,
this.dateRangeCreateTime,
'createTime',
"createTime",
false
)
);
getScoreRecordList(params).then((res) => {
this.loading = false
this.integrationRuleList = res.data.list
this.total = res.data.total
})
this.loading = false;
this.integrationRuleList = res.data.list;
this.total = res.data.total;
});
},
handleQueryPagination() {
const params = { ...this.queryParams }
const params = { ...this.queryParams };
this.addBeginAndEndTime(
params,
this.dateRangeCreateTime,
'createTime',
"createTime",
false
)
);
getScoreRecordList(params).then((res) => {
this.loading = false
this.integrationRuleList = res.data.list
this.total = res.data.total
})
this.loading = false;
this.integrationRuleList = res.data.list;
this.total = res.data.total;
});
},
resetQuery() {
this.loading = true
this.dateRangeCreateTime = []
this.loading = true;
this.dateRangeCreateTime = [];
this.queryParams = {
ruleTitle: '',
ruleDesc: '',
key: '',
sourceType: '',
scoreCount: '',
scoreCountOperate: '',
endTime: '',
ruleTitle: "",
ruleDesc: "",
key: "",
sourceType: "",
scoreCount: "",
status: "1",
scoreCountOperate: "",
endTime: "",
pageNo: 1,
pageSize: 10,
startTime: ''
}
this.handleQuery()
}
}
}
startTime: "",
};
this.handleQuery();
},
},
};
</script>
<style scoped>
.switchBtn{
.switchBtn {
float: right;
padding-right: 70px;
padding-top: 6px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment