177 lines
4.8 KiB
Vue
177 lines
4.8 KiB
Vue
<template>
|
|
<el-card>
|
|
<el-row :gutter="20" class="header">
|
|
<el-col :span="7">
|
|
<el-input placeholder="请输入订单号..." clearable v-model="queryForm.orderNumber"></el-input>
|
|
</el-col>
|
|
<el-button type="button" :icon="Search" @click="initOrderList">搜索</el-button>
|
|
</el-row>
|
|
<el-table :data="tableData" stripe style="width: 100%" showOverflowTooltip>
|
|
<el-table-column prop="orderNumber" label="订单号" width="220" fixed/>
|
|
<el-table-column prop="userName" label="用户昵称" width="200"/>
|
|
<el-table-column prop="totalPrice" label="订单总价" width="100"/>
|
|
<el-table-column prop="paymentStatus" label="订单状态" width="100"/>
|
|
<el-table-column prop="createTime" label="订单创建日期" width="200"/>
|
|
<el-table-column prop="updateTime" label="订单支付日期" width="200"/>
|
|
<el-table-column prop="userName" label="收货人" width="80"/>
|
|
<el-table-column prop="phone" label="联系电话" width="150"/>
|
|
<el-table-column prop="notes" label="描述" width="400"/>
|
|
<!-- <el-table-column label="操作" width="300" fixed="right">-->
|
|
<!-- <template v-slot="scope">-->
|
|
<!-- <el-button type="success" @click="handleDialogValue(scope.row.id)">详情</el-button>-->
|
|
<!-- <el-button type="primary" @click="handleOrderStatus(scope.row.id,2)">发货</el-button>-->
|
|
<!-- <el-button type="primary" @click="handleOrderStatus(scope.row.id,3)">退货</el-button>-->
|
|
<!-- <el-button type="danger" :icon="Delete" @click="handleDelete(scope.row.id)"></el-button>-->
|
|
<!-- </template>-->
|
|
<!-- </el-table-column>-->
|
|
</el-table>
|
|
<el-pagination
|
|
v-model:currentPage="queryForm.current"
|
|
v-model:page-size="queryForm.pageSize"
|
|
:page-sizes="[10, 20, 30, 40,50]"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="total"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
/>
|
|
</el-card>
|
|
|
|
<Dialog v-model:="dialogVisible" :id="id"></Dialog>
|
|
</template>
|
|
<script setup>
|
|
import {Search,Delete} from '@element-plus/icons-vue'
|
|
import { ref} from 'vue'
|
|
import axios from "@/util/axios";
|
|
import Dialog from "@/views/order/dialog/index.vue";
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
const handleDelete=(id)=>{
|
|
ElMessageBox.confirm(
|
|
'您确认要删除这个订单记录吗吗?',
|
|
'系统提示',
|
|
{
|
|
confirmButtonText: '确认',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
}
|
|
)
|
|
.then(async () => {
|
|
let res=await axios.get("admin/delete/"+id)
|
|
if (res.data.code==0){
|
|
ElMessage({
|
|
type: 'success',
|
|
message: '删除成功',
|
|
})
|
|
initOrderList();
|
|
}else{
|
|
ElMessage({
|
|
type: 'error',
|
|
message: res.data.msg,
|
|
})
|
|
}
|
|
|
|
})
|
|
.catch(() => {
|
|
|
|
})
|
|
}
|
|
|
|
|
|
|
|
const handleOrderStatus=(id,status)=>{
|
|
ElMessageBox.confirm(
|
|
'您确认要更新这个订单状态吗?',
|
|
'系统提示',
|
|
{
|
|
confirmButtonText: '确认',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
}
|
|
)
|
|
.then(async () => {
|
|
let res=await axios.post("admin/updateStatus",{id:id,status:status})
|
|
if (res.data.code==0){
|
|
ElMessage({
|
|
type: 'success',
|
|
message: '执行成功',
|
|
})
|
|
initOrderList();
|
|
}else{
|
|
ElMessage({
|
|
type: 'error',
|
|
message: res.data.msg,
|
|
})
|
|
}
|
|
|
|
})
|
|
.catch(() => {
|
|
|
|
})
|
|
}
|
|
|
|
|
|
const dialogVisible=ref(false)
|
|
|
|
|
|
const handleDialogValue=(orderId)=>{
|
|
id.value=orderId;
|
|
dialogVisible.value=true;
|
|
}
|
|
|
|
const id=ref(-1);
|
|
|
|
|
|
const queryForm=ref({
|
|
orderNumber:'',
|
|
current:1,
|
|
pageSize:10
|
|
})
|
|
const total=ref(0)
|
|
const tableData =ref([])
|
|
const initOrderList=async()=>{
|
|
const res=await axios.post("orders/list/page",queryForm.value);
|
|
//console.log(res.data.data)
|
|
// const temp=[];
|
|
// temp.push(res.data.data)
|
|
// console.log(res.data.data)
|
|
if(res.data.data){
|
|
tableData.value=res.data.data.records;
|
|
total.value=Number(res.data.data.total);
|
|
}
|
|
else{
|
|
ElMessage.error(res.data.description);
|
|
}
|
|
}
|
|
initOrderList();
|
|
const handleSizeChange = (pageSize) => {
|
|
queryForm.value.current=1;
|
|
queryForm.value.pageSize=pageSize;
|
|
initOrderList();
|
|
}
|
|
const handleCurrentChange = (current) => {
|
|
queryForm.value.current=current;
|
|
initOrderList();
|
|
}
|
|
|
|
const statusFormatter=(row)=>{
|
|
switch (row.status){
|
|
case 1:
|
|
return "待支付";
|
|
case 2:
|
|
return "待发货";
|
|
case 3:
|
|
return "退款/退货";
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.header{
|
|
padding-bottom: 16px;
|
|
box-sizing: border-box;
|
|
}
|
|
.el-pagination{
|
|
padding-top: 15px;
|
|
box-sizing: border-box;
|
|
}
|
|
</style> |