gqx 2 years ago
parent
commit
25e66cd211

+ 99 - 0
src/views/room/modules/checkIn/EditBatchRoomPriceForm.vue

@@ -0,0 +1,99 @@
+<template>
+  <a-card :bordered="false">
+    <div>
+      <a-list
+        :grid="{ gutter: 0, column: 6 }"
+        :data-source="model.livingDayPrices"
+      >
+        <a-list-item slot="renderItem" slot-scope="item, index">
+          <a-card title="价格">
+            <p>{{ item.dayTime }}</p>
+            <p>
+              <a-input-number
+                :disabled="item.dayTime < currentDate"
+                v-model="item.price"
+                placeholder="价格"
+                :min="0"
+              ></a-input-number>
+            </p>
+          </a-card>
+        </a-list-item>
+      </a-list>
+    </div>
+  </a-card>
+</template>
+
+<script>
+import { httpAction, getAction, postAction } from "@/api/manage";
+import { validateDuplicateValue } from "@/utils/util";
+import moment from "moment";
+export default {
+  name: "BusMemberCardForm",
+  components: {},
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false,
+    },
+  },
+  data() {
+    return {
+      currentDate: moment(new Date()).format("YYYY-MM-DD"),
+      model: { livingDayPrices: [] },
+      url: {
+        add: "/business/busRoomBookingOrders/booking-to-live",
+        edit: "/business/busMemberCard/edit",
+        queryById: "/business/busMemberCard/queryById",
+      },
+      gradeList: [],
+      paymentMethodList: [],
+      staffList: [],
+      customerList: [],
+      oldcustomerList: [],
+      hourRoomRuleList: [],
+    };
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled;
+    },
+  },
+  created() {
+    var _info = JSON.parse(localStorage.getItem("storeInfo"));
+    if (_info) {
+      this.model.hotelId = _info.id;
+    }
+    //备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model));
+  },
+  methods: {
+    moment,
+    add(livingOrderId, roomId) {
+      this.modelDefault.livingOrderId = livingOrderId;
+      this.modelDefault.roomId = roomId;
+      this.edit(this.modelDefault);
+    },
+    edit(record) {
+      this.model = Object.assign({}, record);
+      this.visible = true;
+    },
+    submitForm() {
+      this.$emit("ok", this.model.livingDayPrices);
+    },
+  },
+};
+</script>
+
+<style scoped>
+/deep/ .ant-card-head {
+  text-align: center;
+  background: #f0f0f0;
+  height: 28px !important;
+}
+/deep/ .ant-card-body {
+  padding: 2px !important;
+  text-align: center;
+}
+</style>

+ 64 - 0
src/views/room/modules/checkIn/EditBatchRoomPriceModal.vue

@@ -0,0 +1,64 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
+    @cancel="handleCancel"
+    cancelText="关闭"
+  >
+    <bus-member-card-form
+      ref="realForm"
+      @ok="submitCallback"
+      :disabled="disableSubmit"
+    ></bus-member-card-form>
+  </j-modal>
+</template>
+
+<script>
+import BusMemberCardForm from "./EditBatchRoomPriceForm";
+export default {
+  name: "BusMemberCardModal",
+  components: {
+    BusMemberCardForm,
+  },
+  data() {
+    return {
+      title: "",
+      width: 800,
+      visible: false,
+      disableSubmit: false,
+    };
+  },
+  methods: {
+    add(livingOrderId, roomId) {
+      this.visible = true;
+      this.$nextTick(() => {
+        this.$refs.realForm.add(livingOrderId, roomId);
+      });
+    },
+    edit(record) {
+      this.visible = true;
+      this.$nextTick(() => {
+        this.$refs.realForm.edit(record);
+      });
+    },
+    close() {
+      this.$emit("close");
+      this.visible = false;
+    },
+    handleOk() {
+      this.$refs.realForm.submitForm();
+    },
+    submitCallback(e) {
+      this.$emit("ok", e);
+      this.visible = false;
+    },
+    handleCancel() {
+      this.close();
+    },
+  },
+};
+</script>

+ 271 - 0
src/views/room/modules/checkIn/EditBookingTypeForm.vue

@@ -0,0 +1,271 @@
+<template>
+  <a-spin :spinning="confirmLoading">
+    <j-form-container :disabled="formDisabled">
+      <a-form-model
+        ref="form"
+        :model="model"
+        :rules="validatorRules"
+        slot="detail"
+      >
+        <a-row>
+          <a-col :span="24">
+            <a-form-model-item
+              label="房间总价"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              {{ sumPrice
+              }}<a-icon
+                @click="editBatchRoomPrice()"
+                type="edit"
+                style="color: rgba(255, 141, 26, 1); font-size: 18px"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="入住类型"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="liveType"
+            >
+              <a-select
+                placeholder="入住类型"
+                v-model="model.liveType"
+                @change="bookingTypeChange"
+              >
+                <a-select-option :value="1"> 全天 </a-select-option>
+                <a-select-option :value="2"> 钟点 </a-select-option>
+              </a-select>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24" v-if="model.liveType == 2">
+            <a-form-model-item
+              label="时长"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="fangAnId"
+            >
+              <a-select
+                placeholder="时长"
+                v-model="model.fangAnId"
+                @change="hourRoomIdChange"
+              >
+                <a-select-option
+                  :value="item.id"
+                  v-for="(item, index) in hourRoomRuleList"
+                  :key="item.id"
+                >
+                  {{ item.hourRoomName }}
+                </a-select-option>
+              </a-select>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </j-form-container>
+    <edit-batch-room-price-modal
+      ref="modalEditBatchRoomPriceModal"
+      @ok="modalFormOk"
+    ></edit-batch-room-price-modal>
+  </a-spin>
+</template>
+
+<script>
+import moment from "moment";
+import { httpAction, getAction, postAction } from "@/api/manage";
+import { validateDuplicateValue } from "@/utils/util";
+import EditBatchRoomPriceModal from "./EditBatchRoomPriceModal.vue";
+export default {
+  name: "BusMemberCardForm",
+  components: { EditBatchRoomPriceModal },
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false,
+    },
+  },
+  data() {
+    return {
+      model: { payType: 1, livingOrderId: "", certType: 1, gender: 1 },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+      confirmLoading: false,
+      validatorRules: {
+        mobile: [
+          {
+            required: true,
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+            message: "请输入手机号!",
+          },
+        ],
+        liveType: [{ required: true, message: "请输入入住类型!" }],
+        gradeId: [{ required: true, message: "请输入等级类型!" }],
+        payType: [{ required: true, message: "请输入付款类型!" }],
+        paymentMethod: [{ required: true, message: "请输入付款方式!" }],
+        cusName: [{ required: true, message: "请输入会员姓名!" }],
+        sex: [{ required: true, message: "请输入性别!" }],
+        certificateType: [{ required: true, message: "请输入证件类型!" }],
+        validity: [{ required: true, message: "请输入有效期!" }],
+      },
+      url: {
+        add: "/business/busRoomBookingOrders/booking-to-live",
+        edit: "/business/busMemberCard/edit",
+        queryById: "/business/busMemberCard/queryById",
+      },
+      gradeList: [],
+      paymentMethodList: [],
+      staffList: [],
+      customerList: [],
+      oldcustomerList: [],
+      hourRoomRuleList: [],
+      currentDate: moment(new Date()).format("YYYY-MM-DD"),
+      roomPrice: 0,
+    };
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled;
+    },
+    sumPrice() {
+      var sum = 0;
+      // if (this.model.liveType == 1) {
+      (this.model.livingDayPrices || []).forEach((item) => {
+        sum += item.price;
+      });
+      // } else if (this.model.liveType == 2) {
+      //   var find = this.hourRoomRuleList.find(
+      //     (t) => t.id == this.model.fangAnId
+      //   );
+      //   if (find) {
+      //     sum = find.afterOpenRoomPay;
+      //   }
+      // }
+      return sum;
+    },
+  },
+  created() {
+    var _info = JSON.parse(localStorage.getItem("storeInfo"));
+    if (_info) {
+      this.model.hotelId = _info.id;
+    }
+    //备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    getAction("/rooms/cesHourRoomRule/list", {
+      pageNo: 1,
+      pageSize: 100,
+    }).then((res) => {
+      if (res.success) {
+        this.hourRoomRuleList = res.result.records;
+      }
+    });
+  },
+  methods: {
+    moment,
+    modalFormOk(e) {
+      console.log("e", e);
+    },
+    editBatchRoomPrice() {
+      this.$refs.modalEditBatchRoomPriceModal.edit(this.model);
+      this.$refs.modalEditBatchRoomPriceModal.title = "修改";
+      this.$refs.modalEditBatchRoomPriceModal.disableSubmit = false;
+    },
+    bookingTypeChange(e) {
+      if (this.model.liveType == 1) {
+        this.model.fangAnId = "";
+        if (this.model.oldliveType == 1) {
+          this.model.livingDayPrices = this.model.oldlivingDayPrices;
+        } else if (this.model.oldliveType == 2) {
+          //钟点转全天,每日房价要重新赋值
+          this.model.livingDayPrices = this.model.oldlivingDayPrices;
+          var item = JSON.parse(
+            JSON.stringify(this.model.oldlivingDayPrices[0])
+          );
+          item.dayTime = this.currentDate;
+          item.price = this.roomPrice;
+          this.model.livingDayPrices = [item];
+        }
+      } else {
+        var hourRoomRule = this.hourRoomRuleList[0];
+        if (hourRoomRule) {
+          this.model.fangAnId = hourRoomRule.id;
+          this.bindLivingDayPrices();
+        }
+      }
+    },
+    bindLivingDayPrices() {
+      var find = this.hourRoomRuleList.find((t) => t.id == this.model.fangAnId);
+      var item = JSON.parse(JSON.stringify(this.model.oldlivingDayPrices[0]));
+      item.dayTime = this.currentDate;
+      item.price = 0;
+      if (find) {
+        item.price = find.afterOpenRoomPay;
+      }
+      this.model.livingDayPrices = [item];
+    },
+    hourRoomIdChange() {
+      this.bindLivingDayPrices();
+    },
+    add(livingOrderId, roomId) {
+      this.modelDefault.livingOrderId = livingOrderId;
+      this.modelDefault.roomId = roomId;
+      this.edit(this.modelDefault);
+    },
+    edit(record) {
+      this.model = Object.assign({}, record);
+      this.model.oldlivingDayPrices = JSON.parse(
+        JSON.stringify(this.model.livingDayPrices)
+      );
+      this.model.oldliveType = JSON.parse(JSON.stringify(this.model.liveType));
+      this.visible = true;
+
+      getAction(
+        "/rooms/cesRooms/get-room-mkt-price?roomId=" + this.model.roomId,
+        {}
+      ).then((res) => {
+        if (res.success) {
+          this.roomPrice = res.result;
+        }
+      });
+    },
+    submitForm() {
+      const that = this;
+      // 触发表单验证
+      this.$refs.form.validate((valid) => {
+        console.log(this.model);
+        // return;
+        if (valid) {
+          that.model.prices = {
+            livingOrderId: that.model.orderId,
+            dayPrices: that.model.livingDayPrices,
+          };
+          that.confirmLoading = true;
+          postAction(
+            "/business/busRoomBookingOrders/update-orders?type=2",
+            this.model
+          )
+            .then((res) => {
+              if (res.success) {
+                that.$message.success("修改成功");
+                that.$emit("ok");
+              } else {
+                that.$message.warning(res.message);
+              }
+            })
+            .finally(() => {
+              that.confirmLoading = false;
+            });
+        }
+      });
+    },
+  },
+};
+</script>

+ 60 - 0
src/views/room/modules/checkIn/EditBookingTypeModal.vue

@@ -0,0 +1,60 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    <bus-member-card-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></bus-member-card-form>
+  </j-modal>
+</template>
+
+<script>
+
+  import BusMemberCardForm from './EditBookingTypeForm'
+  export default {
+    name: 'BusMemberCardModal',
+    components: {
+      BusMemberCardForm
+    },
+    data () {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add (livingOrderId,roomId) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add(livingOrderId,roomId);
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>

+ 182 - 0
src/views/room/modules/checkIn/EditBreakfastNumForm.vue

@@ -0,0 +1,182 @@
+<template>
+  <a-spin :spinning="confirmLoading">
+    <j-form-container :disabled="formDisabled">
+      <a-form-model
+        ref="form"
+        :model="model"
+        :rules="validatorRules"
+        slot="detail"
+      >
+        <a-row>
+          <a-col :span="24">
+            <a-form-model-item
+              label="早餐数量"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="brkfstNum"
+            >
+              <a-input-number
+                v-model="model.brkfstNum"
+                placeholder="早餐数量"
+                :min="0"
+              ></a-input-number
+              >份
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </j-form-container>
+  </a-spin>
+</template>
+
+<script>
+import { httpAction, getAction } from "@/api/manage";
+import { validateDuplicateValue } from "@/utils/util";
+
+export default {
+  name: "BusMemberCardForm",
+  components: {},
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false,
+    },
+  },
+  data() {
+    return {
+      model: { payType: 1, livingOrderId: "", certType: 1, gender: 1 },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+      confirmLoading: false,
+      validatorRules: {
+        mobile: [
+          {
+            required: true,
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+            message: "请输入手机号!",
+          },
+        ],
+        cardNo: [{ required: true, message: "请输入会员卡号!" }],
+        gradeId: [{ required: true, message: "请输入等级类型!" }],
+        payType: [{ required: true, message: "请输入付款类型!" }],
+        paymentMethod: [{ required: true, message: "请输入付款方式!" }],
+        cusName: [{ required: true, message: "请输入会员姓名!" }],
+        sex: [{ required: true, message: "请输入性别!" }],
+        certificateType: [{ required: true, message: "请输入证件类型!" }],
+        validity: [{ required: true, message: "请输入有效期!" }],
+      },
+      url: {
+        add: "/business/busRoomBookingOrders/booking-to-live",
+        edit: "/business/busMemberCard/edit",
+        queryById: "/business/busMemberCard/queryById",
+      },
+      gradeList: [],
+      paymentMethodList: [],
+      staffList: [],
+      customerList: [],
+      oldcustomerList: [],
+      customerSourceList: [],
+      warranterList: [],
+    };
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled;
+    },
+  },
+  created() {
+    var _info = JSON.parse(localStorage.getItem("storeInfo"));
+    if (_info) {
+      this.model.hotelId = _info.id;
+    }
+    //备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    getAction("/business/busSalesPerson/list", {
+      hotelId: _info.id,
+      pageNo: 1,
+      pageSize: 100,
+    }).then((res) => {
+      if (res.success) {
+        this.warranterList = res.result.records;
+      }
+    });
+  },
+  methods: {
+    handleSearch(value) {
+      let result;
+      if (!value) {
+        result = this.oldcustomerList;
+      } else {
+        result = this.oldcustomerList.filter((t) => t.name.includes(value));
+      }
+      this.customerList = result;
+    },
+    handleSelectMember(e) {
+      var find = this.customerList.find((t) => t.id === e);
+      this.model.cusPhone = find.phone;
+      this.model.cusName = find.name;
+      this.model.cusId = find.id;
+    },
+    getbusCustomer() {
+      getAction("/bus/busCustomer/list", {}).then((res) => {
+        if (res.success) {
+          this.customerList = res.result.records;
+          this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
+        }
+      });
+    },
+    add(livingOrderId, roomId) {
+      this.modelDefault.livingOrderId = livingOrderId;
+      this.modelDefault.roomId = roomId;
+      this.edit(this.modelDefault);
+    },
+    edit(record) {
+      this.model = Object.assign({}, record);
+      this.visible = true;
+    },
+    submitForm() {
+      const that = this;
+      // 触发表单验证
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          that.confirmLoading = true;
+          // var customers = [];
+          // customers.push({
+          //   certNo: this.model.certNo,
+          //   certType: this.model.certType,
+          //   customerId: this.model.customerId,
+          //   customerName: this.model.customerName,
+          //   gender: this.model.gender,
+          //   phone: this.model.phone,
+          //   roomId: this.model.roomId,
+          // });
+          httpAction(
+            "/business/busRoomBookingOrders/update-orders?type=2",
+            this.model,
+            "post"
+          )
+            .then((res) => {
+              if (res.success) {
+                that.$message.success("修改成功");
+                that.$emit("ok");
+              } else {
+                that.$message.warning(res.message);
+              }
+            })
+            .finally(() => {
+              that.confirmLoading = false;
+            });
+        }
+      });
+    },
+  },
+};
+</script>

+ 60 - 0
src/views/room/modules/checkIn/EditBreakfastNumModal.vue

@@ -0,0 +1,60 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    <bus-member-card-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></bus-member-card-form>
+  </j-modal>
+</template>
+
+<script>
+
+  import BusMemberCardForm from './EditBreakfastNumForm'
+  export default {
+    name: 'BusMemberCardModal',
+    components: {
+      BusMemberCardForm
+    },
+    data () {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add (livingOrderId,roomId) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add(livingOrderId,roomId);
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>