推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

601 lines
14 KiB

<template>
<view>
<view class="head-box"></view>
<uv-navbar autoBack title="活动详情" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar>
<view class="content">
<view class="content-head">
<image class="image-box" :src="imageArr" mode="aspectFill"></image>
<view class="msg-box">
<view class="msg-box-title">{{activityDetails.title}}</view>
<view class="msg-box-time">开始时间{{activityDetails.startTime}}</view>
<view class="msg-box-address">
<view class="msg-box-address-text">活动地址{{activityDetails.address}}</view>
<view class="address-icon" @click="daohang">
<image src="@/static/image/home/address-icon-2.png" mode="aspectFill"></image>
<view>导航</view>
</view>
</view>
<view class="lingdui-box">
<image class="use-img" :src="adminUserInfo.headImage" mode="aspectFill"></image>
<view class="lingdui-msg">
<view class="lingdui-msg-name">
<view>{{adminUserInfo.nickName}}</view>
<view class="name-tip">主理人</view>
</view>
<view>
<uv-rate :count="count"
disabled
v-model="numValue" size="23" activeColor="#FFA200"></uv-rate>
</view>
</view>
<view class="add-wx" @click="$refs.ewmpopup.open();">添加微信</view>
</view>
</view>
</view>
<view class="lv-miaoshu">
<view class="title-box">活动描述</view>
<view class="value-box">
<view class="uv-content lv-msg-box">
<uv-parse :content="activityDetails.details"></uv-parse>
</view>
</view>
<!-- <view class="value-box">
<view class="lv-msg-box">
当金黄的落叶轻柔地铺满了小城的每个角落,我们知道,最温柔的季节已悄然而至。在这个收获的季节里,我们诚挚邀请您加入我们的秋日私旅
</view>
</view> -->
<view class="title-box">注意事项</view>
<view class="value-box">
<view class="lv-msg-box">
{{ activityDetails.precautions}}
</view>
</view>
</view>
</view>
<view class="bottom-box">
<view class="price-box">
<view class="peice-val"><text>¥</text>{{activityDetails.price}}</view>
<view>报名费用</view>
</view>
<view class="caozuo-box">
<view class="caozuo-item border-r"
@click="collect"
v-if="!isCollect">
<image src="./static/shoucang-icon.png"
mode=""></image>
<text>收藏</text>
</view>
<view class="caozuo-item border-r isCollect"
@click="collect"
style=""
v-else>
<text>已收藏</text>
</view>
<button type="primary" style="background-color: transparent;height: 100rpx;font-size: 20rpx;padding: 0;" open-type="share" >
<view class="caozuo-item">
<image src="./static/zhuanfa-icon.png" mode=""></image>
<text style="line-height: initial;">转发</text>
</view>
</button>
</view>
<!-- <view class="btn-box" @click="toBaoming">立即报名</view> -->
<!-- <view class="btn-box end-btn">已结束</view> -->
<view class="btn-box"
v-if="activityDetails.state == 0"
@click="toBaoming">立即报名</view>
<view class="btn-box-2"
v-if="activityDetails.state == 1"
>已结束</view>
</view>
<uv-popup ref="popup" mode="bottom" bgColor="">
<view class="popup-cont">
<view class="popup-title">
<view></view>
<view>选择活动状态</view>
<uv-icon name="close" color="#fff" @click="$refs.popup.close();"></uv-icon>
</view>
<view class="popup-list">
<view class="list-item" v-for="(item,i) in typeList" :key="i" @click="chooseClick(item,i)">
<view class="item-l" :class="chooseIndex == i ? 'chooose-class' : ''">
<view>{{item.name}}</view>
<view class="item-l-val">¥{{item.price}}</view>
</view>
<uv-icon name="checkmark" color="#FF5858" v-if="chooseIndex == i"></uv-icon>
</view>
</view>
<view class="confirm-box">
<uv-button @click="confirmClick(chooseIndex)" text="确定" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button>
</view>
</view>
</uv-popup>
<uv-popup ref="ewmpopup" mode="center" round="30rpx">
<view class="pop-cont">
<uv-image :src="ewmImg" width="380rpx" height="380rpx"></uv-image>
</view>
</uv-popup>
</view>
</template>
<script>
export default{
data() {
return {
activityDetails:{},
adminUserInfo:{},
btnCustomStyle:{
color:'#FF5858'
},
chooseIndex:0,
bgColor:'transparent',
count:5,
numValue:0,
ewmImg:'',
typeList:[
{
name:'早鸟票',
price:168
},
{
name:'单人票',
price:198.01
},
{
name:'尊享票',
price:268
}
],
activityId:'',
isCollect : false,
}
},
computed:{
imageArr() {
return this.activityDetails.image
&& this.activityDetails.image.split(',')[0]
}
},
onShareAppMessage(res) {
console.log(res)
if (res.from === 'button') {
// 来自详情页页面内分享按
return {
title:this.activityDetails.title,
path: `/pages_order/huodong-detail?activityId=${this.activityId}`,
imageUrl: this.imageArr[0],
success: function(res) {
// 转发成功
console.log('转发成功')
},
fail: function(res) {
// 转发失败
}
};
}
// 设置转发的参数
return {
title:this.activityDetails.title,
path: `/pages_order/huodong-detail?activityId=${this.activityId}`,
imageUrl: this.imageArr[0],
success: function(res) {
console.log(res, '发生过是');
if (res.errMsg == 'shareAppMessage:ok') {
console.log("成功", res)
}
},
fail: function(res) {
console.log("失败", res)
}
}
},
onPageScroll(e) {
if(e.scrollTop > 50) {
this.bgColor = '#49070c'
}else{
this.bgColor = 'transparent'
}
},
onLoad({activityId}) {
this.activityId = activityId
this.activityInfo(activityId)
},
methods:{
daohang() {
uni.openLocation({
latitude: Number(this.activityDetails.latitude),
longitude: Number(this.activityDetails.longitude),
success: function () {
console.log('success');
},
fail:(error)=> {
console.log('error',error);
}
});
},
activityInfo(activityId) {
let data = {activityId}
if(uni.getStorageSync('token')){
data.token = uni.getStorageSync('token')
}
this.$api('activityInfo', data,res=> {
if(res.code==200) {
this.activityDetails = res.result.activityInfo
this.numValue = res.result.adminUser.num
this.ewmImg = res.result.adminUser.img
this.adminUserInfo = res.result.adminUserInfo
this.isCollect = res.result.collect
this.typeList[0].price = res.result.activityInfo.birdPrice;
this.typeList[1].price = res.result.activityInfo.personPrice;
this.typeList[2].price = res.result.activityInfo.expensivePrice;
}
})
},
toBaoming() {
this.$refs.popup.open();
},
chooseClick(item,i) {
this.chooseIndex = i
},
collect(){
this.$api('collect', {
id : this.activityId,
type : 0,
}, res => {
this.activityInfo(this.activityId)
if(res.code == 200){
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
confirmClick(typePrice) {
this.$api('createOrder',{
id:this.activityId,
typePrice:typePrice,
type:0
},res=>{
if(res.code === 200) {
uni.navigateTo({
url: '/pages_order/payOrder?id=' + res.result.id
})
// uni.requestPaymentWxPay(res)
// .then(res => {
// uni.showToast({
// title: '下单成功',
// icon: 'none'
// })
// setTimeout(uni.switchTab, 800, {
// url: '/pages/index/cart'
// })
// }).catch(n => {
// // setTimeout(uni.switchTab, 800, {
// // url: '/pages/index/cart'
// // })
// })
}
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #060504;
}
</style>
<style lang="scss" scoped>
.pop-cont {
border-radius: 30rpx;
padding: 10rpx;
}
.head-box {
background: url('@/static/image/nav-bg.png') no-repeat;
background-size: 100% 100%;
width: 100%;
height: 534rpx;
position: absolute;
z-index: -1;
}
.content {
margin-top: 40rpx;
padding: 0 30rpx 170rpx;
padding-top: calc(var(--status-bar-height) + 130rpx);
.content-head {
position: relative;
.image-box {
width: 100%;
height: 546rpx;
border-radius: 12rpx;
}
.msg-box {
background: #1B1713;
border-radius: 27rpx 27rpx 67rpx 67rpx;
position: absolute;
top: 429rpx;
left: 0;
right: 0;
padding-top: 38rpx;
.msg-box-title {
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
margin-bottom: 40rpx;
padding-left: 38rpx;
}
.msg-box-time {
font-weight: 400;
font-size: 27rpx;
color: #999999;
padding-left: 38rpx;
}
.msg-box-address {
font-weight: 400;
font-size: 27rpx;
color: #999999;
padding-left: 38rpx;
padding-right: 30rpx;
margin-top: 24rpx;
display: flex;
justify-content: space-between;
&-text {
flex: 1;
}
.address-icon {
font-weight: 400;
font-size: 23rpx;
color: #999999;
display: flex;
image {
width: 25rpx;
height: 27rpx;
margin-right: 8rpx;
}
}
}
.lingdui-box {
margin-top: 43rpx;
height: 130rpx;
background: #26201A;
border-radius: 60rpx;
display: flex;
align-items: center;
padding: 0 40rpx;
.use-img {
width: 86rpx;
height: 86rpx;
border-radius: 50%;
}
.lingdui-msg {
flex: 1;
margin-left: 24rpx;
.lingdui-msg-name {
font-weight: 500;
font-size: 29rpx;
color: #E6E6E6;
display: flex;
align-items: center;
margin-bottom: 11rpx;
.name-tip {
padding: 0 20rpx;
height: 27rpx;
background: #3C2D17;
border-radius: 0rpx 12rpx 12rpx 12rpx;
font-weight: 500;
font-size: 19rpx;
color: #FFA200;
line-height: 27rpx;
margin-left: 14rpx;
}
}
}
.add-wx {
width: 172rpx;
height: 51rpx;
background: #3C2D17;
border-radius: 23rpx 23rpx 23rpx 23rpx;
text-align: center;
line-height: 51rpx;
font-weight: 400;
font-size: 25rpx;
color: #FF8A00;
}
}
}
}
.title-box {
font-weight: 500;
font-size: 33rpx;
color: #E6E6E6;
text-align: center;
position: relative;
&::after {
content: "";
position: absolute;
top: 50%;
left: 0;
transform: translate(0,-50%);
width: 100%;
height: 12rpx;
background: url(@/static/image/home/title-line.png) no-repeat;
background-size: 100% 100%;
}
}
.lv-miaoshu {
margin-top: 300rpx;
.value-box {
background: #1B1713;
border-radius: 27rpx;
margin-top: 35rpx;
margin-bottom: 52rpx;
.tabs-box {
border-bottom: 1px solid #2D241B;
}
.lv-msg-box {
padding: 20rpx 40rpx;
font-weight: 400;
font-size: 27rpx;
color: #fff;
line-height: 41rpx;
}
}
}
}
.bottom-box {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 150rpx;
background-color: #1B1713;
display: flex;
align-items: center;
padding: 0 40rpx;
.price-box {
font-weight: 400;
font-size: 25rpx;
color: #999999;
flex: 1;
.peice-val {
font-weight: 500;
font-size: 40rpx;
color: #FF3535;
margin-bottom: 15rpx;
text {
font-size: 26rpx;
}
}
}
.caozuo-box {
display: flex;
align-items: center;
.caozuo-item {
font-weight: 400;
font-size: 20rpx;
color: #999999;
padding: 0 35rpx;
text-align: center;
height: 100rpx;
display: flex;
flex-direction: column;
align-items: center;
image {
width: 48rpx;
height: 48rpx;
margin-bottom: 10rpx;
}
}
.border-r {
position: relative;
// border-right: 1px solid #4A3E32;
&::after {
content: "";
width: 2rpx;
height: 47rpx;
position: absolute;
right: 0;
top: 50%;
transform: translate(0,-50%);
background-color: #4A3E32;
}
}
.isCollect{
color: #f40;
font-size: 28rpx;
height: 100%;
display: flex;
align-items: center;
}
}
.btn-box {
width: 252rpx;
height: 74rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
line-height: 74rpx;
background: url(@/static/image/home/hdqd-btn.png) no-repeat;
background-size: 100% 100%;
}
.btn-box-2 {
width: 252rpx;
height: 74rpx;
font-weight: 500;
font-size: 32rpx;
text-align: center;
line-height: 74rpx;
background-size: 100% 100%;
background: #333;
color: #999;
border-radius: 45rpx;
margin-bottom: 13rpx;
}
.end-btn {
background: #666666;
border-radius: 37rpx 37rpx 37rpx 37rpx;
}
}
.popup-cont {
width: 95%;
margin: 0 auto;
background-image: linear-gradient(to top, #000000, #331212);
height:662rpx;
border-radius: 33rpx 33rpx 0 0;
.popup-title {
display: flex;
align-items: center;
justify-content: space-between;
padding: 54rpx 52rpx;
font-weight: 500;
font-size: 29rpx;
color: #999999;
}
.popup-list {
padding: 0 50rpx;
.list-item {
display: flex;
justify-content: space-between;
align-items: center;
height: 110rpx;
border-bottom: 1px solid #3F3535;
.item-l {
font-weight: 500;
font-size: 29rpx;
color: #CCCCCC;
display: flex;
align-items: center;
.item-l-val {
margin-left: 40rpx;
}
}
.chooose-class {
color: #FF5858;
}
}
}
.confirm-box {
padding: 0 50rpx;
margin-top: 30rpx;
.confirm-btn-box {
}
}
}
</style>