feat(代理政策页面): 搜索栏新增“国家”选项

This commit is contained in:
hzj 2026-02-02 10:46:24 +08:00
parent 235f84c7ee
commit 1fb6611b8f

View File

@ -1,6 +1,8 @@
<template>
<div class="app-container">
<!-- 搜索框 -->
<div class="filter-container">
<!-- 系统选择框 -->
<el-select
v-model="listQuery.sysOrigin"
placeholder="系统"
@ -14,11 +16,14 @@
:label="item.label"
:value="item.value"
>
<span style="float: left;"> <sys-origin-icon :icon="item.value" :desc="item.value" /></span>
<span style="float: left;">
<sys-origin-icon :icon="item.value" :desc="item.value"
/></span>
<span style="float: left;margin-left:10px">{{ item.label }}</span>
</el-option>
</el-select>
<!-- 区域选择框 -->
<div class="filter-item">
<select-system-region
ref="regionSelectPolicy"
@ -30,6 +35,33 @@
/>
</div>
<!-- 国家 -->
<el-select
v-model="listQuery.countryCode"
v-loading="loadingCountry"
placeholder="国家"
style="width: 200px"
class="filter-item"
clearable
collapse-tags
@change="changeCountry"
>
<el-option
v-for="item in countryList"
:key="item.id"
:label="item.country.aliasName || item.country.enName"
:value="item.country.alphaTwo"
>
<span style="float: left;">
<img :src="item.country.nationalFlag" width="30"
/></span>
<span style="float: left;margin-left:10px">{{
item.country.aliasName || item.country.enName
}}</span>
</el-option>
</el-select>
<!-- 搜索按钮 -->
<el-button
class="filter-item"
type="primary"
@ -39,25 +71,43 @@
>
搜索
</el-button>
<!-- 政策创建按钮 -->
<el-dropdown>
<el-button class="filter-item" type="primary" :disabled="!listQuery.region">
<el-button
class="filter-item"
type="primary"
:disabled="!listQuery.region"
>
政策<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleCreate(false)">历史政策</el-dropdown-item>
<el-dropdown-item @click.native="handleCreate(true)">创建政策</el-dropdown-item>
<el-dropdown-item @click.native="handleCreate(false)"
>历史政策</el-dropdown-item
>
<el-dropdown-item @click.native="handleCreate(true)"
>创建政策</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</div>
<!-- 浏览框 v-loading="listLoading"-->
<!-- 表单 v-loading="listLoading"-->
<div v-if="!isEditing">
<!-- 标题 -->
<div v-if="data.title" style="margin-bottom: 30px;">
标题: {{ data.title }}
</div>
<!-- 政策类型 -->
<div v-if="data.policyType" style="margin-bottom: 30px;color: #d42724;">
<div v-if="data.policyType === 'MONEY'">政策类型: 美金政策</div>
<div v-if="data.policyType === 'SALARY_DIAMOND'">政策类型: 工资钻石政策</div>
<div v-if="data.policyType === 'SALARY_DIAMOND'">
政策类型: 工资钻石政策
</div>
</div>
<!-- 表单表格 -->
<el-table
v-loading="listLoading"
:data="policys"
@ -65,27 +115,84 @@
fit
highlight-current-row
>
<el-table-column label="Lv" prop="level" min-width="50" align="center" />
<el-table-column label="在线(Hour)" prop="onlineTime" min-width="80" align="center" />
<el-table-column label="有效天(当天满60分钟计有效)" prop="effectiveDay" min-width="80" align="center" />
<el-table-column label="目标" prop="target" min-width="80" align="center" />
<el-table-column label="主播工资" prop="memberSalary" min-width="80" align="center" />
<el-table-column label="代理工资" prop="ownSalary" min-width="80" align="center" />
<!-- Lv -->
<el-table-column
label="Lv"
prop="level"
min-width="50"
align="center"
/>
<!-- 在线(Hour) -->
<el-table-column
label="在线(Hour)"
prop="onlineTime"
min-width="80"
align="center"
/>
<!-- 有效天数 -->
<el-table-column
label="有效天(当天满60分钟计有效)"
prop="effectiveDay"
min-width="80"
align="center"
/>
<!-- 目标 -->
<el-table-column
label="目标"
prop="target"
min-width="80"
align="center"
/>
<!-- 主播工资 -->
<el-table-column
label="主播工资"
prop="memberSalary"
min-width="80"
align="center"
/>
<!-- 代理工资 -->
<el-table-column
label="代理工资"
prop="ownSalary"
min-width="80"
align="center"
/>
<!-- 总工资 -->
<el-table-column label="总工资" min-width="80" align="center">
<template scope="scope">
{{ getTotalSalary(scope.row) }}
</template>
</el-table-column>
<!-- 道具 -->
<el-table-column label="道具" min-width="200" align="center">
<template scope="scope">
<div v-if="scope.row.propsRewards && scope.row.propsRewards.length > 0">
<div
v-if="scope.row.propsRewards && scope.row.propsRewards.length > 0"
>
<props-row :list="scope.row.propsRewards" />
</div>
</template>
</el-table-column>
<!-- 操作列表 -->
<el-table-column label="操作" min-width="80" align="center">
<template scope="scope">
<el-button type="text" :disabled="!(scope.row.propsRewards && scope.row.propsRewards.length > 0)" @click="handleCreatePropsGroup(scope.row, false, index)">道具明细</el-button>
<!-- 道具明细 按钮 -->
<el-button
type="text"
:disabled="
!(scope.row.propsRewards && scope.row.propsRewards.length > 0)
"
@click="handleCreatePropsGroup(scope.row, false, index)"
>道具明细</el-button
>
</template>
</el-table-column>
</el-table>
@ -93,7 +200,6 @@
<!-- 编辑框 -->
<div v-if="isEditing">
<div style="margin-bottom: 30px;">
<el-tag type="danger">标题</el-tag>
<el-input
@ -112,40 +218,69 @@
fit
highlight-current-row
>
<el-table-column label="等级" min-width="50" align="center">
<template scope="scope">
<el-input v-model.number="scope.row.level" size="small" placeholder="等级" />
<el-input
v-model.number="scope.row.level"
size="small"
placeholder="等级"
/>
</template>
</el-table-column>
<el-table-column label="时间(Hour)" min-width="80" align="center">
<template scope="scope">
<el-input v-model.number="scope.row.onlineTime" size="small" placeholder="时间" />
<el-input
v-model.number="scope.row.onlineTime"
size="small"
placeholder="时间"
/>
</template>
</el-table-column>
<el-table-column label="有效天(当天满60分钟计有效)" min-width="80" align="center">
<el-table-column
label="有效天(当天满60分钟计有效)"
min-width="80"
align="center"
>
<template scope="scope">
<el-input v-model.number="scope.row.effectiveDay" size="small" placeholder="时间" />
<el-input
v-model.number="scope.row.effectiveDay"
size="small"
placeholder="时间"
/>
</template>
</el-table-column>
<el-table-column label="目标" min-width="80" align="center">
<template scope="scope">
<el-input v-model.number="scope.row.target" size="small" placeholder="目标" />
<el-input
v-model.number="scope.row.target"
size="small"
placeholder="目标"
/>
</template>
</el-table-column>
<el-table-column label="主播工资" min-width="80" align="center">
<template scope="scope">
<el-input v-model="scope.row.memberSalary" type="number" size="small" placeholder="主播工资" />
<el-input
v-model="scope.row.memberSalary"
type="number"
size="small"
placeholder="主播工资"
/>
</template>
</el-table-column>
<el-table-column label="代理工资" min-width="80" align="center">
<template scope="scope">
<el-input v-model="scope.row.ownSalary" type="number" size="small" placeholder="代理工资" />
<el-input
v-model="scope.row.ownSalary"
type="number"
size="small"
placeholder="代理工资"
/>
</template>
</el-table-column>
@ -157,17 +292,37 @@
<el-table-column label="道具" min-width="80" align="center">
<template scope="scope">
<props-row v-if="scope.row.propsRewards && scope.row.propsRewards.length > 0" :list="scope.row.propsRewards" />
<el-button type="text" @click="handleCreatePropsGroup(scope.row, true, scope.$index)">编辑道具</el-button>
<props-row
v-if="scope.row.propsRewards && scope.row.propsRewards.length > 0"
:list="scope.row.propsRewards"
/>
<el-button
type="text"
@click="handleCreatePropsGroup(scope.row, true, scope.$index)"
>编辑道具</el-button
>
</template>
</el-table-column>
<el-table-column label="操作" min-width="100" align="center">
<template scope="scope">
<el-button type="text" @click="clickUp(scope.$index)">上移</el-button>
<el-button type="text" @click="clickDown(scope.$index)">下移</el-button>
<el-button v-if="policys.length > 1" type="text" @click="removeRow(scope.$index)">删除</el-button>
<el-button type="text" @click="handleShowAddRowBoxAndIndex(scope.$index)">增加行</el-button>
<el-button type="text" @click="clickUp(scope.$index)"
>上移</el-button
>
<el-button type="text" @click="clickDown(scope.$index)"
>下移</el-button
>
<el-button
v-if="policys.length > 1"
type="text"
@click="removeRow(scope.$index)"
>删除</el-button
>
<el-button
type="text"
@click="handleShowAddRowBoxAndIndex(scope.$index)"
>增加行</el-button
>
</template>
</el-table-column>
</el-table>
@ -189,7 +344,14 @@
:visible.sync="addRowsBoxVisible"
:before-close="handleAddRowClose"
>
<el-input v-model.number="addRowsNumber" maxlength="2" max="2" min="1" minlength="1" placeholder="请输入新增行数" />
<el-input
v-model.number="addRowsNumber"
maxlength="2"
max="2"
min="1"
minlength="1"
placeholder="请输入新增行数"
/>
<span slot="footer" class="dialog-footer">
<el-button @click="handleAddRowClose()"> </el-button>
<el-button type="primary" @click="addRows()"> </el-button>
@ -212,8 +374,18 @@
<el-row v-for="(item, index) in historyReleases" :key="index">
<el-card style="margin: 10px;">
<div class="ops">
<el-tag v-if="item.historyRelease" size="mini" :type="item.historyRelease ? 'success': 'info'">发布过: {{ item.historyRelease ? 'Yes' : 'No' }}</el-tag>
<el-tag v-if="item.release" size="mini" :type="item.release ? 'success' : 'info'">使用: {{ item.release ? 'Yes':'No' }}</el-tag>
<el-tag
v-if="item.historyRelease"
size="mini"
:type="item.historyRelease ? 'success' : 'info'"
>发布过: {{ item.historyRelease ? "Yes" : "No" }}</el-tag
>
<el-tag
v-if="item.release"
size="mini"
:type="item.release ? 'success' : 'info'"
>使用: {{ item.release ? "Yes" : "No" }}</el-tag
>
</div>
<div class="bottom clearfix">
{{ item.title }}
@ -225,8 +397,15 @@
<div class="time">创建时间:{{ item.createTime }}</div>
</div>
<div class="clearfix">
<el-button type="text" @click.native="handleUpdate(item)">修改</el-button>
<el-button v-if="!item.historyRelease" type="text" @click.native="handleDelete(item.id)">删除</el-button>
<el-button type="text" @click.native="handleUpdate(item)"
>修改</el-button
>
<el-button
v-if="!item.historyRelease"
type="text"
@click.native="handleDelete(item.id)"
>删除</el-button
>
</div>
</el-card>
</el-row>
@ -249,25 +428,32 @@
</template>
<script>
import { mapGetters } from "vuex";
import { teamPolicyReleases, teamPolicyHistoryReleases, teamPolicyAdd, deleteTeamPolicy } from '@/api/team'
import { mapGetters } from 'vuex'
import PropsFormEdit from './props-form-edit'
import PropsRow from '@/components/data/PropsRow'
import {
teamPolicyReleases,
teamPolicyHistoryReleases,
teamPolicyAdd,
deleteTeamPolicy
} from "@/api/team";
import { listPayOpenCountry } from "@/api/sys-pay";
import PropsFormEdit from "./props-form-edit";
import PropsRow from "@/components/data/PropsRow";
function getFormData() {
return {
id: '',
sysOrigin: '',
region: '',
id: "",
sysOrigin: "",
region: "",
release: false,
title: '',
title: "",
policy: [],
policyType: 'MONEY'
}
policyType: "MONEY"
};
}
export default {
name: 'TeamPolicyManager',
name: "TeamPolicyManager",
components: { PropsFormEdit, PropsRow },
data() {
return {
@ -290,118 +476,180 @@ export default {
formData: getFormData(),
isEditing: false,
listQuery: {
sysOrigin: 'HALAR',
region: '',
type: 'WEEK',
policyType: ''
sysOrigin: "HALAR",
region: "",
type: "WEEK",
policyType: "",
countryCode: ""
},
sysOrigins: [],
listLoading: false,
historyReleasesLoading: false
}
historyReleasesLoading: false,
selectedCountry: {}, //
countryList: [],
loadingCountry: false
};
},
computed: {
...mapGetters(['permissionsSysOriginPlatforms'])
...mapGetters(["permissionsSysOriginPlatforms"])
},
created() {
const that = this
const querySystem = this.permissionsSysOriginPlatforms[0]
const that = this;
const querySystem = this.permissionsSysOriginPlatforms[0];
if (!querySystem) {
return
return;
}
that.listQuery.sysOrigin = querySystem.value
that.listQuery.sysOrigin = querySystem.value;
this.loadOpenCountry(); //
},
methods: {
//
renderData() {
const that = this
that.listLoading = true
teamPolicyReleases(that.listQuery).then(res => {
that.listLoading = false
const { body } = res
that.data = body || {}
that.policys = []
if (that.data) {
that.policys = that.data.policy || []
}
}).catch(er => {
that.listLoading = false
})
const that = this;
that.listLoading = true;
teamPolicyReleases(that.listQuery)
.then(res => {
that.listLoading = false;
const { body } = res;
that.data = body || {};
that.policys = [];
if (that.data) {
that.policys = that.data.policy || [];
}
})
.catch(er => {
that.listLoading = false;
});
},
//
changeCountry(val) {
const that = this;
console.log("val", val);
if (!val) {
//
that.listQuery.countryCode = "";
that.selectedCountry = {};
} else {
//
that.selectedCountry =
this.countryList.find(item => item.country.alphaTwo === val) || {};
// 使访
that.listQuery.countryCode = that.selectedCountry.country
? that.selectedCountry.country.alphaTwo
: "";
}
this.renderData();
},
//
loadOpenCountry() {
const that = this;
that.loadingCountry = true;
listPayOpenCountry()
.then(res => {
that.loadingCountry = false;
that.countryList = res.body || [];
that.listQuery.countryCode = "";
that.selectedCountry = {};
// that.renderData();
})
.catch(er => {
that.loadingCountry = false;
console.error(er);
});
},
//
clickUp(index) {
const arr = this.policys
arr.splice(index - 1, 1, ...arr.splice(index, 1, arr[index - 1]))
const arr = this.policys;
arr.splice(index - 1, 1, ...arr.splice(index, 1, arr[index - 1]));
},
//
clickDown(index) {
const arr = this.policys
arr.splice(index, 1, ...arr.splice(index + 1, 1, arr[index]))
const arr = this.policys;
arr.splice(index, 1, ...arr.splice(index + 1, 1, arr[index]));
},
//
handleCreatePropsGroup(row, _isAllowEdit, _index) {
const that = this
that.isAllowEdit = _isAllowEdit
that.thisPolicysIndex = _index
const that = this;
that.isAllowEdit = _isAllowEdit;
that.thisPolicysIndex = _index;
if (!row.propsRewards) {
that.thisPropsRow = {}
that.propsFormEditVisable = true
return
that.thisPropsRow = {};
that.propsFormEditVisable = true;
return;
}
that.thisPropsRow = row
that.propsFormEditVisable = true
that.thisPropsRow = row;
that.propsFormEditVisable = true;
},
handleSearch() {
this.formData = getFormData()
this.isEditing = false
this.renderData()
this.formData = getFormData();
this.isEditing = false;
this.renderData();
},
//
changeSysOrigin() {
this.$refs.regionSelectPolicy.clearValue()
this.$refs.regionSelectPolicy.clearValue();
},
//
loadHistoryReleases() {
const that = this
that.historyReleasesLoading = true
teamPolicyHistoryReleases(that.listQuery).then(res => {
that.historyReleasesLoading = false
const { body } = res
that.historyReleases = body || []
}).catch(er => {
that.historyReleasesLoading = false
})
const that = this;
that.historyReleasesLoading = true;
teamPolicyHistoryReleases(that.listQuery)
.then(res => {
that.historyReleasesLoading = false;
const { body } = res;
that.historyReleases = body || [];
})
.catch(er => {
that.historyReleasesLoading = false;
});
},
//
handleCreate(isNew) {
const that = this
const that = this;
if (!isNew) {
that.historyReleases = []
that.loadHistoryReleases()
that.historyReleasesBoxVisible = true
return
that.historyReleases = [];
that.loadHistoryReleases();
that.historyReleasesBoxVisible = true;
return;
}
that.formData.id = ''
that.formData.region = ''
that.formData.title = ''
that.formData.release = false
that.policys = []
that.addRowsNumber = 1
that.addRowsBoxVisible = true
that.isClickNewPolicyButton = true
that.formData.id = "";
that.formData.region = "";
that.formData.title = "";
that.formData.release = false;
that.policys = [];
that.addRowsNumber = 1;
that.addRowsBoxVisible = true;
that.isClickNewPolicyButton = true;
},
//
handleShowAddRowBoxAndIndex(_index) {
const that = this
that.addRowsNumber = 1
that.addRowsBoxVisible = true
that.currentAddRowIndex = _index
that.isClickNewPolicyButton = false
const that = this;
that.addRowsNumber = 1;
that.addRowsBoxVisible = true;
that.currentAddRowIndex = _index;
that.isClickNewPolicyButton = false;
},
// ,index
addRows() {
const that = this
that.isEditing = true
const that = this;
that.isEditing = true;
for (var i = 0; i < that.addRowsNumber; i++) {
var policy = {
level: 0,
@ -412,140 +660,167 @@ export default {
ownSalary: 0,
totalSalary: 0,
propsRewards: []
}
that.policys.splice(that.currentAddRowIndex + 1, 0, policy)
};
that.policys.splice(that.currentAddRowIndex + 1, 0, policy);
}
that.currentAddRowIndex = -1
that.addRowsBoxVisible = false
that.currentAddRowIndex = -1;
that.addRowsBoxVisible = false;
},
//
removeRow(_index) {
const that = this
that.policys.splice(_index, 1)
const that = this;
that.policys.splice(_index, 1);
},
//
handleUpdate(row) {
const that = this
that.policys = row.policy
that.formData.id = row.id
that.formData.region = row.region
that.formData.title = row.title
that.formData.release = row.release
that.currentAddRowIndex = -1
that.historyReleasesBoxVisible = false
that.isEditing = true
const that = this;
that.policys = row.policy;
that.formData.id = row.id;
that.formData.region = row.region;
that.formData.title = row.title;
that.formData.release = row.release;
that.currentAddRowIndex = -1;
that.historyReleasesBoxVisible = false;
that.isEditing = true;
},
//
save(_release) {
const that = this
that.formData.sysOrigin = that.listQuery.sysOrigin
that.formData.policy = that.policys
that.formData.region = that.listQuery.region
const that = this;
that.formData.sysOrigin = that.listQuery.sysOrigin;
that.formData.policy = that.policys;
that.formData.region = that.listQuery.region;
if (!that.formData.region) {
that.$opsMessage.warn('请选择区域!')
return
that.$opsMessage.warn("请选择区域!");
return;
}
if (!that.formData.title) {
that.$opsMessage.warn('请输入政策标题!')
return
that.$opsMessage.warn("请输入政策标题!");
return;
}
if (!_release) {
that.listLoading = true
that.formData.release = _release
teamPolicyAdd(that.formData).then(res => {
that.listLoading = false
// that.isEditing = false
// that.renderData()
that.$opsMessage.success()
}).catch(er => {
that.listLoading = false
that.$opsMessage.fail()
})
return
that.listLoading = true;
that.formData.release = _release;
teamPolicyAdd(that.formData)
.then(res => {
that.listLoading = false;
// that.isEditing = false
// that.renderData()
that.$opsMessage.success();
})
.catch(er => {
that.listLoading = false;
that.$opsMessage.fail();
});
return;
}
that.$confirm('确定对外发布当政策吗?', '提示', {
type: 'warning'
}).then(() => {
that.listLoading = true
that.formData.release = _release
teamPolicyAdd(that.formData).then(res => {
that.listLoading = false
// that.isEditing = false
// that.renderData()
that.$opsMessage.success()
}).catch(er => {
that.listLoading = false
that.$opsMessage.fail()
that
.$confirm("确定对外发布当政策吗?", "提示", {
type: "warning"
})
}).catch(() => {})
.then(() => {
that.listLoading = true;
that.formData.release = _release;
teamPolicyAdd(that.formData)
.then(res => {
that.listLoading = false;
// that.isEditing = false
// that.renderData()
that.$opsMessage.success();
})
.catch(er => {
that.listLoading = false;
that.$opsMessage.fail();
});
})
.catch(() => {});
},
//
handleDelete(id) {
const that = this
that.$confirm('确定删除选择的政策吗?', '提示', {
type: 'warning'
}).then(() => {
that.listLoading = true
deleteTeamPolicy(id).then(res => {
that.$opsMessage.success()
//
that.historyReleases = that.historyReleases.filter(function(history) {
return history.id !== id
})
that.listLoading = false
}).catch(er => {
that.$opsMessage.fail()
that.listLoading = false
const that = this;
that
.$confirm("确定删除选择的政策吗?", "提示", {
type: "warning"
})
}).catch(() => {})
.then(() => {
that.listLoading = true;
deleteTeamPolicy(id)
.then(res => {
that.$opsMessage.success();
//
that.historyReleases = that.historyReleases.filter(function(
history
) {
return history.id !== id;
});
that.listLoading = false;
})
.catch(er => {
that.$opsMessage.fail();
that.listLoading = false;
});
})
.catch(() => {});
},
//
handleClose() {
this.$emit('close')
this.$emit("close");
},
//
handlePropsSuccess(propsRewards) {
this.policys[this.thisPolicysIndex].propsRewards = propsRewards
this.propsFormEditVisable = false
this.policys[this.thisPolicysIndex].propsRewards = propsRewards;
this.propsFormEditVisable = false;
},
//
getTotalSalary(item) {
item.totalSalary = (Number(item.memberSalary) + Number(item.ownSalary)).toFixed(2)
return item.totalSalary
item.totalSalary = (
Number(item.memberSalary) + Number(item.ownSalary)
).toFixed(2);
return item.totalSalary;
},
//
handleNewpolicyClose() {
this.isEditing = false
this.renderData()
this.isEditing = false;
this.renderData();
},
//
handleAddRowClose() {
this.addRowsBoxVisible = false
this.addRowsBoxVisible = false;
if (!this.isClickNewPolicyButton) {
return
return;
}
this.isEditing = false
this.isEditing = false;
},
//
handleHistoryReleasesClose() {
this.historyReleasesBoxVisible = false
this.historyReleasesBoxVisible = false;
},
selectSystemRegion() {
this.isEditing = false
this.isEditing = false;
if (!this.listQuery.region) {
this.policys = []
this.data = []
this.formData = getFormData()
return
this.policys = [];
this.data = [];
this.formData = getFormData();
return;
}
this.renderData()
this.renderData();
}
}
}
};
</script>
<style scoped lang="scss">
.app-container {
@ -569,34 +844,34 @@ export default {
}
}
.time {
font-size: 13px;
color: #999;
}
.time {
font-size: 13px;
color: #999;
}
.bottom {
margin-top: 13px;
line-height: 12px;
}
.bottom {
margin-top: 13px;
line-height: 12px;
}
.button {
padding: 0;
float: right;
}
.button {
padding: 0;
float: right;
}
.image {
width: 30%;
margin-top: 10px;
display: block;
}
.image {
width: 30%;
margin-top: 10px;
display: block;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.clearfix:after {
clear: both;
}
</style>