zhuliu 1 년 전
부모
커밋
ed55d1341d

+ 5 - 1
src/api/myApi/index.js

@@ -2,11 +2,15 @@ import * as product from './product'
 import * as category from './category'
 import * as uploadFile from './file'
 import * as common from './common'
+import user from './user'
+import voucher from './voucher'
 
 
 export default{
   ...product,
   ...category,
   ...uploadFile,
-  ...common
+  ...common,
+  ...user,
+  ...voucher
 }

+ 30 - 0
src/api/myApi/user.js

@@ -0,0 +1,30 @@
+import request from '@/utils/request'
+
+
+export default {
+  /**
+   * 查询用户
+   * @param {*} data
+   * @returns
+   */
+  queryUser(data) {
+    return request({
+      url:'/xiaoshi-weixinback/userManage/queryUser',
+      method:'post',
+      data:data
+    })
+  },
+  /**
+     * 查询用户反馈
+     * @param {*} data
+     * @returns
+     */
+  queryUserFeedback(data) {
+    return request({
+      url:'/xiaoshi-weixinback/userFeedBack/queryUserFeedback',
+      method:'post',
+      data:data
+    })
+  },
+
+}

+ 90 - 0
src/api/myApi/voucher.js

@@ -0,0 +1,90 @@
+import request from '@/utils/request'
+
+
+export default {
+  /**
+   * 添加优惠券
+   * @param {*} data
+   * @returns
+   */
+  addVoucher(data) {
+    return request({
+      url:'/xiaoshi-weixinback/voucherManage/addVoucher',
+      method:'post',
+      data:data
+    })
+  },
+  /**
+   * 编辑优惠券
+   * @param {*} data
+   * @returns
+   */
+  editVoucher(data) {
+    return request({
+      url:'/xiaoshi-weixinback/voucherManage/editVoucher',
+      method:'post',
+      data:data
+    })
+  },
+  /**
+   * 查询优惠券
+   * @param {*} data
+   * @returns
+   */
+  queryVoucher(data) {
+    return request({
+      url:'/xiaoshi-weixinback/voucherManage/queryVoucher',
+      method:'post',
+      data:data
+    })
+  },
+  /**
+   * 查询优惠券详情
+   * @param {*} data
+   * @returns
+   */
+  queryVectorDetail(data) {
+    return request({
+      url:'/xiaoshi-weixinback/voucherManage/queryVectorDetail',
+      method:'get',
+      params:data
+    })
+  },
+  /**
+   * 下架优惠券
+   * @param {*} data
+   * @returns
+   */
+  updateBatchVoucher(data) {
+    return request({
+      url:'/xiaoshi-weixinback/voucherManage/updateBatchVoucher',
+      method:'post',
+      data:data
+    })
+  },
+
+  //删除
+  // deleteVoucher(data) {
+  //   return request({
+  //     url:'/xiaoshi-weixinback/voucherManage/deleteVoucher',
+  //     method:'post',
+  //     data:data
+  //   })
+  // },
+
+   /**
+   * 发放优惠券
+   * @param {*} data
+   * @returns
+   */
+   sendVoucherToPerson(data) {
+    return request({
+      url:'/xiaoshi-weixinback/voucherManage/sendVoucherToPerson',
+      method:'post',
+      data:data
+    })
+  },
+
+
+
+}

+ 33 - 0
src/assets/css/main.scss

@@ -0,0 +1,33 @@
+//弹窗
+.el-dialog__wrapper{
+  display: flex;
+  align-items: center;
+  .el-dialog{
+    margin: auto !important;
+    .el-dialog__header{
+      border-bottom: 1px solid #EBEEF5;
+    }
+    .el-dialog__footer{
+      border-top: 1px solid #EBEEF5;
+      padding: 10px 20px 10px 10px;
+    }
+    .el-dialog__title{
+      font-family: var(--fm) !important;
+      color: var(--color1) !important;
+      font-weight: bold !important;
+      font-size: 20px !important;
+    }
+    .el-dialog__body{
+      padding-top: 15px;
+      max-height: calc(100vh - 220px) !important;
+      overflow: auto;
+    }
+  }
+}
+.el-container {height: 100%;}
+.el-footer {background: #fff;border-top: 1px solid #e6e6e6;padding:5px 15px !important;}
+.footer-common {
+  height: 70px !important;
+  text-align: right;
+}
+

+ 1 - 0
src/main.js

@@ -9,6 +9,7 @@ import VCharts from 'v-charts'
 
 import '@/styles/index.scss' // global css
 import "@/assets/css/theme.css"
+import "@/assets/css/main.scss"
 import App from './App'
 import router from './router'
 import store from './store'

+ 181 - 176
src/router/index.js

@@ -174,181 +174,187 @@ export const asyncRouterMap = [
       // }
     ]
   },
-  // {
-  //   path:'/sms',
-  //   component: Layout,
-  //   redirect: '/sms/coupon',
-  //   name: 'sms',
-  //   meta: {title: '营销', icon: 'sms'},
-  //   children: [
-  //     {
-  //       path: 'flash',
-  //       name: 'flash',
-  //       component: () => import('@/views/sms/flash/index'),
-  //       meta: {title: '秒杀活动列表', icon: 'sms-flash'}
-  //     },
-  //     {
-  //       path: 'flashSession',
-  //       name: 'flashSession',
-  //       component: () => import('@/views/sms/flash/sessionList'),
-  //       meta: {title: '秒杀时间段列表'},
-  //       hidden:true
-  //     },
-  //     {
-  //       path: 'selectSession',
-  //       name: 'selectSession',
-  //       component: () => import('@/views/sms/flash/selectSessionList'),
-  //       meta: {title: '秒杀时间段选择'},
-  //       hidden:true
-  //     },
-  //     {
-  //       path: 'flashProductRelation',
-  //       name: 'flashProductRelation',
-  //       component: () => import('@/views/sms/flash/productRelationList'),
-  //       meta: {title: '秒杀商品列表'},
-  //       hidden:true
-  //     },
-  //     {
-  //       path: 'coupon',
-  //       name: 'coupon',
-  //       component: () => import('@/views/sms/coupon/index'),
-  //       meta: {title: '优惠券列表', icon: 'sms-coupon'}
-  //     },
-  //     {
-  //       path: 'addCoupon',
-  //       name: 'addCoupon',
-  //       component: () => import('@/views/sms/coupon/add'),
-  //       meta: {title: '添加优惠券'},
-  //       hidden:true
-  //     },
-  //     {
-  //       path: 'updateCoupon',
-  //       name: 'updateCoupon',
-  //       component: () => import('@/views/sms/coupon/update'),
-  //       meta: {title: '修改优惠券'},
-  //       hidden:true
-  //     },
-  //     {
-  //       path: 'couponHistory',
-  //       name: 'couponHistory',
-  //       component: () => import('@/views/sms/coupon/history'),
-  //       meta: {title: '优惠券领取详情'},
-  //       hidden:true
-  //     },
-  //     {
-  //       path: 'brand',
-  //       name: 'homeBrand',
-  //       component: () => import('@/views/sms/brand/index'),
-  //       meta: {title: '品牌推荐', icon: 'product-brand'}
-  //     },
-  //     {
-  //       path: 'new',
-  //       name: 'homeNew',
-  //       component: () => import('@/views/sms/new/index'),
-  //       meta: {title: '新品推荐', icon: 'sms-new'}
-  //     },
-  //     {
-  //       path: 'hot',
-  //       name: 'homeHot',
-  //       component: () => import('@/views/sms/hot/index'),
-  //       meta: {title: '人气推荐', icon: 'sms-hot'}
-  //     },
-  //     {
-  //       path: 'subject',
-  //       name: 'homeSubject',
-  //       component: () => import('@/views/sms/subject/index'),
-  //       meta: {title: '专题推荐', icon: 'sms-subject'}
-  //     },
-  //     {
-  //       path: 'advertise',
-  //       name: 'homeAdvertise',
-  //       component: () => import('@/views/sms/advertise/index'),
-  //       meta: {title: '广告列表', icon: 'sms-ad'}
-  //     },
-  //     {
-  //       path: 'addAdvertise',
-  //       name: 'addHomeAdvertise',
-  //       component: () => import('@/views/sms/advertise/add'),
-  //       meta: {title: '添加广告'},
-  //       hidden:true
-  //     },
-  //     {
-  //       path: 'updateAdvertise',
-  //       name: 'updateHomeAdvertise',
-  //       component: () => import('@/views/sms/advertise/update'),
-  //       meta: {title: '编辑广告'},
-  //       hidden:true
-  //     }
-  //   ]
-  // },
-  // {
-  //   path:'/ums',
-  //   component: Layout,
-  //   redirect: '/ums/admin',
-  //   name: 'ums',
-  //   meta: {title: '权限', icon: 'ums'},
-  //   children: [
-  //     {
-  //       path: 'admin',
-  //       name: 'admin',
-  //       component: () => import('@/views/ums/admin/index'),
-  //       meta: {title: '用户列表', icon: 'ums-admin'}
-  //     },
-  //     {
-  //       path: 'role',
-  //       name: 'role',
-  //       component: () => import('@/views/ums/role/index'),
-  //       meta: {title: '角色列表', icon: 'ums-role'}
-  //     },
-  //     {
-  //       path: 'allocMenu',
-  //       name: 'allocMenu',
-  //       component: () => import('@/views/ums/role/allocMenu'),
-  //       meta: {title: '分配菜单'},
-  //       hidden: true
-  //     },
-  //     {
-  //       path: 'allocResource',
-  //       name: 'allocResource',
-  //       component: () => import('@/views/ums/role/allocResource'),
-  //       meta: {title: '分配资源'},
-  //       hidden: true
-  //     },
-  //     {
-  //       path: 'menu',
-  //       name: 'menu',
-  //       component: () => import('@/views/ums/menu/index'),
-  //       meta: {title: '菜单列表', icon: 'ums-menu'}
-  //     },
-  //     {
-  //       path: 'addMenu',
-  //       name: 'addMenu',
-  //       component: () => import('@/views/ums/menu/add'),
-  //       meta: {title: '添加菜单'},
-  //       hidden: true
-  //     },
-  //     {
-  //       path: 'updateMenu',
-  //       name: 'updateMenu',
-  //       component: () => import('@/views/ums/menu/update'),
-  //       meta: {title: '修改菜单'},
-  //       hidden: true
-  //     },
-  //     {
-  //       path: 'resource',
-  //       name: 'resource',
-  //       component: () => import('@/views/ums/resource/index'),
-  //       meta: {title: '资源列表', icon: 'ums-resource'}
-  //     },
-  //     {
-  //       path: 'resourceCategory',
-  //       name: 'resourceCategory',
-  //       component: () => import('@/views/ums/resource/categoryList'),
-  //       meta: {title: '资源分类'},
-  //       hidden: true
-  //     }
-  //   ]
-  // },
+  {
+    path:'/sms',
+    component: Layout,
+    redirect: '/sms/coupon',
+    name: 'sms',
+    meta: {title: '营销', icon: 'sms'},
+    children: [
+      // {
+      //   path: 'flash',
+      //   name: 'flash',
+      //   component: () => import('@/views/sms/flash/index'),
+      //   meta: {title: '秒杀活动列表', icon: 'sms-flash'}
+      // },
+      // {
+      //   path: 'flashSession',
+      //   name: 'flashSession',
+      //   component: () => import('@/views/sms/flash/sessionList'),
+      //   meta: {title: '秒杀时间段列表'},
+      //   hidden:true
+      // },
+      // {
+      //   path: 'selectSession',
+      //   name: 'selectSession',
+      //   component: () => import('@/views/sms/flash/selectSessionList'),
+      //   meta: {title: '秒杀时间段选择'},
+      //   hidden:true
+      // },
+      // {
+      //   path: 'flashProductRelation',
+      //   name: 'flashProductRelation',
+      //   component: () => import('@/views/sms/flash/productRelationList'),
+      //   meta: {title: '秒杀商品列表'},
+      //   hidden:true
+      // },
+      {
+        path: 'coupon',
+        name: 'coupon',
+        component: () => import('@/views/sms/coupon/index'),
+        meta: {title: '优惠券列表', icon: 'sms-coupon'}
+      },
+      {
+        path: 'addCoupon',
+        name: 'addCoupon',
+        component: () => import('@/views/sms/coupon/add'),
+        meta: {title: '添加优惠券'},
+        hidden:true
+      },
+      {
+        path: 'updateCoupon',
+        name: 'updateCoupon',
+        component: () => import('@/views/sms/coupon/update'),
+        meta: {title: '修改优惠券'},
+        hidden:true
+      },
+      {
+        path: 'couponHistory',
+        name: 'couponHistory',
+        component: () => import('@/views/sms/coupon/history'),
+        meta: {title: '优惠券领取详情'},
+        hidden:true
+      },
+      // {
+      //   path: 'brand',
+      //   name: 'homeBrand',
+      //   component: () => import('@/views/sms/brand/index'),
+      //   meta: {title: '品牌推荐', icon: 'product-brand'}
+      // },
+      // {
+      //   path: 'new',
+      //   name: 'homeNew',
+      //   component: () => import('@/views/sms/new/index'),
+      //   meta: {title: '新品推荐', icon: 'sms-new'}
+      // },
+      // {
+      //   path: 'hot',
+      //   name: 'homeHot',
+      //   component: () => import('@/views/sms/hot/index'),
+      //   meta: {title: '人气推荐', icon: 'sms-hot'}
+      // },
+      // {
+      //   path: 'subject',
+      //   name: 'homeSubject',
+      //   component: () => import('@/views/sms/subject/index'),
+      //   meta: {title: '专题推荐', icon: 'sms-subject'}
+      // },
+      // {
+      //   path: 'advertise',
+      //   name: 'homeAdvertise',
+      //   component: () => import('@/views/sms/advertise/index'),
+      //   meta: {title: '广告列表', icon: 'sms-ad'}
+      // },
+      // {
+      //   path: 'addAdvertise',
+      //   name: 'addHomeAdvertise',
+      //   component: () => import('@/views/sms/advertise/add'),
+      //   meta: {title: '添加广告'},
+      //   hidden:true
+      // },
+      // {
+      //   path: 'updateAdvertise',
+      //   name: 'updateHomeAdvertise',
+      //   component: () => import('@/views/sms/advertise/update'),
+      //   meta: {title: '编辑广告'},
+      //   hidden:true
+      // }
+    ]
+  },
+  {
+    path:'/ums',
+    component: Layout,
+    redirect: '/ums/admin',
+    name: 'ums',
+    meta: {title: '用户', icon: 'ums'},
+    children: [
+      {
+        path: 'admin',
+        name: 'admin',
+        component: () => import('@/views/ums/admin/index'),
+        meta: {title: '用户列表', icon: 'ums-admin'}
+      },
+      {
+        path: 'feedback',
+        name: 'feedback',
+        component: () => import('@/views/ums/feedback/index'),
+        meta: {title: '用户反馈', icon: 'ums-admin'}
+      },
+      // {
+      //   path: 'role',
+      //   name: 'role',
+      //   component: () => import('@/views/ums/role/index'),
+      //   meta: {title: '角色列表', icon: 'ums-role'}
+      // },
+      // {
+      //   path: 'allocMenu',
+      //   name: 'allocMenu',
+      //   component: () => import('@/views/ums/role/allocMenu'),
+      //   meta: {title: '分配菜单'},
+      //   hidden: true
+      // },
+      // {
+      //   path: 'allocResource',
+      //   name: 'allocResource',
+      //   component: () => import('@/views/ums/role/allocResource'),
+      //   meta: {title: '分配资源'},
+      //   hidden: true
+      // },
+      // {
+      //   path: 'menu',
+      //   name: 'menu',
+      //   component: () => import('@/views/ums/menu/index'),
+      //   meta: {title: '菜单列表', icon: 'ums-menu'}
+      // },
+      // {
+      //   path: 'addMenu',
+      //   name: 'addMenu',
+      //   component: () => import('@/views/ums/menu/add'),
+      //   meta: {title: '添加菜单'},
+      //   hidden: true
+      // },
+      // {
+      //   path: 'updateMenu',
+      //   name: 'updateMenu',
+      //   component: () => import('@/views/ums/menu/update'),
+      //   meta: {title: '修改菜单'},
+      //   hidden: true
+      // },
+      // {
+      //   path: 'resource',
+      //   name: 'resource',
+      //   component: () => import('@/views/ums/resource/index'),
+      //   meta: {title: '资源列表', icon: 'ums-resource'}
+      // },
+      // {
+      //   path: 'resourceCategory',
+      //   name: 'resourceCategory',
+      //   component: () => import('@/views/ums/resource/categoryList'),
+      //   meta: {title: '资源分类'},
+      //   hidden: true
+      // }
+    ]
+  },
   {path: '*', redirect: '/404', hidden: true}
 ]
 
@@ -366,7 +372,6 @@ const route = new Router({
 
 // 在你的路由配置文件中
 route.afterEach((to, from) => {
-  console.log(to)
   var obj = {
     name:to.meta.title,
     path:to.path

+ 1 - 1
src/utils/request.js

@@ -5,7 +5,7 @@ import { getToken } from '@/utils/auth'
 // 创建axios实例
 const service = axios.create({
   baseURL:'', // api的base_url
-  timeout: 30000 // 请求超时时间
+  timeout: 300000 // 请求超时时间
 })
 
 // request拦截器

+ 1 - 1
src/views/oms/order/index.vue

@@ -227,7 +227,7 @@
         operateOptions: [
           {
             label: "删除",
-            value: 1
+            value: 3
           }
         ],
         //工单进度

+ 28 - 6
src/views/pms/productCate/index.vue

@@ -64,11 +64,24 @@
         </el-table-column> -->
         <el-table-column label="设置" width="120" align="center">
           <template slot-scope="scope">
-            <el-button
-              size="mini"
-              :disabled="!scope.row.ifChild"
-              @click="handleShowNextLevel(scope.$index, scope.row)">查看下级
-            </el-button>
+            <div class="btn">
+              <!-- <div style="margin-bottom:10px">
+                <el-button
+                  size="mini"
+                  v-if="scope.row.categoryLevelVo && scope.row.categoryLevelVo.id"
+                  @click="handleShowPropLevel(scope.$index, scope.row)">返回上级
+                </el-button>
+              </div> -->
+              <div>
+                <el-button
+                  size="mini"
+                  :disabled="!scope.row.ifChild"
+                  @click="handleShowNextLevel(scope.$index, scope.row)">查看下级
+                </el-button>
+              </div>
+
+            </div>
+
           </template>
         </el-table-column>
         <el-table-column label="操作" width="200" align="center">
@@ -218,6 +231,10 @@ import { mapGetters } from 'vuex'
       handleShowNextLevel(index, row) {
         this.$router.push({path: '/pms/productCate', query: {parentId: row.id}})
       },
+      //返回上一级
+      handleShowPropLevel(){
+        this.$router.go(-1)
+      },
       //编辑
       handleUpdate(index, row) {
         this.$router.push({path:'/pms/updateProductCate',query:{id:row.id}});
@@ -256,7 +273,7 @@ import { mapGetters } from 'vuex'
   }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
   .card{
     position: relative;
   }
@@ -265,4 +282,9 @@ import { mapGetters } from 'vuex'
     position: absolute;
     bottom: 0;
   }
+  .btn{
+    display: flex;
+    align-items: center;
+    flex-direction: column;
+  }
 </style>

+ 25 - 0
src/views/sms/coupon/common/constants.js

@@ -0,0 +1,25 @@
+export default{
+  //优惠券类型
+  type:{
+    0:'金额券'
+  },
+  //优惠券状态
+  state:{
+    0:"下架",
+    1:"上架中"
+  },
+  //获取方式
+  getWay:{
+    // 0:'赠送',
+    1:'购买'
+  },
+  //使用范围
+  useScopes:{
+    '-1':'开通会员',
+    '0':'购买券',
+    '1':'专利解读',
+    '2':'维权工单',
+    '3':'申诉工单',
+    '4':'申请工单',
+  }
+}

+ 148 - 249
src/views/sms/coupon/components/CouponDetail.vue

@@ -1,4 +1,4 @@
-<template> 
+<template>
   <el-card class="form-container" shadow="never">
     <el-form :model="coupon"
              :rules="rules"
@@ -6,125 +6,55 @@
              label-width="150px"
              size="small">
       <el-form-item label="优惠券类型:">
-        <el-select v-model="coupon.type">
+        <el-select v-model="coupon.type" class="input-width">
           <el-option
-            v-for="type in typeOptions"
-            :key="type.value"
-            :label="type.label"
-            :value="type.value">
+            v-for="(type,key) in type"
+            :key="key"
+            :label="type"
+            :value="Number(key)">
           </el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="优惠券名称:" prop="name">
-        <el-input v-model="coupon.name" class="input-width"></el-input>
+        <el-input v-model="coupon.name" class="input-width" placeholder="优惠券名称"></el-input>
       </el-form-item>
-      <el-form-item label="适用平台:">
-        <el-select v-model="coupon.platform">
-          <el-option
-            v-for="item in platformOptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value">
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item label="总发行量:" prop="publishCount">
+
+      <!-- <el-form-item label="总发行量:" prop="publishCount">
         <el-input v-model.number="coupon.publishCount" placeholder="只能输入正整数" class="input-width"></el-input>
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item label="面额:" prop="amount">
-        <el-input v-model.number="coupon.amount" placeholder="面值只能是数值,限2位小数" class="input-width">
+        <el-input v-model.number="coupon.amount" placeholder="只能是数值,限2位小数" class="input-width">
           <template slot="append">元</template>
         </el-input>
       </el-form-item>
-      <el-form-item label="每人限领:">
+      <el-form-item label="售价:" prop="sellingPrice">
+        <el-input v-model.number="coupon.sellingPrice" placeholder="只能是数值,限2位小数" class="input-width">
+          <template slot="append">元</template>
+        </el-input>
+      </el-form-item>
+      <!-- <el-form-item label="每人限领:">
         <el-input v-model="coupon.perLimit" placeholder="只能输入正整数" class="input-width">
           <template slot="append">张</template>
         </el-input>
-      </el-form-item>
-      <el-form-item label="使用门槛:" prop="minPoint">
-        <el-input v-model.number="coupon.minPoint" placeholder="只能输入正整数" class="input-width">
+      </el-form-item> -->
+      <el-form-item label="使用门槛:" prop="threshold">
+        <el-input v-model.number="coupon.threshold" placeholder="只能输入正整数" class="input-width">
           <template slot="prepend">满</template>
           <template slot="append">元可用</template>
         </el-input>
       </el-form-item>
-      <el-form-item label="领取日期:" prop="enableTime">
-        <el-date-picker type="date" placeholder="选择日期" v-model="coupon.enableTime" class="input-width"></el-date-picker>
+      <el-form-item label="领取日期:" prop="available_time">
+        <el-date-picker type="date" placeholder="选择日期" v-model="coupon.availableTime" value-format="yyyy-MM-dd" class="input-width"></el-date-picker>
       </el-form-item>
       <el-form-item label="有效期:">
-        <el-date-picker type="date" placeholder="选择日期" v-model="coupon.startTime" style="width: 150px"></el-date-picker>
-        <span style="margin-left: 20px;margin-right: 20px">至</span>
-        <el-date-picker type="date" placeholder="选择日期" v-model="coupon.endTime" style="width: 150px"></el-date-picker>
+        <!-- <el-date-picker type="date" placeholder="选择日期" v-model="coupon.startTime" style="width: 150px"></el-date-picker>
+        <span style="margin-left: 20px;margin-right: 20px">至</span> -->
+        <el-date-picker type="date" placeholder="选择日期,不选默认永久" v-model="coupon.expirationTime" value-format="yyyy-MM-dd" class="input-width"></el-date-picker>
       </el-form-item>
-      <el-form-item label="可使用商品:">
-        <el-radio-group v-model="coupon.useType">
-          <el-radio-button :label="0">全场通用</el-radio-button>
-          <el-radio-button :label="1">指定分类</el-radio-button>
-          <el-radio-button :label="2">指定商品</el-radio-button>
-        </el-radio-group>
-      </el-form-item>
-      <el-form-item v-show="coupon.useType===1">
-        <el-cascader
-          clearable
-          placeholder="请选择分类名称"
-          v-model="selectProductCate"
-          :options="productCateOptions">
-        </el-cascader>
-        <el-button @click="handleAddProductCategoryRelation()">添加</el-button>
-        <el-table ref="productCateRelationTable"
-                  :data="coupon.productCategoryRelationList"
-                  style="width: 100%;margin-top: 20px"
-                  border>
-          <el-table-column label="分类名称" align="center">
-            <template slot-scope="scope">{{scope.row.parentCategoryName}}>{{scope.row.productCategoryName}}</template>
-          </el-table-column>
-          <el-table-column label="操作" align="center" width="100">
-            <template slot-scope="scope">
-              <el-button size="mini"
-                         type="text"
-                         @click="handleDeleteProductCateRelation(scope.$index, scope.row)">删除
-              </el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-      </el-form-item>
-      <el-form-item v-show="coupon.useType===2">
-        <el-select
-          v-model="selectProduct"
-          filterable
-          remote
-          reserve-keyword
-          placeholder="商品名称/商品货号"
-          :remote-method="searchProductMethod"
-          :loading="selectProductLoading">
-          <el-option
-            v-for="item in selectProductOptions"
-            :key="item.productId"
-            :label="item.productName"
-            :value="item.productId">
-            <span style="float: left">{{ item.productName }}</span>
-            <span style="float: right; color: #8492a6; font-size: 13px">NO.{{ item.productSn }}</span>
-          </el-option>
-        </el-select>
-        <el-button @click="handleAddProductRelation()">添加</el-button>
-        <el-table ref="productRelationTable"
-                  :data="coupon.productRelationList"
-                  style="width: 100%;margin-top: 20px"
-                  border>
-          <el-table-column label="商品名称" align="center">
-            <template slot-scope="scope">{{scope.row.productName}}</template>
-          </el-table-column>
-          <el-table-column label="货号" align="center"  width="120" >
-            <template slot-scope="scope">NO.{{scope.row.productSn}}</template>
-          </el-table-column>
-          <el-table-column label="操作" align="center" width="100">
-            <template slot-scope="scope">
-              <el-button size="mini"
-                         type="text"
-                         @click="handleDeleteProductRelation(scope.$index, scope.row)">删除
-              </el-button>
-            </template>
-          </el-table-column>
-        </el-table>
+      <el-form-item label="使用范围:">
+        <el-checkbox-group v-model="coupon.useScopes">
+          <el-checkbox v-for="(useScope,key,index) in useScopes" :label="Number(key)" :key="index">{{useScope}}</el-checkbox>
+        </el-checkbox-group>
       </el-form-item>
       <el-form-item label="备注:">
         <el-input
@@ -132,67 +62,33 @@
           type="textarea"
           :rows="5"
           placeholder="请输入内容"
-          v-model="coupon.note">
+          v-model="coupon.remark">
         </el-input>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" @click="onSubmit('couponFrom')">提交</el-button>
-        <el-button v-if="!isEdit" @click="resetForm('couponFrom')">重置</el-button>
+        <el-button type="primary" @click="onSubmit('couponFrom')" :loading="loading">提交</el-button>
+        <el-button v-if="!isEdit" @click="resetForm('couponFrom')" :loading="loading">重置</el-button>
       </el-form-item>
     </el-form>
   </el-card>
 </template>
 <script>
-  import {createCoupon,getCoupon,updateCoupon} from '@/api/coupon';
-  import {fetchSimpleList as fetchProductList} from '@/api/product';
-  import {fetchListWithChildren} from '@/api/productCate'
+  import voucherConstants from '../common/constants'
+  import {formatDate} from '@/utils/date';
   const defaultCoupon = {
-    type: 0,
-    name: null,
-    platform: 0,
-    amount: null,
-    perLimit: 1,
-    minPoint: null,
-    startTime: null,
-    endTime: null,
-    useType: 0,
-    note: null,
-    publishCount: null,
-    productRelationList: [],
-    productCategoryRelationList: []
+    type: 0,//类型
+    name: null,//名称
+    amount: null,//当为折扣券时,为折扣百分比,当为金额券时,为金额
+    availableTime: formatDate(new Date(),'yyyy-MM-dd'),//可领取时间
+    expirationTime: null,//使用期限
+    useScopes:[1,2,3,4],//使用范围
+    state:1,//状态
+    remark: null,//备注
+    threshold: 0,//使用门槛
+    sellingPrice: 0,//售价
+    getWay: 1,//获取方式
   };
-  const defaultTypeOptions = [
-    {
-      label: '全场赠券',
-      value: 0
-    },
-    {
-      label: '会员赠券',
-      value: 1
-    },
-    {
-      label: '购物赠券',
-      value: 2
-    },
-    {
-      label: '注册赠券',
-      value: 3
-    }
-  ];
-  const defaultPlatformOptions = [
-    {
-      label: '全平台',
-      value: 0
-    },
-    {
-      label: '移动平台',
-      value: 1
-    },
-    {
-      label: 'PC平台',
-      value: 2
-    }
-  ];
+
   export default {
     name: 'CouponDetail',
     props: {
@@ -204,37 +100,33 @@
     data() {
       return {
         coupon: Object.assign({}, defaultCoupon),
-        typeOptions: Object.assign({}, defaultTypeOptions),
-        platformOptions: Object.assign({}, defaultPlatformOptions),
+        type:voucherConstants.type,
+        useScopes:voucherConstants.useScopes,
         rules: {
           name: [
             {required: true, message: '请输入优惠券名称', trigger: 'blur'},
             {min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
           ],
-          publishCount: [
-            {type: 'number',required: true, message: '只能输入正整数', trigger: 'blur'}
-          ],
+          // publishCount: [
+          //   {type: 'number',required: true, message: '只能输入正整数', trigger: 'blur'}
+          // ],
           amount: [
             {type: 'number',required: true,message: '面值只能是数值,0.01-10000,限2位小数',trigger: 'blur'}
           ],
-          minPoint: [
+          threshold: [
             {type: 'number',required: true,message: '只能输入正整数',trigger: 'blur'}
           ]
         },
-        selectProduct:null,
-        selectProductLoading: false,
-        selectProductOptions:[],
-        selectProductCate: null,
-        productCateOptions: []
+        loading:false
       }
     },
     created(){
       if(this.isEdit){
-        getCoupon(this.$route.query.id).then(response=>{
+        this.$api.queryVectorDetail({id:this.$route.query.id}).then(response=>{
           this.coupon=response.data;
         });
       }
-      this.getProductCateList();
+      // this.getProductCateList();
     },
     methods:{
       onSubmit(formName) {
@@ -245,8 +137,10 @@
               cancelButtonText: '取消',
               type: 'warning'
             }).then(() => {
+              this.loading = true
               if(this.isEdit){
-                updateCoupon(this.$route.query.id,this.coupon).then(response=>{
+                this.$api.editVoucher(this.coupon).then(response=>{
+                  this.loading = false
                   this.$refs[formName].resetFields();
                   this.$message({
                     message: '修改成功',
@@ -254,9 +148,12 @@
                     duration:1000
                   });
                   this.$router.back();
-                });
+                }).catch(error=>{
+                  this.loading = false
+                })
               }else{
-                createCoupon(this.coupon).then(response=>{
+                this.$api.addVoucher(this.coupon).then(response=>{
+                  this.loading = false
                   this.$refs[formName].resetFields();
                   this.$message({
                     message: '提交成功',
@@ -264,7 +161,9 @@
                     duration:1000
                   });
                   this.$router.back();
-                });
+                }).catch(error=>{
+                  this.loading = false
+                })
               }
             });
           } else {
@@ -281,88 +180,88 @@
         this.$refs[formName].resetFields();
         this.coupon = Object.assign({},defaultCoupon);
       },
-      searchProductMethod(query){
-        if (query !== '') {
-          this.loading = true;
-          fetchProductList({keyword:query}).then(response=>{
-            this.loading=false;
-            let productList = response.data;
-            this.selectProductOptions = [];
-            for(let i=0;i<productList.length;i++){
-              let item = productList[i];
-              this.selectProductOptions.push({productId:item.id,productName:item.name,productSn:item.productSn});
-            }
-          });
-        } else {
-          this.selectProductOptions = [];
-        }
-      },
-      handleAddProductRelation(){
-        if(this.selectProduct===null){
-          this.$message({
-            message: '请先选择商品',
-            type: 'warning'
-          });
-          return
-        }
-        this.coupon.productRelationList.push(this.getProductById(this.selectProduct));
-        this.selectProduct=null;
-      },
-      handleDeleteProductRelation(index,row){
-        this.coupon.productRelationList.splice(index,1);
-      },
-      handleAddProductCategoryRelation(){
-        if(this.selectProductCate===null||this.selectProductCate.length===0){
-          this.$message({
-            message: '请先选择商品分类',
-            type: 'warning'
-          });
-          return
-        }
-        this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate));
-        this.selectProductCate=[];
-      },
-      handleDeleteProductCateRelation(index,row){
-        this.coupon.productCategoryRelationList.splice(index,1);
-      },
-      getProductById(id){
-        for(let i=0;i<this.selectProductOptions.length;i++){
-          if(id===this.selectProductOptions[i].productId){
-            return this.selectProductOptions[i];
-          }
-        }
-        return null;
-      },
-      getProductCateList() {
-        fetchListWithChildren().then(response => {
-          let list = response.data;
-          this.productCateOptions = [];
-          for (let i = 0; i < list.length; i++) {
-            let children = [];
-            if (list[i].children != null && list[i].children.length > 0) {
-              for (let j = 0; j < list[i].children.length; j++) {
-                children.push({label: list[i].children[j].name, value: list[i].children[j].id});
-              }
-            }
-            this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
-          }
-        });
-      },
-      getProductCateByIds(ids){
-        let name;
-        let parentName;
-        for (let i = 0; i < this.productCateOptions.length; i++) {
-          if (this.productCateOptions[i].value === ids[0]) {
-            parentName = this.productCateOptions[i].label;
-            for (let j = 0; j < this.productCateOptions[i].children.length; j++) {
-              if (this.productCateOptions[i].children[j].value === ids[1]) {
-                name = this.productCateOptions[i].children[j].label;
-              }
-            }
-          }
-        }
-        return {productCategoryId: ids[1], productCategoryName: name, parentCategoryName: parentName};
-      }
+      // searchProductMethod(query){
+      //   if (query !== '') {
+      //     this.loading = true;
+      //     fetchProductList({keyword:query}).then(response=>{
+      //       this.loading=false;
+      //       let productList = response.data;
+      //       this.selectProductOptions = [];
+      //       for(let i=0;i<productList.length;i++){
+      //         let item = productList[i];
+      //         this.selectProductOptions.push({productId:item.id,productName:item.name,productSn:item.productSn});
+      //       }
+      //     });
+      //   } else {
+      //     this.selectProductOptions = [];
+      //   }
+      // },
+      // handleAddProductRelation(){
+      //   if(this.selectProduct===null){
+      //     this.$message({
+      //       message: '请先选择商品',
+      //       type: 'warning'
+      //     });
+      //     return
+      //   }
+      //   this.coupon.productRelationList.push(this.getProductById(this.selectProduct));
+      //   this.selectProduct=null;
+      // },
+      // handleDeleteProductRelation(index,row){
+      //   this.coupon.productRelationList.splice(index,1);
+      // },
+      // handleAddProductCategoryRelation(){
+      //   if(this.selectProductCate===null||this.selectProductCate.length===0){
+      //     this.$message({
+      //       message: '请先选择商品分类',
+      //       type: 'warning'
+      //     });
+      //     return
+      //   }
+      //   this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate));
+      //   this.selectProductCate=[];
+      // },
+      // handleDeleteProductCateRelation(index,row){
+      //   this.coupon.productCategoryRelationList.splice(index,1);
+      // },
+      // getProductById(id){
+      //   for(let i=0;i<this.selectProductOptions.length;i++){
+      //     if(id===this.selectProductOptions[i].productId){
+      //       return this.selectProductOptions[i];
+      //     }
+      //   }
+      //   return null;
+      // },
+      // getProductCateList() {
+      //   fetchListWithChildren().then(response => {
+      //     let list = response.data;
+      //     this.productCateOptions = [];
+      //     for (let i = 0; i < list.length; i++) {
+      //       let children = [];
+      //       if (list[i].children != null && list[i].children.length > 0) {
+      //         for (let j = 0; j < list[i].children.length; j++) {
+      //           children.push({label: list[i].children[j].name, value: list[i].children[j].id});
+      //         }
+      //       }
+      //       this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
+      //     }
+      //   });
+      // },
+      // getProductCateByIds(ids){
+      //   let name;
+      //   let parentName;
+      //   for (let i = 0; i < this.productCateOptions.length; i++) {
+      //     if (this.productCateOptions[i].value === ids[0]) {
+      //       parentName = this.productCateOptions[i].label;
+      //       for (let j = 0; j < this.productCateOptions[i].children.length; j++) {
+      //         if (this.productCateOptions[i].children[j].value === ids[1]) {
+      //           name = this.productCateOptions[i].children[j].label;
+      //         }
+      //       }
+      //     }
+      //   }
+      //   return {productCategoryId: ids[1], productCategoryName: name, parentCategoryName: parentName};
+      // }
     }
   }
 </script>

+ 247 - 0
src/views/sms/coupon/dialog/distributeCoupons.vue

@@ -0,0 +1,247 @@
+<template>
+  <div>
+    <el-dialog
+      title="发放优惠券"
+      :before-close="handleClose"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      :visible.sync="dialogVisible"
+      width="80%">
+      <!-- 优惠券 -->
+      <div class="distributeCoupons">
+        <div class="coupon">
+          <div class="head" >
+            <el-button v-if="type == 1" size="small" @click="chooseCouponList">选择优惠券</el-button>
+          </div>
+            <div v-if="couponList.length>0">
+
+                <el-table ref="couponTable"
+                  :data="couponList"
+                  style="width: 100%;"
+                  border>
+                  <el-table-column label="序号" width="100" align="center">
+                    <template slot-scope="scope">{{scope.$index+1}}</template>
+                  </el-table-column>
+                  <el-table-column label="优惠券名称" align="center">
+                    <template slot-scope="scope">{{scope.row.name}}</template>
+                  </el-table-column>
+                  <el-table-column label="发放数量" align="center">
+                    <template slot-scope="scope">
+                      <div>
+                        <el-input-number v-model="scope.row.distributeNum" style="width:100%" :min="1" label=""></el-input-number>
+                      </div>
+                    </template>
+
+                  </el-table-column>
+                  <el-table-column label="操作" width="180" align="center">
+                    <template slot-scope="scope">
+                      <el-button size="mini"
+                                type="text"
+                                @click="removeCoupon(scope.$index, scope.row)">移除</el-button>
+                    </template>
+                  </el-table-column>
+              </el-table>
+            </div>
+            <div v-else class="empty">暂无数据</div>
+        </div>
+        <!-- 账号 -->
+        <div class="person">
+          <div class="head" >
+            <el-button v-if="type == 2" size="small" @click="choosePersonList">选择人员</el-button>
+          </div>
+          <div v-if="personList.length>0">
+            <el-table ref="couponTable"
+                :data="personList"
+                style="width: 100%;"
+                border>
+                <el-table-column label="序号" width="100" align="center">
+                  <template slot-scope="scope">{{scope.$index+1}}</template>
+                </el-table-column>
+                <el-table-column label="手机号/帐号" align="center">
+                  <template slot-scope="scope">{{scope.row.phoneNum}}</template>
+                </el-table-column>
+                <el-table-column label="操作" width="180" align="center">
+                  <template slot-scope="scope">
+                    <el-button size="mini"
+                              type="text"
+                              @click="removePerson(scope.$index, scope.row)">移除</el-button>
+                  </template>
+                </el-table-column>
+            </el-table>
+          </div>
+          <div v-else class="empty">暂无数据</div>
+        </div>
+      </div>
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" :loading="loading" @click="submit">确 定</el-button>
+      </span>
+    </el-dialog>
+
+    <el-drawer class="custom-drawer-form" :title="drawer.title" size="80%" append-to-body :visible.sync="drawer.show"
+      direction="rtl" destroy-on-close>
+      <el-container>
+        <el-main v-if="drawer.show">
+          <component ref="dataComponent" :is='drawer.component' :permission="1"></component>
+        </el-main>
+        <el-footer class="footer-common">
+          <el-button @click="drawer.show = false">取 消</el-button>
+          <el-button type="primary" @click="getData" :loading="drawer.loading">确 定</el-button>
+        </el-footer>
+      </el-container>
+    </el-drawer>
+
+  </div>
+</template>
+
+<script>
+import couponIndex from '../index.vue'
+import personIndex from '@/views/ums/admin/index.vue'
+export default {
+  name:'distributeCoupons',
+  components: {
+    couponIndex,
+    personIndex
+  },
+  props: {},
+  data() {
+    return {
+      dialogVisible:false,
+      couponList:[],
+      personList:[],
+      loading:false,
+      type:null,
+      drawer:{
+        show:false,
+        title:'',
+        component:'',
+        loading:false
+      }
+    };
+  },
+  watch: {},
+  computed: {},
+  created() {},
+  mounted() {},
+  methods: {
+    open({couponList,personList,type}){
+      if(!type){
+        throw new Error('参数不正确')
+        return
+      }
+      this.type = type//1是选择优惠券;2是选择人员
+      if(couponList && couponList.length>0){
+        this.couponList = couponList.map(item=>{
+          item.distributeNum = 1
+          return item
+        })
+      }else{
+        this.couponList = []
+      }
+      this.personList = personList || []
+      this.dialogVisible = true
+    },
+    handleClose(){
+      this.couponList = []
+      this.personList = []
+      this.dialogVisible = false
+    },
+    chooseCouponList(){
+      this.drawer.show = true
+      this.drawer.title = '选择优惠券'
+      this.drawer.component = 'couponIndex'
+    },
+    choosePersonList(){
+      this.drawer.show = true
+      this.drawer.title = '选择人员'
+      this.drawer.component = 'personIndex'
+    },
+    removePerson(index,row){
+      this.personList.splice(index,1)
+    },
+    removeCoupon(index,row){
+      this.couponList.splice(index,1)
+    },
+    getData(){
+      this.drawer.loading = true
+      var data = this.$refs.dataComponent.getData()
+      var dataField = []
+      var field = ''
+      switch(this.drawer.component){
+        case 'personIndex':
+          dataField = 'personList'
+          field='uuid'
+          break;
+        case 'couponIndex':
+          dataField = 'couponList'
+          field = 'id'
+          break;
+      }
+      var newData = data.filter(item=>{
+        if(this[dataField].findIndex(i=> i[field] == item[field]) == -1){
+          if(this.drawer.component == 'couponIndex'){
+            this.$set(item,'distributeNum',1)
+          }
+          return item
+        }
+      })
+      this[dataField] = this[dataField].concat(newData)
+      this.drawer.loading = false
+      this.drawer.show = false
+    },
+    submit(){
+      if(this.couponList.length == 0 || this.personList.length == 0){
+        return
+      }
+      var params = {
+        personUuids:this.personList.map(item=>item.uuid),
+        inAddVoucherVOS:this.couponList.map(item=>{
+          return {
+            voucherId:item.id,
+            number:item.distributeNum
+          }
+        })
+      }
+      this.loading = true
+      this.$api.sendVoucherToPerson(params).then(res=>{
+        if(res.code == 200){
+          this.loading = false
+          this.$message.success('优惠券发放成功')
+          this.handleClose()
+        }
+      }).catch(error=>{
+        this.loading = false
+      })
+    },
+
+  },
+};
+</script>
+<style lang="scss" scoped>
+.distributeCoupons{
+  height: calc(100vh - 300px);
+  display: flex;
+  align-content: stretch;
+  .coupon{
+    width: 100%;
+    height: 100%;
+    margin-right: 20px;
+  }
+  .person{
+    width: 100%;
+    height: 100%;
+  }
+  .head{
+    display: flex;
+    justify-content: flex-end;
+    margin-bottom: 10px;
+    height: 30px;
+  }
+}
+.empty{
+  text-align: center;
+  // height: 100%;
+  // background: darkgray;
+}
+</style>

+ 63 - 118
src/views/sms/coupon/history.vue

@@ -2,38 +2,35 @@
   <div class="app-container">
     <div class="table-layout">
       <el-row>
-        <el-col :span="4" class="table-cell-title">名称</el-col>
-        <el-col :span="4" class="table-cell-title">优惠券类型</el-col>
-        <el-col :span="4" class="table-cell-title">可使用商品</el-col>
-        <el-col :span="4" class="table-cell-title">使用门槛</el-col>
-        <el-col :span="4" class="table-cell-title">面值</el-col>
-        <el-col :span="4" class="table-cell-title">状态</el-col>
+        <el-col :span="5" class="table-cell-title">名称</el-col>
+        <el-col :span="5" class="table-cell-title">优惠券类型</el-col>
+        <el-col :span="5" class="table-cell-title">使用门槛</el-col>
+        <el-col :span="5" class="table-cell-title">面值</el-col>
+        <el-col :span="4" class="table-cell-title">售价</el-col>
       </el-row>
       <el-row>
-        <el-col :span="4" class="table-cell">{{coupon.name}}</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.type | formatType}}</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.useType | formatUseType}}</el-col>
-        <el-col :span="4" class="table-cell">满{{coupon.minPoint}}元可用</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.amount}}元</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.endTime | formatStatus}}</el-col>
+        <el-col :span="5" class="table-cell">{{coupon.name}}</el-col>
+        <el-col :span="5" class="table-cell">{{coupon.type | formatType}}</el-col>
+        <el-col :span="5" class="table-cell">满{{coupon.threshold || 0}}元可用</el-col>
+        <el-col :span="5" class="table-cell">{{coupon.amount}}元</el-col>
+        <el-col :span="4" class="table-cell">{{coupon.sellingPrice}}元</el-col>
       </el-row>
       <el-row>
-        <el-col :span="4" class="table-cell-title">有效期</el-col>
-        <el-col :span="4" class="table-cell-title">总发行量</el-col>
-        <el-col :span="4" class="table-cell-title">已领取</el-col>
-        <el-col :span="4" class="table-cell-title">待领取</el-col>
-        <el-col :span="4" class="table-cell-title">已使用</el-col>
-        <el-col :span="4" class="table-cell-title">未使用</el-col>
+        <el-col :span="5" class="table-cell-title">使用范围</el-col>
+        <el-col :span="5" class="table-cell-title">有效期</el-col>
+        <el-col :span="5" class="table-cell-title">状态</el-col>
+        <el-col :span="5" class="table-cell-title">备注</el-col>
+        <el-col :span="4" class="table-cell-title">创建时间</el-col>
       </el-row>
       <el-row>
-        <el-col :span="4" class="table-cell" style="font-size: 13px">
-          {{coupon.startTime|formatDate}}至{{coupon.endTime|formatDate}}
+        <el-col :span="5" class="table-cell">{{coupon.useScopes | formatUseScope}}</el-col>
+        <el-col :span="5" class="table-cell">
+          <div v-if="!coupon.expirationTime">永久</div>
+          <div v-else>{{coupon.availableTime | formatDate}}至{{coupon.expirationTime|formatDate}}</div>
         </el-col>
-        <el-col :span="4" class="table-cell">{{coupon.publishCount}}</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.receiveCount}}</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.publishCount-coupon.receiveCount}}</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.useCount}}</el-col>
-        <el-col :span="4" class="table-cell">{{coupon.publishCount-coupon.useCount}}</el-col>
+        <el-col :span="5" class="table-cell">{{coupon.state | formatStatus}}</el-col>
+        <el-col :span="5" class="table-cell">{{coupon.remark}}</el-col>
+        <el-col :span="4" class="table-cell">{{coupon.createTime | formatDate}}</el-col>
       </el-row>
     </div>
     <el-card class="filter-container" shadow="never">
@@ -115,27 +112,8 @@
 </template>
 <script>
   import {formatDate} from '@/utils/date';
-  import {getCoupon} from '@/api/coupon';
-  import {fetchList as fetchCouponHistoryList} from '@/api/couponHistory';
+  import voucherConstants from './common/constants'
 
-  const defaultTypeOptions = [
-    {
-      label: '全场赠券',
-      value: 0
-    },
-    {
-      label: '会员赠券',
-      value: 1
-    },
-    {
-      label: '购物赠券',
-      value: 2
-    },
-    {
-      label: '注册赠券',
-      value: 3
-    }
-  ];
   const defaultListQuery = {
     pageNum: 1,
     pageSize: 10,
@@ -143,113 +121,80 @@
     orderSn: null,
     couponId: null
   };
-  const defaultUseTypeOptions= [
-    {
-      label: "未使用",
-      value: 0
-    },
-    {
-      label: "已使用",
-      value: 1
-    },
-    {
-      label: "已过期",
-      value: 2
-    }
-  ];
+
   export default {
     name: 'couponHistoryList',
     data() {
       return {
         coupon: {},
         listQuery: Object.assign({}, defaultListQuery),
-        useTypeOptions:Object.assign({},defaultUseTypeOptions),
+        useTypeOptions:[],
         list:null,
         total:null,
         listLoading:false
       }
     },
     created() {
-      getCoupon(this.$route.query.id).then(response => {
+      this.$api.queryVectorDetail({id:this.$route.query.id}).then(response => {
         this.coupon = response.data;
       });
       this.listQuery.couponId=this.$route.query.id;
       this.getList();
     },
-    filters: {
-      formatType(type) {
-        for (let i = 0; i < defaultTypeOptions.length; i++) {
-          if (type === defaultTypeOptions[i].value) {
-            return defaultTypeOptions[i].label;
-          }
+    filters:{
+      formatType(type){
+        var obj = voucherConstants.type
+        if(obj[type]){
+          return obj[type]
         }
         return '';
       },
-      formatUseType(useType) {
-        if (useType === 0) {
-          return '全场通用';
-        } else if (useType === 1) {
-          return '指定分类';
-        } else {
-          return '指定商品';
-        }
-      },
-      formatPlatform(platform) {
-        if (platform === 1) {
-          return '移动平台';
-        } else if (platform === 2) {
-          return 'PC平台';
-        } else {
-          return '全平台';
+      formatUseScope(useScopes){
+        if(!useScopes || useScopes.length == 0){
+          return ''
         }
+        var obj = voucherConstants.useScopes
+        var data = []
+        useScopes.forEach(item => {
+          var str = obj[item]
+          if(str){
+            data.push(str)
+          }
+        });
+        return data.join('、')
       },
-      formatDate(time) {
-        if (time == null || time === '') {
-          return 'N/A';
+
+      formatDate(time){
+        if(time==null||time===''){
+          return '';
         }
         let date = new Date(time);
         return formatDate(date, 'yyyy-MM-dd')
       },
-      formatStatus(endTime) {
+      formatStatus(state){
+        var obj = voucherConstants.state
+        if(obj[state]){
+          return obj[state]
+        }
+        return ''
+
         let now = new Date().getTime();
-        if (endTime > now) {
+        let endDate = new Date(endTime);
+        if(endDate>now){
           return '未过期'
-        } else {
-          return '已过期';
-        }
-      },
-      formatGetType(type) {
-        if(type===1){
-          return '主动获取';
         }else{
-          return '后台赠送';
-        }
-      },
-      formatCouponHistoryUseType(useType) {
-        if (useType === 0) {
-          return '未使用';
-        } else if (useType === 1) {
-          return '已使用';
-        } else {
           return '已过期';
         }
-      },
-      formatTime(time) {
-        if (time == null || time === '') {
-          return 'N/A';
-        }
-        let date = new Date(time);
-        return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
-      },
+      }
     },
     methods: {
       getList(){
-        this.listLoading=true;
-        fetchCouponHistoryList(this.listQuery).then(response=>{
-          this.listLoading=false;
-          this.list=response.data.list;
-          this.total=response.data.total;
-        });
+        // this.listLoading=true;
+        // fetchCouponHistoryList(this.listQuery).then(response=>{
+        //   this.listLoading=false;
+        //   this.list=response.data.list;
+        //   this.total=response.data.total;
+        // });
       },
       handleResetSearch() {
         this.listQuery = Object.assign({}, defaultListQuery);

+ 195 - 99
src/views/sms/coupon/index.vue

@@ -1,4 +1,4 @@
-<template> 
+<template>
   <div class="app-container">
     <el-card class="filter-container" shadow="never">
       <div>
@@ -20,15 +20,24 @@
       </div>
       <div style="margin-top: 15px">
         <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
-          <el-form-item label="优惠券名称:">
+          <!-- <el-form-item label="优惠券名称:">
             <el-input v-model="listQuery.name" class="input-width" placeholder="优惠券名称"></el-input>
+          </el-form-item> -->
+          <el-form-item label="优惠券状态:">
+            <el-select v-model="listQuery.state" placeholder="全部" clearable class="input-width">
+              <el-option v-for="(value,key) in state"
+                         :key="key"
+                         :label="value"
+                         :value="key">
+              </el-option>
+            </el-select>
           </el-form-item>
-          <el-form-item label="优惠券类型:">
-            <el-select v-model="listQuery.type" placeholder="全部" clearable class="input-width">
-              <el-option v-for="item in typeOptions"
-                         :key="item.value"
-                         :label="item.label"
-                         :value="item.value">
+          <el-form-item label="使用范围:">
+            <el-select v-model="listQuery.useScopes" multiple placeholder="全部" clearable class="input-width">
+              <el-option v-for="(value,key) in useScopes"
+                         :key="key"
+                         :label="value"
+                         :value="key">
               </el-option>
             </el-select>
           </el-form-item>
@@ -47,100 +56,127 @@
                 @selection-change="handleSelectionChange"
                 v-loading="listLoading" border>
         <el-table-column type="selection" width="60" align="center"></el-table-column>
-        <el-table-column label="编号" width="100" align="center">
+        <!-- <el-table-column label="编号" width="100" align="center">
           <template slot-scope="scope">{{scope.row.id}}</template>
-        </el-table-column>
-        <el-table-column label="优惠劵名称" align="center">
+        </el-table-column> -->
+        <el-table-column label="优惠劵名称"  width="200" align="center">
           <template slot-scope="scope">{{scope.row.name}}</template>
         </el-table-column>
         <el-table-column label="优惠券类型" width="100" align="center">
           <template slot-scope="scope">{{scope.row.type | formatType}}</template>
         </el-table-column>
-        <el-table-column label="可使用商品" width="100" align="center">
-          <template slot-scope="scope">{{scope.row.useType | formatUseType}}</template>
+        <el-table-column label="使用范围"  align="center">
+          <template slot-scope="scope">{{scope.row.useScopes | formatUseScope}}</template>
         </el-table-column>
-        <el-table-column label="使用门槛" width="140" align="center">
-          <template slot-scope="scope">满{{scope.row.minPoint}}元可用</template>
+        <el-table-column label="使用门槛" width="100" align="center">
+          <template slot-scope="scope">满{{scope.row.threshold || 0}}元可用</template>
         </el-table-column>
         <el-table-column label="面值" width="100" align="center">
           <template slot-scope="scope">{{scope.row.amount}}元</template>
         </el-table-column>
-        <el-table-column label="适用平台" width="100" align="center">
-          <template slot-scope="scope">{{scope.row.platform | formatPlatform}}</template>
+        <el-table-column label="售价" width="100" align="center">
+          <template slot-scope="scope" v-if="scope.row.sellingPrice">{{scope.row.sellingPrice}}元</template>
         </el-table-column>
         <el-table-column label="有效期" width="180" align="center">
-          <template slot-scope="scope">{{scope.row.startTime|formatDate}}至{{scope.row.endTime|formatDate}}</template>
+          <template slot-scope="scope">
+            <div v-if="!scope.row.expirationTime">永久</div>
+            <div v-else>{{scope.row.availableTime | formatDate}}至{{scope.row.expirationTime|formatDate}}</div>
+          </template>
         </el-table-column>
         <el-table-column label="状态" width="100" align="center">
-          <template slot-scope="scope">{{scope.row.endTime | formatStatus}}</template>
+          <template slot-scope="scope">{{scope.row.state | formatStatus}}</template>
+        </el-table-column>
+        <el-table-column label="是否有效" width="100" align="center">
+          <template slot-scope="scope">{{scope.row.expirationTime | formatExpirationTime}}</template>
+        </el-table-column>
+        <el-table-column label="备注" width="100" align="center">
+          <template slot-scope="scope">{{scope.row.remark}}</template>
         </el-table-column>
-        <el-table-column label="操作" width="180" align="center">
+        <el-table-column label="操作" v-if="!permission" width="180" align="center">
           <template slot-scope="scope">
-            <el-button size="mini"
-                       type="text"
-                       @click="handleView(scope.$index, scope.row)">查看</el-button>
-            <el-button size="mini"
-                       type="text"
-                       @click="handleUpdate(scope.$index, scope.row)">
-              编辑</el-button>
-            <el-button size="mini"
-                       type="text"
-                       @click="handleDelete(scope.$index, scope.row)">删除</el-button>
+            <el-button size="mini" type="text" @click="distributeCoupons(scope.$index, scope.row)">发放优惠券</el-button>
+            <!-- <el-button size="mini" type="text" @click="handleView(scope.$index, scope.row)">查看</el-button> -->
+            <el-button size="mini" type="text" @click="handleUpdate(scope.$index, scope.row)">编辑</el-button>
+            <el-button size="mini" type="text" v-if="scope.row.state == 1" @click="handleOffShelf(scope.$index, scope.row,0)">下架</el-button>
+            <el-button size="mini" type="text" v-if="scope.row.state == 0" @click="handleOffShelf(scope.$index, scope.row,1)">上架</el-button>
           </template>
         </el-table-column>
       </el-table>
     </div>
+    <div class="batch-operate-container">
+      <el-select
+        size="small"
+        v-model="operateType" placeholder="批量操作">
+        <el-option
+          v-for="item in operateOptions"
+          :key="item.value"
+          :label="item.label"
+          :value="item.value">
+        </el-option>
+      </el-select>
+      <el-button
+        style="margin-left: 20px"
+        class="search-button"
+        @click="handleBatchOperate()"
+        type="primary"
+        size="small">
+        确定
+      </el-button>
+    </div>
     <div class="pagination-container">
       <el-pagination
         background
         @size-change="handleSizeChange"
         @current-change="handleCurrentChange"
         layout="total, sizes,prev, pager, next,jumper"
-        :current-page.sync="listQuery.pageNum"
-        :page-size="listQuery.pageSize"
+        :current-page.sync="listQuery.current"
+        :page-size="listQuery.size"
         :page-sizes="[5,10,15]"
         :total="total">
       </el-pagination>
     </div>
+    <distributeCouponsDialog ref="distributeCouponsDialog"></distributeCouponsDialog>
   </div>
 </template>
 <script>
-  import {fetchList,deleteCoupon} from '@/api/coupon';
   import {formatDate} from '@/utils/date';
+  import voucherConstants from './common/constants'
+  import distributeCouponsDialog from './dialog/distributeCoupons.vue';
   const defaultListQuery = {
-    pageNum: 1,
-    pageSize: 10,
-    name: null,
-    type: null
+    current: 1,
+    size: 10,
+    state: null,
+    useScopes:[]
   };
-  const defaultTypeOptions=[
-    {
-      label: '全场赠券',
-      value: 0
-    },
-    {
-      label: '会员赠券',
-      value: 1
-    },
-    {
-      label: '购物赠券',
-      value: 2
-    },
-    {
-      label: '注册赠券',
-      value: 3
-    }
-  ];
+
   export default {
     name:'couponList',
+    components: {
+      distributeCouponsDialog
+    },
+    props:{
+      permission:null
+    },
     data() {
       return {
         listQuery:Object.assign({},defaultListQuery),
-        typeOptions:Object.assign({},defaultTypeOptions),
+        state:Object.assign({},voucherConstants.state),
+        useScopes:Object.assign({},voucherConstants.useScopes),
         list:null,
         total:null,
         listLoading:false,
-        multipleSelection:[]
+        multipleSelection:[],
+        operateOptions: [
+          {
+            label: "上架",
+            value: 1
+          },
+          {
+            label: "下架",
+            value: 2
+          }
+        ],
+        operateType:null
       }
     },
     created(){
@@ -148,46 +184,54 @@
     },
     filters:{
       formatType(type){
-        for(let i=0;i<defaultTypeOptions.length;i++){
-          if(type===defaultTypeOptions[i].value){
-            return defaultTypeOptions[i].label;
-          }
+        var obj = voucherConstants.type
+        if(obj[type]){
+          return obj[type]
         }
         return '';
       },
-      formatUseType(useType){
-        if(useType===0){
-          return '全场通用';
-        }else if(useType===1){
-          return '指定分类';
+      formatExpirationTime(expirationTime){
+        if(!expirationTime){
+          return '未过期'
+        }
+        let now = new Date().getTime();
+        let endDate = new Date(expirationTime);
+        if(endDate>now){
+          return '未过期'
         }else{
-          return '指定商品';
+          return '已过期';
         }
       },
-      formatPlatform(platform){
-        if(platform===1){
-          return '移动平台';
-        }else if(platform===2){
-          return 'PC平台';
-        }else{
-          return '全平台';
+      formatUseScope(useScopes){
+        if(!useScopes || useScopes.length == 0){
+          return ''
         }
+        var obj = voucherConstants.useScopes
+        var data = []
+        useScopes.forEach(item => {
+          var str = obj[item]
+          if(str){
+            data.push(str)
+          }
+        });
+        return data.join('、')
       },
+
       formatDate(time){
         if(time==null||time===''){
-          return 'N/A';
+          return '';
         }
         let date = new Date(time);
         return formatDate(date, 'yyyy-MM-dd')
       },
-      formatStatus(endTime){
-        let now = new Date().getTime();
-        let endDate = new Date(endTime);
-        if(endDate>now){
-          return '未过期'
-        }else{
-          return '已过期';
+      formatStatus(state){
+        var obj = voucherConstants.state
+        if(obj[state]){
+          return obj[state]
         }
+        return ''
+
+
       }
     },
     methods:{
@@ -195,19 +239,22 @@
         this.listQuery = Object.assign({}, defaultListQuery);
       },
       handleSearchList() {
-        this.listQuery.pageNum = 1;
+        this.listQuery.current = 1;
         this.getList();
       },
       handleSelectionChange(val){
         this.multipleSelection = val;
       },
+      getData(){
+        return this.multipleSelection
+      },
       handleSizeChange(val) {
-        this.listQuery.pageNum = 1;
-        this.listQuery.pageSize = val;
+        this.listQuery.current = 1;
+        this.listQuery.size = val;
         this.getList();
       },
       handleCurrentChange(val) {
-        this.listQuery.pageNum = val;
+        this.listQuery.current = val;
         this.getList();
       },
       handleAdd(){
@@ -219,29 +266,78 @@
       handleUpdate(index, row) {
         this.$router.push({path: '/sms/updateCoupon', query: {id: row.id}})
       },
-      handleDelete(index, row) {
-        this.$confirm('是否进行删除操作?', '提示', {
+      distributeCoupons(index,row){
+        var data =  {
+          couponList:[row],
+          type:2
+        }
+        this.$refs.distributeCouponsDialog.open(data)
+      },
+      handleOffShelf(index, row,state) {
+        var ids = [row.id]
+        this.batchVoucher(ids,state)
+      },
+      batchVoucher(ids,state){
+        var obj = {
+          0:"下架",
+          1:"上架"
+        }
+        var title = obj[state]
+        this.$confirm(`是否进行${title}操作?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          deleteCoupon(row.id).then(response=>{
-            this.$message({
-              type: 'success',
-              message: '删除成功!'
-            });
-            this.getList();
-          });
+          var params = {
+            ids:ids,
+            state:state
+          }
+          this.listLoading = true
+          this.$api.updateBatchVoucher(params).then(res=>{
+            if(res.code == 200){
+              this.listLoading = false;
+              this.$message.success(`${title}成功`)
+              this.getList()
+            }
+          }).catch(error=>{
+            this.listLoading = false;
+          })
         })
+
       },
       getList(){
         this.listLoading=true;
-        fetchList(this.listQuery).then(response=>{
+        this.$api.queryVoucher(this.listQuery).then(response=>{
           this.listLoading = false;
-          this.list = response.data.list;
+          this.list = response.data.data;
           this.total = response.data.total;
-        });
-      }
+        }).catch(error=>{
+          this.listLoading = false;
+          this.list = [];
+        })
+      },
+      handleBatchOperate(){
+        if(this.multipleSelection==null||this.multipleSelection.length<1){
+          this.$message({
+            message: '请选择要操作的优惠券',
+            type: 'warning',
+            duration: 1000
+          });
+          return;
+        }
+        let ids=[];
+        for(let i=0;i<this.multipleSelection.length;i++){
+          ids.push(this.multipleSelection[i].id);
+        }
+        switch(this.operateType){
+          case 1:
+            this.batchVoucher(ids,1)
+            break;
+          case 2:
+            this.batchVoucher(ids,0)
+            break;
+        }
+      },
     }
   }
 </script>

+ 7 - 0
src/views/ums/admin/common/constants.js

@@ -0,0 +1,7 @@
+export default{
+  vipType:{
+    0:'非会员',
+    1:'会员'
+  },
+
+}

+ 157 - 169
src/views/ums/admin/index.vue

@@ -1,4 +1,4 @@
-<template> 
+<template>
   <div class="app-container">
     <el-card class="filter-container" shadow="never">
       <div>
@@ -20,8 +20,17 @@
       </div>
       <div style="margin-top: 15px">
         <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
-          <el-form-item label="输入搜索:">
-            <el-input v-model="listQuery.keyword" class="input-width" placeholder="帐号/姓名" clearable></el-input>
+          <el-form-item label="手机号/账号:">
+            <el-input v-model="listQuery.phoneNum" class="input-width" placeholder="手机号/账号"></el-input>
+          </el-form-item>
+          <el-form-item label="会员类型:">
+            <el-select v-model="listQuery.vipType" placeholder="全部" clearable class="input-width">
+              <el-option v-for="(value,key) in vipType"
+                         :key="key"
+                         :label="value"
+                         :value="key">
+              </el-option>
+            </el-select>
           </el-form-item>
         </el-form>
       </div>
@@ -29,32 +38,37 @@
     <el-card class="operate-container" shadow="never">
       <i class="el-icon-tickets"></i>
       <span>数据列表</span>
-      <el-button size="mini" class="btn-add" @click="handleAdd()" style="margin-left: 20px">添加</el-button>
+      <!-- <el-button size="mini" class="btn-add" @click="handleAdd()" style="margin-left: 20px">添加</el-button> -->
     </el-card>
     <div class="table-container">
       <el-table ref="adminTable"
                 :data="list"
                 style="width: 100%;"
+                @selection-change="handleSelectionChange"
                 v-loading="listLoading" border>
+        <el-table-column v-if="permission == 1" type="selection" width="60" align="center"></el-table-column>
         <el-table-column label="编号" width="100" align="center">
-          <template slot-scope="scope">{{scope.row.id}}</template>
+          <template slot-scope="scope">{{scope.row.uuid}}</template>
         </el-table-column>
-        <el-table-column label="帐号" align="center">
-          <template slot-scope="scope">{{scope.row.username}}</template>
+        <el-table-column label="手机号/帐号" align="center">
+          <template slot-scope="scope">{{scope.row.phoneNum}}</template>
         </el-table-column>
-        <el-table-column label="姓名" align="center">
+        <!-- <el-table-column label="姓名" align="center">
           <template slot-scope="scope">{{scope.row.nickName}}</template>
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column label="邮箱" align="center">
           <template slot-scope="scope">{{scope.row.email}}</template>
         </el-table-column>
         <el-table-column label="添加时间" width="160" align="center">
-          <template slot-scope="scope">{{scope.row.createTime | formatDateTime}}</template>
+          <template slot-scope="scope">{{scope.row.createTime }}</template>
         </el-table-column>
-        <el-table-column label="最后登录" width="160" align="center">
+        <!-- <el-table-column label="最后登录" width="160" align="center">
           <template slot-scope="scope">{{scope.row.loginTime | formatDateTime}}</template>
+        </el-table-column> -->
+        <el-table-column label="会员类型" width="160" align="center">
+          <template slot-scope="scope">{{scope.row.vipType | formatVipType }}</template>
         </el-table-column>
-        <el-table-column label="是否启用" width="140" align="center">
+        <!-- <el-table-column label="是否启用" width="140" align="center">
           <template slot-scope="scope">
             <el-switch
               @change="handleStatusChange(scope.$index, scope.row)"
@@ -63,14 +77,13 @@
               v-model="scope.row.status">
             </el-switch>
           </template>
-        </el-table-column>
-        <el-table-column label="操作" width="180" align="center">
+        </el-table-column> -->
+        <el-table-column v-if="!permission" label="操作" width="180" align="center">
           <template slot-scope="scope">
             <el-button size="mini"
                        type="text"
-                       @click="handleSelectRole(scope.$index, scope.row)">分配角色
-            </el-button>
-            <el-button size="mini"
+                       @click="distributeCoupons(scope.$index, scope.row)">发放优惠券</el-button>
+            <!-- <el-button size="mini"
                        type="text"
                        @click="handleUpdate(scope.$index, scope.row)">
               编辑
@@ -78,7 +91,7 @@
             <el-button size="mini"
                        type="text"
                        @click="handleDelete(scope.$index, scope.row)">删除
-            </el-button>
+            </el-button> -->
           </template>
         </el-table-column>
       </el-table>
@@ -89,8 +102,8 @@
         @size-change="handleSizeChange"
         @current-change="handleCurrentChange"
         layout="total, sizes,prev, pager, next,jumper"
-        :current-page.sync="listQuery.pageNum"
-        :page-size="listQuery.pageSize"
+        :current-page.sync="listQuery.current"
+        :page-size="listQuery.size"
         :page-sizes="[10,15,20]"
         :total="total">
       </el-pagination>
@@ -102,24 +115,24 @@
       <el-form :model="admin"
                ref="adminForm"
                label-width="150px" size="small">
-        <el-form-item label="帐号:">
-          <el-input v-model="admin.username" style="width: 250px"></el-input>
+        <el-form-item label="手机号/帐号:">
+          <el-input v-model="admin.phoneNum" style="width: 250px"></el-input>
         </el-form-item>
-        <el-form-item label="姓名:">
+        <!-- <el-form-item label="姓名:">
           <el-input v-model="admin.nickName" style="width: 250px"></el-input>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="邮箱:">
           <el-input v-model="admin.email" style="width: 250px"></el-input>
         </el-form-item>
-        <el-form-item label="密码:">
+        <el-form-item label="会员类型:">
           <el-input v-model="admin.password"  type="password" style="width: 250px"></el-input>
         </el-form-item>
-        <el-form-item label="备注:">
+        <!-- <el-form-item label="备注:">
           <el-input v-model="admin.note"
                     type="textarea"
                     :rows="5"
                     style="width: 250px"></el-input>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="是否启用:">
           <el-radio-group v-model="admin.status">
             <el-radio :label="1">是</el-radio>
@@ -132,34 +145,18 @@
         <el-button type="primary" @click="handleDialogConfirm()" size="small">确 定</el-button>
       </span>
     </el-dialog>
-    <el-dialog
-      title="分配角色"
-      :visible.sync="allocDialogVisible"
-      width="30%">
-      <el-select v-model="allocRoleIds" multiple placeholder="请选择" size="small" style="width: 80%">
-        <el-option
-          v-for="item in allRoleList"
-          :key="item.id"
-          :label="item.name"
-          :value="item.id">
-        </el-option>
-      </el-select>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="allocDialogVisible = false" size="small">取 消</el-button>
-        <el-button type="primary" @click="handleAllocDialogConfirm()" size="small">确 定</el-button>
-      </span>
-    </el-dialog>
+    <distributeCouponsDialog ref="distributeCouponsDialog"></distributeCouponsDialog>
   </div>
 </template>
 <script>
-  import {fetchList,createAdmin,updateAdmin,updateStatus,deleteAdmin,getRoleByAdmin,allocRole} from '@/api/login';
-  import {fetchAllRoleList} from '@/api/role';
+  import userConstants from './common/constants'
   import {formatDate} from '@/utils/date';
-
+  import distributeCouponsDialog from '@/views/sms/coupon/dialog/distributeCoupons.vue';
   const defaultListQuery = {
-    pageNum: 1,
-    pageSize: 10,
-    keyword: null
+    current: 1,
+    size: 10,
+    phoneNum: null,//电话号码
+    vipType:null,//会员类型 0非会员 ,1 会员
   };
   const defaultAdmin = {
     id: null,
@@ -172,24 +169,27 @@
   };
   export default {
     name: 'adminList',
+    components: {
+      distributeCouponsDialog
+    },
+    props:{
+      permission:null
+    },
     data() {
       return {
         listQuery: Object.assign({}, defaultListQuery),
+        vipType:userConstants.vipType,
         list: null,
         total: null,
         listLoading: false,
         dialogVisible: false,
         admin: Object.assign({}, defaultAdmin),
         isEdit: false,
-        allocDialogVisible: false,
-        allocRoleIds:[],
-        allRoleList:[],
-        allocAdminId:null
+        multipleSelection:[]
       }
     },
     created() {
       this.getList();
-      this.getAllRoleList();
     },
     filters: {
       formatDateTime(time) {
@@ -198,144 +198,132 @@
         }
         let date = new Date(time);
         return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
-      }
+      },
+      formatVipType(vipType){
+        var obj = userConstants.vipType
+        if(obj[vipType]){
+          return obj[vipType]
+        }
+        return '';
+      },
     },
     methods: {
+      handleSelectionChange(val){
+        this.multipleSelection = val;
+      },
+      getData(){
+        return this.multipleSelection
+      },
       handleResetSearch() {
         this.listQuery = Object.assign({}, defaultListQuery);
       },
       handleSearchList() {
-        this.listQuery.pageNum = 1;
+        this.listQuery.current = 1;
         this.getList();
       },
       handleSizeChange(val) {
-        this.listQuery.pageNum = 1;
-        this.listQuery.pageSize = val;
+        this.listQuery.current = 1;
+        this.listQuery.size = val;
         this.getList();
       },
       handleCurrentChange(val) {
-        this.listQuery.pageNum = val;
+        this.listQuery.current = val;
         this.getList();
       },
+      distributeCoupons(index,row){
+        var data =  {
+          personList:[row],
+          type:1
+        }
+        this.$refs.distributeCouponsDialog.open(data)
+      },
       handleAdd() {
         this.dialogVisible = true;
         this.isEdit = false;
         this.admin = Object.assign({},defaultAdmin);
       },
-      handleStatusChange(index, row) {
-        this.$confirm('是否要修改该状态?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          updateStatus(row.id, {status: row.status}).then(response => {
-            this.$message({
-              type: 'success',
-              message: '修改成功!'
-            });
-          });
-        }).catch(() => {
-          this.$message({
-            type: 'info',
-            message: '取消修改'
-          });
-          this.getList();
-        });
-      },
-      handleDelete(index, row) {
-        this.$confirm('是否要删除该用户?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          deleteAdmin(row.id).then(response => {
-            this.$message({
-              type: 'success',
-              message: '删除成功!'
-            });
-            this.getList();
-          });
-        });
-      },
-      handleUpdate(index, row) {
-        this.dialogVisible = true;
-        this.isEdit = true;
-        this.admin = Object.assign({},row);
-      },
-      handleDialogConfirm() {
-        this.$confirm('是否要确认?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          if (this.isEdit) {
-            updateAdmin(this.admin.id,this.admin).then(response => {
-              this.$message({
-                message: '修改成功!',
-                type: 'success'
-              });
-              this.dialogVisible =false;
-              this.getList();
-            })
-          } else {
-            createAdmin(this.admin).then(response => {
-              this.$message({
-                message: '添加成功!',
-                type: 'success'
-              });
-              this.dialogVisible =false;
-              this.getList();
-            })
-          }
-        })
-      },
-      handleAllocDialogConfirm(){
-        this.$confirm('是否要确认?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          let params = new URLSearchParams();
-          params.append("adminId", this.allocAdminId);
-          params.append("roleIds", this.allocRoleIds);
-          allocRole(params).then(response => {
-            this.$message({
-              message: '分配成功!',
-              type: 'success'
-            });
-            this.allocDialogVisible = false;
-          })
-        })
-      },
-      handleSelectRole(index,row){
-        this.allocAdminId = row.id;
-        this.allocDialogVisible = true;
-        this.getRoleListByAdmin(row.id);
-      },
+      // handleStatusChange(index, row) {
+      //   this.$confirm('是否要修改该状态?', '提示', {
+      //     confirmButtonText: '确定',
+      //     cancelButtonText: '取消',
+      //     type: 'warning'
+      //   }).then(() => {
+      //     updateStatus(row.id, {status: row.status}).then(response => {
+      //       this.$message({
+      //         type: 'success',
+      //         message: '修改成功!'
+      //       });
+      //     });
+      //   }).catch(() => {
+      //     this.$message({
+      //       type: 'info',
+      //       message: '取消修改'
+      //     });
+      //     this.getList();
+      //   });
+      // },
+      // handleDelete(index, row) {
+      //   this.$confirm('是否要删除该用户?', '提示', {
+      //     confirmButtonText: '确定',
+      //     cancelButtonText: '取消',
+      //     type: 'warning'
+      //   }).then(() => {
+      //     deleteAdmin(row.id).then(response => {
+      //       this.$message({
+      //         type: 'success',
+      //         message: '删除成功!'
+      //       });
+      //       this.getList();
+      //     });
+      //   });
+      // },
+      // handleUpdate(index, row) {
+      //   this.dialogVisible = true;
+      //   this.isEdit = true;
+      //   this.admin = Object.assign({},row);
+      // },
+      // handleDialogConfirm() {
+      //   this.$confirm('是否要确认?', '提示', {
+      //     confirmButtonText: '确定',
+      //     cancelButtonText: '取消',
+      //     type: 'warning'
+      //   }).then(() => {
+      //     if (this.isEdit) {
+      //       updateAdmin(this.admin.id,this.admin).then(response => {
+      //         this.$message({
+      //           message: '修改成功!',
+      //           type: 'success'
+      //         });
+      //         this.dialogVisible =false;
+      //         this.getList();
+      //       })
+      //     } else {
+      //       createAdmin(this.admin).then(response => {
+      //         this.$message({
+      //           message: '添加成功!',
+      //           type: 'success'
+      //         });
+      //         this.dialogVisible =false;
+      //         this.getList();
+      //       })
+      //     }
+      //   })
+      // },
+
+
       getList() {
         this.listLoading = true;
-        fetchList(this.listQuery).then(response => {
+        this.$api.queryUser(this.listQuery).then(response => {
           this.listLoading = false;
-          this.list = response.data.list;
+          this.list = response.data.data;
           this.total = response.data.total;
-        });
-      },
-      getAllRoleList() {
-        fetchAllRoleList().then(response => {
-          this.allRoleList = response.data;
-        });
+        }).catch(error=>{
+          this.listLoading = false;
+          this.list = [];
+        })
       },
-      getRoleListByAdmin(adminId) {
-        getRoleByAdmin(adminId).then(response => {
-          let allocRoleList = response.data;
-          this.allocRoleIds=[];
-          if(allocRoleList!=null&&allocRoleList.length>0){
-            for(let i=0;i<allocRoleList.length;i++){
-              this.allocRoleIds.push(allocRoleList[i].id);
-            }
-          }
-        });
-      }
+
+
     }
   }
 </script>

+ 110 - 0
src/views/ums/feedback/index.vue

@@ -0,0 +1,110 @@
+<template>
+  <div>
+    <el-card class="operate-container" shadow="never">
+      <i class="el-icon-tickets"></i>
+      <span>数据列表</span>
+    </el-card>
+    <div class="table-container">
+      <el-table ref="adminTable"
+                :data="list"
+                style="width: 100%;"
+                v-loading="listLoading" border>
+        <el-table-column label="序号" width="100" align="center">
+          <template slot-scope="scope">{{(scope.$index + 1) + ((listQuery.current - 1) * listQuery.size)}}</template>
+        </el-table-column>
+        <el-table-column label="反馈内容" align="center">
+          <template slot-scope="scope">{{scope.row.feedbackContent}}</template>
+        </el-table-column>
+        <el-table-column label="反馈图" align="center">
+          <template slot-scope="scope" v-if="scope.row.systemFiles && scope.row.systemFiles.length>0">
+            <el-image v-for="item in scope.row.systemFiles" :key="item.guid" style="height: 80px" :preview-src-list="scope.row.systemFiles.map(item1=>{return $commonJS.getFile(item1.guid)})" :src="$commonJS.getFile(item.guid)"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="邮箱" align="center">
+          <template slot-scope="scope">{{scope.row.email}}</template>
+        </el-table-column>
+        <el-table-column label="账号" align="center">
+          <template slot-scope="scope">{{scope.row.phoneNum}}</template>
+        </el-table-column>
+        <el-table-column label="添加时间" width="160" align="center">
+          <template slot-scope="scope">{{scope.row.createTime }}</template>
+        </el-table-column>
+
+        <!-- <el-table-column v-if="!permission" label="操作" width="180" align="center">
+          <template slot-scope="scope">
+            <el-button size="mini"
+                       type="text"
+                       @click="handleUpdate(scope.$index, scope.row)">
+              编辑
+            </el-button>
+            <el-button size="mini"
+                       type="text"
+                       @click="handleDelete(scope.$index, scope.row)">删除
+            </el-button>
+          </template>
+        </el-table-column> -->
+      </el-table>
+    </div>
+    <div class="pagination-container">
+      <el-pagination
+        background
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        layout="total, sizes,prev, pager, next,jumper"
+        :current-page.sync="listQuery.current"
+        :page-size="listQuery.size"
+        :page-sizes="[10,15,20]"
+        :total="total">
+      </el-pagination>
+    </div>
+  </div>
+</template>
+
+<script>
+const defaultListQuery = {
+    current: 1,
+    size: 10,
+  };
+export default {
+  components: {},
+  props: {},
+  data() {
+    return {
+      listQuery: Object.assign({}, defaultListQuery),
+      list: null,
+      total: null,
+      listLoading: false,
+    };
+  },
+  watch: {},
+  computed: {},
+  created() {
+    this.getList();
+  },
+  mounted() {},
+  methods: {
+    handleSizeChange(val) {
+      this.listQuery.current = 1;
+      this.listQuery.size = val;
+      this.getList();
+    },
+    handleCurrentChange(val) {
+      this.listQuery.current = val;
+      this.getList();
+    },
+    getList() {
+      this.listLoading = true;
+      this.$api.queryUserFeedback(this.listQuery).then(response => {
+        this.listLoading = false;
+        this.list = response.data.data;
+        this.total = response.data.total;
+      }).catch(error=>{
+        this.listLoading = false;
+        this.list = [];
+      })
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+</style>