Commit f68a1470 by lixiaomin

修改订单

parent 9f5ba20f
......@@ -42,3 +42,12 @@ export function delOrder(id) {
method: "delete",
});
}
// 查询订单日志列表
export function getLogList(query) {
return request({
url: "/system/log/list",
method: "get",
params: query,
});
}
......@@ -42,13 +42,26 @@
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="orderList">
<el-table-column label="订单编号" align="center" prop="orderNo" />
<el-table-column label="订单编号" align="center">
<template slot-scope="scope">
<a @click="handleUpdate(scope.row)" style="color: blue">{{ scope.row.orderNo }}</a>
</template>
</el-table-column>
<el-table-column label="顺序号" align="center" prop="orderNum" />
<el-table-column label="商品数量" align="center" prop="goodsNum" />
<el-table-column label="金额" align="center" prop="amount" />
<el-table-column label="城市" align="center" prop="shop.city" />
<el-table-column label="城市" align="center" >
<template slot-scope="scope">
{{getProvince(scope.row.shop.city)}}
</template>
</el-table-column>
<el-table-column label="店铺" align="center" prop="shop.name" />
<el-table-column label="订单来源" align="center" prop="source" />
<el-table-column label="订单来源" align="center" prop="source">
<template slot-scope="scope">
<span v-if="scope.row.source=='3'">小程序</span>
<span v-if="scope.row.source=='12'">点单屏</span>
</template>
</el-table-column>
<el-table-column label="用户名称" align="center" prop="userName" />
<el-table-column label="创建时间" align="center" prop="createdAt"/>
<el-table-column label="付款时间" align="center" prop="payTime"/>
......@@ -57,17 +70,18 @@
</el-table-column>
<el-table-column width="200" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:order:edit']">修改</el-button>
<el-button size="mini" type="text" v-if="authBtn(['3','4','5','6','13'], scope.row.state)"
@click="refund(scope.row.id)">退款</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 详情对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-dialog title="订单信息" :visible.sync="open" width="1000px" append-to-body>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="订单信息" name="first">
<el-form ref="form" :model="form" label-width="80px">
<el-row>
<el-col :span="8">
......@@ -89,12 +103,12 @@
<el-row>
<el-col :span="8">
<el-form-item label="城市" >
<el-input disabled/>
<el-input v-model="form.city" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="店铺" >
<el-input disabled/>
<el-input v-model="form.shopName" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
......@@ -137,7 +151,35 @@
</el-form-item>
</el-col>
</el-row>
<el-table v-loading="loading" :data="goodsList">
<el-table-column label="商品名称" align="center" prop="goodsName" />
<el-table-column label="缩略图" align="center">
<template slot-scope="scope">
<div class="image-tmp">
<el-image style="width: 100px; height: 100px" :src="getPicsList(scope.row.pics)" :preview-src-list="getPicsBigList(scope.row.pics)">
<div slot="error" class="image-slot"></div>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column label="商品分类" align="center" prop="categoryName" />
<el-table-column label="原售价" align="center" prop="price" />
<el-table-column label="折扣价" align="center" prop="discount" />
<el-table-column label="实付" align="center" prop="realAmount" />
<el-table-column label="数量" align="center" prop="num" />
</el-table>
</el-form>
</el-tab-pane>
<el-tab-pane label="订单日志" name="second">
<el-table v-loading="loading" :data="logList">
<el-table-column label="状态" align="center" prop="status" />
<el-table-column label="操作" align="center" prop="operation" />
<el-table-column label="时间" align="center" prop="createAt" />
<el-table-column label="操作人" align="center" prop="operationUser" />
<el-table-column label="内容" align="center" prop="content" />
</el-table>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
......@@ -147,12 +189,13 @@
</template>
<script>
import { listOrder, getOrder } from "@/api/system/order";
import { listOrder, getOrder,getLogList } from "@/api/system/order";
import piovince from '@/utils/piovince';
export default {
name: "Order",
data() {
return {
piovince,
// 遮罩层
loading: true,
// 选中数组
......@@ -193,7 +236,13 @@ export default {
updatedAt: null
},
// 表单参数
form: {}
form: {},
shopName: null,
city:null,
activeName:"first",
goodsList:[],
logList:[] ,
orderId:null
};
},
......@@ -201,6 +250,35 @@ export default {
this.getList();
},
methods: {
getProvince(province){
let list=this.piovince;
for(let i=0;i<list.length;i++){
if(list[i].value == province){
return list[i].name;
}
}
},
//退款
refund(id){
},
getPicsList(str){
let picObj = JSON.parse(str);
return picObj.thumbnail
},
getPicsBigList(str){
let list=[];
let picObj = JSON.parse(str);
list.push(picObj.thumbnail)
return list;
},
handleClick(tab) {
if(tab.name=="first"){
this.getOrderDetail(this.orderId);
}else if(tab.name=="second"){
this.getLogList();
}
},
formatterState(state){
if(state == 0){
return "创建未校验";
......@@ -213,7 +291,7 @@ export default {
}else if(state == 4){
return "制作完成未取";
}else if(state == 5){
return "待取超时";
return "取餐中";
}else if(state == 6){
return "正常完成";
}else if(state == 7){
......@@ -226,10 +304,10 @@ export default {
return "制作完成取消";
}else if(state == 11){
return "已退款";
}else if(state == 11){
return "已退款";
}else if(state == 12){
return "部分退款";
}else if(state == 13){
return "待取超时";
}else if(state == 50){
return "其他人工干预状态";
}
......@@ -243,10 +321,26 @@ export default {
this.loading = false;
});
},
/** 查询订单日志列表 */
getLogList() {
this.loading = true;
getLogList({orderId:this.orderId}).then(response => {
if(response.code=="200"){
this.logList = response.data;
this.loading = false;
}
});
},
// 取消按钮
cancel() {
this.activeName="first";
this.open = false;
},
/** 提交按钮 */
submitForm() {
this.open=false;
this.activeName="first"
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
......@@ -257,21 +351,31 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
/** 修改按钮操作 */
/** 详情按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
this.goodsList=[];
this.orderId= row.id
this.getOrderDetail(this.orderId);
},
getOrderDetail(id){
getOrder(id).then(response => {
if(response.code=="200"){
this.form = response.data;
this.form.shopName=response.data.shop.name;
this.form.state=this.formatterState(response.data.state);
this.form.city=this.getProvince(response.data.shop.city);
if(response.data.orderDetails.length>0){
let list=response.data.orderDetails;
for(let i=0;i<list.length;i++){
this.goodsList.push({"goodsName":list[i].goods.name,"pics":list[i].goods.pics,
"categoryName":list[i].goods.categoryName,"price":list[i].goods.price,"discount":list[i].goods.discount,
"realAmount":list[i].realAmount,"num":list[i].num})
}
}
this.open = true;
this.title = "订单信息";
}
});
},
/** 提交按钮 */
submitForm() {
this.open=false;
},
/** 导出按钮操作 */
handleExport() {
this.download('system/order/export', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment