Browse Source

improve: 页面缓存判断/商品/优惠券分类优化

From-wh 2 years ago
parent
commit
8dd723caec

+ 10 - 0
template/admin/src/api/product.js

@@ -106,6 +106,16 @@ export function treeListApi(type) {
   });
   });
 }
 }
 
 
+/**
+ * @description 商品管理-- 分类 new
+ */
+export function cascaderListApi(type) {
+  return request({
+    url: `product/category/cascader/${type}`,
+    method: 'get',
+  });
+}
+
 /**
 /**
  * @description 商品管理-- 详情
  * @description 商品管理-- 详情
  */
  */

BIN
template/admin/src/assets/images/sort03.jpg


+ 41 - 43
template/admin/src/layout/routerView/parent.vue

@@ -1,50 +1,48 @@
 <template>
 <template>
-	<div class="h100">
-		<transition :name="setTransitionName" mode="out-in">
-			<keep-alive :include="keepAliveNameList">
-				<router-view :key="refreshRouterViewKey" />
-			</keep-alive>
-		</transition>
-	</div>
+  <div class="h100">
+    <transition :name="setTransitionName" mode="out-in">
+      <keep-alive :include="keepAliveNameList">
+        <router-view :key="refreshRouterViewKey" />
+      </keep-alive>
+    </transition>
+  </div>
 </template>
 </template>
 
 
 <script>
 <script>
 export default {
 export default {
-	name: 'parent',
-	data() {
-		return {
-			refreshRouterViewKey: null,
-			keepAliveNameList: [],
-			keepAliveNameNewList: [],
-		};
-	},
-	created() {
-		// debugger
-		// 页面加载前,处理缓存,页面刷新时路由缓存处理
-		this.keepAliveNameList = this.getKeepAliveNames();
-		console.log(this.keepAliveNameList,'this.keepAliveNameList')
-		this.bus.$on('onTagsViewRefreshRouterView', (path) => {
-			console.log(path)
-			if (this.$route.path !== path) return false;
-			this.keepAliveNameList = this.getKeepAliveNames().filter((name) => this.$route.name !== name);
-			this.refreshRouterViewKey = this.$route.path;
-			this.$nextTick(() => {
-				this.refreshRouterViewKey = null;
-				this.keepAliveNameList = this.getKeepAliveNames();
-			});
-		});
-	},
-	computed: {
-		// 设置主界面切换动画
-		setTransitionName() {
-			return this.$store.state.themeConfig.themeConfig.animation;
-		},
-	},
-	methods: {
-		// 获取路由缓存列表(name),默认路由全部缓存
-		getKeepAliveNames() {
-			return this.$store.state.keepAliveNames.keepAliveNames;
-		},
-	},
+  name: 'parent',
+  data() {
+    return {
+      refreshRouterViewKey: null,
+      keepAliveNameList: [],
+      keepAliveNameNewList: [],
+    };
+  },
+  computed: {},
+  created() {
+    this.keepAliveNameList = this.getKeepAliveNames();
+    this.bus.$on('onTagsViewRefreshRouterView', (path) => {
+      console.log(path);
+      if (this.$route.path !== path) return false;
+      this.keepAliveNameList = this.getKeepAliveNames().filter((name) => this.$route.name !== name);
+      this.refreshRouterViewKey = this.$route.path;
+      this.$nextTick(() => {
+        this.refreshRouterViewKey = null;
+        this.keepAliveNameList = this.getKeepAliveNames();
+      });
+    });
+  },
+  computed: {
+    // 设置主界面切换动画
+    setTransitionName() {
+      return this.$store.state.themeConfig.themeConfig.animation;
+    },
+  },
+  methods: {
+    // 获取路由缓存列表(name),默认路由全部缓存
+    getKeepAliveNames() {
+      return this.$store.state.keepAliveNames.keepAliveNames;
+    },
+  },
 };
 };
 </script>
 </script>

+ 5 - 2
template/admin/src/pages/account/login/index.vue

@@ -211,7 +211,8 @@ export default {
           this.$store.commit('menus/setopenMenus', []);
           this.$store.commit('menus/setopenMenus', []);
           this.$store.commit('menus/getmenusNav', data.menus);
           this.$store.commit('menus/getmenusNav', data.menus);
           this.$store.dispatch('routesList/setRoutesList', data.menus);
           this.$store.dispatch('routesList/setRoutesList', data.menus);
-
+          let arr = this.formatFlatteningRoutes(this.$router.options.routes);
+          this.formatTwoStageRoutes(arr);
           // 记录用户信息
           // 记录用户信息
           this.$store.commit('userInfo/name', data.user_info.account);
           this.$store.commit('userInfo/name', data.user_info.account);
           this.$store.commit('userInfo/avatar', data.user_info.head_pic);
           this.$store.commit('userInfo/avatar', data.user_info.head_pic);
@@ -257,15 +258,17 @@ export default {
     },
     },
     formatTwoStageRoutes(arr) {
     formatTwoStageRoutes(arr) {
       if (arr.length <= 0) return false;
       if (arr.length <= 0) return false;
+      console.log(arr, 'arr');
       const newArr = [];
       const newArr = [];
       const cacheList = [];
       const cacheList = [];
       arr.forEach((v) => {
       arr.forEach((v) => {
-        if (v?.meta?.keepAlive) {
+        if (v && v.meta && v.meta.keepAlive) {
           newArr.push({ ...v });
           newArr.push({ ...v });
           cacheList.push(v.name);
           cacheList.push(v.name);
           this.$store.dispatch('keepAliveNames/setCacheKeepAlive', cacheList);
           this.$store.dispatch('keepAliveNames/setCacheKeepAlive', cacheList);
         }
         }
       });
       });
+      console.log(newArr, 'newArr');
       return newArr;
       return newArr;
     },
     },
     // 多级嵌套数组处理成一维数组
     // 多级嵌套数组处理成一维数组

+ 1 - 1
template/admin/src/pages/cms/article/index.vue

@@ -101,7 +101,7 @@ import relationList from './relation';
 import { formatDate } from '@/utils/validate';
 import { formatDate } from '@/utils/validate';
 import goodsList from '@/components/goodsList/index';
 import goodsList from '@/components/goodsList/index';
 export default {
 export default {
-  name: 'addArticle',
+  name: 'cms_article',
   data() {
   data() {
     return {
     return {
       modalTitleSs: '',
       modalTitleSs: '',

+ 1 - 1
template/admin/src/pages/marketing/channelCode/channelCodeIndex.vue

@@ -174,7 +174,7 @@ import {
 import { scrollTop } from '@/libs/util';
 import { scrollTop } from '@/libs/util';
 
 
 export default {
 export default {
-  name: 'index',
+  name: 'marketing_channel_code',
   filters: {
   filters: {
     typeFilter(status) {
     typeFilter(status) {
       const statusMap = {
       const statusMap = {

+ 1 - 1
template/admin/src/pages/marketing/storeBargain/index.vue

@@ -112,7 +112,7 @@ import { bargainListApi, bargainSetStatusApi, stroeBargainApi } from '@/api/mark
 import { formatDate } from '@/utils/validate';
 import { formatDate } from '@/utils/validate';
 import { exportBargainList } from '@/api/export';
 import { exportBargainList } from '@/api/export';
 export default {
 export default {
-  name: 'storeBargain',
+  name: 'marketing_storeBargain',
   filters: {
   filters: {
     formatDate(time) {
     formatDate(time) {
       if (time !== 0) {
       if (time !== 0) {

+ 1 - 1
template/admin/src/pages/marketing/storeCombination/index.vue

@@ -114,7 +114,7 @@ import { formatDate } from '@/utils/validate';
 import { exportCombinationList } from '@/api/export.js';
 import { exportCombinationList } from '@/api/export.js';
 
 
 export default {
 export default {
-  name: 'index',
+  name: 'marketing_combinalist',
   filters: {
   filters: {
     formatDate(time) {
     formatDate(time) {
       if (time !== 0) {
       if (time !== 0) {

+ 15 - 7
template/admin/src/pages/marketing/storeCouponIssue/create.vue

@@ -28,7 +28,9 @@
             <Radio :label="3">后台赠送</Radio>
             <Radio :label="3">后台赠送</Radio>
             <Radio :label="4">付费会员专享</Radio>
             <Radio :label="4">付费会员专享</Radio>
           </RadioGroup>
           </RadioGroup>
-          <div class="tip">手动领取:用户需要手动领取优惠券;新用户自动发放:新注册的用户自动发放;后台赠送:后台发放制定用户或者添加到商品里面用户购买该商品获得;付费会员专享:仅付费会员可以领取和使用</div>
+          <div class="tip">
+            手动领取:用户需要手动领取优惠券;新用户自动发放:新注册的用户自动发放;后台赠送:后台发放制定用户或者添加到商品里面用户购买该商品获得;付费会员专享:仅付费会员可以领取和使用
+          </div>
         </FormItem>
         </FormItem>
         <FormItem label="优惠劵类型">
         <FormItem label="优惠劵类型">
           <RadioGroup v-model="formData.type">
           <RadioGroup v-model="formData.type">
@@ -49,9 +51,17 @@
           <div class="info">选择商品</div>
           <div class="info">选择商品</div>
         </FormItem>
         </FormItem>
         <FormItem v-show="formData.type === 1">
         <FormItem v-show="formData.type === 1">
-          <Select v-model="formData.category_id" style="width: 320px" multiple>
+          <!-- <Select v-model="formData.category_id" style="width: 320px" multiple>
             <Option v-for="item in categoryList" :value="item.id" :key="item.id">{{ item.cate_name }}</Option>
             <Option v-for="item in categoryList" :value="item.id" :key="item.id">{{ item.cate_name }}</Option>
-          </Select>
+          </Select> -->
+          <el-cascader
+            v-model="formData.category_id"
+            size="small"
+            :options="categoryList"
+            :props="{ multiple: true, emitPath: false }"
+            clearable
+            style="width: 320px"
+          ></el-cascader>
           <div class="info">选择商品的品类</div>
           <div class="info">选择商品的品类</div>
         </FormItem>
         </FormItem>
         <FormItem label="使用门槛">
         <FormItem label="使用门槛">
@@ -152,6 +162,7 @@
 import { mapState } from 'vuex';
 import { mapState } from 'vuex';
 import goodsList from '@/components/goodsList/index';
 import goodsList from '@/components/goodsList/index';
 import { couponCategoryApi, couponSaveApi, couponDetailApi } from '@/api/marketing';
 import { couponCategoryApi, couponSaveApi, couponDetailApi } from '@/api/marketing';
+import { cascaderListApi } from '@/api/product';
 export default {
 export default {
   name: 'storeCouponCreate',
   name: 'storeCouponCreate',
   components: {
   components: {
@@ -201,10 +212,7 @@ export default {
   methods: {
   methods: {
     // 品类
     // 品类
     getCategoryList() {
     getCategoryList() {
-      couponCategoryApi(1).then(async (res) => {
-        res.data.forEach((val) => {
-          val.cate_name = `${val.html}${val.cate_name}`;
-        });
+      cascaderListApi(1).then(async (res) => {
         this.categoryList = res.data;
         this.categoryList = res.data;
       });
       });
     },
     },

+ 1 - 1
template/admin/src/pages/marketing/storeCouponIssue/index.vue

@@ -157,7 +157,7 @@ import {
 } from '@/api/marketing';
 } from '@/api/marketing';
 import { formatDate } from '@/utils/validate';
 import { formatDate } from '@/utils/validate';
 export default {
 export default {
-  name: 'storeCouponIssue',
+  name: 'marketing_storeCouponIssue',
   filters: {
   filters: {
     formatDate(time) {
     formatDate(time) {
       if (time !== 0) {
       if (time !== 0) {

+ 1 - 1
template/admin/src/pages/marketing/storeIntegral/index.vue

@@ -131,7 +131,7 @@ import { mapState } from 'vuex';
 import { integralProductListApi, integralIsShowApi, storeSeckillApi } from '@/api/marketing';
 import { integralProductListApi, integralIsShowApi, storeSeckillApi } from '@/api/marketing';
 import { formatDate } from '@/utils/validate';
 import { formatDate } from '@/utils/validate';
 export default {
 export default {
-  name: 'storeIntegral',
+  name: 'marketing_storeIntegral',
   filters: {
   filters: {
     formatDate(time) {
     formatDate(time) {
       if (time !== 0) {
       if (time !== 0) {

+ 1 - 1
template/admin/src/pages/marketing/storeSeckill/index.vue

@@ -100,7 +100,7 @@ import { formatDate } from '@/utils/validate';
 import { exportSeckillList } from '@/api/export.js';
 import { exportSeckillList } from '@/api/export.js';
 
 
 export default {
 export default {
-  name: 'storeSeckill',
+  name: 'marketing_storeSeckill',
   filters: {
   filters: {
     formatDate(time) {
     formatDate(time) {
       if (time !== 0) {
       if (time !== 0) {

+ 12 - 2
template/admin/src/pages/product/productAdd/index.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
   <div class="" id="shopp-manager">
   <div class="" id="shopp-manager">
     <div class="i-layout-page-header header-title">
     <div class="i-layout-page-header header-title">
-      <div class=" fl_header">
+      <div class="fl_header">
         <router-link :to="{ path: $routeProStr + '/product/product_list' }"
         <router-link :to="{ path: $routeProStr + '/product/product_list' }"
           ><Button icon="ios-arrow-back" size="small" type="text">返回</Button></router-link
           ><Button icon="ios-arrow-back" size="small" type="text">返回</Button></router-link
         >
         >
@@ -46,11 +46,20 @@
           </Col>
           </Col>
           <Col span="24">
           <Col span="24">
             <FormItem label="商品分类:" prop="cate_id">
             <FormItem label="商品分类:" prop="cate_id">
+              <!-- {{ formValidate.cate_id }}
               <Select v-model="formValidate.cate_id" placeholder="请选择商品分类" multiple class="perW20">
               <Select v-model="formValidate.cate_id" placeholder="请选择商品分类" multiple class="perW20">
                 <Option v-for="item in treeSelect" :disabled="item.pid === 0" :value="item.id" :key="item.id">{{
                 <Option v-for="item in treeSelect" :disabled="item.pid === 0" :value="item.id" :key="item.id">{{
                   item.html + item.cate_name
                   item.html + item.cate_name
                 }}</Option>
                 }}</Option>
               </Select>
               </Select>
+              {{ formValidate.cate_id }} -->
+              <el-cascader
+                v-model="formValidate.cate_id"
+                size="small"
+                :options="treeSelect"
+                :props="{ multiple: true, emitPath: false }"
+                clearable
+              ></el-cascader>
               <span class="addfont" @click="addCate">新增分类</span>
               <span class="addfont" @click="addCate">新增分类</span>
             </FormItem>
             </FormItem>
           </Col>
           </Col>
@@ -1332,6 +1341,7 @@ import { userLabelAddApi } from '@/api/user';
 import {
 import {
   productInfoApi,
   productInfoApi,
   treeListApi,
   treeListApi,
+  cascaderListApi,
   productAddApi,
   productAddApi,
   generateAttrApi,
   generateAttrApi,
   productGetRuleApi,
   productGetRuleApi,
@@ -2600,7 +2610,7 @@ export default {
     },
     },
     // 商品分类;
     // 商品分类;
     goodsCategory() {
     goodsCategory() {
-      treeListApi(1)
+      cascaderListApi(1)
         .then((res) => {
         .then((res) => {
           this.treeSelect = res.data;
           this.treeSelect = res.data;
         })
         })

+ 1 - 0
template/admin/src/theme/app.scss

@@ -92,6 +92,7 @@ body,
   .layout-aside-width-default {
   .layout-aside-width-default {
     width: 180px !important;
     width: 180px !important;
     transition: width 0.3s ease;
     transition: width 0.3s ease;
+    box-shadow: 1px 1px 4px rgba(0,21,41,.08);
   }
   }
   .layout-aside-width64 {
   .layout-aside-width64 {
     width: 64px !important;
     width: 64px !important;