| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549 |
- <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="tenantId">
- <a-input v-model="model.tenantId" placeholder="请输入关联租户" ></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item label="关联酒店" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hotelId">
- <a-input v-model="model.hotelId" placeholder="请输入关联酒店" ></a-input>
- </a-form-model-item>
- </a-col> -->
- <a-col :span="24">
- <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="24">
- <a-form-model-item
- label="选择类型"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="type"
- >
- <a-radio-group v-model="model.type">
- <a-radio :value="0">会员折扣</a-radio>
- <a-radio :value="1">房价方案</a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-col>
- <a-col :span="24" v-show="model.type == 0">
- <a-form-model-item
- label="会员折扣"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="discount"
- >
- <a-input-number
- v-model="model.discount"
- :min="1"
- :max="100"
- style="width: 20%"
- :precision="0"
- />%
- </a-form-model-item>
- </a-col>
- <a-col :span="24" v-show="model.type == 1">
- <a-form-model-item
- label="房价方案"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="schemeId"
- >
- <a-select
- v-model="model.schemeId"
- placeholder="请选择"
- style="width: 120px"
- :allowClear="true"
- >
- <a-select-option
- :value="item.value"
- v-for="(item, index) in roomPlans"
- :key="index"
- >{{ item.label }}</a-select-option
- >
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="是否需要支付"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="payFlag"
- >
- <a-radio-group v-model="model.payFlag">
- <a-radio :value="0">否</a-radio>
- <a-radio :value="1">是</a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-col>
- <a-col :span="24" v-if="model.payFlag == 1">
- <a-form-model-item
- label="支付费用"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="payAmount"
- :rules="[
- { required: true, message: '请输入支付费用', trigger: 'blur' },
- ]"
- >
- <a-input-number
- v-model="model.payAmount"
- placeholder="请输入支付费用"
- style="width: 100%"
- />
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="积分购买"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="payIntegral"
- >
- <a-input-number
- v-model="model.payIntegral"
- placeholder="购买会员卡所需积分"
- style="width: 100%"
- />
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="是否可以储值"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="payStored"
- >
- <a-radio-group v-model="model.payStored">
- <a-radio :value="0">否</a-radio>
- <a-radio :value="1">是</a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="等级"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="level"
- >
- <a-input-number
- v-model="model.level"
- placeholder="请输入等级"
- style="width: 20%"
- :precision="0"
- />
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="会员优惠"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="hyyh"
- >每一积分可抵扣金额
- <a-input-number
- v-model="model.hyyh"
- style="width: 20%"
- :min="0"
- :max="1000000"
- />元
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="自动续期"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="renewal"
- >
- <a-checkbox
- @change="(e) => (model.renewal = e.target.checked)"
- :checked="model.renewal"
- >
- 充值自动续期
- </a-checkbox>
- <a-input-number
- v-model="model.renewalDay"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />天
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="积分设置"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="tenantPointsChecked"
- >
- <a-checkbox
- @change="(e) => (model.tenantPointsChecked = e.target.checked)"
- :checked="model.tenantPointsChecked"
- >
- 客房积分模式
- </a-checkbox>
- <block v-show="model.tenantPointsChecked">
- <a-radio-group v-model="model.tenantPoints">
- <a-radio :value="1">所有的消费转成积分</a-radio>
- <a-radio :value="2">只房费转成积分</a-radio> </a-radio-group
- ><br />
- 每消费
- <a-input-number
- v-model="model.tenantRoomIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />元,积
- <a-input-number
- v-model="model.addTenantRoomIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />分</block
- ><br />
- <a-checkbox
- @change="(e) => (model.roomIntegralChecked = e.target.checked)"
- :checked="model.roomIntegralChecked"
- >
- 按储值卡支付积分
- </a-checkbox>
- <block v-show="model.roomIntegralChecked">
- 每消费
- <a-input-number
- v-model="model.roomIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />元,积
- <a-input-number
- v-model="model.addRoomIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />分</block
- ><br />
- <a-checkbox
- @change="(e) => (model.dayIntegralChecked = e.target.checked)"
- :checked="model.dayIntegralChecked"
- >
- 按入住天数积分
- </a-checkbox>
- <block v-show="model.dayIntegralChecked">
- 每入住
- <a-input-number
- v-model="model.dayIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />天,积
- <a-input-number
- v-model="model.addDayIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />分</block
- ><br />
- <a-checkbox
- @change="(e) => (model.rechargeChecked = e.target.checked)"
- :checked="model.rechargeChecked"
- >
- 启用储值赠送
- </a-checkbox>
- <block v-show="model.rechargeChecked">
- 每充值
- <a-input-number
- v-model="model.rechargeIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />元,积
- <a-input-number
- v-model="model.addRechargeIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />分</block
- ><br />
- <a-checkbox
- @change="(e) => (model.upLevelChecked = e.target.checked)"
- :checked="model.upLevelChecked"
- >
- 积分满足
- </a-checkbox>
- <block v-show="model.upLevelChecked">
- <a-input-number
- v-model="model.upLevelIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- />分,自动升级为
- <a-select
- v-model="model.upLevel"
- placeholder="请选择"
- style="width: 120px"
- :allowClear="true"
- >
- <a-select-option
- :value="item.value"
- v-for="(item, index) in members"
- :key="index"
- >{{ item.label }}</a-select-option
- >
- </a-select></block
- ><br />
- <a-checkbox
- @change="(e) => (model.subLevelChecked = e.target.checked)"
- :checked="model.subLevelChecked"
- >
- 升级扣除相应积分
- </a-checkbox>
- <block v-show="model.subLevelChecked">
- ,扣减相应积分为
- <a-input-number
- v-model="model.subLevelIntegral"
- style="width: 20%"
- :min="1"
- :max="1000000"
- :precision="0"
- /></block>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="会员图标"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="icon"
- >
- <!-- <a-input
- v-model="model.icon"
- placeholder="请输入会员图标"
- ></a-input> -->
- <a-input
- placeholder="点击选择图标"
- v-model="model.icon"
- :readOnly="true"
- >
- <a-icon slot="addonAfter" type="setting" @click="selectIcons" />
- </a-input>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="卡片背景"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="bgImage"
- >
- <j-image-upload
- class="avatar-uploader"
- text="上传"
- v-model="model.bgImage"
- ></j-image-upload>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item
- label="卡片描述"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="content"
- >
- <a-textarea
- v-model="model.content"
- rows="4"
- placeholder="请输入卡片描述"
- />
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model>
- <icons
- @choose="handleIconChoose"
- @close="handleIconCancel"
- :iconChooseVisible="iconChooseVisible"
- ></icons>
- </j-form-container>
- </a-spin>
- </template>
- <script>
- import { getRoomPlans,getSelectList } from "@/api/api";
- import { httpAction, getAction } from "@/api/manage";
- import { validateDuplicateValue } from "@/utils/util";
- import Icons from "./icon/Icons";
- export default {
- name: "BusMarketMemberForm",
- components: { Icons },
- props: {
- disabled: {
- type: Boolean,
- default: false,
- required: false,
- },
- },
- data() {
- return {
- model: {
- id: "",
- hotelId: 0,
- type: 0,
- discount: 1,
- payFlag: 0,
- payIntegral: 0,
- payStored: 0,
- level: 1,
- renewal: false,
- tenantPointsChecked: false,
- roomIntegralChecked: false,
- dayIntegralChecked: false,
- rechargeChecked: false,
- upLevelChecked: false,
- subLevelChecked: false,
- tenant_points: 1,
- },
- labelCol: {
- xs: { span: 24 },
- sm: { span: 5 },
- },
- wrapperCol: {
- xs: { span: 24 },
- sm: { span: 16 },
- },
- confirmLoading: false,
- validatorRules: {
- name: [{ required: true, message: "请输入会员名称!" }],
- // payAmount: [{ required: true, message: "请输入支付费用!" }],
- level: [{ required: true, message: "请输入等级!" }],
- icon: [{ required: true, message: "请上传会员图标!" }],
- },
- url: {
- add: "/org.jeecg.modules.business/busMarketMember/add",
- edit: "/org.jeecg.modules.business/busMarketMember/edit",
- queryById: "/org.jeecg.modules.business/busMarketMember/queryById",
- },
- iconChooseVisible: false,
- roomPlans: [],
- members: [],
- };
- },
- computed: {
- formDisabled() {
- return this.disabled;
- },
- },
- created() {
- var _info = JSON.parse(localStorage.getItem("storeInfo"));
- if (_info) {
- this.model.hotelId = _info.id;
- this.initData();
- }
- this.modelDefault = JSON.parse(JSON.stringify(this.model));
- },
- methods: {
- initData() {
- getRoomPlans(this.model.hotelId, null).then((res) => {
- if (res.success) {
- this.roomPlans = res.result;
- }
- });
- },
- selectIcons() {
- this.iconChooseVisible = true;
- },
- handleIconCancel() {
- this.iconChooseVisible = false;
- },
- handleIconChoose(value) {
- console.log(value);
- this.model.icon = value;
- this.iconChooseVisible = false;
- },
- add() {
- this.edit(this.modelDefault);
- },
- edit(record) {
- this.model = Object.assign({}, record);
- this.visible = true;
- getSelectList({ id: this.model.id }).then((res) => {
- if (res.success) {
- this.members = res.result;
- }
- });
- },
- 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 scoped>
- .avatar-uploader > .ant-upload {
- width: 104px;
- height: 104px;
- }
- </style>
|