529 lines
11 KiB
Vue
529 lines
11 KiB
Vue
<template>
|
|
<view class="claim-detail">
|
|
<uni-nav-bar :fixed="true" title="认植认养详情" backgroundColor="none" color="#FFFFFF" leftIcon="icon-left"></uni-nav-bar>
|
|
|
|
<swiper class="banner-swiper" circular autoplay>
|
|
<swiper-item>
|
|
<image class="banner-img" mode="aspectFill" src="@/static/image/imgicon/banner.png"></image>
|
|
</swiper-item>
|
|
</swiper>
|
|
|
|
<view class="headr-wrap">
|
|
<view class="flex">
|
|
<view class="flex-1">
|
|
<view class="name">大鹅大鹅大鹅大鹅</view>
|
|
<view class="intro">已有178人参加</view>
|
|
</view>
|
|
<view class="money">
|
|
<text>¥</text>
|
|
299
|
|
</view>
|
|
</view>
|
|
<view class="headr-info flex">
|
|
<view class="headr-info-item flex-1">
|
|
<text>品种</text>
|
|
额
|
|
</view>
|
|
<view class="headr-info-item flex-1">
|
|
<text>产量</text>
|
|
3kg
|
|
</view>
|
|
<view class="headr-info-item flex-1">
|
|
<text>周期</text>
|
|
365天
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="title-item">
|
|
<view class="title">实时数据</view>
|
|
<view class="weather-wrap">
|
|
<view class="weather-item" v-for="i in 5">
|
|
<image class="icon" mode="aspectFit" src="@/static/image/imgicon/weather_icon1.png"></image>
|
|
<view class="flex-1">
|
|
<view class="label">湿度值</view>
|
|
<view class="count">
|
|
11.0
|
|
<text>%</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="title-item">
|
|
<view class="title">认养收获</view>
|
|
</view>
|
|
<view class="title-item">
|
|
<view class="title">认养规则</view>
|
|
</view>
|
|
<view class="title-item">
|
|
<view class="title">认养详情</view>
|
|
</view>
|
|
<view class="space-max-footer"></view>
|
|
<view class="footer-btn fill-base fix">
|
|
<view class="footer-item flex-between">
|
|
<view class="flex-warp f-caption c-title">
|
|
<view @tap.stop="$util.goUrl({ url: detail.farmer_info.mobile, openType: 'call' })" class="min-but flex-center flex-column">
|
|
<image class="img-icon" mode="aspectFit" src="@/static/image/imgicon/kefu_icon.png"></image>
|
|
<view>客服</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="flex-1 money-box">
|
|
<text class="old text-delete">¥399</text>
|
|
<text class="unit">¥</text>
|
|
<text>399</text>
|
|
</view>
|
|
<view class="flex-warp" v-if="detail.collage_data && detail.collage_data.id">
|
|
<view @tap.stop="toOrder" class="order-btn flex-center">单独认养</view>
|
|
<view @tap.stop="toOrder(1)" class="order-btn flex-center">去众筹</view>
|
|
</view>
|
|
<view @tap.stop="toOrder" class="order-btn flex-center" v-else>立即认养</view>
|
|
</view>
|
|
<view class="space-safe"></view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState, mapMutations } from 'vuex';
|
|
export default {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
options: {},
|
|
detail: {},
|
|
bannerCurrent: 0,
|
|
bannerList: [],
|
|
typeList: [],
|
|
current: 0,
|
|
param: {
|
|
page: 1,
|
|
limit: 10
|
|
},
|
|
list: {
|
|
data: []
|
|
},
|
|
loading: true,
|
|
lockTap: false
|
|
};
|
|
},
|
|
computed: mapState({
|
|
primaryColor: (state) => state.config.configInfo.primaryColor,
|
|
subColor: (state) => state.config.configInfo.subColor,
|
|
configInfo: (state) => state.config.configInfo,
|
|
userInfo: (state) => state.user.userInfo,
|
|
haveOperItem: (state) => state.order.haveOperItem
|
|
}),
|
|
onLoad(options) {
|
|
this.$util.showLoading();
|
|
this.options = options;
|
|
this.updateOrderItem({
|
|
key: 'haveOperItem',
|
|
val: false
|
|
});
|
|
this.initIndex();
|
|
},
|
|
onUnload() {
|
|
if (!this.haveOperItem) return;
|
|
this.$util.back();
|
|
},
|
|
onPullDownRefresh() {
|
|
// #ifndef APP-PLUS
|
|
uni.showNavigationBarLoading();
|
|
// #endif
|
|
this.initRefresh();
|
|
uni.stopPullDownRefresh();
|
|
},
|
|
onShareAppMessage(e) {
|
|
let { id: pid } = this.userInfo;
|
|
let { id, title, cover: imageUrl } = this.detail;
|
|
let path = `/claim/pages/detail?id=${id}&pid=${pid}`;
|
|
this.$util.log(path);
|
|
return {
|
|
title,
|
|
imageUrl,
|
|
path
|
|
};
|
|
},
|
|
methods: {
|
|
...mapMutations(['updateOrderItem']),
|
|
async initIndex(refresh = false) {
|
|
let { id } = this.options;
|
|
let data = await this.$api.claim.claimInfo({
|
|
id
|
|
});
|
|
data.markers = [
|
|
{
|
|
iconPath: 'https://lbqnyv2.migugu.com/images/12/2018/11/A33zQycihMM33y337LH23myTqTl3tl.png',
|
|
id: 0,
|
|
latitude: data.lat,
|
|
longitude: data.lng,
|
|
width: 28,
|
|
height: 28
|
|
}
|
|
];
|
|
|
|
let {
|
|
imgs = [],
|
|
monitor = [],
|
|
user_start_collage = {
|
|
id: 0
|
|
}
|
|
} = data;
|
|
|
|
let bannerList = [];
|
|
let typeList = [];
|
|
if (imgs && imgs.length > 0) {
|
|
imgs.map((item) => {
|
|
bannerList.push({
|
|
img: item,
|
|
link: '',
|
|
link_type: 'img'
|
|
});
|
|
});
|
|
typeList.push({
|
|
title: '图片',
|
|
type: 'img'
|
|
});
|
|
}
|
|
if (monitor && monitor.length > 0) {
|
|
monitor.map((item) => {
|
|
bannerList.push({
|
|
img: item.cover,
|
|
link: item.id,
|
|
link_type: 'monitor'
|
|
});
|
|
});
|
|
typeList.push({
|
|
title: '监控',
|
|
type: 'monitor'
|
|
});
|
|
}
|
|
this.typeList = typeList;
|
|
this.bannerList = bannerList;
|
|
this.detail = data;
|
|
this.$util.hideAll();
|
|
await this.getList();
|
|
if (user_start_collage && user_start_collage.id && !refresh) {
|
|
this.$refs.show_collage_share.open();
|
|
}
|
|
},
|
|
initRefresh() {
|
|
this.initIndex(true);
|
|
},
|
|
countEnd() {
|
|
this.$util.log('倒计时完了');
|
|
setTimeout(() => {
|
|
this.initRefresh();
|
|
}, 1000);
|
|
},
|
|
linkpress(res) {
|
|
console.log('linkpress', res);
|
|
// #ifdef APP-PLUS
|
|
this.$util.goUrl({
|
|
url: res.href,
|
|
openType: 'web'
|
|
});
|
|
// #endif
|
|
},
|
|
async getList() {
|
|
let { list: oldList } = this;
|
|
let { id: goods_id } = this.options;
|
|
let param = Object.assign({}, this.param, {
|
|
goods_id,
|
|
type: 1,
|
|
is_goods: 0
|
|
});
|
|
let newList = await this.$api.mine.goodsEvaluateList(param);
|
|
if (this.param.page == 1) {
|
|
this.list = newList;
|
|
} else {
|
|
newList.data = oldList.data.concat(newList.data);
|
|
this.list = newList;
|
|
}
|
|
this.loading = false;
|
|
this.$util.hideAll();
|
|
},
|
|
handerSwiperChange(e) {
|
|
let { current } = e.detail;
|
|
this.bannerCurrent = current;
|
|
},
|
|
handerBannerClick(index) {
|
|
let item = this.bannerList[index];
|
|
let { link_type: openType, link: id, img } = item;
|
|
if (openType == 'monitor') {
|
|
let url = `/home/pages/monitor/detail?id=${id}`;
|
|
this.$util.goUrl({
|
|
url
|
|
});
|
|
return;
|
|
}
|
|
uni.previewImage({
|
|
current: img,
|
|
urls: [img]
|
|
});
|
|
},
|
|
async toMap() {
|
|
let { lat, lng, address } = this.detail;
|
|
await this.$util.checkAuth({
|
|
type: 'userLocation'
|
|
});
|
|
await uni.getLocation({
|
|
type: 'gcj02'
|
|
});
|
|
await uni.openLocation({
|
|
latitude: lat * 1,
|
|
longitude: lng * 1,
|
|
name: address,
|
|
scale: 28
|
|
});
|
|
},
|
|
toPreviewImage(index, aindex) {
|
|
let { imgs: urls } = this.list.data[index];
|
|
this.$util.previewImage({
|
|
current: urls[aindex],
|
|
urls
|
|
});
|
|
},
|
|
toJoin(index) {
|
|
let { id: cid, claim_id, user_id, can_join } = this.detail.collage_list[index];
|
|
let { join_times } = this.detail.collage_data;
|
|
let { id: uid } = this.userInfo;
|
|
if (user_id == uid || !can_join) {
|
|
this.$util.showToast({
|
|
title: user_id == uid ? `不能参与自己发起的众筹哦` : `您已参与此众筹或已达到参与次数${join_times}`
|
|
});
|
|
return;
|
|
}
|
|
let url = `/claim/pages/order?id=${claim_id}&cid=${cid}&type=2`;
|
|
this.$util.goUrl({
|
|
url
|
|
});
|
|
},
|
|
toOrder(type = 0) {
|
|
let { id } = this.options;
|
|
let {
|
|
collage_data = {
|
|
id: 0
|
|
},
|
|
user_start_collage = {
|
|
id: 0
|
|
}
|
|
} = this.detail;
|
|
let { id: cid = 0, can_start, start_times } = collage_data;
|
|
if (type == 1 && user_start_collage && user_start_collage.id) {
|
|
this.$refs.show_collage_share.open();
|
|
return;
|
|
}
|
|
if (type == 1 && !can_start) {
|
|
this.$util.showToast({
|
|
title: `您已达到发起众筹次数${start_times}`
|
|
});
|
|
return;
|
|
}
|
|
let url = `/claim/pages/order?id=${id}&cid=${cid}&type=${type}`;
|
|
this.$util.goUrl({
|
|
url
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.claim-detail {
|
|
min-height: 100vh;
|
|
background: #ffffff;
|
|
}
|
|
|
|
.banner-swiper {
|
|
height: 480rpx;
|
|
width: 100%;
|
|
.banner-img {
|
|
display: block;
|
|
height: 100%;
|
|
width: 100%;
|
|
border-radius: 0 0 12rpx 12rpx;
|
|
}
|
|
}
|
|
|
|
.headr-wrap {
|
|
margin: -110rpx 28rpx 0;
|
|
padding: 20rpx 28rpx;
|
|
background: #ffffff;
|
|
box-shadow: 0rpx 8rpx 8rpx rgba(229, 229, 229, 0.25);
|
|
border-radius: 18rpx;
|
|
position: relative;
|
|
z-index: 1;
|
|
|
|
.name {
|
|
line-height: 40rpx;
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
}
|
|
|
|
.intro {
|
|
margin-top: 4rpx;
|
|
line-height: 34rpx;
|
|
font-weight: 500;
|
|
font-size: 24rpx;
|
|
color: #777777;
|
|
}
|
|
.money {
|
|
line-height: 56rpx;
|
|
font-weight: bold;
|
|
color: #ff0000;
|
|
font-size: 40rpx;
|
|
margin: 12rpx 0 0 20rpx;
|
|
text {
|
|
font-size: 24rpx;
|
|
vertical-align: baseline;
|
|
}
|
|
}
|
|
|
|
.headr-info {
|
|
margin-top: 46rpx;
|
|
}
|
|
|
|
.headr-info-item {
|
|
line-height: 40rpx;
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
text {
|
|
color: #999999;
|
|
margin-right: 12rpx;
|
|
vertical-align: baseline;
|
|
}
|
|
}
|
|
}
|
|
|
|
.title-item {
|
|
margin: 0 28rpx;
|
|
padding: 28rpx 0 36rpx;
|
|
position: relative;
|
|
&::after {
|
|
content: ' ';
|
|
display: block;
|
|
border-top: 1px solid #f2f2f2;
|
|
width: 200%;
|
|
height: 0;
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
transform: scale(0.5);
|
|
transform-origin: 0 0;
|
|
}
|
|
|
|
.title {
|
|
line-height: 40rpx;
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
.weather-wrap {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
|
|
.weather-item {
|
|
width: 214rpx;
|
|
background: rgba(19, 186, 231, 0.1);
|
|
border-radius: 12rpx;
|
|
margin: 0 28rpx 20rpx 0;
|
|
padding: 18rpx 0 16rpx 26rpx;
|
|
display: flex;
|
|
align-items: flex-start;
|
|
|
|
&:nth-child(3) {
|
|
margin-right: 0;
|
|
}
|
|
|
|
.icon {
|
|
width: 36rpx;
|
|
height: 36rpx;
|
|
margin-right: 8rpx;
|
|
}
|
|
|
|
.label {
|
|
line-height: 34rpx;
|
|
font-weight: 500;
|
|
font-size: 24rpx;
|
|
color: #777777;
|
|
margin-bottom: 2rpx;
|
|
}
|
|
|
|
.count {
|
|
line-height: 44rpx;
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
color: #13bae7;
|
|
text {
|
|
font-size: 24rpx;
|
|
vertical-align: baseline;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.footer-btn {
|
|
bottom: 0;
|
|
|
|
.footer-item {
|
|
height: 96rpx;
|
|
padding: 0 30rpx;
|
|
.min-but {
|
|
line-height: 34rpx;
|
|
font-weight: 500;
|
|
font-size: 24rpx;
|
|
color: #777777;
|
|
text-align: center;
|
|
padding: 0 8rpx;
|
|
}
|
|
.img-icon {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
display: block;
|
|
margin: 0 auto;
|
|
}
|
|
}
|
|
|
|
.money-box {
|
|
line-height: 56rpx;
|
|
font-weight: bold;
|
|
font-size: 40rpx;
|
|
color: #ff0000;
|
|
text-align: right;
|
|
padding: 0 6rpx;
|
|
padding: 16rpx 6rpx 0;
|
|
|
|
.old {
|
|
font-size: 28rpx;
|
|
color: #777777;
|
|
}
|
|
.unit {
|
|
font-size: 24rpx;
|
|
margin-left: 6rpx;
|
|
}
|
|
|
|
text {
|
|
vertical-align: baseline;
|
|
}
|
|
}
|
|
|
|
.order-btn {
|
|
width: 244rpx;
|
|
height: 72rpx;
|
|
background: linear-gradient(180deg, #43c5fe 0%, #358ffd 100%);
|
|
border-radius: 72rpx;
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
color: #ffffff;
|
|
}
|
|
}
|
|
</style>
|