新增营销中心图标以及新版首页

This commit is contained in:
gyq 2025-11-18 18:40:59 +08:00
parent e40b4fe8cc
commit 98b7ee56b1
43 changed files with 531 additions and 139 deletions

27
http/api/market/index.js Normal file
View File

@ -0,0 +1,27 @@
import http from "@/http/http.js";
const request = http.request;
const urlType = "market";
/**
* 限时折扣-分页
* @param {Object} data
*/
export function limitTimeDiscountPage(data) {
return request({
url: `${urlType}/admin/limitTimeDiscount/page`,
method: "GET",
data
});
}
/**
* 删除限时折扣
* @param {Object} data
*/
export function limitTimeDiscountDel(params) {
return request({
url: `${urlType}/admin/limitTimeDiscount`,
method: "DELETE",
params
});
}

View File

@ -0,0 +1,64 @@
<template>
<view class="fixed-btn" id="fixedBtn">
<div class="btn">
<u-button type="primary" :shape="shape" size="large">添加</u-button>
</div>
<div class="btn" v-if="showCancel">
<u-button shape="circle" size="large">取消</u-button>
</div>
</view>
</template>
<script setup>
import { ref, onMounted, nextTick } from 'vue';
const props = defineProps({
confirmText: {
type: String,
default: '添加'
},
showCancel: {
type: Boolean,
default: false
},
shape: {
type: String,
default: 'squre' // squre circle
}
});
const emits = defineEmits(['load']);
function load() {
const query = uni.createSelectorQuery().in(this);
query
.selectComponent('#fixedBtn') // refref#refref
.boundingClientRect((data) => {
console.log('组件内元素高度:', data?.height);
})
.exec();
}
onMounted(() => {
nextTick(() => {
load();
});
});
</script>
<style scoped lang="scss">
.fixed-btn {
width: 100%;
position: fixed;
bottom: 0;
left: 0;
display: flex;
gap: 20upx;
flex-direction: column;
padding: 20upx 28upx calc(40upx + env(safe-area-inset-bottom) / 2) 20upx;
background-color: #fff;
.btn {
flex: 1;
}
}
</style>

View File

@ -0,0 +1,98 @@
<template>
<view class="item-doc" :style="{ height: headHeight + 'px' }">
<view class="item" :style="{ height: headHeight + 'px' }">
<view class="left">
<image :src="`/static/applocation/${options.icon}.png`" mode="aspectFit" class="icon"></image>
<view class="info">
<view class="title">
<text class="t">{{ options.name }}</text>
</view>
<view class="intro">
<text class="t">{{ options.intro }}</text>
</view>
</view>
</view>
<view class="right" v-if="showSwitch">
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen"></u-switch>
</view>
</view>
</view>
</template>
<script setup>
import { ref, onMounted, nextTick } from 'vue';
const props = defineProps({
options: {
type: Object,
default: {
name: '标题',
intro: '说明',
icon: 'xszk'
}
},
showSwitch: {
type: Boolean,
default: false
}
});
const headHeight = ref(70);
const isOpen = defineModel('isOpen', {
type: [Boolean, String, Number],
default: 0
});
const emits = defineEmits(['load']);
onMounted(() => {
nextTick(() => {
emits('load', { height: headHeight.value });
});
});
</script>
<style scoped lang="scss">
.item-doc {
width: 100%;
}
.item {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 99;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
padding: 20upx 28upx;
.left {
display: flex;
.icon {
$size: 80upx;
width: $size;
height: $size;
flex-shrink: 0;
}
.info {
display: flex;
padding-left: 20upx;
flex-direction: column;
.title {
.t {
font-size: 28upx;
font-weight: bold;
}
}
.intro {
.t {
font-size: 28upx;
color: #999;
}
}
}
}
}
</style>

View File

@ -0,0 +1,193 @@
<template>
<view class="container">
<HeaderCard :options="{ name: '限时折扣', intro: '批量设置商品折扣', icon: 'xszk' }" @load="headLoad" />
<view class="list">
<view class="item" v-for="item in tableData.list" :key="item.id">
<view class="head">
<view class="left">
<text class="t">优先级{{ item.sort }}</text>
</view>
<view class="status-wrap">
<u-tag :type="statusFilter(item.status, 'type')" plain :text="statusFilter(item.status, 'label')"></u-tag>
</view>
</view>
<view class="row">
<text class="b">活动时间</text>
<text class="t">{{ item.updateTime }}</text>
</view>
<view class="row">
<text class="t">{{ item.useDays }}</text>
</view>
<view class="row">
<text class="t">折扣{{ item.discountRate }}%</text>
</view>
<view class="footer">
<view class="btn">
<u-button @click="delHandle(item)">删除</u-button>
</view>
<view class="btn">
<u-button type="primary">编辑</u-button>
</view>
</view>
</view>
</view>
<u-loadmore :status="tableData.status"></u-loadmore>
<FooterBtn />
</view>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import HeaderCard from '../components/HeaderCard.vue';
import FooterBtn from '../components/FooterBtn.vue';
import { limitTimeDiscountPage } from '@/http/api/market/index.js';
//
const headHeight = ref(0);
function headLoad(e) {
headHeight.value = e.height;
}
//
function delHandle(item) {
uni.showModal({
title: '注意',
content: '确定要删除吗?',
success: async (res) => {
if (res.confirm) {
try {
uni.showLoading({
title: '删除中...',
mask: true
});
await limitTimeDiscountDel({ id: item.id });
uni.showToast({
title: '删除成功',
icon: 'none'
});
let index = tableData.list.findIndex((val) => val.id === item.id);
tableData.list.splice(index, 1);
} catch (error) {
console.log(error);
}
uni.hideLoading();
}
}
});
}
const statusList = ref([
{
value: 1,
label: '未开始',
type: 'info'
},
{
value: 2,
label: '进行中',
type: 'success'
},
{
value: 3,
label: '已结束',
type: 'info'
},
{
value: -1,
label: '当前时间不可用',
type: 'primary'
}
]);
function statusFilter(status, key = 'label') {
return statusList.value.find((val) => val.value == status)[key];
}
const tableData = reactive({
loading: false,
page: 1,
size: 10,
list: [],
status: 'loading'
});
//
onReachBottom(() => {
tableData.page++;
limitTimeDiscountPageAjax();
});
//
async function limitTimeDiscountPageAjax() {
try {
const res = await limitTimeDiscountPage({
page: 1,
size: 10,
startTime: '',
endTime: ''
});
if (tableData.page == 1) {
tableData.list = res.records;
} else {
tableData.list.push(...res.records);
}
if (res.totalPage == res.totalRow) {
tableData.status = 'nomore';
}
} catch (error) {
console.log(error);
}
}
onLoad(() => {
limitTimeDiscountPageAjax();
});
</script>
<style>
page {
background-color: #f7f7f7;
}
</style>
<style scoped lang="scss">
.container {
padding: 0 28upx;
}
.list {
padding: 28upx 0;
.item {
background-color: #fff;
padding: 20upx;
border-radius: 20upx;
.head {
display: flex;
justify-content: space-between;
.left {
.t {
color: #999;
}
}
}
.row {
margin-bottom: 12upx;
.b {
font-size: 28upx;
font-weight: bold;
}
.t {
font-size: 28upx;
}
}
.footer {
display: flex;
gap: 28upx;
justify-content: flex-end;
.btn {
width: 200upx;
}
}
}
}
</style>

View File

@ -64,42 +64,37 @@
}
},
{
"path" : "pages/permission/permission",
"path": "pages/permission/permission",
"pageId": "PAGES_PERSSION",
"style" :
{
"navigationBarTitleText" : "全部操作"
"style": {
"navigationBarTitleText": "全部操作"
}
},
{
"path" : "pages/shopSetUp/decoration",
"path": "pages/shopSetUp/decoration",
"pageId": "PAGES_DECORATION",
"style" :
{
"navigationBarTitleText" : "店铺装修"
"style": {
"navigationBarTitleText": "店铺装修"
}
},
{
"path" : "pages/appliccation/list",
"style" :
{
"navigationBarTitleText" : "列表管理"
"path": "pages/appliccation/list",
"style": {
"navigationBarTitleText": "列表管理"
}
},
{
"path" : "pages/appliccation/marketing",
"style" :
{
"navigationBarTitleText" : "营销中心"
"path": "pages/appliccation/marketing",
"style": {
"navigationBarTitleText": "营销中心"
}
},
{
"path" : "pages/pay",
"path": "pages/pay",
"pageId": "PAGES_PAY",
"style" :
{
"navigationBarTitleText" : "分销",
"navigationStyle" : "custom"
"style": {
"navigationBarTitleText": "分销",
"navigationStyle": "custom"
}
}
],
@ -629,6 +624,13 @@
"style": {
"navigationBarTitleText": "消费返现"
}
},
{
"pageId": "PAGES_LIMIT_DISCOUNT",
"path": "limitDiscount/index",
"style": {
"navigationBarTitleText": "限时折扣"
}
}
]
},
@ -640,8 +642,7 @@
"style": {
"navigationBarTitleText": "分销"
}
}
]
}]
}
],

View File

@ -0,0 +1,7 @@
<template>
<view class="">选择门店组件</view>
</template>
<script></script>
<style></style>

View File

@ -1,101 +1,103 @@
<template>
<view class="u-p-30 bg-gray min-page">
<view class=" border-r-16 bg-fff u-p-30 ">
<view class="u-m-t-32">
<up-grid :border="false" col="2">
<up-grid-item @click="toPage(listItem,listIndex)" v-for="(listItem,listIndex) in computedMenus"
:key="listIndex">
<image style="width: 120rpx;height: 120rpx;" :src="listItem.miniIcon" mode="scaleToFill" />
<text class="u-m-t-16 color-333 u-font-28 u-p-b-32">{{listItem.title}}</text>
</up-grid-item>
</up-grid>
<view class="container">
<view class="row" v-for="(item, index) in menuList" :key="index">
<view class="header">
<text class="t">{{ item.label }}</text>
</view>
<view class="menu-wrap">
<view class="item" v-for="(val, i) in item.menus" :key="i" @click="go.to(val.pageId)">
<image :src="`/static/applocation/${val.icon}.png`" mode="aspectFit" class="icon"></image>
<view class="info">
<view class="title">
<text class="t">{{ val.label }}</text>
</view>
<view class="intro">
<text class="t">{{ val.intro }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
computed
} from 'vue';
import go from '@/commons/utils/go.js';
import {
useMenusStore
} from '@/store/menus.js';
const menusStore = useMenusStore()
async function init() {
const res = await menusStore.getMenus()
import { ref } from 'vue';
import go from '@/commons/utils/go.js';
const menuList = ref([
{
label: '营销',
menus: [
{
icon: 'xszk',
pageId: 'PAGES_LIMIT_DISCOUNT',
label: '限时折扣',
intro: '批量设置商品折扣'
},
{
icon: 'czdhm',
pageId: 'LIMIT_DISCOUNT',
label: '充值兑换码',
intro: '兑换码直充余额,可当作礼品赠送'
}
init()
function toPage(item, index) {
console.log(item);
uni.navigateTo({
url: '/' + item.miniPath.replace(/^\/+|\/+$/g, ''),
fail(err) {
uni.showToast({
icon: 'none',
title: '无该页面路径或无权限访问该页面'
})
]
}
})
}
const navList = [{
title: '优惠券',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '霸王餐',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '邀请裂变',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '积分锁客',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '满减活动',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_MARKET_DISCOUNT_ACTIVITY'
},
{
title: '私域引流',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_MARKET_DRAINAGE_CONFIG'
},
{
title: '消费返现',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_MARKET_CONSUME_CASHBACK'
},
{
title: '分销',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_PAY'
},
];
console.log(menusStore.adminPages);
const computedMenus = computed(() => {
const arr = menusStore.adminPages.filter(v => {
return navList.find(navItem => navItem.title == v.title)
})
console.log(arr);
return arr
})
]);
</script>
<style lang="scss">
<style>
page {
background-color: #f8f8f8;
}
</style>
<style scoped lang="scss">
.container {
padding: 28upx;
.row {
.header {
padding-bottom: 28upx;
.t {
font-size: 32upx;
font-weight: bold;
}
}
.menu-wrap {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-column-gap: 28upx;
grid-row-gap: 28upx;
.item {
display: flex;
background-color: #fff;
padding: 20upx;
border-radius: 20upx;
.icon {
$size: 80upx;
width: $size;
height: $size;
flex-shrink: 0;
}
.info {
display: flex;
padding-left: 20upx;
flex-direction: column;
.title {
.t {
font-size: 28upx;
font-weight: bold;
}
}
.intro {
.t {
font-size: 28upx;
color: #999;
}
}
}
}
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
static/applocation/bwc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/applocation/cjhy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

BIN
static/applocation/czhd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

BIN
static/applocation/czqb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

BIN
static/applocation/dxts.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

BIN
static/applocation/fx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

BIN
static/applocation/jfsk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

BIN
static/applocation/kctg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
static/applocation/mjhd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/applocation/mjq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

BIN
static/applocation/myzy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/applocation/qdhm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

BIN
static/applocation/sppt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/applocation/sryl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/applocation/syyl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

BIN
static/applocation/tcgg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
static/applocation/tctg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
static/applocation/xffx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/applocation/xfzq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

BIN
static/applocation/xklj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/applocation/xszk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/applocation/yqlb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

BIN
static/applocation/zhcz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

BIN
static/applocation/zkq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B