gqx 2 роки тому
батько
коміт
4ecbacf60f
22 змінених файлів з 1374 додано та 32 видалено
  1. 5 3
      src/views/markets/coupons.vue
  2. 352 0
      src/views/markets/couponscash.vue
  3. 2 2
      src/views/markets/marketInfo.vue
  4. 14 6
      src/views/markets/modules/Provide/BusMemberCardList.vue
  5. 10 5
      src/views/markets/modules/Provide/MobileForm.vue
  6. 22 14
      src/views/markets/modules/Provide/index.vue
  7. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsForm.vue
  8. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsModal.Style#Drawer.vue
  9. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsModal.vue
  10. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsUsedForm.vue
  11. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsUsedGenerateForm.vue
  12. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsUsedGenerateFormModal.vue
  13. 1 2
      src/views/markets/modules/BusMarketCouponsUsedList.vue
  14. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsUsedListModal.vue
  15. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsUsedModal.Style#Drawer.vue
  16. 0 0
      src/views/markets/modules/coupons/BusMarketCouponsUsedModal.vue
  17. 286 0
      src/views/markets/modules/couponsCash/BusMarketCouponsCashForm.vue
  18. 60 0
      src/views/markets/modules/couponsCash/BusMarketCouponsCashModal.vue
  19. 145 0
      src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedGenerateForm.vue
  20. 60 0
      src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedGenerateFormModal.vue
  21. 353 0
      src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedList.vue
  22. 64 0
      src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedListModal.vue

+ 5 - 3
src/views/markets/coupons.vue

@@ -151,9 +151,9 @@
 import "@/assets/less/TableExpand.less";
 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 BusMarketCouponsModal from "./modules/coupons/BusMarketCouponsModal";
+import BusMarketCouponsUsedListModal from "./modules/coupons/BusMarketCouponsUsedListModal";
+import ProvideIndexModal from "./modules/provide/index";
 import { deleteAction } from "@/api/manage";
 export default {
   name: "coupons",
@@ -299,12 +299,14 @@ export default {
       this.couponsId = item.id;
       this.$refs.modalProvideIndexModal.visible = true;
       this.$refs.modalProvideIndexModal.title = "发放";
+      this.$refs.modalProvideIndexModal.disableSubmit = true;
     },
     handleConfig(item) {
       this.couponsId = item.id;
       // this.$refs.modalCouponsUsedListModal.eventId = item.id;
       this.$refs.modalCouponsUsedListModal.visible = true;
       this.$refs.modalCouponsUsedListModal.title = "详情";
+      this.$refs.modalCouponsUsedListModal.disableSubmit = true;
       this.$refs.modalCouponsUsedListModal.add(item.id);
     },
     searchReset() {

+ 352 - 0
src/views/markets/couponscash.vue

@@ -0,0 +1,352 @@
+<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="4">
+            <a-form-item label="">
+              <a-input
+                placeholder="优惠券名称"
+                v-model="queryParam.name"
+              ></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item label="">
+              <a-range-picker
+                format="YYYY-MM-DD"
+                :placeholder="['开始日期', '结束日期']"
+                @change="onChange"
+                v-model="datetime"
+              />
+            </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
+                type="primary"
+                @click="searchReset"
+                icon="reload"
+                style="margin-left: 8px"
+                >重置</a-button
+              >
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 查询区域-END -->
+
+    <!-- 操作按钮区域 -->
+    <div class="table-operator">
+      <a-button @click="handleAdd" type="danger" icon="plus">新增</a-button>
+      <!-- <a-button type="primary" icon="download" @click="handleExportXls('bus_market_coupons_info')">导出</a-button>
+      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
+        <a-button type="primary" icon="import">导入</a-button>
+      </a-upload> -->
+      <!-- 高级查询区域 -->
+      <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
+        </a-menu>
+        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
+      </a-dropdown> -->
+    </div>
+
+    <!-- table区域-begin -->
+    <div>
+      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
+        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+      </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 @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" />
+          <a @click="handleDelete(record.id)">删除</a>
+        </span>
+      </a-table>
+    </div>
+
+    <bus-market-coupons-cash-modal
+      ref="modalForm"
+      @ok="modalFormOk"
+    ></bus-market-coupons-cash-modal>
+    <bus-market-coupons-cash-used-list-modal
+      ref="modalCouponsCashUsedListModal"
+      :couponsId="couponsId"
+    ></bus-market-coupons-cash-used-list-modal>
+
+    <provide-index-modal
+      ref="modalProvideIndexModal"
+      :couponsId="couponsId"
+      :couponsType="2"
+      @ok="modalFormOk"
+    ></provide-index-modal>
+  </a-card>
+</template>
+
+<script>
+import "@/assets/less/TableExpand.less";
+import { mixinDevice } from "@/utils/mixin";
+import { JeecgListMixin } from "@/mixins/JeecgListMixin";
+import BusMarketCouponsCashModal from "./modules/couponsCash/BusMarketCouponsCashModal";
+import BusMarketCouponsCashUsedListModal from "./modules/couponsCash/BusMarketCouponsCashUsedListModal";
+import ProvideIndexModal from "./modules/provide/index";
+import { deleteAction } from "@/api/manage";
+export default {
+  name: "coupons",
+  mixins: [JeecgListMixin, mixinDevice],
+  components: {
+    BusMarketCouponsCashModal,
+    BusMarketCouponsCashUsedListModal,
+    ProvideIndexModal,
+  },
+  data() {
+    return {
+      couponsId: "",
+      datetime: [],
+      queryParam: {},
+      description: "bus_market_coupons_info管理页面",
+      // 表头
+      columns: [
+        // {
+        //   title: "#",
+        //   dataIndex: "",
+        //   key: "rowIndex",
+        //   width: 60,
+        //   align: "center",
+        //   customRender: function (t, r, index) {
+        //     return parseInt(index) + 1;
+        //   },
+        // },
+        // {
+        //   title: "关联租户",
+        //   align: "center",
+        //   dataIndex: "tenantId",
+        // },
+        {
+          title: "商家",
+          align: "center",
+          dataIndex: "hotelName",
+        },
+        {
+          title: "名称",
+          align: "center",
+          dataIndex: "name",
+        },
+        {
+          title: "开始时间",
+          align: "center",
+          dataIndex: "startTime",
+          customRender: function (text) {
+            return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
+          },
+        },
+        {
+          title: "结束时间",
+          align: "center",
+          dataIndex: "endTime",
+          customRender: function (text) {
+            return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
+          },
+        },
+        {
+          title: "优惠条件",
+          align: "center",
+          dataIndex: "type",
+          customRender: function (text, record) {
+            return text == 1 ? "无限制" : "满" + record.conditions + "可使用";
+          },
+        },
+        {
+          title: "生成数量",
+          align: "center",
+          dataIndex: "count",
+        },
+        {
+          title: "待领取",
+          align: "center",
+          dataIndex: "notClaimed",
+        },
+        {
+          title: "已领取",
+          align: "center",
+          dataIndex: "received",
+        },
+        {
+          title: "已使用",
+          align: "center",
+          dataIndex: "used",
+        },
+        {
+          title: "已作废",
+          align: "center",
+          dataIndex: "voided",
+        },
+        {
+          title: "每人可领取张数",
+          align: "center",
+          dataIndex: "klqzs",
+        },
+        {
+          title: "操作",
+          dataIndex: "action",
+          align: "center",
+          fixed: "right",
+          width: 147,
+          scopedSlots: { customRender: "action" },
+        },
+      ],
+      url: {
+        list: "/business/busMarketCouponsCash/list",
+        delete: "/business/busMarketCouponsCash/delete",
+        deleteBatch: "/business/busMarketCouponsCash/deleteBatch",
+        exportXlsUrl: "/business/busMarketCouponsCash/exportXls",
+        importExcelUrl: "business/busMarketCouponsCash/importExcel",
+      },
+      dictOptions: {},
+      superFieldList: [],
+    };
+  },
+  created() {
+    // this.getSuperFieldList();
+  },
+  computed: {
+    importExcelUrl: function () {
+      return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
+    },
+  },
+  methods: {
+    handleDelete: function (id) {
+      if (!this.url.delete) {
+        this.$message.error("请设置url.delete属性!");
+        return;
+      }
+      var that = this;
+      this.$confirm({
+        title: "确认删除",
+        content: "是否删除?",
+        onOk: function () {
+          deleteAction(that.url.delete, { id: id }).then((res) => {
+            if (res.success) {
+              //重新计算分页问题
+              that.reCalculatePage(1);
+              that.$message.success(res.message);
+              that.loadData();
+            } else {
+              that.$message.warning(res.message);
+            }
+          });
+        },
+        onCancel: function () {},
+      });
+    },
+    handleProvide(item) {
+      this.couponsId = item.id;
+      this.$refs.modalProvideIndexModal.visible = true;
+      this.$refs.modalProvideIndexModal.title = "发放";
+      this.$refs.modalProvideIndexModal.disableSubmit = true;
+    },
+    handleConfig(item) {
+      this.couponsId = item.id;
+      this.$refs.modalCouponsCashUsedListModal.visible = true;
+      this.$refs.modalCouponsCashUsedListModal.title = "详情";
+      this.$refs.modalCouponsCashUsedListModal.disableSubmit = true;
+      this.$refs.modalCouponsCashUsedListModal.add(item.id);
+    },
+    searchReset() {
+      this.datetime = [];
+      this.queryParam = {};
+      this.loadData(1);
+    },
+    onChange(e, dateString) {
+      // console.log("Selected Time: ", e);
+      // console.log("Formatted Selected Time: ", dateString);
+      this.queryParam.startTime = dateString[0];
+      this.queryParam.endTime = dateString[1];
+    },
+    initDictConfig() {},
+    getSuperFieldList() {
+      let fieldList = [];
+      fieldList.push({ type: "string", value: "tenantId", text: "关联租户" });
+      fieldList.push({ type: "string", value: "hotelId", text: "关联酒店" });
+      fieldList.push({ type: "string", value: "name", text: "名称" });
+      fieldList.push({ type: "date", value: "startTime", text: "开始时间" });
+      fieldList.push({ type: "date", value: "endTime", text: "结束时间" });
+      fieldList.push({ type: "string", value: "tenantId", text: "适用房型" });
+      fieldList.push({ type: "int", value: "klqzs", text: "可领取张数" });
+      fieldList.push({ type: "string", value: "type", text: "类型" });
+      fieldList.push({ type: "string", value: "introduce", text: "说明" });
+      fieldList.push({ type: "int", value: "lqNum", text: "领取数量" });
+      fieldList.push({ type: "string", value: "ruleDec", text: "使用说明" });
+      this.superFieldList = fieldList;
+    },
+  },
+};
+</script>
+<style scoped>
+@import "~@assets/less/common.less";
+</style>

+ 2 - 2
src/views/markets/marketInfo.vue

@@ -39,7 +39,7 @@
         />
         <p>餐券核销</p>
       </div>
-      <div class="height-100" @click="toPage()">
+      <div class="height-100" @click="toPage('/tenant/marketinfo/couponscash')">
         <img
           src="http://oss.qlan99.com/20200529/7a270d9a3a534034ac03c2fdd23139ab.png"
         />
@@ -81,7 +81,7 @@ export default {
   methods: {
     toPage(url) {
       if(!url){
-        this.$message.warning('开发中,请先体验免房券');
+        this.$message.warning('开发中,请先体验免房券/优惠券');
         return
       }
       this.$router.push(url);

+ 14 - 6
src/views/markets/modules/Provide/BusMemberCardList.vue

@@ -148,6 +148,10 @@ export default {
       type: String,
       default: "",
     },
+    couponsType: {
+      type: Number,
+      default: 1,
+    },
   },
   data() {
     return {
@@ -252,15 +256,19 @@ export default {
         this.$message.warning("发放数量不能小于0!");
         return;
       }
-      // var ids = "";
-      // for (var a = 0; a < this.selectedRowKeys.length; a++) {
-      //   ids += this.selectedRowKeys[a] + ",";
-      // }
       var that = this;
       that.confirmLoading = true;
+      var url = "/business/busMarketCouponsUsed/gainCouponsUsedToMember";
+      if (this.couponsType === 2) {
+        url = "/business/busMarketCouponsCashUsed/gainCouponsCashUsedToMember";
+      }
       httpAction(
-        "/business/busMarketCouponsUsed/gainCouponsUsedToMember",
-        { couponsId: this.couponsId, num: this.num, memberIds: this.selectedRowKeys },
+        url,
+        {
+          couponsId: this.couponsId,
+          num: this.num,
+          memberIds: this.selectedRowKeys,
+        },
         "post"
       )
         .then((res) => {

+ 10 - 5
src/views/markets/modules/Provide/MobileForm.vue

@@ -81,6 +81,11 @@ export default {
       default: "",
       required: true,
     },
+    couponsType: {
+      type: Number,
+      default: 1,
+      required: true,
+    },
   },
   data() {
     return {
@@ -120,11 +125,11 @@ export default {
       this.$refs.form.validate((valid) => {
         if (valid) {
           that.confirmLoading = true;
-          httpAction(
-            "/business/busMarketCouponsUsed/gainCouponsUsedToNoMember",
-            this.model,
-            "post"
-          )
+          var url = "/business/busMarketCouponsUsed/gainCouponsUsedToNoMember";
+          if (this.couponsType === 2) {
+            url = "/business/busMarketCouponsCashUsed/gainCouponsCashUsedToNoMember";
+          }
+          httpAction(url, this.model, "post")
             .then((res) => {
               if (res.success) {
                 that.$message.success(res.message);

+ 22 - 14
src/views/markets/modules/Provide/index.vue

@@ -10,14 +10,24 @@
     cancelText="关闭"
   >
     <a-card :bordered="false">
-      <a-tabs default-active-key="1">
+      <a-tabs default-active-key="1" @tabClick="tabClick">
         <a-tab-pane key="1">
           <span slot="tab"> 会员 </span>
-          <bus-member-card-list :couponsId="couponsId" ref="busMemberCardList" @ok="submitCallback"></bus-member-card-list>
+          <bus-member-card-list
+            :couponsId="couponsId"
+            :couponsType="couponsType"
+            ref="busMemberCardList"
+            @ok="submitCallback"
+          ></bus-member-card-list>
         </a-tab-pane>
         <a-tab-pane key="2">
           <span slot="tab"> 非会员 </span>
-          <mobile-form :couponsId="couponsId" ref="mobileForm" @ok="submitCallback" ></mobile-form>
+          <mobile-form
+            :couponsId="couponsId"
+            :couponsType="couponsType"
+            ref="mobileForm"
+            @ok="submitCallback"
+          ></mobile-form>
         </a-tab-pane>
       </a-tabs>
     </a-card>
@@ -30,27 +40,25 @@ import MobileForm from "./MobileForm";
 export default {
   components: {
     BusMemberCardList,
-    MobileForm
+    MobileForm,
   },
   props: {
     couponsId: {
       type: String,
       default: "",
     },
+    couponsType: {
+      type: Number,
+      default: 1,
+    },
   },
   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);
-    //   });
-    // },
+    tabClick(e) {
+      this.disableSubmit = e !== '2';
+    },
     close() {
       this.$emit("close");
       this.visible = false;
@@ -59,7 +67,7 @@ export default {
       this.$refs.mobileForm.submitForm();
     },
     submitCallback() {
-      console.log('submitCallback')
+      console.log("submitCallback");
       this.$emit("ok");
       this.visible = false;
     },

src/views/markets/modules/BusMarketCouponsForm.vue → src/views/markets/modules/coupons/BusMarketCouponsForm.vue


src/views/markets/modules/BusMarketCouponsModal.Style#Drawer.vue → src/views/markets/modules/coupons/BusMarketCouponsModal.Style#Drawer.vue


src/views/markets/modules/BusMarketCouponsModal.vue → src/views/markets/modules/coupons/BusMarketCouponsModal.vue


src/views/markets/modules/BusMarketCouponsUsedForm.vue → src/views/markets/modules/coupons/BusMarketCouponsUsedForm.vue


src/views/markets/modules/BusMarketCouponsUsedGenerateForm.vue → src/views/markets/modules/coupons/BusMarketCouponsUsedGenerateForm.vue


src/views/markets/modules/BusMarketCouponsUsedGenerateFormModal.vue → src/views/markets/modules/coupons/BusMarketCouponsUsedGenerateFormModal.vue


+ 1 - 2
src/views/markets/modules/BusMarketCouponsUsedList.vue

@@ -57,8 +57,7 @@
               >
               <a-button
                 @click="handleAdd"
-                type="primary"
-                icon="plus"
+                type="danger"
                 style="margin-left: 8px"
                 >生成免房券</a-button
               >

src/views/markets/modules/BusMarketCouponsUsedListModal.vue → src/views/markets/modules/coupons/BusMarketCouponsUsedListModal.vue


src/views/markets/modules/BusMarketCouponsUsedModal.Style#Drawer.vue → src/views/markets/modules/coupons/BusMarketCouponsUsedModal.Style#Drawer.vue


src/views/markets/modules/BusMarketCouponsUsedModal.vue → src/views/markets/modules/coupons/BusMarketCouponsUsedModal.vue


+ 286 - 0
src/views/markets/modules/couponsCash/BusMarketCouponsCashForm.vue

@@ -0,0 +1,286 @@
+<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="startTime"
+            >
+              <j-date
+                placeholder="请选择开始时间"
+                v-model="model.startTime"
+                style="width: 100%"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="结束时间"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="endTime"
+            >
+              <j-date
+                placeholder="请选择结束时间"
+                v-model="model.endTime"
+                style="width: 100%"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="优惠条件"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="conditions"
+            >
+              <a-radio-group v-model="model.type">
+                <a-radio :value="1">不限制</a-radio>
+                <a-radio :value="2">满</a-radio>
+              </a-radio-group>
+              <a-input-number
+                v-model="model.conditions"
+                :min="1"
+                style="width: 30%"
+                @blur="handleChange"
+              />元可使用
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="每单可使用张数"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="ksyzs"
+            >
+              <a-input-number
+                v-model="model.ksyzs"
+                :min="1"
+                placeholder="请输入每单可使用张数"
+                style="width: 100%"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="金额"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="cost"
+            >
+              <a-input-number
+                v-model="model.cost"
+                :min="1"
+                placeholder="请输入金额"
+                style="width: 100%"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="每人可领取张数"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              :min="1"
+              prop="klqzs"
+            >
+              <a-input-number
+                v-model="model.klqzs"
+                placeholder="请输入可领取张数"
+                style="width: 100%"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="说明"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="introduce"
+            >
+              <a-input
+                v-model="model.introduce"
+                placeholder="请输入说明"
+              ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="使用说明"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="ruleDec"
+            >
+              <a-input
+                v-model="model.ruleDec"
+                placeholder="请输入使用说明"
+              ></a-input>
+            </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: "BusMarketCouponsCashForm",
+  components: {},
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false,
+    },
+  },
+  data() {
+    var validateConditions = (rule, value, callback) => {
+      console.log(22);
+      if (!this.model.conditions && this.model.type === 2) {
+        callback("请输入满多少元!");
+      } else {
+        callback();
+      }
+    };
+    return {
+      roomLayouts: [],
+      model: { type: 1 },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+      confirmLoading: false,
+      validatorRules: {
+        name: [{ required: true, message: "请输入名称!" }],
+        startTime: [{ required: true, message: "请输入开始时间!" }],
+        endTime: [{ required: true, message: "请输入结束时间!" }],
+        type: [{ required: true, message: "请输入优惠条件!" }],
+        conditions: [
+          { required: true, validator: validateConditions, trigger: "change" },
+        ],
+        ksyzs: [{ required: true, message: "请输入每单可使用张数!" }],
+        cost: [{ required: true, message: "请输入金额!" }],
+        introduce: [{ required: true, message: "请输入说明!" }],
+        klqzs: [{ required: true, message: "请输入每人可领取张数!" }],
+      },
+      url: {
+        add: "/business/busMarketCouponsCash/add",
+        edit: "/business/busMarketCouponsCash/edit",
+        queryById: "/business/busMarketCouponsCash/queryById",
+      },
+    };
+  },
+  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: {
+    handleChange(e) {
+      // this.$nextTick(() => {
+      //   this.form.validateFields(["conditions"], { force: true });
+      // });
+      if (this.model.conditions) {
+        this.$refs.form.clearValidate(["conditions"]);
+      }
+    },
+    add() {
+      this.edit(this.modelDefault);
+    },
+    edit(record) {
+      console.log("record", record);
+      var roomLayouts = (record.roomIds || "").split(",");
+      this.model = Object.assign({}, record, { roomLayouts: roomLayouts });
+      this.visible = true;
+      getAction("/rooms/cesRoomLayout/list", { pageNo: 1, pageSize: 100 })
+        .then((res) => {
+          if (res.success) {
+            this.roomLayouts = res.result.records;
+            var data = [];
+            res.result.records.forEach((item) => {
+              data.push({ label: item.name, value: item.id });
+            });
+            this.roomLayouts = data;
+          }
+        })
+        .finally(() => {});
+    },
+    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";
+          }
+          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>

+ 60 - 0
src/views/markets/modules/couponsCash/BusMarketCouponsCashModal.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-market-coupons-cash-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></bus-market-coupons-cash-form>
+  </j-modal>
+</template>
+
+<script>
+
+  import BusMarketCouponsCashForm from './BusMarketCouponsCashForm'
+  export default {
+    name: 'BusMarketCouponsCashModal',
+    components: {
+      BusMarketCouponsCashForm
+    },
+    data () {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      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>

+ 145 - 0
src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedGenerateForm.vue

@@ -0,0 +1,145 @@
+<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" v-show="false">
+            <a-form-model-item
+              label="免房券id"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="couponsId"
+            >
+            <a-input-number
+                v-model="model.couponsId"
+                style="width: 100%"
+              />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="已生成数量"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <p>{{ total }}</p>
+            </a-form-model-item>
+          </a-col>
+          <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: 100%"
+              />
+            </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: "BusMarketCouponsCashUsedForm",
+  components: {},
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false,
+    },
+  },
+  data() {
+    return {
+      total: 0,
+      model: {},
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+      confirmLoading: false,
+      validatorRules: {
+        //  couponsId: [
+        //     { required: true, message: '请输入免房券id!'},
+        //  ],
+        num: [{ required: true, message: "请输入生成数量!" }],
+      },
+      url: {
+        add: "/business/busMarketCouponsCashUsed/generate",
+        edit: "/business/busMarketCouponsCashUsed/edit",
+        queryById: "/business/busMarketCouponsCashUsed/queryById",
+      },
+    };
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled;
+    },
+  },
+  created() {
+    //备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model));
+  },
+  methods: {
+    add(total, couponsId) {
+      this.total = total;
+      this.modelDefault.couponsId = couponsId;
+      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;
+          let httpurl = "";
+          let method = "";
+          if (!this.model.id) {
+            httpurl += this.url.add;
+            method = "post";
+          } else {
+            httpurl += this.url.edit;
+            method = "put";
+          }
+          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>

+ 60 - 0
src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedGenerateFormModal.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-market-coupons-cash-used-generate-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></bus-market-coupons-cash-used-generate-form>
+  </j-modal>
+</template>
+
+<script>
+
+  import BusMarketCouponsCashUsedGenerateForm from './BusMarketCouponsCashUsedGenerateForm'
+  export default {
+    name: 'BusMarketCouponsCashUsedGenerateFormModal',
+    components: {
+      BusMarketCouponsCashUsedGenerateForm
+    },
+    data () {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add (total,couponsId) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add(total,couponsId);
+        })
+      },
+      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>

+ 353 - 0
src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedList.vue

@@ -0,0 +1,353 @@
+<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.code"></j-input>
+            </a-form-item>
+          </a-col>
+          <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 :span="4">
+            <a-form-item label="">
+              <a-select
+                v-model:value="queryParam.status"
+                style="width: 120px"
+                placeholder="请选择状态"
+                :allowClear="true"
+              >
+                <a-select-option value="0">未领取</a-select-option>
+                <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>
+            </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
+                type="primary"
+                @click="searchReset"
+                icon="reload"
+                style="margin-left: 8px"
+                >重置</a-button
+              >
+              <a-button
+                @click="handleAdd"
+                type="danger"
+                style="margin-left: 8px"
+                >生成优惠券</a-button
+              >
+              <a-button
+                type="primary"
+                icon="delete"
+                style="margin-left: 8px"
+                @click="batchDel"
+                >批量删除</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-cash-used-generate-form-modal
+      ref="modalForm"
+      @ok="modalFormOk"
+    ></bus-market-coupons-cash-used-generate-form-modal>
+  </a-card>
+</template>
+
+<script>
+import "@/assets/less/TableExpand.less";
+import { mixinDevice } from "@/utils/mixin";
+import { JeecgListMixin } from "@/mixins/JeecgListMixin";
+import BusMarketCouponsCashUsedGenerateFormModal from "./BusMarketCouponsCashUsedGenerateFormModal";
+import { httpAction, getAction } from "@/api/manage";
+
+export default {
+  name: "BusMarketCouponsUsedList",
+  mixins: [JeecgListMixin, mixinDevice],
+  components: {
+    BusMarketCouponsCashUsedGenerateFormModal,
+  },
+  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: 80,
+          scopedSlots: { customRender: "action" },
+        },
+      ],
+      url: {
+        list: "/business/busMarketCouponsCashUsed/list?couponsId=" + this.couponsId,
+        delete: "/business/busMarketCouponsCashUsed/delete",
+        deleteBatch: "/business/busMarketCouponsCashUsed/deleteBatch",
+        exportXlsUrl: "/business/busMarketCouponsCashUsed/exportXls",
+        importExcelUrl: "business/busMarketCouponsCashUsed/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/busMarketCouponsCashUsed/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() {
+      this.$refs.modalForm.add(this.ipagination.total, this.couponsId);
+      this.$refs.modalForm.title = "优惠券生成";
+      this.$refs.modalForm.disableSubmit = false;
+    },
+  },
+};
+</script>
+<style scoped>
+@import "~@assets/less/common.less";
+</style>

+ 64 - 0
src/views/markets/modules/couponsCash/BusMarketCouponsCashUsedListModal.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-market-coupons-cash-used-list :couponsId="couponsId" ref="modalCouponsCashUsedListModal"></bus-market-coupons-cash-used-list>
+  </j-modal>
+</template>
+
+<script>
+  import BusMarketCouponsCashUsedList from "./BusMarketCouponsCashUsedList";
+  export default {
+    name: 'BusMarketCouponsCashUsedListModal',
+    components: {
+      BusMarketCouponsCashUsedList
+    },
+    props: {
+      couponsId: {
+        type: String,
+        default: ''
+      }
+    },
+    data () {
+      return {
+        title:'',
+        width:1200,
+        visible: false,
+        disableSubmit: false,
+        // eventId:'',
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.modalCouponsCashUsedListModal.edit(record);
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.modalCouponsCashUsedListModal.submitForm();
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>