Commit 3e6327bb by liwk

commit

1 parent 43149391
...@@ -8,14 +8,18 @@ export const orderApi = { ...@@ -8,14 +8,18 @@ export const orderApi = {
getOrderList(data = {}) { getOrderList(data = {}) {
return request(data, 'dj.api.get.equity.order.list.get') 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
/** 获取海威账户余额*/
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() {
......
...@@ -10,7 +10,7 @@ const common = { ...@@ -10,7 +10,7 @@ const common = {
/** /**
* 导出excel * 导出excel
* */ * */
exportExcel: function (options) { exportExcel: function(options) {
if (!options) { if (!options) {
return false; return false;
} }
...@@ -58,7 +58,7 @@ const common = { ...@@ -58,7 +58,7 @@ const common = {
/** /**
* 下载zip * 下载zip
*/ */
downPackFile: function (options) { downPackFile: function(options) {
if (!options) { if (!options) {
return false; return false;
}; };
...@@ -76,7 +76,7 @@ const common = { ...@@ -76,7 +76,7 @@ const common = {
/** /**
* 获取时间对象 * 获取时间对象
*/ */
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;
...@@ -105,7 +105,7 @@ const common = { ...@@ -105,7 +105,7 @@ const common = {
/** /**
* 判断按钮是否有权限 * 判断按钮是否有权限
*/ */
hasPermission: function (id) { hasPermission: function(id) {
if (!id) { if (!id) {
return false return false
}; };
...@@ -134,7 +134,7 @@ const common = { ...@@ -134,7 +134,7 @@ const common = {
/** /**
* 递归处理数据 * 递归处理数据
*/ */
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++) {
...@@ -152,7 +152,7 @@ const common = { ...@@ -152,7 +152,7 @@ const common = {
/** /**
* 递归获取子节点数据 * 递归获取子节点数据
*/ */
processChildData: function (oInfo) { processChildData: function(oInfo) {
let resObj = {}; let resObj = {};
if (!oInfo) { if (!oInfo) {
return false; return false;
...@@ -171,7 +171,7 @@ const common = { ...@@ -171,7 +171,7 @@ const common = {
/** /**
* 数字转换成货币格式 * 数字转换成货币格式
*/ */
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 : "$";
...@@ -191,7 +191,7 @@ const common = { ...@@ -191,7 +191,7 @@ const common = {
/** /**
* 截取字符串 * 截取字符串
*/ */
subStrByLength: function (str, length) { subStrByLength: function(str, length) {
var retStr = str; var retStr = str;
var len = 3; var len = 3;
......
...@@ -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: [{ statusList: [
{
label: '待收货', label: '待收货',
value: 1 value: 2
}, { }, {
label: '已完成', label: '已完成',
value: 2 value: 3
}, { }, {
label: '已退款', label: '已退款',
value: 3 value: 6
}, },
{ {
label: '售后中', label: '售后中',
value: 4 value: 4
}], }],
tableData: [], 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!