Commit efd32542 by lixiaomin

修改订单退款

parent 28ed854c
...@@ -51,3 +51,12 @@ export function getLogList(query) { ...@@ -51,3 +51,12 @@ export function getLogList(query) {
params: query, params: query,
}); });
} }
// 退款
export function refund(data) {
return request({
url: "/system/refund",
method: "post",
data: data,
});
}
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<el-table-column width="200" label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column width="200" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" v-if="authBtn(['3','4','5','6','13'], scope.row.state)" <el-button size="mini" type="text" v-if="authBtn(['3','4','5','6','13'], scope.row.state)"
@click="refund(scope.row.id)">退款</el-button> @click="refundClick(scope.row)">退款</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
@pagination="getList" /> @pagination="getList" />
<!-- 详情对话框 --> <!-- 详情对话框 -->
<el-dialog title="订单信息" :visible.sync="open" width="1000px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="订单信息" name="first"> <el-tab-pane label="订单信息" name="first">
<el-form ref="form" :model="form" label-width="80px"> <el-form ref="form" :model="form" label-width="80px">
...@@ -164,6 +164,16 @@ ...@@ -164,6 +164,16 @@
<el-table-column label="数量" align="center" prop="num" /> <el-table-column label="数量" align="center" prop="num" />
</el-table> </el-table>
</el-form> </el-form>
<div v-show="refundTag" style="margin-top: 20px;" >
<el-form ref="refundForm" :rules="rules" :model="refundForm" label-width="80px">
<el-form-item label="退款金额" prop="refundAmount">
<el-input v-model="refundForm.refundAmount" style="width:200px;" placeholder="请输入退款金额"/>
</el-form-item>
<el-form-item label="处理备注" prop="desc">
<el-input v-model="refundForm.desc" type="textarea" placeholder="请输入处理备注"/>
</el-form-item>
</el-form>
</div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="订单日志" name="second"> <el-tab-pane label="订单日志" name="second">
<el-table :data="logList"> <el-table :data="logList">
...@@ -174,9 +184,10 @@ ...@@ -174,9 +184,10 @@
<el-table-column label="内容" align="center" prop="content" /> <el-table-column label="内容" align="center" prop="content" />
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer" style="text-align: center;">
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button v-show="!refundTag" type="primary" @click="submitForm">确定</el-button>
<el-button v-show="refundTag" type="danger" @click="refundSubmit">退款</el-button>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -184,13 +195,30 @@ ...@@ -184,13 +195,30 @@
</template> </template>
<script> <script>
import { listOrder, getOrder,getLogList } from "@/api/system/order"; import { listOrder, getOrder,getLogList,refund } from "@/api/system/order";
import { listShop} from "@/api/system/shop"; import { listShop} from "@/api/system/shop";
import piovince from '@/utils/piovince'; import piovince from '@/utils/piovince';
export default { export default {
name: "Order", name: "Order",
data() { data() {
var validateRefundAmount = (rule, value, callback) => {
var regular=/(^[+]{0,1}([0-9]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1,2}$)/; //正数 ,小数可有可无,最多2位
if (value == undefined || value === '') {
callback(new Error('不能为空'));
}else if(!regular.test(value)){
callback(new Error('请输入大于0的正数,最多保留2位小数'));
}else if(this.amount){
if(value>this.amount){
callback(new Error('退款金额不能大于实付金额'));
}else {
callback();
}
}else {
callback();
}
};
return { return {
refundTag:false,
createdTime:[], createdTime:[],
payTime:[], payTime:[],
shopList:[ shopList:[
...@@ -249,13 +277,27 @@ export default { ...@@ -249,13 +277,27 @@ export default {
}, },
// 表单参数 // 表单参数
form: {}, form: {},
//退款表单
refundForm: {
refundAmount:"",
desc:"",
orderId:""
},
shopName: null, shopName: null,
city:null, city:null,
activeName:"first", activeName:"first",
goodsList:[], goodsList:[],
logList:[] , logList:[] ,
orderId:null orderId:null ,
amount: null,
rules: {
refundAmount: [
{ required: true,validator: validateRefundAmount, trigger: 'blur' }
],
desc: [
{ required: true, message: '请输入退款处理', trigger: 'blur' }
]
}
}; };
}, },
created() { created() {
...@@ -272,8 +314,30 @@ export default { ...@@ -272,8 +314,30 @@ export default {
} }
}, },
//退款 //退款
refund(id){ refundClick(row){
this.refundForm.refundAmount="";
this.refundForm.desc="";
this.refundTag=true;
this.title="退款处理";
this.open=true;
this.goodsList=[];
this.orderId= row.id;
this.amount=row.amount;
this.getOrderDetail(this.orderId);
},
//提交退款
refundSubmit(){
this.refundForm.orderId=this.orderId;
this.$refs["refundForm"].validate((valid) => {
if (valid) {
refund(this.refundForm).then(response => {
if(response.code="200"){
this.open=false;
this.getList();
}
});
}
});
}, },
getPicsList(str){ getPicsList(str){
let picObj = JSON.parse(str); let picObj = JSON.parse(str);
...@@ -379,8 +443,11 @@ export default { ...@@ -379,8 +443,11 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.refundTag=false;
this.goodsList=[]; this.goodsList=[];
this.orderId= row.id this.orderId= row.id;
this.title="订单信息";
this.open = true;
this.getOrderDetail(this.orderId); this.getOrderDetail(this.orderId);
}, },
getOrderDetail(id){ getOrderDetail(id){
...@@ -397,8 +464,7 @@ export default { ...@@ -397,8 +464,7 @@ export default {
"categoryName":list[i].goods.categoryName,"price":list[i].goods.price,"discount":list[i].goods.discount, "categoryName":list[i].goods.categoryName,"price":list[i].goods.price,"discount":list[i].goods.discount,
"realAmount":list[i].realAmount,"num":list[i].num}) "realAmount":list[i].realAmount,"num":list[i].num})
} }
} }
this.open = true;
} }
}); });
}, },
......
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