| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <template>
- <a-spin :spinning="confirmLoading">
- <j-form-container :disabled="formDisabled">
- <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
- <a-row style="display:flex;justify-content:center;">
- <a-col :span="12">
- <a-form-model-item label="消费项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subjectType">
- <a-select v-model="model.subjectType" style="50%" placeholder="消费项目" :allowClear="true">
- <a-select-option :value="1">押金</a-select-option>
- <a-select-option :value="2">预收房费</a-select-option>
- <a-select-option :value="3">每日房费</a-select-option>
- <a-select-option :value="6">商品</a-select-option>
- <a-select-option :value="7">点餐</a-select-option>
- </a-select>
- </a-form-model-item>
- <a-row>
- <a-col :span="24">
- <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money">
- <a-input-number :disabled="model.subjectType==6" v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-col>
- <a-col v-if="model.subjectType==6" :span="12">
- <a-row>
- <a-col :span="24">
- <a-space>
- <a-input v-model="queryParams.name" placeholder="名称" />
- <a-button @click="searchQuery" type="primary">搜索</a-button>
- </a-space>
- </a-col>
- </a-row>
- <a-table :columns="columns" :loading="loading" :dataSource="dataSource" style="margin-top:10px;">
- <template slot="sellingPrice" slot-scope="text, record">
- <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
- </template>
- <template slot="number" slot-scope="text, record">
- <a-input-number v-model="record.number" :min="0"></a-input-number>
- </template>
- </a-table>
- </a-col>
- </a-row>
- <!-- <a-row>
- <a-col :span="24">
- <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money">
- <a-input-number v-model="model.money" 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";
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- export default {
- name: "BusMemberCardForm",
- components: {},
- mixins:[JeecgListMixin],
- props: {
- //表单禁用
- disabled: {
- type: Boolean,
- default: false,
- required: false,
- },
- livingOrderId: {
- type: String,
- },
- },
- data() {
- return {
- dataSource:[],
- columns: [{
- title: "名称",
- align: "center",
- dataIndex: "name",
- },
- {
- title: "售价",
- align: "center",
- dataIndex: "sellingPrice",
- scopedSlots: { customRender: 'sellingPrice' },
- },
- {
- title: "数量",
- align: "center",
- dataIndex: "number",
- scopedSlots: { customRender: 'number' },
- },
- {
- title: "剩余库存",
- align: "center",
- dataIndex: "inventory",
- },
- ],
- model: {
- payType: 1,
- livingOrderId: "",
- certType: 1,
- gender: 1
- },
- queryParams: {},
- labelCol: {
- xs: {
- span: 24
- },
- sm: {
- span: 5
- },
- },
- wrapperCol: {
- xs: {
- span: 24
- },
- sm: {
- span: 16
- },
- },
- confirmLoading: false,
- validatorRules: {
- subjectType: [{
- required: true,
- message: "请输入消费项目!"
- }],
- money: [{
- required: true,
- message: "请输入金额!"
- }],
- },
- url: {
- list: "/rooms/cesGoods/queryList",
- edit: "/business/busMemberCard/edit",
- queryById: "/business/busMemberCard/queryById",
- },
- gradeList: [],
- paymentMethodList: [],
- staffList: [],
- customerList: [],
- oldcustomerList: [],
- };
- },
- 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));
- this.getbusCustomer();
- // getAction('/kc/kcGoods/list').then(res=>{
- // if (res.success) {
- // this.dataSource = res.result.records;
- // }
- // })
- // getAction('/rooms/cesGoods/queryList').then(res=>{
- // if (res.success) {
- // this.dataSource = 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.phone = find.phone;
- this.model.customerName = find.name;
- this.model.customerId = 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 orders = [];
- orders.push({
- money: this.model.money,
- subjectType: this.model.subjectType,
- });
- this.model.orders = orders;
- this.model.livingOrderId = this.livingOrderId;
- httpAction("/business/busRoomBookingOrders/set-living-order-fee?livingOrderId=" + this.livingOrderId, orders, "post")
- .then((res) => {
- if (res.success) {
- that.$message.success(res.message);
- that.$emit("ok");
- } else {
- that.$message.warning(res.message);
- }
- })
- .finally(() => {
- that.confirmLoading = false;
- });
- }
- });
- },
- },
- };
- </script>
|