mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 06:20:50 +00:00
improve: 页面缓存判断/商品/优惠券分类优化
This commit is contained in:
parent
ccb02a8e19
commit
8dd723caec
@ -106,6 +106,16 @@ export function treeListApi(type) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 商品管理-- 分类 new
|
||||
*/
|
||||
export function cascaderListApi(type) {
|
||||
return request({
|
||||
url: `product/category/cascader/${type}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 商品管理-- 详情
|
||||
*/
|
||||
|
||||
BIN
template/admin/src/assets/images/sort03.jpg
Normal file
BIN
template/admin/src/assets/images/sort03.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
@ -1,50 +1,48 @@
|
||||
<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>
|
||||
|
||||
<script>
|
||||
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>
|
||||
|
||||
@ -211,7 +211,8 @@ export default {
|
||||
this.$store.commit('menus/setopenMenus', []);
|
||||
this.$store.commit('menus/getmenusNav', 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/avatar', data.user_info.head_pic);
|
||||
@ -257,15 +258,17 @@ export default {
|
||||
},
|
||||
formatTwoStageRoutes(arr) {
|
||||
if (arr.length <= 0) return false;
|
||||
console.log(arr, 'arr');
|
||||
const newArr = [];
|
||||
const cacheList = [];
|
||||
arr.forEach((v) => {
|
||||
if (v?.meta?.keepAlive) {
|
||||
if (v && v.meta && v.meta.keepAlive) {
|
||||
newArr.push({ ...v });
|
||||
cacheList.push(v.name);
|
||||
this.$store.dispatch('keepAliveNames/setCacheKeepAlive', cacheList);
|
||||
}
|
||||
});
|
||||
console.log(newArr, 'newArr');
|
||||
return newArr;
|
||||
},
|
||||
// 多级嵌套数组处理成一维数组
|
||||
|
||||
@ -101,7 +101,7 @@ import relationList from './relation';
|
||||
import { formatDate } from '@/utils/validate';
|
||||
import goodsList from '@/components/goodsList/index';
|
||||
export default {
|
||||
name: 'addArticle',
|
||||
name: 'cms_article',
|
||||
data() {
|
||||
return {
|
||||
modalTitleSs: '',
|
||||
|
||||
@ -174,7 +174,7 @@ import {
|
||||
import { scrollTop } from '@/libs/util';
|
||||
|
||||
export default {
|
||||
name: 'index',
|
||||
name: 'marketing_channel_code',
|
||||
filters: {
|
||||
typeFilter(status) {
|
||||
const statusMap = {
|
||||
|
||||
@ -112,7 +112,7 @@ import { bargainListApi, bargainSetStatusApi, stroeBargainApi } from '@/api/mark
|
||||
import { formatDate } from '@/utils/validate';
|
||||
import { exportBargainList } from '@/api/export';
|
||||
export default {
|
||||
name: 'storeBargain',
|
||||
name: 'marketing_storeBargain',
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
if (time !== 0) {
|
||||
|
||||
@ -114,7 +114,7 @@ import { formatDate } from '@/utils/validate';
|
||||
import { exportCombinationList } from '@/api/export.js';
|
||||
|
||||
export default {
|
||||
name: 'index',
|
||||
name: 'marketing_combinalist',
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
if (time !== 0) {
|
||||
|
||||
@ -28,7 +28,9 @@
|
||||
<Radio :label="3">后台赠送</Radio>
|
||||
<Radio :label="4">付费会员专享</Radio>
|
||||
</RadioGroup>
|
||||
<div class="tip">手动领取:用户需要手动领取优惠券;新用户自动发放:新注册的用户自动发放;后台赠送:后台发放制定用户或者添加到商品里面用户购买该商品获得;付费会员专享:仅付费会员可以领取和使用</div>
|
||||
<div class="tip">
|
||||
手动领取:用户需要手动领取优惠券;新用户自动发放:新注册的用户自动发放;后台赠送:后台发放制定用户或者添加到商品里面用户购买该商品获得;付费会员专享:仅付费会员可以领取和使用
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem label="优惠劵类型">
|
||||
<RadioGroup v-model="formData.type">
|
||||
@ -49,9 +51,17 @@
|
||||
<div class="info">选择商品</div>
|
||||
</FormItem>
|
||||
<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>
|
||||
</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>
|
||||
</FormItem>
|
||||
<FormItem label="使用门槛">
|
||||
@ -152,6 +162,7 @@
|
||||
import { mapState } from 'vuex';
|
||||
import goodsList from '@/components/goodsList/index';
|
||||
import { couponCategoryApi, couponSaveApi, couponDetailApi } from '@/api/marketing';
|
||||
import { cascaderListApi } from '@/api/product';
|
||||
export default {
|
||||
name: 'storeCouponCreate',
|
||||
components: {
|
||||
@ -201,10 +212,7 @@ export default {
|
||||
methods: {
|
||||
// 品类
|
||||
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;
|
||||
});
|
||||
},
|
||||
|
||||
@ -157,7 +157,7 @@ import {
|
||||
} from '@/api/marketing';
|
||||
import { formatDate } from '@/utils/validate';
|
||||
export default {
|
||||
name: 'storeCouponIssue',
|
||||
name: 'marketing_storeCouponIssue',
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
if (time !== 0) {
|
||||
|
||||
@ -131,7 +131,7 @@ import { mapState } from 'vuex';
|
||||
import { integralProductListApi, integralIsShowApi, storeSeckillApi } from '@/api/marketing';
|
||||
import { formatDate } from '@/utils/validate';
|
||||
export default {
|
||||
name: 'storeIntegral',
|
||||
name: 'marketing_storeIntegral',
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
if (time !== 0) {
|
||||
|
||||
@ -100,7 +100,7 @@ import { formatDate } from '@/utils/validate';
|
||||
import { exportSeckillList } from '@/api/export.js';
|
||||
|
||||
export default {
|
||||
name: 'storeSeckill',
|
||||
name: 'marketing_storeSeckill',
|
||||
filters: {
|
||||
formatDate(time) {
|
||||
if (time !== 0) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="" id="shopp-manager">
|
||||
<div class="i-layout-page-header header-title">
|
||||
<div class=" fl_header">
|
||||
<div class="fl_header">
|
||||
<router-link :to="{ path: $routeProStr + '/product/product_list' }"
|
||||
><Button icon="ios-arrow-back" size="small" type="text">返回</Button></router-link
|
||||
>
|
||||
@ -46,11 +46,20 @@
|
||||
</Col>
|
||||
<Col span="24">
|
||||
<FormItem label="商品分类:" prop="cate_id">
|
||||
<!-- {{ formValidate.cate_id }}
|
||||
<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">{{
|
||||
item.html + item.cate_name
|
||||
}}</Option>
|
||||
</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>
|
||||
</FormItem>
|
||||
</Col>
|
||||
@ -1332,6 +1341,7 @@ import { userLabelAddApi } from '@/api/user';
|
||||
import {
|
||||
productInfoApi,
|
||||
treeListApi,
|
||||
cascaderListApi,
|
||||
productAddApi,
|
||||
generateAttrApi,
|
||||
productGetRuleApi,
|
||||
@ -2600,7 +2610,7 @@ export default {
|
||||
},
|
||||
// 商品分类;
|
||||
goodsCategory() {
|
||||
treeListApi(1)
|
||||
cascaderListApi(1)
|
||||
.then((res) => {
|
||||
this.treeSelect = res.data;
|
||||
})
|
||||
|
||||
@ -92,6 +92,7 @@ body,
|
||||
.layout-aside-width-default {
|
||||
width: 180px !important;
|
||||
transition: width 0.3s ease;
|
||||
box-shadow: 1px 1px 4px rgba(0,21,41,.08);
|
||||
}
|
||||
.layout-aside-width64 {
|
||||
width: 64px !important;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user