Sfoglia il codice sorgente

add:优惠券相关模块

ct 3 settimane fa
parent
commit
0703d6498d

+ 59 - 0
src/api/store/coupon.js

@@ -0,0 +1,59 @@
+import request from '@/utils/request'
+
+// 查询优惠券列表
+export function listCoupon(query) {
+  return request({
+    url: '/store/coupon/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询优惠券详细
+export function getCoupon(couponId) {
+  return request({
+    url: '/store/coupon/' + couponId,
+    method: 'get'
+  })
+}
+
+export function allList() {
+  return request({
+    url: '/store/coupon/allList',
+    method: 'get'
+  })
+}
+// 新增优惠券
+export function addCoupon(data) {
+  return request({
+    url: '/store/coupon',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改优惠券
+export function updateCoupon(data) {
+  return request({
+    url: '/store/coupon',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除优惠券
+export function delCoupon(couponId) {
+  return request({
+    url: '/store/coupon/' + couponId,
+    method: 'delete'
+  })
+}
+
+// 导出优惠券
+export function exportCoupon(query) {
+  return request({
+    url: '/store/coupon/export',
+    method: 'get',
+    params: query
+  })
+}

+ 143 - 0
src/api/store/doctor.js

@@ -0,0 +1,143 @@
+import request from '@/utils/request'
+
+// 查询医生管理列表
+export function listDoctor(query) {
+  return request({
+    url: '/store/doctor/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function getUserList(name) {
+  return request({
+    url: '/store/doctor/user/list',
+    method: 'get',
+    params: name
+  })
+}
+export function getFollowDoctorList(query) {
+  return request({
+    url: '/store/doctor/followDoctorList',
+    method: 'get',
+    params: query
+  })
+}
+export function getAllFollowDoctorList(query) {
+  return request({
+    url: '/store/doctor/allFollowDoctorList',
+    method: 'get',
+    params: query
+  })
+}
+export function docList() {
+  return request({
+    url: '/store/doctor/doc/list',
+    method: 'get',
+
+  })
+}
+// 查询医生名称列表
+export function listdocuser(query) {
+  return request({
+    url: '/store/doctor/userdoc/list',
+    method: 'get',
+    params: query
+  })
+}
+export function getDoctorPrice(doctorId) {
+  return request({
+    url: '/store/price/getDoctorPrice/' + doctorId,
+    method: 'get'
+  })
+}
+
+
+export function editPassWord(data) {
+  return request({
+    url: '/store/doctor/editPassWord',
+    method: 'put',
+    data: data
+  })
+}
+
+export function editDoctorPrice(data) {
+  return request({
+    url: '/store/price/editDoctorPrice',
+    method: 'post',
+    data: data
+  })
+}
+// 查询医生管理详细
+export function getDoctor(doctorId) {
+  return request({
+    url: '/store/doctor/' + doctorId,
+    method: 'get'
+  })
+}
+// 新增医生管理
+export function addDoctor(data) {
+  return request({
+    url: '/store/doctor',
+    method: 'post',
+    data: data
+  })
+}
+export function editFollow(data) {
+  return request({
+    url: '/store/doctor/editFollow',
+    method: 'put',
+    data: data
+  })
+}
+// 修改医生管理
+export function updateDoctor(data) {
+  return request({
+    url: '/store/doctor',
+    method: 'put',
+    data: data
+  })
+}
+
+// 修改医生管理
+export function editPrice(data) {
+  return request({
+    url: '/store/doctor/editDoctorPrice',
+    method: 'put',
+    data: data
+  })
+}
+
+// 修改医生管理
+export function updateAuditDoctor(data) {
+  return request({
+    url: '/store/doctor/editDoctor',
+    method: 'put',
+    data: data
+  })
+}
+
+
+// 删除医生管理
+export function delDoctor(doctorId) {
+  return request({
+    url: '/store/doctor/' + doctorId,
+    method: 'delete'
+  })
+}
+
+// 导出医生管理
+export function getWxaCodeUnLimit() {
+  return request({
+    url: '/store/doctor/getWxaCodeUnLimit',
+    method: 'get',
+  })
+}
+// 导出医生管理
+export function exportDoctor(query) {
+  return request({
+    url: '/store/doctor/export',
+    method: 'get',
+    params: query
+  })
+}

+ 66 - 0
src/api/store/userCoupon copy.js

@@ -0,0 +1,66 @@
+import request from '@/utils/request'
+
+// 查询会员优惠券列表
+export function listUserCoupon(query) {
+  return request({
+    url: '/store/userCoupon/list',
+    method: 'get',
+    params: query
+  })
+}
+export function getListUserCoupon(query) {
+  return request({
+    url: '/store/userCoupon/getList',
+    method: 'get',
+    params: query
+  })
+}
+// 查询会员优惠券详细
+export function getUserCoupon(id) {
+  return request({
+    url: '/store/userCoupon/' + id,
+    method: 'get'
+  })
+}
+
+// 新增会员优惠券
+export function addUserCoupon(data) {
+  return request({
+    url: '/store/userCoupon',
+    method: 'post',
+    data: data
+  })
+}
+export function sendCoupon(data) {
+  return request({
+    url: '/store/userCoupon/sendCoupon',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改会员优惠券
+export function updateUserCoupon(data) {
+  return request({
+    url: '/store/userCoupon',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除会员优惠券
+export function delUserCoupon(id) {
+  return request({
+    url: '/store/userCoupon/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出会员优惠券
+export function exportUserCoupon(query) {
+  return request({
+    url: '/store/userCoupon/export',
+    method: 'get',
+    params: query
+  })
+}

+ 152 - 0
src/views/store/components/couponDetails.vue

@@ -0,0 +1,152 @@
+<template>
+    <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
+      <div style="padding: 20px; background-color: #fff;">
+         优惠劵详情
+      </div>
+<div class="contentx" v-if="item!=null">
+        <div class="desct"> 优惠劵信息</div>
+        <el-descriptions title="" :column="3" border>
+          <el-descriptions-item label="标题"><span v-if="item!=null">{{item.title}}</span></el-descriptions-item>
+          <el-descriptions-item label="面额"><span v-if="item!=null">{{item.price}}</span></el-descriptions-item>
+          <el-descriptions-item label="数量"><span v-if="item!=null">{{item.number}}</span></el-descriptions-item>
+           <el-descriptions-item label="卷类型"><span v-if="item!=null">{{item.couponType}}</span></el-descriptions-item>
+          <el-descriptions-item label="最低消费金额可用"><span v-if="item!=null">{{item.minPrice}}</span></el-descriptions-item>
+          <el-descriptions-item label="剩余数量"><span v-if="item!=null">{{item.remainNumber}}</span></el-descriptions-item>
+          <el-descriptions-item label="有效期"><span v-if="item!=null">{{item.limitTime}}</span></el-descriptions-item>
+          <el-descriptions-item label="状态"><span v-if="item!=null"> <dict-tag :options="statusOptions" :value="item.status"/></span></el-descriptions-item>
+          <el-descriptions-item label="卷类型"><span v-if="item!=null"> <dict-tag :options="couponTypeOptions" :value="item.couponType"/></span></el-descriptions-item>
+        </el-descriptions>
+    </div>
+    <div class="contentx" v-if="item!=null">
+            <div class="desct"> 优惠劵领取信息</div>
+            <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
+              <el-tab-pane label="全部" name="10"></el-tab-pane>
+              <el-tab-pane v-for="(item,index) in couponStatusOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
+            </el-tabs>
+            <el-table v-loading="loading" :data="userCouponList">
+              <el-table-column label="券号" align="center" prop="couponCode" />
+              <el-table-column label="会员昵称" align="center" prop="nickName" />
+             <!-- <el-table-column label="会员电话" align="center" prop="phone" /> -->
+              <el-table-column label="关联订单ID" align="center" prop="businessId" />
+              <el-table-column label="订单类型" align="center" prop="businessType">
+                <template slot-scope="scope">
+                  <dict-tag :options="businessTypeOptions" :value="scope.row.businessType"/>
+                </template>
+              </el-table-column>
+              <el-table-column label="状态" align="center" prop="status">
+                <template slot-scope="scope">
+                  <dict-tag :options="couponStatusOptions" :value="scope.row.status"/>
+                </template>
+              </el-table-column>
+              <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
+              <el-table-column label="使用时间" align="center" prop="useTime" width="180"/>
+            </el-table>
+
+            <pagination
+              v-show="total>0"
+              :total="total"
+              :page.sync="queryParams.pageNum"
+              :limit.sync="queryParams.pageSize"
+              @pagination="getList"
+            />
+        </div>
+
+    </div>
+</template>
+
+<script>
+import { listCoupon, getCoupon, delCoupon, addCoupon, updateCoupon, exportCoupon } from "@/api/store/coupon";
+import { getListUserCoupon } from "@/api/store/userCoupon";
+  export default {
+    name: "coupon",
+    props:["data"],
+    data() {
+      return {
+        actName:"10",
+        couponId:null,
+        item:null,
+        statusOptions: [],
+        couponTypeOptions: [],
+        businessTypeOptions:[],
+        couponStatusOptions:[],
+        total: 0,
+        loading: true,
+        // 会员优惠券表格数据
+        userCouponList: [],
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          couponId: null,
+        },
+      }
+    },
+    created() {
+      this.getDicts("sys_coupon_type").then(response => {
+        this.couponTypeOptions = response.data;
+      });
+      this.getDicts("sys_coupon_business_type").then(response => {
+        this.businessTypeOptions = response.data;
+      });
+      this.getDicts("sys_company_status").then(response => {
+        this.statusOptions = response.data;
+      });
+      this.getDicts("sys_coupon_status").then(response => {
+        this.couponStatusOptions = response.data;
+      });
+    },
+    methods: {
+      getList() {
+        this.loading = true;
+        getListUserCoupon(this.queryParams).then(response => {
+          this.userCouponList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      },
+      handleClickX(tab, event) {
+       if(tab.name=="10"){
+         this.queryParams.status=null;
+       }else{
+         this.queryParams.status=tab.name;
+       }
+          this.queryParams.pageNum = 1;
+          this.couponId = this.queryParams.couponId;
+          this.getList();
+
+      },
+      getDetails(orderId) {
+        this.item=null;
+        this.couponId = orderId;
+        getCoupon(orderId).then(response => {
+            this.item = response.data;
+            this.queryParams.couponId = orderId;
+            this.getList();
+        });
+      },
+    }
+  }
+</script>
+<style>
+  .contentx{
+      height: 100%;
+      background-color: #fff;
+      padding: 0px 20px 20px;
+
+
+      margin: 20px;
+  }
+  .el-descriptions-item__label.is-bordered-label{
+    font-weight: normal;
+  }
+  .el-descriptions-item__content {
+    max-width: 150px;
+    min-width: 100px;
+  }
+  .desct{
+      padding-top: 20px;
+      padding-bottom: 20px;
+      color: #524b4a;
+      font-weight: bold;
+    }
+
+</style>

+ 568 - 0
src/views/store/coupon/index.vue

@@ -0,0 +1,568 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="标题" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+       <el-form-item label="有效期" prop="limitTime">
+                 <el-date-picker v-model="limitTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
+       </el-form-item>
+      <el-form-item label="券类型" prop="couponType">
+        <el-select v-model="queryParams.couponType" placeholder="请选择券类型" clearable size="small">
+          <el-option
+            v-for="dict in couponTypeOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="面额" prop="price">
+        <el-input
+          v-model="queryParams.price"
+          placeholder="请输入面额"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <!-- <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['his:coupon:add']"
+        >新增</el-button>
+      </el-col> -->
+      <!-- <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['his:coupon:edit']"
+        >修改</el-button>
+      </el-col> -->
+      <!-- <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['his:coupon:remove']"
+        >删除</el-button>
+      </el-col> -->
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['his:coupon:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" border :data="couponList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="优惠券名称" align="center" prop="title" width="120px"/>
+      <el-table-column label="面额" align="center" prop="price" />
+      <el-table-column label="折扣" align="center" prop="rate" />
+      <el-table-column label="数量" align="center" prop="number" />
+      <el-table-column label="卷类型 " align="center" prop="couponType" width="120px">
+        <template slot-scope="scope">
+          <dict-tag :options="couponTypeOptions" :value="scope.row.couponType"/>
+        </template>
+      </el-table-column>
+     <el-table-column label="状态" align="center" prop="status">
+       <template slot-scope="scope">
+         <dict-tag :options="statusOptions" :value="scope.row.status"/>
+       </template>
+     </el-table-column>
+      <el-table-column label="最低消费金额可用" align="center" prop="minPrice" />
+      <el-table-column label="剩余数量" align="center" prop="remainNumber" />
+      <el-table-column label="有效期" align="center" prop="limitTime" width="180"/>
+      <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
+      <el-table-column label="更改时间" align="center" prop="updateTime" width="180"/>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150px">
+        <template slot-scope="scope">
+          <!-- <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['his:coupon:edit']"
+          >修改</el-button> -->
+          <el-button
+               size="mini"
+               type="text"
+               @click="handledetails(scope.row)"
+           >详情
+           
+          </el-button>
+          <!-- <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['his:coupon:remove']"
+          >删除</el-button> -->
+
+         <el-button
+               size="mini"
+               type="text"
+               @click="send(scope.row)"
+               v-hasPermi="['his:userCoupon:send']"
+           >发送优惠劵
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+<el-dialog title="发送优惠劵" :visible.sync="openSend" width="500px" append-to-body>
+      <el-form ref="formSend"  label-width="100px">
+
+        <el-form-item label="优惠券名称" prop="title">
+          <div style="margin-left: 20px;font-weight: bold;">    {{sendForm.title}}</div>
+
+        </el-form-item>
+        <el-form-item label="面额" prop="price" v-if="form.couponType==1">
+          <div style="margin-left: 20px;font-weight: bold;">   {{sendForm.price}}</div>
+        </el-form-item>
+        <el-form-item label="搜索用户" >
+          <el-input placeholder="输入电话号码查询用户" v-model="phone" class="input-with-select">
+              <el-button slot="append" icon="el-icon-search" @click="selectPhone"></el-button>
+            </el-input>
+        </el-form-item>
+       <el-form-item label="用户" >
+         <el-select v-model="sendForm.userId">
+              <el-option
+                v-for="item in userList"
+                :key="item.name"
+                :label="item.name"
+                :value="item.id">
+              </el-option>
+            </el-select>
+       </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitSendForm">发 送</el-button>
+        <el-button @click="cancelSend">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!-- 添加或修改优惠券对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-form-item label="优惠券名称" prop="title">
+          <el-input v-model="form.title" placeholder="请输入优惠券名称" />
+        </el-form-item>
+
+        <el-form-item label="过期时间" prop="limitTime">
+          <el-date-picker clearable size="small"
+            v-model="form.limitTime"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择过期时间">
+          </el-date-picker>
+        </el-form-item>
+
+
+        <el-form-item label="用户可领取数量" prop="limitCount" >
+          <el-input-number v-model="form.limitCount"  :min="1"  label="请输入用户可领取数量"></el-input-number>
+        </el-form-item>
+        <el-form-item label="卷类型" prop="couponType">
+          <el-select v-model="form.couponType" placeholder="请选择卷类型" @change="isShowChange">
+            <el-option
+              v-for="dict in couponTypeOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="可用分类" prop="cateIds" v-show="form.couponType==5||form.couponType==6">
+          <el-select v-model="form.cateIds" multiple placeholder="请选择可用分类">
+            <el-option
+              v-for="dict in cateIdsOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="面额" prop="price" v-if="form.couponType==1||form.couponType==5||form.couponType==6">
+          <el-input-number v-model="form.price"  :min="0"  label="请输入面额"></el-input-number>
+        </el-form-item>
+        <el-form-item label="最低消费" prop="minPrice" v-if="form.couponType==1||form.couponType==5||form.couponType==6">
+           <el-input-number v-model="form.minPrice"  :min="0"  label="请输入最低消费金额可用"></el-input-number>
+        </el-form-item>
+        <el-form-item label="打折百分比" prop="rate" v-if="form.couponType==4">
+          <el-input-number v-model="form.rate"  :min="1" :max="100"  label="请输入折扣百分比"></el-input-number>
+        </el-form-item>
+
+        <el-form-item label="有效期类型" prop="limitType">
+          <el-select v-model="form.limitType" placeholder="请选择有效期类型">
+            <el-option
+              v-for="dict in limitTypeOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+
+        <el-form-item label="领取后有效期(天)" prop="limitDay" >
+          <el-input-number v-model="form.limitDay"  :min="1"  label="请输入领取后有效期"></el-input-number>
+        </el-form-item>
+        <el-form-item label="数量" prop="number">
+            <el-input-number v-model="form.number"  :min="0"  label="请输入数量"></el-input-number>
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-radio-group v-model="form.status">
+                   <el-radio :label="item.dictValue" v-for="item in statusOptions" >{{item.dictLabel}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-drawer
+    	:with-header="false"
+            size="75%"
+             :title="show.title" :visible.sync="show.open">
+         <couponDetails  ref="Details" />
+       </el-drawer>
+  </div>
+</template>
+
+<script>
+import { listCoupon, getCoupon, delCoupon, addCoupon, updateCoupon, exportCoupon } from "@/api/store/coupon";
+import { sendCoupon } from "@/api/store/userCoupon";
+import couponDetails from '@/views/store/components/couponDetails.vue';
+import {selectUser} from "@/api/store/user";
+import {getAllCateList} from "@/api/store/packageCate";
+export default {
+  name: "Coupon",
+  components: { couponDetails },
+  data() {
+    return {
+      show:{
+              open:false,
+            },
+      limitTime:[],
+      userList:[],
+      userName: null,
+      // 遮罩层
+      loading: true,
+      phone:null,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 优惠券表格数据
+      couponList: [],
+      statusOptions: [],
+      limitTypeOptions: [],
+      privateTypeOptions: [],
+      diseaseTypeOptions: [],
+      orOptions: [],
+      cateIdsOptions: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      openSend:false,
+      // 卷类型 1代金券 字典
+      couponTypeOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        title: null,
+        limitTime: null,
+        price: null,
+        number: null,
+        couponType: null,
+        minPrice: null,
+        remainNumber: null,
+        sTime:null,
+        eTime:null
+      },
+      sendForm:{
+        title: null,
+        price: null,
+        couponId:null,
+        couponType:null,
+        userId:null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        title: [
+          { required: true, message: "标题不能为空", trigger: "blur" }
+        ],
+        limitTime: [
+          { required: true, message: "有效期不能为空", trigger: "blur" }
+        ],
+        couponType: [
+          { required: true, message: "券类型不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+    getAllCateList().then(response => {
+      this.diseaseTypeOptions = response.data.diseaseType;
+      this.privateTypeOptions = response.data.privateType;
+    });
+    this.getDicts("sys_coupon_type").then(response => {
+      this.couponTypeOptions = response.data;
+    });
+    this.getDicts("sys_company_status").then(response => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("sys_coupon_limit_type").then(response => {
+      this.limitTypeOptions = response.data;
+    });
+    this.getDicts("sys_company_or").then(response => {
+      this.orOptions = response.data;
+    });
+
+  },
+  methods: {
+    send(row){
+      this.openSend=true;
+      this.sendForm.userId=null;
+      this.sendForm.couponId=row.couponId;
+      this.sendForm.title=row.title;
+      this.sendForm.price=row.price;
+      this.sendForm.couponType=row.couponType;
+    },
+    selectPhone(){
+        selectUser(this.phone).then(response => {
+          this.userList=response.rows;
+          if(this.userList!=null){
+              this.sendForm.userId=this.userList[0].id;
+          }
+        });
+    },
+    cancelSend(){
+      this.openSend=false;
+    },
+    submitSendForm(row){
+      if(this.sendForm.userId==null){
+        return this.$message('未选择用户');
+      }
+      sendCoupon(this.sendForm).then(response => {
+        this.msgSuccess("发送成功");
+        this.openSend=false;
+        this.getList();
+      });
+
+    },
+    /** 查询优惠券列表 */
+    getList() {
+      this.loading = true;
+      listCoupon(this.queryParams).then(response => {
+        this.couponList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        couponId: null,
+        title: null,
+        createTime: null,
+        limitTime: null,
+        price: null,
+        number: null,
+        couponType: null,
+        minPrice: null,
+        remainNumber: null,
+        status:"1",
+        rate:0,
+        limitDay:1,
+        limitCount:1,
+        limitType:null,
+        cateIds:null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+       this.limitTime=null;
+      this.queryParams.sTime=null;
+      this.queryParams.eTime=null;
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.couponId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    handledetails(row){
+            this.show.open=true;
+            setTimeout(() => {
+                 this.$refs.Details.getDetails(row.couponId);
+            }, 1);
+     },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加优惠券";
+    },
+    isShowChange(){
+      this.form.cateIds=null
+      if(this.form.couponType==5){
+        this.cateIdsOptions=this.privateTypeOptions;
+      }else{
+        this.cateIdsOptions=this.diseaseTypeOptions;
+      }
+
+    },
+
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const couponId = row.couponId || this.ids
+      getCoupon(couponId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改优惠券";
+        this.form.status=String(this.form.status)
+        this.form.isShow=String(this.form.isShow)
+
+          if(this.form.couponType==5){
+            this.cateIdsOptions=this.privateTypeOptions;
+          }else{
+            this.cateIdsOptions=this.diseaseTypeOptions;
+          }
+          if(this.form.cateIds!=null){
+           this.form.cateIds= JSON.parse(this.form.cateIds)
+          }
+
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if(this.form.cateIds!=null){
+           this.form.cateIds= JSON.stringify(this.form.cateIds)
+          }
+
+          if (this.form.couponId != null) {
+            updateCoupon(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addCoupon(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    change(){
+          if(this.limitTime!=null){
+            this.queryParams.sTime=this.limitTime[0];
+            this.queryParams.eTime=this.limitTime[1];
+          }else{
+            this.queryParams.sTime=null;
+            this.queryParams.eTime=null;
+          }
+
+        },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const couponIds = row.couponId || this.ids;
+      this.$confirm('是否确认删除优惠券编号为"' + couponIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delCoupon(couponIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有优惠券数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportCoupon(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 432 - 0
src/views/store/userCoupon/index.vue

@@ -0,0 +1,432 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
+      <el-form-item label="券号" prop="couponCode">
+        <el-input
+          v-model="queryParams.couponCode"
+          placeholder="请输入券号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="券标题" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入券标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="用户电话" prop="phone">
+        <el-input
+          v-model="queryParams.phone"
+          placeholder="请输入用户电话"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+       <el-form-item label="领取时间" prop="createTime">
+                 <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
+              </el-form-item>
+      
+      <el-form-item label="使用时间" prop="useTime">
+                 <el-date-picker v-model="useTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeUse"></el-date-picker>
+              </el-form-item>
+      
+
+      <el-form-item label="关联订单" prop="businessId">
+        <el-input
+          v-model="queryParams.businessId"
+          placeholder="请输入关联订单ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="订单类型" prop="businessType">
+        <el-select v-model="queryParams.businessType" placeholder="请选择订单类型" clearable size="small">
+          <el-option
+            v-for="dict in businessTypeOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['his:userCoupon:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
+      <el-tab-pane label="全部" name="10"></el-tab-pane>
+      <el-tab-pane v-for="(item,index) in statusOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
+    </el-tabs>
+    <el-table v-loading="loading" border :data="userCouponList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="优惠劵标题" align="center" prop="title" />
+      <el-table-column label="券号" align="center" prop="couponCode" />
+      <el-table-column label="会员昵称" align="center" prop="nickName" />
+      <el-table-column label="会员电话" align="center" prop="phone" />
+      <el-table-column label="面额" align="center" prop="price" />
+      <el-table-column label="订单类型" align="center" prop="businessType">
+        <template slot-scope="scope">
+          <dict-tag :options="businessTypeOptions" :value="scope.row.businessType"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="卷类型 " align="center" prop="couponType" width="120px">
+        <template slot-scope="scope">
+          <dict-tag :options="couponTypeOptions" :value="scope.row.couponType"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
+       <el-table-column label="发送人" align="center" prop="sendUserName"/>
+       <el-table-column label="公司" align="center" prop="companyName"/>
+       <el-table-column label="销售" align="center" prop="companyUserName"/>
+      <el-table-column label="领取时间" align="center" prop="createTime" width="180"/>
+      <el-table-column label="使用时间" align="center" prop="useTime" width="180"/>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
+        <template slot-scope="scope">
+          <el-button v-if="scope.row.businessType!=null"
+            size="mini"
+            type="text"
+            @click="handledetails(scope.row)"
+          >订单详情</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+    <!-- 添加或修改会员优惠券对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="优惠劵id" prop="couponId">
+          <el-input v-model="form.couponId" placeholder="请输入优惠劵id" />
+        </el-form-item>
+        <el-form-item label="券号" prop="couponCode">
+          <el-input v-model="form.couponCode" placeholder="请输入券号" />
+        </el-form-item>
+        <el-form-item label="会员ID" prop="userId">
+          <el-input v-model="form.userId" placeholder="请输入会员ID" />
+        </el-form-item>
+        <el-form-item label="使用时间" prop="useTime">
+          <el-date-picker clearable size="small"
+            v-model="form.useTime"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择使用时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="关联订单ID" prop="businessId">
+          <el-input v-model="form.businessId" placeholder="请输入关联订单ID" />
+        </el-form-item>
+        <el-form-item label="订单类型" prop="businessType">
+          <el-select v-model="form.businessType" placeholder="请选择订单类型">
+            <el-option
+              v-for="dict in businessTypeOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-select v-model="form.status" placeholder="请选择状态 0未使用 1已使用 2已过期">
+            <el-option
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="parseInt(dict.dictValue)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-drawer
+         :with-header="false"
+         size="75%"
+          :title="show.title" :visible.sync="show.open">
+      <inquiryOrderDetails  ref="Details" />
+    </el-drawer>
+    <el-drawer
+         :with-header="false"
+         size="75%"
+          :title="show.title" :visible.sync="storeOpen">
+      <storeOrderDetails  ref="storeDetails" />
+    </el-drawer>
+  </div>
+</template>
+<script>
+import { listUserCoupon, getUserCoupon, delUserCoupon, addUserCoupon, updateUserCoupon, exportUserCoupon } from "@/api/store/userCoupon";
+import inquiryOrderDetails from '@/views/store/components/inquiryOrderDetails.vue';
+import storeOrderDetails from '@/views/store/components/storeOrderDetails.vue';
+export default {
+  name: "UserCoupon",
+  components: { inquiryOrderDetails,storeOrderDetails },
+  data() {
+    return {
+      show:{
+        open:false,
+        },
+      storeOpen:false,
+      // 遮罩层
+      createTime:[],
+      useTime:[],
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 会员优惠券表格数据
+      userCouponList: [],
+      // 卷类型 1代金券 字典
+      couponTypeOptions: [],
+      // 弹出层标题
+      title: "",
+      actName:"10",
+      // 是否显示弹出层
+      open: false,
+      // 订单类型 1问诊 2商城字典
+      businessTypeOptions: [],
+      // 状态 0未使用 1已使用 2已过期字典
+      statusOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        couponId: null,
+        couponCode: null,
+        userId: null,
+        createTime: null,
+        updateTime: null,
+        useTime: null,
+        businessId: null,
+        businessType: null,
+        status: null,
+        sUseTime:null,
+        eUseTime:null,
+        sTime:null,
+        eTime:null,
+        phone:null,
+        title:null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getDicts("sys_coupon_business_type").then(response => {
+      this.businessTypeOptions = response.data;
+    });
+    this.getDicts("sys_coupon_status").then(response => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("sys_coupon_type").then(response => {
+      this.couponTypeOptions = response.data;
+    });
+  },
+  methods: {
+    /** 查询会员优惠券列表 */
+    getList() {
+      this.loading = true;
+      listUserCoupon(this.queryParams).then(response => {
+        this.userCouponList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    handledetails(row){
+            if(row.businessType==1){
+              this.show.open=true;
+              setTimeout(() => {
+                   this.$refs.Details.getDetails(row.businessId);
+              }, 1);
+            }else if(row.businessType==2){
+              this.storeOpen=true;
+              setTimeout(() => {
+                   this.$refs.storeDetails.getDetails(row.businessId);
+              }, 1);
+            }
+        },
+    handleClickX(tab, event) {
+     if(tab.name=="10"){
+       this.queryParams.status=null;
+     }else{
+       this.queryParams.status=tab.name;
+     }
+      this.handleQuery();
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        couponId: null,
+        couponCode: null,
+        userId: null,
+        createTime: null,
+        updateTime: null,
+        useTime: null,
+        businessId: null,
+        businessType: null,
+        status: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      console.log(this.queryParams)
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+       this.createTime=null;
+      this.queryParams.sTime=null;
+      this.queryParams.eTime=null;
+       this.useTime=null;
+      this.queryParams.sUseTime=null;
+      this.queryParams.eUseTime=null;
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加会员优惠券";
+    },
+    change(){
+          if(this.createTime!=null){
+            this.queryParams.sTime=this.createTime[0];
+            this.queryParams.eTime=this.createTime[1];
+          }else{
+            this.queryParams.sTime=null;
+            this.queryParams.eTime=null;
+          }
+        },
+    changeUse(){
+          if(this.useTime!=null){
+            this.queryParams.sUseTime=this.useTime[0];
+            this.queryParams.eUseTime=this.useTime[1];
+          }else{
+            this.queryParams.sUseTime=null;
+            this.queryParams.eUseTime=null;
+          }
+        },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getUserCoupon(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改会员优惠券";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateUserCoupon(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addUserCoupon(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除会员优惠券编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delUserCoupon(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有会员优惠券数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportUserCoupon(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>