1、首页的轮播图的接口对接
This commit is contained in:
parent
bb30e2332f
commit
39ececc902
@ -6,7 +6,7 @@
|
||||
<view class="tabs-box">
|
||||
<su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="currentTab"></su-tabs>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 可兑换券列表 -->
|
||||
<scroll-view @scrolltolower="onScrolltolower" :refresher-enabled="true" :refresher-triggered="homrS"
|
||||
@refresherrefresh="onS" scroll-y="true" class="flex align-items"
|
||||
@ -14,55 +14,60 @@
|
||||
<!-- 满减券 -->
|
||||
<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>
|
||||
<view class="item-btn">去使用</view>
|
||||
<view class="item-btn" @click="toUseFull(item)">去使用</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<!-- 次数券 -->
|
||||
<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>
|
||||
</view>
|
||||
</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>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
@ -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) {
|
||||
@ -163,9 +206,9 @@
|
||||
couponList.value = [];
|
||||
getCouponList();
|
||||
}
|
||||
|
||||
|
||||
onLoad(() => {
|
||||
getCouponList();
|
||||
getCouponFullList();
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -175,32 +218,32 @@
|
||||
font-size: 60rpx;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
|
||||
|
||||
.fslh28 {
|
||||
font-size: 28rpx;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
|
||||
|
||||
.fs32 {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
.align-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
|
||||
.fs60 {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
@ -212,7 +255,7 @@
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
.regular {
|
||||
font-weight: 400;
|
||||
}
|
||||
@ -220,7 +263,7 @@
|
||||
.c3 {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
.c3D {
|
||||
color: #3d3d3d;
|
||||
}
|
||||
@ -232,11 +275,10 @@
|
||||
.container {
|
||||
background-color: #f7f7f7;
|
||||
height: 100vh;
|
||||
|
||||
|
||||
.exChangeBox {
|
||||
// background-color: #f7f7f7;
|
||||
width: 690rpx;
|
||||
margin-top: 30rpx;
|
||||
|
||||
.couponsList {
|
||||
width: 100%;
|
||||
@ -256,7 +298,7 @@
|
||||
background-size: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
|
||||
.itemLeft {
|
||||
width: 84rpx;
|
||||
height: 103rpx;
|
||||
@ -265,7 +307,7 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.itemRight {
|
||||
width: 446rpx;
|
||||
height: 103rpx;
|
||||
@ -273,7 +315,7 @@
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.item-RightLeft {
|
||||
// width: 84rpx;
|
||||
// height: 103rpx;
|
||||
@ -282,7 +324,7 @@
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.item-btn {
|
||||
width: 160rpx;
|
||||
height: 70rpx;
|
||||
@ -296,9 +338,9 @@
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.item-text {
|
||||
padding: 30rpx;
|
||||
|
@ -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;">
|
||||
<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) {
|
||||
@ -260,6 +261,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) => {
|
||||
|
@ -1,45 +1,51 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
export default {
|
||||
// 优惠券
|
||||
list: (params) =>
|
||||
request({
|
||||
url: 'coupon',
|
||||
method: 'GET',
|
||||
params,
|
||||
custom: {
|
||||
showLoading: false,
|
||||
},
|
||||
}),
|
||||
userCoupon: (params) =>
|
||||
request({
|
||||
url: 'user.coupon',
|
||||
method: 'GET',
|
||||
params,
|
||||
}),
|
||||
detail: (id, user_coupon_id) =>
|
||||
request({
|
||||
url: 'coupon/detail',
|
||||
method: 'GET',
|
||||
params: {
|
||||
id: id,
|
||||
user_coupon_id,
|
||||
},
|
||||
}),
|
||||
get: (id) =>
|
||||
request({
|
||||
url: 'coupon/get',
|
||||
method: 'POST',
|
||||
params: {
|
||||
id: id,
|
||||
},
|
||||
}),
|
||||
listByGoods: (id) =>
|
||||
request({
|
||||
url: 'coupon/listByGoods',
|
||||
method: 'GET',
|
||||
params: {
|
||||
goods_id: id,
|
||||
},
|
||||
}),
|
||||
};
|
||||
// 优惠券
|
||||
list: (params) =>
|
||||
request({
|
||||
url: 'coupon',
|
||||
method: 'GET',
|
||||
params,
|
||||
custom: {
|
||||
showLoading: false,
|
||||
},
|
||||
}),
|
||||
userCoupon: (params) =>
|
||||
request({
|
||||
url: 'user.coupon',
|
||||
method: 'GET',
|
||||
params,
|
||||
}),
|
||||
userTimesList: (params) =>
|
||||
request({
|
||||
url: 'meal.score/mobile_list',
|
||||
method: 'GET',
|
||||
params,
|
||||
}),
|
||||
detail: (id, user_coupon_id) =>
|
||||
request({
|
||||
url: 'coupon/detail',
|
||||
method: 'GET',
|
||||
params: {
|
||||
id: id,
|
||||
user_coupon_id,
|
||||
},
|
||||
}),
|
||||
get: (id) =>
|
||||
request({
|
||||
url: 'coupon/get',
|
||||
method: 'POST',
|
||||
params: {
|
||||
id: id,
|
||||
},
|
||||
}),
|
||||
listByGoods: (id) =>
|
||||
request({
|
||||
url: 'coupon/listByGoods',
|
||||
method: 'GET',
|
||||
params: {
|
||||
goods_id: id,
|
||||
},
|
||||
}),
|
||||
};
|
10
sheep/api/home.js
Normal file
10
sheep/api/home.js
Normal file
@ -0,0 +1,10 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
export default {
|
||||
homeBanner: (params) =>
|
||||
request({
|
||||
url: 'home/homeImages',
|
||||
method: 'GET',
|
||||
params,
|
||||
})
|
||||
};
|
@ -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,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user