6.24(导入

This commit is contained in:
Hong
2024-06-24 10:35:52 +08:00
parent f54555f207
commit 19ab5533f3
5 changed files with 441 additions and 1 deletions

View File

@@ -131,4 +131,44 @@ export function conditionRate(data) {
method: 'post',
data: data,
});
}
//流水明细 分佣 /api/admin/platform/comm/plat/order/return/revenue/list
export function revenueListApi(params) {
return request({
url: '/admin/platform/comm/plat/order/return/revenue/list',
method: 'get',
params
});
}
/**导入订单流水*/
export function excelImportOrder(data) {
return request({
baseURL: process.env.VUE_APP_BASE_API,
url: '/excel/admin/comm/plat/order/import/order',
method: 'post',
data: data,
});
}
/**获取导入订单流水进度 /excel/admin/comm/plat/order/getImportRate */
export function getImportOrderRate(data) {
return request({
baseURL: process.env.VUE_APP_BASE_API,
url: '/excel/admin/comm/plat/order/getImportRate',
method: 'post',
data: data,
});
}
//导出司机失败文件
export function orderExportError(params) {
return request({
baseURL: process.env.VUE_APP_BASE_API,
url: `/excel/admin/comm/plat/order/export/error`,
method: 'get',
responseType: 'blob',
params,
});
}

View File

@@ -22,6 +22,12 @@ const divideRouter = {
name: 'divideUserList',
meta: { title: '分佣用户列表', icon: '' },
},
{
path: 'commission_order',
component: () => import('@/views/divide/commission_order'),
name: 'commission_order',
meta: { title: '分佣订单', icon: '' },
},
],
};
export default divideRouter;

View File

@@ -96,7 +96,7 @@ const financeRouter = {
component: () => import('@/views/finance/verification'),
name: 'verification',
meta: { title: '对账核对', icon: '' },
},
}
],
};

View File

@@ -0,0 +1,389 @@
<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" @keyup.enter.native="carListFn(1)" placeholder="请输入平台名称:"
class="selWidth" clearable>
<el-button slot="append" icon="el-icon-search" class="el-button-solt" @click="carListFn(1)" />
</el-input>
</el-form-item>
<el-form-item label="分佣平台" prop="status">
<el-select v-model="tableFrom.platformId" filterable remote reserve-keyword placeholder="请输入关键词"
:remote-method="remoteMethod" :loading="loading">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" plain icon="el-icon-plus" size="mini"
@click="carExpListOpen = true">导入</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="编号" />
<el-table-column prop="userSn" label="用户id" />
<el-table-column prop="platformId" label="返佣平台id" />
<el-table-column prop="platformSn" label="返佣平台编号" />
<el-table-column prop="realName" label="用户名" show-overflow-tooltip></el-table-column>
<el-table-column prop="phone" label="手机号" show-overflow-tooltip></el-table-column>
<el-table-column prop="way" label="分佣方案" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.way==0?'按比例':'按单量' }}
</template>
</el-table-column>
<el-table-column prop="ratio" label="分佣金额" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.way==0?scope.row.ratio:scope.row.each }}
</template>
</el-table-column>
<!-- <el-table-column prop="each" label="每笔分佣金额" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="platformName" label="平台名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="driverSn" label="司机编码" show-overflow-tooltip></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 prop="participationTime" label="参与时间" show-overflow-tooltip></el-table-column>
<el-table-column prop="status" label="状态" show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="scope.row.status == 0"> 未参与</span>
<span v-if="scope.row.status == 1"> 待审核</span>
<span v-if="scope.row.status == 2"> 审核失败</span>
<span v-if="scope.row.status == 3"> 审核成功</span>
</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>
<!-- 导入汽车列表 -->
<el-dialog title="导入" :visible.sync="carExpListOpen" width="25%" :before-close="handleClose">
<div>
<div v-if="!impDataFlag">
<el-upload width="100%" class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
:http-request="handleUploadForm" multiple :limit="1" :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传xlsx文件且不超过500kb</div>
</el-upload>
<el-progress :percentage="percentage" color="#409eff"></el-progress>
</div>
<div>
<div v-if="impDataFlag">
<span>共处理{{ importData.total }}条数据,</span>
<span style="color: green">{{ importData.successNum }}条数据导入成功,</span>
<span style="color: red">{{ importData.importErrorNum }}条数据导入失败,</span>
<div class="exp-err" @click="carExportErrorFn">导出失败原因</div>
</div>
</div>
</div>
<span v-if="!impDataFlag" slot="footer" class="dialog-footer">
<el-button @click="closeCarExp"> </el-button>
<el-button type="primary" :disabled="buttFlag" @click="toChannelShop()"> </el-button>
</span>
<span v-else slot="footer" class="dialog-footer">
<el-button type="primary" @click="closeCarExp"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { platformPageListApi, revenueListApi,excelImportOrder,getImportOrderRate,orderExportError} from "@/api/divide.js"
export default {
name: 'carBrand',
components: { },
data() {
return {
//导入类型
expType:1,
//导入弹出层
carExpListOpen: false,
//导入开关
buttFlag: false,
//导入结果开关
impDataFlag: false,
//导入数据返回
importData: {},
//进度条
percentage: 0,
fileList: [],
total: 0,
listLoading: false,
loading: false,
tableFrom: {
page: 1,
limit: 10,
name: '',
},
tableData: [],
options: []
};
},
computed: {},
mounted() {
},
created() {
// console.log('created');
this.carListFn();
this.remoteMethod()
},
methods: {
remoteMethod(query) {
if (query !== '') {
platformPageListApi({
name: query,
page: 1,
limit: 20
}).then(res => {
console.log(res);
this.options = res.list
})
}
},
//重置表单
resettingFn() {
this.formData = {};
},
//分页
pageChange(page) {
this.tableFrom.page = page;
this.carListFn();
},
handleSizeChange(val) {
this.tableFrom.limit = val;
this.carListFn();
},
/**列表 */
carListFn() {
revenueListApi(this.tableFrom).then((res) => {
// console.log(res, '321');
this.tableData = res.list;
this.total = res.total;
});
},
// 删除
onDel(row) {
this.$modalSure('是否删除当前数据?').then(() => {
platformDelete(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;
platformDetail(id).then((res) => {
console.log(res);
res.way = String(res.way)
res.time1 = [res.startTime, res.settlementTime]
res.selectedOptions = [res.province, res.city, res.district]
this.formData = res;
});
},
// 添加
onAdd() {
this.$refs.creatMerchants.dialogVisible = true
this.title = '添加分佣平台';
this.resettingFn();
},
// 上传
handleUploadForm(param) {
const formData = new FormData();
formData.append('file', param.file);
this.file = formData;
},
// 导入车辆表
toChannelShop() {
if (this.file) {
this.buttFlag = true;
excelImportOrder(this.file)
.then((res) => {
// console.log(res);
this.importData = res;
this.fileList = [];
this.impDataFlag = true;
this.buttFlag = false;
})
.catch((res) => {
this.buttFlag = false;
// console.log(res);
});
this.timer = setInterval(() => {
// 车辆导入进度
getImportOrderRate().then((res) => {
this.percentage = this.getPercent(res.data.already_install, res.data.total_install);
if (res.data.already_install == null) {
clearInterval(this.timer);
}
});
}, 2000);
} else {
this.$message.success('请选择文件');
}
},
//格式化百分百
getPercent(num, total) {
num = Number(num);
total = Number(total);
if (isNaN(num) || isNaN(total)) {
return 0;
}
return total <= 0 ? 0 : Math.floor(Math.round((num / total) * 10000) / 100.0);
},
//导出失败文件
carExportErrorFn() {
orderExportError({
attach: this.importData.attach,
}).then((res) => {
let URL = window.URL || window.webkitURL;
let blob = res.data;
let objectUrl = URL.createObjectURL(blob);
if (res.fileName) {
let a = document.createElement('a');
if (typeof a.download === 'undefined') {
window.location = objectUrl;
} else {
a.href = objectUrl;
const time = new Date();
const year = time.getFullYear(); // 获取年份
const month = time.getMonth() + 1; // 获取月份
const day = time.getDate(); // 获取日期
// 将时间转换为特定格式的字符串
const formattedDate = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
a.download = `${formattedDate}expError.xlsx`;
document.body.appendChild(a);
a.click();
a.remove();
}
}
});
},
//导出第三方注册信息
carExportUnregisteredFn() {
carExportUnregistered({
platformId: this.tableFrom.platformId
}).then((res) => {
// console.log(res);
let URL = window.URL || window.webkitURL;
let blob = res.data;
let objectUrl = URL.createObjectURL(blob);
if (res.fileName) {
let a = document.createElement('a');
if (typeof a.download === 'undefined') {
window.location = objectUrl;
} else {
a.href = objectUrl;
const time = new Date();
const year = time.getFullYear(); // 获取年份
const month = time.getMonth() + 1; // 获取月份
const day = time.getDate(); // 获取日期
// 将时间转换为特定格式的字符串
const formattedDate = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
a.download = `${formattedDate}carList.xlsx`;
document.body.appendChild(a);
a.click();
a.remove();
}
}
});
},
//导出模版
carExportFn() {
carExport({
platformId: this.tableFrom.platformId
}).then((res) => {
// console.log(res);
let URL = window.URL || window.webkitURL;
let blob = res.data;
let objectUrl = URL.createObjectURL(blob);
if (res.fileName) {
let a = document.createElement('a');
if (typeof a.download === 'undefined') {
window.location = objectUrl;
} else {
a.href = objectUrl;
const time = new Date();
const year = time.getFullYear(); // 获取年份
const month = time.getMonth() + 1; // 获取月份
const day = time.getDate(); // 获取日期
// 将时间转换为特定格式的字符串
const formattedDate = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
a.download = `${formattedDate}carList.xlsx`;
document.body.appendChild(a);
a.click();
a.remove();
}
}
});
},
/** 导入房间号对话框方法 */
handleClose(done) {
this.$confirm('确认关闭?')
.then((_) => {
this.closeCarExp();
})
.catch((_) => { });
},
//关闭弹出层初始化数据
closeCarExp() {
this.buttFlag = false;
this.impDataFlag = false;
this.carExpListOpen = false;
this.fileList=[]
//导入数据返回
this.importData = {};
},
},
};
</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>

View File

@@ -75,6 +75,11 @@
<!-- 导入汽车列表 -->
<el-dialog title="导入" :visible.sync="carExpListOpen" width="25%" :before-close="handleClose">
<div>
<el-select v-if="expType==2" v-model="tableFrom.platformId" filterable remote reserve-keyword placeholder="请输入关键词"
:remote-method="remoteMethod" :loading="loading">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<div v-if="!impDataFlag">
<el-upload width="100%" class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
:http-request="handleUploadForm" multiple :limit="1" :file-list="fileList">