diff --git a/app.json b/app.json index 3a5244d..61e3f63 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,7 @@ { "pages": [ "pages/index/index", + "pages/spellGroup/spellGroup", "pages/complete/index", "pages/main/index", "pages/bargain/bargainDatail/bargainDatail", diff --git a/components/spellbanner/index.js b/components/spellbanner/index.js new file mode 100644 index 0000000..a72f773 --- /dev/null +++ b/components/spellbanner/index.js @@ -0,0 +1,45 @@ +// pages/index/sw/index.js +const imgurl = require("../../utils/imgurl"); +Component({ + /** + * 组件的属性列表 + */ + properties: { + list: { + value: [], + type: Array + } + }, + + /** + * 组件的初始数据 + */ + data: { + swiperCurrent: 0, + bannerUrl: imgurl.banner.url + }, + + /** + * 组件的方法列表 + */ + ready() {}, + methods: { + swiperChange: function(e) { + this.setData({ + swiperCurrent: e.detail.current + }); + }, + gotobannerdetail: function(e) { + console.log(e) + if(e.currentTarget.dataset.data.type==2){ + wx.navigateTo({ + url: `/pages/freeBannerDetail/index?id=${e.currentTarget.dataset.id}` + }); + }else{ + wx.navigateTo({ + url: `/pages/bannerdetail/index?id=${e.currentTarget.dataset.id}` + }); + } + } + } +}); diff --git a/components/spellbanner/index.json b/components/spellbanner/index.json new file mode 100644 index 0000000..3bd5dd3 --- /dev/null +++ b/components/spellbanner/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + + } +} \ No newline at end of file diff --git a/components/spellbanner/index.wxml b/components/spellbanner/index.wxml new file mode 100644 index 0000000..cedae0e --- /dev/null +++ b/components/spellbanner/index.wxml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/spellbanner/index.wxss b/components/spellbanner/index.wxss new file mode 100644 index 0000000..95bb9b0 --- /dev/null +++ b/components/spellbanner/index.wxss @@ -0,0 +1,51 @@ +.index-slide-view{ + position: relative; + width: 710rpx; + height: 260rpx; + overflow: hidden; + /* margin:-132rpx auto 0; */ + border-radius:16rpx; + box-shadow: 0 6px 20px 0 rgba(0,0,0,0.15); + } + .index-slide, + swiper-item + .index-slide-image { + display: block; + width: 710rpx; + height: 260rpx; + margin: 0 auto; + border-radius:16rpx; + overflow: hidden; + position: relative; + + } + .index-slide-view .dots{ + position: absolute; + left: 0; + right: 0; + bottom: 20rpx; + display: flex; + justify-content: center; + } + .index-slide-view .dots .dot{ + margin: 0 8rpx; + width: 12rpx; + height: 12rpx; + background: #b6b6b7; + border-radius: 50%; + transition: all .6s; + } + .index-slide-view .dots .dot.active{ + background: #02C0FF; + width: 30rpx; + height: 12rpx; + border-radius:10rpx; + opacity: 1; + } + .bannerbg{ + width: 100%; + } + .bannerbg image{ + display: block; + width: 100%; + } \ No newline at end of file diff --git a/config/config.js b/config/config.js index bcc11a4..cd09cac 100755 --- a/config/config.js +++ b/config/config.js @@ -220,7 +220,11 @@ var config = { /** * 领取转赠卡 */ - cardAccept:'/couponOrder/cardAccept' + cardAccept:'/couponOrder/cardAccept', + /** + * 获取我的拼团列表 + */ + getMySepllList:'/orderGroup/queryOrderGroup' }, weapp: { AppId: weappId diff --git a/pages/main/index.js b/pages/main/index.js index f2584bb..351ec02 100644 --- a/pages/main/index.js +++ b/pages/main/index.js @@ -10,6 +10,7 @@ Page({ icon002: imgurl.icon002.url, icon003: imgurl.icon003.url, icon004: imgurl.icon004.url, + sapellgroup: imgurl.sapellgroup.url, market: app.globalData.market, list: [], loading: true, @@ -37,6 +38,11 @@ Page({ url: '/pages/rushToBuy/index', }) }, + gotoSpellGroup:function(){ + wx.navigateTo({ + url: '/pages/spellGroup/spellGroup', + }) + }, qrcode: function(e) { var that = this; that.setData({ diff --git a/pages/main/index.wxml b/pages/main/index.wxml index eada370..97b726b 100644 --- a/pages/main/index.wxml +++ b/pages/main/index.wxml @@ -11,6 +11,10 @@ 消费卡 + + + 拼团专场 + 砍价专场 diff --git a/pages/spellGroup/spellGroup.js b/pages/spellGroup/spellGroup.js new file mode 100644 index 0000000..cbb3403 --- /dev/null +++ b/pages/spellGroup/spellGroup.js @@ -0,0 +1,302 @@ +var config = require("../../config/config.js"); +const Http = require("../../utils/HttpBasics"); +const imgurl = require("../../utils/imgurl"); +Page({ + /** + * 页面的初始数据 + */ + data: { + bannerUrl: imgurl.banner.url, + loadingUrl: imgurl.loading.url, + bargaingoods: true, + mybargain: false, + list: [], + lists: [], + page: 1, // 设置加载的第几次,默认是第一次 + pageSize: 10, //返回数据的个数 + searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏 + allow_load: true, // 是否允许继续加载标识 默认 true 允许,false 加载完成 + myorder: false, + actUrl: imgurl.act.url, + loadingUrl: imgurl.loading.url, + flag: 'bargaingoods', + }, + onLoad: function () { + let that = this; + that.getBannerlist(); + var todayDate = new Date().getTime(); + that.setData({ + todayDate: todayDate + }) + that.getList(1, "bargaingoods"); + that.setData({ + flag: "bargaingoods", + bargaingoods: true, + mybargain: false + }) + }, + //切换拼团列表 + getSpellList(){ + this.setData({ + flag: "bargaingoods" + }) + this.getList(1, "bargaingoods") + }, + //切换我的拼团 + getmyList(){ + this.setData({ + flag: "mybargain" + }) + this.getList(1, "mybargain") + }, + /** + * banner + */ + getBannerlist: function () { + let that = this; + Http.get({ + url: config.api.bannerlist, + data: { + pageNum: 1, + pageSize: 7 + } + }).then(res => { + that.setData({ + list: res.data.list + }); + }); + }, + getList(pageNum, flag) { + var that = this; + console.log(pageNum) + if (that.data.allow_load) { + /** + * mybargain: 我的砍价 + * bargaingoods: 砍价商品 + */ + that.setData({ + loading: true, + content: '小主,我在玩命加载中...' + }) + var param = {}; + if (flag == 'mybargain') { + that.setData({ + flag: "mybargain" + }) + var param = { + pageNum: pageNum, + pageSize: 10 + }; + var url = config.api.getMySepllList; + } else if (flag == 'bargaingoods') { + that.setData({ + flag: "bargaingoods" + }) + var param = { + pageNum: pageNum, + pageSize: 10, + targetAd: 7 + }; + var url = config.api.couponChannelList; + } + // 请求接口 + Http.get({ + url: url, + data: param + }).then(res => { + console.log(res) + /** + * 加载完成 + */ + if (pageNum >= res.data.pages) { + if (res.data.pages == 0 || res.data.pages == 1) { + that.setData({ + allow_load: true, + loading: false, + content: "" + }); + } else { + that.setData({ + allow_load: false, + loading: true, + content: "——— 再拉裤子就掉了啦 ———", + }); + } + } + if (pageNum == 1) { + that.setData({ + lists: [], + }) + } + if (flag == 'bargaingoods') { + var tmpArr = that.data.lists; + tmpArr.push.apply(tmpArr, res.data.list); + that.setData({ + lists: tmpArr + }) + } else if (flag == 'mybargain') { + console.log(res.data.list) + var tmpArr = that.data.lists; + tmpArr.push.apply(tmpArr, res.data.list); + console.log(tmpArr) + let lists = []; + tmpArr.map(file => { + if (file.orderStatus != 1) { + lists.push(file); + } + }) + that.setData({ + lists: lists + }) + } + wx.stopPullDownRefresh(); + }) + .catch(err => { + wx.stopPullDownRefresh(); + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400); + } else { + that.setData({ + loading: true, + content: "——— 再拉裤子就掉了啦 ———" + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400) + } + }, + /** + * 如果是重新砍价,需要重新下单 + */ + orderSave: function (couponId, couponChannelId) { + Http.post({ + url: config.api.orderSave, + data: { + couponId: "" + couponId, + couponChannelId: "" + couponChannelId, + press: true + } + }) + .then(res => { + console.log(res) + wx.navigateTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.orderNumber}` + }) + }) + .catch(err => { + wx.showToast({ + title: err.message, + icon: "none" + }) + }) + }, + inviteFriend: function (e) { + /** + * 添加标识 + */ + wx.navigateTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${e.currentTarget.dataset.id}` + }) + }, + barginAgain: function (e) { + let that = this; + console.log(e) + let couponId = e.currentTarget.dataset.couponid; + let couponChannelId = e.currentTarget.dataset.couponchannelid; + // let orderId = e.currentTarget.dataset.id; + that.orderSave(couponId, couponChannelId) + }, + mybargain: function () { + let that = this; + that.setData({ + bargaingoods: false, + mybargain: true, + flag: "mybargain", + allow_load: true, + loading: false, + content: "", + page: 1 + }) + that.getList(1, 'mybargain'); + wx.setNavigationBarTitle({ + title: '我的砍价' + }) + }, + bargaingoods: function () { + let that = this; + that.setData({ + bargaingoods: true, + mybargain: false, + flag: "bargaingoods", + allow_load: true, + loading: false, + page: 1, + content: "" + }) + + that.getList(1, 'bargaingoods'); + wx.setNavigationBarTitle({ + title: '砍价专场' + }) + }, + /** + * + * @param {砍价} 邀请好友砍价 + */ + invite: function (e) { + let couponChannelId = e.currentTarget.dataset.id; + let couponId = e.currentTarget.dataset.couponid; + if (couponChannelId && couponId) { + wx.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}` + }) + } + }, + //加载更多 + onReachBottom: function () { + let that = this; + that.data.page++; + that.setData({ + page: that.data.page + }); + that.getList(that.data.page, that.data.flag); + }, + /** +* 刷新 +*/ + onPullDownRefresh: function (e) { + let that = this; + if (that.data.flag == 'bargaingoods') { + that.getBannerlist(); + var todayDate = new Date().getTime(); + that.setData({ + todayDate: todayDate + }) + that.getList(1, "bargaingoods"); + that.setData({ + flag: "bargaingoods", + bargaingoods: true, + mybargain: false + }) + } else if (that.data.flag == 'mybargain') { + that.getList(1, "mybargain"); + that.setData({ + flag: "mybargain", + bargaingoods: false, + mybargain: true + }) + } + }, +}) \ No newline at end of file diff --git a/pages/spellGroup/spellGroup.json b/pages/spellGroup/spellGroup.json new file mode 100644 index 0000000..0dc6f60 --- /dev/null +++ b/pages/spellGroup/spellGroup.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "拼团专场", + "enablePullDownRefresh": true, + "navigationBarBackgroundColor":"#F13C42", + "usingComponents": { + "c-banner": "../../components/spellbanner/index", + "i-tab": "../../../dist/tab/index", + "i-tabs": "../../../dist/tabs/index" + } +} \ No newline at end of file diff --git a/pages/spellGroup/spellGroup.wxml b/pages/spellGroup/spellGroup.wxml new file mode 100644 index 0000000..36af936 --- /dev/null +++ b/pages/spellGroup/spellGroup.wxml @@ -0,0 +1,34 @@ + + + + + + + + + + + {{item.title}} + {{item.subTitle}} + {{item.pressLimitNum+'人团'}} + + + {{item.salePriceStr}} + + + {{item.priceStr}} + + + + 去拼团 + 已拼27 + + + + + 拼团商品 + 我的拼团 + + \ No newline at end of file diff --git a/pages/spellGroup/spellGroup.wxss b/pages/spellGroup/spellGroup.wxss new file mode 100644 index 0000000..6748c1b --- /dev/null +++ b/pages/spellGroup/spellGroup.wxss @@ -0,0 +1,197 @@ +/* pages/spellGroup/spellGroup.wxss */ +page { + height: auto; + overflow: auto; + background-image: url('https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/spell-bg.png'); + background-size: cover; + background-repeat: no-repeat; +} +.content-box{ + height: auto; + background: #f89132; + padding-bottom: 200rpx; +} +.banner{ + margin-bottom: 20rpx; + background: none; + border-radius: 16rpx; +} +.banner .bg { + display: block; + width: 100%; +} +image{ + padding: 0; + margin: 0; +} +.banner .bannerbg image{ + display: none!important; + height: 0; + overflow: hidden; +} +.bannerimg { + display: block; + width: 710rpx; + height: 260rpx; + border-radius: 15rpx; + margin: -132rpx auto 0; +} +.banner .index-slide-view { + margin: -132rpx auto 0; +} +.top{ + position: absolute; + top: 30rpx; + width: 710rpx; + height: 260rpx; + background: #fff; + left: 20rpx; + border-radius: 16rpx; + overflow: hidden; +} +.content{ + margin-top: 320rpx; +} +.content .sepll-list{ + width: 690rpx; + height: 230rpx; + background: #fff; + border-radius: 30rpx; + margin: 30rpx auto 0; +} +.content .spell-left{ + width: 230rpx; + height: 230rpx; + float: left; +} +.content .spell-left image{ + width: 180rpx; + height: 180rpx; + margin: 25rpx; +} +.content .spell-center{ + float: left; + width: 304rpx; + height: 100%; +} +.content .tilte{ + font-size:30rpx; + font-family:PingFang-SC-Bold; + font-weight:bold; + color:rgba(51,51,51,1); + line-height:44rpx; + padding-top: 16rpx; +} +.content .remark{ + width:304rpx; + font-size:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(140,140,140,1); + line-height:44rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.content .spell-num{ + width: 95rpx; + border:1px solid rgba(255,50,50,1); + border-radius:10rpx; + font-size:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,50,50,1); + line-height:30rpx; + margin: 10rpx 0; + text-align: center; +} +.content .price{ + overflow: hidden; + margin-top: 10rpx; +} +.content .price01{ + display: inline; + font-size:50rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,50,50,1); + line-height:44rpx; +} +.content .price02{ + display: inline; + font-size: 24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + text-decoration:line-through; + color:rgba(140,140,140,1); +} +.content .price-num{ + display: inline; +} +.content .price-unit{ + display: inline; + font-size:24rpx; + margin-right: 10rpx; +} +.content .spell-right{ + float: left; + width: 156rpx; +} +.right-button{ + width:120rpx; + height:48rpx; + font-size:26rpx; + background:linear-gradient(90deg,rgba(236,59,45,1) 0%,rgba(248,98,52,1) 100%); + border-radius:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + text-align: center; + color:rgba(255,255,255,1); + line-height:44rpx; + margin: 110rpx auto 0; + margin-top: 110rpx; +} +.right-text{ + font-size:22rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(140,140,140,1); + line-height:60rpx; + text-align: center; +} +.bottom{ + width: 690rpx; + height: 85rpx; + position: fixed; + bottom: 26rpx; + left: 30rpx; + /* background:rgba(243,69,58,1); */ + border:1px solid rgba(255, 222, 67, 1); + border-radius:40px; + color: #fff; + overflow: hidden; +} +.bottom-left{ + width: 50%; + float: left; + margin-left: -1rpx; + text-align: center; + line-height: 85rpx; + font-size:30rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,253,245,1); + border-right:1px solid rgba(255, 222, 67, 1); + opacity: 1; +} +.bottom-right{ + width: 50%; + float: left; + text-align: center; + line-height: 85rpx; + font-size:30rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,253,245,1); + opacity: 1; +} \ No newline at end of file diff --git a/utils/imgurl.js b/utils/imgurl.js index bdebe91..6b9e45d 100644 --- a/utils/imgurl.js +++ b/utils/imgurl.js @@ -356,4 +356,12 @@ module.exports = { 'url': baseUrl + 'success01.png', 'name': '卡领取成功图标' }, + 'sapellgroup': { + 'url': baseUrl + 'sapellgroup.png', + 'name': '拼团图标' + }, + 'spellBg': { + 'url': baseUrl + 'spell-bg.png', + 'name': '拼团背景图片' + }, } \ No newline at end of file