diff --git a/app.js b/app.js index fd71b47..405e923 100644 --- a/app.js +++ b/app.js @@ -83,7 +83,7 @@ App({ if(option) this.globalData.scene=option.scene; console.log(option,'登陆场景'); - wx.hideTabBar(); + // wx.hideTabBar(); this.initExt(); // this.overShare() @@ -250,7 +250,9 @@ App({ //首页的第一次登录 getUserFir(t) { var s = this; - if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { + if (o.isAuth()) { + "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); + } else { if (!o.isAuth()) return o.wxLogin_fir(t); if (null == s.globalData.userInfo) { return o.wxLogin_fir(t); diff --git a/components/diy_advertising/diy_advertising.wxml b/components/diy_advertising/diy_advertising.wxml index 89e5931..9ef022d 100644 --- a/components/diy_advertising/diy_advertising.wxml +++ b/components/diy_advertising/diy_advertising.wxml @@ -1,27 +1,35 @@ - - - - - - 建议宽度640 - - - + + + + + + 建议宽度640 + + + + - - + + + + - - - + + + + + + + + + - - - + + + @@ -34,16 +42,24 @@ 建议宽度640 - - - + + + + + + + + + + - - - + + + + + - @@ -62,13 +78,30 @@ 300*300 - + + + + + + + + + + + + + + + + + + @@ -80,8 +113,7 @@ - + @@ -90,8 +122,29 @@ 200*200 - - + + + + + + + + + + + + + + + + + + @@ -100,8 +153,29 @@ 200*200 - - + + + + + + + + + + + + + + + + + + @@ -118,12 +192,21 @@ 300*300 - > - - - - - + + + + + + + + + + + + + + + @@ -133,13 +216,29 @@ 300*150 - - + + + + + + + + + + + + + + + + + @@ -149,12 +248,29 @@ 300*150 - + + + + + + + + + + + + + + + + + + @@ -171,13 +287,28 @@ 200*200 - - + + + + + + + + + + + + + + + + @@ -186,13 +317,28 @@ 400*200 - + + + + + + + + + + + + + + + + @@ -204,13 +350,28 @@ 400*200 - - - + + + + + + + + + + + + + + + + @@ -219,13 +380,28 @@ 200*200 - + + + + + + + + + + + + + + + + @@ -241,13 +417,28 @@ 300*150 - + + + + + + + + + + + + + + + + @@ -257,12 +448,27 @@ 300*300 - + + + + + + + + + + + + + + + + @@ -275,13 +481,28 @@ 300*300 - - + + + + + + + + + + + + + + + + @@ -290,13 +511,28 @@ 300*150 - + + + + + + + + + + + + + + + + @@ -314,13 +550,28 @@ 200*200 - - + + + + + + + + + + + + + + + + @@ -329,13 +580,28 @@ 200*200 - + + + + + + + + + + + + + + + + @@ -347,13 +613,29 @@ 200*200 - + + + + + + + + + + + + + + + + + @@ -363,13 +645,22 @@ 200*200 - - - + + + + + + + + + + + + + + + - - - @@ -382,13 +673,21 @@ 200*420 - - - - - - - + + + + + + + + + + + + + + + @@ -401,34 +700,36 @@ - - - + + - - - - {{item.title}} - - + + + + + {{item.title}} + + + - - - + + + + {{item.title}} - - - + + + + + + + + {{item.title}} + + + + - - - - - + \ No newline at end of file diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index 5682cc2..9b8746d 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -14,7 +14,14 @@ Component({ type: Object, value: null, }, - + sticky: { + type: Number, + value: 0, + }, + container: { + type: Function, + value: null, + }, }, data: { // 这里是一些组件内部数据 @@ -47,14 +54,17 @@ Component({ swiper_hei: 0, title_class: "", is_no_plus: 1, + container: null, }, - ready: function () { }, - lifetimes: { + ready: function () { + this.setData({ + container: () => wx.createSelectorQuery().select('#container') + }) + }, + attached: function () { - - //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法 var nav_item = this.data.object; var nav_list = this.data.object.nav_list; diff --git a/components/diy_goodsGroup/diy_goodsGroup.json b/components/diy_goodsGroup/diy_goodsGroup.json index c886449..184585e 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.json +++ b/components/diy_goodsGroup/diy_goodsGroup.json @@ -1,6 +1,7 @@ { "component": true, "usingComponents": { - "mp-loading": "weui-miniprogram/loading/loading" + "mp-loading": "weui-miniprogram/loading/loading", + "mp-sticky": "../mp-sticky/mp-sticky" } } \ No newline at end of file diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxml b/components/diy_goodsGroup/diy_goodsGroup.wxml index ddd463f..0f19b5d 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxml +++ b/components/diy_goodsGroup/diy_goodsGroup.wxml @@ -4,13 +4,27 @@ + + + + + {{item.title}} + + + + + {{item.title}} + + + + @@ -885,4 +899,6 @@ + + \ No newline at end of file diff --git a/components/diy_nav/diy_nav.wxml b/components/diy_nav/diy_nav.wxml index 47c11d1..4ab5090 100644 --- a/components/diy_nav/diy_nav.wxml +++ b/components/diy_nav/diy_nav.wxml @@ -3,13 +3,21 @@ - - - - - - + + + + + + + + + + + + + + + @@ -18,14 +26,21 @@ - - - - - - + + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/components/diy_picMax/diy_picMax.wxml b/components/diy_picMax/diy_picMax.wxml index f19db22..77393e1 100644 --- a/components/diy_picMax/diy_picMax.wxml +++ b/components/diy_picMax/diy_picMax.wxml @@ -9,6 +9,11 @@ + + + + + @@ -24,6 +29,11 @@ + + + + + diff --git a/components/diy_serviceCard/diy_serviceCard.js b/components/diy_serviceCard/diy_serviceCard.js index d30f396..6eca56d 100644 --- a/components/diy_serviceCard/diy_serviceCard.js +++ b/components/diy_serviceCard/diy_serviceCard.js @@ -17,7 +17,14 @@ Component({ type: Object, value: null, }, - + sticky: { + type: Number, + value: 0, + }, + container: { + type: Function, + value: null, + }, }, data: { // 这里是一些组件内部数据 @@ -49,12 +56,19 @@ Component({ title_index: 0, swiper_hei: 0, title_class: "", + container: null, }, - ready: function() {}, + lifetimes: { + ready: function() { + this.setData({ + container: () => wx.createSelectorQuery().select('#container') + }); + }, attached: function() { + let myStyle = ''; //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法 var nav_item = this.data.object; diff --git a/components/diy_serviceCard/diy_serviceCard.json b/components/diy_serviceCard/diy_serviceCard.json index e8cfaaf..17f7f47 100644 --- a/components/diy_serviceCard/diy_serviceCard.json +++ b/components/diy_serviceCard/diy_serviceCard.json @@ -1,4 +1,6 @@ { "component": true, - "usingComponents": {} + "usingComponents": { + "mp-sticky": "../mp-sticky/mp-sticky" + } } \ No newline at end of file diff --git a/components/diy_serviceCard/diy_serviceCard.wxml b/components/diy_serviceCard/diy_serviceCard.wxml index 92b3ec9..4d6a906 100644 --- a/components/diy_serviceCard/diy_serviceCard.wxml +++ b/components/diy_serviceCard/diy_serviceCard.wxml @@ -10,361 +10,219 @@ --> - - - - - - {{item.title}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - - - - {{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}} - - - - - - - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - - - - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - - - - {{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)}} + + + + + + {{item.title}} + + + + + + + + {{item.title}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.goods_name}} + + + + + {{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}} - - - - - - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + + + + + 销量:{{item.sales_sum}}件 + + + + + + + + + + + + + + + + + + - - @@ -386,17 +244,17 @@ src='{{imghost}}/miniapp/images/Promotion.png'> - + + {{item.goods_name}} + - {{item.goods_name}} - - {{item.prom_integral}}积分 - + - ¥{{item.prom_price}} - + {{item.prom_integral}}积分 + + + ¥{{item.prom_price}} + ¥{{item.market_price}} @@ -412,7 +270,7 @@ {{filter.toFix(item[card_field],2)}} - {{card_name}} + {{card_name}} @@ -488,364 +346,529 @@ - ¥{{item.shop_price}} - ¥{{item.market_price}} + ¥{{item.shop_price}} + ¥{{item.market_price}} - 销量:{{item.sales_sum}}件 - + 销量:{{item.sales_sum}}件 + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - - - - {{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}} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.goods_name}} + + + + {{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}} + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + + + 销量:{{item.sales_sum}}件 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.goods_name}} + - - - - - - {{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}} - - - - + + + {{item.prom_integral}}积分 + + + ¥{{item.prom_price}} + + ¥{{item.market_price}} - + - ¥{{item.shop_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}} + + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + - - - - 销量:{{item.sales_sum}}件 - - - - - - + + 销量:{{item.sales_sum}}件 + + + + + + + + + + + + + + + + + + + —— 宝贝已经全部加载 —— + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{aitem.goods_name}} + + + + {{aitem.prom_integral}} + + + ¥{{aitem.prom_price}} + + ¥{{aitem.market_price}} + + + + + + + + + + + + {{filter.toFix(aitem[card_field],2)}} + + + {{card_name}} + + + + + + + + {{aitem.market_price}} + + + + + + + + + {{filter.toFix(aitem.shop_price,2)}} + + + + + + + {{aitem.market_price}} + + + + + + + + + + + + {{filter.toFix(aitem.shop_price,2)}} + + + + + {{aitem.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(aitem,card_list,0),2)}} + + + {{g_filter.get_card_price(aitem,card_list,1)}} + + + + + + + + + + {{filter.toFix(aitem.shop_price,2)}} + + + + + + + {{aitem.market_price}} + + + + + + + ¥{{aitem.shop_price}} + ¥{{aitem.market_price}} + + + + 销量:{{aitem.sales_sum}}件 + + + + + + + + + + - - - - - - - - - - - - —— 宝贝已经全部加载 —— - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{aitem.goods_name}} - - - - {{aitem.prom_integral}} - + - ¥{{aitem.prom_price}} - - ¥{{aitem.market_price}} - - - - - - - - - - - - {{filter.toFix(aitem[card_field],2)}} - - - {{card_name}} - - - - - - - - {{aitem.market_price}} - - - - - - - - - {{filter.toFix(aitem.shop_price,2)}} - - - - - - - {{aitem.market_price}} - - - - - - - - - - - - {{filter.toFix(aitem.shop_price,2)}} - - - - - {{aitem.market_price}} - - - - - - - - {{filter.toFix(g_filter.get_card_price(aitem,card_list,0),2)}} - - - {{g_filter.get_card_price(aitem,card_list,1)}} - - - - - - - - - - {{filter.toFix(aitem.shop_price,2)}} - - - - - - - {{aitem.market_price}} - - - - - - - ¥{{aitem.shop_price}} - ¥{{aitem.market_price}} - - - - 销量:{{aitem.sales_sum}}件 - - - - - - - - - \ No newline at end of file + + diff --git a/components/diy_store_select/diy_store_select.wxss b/components/diy_store_select/diy_store_select.wxss index 26797c1..db12656 100644 --- a/components/diy_store_select/diy_store_select.wxss +++ b/components/diy_store_select/diy_store_select.wxss @@ -188,7 +188,7 @@ /* 门店分类列表 */ .sort_store_list { - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/components/mp-sticky/mp-sticky.js b/components/mp-sticky/mp-sticky.js new file mode 100644 index 0000000..0a70f23 --- /dev/null +++ b/components/mp-sticky/mp-sticky.js @@ -0,0 +1,155 @@ +const selectQuery = require('./selectQuery') +const target = '.weui-sticky' + +Component({ + options: { + addGlobalClass: true, + // 指定所有 _ 开头的数据字段为纯数据字段 + pureDataPattern: /^_/, + multipleSlots: true // 在组件定义时的选项中启用多slot支持 + }, + behaviors: [selectQuery], + properties: { + offsetTop: { + type: Number, + value: 0 + }, + zIndex: { + type: Number, + value: 99 + }, + disabled: { + type: Boolean, + value: false, + }, + container: { + type: null + } + }, + data: { + fixed: false, + height: 0, + _attached: false, + _containerHeight: 0, + }, + + observers: { + disabled: function(newVal) { + if (!this.data._attached) return + newVal ? this.disconnectObserver() : this.initObserver() + }, + + container: function(newVal) { + if (typeof newVal !== 'function' || !this.data.height) return + this.observerContainer() + }, + + offsetTop: function(newVal){ + if(typeof newVal !== 'number' || !this.data._attached) return + this.initObserver() + } + + }, + + lifetimes: { + attached() { + this.data._attached = true + if (!this.data.disabled) this.initObserver() + }, + + detached() { + this.data._attached = false + this.disconnectObserver() + } + + }, + + methods: { + getContainerRect () { + const nodesRef = this.data.container() + return new Promise(resolve => nodesRef.boundingClientRect(resolve).exec()) + }, + + initObserver() { + this.disconnectObserver() + this.getRect(target).then(rect => { + this.setData({ + height: rect.height + }) + this.observerContent() + this.observerContainer() + }) + }, + + disconnectObserver(observerName) { + if (observerName) { + const observer = this[observerName] + observer && observer.disconnect() + } else { + this.contentObserver && this.contentObserver.disconnect() + this.containerObserver && this.containerObserver.disconnect() + } + }, + + observerContent() { + const {offsetTop} = this.data + this.disconnectObserver('contentObserver') + + const contentObserver = this.createIntersectionObserver({ + thresholds: [1], + initialRatio: 1 + }) + contentObserver.relativeToViewport({ + top: -offsetTop + }) + contentObserver.observe(target, res => { + if (this.data.disabled) return + this.setFixed(res.boundingClientRect.top) + }) + this.contentObserver = contentObserver + }, + + observerContainer() { + const {container, height, offsetTop} = this.data + if (typeof container !== 'function') return + + this.disconnectObserver('containerObserver') + this.getContainerRect().then(rect => { + this.getRect(target).then(contentRect => { + const _contentTop = contentRect.top + const _containerTop = rect.top + const _containerHeight = rect.height + const _relativeTop = _contentTop - _containerTop + const containerObserver = this.createIntersectionObserver({ + thresholds: [1], + initialRatio: 1 + }) + containerObserver.relativeToViewport({ + top: _containerHeight - height - offsetTop - _relativeTop + }) + containerObserver.observe(target, (res) => { + if (this.data.disabled) return + this.setFixed(res.boundingClientRect.top); + }) + this.data._relativeTop = _relativeTop + this.data._containerHeight = _containerHeight + this.containerObserver = containerObserver + }) + }) + }, + + setFixed(top) { + const {height, _containerHeight, _relativeTop, offsetTop} = this.data + const fixed = _containerHeight && height + ? (top >= height + offsetTop + _relativeTop - _containerHeight) && (top < offsetTop) + : top < offsetTop + this.triggerEvent('scroll', { + scrollTop: top, + isFixed: fixed + }) + + this.setData({fixed}) + } + } +}) + diff --git a/components/mp-sticky/mp-sticky.json b/components/mp-sticky/mp-sticky.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/components/mp-sticky/mp-sticky.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/mp-sticky/mp-sticky.wxml b/components/mp-sticky/mp-sticky.wxml new file mode 100644 index 0000000..1114837 --- /dev/null +++ b/components/mp-sticky/mp-sticky.wxml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/components/mp-sticky/mp-sticky.wxs b/components/mp-sticky/mp-sticky.wxs new file mode 100644 index 0000000..266810f --- /dev/null +++ b/components/mp-sticky/mp-sticky.wxs @@ -0,0 +1,20 @@ + +/* eslint-disable */ +function wrapStyle(data) { + if (data.fixed) { + return 'top: ' + data.offsetTop + 'px;' + } + return '' +} + +function containerStyle(data) { + if (data.fixed) { + return 'height: ' + data.height + 'px; z-index: ' + data.zIndex + ';' + } + return '' +} + +module.exports = { + wrapStyle: wrapStyle, + containerStyle: containerStyle +} diff --git a/components/mp-sticky/mp-sticky.wxss b/components/mp-sticky/mp-sticky.wxss new file mode 100644 index 0000000..6e440ba --- /dev/null +++ b/components/mp-sticky/mp-sticky.wxss @@ -0,0 +1,11 @@ +.weui-sticky { + position: relative; +} + +.weui-sticky__fixed { + position: fixed; + left: 0; + top: 0; + width: 100%; + background-color: white; +} \ No newline at end of file diff --git a/components/mp-sticky/selectQuery.js b/components/mp-sticky/selectQuery.js new file mode 100644 index 0000000..c64cefd --- /dev/null +++ b/components/mp-sticky/selectQuery.js @@ -0,0 +1,31 @@ +module.exports = Behavior({ + methods: { + getRect(selector) { + return new Promise((resolve, reject) => { + this.createSelectorQuery() + .select(selector) + .boundingClientRect(rect => { + if (rect) { + resolve(rect) + } else { + reject(new Error(`can not find selector: ${selector}`)) + } + }).exec() + }) + }, + + getAllRects(selector) { + return new Promise((resolve, reject) => { + this.createSelectorQuery() + .selectAll(selector) + .boundingClientRect(rects => { + if (rects && rects.lenght > 0) { + resolve(rects) + } else { + reject(new Error(`can not find selector: ${selector}`)) + } + }).exec() + }) + } + } +}) diff --git a/packageA/pages/distribution/shop/shop.js b/packageA/pages/distribution/shop/shop.js index d9f78d6..f9452e5 100644 --- a/packageA/pages/distribution/shop/shop.js +++ b/packageA/pages/distribution/shop/shop.js @@ -196,7 +196,7 @@ Page({ //--- 判断是等级会员,且在有效期范围内 --- 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); + if (card_name && card_name.length > 4) card_name = card_name.substring(0, 8); th.setData({ card_field: user.card_field, card_name: card_name, diff --git a/packageA/pages/goodsInfo/goodsInfo.wxss b/packageA/pages/goodsInfo/goodsInfo.wxss index d6ac50e..0c694bc 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxss +++ b/packageA/pages/goodsInfo/goodsInfo.wxss @@ -2575,7 +2575,7 @@ line-height: 38rpx; } /* 门店分类列表 */ .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js index ab53025..c1e8126 100644 --- a/packageA/pages/myGift/myGift.js +++ b/packageA/pages/myGift/myGift.js @@ -61,7 +61,8 @@ Page({ /** * 生命周期函数--监听页面初次渲染完成 */ - onReady: function () {}, + onReady: function () { + }, /** * 生命周期函数--监听页面显示 @@ -75,6 +76,7 @@ Page({ userInfo: app.globalData.userInfo, imghost: app.globalData.setting.imghost, isLogin: true, + now:Date.parse(new Date()) / 1000, }); var index=this.data.currentIndex; @@ -91,7 +93,7 @@ Page({ if(index == 0) { url = '/api/weshop/libao/libaoForm/page'; - data.timetype=1; + data.timetype=2; } else if(index == 1) { url = '/api/weshop/libao/libaoFormvip/page'; }; diff --git a/packageA/pages/myGift/myGift.wxml b/packageA/pages/myGift/myGift.wxml index 9fb2f5b..731944e 100644 --- a/packageA/pages/myGift/myGift.wxml +++ b/packageA/pages/myGift/myGift.wxml @@ -5,11 +5,11 @@ - + - + 活动说明:{{item.lbintro}} @@ -23,11 +23,11 @@ {{filter.toFix(item.lbprice,2)}}/{{item.lbintegral}}积分 - - {{filter.toFix(item.lbprice,2) }} + + {{filter.toFix(item.lbprice,2) }} - {{item.lbintegral}}积分 + {{item.lbintegral}}积分 @@ -36,20 +36,28 @@ 已售{{item.salenum+item.virtualsales}}件 - 活动结束日期 {{filter.format_time(item.endtime)}} + 活动开始日期 {{filter.format_time(item.startime)}} + 活动结束日期 {{filter.format_time(item.endtime)}} - - 立即兑换 - 立即购买 - + + 活动还未开始 + + + + 立即兑换 + 立即购买 + + - + - + + + @@ -63,7 +71,7 @@ - + @@ -75,7 +83,7 @@ - + 活动说明: {{pop_remark_text}} diff --git a/packageA/pages/myGift/myGift.wxss b/packageA/pages/myGift/myGift.wxss index 1e961aa..05f5d37 100644 --- a/packageA/pages/myGift/myGift.wxss +++ b/packageA/pages/myGift/myGift.wxss @@ -52,6 +52,16 @@ page { font-weight: bold; } +.btn1 { + padding: 20rpx; + flex: 1; + text-align: center; +} + +.btn1.gray{ + background-color: #cccccc; + color:#fff +} .tab-title-item::after { position: absolute; diff --git a/packageA/pages/profile/profile.wxss b/packageA/pages/profile/profile.wxss index 00dfc79..dad2d8e 100644 --- a/packageA/pages/profile/profile.wxss +++ b/packageA/pages/profile/profile.wxss @@ -532,7 +532,7 @@ input { /* 门店分类列表 */ .sort_store_list { - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageA/pages/prom_list/prom_list.wxss b/packageA/pages/prom_list/prom_list.wxss index 4d5aad5..123ef64 100644 --- a/packageA/pages/prom_list/prom_list.wxss +++ b/packageA/pages/prom_list/prom_list.wxss @@ -267,7 +267,7 @@ } /* 门店分类列表 */ .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageA/pages/serviceCard_pd/team_show/team_show.wxss b/packageA/pages/serviceCard_pd/team_show/team_show.wxss index 75fa735..34fe160 100644 --- a/packageA/pages/serviceCard_pd/team_show/team_show.wxss +++ b/packageA/pages/serviceCard_pd/team_show/team_show.wxss @@ -2178,7 +2178,7 @@ page { .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageA/pages/serviceCard_pd/team_success/team_success.js b/packageA/pages/serviceCard_pd/team_success/team_success.js new file mode 100644 index 0000000..a1cbd08 --- /dev/null +++ b/packageA/pages/serviceCard_pd/team_success/team_success.js @@ -0,0 +1,991 @@ +var ut = require("../../../../utils/util.js"), + e = require("../../../../utils/common.js"), + a = require("../../../../utils/wxParse/wxParse.js"), + s = getApp(), + i = s.request, + o = s.globalData.setting, + os = o; + var regeneratorRuntime = require('../../../../utils/runtime.js'); + +Page({ + data: { + //activity_type:1,//活动类型 商家1 阶梯2 会员3 + p_status:1,//会员团的详细情况 1是正在行 2是成功 3失败 + sf_length: 1,//人数大于5 + + erweima:false, + meng:false, + zk:true, + stoid: o.stoid, + hiddenName: true, + teamlist:null, + teamgroup:null, + goods:null,//商品数据 + pindGoods: null,//拼单数据 + imageurl: o.imghost, + pay_f:0,//支付是否成功 + order_sn:"",//订单编号 + canvasHidden:false, //画画版 + screenWidth:0, + + pd_xx: 0, //弹框 + max_num:0,//最低成团人数 + min_price:0,//最低价格 + is_show:0,//加载完才显示 + + share_img_localpath:"", //分享图片的本地图片 + share_ewm_localpath: "", //分享的二维码本地图片 + share_head:"", //分享头像的本地图片 + + iurl:os.imghost, + ct_price:0,//阶梯团成团价格 + sf_arr:null, + + }, + onLoad: function (t) { + wx.setNavigationBarTitle({ title: "拼团订单",}) + var that=this; + var th=this; + //获取用户设备信息,屏幕宽度 + wx.getSystemInfo({ + success: res => { + that.setData({ screenWidth: res.screenWidth }) + } + }) + var pay_f = t.payf, order_sn = t.ordersn; + this.setData({ pay_f: pay_f, order_sn: order_sn}); + this.init(order_sn); + + //-- 自定义海报 -- + 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 && res.data.data && res.data.data.pageData && res.data.data.pageData[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}) + } + } + }) + }, + onShow:function () { + getApp().check_can_share(); + }, + + //关闭展开列表 + click:function(e){ + this.setData({ + hiddenName: !this.data.hiddenName, + zk: !this.data.zk, + }) + }, + //打开收起拼团列表 + czk:function(e){ + this.setData({ + zk:!this.data.zk, + hiddenName: !this.data.hiddenName, + }) + }, + //打开蒙板提示 + cmeng:function(e){ + this.setData({ + meng:!this.data.meng, + }) + }, + + //关闭蒙板提示 + cmc:function(e){ + this.setData({ + meng: !this.data.meng, + }) + }, +//打开二维码提示 + cerweima:function(e){ + this.setData({ + meng: !this.data.meng, + erweima: !this.data.erweima, + }) + }, + + cerc:function(e){ + this.setData({ + erweima: !this.data.erweima, + meng: !this.data.meng, + }) + }, + + async init( order_sn) { + + wx.showLoading(); + + var goods_id = 0,//商品ID, + pageteam=null,// + original_img=null ,//商品图片 + order=null,//订单编号 + service_list=null, //服务卡崇拜 + id = 0,//团购id + pt_listno = "",//团编号 + pt_prom_id = 0, //活动id + ee = this, + team_id = 0,//活动id + ordertx=[],//头像图片 + share_img=null,//分享图片 + teamlist=null,//活动表 + teamgroup=null,//活動从表 + max_num=0,//最低价格时的成团人数 + p_status=1; + + //--如果商家团的时候,这个要改--- + await getApp().request.promisePost("/api/weshop/order/pay/vipAutoTuan", { + data: {orderSn:order_sn,storeId:os.stoid } + }) + + await getApp().request.promiseGet("/api/weshop/recharge/get/"+os.stoid+"/"+order_sn, { + }).then(rs1=>{ + if(rs1.data.code==0){ + order=rs1.data.data; + } + }) + + + //获取order信息根据订单编号order_sn + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/page", { + data: { store_id: os.stoid, order_id: order.order_id,} + }).then(res => { + service_list = res.data.data.pageData[0]; + pt_prom_id = service_list.prom_id; + pt_listno = service_list.pt_listno; + }) + + if (this.data.payf || service_list.pt_status == 3) p_status = 3; //失败 + if (service_list.pt_status == 2 || service_list.pt_status == 4 || service_list.pt_status == 5) + p_status = 2; //成功 + if (service_list.pt_status < 2 && !this.data.payf) + p_status = 1; //正在进行 + if ( service_list.pt_status == 6) p_status = 4; //支付尾款失败 + + //多少人参团头像 + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/pagePtList", { + data: { store_id: o.stoid, pt_listno: pt_listno, } + }).then(res => { + ordertx = res.data.data.pageData; + }) + + var min_price=0; + //获取活动表的信息根据活动pt_prom_id + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + pt_prom_id, { + data: { } + }).then(res => { + if(res.data.code==0){ + teamlist=res.data.data; + this.setData({ + teamlist:teamlist + }); + var nt =ut.gettimestamp(); + teamlist.status=0; + + if (nt >= teamlist.start_time) teamlist.status = 1; + goods_id = res.data.data.goods_id; + id = res.data.data.id; + share_img = ee.data.imageurl + res.data.data.share_imgurl; + + //----------查看阶梯团------------ + if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){ + var ct_rylist = JSON.parse(teamlist.ct_rylist); + var max=0; var pri=0; + ct_rylist.forEach(function (val,ind) { + if(val.rynum>max){ + max=val.rynum; + pri = val.price; + } + }) + max_num=max; + min_price=pri; + } + + } + + //-- 商品地址 -- + original_img = ee.data.imageurl+ service_list.img_url, + ee.setData({goods: service_list,image: original_img,}) + + + }) + + //只装5个 + var ordertx2=[],sf_num=0,ct_nun=teamlist.ct_num; + if(max_num){ + ct_nun=parseInt(max_num); + if (ordertx && ct_nun < ordertx.length) ct_nun = ordertx.length; + } + + if(ct_nun>5) ct_nun=5; + for(var i=0;i= ordertx.length) sf_num++ + else + ordertx2.push(ordertx[i]); + } + + var sf_arr=[]; + for (var i=0;i { + teamgroup = res.data.data.pageData[0]; + if (teamgroup){ + var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss"); + teamgroup.buy_start_date=buy_start_date; + } + }) + + + var ct_price = 0, + num_0 = ordertx.length; + if (teamlist.kttype == 3){ + var js_data = JSON.parse(teamlist.ct_rylist); + js_data.forEach(function (val,ind) { + if (num_0<=val.rynum && ct_price==0){ + ct_price=val.price; + } + }) + if(ct_price==0) ct_price=min_price; + } + + //获取大家都在团信息 + getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1?store_id="+ os.stoid +"&is_end=0&is_show=1" , { + data:{page:1,pageSize:2} + }).then(res => { + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ + pageteam = res.data.data.pageData; + ee.setData({pageteam: pageteam,}) + } + + }) + + //--当是成团的时候的操作-- + if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){ + //设置值 + + ee.setData({ + ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, min_price: min_price, + order: order, share_img: share_img,max_num:max_num, + pindGoods: teamlist,is_show:1, zk:false, + hiddenName: false, ct_price:ct_price,p_status:p_status,sf_arr:sf_arr}); + + //--是否支付了尾款-- + if(order.pt_status==4 || order.pt_status==5){ + ee.setData({is_pay_wk:1}); + } + }else{ + console.log("239什么鬼", teamlist); + //设置值 + ee.setData({ + ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, + order: order, p_status: p_status, min_price:min_price, + share_img: share_img, max_num: max_num, pindGoods: teamlist, is_show: 1, + ct_price: ct_price, p_status: p_status,sf_arr:sf_arr}); + } + + wx.hideLoading(); + + wx.setNavigationBarTitle({ + title: "拼团详情", + }) + + ee.countDown2(); + + //获取分享图片的本地地址 + var path2 = os.imghost + teamlist.share_imgurl; + wx.getImageInfo({ + src: path2, + success: function (res) { + //res.path是网络图片的本地地址 + ee.data.share_img_localpath = res.path; + }, + fail: function (res) { + //失败回调 + } + }); + + + }, + //---小于10的格式化函数---- + timeFormat(param) { + return param < 10 ? '0' + param : param; + }, + countDown2() { + var th = this; + // 获取当前时间,同时得到活动结束时间数组 + var newTime = ut.gettimestamp(); + var o = this.data.teamgroup; + if(!o) return false; + + var endTime = o.kt_end_time; + if (o.status == 0) endTime = o.start_time; + + //看一下,是否要支付尾款 + if(o.team_type==3 && th.data.order.pt_status==2){ + endTime = o.wk_end_time; + } + + let obj = null; + // 如果活动未结束,对时间进行处理 + if (endTime - newTime > 0) { + let time = (endTime - newTime); + // 获取天、时、分、秒 + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec) + } + } else { + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + } + var txt = "pindGoods.djs"; + th.setData({ + obj: obj + }); + setTimeout(th.countDown2, 1000); + }, + + //--定义的保存图片方法,分享团--- + saveImageToPhotosAlbum: function () { + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 + var type=1; + if(this.data.teamlist.kttype==3) type=2; + + wx.showLoading({ title: '生成中...', }) + var that = this, th = that; + //设置画板显示,才能开始绘图 + that.setData({ + canvasHidden: true, + }) + + if(this.data.share_hidden) { + this.setData({ + share_hidden: false, + }); + }; + + var app = getApp(); + var unit = that.data.screenWidth / 750 * 1.35; + var scene=th.data.teamgroup.id; + var goods_id=th.data.teamlist.goods_id; + var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0; + if(user_id>0){ + scene+="_"+user_id; + } + if(goods_id !==""){ + scene+="_"+goods_id; + } + + //二微码 + var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+ + os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show"; + + console.log(path3,6000); + + //读取文件成功则OK-- + wx.getImageInfo({ + src: path3, + success:function (res) { + console.log(res,5000); + //回调写法 + th.get_head_temp(th.get_goods_temp,function () { + var vpath = res.path; + var context = wx.createCanvasContext('share'); + + + //先画背景 + var pg_path = "../../../../images/share/share_bg.png"; + //-- 如果有自定义海报的时候,判断背景的图片 -- + if(th.data.share_b_img){ + pg_path=th.data.share_b_img; + } + + var share_title=th.data.teamlist.share_title; + if(!share_title) + share_title=th.data.teamlist.title; + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + + //-- 是自定义海报的情况下 -- + if(th.data.poster && parseInt(th.data.poster.style)==2){ + //在线上分享人的情况下 + if(parseInt(th.data.poster.show_headpic)){ + //获取坐标 + var x=parseFloat(th.data.poster.head_x)*2; + var y=parseFloat(th.data.poster.head_y)*2; + var x1=(x+90) *unit; + var y1=(y+50) *unit; + //--昵称--- + context.setFontSize(24 * unit) + context.setFillStyle("black") + context.fillText(app.globalData.userInfo.nickname, x1, y1); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; + //强烈推荐 改许程 + var tj_path = "../../../../images/share/q_tj.png"; + context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit) + context.setLineJoin('round'); //交点设置成圆角 + context.setFillStyle("white") + context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); + } + + }else{ + //--昵称--- + context.setFontSize(24 * unit) + context.setFillStyle("black") + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; + //强烈推荐 + var tj_path = "../../../../images/share/q_tj.png"; + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit); + context.setFontSize(18 * unit) + context.setFillStyle("white") + context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit); + } + + + //---产品名称--- + context.setFontSize(21.3 * unit); + context.setFillStyle("black"); + + + + + th.draw_Text(context,share_title, + 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); + //------产品的价格------- + context.setFontSize(24 * unit) + context.setFillStyle("red") + + var pri0 = th.data.teamlist.price; + pri0=parseFloat(pri0).toFixed(2); + var wd1=th.data.screenWidth-ut.measureText(pri0, 31 * unit)-25; + context.fillText("¥", wd1-15, 180 * unit); + context.setFontSize(31 * unit) + context.fillText(pri0, wd1, 180 * unit); + + //---市场价划掉--- + context.setFillStyle("gray") + context.setFontSize(22 * unit) + pri0= "¥" + parseFloat(th.data.goods.market_price).toFixed(2); + var wd2=th.data.screenWidth-ut.measureText(pri0, 22 * unit)-25; + context.fillText(pri0, wd2, 210 * unit); + + context.setStrokeStyle('gray') + context.setLineWidth(1 * unit) + context.moveTo(wd2-5, 204 * unit) + context.lineTo(wd2+ut.measureText(pri0, 22 * unit)+5, 204 * unit) + context.stroke(); + console.log(th.data.share_img_localpath); + + + //---中间大图--- + context.drawImage(th.data.share_img_localpath, 68 * unit, 242 * unit, 410 * unit, 410 * unit); + + var g_ct=th.data.teamlist.ct_num-th.data.ordertx.length; + var wz= ""; + if(g_ct>0) wz="还差"+g_ct+"人成团,"; + else{ + g_ct= th.data.max_num -th.data.ordertx.length; + if(g_ct>0){ + wz="还差"+g_ct+"人享最低优惠,"; + }else{ + wz="已享受最优惠,"; + } + } + + //-------大图后面就不一样了----------- + switch (type) { + case 1://会员团和商家团的展示 + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 670 * unit) + context.lineTo(520 * unit, 670 * unit) + context.stroke(); + + //---文字--- + context.setFontSize(22 * unit) + context.setFillStyle("black") + context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); + + //绘制成团图片 + var ct_img ="../../../../images/share/ct_num.png"; + context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); + var ct_num = th.data.teamlist.ct_num; + context.setFontSize(14 * unit) + + context.setFillStyle("red") + if(ct_num<10){ + context.fillText(ct_num+"人拼团", 92 * unit, 760 * unit); + }else{ + context.fillText(ct_num+"人拼团", 86 * unit, 760 * unit); + } + context.setFontSize(22 * unit) + context.fillText("已拼"+th.data.teamlist.buy_num+"份", 166 * unit, 763 * unit); + context.setFillStyle("gray") + context.fillText(wz+"快来和我一起拼团吧!", 40 * unit, 826 * unit); + context.setFillStyle("black") + + context.setFontSize(22 * unit) + context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit); + //---二维吗图--- + //-- 自定义海报 -- + if(th.data.poster){ + var erm_x= parseFloat(th.data.poster.ewm_x)*2; + var erm_y= parseFloat(th.data.poster.ewm_y)*2; + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); + }else{ + //---二维吗图--- + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); + } + break + case 2://阶梯团的展示 + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 670 * unit) + context.lineTo(520 * unit, 670 * unit) + context.stroke(); + //---文字--- + context.setFontSize(22 * unit) + context.setFillStyle("black") + context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); + //---绘制中间阶梯的价格--- + var list= JSON.parse(th.data.teamlist.ct_rylist); + for(var i=0; i canvasWidth) { + han++; + if (han == 2) + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 + else + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); + + initHeight += 22; //22为字体的高度 + lineWidth = 0; + lastSubStrIndex = i; + titleHeight += 20; + } + if (i == str.length - 1) { //绘制剩余部分 + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); + } + } + }, + + //c点击打开拼团弹窗 + cpd: function() { + console.log("heheh"); + this.setData({ pd_xx: 1,}) + }, + + //点击关闭拼团弹窗 + close_pt_xx: function() { + this.setData({ pd_xx: 0, }) + }, + + go_goodsinfo:function (e) { + var index=e.currentTarget.dataset.index; + var item=this.data.pageteam[index]; + var gid=item.goods_id; + var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gid+"&prom_id="+item.id+"&prom_type=6"; + if(item.goods_type==1){ + url="/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?goods_id="+gid+"&prom_id="+item.id+"&prom_type=6"; + } + getApp().goto(url); //跳到非tabbar页 + }, + + gohome:function () { + getApp().goto("/pages/index/index/index"); + }, + + //--获取头像的本地缓存,回调写法-- + get_head_temp:function (tt,func) { + var ee=this; + if(ee.data.share_head){ + tt(func); + return false; + } + //---获取分享图片的本地地址,头像和商品图片---- + var path2 = getApp().globalData.userInfo.head_pic; + if(path2==""){ + ee.data.share_head ="../../../images/share/hui_hear_pic.png"; + tt(func); + }else { + path2=path2.replace("http://thirdwx.qlogo.cn","https://wx.qlogo.cn"); + path2=path2.replace("https://thirdwx.qlogo.cn","https://wx.qlogo.cn"); + wx.getImageInfo({ + src: path2, + success: function (res) { + //res.path是网络图片的本地地址 + ee.data.share_head = res.path; + tt(func);; + }, + fail: function (res) { + ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的 + tt(func); + } + }); + } + }, + + //--获取商品图片的本地缓存,回调写法-- + get_goods_temp:function (tt) { + var ee=this; + if(ee.data.share_img_localpath) { + tt(); + return false; + } + var path2 = os.imghost + ee.data.teamlist.share_imgurl; + //获取商品是分享图信息 + wx.getImageInfo({ + src: path2, + success: function (res) { + //res.path是网络图片的本地地址 + ee.data.share_img_localpath = res.path; + tt(); + }, + fail: function (res) { + ee.data.share_img_localpath= "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 + tt(); + } + }); + }, + + go_pay_wk:function(){ + var url = "/pages/cart/cart_wk/cart_wk?order_id=" + this.data.order.order_id; + getApp().goto(url); + }, + + img_show_err:function(e){ + var err_img = e.currentTarget.dataset.err; + var ob={}; + ob[err_img] = this.data.iurl + "/miniapp/images/default_g_img.gif"; + this.setData(ob); + + }, + + //------ 分享配置 -------- + onShareAppMessage: function (e) { + getApp().globalData.no_clear=1; + var th=this; + var scene=this.data.teamgroup.id; + var goods_id=this.data.teamlist.goods_id; + var url="/pages/team/team_show/team_show?tg_id="+scene+"&goods_id="+goods_id; + //--分享图片-- + var img=th.data.iurl+th.data.teamlist.share_imgurl; + //--把会员分享出去-- + if(getApp().globalData.user_id){ + if(url.indexOf("?")>0) + url+="&first_leader="+getApp().globalData.user_id; + else + url+="?first_leader="+getApp().globalData.user_id; + } + // console.log('url+++++>>>>>', url, th.data.teamlist.title); + + var share_title=th.data.teamlist.title; + if(th.data.teamlist.share_title){ + share_title=th.data.teamlist.share_title; + } + return { + path:url, + title: share_title, + imageUrl: img, + } + }, + + clickShare() { + if(!getApp().globalData.user_id){ + getApp().goto("/pages/togoin/togoin"); + return false; + } + this.setData({ + share_hidden: true, + }); + }, + + send() { + this.setData({ + share_hidden:false, + }); + }, + + cancel() { + this.setData({ + share_hidden:false, + }); + }, + + + 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 + }); + }); + } + + }) + }, + + + // 保存图片到系统相册 + 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, + }); + } + }) + }) + }, + + // 获取用户已经授予了哪些权限 + 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(); + } + }) + }) + }, + + + go_to:function (e) { + var url=e.currentTarget.dataset.url; + getApp().goto(url); + } + +}) + diff --git a/packageA/pages/serviceCard_pd/team_success/team_success.json b/packageA/pages/serviceCard_pd/team_success/team_success.json new file mode 100644 index 0000000..528e630 --- /dev/null +++ b/packageA/pages/serviceCard_pd/team_success/team_success.json @@ -0,0 +1,12 @@ +{ + "windom": { + "navigationBarTitleText": "拼团订单", + "backgroundTextStyle": "light", + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#eeeeee" + }, + "usingComponents": { + "share": "/components/share/share" + } +} \ No newline at end of file diff --git a/packageA/pages/serviceCard_pd/team_success/team_success.wxml b/packageA/pages/serviceCard_pd/team_success/team_success.wxml new file mode 100644 index 0000000..4889b15 --- /dev/null +++ b/packageA/pages/serviceCard_pd/team_success/team_success.wxml @@ -0,0 +1,310 @@ + + + + + + + + + + + + + {{goods.service_name}} + + + + + + {{teamlist.price}} + + 零售价¥{{goods.show_price}} + + + + + 已拼{{teamlist.buy_num}}件 + + + + + + {{teamlist.ct_num}}人拼 + + + + + + + + + + + + + + + 当前价格 + ¥{{ct_price}}, + + 还差{{max_num-ordertx.length}}人享受最低价格¥{{min_price}} + + + 该团已经拼购到最低价了哦~ + + + + + 拼团成功,当前价格 + ¥{{ct_price}} + + + + + + + + + + + 拼团失败 + + + + + + + + 还差 + {{teamlist.ct_num-ordertx.length}}人成团,组团成功为您节省 + {{filters.toFix(goods.show_price-teamlist.price,2)}}元 + + + + 拼团成功,为您节省 + {{filters.toFix(goods.market_price-teamlist.price,2)}}元 + + + + + + + + + + + 团长 + + + + + + + + + + + + + + + + + + + + 剩余 + + {{obj.hou}}: + {{obj.hou}}: + {{obj.min}}: + {{obj.sec}}结束 + + + + + 剩余支付时间: + + {{obj.hou}}时 + {{obj.min}}分 + {{obj.sec}}秒 + + + + 拼团已结束 + + + + + + 还差 + {{teamlist.ct_num-ordertx.length}}人参团, 拼团失败。 + + + + 已经有 + {{ordertx.length}}人参团, 拼团成功。 + + + + + + + + + + + 拼团成功, 规定时间内支付尾款即发货 + + + 点击下方按钮分享给小伙伴,可快速成团! + + + + + + + + + + + + + + + + + + + + + + + + + + 查看拼团列表 + + + + + + + + + + + + + + + + + + + + + 大家都在团 + + + + + + + + + + + + + + + + ¥{{item.price}} + + {{item.ct_num}} + 人参团 + + + + + {{item.goods_name}} + + + + + + + + + + + + + + + + + 拼团玩法介绍 + + + 1.开团: + 选择心仪商品,点击“发起X人团”按钮,付款后即为开团成功; + + 2.参团: + 进入朋友分享的页面,点击“立即参团”按钮,付款后即为参团成功,若多人同时支付,支付成功时间较早的人获得参团资格; + + 3.成团: + 在开团或参团成功后,点击“邀请小伙伴参团”将页面分享给好友,在有效时间内凑齐人数即为成团,此时商家会开始发货; + + 4.组团失败: + 在有效时间内未凑齐人数,即为组团失败,此时付款项会原路退回到支付账户; + + 5. + 组团有效期间内,拼购商品订单不允许取消。 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packageA/pages/serviceCard_pd/team_success/team_success.wxss b/packageA/pages/serviceCard_pd/team_success/team_success.wxss new file mode 100644 index 0000000..9d13c9f --- /dev/null +++ b/packageA/pages/serviceCard_pd/team_success/team_success.wxss @@ -0,0 +1,965 @@ +page{ + background-color:#eee; +} +.top{ + background-color:rgb(216, 230, 220); + color: rgb(98, 155, 13); + text-align: center; + height:120rpx; + width: 100%; + padding-top:24rpx; +} + +.center{ + height: 240rpx; + width: 100%; + position: relative; + background:#fff; +} + +.cenleft{ + width: 240rpx; + height: 100%; + + float: left; + display:flex; + justify-content: center; + align-items: center; +} + +.cenleft image{ + background-color:white ; + width: 200rpx; + height: 200rpx; + +} + + +.cenrt{ + width: 460rpx; margin-top: 10rpx; +} + +.cenright{ + height: 100%; + width: 460rpx; + + float: left; +} + +.cenrtop{ + margin-top: 10rpx; + background-color: red; + color: white; + border-radius:10rpx; + padding-left: 16rpx; + width: 140rpx; + font-size: 32rpx; + float: left; + height: 40rpx; +} + +.cenrtoptitle{ + float: left; + width: 295rpx; + height: 40rpx; + margin-left: 12rpx; + font-size: 28rpx; + margin-top:12rpx; +} + +.cenrtoptitle>span{ + width: 100%; + display: inline-block; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap +} + +.cenrcen{ + height: 70rpx; + margin-top: 35rpx; + width:474rpx; +} +.jg{ font-size: 40rpx; + margin-right: 30rpx;} +.jgx{ + font-size: 28rpx; + color: #777; + text-decoration:line-through; + margin-left: 20rpx; +} + +.cenrfoot{ + align-content: center; + text-align: center; + border: 2rpx solid red; + border-radius:10rpx; + color: red; + float: left; + font-size: 24rpx; + padding: 4rpx 16rpx; +} + +.body{ + background-color: white; + /* min-height:418rpx; */ + width: 100%; + margin-top: 4rpx; + border-top:5rpx solid #eee; + height: auto; +} + +.bodytop{ + background-color: white; + text-align: center; + font-size: 28rpx; + height:100rpx; + line-height:117rpx; + +} + +.bodytop span{ + color: red; +} + + +.bodyimg{ + height:140rpx; + width:590rpx; + + + +} +.bodyimg image{ + +border-radius:50rpx; +height: 96rpx; +width: 96rpx; +background-color:burlywood; +margin-top: 30rpx; + position: absolute; + +} + +.d{ +width:101rpx; + height:101rpx; + display: inline-block; + margin-right:15rpx; + +} + +.bodyimg span{ + background-color:#e22b44; + color: white; + font-size: 24rpx; + border-radius:6rpx; + padding:2rpx 10rpx; + position: relative; + top: 0rpx; + left: 40rpx; +} + + + +.bodyspan{ + color: red; + text-align: center; + font-size: 26rpx; + +} + +.bodyselect{ + line-height: 47rpx; +} + +.bodytime{ + height: 88rpx; + width: 100%; + display: flex; + flex-wrap: nowrap; + margin-left:40rpx; + align-items:center; + +} + +.bodytimeleft{ + text-decoration:line-through; + flex-grow: 1.7; +} + + +.bodytimecen-success{ + text-align: center; + flex-grow: 1; + line-height:75rpx; + font-size: 30rpx; + color: #000; +} +.bodytimecen-success span{ + + color: #18ba5f; + border-radius:7rpx; + font-size: 30rpx; + margin: 0 auto; + +} +.bodytimecen{ + text-align: center; + flex-grow: 1; + + font-size: 30rpx; + color: #000; +} +.bodytimecen span{ + background-color: #333333; + color: white; + border-radius:7rpx; + padding-left: 10rpx; + font-size: 30rpx; + margin: 0 auto; + padding-right:10rpx; + margin-right:5px +} + + +.bodytimecen span:last-child{ + margin-right: 10rpx; +} + +.bodytimeright{ + flex-grow: 1.7; + margin-right:72rpx; + +} + +.bodybutton{ + width: 90%; + margin: 0 auto; + text-align: center; + line-height: 60rpx; + border-radius:15rpx; + height: auto; +} + +.bodybutton button{ + height:60rpx; + width: 100%; + background-color: #e4374d; + color: white; + font-size:26rpx; + border-radius:12rpx; + +} + +.bodyfoot{ + + width: 100%; + text-align: center; + + font-size: 28rpx; + color: #000; + background-color: white; +} + + + + + +.pintuan{ + width: 100%; + height: 84rpx; + background-color: white; + color: black; + text-align: center; + font-size:36rpx; + margin-top: 60rpx; +} + +.pintuanzhou{ +float: left; + +line-height: 84rpx; +width: 220rpx; +} + +.pintuanyou{ + float: right; + color: rgb(168, 167, 167); + line-height: 84rpx; + font-size: 28rpx; + margin-right: 20rpx; +} + +.onegoods{ + background-color: white; + width: 345rpx; + min-height: 490rpx; + height:auto; + + border:2rpx solid #eee; + + float: left; + margin-right:17rpx; + border-radius:20rpx; +} + +.goodsl{ + background-color: white; +} + +.onegoodsimg{ + width: 100%; + height: 360rpx; +} + +.onegoodsimg image{ + height: 100%; + width: 100%; + border-radius:20rpx 20rpx 0 0; + +} + .xc-buttmo-frame{ + min-height: 103rpx; + height: auto; + padding-bottom:15rpx; + + } +.xc-buttmo-frame .onegoodsdesc { + + height: 80rpx; +} + +.xc-buttmo-frame .onegoodsdesc .price{ + + padding-left:10rpx; + height:85rpx; + +} +.xc-ping{ + border-radius: 50%; + background: #fff; + line-height:34rpx; +width:34rpx; +height:34rpx; +font-size:24rpx; + +} +.jgleft{ +border-radius:36rpx; +height:45rpx; +line-height:50rpx; +color:#fff; +padding-left:7rpx; +padding-right:24rpx; +background:#e4374d; +} + +.jgright{ + font-size: 26rpx; + height:16rpx; +padding-right:10rpx; +color:rgb(168, 167, 167); +} + +.jgright span{ + color: rgb(168, 167, 167); +} + +.goodslisttop{ + width: 100%; +} + +.goodslisttop{ + width: 100%; + margin-top: 5rpx; + border-bottom: 4rpx solid #eee; + text-align: center; +} + +.goodslistspan{ + + margin: 0 auto; + padding-top: 20rpx; +} + +.xian{ + width: 100%; + border-bottom: 2rpx solid #eee; + float: left; +} + +.bodyselect{ + height: 90rpx; + background-color: white; + width: 100%; + line-height:90rpx; + +} + + +.changxin{ + overflow: hidden; + width: 100%; + padding-left:20rpx; + +} + +.zhangxi{ + width: 100%; + background-color:white; + color: black; +} + +.img{ + height: 100rpx; + margin-bottom: 0rpx; + float: left; + color: black; + line-height:100rpx; +display:flex; +align-items:center; + +} + +.zhangxi image{ + border-radius:50rpx; + height: 60rpx; + width: 60rpx; + float: left; + + background-color: red; + margin-left: 40rpx; + margin-right:10rpx; + +} + +.zhangxi .zssj{ + width: 413rpx; + margin-left: 28rpx; + float: right; + margin-top:32rpx; +} + +.zspan{ + float: left; + text-align: center; + display: flex; + align-items: center; + justify-content: center; + height: 48rpx; + font-size: 28rpx; + color:#000; + margin-bottom: 10rpx; + padding-bottom: 10rpx; + width: 100%; + background: #fff; + border-bottom:3rpx solid #eee; + margin-top:20rpx; + +} + + + +.mtop{ + text-align: center; + color: white; + background-color:rgba(0, 0, 0, .4); + width: 100%; + height: 100%; + position: fixed; + z-index: 5;top:0;left: 0; + +} + +.mt1{ + margin-top: 200rpx; + margin-bottom: 20rpx; +} + +.mts{ + color:#E1E10B; +} + +.mcou{ + font-size: 48rpx; + +} + +.mfoot{ + width: 100%; + margin-top: 700rpx; +} + + +.mbtn{ + margin-top: 60rrpx; + width: 400rpx; + background: #666666; + color: #fff; + border-radius: 20rpx; + font-size: 32rpx; +} + + + + + + + +.etop{ + padding-top: 200rpx; + width: 100%; + height: 100%; + position: fixed; + left: 0rpx; + top: 0rpx; + z-index: 12rpx; +background-color:rgba(0, 0, 0, .4); + +} + +.emyimage{ + display:flex; + justify-content: center; + align-items: center; +} + + +.emyimage image{ + background-color: red; + width: 300rpx; + height: 300rpx; + margin: 0 auto; + +} + +.espan{ + font-size: 32rpx; + margin-top: 10rpx; +} + +.erweima{ + margin-top: 10rpx; + display: flex; + width: 100%; + +} + +.erzhou{ + width: 200rpx; + + + margin-right: 20rpx; +} + +.erzhou image{ + background-color: blanchedalmond; + width: 200rpx; + height: 200rpx; +} + + +.eright{ + width: 500rpx; + font-size: 32rpx; + +} + + + +.ecc{ + float: right; + margin-right: 48rpx; +} + + +.eee{ + padding-top:40rpx; + +width:90%; +height:70%; + +padding-left:32rpx; +margin-left:20rpx; + +background-color:white; + +} + +.clear{ + clear: both; +} + +.down-arrow { + display: inline-block; + position: relative; + width: 40rpx; + height: 30rpx; + margin-right: 20rpx; +} + +.down-arrow::after { + display: inline-block; + content: " "; + height: 18rpx; + width: 18rpx; + border-width: 0 2rpx 2rpx 0; + border-color: #000; + border-style: solid; + transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); + transform-origin: center; + transition: transform 0.3s; + position: absolute; + top: 50%; + right: 10rpx; + margin-top: -10rpx; +} + +.down-arrow1 { + display: inline-block; + position: relative; + width: 40rpx; + height: 30rpx; + margin-right: 20rpx; + margin-top: 12rpx; +} + +.down-arrow1::after { + display: inline-block; + content: " "; + height: 18rpx; + width: 18rpx; + border-width: 0 2rpx 2rpx 0; + border-color: #000; + border-style: solid; + transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); + transform-origin: center; + transition: transform 0.3s; + position: absolute; + top: 50%; + right: 10rpx; + margin-top: -10rpx; +} + +.down-arrow1::after { + transform-origin: center; + transform: rotate(-135deg); + transition: transform 0.3s; +} + +.bview { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); +} + +.juzhong { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.juzhong .xq { + padding: 0 20rpx; + background: #fff; + font-size: 30rpx; + padding-bottom: 20rpx; +} + +.juzhong .xq .title { + text-align: center; + margin: 20rpx 0; + position: relative; + height: 50rpx; +} + +.juzhong .xq .hs1 { + font-size: 28rpx; + color: #ab8f9e; +} + +.juzhong .xq .title .close { + position: absolute; + top: 0; + right: 0; + width: 45rpx; + height: 45rpx; +} + +.pt_qd { + margin-top: 40rpx; + height: auto; +} + +.spec-cart-btn.w100 { + width: 100%; + margin-left: 0; + height: 80rpx; + line-height: 80rpx; +} + +.pt_status_set{ + position: absolute; right: 10rpx; top:50rpx; width: 120rpx; height: 120rpx; +} + + + +.xc-goods-details{ +width:479rpx; +margin-top:20rpx; +height:77rpx; +} + +.xc-valframe{ + border-radius:7rpx; +border:1rpx solid; +margin-top:3rpx; +} +.xc-valframe .xc-frame-img{ + width:30rpx; +height:100%; +background:#e22b44; +} +.xc-valframe .xc-frame-img .picture{ + width:25rpx; +height:25rpx; +margin-top:4rpx; + +} +.xc-ellipsis-img{ +width:56rpx; +height:96rpx; + +} +.xc-ellipsis-img .pictures{ + width:56rpx;height:56rpx; +} +.flex_tou{ display: flex; justify-content: center; width: 100%;} +.xc-ptcomplete{ + width:74%; +height:105rpx; +line-height:105rpx; +float:right; + +} +.xc-ptcomplete .xc-img-frame .img{ + width: 105rpx; + height: 105rpx; + float: right; +} +.xc-ptcomplete-ladder .xc-img-frame{ + width:201rpx; + height: 105rpx; + margin-top:20rpx; +} +.xc-ptcomplete-ladder .xc-img-frame .img{ + width: 105rpx; + height: 105rpx; + float: right; + padding-right:6rpx; +} +.xc-ptcomplete .xc-img-frame{ + width:190rpx; + height: 105rpx; + margin-top:20rpx; +} +.xc-ptcomplete .xc-end{ + width:283rpx; +text-align:right; +} +.iw{ +padding-right:33rpx; +} +.xc-ptcomplete .xc-img-frames{ + width:360rpx; +height:105rpx; +margin-top:20rpx; + +} +.xc-ptcomplete .xc-img-frames .img{ + width: 105rpx; + height: 105rpx; + float: right; + padding-right:6rpx; +} +.xc-home-page-frame{ + padding-top:16rpx; + +} +.xc-home-page-frame .xc-home-page{ + background-color: #e22b44;border-radius:15rpx; +width:90%; +color:#fff; +height:60rpx; +font-size:26rpx; +line-height:60rpx; +} +/* */ +.xc-people-val{ + padding-left:8rpx; +padding-right:8rpx; +} +.xc-onclik{ + width:100%; +height:70rpx; + +} +.xc-green{ + color: #18ba5f; + text-align:center; +flex-grow:1; +height:90rpx; + + +} +.xc-ptcomplete-ladder{ + width:74%; +height:105rpx; +line-height:105rpx; +float:right; +} +.xc-fail-ladder{ + width:61%; +height:105rpx; +line-height:105rpx; +float:right; + +} +.xc-fail-ladder .xc-img-frame{ + width:61%; +height:105rpx; +margin-top:20rpx; +} +.xc-fail-ladder .xc-img-frame .img{ + width: 105rpx; + height: 105rpx; + float: right; + padding-right:6rpx; +} +.xc-list{ + background-color:#e22b44; +color:white; +font-size:17rpx; +border-radius:6rpx; +padding:0 5rpx; +position:absolute; +top:13rpx; +left:80rpx; +width:34rpx; +line-height:25rpx; + +} + +.xc-linellae-frame{ + width: 100%; + height: 60rpx; + background: #eee; +} +.xc-linellae-frame .xc-linellae{ + width: 425rpx; + height: 1rpx; + border-bottom: 1rpx solid #a5a5a5; +} +.xc-recommend-frame{ +background:#eee; +width:200rpx; +height:100%; + +} +.xc-recommend-frame .xc-recommend{ + width: 35rpx; + height: 27rpx; + margin-top:7rpx; +} +.xc-recommend-frame .xc-recommend-word{ +font-size:26rpx; +color: #a9a9a9; +margin-left:5rpx; +} +.xc-rmbs{ + +height:40rpx; +} +.xc-shuoming{ + padding-left:10rpx; +} + + +.poster-container { + box-sizing: border-box; + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: calc(100% - 210rpx); + z-index: 1000; +} +.mask { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; + background-color: rgba(0,0,0,.4); +} +.poster-wrapper { + width: 100%; +} + +.poster { + box-sizing: border-box; + width: 100%; + height: 905rpx; + 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: #ccc; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + text-align: center; + border-radius: 50%; + position: absolute; + right: 20rpx; + top: 20rpx; +} + +.icon-close { + font-size: 48rpx; +} \ No newline at end of file diff --git a/packageB/pages/zuhegou/index/index.wxss b/packageB/pages/zuhegou/index/index.wxss index 2577190..a2ca988 100644 --- a/packageB/pages/zuhegou/index/index.wxss +++ b/packageB/pages/zuhegou/index/index.wxss @@ -338,7 +338,7 @@ page { } /* 门店分类列表 */ .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageB/pages/zuhegou/preindex/index.wxss b/packageB/pages/zuhegou/preindex/index.wxss index f9e3077..24e1c0d 100644 --- a/packageB/pages/zuhegou/preindex/index.wxss +++ b/packageB/pages/zuhegou/preindex/index.wxss @@ -334,7 +334,7 @@ page { } /* 门店分类列表 */ .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss index b67b9b9..c0ea42b 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss @@ -2574,7 +2574,7 @@ line-height: 38rpx; } /* 门店分类列表 */ .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 8db3a02..5e8acda 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -1555,10 +1555,8 @@ Page({ if (!title) title = th.data.prom_act.title; if (th.data.prom_type == 4) title = th.data.prom_act.name; - if (th.data.presellForm.share_img) - img = th.data.iurl + th.data.presellForm.share_img; - - + //if (th.data.presellForm.share_img) + // img = th.data.iurl + th.data.presellForm.share_img; var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid+"&pre_id="+th.data.pre_arr.id; if (getApp().globalData.user_id) { @@ -3133,13 +3131,9 @@ Page({ tt(); return false; } - // var img_url = ee.data.data.original_img; - var img_url = ee.data.presellForm.share_img; - img_url?img_url:ee.data.data.original_img; - - if (img_url) { - img_url = this.data.iurl + img_url; - } + var img_url = ee.data.data.original_img; + //var img_url = ee.data.presellForm.share_img; + //img_url?img_url:ee.data.data.original_img; //获取商品是分享图信息 wx.getImageInfo({ diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxss b/packageC/pages/presell/goodsInfo/goodsInfo.wxss index bff91ce..24d9bd8 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxss +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxss @@ -2570,7 +2570,7 @@ line-height: 38rpx; } /* 门店分类列表 */ .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageC/pages/presell/list/list.js b/packageC/pages/presell/list/list.js index c6323d9..562f4f1 100644 --- a/packageC/pages/presell/list/list.js +++ b/packageC/pages/presell/list/list.js @@ -58,6 +58,24 @@ Page({ }else{ getApp().goto("/pages/togoin/togoin"); } + + var room_id = t.room_id; + var room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id + //-- 如果有房间号 -- + if (room_id) { + getApp().globalData.room_id = room_id; + //如果是会员分享过来的要记录 + if (room_user_share) getApp().globalData.room_user_share = room_user_share; + } + + + if(this.data.act_id){ + getApp().promiseGet("/api/weshop/marketing/marketingPresellForm/get/"+os.stoid+"/"+this.data.act_id,{}).then(res=>{ + if(res.data.code==0) + th.data.pre_act=res.data.data + }) + } + }, onShow: function (t) { var userInfo=getApp().globalData.userInfo; @@ -235,4 +253,54 @@ Page({ } }, -}); + onShareAppMessage: async function (t) { + getApp().globalData.no_clear=1; + var img=""; + if(this.data.ad_data && this.data.ad_data.length ){ + img= this.data.ad_data[0]; + }else{ + var url="/api/weshop/store/get/"+os.stoid; + await getApp().promiseGet(url,{}).then(res=>{ + if(res.data.code==0){ + img= os.imghost+res.data.data.store_logo + } + }) + } + + var url = "/packageC/pages/presell/list/list"; + + if(this.data.act_id){ + url += "?act_id=" + this.data.act_id; + } + if (getApp().globalData.user_id) { + + if(url.indexOf("?")==-1) + url += "?first_leader=" + getApp().globalData.user_id; + else + url += "&first_leader=" + getApp().globalData.user_id; + } + //-- 如果房间分享,且不是会员分享的 -- + if (getApp().globalData.room_id && + this.data.data.goods_id == getApp().globalData.room_goods_id && + !getApp().globalData.room_user_share + ) { + url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; + } + + var ob={}; + if(this.data.pre_act){ + ob = { title: this.data.pre_act.share_title, path: url,imageUrl:os.imghost+this.data.pre_act.share_img }; + }else{ + + ob = { title: "预售列表", path: url, }; + if(img){ + ob.imageUrl=img; + } + } + + + return ob; + } + + + }); diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.wxss b/packageC/pages/presell/pregoodsInfo/goodsInfo.wxss index bff91ce..24d9bd8 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.wxss +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.wxss @@ -2570,7 +2570,7 @@ line-height: 38rpx; } /* 门店分类列表 */ .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/packageD/pages/user/coupons/filter.wxs b/packageD/pages/user/coupons/filter.wxs index 33c4a2c..9b4961a 100644 --- a/packageD/pages/user/coupons/filter.wxs +++ b/packageD/pages/user/coupons/filter.wxs @@ -39,11 +39,11 @@ var numFr = { break; }; case 1: { - return '已过从我的专享礼包,期'; + return '从我的专享礼包获取'; break; }; case 2: { - return '从我的幸运大转盘,'; + return '从我的幸运大转盘获取,'; break; }; default: { diff --git a/packageD/pages/user/deposit/deposit.js b/packageD/pages/user/deposit/deposit.js index 78c8c9b..c4f0bd2 100644 --- a/packageD/pages/user/deposit/deposit.js +++ b/packageD/pages/user/deposit/deposit.js @@ -1,3 +1,11 @@ +/* + * @Author: your name + * @Date: 2022-03-26 11:41:08 + * @LastEditTime: 2022-04-13 14:28:30 + * @LastEditors: your name + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: \MShopWeApp\packageD\pages\user\deposit\deposit.js + */ var t = getApp(), a = t.request, o = t.globalData.setting, @@ -24,7 +32,7 @@ Page({ return false; } wx.setNavigationBarTitle({ - title: "预存款", + title: "储值款", }) var th = this; diff --git a/packageD/pages/user/deposit/deposit.wxml b/packageD/pages/user/deposit/deposit.wxml index 2fdc92f..4e81dd0 100644 --- a/packageD/pages/user/deposit/deposit.wxml +++ b/packageD/pages/user/deposit/deposit.wxml @@ -1,6 +1,6 @@ - 预存款 + 储值款 {{yucun_money}} @@ -9,20 +9,20 @@ - 预存款充值 + 储值款充值 - 预存款余额 + 储值款余额 - 暂无任何预存款 + 暂无任何储值款 diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 6cf052b..47c4498 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -130,8 +130,9 @@ Page({ ladder_map: {}, //阶梯促销的map表 is_no_past: 1, state: 0, //阶梯促销的的立即购买也走购物车流程state=1 - show_duo_gift:0, - send_gf:{}, //多赠品的计算 + show_duo_gift: 0, + send_gf: {}, //多赠品的计算 + send_lb: {}, }, onLoad: function (t) { wx.setNavigationBarTitle({ title: "填写订单", }) @@ -171,7 +172,8 @@ Page({ isget_by_quan: {}, is_no_by: {}, is_by: {}, - send_gf:{} + send_gf: {}, + send_lb: {}, }) }, @@ -188,7 +190,6 @@ Page({ } else { this.getuser_addr(function (ie) { - console.log("getuser_addr") console.log(ie) //地址切换要把包邮券清空 @@ -381,7 +382,7 @@ Page({ to.get_allsto(function (e) { th.setData({ allsto: e }); //-------获取购物车已经选择的商品-------- - console.log('购物车结算'); + console.log('购物车结算'); th.get_cart(); }) @@ -408,7 +409,7 @@ Page({ //-----真的获取购物车,入口-------- get_cart: function () { - var th = this, app = getApp(); + var th = this, app = getApp(); var state = 0; if (th.data.state) state = 1; a.get("/api/weshop/cart/list", { @@ -452,6 +453,7 @@ Page({ //要把优惠活动加入,prom_goods_map中,赠品不要运算 if (item1.prom_type == 3 && item1.is_gift != 1) { + // th.check_is_youhui(item1.goods_id, item1.pick_id); await th.add_prom_goods_map(item1); } @@ -719,7 +721,7 @@ Page({ ie.wind = parseInt(th.data.cartlist[kj].wind); //-- 是不是全部自提清空 -- - if(ie.exp_type==0) th.setData({ is_all_zt: 0 }); + if (ie.exp_type == 0) th.setData({ is_all_zt: 0 }); break; } @@ -859,7 +861,6 @@ Page({ et = th.data.bn_exp_type; m_wind = th.data.index; } - //---是不是购买等级卡成功的返回---等级卡显示的判断--- var is_card_back = getApp().globalData.is_card_back; if (is_card_back) { @@ -915,12 +916,13 @@ Page({ t.data.data.prom_id = gg.prom_id; t.data.data.prom_type = 3; //如果是优惠活动,就要调用活动,计算价格 + // th.check_is_youhui(gg.goods_id, gg.pick_id); th.buy_now_prom_goods(gg.prom_id, t.data.data, function (data) { //判断一下购买商品的数量是不是超过 - if (data.gift_goods_id && (!data.zp_mode || parseInt(data.zp_mode)==0) ) { - var num =data.zp_num?data.zp_num:1; + if (data.gift_goods_id && (!data.zp_mode || parseInt(data.zp_mode) == 0)) { + var num = data.zp_num ? data.zp_num : 1; if (data.is_bz == 1) { - num = num*data.bs; + num = num * data.bs; if (num > data.gift_limit_num) num = 0; } //如果赠品数量超出礼品库存,就取消 @@ -943,9 +945,9 @@ Page({ ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式 ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额 - var arr_gf=[]; + var arr_gf = []; arr_gf.push(ob); - th.setData({ buy_now_gift_goods: arr_gf}); + th.setData({ buy_now_gift_goods: arr_gf }); } } @@ -1174,8 +1176,8 @@ Page({ }, calc_per: async function (c_arr) { - var send_gf={}; - var duo_zp_num_arr={}; + var send_gf = {}; + var duo_zp_num_arr = {}; var th = this; //-- 循环处理 -- for (var i in c_arr) { @@ -1197,7 +1199,7 @@ Page({ //等待,获取一下优惠活动的信息 await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { data: { - price:parseFloat(item_map.price).toFixed(2),prom_id:item_map.prom_id, + price: parseFloat(item_map.price).toFixed(2), prom_id: item_map.prom_id, goods_num: item_map.goods_num, user_id: getApp().globalData.user_id, is_bz: item_map.is_bz } @@ -1211,12 +1213,13 @@ Page({ 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; + item_map.lbtitle = get_data.lbtitle; + item_map.zxlbtitle = get_data.zxlbtitle; - - if (get_data.gift_id && parseInt(get_data.zp_mode)!=1 - && get_data.zp_num* item_map.bs<=get_data.limit_num - && get_data.zp_num* item_map.bs<=get_data.gift_storecount - ){ + if (get_data.gift_id && parseInt(get_data.zp_mode) != 1 + && get_data.zp_num * item_map.bs <= get_data.limit_num + && get_data.zp_num * item_map.bs <= get_data.gift_storecount + ) { item_map.gift_id = get_data.gift_id; item_map.gift_goods_id = get_data.goods_id; @@ -1238,21 +1241,21 @@ Page({ item_map.zx_libao = get_data.zxlibao; item_map.zx_lb_num = get_data.zxlb_num; - if(parseInt(get_data.zp_mode)==1){ - if(!send_gf[pickid]) send_gf[pickid]=[]; + if (parseInt(get_data.zp_mode) == 1) { + if (!send_gf[pickid]) send_gf[pickid] = []; - var can_zp_num=0; - for(let iy in get_data.giftsinfo){ - let item=get_data.giftsinfo[iy]; - can_zp_num+= parseInt(item.gift_storecount)>parseInt(item.limit_num)?parseInt(item.limit_num):parseInt(item.gift_storecount); + var can_zp_num = 0; + for (let iy in get_data.giftsinfo) { + let item = get_data.giftsinfo[iy]; + can_zp_num += parseInt(item.gift_storecount) > parseInt(item.limit_num) ? parseInt(item.limit_num) : parseInt(item.gift_storecount); } - var t_zp_num=parseInt(get_data.zp_num)*parseInt(get_data.bs); - if(duo_zp_num_arr[item_map.prom_id]){ - t_zp_num+=duo_zp_num_arr[item_map.prom_id]; + var t_zp_num = parseInt(get_data.zp_num) * parseInt(get_data.bs); + if (duo_zp_num_arr[item_map.prom_id]) { + t_zp_num += duo_zp_num_arr[item_map.prom_id]; } - if(can_zp_num>=t_zp_num) { + if (can_zp_num >= t_zp_num) { send_gf[pickid].push({ pickup_id: pickid, giftsinfo: get_data.giftsinfo, @@ -1261,7 +1264,7 @@ Page({ prom_id: item_map.prom_id }); - duo_zp_num_arr[item_map.prom_id]=t_zp_num; + duo_zp_num_arr[item_map.prom_id] = t_zp_num; } } } @@ -1325,7 +1328,7 @@ Page({ for (var j = 0; j < ord_goods.length; j++) { if (ord_goods[j].is_gift) continue; if (ord_goods[j].prom_type == 3 && ord_goods[j].prom_id == item_map.prom_id) { - ord_goods[j].is_xz_yh =ord_goods[j].is_xz_yh?ord_goods[j].is_xz_yh:item_map.is_xz_yh; + ord_goods[j].is_xz_yh = ord_goods[j].is_xz_yh ? ord_goods[j].is_xz_yh : item_map.is_xz_yh; ord_goods[j].is_past = item_map.is_past; ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir; ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir; @@ -1362,22 +1365,22 @@ Page({ if (item_map.s_libao) { if (!cart_item.s_libao) { cart_item.s_libao = item_map.s_libao + ""; - cart_item.g_lb_num = [{ 'l_id': item_map.s_libao, "num": item_map.s_lb_num }]; + cart_item.g_lb_num = [{ 'l_id': item_map.s_libao, "num": item_map.s_lb_num, 'lbtitle': item_map.lbtitle }]; } else { cart_item.s_libao += "," + item_map.s_libao; - cart_item.g_lb_num.push({ 'l_id': item_map.s_libao, "num": item_map.s_lb_num }) + cart_item.g_lb_num.push({ 'l_id': item_map.s_libao, "num": item_map.s_lb_num, 'lbtitle': item_map.lbtitle }) } } if (item_map.zx_libao) { if (!cart_item.zx_libao) { cart_item.zx_libao = item_map.zx_libao + ""; - cart_item.g_zxlb_num = [{'l_id': item_map.zx_libao, "num": item_map.zx_lb_num}]; + cart_item.g_zxlb_num = [{ 'l_id': item_map.zx_libao, "num": item_map.zx_lb_num, 'zxlbtitle': item_map.zxlbtitle }]; } else { cart_item.zx_libao += "," + item_map.zx_libao; - cart_item.g_zxlb_num.push({'l_id': item_map.zx_libao, "num": item_map.zx_lb_num}) + cart_item.g_zxlb_num.push({ 'l_id': item_map.zx_libao, "num": item_map.zx_lb_num, 'zxlbtitle': item_map.zxlbtitle }) } } } @@ -1387,15 +1390,69 @@ Page({ var arr = Object.keys(send_gf); var arr2 = Object.keys(th.data.send_gf); - if(arr2.length>0) return false; - - if(arr.length>0){ - th.setData({send_gf:send_gf}) - }else{ - th.setData({send_gf:{}}) + if (arr2.length > 0) return false; + th.calclate_lbNum(c_arr); + if (arr.length > 0) { + th.setData({ send_gf: send_gf }) + } else { + th.setData({ send_gf: {} }) } }, + calclate_lbNum(r_data) { + let send_lb = this.data.send_lb; + //g_lb_num我的礼包 g_zxlb_num专享礼包 + r_data.forEach(r_d => { + let arr = []; + if (r_d.g_zxlb_num) { + let g_lb = r_d.g_zxlb_num; + for (let i = 0; i < g_lb.length; i++) { + let item = g_lb[i]; + let new_lb = g_lb.filter(lb => { + return item.l_id === lb.l_id; + }); + if (new_lb.length == 1) { + arr.push(item); + } else { + item.num = new_lb.reduce((pre, next) => { + return pre + next.num; + }, 0); + arr.push(item); + g_lb = g_lb.filter(ii => { + return ii.l_id !== item.l_id; + }); + } + send_lb[r_d.pickup_id] = arr; + } + } + if (r_d.g_lb_num) { + let zx_lb = r_d.g_lb_num; + for (let i = 0; i < zx_lb.length; i++) { + let item = zx_lb[i]; + item.flag = 1; + let new_lb = zx_lb.filter(lb => { + return item.l_id === lb.l_id; + }); + if (new_lb.length == 1) { + arr.push(item); + } else { + item.num = new_lb.reduce((pre, next) => { + return pre + next.num; + }, 0); + arr.push(item); + zx_lb = zx_lb.filter(ii => { + return ii.l_id !== item.l_id; + }); + } + send_lb[r_d.pickup_id] = arr; + } + } + }) + this.setData({ + send_lb, + }) + + }, //-------------------计算订单价格------------------- calculatePrice: function (t, s) { @@ -1404,12 +1461,12 @@ Page({ to.getwuliuprice(async function (rs) { wx.showLoading({ title: "处理中." }) //是不是区域包邮 - th.data.is_area_by=0; + th.data.is_area_by = 0; //当不是区域不包邮的时候,没有不包邮商品的时候 - th.data.free1=0; - th.data.cut_o_shipping_price=0; - th.data.cut_goods_piece=0; - th.data.cut_goods_weight=0; + th.data.free1 = 0; + th.data.cut_o_shipping_price = 0; + th.data.cut_goods_piece = 0; + th.data.cut_goods_weight = 0; var all_price = 0; //所有的商品总价 var all_shipping_m = 0; //所有的物流总价 @@ -1424,7 +1481,7 @@ Page({ var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); var freight_free = ee.freight_free; //全场满多少包邮 - var free1=freight_free; + var free1 = freight_free; var weight_free = ee.weight_free; //多少kg内包邮 var no_ex_id = ee.no_ex_id; @@ -1596,7 +1653,7 @@ Page({ if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { if (th.check_by_area(by_qc.region_list)) { freight_free = 0; - th.data.is_area_by=1; + th.data.is_area_by = 1; //goods_weight = -1; //out_of_weight = 0; th.data.is_no_by[pickid] = 1; @@ -1615,36 +1672,36 @@ Page({ - var is_in_no_ex_goods_arr=0; - var by_g_weight=0; + var is_in_no_ex_goods_arr = 0; + var by_g_weight = 0; //--------循环计算商品总物流----------- for (var jo = 0; jo < item.length; jo++) { //----------------如果是选择了物流--------------------- - if (cart_item.exp_type == 0 && item[jo].is_free_shipping == 0 && th.data.user_addr != null){ + if (cart_item.exp_type == 0 && item[jo].is_free_shipping == 0 && th.data.user_addr != null) { //判断是否有设置限制重量包邮,先看商品有没有包邮 - if(!no_ex_good_arr || no_ex_good_arr.indexOf(item[jo].goods_id + '')== -1){ - if(!th.data.is_area_by) th.data.free1=free1; + if (!no_ex_good_arr || no_ex_good_arr.indexOf(item[jo].goods_id + '') == -1) { + if (!th.data.is_area_by) th.data.free1 = free1; //此时是 模板里面没有不包邮商品列表或者是 该商品没有再不包邮商品列表礼包 if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) { if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 goods_weight += item[jo]['weight'] * item[jo]['goods_num']; - by_g_weight+=item[jo]['weight'] * item[jo]['goods_num']; + by_g_weight += item[jo]['weight'] * item[jo]['goods_num']; - if(free1>0){ + if (free1 > 0) { if (weight_free > 0) { out_of_weight = (weight_free * 1000) - by_g_weight; - }else{ - out_of_weight= -by_g_weight; + } else { + out_of_weight = -by_g_weight; } } } } //这个是在不包邮列表礼包 - else if(no_ex_good_arr.indexOf(item[jo].goods_id + '') > -1){ - is_in_no_ex_goods_arr=1; + else if (no_ex_good_arr.indexOf(item[jo].goods_id + '') > -1) { + is_in_no_ex_goods_arr = 1; if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) { if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 @@ -1655,7 +1712,7 @@ Page({ } } - if(free1>0) { + if (free1 > 0) { //当商品没有超出的时候 if (out_of_weight >= 0) { out_of_weight = -by_g_weight; @@ -1665,7 +1722,7 @@ Page({ } //所有的商品都不在不包邮商品列表,freight_free为0的时候,以及不是区域包邮 - if(!is_in_no_ex_goods_arr && !freight_free && !th.data.is_area_by) freight_free=free1; + if (!is_in_no_ex_goods_arr && !freight_free && !th.data.is_area_by) freight_free = free1; //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额-- if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) { @@ -1751,7 +1808,7 @@ Page({ if (no_ex_good) { is_good_no_by = th.check_by_goods(no_ex_good, item[j].goods_id); } - + //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && !is_good_no_by) { continue; @@ -1777,7 +1834,7 @@ Page({ } - if(!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '')== -1){ + if (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') == -1) { switch (item[j]['exp_sum_type']) { case 1: //统一运费 @@ -1791,7 +1848,7 @@ Page({ } - }else{ + } else { /*-- if(item[j]['exp_sum_type']==2 && out_of_weight!==0){ goods_weight = -1; @@ -1839,7 +1896,7 @@ Page({ var order_m = 0; //---判断是不是有订单优惠--- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: { store_id: os.stoid, orderAmount: o_condition,user_id:getApp().globalData.user_id} + data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id } }).then(res => { if (res.data.code == 0) { var ord_prom = res.data.data; @@ -2284,9 +2341,9 @@ Page({ var l_txt = "formData.give_zxlb_id"; //这个是json格式的 var l_txt1 = "formData.g_zxlb_num"; - var ob = [{"num": good.zx_lb_num, "l_id": good.zx_libao}]; + var ob = [{ "num": good.zx_lb_num, "l_id": good.zx_libao }]; ob = JSON.stringify(ob); - th.setData({[l_txt]: good.zx_libao, [l_txt1]: ob}); + th.setData({ [l_txt]: good.zx_libao, [l_txt1]: ob }); } }) } else { @@ -2343,7 +2400,7 @@ Page({ var l_txt1 = "formData.g_lb_num"; var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; ob = JSON.stringify(ob); - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); + th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob }); } //专享礼包 @@ -2351,9 +2408,9 @@ Page({ var l_txt = "formData.give_zxlb_id"; //这个是json格式的 var l_txt1 = "formData.g_zxlb_num"; - var ob = [{"num": good.zx_lb_num, "l_id": good.zx_libao}]; + var ob = [{ "num": good.zx_lb_num, "l_id": good.zx_libao }]; ob = JSON.stringify(ob); - th.setData({[l_txt]: good.zx_libao, [l_txt1]: ob}); + th.setData({ [l_txt]: good.zx_libao, [l_txt1]: ob }); } } @@ -2388,7 +2445,7 @@ Page({ } }) this.setData({ - submit:1, + submit: 1, }) }, @@ -2523,8 +2580,8 @@ Page({ 'prom_id': th.data.bn_goods.prom_id, //促销活动id }; - if(getApp().globalData.skinface_id){ - goods.skinface_id=getApp().globalData.skinface_id; + if (getApp().globalData.skinface_id) { + goods.skinface_id = getApp().globalData.skinface_id; } //-- 把导购的信息填入-- @@ -2613,8 +2670,8 @@ Page({ //--如果有赠品的时候,赠品也要提交--- if (th.data.buy_now_gift_goods) { var gift_gg_arr = th.data.buy_now_gift_goods; - for(let i in gift_gg_arr){ - let gift_gg=gift_gg_arr[i]; + for (let i in gift_gg_arr) { + let gift_gg = gift_gg_arr[i]; var g_goods = { 'goods_id': gift_gg.goods_id, 'goods_name': gift_gg.goods_name, @@ -2759,11 +2816,11 @@ Page({ order_prom_list.g_zxlb_num = JSON.stringify(t_item.g_zxlb_num); } - if (Object.keys(order_prom_list).length > 0){ - if(order_prom_list.discount_amount) - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2); - if(order_prom_list.order_prom_amount) - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); + if (Object.keys(order_prom_list).length > 0) { + if (order_prom_list.discount_amount) + order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2); + if (order_prom_list.order_prom_amount) + order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2); item.order_prom_list = order_prom_list; } @@ -2809,8 +2866,8 @@ Page({ 'store_id': oo.stoid, }; - if(getApp().globalData.skinface_id){ - goods.skinface_id=getApp().globalData.skinface_id; + if (getApp().globalData.skinface_id) { + goods.skinface_id = getApp().globalData.skinface_id; } //-- 线下取价也要写入,组合购的商品不能去线下价格 -- @@ -2913,7 +2970,7 @@ Page({ if (pdata.length == 0) return; var str = JSON.stringify(pdata); - + wx.showLoading({ title: "加载中" }); wx.request({ url: oo.url + '/api/weshop/order/createWxdOrder', @@ -3036,7 +3093,7 @@ Page({ }, complete: function () { th.setData({ - submit:0, + submit: 0, }) } }) @@ -3232,8 +3289,8 @@ Page({ //------超出重量---------- if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { - goods_weight=goods_weight+ out_of_weight; - if(goods_weight==0) goods_weight=-1; + goods_weight = goods_weight + out_of_weight; + if (goods_weight == 0) goods_weight = -1; } @@ -3247,12 +3304,12 @@ Page({ } } - if(th.data.free1 && freight_free<=0) freight_free=th.data.free1; + if (th.data.free1 && freight_free <= 0) freight_free = th.data.free1; //当有包邮和不包邮混合在一起的时候,件数要重新计算 - if(freight_free>0 && o_price >= freight_free && goods_piece>0 && th.data.cut_goods_piece) - goods_piece=goods_piece-th.data.cut_goods_piece; + if (freight_free > 0 && o_price >= freight_free && goods_piece > 0 && th.data.cut_goods_piece) + goods_piece = goods_piece - th.data.cut_goods_piece; //------按件数---------- if (goods_piece > 0 && item['piecemoney']) { fp_price = parseFloat(item['piecemoney']); @@ -3263,7 +3320,7 @@ Page({ } } //当有包邮和不包邮混合在一起的时候,统一运费要重新计算 - if(freight_free>0 && o_price >= freight_free && th.data.cut_o_shipping_price && price>0) price=price-th.data.cut_o_shipping_price; + if (freight_free > 0 && o_price >= freight_free && th.data.cut_o_shipping_price && price > 0) price = price - th.data.cut_o_shipping_price; var rspice = parseFloat(price + fw_price + fp_price); return rspice; @@ -3481,7 +3538,6 @@ Page({ }, - /*----- 点击选择包邮券 -----*/ sele_quan_item_by: function (e) { var no_use = e.currentTarget.dataset.no; @@ -3936,7 +3992,7 @@ Page({ arr[ind].check_quan_ware_list = check_quan_ware_list; arr[ind].check_quan_price_list = check_quan_price_list; //是否关闭使用优惠券 - if (th.data.is_close_quan != 1 ) { + if (th.data.is_close_quan != 1) { //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- var url = "/api/weshop/couponList/getUseCouponList"; await app.request.promiseGet(url, { @@ -4045,7 +4101,7 @@ Page({ }, //立即购买获取优惠活动的内容 buy_now_prom_goods: function (prom_id, arr, func) { - var th=this; + var th = this; var price = arr.shop_price * arr.goods_num; var prom = null; var gg = to.get_b_now(); @@ -4068,7 +4124,7 @@ Page({ if (res.data.code == 0) { var get_data = res.data.data; arr.is_bz = prom.is_bz; //是不是倍增 - arr.is_xz_yh =arr.is_xz_yh?arr.is_xz_yh:prom.is_xz_yh; //是不是优惠 + arr.is_xz_yh = arr.is_xz_yh ? arr.is_xz_yh : prom.is_xz_yh; //是不是优惠 arr.bs = get_data.bs; //是不是倍数 arr.is_past = get_data.is_past; //是不是包邮 arr.prom_price = get_data.price >= 0 ? get_data.price : price; @@ -4076,13 +4132,13 @@ Page({ arr.s_coupon_id = get_data.coupon_id; arr.s_coupon_num = get_data.coupon_num; arr.zp_mode = get_data.zp_mode; - arr.zp_num = get_data.zp_num?get_data.zp_num:1; //确保默认一个 + arr.zp_num = get_data.zp_num ? get_data.zp_num : 1; //确保默认一个 //-- 看是不是有赠品 -- - if (get_data.gift_id && parseInt(get_data.zp_mode)!=1 - && get_data.zp_num* arr.bs<=get_data.limit_num - && get_data.zp_num* arr.bs<=get_data.gift_storecount - ){ + if (get_data.gift_id && parseInt(get_data.zp_mode) != 1 + && get_data.zp_num * arr.bs <= get_data.limit_num + && get_data.zp_num * arr.bs <= get_data.gift_storecount + ) { arr.gift_id = get_data.gift_id; arr.gift_goods_id = get_data.goods_id; arr.gift_goods_name = get_data.goods_name; @@ -4098,34 +4154,34 @@ Page({ } arr.s_libao = get_data.libao; arr.s_lb_num = get_data.lb_num; - + arr.lbtitle = get_data.lbtitle; + arr.zxlbtitle = get_data.zxlbtitle; arr.zx_libao = get_data.zxlibao; arr.zx_lb_num = get_data.zxlb_num; arr.prom_id = prom_id; - var send_gf={}; - var pickid=gg.pick_id; - if(parseInt(get_data.zp_mode)==1){ - if(!send_gf[pickid]) send_gf[pickid]=[]; - - var a_stock_num=0; - var a_limit_num=0; - for(let iy in get_data.giftsinfo){ - let item=get_data.giftsinfo[iy]; - a_stock_num+= parseInt(item.gift_storecount); - a_limit_num+=parseInt(item.limit_num); + var send_gf = {}; + var pickid = gg.pick_id; + if (parseInt(get_data.zp_mode) == 1) { + if (!send_gf[pickid]) send_gf[pickid] = []; + + var a_stock_num = 0; + var a_limit_num = 0; + for (let iy in get_data.giftsinfo) { + let item = get_data.giftsinfo[iy]; + a_stock_num += parseInt(item.gift_storecount); + a_limit_num += parseInt(item.limit_num); } - var t_zp_num=parseInt(get_data.zp_num)*parseInt(get_data.bs); - if(a_limit_num>= t_zp_num && a_stock_num>=t_zp_num ){ + var t_zp_num = parseInt(get_data.zp_num) * parseInt(get_data.bs); + if (a_limit_num >= t_zp_num && a_stock_num >= t_zp_num) { send_gf[pickid].push({ - pickup_id:pickid,giftsinfo:get_data.giftsinfo,zp_num:get_data.zp_num*get_data.bs, - gf_pr_name:prom.name,prom_id:prom.prom_id}); - + pickup_id: pickid, giftsinfo: get_data.giftsinfo, zp_num: get_data.zp_num * get_data.bs, + gf_pr_name: prom.name, prom_id: prom.prom_id + }); } - - th.setData({send_gf:send_gf}); + th.setData({ send_gf: send_gf }); } } func(arr); @@ -4137,7 +4193,7 @@ Page({ if (this.data.is_b_now == 1) pick = this.data.bn_pick; //---获取订单优惠--- getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: { store_id: os.stoid, orderAmount: condition,user_id:getApp().globalData.user_id } + data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id } }).then(res => { if (res.data.code == 0) { var data = res.data.data; @@ -4195,13 +4251,86 @@ Page({ ob.is_xz_yh = prom.is_xz_yh; ob.goods = new Array(); ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); - var obj = {}; obj[item.prom_id] = ob; map[pickid] = obj; } }, + //---检查有没有优惠活动--- + check_is_youhui: function (r_data, pick_id) { + let send_lb = this.data.send_lb; + let lodash = null; + r_data.forEach(item => { + if (send_lb[pick_id]) { + for (let i = 0; i < send_lb[pick_id].length; i++) { + let sends = send_lb[pick_id][i]; + if (item.lb_id) { + if (sends.id === item.lb_id) { + sends['num']++; + } else { + let send_arr1 = send_lb[pick_id].filter(ii => ii.id === item.lb_id); + if (send_arr1.length == 0) { + if (item.lb_id) { + let ob = {}; + ob.num = 1; + ob.title = item.lbtitle; + ob.id = item.lb_id; + lodash.push(ob); + // break; + } + } + + } + } + if (item.zxlb_id) { + if (sends.id === item.zxlb_id) { + sends['num']++; + } else { + let send_arr = send_lb[pick_id].filter(ii => ii.id === item.zxlb_id); + if (send_arr.length == 0) { + if (item.zxlb_id) { + let ob = {}; + ob.num = 1; + ob.flag = 1; + ob.title = item.zxlbtitle; + ob.id = item.zxlb_id; + lodash.push(ob); + // break; + } + } + } + } + } + + } else { + let arr = new Array(); + if (item.lb_id) { + let ob = {}; + ob.num = 1; + ob.title = item.lbtitle; + ob.id = item.lb_id; + arr.push(ob); + } + if (item.zxlb_id) { + let ob = {}; + ob.num = 1; + ob.flag = 1; + ob.title = item.zxlbtitle; + ob.id = item.zxlb_id; + arr.push(ob); + } + send_lb[pick_id] = arr; + lodash = JSON.parse(JSON.stringify(send_lb[pick_id])); + } + }) + send_lb[pick_id] = lodash; + th.setData({ + send_lb, + }) + + + }, //计算立即购买赠品的物流费用 get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { @@ -4209,8 +4338,7 @@ Page({ var goods_weight = -1, goods_piece = -1; var gift_shipping_price = 0; - if (shipping_price) - { + if (shipping_price) { gift_shipping_price = shipping_price; } var th = this; @@ -4226,8 +4354,8 @@ Page({ } } - for(var i in good_arr) { - var good=good_arr[i]; + for (var i in good_arr) { + var good = good_arr[i]; switch (good['exp_sum_type']) { case 1: //统一运费 @@ -4247,7 +4375,7 @@ Page({ case 3: if (goods_piece < 0) goods_piece = 0; //累积商品数量 - goods_piece += parseInt(good['buynum']) ; + goods_piece += parseInt(good['buynum']); if (goods_piece1) { goods_piece += goods_piece1; } @@ -4259,14 +4387,14 @@ Page({ if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { gift_freight_free = 0; // out_of_weight = 0 - th.data.is_no_by[th.data.bn_pick]=1; + th.data.is_no_by[th.data.bn_pick] = 1; } } } var t_shipping_price = this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight, - goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick); + goods_piece, user_addr, gift_freight_free, allpice, rs, th.data.bn_pick); return t_shipping_price; }, @@ -4334,6 +4462,20 @@ Page({ this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline }); }, + // 促销 -> 送礼包 -> 查看详情 + viewLbDetails(e) { + let id = e.currentTarget.dataset.id; // 获取礼包id + let flag = e.currentTarget.dataset.flag; + let url = ''; + if (flag == 1) { // flag =1 控制跳转到专享礼包 + url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; + } else { + url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 + }; + // console.log('myurl', url); + getApp().goto(url); + }, + //确定使用线下取价 sure_offline: function () { var bn_goods = this.data.bn_goods; @@ -4459,7 +4601,7 @@ Page({ }, //订阅消息提醒 sendsm: function (func) { - let th =this; + let th = this; var template_id = this.data.template_id; // //授权订阅 wx.requestSubscribeMessage({ @@ -4467,417 +4609,417 @@ Page({ success(res) { func(); th.setData({ - submit:0, + submit: 0, }) }, fail(res) { func(); th.setData({ - submit:0, + submit: 0, }) } }) }, - setexptype2: function(e) { - this.debounce(this.setexptype.bind(this, e),400)(); - }, - - setexptype_w2: function(e) { - this.debounce(this.setexptype_w.bind(this, e),400)(); - }, - - // 函数防抖 - debounce: function (func, wait) { - return () => { - clearTimeout(timer); - timer = setTimeout(func, wait); - }; - }, - - - //-- 判断是不是选中 -- - check_th_item:function (e) { - var th=this; - var idx=e.currentTarget.dataset.item; - var check=e.currentTarget.dataset.check; - var txt="giftsinfo["+idx+"].selected"; - var gift_item=this.data.giftsinfo[idx]; - - if(check){ - th.setData({[txt]:0}); - }else{ - - var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,gift_item.goods_num); - if(!is_true){ return false; } - - th.setData({[txt]:1}); - } - }, - - - //输入框输入数量的时候 - valueToNum:function (e){ - var th=this; - var idx=e.currentTarget.dataset.item; - var gift_item=this.data.giftsinfo[idx]; - var num=parseInt(e.detail.value); - var txt="giftsinfo["+idx+"].goods_num"; - var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,num); - if(!is_true){ - th.setData({[txt]:1}); - return false; - } - th.setData({[txt]:num}); + setexptype2: function (e) { + this.debounce(this.setexptype.bind(this, e), 400)(); + }, - }, + setexptype_w2: function (e) { + this.debounce(this.setexptype_w.bind(this, e), 400)(); + }, + // 函数防抖 + debounce: function (func, wait) { + return () => { + clearTimeout(timer); + timer = setTimeout(func, wait); + }; + }, - addNum:function (e) { - var th=this; - var idx=e.currentTarget.dataset.item; - var txt="giftsinfo["+idx+"].goods_num"; - var num=th.data.giftsinfo[idx].goods_num+1; - var gift_item=this.data.giftsinfo[idx]; - var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,num); - if(!is_true){ return false; } - th.setData({[txt]:num}); - }, - - subNum:function (e) { - var th=this; - var idx=e.currentTarget.dataset.item; - var txt="giftsinfo["+idx+"].goods_num"; - var num=th.data.giftsinfo[idx].goods_num-1; - var gift_item=this.data.giftsinfo[idx]; - var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,num); - if(!is_true){ - return false; - } - if(num<1) return false; - th.setData({[txt]:num}); - }, + //-- 判断是不是选中 -- + check_th_item: function (e) { + var th = this; + var idx = e.currentTarget.dataset.item; + var check = e.currentTarget.dataset.check; + var txt = "giftsinfo[" + idx + "].selected"; + var gift_item = this.data.giftsinfo[idx]; + + if (check) { + th.setData({ [txt]: 0 }); + } else { + + var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, gift_item.goods_num); + if (!is_true) { return false; } + + th.setData({ [txt]: 1 }); + } + }, + + + //输入框输入数量的时候 + valueToNum: function (e) { + var th = this; + var idx = e.currentTarget.dataset.item; + var gift_item = this.data.giftsinfo[idx]; + var num = parseInt(e.detail.value); + var txt = "giftsinfo[" + idx + "].goods_num"; + var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, num); + if (!is_true) { + th.setData({ [txt]: 1 }); + return false; + } + th.setData({ [txt]: num }); + + }, + + + + addNum: function (e) { + var th = this; + var idx = e.currentTarget.dataset.item; + var txt = "giftsinfo[" + idx + "].goods_num"; + var num = th.data.giftsinfo[idx].goods_num + 1; + var gift_item = this.data.giftsinfo[idx]; + var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, num); + if (!is_true) { return false; } + th.setData({ [txt]: num }); + }, + + subNum: function (e) { + var th = this; + var idx = e.currentTarget.dataset.item; + var txt = "giftsinfo[" + idx + "].goods_num"; + var num = th.data.giftsinfo[idx].goods_num - 1; + var gift_item = this.data.giftsinfo[idx]; + var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, num); + if (!is_true) { + return false; + } + if (num < 1) return false; + th.setData({ [txt]: num }); + }, //-- 点击选中赠品 -- - show_sele_gift:function (e) { - var index=e.currentTarget.dataset.index; - var pk=e.currentTarget.dataset.pk; - var giftsinfo=this.data.send_gf[pk][index].giftsinfo; - - for(let i in giftsinfo){ - let item=giftsinfo[i]; - if(!item.goods_num) giftsinfo[i].goods_num=1; + show_sele_gift: function (e) { + var index = e.currentTarget.dataset.index; + var pk = e.currentTarget.dataset.pk; + var giftsinfo = this.data.send_gf[pk][index].giftsinfo; + + for (let i in giftsinfo) { + let item = giftsinfo[i]; + if (!item.goods_num) giftsinfo[i].goods_num = 1; } this.setData({ - show_duo_gift:1, - giftsinfo:giftsinfo, - gf_pr_name:this.data.send_gf[pk][index].gf_pr_name, - zp_num:this.data.send_gf[pk][index].zp_num, - gift_pkid:pk, - gf_prom_id:this.data.send_gf[pk][index].prom_id, - send_gf_index:index + show_duo_gift: 1, + giftsinfo: giftsinfo, + gf_pr_name: this.data.send_gf[pk][index].gf_pr_name, + zp_num: this.data.send_gf[pk][index].zp_num, + gift_pkid: pk, + gf_prom_id: this.data.send_gf[pk][index].prom_id, + send_gf_index: index }) }, - close_sele_gift:function () { - this.setData({show_duo_gift:0}) + close_sele_gift: function () { + this.setData({ show_duo_gift: 0 }) }, //购物车赠品有咩有超出库存。有灭有超出限购 - check_out_num_cart:function(discount,pick_id,num) { - var prom_id= discount.prom_id; - var alllist=this.data.cartlist; - var all_num=num; - var all_limit_num=num; - var gift_id=discount.gift_id; - for (var i in alllist) { - var list_item = alllist[i]; - //-- 门店相同,活动相同的时候 -- - if(pick_id==list_item.pickup_id && prom_id==list_item.prom_id) continue; - for (var j in list_item.goods) { - //如果赠品的ID一样,要进行统计数量 - if (list_item.goods[j].is_gift == 1 && - list_item.goods[j].gift_id == gift_id) { - all_num += list_item.goods[j].goods_num; - } - if (list_item.goods[j].is_gift == 1 && list_item.goods[j].gift_id ==gift_id && list_item.goods[j].prom_id == prom_id) { - all_limit_num += list_item.goods[j].limit_num; - } - } - } - //-- 赠品的数量超出库存数量和会员的限制, - // 这里是保证所有的赠品部会超出 -- - if (discount.gift_storecount < all_num ) { - wx.showToast({ - title: "赠品库存不足", - icon: 'none', - duration: 2000 - }); - return false; - } - if (discount.limit_num < all_limit_num) { - wx.showToast({ - title:"超出赠品限购", - icon: 'none', - duration: 2000 - }); - return false; - } - return true; - }, - - //-- 确定赠品 -- - sure_this_gift:async function () { - var th = this; - var gf_pickup_id = this.data.gift_pkid; - - var zp_num = this.data.zp_num; - var giftsinfo = this.data.giftsinfo; - var all_num = 0; - for (let i in giftsinfo) { - let item = giftsinfo[i]; - if (!item.selected) continue; - all_num += item.goods_num; - } - if (all_num > zp_num) { - wx.showToast({ - title: "超出活动赠品赠送的数量" + zp_num + "件", - icon: 'none', - duration: 2000 - }); - return false; - } - if (all_num < zp_num) { - wx.showToast({ - title: "您还可以加" + (zp_num - all_num) + "件", - icon: 'none', - duration: 2000 - }); - return false; - } - - //-- 当是购物车购买的时候 -- - if(this.data.cartlist && this.data.cartlist.length>0){ - var alllist = this.data.cartlist; - var index = alllist.findIndex(function (e) { - return e.pickup_id == gf_pickup_id - }); - var pk_list_goods = alllist[index].goods; - - var url = "/api/weshop/cart/delGift?store_id=" + os.stoid + "&user_id=" - + getApp().globalData.user_id + "&is_gift=1&pick_id=" + this.data.gift_pkid + "&prom_id=" + this.data.prom_id; - await getApp().request.promiseDelete(url, {}); - - var new_pk_list_goods = []; - for (let i in pk_list_goods) { - let item = pk_list_goods[i]; - if (item.is_gift && item.prom_id == this.data.gf_prom_id) { - continue; - } - new_pk_list_goods.push(item) - } - - //-- 循环把赠品添加进去 -- - for (var i = 0; i < giftsinfo.length; i++) { - var gf_item = giftsinfo[i]; - if (!gf_item.selected) continue; - var add_data = null; - var newd = { - goods_id: gf_item.goodsinfo.goods_id, - goods_num: gf_item.goods_num, - pick_id: gf_pickup_id, - user_id: app.globalData.user_id, - store_id: os.stoid, - goods_price: 0, - member_goods_price: 0, - goods_name: gf_item.goodsinfo.goods_name, - goods_sn: gf_item.goodsinfo.goods_sn, - sku: gf_item.goodsinfo.sku, - is_gift: 1, - prom_id: th.data.gf_prom_id, - prom_type: 3, - selected: 1, - gift_id: gf_item.gift_id, - original_img: th.data.imgUrl + gf_item.goodsinfo.original_img, - exp_sum_type: gf_item.goodsinfo.exp_sum_type, - is_free_shipping: gf_item.goodsinfo.is_free_shipping, - weight: gf_item.goodsinfo.weight, - uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum, - goods_spec: gf_item.goodsinfo.goods_spec, - goods_color: gf_item.goodsinfo.goods_color, - }; - - await getApp().request.promisePost("/api/weshop/cart/save", { - data: newd - }).then(res => { - if (res.data.code == 0) { - add_data = res.data.data; - } - }) - if (add_data) { - newd.id = add_data.id; - new_pk_list_goods.push(newd); - } - } - - var set_data = this.data.send_gf[gf_pickup_id][this.data.send_gf_index]; - set_data.selected = 1; - var txt9 = "cartlist[" + index + "].goods"; - - th.setData({[txt9]: new_pk_list_goods, send_gf: this.data.send_gf}); - this.data.old_cartlist[index].goods = new_pk_list_goods; - - - console.log(this.data.send_gf,"----"); - - th.calculatePrice(); - }else{ - var new_pk_list_goods=[]; - //-- 当是立即购买的时候 -- - for (var i = 0; i < giftsinfo.length; i++) { - var gf_item = giftsinfo[i]; - if (!gf_item.selected) continue; - var newd = { - goods_id: gf_item.goodsinfo.goods_id, - buynum: gf_item.goods_num, - pick_id: gf_pickup_id, - user_id: app.globalData.user_id, - store_id: os.stoid, - goods_price: 0, - member_goods_price: 0, - goods_name: gf_item.goodsinfo.goods_name, - goods_sn: gf_item.goodsinfo.goods_sn, - sku: gf_item.goodsinfo.sku, - is_gift: 1, - prom_id: th.data.gf_prom_id, - prom_type: 3, - selected: 1, - gift_id: gf_item.gift_id, - original_img: th.data.imgUrl + gf_item.goodsinfo.original_img, - exp_sum_type: gf_item.goodsinfo.exp_sum_type, - is_free_shipping: gf_item.goodsinfo.is_free_shipping, - weight: gf_item.goodsinfo.weight, - uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum, - uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum, - goods_spec: gf_item.goodsinfo.goods_spec, - goods_color: gf_item.goodsinfo.goods_color, - }; - new_pk_list_goods.push(newd); - } - var set_data = this.data.send_gf[th.data.bn_pick][this.data.send_gf_index]; - set_data.selected = 1; - var txt1 = "send_gf[" + gf_pickup_id + "][" + this.data.send_gf_index + "]"; - - th.setData({buy_now_gift_goods:new_pk_list_goods,[txt1]:set_data}); - th.calculatePrice2(); - - } - th.close_sele_gift(); - }, - - //获取输入 - getInput:function (e) { - this.data.gift_sear=e.detail.value; - }, - //-- 搜索赠品 -- - submitSearch:function () { - var giftsinfo=this.data.giftsinfo; - if(!this.data.gift_sear){ - for(let i in giftsinfo){ - let item=giftsinfo[i]; - item.hide_div=0; - } - }else{ - for(let i in giftsinfo){ - let item=giftsinfo[i]; - item.hide_div=0; - if(item.goods_name.indexOf(this.data.gift_sear)==-1){ - item.hide_div=1; - } - } - } - this.setData({giftsinfo:giftsinfo}) - - }, - - //-- 赠品的验证 -- - sub_check_gift(func){ - var th=this; - if(th.data.send_gf){ - var error_arr=[]; - for(let io in th.data.send_gf){ - let item_arr=th.data.send_gf[io]; - for(let ip in item_arr){ - var gf_pr_name=item_arr[ip].gf_pr_name; - var zp_num=item_arr[ip].zp_num; - var giftsinfo=item_arr[ip].giftsinfo; - var limit_all=0; - var stock_all=0; - for(let iu in giftsinfo){ - let gf_item=giftsinfo[iu]; - limit_all+=gf_item.limit_num; - stock_all+=gf_item.gift_storecount; - } - if(limit_all zp_num) { + wx.showToast({ + title: "超出活动赠品赠送的数量" + zp_num + "件", + icon: 'none', + duration: 2000 + }); + return false; + } + if (all_num < zp_num) { + wx.showToast({ + title: "您还可以加" + (zp_num - all_num) + "件", + icon: 'none', + duration: 2000 + }); + return false; + } + + //-- 当是购物车购买的时候 -- + if (this.data.cartlist && this.data.cartlist.length > 0) { + var alllist = this.data.cartlist; + var index = alllist.findIndex(function (e) { + return e.pickup_id == gf_pickup_id + }); + var pk_list_goods = alllist[index].goods; + + var url = "/api/weshop/cart/delGift?store_id=" + os.stoid + "&user_id=" + + getApp().globalData.user_id + "&is_gift=1&pick_id=" + this.data.gift_pkid + "&prom_id=" + this.data.prom_id; + await getApp().request.promiseDelete(url, {}); + + var new_pk_list_goods = []; + for (let i in pk_list_goods) { + let item = pk_list_goods[i]; + if (item.is_gift && item.prom_id == this.data.gf_prom_id) { + continue; + } + new_pk_list_goods.push(item) + } + + //-- 循环把赠品添加进去 -- + for (var i = 0; i < giftsinfo.length; i++) { + var gf_item = giftsinfo[i]; + if (!gf_item.selected) continue; + var add_data = null; + var newd = { + goods_id: gf_item.goodsinfo.goods_id, + goods_num: gf_item.goods_num, + pick_id: gf_pickup_id, + user_id: app.globalData.user_id, + store_id: os.stoid, + goods_price: 0, + member_goods_price: 0, + goods_name: gf_item.goodsinfo.goods_name, + goods_sn: gf_item.goodsinfo.goods_sn, + sku: gf_item.goodsinfo.sku, + is_gift: 1, + prom_id: th.data.gf_prom_id, + prom_type: 3, + selected: 1, + gift_id: gf_item.gift_id, + original_img: th.data.imgUrl + gf_item.goodsinfo.original_img, + exp_sum_type: gf_item.goodsinfo.exp_sum_type, + is_free_shipping: gf_item.goodsinfo.is_free_shipping, + weight: gf_item.goodsinfo.weight, + uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum, + goods_spec: gf_item.goodsinfo.goods_spec, + goods_color: gf_item.goodsinfo.goods_color, + }; + + await getApp().request.promisePost("/api/weshop/cart/save", { + data: newd + }).then(res => { + if (res.data.code == 0) { + add_data = res.data.data; + } + }) + if (add_data) { + newd.id = add_data.id; + new_pk_list_goods.push(newd); + } + } + + var set_data = this.data.send_gf[gf_pickup_id][this.data.send_gf_index]; + set_data.selected = 1; + var txt9 = "cartlist[" + index + "].goods"; + + th.setData({ [txt9]: new_pk_list_goods, send_gf: this.data.send_gf }); + this.data.old_cartlist[index].goods = new_pk_list_goods; + + + console.log(this.data.send_gf, "----"); + + th.calculatePrice(); + } else { + var new_pk_list_goods = []; + //-- 当是立即购买的时候 -- + for (var i = 0; i < giftsinfo.length; i++) { + var gf_item = giftsinfo[i]; + if (!gf_item.selected) continue; + var newd = { + goods_id: gf_item.goodsinfo.goods_id, + buynum: gf_item.goods_num, + pick_id: gf_pickup_id, + user_id: app.globalData.user_id, + store_id: os.stoid, + goods_price: 0, + member_goods_price: 0, + goods_name: gf_item.goodsinfo.goods_name, + goods_sn: gf_item.goodsinfo.goods_sn, + sku: gf_item.goodsinfo.sku, + is_gift: 1, + prom_id: th.data.gf_prom_id, + prom_type: 3, + selected: 1, + gift_id: gf_item.gift_id, + original_img: th.data.imgUrl + gf_item.goodsinfo.original_img, + exp_sum_type: gf_item.goodsinfo.exp_sum_type, + is_free_shipping: gf_item.goodsinfo.is_free_shipping, + weight: gf_item.goodsinfo.weight, + uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum, + uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum, + goods_spec: gf_item.goodsinfo.goods_spec, + goods_color: gf_item.goodsinfo.goods_color, + }; + new_pk_list_goods.push(newd); + } + var set_data = this.data.send_gf[th.data.bn_pick][this.data.send_gf_index]; + set_data.selected = 1; + var txt1 = "send_gf[" + gf_pickup_id + "][" + this.data.send_gf_index + "]"; + + th.setData({ buy_now_gift_goods: new_pk_list_goods, [txt1]: set_data }); + th.calculatePrice2(); + + } + th.close_sele_gift(); + }, + + //获取输入 + getInput: function (e) { + this.data.gift_sear = e.detail.value; + }, + //-- 搜索赠品 -- + submitSearch: function () { + var giftsinfo = this.data.giftsinfo; + if (!this.data.gift_sear) { + for (let i in giftsinfo) { + let item = giftsinfo[i]; + item.hide_div = 0; + } + } else { + for (let i in giftsinfo) { + let item = giftsinfo[i]; + item.hide_div = 0; + if (item.goods_name.indexOf(this.data.gift_sear) == -1) { + item.hide_div = 1; + } + } + } + this.setData({ giftsinfo: giftsinfo }) + + }, + + //-- 赠品的验证 -- + sub_check_gift(func) { + var th = this; + if (th.data.send_gf) { + var error_arr = []; + for (let io in th.data.send_gf) { + let item_arr = th.data.send_gf[io]; + for (let ip in item_arr) { + var gf_pr_name = item_arr[ip].gf_pr_name; + var zp_num = item_arr[ip].zp_num; + var giftsinfo = item_arr[ip].giftsinfo; + var limit_all = 0; + var stock_all = 0; + for (let iu in giftsinfo) { + let gf_item = giftsinfo[iu]; + limit_all += gf_item.limit_num; + stock_all += gf_item.gift_storecount; + } + if (limit_all < zp_num) { + error_arr.push(gf_pr_name + "限购不足"); + } + if (stock_all < zp_num) { + error_arr.push(gf_pr_name + "赠品库存不足"); + } + } + } + + //-- 有赠品错误的时候,是不是继续下单 -- + if (error_arr.length) { + var err = error_arr.join(","); + wx.showModal({ + title: '提示', + content: err + ',无法赠送赠品,是否继续下单', + success(res) { + if (res.confirm) { + func(); + } else if (res.cancel) { + console.log('用户点击取消'); + th.setData({ + submit: 0, + }) + } + } + }) + } else { + + var is_ok = 1; + var error_arr = []; + for (let io in th.data.send_gf) { + let item_arr1 = th.data.send_gf[io]; + for (let ip1 in item_arr1) { + var item_b = item_arr1[ip1]; + if (!item_b.selected) { + is_ok = 0; + break; + } + } + if (!is_ok) break; + } + + if (!is_ok) { + getApp().confirmBox("请选择赠品"); + th.setData({ + submit: 0, + }) + return false; + } + func(); + } + + + } else { + func(); + } + } diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml index 6588255..d80a6ae 100644 --- a/pages/cart/cart2/cart2.wxml +++ b/pages/cart/cart2/cart2.wxml @@ -8,24 +8,20 @@ - + - + - + - + - + @@ -82,7 +78,7 @@ - + {{items.goods_name}} @@ -104,8 +100,9 @@ - - {{show_card.CardName}} + + + {{show_card.CardName}} 立减 {{filters.toFix(item.card_cut_price,2) }} @@ -119,19 +116,7 @@ - - - - 优惠券{{item.can_num}}张可用 - - 不使用 - ¥{{using_quan[item.pickup_id].money}}元优惠券 - 包邮券 - - - - + @@ -142,9 +127,8 @@ - - + + @@ -166,14 +150,13 @@ - 快递邮寄 + 快递邮寄 - + {{wu_arr[item.wind].name}} @@ -181,69 +164,92 @@ - - - - 选择物流 - - {{wu_arr[item.wind].name}} - + + + + 选择物流 + + {{wu_arr[item.wind].name}} + + - + + + + + + {{send.zxlbtitle?send.zxlbtitle:send.lbtitle}} + + + + x{{send.num}} + + + + - - - {{iter.name}} 可选赠品{{iter.zp_num}}个 - + + + {{iter.name}} 可选赠品{{iter.zp_num}}个 + - - 已选择 - + + 已选择 + - + 未选择 - + - + + + + + 优惠券{{item.can_num}}张可用 + + 不使用 + ¥{{using_quan[item.pickup_id].money}}元优惠券 + 包邮券 + + + + + 留言 - + - - - 店铺优惠 - - 省{{filters.toFix(item.offline_price,2)}}元 - - - -¥{{filters.toFix(item.offline_price,2)}} - - - 不使用优惠 - - - - + + + 店铺优惠 + + 省{{filters.toFix(item.offline_price,2)}}元 + + + -¥{{filters.toFix(item.offline_price,2)}} + + + 不使用优惠 + + + + @@ -286,27 +292,27 @@ - - - + + + - - - - {{item.goods_name}} - - - - {{filters.show_gui_ge(item.goods_spec,item.goods_color)}} - + - - - 0 - x{{item.buynum}} - - - + + {{item.goods_name}} + + + + {{filters.show_gui_ge(item.goods_spec,item.goods_color)}} + + + + + 0 + x{{item.buynum}} + + + @@ -333,12 +339,13 @@ - + - - {{show_card.CardName}} + + + {{show_card.CardName}} 立减 {{filters.toFix(card_cut_price,2) }} @@ -351,6 +358,55 @@ 立即开通 + + + + + {{bn_goods.lbtitle}} + + + + x{{bn_goods.s_lb_num}} + + + + + + + + {{bn_goods.zxlbtitle}} + + + + x{{bn_goods.zx_lb_num}} + + + + + + + + + + + {{iter.name}} 可选赠品{{iter.zp_num}}个 + + + + 已选择 + + + + 未选择 + + + + + + + + + @@ -377,41 +433,20 @@ 选择物流 - {{wu_arr[index].name}} - + {{wu_arr[index].name}} + - - - - - - {{iter.name}} 可选赠品{{iter.zp_num}}个 - - - - 已选择 - - - 未选择 - - - - - 留言 - + @@ -422,10 +457,10 @@ 省{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}元 - -¥{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}} + -¥{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}} - 不使用优惠 + 不使用优惠 @@ -487,7 +522,7 @@ 应付金额:{{formData.order_amount}} - + @@ -519,8 +554,7 @@ - + @@ -561,8 +595,7 @@ - + @@ -605,8 +638,7 @@ - + @@ -672,8 +704,7 @@ - + Γ @@ -703,77 +734,77 @@ 店铺优惠 - 优惠¥{{show_off_price}} - - 不用优惠 - + 优惠¥{{show_off_price}} + + + 不用优惠 + + - + - + - + - + {{gf_pr_name}},可任选{{zp_num}}件商品为赠品 - - + - + - - + \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 11fd6c8..cd914f8 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -70,6 +70,7 @@ Page({ onLoad: function (options) { this.setData({ params: options, + now:Date.parse(new Date()) / 1000, }) }, diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml index 338b8a4..57948bd 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxml +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml @@ -1,118 +1,126 @@ - + + - + - - - - - - - - - 礼包列表 - - - - 我的礼包 - - - - - - - - - - - - {{items.giftTitle}} - - - - {{"¥"+items.payMoney}} - - - / - - - - {{items.payIntegral}} - 积分 - - - - - {{"零售价:¥"+items.giftPosPrice}} - - - {{"活动结束时间:"+items.endTime}} - - - - - - {{"已售:"+items.giftQty+"件"}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - 当前暂无礼包 - - - 回到首页 - - - - - - - 到底了 - - + + + + 礼包列表 + + + + 我的礼包 + + + + + + + + + + + + {{items.giftTitle}} + + + + {{"¥"+items.payMoney}} + + + / + + + + {{items.payIntegral}} + 积分 + + + + + {{"零售价:¥"+items.giftPosPrice}} + + + {{"活动开始时间:"+items.starTime}} + + + {{"活动结束时间:"+items.endTime}} + + + + + + {{"已售:"+items.giftQty+"件"}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 当前暂无礼包 + + + 回到首页 + + + + + + + 到底了 + + diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index f176cb3..7123c06 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -333,6 +333,9 @@ Page({ var sele_g=res.data.data; + //需不需要门店,不需要门店返回 + if(!sele_g.is_pickup) return false; + com.wait_for_store_config(_this2); com.set_user_mo_store(_this2,os,function () { if(sele_g.pickup_list && _this2.data.def_pick_store){ diff --git a/pages/giftpack/public/buy_com.js b/pages/giftpack/public/buy_com.js index 95adf88..6013fb5 100644 --- a/pages/giftpack/public/buy_com.js +++ b/pages/giftpack/public/buy_com.js @@ -227,7 +227,7 @@ module.exports = { json.guide_id=that.data.guide_id } - if(that.data.def_pick_store){ + if(th.data.sele_g.is_pickup && that.data.def_pick_store){ json.pickup_id=that.data.def_pick_store.pickup_id; } diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index 71daaa0..96cdd72 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -99,8 +99,8 @@ Page({ //-- user_id代过来免登录 -- getApp().globalData.first_leader=first_leader; } - - + + if(tt.type) this.data.type= parseInt(tt.type); that.get_brand(); clearInterval(that.data.timer); @@ -267,18 +267,20 @@ Page({ else if (that.data.is_show_pp) {that.setData({ currentTab: 2 });that.get_brand(); } else if (that.data.is_show_xm) {that.setData({ currentTab: 3 });that.getServiceCategory(); } + + var t_type=that.data.type; //----求传参过来的控制----- - if (getApp().globalData.cat_type == 1 && that.data.is_show_gb ) { - that.setData({ currentTab: 1 }); + if (t_type == 1 && that.data.is_show_gb ) { + that.setData({ currentTab: 1,select_classify_on:223 }); that.get_nation(); - } else if (getApp().globalData.cat_type == 2 && that.data.is_show_pp ) { - that.setData({ currentTab: 2 }); + } else if (t_type == 2 && that.data.is_show_pp ) { + that.setData({ currentTab: 2,select_classify_on:220}); that.get_brand(); - } else if (getApp().globalData.cat_type == 3 && that.data.is_show_xm ) { - that.setData({ currentTab: 3 }); + } else if (t_type == 3 && that.data.is_show_xm ) { + that.setData({ currentTab: 3,select_classify_on:221 }); that.getServiceCategory(); } else if (that.data.is_show_pl) { - that.setData({ currentTab: 0 }); + that.setData({ currentTab: 0,select_classify_on:0 }); } // 获取默认选中的第一个 if(that.data.is_show_gb && that.data.select_classify_on == 223){ @@ -370,6 +372,38 @@ Page({ } //console.log(arr) t.setData({one_level_classify:arr}); + if(t.data.select_classify_on==0){ + var item=arr[0]; + + var name = item.items.name; + var cid = item.items.cid; + var arr = item.array; + + + if (arr.length == 0) { + t.setData({ + select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, + goodslist: null, is_level_three: 0 + }); + return false; + } + if (arr.length != 0) { + var is_lev_thr = 0 + for (var i = 0; i < arr.length; i++) { + if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } + } + t.setData({ is_level_three: is_lev_thr }); + + if (this.data.is_level_three != 1) { + t.setData({ index: 0, classify_name: name, goodslist: arr }); + } else { + t.setData({ index: 0, goodslist: arr }); + } + } + + t.style(t.data.stylePage, cid) + + } } } diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index e054985..f492419 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -5054,6 +5054,7 @@ Page({ var type = this.data.prom_type; if (type == 2) type = -1; if (type == 6) type = 2; // 6拼团 2团购 + if (type == 10) type = -1; if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; @@ -5159,8 +5160,7 @@ Page({ context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); } - } - ; + }; var share_title = th.data.data.goods_name; diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss index ae4529c..52009d0 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxss +++ b/pages/goods/goodsInfo/goodsInfo.wxss @@ -3447,7 +3447,7 @@ margin: auto; */ /* 门店分类列表 */ .sort_store_list { - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index 419fab8..bbf575e 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -1,9 +1,9 @@ -var t = function(t) { +var t = function (t) { return t && t.__esModule ? t : { default: t }; }(require("../../../utils/LoadMore.js")), ut = require("../../../utils/util.js"), - a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting; + a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting; Page({ data: { @@ -18,31 +18,32 @@ Page({ requestUrl: "", //hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ] hotWords: null, - is_no_plus:1, + is_no_plus: 1, tabname: "sort", //排序的字段 adname: "asc", //升降的字段 - rq_data:null, - searchRecord: [], - keyword: '', - is_his:0, - hiddenClear: true, + rq_data: null, + searchRecord: [], + keyword: '', + is_his: 0, + hiddenClear: true, + fliter_flag: false, }, - - onLoad: function(t) { - this.data.rq_data=t; - if(t.o) { - this.data.rq_data.o = JSON.parse(t.o); - }; - - + + onLoad: function (t) { + this.data.rq_data = t; + if (t.o) { + this.data.rq_data.o = JSON.parse(t.o); + }; + + //接受有没有导购的参数 - var first_leader=t.first_leader; - if(first_leader){ - getApp().globalData.first_leader=first_leader; + var first_leader = t.first_leader; + if (first_leader) { + getApp().globalData.first_leader = first_leader; //调用接口判断是不是会员 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{ - if(res.data.code==0){ - getApp().globalData.guide_id=res.data.data.id; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; } }) } @@ -63,145 +64,145 @@ Page({ } }) - var th=this; - a.getConfig2(function(rs) { - var arr=new Array(),arr2=new Array(); - if (rs.hot_keywords != null && ut.trim(rs.hot_keywords)!="" ){ - var arr1 = rs.hot_keywords.split('|'); - for (var i = 0; i < arr1.length;i++){ - if(i%5==0 && i!=0){ - arr.push(arr2); - arr2=[]; - }else{ - arr2.push(arr1[i]); + var th = this; + a.getConfig2(function (rs) { + var arr = new Array(), arr2 = new Array(); + if (rs.hot_keywords != null && ut.trim(rs.hot_keywords) != "") { + var arr1 = rs.hot_keywords.split('|'); + for (var i = 0; i < arr1.length; i++) { + if (i % 5 == 0 && i != 0) { + arr.push(arr2); + arr2 = []; + } else { + arr2.push(arr1[i]); + } } + if (arr2.length > 0) arr.push(arr2); + th.setData({ hotWords: arr }); } - if (arr2.length > 0) arr.push(arr2); - th.setData({ hotWords: arr}); - } - - - //计算等级价相关 - var swithc_list=rs.switch_list; - var sw_arr=JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){ - th.setData({rank_switch:true}); - var user=getApp().globalData.userInfo; - var ti=setInterval(function(){ - if(!user) return false; - clearInterval(ti); - //---回调卡的列表--- - th.getPlusCardType(function(ob){ - th.setData({card_list:ob.card_list}); - if(user.card_field ){ - 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 && now7) card_name=card_name.substring(0,8); - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list}); - } - } - }) - },500) - } - - - - }) - //e.init(this, "", "requestData"); - var url = this.data.baseUrl; - - //扫一扫过来,显示搜索的内容 - var s_key = t.s_key; - if (s_key){ - s_key=s_key.trim(); - this.search(s_key); this.openSearchModal(); - return; - } - - if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;} - if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;} - if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;} - if (0 != t.ladder_id && t.ladder_id != undefined) { - url += "&ladder_id=" + t.ladder_id; - this.setData({ - baseUrl:url, + + + //计算等级价相关 + var swithc_list = rs.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台又开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ rank_switch: true }); + var user = getApp().globalData.userInfo; + var ti = setInterval(function () { + if (!user) return false; + clearInterval(ti); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ card_list: ob.card_list }); + if (user.card_field) { + 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 && card_name.length > 7) card_name = card_name.substring(0, 8); + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list }); + } + } + }) + }, 500) + } + + + }) - } - if (url != this.data.baseUrl) return this.requestSearch(url); - this.openSearchModal(); + //e.init(this, "", "requestData"); + var url = this.data.baseUrl; + + //扫一扫过来,显示搜索的内容 + var s_key = t.s_key; + if (s_key) { + s_key = s_key.trim(); + this.search(s_key); this.openSearchModal(); + return; + } + + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; } + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; } + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; } + if (0 != t.ladder_id && t.ladder_id != undefined) { + url += "&ladder_id=" + t.ladder_id; + this.setData({ + baseUrl: url, + }) + } + if (url != this.data.baseUrl) return this.requestSearch(url); + this.openSearchModal(); // 获取历史搜索记录 - this.getHistorySearch(); + this.getHistorySearch(); }, - onShow:function () { + onShow: function () { getApp().check_can_share(); }, - changeTab: function(t) { - var ord = t.currentTarget.dataset.href; - var ad = t.currentTarget.dataset.ad; + changeTab: function (t) { + var ord = t.currentTarget.dataset.href; + var ad = t.currentTarget.dataset.ad; - var url = this.data.requestUrl; + var url = this.data.requestUrl; - if (this.data.tabname != ord) { - this.setData({ tabname: ord, adname: "desc" }); - } else { - ad = ad == "desc" ? "asc" : "desc"; - this.setData({ adname: ad }); - } - this.resetData(), this.requestSearch(url); + if (this.data.tabname != ord) { + this.setData({ tabname: ord, adname: "desc" }); + } else { + ad = ad == "desc" ? "asc" : "desc"; + this.setData({ adname: ad }); + } + this.resetData(), this.requestSearch(url); }, //-----------真的调用地址进行搜索------------ - requestSearch: function(t) { - // console.log('t===>', t); - if(this.data.loading) return false; - this.data.loading=1; - var e = this,th=e; - if(getApp().globalData.userInfo) { - t += "&user_id=" + getApp().globalData.userInfo.user_id; - } + requestSearch: function (t) { + // console.log('t===>', t); + if (this.data.loading) return false; + this.data.loading = 1; + var e = this, th = e; + if (getApp().globalData.userInfo) { + t += "&user_id=" + getApp().globalData.userInfo.user_id; + } this.data.requestUrl = t; - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; - let data = { - is_mainshow: 1, - isonsale: 1, - store_id: oo.stoid, - orderField: e.data.tabname, - orderType: e.data.adname, - page: e.data.currentPage, - }; - - let o = this.data.rq_data.o; - if(o) { - if(o.cat_id) data.cat_id = o.cat_id; - if(o.pid && o.pid != 'three') data.parent_id = o.pid; - if(o.nation_id) data.nation_id = o.nation_id; - if(o.brand_id) data.brand_id = o.brand_id; - }; - - - getApp().request.promiseGet(t, {data:data}).then(async res=>{ - th.data.loading=0; - if(ut.ajax_ok(res)){ - if(!e.data.requestData) { - // e.data.requestData=[]; - e.setData({ - requestData: [], - }); - }; - for(let i in res.data.data.pageData){ - let item=res.data.data.pageData[i]; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; + let data = { + is_mainshow: 1, + isonsale: 1, + store_id: oo.stoid, + orderField: e.data.tabname, + orderType: e.data.adname, + page: e.data.currentPage, + }; + + let o = this.data.rq_data.o; + if (o) { + if (o.cat_id) data.cat_id = o.cat_id; + if (o.pid && o.pid != 'three') data.parent_id = o.pid; + if (o.nation_id) data.nation_id = o.nation_id; + if (o.brand_id) data.brand_id = o.brand_id; + }; + + + getApp().request.promiseGet(t, { data: data }).then(async res => { + th.data.loading = 0; + if (ut.ajax_ok(res)) { + if (!e.data.requestData) { + // e.data.requestData=[]; + e.setData({ + requestData: [], + }); + }; + for (let i in res.data.data.pageData) { + let item = res.data.data.pageData[i]; item.original_img = th.data.url + item.original_img; /*-- @@ -218,48 +219,48 @@ Page({ })--*/ var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购 - var prom_id=item.prom_id; - var now=ut.gettimestamp(); + var prom_id = item.prom_id; + var now = ut.gettimestamp(); var url = ""; - switch (prom_type){ + switch (prom_type) { case 1: - url = "/api/ms/flash_sale/getNew/" +oo.stoid + "/" +user_id+"/"+ prom_id; + url = "/api/ms/flash_sale/getNew/" + oo.stoid + "/" + user_id + "/" + prom_id; break; case 2: - url ="/api/weshop/goods/groupBuy/getActInfo/" +oo.stoid + "/" +item.goods_id+"/"+ prom_id + url = "/api/weshop/goods/groupBuy/getActInfo/" + oo.stoid + "/" + item.goods_id + "/" + prom_id break; case 4: - url ="/api/weshop/integralbuy/get/"+oo.stoid +"/"+prom_id; + url = "/api/weshop/integralbuy/get/" + oo.stoid + "/" + prom_id; break; case 6: url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id; - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{ - data:{ - store_id: oo.stoid, - is_end: 0, - is_show: 1, - user_id: getApp().globalData.user_id, - pageSize:1000, + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1", { + data: { + store_id: oo.stoid, + is_end: 0, + is_show: 1, + user_id: getApp().globalData.user_id, + pageSize: 1000, } - }).then(pd=>{ - let pd_list=pd.data.data.pageData; - if(res.data.code==0 && pd_list.length>0){ - var flag = pd_list.some(pd=>{ - return pd.goods_id==item.goods_id - }) - - if(!flag){ - item.prom_type=0; - item.prom_id=0; - item.prom_price=null; - } + }).then(pd => { + let pd_list = pd.data.data.pageData; + if (res.data.code == 0 && pd_list.length > 0) { + var flag = pd_list.some(pd => { + return pd.goods_id == item.goods_id + }) + + if (!flag) { + item.prom_type = 0; + item.prom_id = 0; + item.prom_price = null; + } } - }) + }) break; case 8: var presell_id = prom_id; var url1 = "/api/weshop/marketing/marketingPresellList/list"; - var rd= { + var rd = { store_id: oo.stoid, presell_id: presell_id, goods_id: item.goods_id @@ -271,287 +272,303 @@ Page({ if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { var arr = res.data.data[0]; item.prom_price = arr.luck_goods_price; - item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0); + item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0); } }) break; default: break; }; - if(url!=null && url!=''){ + if (url != null && url != '') { await getApp().request.promiseGet(url, {}).then(async res => { - var prom =null; - if(res.data.code==0 && res.data.data){ - prom=res.data.data; + var prom = null; + if (res.data.code == 0 && res.data.data) { + prom = res.data.data; - if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time now && (prom.start_time < now || (prom.show_time && prom.show_time < now))) { item.prom_price = res.data.data.price; - if(res.data.data.user_price) item.prom_price=res.data.data.user_price; - var vNum=prom.virtual_num?prom.virtual_num:0; - var vNum1=prom.virtualNum?prom.virtualNum:0; - var vNum2=prom.virtual?prom.virtual:0; - item.sales_sum=prom.buy_num+(vNum+vNum1+vNum2); - }else{ - item.prom_type=0; - item.prom_id=0; - item.prom_price=null; + if (res.data.data.user_price) item.prom_price = res.data.data.user_price; + var vNum = prom.virtual_num ? prom.virtual_num : 0; + var vNum1 = prom.virtualNum ? prom.virtualNum : 0; + var vNum2 = prom.virtual ? prom.virtual : 0; + item.sales_sum = prom.buy_num + (vNum + vNum1 + vNum2); + } else { + item.prom_type = 0; + item.prom_id = 0; + item.prom_price = null; } } }) }; - if(!th.data.requestData) th.data.requestData=[]; + if (!th.data.requestData) th.data.requestData = []; th.data.requestData.push(item); - e.setData({requestData: e.data.requestData}); + e.setData({ requestData: e.data.requestData }); } } e.closeSearchModal(); }) }, - onReachBottom: function() { - console.log('触发上滑加载事件'); + onReachBottom: function () { + console.log('触发上滑加载事件'); this.data.currentPage++ - console.log('触发上滑加载事件currentPage',this.data.currentPage); + console.log('触发上滑加载事件currentPage', this.data.currentPage); this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl); }, - - - openFilterModal: function() { + + + openFilterModal: function () { this.setData({ openFilterModal: !0 }); }, - closeFilterModal: function() { + closeFilterModal: function () { this.setData({ openFilterModal: !1 }); }, - filterGoods: function(t) { + filterGoods: function (t) { this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal(); }, - - - - resetData: function() { - e.resetConfig(), - // this.data.requestData = null, - this.data.currentPage = 1; - this.setData({ - requestData: null, - }); + + + + resetData: function () { + e.resetConfig(), + // this.data.requestData = null, + this.data.currentPage = 1; + this.setData({ + requestData: null, + }); }, //---回复最初的设置---显示全部分类-- - restoreData: function() { + restoreData: function () { this.setData({ requestData: this.data.allData, }); - this.data.currentPage=2; + this.data.currentPage = 2; }, - openSearchModal: function() { + openSearchModal: function () { this.setData({ openSearchModal: !0 }); }, - closeSearchModal: function() { + closeSearchModal: function () { this.setData({ openSearchModal: !1 }); }, - - submitSearch: function(t) { - var val=t.detail.value.word; - if(val==undefined) val=t.detail.value; - val=val?val.trim():''; - if(!val){ - a.showWarning("请输入关键词"); - } - this.search(val); + + submitSearch: function (t) { + var val = t.detail.value.word; + if (val == undefined) val = t.detail.value; + val = val ? val.trim() : ''; + if (!val) { + a.showWarning("请输入关键词"); + } + this.search(val); }, //热搜关键字 - searchHotWord: function(t) { - var word = t.currentTarget.dataset.word; - if(word) { - this.setData({ - keyword: word, - hiddenClear: false, - }); - }; - this.historyRecord(word); - this.search(word); + searchHotWord: function (t) { + var word = t.currentTarget.dataset.word; + if (word) { + this.setData({ + keyword: word, + hiddenClear: false, + }); + }; + this.historyRecord(word); + this.search(word); }, //-----点击搜索按钮---- - search: function(t) { + search: function (t) { if ("string" != typeof t || "" == t) return a.showWarning("请输入关键词"); - this.data.key_str=t; + this.data.key_str = t; this.resetData(); - this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); - this.historyRecord(); + this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); + this.historyRecord(); }, //---------分享配置-------- onShareAppMessage: function (e) { - getApp().globalData.no_clear=1; - var curPage=this; + getApp().globalData.no_clear = 1; + var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - if(this.data.key_str) { + if (this.data.key_str) { pagePath += "?s_key=" + this.data.key_str; } - if(getApp().globalData.user_id){ + if (getApp().globalData.user_id) { - if(pagePath.indexOf("?")>0){ - pagePath+="&first_leader="+getApp().globalData.user_id; - }else{ - pagePath+="?first_leader="+getApp().globalData.user_id; + if (pagePath.indexOf("?") > 0) { + pagePath += "&first_leader=" + getApp().globalData.user_id; + } else { + pagePath += "?first_leader=" + getApp().globalData.user_id; } } // console.log("11-11"+pagePath); return { title: "商品搜索", - path:pagePath, + path: pagePath, } }, //---------图片失败,默认图片-------- bind_bnerr: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errObj = {}; - _errObj[_errImg] = this.data.url+ "/miniapp/images/default_g_img.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, - - //--- 获取卡类列表 --- - getPlusCardType: function (func) { - var storid = oo.stoid; - var th = this; - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { - 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; - - 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); - }) - }, - - - getInput(e) { - let val = e.detail.value; - if(val) { - this.setData({ - keyword: e.detail.value, - hiddenClear: false, - }); - } else { - this.setData({ - hiddenClear: true, - }); - } - - }, - - historyRecord(w) { - let keyword =w; - let self = this; - if(!keyword){ - keyword = this.data.key_str.trim(); - } - let searchRecord = this.data.searchRecord; - if(!searchRecord || searchRecord.length==0) searchRecord=wx.getStorageSync('searchRecord') || []; - - if(keyword) { - - var index=searchRecord.indexOf(keyword); - if(index > -1) { - // 已经存在该值 - searchRecord.splice(index,1); - searchRecord.unshift(keyword); - - // 将历史记录添加到缓存中 - wx.setStorage({ - key: 'searchRecord', - data: searchRecord, - success: function(res) { - self.setData({ - searchRecord, - }) - } - }) - - return; - } else { - if(searchRecord.length >= 10) { - searchRecord.pop(); // 删除最早的一条记录 - }; - searchRecord.unshift(keyword); - - // // 将历史记录添加到缓存中 - wx.setStorage({ - key: 'searchRecord', - data: searchRecord, - success: function(res) { - self.setData({ - searchRecord, - }) - } - }) - }; - }; - }, - - - - // 获取历史搜索记录 - getHistorySearch() { - this.setData({ - searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空 - }); - }, - - // 清除历史搜素记录 - clearSearchRecord() { - wx.clearStorageSync('searchRecord'); - this.setData({ - searchRecord: [] - }); - }, - - go_url:function (e) { - var url=e.currentTarget.dataset.url; + + //--- 获取卡类列表 --- + getPlusCardType: function (func) { + var storid = oo.stoid; + var th = this; + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { + 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; + + 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); + }) + }, + + + getInput(e) { + let val = e.detail.value; + if (val) { + this.setData({ + keyword: e.detail.value, + hiddenClear: false, + }); + } else { + this.setData({ + hiddenClear: true, + }); + } + + }, + + historyRecord(w) { + let keyword = w; + let self = this; + if (!keyword) { + keyword = this.data.key_str.trim(); + } + let searchRecord = this.data.searchRecord; + if (!searchRecord || searchRecord.length == 0) searchRecord = wx.getStorageSync('searchRecord') || []; + + if (keyword) { + + var index = searchRecord.indexOf(keyword); + if (index > -1) { + // 已经存在该值 + searchRecord.splice(index, 1); + searchRecord.unshift(keyword); + + // 将历史记录添加到缓存中 + wx.setStorage({ + key: 'searchRecord', + data: searchRecord, + success: function (res) { + self.setData({ + searchRecord, + }) + } + }) + + return; + } else { + if (searchRecord.length >= 10) { + searchRecord.pop(); // 删除最早的一条记录 + }; + searchRecord.unshift(keyword); + + // // 将历史记录添加到缓存中 + wx.setStorage({ + key: 'searchRecord', + data: searchRecord, + success: function (res) { + self.setData({ + searchRecord, + }) + } + }) + }; + }; + }, + + closePoster() { + this.setData({ + fliter_flag: false, + }); + }, + + show_fliter() { + this.setData({ + fliter_flag: true + }) + }, + fliter_close() { + this.setData({ + fliter_flag: false, + }) + }, + + + // 获取历史搜索记录 + getHistorySearch() { + this.setData({ + searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空 + }); + }, + + // 清除历史搜素记录 + clearSearchRecord() { + wx.clearStorageSync('searchRecord'); + this.setData({ + searchRecord: [] + }); + }, + + go_url: function (e) { + var url = e.currentTarget.dataset.url; getApp().goto(url); }, - - clearInput() { - this.setData({ - keyword: '', - hiddenClear: true, - openSearchModal: true, - }); - }, - - inputFocus() { - this.setData({ - openSearchModal: true, - }); - }, + + clearInput() { + this.setData({ + keyword: '', + hiddenClear: true, + openSearchModal: true, + }); + }, + + inputFocus(e) { + this.setData({ + openSearchModal: true, + }); + }, }); \ No newline at end of file diff --git a/pages/goods/search/search.json b/pages/goods/search/search.json index 0aa7add..daca033 100644 --- a/pages/goods/search/search.json +++ b/pages/goods/search/search.json @@ -3,5 +3,8 @@ "enablePullDownRefresh": false, "usingComponents": { "share_box": "/components/share_box/share_box" - } + }, + "componentPlaceholder": { + "van-popup": "view" + } } \ No newline at end of file diff --git a/pages/goods/search/search.wxml b/pages/goods/search/search.wxml index c645425..34b8305 100644 --- a/pages/goods/search/search.wxml +++ b/pages/goods/search/search.wxml @@ -6,7 +6,7 @@
- + diff --git a/pages/goods/search/search.wxss b/pages/goods/search/search.wxss index 2842aea..257db3d 100644 --- a/pages/goods/search/search.wxss +++ b/pages/goods/search/search.wxss @@ -1,13 +1,13 @@ .container { color: #666; - overflow: visible; + overflow: visible; } .nav { - position: sticky; - top: 90rpx; - background-color: white; - z-index: 999; + position: sticky; + top: 90rpx; + background-color: white; + z-index: 99; } .nav-item { @@ -15,7 +15,7 @@ width: 30%; height: 90rpx; line-height: 90rpx; */ - padding: 14rpx 10rpx; + padding: 14rpx 10rpx; display: flex; align-items: center; justify-content: center; @@ -82,8 +82,8 @@ width: 180rpx; height: 180rpx; padding: 0 10rpx 0 30rpx; - flex-shrink: 0; - /* padding: 10rpx; */ + flex-shrink: 0; + /* padding: 10rpx; */ } .img-wrap image { @@ -98,7 +98,7 @@ line-height: 36rpx; color: #333; overflow: hidden; - text-align: justify; + text-align: justify; } .price { @@ -185,10 +185,10 @@ .search-bar { /* width: 100%; box-sizing: border-box; */ - background-color: white; - position: sticky; - top: 0; - z-index: 1; + background-color: white; + position: sticky; + top: 0; + z-index: 1; } .search-input { @@ -260,13 +260,13 @@ } */ .card_bg { - box-sizing: border-box; + box-sizing: border-box; padding: 2rpx 10rpx; /* height: 28rpx; */ border-radius: 26rpx; font-size: 18rpx; /* line-height: 28rpx; */ - max-width: 210rpx; + max-width: 210rpx; background: #333; color: #fff; margin-left: 8rpx; @@ -276,12 +276,12 @@ width: 19rpx; height: 19rpx; margin-right: 8rpx; - flex-shrink: 0; + flex-shrink: 0; } .card_name { - position: relative; - top: -4rpx; + position: relative; + top: -4rpx; } /* .card_bg image { @@ -299,7 +299,7 @@ } */ .navigator-hover { - opacity: 1; + opacity: 1; } .mk_price { @@ -309,76 +309,134 @@ .item-cont { /* line-height: 38rpx; */ - flex-grow: 1; + flex-grow: 1; } .history { - background-color: #f0f0f0; - color: #7b7b7b; - border: none; - margin-bottom: 16rpx; + background-color: #f0f0f0; + color: #7b7b7b; + border: none; + margin-bottom: 16rpx; } .history:first-of-type { - /* margin-left: 0; */ + /* margin-left: 0; */ } .input-box { - position: relative; - flex: 1; - padding-left: 50rpx; - padding-right: 70rpx; - background-color: #f0f0f0; - border-radius: 60rpx; + position: relative; + flex: 1; + padding-left: 50rpx; + padding-right: 70rpx; + background-color: #f0f0f0; + border-radius: 60rpx; } .input-box::before { - font-family: iconfont; - position: absolute; - left: 20rpx; - top: 50%; - transform: translateY(-50%); - content: '\e618'; + font-family: iconfont; + position: absolute; + left: 20rpx; + top: 50%; + transform: translateY(-50%); + content: '\e618'; } .input-search { - position: relative; - padding: 10rpx; - font-size: 28rpx; + position: relative; + padding: 10rpx; + font-size: 28rpx; } .btn { - margin-left: 0; - margin-right: 0; - line-height: 1; - padding: 20rpx; - font-size: 30rpx; + margin-left: 0; + margin-right: 0; + line-height: 1; + padding: 20rpx; + font-size: 30rpx; } .btn::after { - border: none; + border: none; } .icon-guan { - font-size: 20rpx; - padding: 10rpx; - position: absolute; - right: 20rpx; - top: 50%; - transform: translateY(-50%); + font-size: 20rpx; + padding: 10rpx; + position: absolute; + right: 20rpx; + top: 50%; + transform: translateY(-50%); } .lookat { - display: inline-block; - color: #FF6768; - border: 2rpx solid #FF6768; - border-radius: 80rpx; - font-size: 30rpx; + display: inline-block; + color: #FF6768; + border: 2rpx solid #FF6768; + border-radius: 80rpx; + font-size: 30rpx; } .no-data .no-data-title { - font-size: 28rpx; - color: #999; + font-size: 28rpx; + color: #999; +} + +.mt30 { + margin-top: 30rpx; +} + +.popup_item { + display: flex; + justify-content: space-between; + margin-top: 30rpx; } +.popup_input { + border-radius: 20rpx; + width: 40%; + font-size: 24rpx; + padding: 10rpx; + background: #f9f9f9; +} +.popup_price1 { + text-align: center; + padding: 0 30rpx; + margin-top: 30rpx; + background: red; + border-radius: 20rpx; +} + +.popup_price { + text-align: center; + padding: 10rpx 30rpx; + margin-top: 30rpx; + background: red; + border-radius: 35rpx; +} +.mask { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; + background-color: rgba(0,0,0,.4); + } + +.popup_brand { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +.filter { + height: 100%; + position: absolute; + right: 0; + top: 0; + background: pink; + width: 80%; + z-index: 1000; + transition: all .5s; +} \ No newline at end of file diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 052a9a3..dac0d27 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -84,7 +84,10 @@ Page({ full_ad: null, //全屏广告 full_screen: 0, //全屏广告 is_ok_h5: 0, //判断要不要显示关注二维码 + + container: null, }, + onLoad: async function (tt) { wx.showShareMenu({ diff --git a/pages/index/index/index.json b/pages/index/index/index.json index d22f482..e3ab55c 100644 --- a/pages/index/index/index.json +++ b/pages/index/index/index.json @@ -21,7 +21,10 @@ "store_select": "/components/diy_store_select/diy_store_select", "presell": "/components/diy_pregoods/diy_pregoods", "luckyGo": "/components/diy_luckyGo/diy_luckyGo", - "serviceCard": "/components/diy_serviceCard/diy_serviceCard" + "serviceCard": "/components/diy_serviceCard/diy_serviceCard", + "live": "/components/diy_live/diy_live", + "mp-dialog": "weui-miniprogram/dialog/dialog", + "mp-sticky": "/components/mp-sticky/mp-sticky" }, "enablePullDownRefresh": false } \ No newline at end of file diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index e9e0d5e..d57483c 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -45,6 +45,12 @@ + + + + + + @@ -137,6 +143,8 @@ + + @@ -461,7 +469,7 @@ - + @@ -528,7 +536,7 @@ - + diff --git a/pages/index/index/index.wxss b/pages/index/index/index.wxss index c249c08..6183737 100644 --- a/pages/index/index/index.wxss +++ b/pages/index/index/index.wxss @@ -1,3 +1,18 @@ +/* 基本样式 */ +page { + width: 100%; + height: 100%; + overflow: hidden; + box-sizing: border-box; + position: relative; +} +/* 超出滚动 */ +.container { + width: 100%; + height: 100%; + overflow-y: auto; +} + .pink-b { background: #ff7295; } @@ -1010,14 +1025,10 @@ page { /* background-color: #f7f8fa; */ } -.container { - /* overflow: hidden; */ - overflow: visible; - /* padding-top: 140rpx; */ -} + .container.nor{ - padding-top: 80rpx; + padding-top: 140rpx; } /* page, diff --git a/pages/team/team_show/team_show.wxss b/pages/team/team_show/team_show.wxss index 75fa735..34fe160 100644 --- a/pages/team/team_show/team_show.wxss +++ b/pages/team/team_show/team_show.wxss @@ -2178,7 +2178,7 @@ page { .sort_store_list{ - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/pages/template/index.js b/pages/template/index.js index 13d8475..c45a195 100644 --- a/pages/template/index.js +++ b/pages/template/index.js @@ -19,7 +19,21 @@ Page({ this.data.temp_id=e.scene; if(!this.data.temp_id) this.data.temp_id=e.sence; - if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,}) + if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,}) + + var first_leader = e.first_leader; + if (first_leader) { + //-- user_id代过来免登录 -- + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + } + }) + } + + }, @@ -94,26 +108,52 @@ Page({ }, - onShareAppMessage: function(e) { + onShareAppMessage:async function(e) { getApp().globalData.no_clear=1; + getApp().getConfig(await function(e){ + this.setData({ + store_config:e + }) + }.bind(this)) + + var url= `pages/template/index?sence=`+this.data.temp_id; + var userInfo = getApp().globalData.userInfo; + //是分销商才带 + if (userInfo) { + url += "&first_leader=" + userInfo.user_id; + } + + var ob = { + title: this.data.share_title, + path: url, + imageUrl:this.data.url+this.data.store_config.store_logo, + }; + return ob; }, /** * 用户分享朋友圈 */ async onShareTimeline(){ - getApp().globalData.no_clear=1; + getApp().globalData.no_clear=1; getApp().getConfig(await function(e){ this.setData({ store_config:e }) }.bind(this)) var {share_title,temp_id,store_config} = this.data; - // var url= `pages/template/index?sence=${temp_id}`; + var url= `pages/template/index?sence=${temp_id}`; + + var userInfo = getApp().globalData.userInfo; + //是分销商才带 + if (userInfo) { + url += "&first_leader=" + userInfo.user_id; + } + var ob = { title:share_title, - // path: url, - query:`sence=${temp_id}`, + path: url, + //query:`sence=${temp_id}`, imageUrl:this.data.url+store_config.store_logo, }; console.log(ob); diff --git a/pages/user/express/express.wxml b/pages/user/express/express.wxml index ec4e481..de1d85e 100644 --- a/pages/user/express/express.wxml +++ b/pages/user/express/express.wxml @@ -1,6 +1,6 @@ - 订单编号 : + 快递单号 : {{delivery.invoice_no}} diff --git a/pages/user/index/filter.wxs b/pages/user/index/filter.wxs index de846ad..855ef50 100644 --- a/pages/user/index/filter.wxs +++ b/pages/user/index/filter.wxs @@ -19,6 +19,7 @@ var is_close = function (name,c_list) { map['幸运大转盘']="17"; map['幸运购']="18"; map['AI测肤']="20"; + map['附近门店']="21"; var index=map[name]; //我的权益要判断5,和11 diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 0f3460c..167e168 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -43,8 +43,8 @@ Page({ actImg: "", is_assistance: 0, //助力活动 ad_img: "", - add_card_data: '', //等级卡的内容 - + add_card_data: '', //等级卡的内容 + getusercode_vailtime:10,//会员二维码时效 hiddenCS: true, }, goto_nav: function (e) { @@ -395,8 +395,13 @@ Page({ th.setData({ sys_switch: t_swi }); var user_tool = []; if (t_swi.usertool) user_tool = JSON.parse(t_swi.usertool); - th.setData({ c_list: user_tool }) - } + th.setData({ c_list: user_tool }); + if (t_swi.usercode_vailtime!=null && parseInt(t_swi.usercode_vailtime)>0) + { + th.setData({ getusercode_vailtime: t_swi.usercode_vailtime }); + } + } + if (parseInt(t_swi.rank_switch) == 2) { var userInfo = th.data.userInfo; if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") { @@ -483,9 +488,10 @@ Page({ //------卡片的显示和关闭-------- show_tc: function () { - if (!this.data.userInfo) return false; + if (!this.data.userInfo) return false; + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') - var val = this.data.userInfo.mobile + "|" + ut.formatTime(); + var val = this.data.userInfo.mobile + "|" + ut.formatTime()+"|"+this.data.getusercode_vailtime; val = "^" + ut.base64_encode(val); qrcode('qrcode', val, 480, 480, this); diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 37f2dde..1c6125d 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -38,9 +38,10 @@ - + + 会员卡 {{udata.Balance?udata.Balance:0}} - 预存款 + 储值款 {{udata.Integral?udata.Integral:0}} 积分 @@ -346,7 +347,7 @@ - 扫一扫上面的二维码图案,即可消费 + 前台收银扫此二维码,即可享受优惠! diff --git a/pages/user/index/index.wxss b/pages/user/index/index.wxss index b4bd0fd..a04870c 100644 --- a/pages/user/index/index.wxss +++ b/pages/user/index/index.wxss @@ -145,16 +145,19 @@ } .xc-qrcode-frame { - border-radius: 10rpx; + /* border-radius: 10rpx; border: 5rpx solid #fe9db5; background: #fe9db5; width: 70rpx; - height: 70rpx; + height: 70rpx; */ top: 70rpx; right: 64rpx; } .xc-qrcode { + border-radius: 10rpx; + border: 5rpx solid #fe9db5; + background: #fe9db5; width: 70rpx; height: 70rpx; } @@ -301,7 +304,7 @@ height: 50rpx; } -.xc-send{ +.xc-send { width: 50rpx; height: 50rpx; } @@ -455,9 +458,11 @@ display: block; height: 1px; width: 100%; - background-color: #999; /*颜色需与主题大背景色一致*/ + background-color: #999; + /*颜色需与主题大背景色一致*/ position: relative; - top: 10px; /*调节线高*/ + top: 10px; + /*调节线高*/ left: 0; } @@ -540,10 +545,10 @@ .modal-body { position: fixed; top: 0; - bottom: 0; + bottom: 0; left: 0; - right: 0; - margin: auto; + right: 0; + margin: auto; z-index: 100; background: #fff; /* margin-left: 73rpx; */ @@ -666,7 +671,8 @@ color: #fff; } -.bg_right.bcolor, .bg_left.bcolor { +.bg_right.bcolor, +.bg_left.bcolor { border-color: #333; } @@ -707,45 +713,47 @@ margin-top: 8rpx; margin-right: 5rpx; } -.banner-img{ + +.banner-img { width: 95%; height: 140rpx; - border-radius: 10px 10px 0px 0px; - margin-bottom: -5rpx; + border-radius: 10px 10px 0px 0px; + margin-bottom: -5rpx; } -.banner-frame{ + +.banner-frame { width: 100%; background: #f2f2f2; } -button::after{ border: 0} +button::after { + border: 0 +} .logo-container { - -webkit-filter: brightness(80%); - filter: brightness(80%); + -webkit-filter: brightness(80%); + filter: brightness(80%); } .logo { - width: 132rpx; - height: 37rpx; - margin-right: 10rpx; + width: 132rpx; + height: 37rpx; + margin-right: 10rpx; } .icon-dingwei { - color: #EA4F2B; - font-size: 28rpx; + color: #EA4F2B; + font-size: 28rpx; } .c-5 { - color: #555; + color: #555; } .action .icon-guan { - left: auto !important; - right: 20rpx !important; -} - - + left: auto !important; + right: 20rpx !important; +} \ No newline at end of file diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index e2030cf..2606abf 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -73,6 +73,7 @@ Page({ userInfo: {}, hasUserInfo: false, canIUseGetUserProfile: false, + getusercode_vailtime:10,//会员二维码时效 }, //通过路径跳转到其他页面 @@ -91,8 +92,12 @@ Page({ rank_switch:sms_conf.rank_switch, is_lable_set: sms_conf.user_label_set, //是不是会员标签设置 guide_title:sms_conf.guide_consultant, //系统参数 导购标题 - guide_change_time:sms_conf.guide_change_time //每月能修改几次 + guide_change_time:sms_conf.guide_change_time, //每月能修改几次 }) + if (sms_conf.usercode_vailtime!=null && parseInt(sms_conf.usercode_vailtime)>0) + { + th.setData({ getusercode_vailtime: sms_conf.usercode_vailtime }); + } if (sms_conf.user_label_set) { th.query_checklabels(); } @@ -858,7 +863,7 @@ Page({ show_tc: function() { if (!getApp().globalData.userInfo) return false; //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') - var val=getApp().globalData.userInfo.mobile+"|"+ut.formatTime(); + var val=getApp().globalData.userInfo.mobile+"|"+ut.formatTime()+"|"+this.data.getusercode_vailtime; val="^"+ut.base64_encode(val); qrcode('qrcode', val, 480, 480, this); diff --git a/pages/user/userinfo/userinfo.wxss b/pages/user/userinfo/userinfo.wxss index dbe1b38..efaf211 100644 --- a/pages/user/userinfo/userinfo.wxss +++ b/pages/user/userinfo/userinfo.wxss @@ -529,7 +529,7 @@ input { /* 门店分类列表 */ .sort_store_list { - height: 82%; + max-height: 700rpx; overflow: hidden; overflow-y: scroll; width: 95%; diff --git a/utils/filter.wxs b/utils/filter.wxs index c5d1959..83c952b 100644 --- a/utils/filter.wxs +++ b/utils/filter.wxs @@ -10,6 +10,13 @@ var filters = { if (!val) return "不限"; return val.replace("00:00:00", ""); }, + gettimestamp: function (date) { + console.log(date); + var timestamp = getDate(date).getTime(); + console.log(timestamp); + timestamp = parseInt(timestamp / 1000) + return timestamp; + }, replace_time2: function (val) { if (val == null || val == undefined || val == '') return ""; @@ -278,5 +285,6 @@ module.exports = { JSONStringify: filters.JSONStringify, count: filters.count, isExpired: filters.isExpired, + gettimestamp: filters.gettimestamp, showStartAndEndDate: filters.showStartAndEndDate, } \ No newline at end of file