diff --git a/app.js b/app.js
index 3228d7e..aee4c50 100644
--- a/app.js
+++ b/app.js
@@ -100,6 +100,8 @@ App({
JIANSHEYINHANG:"建行支付",
ZHIFUBAO:"支付宝支付"
},
- kjId:null
+ kjId:null,
+ gp_id:null,
+ team_id:null
}
})
\ No newline at end of file
diff --git a/app.json b/app.json
index 6be562c..23a0161 100644
--- a/app.json
+++ b/app.json
@@ -125,7 +125,10 @@
"pages/kj/index",
"pages/kj/his/index",
"pages/kj/info/index",
- "pages/kj/mine/index"
+ "pages/kj/mine/index",
+ "pages/group/index",
+ "pages/group/mine/index",
+ "pages/group/info/index"
],
"permission": {
"scope.userLocation": {
diff --git a/pages/component/myCalendar/index.js b/pages/component/myCalendar/index.js
index d991505..d338df6 100644
--- a/pages/component/myCalendar/index.js
+++ b/pages/component/myCalendar/index.js
@@ -31,11 +31,11 @@ Component({
isToday: 0,
isTodayWeek: false,
todayIndex: 0,
- isKj:null
+ isKj:null,
+ isGp:null
},
lifetimes: {
attached: function() {
- console.log(app.globalData)
let now = new Date();
let year = now.getFullYear();
let month = now.getMonth() + 1;
@@ -44,7 +44,8 @@ Component({
year: year,
month: month,
isToday: '' + year + month + now.getDate(),
- isKj:app.globalData.kjId
+ isKj:app.globalData.kjId,
+ isGp:app.globalData.gp_id || app.globalData.team_id
})
let dates={}
this.properties.datelist.map(item=>{
diff --git a/pages/group/index.js b/pages/group/index.js
new file mode 100644
index 0000000..72b8355
--- /dev/null
+++ b/pages/group/index.js
@@ -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"
+ }
+ }
+ }
+})
\ No newline at end of file
diff --git a/pages/group/index.json b/pages/group/index.json
new file mode 100644
index 0000000..35cf02f
--- /dev/null
+++ b/pages/group/index.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {
+ "title":"/pages/component/TitleHeader"
+ }
+}
\ No newline at end of file
diff --git a/pages/group/index.wxml b/pages/group/index.wxml
new file mode 100644
index 0000000..dc768bc
--- /dev/null
+++ b/pages/group/index.wxml
@@ -0,0 +1,62 @@
+
+
+ 热门团购
+
+
+
+
+ {{item.title+item.sku_name}}
+
+ ¥{{item.event_price/100}}
+ ¥{{item.price/100}}
+
+
+
+
+
+
+ 精品团购
+
+
+ {{item.gp_num}}人团
+
+
+ {{item.title+item.sku_name}}
+ 剩余库存:{{item.left_stock_num}}
+ 团购成功:{{item.stock_num-item.left_stock_num}}
+
+
+ ¥{{item.event_price/100}}
+ ¥{{item.price/100}}
+ 售罄
+ 团购
+
+
+
+
+
+ 我的
+ 团购
+
+
+
+
+ 您有一个团购正在进行中
+ 倒计时
+
+ {{ingGroup[0].h}}
+ :
+ {{ingGroup[0].m}}
+ :
+ {{ingGroup[0].s}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/group/index.wxss b/pages/group/index.wxss
new file mode 100644
index 0000000..71b3f5f
--- /dev/null
+++ b/pages/group/index.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/pages/group/info/index.js b/pages/group/info/index.js
new file mode 100644
index 0000000..ef8acf1
--- /dev/null
+++ b/pages/group/info/index.js
@@ -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
+ }
+ }
+ }
+})
\ No newline at end of file
diff --git a/pages/group/info/index.json b/pages/group/info/index.json
new file mode 100644
index 0000000..35cf02f
--- /dev/null
+++ b/pages/group/info/index.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {
+ "title":"/pages/component/TitleHeader"
+ }
+}
\ No newline at end of file
diff --git a/pages/group/info/index.wxml b/pages/group/info/index.wxml
new file mode 100644
index 0000000..954ac6a
--- /dev/null
+++ b/pages/group/info/index.wxml
@@ -0,0 +1,115 @@
+
+
+
+
+
+ {{info.gp_num}}人团
+
+
+ {{info.title+info.sku_name}}
+ 剩余库存:{{info.left_stock_num}}
+
+
+ ¥{{info.event_price/100}}
+ ¥{{info.price/100}}
+
+
+ 详情 >
+
+
+
+ 还差{{info.gp_num - myIngList.team_list.length}}人
+ 成团立享超值优惠
+ 倒计时
+
+ {{myIngList.h}}
+ :
+ {{myIngList.m}}
+ :
+ {{myIngList.s}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 团购未满规定人数 已失败
+
+ 原价购买
+ 再开一单
+
+
+
+
+
+ 团购活动已人满 团购成功
+
+ 再开一单
+
+
+
+
+
+ 团购活动已结束
+
+ 查看其它活动
+
+
+
+
+
+ 发起团购
+
+ 拼团规则
+
+
+
+ {{item.nickname}}
+ 还差{{info.gp_num - item.team_num}}人
+
+ 参团
+ 剩余{{item.h}}:{{item.m}}:{{item.s}}
+
+
+
+
+ 拼团规则
+
+
+
+ 商品推荐
+ 更多 >
+
+
+
+
+
+ {{item.productName+item.skuName}}
+
+ ¥{{item.eventPrice/100}}
+ ¥{{item.price/100}}
+
+
+
+
+
+
+
+
+ 请先关注公众号
+
+ 长按保存二维码
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/group/info/index.wxss b/pages/group/info/index.wxss
new file mode 100644
index 0000000..d445fdf
--- /dev/null
+++ b/pages/group/info/index.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/pages/group/mine/index.js b/pages/group/mine/index.js
new file mode 100644
index 0000000..8867874
--- /dev/null
+++ b/pages/group/mine/index.js
@@ -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 () {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/group/mine/index.json b/pages/group/mine/index.json
new file mode 100644
index 0000000..35cf02f
--- /dev/null
+++ b/pages/group/mine/index.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {
+ "title":"/pages/component/TitleHeader"
+ }
+}
\ No newline at end of file
diff --git a/pages/group/mine/index.wxml b/pages/group/mine/index.wxml
new file mode 100644
index 0000000..583f97d
--- /dev/null
+++ b/pages/group/mine/index.wxml
@@ -0,0 +1,60 @@
+
+
+
+
+ 我发起的
+
+
+
+
+
+ {{item.title+item.sku_name}}
+ ¥{{item.event_price/100}}
+
+
+ 已结束
+ {{item.timeText}}后结束
+ 查看详情
+
+
+ 成团日期:{{item.finish_time}}
+
+
+
+
+ 查看订单
+
+
+ 我参与的
+
+
+
+
+
+ {{item.title+item.sku_name}}
+ ¥{{item.event_price/100}}
+
+
+ 已结束
+ {{item.timeText}}后结束
+ 查看详情
+
+
+ 成团日期:{{item.finish_time}}
+
+
+
+
+ 查看订单
+
+
+
+
+
+ 您暂时还未参加拼团活动
+ 您暂时还未参团成功
+ 立即前往
+
\ No newline at end of file
diff --git a/pages/group/mine/index.wxss b/pages/group/mine/index.wxss
new file mode 100644
index 0000000..13ea813
--- /dev/null
+++ b/pages/group/mine/index.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/pages/info/museumInfo/index.js b/pages/info/museumInfo/index.js
index 51c1725..a460032 100644
--- a/pages/info/museumInfo/index.js
+++ b/pages/info/museumInfo/index.js
@@ -17,7 +17,11 @@ Page({
actList:[],
actTotal:1,
id:null,
- fixed:false
+ fixed:false,
+ isLogin:false,
+ product:null,
+ time:null,
+ date:null
},
/**
@@ -31,9 +35,23 @@ Page({
id:options.id
}).then(res=>{
// res.data.listimg = res.data.listimg?res.data.listimg.split(","):[];
- this.setData({
- info:res.data
- })
+ if(res.data.product_venue && res.data.product_venue.sku && res.data.product_venue.sku[0]){
+ let product = {
+ product:res.data.product_venue,
+ sku:res.data.product_venue.sku[0]
+ };
+ app.globalData.product = product;
+ this.setData({
+ info:res.data,
+ product:product
+ })
+ }
+ else {
+ this.setData({
+ info:res.data
+ })
+ }
+
this.BroswerRecord();
})
this.getAct()
@@ -95,14 +113,29 @@ Page({
*/
onReady: function () {
+ },
+ // 修改日期
+ changeDate:function(e){
+ this.setData({
+ date:e.detail
+ })
+ },
+ // 修改分时
+ changeTime:function(e){
+ this.setData({
+ time:e.detail
+ })
},
order:function(){
if(!this.data.info.product_venue) return;
if(!this.data.info.product_venue.sku[0]) return;
app.globalData.couponInfo = null;
+ // 如果在当前的详情页面选择了日期时间的话 那么需要修改日期时间
app.globalData.product = {
product:this.data.info.product_venue,
- sku:this.data.info.product_venue.sku[0]
+ sku:this.data.info.product_venue.sku[0],
+ infoDate:this.data.date,
+ infoTime:this.data.time
}
wx.navigateTo({
url: '/pages/order/scene/index?type=museum'
@@ -113,7 +146,15 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ if(!this.data.isLogin){
+ commonApi.user_post("token/check").then(res=>{
+ if(res.code==1){
+ this.setData({
+ isLogin:true
+ })
+ }
+ })
+ }
},
/**
@@ -127,7 +168,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+ app.globalData.product = null;
},
/**
diff --git a/pages/info/museumInfo/index.json b/pages/info/museumInfo/index.json
index 35cf02f..5e61cff 100644
--- a/pages/info/museumInfo/index.json
+++ b/pages/info/museumInfo/index.json
@@ -1,5 +1,6 @@
{
"usingComponents": {
- "title":"/pages/component/TitleHeader"
+ "title":"/pages/component/TitleHeader",
+ "date":"/pages/order/components/date/index"
}
}
\ No newline at end of file
diff --git a/pages/info/museumInfo/index.wxml b/pages/info/museumInfo/index.wxml
index 25e879f..1108b8c 100644
--- a/pages/info/museumInfo/index.wxml
+++ b/pages/info/museumInfo/index.wxml
@@ -21,6 +21,7 @@
+
预订须知
场馆介绍
diff --git a/pages/kj/index.js b/pages/kj/index.js
index 11cae76..5a59267 100644
--- a/pages/kj/index.js
+++ b/pages/kj/index.js
@@ -34,28 +34,20 @@ Page({
})
this.getList()
})
+ this.getNext()
},
changeType:function(e){
let type = e.currentTarget.dataset.type;
if(this.data.type==type) return;
this.setData({
- type:type,
- nextPage:1,
- page:1,
- nextTotal:1,
- total:1,
- list:[],
- nextList:[]
+ type:type
})
- this.onReachBottom()
},
changeMenu:function(e){
let index = e.currentTarget.dataset.index;
if(this.data.menuIndex==index) return;
this.setData({
menuIndex:index,
- page:1,
- total:1,
list:[]
})
this.getList()
@@ -160,9 +152,7 @@ Page({
getList:function(){
if(this.data.total==this.data.list.length) return;
let dataStr = this.getStrParams({
- act_id:this.data.menuList[this.data.menuIndex].id,
- limit:100,
- page:this.data.page
+ act_id:this.data.menuList[this.data.menuIndex].id
})
productApi.user_post("activity.haggle/get_act_products"+dataStr,{
diff --git a/pages/order/components/contact/index.js b/pages/order/components/contact/index.js
index d75d75e..20b5c7e 100644
--- a/pages/order/components/contact/index.js
+++ b/pages/order/components/contact/index.js
@@ -207,33 +207,45 @@ Component({
},
selectIt:function(e){
let item = e.currentTarget.dataset.item,linkmanList = this.data.linkmanList,num = 0,traveller_limit_num = this.properties.maxNum!=-1?this.properties.maxNum:app.globalData.product.sku.sku_model.traveller_limit_num;
+ // 先计算出全部选中的出行人
linkmanList.map(linkman=>{
- if(this.properties.maxNum!=-1 && num==traveller_limit_num && item.id==linkman.id){
- wx.showToast({
- title: '最多只能选择'+this.properties.maxNum+"个出行人",
- icon:'none'
- })
- }
- else if(traveller_limit_num!=0 && num==traveller_limit_num && item.id==linkman.id){
- wx.showToast({
- title: '出行人限购'+traveller_limit_num+"份",
- icon:'none'
- })
- }
- else if(app.globalData.kjId && num==1){
- wx.showToast({
- title: '最多只能选择一个出行人',
- icon:'none'
- })
+ if(linkman.selected==1){
+ num++;
}
- else if(item.id==linkman.id){
- linkman.selected = item.selected==1?0:1;
- if(linkman.selected){
- num++;
- }
- else {
- num--;
- }
+ })
+ console.log(traveller_limit_num,num,item)
+ // 如果是要新增选中 并且当前选中数量已经超过或者等于了最大出行人限制
+ if((app.globalData.kjId) && num==1 && item.selected!=1){
+ wx.showToast({
+ title: '最多只能选择一个出行人',
+ icon:'none'
+ })
+ return;
+ }
+ else if((app.globalData.gp_id || app.globalData.team_id) && num>=app.globalData.product.maxNum && item.selected!=1){
+ wx.showToast({
+ title: '最多只能选择'+app.globalData.product.maxNum+'个出行人',
+ icon:'none'
+ })
+ return;
+ }
+ else if(this.properties.maxNum!=-1 && item.selected!=1 && num>=traveller_limit_num){
+ wx.showToast({
+ title: '最多只能选择'+this.properties.maxNum+"个出行人",
+ icon:'none'
+ })
+ return;
+ }
+ else if(item.selected!=1 && traveller_limit_num!=0 && num>=traveller_limit_num){
+ wx.showToast({
+ title: '出行人限购'+traveller_limit_num+"份",
+ icon:'none'
+ })
+ return;
+ }
+ linkmanList.map(linkman=>{
+ if(item.id==linkman.id){
+ linkman.selected = linkman.selected==1?0:1;
}
})
this.setData({
diff --git a/pages/order/components/date/index.js b/pages/order/components/date/index.js
index 1536273..c0c9f78 100644
--- a/pages/order/components/date/index.js
+++ b/pages/order/components/date/index.js
@@ -29,13 +29,14 @@ Component({
timelist:[],
timeIndex:0,
isSzMuseum:false,
- kjIdCom:null
+ kjIdCom:null,
+ gpIdCom:null
},
lifetimes: {
attached: function() {
- console.log(app.globalData,11111111)
this.setData({
- kjIdCom:app.globalData.kjId
+ kjIdCom:app.globalData.kjId,
+ gpIdCom:app.globalData.gp_id || app.globalData.team_id
})
// 在组件实例进入页面节点树时执行
let product = app.globalData.product,today = util.formatDate(new Date()),end_date = util.formatDate(new Date(new Date().getTime() + 60 * 24 * 60 * 60 * 1000));
@@ -52,16 +53,33 @@ Component({
end_date:end_date,
sku_id:product.sku.id
}).then(res=>{
- for(let i=0;i0){
- this.setData({
- activeDate:res.data[i]
- })
- this.getTimeStock()
- this.triggerEvent("onChangeDate",this.data.activeDate)
- break;
+ // 如果之前已经在详情页面选择了日期的话 默认日期不能是第一个有库存的日期了
+ if(app.globalData.product.infoDate){
+ this.setData({
+ activeDate:app.globalData.product.infoDate
+ })
+ this.getTimeStock()
+ this.triggerEvent("onChangeDate",app.globalData.product.infoDate)
+ }
+ else {
+ for(let i=0;i0){
+ this.setData({
+ activeDate:res.data[i]
+ })
+ this.getTimeStock()
+ this.triggerEvent("onChangeDate",this.data.activeDate)
+ break;
+ }
}
}
+ if(this.data.gpIdCom){
+ // 拼团的话 价格日历无效 所有价格都是sku里面的event_price
+ res.data.map(item=>{
+ item.price = product.sku.event_price
+ })
+ }
+
this.setData({
datelist:res.data
})
@@ -82,7 +100,8 @@ Component({
pageLifetimes:{
show:function(){
this.setData({
- kjIdCom:app.globalData.kjId
+ kjIdCom:app.globalData.kjId,
+ gpIdCom:app.globalData.gp_id || app.globalData.team_id
})
}
},
@@ -138,6 +157,15 @@ Component({
sku_id:app.globalData.product.sku.id
}).then(res=>{
let timeIndex = -1;
+ if(app.globalData.product.infoTime){
+ this.triggerEvent("onChangeTime",app.globalData.product.infoTime);
+ timeIndex = res.data.findIndex(item=>item.start_time==app.globalData.product.infoTime.start_time)
+ this.setData({
+ timelist:res.data,
+ timeIndex:timeIndex
+ })
+ return;
+ }
for(let i=0;i0){
timeIndex = i;
diff --git a/pages/order/components/date/index.wxml b/pages/order/components/date/index.wxml
index 0adb5f3..6db7808 100644
--- a/pages/order/components/date/index.wxml
+++ b/pages/order/components/date/index.wxml
@@ -8,14 +8,6 @@
售罄
-
更多
@@ -25,16 +17,16 @@
- {{item.start_time}}-{{item.end_time}} 有票({{item.stock_number==-1?'无限':('余票'+item.stock_number)}})
-
-
-
+ {{item.start_time}}-{{item.end_time}} 有票 无票({{item.stock_number==-1?'无限':('余票'+item.stock_number)}})
+
-
+
\ No newline at end of file
diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js
index 1d1245a..8cd3897 100644
--- a/pages/order/postOrder/index.js
+++ b/pages/order/postOrder/index.js
@@ -14,7 +14,8 @@ Page({
postFee:0,
coupon:null,
sku_id:'',
- kjId:null
+ kjId:null,
+ gp_id:null
},
/**
@@ -23,14 +24,17 @@ Page({
onLoad: function (options) {
this.setData({
from:options.from,
- kjId:app.globalData.kjId
+ kjId:app.globalData.kjId,
+ gp_id:app.globalData.gp_id || app.globalData.team_id
})
let price = 0,sku_id=[];
- console.log(app.globalData.kjId)
app.globalData.postProduct.map(item=>{
- if(!app.globalData.kjId){
+ if(!app.globalData.kjId && !this.data.gp_id){
price = price + item.sku.price * item.productNum;
}
+ else if(this.data.gp_id){
+ price = price + item.sku.event_price * item.productNum;
+ }
sku_id.push(item.sku.id)
})
this.setData({
@@ -38,7 +42,7 @@ Page({
showPrice:app.globalData.kjId?0:price,
sku_id:sku_id.join(",")
})
- if(!this.data.kjId){
+ if(!this.data.kjId && !this.data.gp_id){
this.couponCom = this.selectAllComponents("#coupon")[0];
}
@@ -90,7 +94,7 @@ Page({
icon: 'none'
})
app.globalData.couponInfo = null;
- if(!this.data.kjId){
+ if(!this.data.kjId && !this.data.gp_id){
this.couponCom.setNullCoupon()
}
this.setData({
@@ -125,7 +129,9 @@ Page({
source:"WECHATXCX",
product_list:product_list,
coupon:this.data.coupon?this.data.coupon.id:null,
- originate_order_id:this.data.kjId
+ originate_order_id:this.data.kjId,
+ gp_id:app.globalData.gp_id,
+ team_id:app.globalData.team_id
};
commonApi.user_post("order/create",{
data:JSON.stringify(data)
@@ -137,6 +143,12 @@ Page({
})
this.onLoad({})
}
+ app.globalData.gp_id = null;
+ app.globalData.team_id = null;
+ this.setData({
+ gp_id:null
+ })
+ this.onLoad({});
})
},
getPostFee:function(){
@@ -173,7 +185,7 @@ Page({
icon: 'none'
})
app.globalData.couponInfo = null;
- if(!this.data.kjId){
+ if(!this.data.kjId && !this.data.gp_id){
this.couponCom.setNullCoupon()
}
this.setData({
@@ -215,9 +227,12 @@ Page({
*/
onUnload: function () {
this.setData({
- kjId:null
+ kjId:null,
+ gp_id:null
});
app.globalData.kjId = null;
+ app.globalData.gp_id = null;
+ app.globalData.team_id = null;
},
/**
diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml
index df533c6..a2d0663 100644
--- a/pages/order/postOrder/index.wxml
+++ b/pages/order/postOrder/index.wxml
@@ -21,9 +21,9 @@
购票数量
-
+
{{item.productNum}}
-
+
运费
@@ -37,7 +37,7 @@
小计:¥{{item.sku.price/100 * item.productNum}}
-
+
合计:¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}}
diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js
index 36986d9..4619ba7 100644
--- a/pages/order/scene/index.js
+++ b/pages/order/scene/index.js
@@ -18,7 +18,8 @@ Page({
type:null,
coupon:app.globalData.couponInfo,
isLogin:false,
- kjId:null
+ kjId:null,
+ gp_id:null
},
/**
@@ -27,17 +28,23 @@ Page({
onLoad: function (options) {
this.setData({
type:options.type,
- kjId:app.globalData.kjId
+ kjId:app.globalData.kjId,
+ gp_id:app.globalData.gp_id || app.globalData.team_id
})
if(!app.globalData.product){
util.back();
return;
}
+ if(app.globalData.product.productNum){
+ this.setData({
+ productNum:app.globalData.product.productNum<1?1:app.globalData.product.productNum
+ })
+ }
this.setData({
product:app.globalData.product,
- singlePrice:app.globalData.product.sku.price
+ singlePrice:this.data.gp_id?app.globalData.product.sku.event_price:app.globalData.product.sku.price
})
- if(!this.data.kjId){
+ if(!this.data.kjId && !this.data.gp_id){
this.couponCom = this.selectAllComponents("#coupon")[0];
}
},
@@ -48,7 +55,7 @@ Page({
title: '订单价格发生变化,请重新选择优惠券',
icon: 'none'
})
- if(!this.data.kjId){
+ if(!this.data.kjId && !this.data.gp_id){
this.couponCom.setNullCoupon()
}
app.globalData.couponInfo = null;
@@ -56,8 +63,12 @@ Page({
coupon:null
})
}
+ let productNum = linkmanList.length==0?1:linkmanList.length;
+ if(this.data.gp_id){
+ productNum = app.globalData.product.maxNum;
+ }
this.setData({
- productNum:linkmanList.length==0?1:linkmanList.length,
+ productNum:productNum,
linkmanList:linkmanList
})
},
@@ -81,7 +92,7 @@ Page({
icon: 'none'
})
}
- if(!this.data.kjId){
+ if(!this.data.kjId && !this.data.gp_id){
this.couponCom.setNullCoupon()
}
app.globalData.couponInfo = null;
@@ -99,14 +110,14 @@ Page({
this.setData({
coupon:null
})
- if(!this.data.kjId){
+ if(!this.data.kjId && !this.data.gp_id){
this.couponCom.setNullCoupon()
}
app.globalData.couponInfo = null;
}
this.setData({
date:e.detail,
- singlePrice:e.detail.price
+ singlePrice:this.data.gp_id?this.data.product.sku.event_price:e.detail.price
})
console.log(e.detail)
},
@@ -161,7 +172,9 @@ Page({
remark:remark,
product_num:productNum
}],
- originate_order_id:this.data.kjId
+ originate_order_id:this.data.kjId,
+ gp_id:app.globalData.gp_id,
+ team_id:app.globalData.team_id
}
commonApi.user_post("order/create",{
data:JSON.stringify(data)
@@ -172,6 +185,12 @@ Page({
});
app.globalData.kjId = null;
}
+ if(app.globalData.gp_id){
+ this.setData({
+ gp_id:null
+ });
+ app.globalData.gp_id = null;
+ }
})
},
@@ -212,9 +231,11 @@ Page({
*/
onUnload: function () {
this.setData({
- kjId:null
+ kjId:null,
+ gp_id:null
});
app.globalData.kjId = null;
+ app.globalData.gp_id = null;
},
/**
diff --git a/pages/order/scene/index.wxml b/pages/order/scene/index.wxml
index 61c0357..455e630 100644
--- a/pages/order/scene/index.wxml
+++ b/pages/order/scene/index.wxml
@@ -8,13 +8,13 @@
购票数量
-
+
{{productNum}}
-
+
-
+
订单备注
diff --git a/project.private.config.json b/project.private.config.json
index 356af4e..f22233a 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -25,8 +25,8 @@
"scene": null
},
{
- "name": "pages/list/activitynew/index",
- "pathName": "pages/list/activitynew/index",
+ "name": "pages/group/index",
+ "pathName": "pages/group/index",
"query": "id=0000000000LINELINEINFO18082257199008",
"scene": null
},
diff --git a/utils/https.js b/utils/https.js
index bec3577..ebfd83b 100644
--- a/utils/https.js
+++ b/utils/https.js
@@ -1,8 +1,8 @@
var app = getApp();
import util from "../utils/util"
import userApi from "../utils/https/user.js";
-// const baseUrl = "https://test.api.cloud.sz-trip.com/api/";
-const baseUrl = "https://api.cloud.sz-trip.com/api/";
+const baseUrl = "https://test.api.cloud.sz-trip.com/api/";
+// const baseUrl = "https://api.cloud.sz-trip.com/api/";
const orders = ['','weight','distance','sale_number','sale_price','price'];
//封装GET请求
function _get(url,data) {
diff --git a/utils/util.js b/utils/util.js
index 1866ef6..429c941 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -317,6 +317,7 @@ const gotoOrder = function(item){
}
}
// 砍价的去下单
+// 拼团去下单也适用
const goKjOrder = function(item) {
return new Promise((resolve,reject)=>{
commonApi._post("product/get_product_detail",{