From 59db24d1b671b7c930ea3aba21943c1f47ff7450 Mon Sep 17 00:00:00 2001 From: taiyuan Date: Tue, 27 Oct 2020 15:54:30 +0800 Subject: [PATCH] 积分购 --- packageA/pages/jfbuy/jfbuy.js | 359 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/jfbuy/jfbuy.json | 8 ++++++++ packageA/pages/jfbuy/jfbuy.wxml | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageA/pages/jfbuy/jfbuy.wxss | 429 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 864 insertions(+), 0 deletions(-) create mode 100644 packageA/pages/jfbuy/jfbuy.js create mode 100644 packageA/pages/jfbuy/jfbuy.json create mode 100644 packageA/pages/jfbuy/jfbuy.wxml create mode 100644 packageA/pages/jfbuy/jfbuy.wxss diff --git a/packageA/pages/jfbuy/jfbuy.js b/packageA/pages/jfbuy/jfbuy.js new file mode 100644 index 0000000..9cd3b51 --- /dev/null +++ b/packageA/pages/jfbuy/jfbuy.js @@ -0,0 +1,359 @@ +// packageA//pages/goods_share/goods_share.js +var app=getApp(),oo = app.globalData.setting,os=oo,ut = require("../../../utils/util.js"); +var regeneratorRuntime = require('../../../utils/runtime.js'); +Page({ + /** + * 页面的初始数据 + */ + data: { + // tab + tab: ['全部','价格','销量','积分值'], + currentIndex: 1, + //促销页tab + // tab2: ['订单促销','搭配促销','优惠促销'], + // currentIndex2: 0, + //秒杀和拼单底部tab + // currentIndex3: 0, + // 控制价格 + active1: false, + // 控制佣金 + active2: false, + url: oo.imghost, + //popup + hiddenPopup: true, + // 排序 + isUp: false, + //控制滚动条至顶部时开启下拉刷新 + // open: false, + requestData: null, + + list:[], + is_load:0, //是否正在加载 + is_no_data:0, //没有数据 + is_no_more:0, //没有更多数据 + key_str:'', + pattern:0, //分成的方式 + currentPage:1, //当前的页码 + + // canvasHidden: 1, //-- 隐藏画布 -- + // dis_switch:0, //-- 分销开关 -- + // pattern:0, //-- 分成的方式 -- + // share_hidden:1, //-- 分享的按钮隐藏 -- + // share_good:null, //--- 要分享的商品 --- + + // timer:0, + // hui_active:null, //优惠活动分享 + + //点击活动详情的时候的响应 + list2:[], + is_load2:0, + is_no_data2:0, //没有数据 + is_no_more2:0, //没有更多数据 + currentPage2:1, //页码 + prom_goods:null, //优惠活动的条件 + + + triggered: false, + isPullDownRefresh: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.request_list({ + store_id:oo.stoid, + stype:1, + stypeup:1 + }); + // var th=this; + // //接受有没有导购的参数 + // var first_leader=options.first_leader; + // if(first_leader){ + // //-- user_id代过来免登陆 -- + // getApp().globalData.user_id=first_leader; + // getApp().getUserFir(); + // } + + // this.requestGoodsList(); + //-- 自定义海报 -- + // getApp().request.promiseGet("/api/weshop/goods/poster/page",{ + // data:{store_id:os.stoid, type:1, is_use:1 } + // }).then(res=>{ + // if(res.data.code==0){ + + // var poster_data=res.data.data.pageData[0]; + // var json_str=poster_data.jsonStr; + + // if(json_str){ + // var json_data=JSON.parse(json_str); + // if(json_data.bg_img){ + + // //-- 把图片那到本地 -- + // wx.getImageInfo({ + // src:json_data.bg_img, + // success: function(res) { + // var path= res.path; + // th.setData({share_b_img:path}) + // }, + // fail: function(res) {} + // }); + // } + + // th.setData({poster:json_data}) + + // } + // } + // }) + + //获取分销的配置 + // getApp().request.promiseGet("/api/weshop/storeDistribut/get/"+oo.stoid,{}).then(res=>{ + // if(res.data.code==0){ + // th.setData({dis_switch:res.data.data.switch,pattern:res.data.data.pattern}); + // } + // }) + + //获取用户设备信息,屏幕宽度 + // wx.getSystemInfo({ + // success: res => { + // th.setData({ + // screenWidth: res.screenWidth + // }) + // } + // }); + + //-- ---秒杀和拼团都要有定时器--- + // if(!options.currentIndex || options.currentIndex<=1){ + // //设置全局定时器 + // th.data.timer=setInterval(function () { + // th.countDown(); + // },1000); + // } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () {}, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + //--清理定时器-- + // clearInterval(this.timer); + }, + /**e + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + // onShareAppMessage: function () { + // var th = this; + // //礼包的转发 + // if(th.data.currentIndex==3){ + // var lbid=th.data.hui_active.lbId; + // var url="pages/giftpack/giftpacklist/giftpacklist?lbId="+lbid+"&isBuy=1"; + // if(getApp().globalData.user_id){ + // url+="&first_leader="+getApp().globalData.user_id; + // } + // var img=this.data.share_img; + // var title=th.data.hui_active.giftTitle; + + // var ob={ + // title:title, + // path:url, + // imageUrl: img, + // }; + // th.setData({share_hidden:1}); + // return ob; + + // }else{ + // //---秒杀,拼团,促销--- + // var item=this.data.share_good; + // if(item){ + // var price = item.shop_price; + // var title= item.goods_name; + // var img=this.data.url+item.original_img; + // var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid; + // if(getApp().globalData.user_id){ + // url+="&first_leader="+getApp().globalData.user_id; + // } + // var ob={ + // title: price + "元 " +title, + // path:url, + // imageUrl: img, + // }; + // th.setData({share_hidden:1,share_good:null}); + // return ob; + // }else{ + // var url="/pages/index/index/index"; + // if(getApp().globalData.user_id){ + // url+="?first_leader="+getApp().globalData.user_id; + // } + // var hui_active=this.data.hui_active; + // var title=hui_active.name; + // if(!title) title=hui_active.main_goods_name; + // if(!title) title=hui_active.giftTitle; + + // var ob={ + // title: title, + // path:url, + // }; + // th.setData({share_hidden:1,share_good:null}); + // return ob; + // } + // } + + // }, + + + //-- 点击tab -- + clickTab(e) { + var th=this; + var data = { + store_id:oo.stoid, + stype:e.target.dataset.index, + stypeup:1, + }; + this.setData({ + is_no_data2:0, + is_no_more2:0, + list2:[], + is_load2: 0, + currentPage2:1, + }); + if(this.data.currentIndex!=e.target.dataset.index){ + this.setData({ + currentIndex: e.target.dataset.index, + isUp: false, + }); + + } else { + console.log('第2次点击'); + this.setData({ + isUp: !this.data.isUp + }); + }; + + if(this.data.isUp) { + data.stypeup = 0; + } else { + data.stypeup = 1; + }; + + // this.data.requestData = data; + this.setData({ + requestData: data + }) + + this.request_list(data); + }, + + + + + request_list: function(data, callback){ + // console.log('触发上拉刷新'); + + var th = this; + if(this.data.is_load2) return false; //-- 正在加载 + if(this.data.is_no_data2) return false; //-- 没有数据 + if(this.data.is_no_more2) return false; //-- 没有更多 + + // 开启加载状态 + this.data.is_load2=1; + + // var req_data = { + // page:th.data.currentPage2 + // } + + app.request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList", { + data: data + }).then(res=>{ + // 关闭加载状态 + th.data.is_load2=0; + // 请求成功 + if(res.data.code==0) { + if(res.data.data.pageData.length>0) { + th.data.currentPage2++; + var data = res.data.data.pageData; + // 判断有无更多数据可以加载,如果大于则没有更多数据,反之则有 + if(res.data.data.page*res.data.data.pageSize > res.data.data.total){th.setData({is_no_more2:1});} + var list=th.data.list2; + list=list.concat(data); + th.setData({list2:list}); + } else { + if(th.data.currentPage==1){ + th.setData({is_no_data2:1}); + } else { + th.setData({is_no_more2:1}); + } + } + if(callback) callback(); + } else { + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + } + console.log('xx',res); + }) + }, + + + + + //---图片失败,默认图片--- + bind_bnerr2: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] ="/miniapp/images/default_g_img.gif"; + this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + // this.setData({['list2[0].original_img']:/miniapp/images/default_g_img.gif}); + }, + //-- ---更多加载---- + refresh:function(){ + this.request_list(this.data.requestData); + }, + + + + // 页面滚动 + onPageScroll (e) { + console.log(e); + if(e.scrollTop == 0) { + this.setData({open: true }); + } else { + this.setData({open: false}); + } + }, + + // 下拉刷新 + onPullDownRefresh() { + var th = this; + var data = this.data.requestData; + + if(this.isPullDownRefresh) return; + // 触发下拉刷新开启 + this.isPullDownRefresh = true; + + this.setData({ + list2: [], + currentPage2: 1, + is_no_more2: 0 + }); + + this.request_list(data, function() { + th.setData({ + triggered: false, + }); + th.isPullDownRefresh = false; + }); + }, +}) \ No newline at end of file diff --git a/packageA/pages/jfbuy/jfbuy.json b/packageA/pages/jfbuy/jfbuy.json new file mode 100644 index 0000000..0d8dbf3 --- /dev/null +++ b/packageA/pages/jfbuy/jfbuy.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "积分购", + "usingComponents": { + "nodata": "/components/nodata/nodata", + "share_button": "/components/share/share" + }, + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/packageA/pages/jfbuy/jfbuy.wxml b/packageA/pages/jfbuy/jfbuy.wxml new file mode 100644 index 0000000..ee9e04f --- /dev/null +++ b/packageA/pages/jfbuy/jfbuy.wxml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + {{item}} + + + + + + + + + + + + + {{item.goods_name}} + + + {{item.integral}}积分 + ¥{{item.addmoney}} + + + 零售价:¥{{item.shop_price}} + 销量:{{item.sales_sum}} + + + + + + + + + 暂无数据 + - 已全部加载 - + + + + + + diff --git a/packageA/pages/jfbuy/jfbuy.wxss b/packageA/pages/jfbuy/jfbuy.wxss new file mode 100644 index 0000000..3bb8aae --- /dev/null +++ b/packageA/pages/jfbuy/jfbuy.wxss @@ -0,0 +1,429 @@ +/* packageA//pages/goods_share/goods_share.wxss */ +.red { + color: #FE6867; +} +.gray { + color: #7b7b7b; +} +.w25 { + width: 25%; +} +.w50 { + width: 50%; +} +.w164 { + width: 164rpx; +} +.bold { + font-weight: bold; +} +page, +.container { + height: 100%; +} +page { + background-color: #f2f2f2; + /* height: 100%; */ +} +.container { + /* height: 100%; */ + /* position: relative; */ +} + +.search-container { + /* display: flex; + padding: 26rpx 20rpx; + border-bottom: 2rpx solid #f8f8f8; */ +} +.input-container { + /* flex: 1; + border-radius: 6rpx 0 0 6rpx; + overflow: hidden; */ +} +.search { + /* background-color: #f0f0f0; + padding: 10rpx 20rpx; + font-size: 28rpx; */ +} +.btn-search { + /* background-color: #FE6867; + color: white; + padding: 0 30rpx; + display: flex; + align-items: center; + border-radius: 0 6rpx 6rpx 0; */ +} +.title { + display: flex; + font-size: 30rpx; + border-bottom: 2rpx solid #f8f8f8; + background-color: white; + position: sticky; + position: -webkit-sticky; + width: 100%; + top: 0; + z-index: 3; +} +.title .iconfont { + color: #ccc; + font-size: 16rpx; + margin-left: 8rpx; +} +.title-item { + width: 25%; + box-sizing: border-box; + text-align: center; + padding: 20rpx; + position: relative; +} +.title-item.active { + color: #FE6867; + font-weight: bold; +} + +.title-item.active:before { + content:''; + position: absolute; + width: 60%; + height: 4rpx; + background-color: #FE6867; + left: 0; + right: 0; + bottom: 0; + margin: 0 auto; +} +.title-item.active:after { + font-family: iconfont; + content: '\e650'; + font-size: 18rpx; + margin-left: 8rpx; +} +.title-item.active.active1:after { + font-family: iconfont; + content: '\e604'; + font-size: 18rpx; + margin-left: 8rpx; +} +.list-container { + height: calc(100% - 360rpx); + /* height: 100%; */ +} +.list { + box-sizing: border-box; + height: calc(100% - 82rpx); + background-color: #f2f2f2; + /* padding-bottom: 102rpx; */ +} +.list.active1 { + /* height: calc(100% - 82rpx - 78rpx); */ + /* padding-bottom: 0; */ +} +.list.active2 { + /* padding-bottom: 0; */ +} +.list-item { + display: flex; + padding: 20rpx; + border-bottom: 2rpx solid #f8f8f8; + background-color: white; +} +.img-container { + background-color: #f0f0f0; + width: 280rpx; + height: 248rpx; + display: flex; + align-items: center; + justify-content: center; +} +.img-container:after { + +} +.details { + flex: 1; + padding-left: 20rpx; + display: flex; + flex-direction: column; + justify-content: space-between; +} +.btn-share { + box-sizing: border-box; + display: inline-block; + background-color: #FE6867; + color: white; + padding: 8rpx 30rpx; + border-radius: 6rpx; + text-align: center; +} +.pdt14 { + padding-top: 14rpx; +} +.pdtb6 { + padding-top: 6rpx; + padding-bottom: 6rpx; +} +.pdtb8 { + padding-top: 8rpx; + padding-bottom: 8rpx; +} +.pdl20 { + padding-left: 104rpx; +} + + +.no-more { + line-height: 3; + color: #ccc; + /* background-color: #f2f2f2; */ +} +.nodata { + text-align: center; + background-color: #f2f2f2; +} +.progress-container { + width: 55%; + padding-right: 10rpx; + position: relative; + text-align: center; +} +.retail { + color: #7b7b7b; + text-decoration: line-through; + font-size: 22rpx; + padding-left: 20rpx; +} +.name { + height: 76rpx; + overflow: hidden; +} + +.percent { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + color: white; +} +.tabbar { + position: fixed; + width: 100%; + bottom: 0; + background-color: white; +} +.tabbar:after { + position: absolute; + content: ''; + width: 2rpx; + height: 50%; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + background-color: #f0f0f0; +} +.tabbar-item { + width: 50%; + text-align: center; + padding-top: 30rpx; + padding-bottom: 30rpx; +} +.tabbar-item .iconfont { + margin-right: 10rpx; +} +.tabbar-item.active { + color: #FE6867; +} + + +.group-type, +.group-num { + position: relative; + font-size: 22rpx; +} +.group-type:before, +.group-num:before { + font-family: iconfont; +} +.group-type:before { + content: '\e66a'; + color: white; + background-color: #FE6867; + position: absolute; + left: 0; + top: 0; + bottom: 0; + padding-left: 6rpx; + padding-right: 10rpx; + line-height: 30rpx; +} +.group-num:before { + padding-right: 6rpx; +} +.group-num:before { + content: '\e694'; + position: relative; +} +.group-num { + color: white; + background-color: #FE6867; + border-radius: 34rpx; + padding-left: 10rpx; + padding-right: 10rpx; + margin-right: 14rpx; +} +.group-type { + color: #FE6867; + border: 2rpx solid #FE6867; + padding-left: 42rpx; + padding-right: 4rpx; + border-radius: 6rpx; +} + +.badge { + color: white; + padding: 0 20rpx; + border-radius: 6rpx; + background-color: #FE6867; + margin-right: 10rpx; +} + +.subTab-title { + text-align: center; + justify-content: center; + align-items: center; + font-size: 28rpx; +} +.subTab-list { + padding: 20rpx; +} +.subTab-titleItem { + box-sizing: border-box; + width: calc(100% / 3); + padding: 20rpx 40rpx; + background-color: white; + border-right: 2rpx solid #f8f8f8; +} +.subTab-titleItem:last-child { + border-right: none; +} +.subTab-titleItem.active { + background-color: #FE6867; + color: white; +} +.subTab-item { + padding: 20rpx; + border-bottom: 2rpx solid #f8f8f8; + background-color: white; + border-radius: 8rpx; + box-shadow: 0 8px 12px #e7e9eb; +} +.subTab-item ~ .subTab-item { + margin-top: 20rpx; +} +.pdv10 { + padding-top: 10rpx; + padding-bottom: 10rpx; +} +.pdv20 { + padding-top: 20rpx; + padding-bottom: 20rpx; +} +.pdb10 { + padding-bottom: 10rpx; +} +.pdb20 { + padding-bottom: 20rpx; +} +.bdr-b { + border-bottom: 2rpx solid #f8f8f8; +} +.dash-b { + border-bottom: 2rpx dashed #ddd; +} +.btn-container { + display: flex; + align-items: flex-end; + font-size: 26rpx; +} + + +/* .popup-container { + content:''; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 3; + background-color: rgba(0,0,0,.6); + display: flex; + align-items: center; + justify-content: center; +} +.popup { + width: 90%; +} +.popup-content { + box-sizing: border-box; + width: 100%; + background-color: white; + padding: 0 20rpx; + border-radius: 10rpx; + max-height: 1038rpx; +} +.icon-close { + font-size: 60rpx; + color: white; +} +.popup-btn { + padding-top: 30rpx; +} */ + +/* .popup-title { */ + /* font-size: 28rpx; */ + /* font-weight: bold; + padding: 20rpx 0; +} */ +/* .popup-title2 { */ + /* padding: 10rpx 0; */ + /* padding-bottom: 8rpx; +} +.popup-title3 { + padding-left: 34rpx; + font-size: 30rpx; +} +.popup-list { + max-height: 602rpx; + overflow-y: auto; +} + + +radio .wx-radio-input { + width: 28rpx; + height: 28rpx; +} + + +radio .wx-radio-input.wx-radio-input-checked { + background-color: #FE6867; + border-color: #FE6867; +} +radio .wx-radio-input.wx-radio-input-checked::before{ + color: white; +} */ + +/* .popup-content.active { + max-height: 982rpx; + overflow: auto; +} */ + +.banner-container { + height: 360rpx; +} +.banner { + display: block; + width: 100%; + height: 100%; +} \ No newline at end of file -- libgit2 0.21.4