Commit 75d572a1 by 吕明尚

初版订单换房功能

parent ca9ac818
......@@ -27,6 +27,22 @@ export function queryOrder(query) {
}
// 查询订单详细
export function changeRoomList(id) {
return request({
url: '/system/order/changeRoomList?id=' + id,
method: 'get'
})
}
export function changeRoom(data) {
return request({
url: '/system/order/changeRoom',
method: 'post',
data: data
})
}
export function getOrder(id) {
return request({
url: '/system/order/' + id,
......
......@@ -291,6 +291,14 @@
@click="orderRefund(scope.row)"
v-hasPermi="['system:order:refund']"
>退款</el-button>
<el-button v-if="scope.row.status ==0 || scope.row.status == 1"
v-hasPermi="['system:order:change']"
icon="el-icon-edit"
size="mini"
type="text"
@click="changeRoom(scope.row)"
>换房
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
......@@ -420,44 +428,109 @@
</div>
</el-dialog>
<!-- 订单作废对话框 -->
<el-dialog :title="title" :visible.sync="repealOpen" width="700px" append-to-body>
<el-form ref="repealForm" :model="repealForm" :rules="repealRules" label-width="150px">
<el-alert
title="1: 当前操作是作废订单,确认后,该订单不会继续进行"
type="error"
:closable="false"
show-icon>
</el-alert>
<el-alert
title="2:当选择是否作废优惠卷为是时,该订单使用的优惠卷会失效,
选择为否时,该优惠卷会更改为未使用,有重复使用优惠卷的可能"
type="error"
:closable="false"
show-icon>
</el-alert>
<el-alert
title="3:操作前请知晓上述风险"
type="error"
:closable="false"
show-icon>
</el-alert>
<el-checkbox :value="!modify" @change="ismodify">我已知晓</el-checkbox>
<el-form-item label="优惠券是否失效" prop="isReverseconsume">
<el-radio-group v-model="repealForm.isReverseconsume">
<el-radio
v-for="dict in statusList"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark" required>
<el-input v-model="repealForm.remark" placeholder="请输入备注"/>
</el-form-item>
<!-- 订单换房对话框 -->
<el-dialog :title="changeTitle" :visible.sync="changeOpen" append-to-body width="700px">
<el-form ref="changeForm" :model="changeForm" :rules="changeRules" label-width="150px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="订单号" prop="orderNo">
<el-input v-model="changeForm.orderNo" :readonly="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="门店名称" prop="storeName">
<el-input v-model="changeForm.storeName" :readonly="true"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="房间名称" prop="roomName">
<el-input v-model="changeForm.roomName" :readonly="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="会员手机号" prop="consumerPhone">
<el-input v-model="changeForm.consumerPhone" :readonly="true"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="会员昵称" prop="consumerName">
<el-input v-model="changeForm.consumerName" :readonly="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="预约开始时间" prop="preStartDate">
<el-input v-model="changeForm.preStartDate" :readonly="true">
<template slot-scope="scope">
<span>{{ parseTime(changeForm.preStartDate, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预约结束时间" prop="preEndDate">
<el-input v-model="changeForm.preEndDate" :readonly="true">
<template slot-scope="scope">
<span>{{ parseTime(changeForm.preEndDate, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="实际开始时间" prop="startDate">
<el-input v-model="changeForm.startDate" :readonly="true">
<template slot-scope="scope">
<span>{{ parseTime(changeForm.startDate, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实际结束时间" prop="endDate">
<el-input v-model="changeForm.endDate" :readonly="true">
<template slot-scope="scope">
<span>{{ parseTime(changeForm.endDate, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="是否生成保洁" prop="isClean">
<el-radio-group v-model="changeForm.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-col :span="12">
<el-form-item label="所属房间" prop="roomId">
<el-select v-model="changeForm.roomId" clearable placeholder="请选择所属房间">
<el-option
v-for="item in changeRoomList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormRepeal" :disabled=modify> </el-button>
<el-button type="primary" @click="submitChangeRoom"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
......@@ -567,11 +640,21 @@
</template>
<script>
import { listOrder, getOrder, delOrder, addOrder, updateOrder,repealOrder, refund } from "@/api/system/order";
import {
listOrder,
getOrder,
delOrder,
addOrder,
updateOrder,
repealOrder,
refund,
changeRoomList
} from "@/api/system/order";
import {allList} from "@/api/system/store";
import {queryRoom} from "@/api/system/room";
import {query} from "@/api/system/pack";
import {queryCouponList} from "@/api/system/consumerCoupon";
import {changeRoom} from "../../../api/system/order";
export default {
name: "Order",
......@@ -588,51 +671,60 @@ export default {
};
return {
columns: [
{ key: 0, label: `订单编号`, visible: false },
{ key: 1, label: `订单类型`, visible: true },
{ key: 2, label: `门店名称`, visible: true },
{ key: 3, label: `房间名称`, visible: true },
{ key: 4, label: `会员手机号`, visible: true },
{ key: 5, label: `会员昵称`, visible: true },
{ key: 6, label: `套餐名称`, visible: false },
{ key: 7, label: `套餐价格`, visible: false },
{ key: 8, label: `订单时长`, visible: true },
{ key: 9, label: `优惠卷类型`, visible: true },
{ key: 10, label: `优惠券id`, visible: false },
{ key: 11, label: `优惠券名称`, visible: true },
{ key: 12, label: `优惠券原价`, visible: false },
{ key: 13, label: `优惠券促销价`, visible: true },
{ key: 14, label: `订单总价`, visible: true },
{ key: 15, label: `实际支付金额`, visible: true },
{ key: 16, label: `支付时间`, visible: true },
{ key: 17, label: `预约开始时间`, visible: true },
{ key: 18, label: `预约结束时间`, visible: true },
{ key: 19, label: `开始时间`, visible: true },
{ key: 20, label: `结束时间`, visible: true },
{ key: 21, label: `到店时间`, visible: false },
{ key: 22, label: `订单状态`, visible: true },
{ key: 23, label: `下单时间`, visible: false },
{ key: 24, label: `备注`, visible: false }
{key: 0, label: `订单编号`, visible: false},
{key: 1, label: `订单类型`, visible: true},
{key: 2, label: `门店名称`, visible: true},
{key: 3, label: `房间名称`, visible: true},
{key: 4, label: `会员手机号`, visible: true},
{key: 5, label: `会员昵称`, visible: true},
{key: 6, label: `套餐名称`, visible: false},
{key: 7, label: `套餐价格`, visible: false},
{key: 8, label: `订单时长`, visible: true},
{key: 9, label: `优惠卷类型`, visible: true},
{key: 10, label: `优惠券id`, visible: false},
{key: 11, label: `优惠券名称`, visible: true},
{key: 12, label: `优惠券原价`, visible: false},
{key: 13, label: `优惠券促销价`, visible: true},
{key: 14, label: `订单总价`, visible: true},
{key: 15, label: `实际支付金额`, visible: true},
{key: 16, label: `支付时间`, visible: true},
{key: 17, label: `预约开始时间`, visible: true},
{key: 18, label: `预约结束时间`, visible: true},
{key: 19, label: `开始时间`, visible: true},
{key: 20, label: `结束时间`, visible: true},
{key: 21, label: `到店时间`, visible: false},
{key: 22, label: `订单状态`, visible: true},
{key: 23, label: `下单时间`, visible: false},
{key: 24, label: `备注`, visible: false}
],
repealOpen:false,
repealForm:{
orderNo:'',
isReverseconsume: 0,
remark:''
changeOpen: false,
changeForm: {
orderNo: '',
storeName: '',
roomName: '',
consumerPhone: '',
consumerName: '',
preStartDate: '',
preEndDate: '',
startDate: '',
endDate: '',
roomId: '',
isClean: '',
id: ''
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
id: null,
statusList:[
statusList: [
{
label:'是',
value:1
label: '是',
value: 1
},
{
label:'否',
value:0
label: '否',
value: 0
}
],
modify: true,
......@@ -641,6 +733,7 @@ export default {
packList: [],
couponList: [],
rooms: [],
changeRoomList: [],
// 非单个禁用
single: true,
// 非多个禁用
......@@ -663,6 +756,7 @@ export default {
orderList: [],
// 弹出层标题
title: "",
changeTitle: "订单换房",
// 是否显示弹出层
open: false,
dateValue: null,
......@@ -697,9 +791,9 @@ export default {
form: {},
// 表单校验
rules: {},
repealRules: {
remark: [
{required: true, message: "备注不能为空", trigger: "blur"}
changeRules: {
isClean: [
{required: true, message: "请选择是否生成保洁任务", trigger: "change"}
]
},
refundTitle: "",
......@@ -710,7 +804,7 @@ export default {
refundRules: {
amount: [
{required: true, message: "退款金额不能为空", trigger: "blur"},
{required: true, validator: equalToPayAmount, trigger: "blur" },
{required: true, validator: equalToPayAmount, trigger: "blur"},
{pattern: /^[0-9]+(\.[0-9]{0,2})?$/, message: "退款金额必须填写大于等于0的整数或两位以内的小数"},
],
refundCoupon: [
......@@ -731,19 +825,18 @@ export default {
this.onGetCouponList();
},
methods: {
onRepeal(){
onRepeal() {
let orderInfo = this.orderList.find(item => item.id === this.ids[0])
this.repealForm.orderNo = orderInfo.orderNo;
this.changeForm.orderNo = orderInfo.orderNo;
this.title = "订单作废"
this.repealOpen = true;
this.changeOpen = true;
},
submitFormRepeal(){
this.$refs["repealForm"].validate(valid => {
submitFormRepeal() {
this.$refs["changeForm"].validate(valid => {
if (valid) {
repealOrder(this.repealForm).then(res => {
repealOrder(this.changeForm).then(res => {
this.$modal.msgSuccess("操作成功");
this.repealOpen = false;
this.changeOpen = false;
this.open = false;
this.reset();
this.getList();
......@@ -751,17 +844,17 @@ export default {
}
});
},
onGetAllStoreList(){
onGetAllStoreList() {
allList().then(res => {
this.options = res.data
})
},
onGetCouponList(){
onGetCouponList() {
queryCouponList().then(res => {
this.couponList = res.data
})
},
onGetRoomList(){
onGetRoomList() {
queryRoom().then(res => {
this.roomList = res.data
})
......@@ -772,7 +865,7 @@ export default {
this.rooms = res.data.filter(item => item.storeId === id)
})
},
onGetPackList(){
onGetPackList() {
query().then(res => {
this.packList = res.data
})
......@@ -812,15 +905,17 @@ export default {
},
// 取消按钮
cancel() {
this.repealOpen = false;
this.changeOpen = false;
this.open = false;
this.reset();
this.refundOpen = false;
this.resetRefund();
this.changeReset();
this.changeRoomList = [];
},
// 表单重置
reset() {
this.repealForm.remark = '';
this.changeForm.remark = '';
this.modify = true;
this.form = {
id: null,
......@@ -848,7 +943,7 @@ export default {
preEndDate: null
};
this.resetForm("form");
this.resetForm("repealForm");
this.resetForm("changeForm");
},
resetRefund() {
this.refundForm = {
......@@ -864,14 +959,24 @@ export default {
orderStatus: null
}
},
changeReset() {
this.changeForm = {
orderNo: '',
storeName: '',
roomName: '',
consumerPhone: '',
consumerName: '',
preStartDate: '',
preEndDate: '',
roomId: '',
isClean: ''
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
ismodify(e) {
this.modify = !e;
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
......@@ -882,7 +987,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
......@@ -924,12 +1029,13 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除订单编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除订单编号为"' + ids + '"的数据项?').then(function () {
return delOrder(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
......@@ -957,6 +1063,30 @@ export default {
// this.refundForm.refundCoupon = '0';
// this.refundForm.isClean = '0';
},
changeRoom(row) {
this.changeOpen = true;
this.changeForm.orderNo = row.orderNo;
this.changeForm.storeName = row.storeName;
this.changeForm.roomName = row.roomName;
this.changeForm.consumerPhone = row.consumerPhone;
this.changeForm.consumerName = row.consumerName;
this.changeForm.preStartDate = row.preStartDate;
this.changeForm.preEndDate = row.preEndDate;
this.changeForm.startDate = row.startDate;
this.changeForm.endDate = row.endDate;
this.changeForm.id = row.id;
this.changeroomList(row);
},
changeroomList(row) {
changeRoomList(row.id).then(res => {
if (res.code === 500) {
this.$modal.msgError(res.msg);
} else {
this.changeRoomList = res.data
}
})
},
// 字典翻译
orderStatusFormat(value) {
return this.selectDictLabel(this.dict.type.order_status_admin, value);
......@@ -966,13 +1096,14 @@ export default {
let that = this;
this.$refs["refundForm"].validate(valid => {
if (valid) {
this.$modal.confirm('请您仔细核对退款数据,一旦退款成功,数据不可修改!').then(function() {
this.$modal.confirm('请您仔细核对退款数据,一旦退款成功,数据不可修改!').then(function () {
return refund(that.refundForm);
}).then(() => {
that.refundOpen = false;
that.getList();
that.$modal.msgSuccess("退款成功");
}).catch(() => {});
}).catch(() => {
});
// refund(this.refundForm).then(response => {
// this.$modal.msgSuccess("退款成功");
// this.refundOpen = false;
......@@ -980,7 +1111,27 @@ export default {
// });
}
})
},
submitChangeRoom() {
this.$refs["changeForm"].validate(valid => {
if (valid) {
changeRoom(this.changeForm).then(res => {
if (res.code === 200) {
this.$modal.msgSuccess("操作成功");
this.changeOpen = false;
this.open = false;
this.reset();
this.getList();
} else {
this.$modal.msgError(res.msg);
this.changeRoomList = [];
this.changeroomList(this.changeForm);
}
})
}
});
}
}
};
}
</script>
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