<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="下单日期">
<a-range-picker size="large" format="YYYY-MM-DD" @change="onDateChange" />
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="订单号">
<a-input placeholder="请输入订单号" v-model="queryParam.orderCode"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="用户帐号">
<a-input placeholder="请输入用户帐号" v-model="queryParam.userName"></a-input>
</a-form-item>
</a-col>
<!--<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="订单总价">
<a-input placeholder="请输入订单总价" v-model="queryParam.cost"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="备注">
<a-input placeholder="请输入备注" v-model="queryParam.remark"></a-input>
</a-form-item>
</a-col>-->
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="订单状态">
<a-select placeholder="请选择订单状态" v-model="queryParam.status" :options="statusOptions"></a-select>
</a-form-item>
</a-col>
</template>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button type="primary" icon="download" @click="handleExportXls('后台订单管理信息')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
class="j-table-force-nowrap"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<a-badge v-if="text=='未付款'" slot="status" slot-scope="text" color="gray" :text="text"/>
<a-badge v-else-if="text=='已付款'" slot="status" slot-scope="text" color="green" :text="text"/>
<a-badge v-else-if="text=='已完成'" slot="status" slot-scope="text" color="green" :text="text"/>
<a-badge v-else-if="text=='退款中'" slot="status" slot-scope="text" color="red" :text="text"/>
<a-badge v-else-if="text=='已退款'" slot="status" slot-scope="text" color="green" :text="text"/>
<a-badge v-else-if="text=='已取消'" slot="status" slot-scope="text" color="blue" :text="text"/>
<span slot="action" slot-scope="text, record">
<a @click="handleShow(record)">详情</a>
<span v-if="record.status === 2" >
<a-divider type="vertical" />
<a-popconfirm title="确认退款吗?" @confirm="() => reviewRefund(record.id)">
<a-icon type="safety-certificate"/>
<a>审核</a>
</a-popconfirm>
</span>
<!--<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>-->
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<order-modal ref="modalForm" @ok="modalFormOk"></order-modal>
</a-card>
</template>
<script>
import { filterObj } from '@/utils/util';
import '@/assets/less/TableExpand.less'
import OrderModal from './modules/OrderModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@/api/manage'
import { putAction } from '@/api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
export default {
name: "OrderList",
mixins:[JeecgListMixin],
components: {
OrderModal
},
data () {
return {
statusOptions:[
{
label:'全部', value:''
},
{
label:'未付款', value:'0'
},
{
label:'已付款', value:'1'
},
{
label:'退款中', value:'2'
},
{
label:'已退款', value:'3'
},
{
label:'已完成', value:'4'
},
{
label:'已取消', value:'5'
}
],
description: '订单管理页面',
// 表头
columns: [
{
title: '序号',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '订单号',
align:"center",
dataIndex: 'orderCode'
},
{
title: '用户帐号',
align:"center",
dataIndex: 'userName'
},
{
title: '订单状态',
align:"center",
dataIndex: 'status_dictText',
scopedSlots: { customRender: 'status' },
},
{
title: '下单时间',
align:"center",
dataIndex: 'createTime',
defaultSortOrder: '(a,b)',
sorter: (a,b)=>{
let aTimeString = a.createTime
let bTimeString = b.createTime
aTimeString = aTimeString.replace(/-/g,'/')
bTimeString = bTimeString.replace(/-/g,'/')
let aTime = new Date(aTimeString).getTime()
let bTime = new Date(bTimeString).getTime()
return aTime - bTime
}
},
{
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
}
],
url: {
list: "/order/list",
reviewRefund: "/order/reviewRefund",
delete: "/order/delete",
deleteBatch: "/order/deleteBatch",
exportXlsUrl: "order/exportXls",
importExcelUrl: "order/importExcel",
},
}
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
reviewRefund(id){
var param = {id:id}
putAction(this.url.reviewRefund,param).then((res)=>{
if(res.success){
this.$message.success("该用户此订单的退款审核已完成!")
this.loadData(1);
}
else{
this.$message.error("该用户此订单暂无退款审核业务!")
}
})
},
loadData(arg) {
if(!this.url.list){
this.$message.error("请设置url.list属性!")
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
var params = this.getQueryParams();//查询条件
this.loading = true;
console.log(params)
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource = res.result.records;
this.ipagination.total = res.result.total;
}
if(res.code===510){
this.$message.warning(res.message)
}
this.loading = false;
})
},
getQueryParams() {
//获取查询条件
let sqp = {}
if(this.superQueryParams){
sqp['superQueryParams']=encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
var param = Object.assign(sqp, this.queryParam);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
param.beginDate = this.beginDate;
param.finishDate = this.finishDate;
return filterObj(param);
},
getQueryField() {
var str = "id,";
this.columns.forEach(function (value) {
str += "," + value.dataIndex;
});
return str;
},
onDateChange(date, dateString) {
console.log(dateString[0])
console.log(dateString[1])
this.beginDate = dateString[0]
this.finishDate = dateString[1]
},
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
},
putAction(url,id){
return axios({
url: this.url.reviewRefund,
method:'put',
data: id
})
},
handleShow: function (record) {
this.$refs.modalForm.show(record);
this.$refs.modalForm.title = "订单详情";
this.$refs.modalForm.disableSubmit = true;
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
orderList.vue
最新推荐文章于 2023-11-15 00:13:08 发布