Commit 3e6327bb by liwk

commit

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