Merge remote-tracking branch 'refs/remotes/yudao/master'

This commit is contained in:
puhui999
2024-08-14 11:49:22 +08:00
12 changed files with 623 additions and 505 deletions
+13 -1
View File
@@ -199,6 +199,7 @@
/** /**
* 去参团 * 去参团
*
* @param record 团长的团购记录 * @param record 团长的团购记录
*/ */
function onJoinGroupon(record) { function onJoinGroupon(record) {
@@ -227,7 +228,6 @@
} }
// 分享信息 // 分享信息
// TODO @芋艿:分享的接入
const shareInfo = computed(() => { const shareInfo = computed(() => {
if (isEmpty(state.activity)) return {}; if (isEmpty(state.activity)) return {};
return sheep.$platform.share.getShareInfo( return sheep.$platform.share.getShareInfo(
@@ -262,9 +262,21 @@
// 加载商品信息 // 加载商品信息
const { data: spu } = await SpuApi.getSpuDetail(activity.spuId); const { data: spu } = await SpuApi.getSpuDetail(activity.spuId);
state.goodsId = spu.id; state.goodsId = spu.id;
// 默认显示最低价
activity.products.forEach((product) => { activity.products.forEach((product) => {
spu.price = Math.min(spu.price, product.combinationPrice); // 设置 SPU 的最低价格 spu.price = Math.min(spu.price, product.combinationPrice); // 设置 SPU 的最低价格
}); });
// 价格、库存使用活动的
spu.skus.forEach((sku) => {
const product = activity.products.find((product) => product.skuId === sku.id);
if (product) {
sku.price = product.combinationPrice;
} else {
// 找不到可能是没配置,则不能发起秒杀
sku.stock = 0;
}
});
// 关闭骨架屏 // 关闭骨架屏
state.skeletonLoading = false; state.skeletonLoading = false;
if (code === 0) { if (code === 0) {
+3 -2
View File
@@ -196,7 +196,7 @@
}); });
} }
// 分享信息 TODO 芋艿:待接入 // 分享信息
const shareInfo = computed(() => { const shareInfo = computed(() => {
if (isEmpty(unref(activity))) return {}; if (isEmpty(unref(activity))) return {};
return sheep.$platform.share.getShareInfo( return sheep.$platform.share.getShareInfo(
@@ -220,6 +220,7 @@
const activity = ref(); const activity = ref();
const timeStatusEnum = ref(''); const timeStatusEnum = ref('');
// 查询活动 // 查询活动
const getActivity = async (id) => { const getActivity = async (id) => {
const { data } = await SeckillApi.getSeckillActivity(id); const { data } = await SeckillApi.getSeckillActivity(id);
@@ -230,9 +231,9 @@
await getSpu(data.spuId); await getSpu(data.spuId);
}; };
// 查询商品
const getSpu = async (id) => { const getSpu = async (id) => {
const { data } = await SpuApi.getSpuDetail(id); const { data } = await SpuApi.getSpuDetail(id);
// 模拟
data.activity_type = 'seckill'; data.activity_type = 'seckill';
state.goodsInfo = data; state.goodsInfo = data;
// 处理轮播图 // 处理轮播图
+6 -5
View File
@@ -131,12 +131,13 @@
getGoodsList(); getGoodsList();
} }
onLoad(async () => { onLoad(async (params) => {
await getList(); await getList();
// 如果是 first 风格,需要加载商品分页
if (state.style === 'first_one' || state.style === 'first_two') { // 首页点击分类的处理:查找满足条件的分类
onMenu(0); const foundCategory = state.categoryList.find(category => category.id === params.id);
} // 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类
onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0);
}); });
onReachBottom(() => { onReachBottom(() => {
@@ -9,7 +9,7 @@
<!-- 基础组件列表导航 --> <!-- 基础组件列表导航 -->
<s-menu-list v-if="type === 'MenuList'" :data="data" /> <s-menu-list v-if="type === 'MenuList'" :data="data" />
<!-- 基础组件宫格导航 --> <!-- 基础组件宫格导航 -->
<s-menu-grid v-if="type === 'MenuGrid'" :data="data" /> <s-menu-grid v-if="type === 'MenuGrid'" :data="data" :styles="styles" />
<!-- 基础组件弹窗广告 --> <!-- 基础组件弹窗广告 -->
<s-popup-image v-if="type === 'Popover'" :data="data" /> <s-popup-image v-if="type === 'Popover'" :data="data" />
<!-- 基础组件悬浮按钮 --> <!-- 基础组件悬浮按钮 -->
@@ -47,13 +47,13 @@
<s-richtext-block v-if="type === 'PromotionArticle'" :data="data" :styles="styles" /> <s-richtext-block v-if="type === 'PromotionArticle'" :data="data" :styles="styles" />
<!-- 用户组件用户卡片 --> <!-- 用户组件用户卡片 -->
<s-user-card v-if="type === 'UserCard'" /> <s-user-card v-if="type === 'UserCard'" :data="data" :styles="styles" />
<!-- 用户组件用户订单 --> <!-- 用户组件用户订单 -->
<s-order-card v-if="type === 'UserOrder'" :data="data" /> <s-order-card v-if="type === 'UserOrder'" :data="data" :styles="styles" />
<!-- 用户组件用户资产 --> <!-- 用户组件用户资产 -->
<s-wallet-card v-if="type === 'UserWallet'" /> <s-wallet-card v-if="type === 'UserWallet'" :data="data" :styles="styles" />
<!-- 用户组件用户卡券 --> <!-- 用户组件用户卡券 -->
<s-coupon-card v-if="type === 'UserCoupon'" /> <s-coupon-card v-if="type === 'UserCoupon'" :data="data" :styles="styles" />
</view> </view>
</template> </template>
@@ -1,6 +1,6 @@
<!-- 装修用户组件用户卡券 --> <!-- 装修用户组件用户卡券 -->
<template> <template>
<view class="ss-coupon-menu-wrap ss-flex ss-col-center"> <view class="ss-coupon-menu-wrap ss-flex ss-col-center" :style="[bgStyle, { marginLeft: `${data.space}px` }]">
<view class="menu-item ss-flex-col ss-row-center ss-col-center" v-for="item in props.list" :key="item.title" <view class="menu-item ss-flex-col ss-row-center ss-col-center" v-for="item in props.list" :key="item.title"
@tap="sheep.$router.go(item.path, { type: item.type })" @tap="sheep.$router.go(item.path, { type: item.type })"
:class="item.type === 'all' ? 'menu-wallet' : 'ss-flex-1'"> :class="item.type === 'all' ? 'menu-wallet' : 'ss-flex-1'">
@@ -15,6 +15,7 @@
* 装修组件 - 优惠券菜单 * 装修组件 - 优惠券菜单
*/ */
import sheep from '@/sheep'; import sheep from '@/sheep';
import { computed } from 'vue';
// 接收参数 // 接收参数
const props = defineProps({ const props = defineProps({
@@ -52,6 +53,28 @@
]; ];
}, },
}, },
// 装修数据
data: {
type: Object,
default: () => ({}),
},
// 装修样式
styles: {
type: Object,
default: () => ({}),
},
});
// 设置背景样式
const bgStyle = computed(() => {
// 直接从 props.styles 解构
const { bgType, bgImg, bgColor } = props.styles;
// 根据 bgType 返回相应的样式
return {
background: bgType === 'img'
? `url(${bgImg}) no-repeat top center / 100% 100%`
: bgColor
};
}); });
</script> </script>
@@ -1,61 +1,31 @@
<!-- 装修基础组件菜单导航金刚区 --> <!-- 装修基础组件菜单导航金刚区 -->
<template> <template>
<!-- 包裹层 --> <!-- 包裹层 -->
<view <view class="ui-swiper" :class="[props.mode, props.ui]"
class="ui-swiper" :style="[bgStyle, { height: swiperHeight + (menuList.length > 1 ? 50 : 0) + 'rpx' }]">
:class="[props.mode, props.bg, props.ui]"
:style="[{ height: swiperHeight + (menuList.length > 1 ? 50 : 0) + 'rpx' }]"
>
<!-- 轮播 --> <!-- 轮播 -->
<swiper <swiper :circular="props.circular" :current="state.cur" :autoplay="props.autoplay" :interval="props.interval"
:circular="props.circular" :duration="props.duration" :style="[{ height: swiperHeight + 'rpx' }]" @change="swiperChange">
:current="state.cur" <swiper-item v-for="(arr, index) in menuList" :key="index" :class="{ cur: state.cur == index }">
:autoplay="props.autoplay"
:interval="props.interval"
:duration="props.duration"
:style="[{ height: swiperHeight + 'rpx' }]"
@change="swiperChange"
>
<swiper-item
v-for="(arr, index) in menuList"
:key="index"
:class="{ cur: state.cur == index }"
>
<!-- 宫格 --> <!-- 宫格 -->
<view class="grid-wrap"> <view class="grid-wrap">
<view <view v-for="(item, index) in arr" :key="index"
v-for="(item, index) in arr"
:key="index"
class="grid-item ss-flex ss-flex-col ss-col-center ss-row-center" class="grid-item ss-flex ss-flex-col ss-col-center ss-row-center"
:style="[{ width: `${100 * (1 / data.column)}%`, height: '200rpx' }]" :style="[{ width: `${100 * (1 / data.column)}%`, height: '200rpx' }]" hover-class="ss-hover-btn"
hover-class="ss-hover-btn" @tap="sheep.$router.go(item.url)">
@tap="sheep.$router.go(item.url)"
>
<view class="menu-box ss-flex ss-flex-col ss-col-center ss-row-center"> <view class="menu-box ss-flex ss-flex-col ss-col-center ss-row-center">
<view <view v-if="item.badge.show" class="tag-box"
v-if="item.badge.show" :style="[{ background: item.badge.bgColor, color: item.badge.textColor }]">
class="tag-box"
:style="[{ background: item.badge.bgColor, color: item.badge.textColor }]"
>
{{ item.badge.text }} {{ item.badge.text }}
</view> </view>
<image <image v-if="item.iconUrl" class="menu-icon" :style="[
v-if="item.iconUrl"
class="menu-icon"
:style="[
{ {
width: props.iconSize + 'rpx', width: props.iconSize + 'rpx',
height: props.iconSize + 'rpx', height: props.iconSize + 'rpx',
}, },
]" ]" :src="sheep.$url.cdn(item.iconUrl)" mode="aspectFill"></image>
:src="sheep.$url.cdn(item.iconUrl)" <view v-if="data.layout === 'iconText'" class="menu-title"
mode="aspectFill" :style="[{ color: item.titleColor }]">
></image>
<view
v-if="data.layout === 'iconText'"
class="menu-title"
:style="[{ color: item.titleColor }]"
>
{{ item.title }} {{ item.title }}
</view> </view>
</view> </view>
@@ -66,12 +36,8 @@
<!-- 指示点 --> <!-- 指示点 -->
<template v-if="menuList.length > 1"> <template v-if="menuList.length > 1">
<view class="ui-swiper-dot" :class="props.dotStyle" v-if="props.dotStyle != 'tag'"> <view class="ui-swiper-dot" :class="props.dotStyle" v-if="props.dotStyle != 'tag'">
<view <view class="line-box" v-for="(item, index) in menuList.length" :key="index"
class="line-box" :class="[state.cur == index ? 'cur' : '', props.dotCur]"></view>
v-for="(item, index) in menuList.length"
:key="index"
:class="[state.cur == index ? 'cur' : '', props.dotCur]"
></view>
</view> </view>
<view class="ui-swiper-dot" :class="props.dotStyle" v-if="props.dotStyle == 'tag'"> <view class="ui-swiper-dot" :class="props.dotStyle" v-if="props.dotStyle == 'tag'">
<view class="ui-tag radius" :class="[props.dotCur]" style="pointer-events: none"> <view class="ui-tag radius" :class="[props.dotCur]" style="pointer-events: none">
@@ -111,7 +77,10 @@
* *
*/ */
import { reactive, computed } from 'vue'; import {
reactive,
computed
} from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
// 数据 // 数据
@@ -122,13 +91,15 @@
// 接收参数 // 接收参数
const props = defineProps({ const props = defineProps({
// 装修数据
data: { data: {
type: Object, type: Object,
default() {}, default: () => ({}),
}, },
// 装修样式
styles: { styles: {
type: Object, type: Object,
default() {}, default: () => ({}),
}, },
circular: { circular: {
type: Boolean, type: Boolean,
@@ -146,7 +117,6 @@
type: Number, type: Number,
default: 500, default: 500,
}, },
ui: { ui: {
type: String, type: String,
default: '', default: '',
@@ -164,15 +134,10 @@
type: String, type: String,
default: 'ui-BG-Main', default: 'ui-BG-Main',
}, },
bg: {
type: String,
default: 'bg-none',
},
height: { height: {
type: Number, type: Number,
default: 300, default: 300,
}, },
// 是否有边框 // 是否有边框
hasBorder: { hasBorder: {
type: Boolean, type: Boolean,
@@ -206,6 +171,22 @@
}, },
}); });
// 设置背景样式
const bgStyle = computed(() => {
console.log(props.styles)
// 直接从 props.styles 解构
const {
bgType,
bgImg,
bgColor
} = props.styles;
// 根据 bgType 返回相应的样式
return {
background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor
};
});
// 生成数据 // 生成数据
const menuList = computed(() => splitData(props.data.list, props.data.row * props.data.column)); const menuList = computed(() => splitData(props.data.list, props.data.row * props.data.column));
const swiperHeight = computed(() => props.data.row * (props.data.layout === 'iconText' ? 200 : 180)); const swiperHeight = computed(() => props.data.row * (props.data.layout === 'iconText' ? 200 : 180));
@@ -244,6 +225,7 @@
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
} }
.menu-box { .menu-box {
position: relative; position: relative;
z-index: 1; z-index: 1;
@@ -332,8 +314,7 @@
opacity: 1; opacity: 1;
} }
&.cur::after { &.cur::after {}
}
} }
&.line { &.line {
+33 -11
View File
@@ -1,18 +1,12 @@
<!-- 装修基础组件宫格导航 --> <!-- 装修基础组件宫格导航 -->
<template> <template>
<view :style="[bgStyle, { marginLeft: `${data.space}px` }]">
<uni-grid :showBorder="Boolean(data.border)" :column="data.column"> <uni-grid :showBorder="Boolean(data.border)" :column="data.column">
<uni-grid-item <uni-grid-item v-for="(item, index) in data.list" :key="index" @tap="sheep.$router.go(item.url)">
v-for="(item, index) in data.list"
:key="index"
@tap="sheep.$router.go(item.url)"
>
<view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center"> <view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center">
<view class="img-box"> <view class="img-box">
<view <view class="tag-box" v-if="item.badge.show"
class="tag-box" :style="[{ background: item.badge.bgColor, color: item.badge.textColor }]">
v-if="item.badge.show"
:style="[{ background: item.badge.bgColor, color: item.badge.textColor }]"
>
{{ item.badge.text }} {{ item.badge.text }}
</view> </view>
<image class="menu-image" :src="sheep.$url.cdn(item.iconUrl)"></image> <image class="menu-image" :src="sheep.$url.cdn(item.iconUrl)"></image>
@@ -29,16 +23,41 @@
</view> </view>
</uni-grid-item> </uni-grid-item>
</uni-grid> </uni-grid>
</view>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import {
computed
} from 'vue';
const props = defineProps({ const props = defineProps({
// 装修数据
data: { data: {
type: Object, type: Object,
default() {}, default: () => ({}),
}, },
// 装修样式
styles: {
type: Object,
default: () => ({}),
},
});
// 设置背景样式
const bgStyle = computed(() => {
// 直接从 props.styles 解构
const {
bgType,
bgImg,
bgColor
} = props.styles;
// 根据 bgType 返回相应的样式
return {
background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor
};
}); });
</script> </script>
@@ -47,6 +66,7 @@
width: 24px; width: 24px;
height: 24px; height: 24px;
} }
.grid-item-box { .grid-item-box {
flex: 1; flex: 1;
display: flex; display: flex;
@@ -54,8 +74,10 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
.img-box { .img-box {
position: relative; position: relative;
.tag-box { .tag-box {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
+26 -2
View File
@@ -1,6 +1,6 @@
<!-- 装修用户组件用户订单 --> <!-- 装修用户组件用户订单 -->
<template> <template>
<view class="ss-order-menu-wrap ss-flex ss-col-center"> <view class="ss-order-menu-wrap ss-flex ss-col-center" :style="[style, { marginLeft: `${data.space}px` }]">
<view <view
class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center" class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
v-for="item in orderMap" v-for="item in orderMap"
@@ -67,8 +67,32 @@
path: '/pages/order/list', path: '/pages/order/list',
}, },
]; ];
// 接收参数
const props = defineProps({
// 装修数据
data: {
type: Object,
default: () => ({}),
},
// 装修样式
styles: {
type: Object,
default: () => ({}),
},
});
// 设置角标
const numData = computed(() => sheep.$store('user').numData); const numData = computed(() => sheep.$store('user').numData);
// 设置背景样式
const style = computed(() => {
// 直接从 props.styles 解构
const { bgType, bgImg, bgColor } = props.styles;
// 根据 bgType 返回相应的样式
return {
background: bgType === 'img'
? `url(${bgImg}) no-repeat top center / 100% 100%`
: bgColor
};
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -1,10 +1,6 @@
<!-- 装修商品组件标题栏 --> <!-- 装修商品组件标题栏 -->
<template> <template>
<view <view class="ss-title-wrap ss-flex ss-col-center" :class="[state.typeMap[data.textAlign]]" :style="[bgStyle, { marginLeft: `${data.space}px` }]">
class="ss-title-wrap ss-flex ss-col-center"
:class="[state.typeMap[data.textAlign]]"
:style="[elStyles]"
>
<view class="title-content"> <view class="title-content">
<!-- 主标题 --> <!-- 主标题 -->
<view v-if="data.title" class="title-text" :style="[titleStyles]">{{ data.title }}</view> <view v-if="data.title" class="title-text" :style="[titleStyles]">{{ data.title }}</view>
@@ -24,7 +20,10 @@
/** /**
* 标题栏 * 标题栏
*/ */
import { reactive } from 'vue'; import {
reactive,
computed
} from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
// 数据 // 数据
@@ -37,22 +36,32 @@
// 接收参数 // 接收参数
const props = defineProps({ const props = defineProps({
// 装修数据
data: { data: {
type: Object, type: Object,
default() {}, default: () => ({}),
}, },
// 装修样式
styles: { styles: {
type: Object, type: Object,
default() {}, default: () => ({}),
}, },
}); });
// 设置背景样式
const bgStyle = computed(() => {
console.log(props.data)
// 直接从 props.styles 解构
const {
bgType,
bgImg,
bgColor
} = props.styles;
// 组件样式 // 根据 bgType 返回相应的样式
const elStyles = { return {
background: `url(${sheep.$url.cdn(props.data.bgImgUrl)}) no-repeat top center / 100% auto`, background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor
fontSize: `${props.data.titleSize}px`,
fontWeight: `${props.data.titleWeight}px`,
}; };
});
// 标题样式 // 标题样式
const titleStyles = { const titleStyles = {
+23 -4
View File
@@ -1,6 +1,6 @@
<!-- 装修用户组件用户卡片 --> <!-- 装修用户组件用户卡片 -->
<template> <template>
<view class="ss-user-info-wrap ss-p-t-50"> <view class="ss-user-info-wrap ss-p-t-50" :style="[bgStyle, { marginLeft: `${data.space}px` }]">
<view class="ss-flex ss-col-center ss-row-between ss-m-b-20"> <view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
<view class="left-box ss-flex ss-col-center ss-m-l-36"> <view class="left-box ss-flex ss-col-center ss-m-l-36">
<view class="avatar-box ss-m-r-24"> <view class="avatar-box ss-m-r-24">
@@ -70,9 +70,15 @@
const isLogin = computed(() => sheep.$store('user').isLogin); const isLogin = computed(() => sheep.$store('user').isLogin);
// 接收参数 // 接收参数
const props = defineProps({ const props = defineProps({
background: { // 装修数据
type: String, data: {
default: '', type: Object,
default: () => ({}),
},
// 装修样式
styles: {
type: Object,
default: () => ({}),
}, },
// 头像 // 头像
avatar: { avatar: {
@@ -97,6 +103,19 @@
}, },
}); });
// 设置背景样式
const bgStyle = computed(() => {
// 直接从 props.styles 解构
const { bgType, bgImg, bgColor } = props.styles;
// 根据 bgType 返回相应的样式
return {
background: bgType === 'img'
? `url(${bgImg}) no-repeat top center / 100% 100%`
: bgColor
};
});
// 绑定手机号
function onBind() { function onBind() {
showAuthModal('changeMobile'); showAuthModal('changeMobile');
} }
@@ -1,6 +1,6 @@
<!-- 装修用户组件用户资产 --> <!-- 装修用户组件用户资产 -->
<template> <template>
<view class="ss-wallet-menu-wrap ss-flex ss-col-center"> <view class="ss-wallet-menu-wrap ss-flex ss-col-center" :style="[bgStyle, { marginLeft: `${data.space}px` }]">
<view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center" <view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
@tap="sheep.$router.go('/pages/user/wallet/money')"> @tap="sheep.$router.go('/pages/user/wallet/money')">
<view class="value-box ss-flex ss-col-bottom"> <view class="value-box ss-flex ss-col-bottom">
@@ -44,6 +44,32 @@
import sheep from '@/sheep'; import sheep from '@/sheep';
import { fen2yuan } from '../../hooks/useGoods'; import { fen2yuan } from '../../hooks/useGoods';
// 接收参数
const props = defineProps({
// 装修数据
data: {
type: Object,
default: () => ({}),
},
// 装修样式
styles: {
type: Object,
default: () => ({}),
},
});
// 设置背景样式
const bgStyle = computed(() => {
// 直接从 props.styles 解构
const { bgType, bgImg, bgColor } = props.styles;
// 根据 bgType 返回相应的样式
return {
background: bgType === 'img'
? `url(${bgImg}) no-repeat top center / 100% 100%`
: bgColor
};
});
const userWallet = computed(() => sheep.$store('user').userWallet); const userWallet = computed(() => sheep.$store('user').userWallet);
const userInfo = computed(() => sheep.$store('user').userInfo); const userInfo = computed(() => sheep.$store('user').userInfo);
const numData = computed(() => sheep.$store('user').numData); const numData = computed(() => sheep.$store('user').numData);