Procházet zdrojové kódy

Merge branch 'deploy' of chelingzhu-web/qhsxKx-cardCenter-admin-html into master

lilei před 4 roky
rodič
revize
272de50e44
38 změnil soubory, kde provedl 1769 přidání a 5360 odebrání
  1. 2 2
      .env
  2. 1 1
      .env.development
  3. 2 2
      .env.preview
  4. 1 1
      public/index.html
  5. 25 0
      src/api/couponStatistics.js
  6. 61 0
      src/api/coupons.js
  7. 1 1
      src/api/login.js
  8. 34 160
      src/config/router.config.js
  9. 1 2
      src/store/modules/user.js
  10. 1 1
      src/utils/domUtil.js
  11. 8 1
      src/utils/request.js
  12. 0 88
      src/views/AvailableCoupon/AvailableCoupon.vue
  13. 0 701
      src/views/CarWashManagement/AddCarWashModal.vue
  14. 0 321
      src/views/CarWashManagement/CarWashManagement.vue
  15. 0 146
      src/views/CarWashManagement/ChooseEquipment.vue
  16. 0 243
      src/views/CarWashManagement/DetailsCarWashModal.vue
  17. 540 227
      src/views/CouponCenter/AddCouponModal.vue
  18. 151 57
      src/views/CouponCenter/ChooseOutlets.vue
  19. 139 87
      src/views/CouponCenter/CreateCoupons.vue
  20. 234 0
      src/views/CouponCenter/DetailsCouponModal.vue
  21. 112 0
      src/views/CouponCenter/ViewDetailed.vue
  22. 287 0
      src/views/CouponStatistics/CouponDetailModal.vue
  23. 0 146
      src/views/CouponStatistics/CouponStatisticsDetail.vue
  24. 164 110
      src/views/CouponStatistics/CouponStatisticsList.vue
  25. 1 1
      src/views/Home.vue
  26. 0 206
      src/views/RefundRecord/RefundRecord.vue
  27. 0 453
      src/views/bnSetting/menu/adminMenus.vue
  28. 0 340
      src/views/bnSetting/menu/childModal.vue
  29. 0 162
      src/views/bnSetting/menusAuth.vue
  30. 0 41
      src/views/bnSetting/menusAuthTab.vue
  31. 0 302
      src/views/power/menu/childModal.vue
  32. 0 457
      src/views/power/menu/menu.vue
  33. 0 194
      src/views/power/role/menuModal.vue
  34. 0 222
      src/views/power/role/roleList.vue
  35. 0 172
      src/views/power/role/roleModal.vue
  36. 0 242
      src/views/power/user/userList.vue
  37. 0 268
      src/views/power/user/userModal.vue
  38. 4 3
      vue.config.js

+ 2 - 2
.env

@@ -1,5 +1,5 @@
 NODE_ENV=production
 VUE_APP_PREVIEW=false
-VUE_APP_API_BASE_URL=https://it.zyucgj.com/zyit/
+VUE_APP_API_BASE_URL=http://carwash-coupon.zyucgj.com/cw-coupon/
 VUE_APP_VERSION=V1.0.1
-VUE_APP_PRO_NAME=洗车机运营后台
+VUE_APP_PRO_NAME=卡卷管理中心

+ 1 - 1
.env.development

@@ -2,4 +2,4 @@ NODE_ENV=development
 VUE_APP_PREVIEW=true
 VUE_APP_API_BASE_URL=/api
 VUE_APP_VERSION=V1.0.1
-VUE_APP_PRO_NAME=洗车机运营后台-dev
+VUE_APP_PRO_NAME=卡卷管理中心-dev

+ 2 - 2
.env.preview

@@ -1,5 +1,5 @@
 NODE_ENV=production
 VUE_APP_PREVIEW=true
-VUE_APP_API_BASE_URL=http://it.test.zyucgj.com/zyit
+VUE_APP_API_BASE_URL=http://carwash-coupon.test.zyucgj.com/cw-coupon/
 VUE_APP_VERSION=V1.0.1
-VUE_APP_PRO_NAME=洗车机运营后台-pro
+VUE_APP_PRO_NAME=卡卷管理中心-pro

+ 1 - 1
public/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>logo.png">
-    <title>洗车机运营后台</title>
+    <title>智慧快洗卡卷管理中心</title>
     <style>#loading-mask{position:fixed;left:0;top:0;height:100%;width:100%;background:#fff;user-select:none;z-index:9999;overflow:hidden}.loading-wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-100%)}.loading-dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:64px;width:64px;height:64px;box-sizing:border-box}.loading-dot i{width:22px;height:22px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.loading-dot i:nth-child(1){top:0;left:0}.loading-dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.loading-dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.loading-dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style>
     <!-- require cdn assets css -->
     <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>

+ 25 - 0
src/api/couponStatistics.js

@@ -0,0 +1,25 @@
+import { axios } from '@/utils/request'
+
+// 优惠券统计列表
+export const couponStatisticsList = params => {
+  const url = `storeCouponReport/findPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 查看优惠券领取详情
+export const couponReceiveDetail = params => {
+  const url = `couponReceives/findPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 61 - 0
src/api/coupons.js

@@ -0,0 +1,61 @@
+import { axios } from '@/utils/request'
+
+// 创建优惠券
+export const couponCreate = params => {
+  return axios({
+    url: 'coupon/create',
+    data: params,
+    method: 'post'
+  })
+}
+// 创建优惠券
+export const couponUpdate = params => {
+  return axios({
+    url: 'coupon/update',
+    data: params,
+    method: 'post'
+  })
+}
+// 优惠券列表
+export const couponQuery = (params) => {
+  const url = `coupon/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 优惠券启禁用
+export const couponEnableStatus = params => {
+  const url = `coupon/enable/${params.id}/${params.flag}`
+  return axios.request({
+    url: url,
+    method: 'get'
+  })
+}
+// 优惠券删除
+export const couponDel = params => {
+  return axios.request({
+    url: `coupon/delete/${params.id}`,
+    method: 'get',
+    data: {}
+  })
+}
+// 优惠券详情(查看页)
+export const couponFind = params => {
+  return axios.request({
+    url: `coupon/find/${params.id}`,
+    method: 'get',
+    data: {}
+  })
+}
+// 优惠券详情(编辑页)
+export const couponToUpdate = params => {
+  return axios.request({
+    url: `coupon/toUpdate/${params.id}`,
+    method: 'get',
+    data: {}
+  })
+}

+ 1 - 1
src/api/login.js

@@ -4,7 +4,7 @@ import { axios } from '@/utils/request'
 export function login ({ username, password }) {
   return axios({
     url: 'login',
-    headers: { 'content-type': 'application/x-www-form-urlencoded' },
+    headers: { 'content-type': 'application/x-www-form-urlencoded', 'App-Type': 1 },
     data: `username=${username}&password=${password}`,
     method: 'post'
   }).then(res => res.data)

+ 34 - 160
src/config/router.config.js

@@ -41,36 +41,15 @@ export const asyncRouterMap = [
       }
       ]
     },
-    // Car washing machine management center
-    {
-      path: '/CarWashManagement',
-      redirect: '/CarWashManagement/CarWashManagement',
-      component: PageView,
-      meta: {
-        title: '洗车机管理中心',
-        icon: 'setting'
-        // permission: 'M_setting_0'
-      },
-      children: [{
-        path: '/CarWashManagement/CarWashManagement',
-        name: 'CarWashManagement',
-        component: () => import('@/views/CarWashManagement/CarWashManagement.vue'),
-        meta: {
-          title: '洗车机管理',
-          icon: 'database'
-          // permission: 'M_sys_dataDictionary'
-        }
-      }]
-    },
     // 优惠券中心
     {
       path: '/CouponCenter',
       redirect: '/CouponCenter/CreateCoupons',
       component: PageView,
       meta: {
-        title: '优惠券中心',
-        icon: 'setting'
-        // permission: 'M_setting_0'
+        title: '优惠券管理',
+        icon: 'shopping',
+        permission: 'M_coupon_0'
       },
       children: [{
         path: '/CouponCenter/CreateCoupons',
@@ -78,63 +57,19 @@ export const asyncRouterMap = [
         component: () => import('@/views/CouponCenter/CreateCoupons.vue'),
         meta: {
           title: '创建优惠券',
-          icon: 'database'
-          // permission: 'M_sys_dataDictionary'
+          icon: 'database',
+          permission: 'M_coupon_create'
         }
       }]
     },
-    {
-      path: '/Order',
-      redirect: '/Order/OrderCenter',
-      name: 'Order',
-      component: PageView,
-      meta: {
-        title: '订单中心',
-        icon: 'snippets'
-        // permission: 'M_setting_0'
-      },
-      children: [
-        {
-          path: '/Order/OrderCenter',
-          name: 'OrderCenter',
-          component: () => import('@/views/Order/OrderCenter.vue'),
-          meta: {
-            title: '订单中心',
-            icon: 'snippets'
-          // permission: 'M_sys_dataDictionary'
-          }
-        }
-      ]
-    },
-    {
-      path: '/RefundRecord',
-      redirect: '/RefundRecord/RefundRecord',
-      component: PageView,
-      meta: {
-        title: '退单记录',
-        icon: 'setting'
-        // permission: 'M_setting_0'
-      },
-      children: [{
-        path: '/RefundRecord/RefundRecord',
-        name: 'RefundRecord',
-        component: () => import('@/views/RefundRecord/RefundRecord.vue'),
-        meta: {
-          title: '退单记录',
-          icon: 'setting'
-          // permission: 'M_sys_dataDictionary'
-        }
-      }
-      ]
-    },
     {
       path: '/CouponStatistics',
       redirect: '/CouponStatistics/CouponStatistics',
       component: PageView,
       meta: {
-        title: '优惠券统计',
-        icon: 'setting'
-        // permission: 'M_setting_0'
+        title: '卡券统计',
+        icon: 'bar-chart',
+        permission: 'M_CouponStatistics_0'
       },
       children: [{
         path: '/CouponStatistics/CouponStatisticsList',
@@ -142,76 +77,12 @@ export const asyncRouterMap = [
         component: () => import('@/views/CouponStatistics/CouponStatisticsList.vue'),
         meta: {
           title: '优惠券统计',
-          icon: 'setting'
-          // permission: 'M_sys_dataDictionary'
-        }
-      },
-      {
-        path: '/CouponStatistics/CouponStatisticsDetail',
-        name: 'CouponStatisticsDetail',
-        component: () => import('@/views/CouponStatistics/CouponStatisticsDetail.vue'),
-        meta: {
-          title: '优惠券领取详情',
-          icon: 'setting'
-          // permission: 'M_sys_dataDictionary'
+          icon: 'line-chart',
+          permission: 'M_CouponStatistics_List'
         }
       }
       ]
     },
-    {
-      path: '/AvailableCoupon',
-      redirect: '/AvailableCoupon/AvailableCoupon',
-      component: PageView,
-      meta: {
-        title: '可使用优惠券',
-        icon: 'setting'
-        // permission: 'M_setting_0'
-      },
-      children: [
-        {
-          path: '/AvailableCoupon/AvailableCoupon',
-          name: 'AvailableCoupon',
-          component: () => import(/* webpackChunkName: "auth" */ '@/views/AvailableCoupon/AvailableCoupon.vue'),
-          meta: { title: '可使用优惠券', icon: 'user' }
-        }
-      ]
-    },
-    {
-      path: '/auth',
-      redirect: '/auth/userList',
-      component: PageView,
-      meta: { title: '后台权限管理', icon: 'lock'
-        // permission: 'M_auth_0' ,
-      },
-      children: [
-        {
-          path: '/auth/userList',
-          name: 'powerUserList',
-          component: () => import(/* webpackChunkName: "auth" */ '@/views/power/user/userList.vue'),
-          meta: { title: '用户管理', icon: 'user'
-            // permission: 'M_auth_userList' ,
-          }
-        },
-        {
-          path: '/auth/roleList',
-          name: 'powerRoleList',
-          component: () => import(/* webpackChunkName: "auth" */ '@/views/power/role/roleList.vue'),
-          meta: { title: '角色管理', icon: 'solution'
-            // permission: 'M_auth_roleList',
-          }
-        },
-        {
-          path: '/menusAuth/menu',
-          name: 'powerMenu',
-          component: () => import(/* webpackChunkName: "auth" */ '@/views/power/menu/menu.vue'),
-          meta: {
-            title: '菜单管理',
-            icon: 'profile',
-            permission: 'M_menusAuth_menu'
-          }
-        }
-      ]
-    },
     {
       path: '/setting',
       redirect: '/setting/userList',
@@ -224,33 +95,36 @@ export const asyncRouterMap = [
       children: [{
         path: '/setting/dataDictionary',
         name: 'powerDD',
-        component: () => import(/* webpackChunkName: "setting" */ '@/views/power/dataDictionary/dataDictionary.vue'),
+        component: () => import(/* webpackChunkName: "setting" */
+          '@/views/power/dataDictionary/dataDictionary.vue'),
         meta: {
           title: '数据字典管理',
           icon: 'database'
           // permission: 'M_sys_dataDictionary'
         }
-      },
-      {
-        path: '/setting/register',
-        name: 'powerRegister',
-        component: () => import(/* webpackChunkName: "setting" */ '@/views/power/register/register.vue'),
-        meta: {
-          title: '参数管理',
-          icon: 'key'
-          // permission: 'M_sys_register'
-        }
-      },
-      {
-        path: '/setting/jobs',
-        name: 'powerJobs',
-        component: () => import(/* webpackChunkName: "setting" */ '@/views/power/job/jobs.vue'),
-        meta: {
-          title: '定时器',
-          icon: 'alert'
-          // permission: 'M_sys_job'
-        }
       }
+        // 暂时屏蔽,后期可能需要
+        // {
+        //   path: '/setting/register',
+        //   name: 'powerRegister',
+        //   component: () => import( /* webpackChunkName: "setting" */ '@/views/power/register/register.vue'),
+        //   meta: {
+        //     title: '参数管理',
+        //     icon: 'key'
+        //     // permission: 'M_sys_register'
+        //   }
+        // },
+        // 暂时屏蔽,后期可能需要
+        // {
+        //   path: '/setting/jobs',
+        //   name: 'powerJobs',
+        //   component: () => import( /* webpackChunkName: "setting" */ '@/views/power/job/jobs.vue'),
+        //   meta: {
+        //     title: '定时器',
+        //     icon: 'alert'
+        //     // permission: 'M_sys_job'
+        //   }
+        // }
       ]
     }
     ]

+ 1 - 2
src/store/modules/user.js

@@ -37,14 +37,13 @@ const user = {
   actions: {
     // 登录
     Login ({ commit }, userInfo) {
-      console.log(userInfo, 'userInfo----')
       return new Promise((resolve, reject) => {
         login(userInfo).then(res => {
           console.log(res, 'login success')
           if (res.userid) {
             Vue.ls.set('hasError', 0)
             commit('SET_TOKEN', res.userid)
-            commit('SET_NAME', { name: res.username, welcome: welcome() })
+            commit('SET_NAME', { name: res.userNameCN, welcome: welcome() })
             commit('SET_AVATAR', res.avatar ? res.avatar : '')
             Vue.ls.set('rolesAccess', { permissionList: res.permCodes }, 7 * 24 * 60 * 60 * 1000)
             // 记住密码

+ 1 - 1
src/utils/domUtil.js

@@ -16,4 +16,4 @@ export const setDocumentTitle = function (title) {
   }
 }
 
-export const domTitle = '洗车机运营后台'
+export const domTitle = '智慧快洗卡卷管理中心'

+ 8 - 1
src/utils/request.js

@@ -52,7 +52,7 @@ service.interceptors.request.use(config => {
 
 // response interceptor
 service.interceptors.response.use((response) => {
-  // console.log(response, 'responseresponseresponse')
+  console.log(response, 'responseresponseresponse')
   if (response.data.status == '-1') {
     notification.error({
       message: '提示',
@@ -64,6 +64,13 @@ service.interceptors.response.use((response) => {
       })
     }, 2000)
   }
+  if ((response.data.status == '900') && window.location.pathname != '/user/login') {
+    notification.destroy()
+    notification.error({
+      message: '提示',
+      description: response.data.message
+    })
+  }
   return response.data
 }, err)
 

+ 0 - 88
src/views/AvailableCoupon/AvailableCoupon.vue

@@ -1,88 +0,0 @@
-<template>
-  <!-- <a-card class="card-content">
-    <div class="AvailableCoupon-content">
-      <div class="coupon-type">
-        <div class="arc-left"></div>
-        <div class="arc-right"></div>
-      </div>
-      <div class="coupon-content">
-        <div class="arc-top"></div>
-        <div class="arc-bottom"></div>
-      </div>
-    </div>
-  </a-card> -->
-  <a-card hoverable style="width: 240px">
-      <!-- <img
-        slot="cover"
-        alt="example"
-        src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png"
-      /> -->
-      <a-card-meta title="Europe Street beat">
-        <template slot="description">
-          www.instagram.com
-        </template>
-      </a-card-meta>
-      <a-card-meta title="Europe Street beat">
-        <template slot="description">
-          www.instagram.com
-        </template>
-      </a-card-meta>
-    </a-card>
-</template>
-
-<script>
-</script>
-
-<style lang="less">
-  .card-content{
-    height:100vh;
-    padding: 20px;
-    background-color: #fff;
-    .coupon-type{
-      width:200px;
-      height:100px;
-      background-color: red;
-      position: absolute;
-      top: 0;
-      bottom: 0;
-      left: 0;
-      right: 0;
-      border-radius:10px 10px 0 0;
-      .arc-left{
-        width: 15px;
-        height: 15px;
-        background-color: #fff;
-        /*四分之一圆*/
-        border-radius: 0 100% 0  0;
-        /*定位*/
-        position: absolute;
-        left: 0;
-        bottom: 0;
-      }
-      .arc-right{
-        width: 15px;
-        height: 15px;
-        background-color: #fff;
-        /*四分之一圆*/
-        border-radius: 100%  0 0  0;
-        /*定位*/
-        position: absolute;
-        right: 0;
-        bottom: 0;
-      }
-    }
-    .coupon-content{
-      width:200px;
-      height:100px;
-      background-color: #fff;
-      border:1px soild #FF0000;
-      border-radius:0 0 10px 10px;
-      position: absolute;
-      top: 100px;
-      bottom: 0;
-      left: 200px;
-      right: 0;
-    }
-  }
-   
-</style>

+ 0 - 701
src/views/CarWashManagement/AddCarWashModal.vue

@@ -1,701 +0,0 @@
-<template>
-  <a-modal class="CarWashModal" :title="pageType == 'add' ? '新增' : pageType == 'edit' ? '编辑' : ''" :width="1000" :footer="null" :destroyOnClose="true" @cancel="isShow=false" v-model="isShow">
-    <!-- 表单 -->
-    <a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
-      <a-row :gutter="20">
-        <a-col :span="12">
-          <a-form-model-item label="网点名称" prop="name">
-            <a-input v-model="form.name" :maxLength="20" placeholder="请输入网店名称,20个字以内" />
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="地址" class="default-form-item form-item-required">
-            <a-row :gutter="20">
-              <a-col :span="8">
-                <a-form-model-item prop="addrProvince">
-                  <a-select v-model="form.addrProvince" placeholder="请选择省" @change="getCityList">
-                    <a-select-option v-for="item in addrProvinceList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :span="8">
-                <a-form-model-item prop="addrCity">
-                  <a-select v-model="form.addrCity" placeholder="请选择市" @change="getAreaList">
-                    <a-select-option v-for="item in addrCityList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :span="8">
-                <a-form-model-item prop="addrDistrict">
-                  <a-select v-model="form.addrDistrict" placeholder="请选择区" @change="areaCharged">
-                    <a-select-option v-for="item in addrDistrictList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
-            </a-row>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="24">
-          <a-form-model-item label="详细地址" prop="addrDetail" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
-            <a-input v-model="form.addrDetail" :maxLength="32" placeholder="请输入详细地址,32个字以内" />
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="设备ID" prop="deviceDTOList" class="default-form-item">
-            <a-row :gutter="20">
-              <a-col :span="19">
-                <a-tag v-if="form.deviceDTOList.length > 0" color="blue">{{deviceNo}}</a-tag>
-              </a-col>
-              <a-col :span="5">
-                <a-button type="primary" size="small" class="small-btn" @click="openEquipmentModal=true">选择</a-button>
-              </a-col>
-            </a-row>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="网点标签" prop="featuredServiceLabel" :rules="{required: true, message: '请选择网点标签', trigger: 'change'}">
-            <v-select ref="featuredServiceLabel" v-model="featuredServiceLabel" @change="featuredServiceLabelChange" mode="multiple" placeholder="请选择网点标签" showArrow code="STORE_LABEL"></v-select>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="经度" prop="lng" class="default-form-item">
-            <a-row :gutter="20">
-              <a-col :span="17">
-                <a-input-number v-model="form.lng" :min="0" :max="999" placeholder="请输入经度坐标" class="input-number-all" />
-              </a-col>
-              <a-col :span="6">
-                <a href="https://lbs.qq.com/tool/getpoint/" target="_blank">
-                  <a-button type="primary" size="small" icon="search" class="small-btn">查询坐标</a-button>
-                </a>
-              </a-col>
-            </a-row>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="纬度" prop="lat">
-            <a-input-number v-model="form.lat" :min="0" :max="999" placeholder="请输入纬度坐标" class="input-number-all" />
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="服务类型" prop="serviceType">
-            <a-select v-model="form.serviceType" placeholder="请选择服务类型" @change="isResetstoreItemPriceDTOList('serviceType', $event)" showArrow mode="multiple">
-              <a-select-option v-for="item in itemQueryList" :key="item.id" :value="item.id">{{item.itemName}}</a-select-option>
-            </a-select>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="营业时间" class="default-form-item form-item-required">
-            <a-row :gutter="20">
-              <a-col :span="11">
-                <a-form-model-item prop="beginTime">
-                  <a-time-picker v-model="form.beginTime" @change="isResetstoreItemPriceDTOList('beginTime', $event)" format="HH:mm" placeholder="请选择开始时间" class="time-picker" />
-                </a-form-model-item>
-              </a-col>
-              <a-col :span="2">至</a-col>
-              <a-col :span="11">
-                <a-form-model-item prop="endTime">
-                  <a-time-picker v-model="form.endTime" @change="isResetstoreItemPriceDTOList('endTime', $event)" format="HH:mm" placeholder="请选择结束时间" class="time-picker" />
-                </a-form-model-item>
-              </a-col>
-            </a-row>
-          </a-form-model-item>
-        </a-col>
-        <!-- 时段价格设置  start -->
-        <a-col :span="24">
-          <a-form-model-item :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }" prop="storeItemPriceDTOList">
-            <div slot="label" class="form-item-label">
-              <a-tooltip placement="right" arrow-point-at-center title="时段价格是指车主在不同时段洗车需要支付不同的价格,主要用于日间服务和夜间服务的差异化管理,达到调节流量、集客引流的效果。不同时段区间采用起始时间包含,结束时间不包含原则。例如:时段区间为06:00(含)-22:00(不含),普通洗车10元;时间区间为22:00(含)-06:00(不含),普通洗车8元。客户在6点00分01秒普通洗车为10元,客户在22点00分01秒普通洗车为8元。">
-                时段价格
-                <a-icon :style="{ fontSize: '18px', color: '#1890ff', verticalAlign: 'sub' }" type="question-circle" />
-              </a-tooltip>
-            </div>
-            <a-row :gutter="20" v-for="(item, ind) in form.storeItemPriceDTOList" :key="ind">
-              <a-col :span="9">
-                <a-row :gutter="20">
-                  <a-col :span="11">
-                    <a-form-model-item :prop="'storeItemPriceDTOList.'+ ind + '.beginTime'" :rules="{required: true, message: '请选择开始时间', trigger: 'change'}">
-                      <a-time-picker v-model="item.beginTime" disabled format="HH:mm" placeholder="请选择" class="time-picker" />
-                    </a-form-model-item>
-                  </a-col>
-                  <a-col :span="2">至</a-col>
-                  <a-col :span="11">
-                    <a-form-model-item :prop="'storeItemPriceDTOList.'+ ind + '.endTime'" :rules="{required: true, message: '请选择结束时间', trigger: 'change'}">
-                      <a-time-picker v-model="item.endTime" :default-open-value="item.beginTime" @change="isResetBelowstoreItemPriceDTOList($event, ind)" format="HH:mm" placeholder="请选择" class="time-picker" />
-                    </a-form-model-item>
-                  </a-col>
-                </a-row>
-              </a-col>
-              <a-col :span="14">
-                <a-row :gutter="20">
-                  <a-col :span="8" v-for="(priceItem, subInd) in item.currentPrices" :key="subInd">
-                    <a-form-model-item :prop="'storeItemPriceDTOList.'+ ind +'.currentPrices.'+ subInd + '.price'" :rules="{required: true, message: `请输入【${priceItem.name}】单价`, trigger: 'blur'}">
-                      <a-input-number v-model="priceItem.price" :min="0" :max="999999" :placeholder="'【'+ priceItem.name +'】单价'" class="input-number-s" />
-                      <span class="unit">元</span>
-                    </a-form-model-item>
-                  </a-col>
-                </a-row>
-              </a-col>
-              <a-col :span="1">
-                <a-icon type="delete" title="删除" @click="delstoreItemPriceDTOList(ind)" :style="{ fontSize: '20px', color: 'red' }" />
-              </a-col>
-            </a-row>
-            <a-button type="dashed" @click="setTimeInterval" class="setTimeInterval"><a-icon type="plus" />添加时段</a-button>
-          </a-form-model-item>
-        </a-col>
-        <!-- 时段价格设置  end -->
-        <a-col :span="24">
-          <a-form-model-item label="路线指引" prop="guidance" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
-            <editor ref="editor" @on-change="editorChange" :cache="false" v-model="form.guidance"></editor>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="24">
-          <a-form-model-item label="温馨提示" prop="reminder" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
-            <a-textarea ref="reminder" v-model="form.reminder" :maxLength="128" :auto-size="{ minRows: 3, maxRows: 5 }" placeholder="请输入温馨提示,128个字以内" />
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="24">
-          <a-form-model-item :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }" class="btn-cont">
-            <a-button type="primary" @click="onSubmit">保存</a-button>
-            <a-button class="cancel" @click="cancel">取消</a-button>
-          </a-form-model-item>
-        </a-col>
-      </a-row>
-    </a-form-model>
-    
-    <!-- 选择设备 -->
-    <choose-equipment
-      :openEquipmentModal="openEquipmentModal"
-      @close="closeChooseEquipment"
-    />
-    
-  </a-modal>
-</template>
-
-<script>
-  import { VSelect } from '@/components'
-  import ChooseEquipment from './ChooseEquipment.vue'
-  import Editor from '@/components/WEeditor'
-  import moment from 'moment'
-  import { getProvince, getCityByPro, getDistrictByCity } from '@/api/lookup'
-  import { itemQuery, storeSave, storeFind, findItem } from '@/api/car-wash'
-  export default{
-    name: 'AddCarWashModal',
-    components: { VSelect, Editor, ChooseEquipment },
-    props: {
-      openModal: {  //  弹框是否展示
-        type: Boolean,
-        default: false
-      },
-      pageType: {  //  页面类型
-        type: String,
-        default: ''
-      },
-      carWashId: {  //  网点id
-        type: String,
-        default: ''
-      }
-    },
-    data(){
-      return{
-        isShow: this.openModal,  //  弹框是否展示
-        form: {
-          name: '',  //  网点名称
-          addrProvince: undefined,  //  省  编码
-          addrProvinceName: '',  //  省
-          addrCity: undefined,  //  市  编码
-          addrCityName: '',  //  市
-          addrDistrict: undefined,  //  区  编码
-          addrDistrictName: '',  //  区
-          addrDetail: '',  //  详细地址
-          deviceDTOList: [],  //  设备序列号
-          featuredServiceLabel: '',  //  网点标签
-          lng: '',  //  经度
-          lat: '',  //  纬度
-          serviceType: [],  //  服务类型
-          beginTime: null,  //  营业时间开始时间
-          endTime: null,  //  营业时间结束时间
-          storeItemPriceDTOList: [],  //  时段价格
-          guidance: '',  //  路线指引
-          reminder: ''  //  温馨提示
-        },
-        rules: {
-          name: [
-            { required: true, message: '请输入网店名称', trigger: 'blur' }
-          ],
-          addrProvince: [
-            { required: true, message: '请选择所在省份', trigger: 'change' }
-          ],
-          addrCity: [
-            { required: true, message: '请选择所在市', trigger: 'change' }
-          ],
-          addrDistrict: [
-            { required: true, message: '请选择所在区县', trigger: 'change' }
-          ],
-          addrDetail: [
-            { required: true, message: '请输入详细地址', trigger: 'blur' }
-          ],
-          deviceDTOList: [
-            { required: true, message: '请选择设备', trigger: 'change' }
-          ],
-          lng: [
-            { required: true, message: '请输入经度', trigger: 'blur' }
-          ],
-          lat: [
-            { required: true, message: '请输入纬度', trigger: 'blur' }
-          ],
-          serviceType: [
-            { required: true, message: '请选择服务类型', trigger: 'change' }
-          ],
-          beginTime: [
-            { required: true, message: '请选择开始时间', trigger: 'change' }
-          ],
-          endTime: [
-            { required: true, message: '请选择结束时间', trigger: 'change' }
-          ],
-          storeItemPriceDTOList: [
-            { required: true, message: '请设置时段价格', trigger: 'change' }
-          ]
-        },
-        openEquipmentModal: false  ,//  选择设备  弹框展示状态
-        serviceType: [],  //  服务类型  change前的值
-        beginTime: null,  //  营业时间开始时间  change前的值
-        endTime: null,  //  营业时间结束时间  change前的值
-        subendTime: [],  //  时段价格  时段区间结束时间  change前的值
-        featuredServiceLabel: [],  //  网点标签
-        addrProvinceList: [],  //  省列表数据
-        addrCityList: [],  //  市列表数据
-        addrDistrictList: [],  //  区县列表数据
-        itemQueryList: [],  //  服务类型列表数据
-        deviceNo: '',  //  已选设备序列号
-      }
-    },
-    methods: {
-      moment,
-      // 文本编辑器  change
-      editorChange (html, text) {
-        this.form.guidance = html
-      },
-      // 网点详情
-      getCarWashInfo(id){
-        storeFind({ id: id }).then(res => {
-          if(res.status == 200){
-            // 查询门店的服务时段价格
-            findItem({ id: id }).then(result => {
-              if(result.status == 200){
-                let carWashInfo = Object.assign(res.data, {storeItemPriceDTOList: result.data})
-                this.setVal(carWashInfo)
-              }
-            })
-          }
-        })
-      },
-      //  表单赋值
-      setVal(item){
-        const _this = this
-        console.log(item)
-        let arr = [ 'id', 'name', 'addrProvince', 'addrProvinceName', 'addrCityName', 'addrDistrictName', 'featuredServiceLabel', 'lng', 'lat', 'serviceType', 'guidance', 'reminder' ]
-        arr.map(k => {
-          this.form[k] = item[k]
-        })
-        this.getCityList(item.addrProvince)  //  获取市区下拉数据
-        this.form.addrCity = item.addrCity  //  市区赋值
-        this.getAreaList(item.addrCity)  //  获取区县下拉数据
-        this.form.addrDistrict = item.addrDistrict  //  区县赋值
-        this.form.addrDetail = item.addrDetail  //  详细地址赋值
-        this.form.deviceDTOList = [{id: item.deviceVOList[0].id}]  //  设备
-        this.deviceNo = item.deviceVOList[0].deviceNo  //  设备序列号
-        this.featuredServiceLabel = item.featuredServiceLabel.split(',')  //  网点标签
-        this.form.beginTime = moment(item.beginTime, 'HH:mm')  //  营业时间  开始时间
-        this.form.endTime = moment(item.endTime, 'HH:mm')  //  营业时间  结束时间
-        this.setPeriodPrice(item.storeItemPriceDTOList)  // 时段价格
-        this.isShow ? this.$refs.editor.setHtml(item.guidance) : null  //  文本编辑器赋值
-      },
-      // 时段价格  赋值处理
-      setPeriodPrice(storeItemPriceDTOList){
-        let arrInd = 0
-        this.form.storeItemPriceDTOList = []
-        for (var key in storeItemPriceDTOList) {
-          if (storeItemPriceDTOList.hasOwnProperty(key)) {
-            this.form.storeItemPriceDTOList.push({
-              beginTime: moment(key.split(',')[0], 'HH:mm'),
-              endTime: moment(key.split(',')[1], 'HH:mm'),
-              currentPrices: []
-            })
-            let idArr = []
-            storeItemPriceDTOList[key].map((k, ind) => {
-              this.form.storeItemPriceDTOList[arrInd].currentPrices.push({ name: k.itemName, price: k.currentPrice, itemId: k.itemId })
-              idArr.push(k.itemId)
-            })
-            this.form.serviceType = idArr  //  服务类型
-            arrInd++
-          }
-        }
-      },
-      //  保存
-      onSubmit(){
-        const _this = this
-        _this.$refs.ruleForm.validate(valid => {
-          if (valid) {
-            let formData = JSON.parse(JSON.stringify(_this.form))
-            //  校验营业时间结束时间是否与时段价格一致
-            let endTime = formData.storeItemPriceDTOList[formData.storeItemPriceDTOList.length - 1].endTime
-            if(_this.timeFormat(formData.endTime) != _this.timeFormat(endTime)){
-              _this.$message.error('时段价格与营业时间不一致,请修改后再保存!')
-              return
-            }
-            formData.beginTime = _this.timeFormat(formData.beginTime)
-            formData.endTime = _this.timeFormat(formData.endTime)
-            let arr = []
-            formData.storeItemPriceDTOList.map(item => {
-              item.currentPrices.map(k => {
-                arr.push({
-                  beginTime: _this.timeFormat(item.beginTime),
-                  endTime: _this.timeFormat(item.endTime),
-                  itemId: k.itemId,
-                  name: k.name,
-                  currentPrice: k.price
-                })
-              })
-            })
-            formData.storeItemPriceDTOList = arr
-            //  提交前时间格式还需转换
-            delete formData.serviceType
-            storeSave(formData).then(res => {
-              if(res.status == 200){
-                _this.$message.success(res.message)
-                _this.$emit('success')
-              }else{
-                _this.$message.error(res.message)
-              }
-            })
-          } else {
-            return false
-          }
-        })
-      },
-      // 时间格式转换
-      timeFormat (time) {
-        const dateTime = new Date(time)
-        const hour = dateTime.getHours()
-        const minute = dateTime.getMinutes()
-        let timeStr = this.addZero(hour) + ':' + this.addZero(minute)
-        return timeStr
-      },
-      // 时间0补位
-      addZero (v) {
-        return v < 10 ? '0' + v : v
-      },
-      // 取消
-      cancel(){
-        this.resetForm()
-        this.isShow = false
-      },
-      // 重置表单数据
-      resetForm(){
-        this.serviceType = []  //  服务类型  change前的值
-        this.beginTime = null  //  营业时间开始时间  change前的值
-        this.endTime = null  //  营业时间结束时间  change前的值
-        this.subendTime = []  //  时段价格  时段区间结束时间  change前的值
-        this.featuredServiceLabel = []  //  网点标签
-        this.deviceNo = ''  //  已选设备序列号
-        // this.$refs.ruleForm.resetFields()    无效
-        this.form.id = null
-        this.form.name = ''  //  网点名称
-        this.form.addrProvince = undefined  //  省  编码
-        this.form.addrProvinceName = ''  //  省
-        this.form.addrCity = undefined  //  市  编码
-        this.form.addrCityName = ''  //  市
-        this.form.addrDistrict = undefined  //  区  编码
-        this.form.addrDistrictName = ''  //  区
-        this.form.addrDetail = ''  //  详细地址
-        this.form.deviceDTOList = []  //  设备序列号
-        this.form.featuredServiceLabel = ''  //  网点标签
-        this.form.lng = ''  //  经度
-        this.form.lat = ''  //  纬度
-        this.form.serviceType = []  //  服务类型
-        this.form.beginTime = null  //  营业时间开始时间
-        this.form.endTime = null  //  营业时间结束时间
-        this.form.storeItemPriceDTOList = []  //  时段价格
-        this.form.guidance = ''  //  路线指引
-        this.form.reminder = ''  //  温馨提示
-      },
-      // 是否重置时段价格 (更改服务类型、营业开始结束时间)
-      isResetstoreItemPriceDTOList(type, val){
-        console.log(type, val)
-        // type: serviceType  服务类型  beginTime  营业时间  开始时间  endTime  营业时间  结束时间
-        const _this = this
-        setTimeout(()=>{
-          if(_this.form.storeItemPriceDTOList.length != 0){
-            _this.$confirm({
-              title: '提示',
-              content: '更改后已设置的时段价格将会全部清空,确定要更改吗?',
-              onOk() {
-                type == 'serviceType' ? _this.serviceType = val : type == 'beginTime' ? _this.beginTime = val : _this.endTime = val
-                _this.form.storeItemPriceDTOList = []
-              },
-              onCancel() {
-                type == 'serviceType' ? _this.form.serviceType = _this.serviceType : type == 'beginTime' ? _this.form.beginTime = _this.beginTime : _this.form.endTime = _this.endTime
-              },
-            })
-          }else{
-            type == 'serviceType' ? _this.serviceType = val : type == 'beginTime' ? _this.beginTime = val : _this.endTime = val
-          }
-        },0)
-      },
-      // 是否重置时段价格 (更改时段价格区间结束时间)
-      isResetBelowstoreItemPriceDTOList(val, ind){
-        const _this = this
-        // 更改已设置过的时段时间(因为有下一个时段的前提是当前时段结束时间已设置)
-        if(this.form.storeItemPriceDTOList[ind + 1]){
-          _this.$confirm({
-            title: '提示',
-            content: '更改已设置过的时段区间,其之后的时段区间将会被清空,确定要更改吗?',
-            onOk() {
-              _this.subendTime[ind] = val
-              _this.form.storeItemPriceDTOList.splice(ind + 1, _this.form.storeItemPriceDTOList.length - Number(ind + 1))
-            },
-            onCancel() {
-              _this.form.storeItemPriceDTOList[ind].endTime = _this.subendTime[ind]
-            },
-          })
-        }else{
-          _this.subendTime[ind] = val
-        }
-      },
-      //  选择设备
-      closeChooseEquipment(val, no){
-        if(val){
-          this.form.deviceDTOList = [{id: val}]
-          this.deviceNo = no
-        }
-        this.openEquipmentModal = false
-      },
-      //  设置时段价格
-      setTimeInterval(){
-        if(this.form.serviceType.length == 0){
-          this.$message.error('请先选择服务类型')
-          return
-        }
-        if(!this.form.beginTime){
-          this.$message.error('请先选择营业时间开始时间')
-          return
-        }
-        if(!this.form.endTime){
-          this.$message.error('请先选择营业时间结束时间')
-          return
-        }
-        let arr = {}
-        // 时段价格开始时间
-        let timeStr = ''
-        if(this.form.storeItemPriceDTOList.length == 0){
-          timeStr = this.form.beginTime.format('HH:mm')
-        }else{
-          timeStr = this.form.storeItemPriceDTOList[this.form.storeItemPriceDTOList.length - 1].endTime
-          if(!timeStr){
-            this.$message.error('请先选择时段价格 - 第'+ this.form.storeItemPriceDTOList.length +'个时段的结束时间')
-            return
-          }
-        }
-        arr.beginTime = moment(timeStr, 'HH:mm')
-        arr.endTime = null
-        arr.currentPrices = []
-        this.form.serviceType.map((item, index) => {
-          let i = this.itemQueryList.findIndex(k => k.id == item)
-          arr.currentPrices.push({ name: this.itemQueryList[i].itemName, price: '', itemId: item })
-        })
-        this.form.storeItemPriceDTOList.push(arr)
-      },
-      // 删除时段价格
-      delstoreItemPriceDTOList(ind){
-        const _this = this
-        let msg = Number(ind + 1) == _this.form.storeItemPriceDTOList.length ? '确定要删除该时段吗?' : '确定要删除该时段以及其之后已设置的时段吗?'
-        _this.$confirm({
-          title: '提示',
-          content: msg,
-          onOk() {
-            _this.form.storeItemPriceDTOList.splice(ind, _this.form.storeItemPriceDTOList.length - ind)
-          }
-        })
-      },
-      // 网点标签  change
-      featuredServiceLabelChange(val){
-        this.form.featuredServiceLabel = val.join(',')
-      },
-      // 获取服务类型列表
-      getItemQuery(){
-        itemQuery({
-          pageNo: 1,
-          pageSize: 1000
-        }).then(res => {
-          if(res.status == 200){
-            this.itemQueryList = res.data.list || []
-          }else{
-            this.itemQueryList = []
-          }
-        })
-      },
-      // 获取省列表'
-      getProvinceList() {
-        const _this = this
-        getProvince().then(res => {
-          if (res.status == 200) {
-            _this.addrProvinceList = res.data || []
-          } else {
-            _this.addrProvinceList = []
-          }
-        })
-      },
-      // 获取城市列表
-      getCityList (val) {
-        this.addrCityList = []
-        this.addrDistrictList = []
-        this.form.addrCity = undefined
-        this.form.addrDistrict = undefined
-        this.form.addrDetail = ''
-        if (val == null || val == '') {
-          this.form.addrProvinceName = ''
-        } else {
-          for (let i = 0; i < this.addrProvinceList.length; i++) {
-            if (this.addrProvinceList[i].id == val) {
-              this.form.addrProvinceName = this.addrProvinceList[i].name
-              break
-            }
-          }
-          this.getCityListRequest(val)
-        }
-      },
-      getCityListRequest (val) {
-        const _this = this
-        getCityByPro({id: val}).then(res => {
-          if (res.status == 200) {
-            _this.addrCityList = res.data || []
-          } else {
-            _this.addrCityList = []
-          }
-        })
-      },
-      // 获取区县列表
-      getAreaList (val) {
-        this.addrDistrictList = []
-        this.form.addrDistrict = undefined
-        this.form.addrDetail = ''
-        if (val == null || val == '') {
-          this.form.addrCityName = ''
-        } else {
-          for (let i = 0; i < this.addrCityList.length; i++) {
-            if (this.addrCityList[i].id == val) {
-              this.form.addrCityName = this.addrCityList[i].name
-              break
-            }
-          }
-          this.getAreaListRequest(val)
-        }
-      },
-      getAreaListRequest (val) {
-        const _this = this
-        getDistrictByCity({id: val}).then(res => {
-          if (res.status == 200) {
-            _this.addrDistrictList = res.data || []
-          } else {
-            _this.addrDistrictList = []
-          }
-        })
-      },
-      // 区县变更
-      areaCharged (val) {
-        if (val == null || val == '') {
-          this.form.addrDistrictName = ''
-        } else {
-          for (let i = 0; i < this.addrDistrictList.length; i++) {
-            if (this.addrDistrictList[i].id == val) {
-              this.form.addrDistrictName = this.addrDistrictList[i].name
-              break
-            }
-          }
-        }
-        this.form.addrDetail = ''
-      }
-    },
-    watch: {
-      //  父页面传过来的弹框状态
-      openModal (newValue, oldValue) {
-        this.isShow = newValue
-      },
-      //  重定义的弹框状态
-      isShow (val){
-        if (!val){
-          this.$emit('close')
-        }else{
-          this.resetForm()  //  重置表单数据
-          this.getProvinceList()  //  获取省下拉
-          this.getItemQuery()  //  服务类型  列表
-        }
-      },
-      carWashId (newValue, oldValue){
-        console.log(newValue,'-----新增编辑')
-        if(newValue && this.isShow){
-          console.log('进来    编辑')
-          this.getCarWashInfo(newValue)
-        }
-      }
-    }
-  }
-</script>
-
-<style lang="less">
-  .CarWashModal{
-    .default-form-item{
-      margin-bottom: 0;
-    }
-    .form-item-label{
-        display: inline-block;
-        cursor: pointer;
-    }
-    .form-item-required{
-      .ant-form-item-label{
-        label:before{
-          display: inline-block;
-          margin-right: 4px;
-          color: #f5222d;
-          font-size: 14px;
-          font-family: SimSun, sans-serif;
-          line-height: 1;
-          content: '*';
-        }
-      }
-    }
-    .small-btn{
-      background-color: #19be6b;
-      font-size: 13px;
-    }
-    .small-btn.ant-btn-primary:focus, .small-btn.ant-btn-primary:hover{
-      background-color: #19be6b;
-    }
-    .time-picker{
-      width: 100%;
-    }
-    .btn-cont{
-      text-align: center;
-      .cancel{
-        margin-left: 10px;
-      }
-    }
-    .setTimeInterval{
-      width: 40%;
-      color: #19be6b;
-    }
-    .input-number-all{
-      width: 100%;
-    }
-    .input-number-s{
-      width: 90%;
-    }
-    .unit{
-      display: inline-block;
-      width: 10%;
-      text-align: right;
-      padding-left: 5px;
-      box-sizing: border-box;
-    }
-  }
-</style>

+ 0 - 321
src/views/CarWashManagement/CarWashManagement.vue

@@ -1,321 +0,0 @@
-<template>
-  <a-card class="CarWashManagement" :bordered="false">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline">
-        <a-row :gutter="48">
-          <a-col :span="6">
-            <a-form-item class="search-item" label="网点名称">
-              <a-input v-model.trim="queryParam.name" placeholder="请输入网点名称" @pressEnter="$refs.table.refresh(true)" allowClear/>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item class="search-item" label="营业状态">
-              <v-select ref="businessStatus" allowClear placeholder="请选择营业状态" v-model="queryParam.businessStatus" code="STORE_BUSINESS_STATUS"></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item class="search-item" label="设备状态">
-              <v-select ref="deviceStatus" allowClear placeholder="请选择设备状态" v-model="queryParam.deviceDTO.deviceStatus" code="DEVICE_STATUS"></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item class="search-item" label="省">
-              <a-select v-model="queryParam.addrProvince" placeholder="请选择省" @change="getCityList" allowClear>
-                <a-select-option v-for="item in addrProvinceList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item class="search-item" label="市">
-              <a-select v-model="queryParam.addrCity" placeholder="请选择市" @change="getAreaList" allowClear>
-                <a-select-option v-for="item in addrCityList" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-button type="primary" class="search-btn" @click="$refs.table.refresh(true)">查询</a-button>
-            <a-button type="" @click="reset">重置</a-button>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 新建 -->
-    <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="modalHandle('add')">新建</a-button>
-    </div>
-    <!-- 表格列表 -->
-    <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" bordered >
-      <!-- 营业时间 -->
-      <template slot="businessHours" slot-scope="text, record">{{ record.beginTime.substr(0,5) + '-' + record.endTime.substr(0,5) }}</template>
-      <!-- 设备状态 -->
-      <template slot="deviceStatus" slot-scope="text, record">{{ record.deviceVOList ? $refs.deviceStatus.getNameByCode(record.deviceVOList[0].deviceStatus) : '-' }}</template>
-      <!-- 营业状态 -->
-      <template slot="businessStatus" slot-scope="text, record">{{ record.businessStatus ? $refs.businessStatus.getNameByCode(record.businessStatus) : '-' }}</template>
-      <!-- 操作 -->
-      <template slot="action" slot-scope="text, record">
-        <a-tooltip placement="left" trigger="click" overlayClassName="btn-cont">
-          <template slot="title">
-            <div class="btn-set-cont">
-              <p class="set-sub-btn normal"><a-icon type="check-circle" class="icon" />正常营业</p>
-              <p class="set-sub-btn suspension"><a-icon type="pause-circle" class="icon" />暂停营业</p>
-              <p class="set-sub-btn soon"><a-icon type="play-circle" class="icon" />即将开业</p>
-            </div>
-          </template>
-          <a-icon type="setting" title="设置" :style="{ fontSize: '20px', color: '#19be6b', padding: '0 10px' }" />
-        </a-tooltip>
-        <a-icon type="edit" title="编辑" @click="modalHandle('edit', record)" :style="{ fontSize: '20px', color: '#1890FF', padding: '0 10px' }" />
-        <a-icon type="eye" title="查看详情" @click="modalHandle('details', record)" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" />
-        <a-icon type="delete" title="删除" @click="del(record)" :style="{ fontSize: '20px', color: 'red', padding: '0 10px' }" />
-        <a-icon type="qrcode" title="查看小程序码" @click="isQrCodeModal=true" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" />
-      </template>
-    </s-table>
-    
-    <!-- 新增/编辑 洗车机 -->
-    <add-car-wash-modal
-      :openModal="openModal"
-      :pageType="pageType"
-      :carWashId="carWashId"
-      @success="carWashSubmit"
-      @close="closeModal"
-    />
-    <!-- 查看详情 洗车机 -->
-    <details-car-wash-modal
-      :openModal="openDetailsModal"
-      :carWashId="carWashId"
-      @close="closeDetailsModal"
-    />
-    <!-- 查看小程序码 -->
-    <a-modal class="qrCodeModal" title="查看小程序码" :width="500" :footer="null" :destroyOnClose="true" @cancel="isQrCodeModal=false" v-model="isQrCodeModal">
-      <img :src="qrCode" class="qrCode" />
-    </a-modal>
-  </a-card>
-</template>
-
-<script>
-  import { STable, VSelect } from '@/components'
-  import AddCarWashModal from './AddCarWashModal.vue'
-  import DetailsCarWashModal from './DetailsCarWashModal.vue'
-  import { getProvince, getCityByPro } from '@/api/lookup'
-  import { storeQuery, storeFind, findItem, storeDel } from '@/api/car-wash'
-  export default{
-    name: 'CarWashManagement',
-    components: { STable, VSelect, AddCarWashModal, DetailsCarWashModal },
-    data(){
-      return{
-        queryParam: {
-          name: '',  //  网点名称
-          businessStatus: '',  //  营业状态
-          deviceDTO: { deviceStatus: '' },  //  设备状态
-          addrProvince: undefined,  //  省
-          addrCity: undefined  //  市
-        },
-        columns: [
-          { title: '创建时间', dataIndex: 'createDate', width: '100', align: 'center' },
-          { title: '设备ID', dataIndex: 'deviceVOList[0].deviceNo', width: '100', align: 'center' },
-          { title: '网点名称', dataIndex: 'name', width: '100', align: 'center' },
-          { title: '省', dataIndex: 'addrProvinceName', width: '100', align: 'center' },
-          { title: '市', dataIndex: 'addrCityName', width: '100', align: 'center' },
-          { title: '地址', dataIndex: 'addrDetail', width: '100', align: 'center' },
-          { title: '营业时间', scopedSlots: {customRender: 'businessHours'}, width: '100', align: 'center' },
-          { title: '设备状态', scopedSlots: {customRender: 'deviceStatus'}, width: '100', align: 'center' },
-          { title: '营业状态', scopedSlots: {customRender: 'businessStatus'}, width: '100', align: 'center' },
-          { title: '操作', scopedSlots: {customRender: 'action'}, width: '265', align: 'center' }
-        ],
-        // 加载数据方法 必须为 Promise 对象
-        loadData: parameter => {
-          return storeQuery(Object.assign(parameter, this.queryParam)).then(res => {
-            const no = (res.data.pageNo - 1) * res.data.pageSize
-            for (let i = 0; i < res.data.list.length; i++) {
-              const _item = res.data.list[i]
-              _item.no = no + i + 1
-            }
-            return res.data
-          })
-        },
-        openModal: false,  //  新增/编辑 洗车机  弹框展示状态
-        pageType: '',  //  新增/编辑 洗车机  页面类型
-        openDetailsModal: false,  //  查看详情 洗车机  弹框展示状态
-        addrProvinceList: [],  //  省列表数据
-        addrCityList: [],  //  市列表数据
-        isQrCodeModal: false,  //  查看小程序码   弹框展示状态
-        qrCode: '',  //  小程序码
-        carWashId: '',  //  网点id
-      }
-    },
-    methods: {
-      //  新建/编辑/查看
-      modalHandle(type, item){
-        this.pageType = type
-        // this.carWashId = (type == 'edit' || type == 'details') ? String(item.id) : type == 'add' ? '' : ''
-        // type == 'add' || type == 'edit' ? this.openModal = true : this.openDetailsModal = true
-        if(type == 'add'){
-          this.carWashId = ''
-          this.openModal = true
-          this.openDetailsModal = false
-        }else if(type == 'edit'){
-          this.carWashId = String(item.id)
-          this.openModal = true
-          this.openDetailsModal = false
-        }else if(type == 'details'){
-          this.carWashId = String(item.id)
-          this.openDetailsModal = true
-          this.openModal = false
-        }
-      },
-      // 新增编辑  提交成功
-      carWashSubmit(){
-        this.$refs.table.refresh(true)
-        this.openModal = false
-      },
-      // 删除
-      del(item){
-        const _this = this
-        _this.$confirm({
-          title: '提示',
-          content: '确定要删除吗?',
-          onOk () {
-            storeDel({ id: item.id }).then(res => {
-              console.log(res)
-              if(res.status == 200){
-                _this.$message.success(res.message)
-                _this.$refs.table.refresh(true)
-              }else{
-                _this.$message.error(res.message)
-              }
-            })
-          }
-        })
-      },
-      //  重置
-      reset(){
-        this.queryParam = {
-          name: '',  //  网点名称
-          businessStatus: '',  //  营业状态
-          deviceDTO: { deviceStatus: '' },  //  设备状态
-          addrProvince: undefined,  //  省
-          addrCity: undefined  //  市
-        }
-        this.$refs.table.refresh(true)
-      },
-      // 获取省列表
-      getProvinceList() {
-        const _this = this
-        getProvince().then(res => {
-          if (res.status == 200) {
-            _this.addrProvinceList = res.data || []
-          } else {
-            _this.addrProvinceList = []
-          }
-        })
-      },
-      // 获取城市列表
-      getCityList (val) {
-        this.addrCityList = []
-        this.queryParam.addrCity = undefined
-        if (val == null || val == '') {
-          this.addrProvinceName = ''
-        } else {
-          for (let i = 0; i < this.addrProvinceList.length; i++) {
-            if (this.addrProvinceList[i].id == val) {
-              this.addrProvinceName = this.addrProvinceList[i].name
-              break
-            }
-          }
-          this.getCityListRequest(val)
-        }
-      },
-      getCityListRequest (val) {
-        getCityByPro({id: val}).then(res => {
-          if (res.status == 200) {
-            this.addrCityList = res.data || []
-          } else {
-            this.addrCityList = []
-          }
-        })
-      },
-      // 获取区县列表
-      getAreaList (val) {
-        if (val == null || val == '') {
-          this.addrCityName = ''
-        } else {
-          for (let i = 0; i < this.addrCityList.length; i++) {
-            if (this.addrCityList[i].id == val) {
-              this.addrCityName = this.addrCityList[i].name
-              break
-            }
-          }
-        }
-      },
-      // 新增、编辑 弹框关闭
-      closeModal(){
-        this.carWashId = ''
-        this.openModal = false
-      },
-      // 详情 弹框关闭
-      closeDetailsModal(){
-        this.carWashId = ''
-        this.openDetailsModal = false
-      }
-    },
-    mounted(){
-      //  获取省下拉
-      this.getProvinceList()
-    }
-  }
-</script>
-
-<style lang="less">
-  .CarWashManagement{
-    .table-page-search-wrapper{
-      .search-btn{
-        margin-right: 10px;
-      }
-    }
-    .qrCode{
-      display: block;
-      width: 100%;
-      max-width: 100%;
-    }
-  }
-  .btn-cont{
-    .ant-tooltip-inner{
-      background-color: #fff;
-    }
-    .ant-tooltip-arrow:before{
-      background-color: #fff;
-    }
-    .btn-set-cont{
-      .set-sub-btn{
-        padding: 5px 15px 6px;
-        font-size: 12px;
-        border: 1px dashed #dcdee2;
-        border-radius: 4px;
-        margin: 0;
-        cursor: pointer;
-      }
-      .normal{
-        color: rgb(0, 204, 0);
-        border-color: rgb(0, 204, 0);
-        .icon{
-          margin-right: 5px;
-        }
-      }
-      .suspension{
-        color: rgb(255, 85, 0);
-        border-color: rgb(255, 85, 0);
-        margin: 7px 0;
-        .icon{
-          margin-right: 5px;
-        }
-      }
-      .soon{
-        color: #2d8cf0;
-        border-color: #2d8cf0;
-        .icon{
-          margin-right: 5px;
-        }
-      }
-    }
-  }
-</style>

+ 0 - 146
src/views/CarWashManagement/ChooseEquipment.vue

@@ -1,146 +0,0 @@
-<template>
-  <a-modal class="CarWashEquipmentModal" title="选择设备" :width="600" :footer="null" :destroyOnClose="true" @cancel="modalIsShow=false" v-model="modalIsShow">
-    <a-input-search placeholder="请输入设备序列号" enter-button="查询" @search="onSearch" class="input-search" />
-    <a-radio-group v-model="equipment" @change="onChange" class="radio-group">
-      <a-radio :style="radioStyle" v-for="(item,index) in equipmentList" :key="index" :value="item.id" :disabled="item.binding==1">
-        <div class="radio-group-item">
-          <p class="item-label">{{item.deviceNo}}</p>
-          <p :class="['item-status', item.binding == 1 ? 'ybind' : '']">{{item.binding == 0 ? '绑定' : '已绑定'}}</p>
-        </div>
-      </a-radio>
-    </a-radio-group>
-    <!-- 分页 -->
-    <a-pagination class="pagination-s" show-size-changer :current="pageNo" :pageSize.sync="pageSize" :total="total" @showSizeChange="onShowSizeChange" @change="onShowPageChange" />
-  </a-modal>
-</template>
-
-<script>
-  import { deviceQuery } from '@/api/car-wash'
-  export default{
-    name: 'ChooseEquipment',
-    props: {
-      openEquipmentModal: {  //  弹框是否展示
-        type: Boolean,
-        default: false
-      },
-    },
-    data(){
-      return{
-        modalIsShow: this.openEquipmentModal,  //  弹框是否展示
-        searchVal: '',  // 查询条件
-        radioStyle: {  //  设备选项样式
-          display: 'flex',
-          alignItems: 'center',
-          width: '100%',
-          border: '1px solid #e4e4e4',
-          borderRadius: '6px',
-          padding: '10px 15px',
-          marginTop: '15px'
-        },
-        equipment: null,  //  选中的设备 id
-        equipmentNo: '',  //  选中的设备   序列号
-        equipmentList: [],  //  设备数据列表
-        pageNo: 1,  //  页码
-        pageSize: 10,  //  每页条数
-        total: 0,  //  列表总条数
-      }
-    },
-    methods: {
-      // 设备列表
-      getEquipmentList(pageNo){
-        pageNo ? this.pageNo = pageNo : null
-        deviceQuery({
-          pageNo: this.pageNo,
-          pageSize: this.pageSize,
-          deviceNo: this.searchVal,
-        }).then(res => {
-          if(res.status == 200){
-            this.equipmentList = res.data.list || []
-            this.total = res.data.count
-          }else{
-            this.equipmentList = []
-            this.total = 0
-          }
-        })
-      },
-      //  查询
-      onSearch(value) {
-        this.searchVal = value
-        this.getEquipmentList(1)
-      },
-      // 设备  change
-      onChange(e) {
-        const _this = this
-        _this.equipment = e.target.value
-        let i = _this.equipmentList.findIndex(item => item.id == _this.equipment)
-        _this.equipmentNo = _this.equipmentList[i].deviceNo
-        setTimeout(()=>{
-          _this.modalIsShow = false
-        },300)
-      },
-      //  页码  change
-      onShowPageChange(page, pageSize){
-        this.pageNo = page
-        this.getEquipmentList()
-      },
-      //  pageSize 变化的回调
-      onShowSizeChange(current, size){
-        this.pageSize = size
-        this.getEquipmentList()
-      }
-    },
-    watch: {
-      //  父页面传过来的弹框状态
-      openEquipmentModal (newValue, oldValue) {
-        this.modalIsShow = newValue
-      },
-      //  重定义的弹框状态
-      modalIsShow (val){
-        if (!val){
-          this.$emit('close', this.equipment, this.equipmentNo)
-        }else{
-          this.getEquipmentList(1)
-        }
-      }
-    }
-  }
-</script>
-
-<style lang="less">
-  .CarWashEquipmentModal{
-    .input-search{
-      margin-bottom: 15px;
-    }
-    .radio-group{
-      display: block;
-      width: 100%;
-      .ant-radio-wrapper{
-        .ant-radio{
-          width: 16px;
-        }
-        span:nth-child(2){
-          width: 100%;
-        }
-      }
-      .radio-group-item{
-        display: flex;
-        justify-content: space-between;
-        align-items: center;
-        .item-label{
-          margin: 0;
-        }
-        .item-status{
-          margin: 0;
-          font-size: 12px;
-          color: #19be6b;
-        }
-        .item-status.ybind{
-          color: #ff9900;
-        }
-      }
-    }
-    .pagination-s{
-      margin-top: 20px;
-    }
-  }
-</style>

+ 0 - 243
src/views/CarWashManagement/DetailsCarWashModal.vue

@@ -1,243 +0,0 @@
-<template>
-  <div class="DetailsCarWash">
-    <a-modal class="DetailsCarWashModal" title="查看详情" :width="1000" :footer="null" :destroyOnClose="true" @cancel="isShow=false" v-model="isShow">
-      <v-select v-show="false" ref="featuredServiceLabel" placeholder="请选择网点标签" code="STORE_LABEL"></v-select>
-      <a-row :gutter="20">
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">网点名称:</p>
-          <p class="item-main">{{ carWashInfo.name }}</p>
-        </a-col>
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">地址:</p>
-          <p class="item-main">{{ carWashInfo.addrProvinceName }} - {{ carWashInfo.addrCityName }} - {{ carWashInfo.addrDistrictName }}</p>
-        </a-col>
-        <a-col :span="24" class="item-cont">
-          <p class="item-label">详细地址:</p>
-          <p class="item-main">{{ carWashInfo.addrDetail }}</p>
-        </a-col>
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">设备ID:</p>
-          <p class="item-main">{{ carWashInfo.deviceVOList ? carWashInfo.deviceVOList[0].deviceNo : '' }}</p>
-        </a-col>
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">网点标签:</p>
-          <p class="item-main">
-            <a-tag color="blue" v-for="(item, index) in labelList" :ket="index">{{ item }}</a-tag>
-          </p>
-        </a-col>
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">经度:</p>
-          <p class="item-main">{{ carWashInfo.lng }}</p>
-        </a-col>
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">纬度:</p>
-          <p class="item-main">{{ carWashInfo.lat }}</p>
-        </a-col>
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">服务类型:</p>
-          <p class="item-main">
-            <a-tag color="blue" v-for="(item, index) in serviceType" :key="index">{{ item }}</a-tag>
-          </p>
-        </a-col>
-        <a-col :span="12" class="item-cont">
-          <p class="item-label">营业时间:</p>
-          <p class="item-main">{{ carWashInfo.beginTime ? carWashInfo.beginTime.substr(0,5) : null }} - {{ carWashInfo.endTime ? carWashInfo.endTime.substr(0,5) : null }}</p>
-        </a-col>
-        <a-col :span="24" class="item-cont">
-          <p class="item-label">时段价格:</p>
-          <div class="item-main period-price-con">
-            <div class="item-period" v-for="(item, index) in storeItemPriceDTOList" :key="index">
-              <p class="period" :style="{width: 100/(item.currentPrices.length + 1) + '%'}">{{ item.beginTime }} - {{ item.endTime }}</p>
-              <p class="period-price" :style="{width: 100/(item.currentPrices.length + 1) + '%'}" v-for="(subItem, ind) in item.currentPrices" :key="ind">{{ subItem.name }}:<strong class="price">{{ subItem.price }}</strong><span class="price-unit">元</span></p>
-            </div>
-          </div>
-        </a-col>
-        <a-col :span="24" class="item-cont">
-          <p class="item-label">路段指引:</p>
-          <p class="item-main" v-html="carWashInfo.guidance"></p>
-        </a-col>
-        <a-col :span="24" class="item-cont">
-          <p class="item-label">温馨提示:</p>
-          <p class="item-main">{{ carWashInfo.reminder }}</p>
-        </a-col>
-        <a-col :span="24" class="item-cont">
-          <p class="item-label">现场照片:</p>
-          <p class="item-main">
-            <img src="../../assets/avatar2.jpg" class="small-pic" @click="isPicModal=true" />
-          </p>
-        </a-col>
-        <a-col :span="24" class="btn-cont">
-          <a-button @click="isShow=false">取消</a-button>
-        </a-col>
-      </a-row>
-    </a-modal>
-    
-    <!-- 查看现场照片 -->
-    <a-modal class="picModal" title="查看现场照片" :width="800" :footer="null" :destroyOnClose="true" @cancel="isPicModal=false" v-model="isPicModal">
-      <img :src="pic" class="pic" />
-    </a-modal>
-  </div>
-</template>
-
-<script>
-  import { VSelect } from '@/components'
-  import moment from 'moment'
-  import { storeFind, findItem } from '@/api/car-wash'
-  export default{
-    name: 'DetailsCarWashModal',
-    components: { VSelect },
-    props: {
-      openModal: {  //  弹框是否展示
-        type: Boolean,
-        default: false
-      },
-      carWashId: {  //  网点id
-        type: String,
-        default: ''
-      }
-    },
-    data(){
-      return{
-        isShow: this.openModal,  //  弹框是否展示
-        labelList: [],  //  网点标签
-        isPicModal: false,  //  现场照片  弹框是否展示
-        pic: require('../../assets/avatar2.jpg'),  //  现场照片  路径
-        carWashInfo: {}  ,//  网点信息
-        serviceType: [],  //  服务类型
-        storeItemPriceDTOList: [],  //  时段价格
-      }
-    },
-    methods: {
-      // 网点详情
-      getCarWashInfo(id){
-        storeFind({ id: id }).then(res => {
-          if(res.status == 200){
-            // 查询门店的服务时段价格
-            findItem({ id: id }).then(result => {
-              if(result.status == 200){
-                this.carWashInfo = Object.assign(res.data, {storeItemPriceDTOList: result.data})
-                console.log(this.carWashInfo)
-                this.setVal()
-              }
-            })
-          }
-        })
-      },
-      //  赋值
-      setVal(){
-        const _this = this
-        // 网点标签
-        setTimeout(()=>{
-          let featuredServiceLabel = this.carWashInfo.featuredServiceLabel.split(',')
-          let arr = []
-          featuredServiceLabel.map(k => {
-            arr.push(_this.$refs.featuredServiceLabel.getNameByCode(k))
-          })
-          _this.labelList = arr
-        },0)
-        // 时段价格
-        this.setPeriodPrice(this.carWashInfo.storeItemPriceDTOList)
-      },
-      // 时段价格  赋值处理
-      setPeriodPrice(storeItemPriceDTOList){
-        let arrInd = 0
-        this.storeItemPriceDTOList = []
-        for (let key in storeItemPriceDTOList) {
-          if (storeItemPriceDTOList.hasOwnProperty(key)) {
-            console.log(key,'====key ---------for in')
-            this.storeItemPriceDTOList.push({
-              beginTime: key.split(',')[0],
-              endTime: key.split(',')[1],
-              currentPrices: []
-            })
-            let idArr = []
-            storeItemPriceDTOList[key].map((k, ind) => {
-              this.storeItemPriceDTOList[arrInd].currentPrices.push({ name: k.itemName, price: k.currentPrice, itemId: k.itemId })
-              idArr.push(k.itemName)
-            })
-            this.serviceType = idArr  //  服务类型
-            arrInd++
-          }
-        }
-        Object.getOwnPropertyNames(storeItemPriceDTOList).forEach(function(key){
-          console.log(key+ '---'+storeItemPriceDTOList[key],'----------foreach')
-        })
-        console.log(Object.keys(storeItemPriceDTOList),'----------Object.keys')
-        // console.log(this.storeItemPriceDTOList)
-        // console.log(this.serviceType)
-      },
-    },
-    watch: {
-      //  父页面传过来的弹框状态
-      openModal (newValue, oldValue) {
-        this.isShow = newValue
-      },
-      //  重定义的弹框状态
-      isShow (val){
-        if (!val){
-          this.$emit('close')
-        }
-      },
-      carWashId (newValue, oldValue){
-        if(newValue && this.isShow){
-          this.getCarWashInfo(newValue)
-        }
-      }
-    }
-  }
-</script>
-
-<style lang="less">
-  .DetailsCarWashModal{
-    p{
-      margin: 0;
-    }
-    .item-cont{
-      margin-bottom: 24px;
-      display: flex;
-      align-items: center;
-      .item-label{
-        width: 115px;
-        font-size: 14px;
-        color: rgba(0, 0, 0, 0.85);
-        text-align: right;
-        flex-shrink: 0;
-      }
-      .item-main{
-        flex-grow: 1;
-      }
-      .period-price-con{
-        border-bottom: 1px solid #e8e8e8;
-      }
-      .item-period{
-        display: flex;
-        align-items: center;
-        justify-content: space-evenly;
-        flex-grow: 1;
-        border: 1px solid #e8e8e8;
-        border-width: 1px 1px 0;
-        text-align: center;
-        .period, .period-price{
-          padding: 5px 0;
-          border-right: 1px solid #e8e8e8;
-        }
-        .period-price:last-child{
-          border-right: none;
-        }
-      }
-    }
-    .btn-cont{
-      text-align: center;
-    }
-    .small-pic{
-      display: block;
-      cursor: zoom-in;
-      width: 300px;
-    }
-  }
-  .pic{
-    display: block;
-    max-width: 100%;
-    margin: 0 auto;
-  }
-</style>

+ 540 - 227
src/views/CouponCenter/AddCouponModal.vue

@@ -1,7 +1,14 @@
 <template>
-  <a-modal class="CouponModal" :title="mtitle" :width="1020" :footer="null" :destroyOnClose="true" @cancel="isShow=false" v-model="isShow">
+  <a-modal
+    class="CouponModal"
+    :title="pageType == 'add' ? '新增' : pageType == 'edit' ? '编辑' : ''"
+    :width="1030"
+    :footer="null"
+    :destroyOnClose="true"
+    @cancel="isShow = false"
+    v-model="isShow">
     <!-- 表单 -->
-    <a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+    <a-form-model ref="ruleForms" :model="form" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
       <a-row>
         <a-col :span="24">
           <div class="c-title">
@@ -10,49 +17,131 @@
           </div>
         </a-col>
         <a-col :span="12">
-          <a-form-model-item label="优惠券名称" prop="name">
-            <a-input v-model="form.name" :maxLength="20" placeholder="请输入优惠券名称,20个字以内" />
-          </a-form-model-item>
+          <a-form-model-item label="优惠券名称" prop="title"><a-input v-model="form.title" :maxLength="20" placeholder="请输入优惠券名称,20个字以内" /></a-form-model-item>
         </a-col>
         <a-col :span="12">
-          <a-form-model-item label="发放总量" prop="name">
+          <!-- 优惠券类型分为:FULLSUB 满减券、DISCOUNT 折扣券、VOUCHER 代金券和 SUB 实价券 -->
+          <a-form-model-item label="优惠券类型" prop="couponType">
+            <v-select
+              ref="couponType"
+              v-model="form.couponType"
+              @change="selectChange('couponType')"
+              showArrow
+              placeholder="请选择优惠券类型"
+              code="COUPON_TYPE"
+              :disabled="takeCount > 0"></v-select>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="12" v-if="form.couponType == 'VOUCHER'">
+          <a-form-model-item label="优惠券面额" prop="subAmount">
+            <a-input-number
+              v-model="form.subAmount"
+              :disabled="takeCount > 0"
+              :min="1"
+              :max="999999"
+              placeholder="请输入优惠券面额"
+              class="input-number-s" />
+            <span class="unit">元</span>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="12" v-if="form.couponType == 'VOUCHER'">
+          <a-form-model-item label="是否限额使用" class="default-form-item form-item-required">
             <a-row :gutter="20">
-              <a-col :span="7">
-                <a-select v-model="form.isQuota" placeholder="请选择">
-                  <a-select-option :value="item.code" v-for="(item, index) in isFlagList" :key="index">{{item.code == '0' ? '不限' : '限制'}}</a-select-option>
-                </a-select>
+              <a-col :span="9">
+                <a-form-model-item prop="isLimit">
+                  <v-select
+                    ref="flag"
+                    v-model="isLimit"
+                    @change="selectChange('isLimitE')"
+                    showArrow
+                    placeholder="请选择"
+                    code="FLAG"
+                    :disabled="takeCount > 0"></v-select>
+                </a-form-model-item>
               </a-col>
-              <a-col :span="17" v-show="form.isQuota == '1'">
-                <a-input-number v-model="form.quota" :min="0" :max="999999" placeholder="请输入限制发放份数, 0-999999" class="input-number-s" />
-                <span class="unit">份</span>
+              <a-col :span="15" v-if="isLimit == '1'">
+                <a-form-model-item prop="limitAmount">
+                  满<a-input-number
+                    v-model="form.limitAmount"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="限额数值"
+                    class="input-number-ms" />元使用
+                </a-form-model-item>
               </a-col>
             </a-row>
           </a-form-model-item>
         </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="优惠券类型" prop="couponType">
-            <!-- <v-select ref="couponType" v-model="form.couponType" showArrow placeholder="请选择优惠券类型" code="CHECK_ENABLE_STATE"></v-select> -->
-            <a-select v-model="form.couponType" placeholder="请选择">
-              <a-select-option :value="item.code" v-for="(item, index) in couponTypeList" :key="index">{{item.dispName}}</a-select-option>
-            </a-select>
+      </a-row>
+      <a-row>
+        <a-col :span="12" v-if="form.couponType == 'FULLSUB'">
+          <a-form-model-item label="满" class="default-form-item form-item-required">
+            <a-row>
+              <a-col :span="12">
+                <a-form-model-item prop="limitAmount">
+                  <a-input-number
+                    v-model="form.limitAmount"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="限额数值"
+                    class="input-number-ls" />
+                  <span class="unit">减</span>
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="12">
+                <a-form-model-item prop="subAmount">
+                  <a-input-number
+                    v-model="form.subAmount"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="减免金额"
+                    class="input-number-ls" />
+                  <span class="unit">元</span>
+                </a-form-model-item>
+              </a-col>
+            </a-row>
           </a-form-model-item>
         </a-col>
+      </a-row>
+      <a-row>
         <a-col :span="12">
-          <a-form-model-item label="优惠券面额" prop="name">
-            <a-input-number v-model="form.quota" :min="0" :max="999999" placeholder="请输入优惠券面额, 0-999999" class="input-number-s" />
-            <span class="unit">元</span>
+          <a-form-model-item label="发放总量" class="default-form-item form-item-required">
+            <a-row :gutter="20">
+              <a-col :span="9">
+                <a-form-model-item label="" prop="quotaLimit">
+                  <v-select
+                    ref="limitFlag"
+                    v-model="form.quotaLimit"
+                    :disabled="takeCount > 0"
+                    @change="selectChange('quotaLimit')"
+                    showArrow
+                    placeholder="请选择"
+                    code="LIMIT_FLAG"></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="15" v-if="form.quotaLimit == '1'">
+                <a-form-model-item label="" prop="quota">
+                  <a-input-number
+                    v-model="form.quota"
+                    :disabled="takeCount > 0"
+                    :min="1"
+                    :max="999999"
+                    placeholder="请输入限制发放总量"
+                    class="input-number-s" />
+                  <span class="unit">份</span>
+                </a-form-model-item>
+              </a-col>
+            </a-row>
           </a-form-model-item>
         </a-col>
         <a-col :span="12">
-          <a-form-model-item label="是否限额使用" prop="name">
-            <a-select v-model="form.isQuota" placeholder="请选择">
-              <a-select-option :value="item.code" v-for="(item, index) in isFlagList" :key="index">{{item.dispName}}</a-select-option>
-            </a-select>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="24">
-          <a-form-model-item label="优惠券说明" prop="name" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
-            <a-textarea v-model="form.name" :maxLength="256" :auto-size="{ minRows: 3, maxRows: 5 }" placeholder="请输入优惠券说明,256个字以内" />
+          <a-form-model-item label="优惠券说明" prop="ruleDesc">
+            <a-textarea v-model="form.ruleDesc" :maxLength="256" :auto-size="{ minRows: 3, maxRows: 5 }" placeholder="请输入优惠券说明,256个字以内" />
           </a-form-model-item>
         </a-col>
         <a-col :span="24">
@@ -61,52 +150,68 @@
             <a-divider type="vertical" class="bold-divider" />
           </div>
         </a-col>
-        <a-col :span="24">
-          <a-form-model-item label="持卡会员" prop="name" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
+        <a-col :span="12">
+          <a-form-model-item label="持卡会员" class="default-form-item form-item-required">
             <a-row :gutter="20">
-              <a-col :span="6">
-                <a-select v-model="form.isQuota" placeholder="请选择">
-                  <a-select-option :value="item.code" v-for="(item, index) in isFlagList" :key="index">{{item.code == '0' ? '不限领' : '限领'}}</a-select-option>
-                </a-select>
+              <a-col :span="9">
+                <a-form-model-item prop="cardholderCouponLimit.isLimit">
+                  <v-select
+                    ref="limitFlag"
+                    v-model="form.cardholderCouponLimit.isLimit"
+                    @change="selectChange('isLimitC')"
+                    showArrow
+                    placeholder="请选择"
+                    code="LIMIT_FLAG"></v-select>
+                </a-form-model-item>
               </a-col>
-              <a-col :span="16">
+              <a-col :span="15" v-if="form.cardholderCouponLimit.isLimit == '1'">
                 <a-row>
-                  <a-col :span="10">
-                    <a-input-number v-model="form.quota" :min="0" :max="999999" placeholder="请输入限领份数, 0-999999" class="input-number-s" />
-                  </a-col>
-                  <a-col :span="3">
-                    份/每
+                  <a-col :span="11">
+                    <a-form-model-item prop="cardholderCouponLimit.limitCount">
+                      <a-input-number v-model="form.cardholderCouponLimit.limitCount" :min="1" :max="999999" placeholder="限领份数" class="input-number-s" />
+                    </a-form-model-item>
                   </a-col>
-                  <a-col :span="6">
-                    <a-select v-model="form.restrictedUnit" placeholder="请选择">
-                      <a-select-option :value="item.code" v-for="(item, index) in isUnitList" :key="index">{{item.dispName}}</a-select-option>
-                    </a-select>
+                  <a-col :span="4">份/每</a-col>
+                  <a-col :span="9">
+                    <a-form-model-item prop="cardholderCouponLimit.limitCondition">
+                      <a-select v-model="form.cardholderCouponLimit.limitCondition" placeholder="请选择">
+                        <a-select-option :value="item.code" v-for="(item, index) in isUnitList" :key="index">{{ item.dispName }}</a-select-option>
+                      </a-select>
+                    </a-form-model-item>
                   </a-col>
                 </a-row>
               </a-col>
             </a-row>
           </a-form-model-item>
         </a-col>
-        <a-col :span="24">
-          <a-form-model-item label="未持卡会员" prop="name" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
+        <a-col :span="12">
+          <a-form-model-item label="未持卡会员" class="default-form-item form-item-required">
             <a-row :gutter="20">
-              <a-col :span="6">
-                <a-select v-model="form.isQuota" placeholder="请选择">
-                  <a-select-option :value="item.code" v-for="(item, index) in isFlagList" :key="index">{{item.code == '0' ? '不限领' : '限领'}}</a-select-option>
-                </a-select>
+              <a-col :span="9">
+                <a-form-model-item prop="normalCouponLimit.isLimit">
+                  <v-select
+                    ref="limitFlag"
+                    v-model="form.normalCouponLimit.isLimit"
+                    @change="selectChange('isLimitN')"
+                    showArrow
+                    placeholder="请选择"
+                    code="LIMIT_FLAG"></v-select>
+                </a-form-model-item>
               </a-col>
-              <a-col :span="16">
+              <a-col :span="15" v-if="form.normalCouponLimit.isLimit == '1'">
                 <a-row>
-                  <a-col :span="10">
-                    <a-input-number v-model="form.quota" :min="0" :max="999999" placeholder="请输入限领份数, 0-999999" class="input-number-s" />
-                  </a-col>
-                  <a-col :span="3">
-                    份/每
+                  <a-col :span="11">
+                    <a-form-model-item prop="normalCouponLimit.limitCount">
+                      <a-input-number v-model="form.normalCouponLimit.limitCount" :min="1" :max="999999" placeholder="限领份数" class="input-number-s" />
+                    </a-form-model-item>
                   </a-col>
-                  <a-col :span="6">
-                    <a-select v-model="form.restrictedUnit" placeholder="请选择">
-                      <a-select-option :value="item.code" v-for="(item, index) in isUnitList" :key="index">{{item.dispName}}</a-select-option>
-                    </a-select>
+                  <a-col :span="4">份/每</a-col>
+                  <a-col :span="9">
+                    <a-form-model-item prop="normalCouponLimit.limitCondition">
+                      <a-select v-model="form.normalCouponLimit.limitCondition" placeholder="请选择">
+                        <a-select-option :value="item.code" v-for="(item, index) in isUnitList" :key="index">{{ item.dispName }}</a-select-option>
+                      </a-select>
+                    </a-form-model-item>
                   </a-col>
                 </a-row>
               </a-col>
@@ -114,20 +219,32 @@
           </a-form-model-item>
         </a-col>
         <a-col :span="12">
-          <a-form-model-item label="有效期" prop="name">
+          <a-form-model-item label="有效期" class="default-form-item form-item-required">
             <a-row :gutter="20">
               <a-col :span="9">
-                <a-select v-model="form.validType" placeholder="请选择">
-                  <a-select-option :value="item.code" v-for="(item, index) in couponValidityList" :key="index">{{item.dispName}}</a-select-option>
-                </a-select>
+                <a-form-model-item prop="validType">
+                  <a-select v-model="form.validType" :disabled="takeCount > 0" @change="selectChange('validType')" placeholder="请选择">
+                    <a-select-option :value="item.code" v-for="(item, index) in couponValidityList" :key="index">{{ item.dispName }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
               </a-col>
-              <a-col :span="15" v-show="form.validType == 'ABSOLUTE'">
-                <a-range-picker @change="validDateChange" :disabled-date="disabledDate" format="YYYY-MM-DD" />
+              <a-col :span="15" v-if="form.validType == 'ABSOLUTE'">
+                <a-form-model-item prop="timeRange">
+                  <a-range-picker v-model="form.timeRange" :disabled="takeCount > 0" @change="validDateChange" :disabled-date="disabledDate" format="YYYY-MM-DD" />
+                </a-form-model-item>
               </a-col>
-              <a-col :span="15" v-show="form.validType == 'RELATIVE'">
+              <a-col :span="15" v-if="form.validType == 'RELATIVE'">
                 <a-row>
                   <a-col :span="16">
-                    <a-input-number v-model="form.quota" :min="0" :max="999999" placeholder="请输入" class="input-number-s" />
+                    <a-form-model-item prop="validDate">
+                      <a-input-number
+                        v-model="form.validDate"
+                        :disabled="takeCount > 0"
+                        :min="1"
+                        :max="999999"
+                        placeholder="请输入"
+                        class="input-number-s" />
+                    </a-form-model-item>
                   </a-col>
                   <a-col :span="8">天内有效</a-col>
                 </a-row>
@@ -136,201 +253,397 @@
           </a-form-model-item>
         </a-col>
         <a-col :span="12">
-          <a-form-model-item label="是否允许优惠叠加" prop="name">
-            <a-select v-model="form.isQuota" placeholder="请选择">
-              <a-select-option :value="item.code" v-for="(item, index) in isFlagList" :key="index">{{item.dispName}}</a-select-option>
+          <a-form-model-item label="适用洗车类型" prop="couponScopeList">
+            <a-select v-model="form.couponScopeList" placeholder="请选择适用洗车类型" showArrow mode="multiple">
+              <a-select-option v-for="item in itemQueryList" :key="item.id" :value="item.id">{{ item.itemName }}</a-select-option>
             </a-select>
           </a-form-model-item>
         </a-col>
         <a-col :span="12">
-          <a-form-model-item label="适用洗车类型" prop="name">
-            <v-select ref="serviceType" v-model="form.isQuota" showArrow mode="multiple" placeholder="请选择适用洗车类型" code="CHECK_ENABLE_STATE"></v-select>
-          </a-form-model-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-model-item label="适用洗车网点" prop="isOutletsLimit">
+          <a-form-model-item class="default-form-item form-item-required">
+            <div slot="label" class="form-item-label">
+              <a-tooltip
+                placement="right"
+                arrow-point-at-center
+                title="已设置的适用洗车网点再次修改(尤其是减少使用网点)后,在【优惠券统计】中会保留原适用洗车网点的统计数据。"
+              >
+                适用洗车网点
+                <a-icon :style="{ fontSize: '17px', color: '#1890ff', verticalAlign: 'sub' }" type="question-circle" />
+              </a-tooltip>
+            </div>
             <a-row :gutter="20">
-              <a-col :span="12">
-                <a-select v-model="form.isOutletsLimit" placeholder="请选择">
-                  <a-select-option :value="item.code" v-for="(item, index) in isAllList" :key="index">{{item.dispName}}</a-select-option>
-                </a-select>
+              <a-col :span="9">
+                <a-form-model-item prop="isStoreLimit">
+                  <a-select v-model="form.isStoreLimit" @change="selectChange('isStoreLimit')" placeholder="请选择">
+                    <a-select-option :value="item.code" v-for="(item, index) in isAllList" :key="index">{{ item.dispName }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
               </a-col>
-              <a-col :span="12" v-show="form.isOutletsLimit == 1">
-                <a-row :gutter="20">
-                  <a-col :span="12">
-                    已选 <strong>4</strong> 个
-                  </a-col>
-                  <a-col :span="12">
-                    <a-button type="primary" size="small" class="small-btn" @click="openOutletsModal=true">选择</a-button>
-                  </a-col>
-                </a-row>
+              <a-col :span="15" v-if="form.isStoreLimit == '1'">
+                <a-form-model-item prop="couponStoreList">
+                  <a-row :gutter="20">
+                    <a-col :span="15">
+                      已选
+                      <strong>{{ form.couponStoreList.length }}</strong>
+                      个
+                    </a-col>
+                    <a-col :span="9"><a-button type="primary" size="small" class="small-btn" @click="openOutletsModal = true">选择</a-button></a-col>
+                  </a-row>
+                </a-form-model-item>
               </a-col>
             </a-row>
           </a-form-model-item>
         </a-col>
         <a-col :span="24">
           <a-form-model-item :label-col="{ span: 0 }" :wrapper-col="{ span: 24 }" class="btn-cont">
-            <a-button type="primary" @click="onSubmit('ruleForm')">保存</a-button>
-            <a-button class="resetForm" @click="resetForm">取消</a-button>
+            <a-button type="primary" @click="onSubmit">保存</a-button>
+            <a-button class="resetForm" @click="onCancel">取消</a-button>
           </a-form-model-item>
         </a-col>
       </a-row>
     </a-form-model>
-    
+
     <!-- 选择网点 -->
-    <choose-outlets
-      :openOutletsModal="openOutletsModal"
-      @close="closeChooseOutlets"
-    />
-    
+    <choose-outlets :openOutletsModal="openOutletsModal" :storeList="form.couponStoreList" @close="closeChooseOutlets" />
   </a-modal>
 </template>
 
 <script>
-  import { VSelect } from '@/components'
-  import moment from 'moment'
-  import ChooseOutlets from './ChooseOutlets.vue'
-  export default{
-    name: 'AddCouponModal',
-    components: { VSelect, ChooseOutlets },
-    props: {
-      openModal: {  //  弹框是否展示
-        type: Boolean,
-        default: false
-      },
-      mtitle: {  //  弹框标题
-        type: String,
-        default: ''
-      }
+import { VSelect } from '@/components'
+import moment from 'moment'
+import ChooseOutlets from './ChooseOutlets.vue'
+import { itemQuery } from '@/api/car-wash'
+import { couponCreate, couponToUpdate, couponUpdate } from '@/api/coupons'
+export default {
+  name: 'AddCouponModal',
+  components: { VSelect, ChooseOutlets },
+  props: {
+    openModal: {
+      //  弹框是否展示
+      type: Boolean,
+      default: false
+    },
+    pageType: {
+      //  页面类型  add 新增 / edit 编辑
+      type: String,
+      default: ''
     },
-    data(){
-      return{
-        isShow: this.openModal,  //  弹框是否展示
-        form: {
-          name: '',  //  优惠券名称
-          isQuota: '0',  //  发放总量  不限,限制
-          quota: '',  //  发放总量  份数
-          couponType: 'VOUCHER',  //  优惠券类型
-          restrictedUnit: '0',  //  限领单位     自然月
-          validType: 'NONE', //  有效期类型:ABSOLUTE绝对时效(时间区间)/RELATIVE相对时效(领取后多少天内有效)/NONE不限制
-          startTime: '', //  有效期 开始
-          endTime: '', //  有效期 结束
-          validDate: '', //  有效期有效时长  (领取后多少天内有效)
-          isOutletsLimit: '0',  //  适用洗车网点限制   0全部(不限)  1部分(限制)
+    couponId: { //  优惠券id
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  弹框是否展示
+      form: {
+        title: '', //  优惠券名称
+        quotaLimit: '0', //  是否限制发放数量(0否 1是)
+        quota: '', //  发放数量
+        couponType: 'VOUCHER', //  优惠券类型:FULLSUB满减/SUB立减/DISCOUNT折扣券/VOUCHER代金券/PROMOCODE优惠码
+        limitAmount: '', //  限定金额
+        subAmount: '', //  满减券 减免 / 代金券面额
+        ruleDesc: '', //  规则说明
+        normalCouponLimit: { //  非持卡会员
+          isLimit: '0', //  是否限制0否1是
+          limitCount: '', //  限制数量
+          limitCondition: 'monthly', //  限制条件:none无条件;monthly每月;daily每日
+          userType: 'normal' //  用户类型:normal普通用户;cardholder持卡用户;all所有用户
         },
-        rules: {
-          name: [
-            { required: true, message: '请输入优惠券名称', trigger: 'blur' }
-          ]
+        cardholderCouponLimit: { //  持卡会员
+          isLimit: '0', //  是否限制0否1是
+          limitCount: '', //  限制数量
+          limitCondition: 'monthly', //  限制条件:none无条件;monthly每月;daily每日
+          userType: 'cardholder' //  用户类型:normal普通用户;cardholder持卡用户;all所有用户
         },
-        isFlagList: [ //  是否  下拉数据列表
-          {dispName: '是', code: '1'},
-          {dispName: '否', code: '0'}
-        ],
-        couponTypeList: [ //  优惠券类型数据列表
-          {dispName: '满减券', code: 'FULLSUB'},
-          {dispName: '代金券', code: 'VOUCHER'}
-        ],
-        isUnitList: [  //  限领份数单位  下拉数据列表
-          {dispName: '自然月', code: '0'},
-        ],
-        couponValidityList: [ //  有效期  下拉数据列表
-          {dispName: '不限', code: 'NONE'},
-          {dispName: '固定日期', code: 'ABSOLUTE'},
-          {dispName: '领取后', code: 'RELATIVE'}
-        ],
-        isAllList: [ //  适用洗车网点  全部 部分 下拉数据列表
-          {dispName: '全部', code: '0'},
-          {dispName: '部分', code: '1'}
-        ],
-        openOutletsModal: false  ,//  选择网点  弹框展示状态
-      }
-    },
-    methods: {
-      moment,
-      range(start, end) {
-        const result = []
-        for (let i = start; i < end; i++) {
-          result.push(i)
-        }
-        return result
-      },
-      //  有效期  固定日期  禁用范围
-      disabledDate(current) {
-        // 不能选择今天之前的日期
-        return current && current < moment().subtract(1, 'days')
+        validType: 'NONE', //  有效期类型:ABSOLUTE绝对时效(时间区间)/RELATIVE相对时效(领取后多少天内有效)/NONE不限制
+        timeRange: [], //  有效期  时间范围(为解决表单校验)
+        startTime: '', //  开始时间
+        endTime: '', //  结束时间
+        validDate: '', //  有效时长
+        isOverlay: '0', //  是否可叠加使用(0否,1是)
+        scopeType: 'ITEM', //  适用范围类型:ITEM 部分服务/ITEM_ALL 全部服务/BUNDLE 部分套餐/BUNDLE_ALL 全部套餐
+        couponScopeList: [], //  优惠券适用范围设置
+        isStoreLimit: '0', //  是否有门店限制  (0否,1是)
+        couponStoreList: [] //  优惠券使用范围设置
       },
-      //  有效期  固定日期  change
-      validDateChange(date, dateString){
-        console.log(date, dateString)
+      rules: {
+        title: [{ required: true, message: '请输入优惠券名称', trigger: 'blur' }],
+        quota: [{ required: true, message: '请输入限制发放总量', trigger: 'blur' }],
+        couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'blur' }],
+        limitAmount: [{ required: true, message: '请输入限额数值', trigger: 'blur' }],
+        subAmount: [{ required: true, message: '请输入金额', trigger: 'blur' }],
+        'normalCouponLimit.limitCount': [{ required: true, message: '请输入限领份数', trigger: 'blur' }],
+        'cardholderCouponLimit.limitCount': [{ required: true, message: '请输入限领份数', trigger: 'blur' }],
+        timeRange: [{ required: true, message: '请选择日期范围', trigger: 'blur' }],
+        validDate: [{ required: true, message: '请输入有效时长', trigger: 'blur' }],
+        couponScopeList: [{ required: true, message: '请选择适用洗车类型', trigger: 'blur' }],
+        couponStoreList: [{ required: true, message: '请选择适用洗车网点', trigger: 'blur' }]
       },
-      //  保存
-      onSubmit(formName){
-        console.log(this.form, '表单数据')
-        this.$refs[formName].validate(valid => {
-          if (valid) {
-            let formData = JSON.parse(JSON.stringify(this.form))
-            
-            //  提交前时间格式还需转换
-            console.log(formData,'-----提交的表单数据')
-          } else {
-            return false
+      isLimit: '0', //  代金券  是否限额使用(0否,1是)
+      isUnitList: [
+        //  限领份数单位  下拉数据列表
+        { dispName: '自然月', code: 'monthly' }
+      ],
+      couponValidityList: [
+        //  有效期  下拉数据列表
+        { dispName: '不限', code: 'NONE' },
+        { dispName: '固定日期', code: 'ABSOLUTE' },
+        { dispName: '领取后', code: 'RELATIVE' }
+      ],
+      isAllList: [
+        //  适用洗车网点  全部 部分 下拉数据列表
+        { dispName: '全部', code: '0' },
+        { dispName: '部分', code: '1' }
+      ],
+      itemQueryList: [], //  适用洗车类型
+      openOutletsModal: false, //  选择网点  弹框展示状态
+      takeCount: '' //  发放数量(指客户已领取但未使用的数量)  usedCount(指客户已领取并已使用的数量)
+    }
+  },
+  methods: {
+    moment,
+    range (start, end) {
+      const result = []
+      for (let i = start; i < end; i++) {
+        result.push(i)
+      }
+      return result
+    },
+    //  有效期  固定日期  禁用范围
+    disabledDate (current) {
+      // 不能选择今天之前的日期
+      return current && current < moment().subtract(1, 'days')
+    },
+    //  有效期  固定日期  change
+    validDateChange (date, dateString) {
+      this.form.startTime = dateString[0]
+      this.form.endTime = dateString[1]
+    },
+    //  保存
+    onSubmit () {
+      this.$refs.ruleForms.validate(valid => {
+        if (valid) {
+          const formData = JSON.parse(JSON.stringify(this.form))
+          delete formData.timeRange
+          // 适用洗车类型
+          const couponScopeArr = []
+          formData.couponScopeList.map(item => { couponScopeArr.push({ scopeType: 'ITEM', scopeValue: item }) })
+          formData.couponScopeList = couponScopeArr
+          if (this.pageType == 'add') { //  新增
+            formData.id = null
+            this.couponCreate(formData)
+          } else if (this.pageType == 'edit') { //  编辑
+            formData.id = String(this.couponId)
+            this.couponUpdate(formData)
           }
+        } else {
+          return false
+        }
+      })
+    },
+    // 创建优惠券
+    couponCreate (formData) {
+      couponCreate(formData).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$emit('success')
+        } else {
+          this.$message.error(res.message)
+        }
+      })
+    },
+    // 编辑优惠券
+    couponUpdate (formData) {
+      couponUpdate(formData).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$emit('success')
+        } else {
+          this.$message.error(res.message)
+        }
+      })
+    },
+    // 取消
+    onCancel () {
+      this.resetForm()
+      this.isShow = false
+    },
+    //  选择网点
+    closeChooseOutlets (val) {
+      this.form.couponStoreList = []
+      if (val) {
+        val.map(item => {
+          this.form.couponStoreList.push({ storeId: item })
         })
-      },
-      // 取消
-      resetForm(){
-        this.$refs.ruleForm.resetFields()
-        this.isShow = false
-      },
-      //  选择网点
-      closeChooseOutlets(val, name){
-        // if(val){
-        //   this.form.equipment = val
-        //   this.equipmentName = name
-        // }
-        this.openOutletsModal = false
-      },
+      }
+      this.openOutletsModal = false
     },
-    watch: {
-      //  父页面传过来的弹框状态
-      openModal (newValue, oldValue) {
-        this.isShow = newValue
-      },
-      //  重定义的弹框状态
-      isShow (val){
-        if (!val){
-          this.$emit('close')
+    // 获取优惠券详情
+    getCouponInfo (id) {
+      couponToUpdate({ id: id }).then(res => {
+        if (res.status == 200) {
+          this.setVal(res.data)
+          this.takeCount = res.data.takeCount //  发放数量
+        }
+      })
+    },
+    // 表单赋值
+    setVal (data) {
+      const arr = [ 'title', 'couponType', 'quotaLimit', 'quota', 'ruleDesc', 'validType', 'isStoreLimit' ]
+      arr.map(k => { this.form[k] = data[k] })
+      if (data.couponType === 'FULLSUB') { //  满减券
+        this.form.limitAmount = data.limitAmount
+        this.form.subAmount = data.subAmount
+      } else if (data.couponType === 'VOUCHER') { //  代金券
+        this.form.subAmount = data.subAmount
+        this.isLimit = Number(data.limitAmount) > 0 ? '1' : '0'
+        this.form.limitAmount = data.limitAmount
+      }
+      // 持卡与非持卡会员
+      this.form.cardholderCouponLimit = { isLimit: data.cardholderCouponLimit.isLimit, limitCount: data.cardholderCouponLimit.limitCount, limitCondition: data.cardholderCouponLimit.limitCondition, userType: data.cardholderCouponLimit.userType }
+      this.form.normalCouponLimit = { isLimit: data.normalCouponLimit.isLimit, limitCount: data.normalCouponLimit.limitCount, limitCondition: data.normalCouponLimit.limitCondition, userType: data.normalCouponLimit.userType }
+      if (data.validType === 'ABSOLUTE') { //  绝对时效(时间区间)
+        this.form.timeRange = [moment(data.startTimeGmt8Ymd, 'YYYY-MM-DD'), moment(data.endTimeGmt8Ymd, 'YYYY-MM-DD')]
+        this.form.startTime = data.startTimeGmt8Ymd
+        this.form.endTime = data.endTimeGmt8Ymd
+      } else if (data.validType === 'RELATIVE') { //  RELATIVE相对时效(领取后多少天内有效)
+        this.form.validDate = data.validDate
+      }
+      this.form.couponScopeList = data.scopeValueList //  适用洗车类型
+      this.form.couponStoreList = data.couponStoreList //  适用洗车网点
+    },
+    // 获取适用洗车类型列表
+    getItemQuery () {
+      itemQuery({
+        pageNo: 1,
+        pageSize: 1000
+      }).then(res => {
+        if (res.status == 200) {
+          this.itemQueryList = res.data.list || []
+        } else {
+          this.itemQueryList = []
         }
+      })
+    },
+    //  select  change 关联数据清空处理
+    selectChange (type) {
+      if (type == 'couponType') { //  优惠券类型
+        this.form.subAmount = ''
+        this.form.limitAmount = ''
+        this.isLimit = '0' //  代金券  是否限额使用(0否,1是)
+      } else if (type === 'isLimitE') { //  是否限额使用
+        this.form.limitAmount = ''
+      } else if (type === 'quotaLimit') { //  发放总量
+        this.form.quota = ''
+      } else if (type === 'isLimitC') { //  持卡会员  是否限领
+        this.form.cardholderCouponLimit.limitCount = ''
+      } else if (type === 'isLimitN') { //  非持卡会员  是否限领
+        this.form.normalCouponLimit.limitCount = ''
+      } else if (type === 'validType') { //  有效期
+        this.form.timeRange = []
+        this.form.startTime = ''
+        this.form.endTime = ''
+        this.form.validDate = ''
+      } else if (type === 'isStoreLimit') { //  适用洗车网点
+        this.form.couponStoreList = []
+      }
+    },
+    // 重置表单数据
+    resetForm () {
+      const emptyArr = [ 'title', 'quota', 'limitAmount', 'subAmount', 'ruleDesc', 'startTime', 'endTime', 'validDate' ]
+      const zeroArr = [ 'quotaLimit', 'isOverlay', 'isStoreLimit' ]
+      const array = [ 'timeRange', 'couponScopeList', 'couponStoreList' ]
+      emptyArr.map(item => { this.form[item] = '' })
+      zeroArr.map(item => { this.form[item] = '0' })
+      array.map(item => { this.form[item] = [] })
+      this.form.couponType = 'VOUCHER'
+      this.form.cardholderCouponLimit = { isLimit: '0', limitCount: '', limitCondition: 'monthly', userType: 'cardholder' }
+      this.form.normalCouponLimit = { isLimit: '0', limitCount: '', limitCondition: 'monthly', userType: 'normal' }
+      this.form.validType = 'NONE'
+      this.form.scopeType = 'ITEM'
+      this.isLimit = '0'
+      this.takeCount = ''
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+      } else {
+        this.resetForm() //  重置表单数据
+        this.getItemQuery() //  获取适用洗车类型列表
+      }
+    },
+    couponId (newValue, oldValue) {
+      if (newValue && this.isShow) {
+        this.getCouponInfo(newValue)
       }
     }
   }
+}
 </script>
 
 <style lang="less">
-  .CouponModal{
-    .c-title{
-      padding: 0 0 10px;
-      margin-bottom: 20px;
-      border-bottom: 1px solid #e8e8e8;
-      .bold-divider{
-        width: 3px;
-        background-color: #1890ff;
-      }
-    }
-    .input-number-s{
-      width: 90%;
+.CouponModal {
+  .c-title {
+    padding: 0 0 10px;
+    margin-bottom: 20px;
+    border-bottom: 1px solid #e8e8e8;
+    .bold-divider {
+      width: 3px;
+      background-color: #1890ff;
     }
-    .unit{
-      display: inline-block;
-      width: 10%;
-      text-align: right;
+  }
+  .input-number-s {
+    width: 90%;
+  }
+  .input-number-ms{
+    width: 66%;
+    margin: 0 5px;
+  }
+  .input-number-ls{
+    width: 80%;
+    margin-right: 8px;
+  }
+  .input-number-mj{
+    width: 40%;
+  }
+  .unit {
+    display: inline-block;
+    width: 10%;
+    text-align: center;
+  }
+  .btn-cont {
+    text-align: center;
+    .resetForm {
+      margin-left: 10px;
     }
-    .btn-cont{
-      text-align: center;
-      .resetForm{
-        margin-left: 10px;
+  }
+  .default-form-item {
+    margin-bottom: 0;
+  }
+  .form-item-label {
+  	display: inline-block;
+  	cursor: pointer;
+  }
+  .form-item-required {
+    .ant-form-item-label {
+      label:before {
+        display: inline-block;
+        margin-right: 4px;
+        color: #f5222d;
+        font-size: 14px;
+        font-family: SimSun, sans-serif;
+        line-height: 1;
+        content: '*';
       }
     }
   }
+}
 </style>

+ 151 - 57
src/views/CouponCenter/ChooseOutlets.vue

@@ -1,81 +1,175 @@
 <template>
-  <a-modal class="CouponOutletsModal" title="选择网点" :width="600" :footer="null" :destroyOnClose="true" @cancel="modalIsShow=false" v-model="modalIsShow">
+  <a-modal
+    class="CouponOutletsModal"
+    title="选择网点"
+    :width="600"
+    :footer="null"
+    :destroyOnClose="true"
+    @cancel="modalIsShow = false"
+    v-model="modalIsShow">
+    <!-- 查询条件 -->
     <a-input-search placeholder="请输入网点名称" enter-button="查询" @search="onSearch" class="input-search" />
-    <a-checkbox-group @change="onChange" class="checkbox-group">
-      <a-checkbox value="A" class="checkbox-item">A</a-checkbox>
-      <a-checkbox value="B" class="checkbox-item">B</a-checkbox>
-      <a-checkbox value="C" class="checkbox-item">C</a-checkbox>
-      <a-checkbox value="D" class="checkbox-item">D</a-checkbox>
+    <!-- 全选 -->
+    <a-checkbox :checked="checkAll" @change="onCheckAllChange" class="checkAll">全选</a-checkbox>
+    <!-- 多选框 -->
+    <a-checkbox-group @change="onChange" v-model="checkedList" class="checkbox-group">
+      <a-checkbox v-for="(item, index) in outletsDataList" :key="index" :value="item.id" class="checkbox-item">
+        <p class="checkbox-name">{{ item.name }}</p>
+        <span :class="['checkbox-btn', checkedList.indexOf(item.id) !== -1 ? 'checked' : '']">{{ checkedList.indexOf(item.id) !== -1 ? '已选择' : '选择' }}</span>
+      </a-checkbox>
+      <p class="noData" v-show="outletsDataList.length == 0">暂无数据</p>
     </a-checkbox-group>
   </a-modal>
 </template>
 
 <script>
-  export default{
-    name: 'ChooseOutlets',
-    props: {
-      openOutletsModal: {  //  弹框是否展示
-        type: Boolean,
-        default: false
-      },
+import { storeQuery } from '@/api/car-wash'
+export default {
+  name: 'ChooseOutlets',
+  props: {
+    openOutletsModal: {
+      //  弹框是否展示
+      type: Boolean,
+      default: false
     },
-    data(){
-      return{
-        modalIsShow: this.openEquipmentModal,  //  弹框是否展示
-        checkedList: [],  //  选中的网点
-        outletsDataList: [  //  网点列表数据
-          { name: '网点1', value: '1' },
-          { name: '网点2', value: '2' },
-          { name: '网点3', value: '3' },
-          { name: '网点4', value: '4' },
-          { name: '网点5', value: '5' },
-          { name: '网点6', value: '6' },
-        ]
+    storeList: { //  已选网点
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      modalIsShow: this.openEquipmentModal, //  弹框是否展示
+      checkedList: [], //  选中的网点
+      outletsDataList: [], //  网点列表数据
+      checkAll: false //  是否全选
+    }
+  },
+  methods: {
+    //  查询
+    onSearch (value) {
+      if (value) {
+        this.getStoreQuery(value)
+      } else {
+        this.getStoreQuery()
       }
     },
-    methods: {
-      //  查询
-      onSearch(value) {
-        console.log(value)
-      },
-      //  多选框 change
-      onChange(e){
-        console.log(e)
-        this.checkedList = e
-      },
+    //  多选框 change
+    onChange (checkedList) {
+      this.checkAll = checkedList.length === this.outletsDataList.length
     },
-    watch: {
-      //  父页面传过来的弹框状态
-      openOutletsModal (newValue, oldValue) {
-        this.modalIsShow = newValue
-      },
-      //  重定义的弹框状态
-      modalIsShow (val){
-        if (!val){
-          this.$emit('close')
+    // 全选
+    onCheckAllChange (e) {
+      const allId = []
+      this.outletsDataList.map(item => {
+        allId.push(item.id)
+      })
+      Object.assign(this, {
+        checkedList: e.target.checked ? allId : [],
+        checkAll: e.target.checked
+      })
+    },
+    //  获取网点列表
+    getStoreQuery (val) {
+      storeQuery({
+        pageNo: 1,
+        pageSize: 1000,
+        name: val || ''
+      }).then(res => {
+        if (res.status == 200) {
+          this.outletsDataList = res.data.list
+          this.checkAll = this.checkedList.length === this.outletsDataList.length //  检查是否全选
+        } else {
+          this.outletsDataList = []
         }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openOutletsModal (newValue, oldValue) {
+      this.modalIsShow = newValue
+    },
+    //  重定义的弹框状态
+    modalIsShow (val) {
+      if (!val) {
+        this.$emit('close', this.checkedList)
+      } else {
+        this.getStoreQuery() //  获取网点列表
       }
+    },
+    storeList: {
+      handler (newValue, oldValue) {
+        this.checkedList = []
+        newValue.map(item => {
+          this.checkedList.push(item.storeId)
+        })
+      },
+      deep: true
     }
   }
+}
 </script>
 
 <style lang="less">
-  .CouponOutletsModal{
-    .input-search{
-      margin-bottom: 15px;
-    }
-    .checkbox-group{
+.CouponOutletsModal {
+  // 搜索
+  .input-search {
+    margin-bottom: 15px;
+  }
+  // 全选
+  .checkAll{
+    margin: 5px 0 20px;
+    border: 1px dashed #52c41a;
+    padding: 4px 10px 4px 15px;
+    border-radius: 6px;
+  }
+  // 多选
+  .checkbox-group {
+    display: block;
+    max-height: 400px;
+    overflow-y: scroll;
+    padding: 0 15px 15px;
+    border: 1px dashed #e4e4e4;
+    border-radius: 6px;
+    .checkbox-item {
       display: block;
-      .checkbox-item{
-        display: block;
-        margin: 15px 0 0;
-        padding: 10px 15px;
-        border: 1px solid rgb(228, 228, 228);
-        border-radius: 6px;
-        .ant-checkbox{
-          display: none;
+      margin: 15px 0 0;
+      padding: 10px 15px;
+      border: 1px solid rgb(228, 228, 228);
+      border-radius: 6px;
+      .ant-checkbox {
+        display: none;
+      }
+      span:nth-child(2) {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        padding: 0;
+        .checkbox-name {
+          margin: 0;
+        }
+        .checkbox-btn {
+          display: block;
+          font-size: 12px;
+          width: 70px;
+          text-align: center;
+          padding: 5px 15px;
+          border-radius: 28px;
+          background-color: #2db7f5;
+          color: #fff;
+        }
+        .checkbox-btn.checked {
+          background-color: #19be6b;
         }
       }
     }
   }
+  .noData{
+    text-align: center;
+    margin: 34px 0 20px;
+  }
+}
 </style>

+ 139 - 87
src/views/CouponCenter/CreateCoupons.vue

@@ -5,13 +5,11 @@
       <a-form layout="inline">
         <a-row :gutter="48">
           <a-col :span="6">
-            <a-form-item class="search-item" label="优惠券名称">
-              <a-input v-model.trim="queryParam.name" placeholder="请输入优惠券名称" allowClear/>
-            </a-form-item>
+            <a-form-item class="search-item" label="优惠券名称"><a-input v-model.trim="queryParam.title" placeholder="请输入优惠券名称" allowClear @pressEnter="$refs.table.refresh(true)" /></a-form-item>
           </a-col>
           <a-col :span="6">
             <a-form-item class="search-item" label="优惠券类型">
-              <v-select ref="yyzt" allowClear placeholder="请选择优惠券类型" v-model="queryParam.type" code="CHECK_ENABLE_STATE"></v-select>
+              <v-select ref="couponType" allowClear placeholder="请选择优惠券类型" v-model="queryParam.couponType" code="COUPON_TYPE"></v-select>
             </a-form-item>
           </a-col>
           <a-col :span="6">
@@ -22,110 +20,164 @@
       </a-form>
     </div>
     <!-- 新建 -->
-    <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="modalHandle('add')">新建</a-button>
-    </div>
+    <div class="table-operator"><a-button type="primary" icon="plus" @click="modalHandle('add')">新建</a-button></div>
     <!-- 表格列表 -->
-    <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" bordered >
+    <s-table
+      ref="table"
+      size="default"
+      rowKey="id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 类型 -->
+      <template slot="couponType" slot-scope="text, record">{{ $refs.couponType.getNameByCode(record.couponType) }}</template>
+      <!-- 状态 -->
+      <template slot="status" slot-scope="text, record">
+        <a-switch :defaultChecked="record.status == 1" checked-children="已启用" un-checked-children="已停用" @change="changeStatus(record, record.status == 0 ? 1 : record.status == 1 ? 0 : '')" />
+      </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-icon type="edit" title="编辑" :style="{ fontSize: '20px', color: '#1890FF', padding: '0 10px' }" />
-        <a-icon type="eye" title="查看详情" @click="openDetailsModal=true" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" />
-        <a-icon type="delete" title="删除" @click="del(record)" :style="{ fontSize: '20px', color: 'red', padding: '0 10px' }" />
+        <a-icon type="edit" v-if="record.status == 0" title="编辑" @click="modalHandle('edit', record)" :style="{ fontSize: '20px', color: '#1890FF', padding: '0 10px' }" />
+        <a-icon type="eye" title="查看详情" @click="modalHandle('details', record)" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" />
+        <a-icon type="delete" v-if="record.status == 0" title="删除" @click="del(record)" :style="{ fontSize: '20px', color: 'red', padding: '0 10px' }" />
       </template>
     </s-table>
-    
+
     <!-- 新增/编辑 优惠券 -->
-    <add-coupon-modal
-      :openModal="openModal"
-      :mtitle="mtitle"
-      @close="openModal=false"
-    />
-    
+    <add-coupon-modal :openModal="openModal" :pageType="pageType" :couponId="couponId" @close="closeModal" @success="couponSubmit" />
+    <!-- 查看详情 优惠券 -->
+    <details-coupon-modal :openModal="openDetailsModal" :couponId="couponId" @close="closeDetailsModal" />
   </a-card>
 </template>
 
 <script>
-  import { STable, VSelect } from '@/components'
-  import AddCouponModal from './AddCouponModal.vue'
-  export default{
-    name: 'CreateCoupons',
-    components: { STable, VSelect, AddCouponModal },
-    data(){
-      return{
-        queryParam: {
-          name: '',  //  优惠券名称
-          type: '',  //  优惠券类型
-        },
-        columns: [
-          { title: '序号', dataIndex: 'index', width: '100', align: 'center' },
-          { title: '创建时间', dataIndex: 'createDate', width: '100', align: 'center' },
-          { title: '优惠券名称', dataIndex: 'name', width: '100', align: 'center' },
-          { title: '到期时间', dataIndex: 'endDate', width: '100', align: 'center' },
-          { title: '类型', dataIndex: 'couponType', width: '100', align: 'center' },
-          { title: '状态', dataIndex: 'status', width: '100', align: 'center' },
-          { title: '操作', scopedSlots: {customRender: 'action'}, width: '200', align: 'center' }
-        ],
-        // 加载数据方法 必须为 Promise 对象
-        loadData: parameter => {
-          // return activeList(Object.assign(parameter, this.queryParam)).then(res => {
-          //   const no = (res.data.pageNo - 1) * res.data.pageSize
-          //   for (let i = 0; i < res.data.list.length; i++) {
-          //     const _item = res.data.list[i]
-          //     _item.no = no + i + 1
-          //     _item.releaseStatus = _item.releaseStatus + '' === 'FB'
-          //   }
-          //   return res.data
-          // })
-          // let data = [
-          //   { createDate: '2020-07-31 15:09', equipment: 'ID585787887', name: '网点A', addrProvince: '陕西省', addrCity: '西安市', addrDetail: '华帝金座', businessHours: '8:30 - 22:00', equipmentStatus: '在线', businessStatus: '正常营业', wechatCode: '' },
-          //   { createDate: '2020-07-31 15:09', equipment: 'ID585787887', name: '网点A', addrProvince: '陕西省', addrCity: '西安市', addrDetail: '华帝金座', businessHours: '8:30 - 22:00', equipmentStatus: '在线', businessStatus: '正常营业', wechatCode: '' },
-          //   { createDate: '2020-07-31 15:09', equipment: 'ID585787887', name: '网点A', addrProvince: '陕西省', addrCity: '西安市', addrDetail: '华帝金座', businessHours: '8:30 - 22:00', equipmentStatus: '在线', businessStatus: '正常营业', wechatCode: '' },
-          // ]
-          // return new Promise((resolve, reject) => {
-          //   resolve(data)
-          // }).catch(() => console.log('Oops errors!'))
-        },
-        openModal: false,  //  新增/编辑 优惠券  弹框展示状态
-        mtitle: '',  //  新增/编辑 优惠券  弹框标题
-        openDetailsModal: false,  //  查看详情 优惠券  弹框展示状态
-      }
-    },
-    methods: {
-      //  新建
-      modalHandle(type){
-        this.mtitle = type == 'add' ? '新增' : '编辑'
-        this.openModal = true
+import { STable, VSelect } from '@/components'
+import AddCouponModal from './AddCouponModal.vue'
+import DetailsCouponModal from './DetailsCouponModal.vue'
+import { couponQuery, couponEnableStatus, couponDel } from '@/api/coupons'
+export default {
+  name: 'CreateCoupons',
+  components: { STable, VSelect, AddCouponModal, DetailsCouponModal },
+  data () {
+    return {
+      queryParam: {
+        title: '', //  优惠券名称
+        couponType: '' //  优惠券类型
       },
-      // 删除
-      del(item){
-        console.log(item)
-        this.$confirm({
-          title: '提示',
-          content: '确定要删除吗?',
-          onOk () {
-            
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '100', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '100', align: 'center' },
+        { title: '优惠券名称', dataIndex: 'title', width: '100', align: 'center' },
+        { title: '到期时间', dataIndex: 'validDateStr', width: '100', align: 'center' },
+        { title: '类型', scopedSlots: { customRender: 'couponType' }, width: '100', align: 'center' },
+        { title: '状态', scopedSlots: { customRender: 'status' }, width: '100', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '200', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return couponQuery(Object.assign(parameter, this.queryParam)).then(res => {
+          const no = (res.data.pageNo - 1) * res.data.pageSize
+          for (let i = 0; i < res.data.list.length; i++) {
+            const _item = res.data.list[i]
+            _item.no = no + i + 1
           }
+          return res.data
         })
       },
-      //  重置
-      reset(){
-        this.queryParam = {
-          name: '',  //  优惠券名称
-          type: '',  //  优惠券类型
+      openModal: false, //  新增/编辑 优惠券  弹框展示状态
+      pageType: '', //  页面类型  add 新增/edit 编辑 优惠券
+      openDetailsModal: false, //  查看详情 优惠券  弹框展示状态
+      couponId: '' //  优惠券id
+    }
+  },
+  methods: {
+    //  新建
+    modalHandle (type, row) {
+      this.pageType = type
+      if (type === 'add') {
+        this.couponId = ''
+        this.openDetailsModal = false
+        this.openModal = true
+      } else if (type === 'edit') {
+        this.couponId = String(row.id)
+        this.openDetailsModal = false
+        this.openModal = true
+      } else if (type === 'details') {
+        this.couponId = String(row.id)
+        this.openModal = false
+        this.openDetailsModal = true
+      }
+    },
+    // 优惠券创建
+    couponSubmit () {
+      this.$refs.table.refresh(true)
+      this.openModal = false
+    },
+    // 新增、编辑 弹框关闭
+    closeModal () {
+      this.couponId = ''
+      this.openModal = false
+    },
+    // 详情 弹框关闭
+    closeDetailsModal () {
+      this.couponId = ''
+      this.openDetailsModal = false
+    },
+    //  删除
+    del (row) {
+      const _this = this
+      this.$confirm({
+        title: '数据删除后无法恢复, 确认删除吗?',
+        onOk: () => {
+          if (row.takeCount == 0) {
+            couponDel({ 'id': row.id }).then(res => {
+              if (res.status == 200) {
+                _this.$refs.table.refresh()
+                _this.$message.success(res.message)
+              } else {
+                _this.$message.error(res.message)
+              }
+            })
+          } else if (row.takeCount > 0) {
+            // 废除优惠卷
+            _this.changeStatus(row, -1)
+          }
+        },
+        onCancel: () => {
+          this.$message.info('取消删除')
+        }
+      })
+    },
+    // 启用停用
+    changeStatus (row, flag) {
+      couponEnableStatus({ id: row.id, flag: flag }).then(res => {
+        if (res.status + '' === '200') {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+        } else {
+          this.$message.error('修改失败, 请稍后再试')
+          row.status = !row.status
         }
-        this.$refs.table.refresh(true)
+      })
+    },
+    //  重置
+    reset () {
+      this.queryParam = {
+        title: '', //  优惠券名称
+        couponType: '' //  优惠券类型
       }
+      this.$refs.table.refresh(true)
     }
   }
+}
 </script>
 
 <style lang="less">
-  .CreateCoupons{
-    .table-page-search-wrapper{
-      .search-btn{
-        margin-right: 10px;
-      }
+.CreateCoupons {
+  .table-page-search-wrapper {
+    .search-btn {
+      margin-right: 10px;
     }
   }
+}
 </style>

+ 234 - 0
src/views/CouponCenter/DetailsCouponModal.vue

@@ -0,0 +1,234 @@
+<template>
+  <div class="DetailsCoupon">
+    <!-- 数据字典 -->
+    <v-select v-show="false" ref="couponType" placeholder="优惠券类型" code="COUPON_TYPE"></v-select>
+    <a-modal
+      class="DetailsCouponModal"
+      title="查看详情"
+      width="60%"
+      :footer="null"
+      :destroyOnClose="true"
+      @cancel="isShow=false"
+      v-model="isShow">
+      <a-row :gutter="20" v-if="couponInfo">
+        <a-col :span="24">
+          <div class="c-title frist-t">
+            基本信息
+            <a-divider type="vertical" class="bold-divider" />
+          </div>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">优惠券名称:</p>
+          <p class="item-main">{{ couponInfo.title }}</p>
+        </a-col>
+        <!-- 优惠券类型分为:FULLSUB 满减券、DISCOUNT 折扣券、VOUCHER 代金券和 SUB 实价券 -->
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">优惠券类型:</p>
+          <div class="item-main">
+            <strong>{{ couponInfo.couponTypeName }}</strong>
+            <p class="sub-con" v-if="couponInfo.couponType == 'FULLSUB'">
+              满<strong>{{ couponInfo.limitAmount }}</strong>减<strong>{{ couponInfo.subAmount }}</strong>
+            </p>
+          </div>
+        </a-col>
+        <a-col :span="12" class="item-cont" v-if="couponInfo.couponType == 'VOUCHER'">
+          <p class="item-label">优惠券面额:</p>
+          <p class="item-main"><strong>{{ couponInfo.subAmount }}</strong>元</p>
+        </a-col>
+        <a-col :span="12" class="item-cont" v-if="couponInfo.couponType == 'VOUCHER'">
+          <p class="item-label">是否限额使用:</p>
+          <p class="item-main">{{ couponInfo.limitAmount > 0 ? '是' : '否' }}</p>
+          <p class="item-main" v-if="couponInfo.limitAmount > 0">满<strong>{{ couponInfo.limitAmount }}</strong>元使用</p>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">发放总量:</p>
+          <p class="item-main" v-if="couponInfo.quotaLimit == '0'">不限</p>
+          <p class="item-main" v-if="couponInfo.quotaLimit == '1'"><strong>{{ couponInfo.quota }}</strong>份</p>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">优惠券说明:</p>
+          <div class="item-main">{{ couponInfo.ruleDesc }}</div>
+        </a-col>
+        <a-col :span="24">
+          <div class="c-title">
+            领用规则
+            <a-divider type="vertical" class="bold-divider" />
+          </div>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">持卡会员:</p>
+          <p class="item-main" v-if="couponInfo.cardholderCouponLimit.isLimit == '0'">不限</p>
+          <p class="item-main" v-if="couponInfo.cardholderCouponLimit.isLimit == '1'">
+            每<strong>{{ couponInfo.cardholderCouponLimit.limitCondition == 'monthly' ? '自然月' : '' }}</strong>限制领取
+            <strong>{{ couponInfo.cardholderCouponLimit.limitCount }}</strong>份
+          </p>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">未持卡会员:</p>
+          <p class="item-main" v-if="couponInfo.normalCouponLimit.isLimit == '0'">不限</p>
+          <p class="item-main" v-if="couponInfo.normalCouponLimit.isLimit == '1'">
+            每<strong>{{ couponInfo.normalCouponLimit.limitCondition == 'monthly' ? '自然月' : '' }}</strong>限制领取
+            <strong>{{ couponInfo.normalCouponLimit.limitCount }}</strong>份
+          </p>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">有效期:</p>
+          <!-- 有效期类型:ABSOLUTE绝对时效(时间区间)/RELATIVE相对时效(领取后多少天内有效)/NONE不限制 -->
+          <p class="item-main" v-if="couponInfo.validType == 'NONE'">不限</p>
+          <p class="item-main" v-if="couponInfo.validType == 'ABSOLUTE'">
+            <strong>{{ couponInfo.startTimeGmt8Ymd }}</strong> ~
+            <strong>{{ couponInfo.endTimeGmt8Ymd }}</strong>
+          </p>
+          <p class="item-main" v-if="couponInfo.validType == 'RELATIVE'">{{ couponInfo.validDateStr }}</p>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <p class="item-label">适用洗车类型:</p>
+          <p class="item-main">
+            <a-tag color="blue" v-for="(item, index) in couponInfo.couponScopeList" :key="index">{{ item.scopeName }}</a-tag>
+          </p>
+        </a-col>
+        <a-col :span="12" class="item-cont">
+          <div class="item-label">
+            <a-tooltip
+              placement="right"
+              arrow-point-at-center
+              title="已设置的适用洗车网点再次修改(尤其是减少使用网点)后,在【优惠券统计】中会保留原适用洗车网点的统计数据。"
+            >
+              <span style="display: inline-block;">适用洗车网点</span>
+              <a-icon :style="{ fontSize: '17px', color: '#1890ff', verticalAlign: 'sub', display: 'inlineBlock', margin: '0 3px' }" type="question-circle" />
+              <span style="display: inline-block;">:</span>
+            </a-tooltip>
+          </div>
+          <div class="item-main flex-sp">
+            <strong>{{ couponInfo.isStoreLimit == '1' ? '部分' : '全部' }}</strong>
+            <p v-if="couponInfo.isStoreLimit == '1'">
+              已选<strong>{{ couponInfo.couponStoreList.length }}</strong>个
+            </p>
+            <a-button type="primary" size="small" @click="openDetailsDraw = true" v-if="couponInfo.isStoreLimit == '1'">查看</a-button>
+          </div>
+        </a-col>
+        <a-col :span="24" class="btn-cont">
+          <a-button @click="isShow=false">返回列表</a-button>
+        </a-col>
+      </a-row>
+    </a-modal>
+
+    <!-- 查看详细 -->
+    <view-detailed
+      ref="viewDetailed"
+      :checkedList="couponInfo ? couponInfo.couponStoreList : []"
+      :openDetailsDraw="openDetailsDraw"
+      @close="openDetailsDraw = false">
+    </view-detailed>
+  </div>
+</template>
+
+<script>
+import { VSelect } from '@/components'
+import { couponFind } from '@/api/coupons'
+import ViewDetailed from './ViewDetailed.vue'
+export default {
+  name: 'DetailsCouponModal',
+  components: { VSelect, ViewDetailed },
+  props: {
+    openModal: { //  弹框是否展示
+      type: Boolean,
+      default: false
+    },
+    couponId: { //  优惠券id
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  弹框是否展示
+      labelList: [], //  网点标签
+      couponInfo: null, //  优惠券信息
+      serviceType: [], //  服务类型
+      storeItemPriceDTOList: [], //  时段价格
+      itemQueryList: [], //  服务类型  列表数据
+      openDetailsDraw: false //  查看  适用网店详情
+    }
+  },
+  methods: {
+    // 优惠券详情
+    getCouponInfo (id) {
+      couponFind({ id: id }).then(res => {
+        if (res.status == 200) {
+          this.couponInfo = res.data
+          this.couponInfo.couponTypeName = this.$refs.couponType.getNameByCode(res.data.couponType)
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+      }
+    },
+    couponId (newValue, oldValue) {
+      if (newValue && this.isShow) {
+        this.getCouponInfo(newValue)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .DetailsCouponModal{
+    p{
+      margin: 0;
+    }
+    .c-title {
+      padding: 0 0 10px;
+      margin-top: 40px;
+      margin-bottom: 20px;
+      border-bottom: 1px solid #e8e8e8;
+      .bold-divider {
+        width: 3px;
+        background-color: #1890ff;
+      }
+    }
+    .frist-t{
+      margin-top: 20px;
+    }
+    .item-cont{
+      margin-bottom: 24px;
+      display: flex;
+      align-items: center;
+      .item-label{
+        width: 121px;
+        font-size: 14px;
+        color: rgba(0, 0, 0, 0.85);
+        flex-shrink: 0;
+      }
+      .item-main{
+        flex-grow: 1;
+        .sub-con{
+          display: inline-block;
+          margin-left: 40px;
+        }
+        strong{
+          margin: 0 4px;
+        }
+      }
+      .flex-sp{
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+      }
+    }
+    .btn-cont{
+      text-align: center;
+      margin: 30px 0 25px;
+    }
+  }
+</style>

+ 112 - 0
src/views/CouponCenter/ViewDetailed.vue

@@ -0,0 +1,112 @@
+<template>
+  <a-modal
+    class="view-detailed-warp"
+    width="40%"
+    :footer="null"
+    :destroyOnClose="true"
+    @cancel="isShow=false"
+    v-model="isShow">
+    <template slot="title">
+      <div class="drawer-heder">适用洗车网点: 已选 <strong>{{ checkedList.length }}</strong> 个</div>
+    </template>
+    <div class="drawer-content">
+      <a-table
+        size="middle"
+        :columns="columns"
+        bordered
+        :scroll="{ y: 360 }"
+        rowKey="storeId"
+        :data-source="listData"
+        :pagination="false"
+        class="table-con">
+        <!-- 名称 -->
+        <template slot="storeName" slot-scope="text, record">
+          {{ record.storeName }}
+        </template>
+      </a-table>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+export default {
+  name: 'ViewDetailed',
+  props: {
+    checkedList: { // 已选择的项
+      type: Array,
+      default: function () {
+        return []
+      }
+    },
+    openDetailsDraw: { //  是否展示弹框
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      isShow: this.openDetailsDraw, //  弹框是否打开
+      listData: this.checkedList, //  表格数据
+      columns: [ //  表格表头
+        { title: '序号', dataIndex: 'no', width: '100', align: 'center' },
+        { title: '网点名称', scopedSlots: { customRender: 'storeName' }, align: 'center' }
+      ]
+    }
+  },
+  methods: {
+    // 关闭抽屉时触发
+    closeDraw () {
+      this.$emit('close')
+    }
+  },
+  watch: {
+    //  弹框展示隐藏
+    openDetailsDraw (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  组件内 弹框展示隐藏控制变量
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+      }
+    },
+    //  已选项数据列表
+    checkedList: {
+      handler (newValue, oldValue) {
+        // 加序号
+        newValue.map((item, index) => {
+          item.no = index + 1
+        })
+        this.listData = newValue
+      },
+      deep: true
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+.view-detailed-warp {
+	.ivu-modal-body {
+		height: 500px;
+		padding: 0;
+	}
+	.ivu-modal-footer {
+		padding: 0;
+		display: none;
+	}
+	.ivu-drawer-header,
+	.ivu-modal-header {
+		padding: 10px 16px;
+	}
+	.drawer-heder {
+		font-size: 14px;
+		font-weight: bold;
+	}
+	.drawer-content {
+		width: 90%;
+		padding: 20px 0 30px;
+		margin: 0 auto;
+	}
+}
+</style>

+ 287 - 0
src/views/CouponStatistics/CouponDetailModal.vue

@@ -0,0 +1,287 @@
+<template>
+  <a-modal
+    :title="modalTit"
+    width="70%"
+    :footer="null"
+    :destroyOnClose="true"
+    @cancel="close"
+    v-model="isShow">
+    <!-- 搜索条件 -->
+    <div class="CouponStatisticsDetail-searchForm">
+      <a-form ref="searchForm" labelAlign="left">
+        <a-row :gutter="48">
+          <a-col :span="6">
+            <a-form-item label="领券时间" :label-col="{ span:6 }" :wrapper-col="{ span:14 }">
+              <a-range-picker v-model="time" :format="dateFormat" :placeholder="['开始时间','结束时间']" @change="onChange" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item label="手机号码" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
+              <a-input v-model.trim="searchForm.ownerPhone" placeholder="请输入" allowClear :maxLength="11" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item label="用券网点" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
+              <a-input v-model.trim="searchForm.store.name" placeholder="请输入" allowClear/>
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+            <a-button type="" @click="resetForm">重置</a-button>
+          </a-col>
+          </a-col>
+        </a-row>
+        <a-row :gutter="48">
+          <a-col :span="6">
+            <a-form-item label="用券时间" :label-col="{ span:6 }" :wrapper-col="{ span:14 }">
+              <a-range-picker v-model="usedTime" :format="dateFormat" :placeholder="['开始时间','结束时间']" @change="onChangeUsedTime" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item label="使用状态" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
+              <v-select v-model="searchForm.status" placeholder="请选择" allowClear code="COUPON_VALID_STATUS"></v-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 列表 -->
+    <s-table
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 状态 -->
+      <span slot="status" slot-scope="text, record">
+        <template v-if="record.status == 0">{{ '未使用' }}</template>
+        <template v-if="record.status == 1">{{ '已使用' }}</template>
+        <template v-if="record.status == -1">{{ '已过期' }}</template>
+      </span>
+      <!-- 用券时间 -->
+      <span slot="usedTime" slot-scope="text, record">{{ record.usedTime || '-' }}</span>
+      <!-- 关联消费金额 -->
+      <span slot="consumAmount" slot-scope="text, record">{{ record.consumAmount || '-' }}</span>
+      <!-- 用券网点 -->
+      <span slot="store.name" slot-scope="text">
+        <template>{{ text }}</template>
+        <template v-if="!text">{{ '-' }}</template>
+      </span>
+    </s-table>
+  </a-modal>
+</template>
+
+<script>
+import {
+  STable,
+  VSelect
+} from '@/components'
+import getDate from '../../libs/getDate.js'
+import moment from 'moment'
+import { couponReceiveDetail } from '../../api/couponStatistics.js'
+export default {
+  name: 'CouponDetailModal',
+  components: { STable, VSelect },
+  props: {
+    openModal: { //  弹框是否展示
+      type: Boolean,
+      default: false
+    },
+    // 父页面传过来的当前查询优惠券的id
+    nowCouponId: {
+      type: Number,
+      default: null
+    },
+    // 父页面传过来的当前查询发券网点的id
+    nowStoreId: {
+      type: Number,
+      default: null
+    },
+    // 父页面传过来的当前查询优惠券的title
+    nowCouponTitle: {
+      type: String,
+      default: ''
+    },
+    // 父页面传过来的当前查询发券网点的name
+    nowStoreName: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal,
+      modalTit: '', // 弹窗标题
+      searchForm: {
+        store: {
+          name: ''
+        }, // 网点名称
+        beginDate: null, // 创建的开始时间
+        endDate: null, // 创建的结束时间
+        useCouponBeginTime: null, // 用券的开始时间
+        useCouponEndTime: null, // 用券的结束时间
+        couponId: '', // 当前优惠券id----查看详情
+        sourceNo: '', // 当前发券网点id----查看详情
+        ownerPhone: '', // 手机号码
+        status: '' // 使用状态
+      },
+      dateFormat: 'YYYY-MM-DD', // 日期格式
+      time: [
+        moment(getDate.getToday().starttime, this.dateFormat),
+        moment(getDate.getToday().endtime, this.dateFormat)
+      ],
+      usedTime: null,
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'no',
+          minWidth: '40',
+          align: 'center'
+        },
+        {
+          title: '领券时间',
+          dataIndex: 'receiveTime',
+          minWidth: '40',
+          align: 'center'
+        },
+        {
+          title: '领券手机号码',
+          dataIndex: 'ownerPhone',
+          minWidth: '40',
+          align: 'center'
+        },
+        {
+          title: '使用状态',
+          dataIndex: 'status',
+          minWidth: '40',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'status'
+          }
+        },
+        {
+          title: '用券网点',
+          dataIndex: 'store.name',
+          minWidth: '40',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'store.name'
+          }
+        },
+        {
+          title: '用券时间',
+          dataIndex: 'usedTime',
+          minWidth: '40',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'usedTime'
+          }
+        },
+        {
+          title: '关联消费金额',
+          dataIndex: 'consumAmount',
+          minWidth: '40',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'consumAmount'
+          }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.searchForm.beginDate == null ? this.searchForm.beginDate = getDate.getToday().starttime : null
+        this.searchForm.endDate == null ? this.searchForm.endDate = getDate.getToday().endtime : null
+        this.searchForm.couponId = this.nowCouponId
+        this.searchForm.sourceNo = this.nowStoreId
+        console.log(this.searchForm.couponId)
+        return couponReceiveDetail(Object.assign(parameter, this.searchForm)).then(res => {
+          console.log(res, '----------------')
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+            }
+            return res.data
+          }
+        })
+      }
+    }
+  },
+  methods: {
+    // 时间change
+    onChange (dates, dateStrings) {
+      if ((dates, dateStrings)) {
+        this.searchForm.beginDate = dateStrings[0]
+        this.searchForm.endDate = dateStrings[1]
+      }
+      // console.log(this.searchForm.beginDate, this.searchForm.endDate)
+    },
+    // 用券时间change
+    onChangeUsedTime (dates, dateStrings) {
+      if ((dates, dateStrings)) {
+        this.searchForm.useCouponBeginTime = dateStrings[0]
+        this.searchForm.useCouponEndTime = dateStrings[1]
+      }
+      // console.log(this.searchForm.useCouponBeginTime, this.searchForm.useCouponEndTime)
+    },
+    // 关闭弹窗事件
+    close () {
+      this.isShow = false
+      this.resetForm()
+    },
+    // 重置
+    resetForm () {
+      this.searchForm = {
+        store: {
+          name: ''
+        }, // 用券网点名称
+        beginDate: null, // 创建的开始时间
+        endDate: null, // 创建的结束时间
+        useCouponBeginTime: null, // 用券的开始时间
+        useCouponEndTime: null, // 用券的结束时间
+        couponId: '', // 当前优惠券id----查看详情
+        sourceNo: '', // 当前发券网点id----查看详情
+        ownerPhone: '', // 手机号码
+        status: '' // 使用状态
+      }
+      this.time = [
+        moment(getDate.getToday().starttime, this.dateFormat),
+        moment(getDate.getToday().endtime, this.dateFormat)
+      ]
+      this.usedTime = null
+      // this.$refs.searchForm.resetFields()
+      this.$refs.table.refresh(true)
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+      } else {
+        this.modalTit = this.nowStoreName + '【' + this.nowCouponTitle + '】领取详情'
+      }
+    }
+  }
+
+}
+</script>
+
+<style lang="less">
+  .ant-form-item{
+    margin-bottom: 10px;
+  }
+  .ant-divider-horizonta{
+    margin: 10px 0;
+  }
+  .coupon-detail-title{
+    margin-bottom: 20px;
+    margin-left: 20px;
+  }
+</style>

+ 0 - 146
src/views/CouponStatistics/CouponStatisticsDetail.vue

@@ -1,146 +0,0 @@
-<template>
-  <a-card :bordered="false">
-    <!-- 搜索条件 -->
-    <h3 class="coupon-detail-title" v-model="title">{{title}},领取详情</h3>
-    <a-divider />
-    <div class="CouponStatisticsDetail-searchForm">
-      <a-form ref="searchForm" labelAlign="left">
-        <a-row :gutter="48">
-          <a-col :span="6">
-            <a-form-item label="领券时间" :label-col="{ span:6 }" :wrapper-col="{ span:14 }">
-              <a-range-picker v-model="time" :format="dateFormat" :placeholder="['开始时间','结束时间']" @change="onChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item label="手机号码" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <a-input v-model.trim="searchForm.name" placeholder="请输入" allowClear/>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item label="领券网点" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <a-input v-model.trim="searchForm.name" placeholder="请输入" allowClear/>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="48">
-          <a-col :span="6">
-            <a-form-item label="用券时间" :label-col="{ span:6 }" :wrapper-col="{ span:14 }">
-              <a-range-picker v-model="time" :format="dateFormat" :placeholder="['开始时间','结束时间']" @change="onChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item label="使用状态" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <v-select v-model="searchForm.couponType" placeholder="请选择" allowClear></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item label="用券网点" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <a-input v-model.trim="searchForm.name" placeholder="请输入" allowClear/>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-            <a-button type="" @click="resetForm">重置</a-button>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 列表 -->
-    <s-table ref="table" size="default" :rowKey="(record) => record.id" :columns="columns" :data="loadData" bordered>
-      <!-- 状态 -->
-      <span slot="status" slot-scope="text, record">
-        <template></template>
-      </span>
-    </s-table>
-  </a-card>
-</template>
-
-<script>
-  import {
-    STable,
-    VSelect
-  } from '@/components'
-  export default{
-    components:{ STable,VSelect },
-    data(){
-      return{
-        searchForm:{
-          name:'',
-        },
-        title:"3元代金券",
-        columns: [{
-            title: '序号',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-        
-          {
-            title: '领券时间',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '领券手机号码',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '使用状态',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '用券网点',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '用券时间',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '关联消费金额',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          }
-        ],
-        // 加载数据方法 必须为 Promise 对象
-        loadData: parameter => {
-          // return getTenantsList(Object.assign(parameter, this.searchForm)).then(res => {
-          //   if (res.status == 200) {
-          //     const no = (res.data.pageNo - 1) * res.data.pageSize
-          //     for (let i = 0; i < res.data.list.length; i++) {
-          //       const _item = res.data.list[i]
-          //       _item.no = no + i + 1
-          //       _item.status = _item.status + '' === '1'
-          //     }
-          //     return res.data
-          //   }
-          // })
-        }
-      }
-    },
-    methods:{
-      // 重置
-      resetForm(){
-        this.$refs.searchForm.resetFields()
-        this.$refs.table.refresh(true)
-      }
-    }
-  }
-</script>
-
-<style lang="less">
-  .coupon-detail-title{
-    margin-bottom: 20px;
-    margin-left: 20px;
-  }
-</style>

+ 164 - 110
src/views/CouponStatistics/CouponStatisticsList.vue

@@ -6,152 +6,206 @@
         <a-row :gutter="48">
           <a-col :span="6">
             <a-form-item label="发券网点" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <a-input v-model.trim="searchForm.area" placeholder="请输入" allowClear/>
+              <a-input v-model.trim="searchForm.store.name" placeholder="请输入" allowClear />
             </a-form-item>
           </a-col>
           <a-col :span="6">
             <a-form-item label="优惠券名称" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <a-input v-model.trim="searchForm.name" placeholder="请输入" allowClear/>
-
+              <a-input v-model.trim="searchForm.couponTitle" placeholder="请输入" allowClear />
             </a-form-item>
           </a-col>
           <a-col :span="6">
             <a-form-item label="优惠券类型" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <v-select v-model="searchForm.couponType" placeholder="请选择" allowClear></v-select>
+              <v-select ref="couponType" v-model="searchForm.couponType" placeholder="请选择" code="COUPON_TYPE" allowClear></v-select>
             </a-form-item>
           </a-col>
           <a-col :span="6">
             <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-            <a-button type="" @click="resetForm">重置</a-button>
+            <a-button @click="resetForm">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
     <!-- 列表 -->
-    <s-table ref="table" size="default" :rowKey="(record) => record.id" :columns="columns" :data="loadData" bordered>
-      <!-- 状态 -->
-      <span slot="status" slot-scope="text, record">
-        <template></template>
+    <s-table
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 转化率 -->
+      <span slot="conversionRate" slot-scope="text,record">
+        <template v-if="record.conversionRate > 0">{{ ((record.conversionRate)*100).toFixed(2) }}%</template>
+        <template v-if="record.conversionRate == 0">{{ record.conversionRate }}</template>
+        <template v-else-if="!record.conversionRate">{{ '-' }}</template>
       </span>
+      <!-- 优惠券类型 -->
+      <span slot="couponType" slot-scope="text">{{ $refs.couponType.getNameByCode(text) }}</span>
+      <span slot="takeCount" slot-scope="text,record">{{ record.takeCount || '-' }}</span>
+      <span slot="totalUsedCount" slot-scope="text,record">{{ record.totalUsedCount || '-' }}</span>
+      <span slot="consumAmount" slot-scope="text,record">{{ record.consumAmount || '-' }}</span>
       <!-- 操作 -->
       <span slot="action" slot-scope="text, record">
-        <template>
-          <a-icon type="eye" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="handleEdit(record)" />
-        </template>
+        <a-icon type="eye" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="handleEdit(record)" />
       </span>
     </s-table>
+    <!-- 查看详情弹窗 -->
+    <coupon-detail-modal
+      :openModal="openDetailModal"
+      :nowCouponId="couponId"
+      :nowStoreId="sourceNo"
+      :nowCouponTitle="title"
+      :nowStoreName="storeName"
+      @close="openDetailModal=false" />
   </a-card>
 </template>
 
 <script>
-  import {
+import {
+  STable,
+  VSelect
+} from '@/components'
+import { couponStatisticsList } from '../../api/couponStatistics.js'
+import CouponDetailModal from './CouponDetailModal.vue'
+export default {
+  name: 'CouponStatisticsList',
+  components: {
     STable,
-    VSelect
-  } from '@/components'
-  export default {
-    components: {
-      STable,
-      VSelect
-    },
-    data() {
-      return {
-        searchForm: {
-          name: '',      // 优惠券名称
-          area: '',      // 网点名称
-          couponType:''  // 优惠券类型
+    VSelect,
+    CouponDetailModal
+  },
+  data () {
+    return {
+      searchForm: {
+        couponTitle: '', // 优惠券名称
+        store: {
+          name: ''
+        }, // 网点名称
+        couponType: '' // 优惠券类型
+      },
+      openDetailModal: false, // 查看详情弹窗 默认关闭
+      couponId: null, // 查看详情--当前优惠券id
+      sourceNo: null, // 查看详情--当前发券网点id
+      title: '', // 查看详情--当前优惠券title
+      storeName: '', // 查看详情--当前发券网点name
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'no',
+          minWidth: '40',
+          align: 'center'
+        },
+        {
+          title: '发券网点',
+          dataIndex: 'store.name',
+          minWidth: '100',
+          align: 'center'
         },
-        columns: [{
-            title: '序号',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
+        {
+          title: '优惠券名称',
+          dataIndex: 'couponTitle',
+          minWidth: '100',
+          align: 'center'
 
-          {
-            title: '发券网点',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '优惠券名称',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '优惠券类型',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '已发数量',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '使用数量',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '关联消费金额',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '转化率',
-            dataIndex: 'no',
-            minWidth: '40',
-            align: 'center'
-          },
-          {
-            title: '状态',
-            dataIndex: 'status',
-            minWidth: '40',
-            align: 'center',
-            scopedSlots: {
-              customRender: 'status'
-            }
-          },
-          {
-            title: '操作',
-            dataIndex: 'action',
-            minWidth: '40',
-            align: 'center',
-            scopedSlots: {
-              customRender: 'action'
-            }
+        },
+        {
+          title: '优惠券类型',
+          dataIndex: 'couponType',
+          minWidth: '100',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'couponType'
+          }
+        },
+        {
+          title: '已发数量',
+          dataIndex: 'takeCount',
+          minWidth: '100',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'takeCount'
+          }
+        },
+        {
+          title: '使用数量',
+          dataIndex: 'totalUsedCount',
+          minWidth: '100',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'totalUsedCount'
+          }
+        },
+        {
+          title: '关联消费金额',
+          dataIndex: 'consumAmount',
+          minWidth: '100',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'consumAmount'
+          }
+        },
+        {
+          title: '转化率',
+          dataIndex: 'conversionRate',
+          minWidth: '100',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'conversionRate'
+          }
+        },
+        {
+          title: '操作',
+          dataIndex: 'action',
+          minWidth: '100',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'action'
           }
-        ],
-        // 加载数据方法 必须为 Promise 对象
-        loadData: parameter => {
-          // return getTenantsList(Object.assign(parameter, this.searchForm)).then(res => {
-          //   if (res.status == 200) {
-          //     const no = (res.data.pageNo - 1) * res.data.pageSize
-          //     for (let i = 0; i < res.data.list.length; i++) {
-          //       const _item = res.data.list[i]
-          //       _item.no = no + i + 1
-          //       _item.status = _item.status + '' === '1'
-          //     }
-          //     return res.data
-          //   }
-          // })
         }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return couponStatisticsList(Object.assign(parameter, this.searchForm)).then(res => {
+          console.log(res, '-------')
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+            // _item.status = _item.status + '' === '1'
+            }
+            return res.data
+          }
+        })
       }
+    }
+  },
+  methods: {
+    // 点击查看详情
+    handleEdit (record) {
+      console.log(record)
+      this.couponId = record.couponId
+      this.sourceNo = record.storeId
+      this.title = record.couponTitle
+      this.storeName = record.store.name
+      this.openDetailModal = true
+      console.log(this.title)
     },
-    methods: {
-      // 重置
-      resetForm() {
-        this.$refs.searchForm.resetFields()
-        this.$refs.table.refresh(true)
+    // 重置
+    resetForm () {
+      this.searchForm = {
+        couponTitle: '', // 优惠券名称
+        store: {
+          name: ''
+        }, // 网点名称
+        couponType: '' // 优惠券类型
       }
+      // this.$refs.searchForm.resetFields()
+      this.$refs.table.refresh(true)
     }
   }
+}
 </script>
 
 <style>

+ 1 - 1
src/views/Home.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="home">
-    <a-alert message="欢迎登录洗车机运营后台系统" type="info" showIcon />
+    <a-alert message="欢迎登录智慧快洗卡卷管理中心系统" type="info" showIcon />
   </div>
 </template>
 

+ 0 - 206
src/views/RefundRecord/RefundRecord.vue

@@ -1,206 +0,0 @@
-<template>
-  <a-card :bordered="false">
-    <!-- 搜索条件 -->
-    <div class="orderCenter-searchForm">
-      <a-form ref="searchForm">
-        <a-row :gutter="48">
-          <a-col :span="8">
-            <a-form-item label="创建时间" :label-col="{ span:4 }" :wrapper-col="{ span:12}">
-              <a-range-picker v-model="time" :format="dateFormat" :placeholder="['开始时间','结束时间']" @change="onChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item label="关联订单号" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <a-input v-model.trim="searchForm.num" placeholder="请输入" allowClear  />
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item label="网点名称" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <v-select v-model="searchForm.name" placeholder="请选择" allowClear ></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="4">
-            <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-            <a-button type="" @click="resetForm">重置</a-button>
-          </a-col>
-        </a-row>
-        <a-row :gutter="48">
-          <a-col :span="8">
-            <a-form-item label="服务项目" :label-col="{ span:4 }" :wrapper-col="{ span:12}">
-              <v-select v-model="searchForm.fwname" placeholder="请选择" allowClear></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="6">
-            <a-form-item label="退款状态" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <v-select v-model="searchForm.status" placeholder="请选择" allowClear ></v-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 合计 -->
-    <div class="total">
-      <a-icon type="info-circle" class="iconImg"/>
-      <strong>合计:</strong><span v-model="countHJ">{{countHJ}} 单</span><strong style="margin-left: 15px;">实收:</strong><span v-model="incomeHJ">{{incomeHJ}} 元</span>
-    </div>
-    <!-- 列表 -->
-    <s-table ref="table" size="default" :rowKey="(record) => record.id" :columns="columns" :data="loadData" bordered>
-      <!-- 退款状态 -->
-      <span slot="status" slot-scope="text, record">
-        <template></template>
-      </span>
-    </s-table>
-  </a-card>
-</template>
-
-<script>
-  import { STable, VSelect } from '@/components'
-  import getDate from '../../libs/getDate.js'
-  import moment from 'moment'
-  export default {
-    components: {
-      STable,
-      VSelect
-    },
-    data() {
-      return {
-        // 查询参数
-        searchForm: {
-          beginDate: null,  // 创建的开始时间
-          endDate: null,    // 创建的结束时间
-          name: '',         // 网点名称
-          num: '',          // 单号
-          fwname:'',        // 服务项目
-          status:''         // 状态
-        },
-        time: [
-          moment(getDate.getToday().starttime, this.dateFormat),
-          moment(getDate.getToday().endtime, this.dateFormat)
-        ],
-        dateFormat: 'YYYY-MM-DD',
-        countHJ:'40',
-        incomeHJ:'2000',
-        columns: [{
-            title: '创建时间',
-            dataIndex: 'createTime',
-            minWidth: '100',
-            align: 'center'
-
-          },
-          {
-            title: '交易流水号',
-            dataIndex: 'createTime',
-            minWidth: '100',
-            align: 'center'
-
-          },
-          {
-            title: '关联订单号',
-            dataIndex: 'createTime',
-            width: '100',
-            align: 'center'
-
-          },
-          {
-            title: '网点名称',
-            dataIndex: 'createTime',
-            minWidth: '100',
-            align: 'center'
-
-          },
-          {
-            title: '退款项目',
-            dataIndex: 'createTime',
-            minWidth: '100',
-            align: 'center'
-
-          },
-          {
-            title: '退款金额(¥)',
-            dataIndex: 'createTime',
-            minWidth: '40',
-            align: 'center'
-
-          },
-          {
-            title: '退款人',
-            dataIndex: 'createTime',
-            minWidth: '100',
-            align: 'center'
-
-          },
-          {
-            title: '退款状态',
-            dataIndex: 'createTime',
-            minWidth: '100',
-            align: 'center',
-            scopedSlots: {
-              customRender: 'status'
-            }
-          },
-          {
-            title: '备注',
-            dataIndex: 'status',
-            minWidth: '100',
-            align: 'center',
-          },
-        ],
-        // 加载数据方法 必须为 Promise 对象
-        loadData: parameter => {
-          // this.searchData.beginDate == null ? this.searchData.beginDate = getDate.getToday().starttime : null
-          // this.searchData.endDate == null ? this.searchData.endDate = getDate.getToday().endtime : null
-          // return getTenantsList(Object.assign(parameter, this.searchForm)).then(res => {
-          //   if (res.status == 200) {
-          //     const no = (res.data.pageNo - 1) * res.data.pageSize
-          //     for (let i = 0; i < res.data.list.length; i++) {
-          //       const _item = res.data.list[i]
-          //       _item.no = no + i + 1
-          //       _item.status = _item.status + '' === '1'
-          //     }
-          //     return res.data
-          //   }
-          // })
-        }
-      }
-    },
-    methods: {
-      // 创建时间change
-      onChange(dates, dateStrings) {
-        if ((dates, dateStrings)) {
-          this.searchForm.beginDate = dateStrings[0]
-          this.searchForm.endDate = dateStrings[1]
-        }
-        console.log(this.searchForm.beginDate, this.searchForm.endDate)
-      },
-      // 重置
-      resetForm() {
-        this.$refs.searchForm.resetFields()
-        this.$refs.table.refresh(true)
-      },
-    },
-  }
-</script>
-
-<style lang="less">
-  .orderCenter-searchForm,
-  .addButton {
-    margin-bottom: 0;
-  }
-
-  .orderCenter-searchForm .ant-form-inline .ant-form-item {
-    margin-bottom: 15px;
-  }
-
-  .total {
-    margin-bottom: 24px;
-    width:100%;
-    background-color: #e6f7ff;
-    border: 1px solid #91d5ff;
-    padding: 8px 15px 8px 27px;
-    border-radius: 4px;
-    .iconImg{
-      color: #1890FF;
-      margin-right: 10px;
-    }
-  }
-</style>

+ 0 - 453
src/views/bnSetting/menu/adminMenus.vue

@@ -1,453 +0,0 @@
-<template>
-  <a-card :bordered="false">
-    <a-row :gutter="24">
-      <a-button style="margin-right: 10px;" type="primary" icon="plus" @click="addChild">添加子菜单</a-button>
-      <a-button style="margin-right: 10px;background-color: #19be6b;color: #fff;" type="" icon="plus" @click="addTitle">添加顶部菜单</a-button>
-      <a-button style="margin-right: 10px;background-color: red;color: #fff;" type="" icon="delete" @click="delect()">删除</a-button>
-
-    </a-row>
-    <a-row :gutter="24">
-      <!-- 左侧菜单树列表 -->
-      <a-col :span="8">
-        <a-row :gutter="24" class="textCount">
-          <a-icon type="info-circle" style="color: #1890FF;margin-right: 10px;" />
-          <span>当前选择:<span style="color: #40a9ff;font-weight: 600;">{{ selectedMenu }}</span><span v-if="selectedKeys.length" class="imgSize" @click="cancelSel">取消选择</span></span>
-        </a-row>
-
-        <a-row :gutter="24" >
-          <a-input-search placeholder="输入搜索菜单名搜索" style="width: 100%" @change="onChange" />
-          <a-tree
-            @expand="onExpand"
-            :treeData="getMenus"
-            :expandedKeys="expandedKeys"
-            :autoExpandParent="autoExpandParent"
-            @select="onSelect"
-            :selectedKeys="selectedKeys"
-            showIcon
-          >
-            <template slot="title" slot-scope="{title}">
-              <span v-if="title.indexOf(searchValue) > -1">
-                {{ title.substr(0, title.indexOf(searchValue)) }}
-                <span style="color: #f50">{{ searchValue }}</span>
-                {{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
-              </span>
-              <span v-else>{{ title }}</span>
-            </template>
-            <a-icon slot="file" type="file" />
-            <a-icon slot="pushpin" type="pushpin" />
-          </a-tree>
-        </a-row>
-      </a-col>
-      <!-- 右侧 -->
-      <a-col :span="16" >
-        <a-form :form="form" @submit="handleSubmit">
-          <!-- 类型 -->
-          <a-form-item label="类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <div v-if="!formData.type||formData.type=='0'">
-              <a-icon type="file" style="margin-right: 10px;" /><span >页面菜单</span>
-            </div>
-            <div v-if="formData.type=='1'">
-              <a-icon type="pushpin" style="margin-right: 10px;" /><span >操作按钮</span>
-            </div>
-          </a-form-item>
-
-          <!-- 名称 -->
-          <a-form-item label="名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入名称"
-              v-decorator="['formData.name', {
-                initialValue: formData.name,
-                rules: [{ required: true, message: '请输入名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-            />
-          </a-form-item>
-          <!-- 路由英文名 -->
-          <!-- <a-form-item v-if="!formData.type||formData.type=='0'" label="路由英文名" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入路由英文名"
-              v-decorator="['formData.routeName', {
-                initialValue: formData.routeName,
-                rules: [{ required: true, message: '请输入路由英文名!' }] }]"
-            />
-          </a-form-item> -->
-          <!-- 路径 -->
-          <!-- <a-form-item v-if="!formData.type||formData.type=='0'" label="路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入路径"
-              v-decorator="['formData.routePath', {
-                initialValue: formData.routePath,
-                rules: [{ required: true, message: '请输入路径!' }] }]"
-            />
-          </a-form-item> -->
-          <!-- 请求路径 -->
-          <!-- <a-form-item v-if="formData.type==1" label="请求路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入请求路径"
-              v-decorator="['formData.urlPath', {
-                initialValue: formData.urlPath,
-                rules: [{ required: true, message: '请输入请求路径!' }] }]"
-            />
-          </a-form-item> -->
-          <!-- 前端权限编码 -->
-          <a-form-item label="前端权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入前端权限编码"
-              v-decorator="[
-                'formData.code',
-                {
-                  initialValue: formData.code,
-                  rules: [{ required: true, message: '请输入前端权限编码!' }] },
-              ]"
-            />
-          </a-form-item>
-          <!-- 后台权限编码 -->
-          <a-form-item label="后台权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入后台权限编码"
-              v-decorator="[
-                'formData.permission',
-                {
-                  initialValue: formData.permission,
-                  rules: [{ required: formData.isLeaf, message: '请输入后台权限编码!' }] },
-              ]"
-            />
-          </a-form-item>
-          <!-- 图标 -->
-          <!-- <a-form-item v-if="!formData.type ||formData.type=='0' " label="图标" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入图标名称"
-              v-decorator="['formData.icon', {
-                initialValue: formData.icon,
-                rules: [] }]"
-            />
-          </a-form-item> -->
-          <!-- 前端组件 -->
-          <!-- <a-form-item v-if="!formData.type ||formData.type=='0'" label="前端组件" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入前端组件路径"
-              v-decorator="['formData.componentPath', {
-                initialValue: formData.componentPath,
-                rules: [{ required: true, message: '请输入前端组件路径!' }] }]"
-            />
-          </a-form-item> -->
-
-          <!-- 第三方链接 -->
-          <!-- <a-form-item v-if="!formData.type ||formData.type=='0'" label="第三方链接" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入第三方链接地址"
-              v-decorator="['formData.urlPath', {
-                initialValue: formData.urlPath,
-                rules: [] }]"
-            />
-          </a-form-item> -->
-
-          <!-- 排序值 -->
-          <a-form-item label="排序值" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              type="number"
-              placeholder="请输入排序值"
-              v-decorator="['formData.sort', {
-                initialValue: formData.sort,
-                rules: [] }]"
-            />
-          </a-form-item>
-          <!-- 状态 -->
-          <a-form-item label="启用" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-radio-group
-              name="radioGroup"
-              v-decorator="[
-                'formData.status',
-                {
-                  initialValue: formData.status,
-                  rules: [{ required: true, message: '请选择状态!' }] },
-              ]"
-            >
-              <a-radio :value="1">是</a-radio>
-              <a-radio :value="0">否</a-radio>
-            </a-radio-group>
-          </a-form-item>
-
-          <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-            <a-button type="primary" @click="handleSubmit()">
-              保存
-            </a-button>
-            <a-button :style="{ marginLeft: '8px' }" @click="clear">
-              重置
-            </a-button>
-          </a-form-item>
-        </a-form>
-
-      </a-col>
-    </a-row>
-    <childModal parentType="admin" :visible="showChildModal" @refresh="getYyMenuList" :data="parentData" @close="showChildModal = false"></childModal>
-  </a-card>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import childModal from './childModal.vue'
-import { getYyMenuList, saveYyMenu, deleteYyMenu } from '@/api/menu.js'
-
-export default {
-  name: 'Menu',
-  components: {
-    STable, VSelect, childModal
-  },
-  props: {},
-  data () {
-    return {
-      treeData: [],
-      dataList: [],
-      searchValue: '',
-      expandedKeys: [],
-      autoExpandParent: true,
-      selectedKeys: [],
-      selectedMenu: '', // 选择的树节点名
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'menu' }),
-      showChildModal: false,
-      parentData: {}, // 父级菜单
-      formData: {
-        id: '',
-        name: '',
-        routePath: '',
-        icon: '',
-        routeName: '',
-        componentPath: '',
-        urlPath: '',
-        code: '',
-        permission: '',
-        sort: '',
-        type: '0',
-        isLeaf: true,
-        status: '' // 活动状态
-      }
-    }
-  },
-  computed: {
-    getMenus () {
-      this.generateList(this.treeData)
-      return this.treeData
-    }
-  },
-  methods: {
-    onExpand (expandedKeys) {
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
-
-    onSelect (selectedKeys, info) {
-      this.selectedKeys = selectedKeys
-      if (info.selected) {
-        const data = info.selectedNodes[0].data.props
-        const isLeaf = data.dataRef.children
-        this.formData = {
-          id: data.id,
-          name: data.name,
-          routePath: data.routePath,
-          icon: data.icon,
-          routeName: data.routeName,
-          componentPath: data.componentPath,
-          urlPath: data.urlPath,
-          code: data.code,
-          permission: data.permission,
-          sort: data.sort,
-          type: data.type,
-          status: data.status,
-          isLeaf: !(isLeaf && isLeaf.length)
-        }
-        this.selectedMenu = this.formData.name
-        this.formData.status = Number(this.formData.status)
-      } else {
-        this.selectedMenu = ''
-        this.clear()
-      }
-    },
-    generateList (data) {
-      for (let i = 0; i < data.length; i++) {
-        const node = data[i]
-        const key = node.title
-        this.dataList.push({ key, title: key })
-        node.scopedSlots = { title: 'title' }
-        node.slots = { icon: node.type == '0' ? 'file' : 'pushpin' }
-
-        if (node.children) {
-          this.generateList(node.children)
-        }
-      }
-    },
-    getParentKey (key, tree) {
-      let parentKey
-      for (let i = 0; i < tree.length; i++) {
-        const node = tree[i]
-        if (node.children) {
-          if (node.children.some(item => item.title == key)) {
-            parentKey = node.key
-          } else if (this.getParentKey(key, node.children)) {
-            parentKey = this.getParentKey(key, node.children)
-          }
-        }
-      }
-      return parentKey
-    },
-    onChange (e) {
-      const value = e.target.value
-      const expandedKeys = this.dataList
-        .map(item => {
-          if (item.title.indexOf(value) > -1) {
-            return this.getParentKey(item.title, this.treeData)
-          }
-          return null
-        })
-        .filter((item, i, self) => item && self.indexOf(item) === i)
-      Object.assign(this, {
-        expandedKeys,
-        searchValue: value,
-        autoExpandParent: true
-      })
-    },
-    // 获取菜单树列表
-    getYyMenuList () {
-      getYyMenuList().then(res => {
-        console.log(res, 'res1111111')
-        if (res.status == 200) {
-          this.treeData = res.data
-          console.log(this.treeData, 'this.treeData')
-        }
-      })
-    },
-    // 添加子节点
-    addChild () {
-      if (!this.selectedMenu) {
-        return this.$message.warning('请先选择一个父级菜单')
-      } else if (this.formData.type == '1') {
-        return this.$message.warning('请选择一个页面级菜单')
-      }
-      this.showChildModal = true
-      this.parentData = this.formData
-    },
-    // 添加顶部菜单
-    addTitle () {
-      this.showChildModal = true
-      this.parentData = {}
-    },
-
-    //  取消选择
-    cancelSel () {
-      this.selectedKeys = []
-      this.selectedMenu = ''
-      this.clear()
-    },
-    // 清空列表
-    clear () {
-      this.form.resetFields()
-      this.formData.id = ''
-      this.formData.name = ''
-      this.formData.routePath = ''
-      this.formData.icon = ''
-      this.formData.routeName = ''
-      this.formData.componentPath = ''
-      this.formData.urlPath = ''
-      this.formData.sort = ''
-      this.formData.type = ''
-      this.formData.status = ''
-      this.formData.code = ''
-      this.formData.permission = ''
-      this.formData.isLeaf = true
-    },
-
-    // 删除数据
-    delect () {
-      if (!this.selectedKeys.length) {
-        return this.$message.warning('您还未选择要删除的数据')
-      }
-      const _this = this
-      console.log(_this.formData.id, '_this.formData.id')
-      this.$confirm({
-        title: '警告',
-        content: `确定要删除您选择的 ${_this.formData.name} 的数据吗?`,
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          deleteYyMenu({
-            id: _this.formData.id
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success('删除成功')
-              _this.getYyMenuList()
-            }
-          }).catch(() => {
-            _this.$message.success('删除失败, 请稍后重试')
-          })
-        }
-      })
-    },
-
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          console.log(values.formData, ' formData.type222222222')
-          saveYyMenu(Object.assign({ id: this.formData.id }, values.formData)).then(res => {
-            console.log(res, 'res--save')
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
-              _this.getYyMenuList()
-              _this.clear()
-            } else {
-              // this.$message.warning(res.message)
-            }
-          })
-        }
-      })
-    },
-    handleCancel () {
-      this.clear()
-    }
-
-  },
-  mounted () {
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'menu' })
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      vm.getYyMenuList()
-    })
-  },
-  watch: {
-
-  }
-}
-</script>
-
-<style>
-  .menu-box::-webkit-scrollbar{
-    width: 6px;
-    height: 6px ;
-  }
-
-  .menu-box::-webkit-scrollbar-thumb{
-    width: 6px;
-    height: 6px ;
-    border-radius: 4px;
-    -webkit-box-shadow: inset 0 0 2px #d1d1d1;
-    background: #e4e4e4;
-  }
-
-  .textCount{
-    border: 1px solid #91d5ff;
-    background-color: #e6f7ff;
-    border-radius: 5px;
-    padding: 5px 10px 5px 20px;
-    margin: 10px 0;
-    color: rgba(0, 0, 0, 0.85);
-  }
-  .imgSize{
-    color: #2d8cf0;
-    margin-left: 10px;
-    font-size: 14px;
-  }
-
-</style>

+ 0 - 340
src/views/bnSetting/menu/childModal.vue

@@ -1,340 +0,0 @@
-<template>
-  <div>
-    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel">
-      <a-form :form="form" @submit="handleSubmit">
-        <!-- 上级菜单 -->
-        <a-form-item label="上级菜单" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <div >
-            <span >{{ parentTitle }}</span>
-          </div>
-
-        </a-form-item>
-        <!-- 类型 -->
-        <a-form-item label="类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-select
-            @change="selectChange"
-            :disabled="disabled"
-            v-decorator="[
-              'formData.type',
-              {
-                initialValue: formData.type,
-                rules: [{ required: true, message: '请选择状态!' }] },
-            ]"
-            style="width: 100%"
-            placeholder="请选择菜单类型"
-          >
-            <a-select-option :value="0">页面类型</a-select-option>
-            <a-select-option :value="1">按钮类型</a-select-option>
-          </a-select>
-        </a-form-item>
-
-        <!-- 名称 -->
-        <a-form-item label="名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入名称"
-            v-decorator="['formData.name', {
-              initialValue: formData.name,
-              rules: [{ required: true, message: '请输入名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-          />
-        </a-form-item>
-        <!-- 路由英文名 -->
-        <!-- <a-form-item v-if="!formData.type" label="路由英文名" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入路由英文名"
-            v-decorator="['formData.routeName', {
-              initialValue: formData.routeName,
-              rules: [{ required: true, message: '请输入路由英文名!' }] }]"
-          />
-        </a-form-item> -->
-        <!-- 路径 -->
-        <!-- <a-form-item v-if="!formData.type" label="路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-             <a-input placeholder="请输入路径"
-                      v-decorator="['formData.routePath', {
-                        initialValue: formData.routePath,
-                        rules: [{ required: true, message: '请输入路径!' }] }]"
-             />
-           </a-form-item> -->
-        <!-- 请求路径 -->
-        <!-- <a-form-item v-if="formData.type==1" label="请求路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-             <a-input placeholder="请输入请求路径"
-                      v-decorator="['formData.urlPath', {
-                        initialValue: formData.urlPath,
-                        rules: [{ required: true, message: '请输入请求路径!' }] }]"
-             />
-           </a-form-item> -->
-        <!-- 前端权限编码 -->
-        <a-form-item label="前端权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入前端权限编码"
-            v-decorator="[
-              'formData.code',
-              {
-                initialValue: formData.code,
-                rules: [{ required: true, message: '请输入前端权限编码!' }] },
-            ]"
-          />
-
-        </a-form-item>
-        <!-- 后台权限编码 -->
-        <a-form-item label="后台权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入后台权限编码"
-            v-decorator="[
-              'formData.permission',
-              {initialValue: formData.permission},
-            ]"
-          />
-
-        </a-form-item>
-
-        <!-- 图标 -->
-        <!-- <a-form-item v-if="!formData.type" label="图标" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入图标名称"
-            v-decorator="['formData.icon', {
-              initialValue: formData.icon,
-              rules: [] }]"
-          />
-        </a-form-item> -->
-        <!-- 前端组件 -->
-        <!-- <a-form-item v-if="!formData.type" label="前端组件" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入前端组件路径"
-            v-decorator="['formData.componentPath', {
-              initialValue: formData.componentPath,
-              rules: [{ required: true, message: '请输入前端组件路径!' }] }]"
-          />
-        </a-form-item> -->
-
-        <!-- 第三方链接 -->
-        <!-- <a-form-item v-if="!formData.type" label="第三方链接" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入第三方链接地址"
-            v-decorator="['formData.urlPath', {
-              initialValue: formData.urlPath,
-              rules: [] }]"
-          />
-        </a-form-item> -->
-
-        <!-- 排序值 -->
-        <a-form-item label="排序值" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            type="number"
-            placeholder="请输入排序值"
-            v-decorator="['formData.sort', {
-              initialValue: formData.sort,
-              rules: [] }]"
-          />
-        </a-form-item>
-        <!-- 连锁可用 -->
-        <a-form-item v-if="parentType=='store'" label="连锁可用" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-radio-group
-            name="radioGroup"
-            v-decorator="[
-              'formData.chainOrgUse',
-              {
-                initialValue: formData.chainOrgUse,
-                rules: [{ required: true, message: '请选择!' }] },
-            ]"
-          >
-            <a-radio :value="1">是</a-radio>
-            <a-radio :value="0">否</a-radio>
-          </a-radio-group>
-        </a-form-item>
-        <!-- 单店可用 -->
-        <a-form-item v-if="parentType=='store'" label="单店可用" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-radio-group
-            name="radioGroup"
-            v-decorator="[
-              'formData.singleOrgUse',
-              {
-                initialValue: formData.singleOrgUse,
-                rules: [{ required: true, message: '请选择!' }] },
-            ]"
-          >
-            <a-radio :value="1">是</a-radio>
-            <a-radio :value="0">否</a-radio>
-          </a-radio-group>
-        </a-form-item>
-        <!-- 状态 -->
-        <a-form-item label="启用" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-radio-group
-            name="radioGroup"
-            v-decorator="[
-              'formData.status',
-              {
-                initialValue: formData.status,
-                rules: [{ required: true, message: '请选择状态!' }] },
-            ]"
-          >
-            <a-radio :value="1">是</a-radio>
-            <a-radio :value="0">否</a-radio>
-          </a-radio-group>
-        </a-form-item>
-
-        <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-          <a-button type="primary" @click="handleSubmit()">
-            保存
-          </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
-            取消
-          </a-button>
-        </a-form-item>
-      </a-form>
-
-    </a-modal>
-  </div>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import { saveYyMenu, saveMdMenu } from '@/api/menu.js'
-export default {
-  name: 'ChildModal',
-  components: {
-    STable, VSelect
-  },
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    parentType: {
-      type: String,
-      default: ''
-    },
-    data: {
-      type: Object,
-      default: function () {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      isshow: this.visible,
-      titleText: '',
-      disabled: false,
-      parentTitle: '',
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'childModal' }),
-      formData: {
-        parentId: '',
-        name: '',
-        routePath: '',
-        icon: '',
-        routeName: '',
-        code: '',
-        permission: '',
-        componentPath: '',
-        urlPath: '',
-        sort: '',
-        type: undefined,
-        chainOrgUse: 1,
-        singleOrgUse: 1,
-        status: 1 // 活动状态
-      }
-    }
-  },
-  methods: {
-    cancel (e) {
-      this.clear()
-      this.$emit('close')
-    },
-
-    selectChange (val) {
-      this.formData.type = val
-      console.log(val)
-    },
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          const saveRequest = this.parentType == 'store' ? saveMdMenu : saveYyMenu
-          saveRequest(Object.assign(this.formData, values.formData)).then(res => {
-            console.log(res, 'res--save')
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
-              this.$emit('refresh')
-              setTimeout(function () {
-                _this.cancel()
-              }, 300)
-            } else {
-              // this.$message.warning(res.message)
-            }
-          })
-        }
-      })
-    },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
-    clear () {
-      this.form.resetFields()
-      this.parentTitle = ''
-      this.formData.parentId = ''
-      this.formData.name = ''
-      this.formData.routePath = ''
-      this.formData.icon = ''
-      this.formData.routeName = ''
-      this.formData.componentPath = ''
-      this.formData.urlPath = ''
-      this.formData.sort = ''
-      this.formData.type = ''
-      this.formData.status = 1
-      this.formData.chainOrgUse = 1
-      this.formData.singleOrgUse = 1
-      this.formData.code = ''
-      this.formData.permission = ''
-    }
-
-  },
-  mounted () {
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'childModal' })
-  },
-  watch: {
-    visible (newValue, oldValue) {
-      this.isshow = newValue
-    },
-    isshow (newValue, oldValue) {
-      if (newValue) {
-        if (this.data.id) { // 添加子菜单
-          this.titleText = '添加子菜单'
-          this.disabled = false
-          console.log(this.data, 'this.data')
-          this.formData.parentId = this.data.id
-          this.parentTitle = this.data.name
-        } else { // 添加顶菜单
-          this.titleText = '添加顶菜单'
-          this.formData.type = 0
-          this.disabled = true
-        }
-      } else {
-        this.cancel()
-      }
-    }
-  }
-}
-</script>
-
-<style >
-  .modalBox{
-  }
-  .ant-modal-footer {
-    display: none;
-  }
-</style>

+ 0 - 162
src/views/bnSetting/menusAuth.vue

@@ -1,162 +0,0 @@
-<template>
-  <div>
-    <a-form class="form-box" style="height: 500px;overflow: auto;margin-bottom: 15px;" :form="form" @submit="handleSubmit">
-      <a-tree
-        checkable
-        @check="onCheck"
-        @expand="onExpand"
-        :autoExpandParent="autoExpandParent"
-        v-model="checkedKeys"
-        :treeData="treeData"
-      />
-    </a-form>
-    <a-form-item :wrapper-col="{ offset: 3 }">
-      <a-button type="primary" @click="handleSubmit()">
-        保存
-      </a-button>
-    </a-form-item>
-  </div>
-</template>
-
-<script>
-import { findLsMenu, saveLsMouldMenu, findDdMenu, saveDdMouldMenu } from '@/api/menuSet'
-export default {
-  name: 'MenusAuth',
-  props: {
-    types: {
-      type: String,
-      default: 'dd'
-    }
-  },
-  data () {
-    return {
-      menuIds: '',
-      treeData: [],
-      expandedKeys: [],
-      autoExpandParent: false,
-      checkedKeys: [],
-      checkedData: [],
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'menuModal' })
-    }
-  },
-  methods: {
-    tabChange (v) {
-      console.log(v)
-    },
-    // 初始化树
-    treeInit (dr) {
-      this.treeData = dr.menuList
-      this.menuIds = dr.mould.menuIds
-      if (this.menuIds) {
-        const arr = this.menuIds.split(',')
-        const temp = []
-        arr.map(item => {
-          temp.push(Number(item))
-        })
-        this.checkedData = temp
-        this.expandedKeys = temp
-        // 找出叶子节点
-        this.findLeaf(this.treeData, temp)
-      }
-    },
-    // 获取连锁树数据
-    getfindLsMenu () {
-      findLsMenu().then(res => {
-        console.log(res, '+++++++++连锁+++++++++')
-        if (res.status == 200) {
-          this.treeInit(res.data)
-        }
-      })
-    },
-    // 获取单店树数据
-    getfindDdMenu () {
-      findDdMenu().then(res => {
-        console.log(res, '+++++++++单店+++++++++')
-        if (res.status == 200) {
-          this.treeInit(res.data)
-        }
-      })
-    },
-    onExpand (expandedKeys) {
-      console.log('onExpand', expandedKeys)
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
-    onCheck (checkedKeys, info) {
-      this.checkedData = [...checkedKeys, ...info.halfCheckedKeys]
-      this.checkedKeys = checkedKeys
-    },
-    // 勾选已选的菜单
-    findLeaf (data, arr) {
-      for (let i = 0; i < data.length; i++) {
-        const node = data[i]
-        if (node.children) {
-          this.findLeaf(node.children, arr)
-        } else {
-          const hasNode = arr.find(item => {
-            return item == node.id
-          })
-          if (hasNode) {
-            this.checkedKeys.push(node.id)
-          }
-        }
-      }
-    },
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          // console.log(this.checkedData)
-          if (this.checkedData.length == 0) {
-            return this.$message.warning('请先选择菜单')
-          }
-          const arr = this.checkedData.join(',')
-          if (this.types == 'dd') {
-            this.ddSave({ menuIds: arr })
-          } else {
-            this.lsSave({ menuIds: arr })
-          }
-        }
-      })
-    },
-    // 保存单店
-    ddSave (pars) {
-      saveDdMouldMenu(pars).then(res => {
-        console.log(res, 'res--save')
-        if (res.status + '' === '200') {
-          this.$message.success(res.message ? res.message : '保存成功')
-        } else {
-          // this.$message.warning(res.message)
-        }
-      })
-    },
-    // 保存连锁
-    lsSave (pars) {
-      saveLsMouldMenu(pars).then(res => {
-        console.log(res, 'res--save')
-        if (res.status + '' === '200') {
-          this.$message.success(res.message ? res.message : '保存成功')
-        } else {
-          // this.$message.warning(res.message)
-        }
-      })
-    }
-  },
-  mounted () {
-    // 单店
-    if (this.types == 'dd') {
-      this.getfindDdMenu()
-    } else {
-      this.getfindLsMenu()
-    }
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'menu' })
-  }
-}
-</script>
-
-<style>
-</style>

+ 0 - 41
src/views/bnSetting/menusAuthTab.vue

@@ -1,41 +0,0 @@
-<template>
-  <div class="menusAuth-cons">
-    <a-tabs @change="tabChange" type="card">
-      <a-tab-pane tab="单店菜单设置" key="1">
-        <menusAuth types="dd"></menusAuth>
-      </a-tab-pane>
-      <a-tab-pane tab="连锁店菜单设置" key="2">
-        <menusAuth types="ls"></menusAuth>
-      </a-tab-pane>
-    </a-tabs>
-  </div>
-</template>
-
-<script>
-  import menusAuth from './menusAuth.vue'
-  export default {
-    name: 'menusAuthTab',
-    components: {
-      menusAuth
-    },
-    data() {
-      return {}
-    },
-    methods: {
-      tabChange(v) {
-        console.log(v)
-      },
-    },
-    beforeRouteEnter (to, from, next) {
-      next(vm => {
-      })
-    },
-  }
-</script>
-
-<style>
-  .menusAuth-cons{
-    background: #fff;
-    padding: 10px;
-  }
-</style>

+ 0 - 302
src/views/power/menu/childModal.vue

@@ -1,302 +0,0 @@
-<template>
-  <div>
-    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel">
-      <a-form :form="form" @submit="handleSubmit">
-        <!-- 上级菜单 -->
-        <a-form-item label="上级菜单" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <div >
-            <span >{{ parentTitle }}</span>
-          </div>
-
-        </a-form-item>
-        <!-- 类型 -->
-        <a-form-item label="类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-select
-            @change="selectChange"
-            :disabled="disabled"
-            v-decorator="[
-              'formData.type',
-              {
-                initialValue: formData.type,
-                rules: [{ required: true, message: '请选择状态!' }] },
-            ]"
-            style="width: 100%"
-            placeholder="请选择菜单类型"
-          >
-            <a-select-option :value="0">页面类型</a-select-option>
-            <a-select-option :value="1">按钮类型</a-select-option>
-          </a-select>
-        </a-form-item>
-
-        <!-- 名称 -->
-        <a-form-item label="名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入名称"
-            v-decorator="['formData.name', {
-              initialValue: formData.name,
-              rules: [{ required: true, message: '请输入名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-          />
-        </a-form-item>
-        <!-- 路由英文名 -->
-        <!-- <a-form-item v-if="!formData.type" label="路由英文名" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入路由英文名"
-            v-decorator="['formData.routeName', {
-              initialValue: formData.routeName,
-              rules: [{ required: true, message: '请输入路由英文名!' }] }]"
-          />
-        </a-form-item> -->
-        <!-- 路径 -->
-        <!-- <a-form-item v-if="!formData.type" label="路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-             <a-input placeholder="请输入路径"
-                      v-decorator="['formData.routePath', {
-                        initialValue: formData.routePath,
-                        rules: [{ required: true, message: '请输入路径!' }] }]"
-             />
-           </a-form-item> -->
-        <!-- 请求路径 -->
-        <!-- <a-form-item v-if="formData.type==1" label="请求路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-             <a-input placeholder="请输入请求路径"
-                      v-decorator="['formData.urlPath', {
-                        initialValue: formData.urlPath,
-                        rules: [{ required: true, message: '请输入请求路径!' }] }]"
-             />
-           </a-form-item> -->
-        <!-- 前端权限编码 -->
-        <a-form-item label="前端权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入前端权限编码"
-            v-decorator="[
-              'formData.code',
-              {
-                initialValue: formData.code,
-                rules: [{ required: true, message: '请输入前端权限编码!' }] },
-            ]"
-          />
-
-        </a-form-item>
-        <!-- 后台权限编码 -->
-        <a-form-item label="后台权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入后台权限编码"
-            v-decorator="[
-              'formData.permission',
-              {initialValue: formData.permission},
-            ]"
-          />
-
-        </a-form-item>
-
-        <!-- 图标 -->
-        <!-- <a-form-item v-if="!formData.type" label="图标" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入图标名称"
-            v-decorator="['formData.icon', {
-              initialValue: formData.icon,
-              rules: [] }]"
-          />
-        </a-form-item> -->
-        <!-- 前端组件 -->
-        <!-- <a-form-item v-if="!formData.type" label="前端组件" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入前端组件路径"
-            v-decorator="['formData.componentPath', {
-              initialValue: formData.componentPath,
-              rules: [{ required: true, message: '请输入前端组件路径!' }] }]"
-          />
-        </a-form-item> -->
-
-        <!-- 第三方链接 -->
-        <!-- <a-form-item v-if="!formData.type" label="第三方链接" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入第三方链接地址"
-            v-decorator="['formData.urlPath', {
-              initialValue: formData.urlPath,
-              rules: [] }]"
-          />
-        </a-form-item> -->
-
-        <!-- 排序值 -->
-        <a-form-item label="排序值" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            type="number"
-            placeholder="请输入排序值"
-            v-decorator="['formData.sort', {
-              initialValue: formData.sort,
-              rules: [] }]"
-          />
-        </a-form-item>
-        <!-- 状态 -->
-        <a-form-item label="启用" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-radio-group
-            name="radioGroup"
-            v-decorator="[
-              'formData.status',
-              {
-                initialValue: formData.status,
-                rules: [{ required: true, message: '请选择状态!' }] },
-            ]"
-          >
-            <a-radio :value="1">是</a-radio>
-            <a-radio :value="0">否</a-radio>
-          </a-radio-group>
-        </a-form-item>
-
-        <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-          <a-button type="primary" @click="handleSubmit()">
-            保存
-          </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
-            取消
-          </a-button>
-        </a-form-item>
-      </a-form>
-
-    </a-modal>
-  </div>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import { saveMenu } from '@/api/menu.js'
-export default {
-  name: 'ChildModal',
-  components: {
-    STable, VSelect
-  },
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    data: {
-      type: Object,
-      default: function () {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      isshow: this.visible,
-      titleText: '',
-      disabled: false,
-      parentTitle: '',
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'childModal' }),
-      formData: {
-        parentId: '',
-        name: '',
-        routePath: '',
-        icon: '',
-        routeName: '',
-        code: '',
-        permission: '',
-        componentPath: '',
-        urlPath: '',
-        sort: '',
-        type: undefined,
-        status: 1 // 活动状态
-      }
-    }
-  },
-  methods: {
-    cancel (e) {
-      this.clear()
-      this.$emit('close')
-    },
-
-    selectChange (val) {
-      this.formData.type = val
-      console.log(val)
-    },
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          console.log(values.formData, ' formData.type222222222')
-          saveMenu(Object.assign(this.formData, values.formData)).then(res => {
-            console.log(res, 'res--save')
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
-              this.$emit('refresh')
-              setTimeout(function () {
-                _this.cancel()
-              }, 300)
-            } else {
-              // this.$message.warning(res.message)
-            }
-          })
-        }
-      })
-    },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
-    clear () {
-      this.form.resetFields()
-      this.parentTitle = ''
-      this.formData.parentId = ''
-      this.formData.name = ''
-      this.formData.routePath = ''
-      this.formData.icon = ''
-      this.formData.routeName = ''
-      this.formData.componentPath = ''
-      this.formData.urlPath = ''
-      this.formData.sort = ''
-      this.formData.type = ''
-      this.formData.status = 1
-      this.formData.code = ''
-      this.formData.permission = ''
-    }
-
-  },
-  mounted () {
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'childModal' })
-  },
-  watch: {
-    visible (newValue, oldValue) {
-      this.isshow = newValue
-    },
-    isshow (newValue, oldValue) {
-      if (newValue) {
-        if (this.data.id) { // 添加子菜单
-          this.titleText = '添加子菜单'
-          this.disabled = false
-          console.log(this.data, 'this.data')
-          this.formData.parentId = this.data.id
-          this.parentTitle = this.data.name
-        } else { // 添加顶菜单
-          this.titleText = '添加顶菜单'
-          this.formData.type = 0
-          this.disabled = true
-        }
-      } else {
-        this.cancel()
-      }
-    }
-  }
-}
-</script>
-
-<style >
-  .modalBox{
-  }
-  .ant-modal-footer {
-    display: none;
-  }
-</style>

+ 0 - 457
src/views/power/menu/menu.vue

@@ -1,457 +0,0 @@
-<template>
-  <a-card :bordered="false">
-    <a-row :gutter="24">
-      <a-button style="margin-right: 10px;" type="primary" icon="plus" @click="addChild">添加子菜单</a-button>
-      <a-button style="margin-right: 10px;background-color: #19be6b;color: #fff;" type="" icon="plus" @click="addTitle">添加顶部菜单</a-button>
-      <a-button style="margin-right: 10px;background-color: red;color: #fff;" type="" icon="delete" @click="delect()">删除</a-button>
-
-    </a-row>
-    <a-row :gutter="24">
-      <!-- 左侧菜单树列表 -->
-      <a-col :span="8">
-        <a-row :gutter="24" class="textCount">
-          <a-icon type="info-circle" style="color: #1890FF;margin-right: 10px;" />
-          <span>当前选择:<span style="color: #40a9ff;font-weight: 600;">{{ selectedMenu }}</span><span v-if="selectedKeys.length" class="imgSize" @click="cancelSel">取消选择</span></span>
-        </a-row>
-
-        <a-row :gutter="24" >
-          <a-input-search placeholder="输入搜索菜单名搜索" style="width: 100%" @change="onChange" />
-          <a-tree
-            @expand="onExpand"
-            :treeData="getMenus"
-            :expandedKeys="expandedKeys"
-            :autoExpandParent="autoExpandParent"
-            @select="onSelect"
-            :selectedKeys="selectedKeys"
-            showIcon
-          >
-            <template slot="title" slot-scope="{title}">
-              <span v-if="title.indexOf(searchValue) > -1">
-                {{ title.substr(0, title.indexOf(searchValue)) }}
-                <span style="color: #f50">{{ searchValue }}</span>
-                {{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
-              </span>
-              <span v-else>{{ title }}</span>
-            </template>
-            <a-icon slot="file" type="file" />
-            <a-icon slot="pushpin" type="pushpin" />
-          </a-tree>
-        </a-row>
-      </a-col>
-      <!-- 右侧 -->
-      <a-col :span="16" >
-        <a-form :form="form" @submit="handleSubmit">
-          <!-- 类型 -->
-          <a-form-item label="类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <div v-if="!formData.type||formData.type=='0'">
-              <a-icon type="file" style="margin-right: 10px;" /><span >页面菜单</span>
-            </div>
-            <div v-if="formData.type=='1'">
-              <a-icon type="pushpin" style="margin-right: 10px;" /><span >操作按钮</span>
-            </div>
-          </a-form-item>
-
-          <!-- 名称 -->
-          <a-form-item label="名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入名称"
-              v-decorator="['formData.name', {
-                initialValue: formData.name,
-                rules: [{ required: true, message: '请输入名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-            />
-          </a-form-item>
-          <!-- 路由英文名 -->
-          <!-- <a-form-item v-if="!formData.type||formData.type=='0'" label="路由英文名" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入路由英文名"
-              v-decorator="['formData.routeName', {
-                initialValue: formData.routeName,
-                rules: [{ required: true, message: '请输入路由英文名!' }] }]"
-            />
-          </a-form-item> -->
-          <!-- 路径 -->
-          <!-- <a-form-item v-if="!formData.type||formData.type=='0'" label="路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入路径"
-              v-decorator="['formData.routePath', {
-                initialValue: formData.routePath,
-                rules: [{ required: true, message: '请输入路径!' }] }]"
-            />
-          </a-form-item> -->
-          <!-- 请求路径 -->
-          <!-- <a-form-item v-if="formData.type==1" label="请求路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入请求路径"
-              v-decorator="['formData.urlPath', {
-                initialValue: formData.urlPath,
-                rules: [{ required: true, message: '请输入请求路径!' }] }]"
-            />
-          </a-form-item> -->
-          <!-- 前端权限编码 -->
-          <a-form-item label="前端权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入前端权限编码"
-              v-decorator="[
-                'formData.code',
-                {
-                  initialValue: formData.code,
-                  rules: [{ required: true, message: '请输入前端权限编码!' }] },
-              ]"
-            />
-          </a-form-item>
-          <!-- 后台权限编码 -->
-          <a-form-item label="后台权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入后台权限编码"
-              v-decorator="[
-                'formData.permission',
-                {
-                  initialValue: formData.permission,
-                  rules: [{ required: formData.isLeaf, message: '请输入后台权限编码!' }] },
-              ]"
-            />
-          </a-form-item>
-          <!-- 图标 -->
-          <!-- <a-form-item v-if="!formData.type ||formData.type=='0' " label="图标" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入图标名称"
-              v-decorator="['formData.icon', {
-                initialValue: formData.icon,
-                rules: [] }]"
-            />
-          </a-form-item> -->
-          <!-- 前端组件 -->
-          <!-- <a-form-item v-if="!formData.type ||formData.type=='0'" label="前端组件" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入前端组件路径"
-              v-decorator="['formData.componentPath', {
-                initialValue: formData.componentPath,
-                rules: [{ required: true, message: '请输入前端组件路径!' }] }]"
-            />
-          </a-form-item> -->
-
-          <!-- 第三方链接 -->
-          <!-- <a-form-item v-if="!formData.type ||formData.type=='0'" label="第三方链接" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              placeholder="请输入第三方链接地址"
-              v-decorator="['formData.urlPath', {
-                initialValue: formData.urlPath,
-                rules: [] }]"
-            />
-          </a-form-item> -->
-
-          <!-- 排序值 -->
-          <a-form-item label="排序值" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-input
-              type="number"
-              placeholder="请输入排序值"
-              v-decorator="['formData.sort', {
-                initialValue: formData.sort,
-                rules: [] }]"
-            />
-          </a-form-item>
-          <!-- 状态 -->
-          <a-form-item label="启用" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-            <a-radio-group
-              name="radioGroup"
-              v-decorator="[
-                'formData.status',
-                {
-                  initialValue: formData.status,
-                  rules: [{ required: true, message: '请选择状态!' }] },
-              ]"
-            >
-              <a-radio :value="1">是</a-radio>
-              <a-radio :value="0">否</a-radio>
-            </a-radio-group>
-          </a-form-item>
-
-          <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-            <a-button type="primary" @click="handleSubmit()">
-              保存
-            </a-button>
-            <a-button :style="{ marginLeft: '8px' }" @click="clear">
-              重置
-            </a-button>
-          </a-form-item>
-        </a-form>
-
-      </a-col>
-    </a-row>
-    <childModal :visible="showChildModal" @refresh="getMenuList" :data="parentData" @close="showChildModal = false"></childModal>
-  </a-card>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import childModal from './childModal.vue'
-import { getMenuList, saveMenu, deleteMenu } from '@/api/menu.js'
-
-export default {
-  name: 'Menu',
-  components: {
-    STable, VSelect, childModal
-  },
-  props: {},
-  data () {
-    return {
-      treeData: [],
-      dataList: [],
-      searchValue: '',
-      expandedKeys: [],
-      autoExpandParent: true,
-      selectedKeys: [],
-      selectedMenu: '', // 选择的树节点名
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'menu' }),
-      showChildModal: false,
-      parentData: {}, // 父级菜单
-      formData: {
-        id: '',
-        name: '',
-        routePath: '',
-        icon: '',
-        routeName: '',
-        componentPath: '',
-        urlPath: '',
-        code: '',
-        permission: '',
-        sort: '',
-        type: '0',
-        isLeaf: true,
-        status: '' // 活动状态
-      }
-    }
-  },
-  computed: {
-    getMenus () {
-      this.generateList(this.treeData)
-      return this.treeData
-    }
-  },
-  methods: {
-    onExpand (expandedKeys) {
-      // console.log('onExpand', expandedKeys)
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
-
-    onSelect (selectedKeys, info) {
-      console.log('onSelect', info)
-      this.selectedKeys = selectedKeys
-      if (info.selected) {
-        const data = info.selectedNodes[0].data.props
-        const isLeaf = data.dataRef.children
-        // this.formData = Object.assign({}, this.formData, info.selectedNodes[0].data.props)
-        this.formData = {
-          id: data.id,
-          name: data.name,
-          routePath: data.routePath,
-          icon: data.icon,
-          routeName: data.routeName,
-          componentPath: data.componentPath,
-          urlPath: data.urlPath,
-          code: data.code,
-          permission: data.permission,
-          sort: data.sort,
-          type: data.type,
-          status: data.status,
-          isLeaf: !(isLeaf && isLeaf.length)
-        }
-
-        this.selectedMenu = this.formData.name
-        this.formData.status = Number(this.formData.status)
-      } else {
-        this.selectedMenu = ''
-        this.clear()
-      }
-    },
-    generateList (data) {
-      for (let i = 0; i < data.length; i++) {
-        const node = data[i]
-        const key = node.title
-        this.dataList.push({ key, title: key })
-        node.scopedSlots = { title: 'title' }
-        node.slots = { icon: node.type == '0' ? 'file' : 'pushpin' }
-
-        if (node.children) {
-          this.generateList(node.children)
-        }
-      }
-    },
-    getParentKey (key, tree) {
-      let parentKey
-      for (let i = 0; i < tree.length; i++) {
-        const node = tree[i]
-        if (node.children) {
-          if (node.children.some(item => item.title == key)) {
-            parentKey = node.key
-          } else if (this.getParentKey(key, node.children)) {
-            parentKey = this.getParentKey(key, node.children)
-          }
-        }
-      }
-      return parentKey
-    },
-    onChange (e) {
-      const value = e.target.value
-      const expandedKeys = this.dataList
-        .map(item => {
-          if (item.title.indexOf(value) > -1) {
-            return this.getParentKey(item.title, this.treeData)
-          }
-          return null
-        })
-        .filter((item, i, self) => item && self.indexOf(item) === i)
-      Object.assign(this, {
-        expandedKeys,
-        searchValue: value,
-        autoExpandParent: true
-      })
-    },
-    // 获取菜单树列表
-    getMenuList () {
-      getMenuList().then(res => {
-        console.log(res, 'res1111111')
-        if (res.status == 200) {
-          this.treeData = res.data
-          console.log(this.treeData, 'this.treeData')
-        }
-      })
-    },
-    // 添加子节点
-    addChild () {
-      if (!this.selectedMenu) {
-        return this.$message.warning('请先选择一个父级菜单')
-      } else if (this.formData.type == '1') {
-        return this.$message.warning('请选择一个页面级菜单')
-      }
-      this.showChildModal = true
-      this.parentData = this.formData
-    },
-    // 添加顶部菜单
-    addTitle () {
-      this.showChildModal = true
-      this.parentData = {}
-    },
-
-    //  取消选择
-    cancelSel () {
-      this.selectedKeys = []
-      this.selectedMenu = ''
-      this.clear()
-    },
-    // 清空列表
-    clear () {
-      this.form.resetFields()
-      this.formData.id = ''
-      this.formData.name = ''
-      this.formData.routePath = ''
-      this.formData.icon = ''
-      this.formData.routeName = ''
-      this.formData.componentPath = ''
-      this.formData.urlPath = ''
-      this.formData.sort = ''
-      this.formData.type = ''
-      this.formData.status = ''
-      this.formData.code = ''
-      this.formData.permission = ''
-      this.formData.isLeaf = true
-    },
-
-    // 删除数据
-    delect () {
-      if (!this.selectedKeys.length) {
-        return this.$message.warning('您还未选择要删除的数据')
-      }
-      const _this = this
-      console.log(_this.formData.id, '_this.formData.id')
-      this.$confirm({
-        title: '警告',
-        content: `确定要删除您选择的 ${_this.formData.name} 的数据吗?`,
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          deleteMenu({
-            id: _this.formData.id
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success('删除成功')
-              _this.getMenuList()
-            }
-          }).catch(() => {
-            _this.$message.success('删除失败, 请稍后重试')
-          })
-        }
-      })
-    },
-
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          console.log(values.formData, ' formData.type222222222')
-          saveMenu(Object.assign({ id: this.formData.id }, values.formData)).then(res => {
-            console.log(res, 'res--save')
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
-              _this.getMenuList()
-              _this.clear()
-            } else {
-              // this.$message.warning(res.message)
-            }
-          })
-        }
-      })
-    },
-    handleCancel () {
-      this.clear()
-    }
-
-  },
-  mounted () {
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'menu' })
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      vm.getMenuList()
-    })
-  },
-  watch: {
-
-  }
-}
-</script>
-
-<style>
-  .menu-box::-webkit-scrollbar{
-    width: 6px;
-    height: 6px ;
-  }
-
-  .menu-box::-webkit-scrollbar-thumb{
-    width: 6px;
-    height: 6px ;
-    border-radius: 4px;
-    -webkit-box-shadow: inset 0 0 2px #d1d1d1;
-    background: #e4e4e4;
-  }
-
-  .textCount{
-    border: 1px solid #91d5ff;
-    background-color: #e6f7ff;
-    border-radius: 5px;
-    padding: 5px 10px 5px 20px;
-    margin: 10px 0;
-    color: rgba(0, 0, 0, 0.85);
-  }
-  .imgSize{
-    color: #2d8cf0;
-    margin-left: 10px;
-    font-size: 14px;
-  }
-
-</style>

+ 0 - 194
src/views/power/role/menuModal.vue

@@ -1,194 +0,0 @@
-<template>
-  <div>
-    <a-modal class="modalBox" :title="roleName" v-model="isshow" @cancle="cancel">
-      <a-form class="form-box" style="max-height: 600px;" :form="form" @submit="handleSubmit">
-
-        <a-tree
-          checkable
-          @check="onCheck"
-          @expand="onExpand"
-          :expandedKeys="expandedKeys"
-          :autoExpandParent="autoExpandParent"
-          v-model="checkedKeys"
-          :treeData="treeData"
-        />
-
-      </a-form>
-      <a-form-item :wrapper-col="{ offset: 15 }">
-        <a-button type="primary" @click="handleSubmit()">
-          保存
-        </a-button>
-        <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
-          取消
-        </a-button>
-      </a-form-item>
-    </a-modal>
-  </div>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import { addMenuPower } from '@/api/power-role.js'
-export default {
-  name: 'RoleModal',
-  components: {
-    STable, VSelect
-  },
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    data: {
-      type: Object,
-      default: function () {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      treeData: [],
-      roleName: '',
-      expandedKeys: [],
-      autoExpandParent: true,
-      checkedKeys: [],
-      checkedData: [],
-      isshow: this.visible,
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'menuModal' }),
-      id: '' // 角色id
-    }
-  },
-  methods: {
-    onExpand (expandedKeys) {
-      // if not set autoExpandParent to false, if children expanded, parent can not collapse.
-      // or, you can remove all expanded children keys.
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
-    onCheck (checkedKeys, info) {
-      this.checkedData = [...checkedKeys, ...info.halfCheckedKeys]
-      this.checkedKeys = checkedKeys
-    },
-    cancel (e) {
-      this.clear()
-      this.$emit('close')
-    },
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          if (this.checkedData.length == 0) {
-            return this.$message.warning('请先选择菜单')
-          }
-          const arr = this.checkedData.join(',')
-          addMenuPower({ id: this.id, menuIds: arr }).then(res => {
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
-              this.$emit('refresh')
-              setTimeout(function () {
-                _this.cancel()
-              }, 300)
-            } else {
-              // this.$message.error(res.message)
-            }
-          })
-        }
-      })
-    },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
-    clear () {
-      this.form.resetFields()
-      this.roleName = ''
-      this.id = ''
-      this.checkedKeys = []
-    },
-    findLeaf (data, arr) {
-      for (let i = 0; i < data.length; i++) {
-        const node = data[i]
-        if (node.children) {
-          this.findLeaf(node.children, arr)
-        } else {
-          const hasNode = arr.find(item => {
-            return item == node.id
-          })
-          if (hasNode) {
-            this.checkedKeys.push(node.id)
-          }
-        }
-      }
-    }
-  },
-  mounted () {
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'menuModal' })
-  },
-  watch: {
-    visible (newValue, oldValue) {
-      this.isshow = newValue
-    },
-    isshow (newValue, oldValue) {
-      if (newValue) {
-        if (this.data) { // 编辑
-          this.treeData = this.data.allMenuList
-          this.id = this.data.role.id
-          this.roleName = '分配权限' + '(' + this.data.role.name + ')'
-          if (this.data.role.menuIds) {
-            const arr = this.data.role.menuIds.split(',')
-            const temp = []
-            arr.map(item => {
-              temp.push(Number(item))
-            })
-            this.checkedData = temp
-            this.expandedKeys = temp
-            // 找出叶子节点
-            this.findLeaf(this.treeData, temp)
-          }
-        }
-      } else {
-        this.cancel()
-      }
-    }
-  }
-}
-</script>
-
-<style >
-  .modalBox{
-  }
-  .ant-modal-footer {
-    display: none;
-  }
-  .form-box {
-    max-height: 600px !important;
-    overflow: auto;
-  }
-  .form-box::-webkit-scrollbar{
-    width: 6px;
-    height: 6px ;
-  }
-
-  .form-box::-webkit-scrollbar-thumb{
-    width: 6px;
-    height: 6px ;
-    border-radius: 4px;
-    -webkit-box-shadow: inset 0 0 2px #d1d1d1;
-    background: #e4e4e4;
-  }
-</style>

+ 0 - 222
src/views/power/role/roleList.vue

@@ -1,222 +0,0 @@
-<template>
-  <a-card :bordered="false">
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline">
-        <a-row :gutter="48">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="角色名称">
-              <a-input allowClear v-model="queryParam.name" placeholder="请输入角色名称"/>
-            </a-form-item>
-          </a-col>
-
-          <a-col :md="6" :sm="24">
-            <a-form-item label="状态">
-              <v-select code="CHECK_ENABLE_STATE" v-model="queryParam.isEnable" allowClear placeholder="请选择状态" ></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :md="4" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <a-divider/>
-    <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="openModal">新建</a-button>
-    </div>
-
-    <s-table
-      ref="table"
-      size="default"
-      rowKey="id"
-      :columns="columns"
-      :data="loadData"
-      bordered
-    >
-      <span slot="status" slot-scope="text, record">
-        <a-switch checkedChildren="" unCheckedChildren="" v-model="record.isEnable" @change="changeFlagHandle(text, record)"/>
-      </span>
-
-      <span slot="action" slot-scope="text, record">
-        <template>
-          <a class="action-button menu-text" @click="openMenuModal(record)">菜单权限</a>
-          <a class="action-button" @click="handleEdit(record)">修改</a>
-          <a v-if="!record.isEnable" class="action-button red-text" @click="delect(record)">删除</a>
-        </template>
-      </span>
-    </s-table>
-    <roleModal :visible="showModal" :data="itemData" @refresh="refreshTable" @close="showModal = false"></roleModal>
-    <menuModal :visible="showMenuModal" :data="menuData" @close="showMenuModal = false"></menuModal>
-  </a-card>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import roleModal from './roleModal.vue'
-import menuModal from './menuModal.vue'
-import { getPowerRoleList, updateEnableStatus, delectRolePower, getMenuList } from '@/api/power-role.js'
-export default {
-  name: 'RoleList',
-  components: {
-    STable, VSelect, roleModal, menuModal
-  },
-  data () {
-    return {
-      // 查询参数
-      queryParam: {
-        name: '',
-        isEnable: ''
-      },
-      showModal: false,
-      showMenuModal: false,
-      itemData: {}, // 编辑行数据
-      menuData: {},
-      // 表头
-      columns: [
-        {
-          title: '序号',
-          dataIndex: 'no',
-          width: '40',
-          align: 'center'
-        },
-        {
-          title: '角色名称',
-          dataIndex: 'name',
-          width: '100',
-          align: 'center'
-        },
-        {
-          title: '角色描述',
-          dataIndex: 'remarks',
-          width: '100',
-          align: 'center'
-        },
-        {
-          title: '状态',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'status' }
-        },
-        {
-          title: '创建时间',
-          dataIndex: 'createDate',
-          width: '120',
-          align: 'center'
-        },
-        {
-          title: '操作',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'action' }
-        }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        return getPowerRoleList(Object.assign(parameter, this.queryParam)).then(res => {
-          const no = (res.data.pageNo - 1) * res.data.pageSize
-          for (let i = 0; i < res.data.list.length; i++) {
-            const _item = res.data.list[i]
-            _item.no = no + i + 1
-            _item.isEnable = _item.isEnable + '' === '1'
-          }
-          return res.data
-        })
-      },
-      optionAlertShow: false
-    }
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      // vm.$refs.table.refresh()
-    })
-  },
-  methods: {
-    // 刷新列表
-    refreshTable () {
-      this.$refs.table.refresh(true)
-    },
-    // 新建
-    openModal () {
-      this.showModal = true
-      this.itemData = {}
-    },
-    // 打开分配权限弹窗
-    openMenuModal (row) {
-      this.getMenuList(row.id)
-    },
-    // 获取菜单树列表
-    getMenuList (id) {
-      const _this = this
-      getMenuList({ id: id }).then(res => {
-        if (res.status == 200) {
-          _this.menuData = res.data
-          this.showMenuModal = true
-        }
-      })
-    },
-
-    // 删除
-    delect (row) {
-      const _this = this
-      this.$confirm({
-        title: '警告',
-        content: '删除后无法恢复,确认删除?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          delectRolePower({
-            id: row.id
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success('删除成功')
-              _this.$refs.table.refresh()
-            } else {
-              this.$message.error(res.message)
-            }
-          }).catch(() => {
-            _this.$message.success('删除失败, 请稍后重试')
-          })
-        }
-      })
-    },
-    handleEdit (row) {
-      this.showModal = true
-      this.itemData = row
-    },
-    // 修改状态
-    changeFlagHandle (text, record) {
-      const _data = {
-        id: record.id,
-        flag: record.isEnable ? '1' : '0'
-      }
-      updateEnableStatus(_data).then(res => {
-        if (res.status + '' === '200') {
-          this.$message.success('修改成功')
-        } else {
-          record.isEnable = !record.isEnable
-        }
-      })
-    }
-  }
-}
-</script>
-<style scoped>
-  .table-page-search-wrapper .ant-form-inline .ant-form-item{
-    margin-bottom: 0;
-  }
-  .action-button{
-    line-height: 40px;
-    white-space: nowrap;
-    padding: 5px 10px;
-    background-color: #1890ff;
-    border-radius: 4px;
-    color: #fff;
-    margin-right: 5px;
-  }
-  .red-text{
-    background-color: red;
-  }
-  .menu-text {
-    background-color: #f90;
-  }
-</style>

+ 0 - 172
src/views/power/role/roleModal.vue

@@ -1,172 +0,0 @@
-<template>
-  <div>
-    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel">
-      <a-form :form="form" @submit="handleSubmit">
-        <!-- 用户名称 -->
-        <a-form-item label="角色名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-input
-            placeholder="请输入角色名称"
-            v-decorator="['formData.name', {
-              initialValue: formData.name,
-              rules: [{ required: true, message: '请输入角色名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-          />
-        </a-form-item>
-
-        <!-- 状态 -->
-        <a-form-item label="状态" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-radio-group
-            name="radioGroup"
-            v-decorator="[
-              'formData.isEnable',
-              {
-                initialValue: formData.isEnable,
-                rules: [{ required: true, message: '请选择状态!' }] },
-            ]"
-          >
-            <a-radio :value="1">启用</a-radio>
-            <a-radio :value="0">禁用</a-radio>
-          </a-radio-group>
-        </a-form-item>
-
-        <a-form-item label="角色描述" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
-          <a-textarea
-            v-decorator="[
-              'formData.remarks',
-              { initialValue: formData.remarks,
-                rules: [] },
-            ]"
-            style="min-height: 60px;"
-            placeholder=""
-            autosize />
-        </a-form-item>
-
-        <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-          <a-button type="primary" @click="handleSubmit()">
-            保存
-          </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
-            取消
-          </a-button>
-        </a-form-item>
-      </a-form>
-
-    </a-modal>
-  </div>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import { saveRolePower } from '@/api/power-role.js'
-export default {
-  name: 'RoleModal',
-  components: {
-    STable, VSelect
-  },
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    data: {
-      type: Object,
-      default: function () {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      titleText: '添加角色',
-      isshow: this.visible,
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'roleModal' }),
-      formData: {
-        name: '',
-        isEnable: '', // 活动状态
-        remarks: ''
-      }
-
-    }
-  },
-  methods: {
-    cancel (e) {
-      this.clear()
-      this.$emit('close')
-    },
-
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          saveRolePower(Object.assign(this.formData, values.formData)).then(res => {
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
-              this.$emit('refresh')
-              setTimeout(function () {
-                _this.cancel()
-              }, 300)
-            } else {
-              // this.$message.error(res.message)
-            }
-          })
-        }
-      })
-    },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
-    clear () {
-      this.form.resetFields()
-      delete this.formData.id
-      this.formData.name = ''
-      this.formData.isEnable = ''
-      this.formData.remarks = ''
-    }
-
-  },
-  mounted () {
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'roleModal' })
-  },
-  watch: {
-    visible (newValue, oldValue) {
-      this.isshow = newValue
-    },
-    isshow (newValue, oldValue) {
-      if (newValue) {
-        if (this.data.id) { // 编辑
-          this.titleText = '编辑角色'
-          this.formData = Object.assign({}, this.data)
-          delete this.formData.no
-          this.formData.isEnable = Number(this.formData.isEnable)
-        } else {
-          this.titleText = '添加角色'
-        }
-      } else {
-        this.cancel()
-      }
-    }
-  }
-}
-</script>
-
-<style >
-  .modalBox{
-  }
-  .ant-modal-footer {
-    display: none;
-  }
-</style>

+ 0 - 242
src/views/power/user/userList.vue

@@ -1,242 +0,0 @@
-<template>
-  <a-card :bordered="false">
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline">
-        <a-row :gutter="48">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="用户名称">
-              <a-input allowClear v-model="queryParam.name" placeholder="请输入用户名称"/>
-            </a-form-item>
-          </a-col>
-
-          <a-col :md="6" :sm="24">
-            <a-form-item label="手机号码">
-              <a-input allowClear v-model="queryParam.phone" placeholder="请输入手机号码"/>
-            </a-form-item>
-          </a-col>
-
-          <a-col :md="6" :sm="24">
-            <a-form-item label="状态">
-              <v-select code="CHECK_ENABLE_STATE" v-model="queryParam.loginFlag" allowClear placeholder="请选择状态"></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :md="4" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <a-divider/>
-    <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="openModal">新建</a-button>
-    </div>
-
-    <s-table
-      ref="table"
-      size="default"
-      rowKey="id"
-      :columns="columns"
-      :data="loadData"
-      bordered
-    >
-      <span slot="status" slot-scope="text, record">
-        <a-switch checkedChildren="" unCheckedChildren="" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
-      </span>
-      <div slot="roleNames" slot-scope="text, record" :title="record.roleNames">
-        <span v-if="record.roleNames">{{ record.roleNames.substr(0,12) + '...' }}</span>
-        <span v-else>无</span>
-      </div>
-      <span slot="action" slot-scope="text, record">
-        <template>
-          <div >
-            <a class="action-button" @click="handleEdit(record)">修改</a>
-            <a v-if="record.loginFlag" class="action-button reset-text" @click="resetPassword(record)">重置密码</a>
-            <a v-if="!record.loginFlag" class="action-button red-text" @click="delect(record)">删除</a>
-          </div>
-        </template>
-      </span>
-    </s-table>
-    <userModal :visible="showModal" @refresh="$refs.table.refresh(true)" :data="itemData" @close="showModal = false"></userModal>
-  </a-card>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import userModal from './userModal.vue'
-import { resetPSD, updateEnableStatus, getPowerUserList, delectUserPower } from '@/api/power-user.js'
-export default {
-  name: 'UserList',
-  components: {
-    STable, VSelect, userModal
-  },
-  data () {
-    return {
-      // 查询参数
-      queryParam: {
-        name: '',
-        phone: '',
-        loginFlag: ''
-      },
-      showModal: false,
-      itemData: {}, // 编辑行数据
-      // 表头
-      columns: [
-        {
-          title: '序号',
-          dataIndex: 'no',
-          width: '40',
-          align: 'center'
-        },
-        {
-          title: '用户名称',
-          dataIndex: 'name',
-          width: '100',
-          align: 'center'
-        },
-        {
-          title: '手机号码',
-          dataIndex: 'phone',
-          width: '100',
-          align: 'center'
-        },
-        {
-          title: '角色',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'roleNames' }
-        },
-        {
-          title: '状态',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'status' }
-        },
-        {
-          title: '创建时间',
-          dataIndex: 'createDate',
-          width: '120',
-          align: 'center'
-        },
-        {
-          title: '操作',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'action' }
-        }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        return getPowerUserList(Object.assign(parameter, this.queryParam)).then(res => {
-          const no = (res.data.pageNo - 1) * res.data.pageSize
-          for (let i = 0; i < res.data.list.length; i++) {
-            const _item = res.data.list[i]
-            _item.no = no + i + 1
-            _item.loginFlag = _item.loginFlag + '' === '1'
-          }
-          return res.data
-        })
-      },
-      optionAlertShow: false
-    }
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      // vm.$refs.table.refresh()
-    })
-  },
-  methods: {
-    // 刷新列表
-    refreshTable () {
-      this.$refs.table.refresh(true)
-    },
-    // 新建
-    openModal () {
-      this.showModal = true
-      this.itemData = {}
-    },
-    // 重置密码
-    resetPassword (row) {
-      resetPSD({
-        id: row.id
-      }).then(res => {
-        if (res.status == 200) {
-          this.$message.success('密码重置成功')
-        } else {
-          this.$message.error(res.message)
-        }
-      }).catch(() => {
-        this.$message.success('密码重置失败, 请稍后重试')
-      })
-    },
-    // 删除
-    delect (row) {
-      const _this = this
-      this.$confirm({
-        title: '警告',
-        content: '删除后无法恢复,确认删除?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          delectUserPower({
-            id: row.id
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success('删除成功')
-              _this.$refs.table.refresh()
-            } else {
-              _this.$message.error(res.message)
-            }
-          }).catch(() => {
-            _this.$message.success('删除失败, 请稍后重试')
-          })
-        }
-      })
-    },
-    getBizStr (storeBizList) {
-      const str = []
-      storeBizList.forEach(item => {
-        str.push(item.bizTypeName)
-      })
-      return str.join(',')
-    },
-    handleEdit (row) {
-      this.showModal = true
-      this.itemData = row
-    },
-    // 修改状态
-    changeFlagHandle (text, record) {
-      const _data = {
-        id: record.id,
-        flag: record.loginFlag ? '1' : '0'
-      }
-      updateEnableStatus(_data).then(res => {
-        if (res.status + '' === '200') {
-          this.$message.success('修改成功')
-        } else {
-          record.loginFlag = !record.loginFlag
-        }
-      })
-    }
-  }
-}
-</script>
-<style scoped>
-  .table-page-search-wrapper .ant-form-inline .ant-form-item{
-    margin-bottom: 0;
-  }
-  .action-button{
-   line-height: 40px;
-   white-space: nowrap;
-    padding: 5px 10px;
-    background-color: #1890ff;
-    border-radius: 4px;
-    color: #fff;
-    margin-right: 5px;
-  }
-  .red-text{
-    background-color: red;
-  }
-  .reset-text {
-    background-color: #31b50b;
-  }
-</style>

+ 0 - 268
src/views/power/user/userModal.vue

@@ -1,268 +0,0 @@
-<template>
-  <div>
-    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel">
-      <a-form :form="form" @submit="handleSubmit">
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <!-- 用户名称 -->
-            <a-form-item label="用户名称" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
-              <a-input
-                placeholder="请输入用户名称"
-                v-decorator="['formData.name', {
-                  initialValue: formData.name,
-                  rules: [{ required: true, message: '请输入用户名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-              />
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <!-- 手机号码 -->
-            <a-form-item label="手机号码" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
-              <a-input
-                placeholder="请输入手机号码"
-                v-decorator="['formData.phone', {
-                  initialValue: formData.phone,
-                  rules: [{ required: true, message: '请输入手机号码!' },{pattern:/^[1][0-9]{10}$/, message: '请输入正确的手机号码!'}] }]"
-              />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <!-- 性别 -->
-          <a-col :span="12">
-            <a-form-item label="性别" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
-              <v-select
-                code="SEX"
-                v-decorator="[
-                  'formData.sex',
-                  {
-                    initialValue: formData.sex,
-                    rules: [{ required: true, message: '请选择性别!' }] },
-                ]"
-                allowClear ></v-select>
-
-            </a-form-item>
-          </a-col>
-          <!-- 状态 -->
-          <a-col :span="12">
-            <a-form-item label="状态" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
-              <a-radio-group
-                name="radioGroup"
-                v-decorator="[
-                  'formData.loginFlag',
-                  {
-                    initialValue: formData.loginFlag,
-                    rules: [{ required: true, message: '请选择状态!' }] },
-                ]"
-              >
-                <a-radio :value="1">是</a-radio>
-                <a-radio :value="0">否</a-radio>
-              </a-radio-group>
-
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="角色" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
-              <a-select
-                v-decorator="[
-                  'formData.roleNames',
-                  {
-                    initialValue: formData.roleNames,
-                    rules: [{ required: true, message: '请选择状态!' }] },
-                ]"
-                mode="multiple"
-                style="width: 100%"
-                placeholder="请选择角色"
-              >
-                <a-select-option
-                  v-for="item in roleList"
-                  :key="item.id"
-                  :disabled="item.isEnable == '0' ? true : false"
-                >{{ item.name }}</a-select-option
-                >
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="备注" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
-              <a-textarea
-                v-decorator="[
-                  'formData.remarks',
-                  {
-                    initialValue: formData.remarks,
-                    rules: [] },
-                ]"
-                style="min-height: 50px;"
-                placeholder=""
-                autosize />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-          <a-button type="primary" @click="handleSubmit()">
-            保存
-          </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
-            取消
-          </a-button>
-        </a-form-item>
-      </a-form>
-    </a-modal>
-  </div>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import { getRoleList, saveUserPower } from '@/api/power-user.js'
-export default {
-  name: 'UserModal',
-  components: {
-    STable, VSelect
-  },
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    data: {
-      type: Object,
-      default: function () {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      titleText: '添加用户',
-      isshow: this.visible,
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'miniForm' }),
-      roleList: [],
-      formData: {
-        roleNames: undefined, // 角色
-        name: '',
-        loginFlag: '', // 活动状态
-        phone: '',
-        sex: '',
-        remarks: ''
-      }
-    }
-  },
-  methods: {
-    cancel (e) {
-      this.clear()
-      this.$emit('close')
-    },
-
-    // 保存提交
-    handleSubmit () {
-      const _this = this
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          values.formData.roleNames = values.formData.roleNames.join(',')
-          saveUserPower(Object.assign({ id: this.data.id ? this.data.id : '' }, values.formData)).then(res => {
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
-              this.$emit('refresh')
-              setTimeout(function () {
-                _this.cancel()
-              }, 300)
-            } else {
-              // this.$message.error(res.message)
-            }
-          })
-        }
-      })
-    },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
-    clear () {
-      this.form.resetFields()
-      delete this.formData.id
-      this.formData.roleNames = []
-      this.formData.name = ''
-      this.formData.loginFlag = ''
-      this.formData.phone = ''
-      this.formData.sex = ''
-      this.formData.remarks = ''
-    },
-
-    // 获取角色列表接口
-    getRoleList () {
-      getRoleList().then(res => {
-        if (res.status + '' === '200') {
-          this.roleList = res.data
-        } else {
-          this.$message.warning(res.message)
-        }
-      })
-    }
-
-  },
-  mounted () {
-    this.getRoleList()
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'miniForm' })
-  },
-  watch: {
-    visible (newValue, oldValue) {
-      this.isshow = newValue
-    },
-    isshow (newValue, oldValue) {
-      if (newValue) {
-        if (this.data.id) { // 编辑
-          this.titleText = '编辑用户'
-          this.formData = Object.assign({}, this.data)
-          delete this.formData.no
-          let roleNames = this.formData.roleNames
-          if (roleNames) {
-            roleNames = roleNames.split(',')
-            const arr = []
-            roleNames.map(item => {
-              const row = this.roleList.find(a => {
-                return a.name == item
-              })
-              if (row) {
-                arr.push(row.id)
-              }
-            })
-            this.formData.roleNames = arr
-          } else {
-            this.formData.roleNames = []
-          }
-
-          this.formData.loginFlag = Number(this.formData.loginFlag)
-        } else {
-          this.titleText = '添加用户'
-        }
-      } else {
-        this.cancel()
-      }
-    }
-  }
-}
-</script>
-
-<style >
-  .modalBox{
-  }
-  .ant-modal-footer {
-    display: none;
-  }
-</style>

+ 4 - 3
vue.config.js

@@ -108,8 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.16.102:8101/cw-admin/',
-        // target: 'https://zyyc.chelingzhu.com/cw-admin/',
+        // target: 'http://192.168.16.102:8101/cw-coupon/',
+        target: 'http://192.168.16.103:8104/cw-coupon/',
+        // target: 'http://carwash.test.zyucgj.com/cw-coupon/',
         ws: false,
         changeOrigin: true,
         pathRewrite: {
@@ -117,7 +118,7 @@ const vueConfig = {
         },
         // ÖØÐ´cookie·¾¶
         cookiePathRewrite: {
-          '/cw-admin/': '/'
+          '/cw-coupon/': '/'
         }
       }
     }