Commit 3e6327bb by liwk

commit

1 parent 43149391
import request from './request'
export const orderApi = {
/**获取财务管理列表*/
getBalanceList(data = {}) {
return request(data, 'dj.api.get.equity.order.balance.list.get')
},
/** 获取订单列表*/
getOrderList(data = {}) {
return request(data, 'dj.api.get.equity.order.list.get')
},
}
// export const orderApi = {
// /**获取财务管理列表*/
// getBalanceList(data = {}) {
// return request(data, 'dj.api.get.equity.order.balance.list.get')
// },
// /** 获取订单列表*/
// getOrderList(data = {}) {
// return request(data, 'dj.api.get.equity.order.list.get')
// },
// }
\ No newline at end of file
/**获取财务管理列表*/
getBalanceList(data = {}) {
return request(data, 'dj.api.get.equity.order.balance.list.get')
},
/** 获取订单列表*/
getOrderList(data = {}) {
return request(data, 'dj.api.get.equity.order.list.get')
},
/** 获取海威账户余额*/
getHwAccount(data = {}) {
return request(data, 'dj.api.get.equity.order.hw.account.balance.get')
},
}
// export const orderApi = {
// /**获取财务管理列表*/
// getBalanceList(data = {}) {
// return request(data, 'dj.api.get.equity.order.balance.list.get')
// },
// /** 获取订单列表*/
// getOrderList(data = {}) {
// return request(data, 'dj.api.get.equity.order.list.get')
// },
// }
\ No newline at end of file
......@@ -33,6 +33,7 @@ Vue.use(VueQuillEditor)
// locale: 'zh_CN'
// })
import '@/components'
import './utils/util.js'
Vue.use(GlsxVueComponents)
var mixin = {
mounted() {
......
......@@ -7,210 +7,210 @@
import axios from 'axios';
const common = {
/**
* 导出excel
* */
exportExcel: function (options) {
if (!options) {
return false;
}
let oParams = {
method: options.method || 'post',
url: options.url,
responseType: 'blob'
}
if (options.method == 'GET' || options.method == 'get') {
oParams.params = options.data
} else {
oParams.data = options.data;
}
console.log(options.data);
axios(oParams).then(response => {
if (!response) {
return
};
console.log(response)
let a = document.createElement('a')
let blob = new Blob([response.data], { type: "application/vnd.ms-excel" })
let objectUrl = URL.createObjectURL(blob)
a.setAttribute("href", objectUrl)
a.setAttribute("download", '订单信息.xls')
a.click()
// let url = window.URL.createObjectURL(new Blob([response.data], {
// type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
// }));
// let link = document.createElement('a');
// link.style.display = 'none';
// link.href = url;
// link.setAttribute('download', options.fileName || 'excel.xlsx');
// document.body.appendChild(link);
// link.click();
if (options.success) {
(options.success)();
}
}).catch((error) => {
if (options.errorFunc) {
(options.errorFunc)(error);
}
})
},
/**
* 下载zip
*/
downPackFile: function (options) {
if (!options) {
return false;
};
/* let iframe = document.createElement('a')
iframe.style.display = 'none'
iframe.src = options.url
document.body.appendChild(link);
link.click(); */
window.location.href = options.url;
//document.body.appendChild(iframe)
},
/**
* 获取时间对象
*/
getDateInfo: function () {
var o = new Date();
var y = o.getFullYear();
var m = o.getMonth() + 1;
var d = o.getDate();
var M = m;
var D = d;
if (m < 10) {
M = '0' + m;
};
if (d < 10) {
D = '0' + d;
};
return {
y: y,
m: m,
M: M,
d: d,
D: D,
today: y + '-' + M + '-' + D
};
},
/**
* 判断按钮是否有权限
*/
hasPermission: function (id) {
if (!id) {
return false
};
let res = sessionStorage.getItem('MENURESOUCE');
let mres = '';
let resObj = {};
if (res) {
mres = JSON.parse(res);
};
if (mres && mres.length > 0) {
for (let i = 0, len = mres.length; i < len; i++) {
let child = mres[i].children;
resObj[mres[i].menuId] = mres[i];
let abc = Common.processData(child);
Object.assign(resObj, abc);
}
};
if (resObj[id]) {
return true;
} else {
return false;
}
},
/**
* 递归处理数据
*/
processData: function (o) {
let list = {};
if (o && o.length > 0) {
for (let i = 0, len = o.length; i < len; i++) {
let child = o[i].children;
list[o[i].menuId] = o[i];
if (child && child.length > 0) {
let mn = Common.processData(child);
Object.assign(list, mn);
}
}
}
return list;
},
/**
* 递归获取子节点数据
*/
processChildData: function (oInfo) {
let resObj = {};
if (!oInfo) {
return false;
}
if (oInfo && oInfo.length > 0) {
for (let i = 0, len = oInfo.length; i < len; i++) {
let child = oInfo[i].children;
resObj[oInfo[i].menuId] = oInfo[i];
let abc = Common.processData(child);
Object.assign(resObj, abc);
}
};
return resObj;
},
/**
* 数字转换成货币格式
*/
formatMoney: function (number, places, symbol, thousand, decimal) {
number = number || 0;
places = !isNaN(places = Math.abs(places)) ? places : 2;
symbol = symbol !== undefined ? symbol : "$";
thousand = thousand || ",";
decimal = decimal || ".";
var negative = number < 0 ? "-" : "",
i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" +
thousand) + (places ? '' : "");
},
/**
* 字符串截取
*/
/**
* 截取字符串
*/
subStrByLength: function (str, length) {
var retStr = str;
var len = 3;
if (retStr) {
if (length) {
len = length;
};
if (str.length > len) {
retStr = str.substring(0, len) + '...';
}
};
return retStr;
}
/**
* 导出excel
* */
exportExcel: function(options) {
if (!options) {
return false;
}
let oParams = {
method: options.method || 'post',
url: options.url,
responseType: 'blob'
}
if (options.method == 'GET' || options.method == 'get') {
oParams.params = options.data
} else {
oParams.data = options.data;
}
console.log(options.data);
axios(oParams).then(response => {
if (!response) {
return
};
console.log(response)
let a = document.createElement('a')
let blob = new Blob([response.data], { type: "application/vnd.ms-excel" })
let objectUrl = URL.createObjectURL(blob)
a.setAttribute("href", objectUrl)
a.setAttribute("download", '订单信息.xls')
a.click()
// let url = window.URL.createObjectURL(new Blob([response.data], {
// type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
// }));
// let link = document.createElement('a');
// link.style.display = 'none';
// link.href = url;
// link.setAttribute('download', options.fileName || 'excel.xlsx');
// document.body.appendChild(link);
// link.click();
if (options.success) {
(options.success)();
}
}).catch((error) => {
if (options.errorFunc) {
(options.errorFunc)(error);
}
})
},
/**
* 下载zip
*/
downPackFile: function(options) {
if (!options) {
return false;
};
/* let iframe = document.createElement('a')
iframe.style.display = 'none'
iframe.src = options.url
document.body.appendChild(link);
link.click(); */
window.location.href = options.url;
//document.body.appendChild(iframe)
},
/**
* 获取时间对象
*/
getDateInfo: function() {
var o = new Date();
var y = o.getFullYear();
var m = o.getMonth() + 1;
var d = o.getDate();
var M = m;
var D = d;
if (m < 10) {
M = '0' + m;
};
if (d < 10) {
D = '0' + d;
};
return {
y: y,
m: m,
M: M,
d: d,
D: D,
today: y + '-' + M + '-' + D
};
},
/**
* 判断按钮是否有权限
*/
hasPermission: function(id) {
if (!id) {
return false
};
let res = sessionStorage.getItem('MENURESOUCE');
let mres = '';
let resObj = {};
if (res) {
mres = JSON.parse(res);
};
if (mres && mres.length > 0) {
for (let i = 0, len = mres.length; i < len; i++) {
let child = mres[i].children;
resObj[mres[i].menuId] = mres[i];
let abc = Common.processData(child);
Object.assign(resObj, abc);
}
};
if (resObj[id]) {
return true;
} else {
return false;
}
},
/**
* 递归处理数据
*/
processData: function(o) {
let list = {};
if (o && o.length > 0) {
for (let i = 0, len = o.length; i < len; i++) {
let child = o[i].children;
list[o[i].menuId] = o[i];
if (child && child.length > 0) {
let mn = Common.processData(child);
Object.assign(list, mn);
}
}
}
return list;
},
/**
* 递归获取子节点数据
*/
processChildData: function(oInfo) {
let resObj = {};
if (!oInfo) {
return false;
}
if (oInfo && oInfo.length > 0) {
for (let i = 0, len = oInfo.length; i < len; i++) {
let child = oInfo[i].children;
resObj[oInfo[i].menuId] = oInfo[i];
let abc = Common.processData(child);
Object.assign(resObj, abc);
}
};
return resObj;
},
/**
* 数字转换成货币格式
*/
formatMoney: function(number, places, symbol, thousand, decimal) {
number = number || 0;
places = !isNaN(places = Math.abs(places)) ? places : 2;
symbol = symbol !== undefined ? symbol : "$";
thousand = thousand || ",";
decimal = decimal || ".";
var negative = number < 0 ? "-" : "",
i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" +
thousand) + (places ? '' : "");
},
/**
* 字符串截取
*/
/**
* 截取字符串
*/
subStrByLength: function(str, length) {
var retStr = str;
var len = 3;
if (retStr) {
if (length) {
len = length;
};
if (str.length > len) {
retStr = str.substring(0, len) + '...';
}
};
return retStr;
}
};
export const exportExcel = common.exportExcel;
export const subStrByLength = common.subStrByLength;
export const formatMoney = common.formatMoney;
export const formatMoney = common.formatMoney;
\ No newline at end of file
......@@ -270,7 +270,6 @@ export default {
params.sort = this.sort === 'descending' ? 1 : 0
}
// console.log(params)
console.log(1)
this.getListApi(params).then(({ data }) => {
this.data = data[this.tableParams.listName]
this.total = data.total
......
/**
* 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/
Date.prototype.format = function(fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'q+': Math.floor((this.getMonth() + 3) / 3),
'S': this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt
}
\ No newline at end of file
......@@ -5,7 +5,7 @@
<div class="item">
日期:
<el-date-picker
v-model="searchObj.date"
v-model="date"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
......@@ -17,19 +17,19 @@
</div>
<div class="item">
品牌名称:
<el-select>
<el-option
label="团油"
value="0"
>
</el-option>
</el-select>
<div class="input">
<el-input
v-model="searchObj.brandName"
placeholder=""
size="small"
></el-input>
</div>
</div>
<div class="item">
商品名称:
<div class="input">
<el-input
v-model="searchObj.no"
v-model="searchObj.productName"
placeholder=""
size="small"
></el-input>
......@@ -38,11 +38,11 @@
<div class="item">
商品形态:
<el-select
v-model="searchObj.status"
v-model="searchObj.appereance"
placeholder="请选择"
>
<el-option
v-for="item in statusList"
v-for="item in appereanceList"
:key="item.value"
:label="item.label"
:value="item.value"
......@@ -53,11 +53,11 @@
<div class="item">
渠道:
<el-select
v-model="searchObj.status"
v-model="searchObj.channl"
placeholder="请选择"
>
<el-option
v-for="item in statusList"
v-for="item in channlList"
:key="item.value"
:label="item.label"
:value="item.value"
......@@ -69,7 +69,7 @@
门店名称:
<div class="input">
<el-input
v-model="searchObj.no"
v-model="searchObj.merchantName"
placeholder=""
size="small"
></el-input>
......@@ -78,7 +78,7 @@
<div class="item">
订单状态:
<el-select
v-model="searchObj.status"
v-model="searchObj.orderStatus"
placeholder="请选择"
>
<el-option
......@@ -93,31 +93,32 @@
</div>
<div class="bottom">
<el-button-group>
<el-button type="primary">查询</el-button>
<el-button type="default">重置</el-button>
<el-button
type="primary"
@click="search"
>查询</el-button>
<el-button
type="default"
@click="reset"
>重置</el-button>
</el-button-group>
</div>
</div>
<div class="table-box">
<div class="table-btn">
账户余额:
23139.34元
<el-button type="primary">刷新余额</el-button>
账户余额:{{price}}元
<el-button
type="primary"
@click="getHwAccount"
>刷新余额</el-button>
</div>
<d2-table
ref="table"
:searchForm="searchObj"
:tableParams="tableParams"
:tableData="tableData"
:getListApi="tableParams.getListApi"
:hasNum="false"
>
<span
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
>
<el-button type="text">查看详情</el-button>
</span>
<template slot='custom'>
<div class="table-custom">
<el-button type="primary">导出</el-button>
......@@ -130,32 +131,57 @@
<script type='text/ecmascript-6'>
import { orderApi } from '@api/api'
const statusEnum = {
0: '未支付',
1: '已支付',
2: '已发货',
3: '已完成',
4: '售后中',
5: '退款失败',
6: '已退款',
}
export default {
name: '',
data () {
return {
date: '',
price: 0,
searchObj: {
status: 1
},
statusList: [{
label: '待收货',
value: 1
}, {
label: '已完成',
value: 2
}, {
label: '已退款',
value: 3
},
{
label: '售后中',
value: 4
}],
tableData: [],
statusList: [
{
label: '待收货',
value: 2
}, {
label: '已完成',
value: 3
}, {
label: '已退款',
value: 6
},
{
label: '售后中',
value: 4
}],
appereanceList: [
{
label: '卡券',
value: 1
}, {
label: '直充',
value: 2
}
],
channlList: [
{
label: '海威',
value: 'HW'
}
],
tableParams: {
listName: 'list',
showSummary: true,
// getListApi: orderApi.getBalanceList,
getListApi: orderApi.getBalanceList,
summaryMethod ({ columns, data }) {
let sums = []
columns.forEach((column, index) => {
......@@ -163,7 +189,13 @@ export default {
sums[index] = '合计'
return
}
const values = data.map(item => Number(item[column.property]))
const values = data.map(item => {
if (column.property == 'costPrice' || column.property == 'orderPrices' || column.property == 'discount') {
return Number(item[column.property])
}
return NaN
})
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
......@@ -183,65 +215,94 @@ export default {
tableColumns: [
{
label: '订单编号',
prop: 'cardNo',
prop: 'orderCode',
minWidth: '200'
},
{
label: '品牌名称',
prop: 'activationCode',
prop: 'brandName',
minWidth: '200',
},
{
label: '商品形态',
prop: 'sn',
minWidth: '200',
prop: 'appearanceDesc',
minWidth: '100',
},
{
label: '商品名称',
prop: 'memberName',
prop: 'productName',
minWidth: '200',
},
{
label: '订单成本金额',
prop: 'updatedDate',
prop: 'costPrice',
minWidth: '200',
},
{
label: '订单支付金额',
prop: 'cardNoSSS',
prop: 'orderPrices',
minWidth: '200'
},
{
label: '销售差额',
prop: 'AAA',
prop: 'discount',
minWidth: '200',
},
{
label: '下单渠道',
prop: 'CCC',
minWidth: '200',
formatter (cell) {
return `${cell.merchantName || ''}${cell.merchantName ? '-' : ''}${cell.channelName}`
}
},
{
label: '订单状态',
prop: 'BBB',
minWidth: '200',
formatter (cell) {
return statusEnum[cell.orderStatus]
}
},
{
label: '下单时间',
prop: 'DDD',
prop: 'orderDate',
minWidth: '200',
formatter (cell) {
return cell.orderDate ? new Date(cell.orderDate).format('yyyy-MM-dd hh:mm:ss') : '- -'
}
},
]
}
}
},
mounted () {
orderApi.getBalanceList().then(res => {
console.log(res)
})
this.getHwAccount()
},
watch: {
'date' (n, o) {
console.log(n)
if (n) {
this.searchObj.orderDateStart = `${n[0]} 00:00:00`
this.searchObj.orderDateEnd = `${n[1]} 23:59:59`
}
}
},
methods: {
getHwAccount () {
orderApi.getHwAccount().then(({ code, data }) => {
if (code == 0) {
this.price = data
}
})
},
search () {
this.$refs.table.refreshTable()
},
reset () {
this.searchObj = {}
this.date = ''
this.search()
}
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!