Commit 9fded566 authored by 黄奎's avatar 黄奎

页面修改

parent 066cb77d
<template>
<q-dialog v-model="dialog" maximized full-height seamless position="right">
<q-dialog v-model="IsShowEditOrder" maximized full-height seamless position="right">
<q-card style="margin-top:61px;width:500px" class="no-border-radius classinfo_Dialog">
<div class="drawerTop">
<div style="display:flex;align-items:center;margin:20px 0 0 20px;">
......@@ -11,18 +11,18 @@
@input="peopleNumber" class="col-12" label="人数" :rules="[val => !!val || '请填写人数']" />
<q-input filled stack-label :dense="false" v-model="OrderMsg.Unit_Price" :disable="UPrice==true?false:true"
@blur="priceNumber" class="col-12" label="成交单价" :rules="[val => !!val || '请填成交单价']" />
<q-toggle v-model="UPrice" label="高于定价收生" class="q-mb-md" @change="resetSearch" />
<q-toggle v-model="UPrice" label="高于定价收生" class="q-mb-md" /> <!-- @change="resetSearch"-->
<q-select standout="bg-primary text-white" option-value="Id" option-label="Name" v-model="OrderMsg.OrderSource"
:options="SourceEnumList" emit-value map-options label="客人来源" />
<q-input filled stack-label :dense="false" v-model="OrderMsg.SaleRemark" style="margin-top: 20px"
type="textarea" class="col-12" label="备注" />
<div style="margin:30px 10px 0 0;">
<q-btn class="q-mr-md" label="取消" @click="dialog=false" />
<q-btn color="accent" class="q-mr-md" label="保存" @click="saveSatMsg()" />
<q-btn class="q-mr-md" label="取消" @click="closeEditOrder" />
<q-btn color="accent" class="q-mr-md" label="保存" @click="saveOrderInfo()" />
</div>
</div>
</q-card>
<div class="dialog-out-close" @click="dialog=false"
<div class="dialog-out-close" @click="closeEditOrder"
style="height:40px !important;border-top-left-radius: 4px !important;border-bottom-left-radius: 4px !important;">
<q-icon name="iconfont icon-jujue1" size="26px" />
</div>
......@@ -31,9 +31,11 @@
<script>
import {
getClassOrderInfo, //获取订单操作日志列表
getOrderSourceEnumList, //获取订单来源 枚举
setClassOrder, //修改订单
} from '../../api/sale/sale'
export default {
name: "editorder-form",
name: "editOrder-form",
props: {
saveObj: {
type: Object,
......@@ -42,8 +44,7 @@
},
data() {
return {
dialog: true,
tab: '1',
IsShowEditOrder: true,
OrderMsg: {
ClassId: 0, //班级编号
GuestNum: 0, //人数
......@@ -53,18 +54,38 @@
SaleRemark: "",
Class_Price: 0,
},
UPrice: false,
StepPriceList: [],
UnitPrice: 0,
SourceEnumList: [], //订单来源
}
},
created() {
this.getOrderSEList();
},
mounted() {
this.getOrderInfo();
},
methods: {
//关闭弹窗
closeEditOrder() {
this.IsShowEditOrder = false;
this.$emit('close')
},
//获取订单来源
getOrderSEList() {
getOrderSourceEnumList({}).then(res => {
if (res.Code == 1) {
var tempArray = res.Data;
this.SourceEnumList = tempArray;
this.OrderMsg.OrderSource = tempArray[0].Id;
}
})
},
//获取订单信息
getOrderInfo() {
getClassOrderInfo({
OrderId: saveObj.OrderId
OrderId: this.saveObj.OrderId
}).then(res => {
if (res.Code == 1) {
this.OrderMsg.ClassId = res.Data.OrderInfo.ClassId;
......@@ -74,12 +95,93 @@
this.OrderMsg.OrderSource = res.Data.OrderInfo.OrderSource;
this.OrderMsg.SaleRemark = res.Data.OrderInfo.SaleRemark;
this.OrderMsg.Class_Price = res.Data.OrderInfo.Class_Price;
this.UnitPrice = this.OrderMsg.Unit_Price
this.UnitPrice = this.OrderMsg.Unit_Price;
this.StepPriceList = res.Data.StepPriceList;
this.dialog = true
this.IsShowEditOrder = true;
}
})
}
},
//人数改变
peopleNumber(val) {
if (val == '') {
this.OrderMsg.GuestNum = 1
}
this.OrderMsg.Unit_Price = this.countPrice(this.OrderMsg.GuestNum)
this.$forceUpdate()
this.UnitPrice = this.OrderMsg.Unit_Price
},
priceNumber(val) { //大于的时候赋值
if (this.OrderMsg.Unit_Price < this.UnitPrice) {
this.OrderMsg.Unit_Price = this.UnitPrice
}
},
//计算价格
countPrice(num) {
let array = [];
if (this.StepPriceList && this.StepPriceList.length) {
this.StepPriceList.forEach(x => {
let obj = {
PersionNum: x.PersionNum,
PersionPrice: x.PersionPrice,
}
array.push(obj)
})
let fz = false
let a = 0;
array.forEach(x => {
if (x.PersionNum == num) {
fz = true;
a = x.PersionPrice
}
})
if (fz == false) {
array.push({
PersionNum: num
})
array.sort(this.getSortFun('asc', 'PersionNum')); //升序排序
var idx;
for (var i = 0; i < array.length; i++) {
if (array[i].PersionNum == num) {
idx = i;
}
}
idx = Math.max(0, idx - 1);
if (array[idx].PersionPrice) {
return array[idx].PersionPrice;
} else {
return this.OrderMsg.Class_Price;
}
} else {
return a;
}
} else {
return this.OrderMsg.Class_Price;
}
},
//修改订单
saveOrderInfo() {
this.OrderMsg.PreferPrice = this.OrderMsg.GuestNum * this.OrderMsg.Unit_Price
setClassOrder(this.OrderMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '修改成功!',
position: 'top'
})
//调用父页面成功方法
this.$emit('success');
this.IsShowEditOrder = false
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: res.Message
})
}
}).catch(() => {})
},
}
}
......
......@@ -214,7 +214,8 @@
<!--取消订单-->
</table>
<!--修改订单-->
<editorder-form v-if="isShowEditOrderForm" :save-obj="orderObj" @close="closeMOSaveForm"></editorder-form>
<editorder-form v-if="isShowEditOrderForm" :save-obj="orderObj" @close="closeMOSaveForm"
@success="refreshClassOrder"></editorder-form>
</div>
</template>
......@@ -258,6 +259,12 @@
editOrder(item) {
this.orderObj = item;
this.isShowEditOrderForm = true;
},
//刷新页面
refreshClassOrder() {
this.isShowEditOrderForm = false;
//调用父页面成功方法
this.$emit('success');
}
}
}
......
......@@ -27,7 +27,7 @@
</div>
</div>
<div class="page-content">
<orderlist :dataList="dataList" :cancelList="CancelList" ></orderlist>
<orderlist :dataList="dataList" :cancelList="CancelList" @success="refreshClassOrder"></orderlist>
</div>
</div>
</template>
......@@ -80,9 +80,14 @@
this.loading = false
})
},
//刷新页面
refreshClassOrder() {
this.getList();
}
}
}
</script>
<style>
</style>
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