diff --git a/components/serviceCard_list/g_filter.wxs b/components/serviceCard_list/g_filter.wxs new file mode 100644 index 0000000..3155059 --- /dev/null +++ b/components/serviceCard_list/g_filter.wxs @@ -0,0 +1,85 @@ +var g_filters = { + //-- 判断是不是有等级价 -- + is_has_rank:function(rank_switch,item){ + if(!rank_switch) return false; + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} + return false; + }, + + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- + get_card_price:function(goods,all_card,type){ + var price1=parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); + if(!all_card){ + if(type==0) return 0; + return ""; + } + + var min_price=null; + var min_name=null; + //---设置对应的价格名字---- + for(var i=0;i<3;i++) { + var vl=all_card[i]; + if(!vl) continue; + + if(vl['CorrPrice']=="Price1" && price1>0) + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price34 ) min_name=min_name.substring(0, 8); + return min_name; + }, + + get_url_by_type: function(item) { + var url = ''; + if(item.prom_type == 9) { + url = '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + item.goods_id + '&group_id=' + item.prom_id; + } + else if(item.prom_type==8){ + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id + } + else { + url = '/pages/goods/goodsInfo/goodsInfo?goods_id=' + item.goods_id + '&prom_id=' + item.prom_id + '&prom_type=' + item.prom_type; + }; + return url; + }, + +} +module.exports = { + is_has_rank:g_filters.is_has_rank, + get_card_price:g_filters.get_card_price, + get_url_by_type:g_filters.get_url_by_type, +} \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.js b/components/serviceCard_list/serviceCard_list.js new file mode 100644 index 0000000..d642be6 --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.js @@ -0,0 +1,226 @@ +var t = getApp(), + a = t.request, + o = t.globalData.setting, + os = o, + i = require("../../utils/util.js"), + ut = i, + s = require("../../utils/common.js"); +Component({ + data: { + url: o.imghost, + object: null, + curPage: 1, + is_no_more: 1, //加载完所有数据的控制器 + load_complete: 0, //加载完成, + rank_switch: false, + card_field: "", + card_name: "", + max_card_field: "", + card_list: null + }, + properties: { + // 这⾥定义了innerText属性,属性值可以在组件使⽤时指定 + }, + ready: function () {}, + pageLifetimes: { + //要处理一下,游客登录后的界面的变化,主要还该是改变会员 + show: function () { + console.log('page-show'); + this.init(); + if(getApp().globalData.login_back==1){ + getApp().globalData.login_back==0; + this.data.curPage=1; + this.setData({ recommend: [] }); + this.get_list(); + } + } + }, + + methods: { + init: function () { + var th = this; + if (!getApp().globalData.user_id) return false; + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { + isShowLoading: false, + success: function (e) { + if (e.data.code == 0 && e.data && e.data.data) { + getApp().globalData.userInfo = e.data.data; + getApp().getConfig2(function (e) { + var swithc_list = e.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台有开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ + rank_switch: true + }); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ + card_list: ob.card_list + }); + var ti = setInterval(function () { + var user = getApp().globalData.userInfo; + if (!user) return false; + clearInterval(ti); + if (user.card_field && user['card_expiredate']) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + if (card_name.length > 4) card_name = card_name.substring(0, 8); + th.setData({ + card_field: user.card_field, + card_name: card_name, + card_list: ob.card_list + }); + } + } + }, 500) + }) + } + }) + + } + + + + } + }) + }, + // get_list: function () { + // var th = this; + // var url = "http://172.20.0.233:8022/api/weshop/display"; + // wx.request({ + // url: url, + // success: function (res) { + // th.setData({ + // recommend: res.data.data.pageData + // }) + // } + // }) + // }, + get_list: function () { + var that = this; + if (that.data.is_no_more == 0) return false; + var user_id=getApp().globalData.user_id; + if(!user_id) user_id=0; + + var curPage = that.data.curPage; + + // page: curPage, + // pageSize: 6, + // orderField: "sort", + // orderType: 'asc', + // // user_id: user_id, + // // is_mainshow: 1, + // // isonsale: 1, + // // is_on_sale: 1, + // is_recommend: 1, + // store_id: o.stoid, + + getApp().request.get('/api/weshop/serviceCard/page', { + isShowLoading: false, + data: { + is_recommend: 1, + store_id: o.stoid, + }, + success: function (res) { + console.log('获取卡项推荐', res.data.data); + var data = res.data; + var total = data.data.total; + if (total <= curPage * 6) { + that.setData({ + is_no_more: 0 + }); + } else { + that.data.curPage++; + } + //加载完成 + if (data.data.pageData) { + + for(let i in data.data.pageData){ + let item=data.data.pageData[i]; + if(item.user_price) + item.prom_price=item.user_price; + } + + that.setData({ + load_complete: 1 + }); + } + if (that.data.recommend != null) { + var ra = that.data.recommend.concat(data.data.pageData); + that.setData({ + recommend: ra + }); + } else { + that.setData({ + recommend: data.data.pageData + }); + } + + console.log('卡项推荐按~~~~~~', that.data.recommend) + } + }) + }, + bind_bnerr_xc: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errurl = e.target.dataset.url; + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这⾥的赋值⽅式,只是将数据列表中的此项图⽚路径值替换掉 ; + }, + reset: function () { + curPage = 1; + }, + //--- 获取卡类列表 --- + getPlusCardType: function (func) { + var storid = o.stoid; + var th = this; + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { + + if (res.data.code != 0 || !res.data.data) { + var ob = { + "card_list": [], + "name_map": "" + }; + func(ob); + return false; + } + + var plusCard = res.data.data; + var arr = [1219, 2089, 3031]; + var new_arr = new Array(); + var card_name_map = new Map(); + + var user = getApp().globalData.userInfo; + if (plusCard) { + for (var i = 0; i < plusCard.length; i++) { + if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { + continue; + } + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); + card_name_map.set(name, plusCard[i].CardName); + new_arr.push(plusCard[i]); + + } + } + var ob = { + "card_list": new_arr, + "name_map": card_name_map + }; + func(ob); + }) + }, + + go_url:function (e) { + var url=e.currentTarget.dataset.url; + console.log('url===>>>>', url); + getApp().goto(url); + } + + }, +}) \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.json b/components/serviceCard_list/serviceCard_list.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.wxml b/components/serviceCard_list/serviceCard_list.wxml new file mode 100644 index 0000000..86919ed --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.wxml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + {{item.serviceName}} + + + + + {{item.prom_integral}}积分 + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.money,2)}} + + + + + + + {{item.show_price}} + + + + + + + + + + + 没有更多内容了 + + + \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.wxss b/components/serviceCard_list/serviceCard_list.wxss new file mode 100644 index 0000000..7982238 --- /dev/null +++ b/components/serviceCard_list/serviceCard_list.wxss @@ -0,0 +1,236 @@ +.collects { + /* margin-top: 40rpx; */ + /* margin-bottom: 40rpx; */ +} + +.pdt10 { + padding-top: 10rpx; +} + +.ai-center{ + align-items: center; +} + +.ib { + display: inline-block; +} + +.fs20 { + font-size: 20rpx; +} + +.fs22 { + font-size: 22rpx; +} + +.fs24 { + font-size: 24rpx; +} + +.fs26 { + font-size: 26rpx; +} + +.fs28 { + font-size: 28rpx; +} + +.fs35 { + font-size: 35rpx; +} + +.flex-center { + display: flex; + justify-content: center; + align-items: center; +} + +.ellipsis-1 { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +/* .ellipsis-1x { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; +} */ + +.xc-wc { + color: #d60021; +} + +.xc-ash { + color: #b9b9b9; +} + +.choice_box .choice_list .choice_footer .price { + color: #f23030; + height: 10px; +} + +.flex { + display: flex; +} + +.ellipsis-2 { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.goods_name { + height: 62rpx; + /* margin-top: 6rpx; */ + line-height: 1.2; + margin-bottom: 10rpx; +} + +.hang { + /* width: 100%; */ + /* margin: auto; + padding-left: 21rpx; */ + display: flex; + flex-wrap: wrap; + /* margin: 0 auto; */ + padding: 0 20rpx; + box-sizing: border-box; + /* justify-content: space-evenly; */ +} + +.hang .collect { + width: calc((100% - 20rpx) / 2); + /* height: 520rpx; */ + border-radius: 25rpx; + border: 2rpx solid #ebedf0; + overflow: hidden; + box-sizing: border-box; + margin-top: 20rpx; + /* margin-right: 14rpx; + margin-bottom: 5rpx; */ +} + +.hang .collect:nth-child(2n+1) { + margin-right: 20rpx; +} + +.collect .bottom { + padding: 20rpx; +} + +.collect .sp { + width: 100%; + height: 340rpx; + display: block; +} + +.collect .money { + /* margin-top: 28rpx; + margin-bottom: 8rpx; + line-height: 28rpx; + align-items: baseline; */ +} + +.collect .money view { + line-height: 28rpx; +} + +.collect .money .flex { + font-weight: bold; +} + +.collect .money .flex .fs24 { + padding-top: 5rpx; +} + +.collect .Discount { + width: 156rpx; + height: 28rpx; + border-radius: 20rpx; + background-color: rgb(56, 56, 56); + font-size: 18rpx; + color: rgb(255, 255, 255); +} + +.collect .Discount image { + height: 18rpx; + width: 18rpx; + line-height: 28rpx; + margin-right: 3rpx; +} + +.collect.ml20 { + margin-left: 13rpx; +} + +.fs24.dollar { + padding: 0rpx; +} + +.money .price { + margin-left: 12rpx; + text-decoration: line-through; + line-height: 23rpx; +} + +.province { + line-height: 26rpx; +} + +.nothing { + height: 75rpx; + width: 100%; +} + +.nothing .no_content { + margin: 0rpx 11rpx; + color: rgb(138, 138, 138); +} + +.nothing .Foil { + width: 80rpx; + height: 2rpx; + background-color: #ebedf0; +} + +.line_th { + text-decoration: line-through; +} + +.card_bg { + box-sizing: border-box; + padding: 2rpx 10rpx; + height: 28rpx; + border-radius: 26rpx; + font-size: 18rpx; + line-height: 28rpx; + max-width: 210rpx; + background: #333; + color: #fff; + margin-left: 8rpx; +} + +.card_bg image { + width: 19rpx; + height: 19rpx; + margin-right: 8rpx; +} + +/* .card_bg .card_name { + max-width: 76rpx; + width: auto; + overflow: hidden; + white-space: nowrap; +} */ + +.card_name { + position: relative; + top: -4rpx; +} + + diff --git a/packageA/pages/myGiftDetails/myGiftDetails.js b/packageA/pages/myGiftDetails/myGiftDetails.js index f0eaebb..d432b6b 100644 --- a/packageA/pages/myGiftDetails/myGiftDetails.js +++ b/packageA/pages/myGiftDetails/myGiftDetails.js @@ -15,6 +15,7 @@ Page({ content: "当前核销码仅限当面使用!" }, showBtn: true, + isClick: false, }, /** @@ -332,27 +333,35 @@ Page({ //一键领取券 show_get_quan:function (e) { - var th=this; - var json = { - store_id:os.stoid, - user_id:getApp().globalData.user_id, - id:this.data.id - }; - var url = "/api/weshop/libao/libaoFormvip/saveLibaoQuan"; - getApp().request.post(url,{ - data:json, - success:function(res) { - if (res.data.code == 0) { - th.setData({'details.isget':1}); - } else { - wx.showToast({ - title: res.data.msg, - icon: 'none', - duration: 2000 - }) - } - }, - }) + if(this.data.isClick) return false; + if(!this.data.isClick) { + this.data.isClick = true; + let th=this; + let json = { + store_id:os.stoid, + user_id:getApp().globalData.user_id, + id:this.data.id + }; + let url = "/api/weshop/libao/libaoFormvip/saveLibaoQuan"; + getApp().request.post(url,{ + data:json, + success:function(res) { + if (res.data.code == 0) { + th.setData({'details.isget':1}); + } else { + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + th.data.isClick = false; + } + + }, + }); + + } + }