Explorar el Código

实现免房券非会员发放

gqx hace 2 años
padre
commit
ece7653c9c

+ 26 - 11
src/views/markets/coupons.vue

@@ -6,10 +6,10 @@
         <a-row :gutter="24">
           <a-col :span="4">
             <a-form-item label="">
-              <j-input
+              <a-input
                 placeholder="免房券名称"
                 v-model="queryParam.name"
-              ></j-input>
+              ></a-input>
             </a-form-item>
           </a-col>
           <a-col :span="6">
@@ -18,7 +18,7 @@
                 format="YYYY-MM-DD"
                 :placeholder="['开始日期', '结束日期']"
                 @change="onChange"
-                v-model:value="datetime"
+                v-model="datetime"
               />
             </a-form-item>
           </a-col>
@@ -120,6 +120,8 @@
         <span slot="action" slot-scope="text, record">
           <a @click="handleConfig(record)">详情</a>
           <a-divider type="vertical" />
+          <a @click="handleProvide(record)">发放</a>
+          <a-divider type="vertical" />
           <a @click="handleEdit(record)">编辑</a>
 
           <a-divider type="vertical" />
@@ -136,6 +138,12 @@
       ref="modalCouponsUsedListModal"
       :couponsId="couponsId"
     ></bus-market-coupons-used-list-modal>
+
+    <provide-index-modal
+      ref="modalProvideIndexModal"
+      :couponsId="couponsId"
+      @ok="modalFormOk"
+    ></provide-index-modal>
   </a-card>
 </template>
 
@@ -145,18 +153,20 @@ import { mixinDevice } from "@/utils/mixin";
 import { JeecgListMixin } from "@/mixins/JeecgListMixin";
 import BusMarketCouponsModal from "./modules/BusMarketCouponsModal";
 import BusMarketCouponsUsedListModal from "./modules/BusMarketCouponsUsedListModal";
+import ProvideIndexModal from "./modules/Provide/index";
 import { deleteAction } from "@/api/manage";
 export default {
-  name: "BusMarketCouponsList",
+  name: "coupons",
   mixins: [JeecgListMixin, mixinDevice],
   components: {
     BusMarketCouponsModal,
     BusMarketCouponsUsedListModal,
+    ProvideIndexModal,
   },
   data() {
     return {
       couponsId: "",
-      datetime: "",
+      datetime: [],
       queryParam: {},
       description: "bus_market_coupons_info管理页面",
       // 表头
@@ -205,27 +215,27 @@ export default {
         {
           title: "生成数量",
           align: "center",
-          dataIndex: "tenantId",
+          dataIndex: "count",
         },
         {
           title: "待领取",
           align: "center",
-          dataIndex: "tenantId",
+          dataIndex: "notClaimed",
         },
         {
           title: "已领取",
           align: "center",
-          dataIndex: "tenantId",
+          dataIndex: "received",
         },
         {
           title: "已使用",
           align: "center",
-          dataIndex: "tenantId",
+          dataIndex: "used",
         },
         {
           title: "已作废",
           align: "center",
-          dataIndex: "tenantId",
+          dataIndex: "voided",
         },
         {
           title: "每人可领取张数",
@@ -285,6 +295,11 @@ export default {
         onCancel: function () {},
       });
     },
+    handleProvide(item) {
+      this.couponsId = item.id;
+      this.$refs.modalProvideIndexModal.visible = true;
+      this.$refs.modalProvideIndexModal.title = "发放";
+    },
     handleConfig(item) {
       this.couponsId = item.id;
       // this.$refs.modalCouponsUsedListModal.eventId = item.id;
@@ -293,7 +308,7 @@ export default {
       this.$refs.modalCouponsUsedListModal.add(item.id);
     },
     searchReset() {
-      this.datetime = "";
+      this.datetime =[];
       this.queryParam = {};
       this.loadData(1);
     },

+ 7 - 7
src/views/markets/modules/BusMarketCouponsUsedList.vue

@@ -204,17 +204,17 @@ export default {
           title: "领取时间",
           align: "center",
           dataIndex: "gainTime",
-          customRender: function (text) {
-            return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
-          },
+          // customRender: function (text) {
+          //   return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
+          // },
         },
         {
           title: "使用时间",
           align: "center",
           dataIndex: "usedTime",
-          customRender: function (text) {
-            return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
-          },
+          // customRender: function (text) {
+          //   return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
+          // },
         },
         {
           title: "状态",
@@ -226,7 +226,7 @@ export default {
           dataIndex: "action",
           align: "center",
           fixed: "right",
-          width: 147,
+          width: 80,
           scopedSlots: { customRender: "action" },
         },
       ],

+ 162 - 0
src/views/markets/modules/Provide/MobileForm.vue

@@ -0,0 +1,162 @@
+<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="num"
+            >
+              <a-input-number
+                v-model="model.num"
+                placeholder="请输入每人发放张数"
+                style="width: 50%"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24" v-for="(item, index) in model.mobiles" :key="index">
+            <a-form-model-item
+              :label="'手机号' + (index + 1)"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              :prop="`mobiles[${index}]`"
+              :rules="[
+                {
+                  required: true,
+                  message: '请输入手机号!',
+                  trigger: 'change',
+                },
+              ]"
+            >
+              <a-input
+                v-model="item.value"
+                placeholder="请输入手机号"
+                style="width: 50%"
+              ></a-input>
+              <a-icon
+                v-if="model.mobiles.length - 1 == index"
+                type="plus-circle"
+                class="dynamic-delete-button"
+                @click="puls()"
+              />
+              <a-icon
+                type="minus-circle"
+                style="color: #f56c6c"
+                class="dynamic-delete-button"
+                v-if="model.mobiles.length > 1"
+                @click="() => remove(index)"
+              />
+            </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: "MobileForm",
+  components: {},
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false,
+    },
+    couponsId: {
+      type: String,
+      default: "",
+      required: true,
+    },
+  },
+  data() {
+    return {
+      model: { num: 1, mobiles: [{ value: "" }] },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 3 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+      confirmLoading: false,
+      validatorRules: {
+        num: [{ required: true, message: "请输入每人发放张数!" }],
+      },
+    };
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled;
+    },
+  },
+  created() {
+    this.model.couponsId = this.couponsId;
+  },
+  methods: {
+    puls() {
+      this.model.mobiles.push({ value: "" });
+    },
+    remove(index) {
+      this.model.mobiles.splice(index, 1);
+    },
+    submitForm() {
+      const that = this;
+      // 触发表单验证
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          that.confirmLoading = true;
+          httpAction(
+            "/business/busMarketCouponsUsed/gainCouponsUsedToNoMember",
+            this.model,
+            "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>
+<style scoped>
+.dynamic-delete-button {
+  cursor: pointer;
+  position: relative;
+  top: 4px;
+  margin-left: 5px;
+  font-size: 18px;
+  color: #1890ff;
+  transition: all 0.3s;
+}
+.dynamic-delete-button:hover {
+  color: #777;
+}
+.dynamic-delete-button[disabled] {
+  cursor: not-allowed;
+  opacity: 0.5;
+}
+</style>

+ 320 - 0
src/views/markets/modules/Provide/UserList.vue

@@ -0,0 +1,320 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+          <a-col :span="6">
+            <a-form-item label="">
+              <j-input
+                placeholder="会员名称"
+                v-model="queryParam.user_name"
+              ></j-input>
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item label="">
+              <j-input
+                placeholder="会员手机号"
+                v-model="queryParam.mobile"
+              ></j-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <span
+              style="float: left; overflow: hidden"
+              class="table-page-search-submitButtons"
+            >
+              <a-button type="primary" @click="searchQuery" icon="search"
+                >查询</a-button
+              >
+
+              <a-button
+                @click="handleAdd"
+                type="primary"
+                icon="plus"
+                style="margin-left: 8px"
+                >发放</a-button
+              >
+
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 查询区域-END -->
+
+    <!-- table区域-begin -->
+    <div>
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{ x: true }"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{
+          selectedRowKeys: selectedRowKeys,
+          onChange: onSelectChange,
+        }"
+        class="j-table-force-nowrap"
+        @change="handleTableChange"
+      >
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+        <template slot="imgSlot" slot-scope="text, record">
+          <span v-if="!text" style="font-size: 12px; font-style: italic"
+            >无图片</span
+          >
+          <img
+            v-else
+            :src="getImgView(text)"
+            :preview="record.id"
+            height="25px"
+            alt=""
+            style="max-width: 80px; font-size: 12px; font-style: italic"
+          />
+        </template>
+        <template slot="fileSlot" slot-scope="text">
+          <span v-if="!text" style="font-size: 12px; font-style: italic"
+            >无文件</span
+          >
+          <a-button
+            v-else
+            :ghost="true"
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)"
+          >
+            下载
+          </a-button>
+        </template>
+
+        <span slot="action" slot-scope="text, record">
+          <a v-if="record.statusName!=='已作废'" @click="handleEdit(record)">作废</a>
+        </span>
+      </a-table>
+    </div>
+
+    <!-- <bus-market-coupons-used-generate-form-modal
+      ref="modalForm"
+      @ok="modalFormOk"
+    ></bus-market-coupons-used-generate-form-modal> -->
+  </a-card>
+</template>
+
+<script>
+import "@/assets/less/TableExpand.less";
+import { mixinDevice } from "@/utils/mixin";
+import { JeecgListMixin } from "@/mixins/JeecgListMixin";
+// import BusMarketCouponsUsedGenerateFormModal from "./BusMarketCouponsUsedGenerateFormModal";
+import { httpAction, getAction } from "@/api/manage";
+
+export default {
+  name: "BusMarketCouponsUsedList",
+  mixins: [JeecgListMixin, mixinDevice],
+  components: {
+    // BusMarketCouponsUsedGenerateFormModal,
+  },
+  props: {
+    couponsId: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    return {
+      description: "免房券领取使用表管理页面",
+      // 表头
+      columns: [
+        {
+          title: "券号",
+          align: "center",
+          dataIndex: "code",
+        },
+        {
+          title: "免房券名称",
+          align: "center",
+          dataIndex: "conponsName",
+        },
+        // {不知道这个金额是干啥用,数据库表中没加金额字段
+        //   title: "金额",
+        //   align: "center",
+        //   dataIndex: "",
+        // },
+        {
+          title: "姓名",
+          align: "center",
+          dataIndex: "userName",
+        },
+
+        {
+          title: "房间号",
+          align: "center",
+          dataIndex: "roomNumber",
+        },
+        {
+          title: "入住单号",
+          align: "center",
+          dataIndex: "checkedInNo",
+        },
+        {
+          title: "手机号",
+          align: "center",
+          dataIndex: "mobile",
+        },
+        {
+          title: "领取时间",
+          align: "center",
+          dataIndex: "gainTime",
+          customRender: function (text) {
+            return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
+          },
+        },
+        {
+          title: "使用时间",
+          align: "center",
+          dataIndex: "usedTime",
+          customRender: function (text) {
+            return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
+          },
+        },
+        {
+          title: "状态",
+          align: "center",
+          dataIndex: "statusName",
+        },
+        {
+          title: "操作",
+          dataIndex: "action",
+          align: "center",
+          fixed: "right",
+          width: 147,
+          scopedSlots: { customRender: "action" },
+        },
+      ],
+      url: {
+        list: "/business/busMarketCouponsUsed/list?couponsId=" + this.couponsId,
+        delete: "/business/busMarketCouponsUsed/delete",
+        deleteBatch: "/business/busMarketCouponsUsed/deleteBatch",
+        exportXlsUrl: "/business/busMarketCouponsUsed/exportXls",
+        importExcelUrl: "business/busMarketCouponsUsed/importExcel",
+      },
+      dictOptions: {},
+      superFieldList: [],
+    };
+  },
+  created() {
+    this.getSuperFieldList();
+  },
+  computed: {
+    importExcelUrl: function () {
+      return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
+    },
+  },
+  methods: {
+    handleEdit(item) {
+      var that = this;
+      this.$confirm({
+        title: "确认作废",
+        content: "是否作废?",
+        onOk: function () {
+          httpAction(
+            "/business/busMarketCouponsUsed/voided",
+            { id: item.id },
+            "put"
+          )
+            .then((res) => {
+              if (res.success) {
+                that.$message.success(res.message);
+                item.statusName = "已作废";
+              } else {
+                that.$message.warning(res.message);
+              }
+            })
+            .finally(() => {});
+        },
+        onCancel: function () {},
+      });
+    },
+    initDictConfig() {},
+    getSuperFieldList() {
+      let fieldList = [];
+      fieldList.push({
+        type: "string",
+        value: "tenantId",
+        text: "关联租户",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "hotelId",
+        text: "关联酒店",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "couponsId",
+        text: "免房券id",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "code",
+        text: "券号",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "int",
+        value: "status",
+        text: "状态 0未领取 1已领取 2已使用 3已作废",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "userid",
+        text: "会员id",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "userName",
+        text: "姓名",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "roomNumber",
+        text: "房间号",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "checkedInNo",
+        text: "入住单号",
+        dictCode: "",
+      });
+      fieldList.push({
+        type: "string",
+        value: "mobile",
+        text: "手机号",
+        dictCode: "",
+      });
+      fieldList.push({ type: "date", value: "gainTime", text: "领取时间" });
+      fieldList.push({ type: "date", value: "usedTime", text: "使用时间" });
+      this.superFieldList = fieldList;
+    },
+    handleAdd() {
+
+    },
+  },
+};
+</script>
+<style scoped>
+@import "~@assets/less/common.less";
+</style>

+ 75 - 0
src/views/markets/modules/Provide/index.vue

@@ -0,0 +1,75 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
+    @cancel="handleCancel"
+    cancelText="关闭"
+  >
+    <a-card :bordered="false">
+      <a-tabs default-active-key="1">
+        <a-tab-pane key="1">
+          <span slot="tab"> 会员 </span>
+          <!-- <user-list :couponsId="couponsId" ref="userList"></user-list> -->
+          会员功能开发中,请体验非会员...
+        </a-tab-pane>
+        <a-tab-pane key="2">
+          <span slot="tab"> 非会员 </span>
+          <mobile-form :couponsId="couponsId" ref="mobileForm" @ok="submitCallback" ></mobile-form>
+        </a-tab-pane>
+      </a-tabs>
+    </a-card>
+  </j-modal>
+</template>
+
+<script>
+import UserList from "./UserList";
+import MobileForm from "./MobileForm";
+export default {
+  components: {
+    UserList,
+    MobileForm,
+  },
+  props: {
+    couponsId: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    return { title: "", width: 1200, visible: false, disableSubmit: false };
+  },
+  methods: {
+    // add() {
+    //   this.visible = true;
+    // },
+    // edit(record) {
+    //   this.visible = true;
+    //   this.$nextTick(() => {
+    //     this.$refs.mobileForm.edit(record);
+    //   });
+    // },
+    close() {
+      this.$emit("close");
+      this.visible = false;
+    },
+    handleOk() {
+      this.$refs.mobileForm.submitForm();
+    },
+    submitCallback() {
+      console.log('submitCallback')
+      this.$emit("ok");
+      this.visible = false;
+    },
+    handleCancel() {
+      this.close();
+    },
+  },
+};
+</script>
+
+<style scoped>
+</style>