|
|
@@ -1,15 +1,16 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <a-table :columns="columns" :data-source="data" :pagination="false" :loading="loading">
|
|
|
+ <div >
|
|
|
+ <a-table :columns="columns" :data-source="data" :pagination="false" :loading="loading">
|
|
|
<span slot="prepay" slot-scope="text, record, index">
|
|
|
- <a-switch checked-children="是" un-checked-children="否" :checked="record.prepay" @change="changePrepay(record)"/>
|
|
|
- </span>
|
|
|
- <span slot="isVip" slot-scope="text, record, index">
|
|
|
+ <a-switch checked-children="是" un-checked-children="否" :checked="record.prepay"
|
|
|
+ @change="changePrepay(record)" />
|
|
|
+ </span>
|
|
|
+ <span slot="isVip" slot-scope="text, record, index">
|
|
|
<a-switch checked-children="是" un-checked-children="否" :checked="record.isVip" />
|
|
|
- </span>
|
|
|
- <span slot="action" slot-scope="text, record">
|
|
|
+ </span>
|
|
|
+ <span slot="action" slot-scope="text, record">
|
|
|
<a @click="handleEdit(record)">编辑</a>
|
|
|
-
|
|
|
+
|
|
|
<a-divider type="vertical" />
|
|
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
|
|
<a>删除</a>
|
|
|
@@ -17,48 +18,89 @@
|
|
|
</span>
|
|
|
</a-table>
|
|
|
<a-form-model layout="inline" ref="form" :model="model" :rules="validatorRules" slot="detail">
|
|
|
- <a-form-model-item label="价格名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
|
|
|
- <a-input v-model="model.name" placeholder="请输入房价名称"></a-input>
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="原价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oprice">
|
|
|
- <a-input-number style="width:100%;" v-model="model.oprice" :min="1" placeholder="请填写原价"/>
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="现价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price">
|
|
|
- <a-input-number style="width:100%;" v-model="model.oprice" :min="1" placeholder="请填写现价"/>
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="预付" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="prepay">
|
|
|
- <a-radio-group v-model="model.prepay">
|
|
|
- <a-radio :value="1">
|
|
|
- 是
|
|
|
- </a-radio>
|
|
|
- <a-radio :value="0">
|
|
|
- 否
|
|
|
- </a-radio>
|
|
|
- </a-radio-group>
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="积分" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="integral">
|
|
|
- <a-input-number style="width:100%;" v-model="model.integral" placeholder="请填写积分"/>
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
|
|
|
- <a-input-number style="width:100%;" v-model="model.num" placeholder="请填写数量"/>
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="会员折扣" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isVip">
|
|
|
- <a-radio-group v-model="model.isVip">
|
|
|
- <a-radio :value="1">
|
|
|
- 是
|
|
|
- </a-radio>
|
|
|
- <a-radio :value="0">
|
|
|
- 否
|
|
|
- </a-radio>
|
|
|
- </a-radio-group>
|
|
|
- </a-form-model-item>
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="3">
|
|
|
+ <a-form-model-item label="价格名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
|
|
|
+ <a-input v-model="model.name" placeholder="请输入房价名称"></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="3">
|
|
|
+ <a-form-model-item label="原价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oprice">
|
|
|
+ <a-input-number style="width:100%;" v-model="model.oprice" :min="1" placeholder="请填写原价" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="3">
|
|
|
+ <a-form-model-item label="现价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price">
|
|
|
+ <a-input-number style="width:100%;" v-model="model.price" :min="1" placeholder="请填写现价" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="3">
|
|
|
+ <a-form-model-item label="预付" prop="prepay">
|
|
|
+ <a-radio-group v-model="model.prepay">
|
|
|
+ <a-radio-button :value="1">
|
|
|
+ 是
|
|
|
+ </a-radio-button>
|
|
|
+ <a-radio-button :value="0">
|
|
|
+ 否
|
|
|
+ </a-radio-button>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="3">
|
|
|
+ <a-form-model-item label="积分" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="integral">
|
|
|
+ <a-input-number style="width:100%;" v-model="model.integral" placeholder="请填写积分" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="3">
|
|
|
+ <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
|
|
|
+ <a-input-number style="width:100%;" v-model="model.num" placeholder="请填写数量" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="3">
|
|
|
+ <a-form-model-item label="会员折扣" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isVip">
|
|
|
+ <a-radio-group v-model="model.isVip" @change="onVipChange">
|
|
|
+ <a-radio-button :value="1">
|
|
|
+ 是
|
|
|
+ </a-radio-button>
|
|
|
+ <a-radio-button :value="0">
|
|
|
+ 否
|
|
|
+ </a-radio-button>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="1">
|
|
|
+ <a-button @click="submitForm" type="primary">保存</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
</a-form-model>
|
|
|
+
|
|
|
+ <div class="vip-config" v-if="model.isVip">
|
|
|
+ <div class="config-heads h-title">
|
|
|
+ <div class="head-item">会员等级</div>
|
|
|
+ <div class="head-item">原价</div>
|
|
|
+ <div class="head-item">折扣(%)</div>
|
|
|
+ <div class="head-item">现价</div>
|
|
|
+ </div>
|
|
|
+ <div class="config-heads" v-for="item in vipLevels" :key="item.id">
|
|
|
+ <div class="head-item">[{{ item.name }}]</div>
|
|
|
+ <div class="head-item">
|
|
|
+ <a-input-number style="width:80%;" v-model="model.oprice" :min="0" placeholder="请填写原价" @change="vipOpriceChange($event, item)"/>
|
|
|
+ </div>
|
|
|
+ <div class="head-item">
|
|
|
+ <a-input-number style="width:80%;" v-model="item.discount" :min="0" placeholder="请填写折扣" @change="vipDiscountChange($event, item)"/>
|
|
|
+ </div>
|
|
|
+ <div class="head-item">
|
|
|
+ <a-input-number style="width:80%;" :value="item.price" :min="0" placeholder="请填写现价" @change="vipPriceChange($event, item)"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { list } from '@/api/roomLayoutPrice'
|
|
|
-
|
|
|
+import { httpAction, getAction } from "@/api/manage";
|
|
|
+import * as api from '@/api/api'
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '房价名称',
|
|
|
@@ -92,7 +134,7 @@ const columns = [
|
|
|
key: 'num',
|
|
|
},
|
|
|
{
|
|
|
- title:'使用会员折扣',
|
|
|
+ title: '使用会员折扣',
|
|
|
dataIndex: 'isVip',
|
|
|
key: 'isVip',
|
|
|
scopedSlots: { customRender: 'isVip' },
|
|
|
@@ -112,11 +154,11 @@ export default {
|
|
|
return {
|
|
|
labelCol: {
|
|
|
xs: { span: 24 },
|
|
|
- sm: { span: 8 },
|
|
|
+ sm: { span: 10 },
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
xs: { span: 24 },
|
|
|
- sm: { span: 16 },
|
|
|
+ sm: { span: 14 },
|
|
|
},
|
|
|
loading: false,
|
|
|
data: [],
|
|
|
@@ -138,17 +180,68 @@ export default {
|
|
|
prepay: 0,
|
|
|
integral: 0,
|
|
|
num: 0,
|
|
|
- }
|
|
|
+ isVip: 0
|
|
|
+ },
|
|
|
+ vipLevels: [],
|
|
|
+ origiVipLevels: []
|
|
|
};
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
this.getData()
|
|
|
+ this.getVipLevels()
|
|
|
},
|
|
|
-
|
|
|
methods: {
|
|
|
+ vipPriceChange(e, item) {
|
|
|
+ if(this.model.oprice) {
|
|
|
+ item.discount = ((e / this.model.oprice) * 100).toFixed(2)
|
|
|
+ }
|
|
|
+ item.price = e
|
|
|
+ },
|
|
|
+ vipDiscountChange(e, item) {
|
|
|
+ if(this.model.oprice) {
|
|
|
+ item.price = (this.model.oprice * (e/100)).toFixed(2)
|
|
|
+ }
|
|
|
+ item.discount = e
|
|
|
+ },
|
|
|
+ vipOpriceChange(e, item) {
|
|
|
+ if(item.discount) {
|
|
|
+ item.price = (this.model.oprice * (item.discount/100)).toFixed(2)
|
|
|
+ }
|
|
|
+ this.model.oprice = e
|
|
|
+ },
|
|
|
+ getVipLevels() {
|
|
|
+ api.getVipLevels({
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ hotelId: hotelItem.id
|
|
|
+ }).then(res => {
|
|
|
+ if(res.result && res.result.records) {
|
|
|
+
|
|
|
+ res.result.records.forEach(s=>{
|
|
|
+ s['price'] = 0
|
|
|
+ if(!s.discount) {
|
|
|
+ s.discount = 100
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.origiVipLevels = res.result.records
|
|
|
+ this.vipLevels = JSON.parse(JSON.stringify(res.result.records))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
changePrepay(record) {
|
|
|
-
|
|
|
+
|
|
|
+ },
|
|
|
+ onVipChange(e) {
|
|
|
+ if(this.model.isVip) {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleEdit(record) {
|
|
|
+ let cpData = JSON.parse(JSON.stringify(record))
|
|
|
+ cpData.isVip = record.isVip? 1 : 0
|
|
|
+ cpData.prepay = record.prepay? 1 : 0
|
|
|
+ this.model = cpData
|
|
|
},
|
|
|
getData() {
|
|
|
this.loading = true
|
|
|
@@ -158,22 +251,70 @@ export default {
|
|
|
roomLayoutId: this.layoutId,
|
|
|
pageNo: 1,
|
|
|
pageSize: 999
|
|
|
- }).then(res=>{
|
|
|
+ }).then(res => {
|
|
|
this.loading = false
|
|
|
console.log(res)
|
|
|
this.data = res.result.records
|
|
|
- }).catch(res=>{
|
|
|
+ }).catch(res => {
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
|
handleDelete(id) {
|
|
|
|
|
|
- }
|
|
|
+ },
|
|
|
+ submitForm() {
|
|
|
+ const that = this;
|
|
|
+ // 触发表单验证
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ that.confirmLoading = true;
|
|
|
+ let httpurl = "";
|
|
|
+ let method = "";
|
|
|
+ // if (!this.model.id) {
|
|
|
+ // httpurl += this.url.add;
|
|
|
+ // method = "post";
|
|
|
+ // } else {
|
|
|
+ // httpurl += this.url.edit;
|
|
|
+ // method = "put";
|
|
|
+ // }
|
|
|
+ // if (this.model.payFlag == 0) {
|
|
|
+ // this.model.payAmount = 0;
|
|
|
+ // }
|
|
|
+ // httpAction(httpurl, this.model, method)
|
|
|
+ // .then((res) => {
|
|
|
+ // if (res.success) {
|
|
|
+ // that.$message.success(res.message);
|
|
|
+ // that.$emit("ok");
|
|
|
+ // } else {
|
|
|
+ // that.$message.warning(res.message);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .finally(() => {
|
|
|
+ // that.confirmLoading = false;
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="stylus" scoped>
|
|
|
-
|
|
|
+<style lang="css" scoped>
|
|
|
+.vip-config{
|
|
|
+ width: 30%;
|
|
|
+ height: 200px;
|
|
|
+ overflow-y: auto;
|
|
|
+ margin-top: 20px;
|
|
|
+}
|
|
|
+.config-heads{
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+.config-heads .head-item{
|
|
|
+ flex: 1;
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+.h-title{
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
</style>
|