初始化代码

This commit is contained in:
2025-12-22 17:13:05 +08:00
parent ed0de08e3a
commit 1f7e9d401b
2947 changed files with 526137 additions and 0 deletions

View 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>

View 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>