fix:项目初始化
This commit is contained in:
@@ -0,0 +1,271 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :visible.sync="Visible" width="800px" center class="ac-dialog" :close-on-click-modal="false" @close="close">
|
||||
<el-form :model="form" :rules="rules" label-position="center" label-width="120px" ref="ruleForm">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="支付渠道名字" prop="channelName">
|
||||
<el-input placeholder="请输入支付渠道名字" v-model="form.channelName" style="width:180px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="激活时间段" prop="activePeriod">
|
||||
<el-input placeholder="请输入时间段" v-model="form.activePeriod" style="width:180px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="权重" prop="weight">
|
||||
<el-input placeholder="使用数字" v-model.number="form.weight" style="width:180px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="渠道费率" prop="rate">
|
||||
<el-input placeholder v-model="form.rate" style="width:180px">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="充值对象" prop="rchgFor">
|
||||
<el-select placeholder="请选择充值对象" v-model="form.rchgFor" clearable>
|
||||
<el-option label="app" value="app"></el-option>
|
||||
<el-option label="game" value="game"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否激活" prop="active">
|
||||
<el-switch :active-value="true" :inactive-value="false" active-color="#13ce66" inactive-color="#ff4949" v-model="form.active"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="金额类别" prop="category">
|
||||
<el-select placeholder="请选择类别" v-model="form.amountType" clearable>
|
||||
<el-option label="范围金额" value="range"></el-option>
|
||||
<el-option label="固定金额" value="fixed"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.amountType == 'fixed'">
|
||||
<el-form-item label="金额种类" prop="amounts">
|
||||
<el-input placeholder v-model="form.amounts" style="width:180px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.amountType == 'range'">
|
||||
<el-form-item label="最小金额" prop="minMoney">
|
||||
<el-input placeholder v-model.number="form.minMoney" style="width:180px">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.amountType == 'range'">
|
||||
<el-form-item label="最大金额" prop="maxMoney">
|
||||
<el-input placeholder v-model.number="form.maxMoney" style="width:180px">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="支付方式" prop="channelPlatType">
|
||||
<el-select filterable allow-create default-first-option v-model="form.channelPlatType" placeholder="请选择支付方式" clearable>
|
||||
<el-option v-for="item in payTypeList" :key="item.value" :label="item.value" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="扩展的充值类型" prop="rchgType">
|
||||
<el-select filterable allow-create default-first-option v-model="form.rchgType" placeholder="请选择扩展充值类型" clearable>
|
||||
<el-option v-for="item in payTypeList" :key="item.value" :label="item.value" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="扩展的充值类型名字" prop="rchgTypeName">
|
||||
<el-select filterable allow-create default-first-option v-model="form.rchgTypeName" placeholder="请选择" clearable>
|
||||
<el-option v-for="item in payTypeList" :key="item.value" :label="item.label" :value="item.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="渠道" prop="cid">
|
||||
<el-select placeholder="请选择渠道" v-model="form.channelId" clearable>
|
||||
<el-option v-for="(item, index) in pchanneList" :key="index" :label="item.cName" :value="item.cid"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="要求的系统类型" prop="sysType">
|
||||
<el-select placeholder="请选择系统类型" v-model="form.sysType" clearable>
|
||||
<el-option label="苹果" value="ios"></el-option>
|
||||
<el-option label="安卓" value="android"></el-option>
|
||||
<el-option label="移动" value="bothmb"></el-option>
|
||||
<el-option label="PC" value="pc"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="Visible = false"> 取 消 </el-button>
|
||||
<el-button type="primary" @click="submit"> 确 定 </el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { rechargeChanAdd, paychannelList, rechargeChanEidt } from '@/api/tran'
|
||||
import { payTypeList } from '@/filters/tran/rechargeProvider'
|
||||
export default {
|
||||
name: 'AddOrEdit',
|
||||
props: ['data'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
Visible: true,
|
||||
title: '',
|
||||
pchanneList: [],
|
||||
payTypeList: payTypeList(),
|
||||
rules: {
|
||||
weight: [{ required: true, message: '必填', trigger: 'blur' }],
|
||||
},
|
||||
// 表单数据
|
||||
form: {
|
||||
active: false,
|
||||
activePeriod: undefined,
|
||||
amountType: undefined,
|
||||
amounts: undefined,
|
||||
channelId: undefined,
|
||||
channelName: undefined,
|
||||
channelPlatType: undefined,
|
||||
maxMoney: undefined,
|
||||
minMoney: undefined,
|
||||
rate: undefined,
|
||||
rchgFor: undefined,
|
||||
rchgType: undefined,
|
||||
rchgTypeName: undefined,
|
||||
sysType: undefined,
|
||||
weight: undefined,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getPaychanneList()
|
||||
this.title = this.data.title
|
||||
if (this.title === '编辑') {
|
||||
this.form = { ...this.data.data }
|
||||
this.$set(
|
||||
this.form,
|
||||
'minMoney',
|
||||
this.form.minMoney ? Number(this.form.minMoney) / 100 : 0
|
||||
)
|
||||
this.$set(
|
||||
this.form,
|
||||
'maxMoney',
|
||||
this.form.maxMoney ? Number(this.form.maxMoney) / 100 : 0
|
||||
)
|
||||
if (this.form.amounts) {
|
||||
const a = []
|
||||
this.form.amounts.filter((item) => {
|
||||
a.push(item / 100)
|
||||
})
|
||||
this.form.amounts = this.form.amounts ? a.toString() : ''
|
||||
}
|
||||
} else {
|
||||
this.form = {
|
||||
active: false,
|
||||
activePeriod: undefined,
|
||||
amountType: undefined,
|
||||
amounts: undefined,
|
||||
channelId: undefined,
|
||||
channelName: undefined,
|
||||
channelPlatType: undefined,
|
||||
maxMoney: undefined,
|
||||
minMoney: undefined,
|
||||
rate: undefined,
|
||||
rchgType: undefined,
|
||||
rchgTypeName: undefined,
|
||||
sysType: undefined,
|
||||
weight: undefined,
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//TODO:新增支付渠道列表数据
|
||||
add(data) {
|
||||
rechargeChanAdd(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success('新增成功')
|
||||
this.Visible = false
|
||||
} else {
|
||||
this.$message.error('新增失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
//TODO:编辑支付渠道列表数据
|
||||
update(data) {
|
||||
rechargeChanEidt(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success('更新成功')
|
||||
this.Visible = false
|
||||
} else {
|
||||
this.$message.error('更新失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
//TODO:请求渠道列表数据
|
||||
async getPaychanneList() {
|
||||
paychannelList({ pageNum: 1, pageSize: 1000, param: {} }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.pchanneList = res.data.list
|
||||
} else {
|
||||
this.pchanneList = []
|
||||
this.$message.error('请求失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提交按钮
|
||||
submit() {
|
||||
const data = { ...this.form }
|
||||
if (data.amountType === 'range') {
|
||||
data.minMoney = Number(data.minMoney) * 100
|
||||
data.maxMoney = Number(data.maxMoney) * 100
|
||||
data.amounts = undefined
|
||||
} else if (data.amountType === 'fixed') {
|
||||
const a = []
|
||||
if (data.amounts) {
|
||||
data.amounts.split(',').filter((item) => {
|
||||
a.push(Number(item) * 100)
|
||||
})
|
||||
data.amounts = a
|
||||
data.minMoney = undefined
|
||||
data.maxMoney = undefined
|
||||
} else {
|
||||
data.amounts = []
|
||||
}
|
||||
}
|
||||
if (this.title === '新增') {
|
||||
this.add(data)
|
||||
} else if (this.title === '编辑') {
|
||||
this.update(data)
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭编辑
|
||||
close() {
|
||||
this.$emit('close')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<div class="pf-warpper">
|
||||
<el-row class="table-form">
|
||||
<el-form :inline="true" class="form-inline" label-width="80px" size="mini">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-refresh-right" plain @click="getList()">刷新</el-button>
|
||||
<el-button @click="add" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-table :data="list" border height="740" highlight-current-row style="width: 100%" v-loading="loading">
|
||||
<el-table-column align="center" fixed label="支付渠道名字" width="180">
|
||||
<template slot-scope="scope">{{ scope.row.channelName }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否激活" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="请在编辑中修改" placement="top">
|
||||
<el-switch :active-value="true" :inactive-value="false" active-color="#13ce66" disabled inactive-color="#ff4949" v-model="scope.row.active"></el-switch>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="权重">
|
||||
<template slot-scope="scope">{{ scope.row.weight }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="激活时间段" width="120">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.activePeriod
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="金额类别" width="120">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.amountType | changeCategory
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="金额种类(单位:元)" width="240">
|
||||
<template slot-scope="scope" v-if="scope.row.amountType === 'fixed' ? true : false">{{ scope.row.amounts | changeAmountTypes }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="最小金额(单位:元)">
|
||||
<template slot-scope="scope" v-if="scope.row.amountType === 'range' ? true : false">{{ scope.row.minMoney | iTofixed }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="最大金额(单位:元)">
|
||||
<template slot-scope="scope" v-if="scope.row.amountType === 'range' ? true : false">{{ scope.row.maxMoney | iTofixed }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="渠道ID" width="170">
|
||||
<template slot-scope="scope">{{ scope.row.channelId }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="渠道费率">
|
||||
<template slot-scope="scope">{{ scope.row.rate }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="充值对象">
|
||||
<template slot-scope="scope">{{ scope.row.rchgFor | changerchgType }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="渠道的充值平台类型" width="170">
|
||||
<template slot-scope="scope">{{ scope.row.channelPlatType| changePType }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="扩展的充值类型" width="170">
|
||||
<template slot-scope="scope">{{ scope.row.rchgType }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="扩展的充值类型名字" width="170">
|
||||
<template slot-scope="scope">{{ scope.row.rchgTypeName }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="要求的系统类型" width="170">
|
||||
<template slot-scope="scope">{{ scope.row.sysType }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" width="200">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.createdAt | BeiJingTime
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="修改时间" width="200">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.updatedAt | BeiJingTime
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="handleEdit('edit', scope.row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="handleDelete(scope.row)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="table-pagination">
|
||||
<el-pagination :current-page="searchData.pageNum" :page-size="searchData.pageSize" :page-sizes="[50, 100, 200, 300, 500]" :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" layout="total, sizes, prev, pager, next, jumper" />
|
||||
</div>
|
||||
<AddOrEdit :data="editData" v-if="editVisible" @close="closeEdit" ref="addOrEdit"></AddOrEdit>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { rechargeChanList, rechargeChanDel } from '@/api/tran'
|
||||
import AddOrEdit from './components/AddOrEdit'
|
||||
|
||||
export default {
|
||||
name: 'RechargeProvider',
|
||||
components: { AddOrEdit },
|
||||
filters: {
|
||||
changeCategory: function (val) {
|
||||
if (val === 'range') {
|
||||
return '范围金额'
|
||||
} else if (val === 'fixed') {
|
||||
return '固定金额'
|
||||
}
|
||||
},
|
||||
changerchgType: function (val) {
|
||||
if (val === 'app') {
|
||||
return 'app'
|
||||
} else if (val === 'game') {
|
||||
return 'game'
|
||||
}
|
||||
},
|
||||
changeAmountTypes: function (val) {
|
||||
const a = []
|
||||
if (val) {
|
||||
val.filter((item) => {
|
||||
a.push(item / 100)
|
||||
})
|
||||
}
|
||||
return a
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editVisible: false,
|
||||
// 编辑数据
|
||||
editData: {
|
||||
title: '新增',
|
||||
data: {},
|
||||
},
|
||||
total: 0,
|
||||
loading: false,
|
||||
list: [],
|
||||
dialogTitle: undefined,
|
||||
searchData: {
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
param: {},
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
//TODO:请求支付渠道列表
|
||||
async getList() {
|
||||
this.loading = true
|
||||
rechargeChanList(this.searchData).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.total = res.data.total
|
||||
this.list = res.data.list
|
||||
} else {
|
||||
this.total = 0
|
||||
this.list = []
|
||||
this.$message.error('请求支付渠道列表失败')
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
//TODO:删除支付渠道数据
|
||||
handleDelete(row) {
|
||||
this.$confirm('确认删除当前渠道?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
rechargeChanDel({ id: row.id }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功')
|
||||
} else {
|
||||
this.$message.error('删除失败')
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭编辑弹窗
|
||||
closeEdit() {
|
||||
this.editData = {
|
||||
title: '新增',
|
||||
data: {},
|
||||
}
|
||||
this.editVisible = false
|
||||
this.getList()
|
||||
},
|
||||
// 新增按钮
|
||||
add() {
|
||||
this.editData = {
|
||||
title: '新增',
|
||||
data: {},
|
||||
}
|
||||
this.editVisible = true
|
||||
},
|
||||
// 编辑按钮
|
||||
handleEdit(index, row) {
|
||||
this.editData = {
|
||||
title: '编辑',
|
||||
data: row,
|
||||
}
|
||||
this.editVisible = true
|
||||
},
|
||||
// 切换每页条数
|
||||
handleSizeChange(val) {
|
||||
this.searchData.pageSize = Number(val)
|
||||
this.getList()
|
||||
},
|
||||
|
||||
// 翻页
|
||||
handleCurrentChange(val) {
|
||||
this.searchData.pageNum = Number(val)
|
||||
this.getList()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user