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 diff --git a/packageA/pages/quan/quan.js b/packageA/pages/quan/quan.js index 3e541d1..d3d664a 100644 --- a/packageA/pages/quan/quan.js +++ b/packageA/pages/quan/quan.js @@ -33,6 +33,10 @@ Page({ } this.requestGoodsList(); this.setData({getcurday:ut.gettimestamp()}); + + wx.setNavigationBarTitle({ + title: "免费优惠券列表", + }) }, diff --git a/packageA/pages/quan/quan.json b/packageA/pages/quan/quan.json index e3d91c4..7d53138 100644 --- a/packageA/pages/quan/quan.json +++ b/packageA/pages/quan/quan.json @@ -3,6 +3,6 @@ "nodata": "/components/nodata/nodata", "share_button": "/components/share/share" }, - "navigationBarTitleText": "优惠券列表", + "navigationBarTitleText": "免费优惠券列表", "enablePullDownRefresh": false } \ No newline at end of file diff --git a/packageA/pages/quan/quan.wxml b/packageA/pages/quan/quan.wxml index b2cd17c..089d1f3 100644 --- a/packageA/pages/quan/quan.wxml +++ b/packageA/pages/quan/quan.wxml @@ -3,18 +3,17 @@ - + + scroll-anchoring> diff --git a/packageA/pages/quan/quan.wxss b/packageA/pages/quan/quan.wxss index c0e2276..6146348 100644 --- a/packageA/pages/quan/quan.wxss +++ b/packageA/pages/quan/quan.wxss @@ -85,7 +85,8 @@ page { } .list { box-sizing: border-box; - height: calc(100% - 78rpx); + /* height: calc(100% - 78rpx); */ + height: 100%; background-color: #f2f2f2; padding: 20rpx 20rpx 0 20rpx; /* padding-bottom: 102rpx; */ diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index af4a9a9..e1e3ff2 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -142,8 +142,9 @@ Page({ //----------子页返回父页触发---------- onShow: function() { var th=this; - th.setData({show_submit:0}); - + th.setData({show_submit:0}); //让提交先掩藏 + th.data.g_cart_q_time=null; + if (th.data.isclose==0){ wx.navigateTo({ url: "/pages/index/index/index" @@ -739,6 +740,152 @@ Page({ }); }, + calc_per:async function(c_arr){ + var th=this; + //-- 循环处理 -- + for(var i in c_arr){ + var cart_item=c_arr[i]; //就是每一单的意思 + var pickid=cart_item.pickup_id; + var ord_goods=c_arr[i].goods; //就是每一单的从表的意思 + var o_price=0,q_conditin=0; + //--------循环计算总价----------- + for(var j=0;j { + if (res.data.code == 0 && res.data.data.condition) { + var get_data = res.data.data; + item_map.is_bz = get_data.is_bz; //是不是倍增 + item_map.bs = get_data.bs; //是不是倍数 + item_map.is_past = get_data.is_past; //是不是包邮 + item_map.prom_price = get_data.price>=0?get_data.price:item_map.price; + item_map.s_intValue = get_data.intValue; + item_map.s_coupon_id = get_data.coupon_id; + item_map.s_coupon_num = get_data.coupon_num; + if(get_data.gift_id && get_data.goodsinfo) { + item_map.gift_id = get_data.gift_id; + item_map.gift_goods_id = get_data.goods_id; + item_map.gift_goods_name = get_data.goods_name; + item_map.gift_goods_color = get_data.goodsinfo.goods_color ? get_data.goodsinfo.goods_color : ''; + item_map.gift_goods_spec = get_data.goodsinfo.goods_spec ? get_data.goodsinfo.goods_spec : ''; + item_map.gift_original_img = get_data.goodsinfo.original_img; + item_map.gift_limit_num = get_data.limit_num; + item_map.gift_storecount = get_data.gift_storecount; + item_map.gift_weight = get_data.goodsinfo.weight; + item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; + item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; + + } + item_map.s_libao = get_data.libao; + item_map.s_lb_num = get_data.lb_num; + } + }) + } + + //有活动,且优惠活动并没有限制使用优惠券,且有减价 + //--看有没有减价-- + //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ + if(item_map.price-item_map.prom_price && item_map.prom_price!==null){ + if(cart_item.prom_pt_json){ + cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) + }else{ + cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}]; + } + + //-- 如果系统要平摊到单品 -- + //if(!th.data.ispt_goods){ + var pt_data={ + 'prom_id':item_map.prom_id, + 'dis': parseFloat((item_map.price-item_map.prom_price).toFixed(2)), + 'goods':item_map.goods + } + + var pt_res=null; + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{ + if(res.data.code==0){ pt_res=res.data.data; } + }) + if(pt_res){ + for (var io in item_map.goods){ + //平摊赋值 + item_map.goods[io].account_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account; + item_map.goods[io].account_yu_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account_yu; + if(!th.data.ispt_goods){ + item_map.goods[io].account=item_map.goods[io].account_fir; + item_map.goods[io].account_yu=item_map.goods[io].account_yu_fir; + } + } + } + // } + + o_price-=(item_map.price-item_map.prom_price); + //如果有限制使用优惠券,就要减掉参与的活动商品的钱 + if(!item_map.is_xz_yh) q_conditin=o_price; + } + + //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- + for(var j=0;j0){ + for(var i =0;i0) o_price-=c_arr[i].cut_price; + var f_o_price=o_price; //判断包邮券的钱 var q_conditin=0; q_conditin=o_price; - //---如果该门店的相关活动,就要算一下减价-- - if(th.data.prom_goods_map[pickid]){ - var ob=th.data.prom_goods_map[pickid]; - for(var ii in ob){ - var item_map=ob[ii]; - if(item_map.bs==undefined || item_map.bs==null) { - //等待,获取一下优惠活动的信息 - await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { - data: { - price: item_map.price, prom_id: item_map.prom_id, - goods_num: item_map.goods_num, user_id: getApp().globalData.user_id, - is_bz: item_map.is_bz - } - }).then(res => { - if (res.data.code == 0 && res.data.data.condition) { - var get_data = res.data.data; - item_map.is_bz = get_data.is_bz; //是不是倍增 - item_map.bs = get_data.bs; //是不是倍数 - item_map.is_past = get_data.is_past; //是不是包邮 - item_map.prom_price = get_data.price>=0?get_data.price:item_map.price; - item_map.s_intValue = get_data.intValue; - item_map.s_coupon_id = get_data.coupon_id; - item_map.s_coupon_num = get_data.coupon_num; - if(get_data.gift_id && get_data.goodsinfo) { - item_map.gift_id = get_data.gift_id; - item_map.gift_goods_id = get_data.goods_id; - item_map.gift_goods_name = get_data.goods_name; - item_map.gift_goods_color = get_data.goodsinfo.goods_color ? get_data.goodsinfo.goods_color : ''; - item_map.gift_goods_spec = get_data.goodsinfo.goods_spec ? get_data.goodsinfo.goods_spec : ''; - item_map.gift_original_img = get_data.goodsinfo.original_img; - item_map.gift_limit_num = get_data.limit_num; - item_map.gift_storecount = get_data.gift_storecount; - item_map.gift_weight = get_data.goodsinfo.weight; - item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; - item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; - - } - item_map.s_libao = get_data.libao; - item_map.s_lb_num = get_data.lb_num; - } - }) - } - - //有活动,且优惠活动并没有限制使用优惠券,且有减价 - //--看有没有减价-- - //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ - if(item_map.price-item_map.prom_price && item_map.prom_price!==null){ - if(cart_item.prom_pt_json){ - cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) - }else{ - cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}]; - } - - //-- 如果系统要平摊到单品 -- - //if(!th.data.ispt_goods){ - var pt_data={ - 'prom_id':item_map.prom_id, - 'dis': parseFloat((item_map.price-item_map.prom_price).toFixed(2)), - 'goods':item_map.goods - } - - var pt_res=null; - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{ - if(res.data.code==0){ pt_res=res.data.data; } - }) - if(pt_res){ - for (var io in item_map.goods){ - //平摊赋值 - item_map.goods[io].account_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account; - item_map.goods[io].account_yu_fir=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account_yu; - if(!th.data.ispt_goods){ - item_map.goods[io].account=item_map.goods[io].account_fir; - item_map.goods[io].account_yu=item_map.goods[io].account_yu_fir; - } - } - } - // } - - o_price-=(item_map.price-item_map.prom_price); - //如果有限制使用优惠券,就要减掉参与的活动商品的钱 - if(!item_map.is_xz_yh) q_conditin=o_price; - } - - //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- - for(var j=0;j=0 && item['money']) { fw_price =parseFloat(item['money']); @@ -2302,13 +2340,19 @@ Page({ for(var i in quanlist){ quanlist[i].is_using= th.check_in_sele(quanlist[i].CashRepNo,pickid); - if(!t_user || quanlist[i].CashRepNo!=t_user.coupon_no) quanlist[i].show_red=0; + if(t_user && quanlist[i].CashRepNo==t_user.coupon_no) + quanlist[i].show_red=1; + else + quanlist[i].show_red=0; } if(get_by_quan_list_cart){ for(var i in get_by_quan_list_cart){ get_by_quan_list_cart[i].is_using= th.check_in_sele(get_by_quan_list_cart[i].no,pickid); - if(!t_user || get_by_quan_list_cart[i].no!=t_user.coupon_no) get_by_quan_list_cart[i].show_red=0; + if(t_user && get_by_quan_list_cart[i].no==t_user.coupon_no) + get_by_quan_list_cart[i].show_red=1; + else + get_by_quan_list_cart[i].show_red=0; } th.setData({by_quan_list_cart:get_by_quan_list_cart}); }else { @@ -2744,12 +2788,13 @@ Page({ },500); }, //-----获取购物车进来的劵------- - get_cart_quan:function () { + get_cart_quan:async function (order_prom_list_cart) { var th=this; var is_xz_yh=1; //等待值的出现 - getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { - var arr=th.data.order_prom_list_cart; + //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { + //var arr=th.data.order_prom_list_cart; + var arr=order_prom_list_cart; //如果系统有限制使用优惠券 if(th.data.is_close_quan) return false; //------------开始计算使用优惠券相关------------ @@ -2828,7 +2873,7 @@ Page({ th.set_can_num(); } - }) + //}) }, //------ 获取立即购买的购物车的劵 -------- diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 4b4e7c1..40c7e1e 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -241,6 +241,8 @@ Page({ poster:null, //自定义海报 share_b_img:'', //自定义分享的背景 + + showPoster: false, }, //------初始化加载---------- @@ -1536,6 +1538,7 @@ Page({ //--点击分享事件--- onShareAppMessage: function(t) { + var th = this; var price = th.data.data.shop_price; if (th.data.prom_act) { @@ -3330,10 +3333,13 @@ Page({ //先画背景 var pg_path = "../../../images/share/share_bg.png"; + // context.fillStyle="#FFFFFF"; + // context.fillRect(0,0,554 * unit, 899 * unit); + //-- 如果有自定义海报的时候,判断背景的图片 -- if(th.data.share_b_img){ pg_path=th.data.share_b_img; - } + } context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); //-- 是自定义海报的情况下 -- @@ -3655,10 +3661,13 @@ Page({ }) return false; } - wx.previewImage({ - //将图片预览出来 - urls: [that.data.shareImgPath] - }); + // wx.previewImage({ + // //将图片预览出来 + // urls: [that.data.shareImgPath] + // }); + that.setData({ + showPoster: true, + }); wx.hideLoading(); } }) @@ -4353,8 +4362,118 @@ Page({ }) } }) - } - - + }, + + closePoster() { + this.setData({ + showPoster: false, + }); + }, + + // 保存图片到手机 + savePic() { + console.log('保存图片'); + var self = this; + // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限 + this.getSetting().then((res) => { + // 判断用户是否授权了保存到相册的权限,如果没有发起授权 + if (!res.authSetting['scope.writePhotosAlbum']) { + this.authorize().then(() => { + // 同意授权后保存下载文件 + this.saveImage(self.data.shareImgPath) + .then(() => { + self.setData({ + showPoster: false + }); + }); + }) + } else { + // 如果已经授权,保存下载文件 + this.saveImage(self.data.shareImgPath) + .then(() => { + self.setData({ + showPoster: false + }); + }); + } + + }) + }, + + // 获取用户已经授予了哪些权限 + getSetting() { + return new Promise((resolve, reject) => { + wx.getSetting({ + success: res => { + resolve(res) + } + }) + }) + }, + + // 发起首次授权请求 + authorize() { + // isFirst 用来记录是否为首次发起授权, + // 如果首次授权拒绝后,isFirst赋值为1 + let isFirst = wx.getStorageSync('isFirst') || 0; + return new Promise((resolve, reject) => { + wx.authorize({ + scope: 'scope.writePhotosAlbum', + // 同意授权 + success: () => { + resolve(); + }, + // 拒绝授权,这里是用户拒绝授权后的回调 + fail: res => { + if(isFirst === 0) { + wx.setStorageSync('isFirst', 1); + wx.showToast({ + title: '保存失败', + icon: 'none', + duration: 1000 + }) + } else { + this.showModal(); + } + console.log('拒绝授权'); + reject(); + } + }) + }) + }, + + + // 保存图片到系统相册 + saveImage(saveUrl) { + var self = this; + return new Promise((resolve, reject) => { + wx.saveImageToPhotosAlbum({ + filePath: saveUrl, + success: (res) => { + wx.showToast({ + title: '保存成功', + duration: 1000, + }); + self.setData({ + showPlaybill: 'true' + }); + resolve(); + }, + fail: () => { + wx.showToast({ + title: '保存失败', + duration: 1000, + }); + } + }) + }) + }, + + previewImage() { + wx.previewImage({ + //将图片预览出来 + urls: [this.data.shareImgPath] + }); + }, }); diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 18429eb..3f7bd0a 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -383,14 +383,14 @@ - + - 选择门店 + 选择门店 - + 更多门店 @@ -421,9 +421,9 @@ - + - 领券 + 领券 满{{item.condition}}减{{item.money}} @@ -478,7 +478,7 @@ - + {{bconfig.service_bz}} @@ -507,7 +507,7 @@ - + 宝贝评价({{categories3[0].num}}) 查看全部 @@ -523,32 +523,34 @@ - - - - - - - - - {{item.is_anonymous!=1?item.username:'匿名'}} - - - - - {{item.content?item.content:''}} - - - {{item.add_time}} - - - - - - - - - + + + + + + + + + + {{item.is_anonymous!=1?item.username:'匿名'}} + + + + + {{item.content?item.content:''}} + + + {{item.add_time}} + + + + + + + + + + @@ -563,7 +565,7 @@ - 商品信息 + 商品信息 @@ -985,7 +987,7 @@ - 选择门店 + 选择门店 @@ -1483,5 +1485,18 @@ - - \ No newline at end of file + + + + + + + + x + + + + + + + diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss index 48bcc8b..1004874 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxss +++ b/pages/goods/goodsInfo/goodsInfo.wxss @@ -9,15 +9,15 @@ image { display: flex; justify-content: center; width: 100%; - height: 80rpx; - margin-bottom: 20rpx; + /* height: 80rpx; */ + /* margin-bottom: 20rpx; */ background-color: #fff; - border-bottom: 1rpx #fafafa solid; + /* border-bottom: 1rpx #fafafa solid; */ } .type-box { width: 25%; box-sizing: border-box; - font-size: 36rpx; + font-size: 28rpx; line-height: 76rpx; padding: 0 20rpx; text-align: center; @@ -25,13 +25,27 @@ image { overflow: hidden; } .type-navbar-item { - border-bottom: 4rpx solid #fff; + /* border-bottom: 4rpx solid #fff; */ display: flex; justify-content: center; width: 100%; } .type-item-on { - border-bottom: 4rpx solid #333; + color: #F95D74; + font-weight: bold; + /* border-bottom: 4rpx solid #F95D74; */ + position: relative; +} +.type-item-on:after { + content: ''; + position: absolute; + width: 50%; + height: 4rpx; + background-color: #F95D74; + left: 0; + right: 0; + bottom: 0; + margin: 0 auto; } .swiper_box { width: 100%; @@ -46,9 +60,12 @@ image { width: 560rpx; line-height: 46rpx; font-size: 32rpx; + font-weight: bold; color: #333; - margin-top: 40rpx; - margin-bottom:20rpx; + margin-top: 30rpx; + margin-bottom:30rpx; + flex: 1; + text-align: justify; } .goods-collect { @@ -78,7 +95,7 @@ image { /* margin-top: 46rpx; */ margin-top:26rpx; - padding-bottom:12rpx; + padding-bottom:20rpx; } .prom-info { @@ -114,7 +131,8 @@ image { .goods-price>.tm{ color: #999999; font-size: 26rpx;margin-top: 10rpx;} .goods-num { - display: flex;font-size: 28rpx; + display: flex; + font-size: 24rpx; justify-content: space-between; } @@ -949,11 +967,12 @@ left:31rpx;} .bzfu_img{ width: 164rpx; height:34rpx; margin-right: 18rpx; margin-left: 12rpx } .bz_view{ height:100rpx; padding: 0 34rpx 0 13rpx; color: #333; font-size: 28rpx; - border-bottom: 3rpx solid #eee; border-top: 3rpx solid #eee; } + /* border-bottom: 3rpx solid #eee; */ + /* border-top: 3rpx solid #eee; */} .bz_view view{ width: 460rpx; max-height: 70rpx; overflow: hidden;} .bb_view{ display: flex;align-items: center;justify-content: space-between; padding: 0 34rpx; color: #333; - font-size: 32rpx; height: 104rpx; line-height: 104rpx; overflow: hidden; padding-right:26rpx } + font-size: 30rpx; height: 104rpx; line-height: 104rpx; overflow: hidden; padding-right:26rpx } .red_bb{ color: #d70026; min-width:158rpx;width: auto;} .bg_jj{ width: 18rpx; height:18rpx; border-top: 2rpx solid #d70026; @@ -1180,7 +1199,7 @@ left:31rpx;} background: #ffe3e2; color: 28rpx; border-radius:20rpx; - font-size: 28rpx; + font-size: 24rpx; } .xc_comment-discuss{ width: 152rpx; @@ -1190,7 +1209,7 @@ left:31rpx;} background: #ffe3e2; color: 28rpx; border-radius:20rpx; - font-size: 28rpx; + font-size: 24rpx; margin-left: 28rpx } @@ -1274,7 +1293,14 @@ left:31rpx;} } .pj_word_size{ font-size: 28rpx} -.pj_scroll{white-space: nowrap;margin-bottom: 50rpx;} +.pj_scroll{ + white-space: nowrap; + /* height: 324rpx; */ + margin-bottom: 50rpx; + display: flex; + align-items: center; + /* box-shadow: 0 8px 12px #e7e9eb; */ +} /*领券*/ @@ -1285,7 +1311,7 @@ left:31rpx;} font-size: 23rpx; } .cx-frame{ - border-top:3rpx solid #eee; + /* border-top:3rpx solid #eee; */ width:99%; height: 95rpx; line-height: 95rpx; @@ -1317,19 +1343,17 @@ left:31rpx;} } .xc-coupon-fram .xc-circular{ - width: 24rpx; - height:20rpx; + width: 22rpx; + height:22rpx; background-color:#fff; position:absolute; - top:40rpx; - - + top: 40rpx; } .xc-coupon-fram .xc-one{ left:3rpx; } .xc-coupon-fram .xc-two{ - left: 175rpx; + left: 178rpx; } .cx-obtain-coupon{ @@ -2257,7 +2281,7 @@ right:17rpx; top:55rpx; .no_pj_list{text-align: center; width: 100%; color: #999; margin: 30rpx 0; display: inline-block; font-size: 28rpx} /* 门店地址 */ .xc-address_frame{ - border-top:1rpx solid #eee; + /* border-top:1rpx solid #eee; */ width: 100%; height: auto; } @@ -2322,6 +2346,7 @@ background: white; width: 100%; border-radius: 20rpx 20rpx 0 0; height: 72%; +bottom: 0; } .popup-top{ border-bottom: 1rpx solid #eee; @@ -2605,4 +2630,56 @@ button.custom-service::after{ .dp_cx_view{border-bottom: 0.02rpx solid #eee; padding-bottom: 40rpx} .act_content{ margin-top: 40rpx} .act_content view{ margin-bottom: 12rpx} -.color_b{color: #ff9c00} \ No newline at end of file +.color_b{color: #ff9c00} + +.poster-container { + box-sizing: border-box; + position: fixed; + top: 0; + width: 100%; + height: 100%; + z-index: 999; + background-color: rgba(0,0,0,.4); + padding: 60rpx; +} + +.poster { + box-sizing: border-box; + width: 100%; + height: 90%; + border-radius: 20rpx; + /* box-shadow: 0 8px 12px #666; */ + position: relative; + z-index: 999; + overflow: hidden; +} +.poster-img { + display: block; + width: 100%; + height: 100%; +} +.btn-container { + display: flex; + justify-content: space-around; +} +.btn-share { + display: block; + background-color: #FE6867; + color: white; + border-radius: 8rpx; + line-height: 80rpx; + margin-top: 28rpx; + padding: 0 60rpx; +} +.btn-close { + background-color: rgba(0,0,0,.5); + color: white; + width: 40rpx; + height: 40rpx; + line-height: 40rpx; + text-align: center; + border-radius: 50%; + position: absolute; + right: 20rpx; + top: 10rpx; +} \ No newline at end of file diff --git a/pages/user/assistance/assistance.wxss b/pages/user/assistance/assistance.wxss index ac87d8e..83017da 100644 --- a/pages/user/assistance/assistance.wxss +++ b/pages/user/assistance/assistance.wxss @@ -1,12 +1,12 @@ -page { +.page { /* background-color: rgb(208, 17, 25); */ /* width: 100%; height: 100%; */ - + /* height: 100%; */ } .page { - /* height: 100vh; */ + height: 100vh; } diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index 6c2ca9c..960f422 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -223,7 +223,7 @@ Page({ th.setData({ aitem: data_aissa, task_number: task_number, - giftQty:giftQty, + giftQty:data_aissa[0].giftQty, }); th.go_to_task(th.data.taskid); @@ -232,6 +232,7 @@ Page({ aitem: data_aissa, task_number: task_number, taskid: taskid, + giftQty:data_aissa[0].giftQty, }); //判断是不是领取的任务 th.get_user_task(); @@ -368,7 +369,8 @@ Page({ task_number: task_number, taskid: task_id, is_dismantle: 0, - bc_page: 1 + bc_page: 1, + giftQty:aitem[ind].giftQty, }); if (this.data.switch_head == 1 && th.data.is_clik == 0) { @@ -557,7 +559,8 @@ Page({ taskid: task_id, is_dismantle: 0, is_clik: 1, - bc_page: 1 + bc_page: 1, + giftQty:aitem[index].giftQty }) if (this.data.switch_head == 1) { //判断有没有帮拆记录 @@ -589,6 +592,7 @@ Page({ taskid: task_id, is_dismantle: 0, bc_page: 1, + giftQty:aitem[index].giftQty }) if (this.data.switch_head == 1) { this.dismantle_record(); diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml index 8bc19e5..045baf7 100644 --- a/pages/user/assistance/task_assistance.wxml +++ b/pages/user/assistance/task_assistance.wxml @@ -18,17 +18,17 @@ - + - + - - - 礼包详情 - + + + 礼包详情 + diff --git a/pages/user/assistance/task_assistance.wxss b/pages/user/assistance/task_assistance.wxss index d7f0e53..d878741 100644 --- a/pages/user/assistance/task_assistance.wxss +++ b/pages/user/assistance/task_assistance.wxss @@ -41,7 +41,7 @@ page { .xc-specific-more-frame { width: 100%; height: 40%; - margin-top: 20rpx; + padding-top: 20rpx; } .task-number { @@ -159,14 +159,20 @@ page { } .closes { - margin-top: 20rpx; + /* margin-top: 20rpx; */ } .canvas { position: fixed; z-index: 11; width: 100%; - top: 20rpx; + top: 0; + bottom: 0; + left: 0; + right: 0; + background-color: rgba(0,0,0,.5); + box-sizing: border-box; + padding-top: 60rpx; } .close { @@ -206,15 +212,15 @@ page { } .closes { - margin-top: 20rpx; + /* margin-top: 20rpx; */ } -.canvas { +/* .canvas { position: fixed; z-index: 20; width: 100%; top: 20rpx; -} +} */ .close { width: 70rpx;