Authored by 刘志远

Merge branch 'feature/shop-order-v2' into 'master'

一件代发二期

一件代发二期

See merge request !112
... ... @@ -6,6 +6,7 @@ import print from './print';
import stock from './stock';
import invoice from './invoice';
import withdraw from './withdraw';
import transaction from './transaction';
export default {
clearing,
payment,
... ... @@ -15,4 +16,5 @@ export default {
stock,
invoice,
withdraw,
transaction,
};
... ...
export default {
path: '/list.html',
name: 'list',
component: () => import(/* webpackChunkName: "transaction.list" */ './views/list'),
meta: {
pageName: '交易账务明细',
},
};
... ...
<template>
<div>
<layout-body>
<p slot="title">交易服务明细</p>
<layout-filter ref="filter" :model="filters" class="box-filter" :inline="true" :col="1">
<filter-item label="起止时间">
<Date-picker
v-model="filters.createTime.model"
type="datetimerange"
format="yyyy-MM-dd"
placeholder="选择日期和时间"
@on-change="createTimeChange"
></Date-picker>
<div class="quick">
<template v-for="(option, key) in quickOptions">
<a :key="key" href="javascript:;" @click="timeFlag(key)">{{ option }}</a>
</template>
</div>
<div class="select-container">
<Select v-model.trim="filters.status.model" :placeholder="filters.status.label" clearable>
<Option v-for="(option, key) in filters.status.options" :key="key" :value="+key">
{{ option }}
</Option>
</Select>
</div>
</filter-item>
<filter-item>
<div class="select-container">
<Input v-model.trim="filters.orderCode.model" :placeholder="filters.orderCode.label" />
</div>
<div class="select-container">
<Input v-model.trim="filters.productSku.model" :placeholder="filters.productSku.label" />
</div>
<div class="select-container">
<Input v-model.trim="filters.productName.model" :placeholder="filters.productName.label" />
</div>
<div class="select-container">
<Button type="primary" @click="search">查询</Button>
<Button type="primary" @click="reset">全部</Button>
<Button type="warning" @click="exportList">导出</Button>
</div>
</filter-item>
</layout-filter>
<layout-list>
<Table border :columns="tableCols" :data="tableData" show-summary></Table>
<Table border :columns="summaryColumn" :data="summaryInfo" :show-header="false"></Table>
<Page
:total="pageData.total"
:current="pageData.current"
:page-size="pageData.pageSize"
show-total
@on-change="pageChange"
></Page>
</layout-list>
</layout-body>
</div>
</template>
<script>
import _ from 'lodash';
import moment from 'moment';
import qs from 'querystringify';
import FinanceService from 'services/finance/finance-service';
import baseExportApi from 'util/excel';
export default {
data() {
return {
//当前的搜索条件
currentSearchParams: {},
filters: {
createTime: {
label: '创建时间',
model: '',
},
beginTime: {
model: '',
},
endTime: {
model: '',
},
timeFlag: {
label: '时间标志',
model: '',
},
status: {
label: '提现状态',
model: '',
options: {
'0': '冻结中',
'1': '可提现',
'2': '提现中',
'3': '提现成功',
'-1': '提现失败',
},
},
orderCode: {
label: '订单号',
model: '',
},
productSku: {
label: 'SKU',
model: '',
},
productName: {
label: '商品名称',
model: '',
},
pageNo: 1,
pageSize: 10,
},
tableCols: [
{
title: '账务ID',
key: 'id',
width: 60,
align: 'center',
},
{
title: '结算时间',
key: 'businessTime',
align: 'center',
render(h, params) {
const time = moment.unix(params.row.businessTime);
return (
<div>
<div>{time.format('YYYY/MM/DD')}</div>
<div>{time.format('HH:mm:ss')}</div>
</div>
);
},
},
{
title: '订单号',
key: 'orderCode',
align: 'center',
},
{
title: 'SKU',
key: 'productSku',
align: 'center',
},
{
title: '数量',
key: 'quantity',
align: 'center',
},
{
title: '商品名称',
key: 'productName',
align: 'center',
},
{
title: '账务类型',
key: 'billTypeDesc',
align: 'center',
},
{
title: '业务描述',
key: 'clearingTypeName',
align: 'center',
},
{
title: '成交价/优惠价',
key: 'lastPrice',
align: 'center',
},
{
title: '商家应收/分摊比例',
key: 'clearingDiscount',
align: 'center',
},
{
title: '商家应收',
key: 'shopDeserveAmount',
align: 'center',
},
{
title: '提现服务费',
key: 'withdrawServiceAmount',
align: 'center',
},
{
title: '交易服务费',
key: 'serviceAmount',
align: 'center',
},
{
title: '商家实收',
key: 'shopNetAmount',
align: 'center',
},
{
title: '提现状态',
key: 'statusName',
align: 'center',
},
{
title: '可提现日期',
key: 'withdrawalTime',
align: 'center',
render(h, params) {
if (!params.row.withdrawalTime) {
return '';
}
const appSuTime = moment.unix(params.row.withdrawalTime);
return (
<div>
<div>{appSuTime.format('YYYY/MM/DD')}</div>
<div>{appSuTime.format('HH:mm:ss')}</div>
</div>
);
},
},
{
title: '提现申请日期',
key: 'withdrawApplyTime',
align: 'center',
render(h, params) {
if (!params.row.withdrawApplyTime) {
return '';
}
const applyTime = moment.unix(params.row.withdrawApplyTime);
return (
<div>
<div>{applyTime.format('YYYY/MM/DD')}</div>
<div>{applyTime.format('HH:mm:ss')}</div>
</div>
);
},
},
],
tableData: [],
summaryColumn: [
{
title: '账务ID',
key: 'summaryName',
width: 60,
align: 'center',
},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{
title: '商家应收汇总',
key: 'shopDeserveAmount',
align: 'center',
},
{
title: '提现服务费汇总',
key: 'withdrawServiceAmount',
align: 'center',
},
{
title: '交易服务费汇总',
key: 'serviceAmount',
align: 'center',
},
{
title: '商家实收汇总',
key: 'shopNetAmount',
align: 'center',
},
{},
{},
{},
],
summaryInfo: [],
pageData: {
total: 0,
current: 1,
pageSize: 10,
},
quickOptions: {
1: '今天',
2: '昨天',
3: '最近7天',
4: '最近30天',
},
};
},
created() {
this.financeService = new FinanceService();
this.search();
},
methods: {
//组织当前的搜索条件
filterValues() {
const _this = this;
_.each(this.filters, (value, key) => {
_this.currentSearchParams[key] = value.model;
});
const { current, pageSize } = this.pageData;
this.currentSearchParams.pageNo = current;
this.currentSearchParams.pageSize = pageSize;
},
//点击搜索动作
search() {
this.filters.timeFlag.model = '';
this.pageData.current = 1;
this.filterValues();
this.list();
},
//点击全部操作
reset() {
this.pageData.current = 1;
this.resetFilter();
this.filterValues();
this.list();
},
//点击快速查询操作
timeFlag(flag) {
this.resetFilter();
this.filters.timeFlag.model = flag;
this.pageData.current = 1;
this.filterValues();
this.list();
},
//格式化时间
createTimeChange(time) {
if (!_.isArray(time)) {
time = time.split(' - ');
}
if ((time[0] + '').length) {
this.filters.beginTime.model = moment(time[0]).format('YYYY-MM-DD');
this.filters.endTime.model = moment(time[1]).format('YYYY-MM-DD');
} else {
this.filters.beginTime.model = '';
this.filters.endTime.model = '';
}
},
//点击分页
pageChange(page) {
this.pageData.current = page;
this.currentSearchParams.pageNo = page;
this.list();
},
//获取列表数据
list() {
Promise.all([
this.financeService.shopBillList(this.currentSearchParams),
this.financeService.querySummaryInfo(this.currentSearchParams),
]).then(result => {
this.tableData = _.get(result[0], 'data.records', []);
this.pageData.total = _.get(result[0], 'data.totalCount', 0);
this.pageData.current = _.get(result[0], 'data.pageNo', 1);
const summaryInfo = _.get(result[1], 'data', {});
this.summaryInfo = [];
this.summaryInfo.push({ ...summaryInfo, summaryName: '汇总' });
});
},
//导出列表
exportList() {
const queryString = { ...this.currentSearchParams, excelConf: 'shopBill' };
const params = qs.stringify(queryString, true);
const href = `${baseExportApi}${params}`;
window.open(href, '_blank');
},
//重置筛选条件
resetFilter() {
//重置筛选框中的数据
_.each(this.filters, value => {
if (value.hasOwnProperty('model')) {
value.model = '';
}
});
},
},
};
</script>
<style lang="scss">
.layout-container {
min-height: 200px;
margin: 15px;
overflow: hidden;
background: #fff;
border-radius: 4px;
.layout-filter .line {
border-top: none;
margin-bottom: 0;
}
}
.shop-card {
margin-top: 10px;
margin-bottom: 10px;
}
.box-title {
font-weight: 700;
color: #495060;
font-size: 16px;
line-height: 22px;
margin: 5px;
&:before {
content: ' ';
display: inline-block;
width: 5px;
margin-right: 2px;
height: 22px;
vertical-align: top;
background-color: #999;
}
}
.box-item {
width: 90%;
height: 50px;
padding: 0 0 0 15px;
line-height: 50px;
font-size: 14px;
overflow: hidden;
border-radius: 5px;
color: #fff;
margin-bottom: 10px;
.box-item-label {
display: inline-block;
min-width: 75px;
vertical-align: top;
font-weight: normal;
}
.box-item-value {
font-size: 20px;
font-weight: 600;
}
i {
display: inline-block;
width: 20px;
height: 20px;
font-size: 22px;
text-align: center;
margin-top: -7px;
vertical-align: middle;
margin-right: 3px;
}
}
.box-filter {
.ivu-date-picker {
margin-left: 0;
width: 220px !important;
}
.quick {
display: inline-block;
margin-left: 20px;
margin-right: 50px;
a {
margin-right: 5px;
}
}
.select-container {
display: inline-block;
width: 200px;
margin-right: 15px;
margin-top: 5px;
}
}
.ivu-table-cell {
padding-left: 6px;
padding-right: 6px;
}
.action-column {
.cell-action-row {
margin-top: 10px;
&:last-child {
margin-bottom: 10px;
}
}
}
</style>
... ...
... ... @@ -81,11 +81,13 @@
<div class="select-container">
<Button type="primary" @click="search">查询</Button>
<Button type="primary" @click="reset">全部</Button>
<Button type="warning" @click="exportList">导出</Button>
</div>
</filter-item>
</layout-filter>
<layout-list>
<Table border :columns="tableCols" :data="tableData"></Table>
<Table border :columns="summaryColumn" :data="summaryInfo" :show-header="false"></Table>
<Page
:total="pageData.total"
:current="pageData.current"
... ... @@ -103,6 +105,8 @@ import _ from 'lodash';
import moment from 'moment';
import { FreightApply } from './store';
import FinanceService from 'services/finance/finance-service';
import baseExportApi from 'util/excel';
import qs from 'querystringify';
export default {
data() {
... ... @@ -113,52 +117,48 @@ export default {
this.search();
},
methods: {
//组织当前的搜索条件
filterValues() {
const values = {
pageNo: 1,
pageSize: 10,
};
const fields = this.filters;
const keysMap = {
beginTime: 'beginTime',
endTime: 'endTime',
timeFlag: 'timeFlag',
targetAccount: 'targetAccount',
orderCode: 'orderCode',
clearingType: 'clearingType',
subClearingType: 'subClearingType',
status: 'status',
};
if (this.enableFilter) {
_.each(keysMap, (val, key) => {
values[key] = fields[val].model;
});
}
return values;
const _this = this;
_.each(this.filters, (value, key) => {
_this.currentSearchParams[key] = value.model;
});
const { current, pageSize } = this.pageData;
this.currentSearchParams.pageNo = current;
this.currentSearchParams.pageSize = pageSize;
},
//重置筛选条件
resetFilter() {
//重置筛选框中的数据
_.each(this.filters, value => {
if (value.hasOwnProperty('model')) {
value.model = '';
}
});
},
//点击搜索按钮动作
search() {
let params = {};
this.enableFilter = true;
params = this.filterValues();
this.list(params);
this.filters.timeFlag.model = '';
this.pageData.current = 1;
this.filterValues();
this.list();
},
//点击全部操作
reset() {
let params = {};
this.enableFilter = false;
params = this.filterValues();
this.list(params);
this.pageData.current = 1;
this.resetFilter();
this.filterValues();
this.list();
},
//点击快速查询操作
timeFlag(flag) {
let params = {};
this.enableFilter = false;
params = this.filterValues();
params.timeFlag = flag;
this.list(params);
this.resetFilter();
this.filters.timeFlag.model = flag;
this.pageData.current = 1;
this.filterValues();
this.list();
},
//格式化时间
createTimeChange(time) {
if (!_.isArray(time)) {
time = time.split(' - ');
... ... @@ -171,17 +171,24 @@ export default {
this.filters.endTime.model = '';
}
},
//点击分页
pageChange(page) {
const params = this.filterValues();
params.pageNo = page;
this.pageData.current = page;
this.list(params);
this.currentSearchParams.pageNo = page;
this.list();
},
list(params) {
this.financeService.shopWithdrawFreightList(params).then(ret => {
this.tableData = _.get(ret, 'data.records', []);
this.pageData.total = _.get(ret, 'data.totalCount', 0);
this.pageData.current = _.get(ret, 'data.pageNo', 1);
//获取列表数据
list() {
Promise.all([
this.financeService.shopWithdrawFreightList(this.currentSearchParams),
this.financeService.queryFreightBillSummary(this.currentSearchParams),
]).then(result => {
this.tableData = _.get(result[0], 'data.records', []);
this.pageData.total = _.get(result[0], 'data.totalCount', 0);
this.pageData.current = _.get(result[0], 'data.pageNo', 1);
const summaryInfo = _.get(result[1], 'data', {});
this.summaryInfo = [];
this.summaryInfo.push({ ...summaryInfo, summaryName: '汇总' });
});
},
getDetailById(id) {
... ... @@ -192,6 +199,13 @@ export default {
},
});
},
//导出列表
exportList() {
const queryString = { ...this.currentSearchParams, excelConf: 'shopFreightList' };
const params = qs.stringify(queryString, true);
const href = `${baseExportApi}${params}`;
window.open(href, '_blank');
},
},
};
</script>
... ...
... ... @@ -52,6 +52,9 @@
</filter-item>
<filter-item>
<div class="select-container">
<Input v-model.trim="filters.orderCode.model" :placeholder="filters.orderCode.label" />
</div>
<div class="select-container">
<Input v-model.trim="filters.productSku.model" :placeholder="filters.productSku.label" />
</div>
<div class="select-container">
... ... @@ -61,35 +64,16 @@
}}</Option>
</Select>
</div>
<!-- <div class="select-container">-->
<!-- <Input v-model.trim="filters.targetAccount.model" :placeholder="filters.targetAccount.label" />-->
<!-- </div>-->
<!-- <div class="select-container">-->
<!-- <Select v-model.trim="filters.clearingType.model" :placeholder="filters.clearingType.label">-->
<!-- <Option v-for="option in filters.clearingType.options" :key="option.value" :value="option.value">{{-->
<!-- option.label-->
<!-- }}</Option>-->
<!-- </Select>-->
<!-- </div>-->
<!-- <div class="select-container">-->
<!-- <Select v-model.trim="filters.subClearingType.model" :placeholder="filters.subClearingType.label">-->
<!-- <Option v-for="option in filters.subClearingType.options" :key="option.value" :value="option.value">{{-->
<!-- option.label-->
<!-- }}</Option>-->
<!-- </Select>-->
<!-- </div>-->
<div class="select-container">
<Input v-model.trim="filters.orderCode.model" :placeholder="filters.orderCode.label" />
</div>
<div class="select-container">
<Button type="primary" @click="search">查询</Button>
<Button type="primary" @click="reset">全部</Button>
<!-- <Button>导出</Button>-->
<Button type="warning" @click="exportList">导出</Button>
</div>
</filter-item>
</layout-filter>
<layout-list>
<Table border :columns="tableCols" :data="tableData"></Table>
<Table border :columns="summaryColumn" :data="summaryInfo" :show-header="false"></Table>
<Page
:total="pageData.total"
:current="pageData.current"
... ... @@ -107,7 +91,8 @@ import _ from 'lodash';
import moment from 'moment';
import { ServiceList } from './store';
import FinanceService from 'services/finance/finance-service';
import baseExportApi from 'util/excel';
import qs from 'querystringify';
export default {
data() {
return ServiceList.call(this);
... ... @@ -117,54 +102,48 @@ export default {
this.search();
},
methods: {
//组织当前的搜索条件
filterValues() {
const values = {
pageNo: 1,
pageSize: 10,
};
const fields = this.filters;
const keysMap = {
beginTime: 'beginTime',
endTime: 'endTime',
timeFlag: 'timeFlag',
status: 'status',
orderCode: 'orderCode',
productSku: 'productSku',
targetAccount: 'targetAccount',
clearingType: 'clearingType',
subClearingType: 'subClearingType',
// statementSn: 'statementSn',
};
if (this.enableFilter) {
_.each(keysMap, (val, key) => {
values[key] = fields[val].model;
});
}
return values;
const _this = this;
_.each(this.filters, (value, key) => {
_this.currentSearchParams[key] = value.model;
});
const { current, pageSize } = this.pageData;
this.currentSearchParams.pageNo = current;
this.currentSearchParams.pageSize = pageSize;
},
//重置筛选条件
resetFilter() {
//重置筛选框中的数据
_.each(this.filters, value => {
if (value.hasOwnProperty('model')) {
value.model = '';
}
});
},
//点击搜索按钮动作
search() {
let params = {};
this.enableFilter = true;
params = this.filterValues();
this.list(params);
this.filters.timeFlag.model = '';
this.pageData.current = 1;
this.filterValues();
this.list();
},
//点击全部操作
reset() {
let params = {};
this.enableFilter = false;
params = this.filterValues();
this.list(params);
this.pageData.current = 1;
this.resetFilter();
this.filterValues();
this.list();
},
//点击快速查询操作
timeFlag(flag) {
let params = {};
this.enableFilter = false;
params = this.filterValues();
params.timeFlag = flag;
this.list(params);
this.resetFilter();
this.filters.timeFlag.model = flag;
this.pageData.current = 1;
this.filterValues();
this.list();
},
//格式化时间
createTimeChange(time) {
if (!_.isArray(time)) {
time = time.split(' - ');
... ... @@ -177,19 +156,33 @@ export default {
this.filters.endTime.model = '';
}
},
//点击分页
pageChange(page) {
const params = this.filterValues();
params.pageNo = page;
this.pageData.current = page;
this.list(params);
this.currentSearchParams.pageNo = page;
this.list();
},
list(params) {
this.financeService.shopWithdrawServiceList(params).then(ret => {
this.tableData = _.get(ret, 'data.records', []);
this.pageData.total = _.get(ret, 'data.totalCount', 0);
this.pageData.current = _.get(ret, 'data.pageNo', 1);
//获取列表数据
list() {
Promise.all([
this.financeService.shopWithdrawServiceList(this.currentSearchParams),
this.financeService.queryBillSummary(this.currentSearchParams),
]).then(result => {
this.tableData = _.get(result[0], 'data.records', []);
this.pageData.total = _.get(result[0], 'data.totalCount', 0);
this.pageData.current = _.get(result[0], 'data.pageNo', 1);
const summaryInfo = _.get(result[1], 'data', {});
this.summaryInfo = [];
this.summaryInfo.push({ ...summaryInfo, summaryName: '汇总' });
});
},
//导出列表
exportList() {
const queryString = { ...this.currentSearchParams, excelConf: 'shopServiceList' };
const params = qs.stringify(queryString, true);
const href = `${baseExportApi}${params}`;
window.open(href, '_blank');
},
},
};
</script>
... ...
... ... @@ -10,6 +10,8 @@ const withdrawStatus = {
export default function() {
return {
//当前的搜索条件
currentSearchParams: {},
filters: {
createTime: {
label: '创建时间',
... ... @@ -87,8 +89,6 @@ export default function() {
},
],
},
pageNo: 1,
pageSize: 10,
},
tableCols: [
{
... ... @@ -124,6 +124,14 @@ export default function() {
key: 'clearingType',
},
{
title: '运费',
key: 'freightAmount',
},
{
title: '提现服务费',
key: 'withdrawServiceAmount',
},
{
title: '商家实收(元)',
key: 'realIncome',
},
... ... @@ -171,25 +179,6 @@ export default function() {
);
},
},
// {
// title: '操作',
// key: 'action',
// width: 180,
// align: 'center',
// render: (h, params) => {
// const row = params.row;
// return (
// <div>
// <div class="cell-action-row">
// <i-button type="primary" size="small" onClick={() => this.getDetailById(row.id)}>
// 查看明细
// </i-button>
// </div>
// </div>
// );
// },
// className: 'action-column',
// },
],
tableData: [],
pageData: {
... ... @@ -197,5 +186,33 @@ export default function() {
current: 1,
pageSize: 10,
},
summaryColumn: [
{
title: '账务ID',
key: 'summaryName',
align: 'center',
width: 60,
},
{},
{},
{},
{},
{
title: '运费汇总',
key: 'freightAmount',
},
{
title: '提现服务费汇总',
key: 'withdrawServiceAmount',
},
{
title: '商家实收汇总',
key: 'realIncome',
},
{},
{},
{},
],
summaryInfo: [],
};
}
... ...
... ... @@ -10,6 +10,8 @@ const withdrawStatus = {
export default function() {
return {
//当前的搜索条件
currentSearchParams: {},
filters: {
createTime: {
label: '创建时间',
... ... @@ -95,8 +97,6 @@ export default function() {
label: '提现账户',
model: '',
},
pageNo: 1,
pageSize: 10,
},
tableCols: [
{
... ... @@ -108,6 +108,18 @@ export default function() {
title: '提现时间',
key: 'withdrawTime',
align: 'center',
render(h, params) {
if (!params.row.withdrawTime) {
return '';
}
const time = moment.unix(params.row.withdrawTime);
return (
<div>
<div>{time.format('YYYY/MM/DD')}</div>
<div>{time.format('HH:mm:ss')}</div>
</div>
);
},
},
{
title: '商家收款账户',
... ... @@ -129,11 +141,6 @@ export default function() {
key: 'productName',
align: 'center',
},
// {
// title: '业务单据号',
// key: 'statementSn',
// align: 'center',
// },
{
title: '账务类型',
key: 'clearingType',
... ... @@ -141,7 +148,17 @@ export default function() {
},
{
title: '子服务类型',
key: 'subClearingType',
key: 'clearingTypeName',
align: 'center',
},
{
title: '交易服务费',
key: 'tradeServiceAmount',
align: 'center',
},
{
title: '提现服务费',
key: 'withdrawServiceAmount',
align: 'center',
},
{
... ... @@ -161,10 +178,13 @@ export default function() {
},
{
title: '提现成功日期',
key: 'createTime',
key: 'withdrawSuccessTime',
align: 'center',
render(h, params) {
const time = moment.unix(params.row.createTime);
if (!params.row.withdrawSuccessTime) {
return '';
}
const time = moment.unix(params.row.withdrawSuccessTime);
return (
<div>
<div>{time.format('YYYY/MM/DD')}</div>
... ... @@ -180,5 +200,37 @@ export default function() {
current: 1,
pageSize: 10,
},
summaryColumn: [
{
title: '账务ID',
key: 'summaryName',
align: 'center',
},
{},
{},
{},
{},
{},
{},
{},
{
title: '交易服务费汇总',
key: 'tradeServiceAmount',
align: 'center',
},
{
title: '提现服务费汇总',
key: 'withdrawServiceAmount',
align: 'center',
},
{
title: '服务费汇总',
key: 'serviceAmount',
align: 'center',
},
{},
{},
],
summaryInfo: [],
};
}
... ...
export default function() {
return {
showLoading: true,
show: true,
timeCount: '',
timer: null,
isAble: true,
data: {
applyType: 0,
... ... @@ -28,6 +31,8 @@ export default function() {
token: '',
timestamp: '',
salt: 'fd4ad5fcsa0de589af23234ks1923ks',
verifyCode: '',
},
shopPhone: '',
};
}
... ...
... ... @@ -34,6 +34,11 @@
<Form-item label="提现金额" prop="withdrawAmount">
<input v-model="data.withdrawAmount" :disabled="isAble" placeholder="请选择日期获取提现金额" />
</Form-item>
<Form-item label="短信验证码">
<input v-model="data.verifyCode" placeholder="短信验证码" />
<Button v-show="show" type="primary" size="large" @click="getVerifyCode">获取验证码</Button>
<Button v-show="!show" type="default" size="large" disabled> {{ timeCount }}s 后重新发送</Button>
</Form-item>
<Form-item label="提现到帐号">
<span>{{ data.withdrawAccount }}</span>
</Form-item>
... ... @@ -56,6 +61,7 @@
import moment from 'moment';
import crypto from 'util/crypto';
import FinanceService from 'services/finance/finance-service';
import ShopService from 'services/shop/shop-service';
import { WithdrawApply } from './store';
export default {
... ... @@ -67,6 +73,7 @@ export default {
token: this.$user.token,
timestamps: Math.round(new Date().getTime() / 1000),
};
this.shopService = new ShopService();
this.financeService = new FinanceService();
this.financeService
.shopWithdrawApplyInit(params)
... ... @@ -97,9 +104,66 @@ export default {
this.$Message.error('请求出错');
this.showLoading = false;
});
this.getShopInfo();
},
mounted() {},
methods: {
//获取店铺信息
getShopInfo() {
this.shopService.getShop().then(res => {
const { checkTel } = res.data;
this.shopPhone = checkTel;
});
},
//获取短信验证码
getVerifyCode() {
if (this.shopPhone === '') {
this.$Notice.error({
title: '发送失败',
desc: '店铺绑定手机为空,请先绑定手机',
});
return false;
}
this.validateBtn();
const smsParams = {
phones: this.shopPhone,
project: 'shop',
className: 'withdraw',
methodName: 'getVerifyCode',
};
return this.financeService.sendShopVerifyCode(smsParams).then(result => {
if (result.code === 200) {
this.$Notice.success({
title: '发送成功',
desc: '验证码已发送到您手机!',
});
} else {
this.$Notice.error({
title: '发送失败',
desc: result.message,
});
}
});
},
// 点击验证码后倒计时
validateBtn() {
const timeCount = 60;
if (!this.timer) {
this.timeCount = timeCount;
this.show = false;
this.timer = setInterval(() => {
if (this.timeCount > 0 && this.timeCount <= timeCount) {
this.timeCount--;
} else {
this.show = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
},
backList() {
this.$router.push({ name: 'finance.withdraw.withdrawlist' });
},
... ... @@ -130,28 +194,50 @@ export default {
params.sign = crypto.md5(arrParams.join('|'));
params.account = this.$user.name;
params.timeout = 60000; // 提现超时时间60秒
// 短信验证码
params.verifyCode = this.data.verifyCode;
return params;
},
save() {
if (!this.beforeSave()) {
return false;
}
const applyParams = this.beforeSave();
this.$Loading.start();
this.submitDisabled = true;
return this.financeService.shopWithdrawApply(applyParams).then(result => {
if (result.code === 200) {
this.$Loading.finish();
this.$Notice.success({
title: '提交成功',
desc: '确认提现成功!',
});
this.backList();
} else {
this.$Loading.error();
this.submitDisabled = false;
this.$Notice.error({
if (!applyParams.verifyCode || applyParams.verifyCode === '') {
this.$Notice.error({
title: '提交错误',
desc: '验证码不能为空',
});
return false;
}
const _this = this;
this.financeService.verifySmsCode({ phone: this.shopPhone, verifyCode: applyParams.verifyCode }).then(res => {
if (res.code !== 200) {
_this.$Notice.error({
title: '提交错误',
desc: result.message,
desc: res.message,
});
return false;
}
_this.$Loading.start();
_this.submitDisabled = true;
_this.financeService.shopWithdrawApply(applyParams).then(result => {
if (result.code === 200) {
_this.$Loading.finish();
_this.$Notice.success({
title: '提交成功',
desc: '确认提现成功!',
});
_this.backList();
} else {
_this.$Loading.error();
_this.submitDisabled = false;
_this.$Notice.error({
title: '提交错误',
desc: result.message,
});
}
});
});
},
submit() {
... ...
... ... @@ -74,7 +74,7 @@ export default {
},
//编辑
edit(params) {
this.title = '编辑运费板';
this.title = '编辑运费板';
const { templateName, defaultFee, freeMount, id } = params;
this.templateName = templateName;
this.defaultFee = defaultFee;
... ...
... ... @@ -9,15 +9,15 @@
</Row>
<br />
<Row>
<i-col span="4">订单号:{{ orderInfo.orderCode }}</i-col>
<i-col span="4">下单时间:{{ orderInfo.createTime | timeFormat }}</i-col>
<i-col span="4">发货时间:{{ orderInfo.shipmentTime | timeFormat }}</i-col>
<i-col span="6">订单号:{{ orderInfo.orderCode }}</i-col>
<i-col span="6">下单时间:{{ orderInfo.createTime | timeFormat }}</i-col>
<i-col span="6">发货时间:{{ orderInfo.shipmentTime | timeFormat }}</i-col>
</Row>
<br />
<Row>
<i-col span="4">订单状态:{{ orderStatus[orderInfo.orderStatus] }}</i-col>
<i-col span="4">提交时间:{{ orderInfo.checkTime | timeFormat }}</i-col>
<i-col span="4">成交时间:{{ orderInfo.deliveryTime | timeFormat }}</i-col>
<i-col span="6">订单状态:{{ orderStatus[orderInfo.orderStatus] }}</i-col>
<i-col span="6">提交时间:{{ orderInfo.checkTime | timeFormat }}</i-col>
<i-col span="6">成交时间:{{ orderInfo.deliveryTime | timeFormat }}</i-col>
</Row>
</div>
</div>
... ...
... ... @@ -23,6 +23,7 @@
<td>{{ goods.productPrice && goods.productPrice.retailPrice ? goods.productPrice.retailPrice : '' }}</td>
<td>{{ goods.salePrice }}</td>
<td>{{ goods.lastPrice }}</td>
<td>{{ goods.discountPrice }}</td>
<td>
{{
goodsPromos[goods.id] && goodsPromos[goods.id].couponsDiscountAmount
... ... @@ -50,13 +51,13 @@
</tbody>
<tfoot>
<tr>
<td colspan="13" style="text-align: left">
<td colspan="14" style="text-align: left">
<span>实付金额:¥{{ orderInfo.lastOrderAmount }}</span>
<span>快递费:¥{{ orderInfo.shippingCost }}</span>
</td>
</tr>
<tr>
<td td colspan="13">
<td td colspan="14">
<div class="ivu-card">
<div class="ivu-card-head" style="text-align: left">
<p slot="title">使用优惠券</p>
... ... @@ -66,7 +67,7 @@
</td>
</tr>
<tr>
<td colspan="13">
<td colspan="14">
<div class="ivu-card">
<div class="ivu-card-head" style="text-align: left">
<p slot="title">参与促销</p>
... ... @@ -108,6 +109,7 @@ export default {
{ title: '吊牌价', width: '6%' },
{ title: '销售价', width: '6%' },
{ title: '成交价', width: '6%' },
{ title: 'VIP折扣', width: '6%' },
{ title: '优惠券', width: '6%' },
{ title: 'YOHO币', width: '6%' },
{ title: '红包', width: '6%' },
... ... @@ -125,10 +127,6 @@ export default {
key: 'couponAmount',
},
{
title: '优惠券金额调整',
key: 'couponAdjustAmount',
},
{
title: '费用承担类型',
key: 'feeSharingTypeStr',
},
... ...
... ... @@ -23,8 +23,8 @@ export default {
1: '有货承担',
2: '商家承担',
3: '按合同结算比例分摊',
4: '按优惠券结算比例分摊',
5: '按优惠券结算比例分摊',
4: '分摊-有货承担比例',
5: '会员营销券-阶梯折扣',
},
/**
... ...
... ... @@ -32,7 +32,7 @@
<td :rowspan="item.goodsList.length">{{ item.consigneeName }}</td>
<td :rowspan="item.goodsList.length">{{ paymentStatusArr[item.paymentStatus] }}</td>
<td :rowspan="item.goodsList.length">{{ item.lastOrderAmount }}</td>
<td :rowspan="item.goodsList.length">{{ orderStatusArr[item.orderStatus] }}</td>
<td :rowspan="item.goodsList.length">{{ item.orderStatusStr }}</td>
<td :rowspan="item.goodsList.length">
<i-button type="default" size="small" @click="goToDetail(item.orderCode)">查看订单</i-button>
<template v-if="item.orderStatus == 100 || item.orderStatus == 200">
... ...
... ... @@ -20,16 +20,29 @@
</Option>
</Select>
</filter-item>
<filter-item label="开始时间">
<Date-picker v-model="beginTimeModel" type="datetime" placeholder="创建开始时间" clearable></Date-picker>
</filter-item>
<filter-item label="结束时间">
<Date-picker v-model="endTimeModel" type="datetime" placeholder="创建结束时间" clearable></Date-picker>
</filter-item>
<filter-item>
<Button type="primary" @click="search">筛选</Button>
<Button @click="reset">全部</Button>
<Button type="warning" @click="exportList">导出</Button>
</filter-item>
</layout-filter>
<layout-list>
<list-tabs @change-tabs="onChangeTabs"></list-tabs>
<data-table :table-data="tableData" :payment-status-arr="paymentStatusArr" :order-status-arr="orderStatusArr">
</data-table>
<Page :total="pageData.total" :current="pageData.current" :page-size="20" show-total @on-change="pageChange">
<Page
:total="pageData.total"
:current="pageData.current"
:page-size="pageData.pageSize"
show-total
@on-change="pageChange"
>
</Page>
</layout-list>
</layout-body>
... ... @@ -40,6 +53,7 @@ import { ListTabs, DataTable } from './components';
import { OrderService } from 'services/order';
import _ from 'lodash';
import { OrderConfig } from '../configs';
import qs from 'querystringify';
export default {
components: { ListTabs, DataTable },
data() {
... ... @@ -51,11 +65,15 @@ export default {
productSku: '',
consigneeName: '',
orderStatus: '',
pageSize: 20,
pageSize: 10,
pageNo: 1,
orderStatusStr: '',
orderStatusType: 0,
beginCreateTime: '',
endCreateTime: '',
},
beginTimeModel: '',
endTimeModel: '',
tableData: [],
orderStatusArr: OrderConfig.orderStatus,
pageData: {
... ... @@ -64,6 +82,20 @@ export default {
},
};
},
watch: {
beginTimeModel: {
handler(newValue) {
this.query.beginCreateTime = new Date(newValue).getTime() / 1000;
},
deep: true,
},
endTimeModel: {
handler(newValue) {
this.query.endCreateTime = new Date(newValue).getTime() / 1000;
},
deep: true,
},
},
created() {
this.orderService = new OrderService();
this.search();
... ... @@ -93,8 +125,18 @@ export default {
this.query.orderStatus = '';
this.query.pageSize = 20;
this.query.pageNo = 1;
this.query.beginCreateTime = '';
this.query.endCreateTime = '';
this.beginTimeModel = '';
this.endTimeModel = '';
this.search();
},
//导出列表
exportList() {
const queryString = qs.stringify(this.query, true);
const href = `${OrderService.exportOrdersByStatus}${queryString}`;
window.open(href, '_blank');
},
},
};
</script>
... ...
<template>
<div class="ivu-card">
<div class="ivu-card-head">
<h3>退款商品信息</h3>
<p slot="title">退款商品信息</p>
</div>
<div class="ivu-card-body">
<table cellspacing="0" cellpadding="0" class="order-detail">
... ... @@ -31,17 +31,6 @@
<td>{{ goods.giftCardAmount }}</td>
<td>{{ goods.activityDiscount }}</td>
<td>{{ returnedReason[goods.returnedReason] }}</td>
<template v-if="index == 0">
<td :rowspan="tableData.length">
{{ returnedInfo.realReturnedAmount }}
</td>
<td :rowspan="tableData.length">
{{ returnedInfo.returnShippingCost }}
</td>
<td :rowspan="tableData.length">
{{ returnedInfo.realReturnedAmount + returnedInfo.returnShippingCost }}
</td>
</template>
</tr>
<tr v-if="goods.remark || goods.imperfectImage" :key="index + '_1'" class="returned-remark">
<td colspan="14">
... ... @@ -64,7 +53,7 @@
import prodImage from 'util/prod-image';
export default {
name: 'ReturnedGoodsInfo',
props: ['tableData', 'returnedReason', 'returnedInfo'],
props: ['tableData', 'returnedReason'],
data() {
return {
tableCols: [
... ... @@ -79,9 +68,6 @@ export default {
{ title: '礼品卡', width: '6%' },
{ title: '活动优惠', width: '6%' },
{ title: '退款原因', width: '6%' },
{ title: '退货款金额', width: '6%' },
{ title: '退运费金额', width: '6%' },
{ title: '退款总金额', width: '6%' },
],
};
},
... ...
... ... @@ -21,14 +21,27 @@
</Option>
</Select>
</filter-item>
<filter-item label="开始时间">
<Date-picker v-model="beginTimeModel" type="datetime" placeholder="申请开始时间" clearable></Date-picker>
</filter-item>
<filter-item label="结束时间">
<Date-picker v-model="endTimeModel" type="datetime" placeholder="申请结束时间" clearable></Date-picker>
</filter-item>
<filter-item>
<Button type="primary" @click="search">筛选</Button>
<Button @click="reset">全部</Button>
<Button type="warning" @click="exportList">导出</Button>
</filter-item>
</layout-filter>
<layout-list>
<returned-list-table :table-data="tableData" :shop-status="returnedGoodsShopStatus"></returned-list-table>
<Page :total="pageData.total" :current="pageData.current" :page-size="20" show-total @on-change="pageChange">
<Page
:total="pageData.total"
:current="pageData.current"
:page-size="pageData.pageSize"
show-total
@on-change="pageChange"
>
</Page>
</layout-list>
</layout-body>
... ... @@ -39,21 +52,26 @@ import { ReturnedListTable } from '../components';
import { ReturnedService } from 'services/order';
import { OrderConfig } from 'pages/order/configs';
import _ from 'lodash';
import qs from 'querystringify';
export default {
components: { ReturnedListTable },
data() {
return {
beginTimeModel: '',
endTimeModel: '',
paymentStatusArr: OrderConfig.paymentStatus,
query: {
orderCode: '',
productSkn: '',
productSku: '',
consigneeName: '',
pageSize: 20,
pageSize: 10,
pageNo: 1,
queryType: 1,
shopStatus: '-1',
startTime: '',
endTime: '',
},
returnedGoodsShopStatus: OrderConfig.returnedGoodsShopStatus,
pageData: {
... ... @@ -63,6 +81,20 @@ export default {
tableData: [],
};
},
watch: {
beginTimeModel: {
handler(newValue) {
this.query.startTime = new Date(newValue).getTime() / 1000;
},
deep: true,
},
endTimeModel: {
handler(newValue) {
this.query.endTime = new Date(newValue).getTime() / 1000;
},
deep: true,
},
},
created() {
this.ReturnedService = new ReturnedService();
this.search();
... ... @@ -90,8 +122,18 @@ export default {
this.query.pageSize = 20;
this.query.pageNo = 1;
this.query.orderStatusStr = '';
this.query.startTime = '';
this.query.endTime = '';
this.beginTimeModel = '';
this.endTimeModel = '';
this.search();
},
//导出列表
exportList() {
const queryString = qs.stringify(this.query, true);
const href = `${ReturnedService.exportReturnedGoods}${queryString}`;
window.open(href, '_blank');
},
},
};
</script>
... ...
... ... @@ -2,17 +2,23 @@
<div class="ivu-row">
<div class="ivu-card">
<div class="ivu-card-head">
<h3>退货申请处理</h3>
<p slot="title">退货申请处理</p>
</div>
<div class="ivu-card-body">
<Row>
<i-col span="4">退货ID:{{ id }}</i-col>
<i-col span="4">退款申请时间:{{ returnedInfo.createTime | timeFormat }}</i-col>
<i-col span="4">退货状态:{{ returnedGoodsShopStatus[returnedInfo.shopStatus] }}</i-col>
<i-col span="6">退货ID:{{ id }}</i-col>
<i-col span="6">退款申请时间:{{ returnedInfo.createTime | timeFormat }}</i-col>
<i-col span="6">退货状态:{{ returnedGoodsShopStatus[returnedInfo.shopStatus] }}</i-col>
</Row>
<br />
<Row>
<i-col span="6">退货款金额:{{ returnedInfo.realReturnedAmount }}</i-col>
<i-col span="6">退运费金额:{{ returnedInfo.returnShippingCost }}</i-col>
<i-col span="6">退款总金额:{{ returnTotalAmount }}</i-col>
</Row>
<br />
<Row>
<i-col span="4">退款总金额:{{ returnTotalAmount }}</i-col>
<i-col span="4">
<i-col span="8">
退款成功时间:<span v-if="returnedInfo.refundTime">{{ returnedInfo.refundTime | timeFormat }}</span>
</i-col>
</Row>
... ... @@ -21,8 +27,7 @@
<!--订单基本信息-->
<order-base-info :order-info="orderInfo" :order-status="orderStatus"></order-base-info>
<!--退货商品信息-->
<returned-goods-info :table-data="returnGoods" :returned-reason="returnedReasonArr" :returned-info="returnedInfo">
</returned-goods-info>
<returned-goods-info :table-data="returnGoods" :returned-reason="returnedReasonArr"></returned-goods-info>
<div class="ivu-card">
<div class="ivu-card-head">
<h3>寄回物流信息</h3>
... ...
... ... @@ -66,7 +66,7 @@
<Option v-for="streetOption in streetList[addressSelected.district.value]" :label="streetOption.name" :value="streetOption.value" :key="streetOption.value"></Option>
</Select>
<Input v-model="addressDetail" placeholder="详细地址"></Input>
<p>注:店铺地址店铺最新可联系到的地址</p>
<p>注:店铺地址店铺最新可联系到的地址</p>
</div>
</Form-item>
<Form-item v-if="shopData.shopNature === 6" label="店铺客服电话:">
... ...
... ... @@ -16,6 +16,12 @@ const apiUrl = {
shopWithdrawApplyInit: '/erp/shopWithdrawApplyInit',
shopGetAvailableAmount: '/erp/shopGetAvailableAmount',
shopWithdrawApply: '/erp/shopWithdrawApply',
sendShopVerifyCode: '/erp/sendShopVerifyCode',
verifySmsCode: '/erp/verifySmsCode',
queryShopBillList: '/erp/queryShopBillList',
querySummaryInfo: '/erp/querySummaryInfo',
queryBillSummary: '/erp/queryBillSummary',
queryFreightBillSummary: '/erp/queryFreightBillSummary',
};
class FinanceService extends Service {
... ... @@ -145,10 +151,60 @@ class FinanceService extends Service {
shopWithdrawApply(params) {
return this.post(apiUrl.shopWithdrawApply, params);
}
/**
* 获取提现短信验证码
* @param params
* @return {*}
*/
sendShopVerifyCode(params) {
return this.post(apiUrl.sendShopVerifyCode, params);
}
/**
* 验证短信验证码
* @param params
* @return {*}
*/
verifySmsCode(params) {
return this.post(apiUrl.verifySmsCode, params);
}
/**
* 交易账务明细新
* @param params
* @returns {Promise<unknown>}
*/
shopBillList(params) {
return this.post(apiUrl.queryShopBillList, params);
}
/**
* 财务明细汇总
* @param params
*/
querySummaryInfo(params) {
return this.post(apiUrl.querySummaryInfo, params);
}
/**
* 服务费账单汇总
* @param params
*/
queryBillSummary(params) {
return this.post(apiUrl.queryBillSummary, params);
}
/**
* 运费账务汇总
* @param params
*/
queryFreightBillSummary(params) {
return this.post(apiUrl.queryFreightBillSummary, params);
}
}
FinanceService.exportBalanceList = '/Api/erp/exportBalanceList'; // 导出对账单列表, 结算单列表
FinanceService.exportBalanceDetail = '/Api/erp/exportBalanceDetail'; // 导出对账单详情
FinanceService.exportSettlementDetail = '/Api/erp/exportSettlementDetail'; // 导出结算单详情
FinanceService.exportInventory = '/Api/erp/exportInventoryLedgerList'; // 导出结算单库存
export default FinanceService;
... ...
const baseExportApi = '/Api/export/excel';
export default baseExportApi;
... ...
{
"name": "yoho-shop-manage",
"version": "6.9.24-beta23",
"version": "1.3.1",
"description": "",
"main": "app.js",
"scripts": {
... ...
... ... @@ -97,7 +97,7 @@ const domainApis = {
orderDetail: '/erp-gateway-web/shop/orders/queryOrdersDetail', //订单详情
queryOrderGoods: '/erp-gateway-web/shop/orders/queryOrdersGoodsAndPrice', //获取订单商品
queryOrderGoodsPromos: '/erp-gateway-web/cs/order/goodspromos/query', //获取订单商品的促销
queryOrderCoupons: '/erp-gateway-web/cs/order/coupons', //获取订单优惠券
queryOrderCoupons: '/erp-gateway-web/shop/orders/queryShopOrderCoupons', //获取订单优惠券
queryOrderPromos: '/erp-gateway-web/cs/order/promotions', //获取订单促销
confirmExpress: '/erp-gateway-web/shop/orders/ordersUpdateExpress', //订单确认物流
exportOrdersByStatus: '/erp-gateway-web/shop/export/exportOrdersByStatus', //导出订单列表
... ... @@ -127,6 +127,12 @@ const domainApis = {
shopWithdrawApplyInit: '/erp-gateway-web/shop/withdraw/init', //提现页面初始数据
shopGetAvailableAmount: '/erp-gateway-web/shop/withdraw/getAvailableAmount', //根据店铺ID,时间获取可用的提现金额
shopWithdrawApply: '/erp-gateway-web/shop/withdraw/apply', //资金操作明细-申请提现
sendShopVerifyCode: '/erp-gateway-web/sms/sendVerificationCode', //获取短信验证码
verifySmsCode: '/erp-gateway-web/sms/verifySmsCode', // 验证短信验证码
queryShopBillList: '/erp-gateway-web/shop/bill/list', //交易账务明细(新)
querySummaryInfo: '/erp-gateway-web/shop/bill/summaryInfo', //财务明细汇总
queryBillSummary: '/erp-gateway-web/shop/withdraw/service/billSummary', //服务费账单汇总
queryFreightBillSummary: '/erp-gateway-web/shop/withdraw/freight/billSummary', //运费账务汇总
},
platform: {
queryShopsByAdminPid: '/SellerShopController/queryShopsByAdminPid',
... ...
const exportExcelConfs = {
//交易账务明细报表导出配置
shopBill: {
apiUrl: '/erp/queryShopBillList',
conf: {
cols: [
{
caption: '账务ID',
type: 'number',
},
{
caption: '结算时间',
type: 'string',
},
{
caption: '订单号',
type: 'string',
},
{
caption: 'SKU',
type: 'string',
},
{
caption: '数量',
type: 'number',
},
{
caption: '商品名称',
type: 'string',
},
{
caption: '账务类型',
type: 'string',
},
{
caption: '业务描述',
type: 'string',
},
{
caption: '成交价/优惠价',
type: 'number',
},
{
caption: '商家应收/分摊比例',
type: 'number',
},
{
caption: '商家应收',
type: 'number',
},
{
caption: '提现服务费',
type: 'number',
},
{
caption: '交易服务费',
type: 'number',
},
{
caption: '商家实收',
type: 'number',
},
{
caption: '提现状态',
type: 'string',
},
{
caption: '可提现日期',
type: 'string',
},
{
caption: '提现申请日期',
type: 'string',
},
],
rows: [
'id',
'businessTime',
'orderCode',
'productSku',
'quantity',
'productName',
'billTypeDesc',
'clearingTypeName',
'lastPrice',
'clearingDiscount',
'shopDeserveAmount',
'withdrawServiceAmount',
'serviceAmount',
'shopNetAmount',
'statusName',
'withdrawalTime',
'withdrawApplyTime',
],
},
},
//服务费账单报表导出配置
shopServiceList: {
apiUrl: '/erp/shopWithdrawServiceList',
conf: {
cols: [
{
caption: '账务ID',
type: 'number',
},
{
caption: '提现时间',
type: 'string',
},
{
caption: '商家收款账户',
type: 'string',
},
{
caption: '订单号',
type: 'string',
},
{
caption: 'SKU',
type: 'number',
},
{
caption: '商品名称',
type: 'string',
},
{
caption: '账务类型',
type: 'string',
},
{
caption: '子服务类型',
type: 'string',
},
{
caption: '交易服务费',
type: 'number',
},
{
caption: '提现服务费',
type: 'number',
},
{
caption: '服务费金额',
type: 'number',
},
{
caption: '提现状态',
type: 'string',
},
{
caption: '提现成功日期',
type: 'string',
},
],
rows: [
'id',
'withdrawTime',
'targetAccount',
'orderCode',
'productSku',
'productName',
'clearingType',
'clearingTypeName',
'tradeServiceAmount',
'withdrawServiceAmount',
'serviceAmount',
'statusName',
'withdrawSuccessTime',
],
},
},
//运费账务明细报表导出配置
shopFreightList: {
apiUrl: '/erp/shopWithdrawFreightList',
conf: {
cols: [
{
caption: '账务ID',
type: 'number',
},
{
caption: '结算时间',
type: 'string',
},
{
caption: '订单号',
type: 'string',
},
{
caption: '商品名称',
type: 'string',
},
{
caption: '账务类型',
type: 'string',
},
{
caption: '运费',
type: 'number',
},
{
caption: '提现服务费',
type: 'number',
},
{
caption: '商家实收',
type: 'number',
},
{
caption: '提现状态',
type: 'string',
},
{
caption: '提现成功日期',
type: 'string',
},
],
rows: [
'id',
'clearingTime',
'orderCode',
'productName',
'clearingType',
'freightAmount',
'withdrawServiceAmount',
'realIncome',
'statusName',
'withdrawTime',
],
},
},
};
module.exports = exportExcelConfs;
... ...
... ... @@ -15,6 +15,7 @@ const FileController = require('./file-controller');
const ImportController = require('./import-controller');
const CaptchaController = require('./captcha-controller');
const GeeCaptchaController = require('./gee-captcha-controller');
const OutputController = require('./output-controller');
let router = Express.Router(); // eslint-disable-line
... ... @@ -23,6 +24,7 @@ router.post('/logout', middleware(UserController, 'logout'));
router.post('/switchShop', before, auth, middleware(UserController, 'switchShop'));
router.post('/upload/image', before, auth, middleware(FileController, 'uploadImage'));
router.post('/import', before, auth, middleware(ImportController, 'import'));
router.get('/export/excel', before, middleware(OutputController, 'exportExcel'));
router.post('/config', middleware(UserController, 'config'));
router.get('/captcha.jpg', middleware(CaptchaController, 'captcha'));
router.get('/geeCaptcha', middleware(GeeCaptchaController, 'captcha'));
... ...
const Context = require('../framework/context');
const nodeExcel = require('excel-export');
const ExportExcelService = require('../service/export-excel-service');
const _ = require('lodash');
const exportExcelConfs = require('../common/excel-conf/exprot-excel-conf');
const config = global.yoho.config;
const moment = require('moment');
// 暂时弃用
class OutputController extends Context {
constructor() {
super();
this.exportExcelService = this.instance(ExportExcelService);
}
productList(req, res) {
const conf = {
name: 'mysheet',
... ... @@ -19,7 +26,11 @@ class OutputController extends Context {
type: 'string',
},
],
rows: [['1', '2'], ['3', '2'], ['4', '2']],
rows: [
['1', '2'],
['3', '2'],
['4', '2'],
],
};
const result = nodeExcel.execute(conf);
... ... @@ -27,6 +38,95 @@ class OutputController extends Context {
res.setHeader('Content-Disposition', 'attachment; filename=productList.xlsx');
res.end(result, 'binary');
}
/**
* 导出
* @param req
* @param res
*/
exportExcel(req, res) {
//获取导出表格的配置文件
const { apiUrl, conf } = exportExcelConfs[req.query.excelConf];
const searchParams = this.createSearchParams(req);
//请求服务数据
this.exportExcelService.getExportData(apiUrl, searchParams).then(result => {
const totalPage = result.totalPage || 0;
if (totalPage < 1) {
res.end('', 'binary');
}
const apis = [];
for (let i = 1; i <= totalPage; i++) {
searchParams.pageNo = i;
apis.push(this.exportExcelService.getExportData(apiUrl, searchParams));
}
Promise.all(apis).then(result => {
//获取结果集中的records
const excel = this.createExcelData(result, conf);
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
res.setHeader('Content-Disposition', 'attachment; filename=download.xlsx');
res.end(excel, 'binary');
});
});
}
/**
* 组织查询数据
* @param req
*/
createSearchParams(req) {
//获取导出配置
const currentShop = _.find(req.user.shops, shop => shop.shopsId === _.parseInt(req.cookies._sign));
let baseParams = {};
if (currentShop) {
baseParams = {
pid: req.user.uid,
shopsId: currentShop.shopsId,
shopId: currentShop.shopsId,
shop: currentShop.shopsId,
supplierId: currentShop.shopsBrands.length
? req.user.supplier_id
? req.user.supplier_id
: _.first(currentShop.shopsBrands).supplierId
: 0,
platform_id: config.platform,
};
}
return { ...req.query, ...baseParams, pageSize: 1000 };
}
/**
* 组织表格要用的数据
* @param columnFields
* @param rows
*/
createExcelData(dataList, config) {
const { cols, rows } = config;
const conf = { ...{}, cols, rows: [] };
const list = _.flattenDeep(_.map(dataList, 'records'));
//组织导出数据
_.forEach(list, item => {
//组织导出的每一列数据
const excelRow = [];
_.forEach(rows, row => {
if (!item.hasOwnProperty(row)) {
excelRow.push(String(''));
return true;
}
//如果导出的列是时间,则格式化时间
if ((row.indexOf('time') > -1 || row.indexOf('Time') > -1) && item[row] > 0) {
excelRow.push(String(moment(item[row] * 1000).format('YYYY-MM-DD HH:mm:ss')));
return true;
}
if (_.isNaN(item[row])) {
excelRow.push(String(item[row]));
return true;
}
excelRow.push(item[row]);
});
conf.rows.push(excelRow);
});
return nodeExcel.execute(conf);
}
}
module.exports = OutputController;
... ...
'use strict';
const _ = require('lodash');
const Context = require('../framework/context');
const Api = require('../common/api');
const config = global.yoho.config;
class ExportExcelService extends Context {
constructor() {
super();
this.api = this.instance(Api);
}
//获取要导出的数据
getExportData(apiUrl, params) {
const apiArr = _.split(apiUrl, '/');
const platform = apiArr[1];
const method = apiArr[2];
return this.api
.post(config.apiDomain[platform][method], params)
.then(res => {
if (res.code !== 200) {
return Promise.reject({ code: 500, message: res.message });
}
return res.data;
})
.catch(error => {
return Promise.reject({ code: 400, message: error.message });
});
}
}
module.exports = ExportExcelService;
... ...