增加状态管理持久化插件,提取日期选择,时间选择,周期选择为公共组件
This commit is contained in:
7
main.js
7
main.js
@@ -7,6 +7,9 @@ import dict from '@/commons/utils/dict.js'
|
|||||||
import {utils} from '@/commons/utils/index.js'
|
import {utils} from '@/commons/utils/index.js'
|
||||||
import uviewPlus from 'uview-plus'
|
import uviewPlus from 'uview-plus'
|
||||||
import * as Pinia from 'pinia';
|
import * as Pinia from 'pinia';
|
||||||
|
import {
|
||||||
|
createUnistorage
|
||||||
|
} from "pinia-plugin-unistorage";
|
||||||
// 设置node环境
|
// 设置node环境
|
||||||
envConfig.changeEnv(storageManage.env())
|
envConfig.changeEnv(storageManage.env())
|
||||||
|
|
||||||
@@ -39,7 +42,9 @@ export function createApp() {
|
|||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
|
|
||||||
app.use(uviewPlus)
|
app.use(uviewPlus)
|
||||||
app.use(Pinia.createPinia());
|
const store = Pinia.createPinia();
|
||||||
|
store.use(createUnistorage());
|
||||||
|
app.use(store)
|
||||||
app.config.globalProperties.$appName = appConfig.appName
|
app.config.globalProperties.$appName = appConfig.appName
|
||||||
uni.$appName = appConfig.appName
|
uni.$appName = appConfig.appName
|
||||||
app.config.globalProperties.$utils = utils
|
app.config.globalProperties.$utils = utils
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"jsbn": "^1.1.0",
|
"jsbn": "^1.1.0",
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"pinia-plugin-unistorage": "^0.1.2",
|
||||||
"to-arraybuffer": "^1.0.1",
|
"to-arraybuffer": "^1.0.1",
|
||||||
"uview-plus": "^3.3.32",
|
"uview-plus": "^3.3.32",
|
||||||
"ysk-utils": "^1.0.78"
|
"ysk-utils": "^1.0.78"
|
||||||
|
|||||||
@@ -41,10 +41,10 @@
|
|||||||
<view class="u-flex u-row-between u-m-b-32">
|
<view class="u-flex u-row-between u-m-b-32">
|
||||||
<text class="font-bold color-333">活动日期</text>
|
<text class="font-bold color-333">活动日期</text>
|
||||||
</view>
|
</view>
|
||||||
<timeArea
|
<my-time-area
|
||||||
v-model:startDate="form.validStartTime"
|
v-model:startDate="form.validStartTime"
|
||||||
v-model:endDate="form.validEndTime"
|
v-model:endDate="form.validEndTime"
|
||||||
></timeArea>
|
></my-time-area>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-32">
|
<view class="u-m-t-32">
|
||||||
<up-line ></up-line>
|
<up-line ></up-line>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<text class="font-bold color-333 u-m-b-32">可用周期</text>
|
<text class="font-bold color-333 u-m-b-32">可用周期</text>
|
||||||
</view>
|
</view>
|
||||||
<weekSel v-model="form.useDays"></weekSel>
|
<my-week-sel v-model="form.useDays"></my-week-sel>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -61,11 +61,11 @@
|
|||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<text class="font-bold color-333 u-m-b-32">指定时间段</text>
|
<text class="font-bold color-333 u-m-b-32">指定时间段</text>
|
||||||
</view>
|
</view>
|
||||||
<hourSel
|
<my-hour-area
|
||||||
v-model:useTimeType="form.useTimeType"
|
v-model:useTimeType="form.useTimeType"
|
||||||
v-model:startValue="form.useStartTime"
|
v-model:startValue="form.useStartTime"
|
||||||
v-model:endValue="form.useEndTime"
|
v-model:endValue="form.useEndTime"
|
||||||
></hourSel>
|
></my-hour-area>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-32 container">
|
<view class="u-m-t-32 container">
|
||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
@@ -144,15 +144,11 @@
|
|||||||
></up-switch>
|
></up-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<bottomBtnGroup @save="save" @cancel="cancel"></bottomBtnGroup>
|
<my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import timeArea from "./components/time-area.vue";
|
|
||||||
import weekSel from "./components/week-sel.vue";
|
|
||||||
import hourSel from "./components/hour-area.vue";
|
|
||||||
import bottomBtnGroup from "./components/bottom-btn-group.vue";
|
|
||||||
import { reactive } from "vue";
|
import { reactive } from "vue";
|
||||||
import * as discountActivityApi from "@/http/api/market/discountActivity.js";
|
import * as discountActivityApi from "@/http/api/market/discountActivity.js";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<view style="height: 180rpx"></view>
|
|
||||||
|
|
||||||
<view class="fixed-bottom u-flex gap-20">
|
|
||||||
<view class="u-flex-1">
|
|
||||||
<my-button type="primary" @click="save" shape="circle">
|
|
||||||
保存
|
|
||||||
</my-button>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex-1">
|
|
||||||
<my-button bgColor="#fff" type="default" @click="cancel" shape="circle">
|
|
||||||
取消
|
|
||||||
</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
const emit= defineEmits(["save", "cancel"]);
|
|
||||||
|
|
||||||
function save() {
|
|
||||||
emit("save");
|
|
||||||
}
|
|
||||||
function cancel() {
|
|
||||||
emit("cancel");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,154 +1,228 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="row" v-for="(item, index) in menuList" :key="index">
|
<view class="row" v-for="(item, index) in computedMenus" :key="index">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<text class="t">{{ item.label }}</text>
|
<text class="t">{{ item.label }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu-wrap">
|
<view class="menu-wrap">
|
||||||
<view class="item" v-for="(val, i) in item.menus" :key="i" @click="go.to(val.pageUrl)">
|
<view
|
||||||
<image :src="`/static/applocation/${val.icon}.png`" mode="aspectFit" class="icon"></image>
|
class="item"
|
||||||
<view class="info">
|
v-for="(val, i) in item.menus"
|
||||||
<view class="title">
|
:key="i"
|
||||||
<text class="t">{{ val.title }}</text>
|
@click="go.to(val.pageUrl)"
|
||||||
</view>
|
>
|
||||||
<view class="intro">
|
<image :src="val.icon" mode="aspectFit" class="icon"></image>
|
||||||
<text class="t">{{ val.intro }}</text>
|
<view class="info">
|
||||||
</view>
|
<view class="title">
|
||||||
</view>
|
<text class="t">{{ val.title }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="intro">
|
||||||
</view>
|
<text class="t">{{ val.intro }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from "vue";
|
||||||
import go from '@/commons/utils/go.js';
|
import go from "@/commons/utils/go.js";
|
||||||
import { useMenusStore } from '@/store/menus.js';
|
import { useMenusStore } from "@/store/menus.js";
|
||||||
const menusStore = useMenusStore();
|
const menusStore = useMenusStore();
|
||||||
|
|
||||||
const menuList = ref([
|
const menuList = ref([
|
||||||
{
|
{
|
||||||
label: '营销',
|
label: "营销",
|
||||||
menus: [
|
menus: [
|
||||||
{
|
{
|
||||||
icon: 'xszk',
|
title: "霸王餐",
|
||||||
pageUrl: 'PAGES_LIMIT_DISCOUNT',
|
icon: "",
|
||||||
title: '限时折扣',
|
intro: "设置充值消费的N倍,当前订单立即免单",
|
||||||
intro: '批量设置商品折扣'
|
pageUrl: "PAGES_BWC",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'czdhm',
|
title: "积分锁客",
|
||||||
pageUrl: 'LIMIT_DISCOUNT',
|
icon: "",
|
||||||
title: '充值兑换码',
|
pageUrl: "",
|
||||||
intro: '兑换码直充余额,可当作礼品赠送'
|
intro: "设置充值消费的N倍,当前订单立即免单",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
{
|
title: "弹窗广告",
|
||||||
title: '优惠券',
|
icon: "",
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
pageUrl: "PAGES_ORDER_INDEX",
|
||||||
pageUrl: 'PAGES_ORDER_INDEX'
|
intro: "设置弹窗广告",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '霸王餐',
|
title: "超级会员",
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
icon: "",
|
||||||
pageUrl: 'PAGES_ORDER_INDEX'
|
pageUrl: "PAGES_ORDER_INDEX",
|
||||||
},
|
intro: "用户会员管理设置",
|
||||||
{
|
},
|
||||||
title: '邀请裂变',
|
{
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
title: "新客立减",
|
||||||
pageUrl: 'PAGES_ORDER_INDEX'
|
icon: "",
|
||||||
},
|
pageUrl: "PAGES_ORDER_INDEX",
|
||||||
{
|
intro: "首单下单减免金额",
|
||||||
title: '积分锁客',
|
},
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
{
|
||||||
pageUrl: 'PAGES_ORDER_INDEX'
|
title: "智慧充值",
|
||||||
},
|
icon: "",
|
||||||
{
|
pageUrl: "PAGES_ORDER_INDEX",
|
||||||
title: '满减活动',
|
intro: "允许客户充值并使用余额支付",
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
},
|
||||||
pageUrl: 'PAGES_MARKET_DISCOUNT_ACTIVITY'
|
{
|
||||||
},
|
title: "分销",
|
||||||
{
|
icon: "",
|
||||||
title: '私域引流',
|
pageUrl: "PAGES_PAY",
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
intro: "用户成为业务员,可促进消费",
|
||||||
pageUrl: 'PAGES_MARKET_DRAINAGE_CONFIG'
|
},
|
||||||
},
|
{
|
||||||
{
|
title: "消费返现",
|
||||||
title: '消费返现',
|
icon: "",
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
pageUrl: "PAGES_MARKET_CONSUME_CASHBACK",
|
||||||
pageUrl: 'PAGES_MARKET_CONSUME_CASHBACK'
|
intro: "用户下单后返现一定的金额到余额,可促进复购",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '分销',
|
title: "私域引流",
|
||||||
icon: '/static/indexImg/icon-order.svg',
|
icon: "",
|
||||||
pageUrl: 'PAGES_PAY'
|
pageUrl: "PAGES_MARKET_DRAINAGE_CONFIG",
|
||||||
}
|
intro: "可设置用户下单成功后的群二维码",
|
||||||
]
|
},
|
||||||
}
|
{
|
||||||
|
title: "满减活动",
|
||||||
|
icon: "",
|
||||||
|
pageUrl: "PAGES_MARKET_DISCOUNT_ACTIVITY",
|
||||||
|
intro: "达到指定支付金额享受减价",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "生日有礼",
|
||||||
|
icon: "",
|
||||||
|
pageUrl: "",
|
||||||
|
intro: "用户生日管理设置",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "点餐智能推荐",
|
||||||
|
icon: "",
|
||||||
|
pageUrl: "",
|
||||||
|
intro: "进入点单页X秒未点自动推荐商品,此推荐设置启用即生效",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "超值券包",
|
||||||
|
icon: "",
|
||||||
|
pageUrl: "",
|
||||||
|
intro: "下单加购",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "套餐推广",
|
||||||
|
icon: "",
|
||||||
|
pageUrl: "",
|
||||||
|
intro: "下单通过用户邀请好友减免金额的方式裂变宣传套餐加购",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "充值兑换码",
|
||||||
|
icon: "",
|
||||||
|
pageUrl: "",
|
||||||
|
intro: "兑换码直充余额,可当作礼品赠送",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "券兑换码",
|
||||||
|
icon: "",
|
||||||
|
pageUrl: "",
|
||||||
|
intro: "可添加多券组合兑换",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "xszk",
|
||||||
|
pageUrl: "PAGES_LIMIT_DISCOUNT",
|
||||||
|
title: "限时折扣",
|
||||||
|
intro: "批量设置商品折扣",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: "xszk",
|
||||||
|
pageUrl: "PAGES_LIMIT_DISCOUNT",
|
||||||
|
title: "商品拼团",
|
||||||
|
intro: "拼团",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
console.log(menusStore.adminPages);
|
console.log(menusStore.adminPages);
|
||||||
|
|
||||||
const computedMenus = computed(() => {
|
const computedMenus = computed(() => {
|
||||||
const arr = menusStore.adminPages.filter((v) => {
|
// const arr = menusStore.adminPages.filter((v) => {
|
||||||
return navList.find((navItem) => navItem.title == v.title);
|
// return navList.find((navItem) => navItem.title == v.title);
|
||||||
});
|
// });
|
||||||
console.log(arr);
|
return menuList.value.map((v) => {
|
||||||
return arr;
|
v.menus = v.menus.filter((menu) => {
|
||||||
|
const hasPermission = menusStore.adminPages.find(
|
||||||
|
(navItem) => navItem.title == menu.title
|
||||||
|
);
|
||||||
|
console.log("hasPermission", hasPermission);
|
||||||
|
if (hasPermission) {
|
||||||
|
menu.icon = hasPermission.miniIcon;
|
||||||
|
console.log(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasPermission;
|
||||||
|
});
|
||||||
|
return v;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.container {
|
.container {
|
||||||
padding: 28upx;
|
padding: 28upx;
|
||||||
.row {
|
.row {
|
||||||
.header {
|
.header {
|
||||||
padding-bottom: 28upx;
|
padding-bottom: 28upx;
|
||||||
.t {
|
.t {
|
||||||
font-size: 32upx;
|
font-size: 32upx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.menu-wrap {
|
.menu-wrap {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
grid-template-rows: auto;
|
grid-template-rows: auto;
|
||||||
grid-column-gap: 28upx;
|
grid-column-gap: 28upx;
|
||||||
grid-row-gap: 28upx;
|
grid-row-gap: 28upx;
|
||||||
.item {
|
.item {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 20upx;
|
padding: 20upx;
|
||||||
border-radius: 20upx;
|
border-radius: 20upx;
|
||||||
.icon {
|
.icon {
|
||||||
$size: 80upx;
|
$size: 80upx;
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.info {
|
.info {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding-left: 20upx;
|
padding-left: 20upx;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
.title {
|
.title {
|
||||||
.t {
|
.t {
|
||||||
font-size: 28upx;
|
font-size: 28upx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.intro {
|
.intro {
|
||||||
.t {
|
.t {
|
||||||
font-size: 28upx;
|
font-size: 28upx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@@ -35,6 +35,9 @@ importers:
|
|||||||
lodash:
|
lodash:
|
||||||
specifier: ^4.17.21
|
specifier: ^4.17.21
|
||||||
version: 4.17.21
|
version: 4.17.21
|
||||||
|
pinia-plugin-unistorage:
|
||||||
|
specifier: ^0.1.2
|
||||||
|
version: 0.1.2
|
||||||
to-arraybuffer:
|
to-arraybuffer:
|
||||||
specifier: ^1.0.1
|
specifier: ^1.0.1
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
@@ -534,6 +537,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
||||||
engines: {node: '>=8.6'}
|
engines: {node: '>=8.6'}
|
||||||
|
|
||||||
|
pinia-plugin-unistorage@0.1.2:
|
||||||
|
resolution: {integrity: sha512-WXit2cGnm5rG6CDTcLSLehNWhyJS/Yq7WEeeXAapZbCnqoPJxlszqg7rT8S+OP47az0h5nlajGo+LuyMxUQ2uw==}
|
||||||
|
|
||||||
punycode@2.3.1:
|
punycode@2.3.1:
|
||||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@@ -1147,6 +1153,8 @@ snapshots:
|
|||||||
|
|
||||||
picomatch@2.3.1: {}
|
picomatch@2.3.1: {}
|
||||||
|
|
||||||
|
pinia-plugin-unistorage@0.1.2: {}
|
||||||
|
|
||||||
punycode@2.3.1: {}
|
punycode@2.3.1: {}
|
||||||
|
|
||||||
queue-microtask@1.2.3: {}
|
queue-microtask@1.2.3: {}
|
||||||
|
|||||||
@@ -64,4 +64,6 @@ export const useMenusStore = defineStore('menus', {
|
|||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
|
}
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user