Showing
8 changed files
with
217 additions
and
4 deletions
components/2.0/taocan/share.js
0 → 100644
| 1 | +// components/reserve/share/share.js | ||
| 2 | +import util from '../../../utils/util'; | ||
| 3 | +Component({ | ||
| 4 | + /** | ||
| 5 | + * 组件的属性列表 | ||
| 6 | + */ | ||
| 7 | + properties: { | ||
| 8 | + seller_id:String, | ||
| 9 | + hasSellerShare:{ | ||
| 10 | + type:Boolean, | ||
| 11 | + value:false, | ||
| 12 | + }, | ||
| 13 | + seller:{ | ||
| 14 | + type:Object, | ||
| 15 | + value:{}, | ||
| 16 | + }, | ||
| 17 | + }, | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 组件的初始数据 | ||
| 21 | + */ | ||
| 22 | + data: { | ||
| 23 | + hasShow:false, | ||
| 24 | + product:null, | ||
| 25 | + }, | ||
| 26 | + attached: function () { | ||
| 27 | + this.formatProduct() | ||
| 28 | + }, | ||
| 29 | + /** | ||
| 30 | + * 组件的方法列表 | ||
| 31 | + */ | ||
| 32 | + methods: { | ||
| 33 | + show(){ | ||
| 34 | + this.setData({ | ||
| 35 | + hasShow:true, | ||
| 36 | + }) | ||
| 37 | + }, | ||
| 38 | + hide(){ | ||
| 39 | + this.setData({ | ||
| 40 | + hasShow:false, | ||
| 41 | + }) | ||
| 42 | + }, | ||
| 43 | + shareDo(e){ | ||
| 44 | + this.hide() | ||
| 45 | + let act=util.attr(e,'act'); | ||
| 46 | + if(!act) return; | ||
| 47 | + console.log('shareDo.'+act,e); | ||
| 48 | + wx.navigateTo({ | ||
| 49 | + url:util.http_build_query({ | ||
| 50 | + id:this.data.seller_id, | ||
| 51 | + act:act, | ||
| 52 | + hasSellerShare:this.data.hasSellerShare | ||
| 53 | + },'/pages/reserve/share') | ||
| 54 | + }) | ||
| 55 | + }, | ||
| 56 | + formatProduct(){ | ||
| 57 | + let seller=this.data.seller | ||
| 58 | + let product= { | ||
| 59 | + item_code:seller.id+"", | ||
| 60 | + title:seller.sellername, | ||
| 61 | + desc:seller.slogan, | ||
| 62 | + category_list:(seller.cate && seller.cate.length>0)?seller.cate:['餐厅','饭店','餐饮','订包间','周到安排'], | ||
| 63 | + image_list:seller.envi_image, | ||
| 64 | + src_mini_program_path:'/pages/reserve/detail?id='+seller.id+'&from=haowu', | ||
| 65 | + brand_info:{ | ||
| 66 | + name:seller.sellername, | ||
| 67 | + logo:seller.seller_image, | ||
| 68 | + phone:seller.seller_tel, | ||
| 69 | + }, | ||
| 70 | + sku_list:[], | ||
| 71 | + } | ||
| 72 | + this.setData({ | ||
| 73 | + product:product, | ||
| 74 | + }) | ||
| 75 | + }, | ||
| 76 | + } | ||
| 77 | +}) |
components/2.0/taocan/share.json
0 → 100644
components/2.0/taocan/share.wxml
0 → 100644
| 1 | +<!--components/reserve/share/share.wxml--> | ||
| 2 | +<view class="share mask" catchtap="hide" wx:if="{{hasShow}}"> | ||
| 3 | + <view class="share-body" catchtap="catchtap"> | ||
| 4 | + <view class="share-view flex-lr"> | ||
| 5 | + <button class="button-none share-item flex-vc" open-type="share" catchtap="shareDo"> | ||
| 6 | + <image class="share-img wechat"></image> | ||
| 7 | + <view class="share-name">微信</view> | ||
| 8 | + </button> | ||
| 9 | + <view class="share-item flex-vc" catchtap="shareDo" data-act="qrcode"> | ||
| 10 | + <image class="share-img qrcode"></image> | ||
| 11 | + <view class="share-name">二维码</view> | ||
| 12 | + </view> | ||
| 13 | + </view> | ||
| 14 | + <view class="clean" bindtap="hide">取消</view> | ||
| 15 | + </view> | ||
| 16 | + | ||
| 17 | +</view> |
components/2.0/taocan/share.wxss
0 → 100644
| 1 | +/* components/reserve/share/share.wxss */ | ||
| 2 | +@import "../../../app.wxss"; | ||
| 3 | +.share-body{ | ||
| 4 | + height: 260rpx; | ||
| 5 | + width: calc(100% - 100rpx); | ||
| 6 | + padding: 0 50rpx; | ||
| 7 | + position: fixed; | ||
| 8 | + bottom: 0; | ||
| 9 | + | ||
| 10 | + height: 390rpx; | ||
| 11 | + background: #FFFFFF; | ||
| 12 | + border-radius: 40rpx 40rpx 0px 0px; | ||
| 13 | +} | ||
| 14 | +.share-view{ | ||
| 15 | + margin-top: 60rpx; | ||
| 16 | + margin-bottom: 60rpx; | ||
| 17 | +} | ||
| 18 | +.share-img{ | ||
| 19 | + width: 100rpx; | ||
| 20 | + height: 100rpx; | ||
| 21 | + background-size: 100% 100%; | ||
| 22 | +} | ||
| 23 | +.share-img.wechat{ | ||
| 24 | + background-image: url("http://nosqn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004331.png"); | ||
| 25 | +} | ||
| 26 | +.share-img.quanzi{ | ||
| 27 | + background-image: url("http://nosqn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190625100433.png"); | ||
| 28 | +} | ||
| 29 | +.share-img.qrcode{ | ||
| 30 | + background-image: url("http://nosqn.colorcun.com/reserve/share/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201906251004332.png"); | ||
| 31 | +} | ||
| 32 | +.share-img.hwq{ | ||
| 33 | + background-image: url("http://nosqn.colorcun.com/reserve/images/hwq.png"); | ||
| 34 | +} | ||
| 35 | +.share-name{ | ||
| 36 | + margin-top: 20rpx; | ||
| 37 | + height: 40rpx; | ||
| 38 | + font-size: 28rpx; | ||
| 39 | + font-family: PingFangSC-Regular, PingFang SC; | ||
| 40 | + font-weight: 400; | ||
| 41 | + color: #353535; | ||
| 42 | + line-height: 40rpx; | ||
| 43 | +} | ||
| 44 | +.share-item{ | ||
| 45 | + min-width: 50%; | ||
| 46 | + width: 50%; | ||
| 47 | +} | ||
| 48 | +.clean{ | ||
| 49 | + width: 100%; | ||
| 50 | + height: 80rpx; | ||
| 51 | + background: #F5F5F5; | ||
| 52 | + border-radius: 40rpx; | ||
| 53 | + | ||
| 54 | + font-size: 34rpx; | ||
| 55 | + font-family: PingFangSC-Regular, PingFang SC; | ||
| 56 | + font-weight: 400; | ||
| 57 | + color: #666666; | ||
| 58 | + line-height: 80rpx; | ||
| 59 | + | ||
| 60 | + text-align: center; | ||
| 61 | + | ||
| 62 | +} |
| @@ -56,7 +56,15 @@ Page({ | @@ -56,7 +56,15 @@ Page({ | ||
| 56 | * 生命周期函数--监听页面初次渲染完成 | 56 | * 生命周期函数--监听页面初次渲染完成 |
| 57 | */ | 57 | */ |
| 58 | onReady: function () { | 58 | onReady: function () { |
| 59 | - | 59 | + if(wx.getMenuButtonBoundingClientRect){ |
| 60 | + let rect=wx.getMenuButtonBoundingClientRect() | ||
| 61 | + console.log('rect',rect); | ||
| 62 | + this.setData({ | ||
| 63 | + shareTop:rect.top, | ||
| 64 | + shareHeight:rect.height, | ||
| 65 | + shareLeft:rect.left-68, | ||
| 66 | + }) | ||
| 67 | + } | ||
| 60 | }, | 68 | }, |
| 61 | 69 | ||
| 62 | /** | 70 | /** |
| @@ -98,7 +106,17 @@ Page({ | @@ -98,7 +106,17 @@ Page({ | ||
| 98 | * 用户点击右上角分享 | 106 | * 用户点击右上角分享 |
| 99 | */ | 107 | */ |
| 100 | onShareAppMessage: function () { | 108 | onShareAppMessage: function () { |
| 101 | - | 109 | + let pack=this.data.packs[this.activityId] |
| 110 | + let path=util.http_build_query({sid:pack.sid,pid:this.activityId,fromid:getApp().openid},'/pages/taocan/index') | ||
| 111 | + let shareParams={ | ||
| 112 | + title:pack.name||'请客订包间,就上周到安排', | ||
| 113 | + path:path, | ||
| 114 | + } | ||
| 115 | + if(pack.main_url){ | ||
| 116 | + shareParams.imageUrl=pack.main_url+'?imageView2/2/w/450' | ||
| 117 | + } | ||
| 118 | + console.log('shareParams==>',shareParams) | ||
| 119 | + return shareParams | ||
| 102 | }, | 120 | }, |
| 103 | getCurrent(id,packs){ | 121 | getCurrent(id,packs){ |
| 104 | let ps=Object.keys(packs) | 122 | let ps=Object.keys(packs) |
| @@ -178,4 +196,7 @@ Page({ | @@ -178,4 +196,7 @@ Page({ | ||
| 178 | this.createSaleIng=false | 196 | this.createSaleIng=false |
| 179 | }) | 197 | }) |
| 180 | }, | 198 | }, |
| 199 | + share(){ | ||
| 200 | + this.selectComponent('#share').show() | ||
| 201 | + }, | ||
| 181 | }) | 202 | }) |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | "navigationBarBackgroundColor": "#ffffff", | 2 | "navigationBarBackgroundColor": "#ffffff", |
| 3 | "navigationBarTextStyle": "black", | 3 | "navigationBarTextStyle": "black", |
| 4 | "usingComponents": { | 4 | "usingComponents": { |
| 5 | - "nav":"/components/nav/nav" | 5 | + "nav":"/components/nav/nav", |
| 6 | + "share":"/components/2.0/taocan/share" | ||
| 6 | } | 7 | } |
| 7 | } | 8 | } |
| 1 | <!--pages/taocan/index.wxml--> | 1 | <!--pages/taocan/index.wxml--> |
| 2 | <wxs src="../../utils/util.wxs" module="util" /> | 2 | <wxs src="../../utils/util.wxs" module="util" /> |
| 3 | -<nav hasHome>套餐详情</nav> | 3 | +<nav hasHome> |
| 4 | + <view style="top:{{shareTop}}px;height:{{shareHeight}}px;left:{{shareLeft}}px;" | ||
| 5 | + catchtap="share" | ||
| 6 | + class="share view flex align-center justify-center bg-white round"> | ||
| 7 | + <view class="icon view"></view> | ||
| 8 | + <view class="text margin-left-xs">分享</view> | ||
| 9 | + </view> | ||
| 10 | +</nav> | ||
| 4 | <!-- | 11 | <!-- |
| 5 | <swiper | 12 | <swiper |
| 6 | display-multiple-items="3" | 13 | display-multiple-items="3" |
| @@ -124,4 +131,5 @@ | @@ -124,4 +131,5 @@ | ||
| 124 | style="width: 520rpx;height: 348rpx;"></image> | 131 | style="width: 520rpx;height: 348rpx;"></image> |
| 125 | <view class="txt-28-h margin-top-lg">该套餐过期啦</view> | 132 | <view class="txt-28-h margin-top-lg">该套餐过期啦</view> |
| 126 | </view> | 133 | </view> |
| 134 | +<share id="share" seller_id="{{seller.id}}" seller="{{seller}}"></share> | ||
| 127 | 135 |
| @@ -99,4 +99,25 @@ | @@ -99,4 +99,25 @@ | ||
| 99 | background: linear-gradient(90deg, #3BBFF5 0%, #57A0FF 100%); | 99 | background: linear-gradient(90deg, #3BBFF5 0%, #57A0FF 100%); |
| 100 | border-radius: 42rpx; | 100 | border-radius: 42rpx; |
| 101 | 101 | ||
| 102 | +} | ||
| 103 | +.share{ | ||
| 104 | + position: fixed; | ||
| 105 | + width: 63px; | ||
| 106 | + height: 64rpx; | ||
| 107 | + background: rgba(255, 255, 255, 0.6); | ||
| 108 | + border-radius: 32rpx; | ||
| 109 | + border: 1rpx solid rgba(151, 151, 151, 0.2); | ||
| 110 | +} | ||
| 111 | +.share .icon{ | ||
| 112 | + background-image: url("http://nosqn.colorcun.com/taocan/1%20%2828%29.png"); | ||
| 113 | + width: 24rpx; | ||
| 114 | + height: 24rpx; | ||
| 115 | +} | ||
| 116 | +.share .text{ | ||
| 117 | + height: 36rpx; | ||
| 118 | + font-size: 26rpx; | ||
| 119 | + font-family: PingFangSC-Regular, PingFang SC; | ||
| 120 | + font-weight: 400; | ||
| 121 | + color: #333333; | ||
| 122 | + line-height: 36rpx; | ||
| 102 | } | 123 | } |
-
Please register or login to post a comment