29 changed files with 1933 additions and 106 deletions
@ -0,0 +1,248 @@ |
|||
// list//pages/group/index.js
|
|||
import commonApi from "../../utils/https/common"; |
|||
import util from "../../utils/util" |
|||
let timer = null,app = getApp(); |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
showIngGroup:false, |
|||
pageNo:1, |
|||
isMore:true, |
|||
list:[], |
|||
hot:[], |
|||
ingGroup:{} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
|
|||
commonApi.user_post("activity.groups/product_list",{ |
|||
isHot:1, |
|||
page:1, |
|||
limit:10 |
|||
}).then(res=>{ |
|||
this.setData({ |
|||
hot:res.data.data |
|||
}) |
|||
}) |
|||
this.getList() |
|||
}, |
|||
getList:function(){ |
|||
commonApi.user_post("activity.groups/product_list",{ |
|||
isHot:0, |
|||
page:this.data.pageNo, |
|||
limit:10 |
|||
}).then(res=>{ |
|||
this.setData({ |
|||
list:res.data.data |
|||
}) |
|||
}) |
|||
}, |
|||
gotoDetail:function(e){ |
|||
let item = e.currentTarget.dataset.item,that = this; |
|||
commonApi.user_post("activity.groups/is_join",{ |
|||
id:item.id |
|||
}).then(res=>{ |
|||
let isJoin = false; |
|||
if(res.data.length>0 && res.data[0].status==1){ |
|||
// 已经参与了这个团购
|
|||
res.data[0].gp_num = item.gp_num; |
|||
this.setData({ |
|||
showIngGroup:true, |
|||
ingGroup:res.data |
|||
}) |
|||
this.setTime(); |
|||
} |
|||
else { |
|||
// 未参与该团购
|
|||
// 售罄
|
|||
if(item.left_stock_num<=0){ |
|||
wx.showModal({ |
|||
title:"提示", |
|||
content:"商品售罄是否进行原价购买", |
|||
success:function(res){ |
|||
if(res.confirm){ |
|||
// 去下单
|
|||
util.goKjOrder(item).then(product=>{ |
|||
if(item.type=='post'){ |
|||
app.globalData.postProduct = product; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/postOrder/index', |
|||
}) |
|||
} |
|||
else if(item.type=='ticket' || item.type=='scene'){ |
|||
app.globalData.product = product[0]; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/scene/index', |
|||
}) |
|||
} |
|||
}) |
|||
// that.goOrder(item)
|
|||
} |
|||
} |
|||
}) |
|||
return; |
|||
} |
|||
// 正常参团
|
|||
else { |
|||
wx.navigateTo({ |
|||
url: 'info/index?id='+item.id, |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
setTime:function(){ |
|||
let info = this.data.ingGroup; |
|||
if(!this.data.showIngGroup || info.length==0) { |
|||
if(timer){ |
|||
clearTimeout(timer); |
|||
timer=null; |
|||
} |
|||
this.setData({ |
|||
showIngGroup:false |
|||
}) |
|||
return; |
|||
} |
|||
let time = info[0].over_time; |
|||
let overTime = new Date(time.replace(/-/g,'/')).getTime(),now = new Date().getTime(); |
|||
if(overTime<=now){ |
|||
info[0].isOver=true; |
|||
} |
|||
else { |
|||
let t = (overTime - now)/1000; |
|||
let h = Math.floor(t/(60*60)); |
|||
t = t - h * 60*60; |
|||
let m = Math.floor(t/60),s=Math.floor(t-m*60); |
|||
if(h<10) { |
|||
h="0"+h; |
|||
} |
|||
if(m<10) { |
|||
m="0"+m; |
|||
} |
|||
if(s<10) { |
|||
s="0"+s; |
|||
} |
|||
info[0].h=h; |
|||
info[0].m=m; |
|||
info[0].s=s; |
|||
} |
|||
this.setData({ |
|||
ingGroup:info |
|||
}) |
|||
timer = setTimeout(()=>{ |
|||
this.setTime(); |
|||
},1000) |
|||
}, |
|||
goOrder:function(info){ |
|||
commonApi._get('productfront/getProductInfo',{ |
|||
productId:info.productId |
|||
}).then(res=>{ |
|||
if(!res.data){ |
|||
wx.showToast({ |
|||
title:"该产品不存在或已下架", |
|||
icon:'none' |
|||
}) |
|||
return; |
|||
} |
|||
let skuIndex = res.data.skuInfo.findIndex(item=>item.id==info.skuId); |
|||
if(skuIndex==-1) { |
|||
wx.showToast({ |
|||
title:"该产品规格不存在", |
|||
icon:'none' |
|||
}) |
|||
return; |
|||
} |
|||
let sku = res.data.skuInfo[skuIndex]; |
|||
app.globalData.shoppingCart=[{ |
|||
baseInfo:res.data.baseInfo, |
|||
modelInfo:sku.modelInfo, |
|||
skuInfo:sku, |
|||
productNum:1 |
|||
}]; |
|||
app.globalData.groupId = null; |
|||
app.globalData.discounts = 0; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/index', |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
if(this.data.ingGroup){ |
|||
this.setTime(); |
|||
} |
|||
}, |
|||
hideGroup:function(){ |
|||
this.setData({ |
|||
showIngGroup:false |
|||
}) |
|||
wx.navigateTo({ |
|||
url: '/pages/group/info/index?id='+this.data.ingGroup[0].gp_product_id |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
if(timer){ |
|||
clearTimeout(timer); |
|||
timer = null |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
this.getList() |
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function (e) { |
|||
if(e.from=='button'){ |
|||
return { |
|||
title: "我正在发起团购,快来参加吧", // 默认是小程序的名称(可以写slogan等)
|
|||
path: "/pages/group/info/index?id="+this.data.ingGroup.gpInitiateId, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|||
imageUrl: this.data.ingGroup.headImg, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
|||
} |
|||
} |
|||
else { |
|||
return { |
|||
title: "团购专区", // 默认是小程序的名称(可以写slogan等)
|
|||
path: "list/pages/group/index" |
|||
} |
|||
} |
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
<title title="团购专区"></title> |
|||
<view class="hot-box"> |
|||
<view class="hot-title">热门团购<image src="https://resources.jszhwlpt.com/004e4591-a67a-4282-abf9-1c20feb5554e.png" mode="widthFix"></image></view> |
|||
<view class="hot-list"> |
|||
<view wx:for="{{hot}}" bindtap="gotoDetail" data-item="{{item}}" class="hot-item"> |
|||
<image src="{{item.headimg}}" mode="apsectFill"></image> |
|||
<view class="hot-info"> |
|||
<view class="hot-title1">{{item.title+item.sku_name}}</view> |
|||
<view class="hot-bottom"> |
|||
<text>¥{{item.event_price/100}}</text> |
|||
<view class="old-price">¥{{item.price/100}}</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="list-box"> |
|||
<view class="hot-title">精品团购<image src="https://resources.jszhwlpt.com/b994d3ca-e77e-4ef3-84ae-ba6a31bed666.png" mode="widthFix"></image></view> |
|||
<view wx:for="{{list}}" bindtap="gotoDetail" data-item="{{item}}" class="item"> |
|||
<image src="{{item.headimg}}" mode="aspectFill" class="headimg"></image> |
|||
<view class="item-num">{{item.gp_num}}人团</view> |
|||
<view class="info-box"> |
|||
<view> |
|||
<view class="info-title">{{item.title+item.sku_name}}</view> |
|||
<view class="info-tip">剩余库存:{{item.left_stock_num}}</view> |
|||
<view class="info-tip">团购成功:{{item.stock_num-item.left_stock_num}}</view> |
|||
</view> |
|||
<view class="hot-bottom"> |
|||
<text>¥{{item.event_price/100}}</text> |
|||
<view class="old-price">¥{{item.price/100}}</view> |
|||
<view class="btn" style="background:#ccc" wx:if="{{item.left_stock_num<=0}}">售罄</view> |
|||
<view class="btn" wx:else>团购</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<navigator url="mine/index" class="mine-btn"> |
|||
<view>我的</view> |
|||
<view>团购</view> |
|||
</navigator> |
|||
<view class="mask" wx:if="{{showIngGroup && ingGroup.length>0}}" style="flex-direction:column"> |
|||
<view class="mask-bg" bindtap="hideGroup"></view> |
|||
<view class="mask-content" style="text-align:center;font-size:26rpx;color:#666;padding-bottom:40rpx;z-index:100"> |
|||
<view class="mask-title">您有一个团购正在进行中</view> |
|||
<view>倒计时</view> |
|||
<view class="time-box"> |
|||
<view class="time-bg">{{ingGroup[0].h}}</view> |
|||
<text>:</text> |
|||
<view class="time-bg">{{ingGroup[0].m}}</view> |
|||
<text>:</text> |
|||
<view class="time-bg">{{ingGroup[0].s}}</view> |
|||
</view> |
|||
<view class="time-box headimglist"> |
|||
<image src="{{item.avatar}}" wx:for="{{ingGroup}}" mode="aspectFill"></image> |
|||
<view wx:if="{{ingGroup[0].gp_num>ingGroup.length}}"> |
|||
<button open-type="share" plain="true" style="border:none;padding:0;margin:0;"><image style="margin-right:0" src="https://resources.jszhwlpt.com/ffece698-001a-42be-8d8c-ff86985818e3.png" mode="aspectFill"></image></button> |
|||
</view> |
|||
</view> |
|||
<button open-type="share" plain="true" class="yq-btn">邀请好友</button> |
|||
</view> |
|||
<image class="closeimg" bindtap="hideGroup" src="https://resources.jszhwlpt.com/c34835f4-037d-441a-9282-b9e98c1ddae2.png" mode="widthFix"></image> |
|||
</view> |
|||
@ -0,0 +1,234 @@ |
|||
/* pages/user/pdd/index.wxss */ |
|||
page { |
|||
background: #F2F2F2; |
|||
} |
|||
.mine-btn { |
|||
width: 100rpx; |
|||
height: 100rpx; |
|||
background: #F34922; |
|||
box-shadow: 0px 0px 12px 0px rgba(243, 73, 34, 0.35); |
|||
border-radius: 50%; |
|||
position: fixed; |
|||
right: 30rpx; |
|||
bottom: 80rpx; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
flex-direction: column; |
|||
font-size: 26rpx; |
|||
color: #fff; |
|||
line-height: 34rpx; |
|||
} |
|||
.hot-box { |
|||
background: linear-gradient(-30deg, #FFCC24, #FF9124); |
|||
border-radius: 20rpx; |
|||
padding-bottom: 1rpx; |
|||
margin: 25rpx 20rpx; |
|||
} |
|||
.hot-title { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 70rpx; |
|||
margin: 0 20rpx; |
|||
font-size: 32rpx; |
|||
font-weight: bold; |
|||
} |
|||
.hot-title image { |
|||
width: 30rpx; |
|||
display: block; |
|||
height: 30rpx; |
|||
margin-left: 11rpx; |
|||
} |
|||
.hot-list { |
|||
display: flex; |
|||
margin: 20rpx; |
|||
margin-top: 0; |
|||
overflow-x: auto; |
|||
} |
|||
.hot-item { |
|||
border-radius: 10rpx; |
|||
overflow: hidden; |
|||
background: white; |
|||
width: 210rpx; |
|||
margin-right: 20rpx; |
|||
flex-shrink: 0; |
|||
} |
|||
.hot-list .hot-item:last-child { |
|||
margin-right: 0; |
|||
} |
|||
.hot-item image { |
|||
width: 210rpx; |
|||
display: block; |
|||
height: 180rpx; |
|||
} |
|||
.hot-info { |
|||
height: 120rpx; |
|||
display: flex; |
|||
flex-direction: column; |
|||
font-size: 22rpx; |
|||
padding: 10rpx; |
|||
box-sizing: border-box; |
|||
justify-content: space-between; |
|||
padding-bottom: 20rpx; |
|||
line-height: 26rpx; |
|||
} |
|||
.hot-title1 { |
|||
display: -webkit-box; |
|||
-webkit-box-orient: vertical; |
|||
-webkit-line-clamp: 2; |
|||
overflow: hidden; |
|||
} |
|||
.hot-bottom { |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
.hot-bottom text { |
|||
color: #FF5555; |
|||
} |
|||
.old-price { |
|||
margin-left: 10rpx; |
|||
color: #999; |
|||
text-decoration: line-through; |
|||
font-size: 18rpx; |
|||
} |
|||
.list-box { |
|||
margin: 0 20rpx; |
|||
} |
|||
.item { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
border-radius: 20rpx; |
|||
overflow: hidden; |
|||
background: white; |
|||
margin-bottom: 20rpx; |
|||
position: relative; |
|||
} |
|||
.item-num { |
|||
position: absolute; |
|||
width: 100rpx; |
|||
line-height: 40rpx; |
|||
text-align: center; |
|||
left: 0; |
|||
top: 0; |
|||
background: linear-gradient(270deg, #FFCC24, #FF9124); |
|||
border-radius: 20rpx 0px 20rpx 0px; |
|||
font-size: 24rpx; |
|||
color: #fff; |
|||
} |
|||
.item .headimg { |
|||
border-radius: 20rpx 20rpx 0px 20rpx; |
|||
display: block; |
|||
width: 220rpx; |
|||
height: 220rpx; |
|||
flex-shrink: 0; |
|||
} |
|||
.info-box { |
|||
flex: 1; |
|||
width: calc(100% - 300rpx); |
|||
margin:10rpx 20rpx; |
|||
height: 200rpx; |
|||
font-size: 26rpx; |
|||
color: #666; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: space-between; |
|||
} |
|||
.info-title { |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
line-height: 42rpx; |
|||
margin-bottom: 10rpx; |
|||
font-weight: bold; |
|||
} |
|||
.info-box view { |
|||
white-space: nowrap; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
} |
|||
.info-tip { |
|||
margin-bottom: 10rpx; |
|||
} |
|||
.info-box .hot-bottom text { |
|||
font-size: 30rpx; |
|||
} |
|||
.info-box .hot-bottom .old-price { |
|||
font-size: 24rpx; |
|||
flex: 1; |
|||
} |
|||
.info-box .btn { |
|||
width: 160rpx; |
|||
line-height: 50rpx; |
|||
background: linear-gradient(0deg, #FFCC24, #FF9124); |
|||
border-radius: 25rpx; |
|||
text-align: center; |
|||
color: #fff; |
|||
} |
|||
.info-box .btn.disable { |
|||
background: #CCCCCC; |
|||
} |
|||
.mask-title { |
|||
font-size: 36rpx; |
|||
font-weight: bold; |
|||
line-height: 120rpx; |
|||
color: #333; |
|||
} |
|||
.time-box { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
margin-top: 20rpx; |
|||
margin-bottom: 40rpx; |
|||
} |
|||
.time-bg { |
|||
width: 50rpx; |
|||
line-height: 50rpx; |
|||
background: #F2F2F2; |
|||
border-radius: 10rpx; |
|||
color: #F34922; |
|||
} |
|||
.time-box text { |
|||
width: 60rpx; |
|||
} |
|||
.headimglist image { |
|||
display: block; |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
border-radius: 50%; |
|||
margin-right: 30rpx; |
|||
} |
|||
.headimglist view { |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
border-radius: 50%; |
|||
overflow: hidden; |
|||
} |
|||
.headimglist button { |
|||
display: block; |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
background-color: #fff !important; |
|||
background: #fff !important; |
|||
margin: 0 !important; |
|||
} |
|||
button { |
|||
border: none !important; |
|||
padding: 0 !important; |
|||
box-shadow: #fff !important; |
|||
color: #fff !important; |
|||
} |
|||
.closeimg { |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
display: block; |
|||
margin-top: 30rpx; |
|||
} |
|||
.yq-btn { |
|||
width: 400rpx; |
|||
line-height: 80rpx; |
|||
color: #fff; |
|||
margin: 0 auto; |
|||
background: linear-gradient(270deg, #FFCC24, #FF9124); |
|||
border-radius: 40rpx; |
|||
font-size: 36rpx; |
|||
margin-top: 40rpx; |
|||
} |
|||
@ -0,0 +1,311 @@ |
|||
// pages/info/groupInfo/index.js
|
|||
import commonApi from "../../../utils/https/common"; |
|||
let timer = null,app = getApp(),timer2=null; |
|||
import util from "../../../utils/util" |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
info:null, |
|||
list:[], |
|||
hot:[], |
|||
id:null, |
|||
isFollow:true, |
|||
showRuleFlag:false, |
|||
isOn:false, |
|||
myIngList:{} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
this.setData({ |
|||
id:options.id |
|||
}) |
|||
commonApi.user_post('activity.groups/detail?id='+options.id,{ |
|||
id:options.id |
|||
}).then(res=>{ |
|||
this.setData({ |
|||
info:res.data.detail, |
|||
hot:res.data.hotProductList |
|||
}) |
|||
if(res.data.self_team.status==-1){ |
|||
this.setData({ |
|||
isOn:false |
|||
}) |
|||
commonApi.user_post("activity.groups/get_teams?limit=100&id="+options.id,{ |
|||
id:options.id, |
|||
limit:10 |
|||
}).then(res=>{ |
|||
this.setData({ |
|||
list:res.data.data |
|||
}) |
|||
this.setListTime(); |
|||
}) |
|||
} |
|||
else { |
|||
this.setData({ |
|||
isOn:true, |
|||
myIngList:res.data.self_team |
|||
}) |
|||
this.setTime(); |
|||
} |
|||
}) |
|||
}, |
|||
// 我的团购结束倒计时
|
|||
setTime:function(){ |
|||
let myIngList = this.data.myIngList,time = myIngList.team_list[0].over_time; |
|||
if(myIngList.isOver){ |
|||
if(timer2){ |
|||
clearTimeout(timer2); |
|||
timer2 = null; |
|||
} |
|||
return; |
|||
} |
|||
let overTime = new Date(time.replace(/-/g,'/')).getTime(),now = new Date().getTime(); |
|||
if(overTime<=now){ |
|||
myIngList.isOver=true; |
|||
} |
|||
else { |
|||
let t = (overTime - now)/1000; |
|||
let h = Math.floor(t/(60*60)); |
|||
t = t - h * 60*60; |
|||
let m = Math.floor(t/60),s=Math.floor(t-m*60); |
|||
if(h<10) { |
|||
h="0"+h; |
|||
} |
|||
if(m<10) { |
|||
m="0"+m; |
|||
} |
|||
if(s<10) { |
|||
s="0"+s; |
|||
} |
|||
myIngList.h=h; |
|||
myIngList.m=m; |
|||
myIngList.s=s; |
|||
} |
|||
this.setData({ |
|||
myIngList:myIngList |
|||
}) |
|||
timer2 = setTimeout(()=>{ |
|||
this.setTime() |
|||
},1000) |
|||
}, |
|||
// 列表倒计时
|
|||
setListTime:function(){ |
|||
let list = this.data.list,now = new Date(); |
|||
list.map(item=>{ |
|||
let t = item.over_time; |
|||
t = new Date(t.replace(/-/g,'/')).getTime() - now; |
|||
if(t<=0) { |
|||
item.isEnd = true; |
|||
} |
|||
else { |
|||
let h = Math.floor(t / 3600000),m = Math.floor((t - h * 3600000)/60000),s = Math.floor((t - h * 3600000 - m * 60000)/1000); |
|||
item.h = h<10?('0'+h):h; |
|||
item.m = m<10?('0'+m):m; |
|||
item.s = s<10?('0'+s):s; |
|||
} |
|||
}) |
|||
this.setData({ |
|||
list:list |
|||
}) |
|||
if(timer){ |
|||
clearTimeout(timer); |
|||
} |
|||
timer = setTimeout(()=>{ |
|||
this.setListTime() |
|||
},1000) |
|||
}, |
|||
// 修改当前详情页id
|
|||
gotoDetail:function(e){ |
|||
clearTimeout(timer); |
|||
timer = null; |
|||
wx.redirectTo({ |
|||
url: '/pages/info/groupInfo/index?id='+e.currentTarget.dataset.id |
|||
}) |
|||
}, |
|||
// 发起团购
|
|||
startGroup:function(){ |
|||
util.goKjOrder(this.data.info).then(product=>{ |
|||
product.map(item=>{ |
|||
item.productNum = this.data.info.purchase_quantity; |
|||
item.sku.event_price = this.data.info.event_price; |
|||
item.maxNum = this.data.info.purchase_quantity; |
|||
}) |
|||
app.globalData.gp_id = this.data.info.id; |
|||
if(this.data.info.type=='post'){ |
|||
app.globalData.postProduct = product; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/postOrder/index', |
|||
}) |
|||
} |
|||
else if(this.data.info.type=='ticket' || this.data.info.type=='scene'){ |
|||
app.globalData.product = product[0]; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/scene/index', |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
// 加入拼团
|
|||
join:function(e){ |
|||
let item = e.currentTarget.dataset.item; |
|||
util.goKjOrder(this.data.info).then(product=>{ |
|||
product.map(item=>{ |
|||
item.productNum = this.data.info.purchase_quantity; |
|||
item.sku.event_price = this.data.info.event_price; |
|||
item.maxNum = this.data.info.purchase_quantity; |
|||
}) |
|||
// app.globalData.gp_id = this.data.info.id;
|
|||
app.globalData.team_id = item.team_id; |
|||
if(this.data.info.type=='post'){ |
|||
app.globalData.postProduct = product; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/postOrder/index', |
|||
}) |
|||
} |
|||
else if(this.data.info.type=='ticket' || this.data.info.type=='scene'){ |
|||
app.globalData.product = product[0]; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/scene/index', |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
// 原价购买
|
|||
goBuy:function(){ |
|||
this.goOrder(null,1); |
|||
}, |
|||
// 去下单
|
|||
goOrder:function(groupId){ |
|||
commonApi._get('productfront/getProductInfo',{ |
|||
productId:this.data.info.productDetail.productId |
|||
}).then(res=>{ |
|||
if(!res.data){ |
|||
wx.showToast({ |
|||
title:"该产品不存在或已下架", |
|||
icon:'none' |
|||
}) |
|||
return; |
|||
} |
|||
let skuIndex = res.data.skuInfo.findIndex(item=>item.id==this.data.info.productDetail.skuId); |
|||
if(skuIndex==-1) { |
|||
wx.showToast({ |
|||
title:"该产品规格不存在", |
|||
icon:'none' |
|||
}) |
|||
return; |
|||
} |
|||
let sku = res.data.skuInfo[skuIndex]; |
|||
app.globalData.shoppingCart=[{ |
|||
baseInfo:res.data.baseInfo, |
|||
modelInfo:sku.modelInfo, |
|||
skuInfo:sku, |
|||
productNum:1, |
|||
purchaseQuantity:this.data.info.productDetail.purchaseQuantity |
|||
}]; |
|||
app.globalData.groupId = groupId; |
|||
app.globalData.discounts = 0; |
|||
wx.navigateTo({ |
|||
url: '../../order/index', |
|||
}) |
|||
}) |
|||
}, |
|||
// 显示或者隐藏规则
|
|||
showRule:function(){ |
|||
this.setData({ |
|||
showRuleFlag:!this.data.showRuleFlag |
|||
}) |
|||
}, |
|||
// 前往列表页 如果是从列表来的直接返回 防止嵌套
|
|||
backList:function(){ |
|||
let page = getCurrentPages(); |
|||
if(page.length>=2 && page[page.length-2].route.indexOf('pages/group/index')!=-1){ |
|||
wx.navigateBack() |
|||
} |
|||
else { |
|||
wx.navigateTo({ |
|||
url: '/pages/group/index' |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
if(this.data.list.length>0){ |
|||
this.setListTime() |
|||
} |
|||
if(this.data.info && this.data.info.isGroupPurchasing==1){ |
|||
this.setTime() |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
if(timer){ |
|||
clearTimeout(timer) |
|||
timer = null; |
|||
} |
|||
if(timer2){ |
|||
clearTimeout(timer2); |
|||
timer2 = null; |
|||
} |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function (e) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function (e) { |
|||
if(e.from=='button' || this.data.myIngList.status==1){ |
|||
return { |
|||
title: "我正在发起团购,快来参加吧", // 默认是小程序的名称(可以写slogan等)
|
|||
path: "/pages/group/info/index?gpId="+this.data.info.id, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|||
imageUrl: this.data.info.headimg, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
|||
} |
|||
} |
|||
else { |
|||
return { |
|||
title: this.data.info.title+this.data.info.sku_name+"正在团购中~", // 默认是小程序的名称(可以写slogan等)
|
|||
path: "/pages/group/info/index?id="+this.data.info.id, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|||
imageUrl: this.data.info.headimg, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
|||
} |
|||
} |
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,115 @@ |
|||
<!--pages/info/groupInfo/index.wxml--> |
|||
<title title="团购详情"></title> |
|||
<view class="info-top-box" wx:if="{{info}}"> |
|||
<view class="item"> |
|||
<image src="{{info.headimg}}" mode="aspectFill" class="headimg"></image> |
|||
<view class="item-num">{{info.gp_num}}人团</view> |
|||
<view class="info-box"> |
|||
<view> |
|||
<view class="info-title">{{info.title+info.sku_name}}</view> |
|||
<view class="info-tip">剩余库存:{{info.left_stock_num}}</view> |
|||
</view> |
|||
<view class="hot-bottom"> |
|||
<text>¥{{info.event_price/100}}</text> |
|||
<view class="old-price">¥{{info.price/100}}</view> |
|||
</view> |
|||
</view> |
|||
<navigator url="/pages/info/{{info.type=='post'?'post':'scene'}}ProductInfo/index?id={{info.goods_id}}" class="info-btn">详情 ></navigator> |
|||
</view> |
|||
<!-- 进行中的拼团 --> |
|||
<view wx:if="{{isOn && myIngList && myIngList.status==1}}"> |
|||
<view class="mask-title">还差<text>{{info.gp_num - myIngList.team_list.length}}</text>人</view> |
|||
<view class="top-tip">成团立享超值优惠</view> |
|||
<view>倒计时</view> |
|||
<view class="time-box"> |
|||
<view class="time-bg">{{myIngList.h}}</view> |
|||
<text>:</text> |
|||
<view class="time-bg">{{myIngList.m}}</view> |
|||
<text>:</text> |
|||
<view class="time-bg">{{myIngList.s}}</view> |
|||
</view> |
|||
<view class="time-box headimglist"> |
|||
<image wx:for="{{myIngList.team_list}}" src="{{item.avatar}}" mode="aspectFill"></image> |
|||
<view> |
|||
<button open-type="share" plain="true" style="border:none;padding:0;margin:0;"><image style="margin-right:0" src="https://resources.jszhwlpt.com/ffece698-001a-42be-8d8c-ff86985818e3.png" mode="aspectFill"></image></button> |
|||
</view> |
|||
</view> |
|||
<button open-type="share" plain="true" class="yq-btn">邀请好友</button> |
|||
</view> |
|||
<!-- 失败的拼团 --> |
|||
<view class="fail-box" wx:if="{{info.productDetail.status==0 && info.isGroupPurchasing==1}}"> |
|||
<image src="https://resources.jszhwlpt.com/1fccfcab-2e85-4925-826e-4c35d35b8a9a.png" mode="widthFix"></image> |
|||
<view class="fail-text">团购未满规定人数 已失败</view> |
|||
<view class="fail-btns"> |
|||
<view class="fail-btn border-btn" bindtap="goBuy">原价购买</view> |
|||
<view class="fail-btn" bindtap="startGroup">再开一单</view> |
|||
</view> |
|||
</view> |
|||
<!-- 成功的拼团 --> |
|||
<view class="fail-box" wx:if="{{info.productDetail.status==2 && info.isGroupPurchasing==1}}"> |
|||
<image src="https://resources.jszhwlpt.com/fa6904a2-3063-4d90-8da0-d02424d4ac76.png" mode="widthFix"></image> |
|||
<view class="fail-text" style="color:#F34922">团购活动已人满 团购成功</view> |
|||
<view class="fail-btns"> |
|||
<view class="fail-btn" style="width:600rpx" bindtap="startGroup">再开一单</view> |
|||
</view> |
|||
</view> |
|||
<!-- 活动结束 --> |
|||
<view class="fail-box" wx:if="{{info.productDetail.state==2}}"> |
|||
<image src="https://resources.jszhwlpt.com/fdd3bdd5-7e78-4ab3-8cd7-e5dc08e234e9.png" mode="widthFix"></image> |
|||
<view class="fail-text">团购活动已结束</view> |
|||
<view class="fail-btns"> |
|||
<view class="fail-btn" style="width:600rpx" bindtap="backList">查看其它活动</view> |
|||
</view> |
|||
</view> |
|||
<!-- 拼团未开始 --> |
|||
<view class="new-box" wx:if="{{isOn==false}}"> |
|||
<view class="fail-btns"> |
|||
<view class="fail-btn" style="width:600rpx" bindtap="startGroup">发起团购</view> |
|||
</view> |
|||
<view style="margin-top:30rpx" bindtap="showRule">拼团规则</view> |
|||
<view class="group-list"> |
|||
<view class="group-item" wx:for="{{list}}"> |
|||
<image src="{{item.avatar}}" mode="aspectFill"></image> |
|||
<view class="nickname">{{item.nickname}}</view> |
|||
<view class="group-num">还差<text>{{info.gp_num - item.team_num}}</text>人</view> |
|||
<view class="btn-box" bindtap="join" data-item="{{item}}"> |
|||
<view class="btn-top">参团</view> |
|||
<view class="btn-time">剩余{{item.h}}:{{item.m}}:{{item.s}}</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view style="margin-top:30rpx" wx:else bindtap="showRule">拼团规则</view> |
|||
</view> |
|||
<view class="hot-box"> |
|||
<view class="hot-title"> |
|||
<view>商品推荐</view> |
|||
<view class="more-btn" bindtap="backList">更多 ></view> |
|||
</view> |
|||
<view class="hot-list" wx:if="{{hot.length>0}}"> |
|||
<view class="hot-item" wx:for="{{hot}}" bindtap="gotoDetail" data-id="{{item.id}}"> |
|||
<image src="{{item.headImg}}" mode="apsectFill"></image> |
|||
<view class="hot-info"> |
|||
<view class="hot-title1">{{item.productName+item.skuName}}</view> |
|||
<view class="hot-bottom"> |
|||
<text>¥{{item.eventPrice/100}}</text> |
|||
<view class="old-price">¥{{item.price/100}}</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="mask" wx:if="{{showShareFlag}}"> |
|||
<view class="mask-bg" bindtap="hideShare"></view> |
|||
<view class="mask-content" style="width:500rpx;overflow:hidden;text-align:center;color:#FF9124;padding:40rpx 0;"> |
|||
<view>请先关注公众号</view> |
|||
<image bindlongpress="saveImg" style="width:260rpx;height:260rpx;display:block;margin:40rpx auto;border-radius:10rpx;border:1rpx solid" src="https://resources.jszhwlpt.com/d3c2d106-b893-474f-bf5c-091bd04f247f.jpeg" mode="aspectFill" class="codeimg"></image> |
|||
<view style="color:#333">长按保存二维码</view> |
|||
</view> |
|||
</view> |
|||
<view class="mask" wx:if="{{info && showRuleFlag}}"> |
|||
<view class="mask-bg" bindtap="showRule"></view> |
|||
<view class="mask-content" style="padding:20rpx;max-height:50%;overflow-y:auto;min-height:30%;"> |
|||
<rich-text nodes="{{info.rule_content}}"></rich-text> |
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,329 @@ |
|||
/* pages/info/groupInfo/index.wxss */ |
|||
.headimglist view { |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
border-radius: 50%; |
|||
overflow: hidden; |
|||
} |
|||
.headimglist button { |
|||
display: block; |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
background-color: #fff !important; |
|||
background: #fff !important; |
|||
margin: 0 !important; |
|||
} |
|||
button { |
|||
border: none !important; |
|||
padding: 0 !important; |
|||
box-shadow: #fff !important; |
|||
color: #fff !important; |
|||
} |
|||
.info-top-box { |
|||
text-align:center; |
|||
font-size:26rpx; |
|||
color:#666; |
|||
padding: 20rpx; |
|||
padding-bottom:40rpx; |
|||
margin: 20rpx; |
|||
border-radius: 20rpx; |
|||
background: white; |
|||
} |
|||
.mask-title { |
|||
font-size: 36rpx; |
|||
font-weight: bold; |
|||
line-height: 50rpx; |
|||
color: #333; |
|||
margin-top: 30rpx; |
|||
} |
|||
.top-tip { |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
margin-bottom: 40rpx; |
|||
font-weight: bold; |
|||
} |
|||
.time-box { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
margin-top: 20rpx; |
|||
margin-bottom: 40rpx; |
|||
} |
|||
.time-bg { |
|||
width: 50rpx; |
|||
line-height: 50rpx; |
|||
background: #F2F2F2; |
|||
border-radius: 10rpx; |
|||
color: #F34922; |
|||
} |
|||
.time-box text { |
|||
width: 60rpx; |
|||
} |
|||
.headimglist image { |
|||
display: block; |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
border-radius: 50%; |
|||
margin-right: 30rpx; |
|||
} |
|||
.headimglist image:last-child { |
|||
margin-right: 0; |
|||
} |
|||
.closeimg { |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
display: block; |
|||
margin-top: 30rpx; |
|||
} |
|||
.yq-btn { |
|||
width: 400rpx; |
|||
line-height: 80rpx; |
|||
color: #fff; |
|||
margin: 0 auto; |
|||
background: linear-gradient(270deg, #FFCC24, #FF9124); |
|||
border-radius: 40rpx; |
|||
font-size: 36rpx; |
|||
margin-top: 40rpx; |
|||
} |
|||
.item { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
padding-bottom: 20rpx; |
|||
position: relative; |
|||
text-align: left; |
|||
border-bottom: 1rpx solid #D8D8D8; |
|||
} |
|||
.item-num { |
|||
position: absolute; |
|||
width: 100rpx; |
|||
line-height: 40rpx; |
|||
text-align: center; |
|||
left: 0; |
|||
top: 0; |
|||
background: linear-gradient(270deg, #FFCC24, #FF9124); |
|||
border-radius: 10rpx 0px 10rpx 0px; |
|||
font-size: 24rpx; |
|||
color: #fff; |
|||
} |
|||
.item .headimg { |
|||
border-radius: 10rpx; |
|||
display: block; |
|||
width: 160rpx; |
|||
height: 160rpx; |
|||
flex-shrink: 0; |
|||
} |
|||
.info-box { |
|||
flex: 1; |
|||
width: calc(100% - 360rpx); |
|||
margin:0 20rpx; |
|||
height: 150rpx; |
|||
font-size: 26rpx; |
|||
color: #666; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: space-between; |
|||
} |
|||
.info-title { |
|||
font-size: 30rpx; |
|||
color: #333; |
|||
line-height: 42rpx; |
|||
margin-bottom: 10rpx; |
|||
font-weight: bold; |
|||
} |
|||
.info-box view { |
|||
white-space: nowrap; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
} |
|||
.info-tip { |
|||
margin-bottom: 10rpx; |
|||
} |
|||
.info-box .hot-bottom text { |
|||
font-size: 30rpx; |
|||
font-weight: bold; |
|||
} |
|||
.info-box .hot-bottom .old-price { |
|||
font-size: 24rpx; |
|||
flex: 1; |
|||
} |
|||
.hot-bottom { |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
.hot-bottom text { |
|||
color: #FF5555; |
|||
} |
|||
.old-price { |
|||
margin-left: 10rpx; |
|||
color: #999; |
|||
text-decoration: line-through; |
|||
font-size: 18rpx; |
|||
} |
|||
.info-btn { |
|||
flex-shrink: 0; |
|||
color: #F34922; |
|||
margin-top: 3rpx; |
|||
line-height: 30rpx; |
|||
height: 30rpx; |
|||
} |
|||
.more-btn { |
|||
color: #F34922; |
|||
font-size: 26rpx; |
|||
flex: 1; |
|||
font-weight: normal; |
|||
text-align: right; |
|||
} |
|||
.hot-box { |
|||
border-radius: 20rpx; |
|||
background: white; |
|||
padding-bottom: 1rpx; |
|||
margin: 25rpx 20rpx; |
|||
} |
|||
.hot-title { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 70rpx; |
|||
margin: 0 20rpx; |
|||
font-size: 32rpx; |
|||
font-weight: bold; |
|||
} |
|||
.hot-title image { |
|||
width: 30rpx; |
|||
display: block; |
|||
height: 30rpx; |
|||
margin-left: 11rpx; |
|||
} |
|||
.hot-list { |
|||
display: flex; |
|||
margin:0 20rpx; |
|||
} |
|||
.hot-item { |
|||
border-radius: 10rpx; |
|||
overflow: hidden; |
|||
background: white; |
|||
width: 210rpx; |
|||
margin-right: 20rpx; |
|||
} |
|||
.hot-list .hot-item:last-child { |
|||
margin-right: 0; |
|||
} |
|||
.hot-item image { |
|||
width: 210rpx; |
|||
display: block; |
|||
height: 180rpx; |
|||
} |
|||
.hot-info { |
|||
height: 120rpx; |
|||
display: flex; |
|||
flex-direction: column; |
|||
font-size: 22rpx; |
|||
padding: 10rpx; |
|||
box-sizing: border-box; |
|||
justify-content: space-between; |
|||
padding-bottom: 20rpx; |
|||
line-height: 26rpx; |
|||
} |
|||
.hot-title1 { |
|||
display: -webkit-box; |
|||
-webkit-box-orient: vertical; |
|||
-webkit-line-clamp: 2; |
|||
overflow: hidden; |
|||
font-size: 22rpx; |
|||
} |
|||
.fail-box { |
|||
padding-top: 70rpx; |
|||
text-align: center; |
|||
} |
|||
.fail-box image { |
|||
width: 200rpx; |
|||
display: block; |
|||
margin: 0 auto; |
|||
height: 200rpx; |
|||
} |
|||
.fail-text { |
|||
font-size: 36rpx; |
|||
font-weight: bold; |
|||
color: #000; |
|||
margin-top: 20rpx; |
|||
margin-bottom: 60rpx; |
|||
} |
|||
.fail-btns { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
margin: 0 40rpx; |
|||
} |
|||
.fail-btns .fail-btn { |
|||
width: 280rpx; |
|||
box-sizing: border-box; |
|||
line-height: 80rpx; |
|||
height: 80rpx; |
|||
color: #fff; |
|||
background: linear-gradient(90deg, #FFCC24, #FF9124); |
|||
border-radius: 40rpx; |
|||
font-size: 36rpx; |
|||
} |
|||
.fail-btns .fail-btn.border-btn { |
|||
border: 2rpx solid #FF9124; |
|||
color: #FF9124; |
|||
background: white; |
|||
} |
|||
.new-box { |
|||
padding: 20rpx 0; |
|||
} |
|||
.group-list { |
|||
background: #FFF4E9; |
|||
margin: 0 20rpx; |
|||
margin-top: 30rpx; |
|||
border-radius: 10rpx; |
|||
} |
|||
.group-item { |
|||
margin: 0 20rpx; |
|||
border-bottom: 1rpx solid #FFFFFF; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
height: 140rpx; |
|||
font-size: 26rpx; |
|||
color: #333; |
|||
} |
|||
.group-item image { |
|||
width: 80rpx; |
|||
height: 80rpx; |
|||
display: block; |
|||
flex-shrink: 0; |
|||
border-radius: 50%; |
|||
} |
|||
.group-item .nickname { |
|||
margin: 0 20rpx; |
|||
font-size: 30rpx; |
|||
text-align: left; |
|||
flex: 1; |
|||
} |
|||
.group-num { |
|||
flex-shrink: 0; |
|||
margin-right: 30rpx; |
|||
} |
|||
.group-num text { |
|||
color: #F34922; |
|||
margin: 0 4rpx; |
|||
} |
|||
.btn-box { |
|||
width: 160rpx; |
|||
height: 80rpx; |
|||
background: #fff; |
|||
overflow: hidden; |
|||
border: 2rpx solid #FF9124; |
|||
border-radius: 20rpx; |
|||
color: #fff; |
|||
flex-shrink: 0; |
|||
} |
|||
.btn-top { |
|||
width: 100%; |
|||
background: #ff9124; |
|||
line-height: 50rpx; |
|||
} |
|||
.btn-time { |
|||
font-size: 20rpx; |
|||
line-height: 30rpx; |
|||
color: #666; |
|||
} |
|||
@ -0,0 +1,224 @@ |
|||
// pages/user/pdd/index.js
|
|||
import productApi from "../../../utils/https/common"; |
|||
let timer = null,app = getApp(); |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
type:1, |
|||
list:[], |
|||
over:[] |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
this.getList(); |
|||
}, |
|||
changeType:function(e){ |
|||
let type = e.currentTarget.dataset.type; |
|||
if(this.data.type==type) return; |
|||
this.setData({ |
|||
type:type |
|||
}) |
|||
}, |
|||
gotoDetail:function(e){ |
|||
let data = e.currentTarget.dataset.item; |
|||
if(this.data.type==2){ |
|||
this.goOrder(e); |
|||
return; |
|||
} |
|||
wx.navigateTo({ |
|||
url:"/pages/group/info/index?id="+data.gp_product_id |
|||
}) |
|||
}, |
|||
getList:function(){ |
|||
productApi.user_post("activity.groups/my_teams",{ |
|||
limit:100, |
|||
status:1, |
|||
is_team:1 |
|||
}).then(res=>{ |
|||
this.setData({ |
|||
list:{ |
|||
launchList:res.data.data |
|||
} |
|||
}) |
|||
productApi.user_post("activity.groups/my_teams",{ |
|||
limit:100, |
|||
status:1, |
|||
is_team:0 |
|||
}).then(r=>{ |
|||
this.setData({ |
|||
list:{ |
|||
launchList:res.data.data, |
|||
joinList:r.data.data |
|||
} |
|||
}) |
|||
this.setTime(); |
|||
timer = setInterval(()=>{ |
|||
this.setTime() |
|||
},1000) |
|||
}) |
|||
}) |
|||
productApi.user_post("activity.groups/my_teams",{ |
|||
limit:100, |
|||
status:2, |
|||
is_team:1 |
|||
}).then(res=>{ |
|||
productApi.user_post("activity.groups/my_teams",{ |
|||
limit:100, |
|||
status:2, |
|||
is_team:0 |
|||
}).then(r=>{ |
|||
this.setData({ |
|||
over:{ |
|||
launchList:res.data.data, |
|||
joinList:r.data.data |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}, |
|||
setTime:function(){ |
|||
let list = this.data.list,now = new Date().getTime(); |
|||
for(let i in list){ |
|||
list[i].map(item=>{ |
|||
let overTime = item.over_time; |
|||
overTime = new Date(overTime.replace(/-/g,'/')).getTime(); |
|||
if(overTime<=now){ |
|||
item.isOver=true; |
|||
} |
|||
else { |
|||
let t = (overTime - now)/1000; |
|||
let h = Math.floor(t/(60*60)); |
|||
t = t - h * 60*60; |
|||
let m = Math.floor(t/60),s=Math.floor(t-m*60); |
|||
if(h<10) { |
|||
h="0"+h; |
|||
} |
|||
if(m<10) { |
|||
m="0"+m; |
|||
} |
|||
if(s<10) { |
|||
s="0"+s; |
|||
} |
|||
item.timeText=[h,m,s].join(" : "); |
|||
} |
|||
}) |
|||
} |
|||
this.setData({ |
|||
list:list |
|||
}) |
|||
}, |
|||
goProduct:function(e){ |
|||
let item = e.currentTarget.dataset.item; |
|||
console.log(item); |
|||
productApi._get('productfront/getProductInfo',{ |
|||
productId:item.productId |
|||
}).then(res=>{ |
|||
if(!res.data){ |
|||
wx.showToast({ |
|||
title:"该产品不存在或已下架", |
|||
icon:'none' |
|||
}) |
|||
return; |
|||
} |
|||
let skuIndex = res.data.skuInfo.findIndex(sku=>sku.id==item.skuId); |
|||
if(skuIndex==-1) { |
|||
wx.showToast({ |
|||
title:"该产品规格不存在", |
|||
icon:'none' |
|||
}) |
|||
return; |
|||
} |
|||
let sku = res.data.skuInfo[skuIndex]; |
|||
app.globalData.shoppingCart=[{ |
|||
baseInfo:res.data.baseInfo, |
|||
modelInfo:sku.modelInfo, |
|||
skuInfo:sku, |
|||
productNum:1 |
|||
}]; |
|||
app.globalData.kjOrderId = item.id || null; |
|||
app.globalData.discounts = 0; |
|||
wx.navigateTo({ |
|||
url: '/pages/order/index', |
|||
}) |
|||
}) |
|||
}, |
|||
goOrder:function(e){ |
|||
wx.navigateTo({ |
|||
url: '/pages/info/orderInfo/index?id='+e.currentTarget.dataset.item.gpChildOrderNo, |
|||
}) |
|||
}, |
|||
gotoPdd:function(){ |
|||
let page = getCurrentPages(); |
|||
if(page[page.length-2] && page[page.length-2].route && page[page.length-2].route.indexOf('pages/group/index')!=-1){ |
|||
// 如果是从专题页列表来的 那么直接返回
|
|||
wx.navigateBack() |
|||
} |
|||
else { |
|||
wx.navigateTo({ |
|||
url: '/pages/group/index', |
|||
}) |
|||
} |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
if(this.data.list.length>0){ |
|||
this.setTime(); |
|||
timer = setInterval(()=>{ |
|||
this.setTime() |
|||
},1000) |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
if(timer){ |
|||
clearInterval(timer); |
|||
timer = null; |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage: function () { |
|||
|
|||
} |
|||
}) |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
} |
|||
} |
|||
@ -0,0 +1,60 @@ |
|||
<!--pages/user/pdd/index.wxml--> |
|||
<title title="我的团购"></title> |
|||
<view class="top-menus"> |
|||
<view class="top-menu{{type==1?' active':''}}" bindtap="changeType" data-type="1">进行中</view> |
|||
<view class="top-menu{{type==2?' active':''}}" bindtap="changeType" data-type="2">成团记录</view> |
|||
</view> |
|||
<view class="list"> |
|||
<view class="list-title" wx:if="{{type==1 && list.launchList.length>0 || type==2 && over.launchList.length>0}}">我发起的</view> |
|||
<view class="item" wx:for="{{type==1?list.launchList:over.launchList}}" bindtap="gotoDetail" data-item="{{item}}"> |
|||
<view class="item-top"> |
|||
<image src="{{item.g_headimg}}" mode="aspectFill"></image> |
|||
<view class="item-info"> |
|||
<view class="item-info-top"> |
|||
<view class="item-title">{{item.title+item.sku_name}}</view> |
|||
<view class="item-price">¥{{item.event_price/100}}</view> |
|||
</view> |
|||
<view class="item-info-bottom" wx:if="{{type==1}}"> |
|||
<view class="item-info-time" wx:if="{{item.isOver}}">已结束</view> |
|||
<view class="item-info-time" wx:else><text>{{item.timeText}}</text>后结束</view> |
|||
<view class="info-btn">查看详情</view> |
|||
</view> |
|||
<view class="item-info-bottom" wx:else> |
|||
成团日期:{{item.finish_time}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="item-bottom" wx:if="{{type==2}}"> |
|||
<view class="info-btn info-btn-new" catchtap="goOrder" data-item="{{item}}">查看订单</view> |
|||
</view> |
|||
</view> |
|||
<view class="list-title" wx:if="{{type==1 && list.joinList.length>0 || type==2 && over.joinList.length>0}}">我参与的</view> |
|||
<view class="item" wx:for="{{type==1?list.joinList:over.joinList}}" bindtap="gotoDetail" data-item="{{item}}"> |
|||
<view class="item-top"> |
|||
<image src="{{item.g_headimg}}" mode="aspectFill"></image> |
|||
<view class="item-info"> |
|||
<view class="item-info-top"> |
|||
<view class="item-title">{{item.title+item.sku_name}}</view> |
|||
<view class="item-price">¥{{item.event_price/100}}</view> |
|||
</view> |
|||
<view class="item-info-bottom" wx:if="{{type==1}}"> |
|||
<view class="item-info-time" wx:if="{{item.isOver}}">已结束</view> |
|||
<view class="item-info-time" wx:else><text>{{item.timeText}}</text>后结束</view> |
|||
<view class="info-btn">查看详情</view> |
|||
</view> |
|||
<view class="item-info-bottom" wx:else> |
|||
成团日期:{{item.finish_time}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="item-bottom" wx:if="{{type==2}}"> |
|||
<view class="info-btn info-btn-new" catchtap="goOrder" data-item="{{item}}">查看订单</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view wx:if="{{list.joinList.length==0 && list.launchList.length==0 && type==1 || type==2 && over.joinList.length==0 && over.launchList.length==0}}" class="common-empty" style="z-index:-1"> |
|||
<image style="width:200rpx" mode="widthFix" src="https://resources.jszhwlpt.com/d8f70d62-ad43-4347-962a-5b4c49f704ad.png"></image> |
|||
<view wx:if="{{type==1}}">您暂时还未参加拼团活动</view> |
|||
<view wx:if="{{type==2}}">您暂时还未参团成功</view> |
|||
<view wx:if="{{type==1}}" class="empty-btn" bindtap="gotoPdd">立即前往</view> |
|||
</view> |
|||
@ -0,0 +1,121 @@ |
|||
/* pages/user/pdd/index.wxss */ |
|||
.top-menus { |
|||
position: fixed; |
|||
left: 0; |
|||
right: 0; |
|||
height: 80rpx; |
|||
background: white; |
|||
display: flex; |
|||
justify-content: space-around; |
|||
align-items: center; |
|||
font-size: 30rpx; |
|||
line-height: 80rpx; |
|||
} |
|||
.top-menu.active { |
|||
color: #FF9124; |
|||
position: relative; |
|||
font-weight: 500; |
|||
} |
|||
.top-menu.active::after { |
|||
content: "1"; |
|||
font-size: 0; |
|||
width: 40rpx; |
|||
height: 6rpx; |
|||
background: linear-gradient(270deg, #FFCC24, #FF9124); |
|||
display: block; |
|||
border-radius: 3rpx; |
|||
position: absolute; |
|||
left: 50%; |
|||
margin-left: -20rpx; |
|||
bottom: 10rpx; |
|||
} |
|||
.title-header { |
|||
background: #fff !important; |
|||
} |
|||
.item { |
|||
margin: 20rpx 30rpx; |
|||
background: white; |
|||
border-radius: 20rpx; |
|||
font-size: 26rpx; |
|||
} |
|||
.item-top { |
|||
display: flex; |
|||
padding: 30rpx; |
|||
} |
|||
.item-top image { |
|||
width: 160rpx; |
|||
height: 160rpx; |
|||
display: block; |
|||
flex-shrink: 0; |
|||
} |
|||
.item-info { |
|||
margin-left: 30rpx; |
|||
color: #333333; |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: space-between; |
|||
flex: 1; |
|||
height: 160rpx; |
|||
width: 440rpx; |
|||
} |
|||
.item-info-top { |
|||
font-size: 30rpx; |
|||
} |
|||
.item-title { |
|||
font-weight: 500; |
|||
white-space: nowrap; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
margin-bottom: 6rpx; |
|||
} |
|||
.item-info-bottom { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
} |
|||
.item-info-bottom text { |
|||
color: #E14135; |
|||
} |
|||
.info-btn { |
|||
width: 160rpx; |
|||
text-align: center; |
|||
line-height: 50rpx; |
|||
height: 50rpx; |
|||
background: linear-gradient(0deg, #FFCC24, #FF9124); |
|||
border-radius: 25rpx; |
|||
color: #fff; |
|||
margin-left: 20rpx; |
|||
} |
|||
.list { |
|||
padding-top: 80rpx; |
|||
} |
|||
.item-bottom { |
|||
display: flex; |
|||
padding: 20rpx 30rpx; |
|||
border-top: 1rpx solid #d8d8d8; |
|||
justify-content: flex-end; |
|||
} |
|||
.info-btn-new { |
|||
background: #fff; |
|||
border: 2rpx solid; |
|||
color: #FF9124; |
|||
box-sizing: border-box; |
|||
} |
|||
.empty-btn { |
|||
width: 240rpx; |
|||
height: 80rpx; |
|||
background: linear-gradient(0deg, #E14135, #FF9124); |
|||
border-radius: 40rpx; |
|||
line-height: 80rpx; |
|||
text-align: center; |
|||
color: #fff; |
|||
margin-top: 100rpx; |
|||
font-size: 30rpx; |
|||
} |
|||
.list-title { |
|||
line-height: 50rpx; |
|||
color: #333; |
|||
margin: 0 40rpx; |
|||
margin-top: 30rpx; |
|||
font-size: 30rpx; |
|||
} |
|||
@ -1,5 +1,6 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"title":"/pages/component/TitleHeader" |
|||
"title":"/pages/component/TitleHeader", |
|||
"date":"/pages/order/components/date/index" |
|||
} |
|||
} |
|||
Loading…
Reference in new issue