Compare commits
2 Commits
4f31adbcef
...
2686d4e81d
| Author | SHA1 | Date | |
|---|---|---|---|
| 2686d4e81d | |||
| 03ab44d2cb |
528
uniapp/uni-app/claim/pages/detail - 副本 (2).vue
Normal file
@@ -0,0 +1,528 @@
|
|||||||
|
<template>
|
||||||
|
<view class="claim-detail">
|
||||||
|
<uni-nav-bar :fixed="true" title="认植认养详情" backgroundColor="none" color="#FFFFFF"></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>
|
||||||
776
uniapp/uni-app/claim/pages/detail - 副本.vue
Normal file
@@ -0,0 +1,776 @@
|
|||||||
|
<template>
|
||||||
|
<view class="claim-detail" v-if="detail.id">
|
||||||
|
<view class='banner-info'>
|
||||||
|
<swiper class='banner-swiper' @change='handerSwiperChange' :autoplay="true">
|
||||||
|
<swiper-item v-for="(item,index) in bannerList" :key="index" @tap='handerBannerClick(index)'>
|
||||||
|
<image mode="aspectFill" class='banner-img' :src='item.img'></image>
|
||||||
|
<view class="banner-swiper img-bg c-base iconfont icon-zhibo abs flex-center"
|
||||||
|
v-if="bannerList[bannerCurrent].link_type == 'monitor'"></view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
<view class='banner-tagitem banner-tagitem_count'>{{bannerCurrent+1}}/{{bannerList.length}}</view>
|
||||||
|
<view class='banner-taglist'>
|
||||||
|
<view class='banner-tagitem'
|
||||||
|
:class="[{'banner-tagitem_active':item.type==bannerList[bannerCurrent].link_type},{'radius-10':typeList.length == 1},{'radius-left':typeList.length > 1 && index == 0},{'radius-right':typeList.length > 1 && index === typeList.length -1}]"
|
||||||
|
v-for="(item,index) in typeList" :key="index">
|
||||||
|
{{item.title}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="collage-info rel mb-md" v-if="detail.collage_data && detail.collage_data.id">
|
||||||
|
<image mode="aspectFill" class="collage-img abs" src="https://lbqny.migugu.com/admin/farm/collage.png">
|
||||||
|
</image>
|
||||||
|
<view class="collage-count abs">
|
||||||
|
<min-countdown :type="3" :targetTime="detail.collage_data.end_time * 1000" :color="primaryColor"
|
||||||
|
textColor="#fff" className="sm" @callback="countEnd">
|
||||||
|
</min-countdown>
|
||||||
|
<view class="flex-center f-icontext c-base mt-sm">距结束还剩</view>
|
||||||
|
</view>
|
||||||
|
<view class="collage-content pt-md pl-md f-icontext c-base abs">
|
||||||
|
<view class="f-lg-title"> ¥{{detail.collage_data.price}} </view>
|
||||||
|
<view class="flex-y-center">
|
||||||
|
<view class="f-caption text-delete">原价 ¥{{detail.price}} </view>
|
||||||
|
<view class="collage-num flex-center radius-4 ml-sm pl-sm pr-sm" :style="{color:primaryColor}">
|
||||||
|
{{detail.collage_data.success_num}}人团
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="pd-lg fill-base">
|
||||||
|
<view class="flex-center">
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<view class="max-566">
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
|
<view class="flex-1">
|
||||||
|
<!-- #endif -->
|
||||||
|
<view class="f-title c-title">{{detail.title}}</view>
|
||||||
|
<view class="flex-y-baseline">
|
||||||
|
<view class="price c-warning">¥{{detail.price}}</view>
|
||||||
|
<view class="f-caption c-caption ml-sm">/{{detail.unit}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<button open-type="share" class="clear-btn flex-center flex-column">
|
||||||
|
<i class="iconfont icon-share c-title"></i>
|
||||||
|
<view class="f-caption c-title">分享</view>
|
||||||
|
</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
</view>
|
||||||
|
<view class="f-caption c-caption">
|
||||||
|
<text decode="emsp" style="word-break:break-all;">{{detail.desc}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="fill-base pd-lg mt-md" v-if="detail.collage_list.length > 0">
|
||||||
|
<view class="flex-between">
|
||||||
|
<view class="f-paragraph c-title">不想自己开团? 可与下面小伙伴快速成团</view>
|
||||||
|
<view @tap="$util.goUrl({url:`/claim/pages/collage/more?id=${options.id}`})"
|
||||||
|
class="flex-y-center f-caption c-caption">
|
||||||
|
查看更多<i class="iconfont icon-right" style="font-size:24rpx"></i></view>
|
||||||
|
</view>
|
||||||
|
<view @tap="toJoin(index)" class="collage-item flex-center pt-lg pb-lg" :class="[{'b-1px-t':index!=0}]"
|
||||||
|
v-for="(item,index) in detail.collage_list" :key="index">
|
||||||
|
<image class="avatar radius" :src="item.user_info.avatarUrl"></image>
|
||||||
|
<view class="flex-1 flex-center ml-md">
|
||||||
|
<view class="flex-1 mr-md flex-between">
|
||||||
|
<view class="f-desc c-title max-150 ellipsis">{{item.user_info.nickName}}</view>
|
||||||
|
<view>
|
||||||
|
<view class="flex-between">
|
||||||
|
<view></view>
|
||||||
|
<view class="flex-y-center f-paragraph">差<view class="c-warning">
|
||||||
|
{{item.surplus_num}}
|
||||||
|
</view>人成团
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-y-center f-icontext c-caption">
|
||||||
|
剩<min-countdown :type="5" :targetTime="item.end_time * 1000" color="#999"
|
||||||
|
@callback="countEnd">
|
||||||
|
</min-countdown>结束
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="common-btn flex-center f-paragraph c-base" :style="{background:primaryColor}">去参与
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="count-list flex-y-center fill-base pd-lg mt-md">
|
||||||
|
<view class="count-item flex-center flex-column">
|
||||||
|
<view class="f-title c-title ellipsis">{{detail.breed}}</view>
|
||||||
|
<view class="f-caption c-caption">认养品种</view>
|
||||||
|
</view>
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="count-item flex-center flex-column">
|
||||||
|
<view class="f-title c-title ellipsis">{{detail.cycle}}天</view>
|
||||||
|
<view class="f-caption c-caption">认养周期</view>
|
||||||
|
</view>
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="count-item flex-center flex-column">
|
||||||
|
<view class="f-title c-title">{{detail.output}}kg</view>
|
||||||
|
<view class="f-caption c-caption">产量</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title">
|
||||||
|
<view class="common-nav-title flex-center c-title">
|
||||||
|
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||||
|
<view class="f-title text-bold flex-1">认养收获</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-center mt-md">
|
||||||
|
<image mode="aspectFill" lazy-load class="avatar lg box-shadow-mini radius-10"
|
||||||
|
:src="detail.harvest_cover">
|
||||||
|
</image>
|
||||||
|
<view class="flex-1 ml-lg f-paragraph c-title ellipsis">{{detail.harvest_text}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title"
|
||||||
|
v-if="detail.process && detail.process.length > 0">
|
||||||
|
<view class="common-nav-title flex-center c-title">
|
||||||
|
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||||
|
<view class="f-title text-bold flex-1">认养流程</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-warp" :class="[{'mt-md':index==0},{'mt-lg':index!=0}]"
|
||||||
|
v-for="(item,index) in detail.process" :key="index">
|
||||||
|
<image mode="aspectFill" lazy-load class="avatar sm" :src="item.cover"></image>
|
||||||
|
<view class="flex-1 ml-lg">
|
||||||
|
<view class="f-paragraph c-title">{{item.title}}</view>
|
||||||
|
<view class="f-caption c-caption">{{item.time}}</view>
|
||||||
|
<view class="f-caption c-desc">{{item.sub_title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="list.all_count>0">
|
||||||
|
<view class="mt-md pt-sm pl-lg pr-lg fill-base f-paragraph c-title">
|
||||||
|
<view class="common-nav-title flex-center c-title">
|
||||||
|
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||||
|
<view class="flex-1 flex-between">
|
||||||
|
<view class="f-title text-bold">评价({{list.all_count}})</view>
|
||||||
|
<view @tap.stop="$util.goUrl({url:`/mine/pages/evaluate/more?id=${options.id}&type=1`})"
|
||||||
|
class="flex-y-center f-paragraph c-caption">
|
||||||
|
<view>查看全部</view>
|
||||||
|
<i class="iconfont icon-right" style="font-size: 28rpx;"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-for="(item,index) in list.data" :key="index">
|
||||||
|
<view class="flex-warp fill-base pd-lg" :class="[{'b-1px-t':index!=0}]" v-if="index<2">
|
||||||
|
<image mode="aspectFill" lazy-load class="avatar sm radius" :src="item.user_info.avatarUrl">
|
||||||
|
</image>
|
||||||
|
<view class="flex-1 ml-lg">
|
||||||
|
<view class="flex-between">
|
||||||
|
<view class="f-paragraph c-title max-350 ellipsis">{{item.user_info.nickName}}</view>
|
||||||
|
<view class="f-icontext c-caption">{{item.create_time}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-warp">
|
||||||
|
<i class="iconfont icon-star-fill icon-font-color mr-sm"
|
||||||
|
:style="{backgroundImage: aindex < item.star ? '-webkit-linear-gradient(90deg, #FDCD47, #FFC000)' : '-webkit-linear-gradient(90deg, #eee, #eee)'}"
|
||||||
|
v-for="(aitem,aindex) in 5" :key="aindex"></i>
|
||||||
|
</view>
|
||||||
|
<view class="f-caption c-desc mt-md">
|
||||||
|
<text decode="emsp" style="word-break:break-all;">{{item.text || '该用户没有填写评价哦'}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-warp mt-md" v-if="item.imgs && item.imgs.length > 0">
|
||||||
|
<block v-for="(aitem,aindex) in item.imgs" :key="aindex">
|
||||||
|
<view class="eva-img sm radius-10 rel" v-if="aindex < 3">
|
||||||
|
<image @tap.stop="toPreviewImage(index,aindex)" mode="aspectFill"
|
||||||
|
class="eva-img sm radius-10" :src="aitem">
|
||||||
|
</image>
|
||||||
|
<view class="more f-caption c-base abs"
|
||||||
|
v-if="aindex == 2 && item.imgs.length > 3">
|
||||||
|
+{{item.imgs.length - 3}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title">
|
||||||
|
<view class="common-nav-title flex-center c-title">
|
||||||
|
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||||
|
<view class="f-title text-bold flex-1">认养环境</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-center">
|
||||||
|
<image mode="aspectFill" lazy-load class="avatar mini radius" :src="detail.farmer_info.cover">
|
||||||
|
</image>
|
||||||
|
<view class="flex-1 ml-md">{{detail.farmer_info.title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="map-info rel">
|
||||||
|
<map :latitude="detail.lat" :longitude="detail.lng" :markers="detail.markers" :enable-satellite="true">
|
||||||
|
</map>
|
||||||
|
<view @tap.stop="toMap" class="farmer-title flex-center pl-md pr-sm c-base radius abs">
|
||||||
|
<view class="f-desc max-500 ellipsis">
|
||||||
|
{{detail.farmer_info.title}}
|
||||||
|
</view>
|
||||||
|
<i class="iconfont icon-right"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="order-count-info fill-base"
|
||||||
|
v-if="detail.machine_info.data && detail.machine_info.data.length > 0">
|
||||||
|
<view class="flex-between pt-lg pl-lg pr-lg">
|
||||||
|
<view class="flex-y-baseline f-paragraph c-caption">
|
||||||
|
<view class="c-title text-bold mr-sm">实时数据</view>
|
||||||
|
<!-- <view>更新于:2021.09.10 16:24</view> -->
|
||||||
|
</view>
|
||||||
|
<!-- <i class="iconfont icon-shuaxin"></i> -->
|
||||||
|
</view>
|
||||||
|
<!-- <view class="pd-lg flex-center b-1px-b">
|
||||||
|
<view class="count-item flex-center flex-column">
|
||||||
|
<view class="f-paragraph c-title">28.7℃</view>
|
||||||
|
<view class="f-caption c-caption">热敏温度</view>
|
||||||
|
</view>
|
||||||
|
<view class="count-item flex-center flex-column b-1px-l b-1px-r">
|
||||||
|
<view class="f-paragraph c-title">28.7℃</view>
|
||||||
|
<view class="f-caption c-caption">噪声监测</view>
|
||||||
|
</view>
|
||||||
|
<view class="count-item flex-center flex-column">
|
||||||
|
<view class="f-paragraph c-title">28.7℃</view>
|
||||||
|
<view class="f-caption c-caption">移动监测</view>
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="pt-lg pl-lg pr-lg pb-md f-paragraph c-desc">
|
||||||
|
<view class="flex-y-baseline">
|
||||||
|
<view class="mr-md">无线温湿度</view>
|
||||||
|
<view>土壤电导率三合一</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<veiw class="flex-warp pb-md">
|
||||||
|
<view class="machine-item flex-warp f-desc c-caption mt-md"
|
||||||
|
v-for="(item,index) in detail.machine_info.data" :key="index">
|
||||||
|
<view class="num">{{`(${index*1+1})`}}</view>
|
||||||
|
<view class="text">{{item.text}}</view>
|
||||||
|
<view>{{item.value.length == 0 ? '无' : item.value}}</view>
|
||||||
|
</view>
|
||||||
|
</veiw>
|
||||||
|
<!-- <view class="flex-center pt-md"><i class="iconfont icon-down-bold" style="font-size: 28rpx;"></i></view> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mt-md pt-sm pl-lg pr-lg pb-lg fill-base f-paragraph c-title">
|
||||||
|
<view class="common-nav-title flex-center c-title">
|
||||||
|
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||||
|
<view class="f-title text-bold flex-1">详细说明</view>
|
||||||
|
</view>
|
||||||
|
<view class="pt-sm" v-if="detail.text">
|
||||||
|
<parser :html="detail.text" @linkpress="linkpress" show-with-animation lazy-load>加载中...</parser>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="space-max-footer"></view>
|
||||||
|
<view class="footer-btn fill-base fix">
|
||||||
|
<view class="footer-item flex-between pr-lg">
|
||||||
|
<view class="flex-warp f-caption c-title">
|
||||||
|
<view @tap.stop="$util.goUrl({url:`/pages/home`,openType:`switchTab`})"
|
||||||
|
class="flex-center flex-column pl-lg pr-lg">
|
||||||
|
<i class="iconfont icon-home"></i>
|
||||||
|
<view>首页</view>
|
||||||
|
</view>
|
||||||
|
<view @tap.stop="$util.goUrl({url:detail.farmer_info.mobile,openType:'call'})"
|
||||||
|
class="flex-center flex-column pl-md">
|
||||||
|
<i class="iconfont icon-dianhua text-bold"></i>
|
||||||
|
<view>客服</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flex-warp" v-if="detail.collage_data && detail.collage_data.id">
|
||||||
|
<view @tap.stop="toOrder" class="order-btn flex-center f-title c-base text-bold radius-20"
|
||||||
|
:style="{color:primaryColor,border:`1rpx solid ${primaryColor}`}">
|
||||||
|
单独认养
|
||||||
|
</view>
|
||||||
|
<view @tap.stop="toOrder(1)"
|
||||||
|
class="order-btn flex-center ml-md f-title c-base text-bold radius-20"
|
||||||
|
:style="{background:primaryColor,border:`1rpx solid ${primaryColor}`}">
|
||||||
|
去众筹
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @tap.stop="toOrder" class="order-btn md flex-center f-title c-base text-bold radius-20"
|
||||||
|
:style="{background:primaryColor}" v-else>立即认养
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="space-safe"></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<uni-popup ref="show_collage_share" type="center">
|
||||||
|
<view class="show-collage-share">
|
||||||
|
<view class="flex-center flex-column fill-base pd-lg radius-24">
|
||||||
|
<view class="f-md-title text-bold pt-lg pb-lg" :style="{color:primaryColor}">您有一个拼团正在进行中</view>
|
||||||
|
<view class="user-list flex-center mt-lg mb-lg">
|
||||||
|
<block v-for="(item,index) in detail.user_start_collage.user_avatar" :key="index">
|
||||||
|
<view class="avatar-group lg"
|
||||||
|
v-if="index < detail.user_start_collage.success_num > 3 ? 3 : detail.user_start_collage.success_num -1">
|
||||||
|
<image mode="aspectFill" lazy-load class="abs avatar fill-body radius" :src="item">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="detail.user_start_collage.surplus_num">
|
||||||
|
<i class="iconfont icon-more ml-sm pl-lg pr-lg"></i>
|
||||||
|
<view class="more-btn flex-center radius"><i class="iconfont icon-add"></i> </view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<min-countdown :type="2" :targetTime="detail.user_start_collage.end_time * 1000" color="#333"
|
||||||
|
textColor="#999" bgColor="#F7F7F7" className="md" @callback="countEnd">
|
||||||
|
</min-countdown>
|
||||||
|
<view class="f-desc c-caption mt-md mb-lg">还差{{detail.user_start_collage.surplus_num}}人成团,距离结束还剩
|
||||||
|
</view>
|
||||||
|
<view class="space-lg"></view>
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<button open-type="share" class="clear-btn share-btn flex-center f-sm-title"
|
||||||
|
:style="{background:primaryColor}">
|
||||||
|
邀请好友
|
||||||
|
</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef APP-PLUS -->
|
||||||
|
<view @click="toAppShare" class="share-btn flex-center f-sm-title"
|
||||||
|
:style="{background:primaryColor}">
|
||||||
|
邀请好友
|
||||||
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
|
<view class="space-lg"></view>
|
||||||
|
</view>
|
||||||
|
<i @tap="$refs.show_collage_share.close()" class="flex-center mt-lg iconfont icon-close c-base"></i>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</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 {
|
||||||
|
.collage-info {
|
||||||
|
width: 100%;
|
||||||
|
height: 143rpx;
|
||||||
|
|
||||||
|
.collage-img {
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 156rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collage-count {
|
||||||
|
right: 12rpx;
|
||||||
|
bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collage-content {
|
||||||
|
top: 0;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 140rpx;
|
||||||
|
|
||||||
|
.collage-num {
|
||||||
|
min-width: 76rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
background: #FFFB00;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.price,
|
||||||
|
.icon-share {
|
||||||
|
font-size: 42rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collage-item {
|
||||||
|
.avatar {
|
||||||
|
width: 68rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.count-list {
|
||||||
|
.count-item {
|
||||||
|
width: 249rpx;
|
||||||
|
|
||||||
|
.ellipsis {
|
||||||
|
max-width: 220rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
width: 1rpx;
|
||||||
|
height: 58rpx;
|
||||||
|
background: #CCCCCC;
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-info {
|
||||||
|
map {
|
||||||
|
width: 100%;
|
||||||
|
height: 450rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.farmer-title {
|
||||||
|
z-index: 9;
|
||||||
|
left: 15rpx;
|
||||||
|
bottom: 10rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
.iconfont {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-count-info {
|
||||||
|
.count-item {
|
||||||
|
width: 33.33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.machine-item {
|
||||||
|
width: 50%;
|
||||||
|
|
||||||
|
.num {
|
||||||
|
width: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
width: 150rpx;
|
||||||
|
padding-right: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.footer-btn {
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
.footer-item {
|
||||||
|
height: 114rpx;
|
||||||
|
|
||||||
|
.iconfont {
|
||||||
|
font-size: 42rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-btn {
|
||||||
|
width: 220rpx;
|
||||||
|
height: 78rpx;
|
||||||
|
transform: rotateZ(360deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-btn.md {
|
||||||
|
width: 444rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.show-collage-share {
|
||||||
|
width: 640rpx;
|
||||||
|
|
||||||
|
.user-list {
|
||||||
|
|
||||||
|
.more-btn {
|
||||||
|
width: 92rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
background: #F8F8F8;
|
||||||
|
border: 1px solid #DBDBDB;
|
||||||
|
|
||||||
|
.icon-add {
|
||||||
|
color: #D8D8D7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-btn {
|
||||||
|
width: 420rpx;
|
||||||
|
height: 94rpx;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-close {
|
||||||
|
font-size: 80rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
709
uniapp/uni-app/claim/pages/order - 副本.vue
Normal file
@@ -0,0 +1,709 @@
|
|||||||
|
<template>
|
||||||
|
<view class="claim-order" v-if="orderInfo.claim_info.id">
|
||||||
|
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
|
||||||
|
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="确认订单">
|
||||||
|
</uni-nav-bar>
|
||||||
|
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
|
||||||
|
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png">
|
||||||
|
</image>
|
||||||
|
<view class="space-lg"></view>
|
||||||
|
<view class="fill-base mt-md ml-md mr-md pd-lg box-shadow radius-24">
|
||||||
|
<view class="f-title c-title pb-lg b-1px-b">{{orderInfo.farmer_info.title}}</view>
|
||||||
|
<view class="flex-warp pt-lg pb-lg">
|
||||||
|
<image mode="aspectFill" lazy-load class="avatar lg radius-10" :src="orderInfo.claim_info.cover">
|
||||||
|
</image>
|
||||||
|
<view class="flex-1 ml-lg">
|
||||||
|
<view class="f-paragraph max-520 ellipsis">{{orderInfo.claim_info.title}}</view>
|
||||||
|
<block v-if="options.type">
|
||||||
|
<view class="flex-y-center f-desc c-warning mt-sm">众筹价<view
|
||||||
|
class="flex-y-baseline f-caption ml-sm">
|
||||||
|
¥<view class="f-sm-title text-bold">
|
||||||
|
{{orderInfo.claim_info[orderType[options.type]].price}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-icontext c-caption text-delete ml-sm">原价 ¥{{orderInfo.claim_info.price}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-center mt-md">
|
||||||
|
<view class="collage-tag flex-center f-caption c-base" :style="{background:primaryColor}">
|
||||||
|
{{orderInfo.claim_info[orderType[options.type]].success_num}}人团
|
||||||
|
</view>
|
||||||
|
<view class="flex-1"></view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<view class="flex-y-baseline f-paragraph c-warning mt-sm" v-else>¥{{orderInfo.claim_info.price}}
|
||||||
|
<view class="f-caption c-caption ml-sm">
|
||||||
|
/{{orderInfo.claim_info.unit}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flex-between pt-lg pb-lg b-1px-tb">
|
||||||
|
<view class="f-paragraph c-black">认养数量</view>
|
||||||
|
<view v-if="options.type">{{subForm.num}}</view>
|
||||||
|
<view class="add-remove-item flex-center" v-else>
|
||||||
|
<i @tap.stop="changeNum(-1,index)" class="iconfont icon-remove-square c-caption"></i>
|
||||||
|
<view class="number flex-center f-desc pl-sm pr-sm">{{subForm.num}}</view>
|
||||||
|
<i @tap.stop="changeNum(1,index)" class="iconfont icon-add-square"
|
||||||
|
:style="{color:primaryColor}"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="pt-lg pb-lg f-paragraph c-black">认养收获</view>
|
||||||
|
<view class="flex-center">
|
||||||
|
<image mode="aspectFill" lazy-load class="avatar sm radius-10"
|
||||||
|
:src="orderInfo.claim_info.harvest_cover"></image>
|
||||||
|
<view class="flex-1 ml-lg ellipsis">{{orderInfo.claim_info.harvest_text}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
|
||||||
|
<view class="flex-between pd-lg">
|
||||||
|
<view class="flex-y-center f-sm-title c-black"><i class="iconfont icon-peisong mr-sm"
|
||||||
|
:style="{color:primaryColor}"></i>配送周期</view>
|
||||||
|
<view class="f-paragraph">{{orderInfo.claim_info.send_cycle}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
|
||||||
|
<view class="flex-between pd-lg f-sm-title c-title b-1px-b">
|
||||||
|
<view class="text-bold">配送方式</view>
|
||||||
|
<view class="send-list flex-center radius" :style="{width:sendList.length==1?'90rpx':''}">
|
||||||
|
<view @tap.stop="toChangeItem('sendInd',index)" class="send-item flex-center f-paragraph radius"
|
||||||
|
:class="[{'c-base':sendInd == index}]" :style="{background:sendInd==index?primaryColor:''}"
|
||||||
|
v-for="(item,index) in sendList" :key="index">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @tap.stop="toChooseAddr" class="pd-lg flex-center"
|
||||||
|
v-if="sendList[sendInd].id == 1 || orderInfo.address.id">
|
||||||
|
<view class="flex-1">
|
||||||
|
<view class="flex-warp">
|
||||||
|
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx;margin-top: 6rpx;"></i>
|
||||||
|
<view class="f-paragraph c-title flex-1" :class="[{'max-520':sendList[sendInd].id == 2}]">
|
||||||
|
{{sendList[sendInd].id == 1 ? `${orderInfo.farmer_info.address}` : orderInfo.address.id ? `${orderInfo.address.address} ${orderInfo.address.address_info}`:''}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-y-baseline f-paragraph c-caption" style="margin:5rpx 0 0 38rpx;">
|
||||||
|
{{sendList[sendInd].id == 1 ? orderInfo.farmer_info.user_name : orderInfo.address.id ? orderInfo.address.user_name:'' }}
|
||||||
|
<view class="ml-lg">
|
||||||
|
{{sendList[sendInd].id == 1? orderInfo.farmer_info.mobile : orderInfo.address.id ? orderInfo.address.mobile : ''}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<i class="iconfont"
|
||||||
|
:class="[{'icon-dingwei':sendList[sendInd].id == 1},{'icon-right':sendList[sendInd].id == 2}]"></i>
|
||||||
|
</view>
|
||||||
|
<block v-else>
|
||||||
|
<view class="space-lg"></view>
|
||||||
|
<view class="space-lg"></view>
|
||||||
|
<view @tap.stop="toChooseAddr" class="add-btn flex-center f-paragraph c-desc"><i
|
||||||
|
class="iconfont icon-add-circle-fill mr-sm"></i>添加地址
|
||||||
|
</view>
|
||||||
|
<view class="space-lg"></view>
|
||||||
|
<view class="space-lg"></view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="sendList[sendInd].id == 1">
|
||||||
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg b-1px-b">
|
||||||
|
<view class="flex-y-center">
|
||||||
|
<i class="iconfont icon-required c-warning"></i>
|
||||||
|
<view class="item-text">姓名</view>
|
||||||
|
</view>
|
||||||
|
<input v-model="subForm.user_name" type="text" class="flex-1 f-paragraph"
|
||||||
|
placeholder-class="c-placeholder" :placeholder="rule[0].errorMsg" />
|
||||||
|
</view>
|
||||||
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
||||||
|
<view class="flex-y-center">
|
||||||
|
<i class="iconfont icon-required c-warning"></i>
|
||||||
|
<view class="item-text">手机号</view>
|
||||||
|
</view>
|
||||||
|
<input v-model="subForm.mobile" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder"
|
||||||
|
:placeholder="rule[1].errorMsg" />
|
||||||
|
<button open-type="getPhoneNumber" @getphonenumber="toAuthPhone"
|
||||||
|
class="clear-btn auth-phone-btn flex-center" :style="{color:primaryColor}">立即授权</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
|
||||||
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg b-1px-b">
|
||||||
|
<view class="flex-y-center">
|
||||||
|
<i class="iconfont icon-required c-warning"></i>
|
||||||
|
<view class="item-text">认养取名</view>
|
||||||
|
</view>
|
||||||
|
<input v-model="subForm.claim_name" type="text" class="flex-1 f-paragraph"
|
||||||
|
placeholder-class="c-placeholder" :placeholder="rule[2].errorMsg" />
|
||||||
|
</view>
|
||||||
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
||||||
|
<view class="flex-y-center">
|
||||||
|
<i class="iconfont icon-required c-base"></i>
|
||||||
|
<view class="item-text">订单备注</view>
|
||||||
|
</view>
|
||||||
|
<input v-model="subForm.text" type="text" class="flex-1 f-paragraph" maxlength="100"
|
||||||
|
placeholder-class="c-placeholder" placeholder="请输入订单备注" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="!options.type">
|
||||||
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
||||||
|
<view class="item-text">卡券优惠</view>
|
||||||
|
<view
|
||||||
|
@tap.stop="$util.goUrl({url:`/mine/pages/coupon/use?claim_id=${options.id}&num=${subForm.num}&type=2`})"
|
||||||
|
class="flex-y-center">
|
||||||
|
<view class="flex-1 text-right">
|
||||||
|
{{ orderInfo.coupon_id ? `-¥${orderInfo.coupon_discount}` : `${orderInfo.canUseCoupon}张可用` }}
|
||||||
|
</view>
|
||||||
|
<i class="iconfont icon-right"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="fill-base mt-md ml-md mr-md f-sm-title box-shadow radius-24">
|
||||||
|
<view @tap.stop="toChangeItem('payInd',index)"
|
||||||
|
class="flex-between ml-md mr-md pl-sm pr-sm pt-lg pb-lg b-1px-b" v-for="(item,index) in payList"
|
||||||
|
:key="index">
|
||||||
|
<view class="pay-item flex-y-center"><i class="iconfont mr-md" :class="[item.icon]"
|
||||||
|
:style="{color:item.id==1?primaryColor:item.id==2?subColor:'#01AAF2'}"></i>
|
||||||
|
<view class="flex-y-baseline">{{item.title}}
|
||||||
|
<view class="f-paragraph c-caption ml-sm" v-if="item.id==2">余额{{userInfo.balance || 0}}元
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<i class="pay-icon iconfont c-caption"
|
||||||
|
:class="[{'icon-xuanze':payInd != index},{'icon-radio-fill':item.is_disabled || payInd == index}]"
|
||||||
|
:style="{color:payInd==index?primaryColor:''}"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @tap.stop="toAgree" class="flex-warp f-paragraph mt-md pd-md"><i
|
||||||
|
class="agree-icon iconfont c-caption mr-sm"
|
||||||
|
:class="[{'icon-xuanze': !agree},{'icon-xuanze-fill': agree}]" style="margin-top: 3rpx;"
|
||||||
|
:style="{color:agree?primaryColor:''}"></i>
|
||||||
|
<view class="flex-y-center">购买代表您已同意<view @tap.stop="$util.goUrl({url:`/mine/pages/agreement?type=1`})"
|
||||||
|
:style="{color:primaryColor}">
|
||||||
|
《{{agreement}}》</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="space-max-footer"></view>
|
||||||
|
<view class="footer-btn fill-base fix">
|
||||||
|
<view class="footer-item flex-between pl-lg pr-lg">
|
||||||
|
<view class="flex-y-baseline f-paragraph c-title">
|
||||||
|
合计:<view class="f-sm-title c-warning text-bold">¥{{orderInfo.pay_price}}</view>
|
||||||
|
</view>
|
||||||
|
<!-- #ifdef APP-PLUS -->
|
||||||
|
<view @tap="toOrder" class="order-btn flex-center f-sm-title c-base text-bold radius-20"
|
||||||
|
:style="{background:primaryColor}">立即支付
|
||||||
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifndef APP-PLUS -->
|
||||||
|
<auth :needAuth="userInfo && !userInfo.nickName" :must="true" type="userInfo" @go="toOrder">
|
||||||
|
<view class="order-btn flex-center f-sm-title c-base text-bold radius-20"
|
||||||
|
:style="{background:primaryColor}">立即支付
|
||||||
|
</view>
|
||||||
|
</auth>
|
||||||
|
<!-- #endif -->
|
||||||
|
</view>
|
||||||
|
<view class="space-safe"></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions,
|
||||||
|
mapMutations
|
||||||
|
} from "vuex"
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
options: {},
|
||||||
|
scrollTop: 0,
|
||||||
|
orderType: {
|
||||||
|
1: 'collage_start_data',
|
||||||
|
2: 'collage_join_data'
|
||||||
|
},
|
||||||
|
// 1微信支付;2余额支付;3支付宝支付
|
||||||
|
payList: [{
|
||||||
|
id: 1,
|
||||||
|
title: '微信支付',
|
||||||
|
icon: 'icon-wechat-pay',
|
||||||
|
is_disabled: false
|
||||||
|
}
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
, {
|
||||||
|
id: 3,
|
||||||
|
title: '支付宝支付',
|
||||||
|
icon: 'icon-alipay',
|
||||||
|
is_disabled: false
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
, {
|
||||||
|
id: 2,
|
||||||
|
title: '余额支付',
|
||||||
|
icon: 'icon-qianbao',
|
||||||
|
is_disabled: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
payInd: 0,
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
balanceInd: 2,
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
balanceInd: 1,
|
||||||
|
// #endif
|
||||||
|
sendList: [],
|
||||||
|
sendInd: 0,
|
||||||
|
agreement: '',
|
||||||
|
agree: false,
|
||||||
|
orderInfo: {
|
||||||
|
address: {},
|
||||||
|
farmer_info: {},
|
||||||
|
claim_info: {},
|
||||||
|
},
|
||||||
|
subForm: {
|
||||||
|
num: 1,
|
||||||
|
send_type: 1,
|
||||||
|
address_id: '',
|
||||||
|
user_name: '',
|
||||||
|
mobile: '',
|
||||||
|
claim_name: '',
|
||||||
|
text: ''
|
||||||
|
},
|
||||||
|
rule: [{
|
||||||
|
name: "user_name",
|
||||||
|
checkType: "isNotNull",
|
||||||
|
errorMsg: "请输入姓名",
|
||||||
|
regType: 2
|
||||||
|
}, {
|
||||||
|
name: "mobile",
|
||||||
|
checkType: "isMobile",
|
||||||
|
errorMsg: "请输入手机号"
|
||||||
|
}, {
|
||||||
|
name: "claim_name",
|
||||||
|
checkType: "isNotNull",
|
||||||
|
errorMsg: "快给你认养的小动物取个名吧"
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: mapState({
|
||||||
|
primaryColor: state => state.config.configInfo.primaryColor,
|
||||||
|
subColor: state => state.config.configInfo.subColor,
|
||||||
|
configInfo: state => state.config.configInfo,
|
||||||
|
userInfo: state => state.user.userInfo,
|
||||||
|
}),
|
||||||
|
onLoad(options) {
|
||||||
|
let {
|
||||||
|
type = 0
|
||||||
|
} = options
|
||||||
|
options.type = type * 1
|
||||||
|
this.options = options
|
||||||
|
this.initIndex()
|
||||||
|
},
|
||||||
|
onPageScroll(e) {
|
||||||
|
this.scrollTop = e.scrollTop
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['getUserInfo', 'getAuthPhone']),
|
||||||
|
...mapMutations(['updateOrderItem']),
|
||||||
|
async initIndex(refresh = false) {
|
||||||
|
if (!refresh) {
|
||||||
|
let [, info] = await Promise.all([this.getUserInfo(), this.$api.home.aboutUsInfoType({
|
||||||
|
type: 1
|
||||||
|
})])
|
||||||
|
this.agreement = info.title
|
||||||
|
}
|
||||||
|
let {
|
||||||
|
id: claim_id,
|
||||||
|
type: order_type,
|
||||||
|
cid: collage_id
|
||||||
|
} = this.options
|
||||||
|
let {
|
||||||
|
phone
|
||||||
|
} = this.userInfo
|
||||||
|
let {
|
||||||
|
mobile = '',
|
||||||
|
num = 1
|
||||||
|
} = this.subForm
|
||||||
|
this.subForm.mobile = mobile || phone
|
||||||
|
let {
|
||||||
|
address = {}, coupon_id = 0
|
||||||
|
} = this.orderInfo
|
||||||
|
let {
|
||||||
|
id: address_id = 0
|
||||||
|
} = address
|
||||||
|
|
||||||
|
let param = {
|
||||||
|
claim_id,
|
||||||
|
coupon_id,
|
||||||
|
address_id,
|
||||||
|
num
|
||||||
|
}
|
||||||
|
// order_type 1发起众筹;2参与众筹
|
||||||
|
if (order_type == 1) {
|
||||||
|
param.collage_start_id = collage_id
|
||||||
|
}
|
||||||
|
if (order_type == 2) {
|
||||||
|
param.collage_join_id = collage_id
|
||||||
|
}
|
||||||
|
let orderInfo = await this.$api.claim.claimPayOrderInfo(param)
|
||||||
|
if (!refresh) {
|
||||||
|
let {
|
||||||
|
is_self,
|
||||||
|
is_send
|
||||||
|
} = orderInfo.claim_info
|
||||||
|
let sendList = []
|
||||||
|
if (is_self) {
|
||||||
|
sendList.push({
|
||||||
|
id: 1,
|
||||||
|
title: '自提',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (is_send) {
|
||||||
|
sendList.push({
|
||||||
|
id: 2,
|
||||||
|
title: '快递',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.sendList = sendList
|
||||||
|
}
|
||||||
|
let {
|
||||||
|
balance
|
||||||
|
} = this.userInfo
|
||||||
|
let {
|
||||||
|
pay_price
|
||||||
|
} = orderInfo
|
||||||
|
let is_disabled = balance * 1 < pay_price * 1
|
||||||
|
let {
|
||||||
|
balanceInd
|
||||||
|
} = this
|
||||||
|
this.payList[balanceInd].is_disabled = is_disabled
|
||||||
|
if (pay_price * 1 == 0) {
|
||||||
|
this.payList[0].is_disabled = true
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
this.payList[1].is_disabled = true
|
||||||
|
// #endif
|
||||||
|
this.payInd = balanceInd
|
||||||
|
}
|
||||||
|
this.orderInfo = orderInfo
|
||||||
|
},
|
||||||
|
initRefresh() {
|
||||||
|
this.initIndex(true)
|
||||||
|
},
|
||||||
|
async changeNum(mod, index) {
|
||||||
|
let {
|
||||||
|
num: goods_num
|
||||||
|
} = this.subForm
|
||||||
|
let {
|
||||||
|
unit
|
||||||
|
} = this.orderInfo.claim_info
|
||||||
|
let num = goods_num + mod;
|
||||||
|
if (num < 1) {
|
||||||
|
this.$util.showToast({
|
||||||
|
title: `此动物最少购买1${unit}`
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.subForm.num = num
|
||||||
|
this.initRefresh()
|
||||||
|
},
|
||||||
|
toChangeItem(key, index) {
|
||||||
|
if (key == 'payInd' && index === 2 && this.payList[index].is_disabled) return
|
||||||
|
this[key] = index
|
||||||
|
},
|
||||||
|
async toMap() {
|
||||||
|
let {
|
||||||
|
lat,
|
||||||
|
lng,
|
||||||
|
address
|
||||||
|
} = this.orderInfo.farmer_info
|
||||||
|
await this.$util.checkAuth({
|
||||||
|
type: 'userLocation'
|
||||||
|
})
|
||||||
|
await uni.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
})
|
||||||
|
await uni.openLocation({
|
||||||
|
latitude: lat * 1,
|
||||||
|
longitude: lng * 1,
|
||||||
|
name: address,
|
||||||
|
scale: 28
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toChooseAddr() {
|
||||||
|
if (this.sendList[this.sendInd].id == 1) {
|
||||||
|
this.toMap()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$util.goUrl({
|
||||||
|
url: `/mine/pages/address/list?check=1`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 授权手机号
|
||||||
|
async toAuthPhone(e) {
|
||||||
|
let phone = await this.getAuthPhone({
|
||||||
|
e,
|
||||||
|
})
|
||||||
|
if (!phone) return
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.subForm.mobile = phone
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toAgree() {
|
||||||
|
this.agree = !this.agree
|
||||||
|
},
|
||||||
|
//表单验证
|
||||||
|
validate(param) {
|
||||||
|
let validate = new this.$util.Validate();
|
||||||
|
let arr = param.send_type == 1 ? ['user_name', 'mobile', 'claim_name'] : [
|
||||||
|
'claim_name'
|
||||||
|
]
|
||||||
|
this.rule.map(item => {
|
||||||
|
let {
|
||||||
|
name
|
||||||
|
} = item
|
||||||
|
if (!arr.includes(name)) return
|
||||||
|
validate.add(param[name], item);
|
||||||
|
})
|
||||||
|
let message = validate.start();
|
||||||
|
return message;
|
||||||
|
},
|
||||||
|
toOrder() {
|
||||||
|
let {
|
||||||
|
payList,
|
||||||
|
payInd,
|
||||||
|
sendList,
|
||||||
|
sendInd,
|
||||||
|
subForm,
|
||||||
|
agreement
|
||||||
|
} = this
|
||||||
|
let {
|
||||||
|
id: claim_id,
|
||||||
|
cid: collage_id,
|
||||||
|
type: order_type
|
||||||
|
} = this.options
|
||||||
|
let {
|
||||||
|
id: pay_model
|
||||||
|
} = payList[payInd]
|
||||||
|
let {
|
||||||
|
id: send_type
|
||||||
|
} = sendList[sendInd]
|
||||||
|
let {
|
||||||
|
address = {}, coupon_id = 0
|
||||||
|
} = this.orderInfo
|
||||||
|
let {
|
||||||
|
id: address_id = 0
|
||||||
|
} = address
|
||||||
|
if (!address_id && send_type == 2) {
|
||||||
|
this.$util.showToast({
|
||||||
|
title: `请选择收货地址`
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let param = Object.assign({}, subForm, {
|
||||||
|
claim_id,
|
||||||
|
address_id,
|
||||||
|
coupon_id,
|
||||||
|
pay_model,
|
||||||
|
send_type
|
||||||
|
});
|
||||||
|
|
||||||
|
// order_type 1发起众筹;2参与众筹
|
||||||
|
if (order_type == 1) {
|
||||||
|
param.collage_start_id = collage_id
|
||||||
|
}
|
||||||
|
if (order_type == 2) {
|
||||||
|
param.collage_join_id = collage_id
|
||||||
|
}
|
||||||
|
let msg = this.validate(param);
|
||||||
|
if (msg) {
|
||||||
|
this.$util.showToast({
|
||||||
|
title: msg
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.agree) {
|
||||||
|
this.$util.showToast({
|
||||||
|
title: `请勾选${agreement}`
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.toPay(param)
|
||||||
|
},
|
||||||
|
async toPay(param) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
let that = this
|
||||||
|
let {
|
||||||
|
tmp_list = []
|
||||||
|
} = that.orderInfo
|
||||||
|
let tmplIds = []
|
||||||
|
tmp_list.map(item => {
|
||||||
|
tmplIds.push(item.tmpl_id)
|
||||||
|
})
|
||||||
|
if (tmplIds && tmplIds.length > 0) {
|
||||||
|
uni.requestSubscribeMessage({
|
||||||
|
tmplIds,
|
||||||
|
complete(res) {
|
||||||
|
that.toConfirmPay(param)
|
||||||
|
console.log(res, "complete requestSubscribeMessage");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
that.toConfirmPay(param)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
this.toConfirmPay(param)
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
async toConfirmPay(param) {
|
||||||
|
if (this.lockTap) return
|
||||||
|
this.lockTap = true
|
||||||
|
this.$util.showLoading()
|
||||||
|
try {
|
||||||
|
let {
|
||||||
|
pay_list
|
||||||
|
} = await this.$api.claim.claimPayOrder(param)
|
||||||
|
this.$util.hideAll()
|
||||||
|
if (pay_list) {
|
||||||
|
if (param.pay_model == 3) {
|
||||||
|
pay_list = {
|
||||||
|
orderInfo: pay_list,
|
||||||
|
provider: 'alipay'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await this.$util.pay(pay_list)
|
||||||
|
this.$util.showToast({
|
||||||
|
title: `支付成功`
|
||||||
|
})
|
||||||
|
this.updateOrderItem({
|
||||||
|
key: 'haveOperItem',
|
||||||
|
val: true
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$util.back()
|
||||||
|
this.$util.goUrl({
|
||||||
|
url: '/mine/pages/pay-result?type=claim',
|
||||||
|
openType: 'redirectTo'
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
this.lockTap = false
|
||||||
|
return
|
||||||
|
} catch (e) {
|
||||||
|
this.$util.showToast({
|
||||||
|
title: `支付失败`
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$util.back()
|
||||||
|
this.$util.goUrl({
|
||||||
|
url: `/claim/pages/order/list`,
|
||||||
|
openType: 'redirectTo'
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
this.lockTap = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$util.showToast({
|
||||||
|
title: `支付成功`
|
||||||
|
})
|
||||||
|
this.updateOrderItem({
|
||||||
|
key: 'haveOperItem',
|
||||||
|
val: true
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$util.back()
|
||||||
|
this.$util.goUrl({
|
||||||
|
url: '/mine/pages/pay-result?type=claim',
|
||||||
|
openType: 'redirectTo'
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
} catch (e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.lockTap = false
|
||||||
|
this.$util.hideAll()
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.claim-order {
|
||||||
|
|
||||||
|
.collage-tag {
|
||||||
|
height: 36rpx;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-list {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 52rpx;
|
||||||
|
border: 1rpx solid #CCCCCC;
|
||||||
|
transform: rotateZ(360deg);
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.send-item {
|
||||||
|
width: 90rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-btn {
|
||||||
|
width: 296rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
background: #F6F6F6;
|
||||||
|
border-radius: 36rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-item {
|
||||||
|
.iconfont {
|
||||||
|
font-size: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-icon {
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-right {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-peisong,
|
||||||
|
.agree-icon {
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-text {
|
||||||
|
width: 150rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-phone-btn {
|
||||||
|
width: 106rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
margin-left: 15rpx;
|
||||||
|
font-size: 20rpx;
|
||||||
|
background: #F0F4EC;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-btn {
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
.footer-item {
|
||||||
|
height: 114rpx;
|
||||||
|
|
||||||
|
.order-btn {
|
||||||
|
width: 332rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,101 +1,110 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="claim-order" v-if="orderInfo.claim_info.id">
|
<view class="claim-order" v-if="orderInfo.claim_info.id">
|
||||||
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
|
<uni-nav-bar :fixed="true" :shadow="false" title="确认订单" leftIcon="icon-left"></uni-nav-bar>
|
||||||
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="确认订单">
|
<view :style="{ height: `${configInfo.navBarHeight}px` }"></view>
|
||||||
</uni-nav-bar>
|
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png"></image>
|
||||||
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
|
|
||||||
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png">
|
|
||||||
</image>
|
|
||||||
<view class="space-lg"></view>
|
<view class="space-lg"></view>
|
||||||
<view class="fill-base mt-md ml-md mr-md pd-lg box-shadow radius-24">
|
<view class="fill-base mt-md ml-md mr-md pd-lg box-shadow radius-24">
|
||||||
<view class="f-title c-title pb-lg b-1px-b">{{orderInfo.farmer_info.title}}</view>
|
<view class="f-title c-title pb-lg b-1px-b">{{ orderInfo.farmer_info.title }}</view>
|
||||||
<view class="flex-warp pt-lg pb-lg">
|
<view class="flex-warp pt-lg pb-lg">
|
||||||
<image mode="aspectFill" lazy-load class="avatar lg radius-10" :src="orderInfo.claim_info.cover">
|
<image mode="aspectFill" lazy-load class="avatar lg radius-10" :src="orderInfo.claim_info.cover"></image>
|
||||||
</image>
|
|
||||||
<view class="flex-1 ml-lg">
|
<view class="flex-1 ml-lg">
|
||||||
<view class="f-paragraph max-520 ellipsis">{{orderInfo.claim_info.title}}</view>
|
<view class="f-paragraph max-520 ellipsis">{{ orderInfo.claim_info.title }}</view>
|
||||||
<block v-if="options.type">
|
<block v-if="options.type">
|
||||||
<view class="flex-y-center f-desc c-warning mt-sm">众筹价<view
|
<view class="flex-y-center f-desc c-warning mt-sm">
|
||||||
class="flex-y-baseline f-caption ml-sm">
|
众筹价
|
||||||
¥<view class="f-sm-title text-bold">
|
<view class="flex-y-baseline f-caption ml-sm">
|
||||||
{{orderInfo.claim_info[orderType[options.type]].price}}
|
¥
|
||||||
|
<view class="f-sm-title text-bold">
|
||||||
|
{{ orderInfo.claim_info[orderType[options.type]].price }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="f-icontext c-caption text-delete ml-sm">原价 ¥{{orderInfo.claim_info.price}}
|
<view class="f-icontext c-caption text-delete ml-sm">原价 ¥{{ orderInfo.claim_info.price }}</view>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-center mt-md">
|
<view class="flex-center mt-md">
|
||||||
<view class="collage-tag flex-center f-caption c-base" :style="{background:primaryColor}">
|
<view class="collage-tag flex-center f-caption c-base" :style="{ background: primaryColor }">
|
||||||
{{orderInfo.claim_info[orderType[options.type]].success_num}}人团
|
{{ orderInfo.claim_info[orderType[options.type]].success_num }}人团
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-1"></view>
|
<view class="flex-1"></view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<view class="flex-y-baseline f-paragraph c-warning mt-sm" v-else>¥{{orderInfo.claim_info.price}}
|
<view class="flex-y-baseline f-paragraph c-warning mt-sm" v-else>
|
||||||
<view class="f-caption c-caption ml-sm">
|
¥{{ orderInfo.claim_info.price }}
|
||||||
/{{orderInfo.claim_info.unit}}</view>
|
<view class="f-caption c-caption ml-sm">/{{ orderInfo.claim_info.unit }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex-between pt-lg pb-lg b-1px-tb">
|
<view class="flex-between pt-lg pb-lg b-1px-tb">
|
||||||
<view class="f-paragraph c-black">认养数量</view>
|
<view class="f-paragraph c-black">认养数量</view>
|
||||||
<view v-if="options.type">{{subForm.num}}</view>
|
<view v-if="options.type">{{ subForm.num }}</view>
|
||||||
<view class="add-remove-item flex-center" v-else>
|
<view class="add-remove-item flex-center" v-else>
|
||||||
<i @tap.stop="changeNum(-1,index)" class="iconfont icon-remove-square c-caption"></i>
|
<i @tap.stop="changeNum(-1, index)" class="iconfont icon-remove-square c-caption"></i>
|
||||||
<view class="number flex-center f-desc pl-sm pr-sm">{{subForm.num}}</view>
|
<view class="number flex-center f-desc pl-sm pr-sm">{{ subForm.num }}</view>
|
||||||
<i @tap.stop="changeNum(1,index)" class="iconfont icon-add-square"
|
<i @tap.stop="changeNum(1, index)" class="iconfont icon-add-square" :style="{ color: primaryColor }"></i>
|
||||||
:style="{color:primaryColor}"></i>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="pt-lg pb-lg f-paragraph c-black">认养收获</view>
|
<view class="pt-lg pb-lg f-paragraph c-black">认养收获</view>
|
||||||
<view class="flex-center">
|
<view class="flex-center">
|
||||||
<image mode="aspectFill" lazy-load class="avatar sm radius-10"
|
<image mode="aspectFill" lazy-load class="avatar sm radius-10" :src="orderInfo.claim_info.harvest_cover"></image>
|
||||||
:src="orderInfo.claim_info.harvest_cover"></image>
|
<view class="flex-1 ml-lg ellipsis">{{ orderInfo.claim_info.harvest_text }}</view>
|
||||||
<view class="flex-1 ml-lg ellipsis">{{orderInfo.claim_info.harvest_text}}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
|
||||||
<view class="flex-between pd-lg">
|
<view class="flex-between pd-lg">
|
||||||
<view class="flex-y-center f-sm-title c-black"><i class="iconfont icon-peisong mr-sm"
|
<view class="flex-y-center f-sm-title c-black">
|
||||||
:style="{color:primaryColor}"></i>配送周期</view>
|
<i class="iconfont icon-peisong mr-sm" :style="{ color: primaryColor }"></i>
|
||||||
<view class="f-paragraph">{{orderInfo.claim_info.send_cycle}}</view>
|
配送周期
|
||||||
|
</view>
|
||||||
|
<view class="f-paragraph">{{ orderInfo.claim_info.send_cycle }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24">
|
||||||
<view class="flex-between pd-lg f-sm-title c-title b-1px-b">
|
<view class="flex-between pd-lg f-sm-title c-title b-1px-b">
|
||||||
<view class="text-bold">配送方式</view>
|
<view class="text-bold">配送方式</view>
|
||||||
<view class="send-list flex-center radius" :style="{width:sendList.length==1?'90rpx':''}">
|
<view class="send-list flex-center radius" :style="{ width: sendList.length == 1 ? '90rpx' : '' }">
|
||||||
<view @tap.stop="toChangeItem('sendInd',index)" class="send-item flex-center f-paragraph radius"
|
<view
|
||||||
:class="[{'c-base':sendInd == index}]" :style="{background:sendInd==index?primaryColor:''}"
|
@tap.stop="toChangeItem('sendInd', index)"
|
||||||
v-for="(item,index) in sendList" :key="index">{{item.title}}</view>
|
class="send-item flex-center f-paragraph radius"
|
||||||
|
:class="[{ 'c-base': sendInd == index }]"
|
||||||
|
:style="{ background: sendInd == index ? primaryColor : '' }"
|
||||||
|
v-for="(item, index) in sendList"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ item.title }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view @tap.stop="toChooseAddr" class="pd-lg flex-center"
|
</view>
|
||||||
v-if="sendList[sendInd].id == 1 || orderInfo.address.id">
|
<view @tap.stop="toChooseAddr" class="pd-lg flex-center" v-if="sendList[sendInd].id == 1 || orderInfo.address.id">
|
||||||
<view class="flex-1">
|
<view class="flex-1">
|
||||||
<view class="flex-warp">
|
<view class="flex-warp">
|
||||||
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx;margin-top: 6rpx;"></i>
|
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx; margin-top: 6rpx"></i>
|
||||||
<view class="f-paragraph c-title flex-1" :class="[{'max-520':sendList[sendInd].id == 2}]">
|
<view class="f-paragraph c-title flex-1" :class="[{ 'max-520': sendList[sendInd].id == 2 }]">
|
||||||
{{sendList[sendInd].id == 1 ? `${orderInfo.farmer_info.address}` : orderInfo.address.id ? `${orderInfo.address.address} ${orderInfo.address.address_info}`:''}}
|
{{
|
||||||
|
sendList[sendInd].id == 1
|
||||||
|
? `${orderInfo.farmer_info.address}`
|
||||||
|
: orderInfo.address.id
|
||||||
|
? `${orderInfo.address.address} ${orderInfo.address.address_info}`
|
||||||
|
: ''
|
||||||
|
}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-y-baseline f-paragraph c-caption" style="margin:5rpx 0 0 38rpx;">
|
<view class="flex-y-baseline f-paragraph c-caption" style="margin: 5rpx 0 0 38rpx">
|
||||||
{{sendList[sendInd].id == 1 ? orderInfo.farmer_info.user_name : orderInfo.address.id ? orderInfo.address.user_name:'' }}
|
{{ sendList[sendInd].id == 1 ? orderInfo.farmer_info.user_name : orderInfo.address.id ? orderInfo.address.user_name : '' }}
|
||||||
<view class="ml-lg">
|
<view class="ml-lg">
|
||||||
{{sendList[sendInd].id == 1? orderInfo.farmer_info.mobile : orderInfo.address.id ? orderInfo.address.mobile : ''}}
|
{{ sendList[sendInd].id == 1 ? orderInfo.farmer_info.mobile : orderInfo.address.id ? orderInfo.address.mobile : '' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<i class="iconfont"
|
<i class="iconfont" :class="[{ 'icon-dingwei': sendList[sendInd].id == 1 }, { 'icon-right': sendList[sendInd].id == 2 }]"></i>
|
||||||
:class="[{'icon-dingwei':sendList[sendInd].id == 1},{'icon-right':sendList[sendInd].id == 2}]"></i>
|
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="space-lg"></view>
|
<view class="space-lg"></view>
|
||||||
<view class="space-lg"></view>
|
<view class="space-lg"></view>
|
||||||
<view @tap.stop="toChooseAddr" class="add-btn flex-center f-paragraph c-desc"><i
|
<view @tap.stop="toChooseAddr" class="add-btn flex-center f-paragraph c-desc">
|
||||||
class="iconfont icon-add-circle-fill mr-sm"></i>添加地址
|
<i class="iconfont icon-add-circle-fill mr-sm"></i>
|
||||||
|
添加地址
|
||||||
</view>
|
</view>
|
||||||
<view class="space-lg"></view>
|
<view class="space-lg"></view>
|
||||||
<view class="space-lg"></view>
|
<view class="space-lg"></view>
|
||||||
@@ -108,18 +117,15 @@
|
|||||||
<i class="iconfont icon-required c-warning"></i>
|
<i class="iconfont icon-required c-warning"></i>
|
||||||
<view class="item-text">姓名</view>
|
<view class="item-text">姓名</view>
|
||||||
</view>
|
</view>
|
||||||
<input v-model="subForm.user_name" type="text" class="flex-1 f-paragraph"
|
<input v-model="subForm.user_name" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder" :placeholder="rule[0].errorMsg" />
|
||||||
placeholder-class="c-placeholder" :placeholder="rule[0].errorMsg" />
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
||||||
<view class="flex-y-center">
|
<view class="flex-y-center">
|
||||||
<i class="iconfont icon-required c-warning"></i>
|
<i class="iconfont icon-required c-warning"></i>
|
||||||
<view class="item-text">手机号</view>
|
<view class="item-text">手机号</view>
|
||||||
</view>
|
</view>
|
||||||
<input v-model="subForm.mobile" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder"
|
<input v-model="subForm.mobile" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder" :placeholder="rule[1].errorMsg" />
|
||||||
:placeholder="rule[1].errorMsg" />
|
<button open-type="getPhoneNumber" @getphonenumber="toAuthPhone" class="clear-btn auth-phone-btn flex-center" :style="{ color: primaryColor }">立即授权</button>
|
||||||
<button open-type="getPhoneNumber" @getphonenumber="toAuthPhone"
|
|
||||||
class="clear-btn auth-phone-btn flex-center" :style="{color:primaryColor}">立即授权</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -129,25 +135,21 @@
|
|||||||
<i class="iconfont icon-required c-warning"></i>
|
<i class="iconfont icon-required c-warning"></i>
|
||||||
<view class="item-text">认养取名</view>
|
<view class="item-text">认养取名</view>
|
||||||
</view>
|
</view>
|
||||||
<input v-model="subForm.claim_name" type="text" class="flex-1 f-paragraph"
|
<input v-model="subForm.claim_name" type="text" class="flex-1 f-paragraph" placeholder-class="c-placeholder" :placeholder="rule[2].errorMsg" />
|
||||||
placeholder-class="c-placeholder" :placeholder="rule[2].errorMsg" />
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
||||||
<view class="flex-y-center">
|
<view class="flex-y-center">
|
||||||
<i class="iconfont icon-required c-base"></i>
|
<i class="iconfont icon-required c-base"></i>
|
||||||
<view class="item-text">订单备注</view>
|
<view class="item-text">订单备注</view>
|
||||||
</view>
|
</view>
|
||||||
<input v-model="subForm.text" type="text" class="flex-1 f-paragraph" maxlength="100"
|
<input v-model="subForm.text" type="text" class="flex-1 f-paragraph" maxlength="100" placeholder-class="c-placeholder" placeholder="请输入订单备注" />
|
||||||
placeholder-class="c-placeholder" placeholder="请输入订单备注" />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="!options.type">
|
<view class="fill-base mt-md ml-md mr-md f-paragraph box-shadow radius-24" v-if="!options.type">
|
||||||
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
<view class="flex-between ml-md mr-md pl-sm pt-lg pb-lg">
|
||||||
<view class="item-text">卡券优惠</view>
|
<view class="item-text">卡券优惠</view>
|
||||||
<view
|
<view @tap.stop="$util.goUrl({ url: `/mine/pages/coupon/use?claim_id=${options.id}&num=${subForm.num}&type=2` })" class="flex-y-center">
|
||||||
@tap.stop="$util.goUrl({url:`/mine/pages/coupon/use?claim_id=${options.id}&num=${subForm.num}&type=2`})"
|
|
||||||
class="flex-y-center">
|
|
||||||
<view class="flex-1 text-right">
|
<view class="flex-1 text-right">
|
||||||
{{ orderInfo.coupon_id ? `-¥${orderInfo.coupon_discount}` : `${orderInfo.canUseCoupon}张可用` }}
|
{{ orderInfo.coupon_id ? `-¥${orderInfo.coupon_discount}` : `${orderInfo.canUseCoupon}张可用` }}
|
||||||
</view>
|
</view>
|
||||||
@@ -157,28 +159,31 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="fill-base mt-md ml-md mr-md f-sm-title box-shadow radius-24">
|
<view class="fill-base mt-md ml-md mr-md f-sm-title box-shadow radius-24">
|
||||||
<view @tap.stop="toChangeItem('payInd',index)"
|
<view @tap.stop="toChangeItem('payInd', index)" class="flex-between ml-md mr-md pl-sm pr-sm pt-lg pb-lg b-1px-b" v-for="(item, index) in payList" :key="index">
|
||||||
class="flex-between ml-md mr-md pl-sm pr-sm pt-lg pb-lg b-1px-b" v-for="(item,index) in payList"
|
<view class="pay-item flex-y-center">
|
||||||
:key="index">
|
<i class="iconfont mr-md" :class="[item.icon]" :style="{ color: item.id == 1 ? primaryColor : item.id == 2 ? subColor : '#01AAF2' }"></i>
|
||||||
<view class="pay-item flex-y-center"><i class="iconfont mr-md" :class="[item.icon]"
|
<view class="flex-y-baseline">
|
||||||
:style="{color:item.id==1?primaryColor:item.id==2?subColor:'#01AAF2'}"></i>
|
{{ item.title }}
|
||||||
<view class="flex-y-baseline">{{item.title}}
|
<view class="f-paragraph c-caption ml-sm" v-if="item.id == 2">余额{{ userInfo.balance || 0 }}元</view>
|
||||||
<view class="f-paragraph c-caption ml-sm" v-if="item.id==2">余额{{userInfo.balance || 0}}元
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<i
|
||||||
<i class="pay-icon iconfont c-caption"
|
class="pay-icon iconfont c-caption"
|
||||||
:class="[{'icon-xuanze':payInd != index},{'icon-radio-fill':item.is_disabled || payInd == index}]"
|
:class="[{ 'icon-xuanze': payInd != index }, { 'icon-radio-fill': item.is_disabled || payInd == index }]"
|
||||||
:style="{color:payInd==index?primaryColor:''}"></i>
|
:style="{ color: payInd == index ? primaryColor : '' }"
|
||||||
|
></i>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view @tap.stop="toAgree" class="flex-warp f-paragraph mt-md pd-md"><i
|
<view @tap.stop="toAgree" class="flex-warp f-paragraph mt-md pd-md">
|
||||||
|
<i
|
||||||
class="agree-icon iconfont c-caption mr-sm"
|
class="agree-icon iconfont c-caption mr-sm"
|
||||||
:class="[{'icon-xuanze': !agree},{'icon-xuanze-fill': agree}]" style="margin-top: 3rpx;"
|
:class="[{ 'icon-xuanze': !agree }, { 'icon-xuanze-fill': agree }]"
|
||||||
:style="{color:agree?primaryColor:''}"></i>
|
style="margin-top: 3rpx"
|
||||||
<view class="flex-y-center">购买代表您已同意<view @tap.stop="$util.goUrl({url:`/mine/pages/agreement?type=1`})"
|
:style="{ color: agree ? primaryColor : '' }"
|
||||||
:style="{color:primaryColor}">
|
></i>
|
||||||
《{{agreement}}》</view>
|
<view class="flex-y-center">
|
||||||
|
购买代表您已同意
|
||||||
|
<view @tap.stop="$util.goUrl({ url: `/mine/pages/agreement?type=1` })" :style="{ color: primaryColor }">《{{ agreement }}》</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -186,34 +191,26 @@
|
|||||||
<view class="footer-btn fill-base fix">
|
<view class="footer-btn fill-base fix">
|
||||||
<view class="footer-item flex-between pl-lg pr-lg">
|
<view class="footer-item flex-between pl-lg pr-lg">
|
||||||
<view class="flex-y-baseline f-paragraph c-title">
|
<view class="flex-y-baseline f-paragraph c-title">
|
||||||
合计:<view class="f-sm-title c-warning text-bold">¥{{orderInfo.pay_price}}</view>
|
合计:
|
||||||
|
<view class="f-sm-title c-warning text-bold">¥{{ orderInfo.pay_price }}</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef APP-PLUS -->
|
<!-- #ifdef APP-PLUS -->
|
||||||
<view @tap="toOrder" class="order-btn flex-center f-sm-title c-base text-bold radius-20"
|
<view @tap="toOrder" class="order-btn flex-center f-sm-title c-base text-bold radius-20" :style="{ background: primaryColor }">立即支付</view>
|
||||||
:style="{background:primaryColor}">立即支付
|
|
||||||
</view>
|
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- #ifndef APP-PLUS -->
|
<!-- #ifndef APP-PLUS -->
|
||||||
<auth :needAuth="userInfo && !userInfo.nickName" :must="true" type="userInfo" @go="toOrder">
|
<auth :needAuth="userInfo && !userInfo.nickName" :must="true" type="userInfo" @go="toOrder">
|
||||||
<view class="order-btn flex-center f-sm-title c-base text-bold radius-20"
|
<view class="order-btn flex-center f-sm-title c-base text-bold radius-20" :style="{ background: primaryColor }">立即支付</view>
|
||||||
:style="{background:primaryColor}">立即支付
|
|
||||||
</view>
|
|
||||||
</auth>
|
</auth>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<view class="space-safe"></view>
|
<view class="space-safe"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { mapState, mapActions, mapMutations } from 'vuex';
|
||||||
mapState,
|
export default {
|
||||||
mapActions,
|
|
||||||
mapMutations
|
|
||||||
} from "vuex"
|
|
||||||
export default {
|
|
||||||
components: {},
|
components: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -224,21 +221,22 @@
|
|||||||
2: 'collage_join_data'
|
2: 'collage_join_data'
|
||||||
},
|
},
|
||||||
// 1微信支付;2余额支付;3支付宝支付
|
// 1微信支付;2余额支付;3支付宝支付
|
||||||
payList: [{
|
payList: [
|
||||||
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
title: '微信支付',
|
title: '微信支付',
|
||||||
icon: 'icon-wechat-pay',
|
icon: 'icon-wechat-pay',
|
||||||
is_disabled: false
|
is_disabled: false
|
||||||
}
|
},
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
, {
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
title: '支付宝支付',
|
title: '支付宝支付',
|
||||||
icon: 'icon-alipay',
|
icon: 'icon-alipay',
|
||||||
is_disabled: false
|
is_disabled: false
|
||||||
}
|
},
|
||||||
// #endif
|
// #endif
|
||||||
, {
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
title: '余额支付',
|
title: '余额支付',
|
||||||
icon: 'icon-qianbao',
|
icon: 'icon-qianbao',
|
||||||
@@ -259,7 +257,7 @@
|
|||||||
orderInfo: {
|
orderInfo: {
|
||||||
address: {},
|
address: {},
|
||||||
farmer_info: {},
|
farmer_info: {},
|
||||||
claim_info: {},
|
claim_info: {}
|
||||||
},
|
},
|
||||||
subForm: {
|
subForm: {
|
||||||
num: 1,
|
num: 1,
|
||||||
@@ -270,235 +268,187 @@
|
|||||||
claim_name: '',
|
claim_name: '',
|
||||||
text: ''
|
text: ''
|
||||||
},
|
},
|
||||||
rule: [{
|
rule: [
|
||||||
name: "user_name",
|
{
|
||||||
checkType: "isNotNull",
|
name: 'user_name',
|
||||||
errorMsg: "请输入姓名",
|
checkType: 'isNotNull',
|
||||||
|
errorMsg: '请输入姓名',
|
||||||
regType: 2
|
regType: 2
|
||||||
}, {
|
},
|
||||||
name: "mobile",
|
{
|
||||||
checkType: "isMobile",
|
name: 'mobile',
|
||||||
errorMsg: "请输入手机号"
|
checkType: 'isMobile',
|
||||||
}, {
|
errorMsg: '请输入手机号'
|
||||||
name: "claim_name",
|
},
|
||||||
checkType: "isNotNull",
|
{
|
||||||
errorMsg: "快给你认养的小动物取个名吧"
|
name: 'claim_name',
|
||||||
}],
|
checkType: 'isNotNull',
|
||||||
|
errorMsg: '快给你认养的小动物取个名吧'
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
},
|
},
|
||||||
computed: mapState({
|
computed: mapState({
|
||||||
primaryColor: state => state.config.configInfo.primaryColor,
|
primaryColor: (state) => state.config.configInfo.primaryColor,
|
||||||
subColor: state => state.config.configInfo.subColor,
|
subColor: (state) => state.config.configInfo.subColor,
|
||||||
configInfo: state => state.config.configInfo,
|
configInfo: (state) => state.config.configInfo,
|
||||||
userInfo: state => state.user.userInfo,
|
userInfo: (state) => state.user.userInfo
|
||||||
}),
|
}),
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let {
|
let { type = 0 } = options;
|
||||||
type = 0
|
options.type = type * 1;
|
||||||
} = options
|
this.options = options;
|
||||||
options.type = type * 1
|
this.initIndex();
|
||||||
this.options = options
|
|
||||||
this.initIndex()
|
|
||||||
},
|
},
|
||||||
onPageScroll(e) {
|
onPageScroll(e) {
|
||||||
this.scrollTop = e.scrollTop
|
this.scrollTop = e.scrollTop;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getUserInfo', 'getAuthPhone']),
|
...mapActions(['getUserInfo', 'getAuthPhone']),
|
||||||
...mapMutations(['updateOrderItem']),
|
...mapMutations(['updateOrderItem']),
|
||||||
async initIndex(refresh = false) {
|
async initIndex(refresh = false) {
|
||||||
if (!refresh) {
|
if (!refresh) {
|
||||||
let [, info] = await Promise.all([this.getUserInfo(), this.$api.home.aboutUsInfoType({
|
let [, info] = await Promise.all([
|
||||||
|
this.getUserInfo(),
|
||||||
|
this.$api.home.aboutUsInfoType({
|
||||||
type: 1
|
type: 1
|
||||||
})])
|
})
|
||||||
this.agreement = info.title
|
]);
|
||||||
|
this.agreement = info.title;
|
||||||
}
|
}
|
||||||
let {
|
let { id: claim_id, type: order_type, cid: collage_id } = this.options;
|
||||||
id: claim_id,
|
let { phone } = this.userInfo;
|
||||||
type: order_type,
|
let { mobile = '', num = 1 } = this.subForm;
|
||||||
cid: collage_id
|
this.subForm.mobile = mobile || phone;
|
||||||
} = this.options
|
let { address = {}, coupon_id = 0 } = this.orderInfo;
|
||||||
let {
|
let { id: address_id = 0 } = address;
|
||||||
phone
|
|
||||||
} = this.userInfo
|
|
||||||
let {
|
|
||||||
mobile = '',
|
|
||||||
num = 1
|
|
||||||
} = this.subForm
|
|
||||||
this.subForm.mobile = mobile || phone
|
|
||||||
let {
|
|
||||||
address = {}, coupon_id = 0
|
|
||||||
} = this.orderInfo
|
|
||||||
let {
|
|
||||||
id: address_id = 0
|
|
||||||
} = address
|
|
||||||
|
|
||||||
let param = {
|
let param = {
|
||||||
claim_id,
|
claim_id,
|
||||||
coupon_id,
|
coupon_id,
|
||||||
address_id,
|
address_id,
|
||||||
num
|
num
|
||||||
}
|
};
|
||||||
// order_type 1发起众筹;2参与众筹
|
// order_type 1发起众筹;2参与众筹
|
||||||
if (order_type == 1) {
|
if (order_type == 1) {
|
||||||
param.collage_start_id = collage_id
|
param.collage_start_id = collage_id;
|
||||||
}
|
}
|
||||||
if (order_type == 2) {
|
if (order_type == 2) {
|
||||||
param.collage_join_id = collage_id
|
param.collage_join_id = collage_id;
|
||||||
}
|
}
|
||||||
let orderInfo = await this.$api.claim.claimPayOrderInfo(param)
|
let orderInfo = await this.$api.claim.claimPayOrderInfo(param);
|
||||||
if (!refresh) {
|
if (!refresh) {
|
||||||
let {
|
let { is_self, is_send } = orderInfo.claim_info;
|
||||||
is_self,
|
let sendList = [];
|
||||||
is_send
|
|
||||||
} = orderInfo.claim_info
|
|
||||||
let sendList = []
|
|
||||||
if (is_self) {
|
if (is_self) {
|
||||||
sendList.push({
|
sendList.push({
|
||||||
id: 1,
|
id: 1,
|
||||||
title: '自提',
|
title: '自提'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
if (is_send) {
|
if (is_send) {
|
||||||
sendList.push({
|
sendList.push({
|
||||||
id: 2,
|
id: 2,
|
||||||
title: '快递',
|
title: '快递'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.sendList = sendList
|
this.sendList = sendList;
|
||||||
}
|
}
|
||||||
let {
|
let { balance } = this.userInfo;
|
||||||
balance
|
let { pay_price } = orderInfo;
|
||||||
} = this.userInfo
|
let is_disabled = balance * 1 < pay_price * 1;
|
||||||
let {
|
let { balanceInd } = this;
|
||||||
pay_price
|
this.payList[balanceInd].is_disabled = is_disabled;
|
||||||
} = orderInfo
|
|
||||||
let is_disabled = balance * 1 < pay_price * 1
|
|
||||||
let {
|
|
||||||
balanceInd
|
|
||||||
} = this
|
|
||||||
this.payList[balanceInd].is_disabled = is_disabled
|
|
||||||
if (pay_price * 1 == 0) {
|
if (pay_price * 1 == 0) {
|
||||||
this.payList[0].is_disabled = true
|
this.payList[0].is_disabled = true;
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
this.payList[1].is_disabled = true
|
this.payList[1].is_disabled = true;
|
||||||
// #endif
|
// #endif
|
||||||
this.payInd = balanceInd
|
this.payInd = balanceInd;
|
||||||
}
|
}
|
||||||
this.orderInfo = orderInfo
|
this.orderInfo = orderInfo;
|
||||||
},
|
},
|
||||||
initRefresh() {
|
initRefresh() {
|
||||||
this.initIndex(true)
|
this.initIndex(true);
|
||||||
},
|
},
|
||||||
async changeNum(mod, index) {
|
async changeNum(mod, index) {
|
||||||
let {
|
let { num: goods_num } = this.subForm;
|
||||||
num: goods_num
|
let { unit } = this.orderInfo.claim_info;
|
||||||
} = this.subForm
|
|
||||||
let {
|
|
||||||
unit
|
|
||||||
} = this.orderInfo.claim_info
|
|
||||||
let num = goods_num + mod;
|
let num = goods_num + mod;
|
||||||
if (num < 1) {
|
if (num < 1) {
|
||||||
this.$util.showToast({
|
this.$util.showToast({
|
||||||
title: `此动物最少购买1${unit}`
|
title: `此动物最少购买1${unit}`
|
||||||
})
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.subForm.num = num
|
this.subForm.num = num;
|
||||||
this.initRefresh()
|
this.initRefresh();
|
||||||
},
|
},
|
||||||
toChangeItem(key, index) {
|
toChangeItem(key, index) {
|
||||||
if (key == 'payInd' && index === 2 && this.payList[index].is_disabled) return
|
if (key == 'payInd' && index === 2 && this.payList[index].is_disabled) return;
|
||||||
this[key] = index
|
this[key] = index;
|
||||||
},
|
},
|
||||||
async toMap() {
|
async toMap() {
|
||||||
let {
|
let { lat, lng, address } = this.orderInfo.farmer_info;
|
||||||
lat,
|
|
||||||
lng,
|
|
||||||
address
|
|
||||||
} = this.orderInfo.farmer_info
|
|
||||||
await this.$util.checkAuth({
|
await this.$util.checkAuth({
|
||||||
type: 'userLocation'
|
type: 'userLocation'
|
||||||
})
|
});
|
||||||
await uni.getLocation({
|
await uni.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02'
|
||||||
})
|
});
|
||||||
await uni.openLocation({
|
await uni.openLocation({
|
||||||
latitude: lat * 1,
|
latitude: lat * 1,
|
||||||
longitude: lng * 1,
|
longitude: lng * 1,
|
||||||
name: address,
|
name: address,
|
||||||
scale: 28
|
scale: 28
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
toChooseAddr() {
|
toChooseAddr() {
|
||||||
if (this.sendList[this.sendInd].id == 1) {
|
if (this.sendList[this.sendInd].id == 1) {
|
||||||
this.toMap()
|
this.toMap();
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
this.$util.goUrl({
|
this.$util.goUrl({
|
||||||
url: `/mine/pages/address/list?check=1`
|
url: `/mine/pages/address/list?check=1`
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 授权手机号
|
// 授权手机号
|
||||||
async toAuthPhone(e) {
|
async toAuthPhone(e) {
|
||||||
let phone = await this.getAuthPhone({
|
let phone = await this.getAuthPhone({
|
||||||
e,
|
e
|
||||||
})
|
});
|
||||||
if (!phone) return
|
if (!phone) return;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.subForm.mobile = phone
|
this.subForm.mobile = phone;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
toAgree() {
|
toAgree() {
|
||||||
this.agree = !this.agree
|
this.agree = !this.agree;
|
||||||
},
|
},
|
||||||
//表单验证
|
//表单验证
|
||||||
validate(param) {
|
validate(param) {
|
||||||
let validate = new this.$util.Validate();
|
let validate = new this.$util.Validate();
|
||||||
let arr = param.send_type == 1 ? ['user_name', 'mobile', 'claim_name'] : [
|
let arr = param.send_type == 1 ? ['user_name', 'mobile', 'claim_name'] : ['claim_name'];
|
||||||
'claim_name'
|
this.rule.map((item) => {
|
||||||
]
|
let { name } = item;
|
||||||
this.rule.map(item => {
|
if (!arr.includes(name)) return;
|
||||||
let {
|
|
||||||
name
|
|
||||||
} = item
|
|
||||||
if (!arr.includes(name)) return
|
|
||||||
validate.add(param[name], item);
|
validate.add(param[name], item);
|
||||||
})
|
});
|
||||||
let message = validate.start();
|
let message = validate.start();
|
||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
toOrder() {
|
toOrder() {
|
||||||
let {
|
let { payList, payInd, sendList, sendInd, subForm, agreement } = this;
|
||||||
payList,
|
let { id: claim_id, cid: collage_id, type: order_type } = this.options;
|
||||||
payInd,
|
let { id: pay_model } = payList[payInd];
|
||||||
sendList,
|
let { id: send_type } = sendList[sendInd];
|
||||||
sendInd,
|
let { address = {}, coupon_id = 0 } = this.orderInfo;
|
||||||
subForm,
|
let { id: address_id = 0 } = address;
|
||||||
agreement
|
|
||||||
} = this
|
|
||||||
let {
|
|
||||||
id: claim_id,
|
|
||||||
cid: collage_id,
|
|
||||||
type: order_type
|
|
||||||
} = this.options
|
|
||||||
let {
|
|
||||||
id: pay_model
|
|
||||||
} = payList[payInd]
|
|
||||||
let {
|
|
||||||
id: send_type
|
|
||||||
} = sendList[sendInd]
|
|
||||||
let {
|
|
||||||
address = {}, coupon_id = 0
|
|
||||||
} = this.orderInfo
|
|
||||||
let {
|
|
||||||
id: address_id = 0
|
|
||||||
} = address
|
|
||||||
if (!address_id && send_type == 2) {
|
if (!address_id && send_type == 2) {
|
||||||
this.$util.showToast({
|
this.$util.showToast({
|
||||||
title: `请选择收货地址`
|
title: `请选择收货地址`
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
let param = Object.assign({}, subForm, {
|
let param = Object.assign({}, subForm, {
|
||||||
claim_id,
|
claim_id,
|
||||||
@@ -510,10 +460,10 @@
|
|||||||
|
|
||||||
// order_type 1发起众筹;2参与众筹
|
// order_type 1发起众筹;2参与众筹
|
||||||
if (order_type == 1) {
|
if (order_type == 1) {
|
||||||
param.collage_start_id = collage_id
|
param.collage_start_id = collage_id;
|
||||||
}
|
}
|
||||||
if (order_type == 2) {
|
if (order_type == 2) {
|
||||||
param.collage_join_id = collage_id
|
param.collage_join_id = collage_id;
|
||||||
}
|
}
|
||||||
let msg = this.validate(param);
|
let msg = this.validate(param);
|
||||||
if (msg) {
|
if (msg) {
|
||||||
@@ -525,115 +475,109 @@
|
|||||||
if (!this.agree) {
|
if (!this.agree) {
|
||||||
this.$util.showToast({
|
this.$util.showToast({
|
||||||
title: `请勾选${agreement}`
|
title: `请勾选${agreement}`
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
this.toPay(param)
|
this.toPay(param);
|
||||||
},
|
},
|
||||||
async toPay(param) {
|
async toPay(param) {
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
let that = this
|
let that = this;
|
||||||
let {
|
let { tmp_list = [] } = that.orderInfo;
|
||||||
tmp_list = []
|
let tmplIds = [];
|
||||||
} = that.orderInfo
|
tmp_list.map((item) => {
|
||||||
let tmplIds = []
|
tmplIds.push(item.tmpl_id);
|
||||||
tmp_list.map(item => {
|
});
|
||||||
tmplIds.push(item.tmpl_id)
|
|
||||||
})
|
|
||||||
if (tmplIds && tmplIds.length > 0) {
|
if (tmplIds && tmplIds.length > 0) {
|
||||||
uni.requestSubscribeMessage({
|
uni.requestSubscribeMessage({
|
||||||
tmplIds,
|
tmplIds,
|
||||||
complete(res) {
|
complete(res) {
|
||||||
that.toConfirmPay(param)
|
that.toConfirmPay(param);
|
||||||
console.log(res, "complete requestSubscribeMessage");
|
console.log(res, 'complete requestSubscribeMessage');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
that.toConfirmPay(param)
|
that.toConfirmPay(param);
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef MP-WEIXIN
|
// #ifndef MP-WEIXIN
|
||||||
this.toConfirmPay(param)
|
this.toConfirmPay(param);
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
async toConfirmPay(param) {
|
async toConfirmPay(param) {
|
||||||
if (this.lockTap) return
|
if (this.lockTap) return;
|
||||||
this.lockTap = true
|
this.lockTap = true;
|
||||||
this.$util.showLoading()
|
this.$util.showLoading();
|
||||||
try {
|
try {
|
||||||
let {
|
let { pay_list } = await this.$api.claim.claimPayOrder(param);
|
||||||
pay_list
|
this.$util.hideAll();
|
||||||
} = await this.$api.claim.claimPayOrder(param)
|
|
||||||
this.$util.hideAll()
|
|
||||||
if (pay_list) {
|
if (pay_list) {
|
||||||
if (param.pay_model == 3) {
|
if (param.pay_model == 3) {
|
||||||
pay_list = {
|
pay_list = {
|
||||||
orderInfo: pay_list,
|
orderInfo: pay_list,
|
||||||
provider: 'alipay'
|
provider: 'alipay'
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await this.$util.pay(pay_list)
|
await this.$util.pay(pay_list);
|
||||||
this.$util.showToast({
|
this.$util.showToast({
|
||||||
title: `支付成功`
|
title: `支付成功`
|
||||||
})
|
});
|
||||||
this.updateOrderItem({
|
this.updateOrderItem({
|
||||||
key: 'haveOperItem',
|
key: 'haveOperItem',
|
||||||
val: true
|
val: true
|
||||||
})
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$util.back()
|
this.$util.back();
|
||||||
this.$util.goUrl({
|
this.$util.goUrl({
|
||||||
url: '/mine/pages/pay-result?type=claim',
|
url: '/mine/pages/pay-result?type=claim',
|
||||||
openType: 'redirectTo'
|
openType: 'redirectTo'
|
||||||
})
|
});
|
||||||
}, 1000)
|
}, 1000);
|
||||||
this.lockTap = false
|
this.lockTap = false;
|
||||||
return
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$util.showToast({
|
this.$util.showToast({
|
||||||
title: `支付失败`
|
title: `支付失败`
|
||||||
})
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$util.back()
|
this.$util.back();
|
||||||
this.$util.goUrl({
|
this.$util.goUrl({
|
||||||
url: `/claim/pages/order/list`,
|
url: `/claim/pages/order/list`,
|
||||||
openType: 'redirectTo'
|
openType: 'redirectTo'
|
||||||
})
|
});
|
||||||
}, 1000)
|
}, 1000);
|
||||||
this.lockTap = false
|
this.lockTap = false;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$util.showToast({
|
this.$util.showToast({
|
||||||
title: `支付成功`
|
title: `支付成功`
|
||||||
})
|
});
|
||||||
this.updateOrderItem({
|
this.updateOrderItem({
|
||||||
key: 'haveOperItem',
|
key: 'haveOperItem',
|
||||||
val: true
|
val: true
|
||||||
})
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$util.back()
|
this.$util.back();
|
||||||
this.$util.goUrl({
|
this.$util.goUrl({
|
||||||
url: '/mine/pages/pay-result?type=claim',
|
url: '/mine/pages/pay-result?type=claim',
|
||||||
openType: 'redirectTo'
|
openType: 'redirectTo'
|
||||||
})
|
});
|
||||||
}, 1000)
|
}, 1000);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.lockTap = false
|
this.lockTap = false;
|
||||||
this.$util.hideAll()
|
this.$util.hideAll();
|
||||||
}, 2000)
|
}, 2000);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.claim-order {
|
.claim-order {
|
||||||
|
|
||||||
.collage-tag {
|
.collage-tag {
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
padding: 0 10rpx;
|
padding: 0 10rpx;
|
||||||
@@ -642,7 +586,7 @@
|
|||||||
.send-list {
|
.send-list {
|
||||||
width: 180rpx;
|
width: 180rpx;
|
||||||
height: 52rpx;
|
height: 52rpx;
|
||||||
border: 1rpx solid #CCCCCC;
|
border: 1rpx solid #cccccc;
|
||||||
transform: rotateZ(360deg);
|
transform: rotateZ(360deg);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
@@ -655,7 +599,7 @@
|
|||||||
.add-btn {
|
.add-btn {
|
||||||
width: 296rpx;
|
width: 296rpx;
|
||||||
height: 72rpx;
|
height: 72rpx;
|
||||||
background: #F6F6F6;
|
background: #f6f6f6;
|
||||||
border-radius: 36rpx;
|
border-radius: 36rpx;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
@@ -689,7 +633,7 @@
|
|||||||
line-height: 36rpx;
|
line-height: 36rpx;
|
||||||
margin-left: 15rpx;
|
margin-left: 15rpx;
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
background: #F0F4EC;
|
background: #f0f4ec;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,5 +649,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -230,7 +230,8 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-navbar-btn-text.iconfont {
|
.uni-navbar-btn-text .iconfont {
|
||||||
|
transform: rotate(180deg);
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@
|
|||||||
"path": "pages/claim",
|
"path": "pages/claim",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "认养",
|
"navigationBarTitleText": "认养",
|
||||||
"enablePullDownRefresh": true
|
"enablePullDownRefresh": true,
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/shop",
|
"path": "pages/shop",
|
||||||
@@ -235,7 +236,9 @@
|
|||||||
"path": "pages/detail",
|
"path": "pages/detail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "认养详情",
|
"navigationBarTitleText": "认养详情",
|
||||||
"enablePullDownRefresh": true
|
"enablePullDownRefresh": true,
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/order",
|
"path": "pages/order",
|
||||||
|
|||||||
457
uniapp/uni-app/pages/claim - 副本 (2).vue
Normal file
@@ -0,0 +1,457 @@
|
|||||||
|
<template>
|
||||||
|
<view class="pages-claim" v-if="isLoad">
|
||||||
|
<uni-nav-bar :fixed="true" :title="scrollTop>40?'':'认植认养'" backgroundColor="none" color="#FFFFFF"></uni-nav-bar>
|
||||||
|
<view class="banner-wrap">
|
||||||
|
<image class="banner" mode="aspectFill" src="@/static/image/imgicon/banner_bg.png"></image>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="tab-scroll" scroll-x enable-flex>
|
||||||
|
<view class="tab-list-box">
|
||||||
|
<view class="tab-item on" v-for="i in 9">
|
||||||
|
<view class="name">优质果蔬</view>
|
||||||
|
<image class="icon-bg" mode="aspectFit" src="@/static/image/imgicon/tab_icon.png"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<view class="list-wrap">
|
||||||
|
<view class="list-item" v-for="i in 3">
|
||||||
|
<view class="img-box">
|
||||||
|
<image class="img" mode="aspectFill" src="@/static/image/imgicon/banner_bg.png"></image>
|
||||||
|
<view class="hot">最热</view>
|
||||||
|
</view>
|
||||||
|
<view class="content">
|
||||||
|
<view class="name-row">
|
||||||
|
<view class="name">橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树橙子树</view>
|
||||||
|
<view class="money">
|
||||||
|
<text>¥</text>
|
||||||
|
280.
|
||||||
|
<text>00</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-row">
|
||||||
|
<view class="address">产地:河源-牛营山牛营山牛营山牛营山牛营山牛营山牛营山</view>
|
||||||
|
<view class="count">已认种:10</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="info-row">
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="count">10</view>
|
||||||
|
<view class="label">品种</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="count">1890</view>
|
||||||
|
<view class="label">预产量(kg)</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="count">10天</view>
|
||||||
|
<view class="label">周期</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="but">我要认种</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState, mapActions, mapMutations } from 'vuex';
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isLoad: false,
|
||||||
|
options: {},
|
||||||
|
rankInd: 0,
|
||||||
|
rankList: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
title: '综合排序'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
title: '销量优先'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
title: '距离优先'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
tabList: [],
|
||||||
|
activeIndex: 0,
|
||||||
|
cate_id: 0,
|
||||||
|
banner: [],
|
||||||
|
param: {
|
||||||
|
page: 1
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
data: []
|
||||||
|
},
|
||||||
|
loading: true,
|
||||||
|
lockTap: false,
|
||||||
|
show_rank_item: false,
|
||||||
|
refresh: false,
|
||||||
|
|
||||||
|
scrollTop: 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: mapState({
|
||||||
|
primaryColor: (state) => state.config.configInfo.primaryColor,
|
||||||
|
subColor: (state) => state.config.configInfo.subColor,
|
||||||
|
configInfo: (state) => state.config.configInfo,
|
||||||
|
userInfo: (state) => state.user.userInfo,
|
||||||
|
location: (state) => state.user.location,
|
||||||
|
loginType: (state) => state.user.loginType
|
||||||
|
}),
|
||||||
|
async onLoad() {
|
||||||
|
if (this.isLoad) return;
|
||||||
|
this.$util.showLoading();
|
||||||
|
this.initIndex();
|
||||||
|
},
|
||||||
|
async onShow() {
|
||||||
|
if (!this.isLoad || (this.location.lat && this.rankInd != 2)) return;
|
||||||
|
let [err, result] = await uni.getSetting();
|
||||||
|
if (err || !result.authSetting[`scope.userLocation`]) return;
|
||||||
|
this.initIndex();
|
||||||
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
uni.showNavigationBarLoading();
|
||||||
|
// #endif
|
||||||
|
this.initRefresh();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
if (this.list.current_page >= this.list.last_page || this.loading) return;
|
||||||
|
this.param.page = this.param.page + 1;
|
||||||
|
this.loading = true;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
onShareAppMessage(e) {
|
||||||
|
let { id: pid } = this.userInfo;
|
||||||
|
let path = `/pages/claim?pid=${pid}`;
|
||||||
|
this.$util.log(path);
|
||||||
|
return {
|
||||||
|
title: '',
|
||||||
|
imageUrl: '',
|
||||||
|
path
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onPageScroll(e){
|
||||||
|
this.scrollTop = e.scrollTop
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['getConfigInfo']),
|
||||||
|
...mapMutations(['updateUserItem']),
|
||||||
|
async initIndex(refresh = false) {
|
||||||
|
if (!this.configInfo.id || refresh) {
|
||||||
|
await this.getConfigInfo();
|
||||||
|
if (this.loginType == 'apple') {
|
||||||
|
this.updateUserItem({
|
||||||
|
key: 'isShowLogin',
|
||||||
|
val: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await this.getLocation();
|
||||||
|
let [banner, cate] = await Promise.all([
|
||||||
|
this.$api.claim.claimBanner({
|
||||||
|
type: 3
|
||||||
|
}),
|
||||||
|
this.$api.claim.claimCateList({
|
||||||
|
type: 2
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
cate.unshift({
|
||||||
|
id: 0,
|
||||||
|
title: '全部'
|
||||||
|
});
|
||||||
|
this.banner = banner;
|
||||||
|
this.tabList = cate;
|
||||||
|
this.isLoad = true;
|
||||||
|
this.refresh = false;
|
||||||
|
this.param.page = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
initRefresh() {
|
||||||
|
this.refresh = true;
|
||||||
|
this.$refs.rank_item.close();
|
||||||
|
this.initIndex(true);
|
||||||
|
},
|
||||||
|
async getLocation() {
|
||||||
|
let { location } = this;
|
||||||
|
if (!location.lat) {
|
||||||
|
location = await this.$util.getBmapLocation();
|
||||||
|
this.updateUserItem({
|
||||||
|
key: 'location',
|
||||||
|
val: location
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handerTabChange(index, type) {
|
||||||
|
this[type] = index;
|
||||||
|
this.$refs.rank_item.close();
|
||||||
|
if (type == 'activeIndex') {
|
||||||
|
this.cate_id = this.tabList[index].id;
|
||||||
|
}
|
||||||
|
this.$util.showLoading();
|
||||||
|
this.param.page = 1;
|
||||||
|
this.list.data = [];
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
toShowRank() {
|
||||||
|
let { show_rank_item } = this;
|
||||||
|
if (this.lockTap) return;
|
||||||
|
this.lockTap = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
let methodModel = show_rank_item ? 'close' : 'open';
|
||||||
|
this.$refs.rank_item[methodModel]();
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
popupChange(e) {
|
||||||
|
let { show } = e;
|
||||||
|
this.show_rank_item = show;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.lockTap = false;
|
||||||
|
}, 200);
|
||||||
|
},
|
||||||
|
async getList() {
|
||||||
|
let { list: oldList, param, tabList, activeIndex, rankList, rankInd, cate_id } = this;
|
||||||
|
let ind = tabList.findIndex((item) => {
|
||||||
|
return item.id == cate_id;
|
||||||
|
});
|
||||||
|
cate_id = ind == -1 ? 0 : cate_id;
|
||||||
|
activeIndex = ind == -1 ? 0 : ind;
|
||||||
|
this.cate_id = cate_id;
|
||||||
|
this.activeIndex = activeIndex;
|
||||||
|
let { id: sort } = rankList[rankInd];
|
||||||
|
if (sort == 3 && !this.location.lat) {
|
||||||
|
this.$util.hideAll();
|
||||||
|
await this.getLocation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let { lng = 0, lat = 0 } = this.location;
|
||||||
|
param = Object.assign({}, param, {
|
||||||
|
cate_id,
|
||||||
|
sort
|
||||||
|
});
|
||||||
|
if (sort === 3) {
|
||||||
|
param.lat = lat;
|
||||||
|
param.lng = lng;
|
||||||
|
}
|
||||||
|
let newList = await this.$api.claim.claimList(param);
|
||||||
|
newList.data.map((item) => {
|
||||||
|
let { stock, sale_num } = item;
|
||||||
|
item.precent = ((sale_num / (stock + sale_num)) * 100).toFixed(2) + '%';
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
},
|
||||||
|
async goDetail(index) {
|
||||||
|
let { id } = this.list.data[index];
|
||||||
|
let url = `/claim/pages/detail?id=${id}`;
|
||||||
|
this.$util.toCheckLogin({
|
||||||
|
url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.pages-claim {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: #f8feff;
|
||||||
|
}
|
||||||
|
.banner-wrap {
|
||||||
|
width: 100%;
|
||||||
|
height: 596rpx;
|
||||||
|
|
||||||
|
.banner {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 596rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-scroll {
|
||||||
|
height: 88rpx;
|
||||||
|
overflow: auto;
|
||||||
|
display: flex;
|
||||||
|
background: #ffffff;
|
||||||
|
|
||||||
|
.tab-list-box {
|
||||||
|
padding: 0 28rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
width: auto;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #777777;
|
||||||
|
line-height: 88rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
flex-shrink: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
& + .tab-item {
|
||||||
|
margin-left: 70rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.on {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.name {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.icon-bg {
|
||||||
|
width: 62rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 10rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-wrap {
|
||||||
|
padding: 28rpx 28rpx 200rpx;
|
||||||
|
|
||||||
|
.list-item {
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 6rpx 6rpx #f5f5f5;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin-bottom: 28rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.img-box {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 390rpx;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hot{
|
||||||
|
height: 48rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 28rpx;
|
||||||
|
background: linear-gradient( 133deg, #FFCC49 0%, #FF8744 100%);
|
||||||
|
border-radius: 0 0 12rpx 0;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 28rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 28rpx 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 22rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
flex: 1;
|
||||||
|
line-height: 44rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.money {
|
||||||
|
line-height: 50rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #dd3e3e;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-row {
|
||||||
|
line-height: 40rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
display: flex;
|
||||||
|
padding-bottom: 24rpx;
|
||||||
|
border-bottom: 2rpx dashed #e4eaeb;
|
||||||
|
|
||||||
|
.address {
|
||||||
|
flex: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-row {
|
||||||
|
display: flex;
|
||||||
|
padding: 35rpx 0;
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.count {
|
||||||
|
line-height: 44rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #dd3e3e;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
line-height: 34rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.but {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 568rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
background: #1FD3EA;
|
||||||
|
// background: linear-gradient(to right, #43c5fe, #358ffd);
|
||||||
|
border-radius: 72rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
375
uniapp/uni-app/pages/claim - 副本.vue
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
<template>
|
||||||
|
<view class="pages-claim" v-if="isLoad">
|
||||||
|
<fixed :refresh="refresh">
|
||||||
|
<view class="fill-base">
|
||||||
|
<banner :list="banner" :margin="0" :autoplay="true" :borderRadius="0" :height="420"
|
||||||
|
:indicatorActiveColor="primaryColor" v-if="banner.length > 0"></banner>
|
||||||
|
<view class="fill-base flex-between b-1px-b">
|
||||||
|
<view style="width: 650rpx;">
|
||||||
|
<tab @change="handerTabChange($event,'activeIndex')" :list="tabList" :activeIndex="activeIndex"
|
||||||
|
:activeColor="primaryColor" height="100rpx"></tab>
|
||||||
|
</view>
|
||||||
|
<view @tap.stop="toShowRank" class="flex-center c-caption b-1px-l" style="width: 100rpx;">
|
||||||
|
<i class="iconfont icon-down-bold" :class="[{'rotate-180':show_rank_item}]"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</fixed>
|
||||||
|
|
||||||
|
<uni-popup @change="popupChange" ref="rank_item" type="top" :custom="true">
|
||||||
|
<view :style="{height: banner.length > 0 ? '520rpx':'100rpx'}"></view>
|
||||||
|
<view class="pd-lg fill-base">
|
||||||
|
<view @tap.stop="handerTabChange(index,'rankInd')" class="f-paragraph c-title"
|
||||||
|
:class="[{'mt-md':index!=0}]" :style="{color:index==rankInd?primaryColor:''}"
|
||||||
|
v-for="(item,index) in rankList" :key="index">
|
||||||
|
{{item.title}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
|
||||||
|
|
||||||
|
<view @tap.stop="goDetail(index)" class="claim-item fill-base mt-md ml-md mr-md box-shadow radius-24"
|
||||||
|
v-for="(item,index) in list.data" :key="index">
|
||||||
|
<view class="flex-between pt-lg pl-lg pr-lg">
|
||||||
|
<view class="flex-y-center">
|
||||||
|
<image mode="aspectFill" lazy-load class="avatar mini radius" :src="item.farmer_info.cover"></image>
|
||||||
|
<view class="ml-lg max-446 ellipsis">{{item.farmer_info.title}}</view>
|
||||||
|
</view>
|
||||||
|
<i class="iconfont icon-right c-caption" style="font-size: 28rpx;"></i>
|
||||||
|
</view>
|
||||||
|
<view class="flex-center pd-lg">
|
||||||
|
<image mode="aspectFill" lazy-load class="cover fill-body radius-24" :src="item.cover"></image>
|
||||||
|
<view class="flex-1 ml-lg max-380">
|
||||||
|
<view class="f-title c-title ellipsis-2">{{item.title}}</view>
|
||||||
|
<view class="f-paragraph c-title">{{`${item.start_time} ~ ${item.end_time}`}}</view>
|
||||||
|
<view class="flex-between mt-sm mb-md">
|
||||||
|
<view class="line-item rel">
|
||||||
|
<view class="cur abs" :style="{width:item.precent}"></view>
|
||||||
|
</view>
|
||||||
|
<view class="c-caption" style="font-size: 20rpx;">已认养{{item.precent}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="count-list flex-warp">
|
||||||
|
<view class="count-item">
|
||||||
|
<view class="flex-y-center f-caption c-caption">
|
||||||
|
<view class="dot radius"></view>品种
|
||||||
|
</view>
|
||||||
|
<view class="f-paragraph c-title ellipsis">{{item.breed}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="count-item">
|
||||||
|
<view class="flex-y-center f-caption c-caption">
|
||||||
|
<view class="dot radius"></view>周期
|
||||||
|
</view>
|
||||||
|
<view class="f-paragraph c-title ellipsis">{{item.cycle}}天</view>
|
||||||
|
</view>
|
||||||
|
<view class="count-item">
|
||||||
|
<view class="flex-y-center f-caption c-caption">
|
||||||
|
<view class="dot radius"></view>产量
|
||||||
|
</view>
|
||||||
|
<view class="f-paragraph c-title">{{item.output}}kg</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-between ml-lg mr-lg pt-lg pb-sm b-1px-t">
|
||||||
|
<view class="flex-y-baseline">
|
||||||
|
<view class="f-lg-title c-warning">¥{{item.price}}</view>
|
||||||
|
<view class="f-caption c-caption ml-sm">/{{item.unit}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="common-btn flex-center f-paragraph c-base radius-4" :style="{background:primaryColor}">
|
||||||
|
立即认养</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-y-center pl-lg pr-lg pb-lg">
|
||||||
|
<view class="flex-warp">
|
||||||
|
<block v-for="(item,index) in item.count.user_list" :key="index">
|
||||||
|
<view class="avatar-group" v-if="index<6">
|
||||||
|
<image mode="aspectFill" lazy-load class="abs avatar fill-body radius"
|
||||||
|
:src="item.avatarUrl"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="flex-y-center f-caption c-title pr-lg" :class="[{'ml-lg':item.count.user_count>0}]"
|
||||||
|
style="height: 48rpx;">
|
||||||
|
已有{{item.count.user_count}}人参与</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||||
|
</load-more>
|
||||||
|
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||||
|
<view class="space-footer"></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions,
|
||||||
|
mapMutations
|
||||||
|
} from "vuex"
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isLoad: false,
|
||||||
|
options: {},
|
||||||
|
rankInd: 0,
|
||||||
|
rankList: [{
|
||||||
|
id: 1,
|
||||||
|
title: '综合排序'
|
||||||
|
}, {
|
||||||
|
id: 2,
|
||||||
|
title: '销量优先'
|
||||||
|
}, {
|
||||||
|
id: 3,
|
||||||
|
title: '距离优先'
|
||||||
|
}],
|
||||||
|
tabList: [],
|
||||||
|
activeIndex: 0,
|
||||||
|
cate_id: 0,
|
||||||
|
banner: [],
|
||||||
|
param: {
|
||||||
|
page: 1,
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
data: []
|
||||||
|
},
|
||||||
|
loading: true,
|
||||||
|
lockTap: false,
|
||||||
|
show_rank_item: false,
|
||||||
|
refresh: 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,
|
||||||
|
location: state => state.user.location,
|
||||||
|
loginType: state => state.user.loginType,
|
||||||
|
}),
|
||||||
|
async onLoad() {
|
||||||
|
if (this.isLoad) return
|
||||||
|
this.$util.showLoading()
|
||||||
|
this.initIndex()
|
||||||
|
},
|
||||||
|
async onShow() {
|
||||||
|
if (!this.isLoad || (this.location.lat && this.rankInd != 2)) return
|
||||||
|
let [err, result] = await uni.getSetting()
|
||||||
|
if (err || !result.authSetting[`scope.userLocation`]) return
|
||||||
|
this.initIndex()
|
||||||
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
uni.showNavigationBarLoading()
|
||||||
|
// #endif
|
||||||
|
this.initRefresh()
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||||
|
this.param.page = this.param.page + 1
|
||||||
|
this.loading = true
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
onShareAppMessage(e) {
|
||||||
|
let {
|
||||||
|
id: pid
|
||||||
|
} = this.userInfo
|
||||||
|
let path = `/pages/claim?pid=${pid}`
|
||||||
|
this.$util.log(path)
|
||||||
|
return {
|
||||||
|
title: '',
|
||||||
|
imageUrl: '',
|
||||||
|
path,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['getConfigInfo']),
|
||||||
|
...mapMutations(['updateUserItem']),
|
||||||
|
async initIndex(refresh = false) {
|
||||||
|
if (!this.configInfo.id || refresh) {
|
||||||
|
await this.getConfigInfo()
|
||||||
|
if (this.loginType == 'apple') {
|
||||||
|
this.updateUserItem({
|
||||||
|
key: 'isShowLogin',
|
||||||
|
val: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await this.getLocation()
|
||||||
|
let [banner, cate] = await Promise.all([this.$api.claim.claimBanner({
|
||||||
|
type: 3
|
||||||
|
}), this.$api.claim
|
||||||
|
.claimCateList({
|
||||||
|
type: 2
|
||||||
|
})
|
||||||
|
])
|
||||||
|
cate.unshift({
|
||||||
|
id: 0,
|
||||||
|
title: '全部'
|
||||||
|
})
|
||||||
|
this.banner = banner
|
||||||
|
this.tabList = cate
|
||||||
|
this.isLoad = true
|
||||||
|
this.refresh = false
|
||||||
|
this.param.page = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
initRefresh() {
|
||||||
|
this.refresh = true
|
||||||
|
this.$refs.rank_item.close()
|
||||||
|
this.initIndex(true)
|
||||||
|
},
|
||||||
|
async getLocation() {
|
||||||
|
let {
|
||||||
|
location
|
||||||
|
} = this
|
||||||
|
if (!location.lat) {
|
||||||
|
location = await this.$util.getBmapLocation()
|
||||||
|
this.updateUserItem({
|
||||||
|
key: 'location',
|
||||||
|
val: location
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handerTabChange(index, type) {
|
||||||
|
this[type] = index
|
||||||
|
this.$refs.rank_item.close()
|
||||||
|
if (type == 'activeIndex') {
|
||||||
|
this.cate_id = this.tabList[index].id
|
||||||
|
}
|
||||||
|
this.$util.showLoading()
|
||||||
|
this.param.page = 1
|
||||||
|
this.list.data = []
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
toShowRank() {
|
||||||
|
let {
|
||||||
|
show_rank_item,
|
||||||
|
} = this
|
||||||
|
if (this.lockTap) return
|
||||||
|
this.lockTap = true
|
||||||
|
setTimeout(() => {
|
||||||
|
let methodModel = show_rank_item ? 'close' : 'open'
|
||||||
|
this.$refs.rank_item[methodModel]()
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
|
popupChange(e) {
|
||||||
|
let {
|
||||||
|
show
|
||||||
|
} = e
|
||||||
|
this.show_rank_item = show
|
||||||
|
setTimeout(() => {
|
||||||
|
this.lockTap = false
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
async getList() {
|
||||||
|
let {
|
||||||
|
list: oldList,
|
||||||
|
param,
|
||||||
|
tabList,
|
||||||
|
activeIndex,
|
||||||
|
rankList,
|
||||||
|
rankInd,
|
||||||
|
cate_id
|
||||||
|
} = this
|
||||||
|
let ind = tabList.findIndex(item => {
|
||||||
|
return item.id == cate_id
|
||||||
|
})
|
||||||
|
cate_id = ind == -1 ? 0 : cate_id
|
||||||
|
activeIndex = ind == -1 ? 0 : ind
|
||||||
|
this.cate_id = cate_id
|
||||||
|
this.activeIndex = activeIndex
|
||||||
|
let {
|
||||||
|
id: sort
|
||||||
|
} = rankList[rankInd]
|
||||||
|
if (sort == 3 && !this.location.lat) {
|
||||||
|
this.$util.hideAll()
|
||||||
|
await this.getLocation()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let {
|
||||||
|
lng = 0,
|
||||||
|
lat = 0
|
||||||
|
} = this.location
|
||||||
|
param = Object.assign({}, param, {
|
||||||
|
cate_id,
|
||||||
|
sort,
|
||||||
|
});
|
||||||
|
if (sort === 3) {
|
||||||
|
param.lat = lat
|
||||||
|
param.lng = lng
|
||||||
|
}
|
||||||
|
let newList = await this.$api.claim.claimList(param)
|
||||||
|
newList.data.map(item => {
|
||||||
|
let {
|
||||||
|
stock,
|
||||||
|
sale_num
|
||||||
|
} = item
|
||||||
|
item.precent = (sale_num / (stock + sale_num) * 100).toFixed(2) + '%'
|
||||||
|
})
|
||||||
|
|
||||||
|
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()
|
||||||
|
},
|
||||||
|
async goDetail(index) {
|
||||||
|
let {
|
||||||
|
id
|
||||||
|
} = this.list.data[index]
|
||||||
|
let url = `/claim/pages/detail?id=${id}`
|
||||||
|
this.$util.toCheckLogin({
|
||||||
|
url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.pages-claim {
|
||||||
|
|
||||||
|
.claim-item {
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 240rpx;
|
||||||
|
height: 240rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-item {
|
||||||
|
width: 230rpx;
|
||||||
|
height: 15rpx;
|
||||||
|
background: rgba(112, 152, 64, 0.2);
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
.cur {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 15rpx;
|
||||||
|
background: linear-gradient(0deg, #709840 0%, #91C84E 100%);
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.count-list {
|
||||||
|
.count-item {
|
||||||
|
width: 33.33%;
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
width: 10rpx;
|
||||||
|
height: 10rpx;
|
||||||
|
background: #B3D465;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
606
uniapp/uni-app/pages/home - 副本.vue
Normal file
@@ -0,0 +1,606 @@
|
|||||||
|
<template>
|
||||||
|
<view class="pages-home" v-if="isLoad">
|
||||||
|
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" :onlyLeft="true" color="#fff"
|
||||||
|
:backgroundColor="scrollTop < 20 ?``:primaryColor">
|
||||||
|
<view @tap.stop="toChooseLocation" class="flex-y-center" slot="left">
|
||||||
|
<i class="iconfont icon-dingwei mr-sm"></i>
|
||||||
|
<view class=" max-400 ellipsis">
|
||||||
|
{{location.address || location.city || (location.lat ? '未知地点' : (isLoad ? '定位失败' : '定位中...'))}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-nav-bar>
|
||||||
|
|
||||||
|
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
|
||||||
|
<view mode="aspectFill" lazy-load class="home-index-bg abs"></view>
|
||||||
|
<view @tap.stop="$util.toCheckLogin({url:`/home/pages/search`})" class="pt-md pl-md pr-md">
|
||||||
|
<search :padding="0" :radius="10" backgroundColor="rgba(240,240,240,0.2)"
|
||||||
|
searchColor="rgba(240,240,240,0.2)" frontColor="#fff" textAlign="center" placeholder="请输入商品名称"></search>
|
||||||
|
</view>
|
||||||
|
<view class="mt-lg ml-md mr-md" v-if="detail.banner.rotation.length > 0">
|
||||||
|
<banner @change="goBanner" :list="detail.banner.rotation" :margin="0" :autoplay="true" :borderRadius="25"
|
||||||
|
:height="286" :indicatorActiveColor="primaryColor"></banner>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view @tap="$util.toCheckLogin({url:`/home/pages/welfare?type=2`})"
|
||||||
|
class="notice-info flex-center mt-md pd-md fill-base">
|
||||||
|
<image mode="aspectFill" lazy-load class="notice-img" src="/static/image/home/notice.png">
|
||||||
|
</image>
|
||||||
|
<view class="ml-sm infomation-left"></view>
|
||||||
|
<view class="flex-1 ml-md">
|
||||||
|
<swiper :autoplay="true" :circular='true' :vertical="true" class="roller-box" :interval="2000">
|
||||||
|
<swiper-item v-for="(item,index) in detail.system_list" :key="index">
|
||||||
|
<view class="roller-item flex-between f-caption c-desc">
|
||||||
|
<view class="ellipsis">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view @tap.stop="goAbout"
|
||||||
|
class="weather-info flex-warp rel pr-md pl-md pb-md f-icontext c-desc"
|
||||||
|
v-if="detail.weather.observe.update_time">
|
||||||
|
<view class="flex-y-baseline">
|
||||||
|
<view class="flex-center mr-lg">
|
||||||
|
<view class="number">{{detail.weather.observe.degree}}°</view>
|
||||||
|
</view>
|
||||||
|
<view class="weather">{{today}} {{detail.weather.observe.weather}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex-warp">
|
||||||
|
<view class="mr-lg">
|
||||||
|
温度变化:{{`${detail.weather.forecast_24h.min_degree}°~${detail.weather.forecast_24h.max_degree}°`}}
|
||||||
|
</view>
|
||||||
|
<view class="mr-lg">风力:{{detail.weather.observe.wind_power}}级</view>
|
||||||
|
<view class="mr-lg">湿度:{{detail.weather.observe.humidity}}%</view>
|
||||||
|
<view>气压:{{detail.weather.observe.pressure}}hPa</view>
|
||||||
|
</view>
|
||||||
|
<view class="about-info flex-center abs" :style="{background:primaryColor}">
|
||||||
|
<image mode="aspectFill" lazy-load class="weather-img ml-sm mr-md"
|
||||||
|
:src="`${weather_img}${time_key}/${detail.weather.observe.weather_code}.png`">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flex-warp fill-base pb-md">
|
||||||
|
<view @tap.stop="toMenu(index)" class="menu-item flex-center flex-column pb-lg"
|
||||||
|
v-for="(item,index) in menuList" :key="index">
|
||||||
|
<image mode="aspectFill" lazy-load class="menu-img radius"
|
||||||
|
:src="`/static/image/home/${item.img_name}.png`">
|
||||||
|
</image>
|
||||||
|
<view class="f-caption c-title mt-sm">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view @tap="$util.toCheckLogin({url:`/shop/pages/coupon`})"
|
||||||
|
class="advertisement-info fill-base pr-md pl-md pb-md" v-if="detail.coupon_total">
|
||||||
|
<image mode="aspectFill" lazy-load class="coupon-img"
|
||||||
|
src="/static/image/home/xrhb.png">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="advertisement-info fill-base pr-md pl-md pb-md"
|
||||||
|
v-if="detail.banner.poster.length > 0">
|
||||||
|
<banner @change="goBanner" :list="detail.banner.poster" :margin="0" :autoplay="true" :borderRadius="25"
|
||||||
|
:height="285" :indicatorActiveColor="primaryColor"></banner>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mt-md pd-lg fill-base">
|
||||||
|
<view @tap="$util.toCheckLogin({url:`/shop/pages/hot-goods`})" class="flex-center">
|
||||||
|
<view class="flex-1 f-paragraph text-bold">热门商品</view>
|
||||||
|
<view class="flex-y-center c-caption f-caption">查看更多<i class="iconfont icon-right"></i></view>
|
||||||
|
</view>
|
||||||
|
<block v-for="(item,index) in detail.hot_goods" :key="index">
|
||||||
|
<view @tap.stop="goDetail(1,'hot_goods',index)" class="goods-item flex-center mt-lg">
|
||||||
|
<image mode="aspectFill" lazy-load class="cover radius-16" :src="item.cover"></image>
|
||||||
|
<view class="flex-1 ml-lg">
|
||||||
|
<view class="flex-center">
|
||||||
|
<view class="flex-1">
|
||||||
|
<view class="f-paragraph c-title mt-sm mb-sm max-400 ellipsis">{{item.goods_name}}
|
||||||
|
</view>
|
||||||
|
<view class="flex-y-baseline f-caption c-warning">¥<view class="f-title">
|
||||||
|
{{item.show_price}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-caption c-caption text-delete">¥{{item.show_init_price}}</view>
|
||||||
|
</view>
|
||||||
|
<image lazy-load class="add-car-img" src="/static/image/shop/add-car.png">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="mt-md pt-lg pb-lg fill-base">
|
||||||
|
<view @tap="$util.toCheckLogin({url:`/shop/pages/choose-store`})" class="pl-lg pr-lg flex-center">
|
||||||
|
<view class="flex-1 f-paragraph text-bold">热门店铺</view>
|
||||||
|
<view class="flex-y-center c-caption f-caption">查看更多<i class="iconfont icon-right"></i></view>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-x class="hot-shop-list pt-lg pl-lg" :scroll-with-animation="true"
|
||||||
|
v-if="detail.store_list.length > 0">
|
||||||
|
<block v-for="(item,index) in detail.store_list" :key="index">
|
||||||
|
<view @tap.stop="goDetail(2,'store_list',index)" class="hot-shop-item mr-lg radius-16">
|
||||||
|
<image mode="aspectFill" lazy-load class="cover box-shadow" :src="item.cover"></image>
|
||||||
|
<view class="pd-md">
|
||||||
|
<view class="flex-between f-caption c-desc">
|
||||||
|
<view class="business-tag flex-center radius-4" :style="{color:primaryColor}">营业中</view>
|
||||||
|
<view class="pl-sm ellipsis">{{item.distance}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-paragraph c-title mt-md ellipsis-2">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mt-md pd-lg fill-base">
|
||||||
|
<view @tap="$util.toCheckLogin({url:`/home/pages/welfare`})" class="flex-center">
|
||||||
|
<view class="flex-1 f-paragraph text-bold">公益栏目</view>
|
||||||
|
<view class="flex-y-center c-caption f-caption">查看更多<i class="iconfont icon-right"></i></view>
|
||||||
|
</view>
|
||||||
|
<block v-for="(item,index) in detail.welfare_list" :key="index">
|
||||||
|
<view @tap.stop="goDetail(3,'welfare_list',index)" class="welfare-item flex-center mt-lg">
|
||||||
|
<image mode="aspectFill" lazy-load class="cover radius-16" :src="item.cover"></image>
|
||||||
|
<view class="flex-1 ml-lg">
|
||||||
|
<view class="f-title c-title mb-md ellipsis">{{item.title}}</view>
|
||||||
|
<view class="f-caption c-caption">{{item.create_time_text}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="space-footer"></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions,
|
||||||
|
mapMutations
|
||||||
|
} from "vuex"
|
||||||
|
import uniSegmentedControl from "@/components/uni-segmented-control.vue"
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
uniSegmentedControl
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
scrollTop: 0,
|
||||||
|
options: {},
|
||||||
|
weather_img: `https://mat1.gtimg.com/pingjs/ext2020/weather/pc/icon/currentweather/`,
|
||||||
|
menuList: [{
|
||||||
|
id: 1,
|
||||||
|
title: '土地租赁',
|
||||||
|
img_name: 'land',
|
||||||
|
url: '/pages/land'
|
||||||
|
}, {
|
||||||
|
id: 2,
|
||||||
|
title: '农业认养',
|
||||||
|
img_name: 'claim',
|
||||||
|
url: '/pages/claim'
|
||||||
|
}, {
|
||||||
|
id: 3,
|
||||||
|
title: '视频监控',
|
||||||
|
img_name: 'monitor',
|
||||||
|
url: '/home/pages/monitor/list'
|
||||||
|
}, {
|
||||||
|
id: 4,
|
||||||
|
title: '农场商城',
|
||||||
|
img_name: 'shop',
|
||||||
|
url: '/pages/shop'
|
||||||
|
}, {
|
||||||
|
id: 5,
|
||||||
|
title: '会员充值',
|
||||||
|
img_name: 'stored',
|
||||||
|
url: '/mine/pages/balance/list'
|
||||||
|
}, {
|
||||||
|
id: 6,
|
||||||
|
title: '众筹认养',
|
||||||
|
img_name: 'collage',
|
||||||
|
url: '/claim/pages/collage/list'
|
||||||
|
}, {
|
||||||
|
id: 7,
|
||||||
|
title: '限时秒杀',
|
||||||
|
img_name: 'seckill',
|
||||||
|
url: '/shop/pages/seckill'
|
||||||
|
}, {
|
||||||
|
id: 8,
|
||||||
|
title: '积分商城',
|
||||||
|
img_name: 'integral',
|
||||||
|
url: '/shop/pages/integral/list'
|
||||||
|
}, {
|
||||||
|
id: 9,
|
||||||
|
title: '农场签到',
|
||||||
|
img_name: 'sign',
|
||||||
|
url: '/shop/pages/sign'
|
||||||
|
}, {
|
||||||
|
id: 10,
|
||||||
|
title: '积分抽奖',
|
||||||
|
img_name: 'luck',
|
||||||
|
url: '/shop/pages/luck'
|
||||||
|
}],
|
||||||
|
isLoad: false,
|
||||||
|
loading: false,
|
||||||
|
detail: {},
|
||||||
|
about_us: 0,
|
||||||
|
weather: {},
|
||||||
|
store_list: [],
|
||||||
|
today: '',
|
||||||
|
cur_time: '',
|
||||||
|
time_key: 'day'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: mapState({
|
||||||
|
primaryColor: state => state.config.configInfo.primaryColor,
|
||||||
|
subColor: state => state.config.configInfo.subColor,
|
||||||
|
configInfo: state => state.config.configInfo,
|
||||||
|
userInfo: state => state.user.userInfo,
|
||||||
|
location: state => state.user.location,
|
||||||
|
loginType: state => state.user.loginType,
|
||||||
|
}),
|
||||||
|
async onLoad() {
|
||||||
|
console.log("====onload")
|
||||||
|
if (this.isLoad) return
|
||||||
|
this.initIndex()
|
||||||
|
},
|
||||||
|
async onShow() {
|
||||||
|
let cur_time = this.$util.DateToUnix(this.$util.formatTime(new Date(), 'YY-M-D h:m:s'))
|
||||||
|
let time = this.$util.DateToUnix(this.$util.formatTime(new Date(), 'YY-M-D'))
|
||||||
|
let min = time + 8 * 3600 - 1
|
||||||
|
let max = time + 19 * 3600 + 1
|
||||||
|
this.time_key = cur_time > min && cur_time < max ? 'day' : 'night'
|
||||||
|
if (!this.isLoad || this.location.lat) return
|
||||||
|
let [err, result] = await uni.getSetting()
|
||||||
|
if (err || !result.authSetting[`scope.userLocation`]) return
|
||||||
|
this.initIndex()
|
||||||
|
},
|
||||||
|
onPageScroll(e) {
|
||||||
|
this.scrollTop = e.scrollTop
|
||||||
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
uni.showNavigationBarLoading()
|
||||||
|
// #endif
|
||||||
|
this.initRefresh()
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
},
|
||||||
|
onShareAppMessage(e) {
|
||||||
|
let {
|
||||||
|
id: pid
|
||||||
|
} = this.userInfo
|
||||||
|
let path = `/pages/home?pid=${pid}`
|
||||||
|
this.$util.log(path)
|
||||||
|
return {
|
||||||
|
title: '',
|
||||||
|
imageUrl: '',
|
||||||
|
path,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['getConfigInfo']),
|
||||||
|
...mapMutations(['updateUserItem']),
|
||||||
|
async initIndex(refresh = false) {
|
||||||
|
this.cur_time = this.$util.formatTime(new Date(), 'YY-M-D')
|
||||||
|
this.today = this.$util.formatTime(new Date(), 'YY年M月D日')
|
||||||
|
if (!this.configInfo.id || refresh) {
|
||||||
|
await this.getConfigInfo()
|
||||||
|
if (this.loginType == 'apple') {
|
||||||
|
this.updateUserItem({
|
||||||
|
key: 'isShowLogin',
|
||||||
|
val: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await this.getLocation()
|
||||||
|
if (!refresh) {
|
||||||
|
this.$util.showLoading()
|
||||||
|
}
|
||||||
|
let {
|
||||||
|
lat = 0,
|
||||||
|
lng = 0
|
||||||
|
} = this.location
|
||||||
|
let [detail, coupon] = await Promise.all([this.$api.home.index({
|
||||||
|
lat,
|
||||||
|
lng
|
||||||
|
}), this.$api.shop.couponList()])
|
||||||
|
detail.coupon_total = coupon.total
|
||||||
|
let {
|
||||||
|
status = 0,
|
||||||
|
data
|
||||||
|
} = detail.weather
|
||||||
|
if (status == 200) {
|
||||||
|
let {
|
||||||
|
forecast_24h
|
||||||
|
} = data
|
||||||
|
let cur_day = forecast_24h.filter(item => {
|
||||||
|
return item.time == this.cur_time
|
||||||
|
})
|
||||||
|
data.forecast_24h = cur_day.length > 0 ? cur_day[0] : []
|
||||||
|
detail.weather = data
|
||||||
|
}
|
||||||
|
this.detail = detail
|
||||||
|
this.isLoad = true
|
||||||
|
this.loading = false
|
||||||
|
this.$util.hideAll()
|
||||||
|
},
|
||||||
|
initRefresh() {
|
||||||
|
this.initIndex(true)
|
||||||
|
},
|
||||||
|
async getLocation() {
|
||||||
|
let {
|
||||||
|
location
|
||||||
|
} = this
|
||||||
|
if (!location.lat) {
|
||||||
|
try {
|
||||||
|
// #ifdef H5
|
||||||
|
// H5环境下,先检查缓存的位置信息
|
||||||
|
let cachedLocation = uni.getStorageSync('cached_location');
|
||||||
|
let cacheTime = uni.getStorageSync('location_cache_time');
|
||||||
|
let now = new Date().getTime();
|
||||||
|
|
||||||
|
// 如果有缓存且缓存时间不超过30分钟,直接使用缓存的位置
|
||||||
|
if (cachedLocation && cacheTime && (now - cacheTime) < 30 * 60 * 1000) {
|
||||||
|
location = cachedLocation;
|
||||||
|
} else {
|
||||||
|
// 没有缓存或缓存过期,才获取新位置
|
||||||
|
location = await this.$util.getBmapLocation();
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef H5
|
||||||
|
// 非H5环境,直接获取位置
|
||||||
|
location = await this.$util.getBmapLocation();
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
this.updateUserItem({
|
||||||
|
key: 'location',
|
||||||
|
val: location
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.log('获取位置失败:', error);
|
||||||
|
// 获取位置失败时,不更新location,使用默认值
|
||||||
|
this.$util.showToast({
|
||||||
|
title: '获取位置失败,使用默认位置'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选择地区
|
||||||
|
async toChooseLocation(e) {
|
||||||
|
await this.$util.checkAuth({
|
||||||
|
type: 'userLocation'
|
||||||
|
})
|
||||||
|
|
||||||
|
let [, {
|
||||||
|
address = '',
|
||||||
|
longitude: lng = 0,
|
||||||
|
latitude: lat = 0
|
||||||
|
} = {}] = await uni.chooseLocation();
|
||||||
|
if (!lng) return
|
||||||
|
let location = {
|
||||||
|
lng,
|
||||||
|
lat,
|
||||||
|
address
|
||||||
|
}
|
||||||
|
this.updateUserItem({
|
||||||
|
key: 'location',
|
||||||
|
val: location
|
||||||
|
})
|
||||||
|
this.initRefresh()
|
||||||
|
},
|
||||||
|
toMenu(index) {
|
||||||
|
let {
|
||||||
|
title,
|
||||||
|
url,
|
||||||
|
} = this.menuList[index]
|
||||||
|
let arr = ['土地租赁', '农业认养']
|
||||||
|
let openType = arr.includes(title) ? 'switchTab' : title == '农场商城' ?
|
||||||
|
'reLaunch' : 'navigateTo'
|
||||||
|
this.$util.toCheckLogin({
|
||||||
|
url,
|
||||||
|
openType
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 轮播图/广告图跳转
|
||||||
|
goBanner(e) {
|
||||||
|
// connect_type 1店铺,2文章,3图片,4店铺
|
||||||
|
let {
|
||||||
|
connect_type,
|
||||||
|
text_id: id = 0,
|
||||||
|
img: current
|
||||||
|
} = e.item
|
||||||
|
switch (connect_type) {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 4:
|
||||||
|
let page = {
|
||||||
|
1: `/home/pages/farm/detail?id=${id}`,
|
||||||
|
2: `/home/pages/article?id=${id}&type=1`,
|
||||||
|
4: `/shop/pages/store?id=${id}`
|
||||||
|
}
|
||||||
|
let url = page[connect_type]
|
||||||
|
this.$util.toCheckLogin({
|
||||||
|
url
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$util.previewImage({
|
||||||
|
current,
|
||||||
|
urls: [current]
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
goAbout() {
|
||||||
|
if (!this.detail.about_us) return
|
||||||
|
this.$util.toCheckLogin({
|
||||||
|
url: `/home/pages/about`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 商品/店铺/公益栏目详情
|
||||||
|
async goDetail(type, key, index) {
|
||||||
|
let {
|
||||||
|
id
|
||||||
|
} = this.detail[key][index]
|
||||||
|
let url = ''
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
url = `/shop/pages/detail?id=${id}`
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
url = `/shop/pages/store?id=${id}`
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
url = `/home/pages/article?id=${id}&type=2`
|
||||||
|
break
|
||||||
|
}
|
||||||
|
this.$util.toCheckLogin({
|
||||||
|
url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.pages-home {
|
||||||
|
.icon-right {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item {
|
||||||
|
width: 20%;
|
||||||
|
|
||||||
|
.menu-img {
|
||||||
|
width: 96rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-info {
|
||||||
|
height: 110rpx;
|
||||||
|
|
||||||
|
.notice-img {
|
||||||
|
width: 128rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
.infomation-left {
|
||||||
|
height: 48rpx;
|
||||||
|
border-right: 0.03125rem solid #e1e6ec;
|
||||||
|
}
|
||||||
|
.roller-box {
|
||||||
|
height: 40rpx;
|
||||||
|
|
||||||
|
.roller-item {
|
||||||
|
height: 40rpx;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-info {
|
||||||
|
height: 168rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
|
||||||
|
.number {
|
||||||
|
font-size: 48rpx;
|
||||||
|
color: #FEB23A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather {
|
||||||
|
color: #FEB23A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-img {
|
||||||
|
width: 50rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.about-info {
|
||||||
|
right: 0rpx;
|
||||||
|
width: 84rpx;
|
||||||
|
height: 84rpx;
|
||||||
|
border-radius: 5000rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
|
||||||
|
.about-img {
|
||||||
|
width: 102rpx;
|
||||||
|
height: 25rpx;
|
||||||
|
margin: 0 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.about-right-img {
|
||||||
|
width: 34rpx;
|
||||||
|
height: 25rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.advertisement-info {
|
||||||
|
|
||||||
|
.coupon-img {
|
||||||
|
width: 100%;
|
||||||
|
height: 180rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-item {
|
||||||
|
.cover {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 170rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-car-img {
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hot-shop-list {
|
||||||
|
white-space: nowrap;
|
||||||
|
width: calc(100% - 30rpx);
|
||||||
|
|
||||||
|
.hot-shop-item {
|
||||||
|
width: 281rpx;
|
||||||
|
height: 353rpx;
|
||||||
|
background: #F9FAF9;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 281rpx;
|
||||||
|
height: 175rpx;
|
||||||
|
border-radius: 15rpx 15rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.business-tag {
|
||||||
|
width: 86rpx;
|
||||||
|
height: 34rpx;
|
||||||
|
background: rgba(52, 162, 99, 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-index-bg {
|
||||||
|
background: rgb(57, 181, 74);
|
||||||
|
height: 15.625rem;
|
||||||
|
width: 100%;
|
||||||
|
top: 0;
|
||||||
|
border-radius: 0 0 5% 5%;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.welfare-item {
|
||||||
|
.cover {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ellipsis {
|
||||||
|
max-width: 480rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
uniapp/uni-app/static/image/imgicon/banner.png
Normal file
|
After Width: | Height: | Size: 252 KiB |
BIN
uniapp/uni-app/static/image/imgicon/banner_bg.png
Normal file
|
After Width: | Height: | Size: 598 KiB |
BIN
uniapp/uni-app/static/image/imgicon/kefu_icon.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
uniapp/uni-app/static/image/imgicon/menu1.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
uniapp/uni-app/static/image/imgicon/menu2.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
uniapp/uni-app/static/image/imgicon/menu3.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
uniapp/uni-app/static/image/imgicon/menu4.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
uniapp/uni-app/static/image/imgicon/qrcode.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
uniapp/uni-app/static/image/imgicon/soso.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
uniapp/uni-app/static/image/imgicon/tab_icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
uniapp/uni-app/static/image/imgicon/video.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
uniapp/uni-app/static/image/imgicon/weather1.png
Normal file
|
After Width: | Height: | Size: 636 B |
BIN
uniapp/uni-app/static/image/imgicon/weather2.png
Normal file
|
After Width: | Height: | Size: 423 B |
BIN
uniapp/uni-app/static/image/imgicon/weather3.png
Normal file
|
After Width: | Height: | Size: 519 B |
BIN
uniapp/uni-app/static/image/imgicon/weather_icon1.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
uniapp/uni-app/static/image/imgicon/zan.png
Normal file
|
After Width: | Height: | Size: 381 B |
@@ -8,7 +8,7 @@ export default {
|
|||||||
navBarHeight: uni.getSystemInfoSync().statusBarHeight * 1 + 44,
|
navBarHeight: uni.getSystemInfoSync().statusBarHeight * 1 + 44,
|
||||||
isIos: uni.getSystemInfoSync().system.includes('iOS'),
|
isIos: uni.getSystemInfoSync().system.includes('iOS'),
|
||||||
canIUseGetUserProfile: uni.getUserProfile ? true : false,
|
canIUseGetUserProfile: uni.getUserProfile ? true : false,
|
||||||
primaryColor: '#39b54a',
|
primaryColor: '#358FFD',
|
||||||
subColor: '#F3A664',
|
subColor: '#F3A664',
|
||||||
refund_img: 'https://lbqny.migugu.com/paotui/errand.png',
|
refund_img: 'https://lbqny.migugu.com/paotui/errand.png',
|
||||||
curSysHeight: '',
|
curSysHeight: '',
|
||||||
|
|||||||
@@ -91,6 +91,10 @@
|
|||||||
content: "\e617";
|
content: "\e617";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-left:before {
|
||||||
|
content: "\e617";
|
||||||
|
}
|
||||||
|
|
||||||
.icon-add-circle-fill:before {
|
.icon-add-circle-fill:before {
|
||||||
content: "\e61d";
|
content: "\e61d";
|
||||||
}
|
}
|
||||||
|
|||||||