7.17(添加平台下拉

This commit is contained in:
Hong
2024-07-17 18:52:36 +08:00
parent e53f701aa2
commit 02d94ffef4
5 changed files with 514 additions and 25 deletions

View File

@@ -326,4 +326,61 @@ export function exportOutList(params) {
responseType: 'blob',
params,
});
}
}
/**
* 分佣平台列表 /api/admin/platform/return/commission/platform/config/page/list
*/
export function getDivideList(params) {
return request({
url: '/admin/platform/return/commission/platform/config/page/list',
method: 'get',
params
});
}
/**
* 分佣平台详情 /api/admin/platform/return/commission/platform/config/detail/{id}
*/
export function getDivideDetail(id) {
return request({
url: `/admin/platform/return/commission/platform/config/detail/${id}`,
method: 'get',
});
}
/**
* 修改用户编号跟状态/api/admin/platform/return/commission/platform/config/update
*/
export function getDivideUpdate(data) {
return request({
url: `/admin/platform/return/commission/platform/config/update`,
method: 'post',
data
});
}
//添加合作平台 /api/admin/platform/return/commission/platform/config/add
export function getDivideAdd(data) {
return request({
url: '/admin/platform/return/commission/platform/config/add',
method: 'post',
data
});
}
//删除平台 /api
export function getDivideDel(id) {
return request({
url: `/admin/platform/return/commission/platform/config/delete/${id}`,
method: 'post',
});
}
//平台列表 /api/admin/platform/return/commission/platform/config/all/list
export function getDivideAllList(id) {
return request({
url: `/admin/platform/return/commission/platform/config/all/list`,
method: 'get',
});
}

View File

@@ -10,6 +10,12 @@ const divideRouter = {
icon: 'clipboard',
},
children: [
{
path: 'list',
component: () => import('@/views/divide/list'),
name: 'list',
meta: { title: '分佣平台', icon: '' },
},
{
path: 'divide_list',
component: () => import('@/views/divide/divide_list'),

View File

@@ -10,20 +10,19 @@
<el-form-item label="平台全称" prop="name" class="lang">
<el-input v-model.trim="dataForm.abbreviation" placeholder="请输入平台全称" />
</el-form-item>
<el-form-item label="平台简称" prop="abbreviation" class="lang">
<el-input v-model.trim="dataForm.name" placeholder="请输入平台简称" />
</el-form-item>
<el-form-item label="平台简介" prop="abbreviation" class="lang">
<el-input v-model.trim="dataForm.maxMoney" placeholder="请输入平台简称" />
<el-form-item label="平台简称:">
<el-select v-model="dataForm.name" style="width: 200px;" filterable remote reserve-keyword
placeholder="选择分佣方案" :loading="loading" clearable @change="dicideChange">
<el-option v-for="(item, index) in dicideList" :key="index" :label="item.name" :value="item.name">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="平台编码" prop="platformSn" class="lang">
<el-input v-model.trim="dataForm.platformSn" placeholder="请输入平台编码" />
</el-form-item>
<el-form-item label="注册链接" prop="link" class="lang">
<el-input v-model.trim="dataForm.link" placeholder="请输入注册链接" />
<el-input v-model.trim="dataForm.platformSn" disabled placeholder="请输入平台编码" />
</el-form-item>
<el-form-item label="平台logo" prop="image" class="lang">
<div class="upLoadPicBox" @click="modalPicTapOnly('1', 'image')">
<!-- @click="modalPicTapOnly('1', 'image')" -->
<div class="upLoadPicBox" >
<div v-if="dataForm.image" class="pictrue"><img :src="dataForm.image" /></div>
<div v-else-if="dataForm.image" class="pictrue"><img :src="dataForm.image" /></div>
<div v-else class="upLoad">
@@ -31,6 +30,16 @@
</div>
</div>
</el-form-item>
<el-form-item label="平台简介" prop="abbreviation" class="lang">
<el-input v-model.trim="dataForm.maxMoney" placeholder="请输入平台简称" />
</el-form-item>
<el-form-item label="注册链接" prop="link" class="lang">
<el-input v-model.trim="dataForm.link" placeholder="请输入注册链接" />
</el-form-item>
<el-form-item label="省市区" prop="selectedOptions" class="lang">
<el-cascader style="width: 100%" :options="pcTextArr" v-model="dataForm.selectedOptions"
@change="addressChoose"></el-cascader>
</el-form-item>
<el-form-item label="分佣类型:" prop="typeId" class="lang">
<el-radio v-model="dataForm.way" :label="'0'">按比例分佣(0~1)</el-radio>
<el-radio v-model="dataForm.way" :label="'1'">按量分佣(/)</el-radio>
@@ -48,14 +57,12 @@
<el-input type="number" v-model.trim="item.maxStandard" style="width: 200px;" placeholder="请输入结束单量" />
<el-input-number type="text" :precision="2" style="width: 200px;" v-model="item.rebate" :min="0"
:max="999999999"></el-input-number>
<i class="el-icon-remove" style="font-size: 22px;color: red;margin-left: 6px;" @click="subRatioListFn(index)"></i>
<i class="el-icon-remove" style="font-size: 22px;color: red;margin-left: 6px;"
@click="subRatioListFn(index)"></i>
<!-- <el-button type="primary" icon="el-icon-remove" circle ></el-button> -->
</div>
</el-form-item>
<el-form-item label="省市区" prop="selectedOptions" class="lang">
<el-cascader style="width: 100%" :options="pcTextArr" v-model="dataForm.selectedOptions"
@change="addressChoose"></el-cascader>
</el-form-item>
<el-form-item label="上传合同" prop="contract" class="lang">
<div class="upLoadPicBox" @click="modalPicTapOnly('1', 'contract')">
<div v-if="dataForm.contract" class="pictrue"><img :src="dataForm.contract" /></div>
@@ -83,13 +90,11 @@
</template>
<script>
import { platformPageListApi, platformAdd, platformUpdate, platformDelete, platformDetail } from "@/api/divide.js"
import { platformAdd, platformUpdate, getDivideAllList } from "@/api/divide.js"
import { pcTextArr } from 'element-china-area-data';
import * as merchant from '@/api/vehicleShop/vehicleShop';
import { mapGetters } from 'vuex';
import Keyword from '../../../components/base/keyword';
import { Icon } from "element-ui";
import elementIcons from "@/components/js/element-icons";
export default {
name: 'creatClassify',
components: {
@@ -110,6 +115,8 @@ export default {
},
data() {
return {
//平台列表
dicideList: [],
dialogVisible: false,
formValidate: Object.assign({}, {}),
formValidate2: Object.assign({}, {}),
@@ -169,8 +176,8 @@ export default {
if (val.id) {
console.log(val.selectedOptions);
this.dataForm = val
if(val.gearList){
this.gearList=val.gearList
if (val.gearList) {
this.gearList = val.gearList
}
} else {
this.dataForm = {
@@ -205,7 +212,29 @@ export default {
window.selectAdderss = this.selectAdderss;
this.keyUrl = `https://apis.map.qq.com/tools/locpicker?type=1&key=SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7&referer=myapp`;
},
created() {
this.getDivideAllListFn()
},
methods: {
//监听选择
dicideChange(e) {
console.log(e);
this.dicideList.forEach(item => {
if (item.name == e) {
console.log(item);
this.dataForm.image = item.image
this.dataForm.platformSn = item.platformSn
// this.dataForm.platformSn=item.platformSn
}
})
},
//获取平台数据
getDivideAllListFn() {
getDivideAllList().then(res => {
console.log('列表', res);
this.dicideList = res
})
},
//添加分佣列表
addRatioListFn() {
this.gearList.push({
@@ -303,7 +332,7 @@ export default {
this.dialogVisible = false;
// this.$refs['dataForm'].resetFields();
this.loading = false;
this.gearList=[]
this.gearList = []
this.$parent.carListFn()
// this.$emit('getList');
},
@@ -312,7 +341,7 @@ export default {
if (valid) {
this.loading = true;
// if (this.dataForm.addressDetail) this.$delete(this.dataForm, 'addressDetail');
this.dataForm.gearList=this.gearList
this.dataForm.gearList = this.gearList
this.dataForm.qualificationPicture = JSON.stringify(this.dataForm.sliderImages);
this.dataForm.keywords = this.labelarr.join(',');
this.dataForm.startTime = this.dataForm.time1[0]
@@ -320,7 +349,7 @@ export default {
platformUpdate(this.dataForm).then((res) => {
this.$message.success('操作成功');
this.onClose();
})
.catch(() => {
this.loading = false;
@@ -329,7 +358,7 @@ export default {
platformAdd(this.dataForm).then((res) => {
this.$message.success(`添加成功`);
this.onClose();
})
.catch(() => {
this.loading = false;

View File

@@ -0,0 +1,228 @@
<template>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" destroy-on-close width="1000px">
<el-form v-loading="loadingFrom" ref="dataForm" :inline="true" :model="dataForm" label-width="100px"
:rules="rules">
<el-form-item label="平台简称" prop="name" class="lang">
<el-input v-model.trim="dataForm.name" placeholder="请输入平台简称" />
</el-form-item>
<el-form-item label="平台编码" prop="platformSn" class="lang">
<el-input v-model.trim="dataForm.platformSn" placeholder="请输入平台编码" />
</el-form-item>
<el-form-item label="平台logo" prop="image" class="lang">
<div class="upLoadPicBox" @click="modalPicTapOnly('1', 'image')">
<div v-if="dataForm.image" class="pictrue"><img :src="dataForm.image" /></div>
<div v-else-if="dataForm.image" class="pictrue"><img :src="dataForm.image" /></div>
<div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeModel()"> </el-button>
<el-button type="primary" v-hasPermi="['platform:merchant:add', 'platform:merchant:update']" :loading="loading"
@click="onsubmit('dataForm')">保存</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getDivideAdd, getDivideUpdate } from "@/api/divide.js"
import * as merchant from '@/api/vehicleShop/vehicleShop';
import { mapGetters } from 'vuex';
import Keyword from '../../../components/base/keyword';
import { Icon } from "element-ui";
import elementIcons from "@/components/js/element-icons";
export default {
name: 'creatClassify',
components: {
Keyword,
},
props: {
formData: {
type: Object,
default: {}
},
title: {
type: String,
default: ''
},
},
computed: {
...mapGetters(['merchantClassify', 'merchantType']),
},
data() {
return {
dialogVisible: false,
formValidate: Object.assign({}, {}),
selectedOptions: [],
loadingBtn: false,
loading: false,
loadingFrom: false,
keyUrl: '',
ruleForm: {
marginMark: '',
marginStatus: 2,
id: '',
},
rules: {
},
marginRules: {
marginMark: [{ required: true, message: '备注不能为空', trigger: 'blur' }],
marginStatus: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
},
//阶梯列表
gearList: [{
minStandard: '',
maxStandard: '',
rebate: ''
}],
dataForm: {
name: '',
image: '',
contract: '',
addressDetail: '',
latitude: '',
longitude: '',
},
isCn: true,
labelarr: [],
brandCategoryList: [],
tableFrom: {
page: 1,
limit: 1000,
},
};
},
watch: {
'dataForm.name': function (val) {
let pattern = new RegExp('[\u4E00-\u9FA5]+');
let pattern2 = new RegExp('[A-Za-z]+');
if (pattern.test(val)) {
this.isCn = true;
} else if (pattern2.test(val)) {
this.isCn = false;
}
},
formData: function (val) {
console.log(8888888, val);
if (val.id) {
console.log(val.selectedOptions);
this.dataForm = val
if(val.gearList){
this.gearList=val.gearList
}
} else {
this.dataForm = {
name: '',
image: '',
contract: '',
addressDetail: '',
latitude: '',
longitude: '',
time1: [],
selectedOptions: []
}
}
}
},
mounted() {
},
methods: {
// 点击 注图
modalPicTapOnly(tit, num) {
const _this = this;
this.$modalUpload(
function (img) {
if (tit === '1' && num === 'image') {
_this.dataForm.image = img[0].sattDir;
// this.$set(_this.dataForm, 'image', _this.formValidate.mainImage);
} else {
_this.dataForm.contract = img[0].sattDir;
}
},
tit,
'user',
);
},
closeModel() {
this.$parent.formData = {}
this.dialogVisible = false;
},
onClose() {
this.dialogVisible = false;
this.loading = false;
this.gearList=[]
this.$parent.carListFn()
},
onsubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading = true;
console.log(this.dataForm);
if (this.dataForm.id) {
getDivideUpdate(this.dataForm).then((res) => {
this.$message.success('操作成功');
this.onClose();
})
.catch(() => {
this.loading = false;
});
} else {
getDivideAdd(this.dataForm).then((res) => {
this.$message.success(`添加成功`);
this.onClose();
})
.catch(() => {
this.loading = false;
})
}
} else {
return false;
}
});
},
},
};
</script>
<style scoped lang="scss">
.el-alert {
line-height: 20px;
margin-left: 41px;
margin-bottom: 9px;
width: 90%;
::v-deep.el-form-item__content {
width: 94%;
}
}
.lang {
width: 93.5%;
::v-deep.el-form-item__content {
width: 79%;
}
}
.inline {
// width: 228px;
::v-deep.el-form-item__content,
::v-deep.el-input-number {
width: 228px;
}
::v-deep.el-select {
width: 100%;
}
}
</style>

View File

@@ -0,0 +1,169 @@
<template>
<!-- 平台列表 -->
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container" v-hasPermi="['platform:merchant:page:list']">
<el-form size="small" label-width="100px" :inline="true">
<el-form-item label="平台名称:" label-width="100px" style="display: inline-block">
<el-input v-model.trim="tableFrom.name" style="width: 200px;" @keyup.enter.native="carListFn(1)"
placeholder="请输入平台名称:" class="selWidth" clearable>
</el-input>
</el-form-item>
<el-form-item label="平台编码:" label-width="100px" style="display: inline-block">
<el-input v-model.trim="tableFrom.platformSn" style="width: 200px;" @keyup.enter.native="carListFn(1)"
placeholder="请输入平台编码:" class="selWidth" clearable>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="el-icon-search" size="mini" @click="queryListFn">搜索
</el-button>
</el-form-item>
</el-form>
</div>
<el-button type="primary" @click="onAdd">添加合作平台</el-button>
</div>
<el-table v-loading="listLoading" :data="tableData" style="width: 100%" size="small" highlight-current-row
class="switchTable">
<el-table-column prop="id" label="ID" />
<el-table-column prop="name" label="平台简称" show-overflow-tooltip></el-table-column>
<el-table-column prop="platformSn" label="平台编码"></el-table-column>
<el-table-column prop="image" label="logo" show-overflow-tooltip>
<template slot-scope="scope">
<imagePreview :src="scope.row.image" style="width: 40px; height: 40px" />
</template>
</el-table-column>
<el-table-column label="操作" min-width="110" fixed="right" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="onEdit(scope.row)" class="mr10">修改</el-button>
<el-button type="text" size="small" @click="onDel(scope.row)" class="mr10">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination ref="pagination" :page-sizes="[10, 20, 40, 60, 80]" :page-size="tableFrom.limit"
:current-page="tableFrom.page" layout="total, sizes, prev, pager, next, jumper" :total="total"
@size-change="handleSizeChange" @current-change="pageChange" />
</div>
</el-card>
<CreatMerchant ref="creatMerchants" :formData="formData" :title="title"></CreatMerchant>
</div>
</template>
<script>
import { getDivideList, getDivideDel, getDivideDetail, } from "@/api/divide.js"
import CreatMerchant from './creatMerchant';
export default {
name: 'carBrand',
components: { CreatMerchant },
data() {
return {
selectedOptions: [],
title: '添加',
listLoading: false,
tableFrom: {
page: 1,
limit: 10,
},
tableData: [],
formData: {},
total: 0,
};
},
computed: {},
mounted() { },
created() {
this.carListFn();
},
methods: {
//搜索
queryListFn() {
this.tableFrom.page = 1;
this.carListFn();
},
//重置表单
resettingFn() {
this.formData = {};
},
//分页
pageChange(page) {
this.tableFrom.page = page;
this.carListFn();
},
handleSizeChange(val) {
this.tableFrom.limit = val;
this.carListFn();
},
/**列表 */
carListFn() {
getDivideList(this.tableFrom).then((res) => {
// console.log(res, '321');
this.tableData = res.list;
this.total = res.total;
});
},
// 删除
onDel(row) {
this.$modalSure('是否删除当前数据?').then(() => {
getDivideDel(row.id).then(() => {
this.$message.success('删除成功');
this.carListFn(1);
});
});
},
/* 编辑 */
onEdit(row) {
this.title = '修改分佣平台';
// this.formData = row;
this.$refs.creatMerchants.dialogVisible = true
this.onInfo(row.id)
},
// 详情
onInfo(id) {
this.loadingFrom = true;
getDivideDetail(id).then((res) => {
console.log(res);
res.way = String(res.way)
res.time1 = [res.startTime, res.settlementTime]
res.selectedOptions = [res.province, res.city]
this.formData = res;
});
},
// 添加
onAdd() {
this.$refs.creatMerchants.dialogVisible = true
this.title = '添加分佣平台';
this.resettingFn();
},
},
};
</script>
<style scoped lang="scss">
.demo-table-expand label {
width: 90px;
}
.el-dropdown-link {
cursor: pointer;
color: #1890ff;
font-size: 12px;
}
.el-icon-arrow-down {
font-size: 12px;
}
.icon-arrow-down {
::v-deep .el-dropdown-menu__item {
font-size: 12px;
}
}
.exp-err {
text-align: end;
margin-top: 15px;
color: #1890ff;
}
</style>