Feat:接口对接

This commit is contained in:
lifizer
2023-11-20 15:54:00 +08:00
parent 4652b6706a
commit a3ac5a2506
24 changed files with 2305 additions and 152 deletions
+48 -3
View File
@@ -31,6 +31,9 @@
<text class="bold">{{ item.price }}</text>
</view>
</view>
<image class="img-nodata" :src="webUrl+'/20231023131208675588.png'" mode="scaleToFill"
v-if="dataList.length===0"/>
</view>
</view>
</template>
@@ -38,6 +41,11 @@
<script>
import {countyFamous} from "@/api/product";
import {getProducts} from "@/api/store";
import {famousShareImage} from "@/api/share";
import {mapGetters} from "vuex";
import cookie from "@/utils/store/cookie";
import {userBindParent} from "@/api/user";
import {getUrlParam} from "@/utils/common.js";
export default {
name: "famousList",
@@ -49,10 +57,38 @@ export default {
bannerList: [],
dataList: [],
navList: [],
navIndex: 0
navIndex: 0,
partnerId: null
}
},
onLoad() {
computed: mapGetters(["userInfo", "isLogin"]),
onShareAppMessage() {
return new Promise(async (resolve, reject) => {
const {status, data} = await famousShareImage();
if (status === 200) {
resolve({
title: '探寻有趣有味的生活方式',
path: '/pkg_product/views/famousList?partnerId=' + this.userInfo.uid,
imageUrl: data
})
}
})
},
onLoad(options) {
if (options.partnerId) {
this.partnerId = options.partnerId || null;
} else {
let obj = uni.getEnterOptionsSync();
if (options.scene != null || obj.query.scene != null) {
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene);
this.partnerId = getUrlParam(query, "partnerId") || null;
}
}
if (this.partnerId) {
cookie.set("spread", this.partnerId);
userBindParent({spread: parseInt(this.partnerId)});
}
countyFamous().then(({data}) => {
this.bannerList = data.banner;
this.navList = data.countyFamousAreaList;
@@ -91,7 +127,7 @@ export default {
},
goGoods(id) {
uni.navigateTo({
url: "/pages/shop/GoodsCon/index?id=" + id
url: `/pages/shop/GoodsCon/index?id=${id}&from=famous`
})
},
goStory() {
@@ -207,6 +243,15 @@ export default {
.item:nth-child(2n) {
margin-right: 0;
}
.img-nodata {
position: relative;
top: 40rpx;
left: 50%;
transform: translate(-50%, 0);
width: 352rpx;
height: 338rpx;
}
}
}
</style>
+97
View File
@@ -0,0 +1,97 @@
<script>
import {getFestival} from "@/api/product";
export default {
name: "festival", // 节日专题
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
topImage: '',
contents: []
}
},
onLoad() {
getFestival().then(({data}) => {
this.topImage = data.topImage;
this.contents = data.contents;
})
}
}
</script>
<template>
<view class="pkg-product-festival">
<image class="top-img" mode="widthFix" :src="topImage" v-if="topImage"/>
<view class="section" v-for="(content,cIndex) in contents" :key="cIndex">
<image class="section-bg" :src="content.backgroundImage" mode="widthFix"/>
<view class="list flex flex-wrap" :class="cIndex===0?'section12':'section8'">
<image :class="cIndex===0?'span12':'span8'" mode="scaleToFill" :src="item.image"
v-for="(item,index) in content.products" :key="index" @click="$global.navToGoods(item.id)"/>
</view>
</view>
</view>
</template>
<style scoped lang="less">
.pkg-product-festival {
image {
margin: 0;
padding: 0;
border: none;
vertical-align: middle;
}
.top-img {
width: 100vw;
height: auto;
}
.section12 {
padding: 0 32rpx;
}
.section8 {
padding: 0 16rpx;
}
.section {
position: relative;
width: 100vw;
.section-bg {
width: 100%;
height: auto;
}
.list {
position: absolute;
top: 350rpx;
left: 0;
width: 100vw;
}
.span12 {
width: 332rpx;
height: 520rpx;
margin: 0 22rpx 24rpx 0;
}
.span12:nth-child(2n) {
margin-right: 0;
}
.span8 {
width: 234rpx;
height: 384rpx;
margin: 0 8rpx 24rpx 0;
}
.span8:nth-child(3n) {
margin-right: 0;
}
}
}
</style>
+53 -42
View File
@@ -1,31 +1,26 @@
<template>
<view class="pkg-product-list">
<view class="search-box flex jc-between ai-center">
<input type="text" v-model="keyword" placeholder="搜索商品" placeholder-style="color:#949494" @confirm="search">
<image class="icon" :src="webUrl+'/20220903142935869059.png'" mode="scaleToFill" @click="search"></image>
</view>
<view class="first-half">
<view class="search-box flex jc-between ai-center">
<input type="text" v-model="keyword" placeholder="搜索商品" placeholder-style="color:#949494" @confirm="search">
<image class="icon" :src="webUrl+'/20220903142935869059.png'" mode="scaleToFill" @click="search"></image>
</view>
<swiper class="swiper-box" indicator-dots indicator-color="rgba(255,255,255,.3)" indicator-active-color="#fff"
autoplay circular v-if="bannerList.length>0">
<swiper-item v-for="(item,index) in bannerList" :key="index">
<image :src="item.pic" mode="scaleToFill" @click="$global.commonJump(item.uniappUrl)"/>
</swiper-item>
</swiper>
<swiper class="swiper-box" indicator-dots indicator-color="rgba(255,255,255,.3)" indicator-active-color="#fff"
autoplay circular v-if="bannerList.length>0">
<swiper-item v-for="(item,index) in bannerList" :key="index">
<image :src="item.pic" mode="scaleToFill" @click="$global.commonJump(item.uniappUrl)"/>
</swiper-item>
</swiper>
<swiper class="swiper-box" indicator-dots indicator-color="rgba(255,255,255,.3)" indicator-active-color="#fff"
autoplay circular v-else>
<swiper-item>
<view class="swiper-item uni-bg-blue">暂无内容</view>
</swiper-item>
</swiper>
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===0">
<image class="active" src="/static/images/v6/btn_active_left.png" @click="changeTab(0)"/>
<image class="inactive" src="/static/images/v6/btn_right.png" @click="changeTab(1)"/>
</view>
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===1">
<image class="inactive" src="/static/images/v6/btn_left.png" @click="changeTab(0)"/>
<image class="active" src="/static/images/v6/btn_active_right.png" @click="changeTab(1)"/>
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===0">
<image class="active" src="/static/images/v6/btn_active_left.png" @click="changeTab(0)"/>
<image class="inactive" src="/static/images/v6/btn_right.png" @click="changeTab(1)"/>
</view>
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===1">
<image class="inactive" src="/static/images/v6/btn_left.png" @click="changeTab(0)"/>
<image class="active" src="/static/images/v6/btn_active_right.png" @click="changeTab(1)"/>
</view>
</view>
<view class="body-box">
@@ -40,7 +35,8 @@
<scroll-view class="list flex flex-wrap" :style="{'height':listHeight}" :enable-flex="true"
:scroll-anchoring="true"
:scroll-y="true"
:scroll-with-animation="true" :enable-back-to-top="true" @scrolltolower="onLower" v-if="dataList.length>0">
:scroll-with-animation="true" :enable-back-to-top="true" @scrolltolower="onLower"
v-if="dataList.length>0">
<view v-for="(item, index) in dataList" :key="index">
<view class="item item-store" @click="goStore(item.id)" v-if="tabIndex===0">
<image class="cover" :src="item.cover" mode="scaleToFill"/>
@@ -59,8 +55,11 @@
</view>
</scroll-view>
<image class="img-nodata" :src="webUrl+'/20230912145123537792.png'" mode="scaleToFill" v-else-if="tabIndex===0"/>
<image class="img-nodata" :src="webUrl+'/20230912145113749133.png'" mode="scaleToFill" v-else/>
<view class="tc" v-else>
<image class="img-nodata" :src="webUrl+'/20230912145123537792.png'" mode="scaleToFill"
v-if="tabIndex===0"/>
<image class="img-nodata" :src="webUrl+'/20230912145113749133.png'" mode="scaleToFill" v-else/>
</view>
</view>
</view>
</view>
@@ -92,7 +91,9 @@ export default {
},
methods: {
init() {
wellnessFood().then(({data}) => this.bannerList = data.banner);
wellnessFood().then(({data}) => {
this.bannerList = data.banner
});
fetchCity(4).then(({data}) => {
this.asideList = data.group;
this.search();
@@ -128,7 +129,7 @@ export default {
});
}
},
handleData(data){
handleData(data) {
let that = this;
if (this.page === 1) {
this.dataList = [];
@@ -138,7 +139,6 @@ export default {
success: function (res) {
let len = that.dataList.length;
let {windowHeight} = res;
console.log("test data",windowHeight)
that.listHeight = "auto";
if (windowHeight > 600 && len > 4) {
that.listHeight = "100%";
@@ -179,8 +179,22 @@ export default {
padding-top: 16rpx;
background: #fff;
.first-half {
height: 612rpx;
z-index: 20;
}
.search-box {
margin-bottom: 32rpx;
}
.swiper-box {
margin-bottom: 32rpx;
}
.tab-box {
margin: 0 32rpx;
padding-bottom: 32rpx;
.active {
width: 342rpx;
@@ -195,14 +209,10 @@ export default {
}
}
.swiper-box {
margin: 20rpx auto 30rpx;
}
.body-box {
position: fixed;
top: 610rpx;
height: calc(100vh - 610rpx);
position: relative;
height: calc(100vh - 612rpx);
z-index: 10;
.store {
image {
@@ -218,14 +228,15 @@ export default {
}
}
.img-nodata{
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
.article-box {
padding-bottom: 20rpx;
}
.img-nodata {
width: 360rpx;
height: 360rpx;
vertical-align: middle;
margin-top: 60rpx;
}
}
}
+101
View File
@@ -0,0 +1,101 @@
<script>
import {getICH} from "@/api/product";
export default {
name: "heritage",
data() {
return {
contents: [],
topImage: '',
backgroundImage: '',
bgImgWidth: 0,
}
},
computed: {
scale() {
return 750 / this.bgImgWidth;
}
},
onLoad() {
this.init();
},
methods: {
init() {
getICH().then(({data}) => {
this.contents = data.contents;
this.topImage = data.topImage;
this.backgroundImage = data.backgroundImage;
this.bgImgWidth = data.backgroundImageWidth;
this.calcPosition();
})
},
// 计算位置
calcPosition() {
this.contents?.forEach(item => {
item.gx = item.x * this.scale;
item.gy = item.y * this.scale;
})
},
goDetails(item) {
if (!item.isLink) return;
if (item.type === 1) {
uni.navigateTo({
url: '/pkg_product/views/heritageVideo?id=' + item.id
})
} else {
uni.navigateTo({
url: '/pkg_product/views/heritageGoods?id=' + item.id
})
}
}
}
}
</script>
<template>
<view class="pkg-product-heritage">
<image style="width: 100%" :src="topImage" mode="widthFix"/>
<view class="main-box">
<image style="width: 100%" :src="backgroundImage" mode="widthFix"/>
<view class="item" :style="{'left':item.gx+'rpx','top':item.gy+'rpx'}" v-for="(item,index) in contents"
:key="index" @click="goDetails(item)">
<image class="img-item" :src="item.image"/>
<view class="title flex jc-center">{{ item.title }}</view>
</view>
</view>
</view>
</template>
<style scoped lang="less">
.pkg-product-heritage {
image {
vertical-align: middle;
}
.main-box {
position: relative;
.item {
position: absolute;
width: 160rpx;
font-size: 24rpx;
.title {
position: relative;
width: 100%;
white-space: nowrap;
}
}
.img-item {
width: 160rpx;
height: 160rpx;
}
}
}
</style>
+128
View File
@@ -0,0 +1,128 @@
<script>
import {getICHDetails} from "@/api/product";
export default {
name: "heritageGoods",
data() {
return {
id: null,
info: null,
}
},
onLoad(options) {
this.id = options.id;
this.getDetails();
},
methods: {
getDetails() {
getICHDetails(this.id).then(({data}) => this.info = data);
},
goGoods(id) {
uni.navigateTo({
url: "/pages/shop/GoodsCon/index?id=" + id
})
},
}
}
</script>
<template>
<view class="heritage-goods" v-if="info">
<image class="page-bg" :src="info.backgroundImage" mode="widthFix"/>
<view class="list-box flex flex-wrap">
<view class="item flex flex-col jc-between" v-for="(item,index) in info.products" :key="index"
@click="goGoods(item.productId)">
<view class="flex flex-col ai-center">
<image :src="item.image" mode="scaleToFill"/>
<view class="more-t">{{ item.storeName }}</view>
</view>
<view class="footer flex jc-between">
<view class="price">
<text>{{ item.price }}</text>
</view>
<view class="btn flex jc-center ai-center">立即购买</view>
</view>
</view>
</view>
</view>
</template>
<style scoped lang="less">
.heritage-goods {
position: relative;
image {
vertical-align: middle;
}
.page-bg {
width: 100vw;
height: auto;
}
.list-box {
position: absolute;
top: 9000rpx;
left: 0;
width: 100vw;
box-sizing: border-box;
padding: 0 32rpx;
}
.item {
width: 332rpx;
height: 490rpx;
margin-right: 22rpx;
margin-bottom: 22rpx;
background: #FFFEF3;
border-radius: 8rpx;
image {
width: 304rpx;
height: 304rpx;
margin-top: 10rpx;
border-radius: 8rpx;
vertical-align: middle;
}
.more-t {
width: 304rpx;
margin-top: 6rpx;
font-size: 36rpx;
font-weight: 600;
line-height: 48rpx;
color: #650000;
}
.footer {
padding: 0 14rpx 16rpx;
.price {
font-size: 28rpx;
font-weight: bold;
line-height: 52rpx;
color: #C40303;
text {
font-size: 36rpx;
}
}
.btn {
width: 120rpx;
height: 48rpx;
background: linear-gradient(180deg, #F57F25 0%, #F05353 100%);
border-radius: 4rpx;
color: #FFFFFF;
font-size: 24rpx;
}
}
}
.item:nth-child(2n) {
margin-right: 0;
}
}
</style>
+53
View File
@@ -0,0 +1,53 @@
<script>
import {getICHDetails} from "@/api/product";
export default {
name: "heritageVideo",
data() {
return {
id: null,
info: null,
}
},
onLoad(options) {
this.id = options.id;
this.getDetails();
},
methods: {
getDetails() {
getICHDetails(this.id).then(({data}) => this.info = data);
}
}
}
</script>
<template>
<view class="heritage-video" v-if="info">
<image class="page-bg" :src="info.backgroundImage" mode="widthFix"/>
<video :src="info.video" autoplay show-center-play-btn/>
<!-- <video id="myVideo" src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"-->
<!-- autoplay controls></video>-->
</view>
</template>
<style scoped lang="less">
.heritage-video {
position: relative;
min-height: 100vh;
.page-bg {
width: 100vw;
height: auto;
vertical-align: middle;
}
video {
position: absolute;
left: 33rpx;
top: 880rpx;
width: 684rpx;
height: 424rpx;
}
}
</style>
+100
View File
@@ -0,0 +1,100 @@
<script>
import {getHomestay} from "@/api/product";
export default {
name: "homestay", // 民宿专题
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
topImage: '',
contents: [],
id: null
}
},
onLoad(options) {
this.id = options.id;
getHomestay(this.id).then(({data}) => {
this.topImage = data.topImage;
this.contents = data.contents;
})
},
methods: {
goInnDetail(item) {
uni.navigateTo({
url: `/pagesInn/inn/innHome?id=${item.id}`
})
},
}
}
</script>
<template>
<view class="pkg-product-homestay">
<image class="top-img" mode="widthFix" :src="topImage" v-if="topImage"/>
<view class="section" v-for="(content,cIndex) in contents" :key="cIndex">
<image class="section-bg" :src="content.backgroundImage" mode="widthFix"/>
<view class="list flex flex-wrap" :class="cIndex===2?'section12':'section24'">
<image :class="cIndex===2?'span12':'span24'" mode="scaleToFill" :src="item.image"
v-for="(item,index) in content.hotels" :key="index" @click="goInnDetail(item)"/>
</view>
</view>
</view>
</template>
<style scoped lang="less">
.pkg-product-homestay {
image {
vertical-align: middle;
}
.top-img {
width: 100vw;
height: auto;
}
.section12 {
padding: 0 32rpx;
}
.section24 {
padding: 0 61rpx;
}
.section {
position: relative;
width: 100vw;
.section-bg{
width: 100%;
height: auto;
}
.list{
position: absolute;
top: 350rpx;
left: 0;
width: 100vw;
}
.span24 {
width: 628rpx;
height: 320rpx;
}
.span12 {
width: 332rpx;
height: 500rpx;
margin: 0 22rpx 24rpx 0;
}
.span12:nth-child(2n) {
margin-right: 0;
}
}
}
</style>
+12 -1
View File
@@ -39,6 +39,8 @@
<view class="price bold">{{ item.price }}</view>
</view>
</scroll-view>
<image class="img-nodata" :src="webUrl+'/20231023131208675588.png'" mode="scaleToFill" v-if="dataList.length===0"/>
</view>
</view>
</view>
@@ -58,7 +60,7 @@ export default {
dataList: [], // 列表数据
tabList: [],
cityId: null,
cityName: "桂林市",
cityName: "",
page: 1,
listHeight: "auto"
}
@@ -173,5 +175,14 @@ export default {
}
}
}
.img-nodata {
position: relative;
top: 200rpx;
left: 50%;
transform: translate(-50%, 0);
width: 352rpx;
height: 338rpx;
}
}
</style>
+17 -9
View File
@@ -32,8 +32,8 @@ export default {
this.init();
},
methods: {
changeShare(){
this.showShare=!this.showShare
changeShare() {
this.showShare = !this.showShare
},
init() {
getSeason(this.id).then(({data}) => {
@@ -44,11 +44,17 @@ export default {
getSeasonPoster(this.id).then(({data}) => this.posterUrl = data);
},
tapLeft() {
if (this.current === 0) return;
if (this.current === 0) {
this.current = this.info.swiper.length - 1;
return
}
this.current--;
},
tapRight() {
if (this.current + 1 === this.info.swiper.length) return;
if (this.current + 1 === this.info.swiper.length) {
this.current = 0;
return
}
this.current++;
},
@@ -149,7 +155,8 @@ export default {
</u-popup>
<view class="scroll-item">
<u-swiper :autoplay="false" :current="current" :list="info.swiper" height="1200rpx" radius="0" indicator
<u-swiper :autoplay="true" circular :current="current" :list="info.swiper" height="1200rpx" radius="0"
indicator
imgMode="scaleToFill"></u-swiper>
<image class="icon-direction icon-left" :src="webUrl+'/20230911105736198247.png'" mode="scaleToFill"
@click="tapLeft"/>
@@ -192,7 +199,7 @@ export default {
.share-label {
position: fixed;
top: 50%;
right: 32rpx;
right: 0;
width: 200rpx;
height: 56rpx;
background: rgba(255, 255, 255, 0.39);
@@ -208,12 +215,13 @@ export default {
}
}
.box-share{
.box-img{
.box-share {
.box-img {
width: 500rpx;
height: 889.5rpx;
}
.main-img{
.main-img {
width: 500rpx;
height: 889.5rpx;
}
+35 -2
View File
@@ -100,6 +100,11 @@
<script>
import CountDownUnit from "@/pkg_product/components/CountDownUnit.vue";
import {getSeckillRule, getSeckillTopList, getYxStoreSeckillIndex, getYxStoreSeckillPageList} from "@/api/goods";
import {secKillShareImage} from "@/api/share";
import {mapGetters} from "vuex";
import cookie from "@/utils/store/cookie";
import {userBindParent} from "@/api/user";
import {getUrlParam} from "@/utils/common.js";
export default {
name: "seckill",
@@ -119,10 +124,38 @@ export default {
endReach: false,
timeId: null,
nextList: [],
ruleContent: null
ruleContent: null,
partnerId: null
}
},
onLoad() {
computed: mapGetters(["userInfo", "isLogin"]),
onShareAppMessage() {
return new Promise(async (resolve, reject) => {
const {status, data} = await secKillShareImage();
if (status === 200) {
resolve({
title: '探寻有趣有味的生活方式',
path: '/pkg_product/views/seckill?partnerId=' + this.userInfo.uid,
imageUrl: data
})
}
})
},
onLoad(options) {
if (options.partnerId) {
this.partnerId = options.partnerId || null;
} else {
let obj = uni.getEnterOptionsSync();
if (options.scene != null || obj.query.scene != null) {
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene);
this.partnerId = getUrlParam(query, "partnerId") || null;
}
}
if (this.partnerId) {
cookie.set("spread", this.partnerId);
userBindParent({spread: parseInt(this.partnerId)});
}
this.fetchSession();
getSeckillRule().then(({data}) => this.ruleContent = data);
getSeckillTopList(1, 10).then(({data}) => this.topList = data.records);