This commit is contained in:
gyq
2025-09-28 19:27:18 +08:00
parent 7895455b97
commit 3243f16cff
5 changed files with 639 additions and 513 deletions

View File

@@ -28,3 +28,23 @@ export const userdict = (data) => {
toast: false toast: false
}) })
} }
// 获取当前店铺会员开通配置信息
export const getMemberConfig = (data) => {
return request({
url: '/market/user/member/config',
method: 'GET',
data: data,
toast: false
})
}
// 获取充值配置
export const getRechargeConfig = (data) => {
return request({
url: '/market/user/recharge/config',
method: 'GET',
data: data,
toast: false
})
}

View File

@@ -2,11 +2,11 @@
<template> <template>
<up-popup :show="show" bgColor="transparent"> <up-popup :show="show" bgColor="transparent">
<view class="container"> <view class="container">
<view class="content"> <view class="content" :class="`content${currentNum}`">
<image class="bg" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/6520f3cfae594480aa2e612ff4ad121c.png" mode="widthFix"></image> <image class="bg" :src="bgUrl" mode="widthFix"></image>
<view class="swiper-wrap"> <view class="swiper-wrap" :class="`swiper-wrap${currentNum}`">
<swiper class="swiper" @change="swiperChange"> <swiper class="swiper" :class="[`swiper${currentNum}`]" @change="swiperChange">
<swiper-item class="swiper-item" v-for="(item, index) in couponList" :key="index"> <swiper-item class="swiper-item" :class="[`swiper-item${currentNum}`]" v-for="(item, index) in couponList" :key="index">
<view class="item" v-for="val in item" :key="val.id"> <view class="item" v-for="val in item" :key="val.id">
<image <image
class="item-bg" class="item-bg"
@@ -54,7 +54,7 @@
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="dot-wrap"> <view class="dot-wrap" v-if="couponList.length > 1">
<view class="page-btn"> <view class="page-btn">
<up-icon name="arrow-left" :color="swiperIndex == 0 ? '#fa746a' : '#f6171b'" size="16"></up-icon> <up-icon name="arrow-left" :color="swiperIndex == 0 ? '#fa746a' : '#f6171b'" size="16"></up-icon>
</view> </view>
@@ -66,7 +66,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="btn-wrap" @click="getHandle"> <view class="btn-wrap" :class="[`btn-wrap${currentNum}`]" @click="getHandle">
<image class="btn-img" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/a7ea3211baf84cc8b77171d4f88c7f9e.png" mode="widthFix"></image> <image class="btn-img" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/a7ea3211baf84cc8b77171d4f88c7f9e.png" mode="widthFix"></image>
<text class="t">全部领取{{ couponCount }}</text> <text class="t">全部领取{{ couponCount }}</text>
</view> </view>
@@ -84,6 +84,15 @@ import dayjs from 'dayjs';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { getCouponPopup, receivePopUp } from '@/common/api/member.js'; import { getCouponPopup, receivePopUp } from '@/common/api/member.js';
const currentNum = ref(1);
const swiperCheck = ref(3);
const bgUrlList = ref({
1: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/0/20c159a4cd664d8a843d82eb9b5a5e0e.png',
2: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/0/d6b11e76f03b495d84f07791b3ce1c3e.png',
3: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/0/f41a5bffdc1c474eb5bb41ed0035c91b.png'
});
const bgUrl = ref('');
const couponCount = ref(0); const couponCount = ref(0);
const swiperIndex = ref(0); const swiperIndex = ref(0);
const couponList = ref([]); const couponList = ref([]);
@@ -114,12 +123,24 @@ async function getCouponPopupAjax() {
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
} }
}); });
console.log('res===', res);
show.value = true; show.value = true;
couponCount.value = res.length; couponCount.value = res.length;
couponList.value = _.chunk(res, 3); couponList.value = _.chunk(res, swiperCheck.value);
console.log('couponList.value===', couponList.value);
console.log('couponList.value[0].length===', couponList.value[0].length);
if (couponList.value[0].length >= swiperCheck.value) {
bgUrl.value = bgUrlList.value[3];
currentNum.value = 3;
}
if (couponList.value[0].length == 2) {
bgUrl.value = bgUrlList.value[2];
currentNum.value = 2;
}
if (couponList.value[0].length <= 1) {
bgUrl.value = bgUrlList.value[1];
currentNum.value = 1;
}
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@@ -163,7 +184,9 @@ onMounted(() => {
.content { .content {
width: 94vw; width: 94vw;
position: relative; position: relative;
&.content3 {
padding-left: 24upx; padding-left: 24upx;
}
.close { .close {
position: absolute; position: absolute;
left: 50%; left: 50%;
@@ -179,19 +202,43 @@ onMounted(() => {
height: 70%; height: 70%;
position: absolute; position: absolute;
left: 18%; left: 18%;
&.swiper-wrap1 {
top: 162upx;
}
&.swiper-wrap2 {
top: 140upx;
}
&.swiper-wrap3 {
top: 96upx; top: 96upx;
}
.swiper { .swiper {
width: 100%; width: 100%;
height: 90%;
background-color: #fff; background-color: #fff;
&.swiper1 {
height: 44%;
}
&.swiper2 {
height: 70%;
}
&.swiper3 {
height: 90%;
}
.swiper-item { .swiper-item {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: grid; display: grid;
grid-template-columns: 1fr; grid-template-columns: 1fr;
grid-template-rows: repeat(3, 1fr);
grid-column-gap: 0; grid-column-gap: 0;
grid-row-gap: 12upx; grid-row-gap: 12upx;
&.swiper-item1 {
grid-template-rows: repeat(1, 1fr);
}
&.swiper-item2 {
grid-template-rows: repeat(2, 1fr);
}
&.swiper-item3 {
grid-template-rows: repeat(3, 1fr);
}
.item { .item {
background-color: #e20410; background-color: #e20410;
border-radius: 12upx; border-radius: 12upx;
@@ -315,7 +362,15 @@ onMounted(() => {
width: 60%; width: 60%;
position: absolute; position: absolute;
left: 20%; left: 20%;
&.btn-wrap1 {
bottom: 74upx;
}
&.btn-wrap2 {
bottom: 74upx;
}
&.btn-wrap3 {
bottom: 38upx; bottom: 38upx;
}
.btn-img { .btn-img {
width: 100%; width: 100%;
} }

View File

@@ -125,7 +125,7 @@
<up-loadmore :status="formhomelist.status" fontSize="14" color="#999" iconSize="14" /> <up-loadmore :status="formhomelist.status" fontSize="14" color="#999" iconSize="14" />
</view> --> </view> -->
</view> </view>
<indexs v-if="showindex == 'shopIndex'" :shopExtend="orderVIP.shopExtendList"></indexs> <indexs ref="indexsRef" v-if="showindex == 'shopIndex'" :shopExtend="orderVIP.shopExtendList"></indexs>
<!-- <CouponModal></CouponModal> --> <!-- <CouponModal></CouponModal> -->
</view> </view>
</template> </template>
@@ -319,6 +319,9 @@ onPageScroll((res) => {
isSticky.value = res.scrollTop > elementTop.value ? true : false; isSticky.value = res.scrollTop > elementTop.value ? true : false;
uni.$u.debounce((store.scrollTop = res.scrollTop), 500); uni.$u.debounce((store.scrollTop = res.scrollTop), 500);
}); });
const indexsRef = ref(null);
onShow(async () => { onShow(async () => {
try { try {
uni.getLocation({ uni.getLocation({
@@ -343,6 +346,8 @@ onShow(async () => {
} }
} }
}); });
indexsRef.value.getVipConfig();
} catch (error) { } catch (error) {
try { try {
let successres = await APIgeocodelocation({ let successres = await APIgeocodelocation({

View File

@@ -1,11 +1,16 @@
<template> <template>
<view class="content"> <view class="content">
<view class="contentbox" <view
:style="'background:url('+(shopExtend?shopExtend[0].value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png')+') no-repeat center center / cover' "> class="contentbox"
:style="
'background:url(' +
(shopExtend ? shopExtend[0].value : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png') +
') no-repeat center center / cover'
"
>
<view class="contentboxitem flex-between"> <view class="contentboxitem flex-between">
<view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)"> <view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill"> <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill"></image>
</image>
<text class="contentboxitemlefttextone">点餐</text> <text class="contentboxitemlefttextone">点餐</text>
<text class="contentboxitemlefttexttow">在线点不排队</text> <text class="contentboxitemlefttexttow">在线点不排队</text>
</view> </view>
@@ -13,8 +18,7 @@
<!-- <view class="contentboxitemright_item flex-between" <!-- <view class="contentboxitemright_item flex-between"
@click="memberindex('user/member/memberdetails')"> --> @click="memberindex('user/member/memberdetails')"> -->
<view class="contentboxitemright_item flex-between" @click="tomember"> <view class="contentboxitemright_item flex-between" @click="tomember">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xvip.png" mode="aspectFill"> <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xvip.png" mode="aspectFill"></image>
</image>
<view class="contentboxitemright_itembox flex-colum"> <view class="contentboxitemright_itembox flex-colum">
<text>会员</text> <text>会员</text>
<text>入会享权益</text> <text>入会享权益</text>
@@ -25,8 +29,7 @@
> --> > -->
<view class="contentboxitemright_item flex-between" @click="toCharge"> <view class="contentboxitemright_item flex-between" @click="toCharge">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xchong.png" <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xchong.png" mode="aspectFill"></image>
mode="aspectFill"></image>
<view class="contentboxitemright_itembox flex-colum"> <view class="contentboxitemright_itembox flex-colum">
<text>充值</text> <text>充值</text>
<text>充值享更多优惠</text> <text>充值享更多优惠</text>
@@ -39,74 +42,105 @@
</template> </template>
<script setup> <script setup>
import { import { getMemberConfig, getRechargeConfig } from '@/common/api/index/index.js';
ref, import { ref, reactive, defineProps, defineEmits, onMounted } from 'vue';
reactive,
defineProps,
defineEmits
} from 'vue';
// 定义接收的属性 // 定义接收的属性
const props = defineProps({ const props = defineProps({
shopExtend: { shopExtend: {
type: Array, type: Array,
default: [] default: []
} }
}); });
import { import { productStore } from '@/stores/user.js';
productStore
} from '@/stores/user.js';
const scanCodehandle = async (i) => { const scanCodehandle = async (i) => {
const store = productStore(); const store = productStore();
await store.scanCodeactions() await store.scanCodeactions();
} };
const memberindex = (url) => {
const memberindex = (url) => {
uni.pro.navigateTo(url, { uni.pro.navigateTo(url, {
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId'),
type: 'index', type: 'index'
}) });
} };
function tomember() { function tomember() {
const shopUserInfo = uni.cache.get('shopUserInfo')||{} if (isMember.value) {
const shopId = uni.cache.get('shopId') const shopUserInfo = uni.cache.get('shopUserInfo') || {};
if(!shopUserInfo.isVip){ const shopId = uni.cache.get('shopId');
if (!shopUserInfo.isVip) {
uni.navigateTo({ uni.navigateTo({
url: '/user/vip/buy-vip?shopId=' + shopId url: '/user/vip/buy-vip?shopId=' + shopId
}) });
return return;
} }
uni.navigateTo({ uni.navigateTo({
url: '/user/vip/vip?shopId=' + shopId url: '/user/vip/vip?shopId=' + shopId
}) });
} else {
uni.showToast({
title: '暂未开放',
icon: 'none'
});
} }
}
function toCharge() { function toCharge() {
const shopId = uni.cache.get('shopId') if (isCharge.value) {
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 {
uni.showToast({
title: '暂未开放',
icon: 'none'
});
} }
const getQueryString = (url, name) => { //解码 }
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i') const getQueryString = (url, name) => {
var r = url.substr(1).match(reg) //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i');
var r = url.substr(1).match(reg);
if (r != null) { if (r != null) {
return r[2] return r[2];
} }
return null; 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);
} }
}
onMounted(() => {
getVipConfig();
});
defineExpose({
getVipConfig
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
page { page {
background: #F6F8FA; background: #f6f8fa;
} }
.content { .content {
.contentbox { .contentbox {
position: relative; position: relative;
width: 100%; width: 100%;
@@ -182,10 +216,9 @@
color: #999999; color: #999999;
} }
} }
}
} }
} }
} }
} }
}
</style> </style>

View File

@@ -1,17 +1,23 @@
<template> <template>
<view class="container"> <view class="container">
<image class="topBack" <image
:src="userInfo.shopExtendList?(userInfo.shopExtendList[1].value?userInfo.shopExtendList[1].value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'):'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'" class="topBack"
mode="aspectFill"></image> :src="
userInfo.shopExtendList
? userInfo.shopExtendList[1].value
? userInfo.shopExtendList[1].value
: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'
: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'
"
mode="aspectFill"
></image>
<view class="myContent"> <view class="myContent">
<view class="my_info flex-between"> <view class="my_info flex-between">
<view class="my_info_left"> <view class="my_info_left">
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image> <image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
<view class="name">{{userInfo.nickName}}</view> <view class="name">{{ userInfo.nickName }}</view>
</view> </view>
<image class="my_info_right_qr" src="/static/icon/code.png" mode="aspectFill"> <image class="my_info_right_qr" src="/static/icon/code.png" mode="aspectFill"></image>
</image>
<!-- <image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1 && ShopId" <!-- <image class="my_info_right_qr" @click="clickEvent" v-if="userInfo.isVip == 1 && ShopId"
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill"> :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_qRcode.png'" mode="aspectFill">
@@ -19,7 +25,6 @@
<view class="my_info_right" @click="clickEvent" v-if="userInfo.isVip == 0 && ShopId"> <view class="my_info_right" @click="clickEvent" v-if="userInfo.isVip == 0 && ShopId">
<text>免费入会</text> <text>免费入会</text>
</view> --> </view> -->
</view> </view>
<up-gap height="26rpx" bg-color="#F9F9F9"></up-gap> <up-gap height="26rpx" bg-color="#F9F9F9"></up-gap>
@@ -29,33 +34,27 @@
<view class="amount"> <view class="amount">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image style="width: 50rpx;height: 37rpx;" <image style="width: 50rpx; height: 37rpx" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png" mode="aspectFill"></image>
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png"
mode="aspectFill">
</image>
<text class="color-333 font-14 u-m-l-20">储值</text> <text class="color-333 font-14 u-m-l-20">储值</text>
</view> </view>
<view class="u-flex color-666" @click="toChargeList"> <view class="u-flex color-666" @click="toChargeList">
<text class="font-12 u-m-r-4">{{rechargeTotal}}家店</text> <text class="font-12 u-m-r-4">{{ rechargeTotal }}家店</text>
<up-icon name="arrow-down" color="#666" size="12px"></up-icon> <up-icon name="arrow-down" color="#666" size="12px"></up-icon>
</view> </view>
</view> </view>
<view class="card-list"> <view class="card-list">
<view class="card-list-item" v-for="(item,index) in rechargeList" :key="index" <view class="card-list-item" v-for="(item, index) in rechargeList" :key="index" @click="toCharge(item)">
@click="toCharge(item)"> <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
<up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"> </up-image>
<view class="info text-center"> <view class="info text-center">
<view class="color-333 u-m-t-14 "> <view class="color-333 u-m-t-14">
<text class="font-10">¥</text> <text class="font-10">¥</text>
<text class="font-16 font-700 ">{{item.amount}}</text> <text class="font-16 font-700">{{ item.amount || '0.00' }}</text>
</view> </view>
<view class="font-12 color-666 u-line-1">{{item.shopName}}</view> <view class="font-12 color-666 u-line-1">{{ item.shopName }}</view>
</view> </view>
</view> </view>
<view class="u-flex u-flex-column u-flex-center" style="width: 12px;" v-if="rechargeList.length" <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="rechargeList.length" @click="toChargeList">
@click="toChargeList">
<view class="text-center color-333 font-12">查看全部</view> <view class="text-center color-333 font-12">查看全部</view>
</view> </view>
</view> </view>
@@ -63,44 +62,65 @@
<view class="vip u-m-t-40"> <view class="vip u-m-t-40">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image style="width: 50rpx;height: 40rpx;" src="/static/icon/vip.png" mode="aspectFill"> <image style="width: 50rpx; height: 40rpx" src="/static/icon/vip.png" mode="aspectFill"></image>
</image>
<text class="color-333 font-14 u-m-l-20">会员</text> <text class="color-333 font-14 u-m-l-20">会员</text>
</view> </view>
<view class="u-flex color-666" @click="tomemberList"> <view class="u-flex color-666" @click="tomemberList">
<text class="font-12 u-m-r-4">{{memberTotal}}家店</text> <text class="font-12 u-m-r-4">{{ memberTotal }}家店</text>
<up-icon name="arrow-down" color="#666" size="12px"></up-icon> <up-icon name="arrow-down" color="#666" size="12px"></up-icon>
</view> </view>
</view> </view>
<view class="card-list"> <view class="card-list">
<view class="card-list-item" v-for="(item,index) in memberList" :key="index" <view class="card-list-item" v-for="(item, index) in memberList" :key="index" @click="tomember(item)">
@click="tomember(item)">
<up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image> <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
<view class="info text-center"> <view class="info text-center">
<view class="font-12 color-666 u-m-t-14 u-line-1">{{item.shopName}}</view> <view class="font-12 color-666 u-m-t-14 u-line-1">{{ item.shopName }}</view>
</view> </view>
</view> </view>
<view class="u-flex u-flex-column u-flex-center" style="width: 12px;" v-if="memberList.length"> <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="memberList.length">
<view class="text-center color-333 font-12" @click="tomemberList">查看全部</view> <view class="text-center color-333 font-12" @click="tomemberList">查看全部</view>
</view> </view>
</view> </view>
</view>
<view class="amount">
<view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex">
<image style="width: 50rpx; height: 44rpx" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png" mode="aspectFill"></image>
<text class="color-333 font-14 u-m-l-20">积分</text>
</view>
<view class="u-flex color-666" @click="toCoin">
<text class="font-12 u-m-r-4">{{ coinTotal }}家店</text>
<up-icon name="arrow-down" color="#666" size="12px"></up-icon>
</view>
</view> </view>
<view class="card-list">
<view class="card-list-item" v-for="(item, index) in coinList" :key="index" @click="toCoin(item)">
<up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
<view class="info text-center">
<view class="color-333 u-m-t-14">
<text class="font-10">¥</text>
<text class="font-16 font-700">{{ item.accountPoints || '0.00' }}</text>
</view>
<view class="font-12 color-666 u-line-1">{{ item.shopName }}</view>
</view>
</view>
<view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="coinList.length" @click="toCoin">
<view class="text-center color-333 font-12">查看全部</view>
</view>
</view>
</view>
</view> </view>
<view class="my_item my_fun u-m-t-30"> <view class="my_item my_fun u-m-t-30">
<view class="my_fun_list"> <view class="my_fun_list">
<view class="my_list_item" v-for="(item,index) in myFunList" :key="index" <view class="my_list_item" v-for="(item, index) in myFunList" :key="index" @click="clickTo(item, index)">
@click="clickTo(item,index)">
<view class="my_list_item_left"> <view class="my_list_item_left">
<image class="my_list_item_icon" :src="item.icon" mode="aspectFill"></image> <image class="my_list_item_icon" :src="item.icon" mode="aspectFill"></image>
<view class="my_list_item_name">{{item.name}}</view> <view class="my_list_item_name">{{ item.name }}</view>
</view> </view>
<view class="my_list_item_right u-flex "> <view class="my_list_item_right u-flex">
<text v-if="item.type=='score'" class="font-12 ">{{userInfo.accountPoints || 0}}</text> <text v-if="item.type == 'score'" class="font-12">{{ userInfo.accountPoints || 0 }}</text>
<!-- <text v-else-if="item.type=='my_coupon'" class="font-12 ">{{userInfo.couponNum || 0}}</text> --> <!-- <text v-else-if="item.type=='my_coupon'" class="font-12 ">{{userInfo.couponNum || 0}}</text> -->
<text class="font-12 color-999" v-else>查看</text> <text class="font-12 color-999" v-else>查看</text>
<u-icon class="u-m-t-2" name="arrow-right" color="#999999" size="12"></u-icon> <u-icon class="u-m-t-2" name="arrow-right" color="#999999" size="12"></u-icon>
@@ -108,43 +128,31 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { ref, computed, onMounted, reactive } from 'vue';
ref, import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
computed, import { productStore } from '@/stores/user.js';
onMounted, import * as vipApi from '@/common/api/market/vip.js';
reactive import * as rechargeApi from '@/common/api/market/recharge.js';
} from "vue"; import { pointsShopList } from '@/common/api/account/points.js';
import {
onLoad,
onReady,
onShow
} from '@dcloudio/uni-app'
import {
productStore
} from '@/stores/user.js';
import * as vipApi from '@/common/api/market/vip.js'
import * as rechargeApi from '@/common/api/market/recharge.js'
const store = productStore();
const store = productStore(); const myFunList = ref([
const myFunList = ref([{ // {
name: "积分", // name: "积分",
type: "score", // type: "score",
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png", // icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png",
url: '/user/score/list' // url: '/user/score/list'
}, // },
{ {
name: "优惠券", name: '优惠券',
type: "my_coupon", type: 'my_coupon',
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_coupon.png" icon: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_coupon.png'
}, }
// { // {
// name: "我的订单", // name: "我的订单",
// type: "my_order", // type: "my_order",
@@ -162,40 +170,39 @@
// icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_member.png" // icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_member.png"
// }, // },
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"}, // { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
]) ]);
const userInfo = reactive({}) const userInfo = reactive({});
const ShopId = ref(uni.cache.get('shopId')) const ShopId = ref(uni.cache.get('shopId'));
console.log('ShopId', uni.cache.get('shopId')) console.log('ShopId', uni.cache.get('shopId'));
function tomemberList() { function tomemberList() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/member/list' url: '/pages/user/member/list'
}) });
} }
function tomember(item) { function tomember(item) {
uni.navigateTo({ uni.navigateTo({
url: '/user/vip/vip?shopId=' + item.shopId url: '/user/vip/vip?shopId=' + item.shopId
}) });
} }
const clickEvent = () => { const clickEvent = () => {
if (ShopId.value) { if (ShopId.value) {
if (!userInfo.isVip) { if (!userInfo.isVip) {
uni.navigateTo({ uni.navigateTo({
url: '/user/vip/buy-vip?shopId=' + ShopId.value url: '/user/vip/buy-vip?shopId=' + ShopId.value
}) });
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: '/user/vip/vip?shopId=' + ShopId.value url: '/user/vip/vip?shopId=' + ShopId.value
}) });
} }
// if (userInfo.isVip == 0) { // if (userInfo.isVip == 0) {
// uni.pro.navigateTo('user/member/memberdetails', { // uni.pro.navigateTo('user/member/memberdetails', {
// shopId: uni.cache.get('shopId') // shopId: uni.cache.get('shopId')
// }) // })
@@ -208,130 +215,143 @@
} else { } else {
uni.pro.navigateTo('member/list', { uni.pro.navigateTo('member/list', {
type: 'user_payCode' type: 'user_payCode'
}) });
}
} }
};
// 我的资产 // 我的资产
const Myassets = () => { const Myassets = () => {
if (uni.cache.get('shopId')) { if (uni.cache.get('shopId')) {
uni.pro.navigateTo('user/member/memberdetails', { uni.pro.navigateTo('user/member/memberdetails', {
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId'),
type: 'index' type: 'index'
}) });
} else { } else {
uni.pro.navigateTo('user/member/list', { uni.pro.navigateTo('user/member/list', {
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId'),
type: 'index' type: 'index'
}) });
}
} }
};
function toCharge(item) { function toCharge(item) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/member/czzx?shopId=' + item.shopId url: '/pages/user/member/czzx?shopId=' + item.shopId
}) });
} }
function toChargeList() { function toChargeList() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/member/amount-list' url: '/pages/user/member/amount-list'
}) });
} }
const clickTo = (item, index) => {
const clickTo = (item, index) => {
if (item.url) { if (item.url) {
uni.navigateTo({ uni.navigateTo({
url:item.url url: item.url
}) });
return return;
} }
let shopId = null; let shopId = null;
switch (item.type) { switch (item.type) {
case 'my_order': case 'my_order':
uni.pro.switchTab('order/index') uni.pro.switchTab('order/index');
break break;
case 'my_member': case 'my_member':
uni.pro.navigateTo('user/member/list') uni.pro.navigateTo('user/member/list');
break break;
case 'recharge': case 'recharge':
if (uni.cache.get('shopId') && uni.cache.get('token')) { if (uni.cache.get('shopId') && uni.cache.get('token')) {
uni.pro.navigateTo('member/index', { uni.pro.navigateTo('member/index', {
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId'),
type: 'index', type: 'index'
}) });
} else { } else {
uni.pro.navigateTo('member/list', { uni.pro.navigateTo('member/list', {
type: 'user_recharge' type: 'user_recharge'
}) });
} }
break break;
case 'points': //积分 case 'points': //积分
if (uni.cache.get('shopId') && uni.cache.get('token')) { if (uni.cache.get('shopId') && uni.cache.get('token')) {
uni.pro.navigateTo('/pagesPoints/index/index', { uni.pro.navigateTo('/pagesPoints/index/index', {
shopId: uni.cache.get('shopId'), shopId: uni.cache.get('shopId'),
type: 'user', type: 'user'
}) });
} else { } else {
uni.pro.navigateTo('member/list', { uni.pro.navigateTo('member/list', {
type: 'user_points' type: 'user_points'
}) });
} }
break; break;
case 'my_coupon': //优惠券 case 'my_coupon': //优惠券
uni.pro.navigateTo('user/coupon', { uni.pro.navigateTo('user/coupon', {
shopId: uni.cache.get('shopId') || '' shopId: uni.cache.get('shopId') || ''
}) });
break; break;
case 'myself': //内部页面 case 'myself': //内部页面
uni.pro.navigateTo('user/myself') uni.pro.navigateTo('user/myself');
break; break;
case 'scan_applet': case 'scan_applet':
uni.navigateToMiniProgram(JSON.parse(item.value)) uni.navigateToMiniProgram(JSON.parse(item.value));
break break;
case 'absolute': //外链url case 'absolute': //外链url
uni.navigateTo({ uni.navigateTo({
url: `/pages/webview/webview?url=${item.menuUrl}` url: `/pages/webview/webview?url=${item.menuUrl}`
}); });
break; break;
} }
} };
const memberList = ref([]) const memberList = ref([]);
const rechargeList = ref([]) const rechargeList = ref([]);
const memberTotal=ref(0) const memberTotal = ref(0);
const rechargeTotal=ref(0) const rechargeTotal = ref(0);
async function getData() {
const res = await vipApi.list() const coinTotal = ref(0);
memberTotal.value=res.length const coinList = ref([]);
async function getData() {
const res = await vipApi.list();
memberTotal.value = res.length;
memberList.value = res.slice(0, 3); memberList.value = res.slice(0, 3);
const res1 = await rechargeApi.list() const res1 = await rechargeApi.list();
rechargeTotal.value=res1.length rechargeTotal.value = res1.length;
rechargeList.value = res1.slice(0, 3); rechargeList.value = res1.slice(0, 3);
}
onShow(() => { const res3 = await pointsShopList();
store.actionsAPIuser() coinTotal.value = res3.length;
coinList.value = res3;
}
function toCoin() {
uni.navigateTo({
url: '/user/score/list'
});
}
onShow(() => {
store.actionsAPIuser();
if (uni.cache.get('shopId')) { if (uni.cache.get('shopId')) {
Object.assign(userInfo, uni.cache.get('orderVIP')) Object.assign(userInfo, uni.cache.get('orderVIP'));
} else { } else {
Object.assign(userInfo, { Object.assign(userInfo, {
...uni.cache.get('userInfo'), ...uni.cache.get('userInfo'),
...uni.cache.get('userInfo').assetsSummary ...uni.cache.get('userInfo').assetsSummary
}) });
} }
getData() getData();
}) });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.topBack { .topBack {
width: 100%; width: 100%;
height: 400rpx; height: 400rpx;
position: absolute; position: absolute;
} }
.myContent { .myContent {
position: relative; position: relative;
z-index: 1; z-index: 1;
padding: 298rpx 0 0 0; padding: 298rpx 0 0 0;
@@ -363,7 +383,7 @@
.my_info_right { .my_info_right {
width: 136rpx; width: 136rpx;
height: 48rpx; height: 48rpx;
background-color: #E3AD7F; background-color: #e3ad7f;
border-radius: 24rpx; border-radius: 24rpx;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -372,7 +392,7 @@
text { text {
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #ffffff;
} }
} }
@@ -380,11 +400,8 @@
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
} }
} }
.my_item { .my_item {
background-color: #fff; background-color: #fff;
padding: 0 32rpx; padding: 0 32rpx;
@@ -429,8 +446,7 @@
.my_list_item_num { .my_list_item_num {
font-weight: 400; font-weight: 400;
font-size: 20rpx; font-size: 20rpx;
color: #E3AD7F; color: #e3ad7f;
} }
} }
} }
@@ -450,7 +466,7 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 24rpx 0 26rpx 0; padding: 24rpx 0 26rpx 0;
border-bottom: 1rpx solid #E5E5E5; border-bottom: 1rpx solid #e5e5e5;
.my_list_item_left { .my_list_item_left {
display: flex; display: flex;
@@ -475,12 +491,9 @@
} }
} }
} }
} }
.card-list {
.card-list {
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
column-gap: 40rpx; column-gap: 40rpx;
@@ -497,5 +510,5 @@
overflow: hidden; overflow: hidden;
} }
} }
} }
</style> </style>