3
0
Fork 0
web-store-retail-admin/src/views/settlementCenter/bonusCount/index.vue

918 lines
25 KiB
Vue
Raw Normal View History

2025-03-23 10:03:12 +08:00
<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-10-24 15:45:01
-->
<template>
<div class="page">
<topBar
v-if="topList.length > 0"
:top-list="topList"
:moren="moren"
/>
<div class="main">
<el-form
ref="select"
:model="select"
style="padding:0px 10px 0 0;background: #fff"
label-width="100px"
>
<el-row>
<!-- 一层 -->
<el-col :span="4" >
<el-form-item :label="$t('MN_F_T_930')">
<div style="display: flex">
<div>
<el-input v-model="select.period" clearable />
</div>
<!-- <span style="margin: 0 10px"></span>-->
<!-- <div>-->
<!-- <el-input v-model="select.endPeriod" clearable />-->
<!-- </div>-->
</div>
</el-form-item>
</el-col>
<el-collapse-transition>
<div v-show="isActive">
<el-col :span="4" >
<el-form-item :label="$t('MN_F_T_931')">
<el-select
v-model="select.isRetry"
clearable
placeholder=""
>
<el-option
v-for="item in dealerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('MN_F_T_932')">
<el-select
v-model="select.isPublish"
clearable
placeholder=""
>
<el-option
v-for="item in dealerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('MN_F_T_933')">
<el-select
v-model="select.isGrant"
clearable
placeholder=""
>
<el-option
v-for="item in dealerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('MN_F_T_568')">
<el-select
v-model="select.isWithdrawal"
clearable
placeholder=""
>
<el-option
v-for="item in dealerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<div>
<el-col :span="8">
<el-form-item :label="$t('MN_F_T_1252')">
<el-date-picker
v-model="creationTime"
value-format="yyyy-MM-dd"
type="datetimerange"
:range-separator="$t('w_0139')"
:start-placeholder="$t('CK_KS_4')"
:end-placeholder="$t('CK_KS_5')"
@change="changeTime"
format="yyyy-MM-dd"
/>
</el-form-item>
</el-col>
<el-col :span="4" style="margin-left: 40px;margin-top: 3px">
<el-button
class="my_search"
type="primary"
@click="getDataList"
> {{ $t('MN_T_2') }}</el-button>
<el-button
class="my_reset"
@click="reset"
> {{ $t('MN_T_3') }}</el-button>
</el-col>
</div>
</div>
</el-collapse-transition>
</el-row>
<!-- <div class="openClose" @click="changeActive">-->
<!-- <i :class="isActive ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>-->
<!-- <div>{{ isActive ? $t('MN_F_T_545') : $t('MN_F_T_546') }}</div>-->
<!-- </div>-->
</el-form>
<div class="maintop">
<div class="mainbtn">
<el-button
size="small"
style="background-color: #48B2FD;"
class="thebtn2"
@click="balance"
v-has-buttons="['bonusCountSettlement']"
>{{ $t('MN_F_T_934') }}</el-button>
<el-button
size="small"
class="thebtn2"
@click="publish"
v-has-buttons="['bonusCountPublish']"
>{{ $t('MN_F_T_935') }}</el-button>
<el-button
size="small"
class="thebtn2"
@click="publish1"
>{{ $t('MN_F_T_936') }}</el-button>
<el-button
size="small"
style="background-color: #009B58"
class="thebtn2"
v-has-buttons="['bonusCountGrant']"
@click="grant"
>{{ $t('MN_F_T_937') }}</el-button>
<el-button
size="small"
style="background-color: #48B2FD"
class="thebtn2"
@click="withdraw"
v-has-buttons="['bonusCountCash']"
>{{ $t('MN_F_T_938') }}</el-button>
</div>
<div>
<el-dropdown :hide-on-click="false">
<span class="el-dropdown-link kuang">
{{$t('MN_F_T_939')}}<i class="el-icon-arrow-down el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="item in menuList"
:key="item.id"
>
<el-checkbox
v-model="item.checked"
@change="getMenu($event,item.id)"
>{{ item.text }}</el-checkbox></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
<div class="maintable">
<div class="itemTrading">
<el-table
ref="multipleTable"
height="690px"
class="content"
v-loading="loading"
:data="tableData.censusSummaryList"
style="width: 100%;"
:header-cell-style="{ background: '#EEEEEE' }"
:row-class-name="tableRowClassName"
:summary-method="getSummaries"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection"> </el-table-column>
<el-table-column
align="center"
prop="pkId"
width="130"
:label="$t('MN_F_T_930')"
/>
<el-table-column
align="center"
prop="settleDate"
width="130"
:label="$t('MN_F_T_1252')"
/>
<el-table-column
v-if="menuList[1].checked==true"
align="center"
prop="orderCode"
width="130"
:label="$t('MN_F_T_854')+`(${isLocalSymbol()})`"
:formatter="stateFormat"
/>
<el-table-column
align="center"
prop="orderTypeVal"
width="130"
:label="$t('MN_F_T_940')+'(%)'"
/>
<el-table-column
v-if="menuList[2].checked==true"
align="center"
prop="sourceCountryName"
width="130"
:label="$t('MN_F_T_843')+`(${isLocalSymbol()})`"
:formatter="stateFormat"
/>
<el-table-column
align="center"
prop="sourceMemberCode"
width="130"
:label="$t('MN_F_T_941')+'(%)'"
/>
<el-table-column
v-if="menuList[3].checked==true"
align="center"
prop="sourceMemberName"
width="130"
:label="$t('MN_F_T_942')+`(${isLocalSymbol()})`"
:formatter="stateFormat"
/>
<el-table-column
align="center"
prop="firstBuyAmount"
width="130"
:label="$t('MN_F_T_943')+'(%)'"
/>
<el-table-column
v-if="menuList[4].checked==true"
align="center"
prop="firstBuyAmount"
width="130"
:label="$t('MN_F_T_944')+`(${isLocalSymbol()})`"
:formatter="stateFormat"
/>
<el-table-column
align="center"
prop="firstBuyAmount"
width="130"
:label="$t('MN_F_T_945')+'(%)'"
:formatter="stateFormat"
/>
<!-- <el-table-column-->
<!-- v-for="item in menuList"-->
<!-- v-if="item.checked&&item.id != 0&&item.id < 5"-->
<!-- :key="item.id"-->
<!-- align="center"-->
<!-- width="130"-->
<!-- :prop="item.prop"-->
<!-- :label="item.text"-->
<!-- />-->
<el-table-column
align="center"
prop="isSettleVal"
width="100"
:label="$t('MN_F_T_931')"
/>
<el-table-column
align="center"
prop="settleDate"
width="100"
:label="$t('w_0431')"
/>
<el-table-column
align="center"
prop="isPublishVal"
width="100"
:label="$t('MN_F_T_932')"
/>
<el-table-column
align="center"
prop="isGrantVal"
width="100"
:label="$t('MN_F_T_933')"
/>
<el-table-column
align="center"
prop="grantDate"
width="130"
:label="$t('w_0432')"
/>
<el-table-column
align="center"
prop="isWithdrawalVal"
width="130"
:label="$t('MN_F_T_568')"
/>
<el-table-column
align="center"
prop="withdrawalDate"
width="130"
:label="$t('PER_DA_9')"
/>
<el-table-column
width="auto"
label=""
/>
<!-- <el-table-column align="center"-->
<!-- prop="time"-->
<!-- :label="$t('MY_ORD_14')" fixed="right" >-->
<!-- <template slot-scope="scope">-->
<!-- <el-button @click="toFixed(scope.row.pkId)"-->
<!-- type="text"-->
<!-- size="small">-->
<!-- 修改-->
<!-- </el-button>-->
<!-- <el-button @click="toFixed(scope.row.pkId)"-->
<!-- type="text"-->
<!-- size="small">-->
<!-- 查看-->
<!-- </el-button>-->
<!-- <el-button @click="handleDelete(scope.row.pkId)"-->
<!-- type="text"-->
<!-- size="small"-->
<!-- style="color: #c73030">-->
<!-- 删除-->
<!-- </el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</div>
<!-- <div class="heji">-->
<!-- <div-->
<!-- v-for="item in menuList"-->
<!-- v-if="item.checked&&item.id != 0&&item.id > 13"-->
<!-- :key="item.id"-->
<!-- class="dis"-->
<!-- >-->
<!-- <div>{{ item.text }}</div>-->
<!-- <div>{{ tableData[item.prop] }}</div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getDataList"
/>
</div>
</template>
<script>
import topBar from '@/components/topBar'
import * as api from '@/api/settle.js'
import { classifyUpdate, classifySave } from '@/api/product'
import * as log from '@/api/logistics'
import { getcountryAllList } from '@/api/exchangerate'
import {getDealerYesno, settleBonus, publishBonus, grantBonus, withdrawalBonus, noPublishBonus,} from '@/api/member'
import { listPeriod } from '@/api/bonus'
import { Message } from 'element-ui'
import {isLocal, isLocalSymbol, stateFormat} from "@/utils/numberToCurrency";
import {mapGetters} from "vuex";
export default {
name: 'Bzpz',
components: {
topBar
},
filters: {
isAgree(val) {
if (!val) {
return this.$t('ENU_POPUP_TYPE_1');
} else {
return this.$t('ENU_POPUP_TYPE_2');
}
}
},
data() {
return {
dealerList: [],
isActive: true,
typeList: [
{
value: 0,
label: this.$t('ENU_NOTICE_WEBSITE_TYPE_1')
},
{
value: 1,
label: this.$t('ENU_NOTICE_WEBSITE_TYPE_2')
}
],
digList: [
{
value: 0,
label: this.$t('ENU_POPUP_TYPE_1'),
},
{
value: 1,
label: this.$t('ENU_POPUP_TYPE_2'),
},
],
menuList: [
{
id: 0,
text: this.$t('MN_F_T_948'),
checked: true,
},
{
id: 1,
checked: true,
prop: 'firstBuyAmountDollar',
text: `${this.$t('MN_F_T_854')}(${isLocalSymbol()})`
},
{
id: 2,
text: `${this.$t('MN_F_T_843')}(${isLocalSymbol()})`,
checked: true,
prop: 'upgradeAmountDollar',
},
{
id: 3,
text: `${this.$t('MN_F_T_854')}(${isLocalSymbol()})`,
checked: true,
prop: 'repurchaseAmountDollar',
},
{
id: 4,
text: `${this.$t('MN_F_T_943')}(${isLocalSymbol()})`,
checked: true,
prop: 'fansAmountDollar',
}
],
creationTime: [],
creationTime1: [],
select: {
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 50
},
addOrEdit: '',
total: 0,
dialogVisible: false,
loading:false,
tableData: {
censusSummaryList: []
},
moren: '/settlementCenter/bonusCount',
topList: [
{
name: this.$t('MN_F_T_46'),
path: '/settlementCenter/bonusCount'
}
],
form: {
name: ''
},
rules: {
name: [{ required: true, message: this.$t('MN_F_T_302'), trigger: 'blur' }]
},
acList: [],
verList: [],
memberList: [],
yieldList: [],
yieldStatus: [],
countryList: [],
orderTypeList: [],
button1Flag:false,
button2Flag:false,
button3Flag:false,
button4Flag:false,
}
},
mounted() {
// 获取下拉
this.getData()
// 获取列表
this.getDataList()
},
computed: {
...mapGetters(['getUser'])
},
methods: {
isLocalSymbol,
isLocal,
stateFormat,
verifySelect() {
const len = this.$refs.multipleTable.selection.length
if (len === 0) {
Message({ message: this.$t('MN_F_T_527'), type: 'warning' })
} else if (len > 1) {
Message({ message: this.$t('MN_F_T_528'), type: 'warning' })
} else {
return true
}
},
// 结算
balance() {
const verify = this.verifySelect()
const time = this.$refs.multipleTable.selection[0].settleDate
if (verify) {
settleBonus({ 'settleDate': time }).then((res) => {
if (res.code == 200) {
Message({
message: res.msg,
type: 'success'
})
} else {
Message({
message: res.msg,
type: 'error'
})
}
})
}
},
// 不公布
publish1() {
const verify = this.verifySelect()
const time = this.$refs.multipleTable.selection[0].settleDate
if (verify) {
noPublishBonus({ 'settleDate': time }).then((res) => {
if (res.code == 200) {
Message({
message: res.msg,
type: 'success'
})
} else {
Message({
message: res.msg,
type: 'error'
})
}
})
}
},
// 公布
publish() {
const verify = this.verifySelect()
const time = this.$refs.multipleTable.selection[0].settleDate
if (verify) {
publishBonus({ 'settleDate': time }).then((res) => {
if (res.code == 200) {
Message({
message: res.msg,
type: 'success'
})
} else {
Message({
message: res.msg,
type: 'error'
})
}
})
}
},
// 发放
grant() {
const verify = this.verifySelect()
const time = this.$refs.multipleTable.selection[0].settleDate
if (verify) {
grantBonus({ 'settleDate': time }).then((res) => {
if (res.code == 200) {
Message({
message: res.msg,
type: 'success'
})
} else {
Message({
message: res.msg,
type: 'error'
})
}
})
}
},
// 提现
withdraw() {
const verify = this.verifySelect()
const time = this.$refs.multipleTable.selection[0].settleDate
if (verify) {
withdrawalBonus({ 'settleDate': time }).then((res) => {
if (res.code == 200) {
Message({
message: res.msg,
type: 'success'
})
} else {
Message({
message: res.msg,
type: 'error'
})
}
})
}
},
// 展开折叠
changeActive() {
this.isActive = !this.isActive
},
reset() {
this.select = {
}
// this.creationTime = ''
this.creationTime = []
this.getDataList()
},
getMenu(e, id) {
if (e && id == 0) {
this.menuList.forEach((item) => {
this.$set(item, 'checked', true)
})
} else if (!e && id == 0) {
this.menuList.forEach((item) => {
this.$set(item, 'checked', false)
})
}
},
getData() {
// 经销商
getDealerYesno().then((res) => {
this.dealerList = res.data
})
},
changeTime(val) {
if(val){
this.select.startDate = val[0]
this.select.endDate = val[1]
}
},
// 点击修改
toFixed(id) {
this.addOrEdit = false
this.dialogVisible = true
this.$router.push({
path: 'noticeList/details',
query: {
pkId: id
}
})
},
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = this.$t('MN_F_T_951') +'(¥)'
return
}
if (index === 1) {
sums[index] = ''
return
}
const values = data.map((item) => Number(item[column.property]))
if (!values.every((value) => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
// sums[index] += ' 元'
} else {
sums[index] = ''
}
})
return sums
},
// 删除
handleDelete(id) {
this.$confirm(this.$t('MN_F_T_303'), this.$t('w_0034'), {
confirmButtonText: this.$t('w_0035'),
cancelButtonText: this.$t('ENU_P_TYPE0'),
type: 'warning'
}).then(() => {
api.classifyDel(id).then((res) => {
this.getDataList()
})
})
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let url = ''
if (this.addOrEdit == true) {
url = classifySave
} else {
url = classifyUpdate
}
url(this.form).then((res) => {
if (res.code == 200) {
this.$message({
message: res.msg,
type: 'success'
})
this.dialogVisible = false
// 充值数据
this.$refs[formName].resetFields()
// 获取列表
this.getDataList()
}
})
} else {
return false
}
})
},
handleClose() {
this.dialogVisible = false
this.$refs['form'].clearValidate()
this.$refs['form'].resetFields()
},
openDig() {
this.$router.push({
path: 'noticeList/details'
})
},
getDataList() {
this.loading = true
if(this.select.period){
this.select.period=parseInt(this.select.period)
}
if (this.creationTime == '' || this.creationTime == null) {
this.select.startDate = ''
this.select.endDate = ''
}
Number(this.select)
listPeriod(Object.assign({}, this.select),`?pageNum=${this.queryParams.pageNum}&pageSize=${this.queryParams.pageSize}`)
.then((res) => {
this.loading = false
this.tableData.censusSummaryList = res.rows
this.total = res.total
})
},
handleSelectionChange(val) {},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm( this.$t('MN_F_T_407'), this.$t('MN_F_T_304'), {
confirmButtonText: this.$t('w_0035'),
cancelButtonText: this.$t('ENU_P_TYPE0'),
type: 'warning'
})
.then(function() {
return api.exportClassIfy(queryParams)
})
.then((response) => {
this.download(response)
})
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 1) {
return 'warning-row'
} else if (rowIndex % 2 == 0) {
return 'success-row'
}
return ''
}
}
}
</script>
<style scoped lang="scss">
::v-deep .el-range-editor.el-input__inner{
width: 100%!important;
}
::v-deep .el-button{
padding: 8px 20px;
}
::v-deep .el-date-editor .el-range__close-icon{
margin-top: -10px;
}
::v-deep .el-date-editor .el-range-separator{
margin-top: -10px;
}
::v-deep .el-date-editor .el-range__icon{
margin-top: -10px;
}
::v-deep .el-input__inner{
//height:28px;
//line-height: 28px;
}
::v-deep .el-form-item__label{
color: #333;
font-weight: inherit;
}
::v-deep .el-table .warning-row {
background: #f9f9f9;
}
::v-deep .el-table .success-row {
background: #ffffff;
}
::v-deep .el-table thead {
color: #000000;
}
::v-deep .el-select {
width: 100%;
}
.uploadIcon ::v-deep .el-upload--picture-card {
display: none !important; /* 上传按钮隐藏 */
}
.page {
padding: 20px;
background: #f9f9f9;
font-size: 14px;
.main {
background: #f9f9f9;
//border-radius: 8px;
//box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);
.maintop {
display: flex;
padding: 0 0;
justify-content: space-between;
align-items: center;
.mainbtn {
.thebtn1 {
background: #3181e5;
color: #ffffff;
}
.thebtn2 {
background: #F3A900;
color: #ffffff;
}
}
.maintitle {
font-size: 10px;
font-family: MicrosoftYaHei;
color: #999999;
}
}
}
.tem {
display: flex;
align-items: center;
justify-content: center;
img {
width: 28px;
height: 20px;
margin-right: 3px;
}
}
.isRed {
color: #ed1d25;
}
.isGreen {
color: #1ab62b;
}
.bgImg {
width: 48px;
height: 48px;
}
}
.openClose {
margin-right: 10px;
color: #666666;
text-align: center;
}
.kuang {
padding: 5px 20px;
background: rgba(255, 255, 255, 0);
border-radius: 4px;
border: 1px solid #cccccc;
margin-right: 10px;
}
.heji {
margin-top: 10px;
.dis {
display: flex;
justify-content: right;
padding: 5px 10px;
font-size: 14px;
color: #333333;
:nth-child(1) {
font-size: 14px;
font-weight: bold;
color: #333333;
margin-right: 20px;
}
}
}
</style>