1、首页的轮播图的接口对接

This commit is contained in:
wangzimeng 2025-07-29 16:22:14 +08:00
parent bb30e2332f
commit 39ececc902
5 changed files with 175 additions and 104 deletions

View File

@ -14,17 +14,18 @@
<!-- 满减券 -->
<view class="exChangeBox" v-if="currentTab == 0">
<view class="couponsList">
<view class="list-item">
<view class="list-item" v-for="(item, index) in couponFullList" :key="index">
<view class="itemLeft">
<view class="fslh60 c3 bold">50</view>
<view class="fslh28 c3 regular" style="margin-top: 15rpx;">满减券</view>
<view class="fslh60 c3 bold">{{item.amount}}</view>
<view class="fslh28 c3 regular" style="margin-top: 15rpx;">{{item.type_text}}</view>
</view>
<view class="itemRight">
<view class="item-RightLeft">
<view class="fs32 c3D bold" style="line-height: 36rpx;">满100减50</view>
<view class="fs24 c9 regular" style="margin-top: 20rpx;line-height: 30rpx;">仅限原料商城可用</view>
<view class="fs32 c3D bold" style="line-height: 36rpx;">{{item.name}}</view>
<view class="fs24 c9 regular" style="margin-top: 20rpx;line-height: 30rpx;">仅限原料商城可用
</view>
<view class="item-btn">去使用</view>
</view>
<view class="item-btn" @click="toUseFull(item)">去使用</view>
</view>
</view>
</view>
@ -33,18 +34,18 @@
<!-- 次数券 -->
<view class="exChangeBox" v-if="currentTab == 1">
<view class="couponsList">
<view class="list-item" v-for="(item, index) in couponList" :key="index"
@click="openCouponPro(item)">
<view class="list-item" v-for="(e, i) in couponTimesList" :key="i">
<view class="itemLeft">
<view class="fslh60 c3 bold">1</view>
<view class="fslh60 c3 bold" style="text-align: center;">{{e.mobile_number}}</view>
<view class="fslh28 c3 regular" style="margin-top: 15rpx;">次数券</view>
</view>
<view class="itemRight">
<view class="item-RightLeft">
<view class="fs32 c3D bold" style="line-height: 36rpx;">增加拨打次数</view>
<view class="fs24 c9 regular" style="margin-top: 20rpx;line-height: 30rpx;">仅限增加拨打次数使用</view>
<view class="fs32 c3D bold" style="line-height: 36rpx;">{{e.name}}</view>
<view class="fs24 c9 regular" style="margin-top: 30rpx;line-height: 30rpx;">
仅限增加拨打次数使用</view>
</view>
<view class="item-btn">去使用</view>
<view class="item-btn" @click="toUseTimes(e)">去使用</view>
</view>
</view>
@ -52,10 +53,14 @@
</view>
<!-- 无数据展示 -->
<view class="grid flex-column justify-center align-center" v-if="couponList.length == 0" style="margin: 0 auto;margin-top: 300rpx;">
<image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode="" style="width: 520rpx;height: 259rpx;">
<view class="grid flex-column justify-center align-center"
v-if="(currentTab == 0 && couponFullCount == 0) || (currentTab == 1 && couponTimesCount == 0)"
style="margin: 0 auto;margin-top: 300rpx;">
<image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode=""
style="width: 520rpx;height: 259rpx;">
</image>
<view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;text-align: center;width: 100%;">暂无数据信息</view>
<view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;text-align: center;width: 100%;">
暂无数据信息</view>
</view>
</scroll-view>
@ -86,7 +91,7 @@
status: 1,
})
const tabMaps = [{
name: '优惠券',
name: '满减券',
value: '1',
},
{
@ -102,8 +107,16 @@
currentTab.value = e.index
console.log('切换tabs', currentTab.value);
listQuery.value.status = e.value
couponList.value = []
getCouponList();
listQuery.value.page = 1;
listQuery.value.limit = 10;
listQuery.value.list_rows = 10
couponFullList.value = []
couponTimesCount.value = []
if (currentTab.value == 0) {
getCouponFullList();
} else {
getCouponTimesList();
}
}
//
@ -114,21 +127,21 @@
}
//
const couponList = ref([])
const couponCount = ref(0)
/* 满减券 */
const couponFullList = ref([])
const couponFullCount = ref(0)
const homrS = ref(false)
async function getCouponList() {
const res = await sheep.$api.app.scoreShop.fullList({
async function getCouponFullList() {
const res = await sheep.$api.coupon.userCoupon({
page: listQuery.value.page,
limit: listQuery.value.limit,
status: listQuery.value.status,
order: 'normal'
list_rows: listQuery.value.list_rows,
add_type: 'reduce',
type: 'geted'
});
if (res.code === 1) {
couponList.value = [...couponList.value, ...res.data.list];
couponCount.value = res.data.count;
score.value = res.data.score
couponFullList.value = [...couponFullList.value, ...res.data.data];
couponFullCount.value = res.data.total;
console.log('满减券',couponFullList.value,couponFullList.value[0]);
} else {
uni.showToast({
title: res.msg,
@ -136,6 +149,36 @@
})
}
}
/* 次数券 */
const couponTimesList = ref([])
const couponTimesCount = ref(0)
async function getCouponTimesList() {
const res = await sheep.$api.coupon.userTimesList({
page: listQuery.value.page,
limit: listQuery.value.limit,
status: 1,
order: 'normal'
});
if (res.code === 1) {
couponTimesList.value = [...couponTimesList.value, ...res.data.list];
couponTimesCount.value = res.data.count;
// score.value = res.data.score
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}
/* 使用券 */
function toUseFull(item) {
}
function toUseTimes(e) {
}
//
function onScrolltolower() {
if (couponList.value.length < couponCount.value) {
@ -165,7 +208,7 @@
}
onLoad(() => {
getCouponList();
getCouponFullList();
});
</script>
@ -236,7 +279,6 @@
.exChangeBox {
// background-color: #f7f7f7;
width: 690rpx;
margin-top: 30rpx;
.couponsList {
width: 100%;

View File

@ -50,24 +50,24 @@
<view class="swiper_s">
<swiper class="swiper_s" :circular="true" :autoplay="true" indicator-active-color="#0DAE11"
indicator-color="#ffffff" :indicator-dots="false" :current="swiperCurrent"
@animationfinish="swiperChange">
@animationfinish="swiperChange" v-for="(item, index) in bannerList" :key="index">
<!-- v-for="(item, index) in swiperList" :key="index" @click="openSwiper(item)"-->
<swiper-item style="margin: 0 auto;" >
<view style="position: relative;width: 100%;height: 100%;">
<!--<view class="fnon_tit"></view>
<view class="text">{{ item.title ? item.title : '' }}</view>
@click="click(item.url)" 跳转活动链接 -->
<image class="swiper-image" src="/static/swiper.png" mode="scaleToFill" />
<image class="swiper-image" :src="item.image" mode="scaleToFill" />
</view>
</swiper-item>
<swiper-item style="margin: 0 auto;">
<!-- <swiper-item style="margin: 0 auto;">
<view style="position: relative;width: 100%;height: 100%">
<!--<view class="fnon_tit"></view>
<view class="text">{{ item.title ? item.title : '' }}</view>
@click="click(item.url)" 跳转活动链接 -->
@click="click(item.url)" 跳转活动链接
<image class="swiper-image" src="/static/cart-empty.png" mode="scaleToFill" />
</view>
</swiper-item>
</swiper-item> -->
</swiper>
</view>
</view>
@ -227,6 +227,7 @@
onLoad((options) => {
getList();
getBanner();
// #ifdef MP
//
if (options.scene) {
@ -261,6 +262,16 @@
onPageScroll(() => {});
const bannerList = ref([])
async function getBanner() {
const res = await sheep.$api.home.homeBanner({});
console.log('banner',res);
if(res.code == 1) {
bannerList.value = res.data.list
}
}
const toPage = (e) => {
if (isLogin.value == true) {

View File

@ -17,6 +17,12 @@ export default {
method: 'GET',
params,
}),
userTimesList: (params) =>
request({
url: 'meal.score/mobile_list',
method: 'GET',
params,
}),
detail: (id, user_coupon_id) =>
request({
url: 'coupon/detail',

10
sheep/api/home.js Normal file
View File

@ -0,0 +1,10 @@
import request from '@/sheep/request';
export default {
homeBanner: (params) =>
request({
url: 'home/homeImages',
method: 'GET',
params,
})
};

View File

@ -14,6 +14,7 @@ import trade from "./trade"
import user from "./user"
import rent from "./rent"
import school from "./school"
import home from "./home"
export default {
activity,
@ -32,5 +33,6 @@ export default {
user,
rent,
school,
home,
}