初始化代码
This commit is contained in:
287
uniapp/uni-app/claim/pages/collage/list.vue
Normal file
287
uniapp/uni-app/claim/pages/collage/list.vue
Normal file
@@ -0,0 +1,287 @@
|
||||
<template>
|
||||
<view class="claim-collage">
|
||||
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
|
||||
:backgroundColor="color == '#ffffff' ?``:primaryColor" leftIcon="icon-left"
|
||||
:title="color == '#ffffff' ?``:`众筹认养`">
|
||||
</uni-nav-bar>
|
||||
<image mode="aspectFill" lazy-load class="common-bg nav abs"
|
||||
src="https://lbqny.migugu.com/admin/farm/nav-collage.png"></image>
|
||||
<image mode="aspectFill" lazy-load class="common-bg collage abs"
|
||||
src="https://lbqny.migugu.com/admin/farm/bg-collage.png"></image>
|
||||
<view class="space-collage rel"></view>
|
||||
<view class="collage-info rel fill-base mt-md ml-md mr-md radius-24 box-shadow">
|
||||
<image lazy-load class="title-img abs" src="https://lbqny.migugu.com/admin/farm/collage-title.png">
|
||||
</image>
|
||||
<view class="title flex-center f-title c-base">简单4步 获得宠物</view>
|
||||
<view class="flex-x-between mt-md pd-lg">
|
||||
<block v-for="(item,index) in collageList" :key="index">
|
||||
<view class="flex-center flex-column">
|
||||
<image class="collage-icon" :src="`/static/image/farm/${item.img}.png`"></image>
|
||||
<view class="f-caption mt-sm">
|
||||
<text space="ensp" decode="emsp"
|
||||
style="word-break:break-all;color:#899E95">{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<i class="flex-y-center iconfont icon-xiangyou" v-if="index!=3"></i>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-lg"></view>
|
||||
<view class="flex-between pd-md c-title">
|
||||
<view class="f-sm-title text-bold">我参与的众筹</view>
|
||||
<view @tap="$util.goUrl({url:`/claim/pages/order/collage/list`})" class="flex-y-center f-caption">查看全部<i
|
||||
class="iconfont icon-right" style="font-size: 24rpx;"></i></view>
|
||||
</view>
|
||||
<scroll-view scroll-x class="my-collage-list pl-md" :scroll-with-animation="true" v-if="user_list.length>0">
|
||||
<block v-for="(item,index) in user_list" :key="index">
|
||||
<view @tap.stop="goDetail(1,index)" class="my-item mr-md radius-16">
|
||||
<view class="flex-center rel">
|
||||
<view class="collage-status abs flex-center f-caption c-base"
|
||||
:style="{background:primaryColor}">
|
||||
<view class="flex-y-center f-icontext">
|
||||
<view class="mr-sm">距成团</view>
|
||||
<min-countdown :type="4" :targetTime="item.end_time * 1000" color="#fff"
|
||||
@callback="countEnd">
|
||||
</min-countdown>
|
||||
</view>
|
||||
</view>
|
||||
<image mode="aspectFill" lazy-load class="cover" :src="item.claim_cover"></image>
|
||||
<view class="flex-1 pl-md">
|
||||
<view class="pr-sm f-title c-title text-bold max-300 ellipsis">
|
||||
{{item.claim_title}}
|
||||
</view>
|
||||
<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">{{item.price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-y-center f-icontext c-title mt-sm">已参与<view :style="{color:primaryColor}">
|
||||
{{item.have_num||0}}
|
||||
</view>
|
||||
人, 还差
|
||||
<view :style="{color:primaryColor}">{{item.surplus_num||0}}</view>人众筹成功
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
<view class="pd-md f-sm-title c-title text-bold">众筹商品</view>
|
||||
<view class="pl-md pr-md" :class="[{'mt-lg':index!=0}]" v-for="(item,index) in list.data" :key="index">
|
||||
<view @tap.stop="goDetail(2,index)" class="collage-item flex-center">
|
||||
<image mode="aspectFill" lazy-load class="cover radius-10" :src="item.claim_cover"></image>
|
||||
<view class="flex-1 ml-md">
|
||||
<view class="f-title c-title text-bold max-510 ellipsis">{{item.claim_title}}</view>
|
||||
<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">{{item.price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="f-icontext c-caption text-delete mt-md">原价 ¥{{item.init_price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between mt-md mb-md">
|
||||
<view class="flex-y-center f-desc" :style="{color:primaryColor}">
|
||||
剩余
|
||||
<min-countdown :type="2" :targetTime="item.end_time * 1000" :color="primaryColor"
|
||||
:textColor="primaryColor" :borderColor="primaryColor" @callback="countEnd">
|
||||
</min-countdown>
|
||||
</view>
|
||||
<view class="common-btn flex-center f-paragraph c-base radius" :style="{background:primaryColor}">去众筹
|
||||
</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,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
color: '#ffffff',
|
||||
collageList: [{
|
||||
img: 'pay',
|
||||
text: ' 支付\n开团/参团'
|
||||
}, {
|
||||
img: 'users',
|
||||
text: '达到人数\n众筹成功'
|
||||
}, {
|
||||
img: 'claim',
|
||||
text: ' 获得\n认养商品'
|
||||
}, {
|
||||
img: 'send',
|
||||
text: '认养到期\n配送到家'
|
||||
}],
|
||||
user_list: [],
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
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,
|
||||
}),
|
||||
onLoad() {
|
||||
this.$util.showLoading()
|
||||
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()
|
||||
},
|
||||
onPageScroll(e) {
|
||||
let color = e.scrollTop < 20 ? '#ffffff' : '#000000'
|
||||
if (this.color == color) return
|
||||
this.color = color
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getConfigInfo', 'getUserInfo']),
|
||||
async initIndex() {
|
||||
this.user_list = await this.$api.claim.userCollageLimit()
|
||||
await this.getList()
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
countEnd() {
|
||||
this.$util.log("倒计时完了")
|
||||
setTimeout(() => {
|
||||
this.initRefresh()
|
||||
}, 1000)
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
} = this
|
||||
let newList = await this.$api.claim.collageList(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()
|
||||
},
|
||||
goDetail(type, index) {
|
||||
let {
|
||||
start_id,
|
||||
claim_id = 0
|
||||
} = type == 1 ? this.user_list[index] : this.list.data[index]
|
||||
let page = {
|
||||
1: `/claim/pages/order/collage/detail?id=${start_id}`,
|
||||
2: `/claim/pages/detail?id=${claim_id}`
|
||||
}
|
||||
this.$util.goUrl({
|
||||
url: page[type]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.claim-collage {
|
||||
.space-collage {
|
||||
width: 100%;
|
||||
height: 494rpx;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.collage-info {
|
||||
height: 312rpx;
|
||||
z-index: 1;
|
||||
|
||||
.title-img {
|
||||
width: 390rpx;
|
||||
height: 100rpx;
|
||||
top: -19rpx;
|
||||
left: 160rpx;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.title {
|
||||
height: 58rpx;
|
||||
}
|
||||
|
||||
.collage-icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
|
||||
.icon-xiangyou {
|
||||
color: rgba(0, 146, 84, 0.3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.my-collage-list {
|
||||
white-space: nowrap;
|
||||
width: calc(100% - 20rpx);
|
||||
|
||||
.my-item {
|
||||
width: 550rpx;
|
||||
height: 180rpx;
|
||||
background: #F6F7F8;
|
||||
display: inline-block;
|
||||
|
||||
.collage-status {
|
||||
width: 188rpx;
|
||||
height: 38rpx;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-radius: 16rpx 0 0 0;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 188rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 16rpx 0 0 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.collage-item {
|
||||
.cover {
|
||||
width: 180rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
152
uniapp/uni-app/claim/pages/collage/more.vue
Normal file
152
uniapp/uni-app/claim/pages/collage/more.vue
Normal file
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<view class="claim-collage-more" v-if="isLoad">
|
||||
<view @tap="toJoin(index)" class="collage-item fill-base flex-center pd-lg" :class="[{'b-1px-t':index!=0}]"
|
||||
v-for="(item,index) in list.data" :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>
|
||||
<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
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
options: {},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
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()
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo
|
||||
}),
|
||||
methods: {
|
||||
...mapActions(['']),
|
||||
async initIndex() {
|
||||
await this.getList()
|
||||
this.isLoad = true
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
countEnd() {
|
||||
this.$util.log("倒计时完了")
|
||||
setTimeout(() => {
|
||||
this.initRefresh()
|
||||
}, 1000)
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
} = this
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
param.claim_id = id
|
||||
let newList = await this.$api.claim.claimCollageList(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()
|
||||
},
|
||||
toJoin(index) {
|
||||
let {
|
||||
id: cid,
|
||||
claim_id,
|
||||
user_id,
|
||||
can_join,
|
||||
} = this.list.data[index]
|
||||
let {
|
||||
join_times
|
||||
} = this.$util.getPage(-1).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
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.claim-collage-more {
|
||||
.collage-item {
|
||||
.avatar {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
776
uniapp/uni-app/claim/pages/detail.vue
Normal file
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
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>
|
||||
170
uniapp/uni-app/claim/pages/order/breed/detail.vue
Normal file
170
uniapp/uni-app/claim/pages/order/breed/detail.vue
Normal file
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<view class="claim-order-detail" v-if="detail.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="order-item fill-base mg-big pd-lg radius-16 box-shadow" :class="[{'mt-md':index!=0}]">
|
||||
<view class="flex-center" :class="[{'mt-md':aindex!=0}]" v-for="(aitem,aindex) in detail.order_goods"
|
||||
:key="aindex">
|
||||
<image mode="aspectFill" lazy-load class="avatar radius-16" :src="aitem.goods_cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-paragraph c-title text-bold ellipsis" style="max-width: 498rpx;">
|
||||
{{aitem.goods_name}}
|
||||
</view>
|
||||
<view class="flex-between f-desc c-caption mt-md">
|
||||
<view class="f-paragraph c-warning"> ¥{{aitem.goods_price}} </view>
|
||||
<view>x{{aitem.goods_num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fill-base mg-md pd-lg radius-24" v-if="detail.text">
|
||||
<view class="f-paragraph c-title">
|
||||
<view class="c-desc">订单备注</view>
|
||||
<view class="mt-sm">
|
||||
<text decode="emsp" style="word-break:break-all;">{{detail.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fill-base mg-md pd-lg radius-24">
|
||||
<view class="flex-between f-paragraph c-title">
|
||||
<view class="c-desc">订单编号</view>
|
||||
<view class="flex-warp">
|
||||
<view class="max-400 ellipsis">{{detail.order_code}}</view>
|
||||
<view @tap="$util.goUrl( {url:`${detail.order_code}`,openType:'copy'})"
|
||||
class="copy-btn flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph c-title mt-lg">
|
||||
<view class="c-desc">付款单号</view>
|
||||
<view class="flex-warp">
|
||||
<view class="max-400 ellipsis">{{detail.transaction_id}}</view>
|
||||
<view @tap="$util.goUrl( {url:`${detail.transaction_id}`,openType:'copy'})"
|
||||
class="copy-btn flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph c-title mt-lg">
|
||||
<view class="c-desc">下单时间</view>
|
||||
<view>{{detail.create_time}}</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph c-title mt-lg" v-if="detail.pay_time">
|
||||
<view class="c-desc">支付时间</view>
|
||||
<view>{{detail.pay_time}}</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph c-title mt-lg">
|
||||
<view class="c-desc">实付金额</view>
|
||||
<view class="c-warning">¥{{detail.pay_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph c-title mt-lg">
|
||||
<view class="c-desc">支付方式</view>
|
||||
<view>{{payType[detail.pay_model]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
options: {},
|
||||
detail: {},
|
||||
payType: {
|
||||
1: '微信支付',
|
||||
2: '余额支付',
|
||||
3: '支付宝支付'
|
||||
},
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
this.initIndex()
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo
|
||||
}),
|
||||
methods: {
|
||||
...mapActions(['']),
|
||||
async initIndex() {
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
let data = await this.$api.claim.breedOrderInfo({
|
||||
id
|
||||
})
|
||||
this.detail = data
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.claim-order-detail {
|
||||
|
||||
.order-video-info {
|
||||
width: 750rpx;
|
||||
height: 380rpx;
|
||||
margin-top: 26rpx;
|
||||
|
||||
.video-img {
|
||||
width: 750rpx;
|
||||
height: 380rpx;
|
||||
}
|
||||
|
||||
.video-bg {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 750rpx;
|
||||
height: 380rpx;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.iconfont {
|
||||
font-size: 70rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-count-info {
|
||||
.count-item {
|
||||
width: 33.33%;
|
||||
}
|
||||
}
|
||||
|
||||
.order-seed-item {
|
||||
.seed-img {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
width: 180rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
263
uniapp/uni-app/claim/pages/order/breed/list.vue
Normal file
263
uniapp/uni-app/claim/pages/order/breed/list.vue
Normal file
@@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<view class="claim-order-detail">
|
||||
<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 breed abs" src="https://lbqny.migugu.com/admin/farm/bg-breed.png"></image>
|
||||
|
||||
<view @tap.stop="goDetail(index)" class="order-item flex-center fill-base mg-big pd-lg radius-16 box-shadow"
|
||||
:class="[{'mt-md':index!=0}]" v-for="(item,index) in list.data" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="avatar big radius-24" :src="item.cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title text-bold ellipsis" style="max-width: 468rpx;"> {{item.title}}
|
||||
</view>
|
||||
<view class="f-caption c-caption mt-md mb-md ellipsis" style="max-width: 468rpx;"> {{item.sub_title}}
|
||||
</view>
|
||||
<view class="flex-between">
|
||||
<view class="f-title c-warning"> ¥{{item.price}} </view>
|
||||
<view class="add-remove-item flex-warp">
|
||||
<block v-if="item.car_num>0">
|
||||
<i @tap.stop="toAddCar(index, -1)" class="iconfont icon-remove-square"></i>
|
||||
<view class="number-text flex-center">{{item.car_num}}</view>
|
||||
</block>
|
||||
<i @tap.stop="toAddCar(index,1)" class="iconfont icon-add-square"
|
||||
:style="{color:primaryColor}"></i>
|
||||
</view>
|
||||
</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 class="space-max-footer"></view>
|
||||
<view class="footer-btn fix pl-lg pr-lg fill-base" v-if="list.count > 0">
|
||||
<image mode="aspectFill" lazy-load class="cart-img abs" src="/static/image/farm/breed-cart.png"></image>
|
||||
<view class="cart-msg flex-center c-base f-icontext abs" :style="{width: list.count<10 ? '30rpx' : '50rpx'}"
|
||||
v-if="list.count">
|
||||
{{list.count < 100 ? list.count : '99+'}}
|
||||
</view>
|
||||
<view class="footer-item flex-between">
|
||||
<view class="flex-y-baseline">总计:<view class="c-warning ml-sm">¥{{list.total_price}}</view>
|
||||
</view>
|
||||
<view @tap.stop="toOrder" class="order-btn flex-center f-title c-base text-bold radius-20"
|
||||
:style="{background:primaryColor}">立即下单
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-safe"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
detail: {},
|
||||
number: 1,
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: [],
|
||||
count: 0,
|
||||
total_price: 0
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
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()
|
||||
},
|
||||
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()
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop
|
||||
},
|
||||
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,
|
||||
}),
|
||||
methods: {
|
||||
...mapMutations(['updateOrderItem']),
|
||||
async initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param
|
||||
} = this
|
||||
let {
|
||||
farmer_id
|
||||
} = this.options
|
||||
param.farmer_id = farmer_id
|
||||
let newList = await this.$api.claim.breedList(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()
|
||||
},
|
||||
// 添加购物车
|
||||
async toAddCar(index, goods_num) {
|
||||
let {
|
||||
id: goods_id,
|
||||
car_id = 0
|
||||
} = this.list.data[index]
|
||||
await this.toUpdateCar(goods_id, goods_num, car_id, index)
|
||||
},
|
||||
// 修改购物车数量
|
||||
async toUpdateCar(goods_id, goods_num, car_id, index) {
|
||||
if (this.lockTap) return;
|
||||
this.lockTap = true;
|
||||
let methodModel = goods_num > 0 ? 'addCar' : 'delCar'
|
||||
let {
|
||||
farmer_id
|
||||
} = this.options
|
||||
let param = goods_num > 0 ? {
|
||||
farmer_id,
|
||||
goods_id,
|
||||
goods_num,
|
||||
type: 1
|
||||
} : {
|
||||
id: car_id,
|
||||
goods_num: 1
|
||||
}
|
||||
try {
|
||||
let curCarId = await this.$api.claim[methodModel](param)
|
||||
this.lockTap = false
|
||||
let {
|
||||
car_num,
|
||||
} = this.list.data[index]
|
||||
let num = car_num + goods_num
|
||||
let cur_car_id = car_id ? num == 0 ? '' : car_id : curCarId
|
||||
this.list.data[index].car_id = cur_car_id
|
||||
this.list.data[index].car_num = num
|
||||
this.getCount()
|
||||
} catch (e) {
|
||||
this.lockTap = false
|
||||
}
|
||||
},
|
||||
async getCount() {
|
||||
let {
|
||||
farmer_id
|
||||
} = this.options
|
||||
let {
|
||||
count,
|
||||
total_price
|
||||
} = await this.$api.claim.breedList({
|
||||
farmer_id
|
||||
});
|
||||
this.list.count = count
|
||||
this.list.total_price = total_price
|
||||
},
|
||||
toOrder() {
|
||||
let {
|
||||
id: claim_order_id,
|
||||
farmer_id
|
||||
} = this.options
|
||||
let {
|
||||
total_price: pay_price
|
||||
} = this.list
|
||||
let param = {
|
||||
claim_order_id,
|
||||
pay_price,
|
||||
page_type: 'breed'
|
||||
}
|
||||
this.updateOrderItem({
|
||||
key: 'orderInfo',
|
||||
val: param
|
||||
})
|
||||
let url = `/mine/pages/pay`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.claim-order-detail {
|
||||
|
||||
.footer-btn {
|
||||
bottom: 0;
|
||||
|
||||
.cart-img {
|
||||
width: 108rpx;
|
||||
height: 108rpx;
|
||||
top: -8rpx;
|
||||
}
|
||||
|
||||
.cart-msg {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
line-height: 30rpx;
|
||||
border-radius: 15rpx 15rpx 15rpx 0;
|
||||
background: #f12c20;
|
||||
top: -8rpx;
|
||||
left: 108rpx;
|
||||
}
|
||||
|
||||
.footer-item {
|
||||
height: 114rpx;
|
||||
margin-left: 180rpx;
|
||||
|
||||
.order-btn {
|
||||
width: 226rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
253
uniapp/uni-app/claim/pages/order/collage/detail.vue
Normal file
253
uniapp/uni-app/claim/pages/order/collage/detail.vue
Normal file
@@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<view class="claim-order-collage-detail" v-if="detail.id">
|
||||
<view class="mg-md">
|
||||
<view class="collage-item flex-center pd-lg fill-base radius-16">
|
||||
<image mode="aspectFill" lazy-load class="cover radius-10" :src="detail.claim_cover"></image>
|
||||
<view class="flex-1 ml-md">
|
||||
<view class="f-title c-title text-bold ellipsis">{{detail.claim_title}}</view>
|
||||
<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">{{detail.price}}</view>
|
||||
</view>
|
||||
<view class="f-icontext c-caption text-delete ml-sm">原价 ¥{{detail.claim_price}}</view>
|
||||
</view>
|
||||
<view class="flex-center mt-md">
|
||||
<view class="collage-tag flex-center f-caption c-base" :style="{background:primaryColor}">
|
||||
{{detail.success_num}}人团
|
||||
</view>
|
||||
<view class="flex-1"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-md pd-lg flex-center flex-column fill-base radius-16">
|
||||
<view class="space-md"></view>
|
||||
<view class="flex-center">
|
||||
<image lazy-load class="tag-img mr-lg" src="/static/image/farm/tag.png"></image>
|
||||
<view class="f-md-title text-bold" :style="{color:primaryColor}">
|
||||
{{detail.status==1?`还差${detail.surplus_num}人, 成团立享超值优惠`:statusType[detail.status].title}}
|
||||
</view>
|
||||
<image lazy-load class="tag-img ml-lg" src="/static/image/farm/tag.png"></image>
|
||||
</view>
|
||||
<block v-if="detail.status==1">
|
||||
<view class="user-list flex-center mt-lg mb-md">
|
||||
<block v-for="(item,index) in detail.user_list" :key="index">
|
||||
<image class="avatar radius" :src="item"
|
||||
v-if="index< detail.success_num > 4 ? 4 : detail.success_num - 1"></image>
|
||||
</block>
|
||||
<block v-if="detail.surplus_num">
|
||||
<view class="avatar flex-center radius" v-for="(item,index) in detail.more_num"
|
||||
:key="index"><i class="iconfont icon-add"></i>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="flex-y-center mt-lg mb-lg" :style="{color:primaryColor}">
|
||||
<min-countdown :type="2" :targetTime="detail.end_time * 1000" color="#333" textColor="#999"
|
||||
bgColor="#F7F7F7" className="sm" @callback="countEnd">
|
||||
</min-countdown>
|
||||
</view>
|
||||
<view class="f-desc c-caption">还差{{detail.surplus_num}}人成团,距离结束还剩</view>
|
||||
<view class="space-lg"></view>
|
||||
</block>
|
||||
<view class="collage-status-icon iconfont icon-biaoqian flex-center"
|
||||
:style="{color:detail.status==2?primaryColor:'#E82F21'}" v-else>
|
||||
<view class="f-md-title text-bold abs">{{statusType[detail.status].text}}</view>
|
||||
</view>
|
||||
<block v-if="detail.status == 1 && !detail.can_join">
|
||||
<!-- #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 -->
|
||||
</block>
|
||||
|
||||
<view @click="toOrder" class="share-btn flex-center f-sm-title" :style="{background:primaryColor}"
|
||||
v-if="(detail.status == 1 && detail.can_join) || (detail.status>1 && detail.can_start)">
|
||||
{{detail.status==1 ? '立即参与' : '再开一团'}}
|
||||
</view>
|
||||
<view class="space-lg"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
detail: {},
|
||||
statusType: {
|
||||
2: {
|
||||
title: '众筹活动已人满成功',
|
||||
text: '众筹成功'
|
||||
},
|
||||
3: {
|
||||
title: '众筹超时失败',
|
||||
text: '众筹失败'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo
|
||||
}),
|
||||
methods: {
|
||||
...mapActions(['']),
|
||||
async initIndex() {
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
let data = await this.$api.claim.claimCollageInfo({
|
||||
id
|
||||
})
|
||||
let {
|
||||
success_num,
|
||||
user_list
|
||||
} = data
|
||||
let len = user_list.length
|
||||
data.more_num = len > 3 ? 1 : success_num > 4 ? 5 - len : success_num - len
|
||||
this.detail = data
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
countEnd() {
|
||||
this.$util.log("倒计时完了")
|
||||
setTimeout(() => {
|
||||
this.initRefresh()
|
||||
}, 1000)
|
||||
},
|
||||
toAppShare() {
|
||||
// #ifdef APP-PLUS
|
||||
let {
|
||||
siteroot
|
||||
} = siteInfo
|
||||
let url = siteroot.split('/index.php')[0]
|
||||
let href = `${url}/h5/#/user/pages/coupon/share?coupon_atv_id=${id}&pid=${pid}`
|
||||
let scene = type == 1 ? 'WXSceneSession' : 'WXSceneTimeline'
|
||||
uni.share({
|
||||
provider: "weixin",
|
||||
scene,
|
||||
type: 0,
|
||||
href,
|
||||
title,
|
||||
summary,
|
||||
imageUrl,
|
||||
success: function(res) {
|
||||
console.log("success:" + JSON.stringify(res));
|
||||
},
|
||||
fail: function(err) {
|
||||
console.log("fail:" + JSON.stringify(err));
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
toOrder() {
|
||||
let {
|
||||
id,
|
||||
atv_id,
|
||||
claim_id,
|
||||
status
|
||||
} = this.detail
|
||||
let type = status == 1 ? 2 : 1
|
||||
let cid = type == 1 ? atv_id : id
|
||||
let url = `/claim/pages/order?id=${claim_id}&cid=${cid}&type=${type}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.claim-order-collage-detail {
|
||||
|
||||
.collage-item {
|
||||
|
||||
.cover {
|
||||
width: 180rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
max-width: 450rpx;
|
||||
}
|
||||
|
||||
.collage-tag {
|
||||
height: 36rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-img {
|
||||
width: 26rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.collage-status-icon {
|
||||
width: 210rpx;
|
||||
height: 200rpx;
|
||||
font-size: 200rpx;
|
||||
margin: 50rpx auto;
|
||||
|
||||
.text-bold {
|
||||
height: 40rpx;
|
||||
transform: rotate(-32deg);
|
||||
}
|
||||
}
|
||||
|
||||
.user-list {
|
||||
|
||||
.avatar {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
margin: 0 17rpx;
|
||||
|
||||
.icon-add {
|
||||
color: #D8D8D7
|
||||
}
|
||||
}
|
||||
|
||||
.avatar.flex-center {
|
||||
background: #F8F8F8;
|
||||
border: 1px solid #DBDBDB;
|
||||
}
|
||||
}
|
||||
|
||||
.share-btn {
|
||||
width: 590rpx;
|
||||
height: 90rpx;
|
||||
color: #fff;
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
187
uniapp/uni-app/claim/pages/order/collage/list.vue
Normal file
187
uniapp/uni-app/claim/pages/order/collage/list.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<view class="claim-order-collage-list">
|
||||
<fixed>
|
||||
<view class="fill-base pd-lg f-paragraph c-title b-1px-b">我参与了{{list.total_num||0}}个众筹</view>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
:width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-b"></view>
|
||||
</fixed>
|
||||
<view @tap.stop="goDetail(index)" class="order-item rel fill-base mg-big pd-lg radius-16"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pb-lg f-desc b-1px-b" :style="{color:primaryColor}"
|
||||
v-if="activeIndex==0 && item.status==1">
|
||||
<view> 距离开团结束仅剩 </view>
|
||||
<min-countdown :type="2" :targetTime="item.end_time * 1000" :color="primaryColor"
|
||||
:textColor="primaryColor" :borderColor="primaryColor" @callback="countEnd">
|
||||
</min-countdown>
|
||||
</view>
|
||||
<view class="pb-lg f-sm-title c-title text-bold" :class="[{'pt-lg':activeIndex==0 && item.status ==1}]">
|
||||
{{item.claim_title}}
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view class="flex-warp flex-1">
|
||||
<block v-for="(aitem,aindex) in item.user_avatar" :key="index">
|
||||
<view class="avatar-group md" v-if="aindex<4">
|
||||
<image mode="aspectFill" lazy-load class="abs avatar fill-body radius" :src="aitem">
|
||||
</image>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="common-btn flex-center f-desc c-base" :style="{background:primaryColor}"
|
||||
v-if="activeIndex==1">查看订单</view>
|
||||
</view>
|
||||
<view class="collage-status-icon abs iconfont icon-biaoqian flex-center"
|
||||
:style="{color:item.status==1?primaryColor:'#E82F21'}" v-if="activeIndex==0">
|
||||
<view class="f-icontext text-bold abs">{{statusType[item.status]}}</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>
|
||||
<common-popup @confirm="confirmCancel" ref="cancel_item" type="CANCEL_ORDER" :info="popupInfo"></common-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 1,
|
||||
title: '未成团'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '已成团'
|
||||
}],
|
||||
statusType: {
|
||||
1: '进行中',
|
||||
2: '众筹成功',
|
||||
3: '众筹超时'
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
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,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
let {
|
||||
tab = 0
|
||||
} = options
|
||||
this.activeIndex = tab
|
||||
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()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
countEnd() {
|
||||
this.$util.log("倒计时完了")
|
||||
setTimeout(() => {
|
||||
this.initRefresh()
|
||||
}, 1000)
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
tabList,
|
||||
activeIndex
|
||||
} = this
|
||||
param.status = tabList[activeIndex].id
|
||||
let newList = await this.$api.claim.userCollageList(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()
|
||||
},
|
||||
// 订单详情
|
||||
goDetail(index) {
|
||||
let {
|
||||
start_id,
|
||||
order_id
|
||||
} = this.list.data[index]
|
||||
let {
|
||||
activeIndex
|
||||
} = this
|
||||
let url = activeIndex == 0 ? `/claim/pages/order/collage/detail?id=${start_id}` :
|
||||
`/claim/pages/order/detail?id=${order_id}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.claim-order-collage-list {
|
||||
|
||||
.order-item {
|
||||
.collage-status-icon {
|
||||
right: 30rpx;
|
||||
bottom: 30rpx;
|
||||
width: 110rpx;
|
||||
height: 100rpx;
|
||||
font-size: 100rpx;
|
||||
|
||||
.text-bold {
|
||||
height: 26rpx;
|
||||
transform: rotate(-32deg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
1067
uniapp/uni-app/claim/pages/order/detail.vue
Normal file
1067
uniapp/uni-app/claim/pages/order/detail.vue
Normal file
File diff suppressed because it is too large
Load Diff
294
uniapp/uni-app/claim/pages/order/list.vue
Normal file
294
uniapp/uni-app/claim/pages/order/list.vue
Normal file
@@ -0,0 +1,294 @@
|
||||
<template>
|
||||
<view class="farmer-order-land-list">
|
||||
<fixed>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
:width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-b"></view>
|
||||
</fixed>
|
||||
<view @tap.stop="goDetail(index)" class="order-item fill-base mg-big pd-lg radius-16 box-shadow"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pb-lg c-title">
|
||||
<view class="f-title flex-y-baseline"><i class="iconfont icon-dianpu mr-sm"></i>
|
||||
<view class="text-bold max-400 ellipsis">{{item.farmer_info.title}}</view>
|
||||
</view>
|
||||
<view class="f-paragraph"
|
||||
:style="{color:item.pay_type == 1? subColor: item.pay_type == 2? primaryColor: ''}">
|
||||
{{statusType[item.pay_type]}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<image mode="aspectFill" lazy-load class="avatar radius-24" :src="item.goods_cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title text-bold ellipsis" style="max-width: 498rpx;"> {{item.goods_name}}
|
||||
</view>
|
||||
<view class="f-caption c-caption mt-sm"> 数量:{{`${item.num}/${item.unit}`}} </view>
|
||||
<view class="f-caption c-caption"> 配送周期:{{item.send_cycle}} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph mt-md pt-md b-1px-t">
|
||||
<view class="c-desc max-380 ellipsis">认养编号 {{item.claim_code}}</view>
|
||||
<view class="flex-y-baseline c-title">总计:<view class="f-title c-warning">¥{{item.pay_price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between mt-md">
|
||||
<view></view>
|
||||
<view class="flex-warp" v-if="item.pay_type == 1">
|
||||
<view @tap.stop="toChangeOrder(index,'cancel_item')"
|
||||
class="common-btn disabled flex-center f-caption c-title radius-4">取消订单
|
||||
</view>
|
||||
<view @tap.stop="toPay(index)" class="common-btn flex-center f-caption c-base radius-4 ml-lg"
|
||||
:style="{background:primaryColor}">去支付
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-warp" v-if="item.pay_type == 2">
|
||||
<view @tap.stop="goDetail(index,2)" class="common-btn flex-center f-caption c-base radius-4 ml-lg"
|
||||
:style="{background:primaryColor}">养殖管理
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-warp" v-if="item.pay_type == 7 && !item.have_eva">
|
||||
<view @tap.stop="toEvaluate(index)" class="common-btn flex-center f-caption c-base radius-4 ml-lg"
|
||||
:style="{background:primaryColor}">去评价
|
||||
</view>
|
||||
</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>
|
||||
<common-popup @confirm="confirmCancel" ref="cancel_item" type="CANCEL_ORDER" :info="popupInfo"></common-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 0,
|
||||
title: '全部'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '认养中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 3,
|
||||
title: '配送中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 7,
|
||||
title: '已完成'
|
||||
}],
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
1: '待支付',
|
||||
2: '认养中',
|
||||
3: '配送中',
|
||||
7: '已完成',
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
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,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
this.options = options
|
||||
let {
|
||||
tab = 0
|
||||
} = options
|
||||
this.activeIndex = tab
|
||||
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()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
tabList,
|
||||
activeIndex
|
||||
} = this
|
||||
param.pay_type = tabList[activeIndex].id
|
||||
let newList = await this.$api.claim.orderList(param);
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
let {
|
||||
claim_count,
|
||||
send_count
|
||||
} = newList.count
|
||||
this.tabList[1].number = claim_count
|
||||
this.tabList[2].number = send_count
|
||||
this.$util.hideAll()
|
||||
},
|
||||
// 取消订单/确认收货
|
||||
async toChangeOrder(index, key) {
|
||||
let {
|
||||
id,
|
||||
order_code,
|
||||
goods_cover: image,
|
||||
} = this.list.data[index]
|
||||
this.popupInfo = {
|
||||
id,
|
||||
name: `订单编号:${order_code}`,
|
||||
image,
|
||||
index,
|
||||
}
|
||||
this.$refs[key].open()
|
||||
},
|
||||
async confirmCancel() {
|
||||
let {
|
||||
id,
|
||||
index,
|
||||
} = this.popupInfo
|
||||
if (this.lockTap) return;
|
||||
this.lockTap = true;
|
||||
this.$util.showLoading()
|
||||
try {
|
||||
await this.$api.claim.cancelOrder({
|
||||
id
|
||||
})
|
||||
this.$util.hideAll()
|
||||
if (this.activeIndex == 0) {
|
||||
this.list.data[index].pay_type = -1
|
||||
} else {
|
||||
this.list.data.splice(index, 1)
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: `取消成功`
|
||||
})
|
||||
this.lockTap = false
|
||||
this.$refs.cancel_item.close()
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
// 去支付
|
||||
async toPay(index) {
|
||||
if (this.lockTap) return;
|
||||
this.lockTap = true;
|
||||
this.$util.showLoading()
|
||||
let {
|
||||
id,
|
||||
pay_model
|
||||
} = this.list.data[index]
|
||||
try {
|
||||
let {
|
||||
pay_list
|
||||
} = await this.$api.claim.claimRePayOrder({
|
||||
id
|
||||
})
|
||||
this.$util.hideAll()
|
||||
if (pay_list) {
|
||||
if (pay_model == 3) {
|
||||
pay_list = {
|
||||
orderInfo: pay_list,
|
||||
provider: 'alipay'
|
||||
}
|
||||
}
|
||||
try {
|
||||
await this.$util.pay(pay_list)
|
||||
this.lockTap = false;
|
||||
if (this.activeIndex == 0) {
|
||||
this.list.data[index].pay_type = 2
|
||||
} else {
|
||||
this.list.data.splice(index, 1)
|
||||
}
|
||||
let {
|
||||
number
|
||||
} = this.tabList[1]
|
||||
this.tabList[1].number = number + 1
|
||||
} catch (e) {
|
||||
this.lockTap = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
// 去评价
|
||||
toEvaluate(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/mine/pages/evaluate/edit?id=${id}&type=claim`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
},
|
||||
// 订单详情
|
||||
goDetail(index, tab = 0) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/claim/pages/order/detail?id=${id}&tab=${tab}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
Reference in New Issue
Block a user