新优化

This commit is contained in:
77 2024-10-30 18:49:19 +08:00
parent 09b02ede34
commit 2dd82f6240
12 changed files with 2142 additions and 160 deletions

1236
README.md

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,19 @@
"group": "商城" "group": "商城"
} }
}, },
{
"path": "pages/seeding/seeding",
"style": {
"navigationBarTitleText": "社区种草",
"enablePullDownRefresh": true
},
"meta": {
"auth": false,
"sync": true,
"title": "社区种草",
"group": "商城"
}
},
{ {
"path": "pages/subscribe/success_tolse", "path": "pages/subscribe/success_tolse",
"style": { "style": {
@ -805,6 +818,17 @@
"group": "营销活动" "group": "营销活动"
} }
}, },
{
"path": "point/exchange_listall",
"style": {
"navigationBarTitleText": "兑换记录"
},
"meta": {
"sync": true,
"title": "兑换记录",
"group": "营销活动"
}
},
{ {
"path": "point/exchange_success", "path": "point/exchange_success",
"style": { "style": {

View File

@ -0,0 +1,100 @@
<template>
<s-layout title="兑换商品列表" :bgStyle="{ color: '#fff' }">
<!-- 营销组件积分商城 -->
<view class="goods-lg-box">
<view class="goods-box" v-for="item in pointList"
:key="item.id">
<s-goods-column class="goods-card" size="lg" :data="item"
@tap="sheep.$router.go('/pages/goods/point', { id: item.activityId })">
<!-- 购买按钮 -->
<template v-slot:cart>
<button class="ss-reset-button cart-btn" :style="[buyStyle]">
去兑换
</button>
</template>
</s-goods-column>
</view>
</view>
</s-layout>
</template>
<script setup>
import {
computed,
ref
} from 'vue';
import sheep from '@/sheep';
import request from '@/sheep/request';
import {
baseUrl,
apiPath
} from '@/sheep/config';
const pointList = ref([]);
function getList() {
request({
// url: `${baseUrl}${apiPath}/h5/reservation/list`,
url: `${baseUrl}${apiPath}/promotion/point-activity/pointActivityList`,
method: 'GET',
// params: {
// userId: this.memberId,
// },
custom: {
showLoading: false,
},
}).then((res) => {
pointList.value = res.data;
console.log('this.reservationList', this.reservationList)
});
}
getList();
</script>
<style lang="scss" scoped>
.goods-md-wrap {
width: 100%;
}
.goods-list-box {
width: 50%;
box-sizing: border-box;
.left-list {
&:nth-last-child(1) {
margin-bottom: 0 !important;
}
}
.right-list {
&:nth-last-child(1) {
margin-bottom: 0 !important;
}
}
}
.goods-box {
&:nth-last-of-type(1) {
margin-bottom: 0 !important;
}
}
.goods-md-box,
.goods-sl-box,
.goods-lg-box {
position: relative;
.cart-btn {
position: absolute;
bottom: 18rpx;
right: 20rpx;
z-index: 11;
height: 50rpx;
line-height: 50rpx;
padding: 0 20rpx;
border-radius: 25rpx;
font-size: 24rpx;
color: #fff;
}
}
</style>

View File

@ -13,8 +13,16 @@
</view> </view>
</view> </view>
</su-sticky> --> </su-sticky> -->
<su-swiper
:list="state.data"
imageMode="scaleToFill"
/>
<view class="title"> <view class="title">
促销商品 <text v-if="state.name == 'recommendBest'">精品推荐</text>
<text v-if="state.name == 'recommendHot'">热门榜单</text>
<text v-if="state.name == 'recommendNew'">新品首发</text>
<text v-if="state.name == 'recommendGood'">促销单品</text>
</view> </view>
<!-- 弹窗 --> <!-- 弹窗 -->
<su-popup :show="state.showFilter" type="top" round="10" :space="sys_navBar + 38" backgroundColor="#F6F6F6" <su-popup :show="state.showFilter" type="top" round="10" :space="sys_navBar + 38" backgroundColor="#F6F6F6"
@ -64,11 +72,16 @@
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{ <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多', contentdown: '上拉加载更多',
}" @tap="loadMore" /> }" @tap="loadMore" />
<s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品" /> <!-- <s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品" /> -->
</s-layout> </s-layout>
</template> </template>
<script setup> <script setup>
import request from '@/sheep/request';
import {
baseUrl,
apiPath
} from '@/sheep/config';
import { import {
reactive reactive
} from 'vue'; } from 'vue';
@ -87,6 +100,12 @@
const emits = defineEmits(['close', 'change']); const emits = defineEmits(['close', 'change']);
const state = reactive({ const state = reactive({
data:[
{
// src:'https://zysc.fjptzykj.com:3000/shangcheng/38f95116a77c4927d9fb3bb2cb3744161481c349e12005eebf78b21e84b6e379.png'
}
],
name:'',
pagination: { pagination: {
list: [], list: [],
total: 0, total: 0,
@ -258,10 +277,35 @@
console.log(data, "我要留了") console.log(data, "我要留了")
}; };
//
function classValue(val) {
state.isShow = val;
request({
url: `${baseUrl}${apiPath}/product/spu/getActivityGoods`,
method: 'GET',
params: {
// projectdayId: this.brandId4,
// technicianId: this.brandId3
activityType:val
},
custom: {
showLoading: false,
},
}).then((res) => {
//
state.pagination.list = res.data
// state.pagination.list = _.concat(state.pagination.list, data.list);
// state.pagination.total = data.total;
// state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
});
}
onLoad((options) => { onLoad((options) => {
state.categoryId = options.categoryId; state.categoryId = options.categoryId;
state.keyword = options.keyword; state.keyword = options.keyword;
getList(state.currentSort, state.currentOrder); state.name = options.activityType
classValue(options.activityType)
// getList(state.currentSort, state.currentOrder);
}); });
// //

View File

@ -16,21 +16,17 @@
<scroll-view class="goods-list-box" scroll-y :style="[{ height: pageHeight + 'px' }]" <scroll-view class="goods-list-box" scroll-y :style="[{ height: pageHeight + 'px' }]"
v-if="state.categoryList?.length"> v-if="state.categoryList?.length">
<view class="top_class">
<scroll-view scroll-x class="scroll">
<view class="list on" v-for="(item, index) in 6" :key="index">sss</view>
<view class="list" style="width:0;"> </view> <!-- 为了不让标按钮覆盖按钮 -->
</scroll-view>
<view class="rit">
<image src="https://zysc.fjptzykj.com:3000/shangcheng/475ffa1c11d2bdb4997efb0ba4dfab0b971630ca9e140fa90686c7206db53c82.png" class="img"></image>
</view>
</view>
<!-- <image v-if="state.categoryList[state.activeMenu].picUrl" class="banner-img" :src="sheep.$url.cdn(state.categoryList[state.activeMenu].picUrl)" mode="widthFix"/> --> <!-- <image v-if="state.categoryList[state.activeMenu].picUrl" class="banner-img" :src="sheep.$url.cdn(state.categoryList[state.activeMenu].picUrl)" mode="widthFix"/> -->
<first-one v-if="state.style === 'first_one'" :pagination="state.pagination" /> <first-one v-if="state.style === 'first_one'" :pagination="state.pagination" />
<first-two v-if="state.style === 'first_two'" :pagination="state.pagination" /> <first-two v-if="state.style === 'first_two'" :pagination="state.pagination" />
<second-one v-if="state.style === 'second_one'" :data="state.categoryList" <!-- 样式1 -->
<!-- <second-one v-if="state.style === 'second_one'" :data="state.categoryList"
:activeMenu="state.activeMenu" /> -->
<!-- 样式2 -->
<second-second ref="secondRef" v-if="state.style === 'second_one'" :data="state.categoryList"
:activeMenu="state.activeMenu" /> :activeMenu="state.activeMenu" />
<uni-load-more v-if=" <uni-load-more v-if="
(state.style === 'first_one' || state.style === 'first_two') && (state.style === 'first_one' || state.style === 'first_two') &&
state.pagination.total > 0 state.pagination.total > 0
@ -45,6 +41,7 @@
<script setup> <script setup>
import secondOne from './components/second-one.vue'; import secondOne from './components/second-one.vue';
import secondSecond from './components/second-second.vue';
import firstOne from './components/first-one.vue'; import firstOne from './components/first-one.vue';
import firstTwo from './components/first-two.vue'; import firstTwo from './components/first-two.vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
@ -56,7 +53,8 @@
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
import { import {
computed, computed,
reactive reactive,
ref
} from 'vue'; } from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import { import {
@ -78,6 +76,8 @@
loadStatus: '', loadStatus: '',
}); });
const secondRef = ref(null);
const { const {
safeArea safeArea
} = sheep.$platform.device; } = sheep.$platform.device;
@ -93,11 +93,15 @@
return; return;
} }
state.categoryList = handleTree(data); state.categoryList = handleTree(data);
// console.log(state.categoryList,"ssssssssssssss")
} }
// //
const onMenu = (val) => { const onMenu = (val) => {
state.activeMenu = val; state.activeMenu = val;
if (state.style === 'second_one' && secondRef.value) {
secondRef.value.onFilterItem(state.categoryList[state.activeMenu].children[0].id);
}
if (state.style === 'first_one' || state.style === 'first_two') { if (state.style === 'first_one' || state.style === 'first_two') {
state.pagination.pageNo = 1; state.pagination.pageNo = 1;
state.pagination.list = []; state.pagination.list = [];
@ -150,7 +154,7 @@
.s-category { .s-category {
:deep() { :deep() {
.side-menu-wrap { .side-menu-wrap {
width: 200rpx; width: 170rpx;
height: 100%; height: 100%;
// padding-left: 12rpx; // padding-left: 12rpx;
background-color: #f6f6f6; background-color: #f6f6f6;
@ -166,10 +170,11 @@
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: #333; color: #333;
margin-left: 28rpx; // margin-left: 28rpx;
position: relative; position: relative;
z-index: 0; z-index: 0;
text-align: center;
width: 100%;
&::before { &::before {
content: ''; content: '';
width: 64rpx; width: 64rpx;
@ -223,43 +228,9 @@
.goods-list-box { .goods-list-box {
background-color: #fff; background-color: #fff;
width: calc(100vw - 100px); width: calc(100vw - 85px);
padding: 10px; padding: 10px 0;
.top_class{
position:relative;
.scroll{
white-space: nowrap;
margin-bottom: 10px;
.list{
padding:3px 15px;
background:rgba(248,248,248);
color:rgba(179,179,179);
display: inline-block;
border-radius: 13px;
margin-right:10px;
&.on{
background:rgba(255,235,234);
color:rgba(223,47,41);
}
}
}
.rit{
position:absolute;
right:0;
top:0;
width:40px;
height:100%;
background-color: white;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
.img{
width:15px;
height:15px;
}
}
}
} }
.banner-img { .banner-img {

View File

@ -0,0 +1,328 @@
<!-- 分类展示second-one 风格 -->
<template>
<view>
<view class="top_class">
<scroll-view scroll-x class="scroll">
<view @click="onFilterItem(item.id)" class="list on"
v-for="(item, index) in props.data[activeMenu].children" :key="index">
{{item.name}}
</view>
<!-- 为了不让标按钮覆盖按钮 -->
<view v-if="props.data[activeMenu].children.length > 5" class="list" style="width:0;"> </view>
</scroll-view>
<view class="rit" v-if="props.data[activeMenu].children.length > 5">
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/475ffa1c11d2bdb4997efb0ba4dfab0b971630ca9e140fa90686c7206db53c82.png"
class="img"></image>
</view>
</view>
<view class="" v-for="data in state.pagination.list" :key="data.id">
<!-- <s-goods-column class="" size="lg" :data="data" :topRadius="10" :bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })" /> -->
<view class="ss-goods-wrap">
<view class="lg-goods-card ss-flex ss-col-stretch" style=""
@click="sheep.$router.go('/pages/goods/index', { id: data.id })">
<image class="lg-img-box" :src="sheep.$url.cdn(data.image || data.picUrl)" mode="aspectFill" />
<view class="lg-goods-content ss-flex-1 ss-flex-col ss-p-b-10 ">
<view class="b">
<view class="lg-goods-title ss-line-2">
{{ data.title || data.name }}
</view>
</view>
<view class="pppp">
<view class="ss-flex ss-col-bottom font-OPPOSANS">
<view class="sl-goods-price ss-m-r-12">
<!-- 活动价格 -->
<text class="price-unit ss-font-24"></text>
<text class="price">
{{ isArray(data.price) ? fen2yuan(data.price[0]) : fen2yuan(data.price) }}
</text>
</view>
</view>
<slot name="cart">
<view class="buy-box ss-flex ss-col-center ss-row-center"> 去购买</view>
</slot>
</view>
</view>
</view>
</view>
</view>
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}" @tap="loadMore" />
<s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品" />
</view>
</template>
<script setup>
import {
fen2yuan,
formatExchange,
formatSales,
formatStock,
getRewardActivityRuleItemDescriptions,
} from '@/sheep/hooks/useGoods';
import {
isArray
} from 'lodash-es';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import SpuApi from '@/sheep/api/product/spu';
import {
reactive,
defineExpose
} from 'vue';
import _ from 'lodash';
const props = defineProps({
data: {
type: Object,
default: () => ({}),
},
activeMenu: [Number, String],
});
const state = reactive({
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 6,
},
currentSort: undefined,
currentOrder: undefined,
currentTab: 0, // tab
curFilter: 0, // list
showFilter: false,
iconStatus: false, // true - false -
keyword: '',
categoryId: 0,
loadStatus: ''
});
//
function emptyList() {
state.pagination.list = [];
}
const onFilterItem = (id) => {
// +
emptyList();
getList(id);
};
async function getList(id) {
console.log(id)
state.loadStatus = 'loading';
const {
code,
data
} = await SpuApi.getSpuPage({
pageNo: state.pagination.pageNo,
pageSize: state.pagination.pageSize,
sortField: state.currentSort,
sortAsc: state.currentOrder,
categoryId: id,
keyword: state.keyword,
});
if (code !== 0) {
return;
}
state.pagination.list = _.concat(state.pagination.list, data.list);
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
};
//
function loadMore() {
if (state.loadStatus === 'noMore') {
return;
}
state.pagination.pageNo++;
getList();
}
console.log(props.data[props.activeMenu].id, "state.pagination.list")
getList(props.data[props.activeMenu].id);
// onLoad((options) => {
// // state.categoryId = options.categoryId;
// // state.keyword = options.keyword;
// });
//
onReachBottom(() => {
loadMore();
});
defineExpose({
onFilterItem
});
</script>
<style lang="scss" scoped>
//lg
.lg-goods-card {
overflow: hidden;
position: relative;
z-index: 1;
background-color: $white;
// height: 280rpx;
border-radius: 10px !important;
padding: 10px;
.price-unit{
color:#df2f29;
font-weight:700;
}
.lg-img-box {
width: 150rpx;
height: 150rpx;
margin-right: 20rpx;
border-radius: 10px;
}
.price{
color:#df2f29;
font-weight:700;
}
.lg-goods-title {
font-size: 28rpx;
font-weight: 500;
color: #333333;
// margin-top:7px;
// line-height: 36rpx;
// width: 410rpx;
}
.lg-goods-subtitle {
font-size: 24rpx;
font-weight: 400;
color: #999999;
// line-height: 30rpx;
// width: 410rpx;
}
.lg-goods-price {
font-size: 30rpx;
color: $red;
line-height: 36rpx;
}
.tag-box {
width: 100%;
}
}
.top_class {
position: relative;
padding: 0 10px;
.scroll {
white-space: nowrap;
margin-bottom: 10px;
.list {
padding: 3px 15px;
background: rgba(248, 248, 248);
color: rgba(179, 179, 179);
display: inline-block;
border-radius: 13px;
margin-right: 10px;
&.on {
background: rgba(255, 235, 234);
color: rgba(223, 47, 41);
}
}
}
.rit {
position: absolute;
right: 0;
top: 0;
width: 40px;
height: 100%;
background-color: white;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
.img {
width: 15px;
height: 15px;
}
}
}
.title-box {
.title-line-left,
.title-line-right {
width: 15px;
height: 1px;
background: #d2d2d2;
}
}
.goods-item {
width: calc((100% - 20px) / 3);
margin-right: 10px;
margin-bottom: 10px;
&:nth-of-type(3n) {
margin-right: 0;
}
.goods-img {
width: calc((100vw - 140px) / 3);
height: calc((100vw - 140px) / 3);
}
.goods-title {
font-size: 26rpx;
font-weight: bold;
color: #333333;
line-height: 40rpx;
text-align: center;
}
.goods-price {
color: $red;
line-height: 40rpx;
}
}
.lg-goods-content{
.b{
min-height: 37px;
display:flex;
align-items:center;
}
.pppp{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
// padding-right: 10px;
.buy-box {
bottom: 20rpx;
right: 20rpx;
z-index: 2;
width: 58px;
padding:3px 0;
// background: linear-gradient(90deg, #fe8900, #ff5e00);
background: #df2f29;
border-radius: 25rpx;
font-size: 12px;
color: #ffffff;
}
}
}
</style>

View File

@ -88,7 +88,8 @@
payment: '', // payment: '', //
vip: '' ,//vip vip: '' ,//vip
vipid:'',//vipid vipid:'',//vipid
cardName:''//vip cardName:'',//vip
hideWalletPay:false//
}); });
const onPay = () => { const onPay = () => {
@ -201,7 +202,7 @@
const { const {
data, data,
code code
} = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId); } = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId, state.hideWalletPay);
if (code !== 0) { if (code !== 0) {
return; return;
} }
@ -222,6 +223,7 @@
state.vip = options.type state.vip = options.type
state.vipid = options.vipid state.vipid = options.vipid
state.cardName = options.cardName state.cardName = options.cardName
state.hideWalletPay = options.hideWalletPay
if (options.orderType) { if (options.orderType) {
state.orderType = options.orderType; state.orderType = options.orderType;
} }

View File

@ -101,6 +101,7 @@
sheep.$router.go('/pages/pay/index', { sheep.$router.go('/pages/pay/index', {
id: data.payOrderId, id: data.payOrderId,
orderType: 'recharge', orderType: 'recharge',
hideWalletPay:true
}); });
} }

193
pages/seeding/seeding.vue Normal file
View File

@ -0,0 +1,193 @@
<template>
<s-layout title="社区种草" :bgStyle="{ color: '#fff' }">
<view class="seeding">
<view class="list" v-for="(item,index) in getData" :key="index">
<view class="top">
<view class="l">
<image :src="item.picUrl" class="img"></image>
</view>
<view class="r">
<view class="name">{{item.nickname}}</view>
<view class="time">{{sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
</view>
</view>
<view class="content">
{{item.content}}
</view>
<view class="bottom">
<view class="ck"><image src="https://zysc.fjptzykj.com:3000/shangcheng/fa998f749128876ceba66145c9c543f5650aaa16a71da8123c436ddb45071dc5.png" class="img"></image>{{item.lookCount}}</view>
<view class="ck"><image src="https://zysc.fjptzykj.com:3000/shangcheng/6141e7edbc442871fdf4fb321cbb842b41509d0b527338b1b02b6e96ff976dcb.png" class="img"></image>{{item.likeCount}}</view>
<view class="ck"><image src="https://zysc.fjptzykj.com:3000/shangcheng/88994efd6eec03acb0b09c38f43ad2b5f78744ec2a99f1ab2bbb6a70c20fd386.png" class="img"></image>{{item.commentCount}}</view>
</view>
</view>
<view class="btn" v-if="isShow">
<input class="content_cs" v-model="content"></input>
<input class="pic content_cs" v-model="picUrl"/>
</view>
<view class="dd" @click="fabu" v-if="!isShow">
我想发布动态
</view>
<view class="dd" @click="setlist" v-if="isShow">
确定
</view>
</view>
</s-layout>
</template>
<script setup>
import request from '@/sheep/request';
import sheep from '@/sheep';
import {
baseUrl,
apiPath
} from '@/sheep/config';
import {
ref
} from 'vue'
const getData = ref([]);
const content = ref('请输入要发送的内容');
const picUrl = ref('请输入路径');
const isShow = ref(false);
//
function getlist() {
request({
url: `${baseUrl}${apiPath}/promotion/circle/page`,
method: 'GET',
params: {
// id: this.brandId
},
custom: {
showLoading: false,
},
}).then((res) => {
getData.value = res.data.list;
});
}
//
function fabu(){
isShow.value = !isShow.value
}
//
function setlist() {
console.log(content.value,"content.value")
if(!content.value){
sheep.$helper.toast('内容不能为空');
}else if(!picUrl.value){
sheep.$helper.toast('头像不能为空');
}else{
request({
url: `${baseUrl}${apiPath}/promotion/circle/create`,
method: 'post',
data: {
content: content.value,
picUrl:picUrl.value
},
custom: {
showLoading: false,
},
}).then((res) => {
console.log(res,"是否成功")
if(res.data){
isShow.value = false;
sheep.$helper.toast('提交成功')
getlist();
}else{
sheep.$helper.toast('提交失败')
}
});
}
}
getlist();
</script>
<style scoped lang="scss">
.seeding{
.list{
background:white;
margin:10px;
margin-bottom:5px;
padding:10px;
.top{
display:flex;
align-items:center;
.l{
margin-right: 10px;
.img{
width:40px;
height:40px;
}
}
.r{
.name{
font-weight:700;
}
.time{
font-size: 12px;
color: rgba(163, 163, 163);
}
}
}
.content{
margin-top: 10px;
}
.bottom{
display:flex;
justify-content: flex-end;
.ck{
display:flex;
align-items: center;
margin-right:20px;
color: rgba(163, 163, 163);
.img{
width:20px;
height:20px;
margin-right:8px;
}
}
}
}
}
.btn{
margin-top:50px;
background:white;
display:flex;
justify-content:center;
flex-wrap:wrap;
.content_cs{
width:100%;
text-align:center;
padding: 10px;
margin:20px 0;
margin-bottom:10px;
background-color: rgba(246, 246, 246);
}
.pic{
width:100%;
text-align:center;
}
}
.dd{
width:100%;
text-align:center;
background:red;
color:white;
width:50%;
margin:0 auto;
padding:10px;
margin-bottom:30px;
border-radius:15px;
}
</style>

View File

@ -2,11 +2,11 @@ import request from '@/sheep/request';
const PayChannelApi = { const PayChannelApi = {
// 获得指定应用的开启的支付渠道编码列表 // 获得指定应用的开启的支付渠道编码列表
getEnableChannelCodeList: (appId) => { getEnableChannelCodeList: (appId, hideWalletPay) => {
return request({ return request({
url: '/pay/channel/get-enable-code-list', url: '/pay/channel/get-enable-code-list',
method: 'GET', method: 'GET',
params: { appId }, params: { appId, hideWalletPay:hideWalletPay },
}); });
}, },
}; };

View File

@ -3,13 +3,21 @@
<!-- 商品卡片 --> <!-- 商品卡片 -->
<view> <view>
<view class="new-fenlei" v-if="fl"> <view class="new-fenlei" v-if="fl">
<view class="list on"> <view class="list" :class="state.isShow == 'recommendNew' ? 'on' : ''" @click="classValue('recommendNew')">
<view class="t">首页新品</view> <view class="t">首页新品</view>
<view class="b">最新出炉</view> <view class="b">最新出炉</view>
</view> </view>
<view class="list" v-for="(item, index) in 3" :key="index"> <view class="list" :class="state.isShow == 'recommendBest' ? 'on' : ''" @click="classValue('recommendBest')">
<view class="t">首页新品</view> <view class="t">精品推荐</view>
<view class="b">最新出炉</view> <view class="b">猜你喜欢</view>
</view>
<view class="list" :class="state.isShow == 'recommendHot' ? 'on' : ''" @click="classValue('recommendHot')">
<view class="t">热门榜单</view>
<view class="b">好评如云</view>
</view>
<view class="list" :class="state.isShow == 'recommendGood' ? 'on' : ''" @click="classValue('recommendGood')">
<view class="t">促销单品</view>
<view class="b">多买多销</view>
</view> </view>
</view> </view>
<!-- 布局1. 单列大图上图下内容--> <!-- 布局1. 单列大图上图下内容-->
@ -35,8 +43,10 @@
<view v-if="layoutType === LayoutTypeEnum.TWO_COL && state.goodsList.length" <view v-if="layoutType === LayoutTypeEnum.TWO_COL && state.goodsList.length"
class="goods-md-wrap ss-flex ss-flex-wrap ss-col-top"> class="goods-md-wrap ss-flex ss-flex-wrap ss-col-top">
<view class="goods-list-box"> <view class="goods-list-box">
<!-- <view class="left-list" :style="[{ paddingRight: data.space + 'rpx', marginBottom: data.space + 'px' }]"
v-for="item in state.leftGoodsList" :key="item.id"> -->
<view class="left-list" :style="[{ paddingRight: data.space + 'rpx', marginBottom: data.space + 'px' }]" <view class="left-list" :style="[{ paddingRight: data.space + 'rpx', marginBottom: data.space + 'px' }]"
v-for="item in state.leftGoodsList" :key="item.id"> v-for="item in state.goodsList" :key="item.id">
<s-goods-column class="goods-md-box" size="md" :goodsFields="data.fields" :tagStyle="data.badge" <s-goods-column class="goods-md-box" size="md" :goodsFields="data.fields" :tagStyle="data.badge"
:data="item" :titleColor="data.fields.name?.color" :data="item" :titleColor="data.fields.name?.color"
:subTitleColor="data.fields.introduction.color" :topRadius="data.borderRadiusTop" :subTitleColor="data.fields.introduction.color" :topRadius="data.borderRadiusTop"
@ -52,7 +62,7 @@
</s-goods-column> </s-goods-column>
</view> </view>
</view> </view>
<view class="goods-list-box"> <!-- <view class="goods-list-box">
<view class="right-list" :style="[{ paddingLeft: data.space + 'rpx', marginBottom: data.space + 'px' }]" <view class="right-list" :style="[{ paddingLeft: data.space + 'rpx', marginBottom: data.space + 'px' }]"
v-for="item in state.rightGoodsList" :key="item.id"> v-for="item in state.rightGoodsList" :key="item.id">
<s-goods-column class="goods-md-box" size="md" :goodsFields="data.fields" :tagStyle="data.badge" <s-goods-column class="goods-md-box" size="md" :goodsFields="data.fields" :tagStyle="data.badge"
@ -61,7 +71,6 @@
:bottomRadius="data.borderRadiusBottom" :titleWidth="330 - marginLeft - marginRight" :bottomRadius="data.borderRadiusBottom" :titleWidth="330 - marginLeft - marginRight"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })" @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
@getHeight="calculateGoodsColumn($event, 'right')"> @getHeight="calculateGoodsColumn($event, 'right')">
<!-- 购买按钮 -->
<template v-slot:cart> <template v-slot:cart>
<button class="ss-reset-button cart-btn" :style="[buyStyle]"> <button class="ss-reset-button cart-btn" :style="[buyStyle]">
{{ btnBuy.type === 'text' ? btnBuy.text : '' }} {{ btnBuy.type === 'text' ? btnBuy.text : '' }}
@ -69,7 +78,7 @@
</template> </template>
</s-goods-column> </s-goods-column>
</view> </view>
</view> </view> -->
</view> </view>
<!-- 布局3. 单列小图左图右内容 --> <!-- 布局3. 单列小图左图右内容 -->
@ -94,6 +103,13 @@
</template> </template>
<script setup> <script setup>
import request from '@/sheep/request';
import {
baseUrl,
apiPath
} from '@/sheep/config';
/** /**
* 商品卡片 * 商品卡片
*/ */
@ -119,6 +135,7 @@
goodsList: [], goodsList: [],
leftGoodsList: [], leftGoodsList: [],
rightGoodsList: [], rightGoodsList: [],
isShow:'recommendNew'
}); });
const props = defineProps({ const props = defineProps({
data: { data: {
@ -166,7 +183,7 @@
//region //region
// //
let count = 0; let count = 3;
// //
let leftHeight = 0; let leftHeight = 0;
// //
@ -206,15 +223,49 @@
return data; return data;
} }
//
function classValue(val) {
state.isShow = val;
request({
url: `${baseUrl}${apiPath}/product/spu/getActivityGoods`,
method: 'GET',
params: {
// projectdayId: this.brandId4,
// technicianId: this.brandId3
activityType:val
},
custom: {
showLoading: false,
},
}).then((res) => {
//
count=0;
leftHeight = 0;
rightHeight = 0;
state.goodsList = [];
state.goodsList = res.data;
state.leftGoodsList = []
state.rightGoodsList = []
calculateGoodsColumn();
});
}
// //
onMounted(async () => { onMounted(async () => {
if(props.fl){
classValue("recommendNew");
}
// //
if(!props.fl){
state.goodsList = await getGoodsListByIds(spuIds.join(',')); state.goodsList = await getGoodsListByIds(spuIds.join(','));
// //
if (layoutType === LayoutTypeEnum.TWO_COL) { if (layoutType === LayoutTypeEnum.TWO_COL) {
// //
calculateGoodsColumn(); calculateGoodsColumn();
} }
}
}); });
</script> </script>
@ -223,6 +274,7 @@
width: 100%; width: 100%;
display: flex; display: flex;
margin:10px 0; margin:10px 0;
justify-content: space-around;
.list { .list {
width: 24%; width: 24%;
&.on{ &.on{
@ -237,6 +289,7 @@
} }
.t { .t {
text-align: center; text-align: center;
font-size: 16px;
} }
.b { .b {
@ -246,7 +299,7 @@
border-radius: 15px; border-radius: 15px;
width: 63%; width: 63%;
margin: 0 auto; margin: 0 auto;
font-size: 11px; font-size: 12px;
margin-top:5px; margin-top:5px;
} }
} }
@ -257,9 +310,18 @@
} }
.goods-list-box { .goods-list-box {
width: 50%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
::v-deep &{
display:flex;
flex-wrap:wrap;
.left-list{
width:48%;
}
.left-list:nth-child(3n+2){
margin-right:0;
}
}
.left-list { .left-list {
&:nth-last-child(1) { &:nth-last-child(1) {
margin-bottom: 0 !important; margin-bottom: 0 !important;

View File

@ -6,21 +6,99 @@
<view class="sub">美好生活由此开始</view> <view class="sub">美好生活由此开始</view>
</view> </view>
<view class="new-list"> <view class="new-list">
<view class="item" v-for="(item , index) in 4" :key="index"> <!-- <view class="item" @click="sheep.$router.go('/pages/goods/sales', {
activityType: 'recommendBest',
});"> -->
<view class="item" @click="sheep.$router.go('/pages/index/page', {
id: '19',
});">
<view class="nei"> <view class="nei">
<view class="l"> <view class="l">
<view class="t">今日推荐</view> <view class="t">今日推荐</view>
<view class="c">店主诚意推荐品质商品</view> <view class="c">店主诚意推荐品质商品</view>
<view class="b"> <view class="b">
GO! <!-- GO! -->
<image <image
src="https://zysc.fjptzykj.com:3000/shangcheng/0790eb9a90d70762e7663d2bf3d04d7427947b535dda1e98712e08d1628b52a0.png" src="https://zysc.fjptzykj.com:3000/shangcheng/40a7582be7aeb5a6047415ab3a6728439a2798a4752ffcc1c063d66a534aa630.png"
class="img" /> class="img"></image>
</view> </view>
</view> </view>
<view class="r"> <view class="r">
<image <image
src="https://zysc.fjptzykj.com:3000/shangcheng/034b7091b1194d9c2853d7c17a0c1e59f0c6cdfebfcf8f7a732002e2784ead35.png" src="https://zysc.fjptzykj.com:3000/shangcheng/c80faeeeb2d6dadcdbe7e6d1a4caa06869b94301612cdf157414a10559b38267.png"
class="img"></image>
</view>
</view>
</view>
<!-- <view class="item" @click="sheep.$router.go('/pages/goods/sales', {
activityType: 'recommendHot',
});"> -->
<view class="item" @click="sheep.$router.go('/pages/index/page', {
id: '21',
});">
<view class="nei">
<view class="l">
<view class="t">热门榜单</view>
<view class="c">店主诚意推荐品质商品</view>
<view class="b">
<!-- GO! -->
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/5c72fc99989bf0a7e59b57f519c76c9a98cb20478384e20b1b934aa8f80cc598.png"
class="img"></image>
</view>
</view>
<view class="r">
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/904fd4848fde8025ccc17693662efd5b7bf5ec3f2656ecc7de407c8c46f910b2.png"
class="img"></image>
</view>
</view>
</view>
<!-- <view class="item" @click="sheep.$router.go('/pages/goods/sales', {
activityType: 'recommendNew',
});"> -->
<view class="item" @click="sheep.$router.go('/pages/index/page', {
id: '22',
});">
<view class="nei">
<view class="l">
<view class="t">首发新品</view>
<view class="c">新品上架等 你来拿</view>
<view class="b">
<!-- GO! -->
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/ebb2fc0512d1bd6a6d21a2c07f6603bfd2ea6f7e23377eb4cd8118d89d666589.png"
class="img"></image>
</view>
</view>
<view class="r">
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/7c71cbf2c757418302ea9ef2952893c24e1d46c4cc35a821f56be0f315bcabb0.png"
class="img"></image>
</view>
</view>
</view>
<!-- <view class="item" @click="sheep.$router.go('/pages/goods/sales', {
activityType: 'recommendGood',
});"> -->
<view class="item" @click="sheep.$router.go('/pages/index/page', {
id: '23',
});">
<view class="nei">
<view class="l">
<view class="t">促销单品</view>
<view class="c">综合评选好 产品</view>
<view class="b">
<!-- GO! -->
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/aac8baa7a6feb9ee3459d1cf75ba9a7e8bacb5d93c88ac95c1b0ecd29b847f96.png"
class="img"></image>
</view>
</view>
<view class="r">
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/8a61c35d82702c61f97ef3db43a8d6755b2eca3d78a22dbaa55851e815e96a23.png"
class="img"></image> class="img"></image>
</view> </view>
</view> </view>
@ -89,20 +167,21 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.new_czbk { .new_czbk {
width: 92%; width: 100%;
background: rgba(255, 229, 227); background: rgba(255, 229, 227);
border-radius: 20px; border-radius: 5px;
margin: 0 auto; margin: 0 auto;
padding: 20px 10px; padding: 5px 0;
margin-top: 10px; margin-top: 10px;
padding-bottom: 10px;
.t { padding-top: 10px;
&>.t {
display: flex; display: flex;
align-items: center; align-items: center;
padding:0 10px;
.left-font { .left-font {
color: rgba(252, 60, 62); color: rgba(252, 60, 62);
font-size: 22px; font-size: 17px;
font-weight: 700; font-weight: 700;
} }
@ -112,49 +191,53 @@
border-radius: 20px 0px 20px 0px; border-radius: 20px 0px 20px 0px;
padding: 0 13px; padding: 0 13px;
margin-left: 10px; margin-left: 10px;
font-size: 13px;
} }
} }
.new-list { .new-list {
width: 100%; // width: 100%;
margin-top: 20px; margin-right:10px;
.item { .item {
float: left; float: left;
width: 47.5%; width: 50%;
padding: 5px;
.nei { .nei {
margin: 10px;
margin-right:0;
margin-bottom: 0;
background: white; background: white;
border-radius: 10px; border-radius: 10px;
padding: 15px 10px; padding: 8px 10px;
display: flex; display: flex;
.l { .l {
width: 51%; width: 50%;
.t {} .t {
// font-size: 17px;
}
.c { .c {
color: rgba(153, 153, 153); color: rgba(153, 153, 153);
font-size: 13px; font-size: 12px;
margin: 10px 0; margin: 3px 0;
} }
.b { .b {
display: flex; // display: flex;
align-items: center; // align-items: center;
justify-content: space-around; // justify-content: space-around;
background: #329cff; // background: #329cff;
margin: 0 3px; // margin: 0 3px;
border-radius: 15px; // border-radius: 15px;
color: white; // color: white;
font-weight: 700; // font-weight: 700;
padding: 0px 9px; // padding: 0px 9px;
font-style: oblique; // font-style: oblique;
.img { .img {
width: 20px; width: 76%;
height: 20px; height: 20px;
} }
} }
@ -175,23 +258,23 @@
} }
@media (max-width: 435px) { // @media (max-width: 435px) {
.new_czbk { // .new_czbk {
.new-list { // .new-list {
.item { // .item {
width: 47%; // width: 47%;
} // }
} // }
} // }
} // }
@media (max-width: 379px) { // @media (max-width: 379px) {
.new_czbk { // .new_czbk {
.new-list { // .new-list {
.item { // .item {
width: 46%; // width: 46%;
} // }
} // }
} // }
} // }
</style> </style>