Commit 7574f58d by YG8999

订单退款功能及网关状态查询条件

parent 14c9f651
......@@ -31,6 +31,14 @@ export function listDuration(query) {
})
}
export function durationCoupon(query) {
return request({
url: '/system/coupon/list/durationCoupon',
method: 'get',
params: query
})
}
export function listGroup(query) {
return request({
url: '/system/coupon/list/group',
......
......@@ -60,3 +60,12 @@ export function repealOrder(data) {
data
})
}
// 退款操作
export function refund(data) {
return request({
url: '/system/order/refund',
method: 'post',
data: data
})
}
......@@ -28,6 +28,16 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择">
<el-option
v-for="dict in dict.type.device_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="设备ID" prop="devId">-->
<!-- <el-input-->
<!-- v-model="queryParams.devId"-->
......
......@@ -302,13 +302,13 @@
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column 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 v-if="scope.row.payStatus == 1 && scope.row.status != 3"
size="mini"
type="text"
icon="el-icon-edit"
@click="orderRefund(scope.row)"
v-hasPermi="['system:order:refund']"
>退款</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
......@@ -479,11 +479,113 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 订单退款对话框 -->
<el-dialog :title="refundTitle" :visible.sync="refundOpen" width="800px" append-to-body>
<el-form ref="refundForm" :model="refundForm" :rules="refundRules" label-width="120px">
<el-alert
title="1: 退款金额可修改,但不能大于实际付款金额"
type="error"
:closable="false"
show-icon>
</el-alert>
<el-divider></el-divider>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="订单号" prop="orderNo">
<el-input v-model="refundForm.orderNo" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="订单状态" prop="orderStatus">
<el-input v-model="refundForm.orderStatus" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="是否使用优惠券" prop="isUseCoupon">
<el-radio-group v-model="refundForm.isUseCoupon" :readonly="true">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="优惠券名称" prop="couponName">
<el-input v-model="refundForm.couponName" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="优惠券金额" prop="couponAmount">
<el-input v-model="refundForm.couponAmount" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="实际支付金额" prop="payAmount">
<el-input v-model="refundForm.payAmount" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="退款金额" prop="amount">
<el-input v-model="refundForm.amount" type="number"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="是否退券" prop="refundCoupon">
<el-radio-group v-model="refundForm.refundCoupon">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否生成保洁" prop="isClean">
<el-radio-group v-model="refundForm.isClean">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="退款原因" prop="refundReason">
<el-input v-model="refundForm.refundReason" type="textarea" :rows="3"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitRefundForm" > </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listOrder, getOrder, delOrder, addOrder, updateOrder,repealOrder } from "@/api/system/order";
import { listOrder, getOrder, delOrder, addOrder, updateOrder,repealOrder, refund } from "@/api/system/order";
import {allList} from "@/api/system/store";
import {queryRoom} from "@/api/system/room";
import {query} from "@/api/system/pack";
......@@ -579,7 +681,17 @@ export default {
remark: [
{required: true, message: "备注不能为空", trigger: "blur"}
]
}
},
refundTitle: "",
refundOpen: false,
// 表单参数
refundForm: {},
// 表单校验
refundRules: {
amount: [
{required: true, message: "退款金额不能为空", trigger: "blur"}
]
},
};
},
created() {
......@@ -675,6 +787,8 @@ export default {
this.repealOpen = false;
this.open = false;
this.reset();
this.refundOpen = false;
this.resetRefund();
},
// 表单重置
reset() {
......@@ -708,6 +822,20 @@ export default {
this.resetForm("form");
this.resetForm("repealForm");
},
resetRefund() {
this.refundForm = {
orderNo: null,
isUseCoupon: null,
couponName: null,
couponAmount: null,
payAmount: null,
amount: null,
refundCoupon: '0',
isClean: '0',
refundReason: null,
orderStatus: null
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
......@@ -780,6 +908,41 @@ export default {
this.download('system/order/export', {
...this.queryParams
}, `order_${new Date().getTime()}.xlsx`)
},
/** 退款按钮操作 */
orderRefund(row) {
this.resetRefund();
this.refundOpen = true;
this.refundTitle = "订单退款";
this.refundForm.orderNo = row.orderNo;
this.refundForm.orderStatus = this.orderStatusFormat(row.status);
this.refundForm.isUseCoupon = row.couponId ? '1' : '0';
if (row.couponId) {
let coupon = this.couponList.find(item => item.id === row.couponId);
this.refundForm.couponName = coupon.name;
this.refundForm.couponAmount = coupon.subPrice ? coupon.subPrice : row.couponPrice;
}
this.refundForm.payAmount = row.payPrice;
this.refundForm.amount = row.payPrice ? row.payPrice : 0;
this.refundForm.refundCoupon = '0';
this.refundForm.isClean = '0';
},
// 字典翻译
orderStatusFormat(value) {
return this.selectDictLabel(this.dict.type.order_status_admin, value);
},
/** 退款提交按钮操作 */
submitRefundForm() {
this.$refs["refundForm"].validate(valid => {
if (valid) {
refund(this.refundForm).then(response => {
this.$modal.msgSuccess("退款成功");
this.refundOpen = false;
this.getList();
});
}
})
}
}
};
......
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