Переглянути джерело

实现免房券发放给会员

gqx 2 роки тому
батько
коміт
05bb0afc25

+ 1 - 1
src/views/markets/coupons.vue

@@ -46,7 +46,7 @@
 
     <!-- 操作按钮区域 -->
     <div class="table-operator">
-      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+      <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>

+ 339 - 0
src/views/markets/modules/Provide/BusMemberCardList.vue

@@ -0,0 +1,339 @@
+<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.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-input-number
+                style="margin-left: 8px"
+                v-model="num"
+                :min="1"
+                :max="10"
+              />
+              <a-button
+                @click="handleAdd"
+                type="danger"
+                :disabled="selectedRowKeys.length <= 0"
+                >发放</a-button
+              > -->
+              <a-input-search
+                style="width: 200px; margin-left: 8px"
+                placeholder="请输入每人发放张数"
+                enter-button="发放"
+                v-model="num"
+                type="danger"
+                :disabled="selectedRowKeys.length <= 0"
+                @search="handleAdd"
+              />
+            </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="avatar" slot-scope="text">
+          <a-avatar v-if="text" :src="text" />
+          <a-avatar v-else icon="user" />
+        </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="handleEdit(record)">编辑</a>
+
+          <a-divider type="vertical" />
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a @click="handleDetail(record)">详情</a>
+              </a-menu-item>
+              <a-menu-item>
+                <a-popconfirm
+                  title="确定删除吗?"
+                  @confirm="() => handleDelete(record.id)"
+                >
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+        </span>
+      </a-table>
+    </div>
+  </a-card>
+</template>
+
+<script>
+import "@/assets/less/TableExpand.less";
+import { mixinDevice } from "@/utils/mixin";
+import { JeecgListMixin } from "@/mixins/JeecgListMixin";
+import { httpAction } from "@/api/manage";
+export default {
+  name: "BusMemberCardList",
+  mixins: [JeecgListMixin, mixinDevice],
+  props: {
+    couponsId: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    return {
+      num: 1,
+      description: "bus_member_card管理页面",
+      // 表头
+      columns: [
+        {
+          title: "商家",
+          align: "center",
+          dataIndex: "hotelName",
+        },
+        {
+          title: "头像",
+          align: "center",
+          dataIndex: "avatar",
+          scopedSlots: { customRender: "avatar" },
+        },
+        {
+          title: "会员姓名",
+          align: "center",
+          dataIndex: "name",
+        },
+        {
+          title: "手机号",
+          align: "center",
+          dataIndex: "mobile",
+        },
+        {
+          title: "性别",
+          align: "center",
+          dataIndex: "sex",
+          customRender: function (text) {
+            return text === 1 ? "男" : "女";
+          },
+        },
+        {
+          title: "会员卡号",
+          align: "center",
+          dataIndex: "cardNo",
+        },
+        {
+          title: "等级类型",
+          align: "center",
+          dataIndex: "gradeName",
+        },
+        {
+          title: "证件号",
+          align: "center",
+          dataIndex: "certificateNo",
+        },
+        {
+          title: "推荐员工",
+          align: "center",
+          dataIndex: "staffId",
+        },
+        {
+          title: "可用积分",
+          align: "center",
+          dataIndex: "integral",
+        },
+        {
+          title: "可用余额",
+          align: "center",
+          dataIndex: "balance",
+        },
+        // {
+        //   title: '操作',
+        //   dataIndex: 'action',
+        //   align:"center",
+        //   fixed:"right",
+        //   width:147,
+        //   scopedSlots: { customRender: 'action' }
+        // }
+      ],
+      url: {
+        list: "/business/busMemberCard/list",
+        delete: "/business/busMemberCard/delete",
+        deleteBatch: "/business/busMemberCard/deleteBatch",
+        exportXlsUrl: "/business/busMemberCard/exportXls",
+        importExcelUrl: "business/busMemberCard/importExcel",
+      },
+      dictOptions: {},
+      superFieldList: [],
+    };
+  },
+  created() {
+    this.getSuperFieldList();
+  },
+  computed: {
+    importExcelUrl: function () {
+      return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
+    },
+  },
+  methods: {
+    handleAdd() {
+      if (this.selectedRowKeys.length <= 0) {
+        this.$message.warning("请选择一条记录!");
+        return;
+      }
+      if (this.num <= 0) {
+        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;
+      httpAction(
+        "/business/busMarketCouponsUsed/gainCouponsUsedToMember",
+        { couponsId: this.couponsId, num: this.num, memberIds: this.selectedRowKeys },
+        "post"
+      )
+        .then((res) => {
+          if (res.success) {
+            that.$message.success(res.message);
+            that.$emit("ok");
+          } else {
+            that.$message.warning(res.message);
+          }
+        })
+        .finally(() => {
+          that.confirmLoading = false;
+        });
+    },
+    initDictConfig() {},
+    getSuperFieldList() {
+      let fieldList = [];
+      fieldList.push({ type: "string", value: "tenantId", text: "关联租户" });
+      fieldList.push({ type: "string", value: "hotelId", text: "关联酒店" });
+      fieldList.push({ type: "string", value: "mobile", text: "手机号" });
+      fieldList.push({ type: "string", value: "cardNo", text: "会员卡号" });
+      fieldList.push({ type: "string", value: "cardInnerNo", text: "卡内码" });
+      fieldList.push({ type: "string", value: "gradeId", text: "等级类型" });
+      fieldList.push({ type: "number", value: "memberFee", text: "会员费" });
+      fieldList.push({ type: "int", value: "payType", text: "付款类型" });
+      fieldList.push({ type: "int", value: "paymentMethod", text: "付款方式" });
+      fieldList.push({ type: "string", value: "name", text: "会员姓名" });
+      fieldList.push({ type: "string", value: "avatar", text: "头像" });
+      fieldList.push({ type: "int", value: "sex", text: "性别" });
+      fieldList.push({
+        type: "int",
+        value: "certificateType",
+        text: "证件类型",
+      });
+      fieldList.push({
+        type: "string",
+        value: "certificateNo",
+        text: "证件号",
+      });
+      fieldList.push({ type: "string", value: "address", text: "地址" });
+      fieldList.push({
+        type: "string",
+        value: "consumePassword",
+        text: "消费密码",
+      });
+      fieldList.push({ type: "int", value: "validity", text: "有效期" });
+      fieldList.push({
+        type: "date",
+        value: "validityEndTime",
+        text: "有效期截止日期",
+      });
+      fieldList.push({ type: "string", value: "remark", text: "备注" });
+      fieldList.push({ type: "string", value: "staffId", text: "推荐员工" });
+      fieldList.push({ type: "int", value: "integral", text: "可用积分" });
+      fieldList.push({ type: "number", value: "balance", text: "可用余额" });
+      this.superFieldList = fieldList;
+    },
+  },
+};
+</script>
+<style scoped>
+@import "~@assets/less/common.less";
+/deep/ .ant-input-search-button {
+  background-color: #ff4d4f;
+  border-color: #ff4d4f;
+}
+/deep/ .ant-input-search-button[disabled]:hover {
+  opacity: 0.7;
+  background-color: #ff4d4f;
+  border-color: #ff4d4f;
+}
+/deep/ .ant-input-search-button[disabled] {
+  opacity: 0.7;
+  color: #ffffff;
+}
+</style>

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

@@ -1,320 +0,0 @@
-<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>

+ 4 - 5
src/views/markets/modules/Provide/index.vue

@@ -13,8 +13,7 @@
       <a-tabs default-active-key="1">
         <a-tab-pane key="1">
           <span slot="tab"> 会员 </span>
-          <!-- <user-list :couponsId="couponsId" ref="userList"></user-list> -->
-          会员功能开发中,请体验非会员...
+          <bus-member-card-list :couponsId="couponsId" ref="busMemberCardList" @ok="submitCallback"></bus-member-card-list>
         </a-tab-pane>
         <a-tab-pane key="2">
           <span slot="tab"> 非会员 </span>
@@ -26,12 +25,12 @@
 </template>
 
 <script>
-import UserList from "./UserList";
+import BusMemberCardList from "./BusMemberCardList";
 import MobileForm from "./MobileForm";
 export default {
   components: {
-    UserList,
-    MobileForm,
+    BusMemberCardList,
+    MobileForm
   },
   props: {
     couponsId: {