This commit is contained in:
2025-12-15 17:24:21 +08:00
6 changed files with 787 additions and 572 deletions

View File

@@ -1,5 +1,5 @@
// const debug = process.env.NODE_ENV == 'development' ? true : false; // const debug = process.env.NODE_ENV == 'development' ? true : false;
const debug = false; const debug = true; // false线上 true本地
// #ifdef H5 // #ifdef H5
const proxyApi = "/api"; const proxyApi = "/api";
// #endif // #endif
@@ -21,36 +21,36 @@ const baseUrlwws = debug ? proxyApiwws : "wss://czgeatws.sxczgkj.com/wss"; //
const version = "100"; const version = "100";
const autoRemoveCache = { const autoRemoveCache = {
count: 100000, count: 100000,
size: 100000, size: 100000,
}; };
uni.conf = { uni.conf = {
debug, debug,
baseUrl, baseUrl,
version, version,
autoRemoveCache, autoRemoveCache,
baseUrlwws, baseUrlwws,
}; };
export const changeEnv = (env) => { export const changeEnv = (env) => {
if (env === "test") { if (env === "test") {
uni.conf = { uni.conf = {
debug: true, debug: true,
baseUrl: "http://192.168.1.42", baseUrl: "http://192.168.1.42",
phpUrl:'http://192.168.1.42:8787/api/', phpUrl: 'http://192.168.1.42:8787/api/',
phpChatWx:'ws://192.168.1.42:2348', phpChatWx: 'ws://192.168.1.42:2348',
version: 100, version: 100,
autoRemoveCache, autoRemoveCache,
baseUrlwws: "ws://192.168.1.42:2348", baseUrlwws: "ws://192.168.1.42:2348",
}; };
} }
if (env === "prod") { if (env === "prod") {
uni.conf = { uni.conf = {
debug: false, debug: false,
baseUrl: "https://cashier.sxczgkj.com", baseUrl: "https://cashier.sxczgkj.com",
version: 100, version: 100,
autoRemoveCache, autoRemoveCache,
baseUrlwws: "wss://czgeatws.sxczgkj.com/wss", baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",
}; };
} }
}; };

View File

@@ -0,0 +1,230 @@
<!-- 私域引流 -->
<template>
<u-popup :show="show" mode="center" :safeAreaInsetBottom="false">
<view class="new_preview">
<view class="header">{{ shopInfo.shopName }}</view>
<view class="content">
<view class="title">{{ form.title }}</view>
<view class="img_wrap">
<image class="img" :src="form.qrCode"></image>
</view>
<view class="intro">
{{ form.content }}
</view>
<view class="foot">
{{ form.note }}
</view>
</view>
<view class="close" @click="closeHandle">
<u-icon name="close" color="#fff" size="14"></u-icon>
</view>
</view>
</u-popup>
</template>
<script setup>
import dayjs from 'dayjs';
import { ref, onMounted } from 'vue';
import { config } from '@/common/api/market/drainageConfig.js';
import { checkArrayElementsExist } from '@/utils/util.js';
const shopInfo = ref('');
const props = defineProps({
type: {
type: String,
default: 'home' // 调用的位置 home首页 order支付成功后
}
});
const show = ref(false);
const form = ref({});
const drainageHomeKey = 'drainageHome';
function closeHandle() {
switch (props.type) {
case 'home':
// 在首页关闭
switch (form.value.homeType) {
case 'only':
// 仅显示1次
uni.cache.set(drainageHomeKey, {
value: form.value.homeType
});
break;
case 'day':
// 每天显示1次
uni.cache.set(drainageHomeKey, {
value: form.value.homeType,
time: dayjs().format('YYYY-MM-DD')
});
break;
case 'every':
// 每次onload都显示
uni.cache.set(drainageHomeKey, {
value: form.value.homeType
});
break;
default:
break;
}
break;
case 'order':
break;
default:
break;
}
show.value = false;
}
// 显示逻辑
function showHandle() {
switch (props.type) {
case 'home':
// 首页
if (form.value.homeEnable == 0) return;
let drainage = uni.cache.get(drainageHomeKey);
console.log('drainage', drainage);
if (!drainage || form.value.homeType != drainage.value) {
uni.cache.set(drainageHomeKey, '');
show.value = true;
} else {
switch (drainage.value) {
case 'only':
// 存在则证明已经显示过一次,则不在显示
break;
case 'day':
// 判断是不是用一天,同一天不显示,不是同一天则显示
let localDay = drainage.time;
let currentDay = dayjs().format('YYYY-MM-DD');
if (localDay != currentDay) {
show.value = true;
}
break;
case 'every':
// 页面每次onload会触发显示
show.value = true;
break;
default:
break;
}
}
break;
case 'order':
// 订单 只要包含用餐类型就显示
let shopMode = shopInfo.value.eatModel.split(',');
if (checkArrayElementsExist(shopMode, form.value.orderType)) {
show.value = true;
}
break;
default:
break;
}
}
// 获取私域引流配置
async function configAjax() {
try {
const shopId = uni.cache.get('shopId');
const res = await config({ shopId: shopId });
form.value = res;
showHandle();
} catch (error) {
console.log(error);
}
}
defineExpose({
configAjax
});
onMounted(() => {
shopInfo.value = uni.cache.get('shopInfo');
if (props.type == 'home') {
configAjax();
}
});
</script>
<style scoped lang="scss">
.new_preview {
--bg: #3f3b37;
--color: #f6dfc4;
--borderColor: #f6dfc45b;
width: 90vw;
background-color: var(--bg);
border-radius: 4px;
position: relative;
.close {
--size: 70upx;
width: var(--size);
height: var(--size);
border-radius: 50%;
background-color: var(--bg);
display: flex;
align-items: center;
justify-content: center;
position: absolute;
bottom: calc(var(--size) * -1 - 20upx);
left: 50%;
margin-left: calc(var(--size) / 2 * -1);
}
.header {
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: var(--color);
height: 50px;
border-bottom: 1px dashed var(--borderColor);
}
.content {
padding-bottom: 14px;
.title {
font-size: 14px;
color: var(--color);
height: 50px;
display: flex;
align-items: center;
justify-content: center;
}
.img_wrap {
display: flex;
justify-content: center;
.img {
--size: 220px;
width: var(--size);
height: var(--size);
border-radius: 4px;
}
}
.intro {
height: 40px;
font-size: 14px;
color: var(--color);
display: flex;
align-items: center;
justify-content: center;
padding: 0 14px;
}
.foot {
height: 40px;
color: var(--borderColor);
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 14px;
text-align: center;
}
}
}
</style>

View File

@@ -1,114 +1,93 @@
<template> <template>
<view> <view>
<!-- 私域引流 --> <!-- 私域引流 -->
<up-popup <up-popup :show="show" mode="center" round="16rpx" closeOnClickOverlay @close="close" :safeAreaInsetBottom="false">
:show="show" <view class="preview-box">
mode="center" <view class="u-flex" style="align-items: stretch">
round="16rpx" <view class="u-flex-1 u-p-r-24 u-flex u-flex-col" style="align-items: start; justify-content: space-between">
closeOnClickOverlay <view>
@close="close" <view class="font-14 font-bold color-333">{{ drainageConfig.title }}</view>
:safeAreaInsetBottom="false" <view class="u-m-t-16 font-12 color-666">{{ drainageConfig.content }}</view>
> </view>
<view class="preview-box">
<view class="u-flex" style="align-items: stretch">
<view
class="u-flex-1 u-p-r-24 u-flex u-flex-col"
style="align-items: start; justify-content: space-between"
>
<view>
<view class="font-14 font-bold color-333">{{
drainageConfig.title
}}</view>
<view class="u-m-t-16 font-12 color-666">{{
drainageConfig.content
}}</view>
</view>
<view class="color-999 font-12 u-m-t-16">{{ <view class="color-999 font-12 u-m-t-16">{{ drainageConfig.note }}</view>
drainageConfig.note </view>
}}</view>
</view>
<image <image :show-menu-by-longpress="true" :src="drainageConfig.qrCode" style="width: 240rpx; height: 240rpx" mode="aspectFit"></image>
:show-menu-by-longpress="true" </view>
:src="drainageConfig.qrCode"
style="width: 240rpx; height: 240rpx"
mode="aspectFit"
></image>
</view>
<view class="close" @click="close"> <view class="close" @click="close">
<up-icon name="close-circle" size="34" color="#fff"></up-icon> <up-icon name="close-circle" size="34" color="#fff"></up-icon>
</view> </view>
</view> </view>
</up-popup> </up-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import * as drainageConfigApi from "@/common/api/market/drainageConfig.js"; import * as drainageConfigApi from '@/common/api/market/drainageConfig.js';
import { ref, reactive, computed, watch, onMounted } from "vue"; import { ref, reactive, computed, watch, onMounted } from 'vue';
const showPreview = defineModel({ const showPreview = defineModel({
type: Boolean, type: Boolean,
default: false, default: false
}); });
const show=ref(false); const show = ref(false);
const emit = defineEmits(["close"]); const emit = defineEmits(['close']);
function close() { function close() {
show.value = false; show.value = false;
emit("close"); emit('close');
} }
const drainageConfig = ref({}); const drainageConfig = ref({});
async function getDrainageConfig() { async function getDrainageConfig() {
const shopId = uni.cache.get("shopId"); const shopId = uni.cache.get('shopId');
const drainageConfigRes = await drainageConfigApi.config({ const drainageConfigRes = await drainageConfigApi.config({
shopId: shopId, shopId: shopId
}); });
drainageConfig.value = drainageConfigRes; drainageConfig.value = drainageConfigRes;
if (drainageConfig.value.isEnable) { if (drainageConfig.value.isEnable) {
show.value = true; show.value = true;
} else { } else {
close(); close();
} }
} }
// onMounted(() => { // onMounted(() => {
// getDrainageConfig(); // getDrainageConfig();
// }); // });
watch( watch(
() => showPreview.value, () => showPreview.value,
(newVal) => { (newVal) => {
if (newVal) { if (newVal) {
getDrainageConfig(); getDrainageConfig();
} }
} }
); );
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.u-flex-col { .u-flex-col {
flex-direction: column; flex-direction: column;
} }
.preview { .preview {
padding: 8rpx 32rpx; padding: 8rpx 32rpx;
border-radius: 12rpx; border-radius: 12rpx;
background: $my-main-color; background: $my-main-color;
color: #ffffff; color: #ffffff;
font-size: 28rpx; font-size: 28rpx;
font-weight: 400; font-weight: 400;
line-height: 40rpx; line-height: 40rpx;
} }
.preview-box { .preview-box {
width: 700rpx; width: 700rpx;
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
position: relative; position: relative;
.close { .close {
position: absolute; position: absolute;
left: 50%; left: 50%;
bottom: -100rpx; bottom: -100rpx;
transform: translateX(-50%); transform: translateX(-50%);
} }
} }
</style> </style>

View File

@@ -1,43 +1,49 @@
<template> <template>
<view> <view>
<!-- 生成公众号二维码 --> <!-- 生成公众号二维码 -->
<we-qrcode @generate="(e) => qrcodeResult(e)"></we-qrcode> <we-qrcode @generate="(e) => qrcodeResult(e)"></we-qrcode>
<officialAccount <officialAccount followIndex="order" :wechatAcQrcode="wechatAcQrcode" v-if="showOfficialAccount" @close="modelClose($event, 'officialAccount')" />
followIndex="order" <!-- <Drainage v-model="showDrainage" @close="modelClose($event, 'drainage')" /> -->
:wechatAcQrcode="wechatAcQrcode" <attractPopup type="order" ref="attractPopupRef" />
v-if="showOfficialAccount" </view>
@close="modelClose($event, 'officialAccount')"
/>
<Drainage v-model="showDrainage" @close="modelClose($event, 'drainage')" />
</view>
</template> </template>
<script setup> <script setup>
import weQrcode from "@/components/wechat-ac-qrcode.vue"; import weQrcode from '@/components/wechat-ac-qrcode.vue';
import { ref, watch, computed, reactive, toRaw } from "vue"; import attractPopup from '@/components/attract-popup.vue';
import officialAccount from "@/components/official-account.vue"; import { ref, watch, computed, reactive, toRaw } from 'vue';
import Drainage from "@/components/drainage.vue"; import officialAccount from '@/components/official-account.vue';
import Drainage from '@/components/drainage.vue';
const attractPopupRef = ref(null);
const showDrainage = defineModel({ const showDrainage = defineModel({
type: Boolean, type: Boolean,
default: false, default: false
}); });
watch(showDrainage, (newVal, oldVal) => {
console.log('modelValue 变化:', { newVal, oldVal });
if (newVal == true) {
attractPopupRef.value.configAjax();
}
});
const showOfficialAccount = ref(false); const showOfficialAccount = ref(false);
function modelClose(e, type) { function modelClose(e, type) {
console.log("modelClose", type); console.log('modelClose', type);
if (type == "drainage") { if (type == 'drainage') {
showOfficialAccount.value = true; showOfficialAccount.value = true;
return; return;
} }
} }
const wechatAcQrcode = ref(""); const wechatAcQrcode = ref('');
const userinfo = uni.cache.get("userInfo") || {}; const userinfo = uni.cache.get('userInfo') || {};
const codeVal = ref(userinfo.wechatAcQrcode || ""); const codeVal = ref(userinfo.wechatAcQrcode || '');
console.log("codeVal", codeVal.value); console.log('codeVal', codeVal.value);
function qrcodeResult(e) { function qrcodeResult(e) {
wechatAcQrcode.value = e; wechatAcQrcode.value = e;
} }
</script> </script>

View File

@@ -2,31 +2,27 @@
<view class="content min-page bg-f7"> <view class="content min-page bg-f7">
<view class="contentbox"> <view class="contentbox">
<template v-if="shopExtend.length"> <template v-if="shopExtend.length">
<image class="bg" :src="shopExtend[0].value" mode="aspectFill" <image class="bg" :src="shopExtend[0].value" mode="aspectFill" v-if="!isJsonArrayString(shopExtend[0].value)"></image>
v-if="!isJsonArrayString(shopExtend[0].value)"></image>
<swiper class="swiper" autoplay circular v-else> <swiper class="swiper" autoplay circular v-else>
<swiper-item class="swiper-item" v-for="item in JSON.parse(shopExtend[0].value)"> <swiper-item class="swiper-item" v-for="(item, index) in JSON.parse(shopExtend[0].value)" :key="index">
<image class="swiper-bg" :src="item"></image> <image class="swiper-bg" :src="item"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
</template> </template>
</view> </view>
<view class="userInfo u-flex"> <view class="userInfo u-flex">
<up-avatar size="61px" :default-url="imgs.defaultAvatar"></up-avatar> <up-avatar size="61px" :default-url="imgs.defaultAvatar"></up-avatar>
<view class="u-flex-1 u-flex u-row-between u-p-l-16 u-p-r-16"> <view class="u-flex-1 u-flex u-row-between u-p-l-16 u-p-r-16">
<view> <view>
<view class="u-flex"> <view class="u-flex">
<view class="u-font-32 color-333 font-bold u-line-1" style="max-width: 320rpx;">HI欢迎回来</view> <view class="u-font-32 color-333 font-bold u-line-1" style="max-width: 320rpx">HI欢迎回来</view>
<view class="vip" v-if="shopUserInfo.isVip">会员身份</view> <view class="vip" v-if="shopUserInfo.isVip">会员身份</view>
</view> </view>
<view class="u-m-t-10 u-font-24 color-666"> <view class="u-m-t-10 u-font-24 color-666">
<text>优惠券{{allConfig.couponNum}}</text> <text>优惠券{{ allConfig.couponNum }}</text>
<text class="u-m-l-22">积分{{allConfig.pointNum}}</text> <text class="u-m-l-22">积分{{ allConfig.pointNum }}</text>
</view> </view>
</view> </view>
<image :src="imgs.code" class="code"></image> <image :src="imgs.code" class="code"></image>
</view> </view>
@@ -52,8 +48,6 @@
<view class="desc">-自助下单 快人一步-</view> <view class="desc">-自助下单 快人一步-</view>
</view> </view>
<image :src="imgs.big_orderFood" class="big_img"></image> <image :src="imgs.big_orderFood" class="big_img"></image>
</view> </view>
<view class="groupBuying" v-if="allConfig.group"> <view class="groupBuying" v-if="allConfig.group">
@@ -90,10 +84,9 @@
<view class="title">股东共享</view> <view class="title">股东共享</view>
<view class="desc">邀请好友获得佣金</view> <view class="desc">邀请好友获得佣金</view>
</view> </view>
</view> </view>
<view style="height: 90px;"></view> <view style="height: 90px"></view>
<u-popup :show="popupShow" :safe-area-inset-bottom="false" mode="center" @close="popupShow = false"> <u-popup :show="popupShow" :safe-area-inset-bottom="false" mode="center" @close="popupShow = false">
<view class="popup-content"> <view class="popup-content">
<view class="header-wrap"> <view class="header-wrap">
@@ -112,512 +105,499 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<!-- 私域引流弹窗 -->
<attractPopup type="home" ref="attractPopupRef" />
</view> </view>
</template> </template>
<script setup> <script setup>
import { import attractPopup from '@/components/attract-popup.vue';
homeData import { homeData } from '@/common/api/market/index.js';
} from '@/common/api/market/index.js' import { getMemberConfig, getRechargeConfig } from '@/common/api/index/index.js';
import { import { ref, reactive, defineProps, defineEmits, onMounted } from 'vue';
getMemberConfig, import { isJsonArrayString } from '@/utils/util.js';
getRechargeConfig,
} from "@/common/api/index/index.js"; const attractPopupRef = ref(null);
import {
ref, const imgs = {
reactive, recharge: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/2f22c0ced494497e8d6f981832b191c9.png',
defineProps, share: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/bcb8d461e96d445ba40256079da775b3.png',
defineEmits, vip: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/cfc3bf5ba12747c6ada4d5a388aceca3.png',
onMounted orderFood: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/7c54a22d56f44813bf3f76c1a82a34f3.png',
} from "vue"; big_orderFood: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/b3c7f6139eff4a7d81482cf533ec79fa.png',
import { takeout: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/3623cbf425d845a993acb4309404a7b9.png',
isJsonArrayString groupBuying: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/117745e0f3db48b489f9d4e5c5967043.png',
} from "@/utils/util.js"; points: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/df0758f7b86449f89f882e50226e17c7.png',
const imgs = { code: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/044dcaf913054f03a9db7983f048b1e6.png',
recharge: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/2f22c0ced494497e8d6f981832b191c9.png', defaultAvatar: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/b98d2c7110e847f996e8d7ba4342f0a5.png'
share: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/bcb8d461e96d445ba40256079da775b3.png', };
vip: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/cfc3bf5ba12747c6ada4d5a388aceca3.png', // 定义接收的属性
orderFood: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/7c54a22d56f44813bf3f76c1a82a34f3.png', const props = defineProps({
big_orderFood: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/b3c7f6139eff4a7d81482cf533ec79fa.png', shopExtend: {
takeout: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/3623cbf425d845a993acb4309404a7b9.png', type: Array,
groupBuying: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/117745e0f3db48b489f9d4e5c5967043.png', default: []
points: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/df0758f7b86449f89f882e50226e17c7.png',
code: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/044dcaf913054f03a9db7983f048b1e6.png',
defaultAvatar: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/b98d2c7110e847f996e8d7ba4342f0a5.png'
} }
// 定义接收的属性 });
const props = defineProps({
shopExtend: { function toFenxiao() {
type: Array, uni.navigateTo({
default: [], url: '/distribution/shop-detail/index?shopId=' + uni.cache.get('shopId')
},
}); });
}
function toFenxiao() { function toIntegralMall() {
uni.navigateTo({ uni.navigateTo({
url: "/distribution/shop-detail/index?shopId=" + uni.cache.get("shopId"), url: '/scoreShop/index/index?shopId=' + uni.cache.get('shopId')
}); });
} }
function toIntegralMall() { import { productStore } from '@/stores/user.js';
uni.navigateTo({ import { onShow } from '@dcloudio/uni-app';
url: "/scoreShop/index/index?shopId=" + uni.cache.get("shopId"),
});
}
import { // 显示弹窗
productStore const popupShow = ref(false);
} from "@/stores/user.js"; const scanCodehandle = (i) => {
import { popupShow.value = true;
onShow };
} from '@dcloudio/uni-app';
// 显示弹窗 // 预点单
const popupShow = ref(false); function beforehandOrderHandle() {
const scanCodehandle = (i) => { popupShow.value = false;
popupShow.value = true; uni.cache.set('dinersNum', 1);
}; uni.cache.set('tableCode', shopUserInfo.id);
uni.navigateTo({
url: '/pages/product/index?type=beforehand'
});
}
// 预点单 // 扫码点餐
function beforehandOrderHandle() { async function scanOrderHandle() {
popupShow.value = false; popupShow.value = false;
uni.cache.set("dinersNum", 1); const store = productStore();
uni.cache.set("tableCode", shopUserInfo.id); await store.scanCodeactions();
uni.navigateTo({ }
url: "/pages/product/index?type=beforehand",
});
}
// 扫码点餐 const memberindex = (url) => {
async function scanOrderHandle() { uni.pro.navigateTo(url, {
popupShow.value = false; shopId: uni.cache.get('shopId'),
const store = productStore(); type: 'index'
await store.scanCodeactions(); });
} };
const shopUserInfo = reactive({});
Object.assign(shopUserInfo, uni.cache.get('shopUserInfo') || {});
const memberindex = (url) => { function tomember() {
uni.pro.navigateTo(url, { if (isMember.value) {
shopId: uni.cache.get("shopId"), const shopId = uni.cache.get('shopId');
type: "index", if (!shopUserInfo.isVip) {
});
};
const shopUserInfo = reactive({})
Object.assign(shopUserInfo, uni.cache.get("shopUserInfo") || {})
function tomember() {
if (isMember.value) {
const shopId = uni.cache.get("shopId");
if (!shopUserInfo.isVip) {
uni.navigateTo({
url: "/user/vip/buy-vip?shopId=" + shopId,
});
return;
}
uni.navigateTo({ uni.navigateTo({
url: "/user/vip/vip?shopId=" + shopId, url: '/user/vip/buy-vip?shopId=' + shopId
});
} else {
uni.showToast({
title: "暂未开放",
icon: "none",
}); });
return;
} }
uni.navigateTo({
url: '/user/vip/vip?shopId=' + shopId
});
} else {
uni.showToast({
title: '暂未开放',
icon: 'none'
});
} }
}
function toCharge() { function toCharge() {
if (isCharge.value) { if (isCharge.value) {
const shopId = uni.cache.get("shopId"); const shopId = uni.cache.get('shopId');
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/czzx?shopId=" + shopId, url: '/pages/user/member/czzx?shopId=' + shopId
}); });
} else { } else {
uni.showToast({ uni.showToast({
title: "暂未开放", title: '暂未开放',
icon: "none", icon: 'none'
}); });
}
} }
const getQueryString = (url, name) => { }
//解码 const getQueryString = (url, name) => {
var reg = new RegExp("(^|&|/?)" + name + "=([^&|/?]*)(&|/?|$)", "i"); //解码
var r = url.substr(1).match(reg); var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i');
if (r != null) { var r = url.substr(1).match(reg);
return r[2]; if (r != null) {
} return r[2];
return null;
};
// 获取会员配置
const isMember = ref(0);
const isCharge = ref(0);
async function getVipConfig() {
try {
const res1 = await getMemberConfig({
shopId: uni.cache.get("shopId")
});
const res2 = await getRechargeConfig({
shopId: uni.cache.get("shopId")
});
isMember.value = +res1.memberConfig.isOpen;
isCharge.value = +res2.isEnable;
} catch (error) {
console.log(error);
}
} }
return null;
};
// 获取会员配置
const isMember = ref(0);
const isCharge = ref(0);
async function getVipConfig() {
try {
const res1 = await getMemberConfig({
shopId: uni.cache.get('shopId')
});
const res2 = await getRechargeConfig({
shopId: uni.cache.get('shopId')
});
const allConfig = reactive({ isMember.value = +res1.memberConfig.isOpen;
takeout: 0, isCharge.value = +res2.isEnable;
group: 0, } catch (error) {
pointsMall: 0, console.log(error);
distribution: 0,
couponNum: 0,
pointNum: 0
})
function getHomeData() {
homeData().then(res => {
Object.assign(allConfig, res)
})
} }
onMounted(() => { }
updateData()
const allConfig = reactive({
takeout: 0,
group: 0,
pointsMall: 0,
distribution: 0,
couponNum: 0,
pointNum: 0
});
function getHomeData() {
homeData().then((res) => {
Object.assign(allConfig, res);
}); });
}
onMounted(() => {
updateData();
});
function updateData() { function updateData() {
Object.assign(shopUserInfo, uni.cache.get("shopUserInfo") || {}) Object.assign(shopUserInfo, uni.cache.get('shopUserInfo') || {});
getVipConfig(); getVipConfig();
getHomeData() getHomeData();
} }
defineExpose({ defineExpose({
updateData updateData
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
page { page {
background: #f6f8fa; background: #f6f8fa;
} }
.swiper { .swiper {
width: 100%;
height: 100%;
.swiper-item {
width: 100%; width: 100%;
height: 100%; height: 100%;
.swiper-item { .swiper-bg {
width: 100%; width: 100%;
height: 100%; height: 100%;
.swiper-bg {
width: 100%;
height: 100%;
}
} }
} }
}
.content { .content {
.contentbox { .contentbox {
position: relative; position: relative;
width: 100%;
height: 430rpx;
.bg {
width: 100%; width: 100%;
height: 430rpx; height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
.bg { .contentboxitem {
width: 100%; position: absolute;
height: 100%; bottom: 0;
position: absolute; width: 90%;
top: 0; left: 50%;
left: 0; transform: translate(-50%, 50%);
z-index: -1; padding: 38rpx 0 26rpx 0;
} background: rgba(255, 255, 255, 0.98);
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 20rpx 20rpx 20rpx 20rpx;
.contentboxitem { .contentboxitemleft {
position: absolute; width: 50%;
bottom: 0; border-right: 2rpx solid #623618;
width: 90%;
left: 50%;
transform: translate(-50%, 50%);
padding: 38rpx 0 26rpx 0;
background: rgba(255, 255, 255, 0.98);
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 20rpx 20rpx 20rpx 20rpx;
.contentboxitemleft { image {
width: 50%; width: 134rpx;
border-right: 2rpx solid #623618; height: 134rpx;
image {
width: 134rpx;
height: 134rpx;
}
.contentboxitemlefttextone {
margin-top: 10rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 32rpx;
color: #333333;
}
.contentboxitemlefttexttow {
margin-top: 2rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
} }
.contentboxitemright { .contentboxitemlefttextone {
width: 50%; margin-top: 10rpx;
padding: 0 34rpx; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 32rpx;
color: #333333;
}
.contentboxitemright_item:nth-child(2) { .contentboxitemlefttexttow {
margin-top: 30rpx; margin-top: 2rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
.contentboxitemright {
width: 50%;
padding: 0 34rpx;
.contentboxitemright_item:nth-child(2) {
margin-top: 30rpx;
}
.contentboxitemright_item {
image {
width: 96rpx;
height: 96rpx;
} }
.contentboxitemright_item { .contentboxitemright_itembox {
image { width: 170rpx;
width: 96rpx;
height: 96rpx; text:nth-child(1) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 32rpx;
color: #333333;
} }
.contentboxitemright_itembox { text:nth-child(2) {
width: 170rpx; margin-top: 2rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
text:nth-child(1) { font-weight: 400;
font-family: Source Han Sans CN, Source Han Sans CN; font-size: 24rpx;
font-weight: 400; color: #999999;
font-size: 32rpx;
color: #333333;
}
text:nth-child(2) {
margin-top: 2rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
} }
} }
} }
} }
} }
} }
}
.popup-content { .popup-content {
width: 90vw; width: 90vw;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
.header-wrap { .header-wrap {
height: 64px; height: 64px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
border-bottom: 1px solid #ececec; border-bottom: 1px solid #ececec;
padding: 0 28upx; padding: 0 28upx;
.t { .t {
font-size: 32upx; font-size: 32upx;
color: #333; color: #333;
}
.close {
$size: 60upx;
width: $size;
height: $size;
display: flex;
align-items: center;
justify-content: center;
}
} }
.btn-content { .close {
height: 86px; $size: 60upx;
width: $size;
height: $size;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 60upx;
.btn {
width: 248upx;
}
} }
} }
.menus { .btn-content {
height: 86px;
display: flex; display: flex;
padding: 32rpx 40rpx;
margin-top: 150rpx;
gap: 20rpx;
.menu-item {
background-color: #fff;
border-radius: 16rpx;
text-align: center;
padding: 32rpx 28rpx;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
flex: 1;
}
}
.userInfo {
display: flex;
padding: 22rpx 24rpx;
margin: 0 4rpx;
align-items: center; align-items: center;
align-self: stretch; justify-content: center;
border-radius: 24rpx; gap: 60upx;
background: #FFF;
transform: translateY(-36rpx);
.vip { .btn {
background: #FA720A; width: 248upx;
font-size: 24rpx;
color: #ffffff;
padding: 6rpx 10rpx;
margin-left: 10rpx;
border-radius: 20rpx 20rpx 20rpx 0;
}
.code {
width: 33px;
height: 33px;
} }
} }
}
.menus {
display: flex;
padding: 32rpx 40rpx;
margin-top: 150rpx;
gap: 20rpx;
.menu-item {
.new-menus-box {
margin: 0 16rpx 34rpx 16rpx;
.new-menus {
display: flex;
background-color: #fff;
border-radius: 16rpx;
align-items: center;
.icon {
width: 79px;
height: 79px;
}
&.layout2 {
padding: 29px 0;
.diner,
.takeout {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.line {
width: 2rpx;
height: 156rpx;
background: #EDEDED;
}
.takeout {}
}
&.layout1 {
padding: 36rpx 40rpx;
justify-content: space-between;
display: flex;
align-items: center;
.big_img {
width: 330rpx;
height: 330rpx;
}
.title {
font-size: 48rpx;
}
.desc {
margin-top: 20rpx;
font-size: 32rpx;
color: #999;
}
}
}
}
.groupBuying {
padding: 16rpx 38rpx;
border-top: 2rpx solid #EDEDED;
background-color: #fff; background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
.img {
width: 40px;
height: 40px;
}
}
.title {
color: #333333;
font-size: 36rpx;
font-weight: 700;
}
.desc {
margin-top: 16rpx;
font-size: 28rpx;
color: #999;
}
.points {
margin-top: 34rpx;
background-color: #fff;
padding: 16rpx 68rpx;
border-radius: 16rpx; border-radius: 16rpx;
display: flex; text-align: center;
align-items: center; padding: 32rpx 28rpx;
justify-content: space-between; box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
flex: 1;
}
}
.img { .userInfo {
width: 98px; display: flex;
height: 98px; padding: 22rpx 24rpx;
} margin: 0 4rpx;
align-items: center;
align-self: stretch;
border-radius: 24rpx;
background: #fff;
transform: translateY(-36rpx);
.vip {
background: #fa720a;
font-size: 24rpx;
color: #ffffff;
padding: 6rpx 10rpx;
margin-left: 10rpx;
border-radius: 20rpx 20rpx 20rpx 0;
} }
.bottom_menus { .code {
width: 33px;
height: 33px;
}
}
.new-menus-box {
margin: 0 16rpx 34rpx 16rpx;
.new-menus {
display: flex; display: flex;
gap: 14rpx; background-color: #fff;
margin-top: 34rpx; border-radius: 16rpx;
align-items: center;
.item { .icon {
flex: 1; width: 79px;
height: 79px;
}
&.layout2 {
padding: 29px 0;
.diner,
.takeout {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.line {
width: 2rpx;
height: 156rpx;
background: #ededed;
}
.takeout {
}
}
&.layout1 {
padding: 36rpx 40rpx;
justify-content: space-between;
display: flex; display: flex;
padding: 20rpx;
flex-direction: column;
align-items: center; align-items: center;
border-radius: 18rpx;
background: #FFF;
.img { .big_img {
width: 39px; width: 330rpx;
height: 39px; height: 330rpx;
} }
.title { .title {
font-size: 32rpx; font-size: 48rpx;
} }
.desc { .desc {
margin-top: 8rpx; margin-top: 20rpx;
font-size: 32rpx;
color: #999; color: #999;
font-size: 24rpx;
white-space: nowrap;
} }
} }
} }
</style> }
.groupBuying {
padding: 16rpx 38rpx;
border-top: 2rpx solid #ededed;
background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
.img {
width: 40px;
height: 40px;
}
}
.title {
color: #333333;
font-size: 36rpx;
font-weight: 700;
}
.desc {
margin-top: 16rpx;
font-size: 28rpx;
color: #999;
}
.points {
margin-top: 34rpx;
background-color: #fff;
padding: 16rpx 68rpx;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
.img {
width: 98px;
height: 98px;
}
}
.bottom_menus {
display: flex;
gap: 14rpx;
margin-top: 34rpx;
.item {
flex: 1;
display: flex;
padding: 20rpx;
flex-direction: column;
align-items: center;
border-radius: 18rpx;
background: #fff;
.img {
width: 39px;
height: 39px;
}
.title {
font-size: 32rpx;
}
.desc {
margin-top: 8rpx;
color: #999;
font-size: 24rpx;
white-space: nowrap;
}
}
}
</style>

View File

@@ -475,4 +475,24 @@ export function includesString(target, searchStr, options = {}) {
// 4. 执行包含判断 // 4. 执行包含判断
return processedTarget.includes(processedSearch); return processedTarget.includes(processedSearch);
}
/**
* 校验一维基础类型数组A的元素是否存在于数组B支持部分/全部存在,默认全部存在)
* @param {Array<string|number|boolean>} arrA - 待校验的一维数组
* @param {Array<string|number|boolean>} arrB - 参考的一维数组
* @param {boolean} [partial=false] - 是否校验「部分存在」true=部分存在false=全部存在默认false
* @returns {boolean} 校验结果
*/
export function checkArrayElementsExist(arrA, arrB, partial = false) {
// 边界处理:空数组特殊逻辑
if (arrA.length === 0) return !partial
// 转Set优化查找性能一维数组核心优化
const bSet = new Set(arrB)
// 核心逻辑partial=true → some部分存在partial=false → every全部存在
return partial ?
arrA.some(item => bSet.has(item)) :
arrA.every(item => bSet.has(item))
} }