| @@ -1,21 +0,0 @@ | |||||
| // pages/index/sw/index.js | |||||
| Component({ | |||||
| /** | |||||
| * 组件的属性列表 | |||||
| */ | |||||
| properties: { | |||||
| paramAtoB: String, | |||||
| data: { | |||||
| value: {}, | |||||
| type: Object | |||||
| }, | |||||
| }, | |||||
| /** | |||||
| * 组件的初始数据 | |||||
| */ | |||||
| data: {}, | |||||
| methods: { | |||||
| } | |||||
| }); | |||||
| @@ -1,6 +0,0 @@ | |||||
| { | |||||
| "component": true, | |||||
| "usingComponents": { | |||||
| "i-button": "../../dist/button/index" | |||||
| } | |||||
| } | |||||
| @@ -1,37 +0,0 @@ | |||||
| <navigator url="/pages/coupon/detail/index?couponChannelId={{data.couponChannelId}}&couponId={{data.couponId}}&title={{data.title}}"> | |||||
| <!-- 首页优惠券列表页面 --> | |||||
| <view class="coupons"> | |||||
| <view class="coupons-img"> | |||||
| <image src="{{data.coverImg}}" mode='aspectFill' lazy-load="true"></image> | |||||
| </view> | |||||
| <view class="coupons-info"> | |||||
| <view class="coupons-info-name tit">{{data.title}}</view> | |||||
| <view class="coupons-info-name subtitle">{{data.subTitle}}</view> | |||||
| <view class="coupons-info-price-p"> | |||||
| <view class='price'> | |||||
| <text>{{data.salePriceStr}}<text style="font-size:24rpx;display:inline-block;margin-right:10rpx;font-weight:400;">元</text></text> | |||||
| <view class="coupons-info-manjian" style="margin-top:10rpx;" wx:if="{{data.type == 1}}"> | |||||
| <view class='view01' wx:if="{{data.unit==0}}">{{data.priceStr}}元</view> | |||||
| <view wx:if="{{data.unit==1}}">{{data.priceStr}}小时</view> | |||||
| <!-- <text class='txt2'>满{{data.usePriceStr}}元可用</text> --> | |||||
| </view> | |||||
| <view class="coupons-info-manjian" wx:elif="{{data.type == 2||data.type == 3||data.type==4||data.type==5}}"> | |||||
| <text class='view01' wx:if="{{data.unit==0}}">{{data.priceStr}}元</text> | |||||
| <text wx:if="{{data.unit==1}}">{{data.priceStr}}小时</text> | |||||
| <!-- <text class='txt2'>仅限本店使用</text> --> | |||||
| </view> | |||||
| </view> | |||||
| <!-- <view class="coupons-info-manjian1" wx:if="{{data.merchantVoList.length==1}}">{{data.merchantVoList[0].merchantName}}</view> | |||||
| <view class="coupons-info-manjian1" wx:if="{{data.merchantVoList.length>1}}">多商户通用</view> --> | |||||
| </view> | |||||
| </view> | |||||
| <view class="coupons-btn"> | |||||
| <!-- 优惠券价格 --> | |||||
| <i-button i-class="coupons-btn-gm" wx:if="{{data.salePriceStr==0&&data.remainInventory!=0}}" data-date='{{data}}'>免费领</i-button> | |||||
| <i-button i-class="coupons-btn-gm" wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0}}" data-date='{{data}}'>马上购</i-button> | |||||
| <i-button i-class="coupons-btn-gms" wx:if="{{data.remainInventory==0}}" data-date='{{data}}'>已售罄</i-button> | |||||
| <i-button i-class="coupons-btn-gms" wx:if="{{data.status==1}}" data-date='{{data}}'>已下架</i-button> | |||||
| </view> | |||||
| <!-- <view class="coupons-info-name sy">剩余{{data.remainInventory}}</view> --> | |||||
| </view> | |||||
| </navigator> | |||||
| @@ -1,259 +0,0 @@ | |||||
| @import "../../app.wxss"; | |||||
| .coupons { | |||||
| width: 335rpx; | |||||
| display: inline-block; | |||||
| position: relative; | |||||
| } | |||||
| .coupons-border { | |||||
| height: 1rpx; | |||||
| left: 30rpx; | |||||
| right: 30rpx; | |||||
| background: #f5f5f5; | |||||
| position: absolute; | |||||
| bottom: 0; | |||||
| } | |||||
| .coupons-img { | |||||
| border-radius: 10rpx; | |||||
| } | |||||
| .coupons-img image { | |||||
| display: block; | |||||
| width: 335rpx; | |||||
| height: 203rpx; | |||||
| border-top-left-radius: 10rpx; | |||||
| border-top-right-radius: 10rpx; | |||||
| } | |||||
| .coupons-info { | |||||
| width: 335rpx; | |||||
| height: 152rpx; | |||||
| border-radius:0rpx 0rpx 10rpx 10rpx; | |||||
| background: #fff; | |||||
| } | |||||
| .coupons-info-name { | |||||
| font-size: 28rpx; | |||||
| color: #333333; | |||||
| letter-spacing: 0; | |||||
| line-height: 38rpx; | |||||
| } | |||||
| .coupons-info-price { | |||||
| padding: 16rpx 0 0; | |||||
| } | |||||
| .i { | |||||
| font-size: 24rpx; | |||||
| font-style: normal; | |||||
| } | |||||
| .coupons-info-price-p { | |||||
| display: block; | |||||
| font-size: 50rpx; | |||||
| color: #FF4949; | |||||
| } | |||||
| .price{ | |||||
| font-size:34rpx; | |||||
| font-family:PingFang-SC-Bold; | |||||
| font-weight:bold; | |||||
| color:rgba(255,50,50,1); | |||||
| line-height:44rpx; | |||||
| margin-left: 16rpx; | |||||
| padding-top: 16rpx; | |||||
| } | |||||
| .tit { | |||||
| overflow: hidden; | |||||
| white-space: nowrap; | |||||
| text-overflow: ellipsis; | |||||
| font-size: 28rpx; | |||||
| line-height: 30rpx; | |||||
| padding-top: 20rpx; | |||||
| padding-left: 10rpx; | |||||
| color: #333; | |||||
| letter-spacing: 0; | |||||
| } | |||||
| .coupons-info-price-o { | |||||
| display: block; | |||||
| text-align: center; | |||||
| font-size: 26rpx; | |||||
| color: #b4b4b4; | |||||
| letter-spacing: 0.96rpx; | |||||
| text-decoration: line-through; | |||||
| line-height: 24rpx; | |||||
| } | |||||
| .coupons-info-distance { | |||||
| font-size: 22rpx; | |||||
| color: #c0c0c0; | |||||
| letter-spacing: 0; | |||||
| padding-bottom: 10rpx; | |||||
| line-height: 30rpx; | |||||
| } | |||||
| .coupons-info-address { | |||||
| font-size: 22rpx; | |||||
| color: #585858; | |||||
| letter-spacing: 0; | |||||
| line-height: 30rpx; | |||||
| } | |||||
| .coupons-btn { | |||||
| position: absolute; | |||||
| bottom: 0; | |||||
| right: 0; | |||||
| } | |||||
| .coupons-btn-gm { | |||||
| background: #AF6E34 !important; | |||||
| border-radius: 10px 0px 5px 0px !important; | |||||
| margin: 0 !important; | |||||
| padding: 0 !important; | |||||
| font-size: 26rpx; | |||||
| color: #fff !important; | |||||
| letter-spacing: 0; | |||||
| height: 51rpx !important; | |||||
| width: 100rpx !important; | |||||
| line-height: 51rpx !important; | |||||
| } | |||||
| .coupons-btn-gms { | |||||
| background: #b9b9b9 !important; | |||||
| border-radius: 10px 0px 10px 0px !important; | |||||
| opacity: 0.6; | |||||
| margin: 0 !important; | |||||
| padding: 0 !important; | |||||
| font-family: PingFangSC-Semibold; | |||||
| font-size: 26rpx; | |||||
| font-weight: 400; | |||||
| color: #fff !important; | |||||
| letter-spacing: 0; | |||||
| height: 51rpx !important; | |||||
| width: 100rpx !important; | |||||
| line-height: 51rpx !important; | |||||
| } | |||||
| .subtitle { | |||||
| font-size: 24rpx; | |||||
| color: #999999; | |||||
| overflow: hidden; | |||||
| height: 24rpx; | |||||
| padding-left: 10rpx; | |||||
| line-height: 24rpx; | |||||
| white-space: nowrap; | |||||
| text-overflow: ellipsis; | |||||
| margin-top: 12rpx; | |||||
| } | |||||
| .coupons-info-manjian { | |||||
| font-weight: normal; | |||||
| font-size: 20rpx; | |||||
| line-height: 34rpx; | |||||
| display: inline-block; | |||||
| color: #FF4949; | |||||
| letter-spacing: 0; | |||||
| } | |||||
| .coupons-info-manjian1 { | |||||
| font-weight: normal; | |||||
| font-size: 20rpx; | |||||
| line-height: 22rpx; | |||||
| color: #919191; | |||||
| letter-spacing: 0; | |||||
| overflow: hidden; | |||||
| white-space: nowrap; | |||||
| text-overflow: ellipsis; | |||||
| width: 300rpx; | |||||
| margin-top: 16rpx; | |||||
| } | |||||
| .coupons-info-manjian text{ | |||||
| display: block; | |||||
| line-height: 20rpx; | |||||
| } | |||||
| .coupons-info-manjian > text:nth-of-type(1){ | |||||
| display: block; | |||||
| /* color: #FF4949; */ | |||||
| opacity: .6; | |||||
| } | |||||
| .view01{ | |||||
| text-decoration:line-through; | |||||
| color: #999999 !important; | |||||
| } | |||||
| .txt2{ | |||||
| display: block; | |||||
| color: #ccc; | |||||
| } | |||||
| /**上拉加载更多**/ | |||||
| .userinfo { | |||||
| display: flex; | |||||
| flex-direction: column; | |||||
| align-items: center; | |||||
| } | |||||
| .userinfo-avatar { | |||||
| width: 128rpx; | |||||
| height: 128rpx; | |||||
| margin: 20rpx; | |||||
| border-radius: 50%; | |||||
| } | |||||
| .userinfo-nickname { | |||||
| color: #aaa; | |||||
| } | |||||
| .sy { | |||||
| display: block; | |||||
| text-align: right; | |||||
| width: 181rpx; | |||||
| font-size: 24rpx; | |||||
| color: #999; | |||||
| height: 40rpx; | |||||
| margin-top: 106rpx; | |||||
| } | |||||
| .usermotto { | |||||
| margin-top: 200px; | |||||
| } | |||||
| scroll-view { | |||||
| width: 100%; | |||||
| } | |||||
| .item { | |||||
| width: 90%; | |||||
| height: 300rpx; | |||||
| margin: 20rpx auto; | |||||
| background: brown; | |||||
| overflow: hidden; | |||||
| } | |||||
| .item .img { | |||||
| width: 430rpx; | |||||
| margin-right: 20rpx; | |||||
| float: left; | |||||
| } | |||||
| .title { | |||||
| font-size: 30rpx; | |||||
| display: block; | |||||
| margin: 30rpx auto; | |||||
| } | |||||
| .description { | |||||
| font-size: 26rpx; | |||||
| line-height: 15rpx; | |||||
| } | |||||
| .navigator-hover{ | |||||
| opacity: 1!important; | |||||
| background: #fff; | |||||
| } | |||||
| navigator{ | |||||
| display: inline-block; | |||||
| } | |||||
| navigator:nth-of-type(2n+1){ | |||||
| margin-right: 10rpx; | |||||
| } | |||||
| @@ -29,7 +29,7 @@ var config = { | |||||
| /** | /** | ||||
| * 商户优惠信息 | * 商户优惠信息 | ||||
| */ | */ | ||||
| merchantCouponList: "/wxCoupon/findByMerchant", | |||||
| listByMerchant: "/wxCouponChannel/listByMerchant", | |||||
| /** | /** | ||||
| * 优惠券详情 | * 优惠券详情 | ||||
| */ | */ | ||||
| @@ -369,6 +369,8 @@ Page({ | |||||
| * 获取用户信息 | * 获取用户信息 | ||||
| */ | */ | ||||
| onLoad(options) { | onLoad(options) { | ||||
| console.log(options) | |||||
| debugger | |||||
| let that = this; | let that = this; | ||||
| wx.showLoading({ | wx.showLoading({ | ||||
| title: "加载中..." | title: "加载中..." | ||||
| @@ -11,39 +11,39 @@ Page({ | |||||
| teljpgUrl: imgurl.teljpg.url, | teljpgUrl: imgurl.teljpg.url, | ||||
| share01: imgurl.share01.url, | share01: imgurl.share01.url, | ||||
| actUrl: imgurl.act.url, | actUrl: imgurl.act.url, | ||||
| poster:'./../../../../assets/images/picture.png', | |||||
| poster: './../../../../assets/images/picture.png', | |||||
| page: 1, | page: 1, | ||||
| imglist:null, | |||||
| shopVoList:[], | |||||
| couponList:[],//活动劵列表 | |||||
| data:{ | |||||
| imglist: null, | |||||
| shopVoList: [], | |||||
| couponList: [], //活动劵列表 | |||||
| data: { | |||||
| currentTab: 0, | currentTab: 0, | ||||
| isshare:false, | |||||
| isshare: false, | |||||
| showpost: false, | showpost: false, | ||||
| imgHeight: 0, | imgHeight: 0, | ||||
| }, | }, | ||||
| id:null, | |||||
| id: null, | |||||
| windowWidth: 0, | windowWidth: 0, | ||||
| windowHeight: 0, | windowHeight: 0, | ||||
| totalHeight: 0, | totalHeight: 0, | ||||
| canvasScale: 1.0,// 画布放大的倍数,因为如果保存的是一倍的分享图片的话,分享图会有点虚。所以保存的时候,canvasScale设置为2.0,wxss 里面的left: 500%;打开注释。就可保存两倍的分享图 | |||||
| canvasScale: 1.0, // 画布放大的倍数,因为如果保存的是一倍的分享图片的话,分享图会有点虚。所以保存的时候,canvasScale设置为2.0,wxss 里面的left: 500%;打开注释。就可保存两倍的分享图 | |||||
| }, | }, | ||||
| /** | |||||
| /** | |||||
| * 分享海报的生成 | * 分享海报的生成 | ||||
| */ | */ | ||||
| //关闭海报 | |||||
| closePoste: function() { | |||||
| this.setData({ | |||||
| showpost: false | |||||
| }) | |||||
| }, | |||||
| //关闭海报 | |||||
| closePoste: function() { | |||||
| this.setData({ | |||||
| showpost: false | |||||
| }) | |||||
| }, | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
| */ | */ | ||||
| onLoad: function (options) { | |||||
| let that=this; | |||||
| if (options && options.id){ | |||||
| onLoad: function(options) { | |||||
| let that = this; | |||||
| if (options && options.id) { | |||||
| this.setData({ | this.setData({ | ||||
| id: options.id | id: options.id | ||||
| }); | }); | ||||
| @@ -54,7 +54,7 @@ Page({ | |||||
| }) | }) | ||||
| } | } | ||||
| // 获取到屏幕的宽高等信息 | // 获取到屏幕的宽高等信息 | ||||
| wx.getSystemInfo({ | |||||
| wx.getSystemInfo({ | |||||
| success: function(res) { | success: function(res) { | ||||
| that.setData({ | that.setData({ | ||||
| windowWidth: res.windowWidth, | windowWidth: res.windowWidth, | ||||
| @@ -70,8 +70,10 @@ Page({ | |||||
| var that = this | var that = this | ||||
| // 适配屏幕 | // 适配屏幕 | ||||
| let scale = this.data.windowWidth / 375.0 | let scale = this.data.windowWidth / 375.0 | ||||
| this.setData({ totalHeight: 767* scale}) | |||||
| this.setData({ | |||||
| totalHeight: 767 * scale | |||||
| }) | |||||
| // 获取Canvas | // 获取Canvas | ||||
| let ctx = wx.createCanvasContext('myCanvas') | let ctx = wx.createCanvasContext('myCanvas') | ||||
| @@ -90,7 +92,7 @@ Page({ | |||||
| wx.getImageInfo({ | wx.getImageInfo({ | ||||
| src: src1, | src: src1, | ||||
| success: function(res) { | success: function(res) { | ||||
| ctx.drawImage(res.path, 0, 0, topImageWidth, topImageHeight) | |||||
| ctx.drawImage(res.path, 0, 0, topImageWidth, topImageHeight) | |||||
| // 覆盖黑色蒙层 | // 覆盖黑色蒙层 | ||||
| ctx.setFillStyle('rgba(0,0,0,0.3)') | ctx.setFillStyle('rgba(0,0,0,0.3)') | ||||
| ctx.fillRect(0, 0, topImageWidth, topImageHeight) | ctx.fillRect(0, 0, topImageWidth, topImageHeight) | ||||
| @@ -98,7 +100,7 @@ Page({ | |||||
| ctx.draw(true) | ctx.draw(true) | ||||
| that.drawOtherContent(ctx, scale) | that.drawOtherContent(ctx, scale) | ||||
| that.drawOtherImage(ctx,scale) | |||||
| that.drawOtherImage(ctx, scale) | |||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| @@ -118,7 +120,7 @@ Page({ | |||||
| // address | // address | ||||
| ctx.setFillStyle('#000'); | ctx.setFillStyle('#000'); | ||||
| ctx.setFontSize(18 * scale); | ctx.setFontSize(18 * scale); | ||||
| this.canvasTextAutoLine("地址:"+this.data.data.shopVoList[0].floorName+this.data.data.shopVoList[0].buildingName+this.data.data.shopVoList[0].shopNumber, ctx, 20 * scale, 270 * scale, 22 * scale, 305 * scale, 1) | |||||
| this.canvasTextAutoLine("地址:" + this.data.data.shopVoList[0].floorName + this.data.data.shopVoList[0].buildingName + this.data.data.shopVoList[0].shopNumber, ctx, 20 * scale, 270 * scale, 22 * scale, 305 * scale, 1) | |||||
| // this.drawNormalText(ctx, '探索新鲜好去处', 82 * scale, 596 * scale, 14 * scale, '#3C3C3C', 'left', 'middle', scale); | // this.drawNormalText(ctx, '探索新鲜好去处', 82 * scale, 596 * scale, 14 * scale, '#3C3C3C', 'left', 'middle', scale); | ||||
| // this.drawNormalText(ctx, '长按右侧小程序码', 82 * scale, 620 * scale, 12 * scale, '#9A9CAC', 'left', 'middle', scale); | // this.drawNormalText(ctx, '长按右侧小程序码', 82 * scale, 620 * scale, 12 * scale, '#9A9CAC', 'left', 'middle', scale); | ||||
| @@ -133,30 +135,30 @@ Page({ | |||||
| let that = this | let that = this | ||||
| // 如果该商户有活动商品 | // 如果该商户有活动商品 | ||||
| if(this.data.couponList.length>0){ | |||||
| let cotentImageWidth = parseInt(136 * scale) | |||||
| let cotentImageHeight = parseInt(136 * scale) | |||||
| for (let i = 0; i < this.data.couponList.length; i++){ | |||||
| let imageItem = this.data.couponList[i].coverImg | |||||
| let src1 = imageItem + `?imageView/2/w/${cotentImageWidth}/h/${cotentImageHeight}` | |||||
| wx.getImageInfo({ | |||||
| src: src1, | |||||
| success: function (res) { | |||||
| ctx.drawImage(res.path, 15 * scale + i*180*scale, 300 * scale, cotentImageWidth, cotentImageHeight) | |||||
| ctx.draw(true) | |||||
| } | |||||
| }) | |||||
| } | |||||
| //没有活动商品生成小程序码 | |||||
| }else{ | |||||
| if(this.data.qrCode){ | |||||
| if (this.data.couponList.length > 0) { | |||||
| let cotentImageWidth = parseInt(136 * scale) | |||||
| let cotentImageHeight = parseInt(136 * scale) | |||||
| for (let i = 0; i < this.data.couponList.length; i++) { | |||||
| let imageItem = this.data.couponList[i].coverImg | |||||
| let src1 = imageItem + `?imageView/2/w/${cotentImageWidth}/h/${cotentImageHeight}` | |||||
| wx.getImageInfo({ | |||||
| src: src1, | |||||
| success: function(res) { | |||||
| ctx.drawImage(res.path, 15 * scale + i * 180 * scale, 300 * scale, cotentImageWidth, cotentImageHeight) | |||||
| ctx.draw(true) | |||||
| } | |||||
| }) | |||||
| } | |||||
| //没有活动商品生成小程序码 | |||||
| } else { | |||||
| if (this.data.qrCode) { | |||||
| let coImageWidth = parseInt(336 * scale) | let coImageWidth = parseInt(336 * scale) | ||||
| let coImageHeight = parseInt(336 * scale) | let coImageHeight = parseInt(336 * scale) | ||||
| let src1 = this.data.qrCode + `?imageView/2/w/${topImageWidth}/h/${topImageHeight}` | let src1 = this.data.qrCode + `?imageView/2/w/${topImageWidth}/h/${topImageHeight}` | ||||
| wx.getImageInfo({ | wx.getImageInfo({ | ||||
| src: src1, | src: src1, | ||||
| success: function(res) { | success: function(res) { | ||||
| ctx.drawImage(res.path, 0, 0, coImageWidth, coImageHeight) | |||||
| ctx.drawImage(res.path, 0, 0, coImageWidth, coImageHeight) | |||||
| ctx.draw(true) | ctx.draw(true) | ||||
| } | } | ||||
| }) | }) | ||||
| @@ -216,24 +218,24 @@ Page({ | |||||
| } | } | ||||
| } | } | ||||
| }, | }, | ||||
| // 保存图片 | |||||
| saveImage() { | |||||
| var _this = this | |||||
| var image = _this.data.poster | |||||
| // 保存图片 | |||||
| saveImage() { | |||||
| var _this = this | |||||
| var image = _this.data.poster | |||||
| wx.getImageInfo({ | wx.getImageInfo({ | ||||
| src: image, | src: image, | ||||
| success: function (sres) { | |||||
| success: function(sres) { | |||||
| var imgSrc = sres.path; | var imgSrc = sres.path; | ||||
| wx.showLoading({ | wx.showLoading({ | ||||
| title: '保存中', | title: '保存中', | ||||
| mask: true | mask: true | ||||
| }) | }) | ||||
| setTimeout(function () { | |||||
| setTimeout(function() { | |||||
| wx.saveImageToPhotosAlbum({ | wx.saveImageToPhotosAlbum({ | ||||
| filePath: imgSrc, | filePath: imgSrc, | ||||
| success: function (data) { | |||||
| success: function(data) { | |||||
| // wx.showToast({ | // wx.showToast({ | ||||
| // title: '保存成功', | // title: '保存成功', | ||||
| // icon: 'success', | // icon: 'success', | ||||
| @@ -245,15 +247,15 @@ Page({ | |||||
| content: '图片保存成功,请到相册查找分享', | content: '图片保存成功,请到相册查找分享', | ||||
| success(res) { | success(res) { | ||||
| if (res.confirm) { | if (res.confirm) { | ||||
| } else if (res.cancel) { | } else if (res.cancel) { | ||||
| } | } | ||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| fail: function (err) { | |||||
| fail: function(err) { | |||||
| // console.log(err); | // console.log(err); | ||||
| if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") { | if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") { | ||||
| console.log("当初用户拒绝,再次发起授权") | console.log("当初用户拒绝,再次发起授权") | ||||
| @@ -275,85 +277,81 @@ Page({ | |||||
| }) | }) | ||||
| wx.hideLoading(); | wx.hideLoading(); | ||||
| }, 2000) | }, 2000) | ||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| /** | |||||
| /** | |||||
| * 获取access_token | * 获取access_token | ||||
| */ | */ | ||||
| getaccess_token:function(access_token){ | |||||
| getaccess_token: function(access_token) { | |||||
| wx.request({ | wx.request({ | ||||
| url:"https://api.weixin.qq.com/wxa/getwxacode?access_token=" + access_token, | |||||
| url: "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + access_token, | |||||
| method: 'POST', | method: 'POST', | ||||
| data: { | data: { | ||||
| path: 'pages/index/index', // 必须是已经发布的小程序存在的页面(否则报错) | |||||
| width: 430, | |||||
| auto_color: false,// 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 | |||||
| line_color: {"r":"0","g":"0","b":"0"} // auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} 十进制表示 | |||||
| path: 'pages/index/index', // 必须是已经发布的小程序存在的页面(否则报错) | |||||
| width: 430, | |||||
| auto_color: false, // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 | |||||
| line_color: { | |||||
| "r": "0", | |||||
| "g": "0", | |||||
| "b": "0" | |||||
| } // auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} 十进制表示 | |||||
| }, | }, | ||||
| success:function(res){ | |||||
| console.log(res); | |||||
| success: function(res) { | |||||
| console.log(res); | |||||
| } | } | ||||
| }) | |||||
| }, | |||||
| /** | |||||
| }) | |||||
| }, | |||||
| /** | |||||
| * 拨打电话 | * 拨打电话 | ||||
| */ | */ | ||||
| phone: function (e) { | |||||
| phone: function(e) { | |||||
| let that = this; | let that = this; | ||||
| wx.makePhoneCall({ | wx.makePhoneCall({ | ||||
| phoneNumber: e.target.dataset.merchantlinkphone | phoneNumber: e.target.dataset.merchantlinkphone | ||||
| }); | }); | ||||
| }, | }, | ||||
| /** | |||||
| /** | |||||
| * 显示分享弹框 | * 显示分享弹框 | ||||
| */ | */ | ||||
| showshare:function(){ | |||||
| showshare: function() { | |||||
| this.setData({ | this.setData({ | ||||
| isshare:true, | |||||
| isshare: true, | |||||
| }) | }) | ||||
| }, | }, | ||||
| /** | |||||
| /** | |||||
| * 隐藏分享弹框 | * 隐藏分享弹框 | ||||
| */ | */ | ||||
| hidemodal:function(){ | |||||
| hidemodal: function() { | |||||
| this.setData({ | this.setData({ | ||||
| isshare: false, | isshare: false, | ||||
| }) | }) | ||||
| }, | }, | ||||
| //滑动切换 | //滑动切换 | ||||
| swiperTabView: function (e) { | |||||
| swiperTabView: function(e) { | |||||
| this.setData({ | this.setData({ | ||||
| currentTab: e.detail.current | currentTab: e.detail.current | ||||
| }); | }); | ||||
| }, | }, | ||||
| /** | |||||
| /** | |||||
| * 隐藏分享海报 | * 隐藏分享海报 | ||||
| */ | */ | ||||
| hideposter:function(){ | |||||
| hideposter: function() { | |||||
| this.setData({ | this.setData({ | ||||
| showpost: false, | showpost: false, | ||||
| }) | }) | ||||
| }, | }, | ||||
| /** | |||||
| /** | |||||
| * 显示分享海报 | * 显示分享海报 | ||||
| */ | */ | ||||
| showPoster:function(){ | |||||
| showPoster: function() { | |||||
| this.setData({ | this.setData({ | ||||
| showpost: true, | showpost: true, | ||||
| }) | }) | ||||
| this.begainDrawShareImage(); | this.begainDrawShareImage(); | ||||
| }, | }, | ||||
| //点击切换 | //点击切换 | ||||
| clickTab: function (e) { | |||||
| clickTab: function(e) { | |||||
| if (this.data.currentTab === e.target.dataset.current) { | if (this.data.currentTab === e.target.dataset.current) { | ||||
| return false; | return false; | ||||
| } else { | } else { | ||||
| @@ -365,24 +363,24 @@ Page({ | |||||
| /** | /** | ||||
| * 获取商户详情 | * 获取商户详情 | ||||
| */ | */ | ||||
| getList: function (id) { | |||||
| getList: function(id) { | |||||
| let that = this; | let that = this; | ||||
| let data; | let data; | ||||
| data = { | |||||
| pageNum: that.data.page, | |||||
| pageSize: 15, | |||||
| id:id | |||||
| } | |||||
| data = { | |||||
| pageNum: that.data.page, | |||||
| pageSize: 15, | |||||
| id: id | |||||
| } | |||||
| Http.get({ | Http.get({ | ||||
| url: config.api.merchantList, | |||||
| data: data | |||||
| }).then(res => { | |||||
| that.setData({ | |||||
| data: res.data.list[0], | |||||
| shopVoList: res.data.list[0].shopVoList, | |||||
| imglist: JSON.parse(res.data.list[0].coverPicture) ? JSON.parse(res.data.list[0].coverPicture) : res.data.list[0].merchantImgUrl, | |||||
| url: config.api.merchantList, | |||||
| data: data | |||||
| }).then(res => { | |||||
| that.setData({ | |||||
| data: res.data.list[0], | |||||
| shopVoList: res.data.list[0].shopVoList, | |||||
| imglist: JSON.parse(res.data.list[0].coverPicture) ? JSON.parse(res.data.list[0].coverPicture) : res.data.list[0].merchantImgUrl, | |||||
| }) | |||||
| }) | }) | ||||
| }) | |||||
| .catch(err => { | .catch(err => { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| title: err.errMsg, | title: err.errMsg, | ||||
| @@ -393,26 +391,26 @@ Page({ | |||||
| }) | }) | ||||
| }, | }, | ||||
| /** | /** | ||||
| * 获取商户活动信息 券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券 100.消费卡) | |||||
| * 投放频道:(1.列表, 2.限时抢购, 3. banner图 4. 游戏 5.卡频道 6.砍价频道 7.拼团频道 8专题) | |||||
| */ | |||||
| getCouponList: function (id) { | |||||
| * 获取商户活动信息 券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券 100.消费卡) | |||||
| * 投放频道:(1.列表, 2.限时抢购, 3. banner图 4. 游戏 5.卡频道 6.砍价频道 7.拼团频道 8专题) | |||||
| */ | |||||
| getCouponList: function(id) { | |||||
| let that = this; | let that = this; | ||||
| let data; | let data; | ||||
| data = { | data = { | ||||
| status:0, | |||||
| merchantId:id, | |||||
| status: 0, | |||||
| merchantId: id, | |||||
| pageNum: that.data.page, | pageNum: that.data.page, | ||||
| pageSize: 15, | pageSize: 15, | ||||
| } | } | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.merchantCouponList, | |||||
| data: data | |||||
| }).then(res => { | |||||
| that.setData({ | |||||
| couponList: res.data.list, | |||||
| url: config.api.listByMerchant, | |||||
| data: data | |||||
| }).then(res => { | |||||
| that.setData({ | |||||
| couponList: res.data.list, | |||||
| }) | |||||
| }) | }) | ||||
| }) | |||||
| .catch(err => { | .catch(err => { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| title: err.errMsg, | title: err.errMsg, | ||||
| @@ -425,41 +423,29 @@ Page({ | |||||
| /** | /** | ||||
| * 获取多商铺列表 | * 获取多商铺列表 | ||||
| */ | */ | ||||
| shopList:function(e){ | |||||
| shopList: function(e) { | |||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url: `/pages/index/merchantList/index?id=${e.currentTarget.dataset.id}` | url: `/pages/index/merchantList/index?id=${e.currentTarget.dataset.id}` | ||||
| }) | }) | ||||
| }, | }, | ||||
| /** | |||||
| * 生命周期函数--监听页面隐藏 | |||||
| */ | |||||
| onHide: function () { | |||||
| }, | |||||
| onShareAppMessage: function (res) { | |||||
| var that = this; | |||||
| var shareObj = { | |||||
| title: that.data.data.title, | |||||
| path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, | |||||
| success: function (res) { | |||||
| if (res.errMsg == 'shareAppMessage:ok') { } | |||||
| }, | |||||
| fail: function (error) { | |||||
| if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } | |||||
| } | |||||
| }; | |||||
| // 来自页面内的按钮的转发 | |||||
| if (res.from === 'button') { | |||||
| var eData = res.target.dataset.id; | |||||
| shareObj.path = `/pages/index/index?couponChannelId=${eData}`; | |||||
| } | |||||
| // 返回shareObj | |||||
| return shareObj; | |||||
| }, | |||||
| /** | |||||
| * 页面相关事件处理函数--监听用户下拉动作 | |||||
| */ | |||||
| onPullDownRefresh: function () { | |||||
| }, | |||||
| // onShareAppMessage: function(res) { | |||||
| // var that = this; | |||||
| // var shareObj = { | |||||
| // title: that.data.data.title, | |||||
| // path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, | |||||
| // success: function(res) { | |||||
| // if (res.errMsg == 'shareAppMessage:ok') {} | |||||
| // }, | |||||
| // fail: function(error) { | |||||
| // if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} | |||||
| // } | |||||
| // }; | |||||
| // // 来自页面内的按钮的转发 | |||||
| // if (res.from === 'button') { | |||||
| // var eData = res.target.dataset.id; | |||||
| // shareObj.path = `/pages/index/index?couponChannelId=${eData}`; | |||||
| // } | |||||
| // // 返回shareObj | |||||
| // return shareObj; | |||||
| // }, | |||||
| }) | }) | ||||
| @@ -4,6 +4,6 @@ | |||||
| "enablePullDownRefresh": true, | "enablePullDownRefresh": true, | ||||
| "usingComponents": { | "usingComponents": { | ||||
| "c-banner": "../../../../components/banner/index", | "c-banner": "../../../../components/banner/index", | ||||
| "c-coupons": "../../../../components/merchantcoupons/index" | |||||
| "c-coupons": "../../../../components/coupons/index" | |||||
| } | } | ||||
| } | } | ||||
| @@ -57,7 +57,6 @@ | |||||
| 商家简介 | 商家简介 | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <!-- <swiper current="{{currentTab}}" duration="300" bindchange="swiperTabView"> --> | |||||
| <view class='swiperactive'> | <view class='swiperactive'> | ||||
| <!-- 商户对应的活动 --> | <!-- 商户对应的活动 --> | ||||
| <view wx:if="{{currentTab==0}}"> | <view wx:if="{{currentTab==0}}"> | ||||
| @@ -78,7 +77,7 @@ | |||||
| <!-- 商户简介 --> | <!-- 商户简介 --> | ||||
| <view wx:elif="{{currentTab==1}}"> | <view wx:elif="{{currentTab==1}}"> | ||||
| <text wx:if="{{data.summary}}">{{data.summary}}</text> | <text wx:if="{{data.summary}}">{{data.summary}}</text> | ||||
| <text wx:else>{{"信息完善中,敬请期待。"}}</text> | |||||
| <text wx:else>信息完善中,敬请期待。</text> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <!-- </swiper> --> | <!-- </swiper> --> | ||||
| @@ -44,12 +44,12 @@ | |||||
| } | } | ||||
| .merchant-detail { | .merchant-detail { | ||||
| width:92%; | |||||
| padding:30rpx 4% 0; | |||||
| background:#fff; | |||||
| border-top-left-radius:20rpx; | |||||
| border-top-right-radius:20rpx; | |||||
| margin-top:-25rpx; | |||||
| width: 92%; | |||||
| padding: 30rpx 4% 0; | |||||
| background: #fff; | |||||
| border-top-left-radius: 20rpx; | |||||
| border-top-right-radius: 20rpx; | |||||
| margin-top: -25rpx; | |||||
| } | } | ||||
| .merchant-brand, .merchant-shop, .merchant-phone { | .merchant-brand, .merchant-shop, .merchant-phone { | ||||
| @@ -95,20 +95,22 @@ | |||||
| color: #333; | color: #333; | ||||
| } | } | ||||
| .merchant-shop view:nth-child(2){ | |||||
| .merchant-shop view:nth-child(2) { | |||||
| font-size: 30rpx; | font-size: 30rpx; | ||||
| } | } | ||||
| .merchant-info { | .merchant-info { | ||||
| display: block!important; | |||||
| display: block !important; | |||||
| color: #999; | color: #999; | ||||
| font-size: 28rpx; | font-size: 28rpx; | ||||
| } | } | ||||
| .merchant-phones{ | |||||
| .merchant-phones { | |||||
| padding: 20rpx 0; | padding: 20rpx 0; | ||||
| display: block; | display: block; | ||||
| font-size: 30rpx; | font-size: 30rpx; | ||||
| } | } | ||||
| .tel { | .tel { | ||||
| right: 0; | right: 0; | ||||
| top: 0; | top: 0; | ||||
| @@ -132,49 +134,59 @@ | |||||
| position: absolute; | position: absolute; | ||||
| right: 10rpx; | right: 10rpx; | ||||
| } | } | ||||
| .merchants text{ | |||||
| .merchants text { | |||||
| display: block; | display: block; | ||||
| text-align: left; | text-align: left; | ||||
| font-size:26rpx; | |||||
| font-size: 26rpx; | |||||
| margin-bottom: 6rpx; | margin-bottom: 6rpx; | ||||
| line-height: 15rpx; | |||||
| } | } | ||||
| .merchants{ | |||||
| display: block!important; | |||||
| .merchants { | |||||
| display: block !important; | |||||
| } | } | ||||
| .merchant-brand{ | |||||
| border: none!important; | |||||
| .merchant-brand { | |||||
| border: none !important; | |||||
| } | } | ||||
| .tabs-item.selected { | .tabs-item.selected { | ||||
| color:rgba(171,149,109,.8); | |||||
| border-bottom:2px solid rgba(171,149,109,.8); | |||||
| color: rgba(171, 149, 109, 0.8); | |||||
| border-bottom: 2px solid rgba(171, 149, 109, 0.8); | |||||
| } | } | ||||
| .tabs-item { | .tabs-item { | ||||
| width:33.3%; | |||||
| color:#C7C7CB; | |||||
| font-size:28rpx; | |||||
| display:flex; | |||||
| align-items:center; | |||||
| justify-content:center; | |||||
| border-bottom:1rpx solid #D0D0D7; | |||||
| } | |||||
| .swiper-tab{ | |||||
| width: 33.3%; | |||||
| color: #c7c7cb; | |||||
| font-size: 28rpx; | |||||
| display: flex; | |||||
| align-items: center; | |||||
| justify-content: center; | |||||
| border-bottom: 1rpx solid #d0d0d7; | |||||
| } | |||||
| .swiper-tab { | |||||
| text-align: left; | text-align: left; | ||||
| width: 100%; | width: 100%; | ||||
| display: flex; | |||||
| flex-flow: row; | |||||
| height: 88rpx; | |||||
| line-height: 88rpx; | |||||
| margin-bottom: 20rpx; | |||||
| display: flex; | |||||
| flex-flow: row; | |||||
| height: 88rpx; | |||||
| line-height: 88rpx; | |||||
| margin-bottom: 40rpx; | |||||
| } | } | ||||
| .swiper-tab-item { | .swiper-tab-item { | ||||
| color: #434343; | |||||
| font-size: 30rpx; | |||||
| margin-right:50rpx; | |||||
| color: #434343; | |||||
| font-size: 30rpx; | |||||
| margin-right: 50rpx; | |||||
| } | } | ||||
| .active-tab { | .active-tab { | ||||
| color: #1693FC; | |||||
| border-bottom: 10rpx solid #1693FC; | |||||
| color: #1693fc; | |||||
| border-bottom: 10rpx solid #1693fc; | |||||
| } | } | ||||
| .fenxiang { | .fenxiang { | ||||
| position: absolute; | position: absolute; | ||||
| right: 0; | right: 0; | ||||
| @@ -188,88 +200,105 @@ | |||||
| top: 0; | top: 0; | ||||
| right: 0; | right: 0; | ||||
| } | } | ||||
| .user-motto { | .user-motto { | ||||
| width:270rpx; | |||||
| border:0; | |||||
| background:none; | |||||
| height:260rpx; | |||||
| color:#fff; | |||||
| position:fixed; | |||||
| width: 270rpx; | |||||
| border: 0; | |||||
| background: none; | |||||
| height: 260rpx; | |||||
| color: #fff; | |||||
| position: fixed; | |||||
| } | } | ||||
| .user-motto::after { | .user-motto::after { | ||||
| border: none; | border: none; | ||||
| } | } | ||||
| /* 商户活动列表 */ | /* 商户活动列表 */ | ||||
| .coupons c-coupons{ | |||||
| .coupons c-coupons { | |||||
| width: 335rpx; | width: 335rpx; | ||||
| height: 354rpx; | height: 354rpx; | ||||
| margin-bottom: 22rpx; | margin-bottom: 22rpx; | ||||
| } | } | ||||
| .coupons c-coupons:nth-of-type(2n+1){ | |||||
| .coupons c-coupons:nth-of-type(2n+1) { | |||||
| float: left; | float: left; | ||||
| } | } | ||||
| .coupons c-coupons:nth-of-type(2n){ | |||||
| .coupons c-coupons:nth-of-type(2n) { | |||||
| float: right; | float: right; | ||||
| } | } | ||||
| .loading image { | .loading image { | ||||
| width: 60rpx; | width: 60rpx; | ||||
| height: 60rpx; | height: 60rpx; | ||||
| vertical-align: middle; | vertical-align: middle; | ||||
| margin-right: 10rpx; | margin-right: 10rpx; | ||||
| } | } | ||||
| .dingdan text{ | |||||
| .dingdan text { | |||||
| display: block; | display: block; | ||||
| text-align: center; | text-align: center; | ||||
| color: #999; | |||||
| } | } | ||||
| .swiperactive{ | |||||
| .swiperactive { | |||||
| min-height: 300rpx; | min-height: 300rpx; | ||||
| margin-bottom:20rpx; | |||||
| margin-bottom: 20rpx; | |||||
| } | } | ||||
| /* modal */ | /* modal */ | ||||
| .modal{ | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| position: fixed; | |||||
| top: 0; | |||||
| left: 0; | |||||
| background: rgba(0,0,0,0.5); | |||||
| overflow: hidden; | |||||
| z-index: 10; | |||||
| color: #fff; | |||||
| } | |||||
| .modal-content{ | |||||
| width: 540rpx; | |||||
| height: 260rpx; | |||||
| line-height: 60rpx; | |||||
| overflow: hidden; | |||||
| position: fixed; | |||||
| top: 50%; | |||||
| left: 0; | |||||
| z-index: 11; | |||||
| background: #f9f9f9; | |||||
| margin: -130rpx 105rpx; | |||||
| border-radius: 36rpx; | |||||
| display: flex; | |||||
| } | |||||
| .modal-content view{ | |||||
| .modal { | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| position: fixed; | |||||
| top: 0; | |||||
| left: 0; | |||||
| background: rgba(0, 0, 0, 0.5); | |||||
| overflow: hidden; | |||||
| z-index: 10; | |||||
| color: #fff; | |||||
| } | |||||
| .modal-content { | |||||
| width: 540rpx; | |||||
| height: 260rpx; | |||||
| line-height: 60rpx; | |||||
| overflow: hidden; | |||||
| position: fixed; | |||||
| top: 50%; | |||||
| left: 0; | |||||
| z-index: 11; | |||||
| background: #f9f9f9; | |||||
| margin: -130rpx 105rpx; | |||||
| border-radius: 36rpx; | |||||
| display: flex; | |||||
| } | |||||
| .modal-content view { | |||||
| display: inline-block; | display: inline-block; | ||||
| flex: 1; | flex: 1; | ||||
| text-align: center; | text-align: center; | ||||
| } | } | ||||
| .modal-content view>text{ | |||||
| color: #000; | |||||
| display: block; | |||||
| height: 80rpx; | |||||
| line-height: 80rpx; | |||||
| .modal-content view>text { | |||||
| color: #000; | |||||
| display: block; | |||||
| height: 80rpx; | |||||
| line-height: 80rpx; | |||||
| } | } | ||||
| .modal-content view>image{ | |||||
| .modal-content view>image { | |||||
| margin-top: 30rpx; | margin-top: 30rpx; | ||||
| width: 100rpx; | width: 100rpx; | ||||
| height: 100rpx; | height: 100rpx; | ||||
| } | } | ||||
| /*分享海报样式*/ | /*分享海报样式*/ | ||||
| .canvas-content{ | |||||
| .canvas-content { | |||||
| display: flex; | display: flex; | ||||
| top: 0; | top: 0; | ||||
| left: 0; | left: 0; | ||||
| @@ -294,15 +323,23 @@ position:fixed; | |||||
| width: 36rpx; | width: 36rpx; | ||||
| height: 36rpx; | height: 36rpx; | ||||
| } | } | ||||
| /*分享海报蒙层*/ | /*分享海报蒙层*/ | ||||
| .postermodal{ | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| position: fixed; | |||||
| top: 0; | |||||
| left: 0; | |||||
| background: rgba(0,0,0,0.5); | |||||
| overflow: hidden; | |||||
| z-index: 50; | |||||
| color: #fff; | |||||
| } | |||||
| .postermodal { | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| position: fixed; | |||||
| top: 0; | |||||
| left: 0; | |||||
| background: rgba(0, 0, 0, 0.5); | |||||
| overflow: hidden; | |||||
| z-index: 50; | |||||
| color: #fff; | |||||
| } | |||||
| .dingdan image { | |||||
| display: block; | |||||
| width: 300rpx; | |||||
| margin: 30rpx auto 0; | |||||
| } | |||||