[本时生活H5]

This commit is contained in:
2023-09-28 14:35:28 +08:00
parent f74b177f6d
commit 69824dedea
48 changed files with 9224 additions and 6635 deletions

View File

@@ -1,10 +1,19 @@
<template>
<view class="content">
<view class="content-border">
<view v-for="(item, idx) in adverts" :key="item.cover">
<image class="campusBanner" :src="item.cover" mode="widthFix"></image>
</view>
<view class="recommend"></view>
<!-- 卡片轮播 -->
<view class="indexBanner">
<view class="banner">
<swiper class="banner-swiper" interval="5000" autoplay indicator-dots>
<swiper-item v-for="(item, idx) in adverts" :key="item.cover">
<image class="banner-img" :src="item.cover"></image>
</swiper-item>
</swiper>
</view>
</view>
<!-- <view class="recommend"></view> -->
<!-- tab -->
<view class="indexTab">
<view class="indexTab-item" :class="{active : tabType == item.used}" @tap="orderTab" v-for="(item, index) in tabList" :key="index" :data-state="(item.used)">
@@ -74,8 +83,8 @@
<view class="couponItem">
<view class="couponItem-cont">
<view class="couponItem-top">
<view class="couponItem-cont-number">
<text>{{item.price}}</text>
<view class="couponItem-cont-image">
<image :src="item.cover" mode="widthFix"></image>
</view>
<view class="couponItem-cont-name">
<view class="nowrap couponItem-cont-title">
@@ -86,9 +95,9 @@
</view>
</view>
</view>
<navigator class="couponItem-btn" hover-class="none" :url="'/pages/giftPack/details?id=' + item.id">
<view class="couponItem-btn" @click="couponUrl(item.id, item.from)">
立即使用
</navigator>
</view>
</view>
<view class="couponItem-cont-text" v-if="item.couponShow">
<rich-text :nodes="item.remark"></rich-text>
@@ -130,8 +139,7 @@
</view>
</navigator>
</view>
<!-- 是否兑换弹出 -->
<view class="tipsBack" v-if="generalShow"></view>
<view class="tipsCont" v-if="generalShow">
@@ -157,12 +165,13 @@
</view>
</view>
</view>
</view>
</template>
<script>
import { index, coupon, monthsChoose } from '@/apis/interfaces/giftPack'
const jweixin = require('jweixin-module');
import { index, coupon, monthsChoose, shopsUrl, getAuthUrl, authInfo } from '@/apis/interfaces/giftPack'
import AMapLoader from '@vuemap/amap-jsapi-loader';
export default {
data() {
return {
@@ -172,11 +181,13 @@
couponArr : [],
numbers : '',
count : '',
openId : '',
codeData : '',
//Tab列表
tabList : [
{ title : "可兑换", used: 0 },
{ title : "已兑换", used: 1 }
// { title : "已兑换", used: 1 }
],
tabType : 0, //卡券状态
generalId : '', //卡券id
@@ -185,10 +196,46 @@
},
// 生命周期函数--监听页面加载
onLoad(options) {},
onLoad(options) {
if(options != ''){
this.codeData = options.code || '';
}
// 获取首页数据
this.indexInfo()
// window.location.href = "https://www.amap.com/search?query=%E8%9E%8D%E5%88%9B%E4%B9%90%E5%9B%AD&city=230100&geoobj=126.150528%7C45.61094%7C127.139298%7C46.008671&zoom=11"
// Key
// 秘钥73f1992898e143896d4529a8ffead6c3
// 开发文档:
// AMapLoader.load({
// key: "34ea3d2958aee3ffc154738551a976f9"
// }).then(AMap => {
// console.log(this.$refs.amap)
// let aMap = new AMap.Map('amap', {
// zoom:11,//级别
// center: [116.397428, 39.90923],//中心点坐标
// viewMode:'3D'//使用3D视图
// })
// console.log(AMap)
// }).catch(err => {
// console.log(err)
// })
},
// 生命周期函数--监听页面显示
onShow() {
console.log(this.codeData)
// 存储环境-月兑活动
getApp().globalData.envType = 'giftPEnv'
@@ -196,9 +243,15 @@
this.isUser = true
}
// 获取首页数据
this.indexInfo()
if(this.codeData != ''){
authInfo({
code: this.codeData
}).then(res=>{
// 获取首页数据
this.indexInfo()
}).catch(err=>{})
}
},
methods: {
// 首页数据
@@ -210,12 +263,11 @@
for(let val in listData){
listData[val].schemesShow = false
}
console.log(listData)
this.giftPackArr = listData
this.numbers = res.numbers
this.count = res.coupons_count
this.adverts = res.adverts
this.openId = res.h5_openid
}).catch(err=>{})
} else {
if(uni.getStorageSync("token")) {
@@ -276,6 +328,24 @@
uni.navigateTo({
url: '/pages/giftPack/list?id=' + id
})
// if(this.openId != null) {
// if(!can) {
// this.generalShow = !this.generalShow
// return
// }
// uni.navigateTo({
// url: '/pages/giftPack/list?id=' + id
// })
// return
// }
// oppid
// getAuthUrl({
// url: 'pages/giftPack/index'
// }).then(res=> {
// window.location.href = res
// })
},
// 兑换跳转
@@ -286,7 +356,23 @@
url: '/pages/giftPack/list?id=' + this.generalId
})
}).catch(err=>{})
}
},
// 优惠券跳转详情
couponUrl(id, from) {
if(from == 'washcar') {
shopsUrl(id).then(res=>{
const newUrl = res.url
window.location.href = newUrl
})
return
}
// 跳转分类页
uni.navigateTo({
url: '/pages/giftPack/details?id=' + id
})
},
}
}
</script>
@@ -302,11 +388,33 @@
.content-border {
border-bottom: 130rpx transparent solid;
}
// banner
.campusBanner {
width: 100%;
}
.indexBanner {
padding: 30rpx;
box-sizing: border-box;
}
.banner {
position: relative;
padding-top: 48%;
width: 100%;
background: white;
overflow: hidden;
z-index: 99;
border-radius: 10rpx;
.banner-swiper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.banner-img {
width: 100%;
height: 100%;
vertical-align: top;
}
}
}
// 推荐
.recommend {
@@ -515,6 +623,19 @@
text {
font-size: 54rpx;
}
}
.couponItem-cont-image {
width: 88rpx;
height: 88rpx;
margin-right: 10rpx;
border-radius: 50%;
padding: 10rpx;
box-sizing: border-box;
background-color: #fff1dd;
image {
width: 100%;
border-radius: 50%;
}
}
.couponItem-cont-name {
color: #72411f;