diff --git a/app.js b/app.js index 53c2aa5..b5d0901 100644 --- a/app.js +++ b/app.js @@ -17,6 +17,14 @@ App({ this.globalData.uuid = res.data.uuid; wx.setStorageSync('uuid', res.data.uuid) }) + // 获取前端配置文件 + commonApi._post("pbservice/Other/getClientConfig", { + unique_key: "wechatxcx" + }).then(res => { + let data = JSON.parse(res.data); + data.isTest = data.isTest3; + this.globalData.configJson = data + }) // 获取用户信息 @@ -175,7 +183,7 @@ App({ 'OFFLINE_WAIT':'线下退款处理中' }, codeState:['未使用','已使用','已失效','已取消'], - weburl:"https://wechat.b2c.zj-trip.net", + weburl:"", pay_methods:{ NONE:"无需支付", WEIXIN:"微信支付", @@ -185,6 +193,8 @@ App({ kjId:null, gp_id:null, team_id:null, - retailId:"" + retailId:"", + configJson:null, + prizeId:null } }) \ No newline at end of file diff --git a/app.json b/app.json index 3d43ed5..6b58555 100644 --- a/app.json +++ b/app.json @@ -48,6 +48,7 @@ "pages/user/retail/list/index", "pages/user/retail/order/index", "pages/user/coupon/index", + "pages/user/videoCoupon/index", "pages/user/verify/index", "pages/user/cartlist/list", "pages/user/couponCenter/index", diff --git a/app.wxss b/app.wxss index ae93720..4f55e40 100644 --- a/app.wxss +++ b/app.wxss @@ -31,7 +31,7 @@ page{ position: relative; z-index: 1; width: 80%; - max-height: 60%; + max-height: 100%; background: white; border-radius: 12rpx; overflow-y: auto; diff --git a/pages/group/info/index.js b/pages/group/info/index.js index 5d13c44..111e365 100644 --- a/pages/group/info/index.js +++ b/pages/group/info/index.js @@ -2,6 +2,9 @@ import commonApi from "../../../utils/https/common"; let timer = null,app = getApp(),timer2=null; import util from "../../../utils/util" +import QRCode from '../../../utils/weapp-qrcode.js' +let device = wx.getSystemInfoSync(); +const ratio = device.screenWidth / 750; Page({ /** @@ -14,6 +17,7 @@ Page({ id:null, isFollow:true, showRuleFlag:false, + showShareFlag:false, isOn:false, myIngList:{} }, @@ -25,48 +29,61 @@ Page({ this.setData({ id:options.id }) + // 获取推荐列表 + commonApi.user_post('activity.groups/get_recommend?id='+options.id,{ + id:options.id + }).then(res=>{ + this.setData({ + hot:res.data.data + }) + }) commonApi.user_post('activity.groups/detail?id='+options.id+'&team_id='+options.team_id,{ id:options.id, team_id:options.team_id }).then(res=>{ this.setData({ - info:res.data.detail, - hot:res.data.hotProductList + info:res.data.detail }) - if(res.data.self_team.status==-1){ - this.setData({ - isOn:false - }) - commonApi.user_post("activity.groups/get_teams?limit=100&id="+options.id,{ - id:options.id, - limit:10 - }).then(res=>{ + commonApi.user_post('activity.groups/is_join?id='+options.id,{ + id:options.id, + }).then(r=>{ + if(r.data.length>0 && r.data[0].status==1){ + // 已经参与这个团购 this.setData({ - list:res.data.data + isOn:true, + myIngList:res.data.self_team }) - this.setListTime(); - }) - } - else { - this.setData({ - isOn:true, - myIngList:res.data.self_team - }) - this.setTime(); - } + this.setTime(); + this.drawImg() + } + else { + this.setData({ + isOn:false + }) + commonApi.user_post("activity.groups/get_teams?limit=100&id="+options.id,{ + id:options.id, + limit:10 + }).then(res=>{ + this.setData({ + list:res.data.data + }) + this.setListTime(); + }) + } + }) }) }, // 我的团购结束倒计时 setTime:function(){ - let myIngList = this.data.myIngList,time = myIngList.team_list[0].over_time; - if(myIngList.isOver){ + let myIngList = this.data.myIngList; + if(myIngList.isOver || !myIngList.team_list || !myIngList.team_list[0]){ if(timer2){ clearTimeout(timer2); timer2 = null; } return; } - let overTime = new Date(time.replace(/-/g,'/')).getTime(),now = new Date().getTime(); + let time = myIngList.team_list[0].over_time,overTime = new Date(time.replace(/-/g,'/')).getTime(),now = new Date().getTime(); if(overTime<=now){ myIngList.isOver=true; } @@ -95,6 +112,14 @@ Page({ this.setTime() },1000) }, + // 去详情 + gotoInfo(){ + util.gotoDetail({ + type:this.data.info.type, + id:this.data.info.goods_id, + scene_id:this.data.info.scene_id + }) + }, // 列表倒计时 setListTime:function(){ let list = this.data.list,now = new Date(); @@ -126,7 +151,7 @@ Page({ clearTimeout(timer); timer = null; wx.redirectTo({ - url: '/pages/info/groupInfo/index?id='+e.currentTarget.dataset.id + url: '/pages/group/info/index?id='+e.currentTarget.dataset.id }) }, // 发起团购 @@ -138,6 +163,7 @@ Page({ item.maxNum = this.data.info.purchase_quantity; }) app.globalData.gp_id = this.data.info.id; + console.log(this.data.info) if(this.data.info.type=='post'){ app.globalData.postProduct = product; wx.navigateTo({ @@ -150,6 +176,12 @@ Page({ url: '/pages/order/scene/index', }) } + else if(this.data.info.type=="venue"){ + app.globalData.product = product[0]; + wx.navigateTo({ + url: '/pages/order/scene/index?type=museum', + }) + } }) }, // 加入拼团 @@ -234,6 +266,249 @@ Page({ }) } }, + // 分享 + share:function(){ + if(!this.data.shareImg){ + wx.showToast({ + title: '图片生成中,稍后再试', + icon:'none' + }) + return; + } + this.setData({ + showShareFlag:!this.data.showShareFlag + }) + }, + // 保存 + save(){ + let url = this.data.shareImg,that = this; + wx.authorize({ + /* 这个就是保存相册的 */ + scope: 'scope.writePhotosAlbum', + success() { + wx.saveImageToPhotosAlbum({ + filePath:url, + success(res) { + wx.showToast({ + title: '保存成功', + icon:"success" + }) + that.setData({ + showShareFlag:!this.data.showShareFlag + }) + }, + fail(res){ + wx.showToast({ + title: '保存失败', + icon:'none' + }) + } + }) + }, + complete(res) { + console.log(res); + /* 这里判断一下如果没有授权重新打开设置选项 */ + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.writePhotosAlbum']) { + /* 打开设置的方法 */ + // opensit(); + wx.showToast({ + title: '请打开权限后再试', + icon:'none' + }) + } + } + }); + } + }); + + }, + // 绘制海报 + drawImg:function(){ + if(!this.data.myIngList || !this.data.myIngList.team_list || !this.data.myIngList.team_list[0]){ + return; + } + var that = this,userinfo = wx.getStorageSync('jstrip_userInfo'); + const ctx = wx.createCanvasContext('imageCanvas'); + // const device = wx.getSystemInfoSync(); + // const ratio = device.screenWidth / 750; + + // 先获取到图片信息 + let promise2 = new Promise(function(resolve,reject){ + wx.getImageInfo({ + src:that.data.info.headimg, + success:function(res){ + resolve(res); + }, + fail:function(res){ + reject(res); + } + }) + }) + let promise3 = new Promise(function(resolve,reject){ + let userid = wx.getStorageSync('jstrip_userid') + new QRCode('myQrcode',{ + text: 'https://m.cloud.sz-trip.com/GroupDetailFriends?id='+that.data.info.id+'&sharedUserId='+userid+'&channel=-1&team_id='+that.data.myIngList.team_list[0].team_id, + width: 500, + height: 500, + padding: 12, // 生成二维码四周自动留边宽度,不传入默认为0 + correctLevel: QRCode.CorrectLevel.L, // 二维码可辨识度 + callback: (res) => { + resolve(res); + } + }) + }) + //成功得到图片信息后,开始绘图 + Promise.all([promise2,promise3]).then(imgs=>{ + ctx.save(); + ctx.beginPath(); //开始绘制 + that.handleBorderRect(ctx,0,0,551 * ratio,407 * ratio,25 * ratio,'#ccc') + ctx.clip();//画好了圆 剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内 这也是我们要save上下文的原因 + ctx.drawImage(imgs[0].path, 0, 0,551 * ratio,407 * ratio); + console.log(407 * ratio) + ctx.restore(); + ctx.save(); + that.handleBorderRect2(ctx,0,407 * ratio,551 * ratio,236*ratio,25 * ratio,'#fff') + ctx.restore(); + // 绘制二维码 + ctx.drawImage(imgs[1].path, 373 * ratio, 495 * ratio,137 * ratio, 137 * ratio); + // 开始文字绘制 + ctx.setFillStyle("#000"); + ctx.setFontSize(30 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + that.drawText(ctx,that.data.info.title+that.data.info.sku_name, 25*ratio, 450*ratio,480 * ratio,ratio); + // 售价 + ctx.setFillStyle("#D62828"); + ctx.setFontSize(40 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + let price = "¥"+(that.data.info.event_price/100); + let width = ctx.measureText(price).width; + ctx.fillText(price, 25*ratio, 620*ratio); + // 副标题 + ctx.setFillStyle("#999999"); + ctx.setFontSize(28 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + let subtitle = that.data.info.gp_num+'人团'; + ctx.fillText(subtitle, 25*ratio, 540*ratio); + // ctx.draw(); + // 划线价 + ctx.setFillStyle("#999999"); + ctx.setFontSize(32 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + let market_price = "¥"+(that.data.info.price/100) + ctx.fillText(market_price, 40*ratio + width, 620*ratio); + let market_price_width = ctx.measureText(market_price).width; + // 划线 + ctx.beginPath() + ctx.setLineWidth(1) + ctx.moveTo(40*ratio + width, 608*ratio) + ctx.lineTo(45*ratio + width + market_price_width, 608*ratio) + ctx.stroke(); + // 长按识别二维码 + // ctx.setFillStyle("#666"); + // ctx.setFontSize(22 * ratio); //字大小 + // ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + // ctx.fillText("长按识别二维码", 404*ratio, 710*ratio); + // 长按图片转发或保存 + // ctx.setFillStyle("#000"); + // ctx.setFontSize(24 * ratio); //字大小 + // ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + // ctx.fillText("长按图片保存到本地",(592*ratio - ctx.measureText("长按图片保存到本地").width)/2, 740*ratio); + ctx.draw(); + // 转为图片 + setTimeout(()=>{ + wx.canvasToTempFilePath({ + x: 0, + y: 0, + canvasId: 'imageCanvas', + success: function (res) { + that.setData({ + shareImg:res.tempFilePath + }) + }, + fail(err){ + console.log('agdgjgdajhg',err) + } + }) + },500) + return false; + }).catch(err=>{ + console.log("this err",err) + }) + }, + // 圆角矩形 + handleBorderRect(ctx, x, y, w, h, r, color){ + ctx.beginPath(); + ctx.moveTo(x+w,y+h); + ctx.lineTo(x,y+h) + // 左上角 + ctx.arc(x + r, y + r, r, Math.PI, 1.5 * Math.PI); + ctx.moveTo(x + r, y); + ctx.lineTo(x + w - r, y); + ctx.lineTo(x + w, y + r); + // 右上角 + ctx.arc(x + w - r, y + r, r, 1.5 * Math.PI, 2 * Math.PI); + ctx.lineTo(x + w, y + h ); + ctx.lineTo(x + w - r, y + h); + ctx.fillStyle = color; + ctx.fill(); + ctx.closePath(); + }, + handleBorderRect2(ctx, x, y, w, h, r, color){ + ctx.beginPath(); + ctx.moveTo(x,y); + ctx.lineTo(x+w,y) + // 右下角 + ctx.arc(x + w - r, y + h - r, r, 0, 0.5 * Math.PI); + ctx.lineTo(x + r, y + h); + ctx.lineTo(x, y + h - r); + // 左下角 + ctx.arc(x + r, y + h - r, r, 0.5 * Math.PI, Math.PI); + ctx.lineTo(x, y); + ctx.lineTo(x, y); + ctx.fillStyle = color; + ctx.fill(); + ctx.closePath(); + }, + // 绘制两行文字 + drawText: function(ctx, str, x, y, canvasWidth,ratio) { + let row = [],temp="",chr=str.split(""); + for (var a = 0; a < chr.length; a++) { + if (ctx.measureText(temp).width < canvasWidth) { + temp += chr[a]; + } + else { + a--; //这里添加了a-- 是为了防止字符丢失,效果图中有对比 + row.push(temp); + temp = ""; + } + } + row.push(temp); + + //如果数组长度大于2 则截取前两个 + if (row.length > 2) { + var rowCut = row.slice(0, 2); + var rowPart = rowCut[1]; + var test = ""; + var empty = []; + for (var a = 0; a < rowPart.length; a++) { + if (ctx.measureText(test).width < canvasWidth - 30 * ratio) { + test += rowPart[a]; + } + else { + break; + } + } + empty.push(test); + var group = empty[0] + "..."//这里只显示两行,超出的用...表示 + rowCut.splice(1, 1, group); + row = rowCut; + } + for (var b = 0; b < row.length; b++) { + ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth); + } + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -294,7 +569,7 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage: function (e) { - if(e.from=='button' || this.data.myIngList.status==1){ + if(e.from=='button' || this.data.isOn){ return { title: "我正在发起团购,快来参加吧", // 默认是小程序的名称(可以写slogan等) path: "/pages/group/info/index?id="+this.data.info.id+'&team_id='+this.data.myIngList.team_list[0].team_id, // 默认是当前页面,必须是以‘/’开头的完整路径 diff --git a/pages/group/info/index.wxml b/pages/group/info/index.wxml index 954ac6a..4034a78 100644 --- a/pages/group/info/index.wxml +++ b/pages/group/info/index.wxml @@ -14,7 +14,7 @@ ¥{{info.price/100}} - 详情 > + 详情 > @@ -31,10 +31,10 @@ - + - + @@ -68,10 +68,10 @@ 拼团规则 - + {{item.nickname}} - 还差{{info.gp_num - item.team_num}} + 还差{{item.team_num}} 参团 剩余{{item.h}}:{{item.m}}:{{item.s}} @@ -88,28 +88,45 @@ - + - {{item.productName+item.skuName}} + {{item.title+item.sku_name}} - ¥{{item.eventPrice/100}} + ¥{{item.event_price/100}} ¥{{item.price/100}} - - - - 请先关注公众号 - - 长按保存二维码 - - + + + + + + + + + \ No newline at end of file diff --git a/pages/group/info/index.wxss b/pages/group/info/index.wxss index d445fdf..81bcc5e 100644 --- a/pages/group/info/index.wxss +++ b/pages/group/info/index.wxss @@ -326,4 +326,67 @@ button { font-size: 20rpx; line-height: 30rpx; color: #666; +} +.share-img-box { + /* width: 551rpx; */ + position: static; + background: none; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} +.share-img { + display: block; + width: 551rpx; +} +.share-tips { + width: 426rpx; + height: 150rpx; + background: #FFFFFF; + border-radius: 25rpx; + margin-top: 25rpx; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 65rpx; + color: #999; + font-size: 24rpx; + text-align: center; + line-height: 40rpx; +} +.share-tips .img { + display: block; + width: 55rpx; + margin: 0 auto; + margin-bottom: 4rpx; +} +.tipimg { + position: absolute; + left: 50%; + margin-left: 16rpx; + width: 24rpx; + height: 24rpx; + background: #D62828; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + top: 34rpx; +} +.tipimg image { + width: 21rpx; + display: block; + +} +.save-btn { + width: 403rpx; + line-height: 77rpx; + background: #D62828; + border-radius: 39rpx; + text-align: center; + color: #fff; + font-size: 31rpx; + font-weight: 500; + margin-top: 50rpx; } \ No newline at end of file diff --git a/pages/group/mine/index.js b/pages/group/mine/index.js index 55fb607..ee4832c 100644 --- a/pages/group/mine/index.js +++ b/pages/group/mine/index.js @@ -1,6 +1,7 @@ // pages/user/pdd/index.js import productApi from "../../../utils/https/common"; let timer = null,app = getApp(); +import util from "../../../utils/util" Page({ /** @@ -149,18 +150,32 @@ Page({ }) }, goOrder:function(e){ - wx.navigateTo({ - url: '/pages/info/orderInfo/index?id='+e.currentTarget.dataset.item.gpChildOrderNo, - }) + let item = e.currentTarget.dataset.item,info = { + order_id:item.order_id, + order_product_list:[{ + product_model:item.type + }] + } + util.gotoOrder(info) + // wx.navigateTo({ + // url: '/pages/info/orderInfo/index?id='+.gpChildOrderNo, + // }) }, refund(e){ + let that = this; wx.showModal({ title:"提示", content:"确定申请退款吗?", success:function(res){ if(res.confirm){ // todo - productApi.user_post({}) + productApi.user_post('order/refund',{ + order_id:e.currentTarget.dataset.item.order_id + }).then(res=>{ + if(res && res.code==1){ + that.getList() + } + }) } } }) diff --git a/pages/group/mine/index.wxml b/pages/group/mine/index.wxml index f1655b3..75c35f7 100644 --- a/pages/group/mine/index.wxml +++ b/pages/group/mine/index.wxml @@ -27,9 +27,9 @@ 查看订单 - + 我参与的 diff --git a/pages/index/index.js b/pages/index/index.js index 90a8330..f7ca8a1 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -27,7 +27,9 @@ Page({ lat:"", lon:"", urltopage:{}, - scrollLeft:0 + scrollLeft:0, + videoPrize:false, + prizeInfo:null }, onLoad: function (options) { if(options.from){ @@ -48,22 +50,12 @@ Page({ this.getList() } }) - this.setData({ height:height, padHeight:systemInfo.statusBarHeight, right:(systemInfo.screenWidth - rect.right) + rect.width }) - commonApi._post("pbservice/Other/getClientConfig",{ - unique_key:"wechatxcx" - }).then(res=>{ - let data = JSON.parse(res.data) - this.setData({ - indexHot:data.indexHot, - isTest:data.isTest - }) - this.getFourProduct() - }) + commonApi._post("pbservice/Other/getClientConfig",{ unique_key:"urltopage" }).then(res=>{ @@ -81,7 +73,7 @@ Page({ month:(this.data.months[today.getMonth()]).toUpperCase(), date:today.getDate() }) - + this.getVideoPrize() }, onTabItemTap:function(e){ console.log(e,99999999) @@ -460,11 +452,64 @@ Page({ }, // 监听文旅查询的scroll listenScroll(e){ - console.log(e) this.setData({ scrollLeft:e.detail.scrollLeft }) }, + // 获取短视频大赛是否中奖 中奖详情 + getVideoPrize(){ + let user_id = wx.getStorageSync('jstrip_userid'); + if(!user_id || wx.getStorageSync('indexPriceNoTip')) return; + commonApi.user_post('actonline/video_act/getRaffle',{ + act_id:5 + }).then(res=>{ + this.setData({ + videoPrize:res.data + }) + }) + }, + noMoreTip(){ + wx.setStorageSync('indexPriceNoTip', true) + this.closePrice() + }, + closePrice(){ + this.setData({ + videoPrize:false, + prizeInfo:null + }) + }, + // 抽奖 + choosePrize(){ + commonApi.user_post('actonline/video_act/luckyDraw',{ + act_id:5 + }).then(res=>{ + this.setData({ + prizeInfo:res.data + }) + if(res.data.type!='none'){ + // 抽奖成功的话 弹框 + wx.showModal({ + title:"提示", + content:"中奖人员请联系君到苏州客服,领奖方式以客服通知为准", + showCancel:false + }) + } + }) + }, + onReady:function(){ + if(app.globalData.configJson){ + this.setData({ + indexHot:app.globalData.configJson.indexHot, + isTest:app.globalData.configJson.isTest + }) + this.getFourProduct() + } + else { + setTimeout(()=>{ + this.onReady() + },300) + } + }, /** * 用户点击右上角分享 diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 3f3323c..2efa244 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -104,8 +104,8 @@ - 带你轻松 - 玩转苏州 + 四季苏州 + 最是江南 ¥{{roadProduct.price?roadProduct.price/100:0}}起 @@ -331,4 +331,54 @@ 查看更多 暂无更多推荐 + + + + + + + + + {{prizeInfo.prize_name}} + + + + + + + + + + {{prizeInfo.prize_name}} + + + + + + + + + + 您与奖品擦肩而过期待下次参与 + + + + + + 我知道了 + + + + + + + + + \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss index b601d1c..278e5bc 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -487,4 +487,100 @@ height: 6rpx; border-radius: 3rpx; background: #0B898E; +} +.nomore-tip-btn { + position: absolute; + left: 0; + right: 0; + height: 78rpx; + bottom: 0; +} +.prize-tip-text { + width: 267rpx; + display: block; + top: 39rpx; + left: 134rpx; + position: absolute; +} +.prize-name { + position: absolute; + text-align: center; + left: 132rpx; + right: 132rpx; + top: 169rpx; + font-size: 31rpx; + color: #333333; +} +.prize-img { + width: 333rpx; + height: 240rpx; + border-radius: 13rpx; + overflow: hidden; + position: absolute; + left: 100rpx; + display: flex; + align-items: center; + justify-content: center; + top: 269rpx; +} +.prize-img image { + display: block; + width: 333rpx; + height: 240rpx; +} +.btn-box { + position: absolute; + width: 400rpx; + height: 87rpx; + left: 67rpx; + bottom: 78rpx; + text-align: center; + line-height: 87rpx; +} +.btn-box image { + display: block; + width: 100%; +} +.btn-box navigator,.btn-box view { + color: #fff; + font-size: 35rpx; + font-weight: bold; + position: absolute; + left: 0; + top: 0; + z-index: 1; + right: 0; +} +.prize-coupon { + width: 293rpx; + height: 227rpx; + position: absolute; + top: 274rpx; + left: 120rpx; + color: #fff; + font-size: 24rpx; + text-align: center; +} +.prize-coupon image { + display: block; + width: 100%; +} +.prize-coupon-money { + position: absolute; + left: 0; + right: 0; + font-size: 80rpx; + font-weight: bold; + line-height: 110rpx; + top: 12rpx; +} +.prize-coupon-money::before{ + content: "¥"; + font-size: 32rpx; +} +.prize-coupon-tip { + position: absolute; + left: 0; + right: 0; + top: 120rpx; } \ No newline at end of file diff --git a/pages/info/hotelProductInfo/index.js b/pages/info/hotelProductInfo/index.js index 3ce384a..eb4c6eb 100644 --- a/pages/info/hotelProductInfo/index.js +++ b/pages/info/hotelProductInfo/index.js @@ -52,14 +52,7 @@ Page({ retailId: options.retailId }) } - commonApi._post("pbservice/Other/getClientConfig", { - unique_key: "wechatxcx" - }).then(res => { - let data = JSON.parse(res.data); - this.setData({ - isTest: data.isTest - }) - }) + // 先初始化日期 let today = new Date(), tomorrow = new Date(today.getTime() + 24 * 60 * 60 * 1000); this.setData({ @@ -574,7 +567,16 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { - + if(app.globalData.configJson){ + this.setData({ + isTest: app.globalData.configJson.isTest + }) + } + else { + setTimeout(()=>{ + this.onReady() + },300) + } }, /** diff --git a/pages/info/museumInfo/index.js b/pages/info/museumInfo/index.js index 6d78047..058e55f 100644 --- a/pages/info/museumInfo/index.js +++ b/pages/info/museumInfo/index.js @@ -410,7 +410,7 @@ Page({ infoDate: this.data.date, infoTime: this.data.time, isGroup: this.data.isGroup, - isTeam: this.data.info.team_order + isTeam: this.data.info.team_order && this.data.isGroup?1:0 } wx.navigateTo({ url: '/pages/order/scene/index?type=museum' diff --git a/pages/info/museumInfo/index.wxml b/pages/info/museumInfo/index.wxml index cf42bbb..0d276e0 100644 --- a/pages/info/museumInfo/index.wxml +++ b/pages/info/museumInfo/index.wxml @@ -30,7 +30,7 @@ - 预订须知 diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js index 0efb176..76e5ca5 100644 --- a/pages/info/sceneProductInfo/index.js +++ b/pages/info/sceneProductInfo/index.js @@ -37,14 +37,6 @@ Page({ retailId: options.retailId }) } - commonApi._post("pbservice/Other/getClientConfig", { - unique_key: "wechatxcx" - }).then(res => { - let data = JSON.parse(res.data); - this.setData({ - isTest: data.isTest - }) - }) this.setData({ id: options.id }) @@ -458,7 +450,16 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { - + if(app.globalData.configJson){ + this.setData({ + isTest: app.globalData.configJson.isTest + }) + } + else { + setTimeout(()=>{ + this.onReady() + },300) + } }, /** diff --git a/pages/kj/info/index.js b/pages/kj/info/index.js index 42d02a0..1d8d83f 100644 --- a/pages/kj/info/index.js +++ b/pages/kj/info/index.js @@ -3,6 +3,9 @@ import productApi from "../../../utils/https/common"; import util from "../../../utils/util" let app = getApp(); let timer = null; +import QRCode from '../../../utils/weapp-qrcode.js' +let device = wx.getSystemInfoSync(); +const ratio = device.windowWidth / 750; Page({ /** @@ -51,6 +54,7 @@ Page({ this.setData({ isKj:false }) + this.drawImg() } else { this.setData({ @@ -168,12 +172,6 @@ Page({ info:info }) }, - // 隐藏关注二维码 - hideShare:function(){ - this.setData({ - showShareFlag:false - }) - }, // 保存二维码到手机 saveImg:function(){ wx.downloadFile({ @@ -192,6 +190,245 @@ Page({ showRuleFlag:!this.data.showRuleFlag }) }, + // 分享 + share:function(){ + if(!this.data.shareImg){ + wx.showToast({ + title: '图片生成中,稍后再试', + icon:'none' + }) + return; + } + this.setData({ + showShareFlag:!this.data.showShareFlag + }) + }, + // 保存 + save(){ + let url = this.data.shareImg,that = this; + wx.authorize({ + /* 这个就是保存相册的 */ + scope: 'scope.writePhotosAlbum', + success() { + wx.saveImageToPhotosAlbum({ + filePath:url, + success(res) { + wx.showToast({ + title: '保存成功', + icon:"success" + }) + that.setData({ + showShareFlag:!this.data.showShareFlag + }) + }, + fail(res){ + wx.showToast({ + title: '保存失败', + icon:'none' + }) + } + }) + }, + complete(res) { + console.log(res); + /* 这里判断一下如果没有授权重新打开设置选项 */ + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.writePhotosAlbum']) { + /* 打开设置的方法 */ + // opensit(); + wx.showToast({ + title: '请打开权限后再试', + icon:'none' + }) + } + } + }); + } + }); + + }, + // 绘制海报 + drawImg:function(){ + var that = this,userinfo = wx.getStorageSync('jstrip_userInfo'); + const ctx = wx.createCanvasContext('imageCanvas'); + // const device = wx.getSystemInfoSync(); + // const ratio = device.screenWidth / 750; + + // 先获取到图片信息 + let promise2 = new Promise(function(resolve,reject){ + wx.getImageInfo({ + src:that.data.info.detail.headimg, + success:function(res){ + resolve(res); + }, + fail:function(res){ + reject(res); + } + }) + }) + let promise3 = new Promise(function(resolve,reject){ + let userid = wx.getStorageSync('jstrip_userid') + new QRCode('myQrcode',{ + text: 'https://m.cloud.sz-trip.com/BargainFriends?id='+that.data.info.detail.id+'&sharedUserId='+userid+'&channel=-1&originate_id='+that.data.kjId, + width: 500, + height: 500, + padding: 12, // 生成二维码四周自动留边宽度,不传入默认为0 + correctLevel: QRCode.CorrectLevel.L, // 二维码可辨识度 + callback: (res) => { + resolve(res); + } + }) + }) + //成功得到图片信息后,开始绘图 + Promise.all([promise2,promise3]).then(imgs=>{ + ctx.save(); + ctx.beginPath(); //开始绘制 + that.handleBorderRect(ctx,0,0,551 * ratio,407 * ratio,25 * ratio,'#ccc') + ctx.clip();//画好了圆 剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内 这也是我们要save上下文的原因 + ctx.drawImage(imgs[0].path, 0, 0,551 * ratio,407 * ratio); + ctx.restore(); + ctx.save(); + that.handleBorderRect2(ctx,0,407 * ratio,551 * ratio,236*ratio,25 * ratio,'#fff') + ctx.restore(); + // 绘制二维码 + ctx.drawImage(imgs[1].path, 373 * ratio, 495 * ratio,137 * ratio, 137 * ratio); + // 开始文字绘制 + ctx.setFillStyle("#000"); + ctx.setFontSize(30 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + that.drawText(ctx,that.data.info.detail.title+that.data.info.detail.sku_name, 25*ratio, 450*ratio,480 * ratio,ratio); + // 售价 + ctx.setFillStyle("#D62828"); + ctx.setFontSize(40 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + let price = "¥0"; + let width = ctx.measureText(price).width; + ctx.fillText(price, 25*ratio, 620*ratio); + // 副标题 + ctx.setFillStyle("#999999"); + ctx.setFontSize(28 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + let subtitle = '快来帮我砍一刀吧~' + ctx.fillText(subtitle, 25*ratio, 540*ratio); + // ctx.draw(); + // 划线价 + ctx.setFillStyle("#999999"); + ctx.setFontSize(32 * ratio); //字大小 + ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + let market_price = "¥"+(that.data.info.detail.kj_money/100) + ctx.fillText(market_price, 40*ratio + width, 620*ratio); + let market_price_width = ctx.measureText(market_price).width; + // 划线 + ctx.beginPath() + ctx.setLineWidth(1) + ctx.moveTo(40*ratio + width, 608*ratio) + ctx.lineTo(45*ratio + width + market_price_width, 608*ratio) + ctx.stroke(); + // 长按识别二维码 + // ctx.setFillStyle("#666"); + // ctx.setFontSize(22 * ratio); //字大小 + // ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + // ctx.fillText("长按识别二维码", 404*ratio, 710*ratio); + // 长按图片转发或保存 + // ctx.setFillStyle("#000"); + // ctx.setFontSize(24 * ratio); //字大小 + // ctx.setTextAlign('left'); //是否居中显示,参考点画布中线 + // ctx.fillText("长按图片保存到本地",(592*ratio - ctx.measureText("长按图片保存到本地").width)/2, 740*ratio); + ctx.draw(); + // 转为图片 + setTimeout(()=>{ + wx.canvasToTempFilePath({ + x: 0, + y: 0, + canvasId: 'imageCanvas', + success: function (res) { + that.setData({ + shareImg:res.tempFilePath + }) + }, + fail(err){ + console.log('agdgjgdajhg',err) + } + }) + },500) + return false; + }).catch(err=>{ + console.log("this err",err) + }) + }, + // 圆角矩形 + handleBorderRect(ctx, x, y, w, h, r, color){ + ctx.beginPath(); + ctx.moveTo(x+w,y+h); + ctx.lineTo(x,y+h) + // 左上角 + ctx.arc(x + r, y + r, r, Math.PI, 1.5 * Math.PI); + ctx.moveTo(x + r, y); + ctx.lineTo(x + w - r, y); + ctx.lineTo(x + w, y + r); + // 右上角 + ctx.arc(x + w - r, y + r, r, 1.5 * Math.PI, 2 * Math.PI); + ctx.lineTo(x + w, y + h ); + ctx.lineTo(x + w - r, y + h); + ctx.fillStyle = color; + ctx.fill(); + ctx.closePath(); + }, + handleBorderRect2(ctx, x, y, w, h, r, color){ + ctx.beginPath(); + ctx.moveTo(x,y); + ctx.lineTo(x+w,y) + // 右下角 + ctx.arc(x + w - r, y + h - r, r, 0, 0.5 * Math.PI); + ctx.lineTo(x + r, y + h); + ctx.lineTo(x, y + h - r); + // 左下角 + ctx.arc(x + r, y + h - r, r, 0.5 * Math.PI, Math.PI); + ctx.lineTo(x, y); + ctx.lineTo(x, y); + ctx.fillStyle = color; + ctx.fill(); + ctx.closePath(); + }, + // 绘制两行文字 + drawText: function(ctx, str, x, y, canvasWidth,ratio) { + let row = [],temp="",chr=str.split(""); + for (var a = 0; a < chr.length; a++) { + if (ctx.measureText(temp).width < canvasWidth) { + temp += chr[a]; + } + else { + a--; //这里添加了a-- 是为了防止字符丢失,效果图中有对比 + row.push(temp); + temp = ""; + } + } + row.push(temp); + + //如果数组长度大于2 则截取前两个 + if (row.length > 2) { + var rowCut = row.slice(0, 2); + var rowPart = rowCut[1]; + var test = ""; + var empty = []; + for (var a = 0; a < rowPart.length; a++) { + if (ctx.measureText(test).width < canvasWidth - 30 * ratio) { + test += rowPart[a]; + } + else { + break; + } + } + empty.push(test); + var group = empty[0] + "..."//这里只显示两行,超出的用...表示 + rowCut.splice(1, 1, group); + row = rowCut; + } + for (var b = 0; b < row.length; b++) { + ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth); + } + }, /** * 生命周期函数--监听页面初次渲染完成 diff --git a/pages/kj/info/index.wxml b/pages/kj/info/index.wxml index bdbd0c1..bdfba66 100644 --- a/pages/kj/info/index.wxml +++ b/pages/kj/info/index.wxml @@ -52,7 +52,7 @@ - + 预计再邀请{{info.detail.success_need_num}}人后砍价完成 原价购买 >> @@ -106,4 +106,29 @@ 长按保存二维码 + + + + + + + + + \ No newline at end of file diff --git a/pages/kj/info/index.wxss b/pages/kj/info/index.wxss index 5136ef5..6733288 100644 --- a/pages/kj/info/index.wxss +++ b/pages/kj/info/index.wxss @@ -238,4 +238,67 @@ page { margin-top: 30rpx; color: #E14135; text-align: center; +} +.share-img-box { + /* width: 551rpx; */ + position: static; + background: none; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} +.share-img { + display: block; + width: 551rpx; +} +.share-tips { + width: 426rpx; + height: 150rpx; + background: #FFFFFF; + border-radius: 25rpx; + margin-top: 25rpx; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 65rpx; + color: #999; + font-size: 24rpx; + text-align: center; + line-height: 40rpx; +} +.share-tips .img { + display: block; + width: 55rpx; + margin: 0 auto; + margin-bottom: 4rpx; +} +.tipimg { + position: absolute; + left: 50%; + margin-left: 16rpx; + width: 24rpx; + height: 24rpx; + background: #D62828; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + top: 34rpx; +} +.tipimg image { + width: 21rpx; + display: block; + +} +.save-btn { + width: 403rpx; + line-height: 77rpx; + background: #D62828; + border-radius: 39rpx; + text-align: center; + color: #fff; + font-size: 31rpx; + font-weight: 500; + margin-top: 50rpx; } \ No newline at end of file diff --git a/pages/list/hotel/index.js b/pages/list/hotel/index.js index 96e3c8b..304f490 100644 --- a/pages/list/hotel/index.js +++ b/pages/list/hotel/index.js @@ -7,7 +7,7 @@ Page({ * 页面的初始数据 */ data: { - type:5, + type:8, total:1, list:[], keywords:"", @@ -104,7 +104,8 @@ Page({ lon:this.data.location?this.data.location.lon:null, lat:this.data.location?this.data.location.lat:null, sort:this.data.isDistanceSort?'distance':null, - order:this.data.isDistanceSort?'asc':null + order:this.data.isDistanceSort?'asc':null, + wid:'1' }).then(res=>{ res.data.list.map(item=>{ if(item.distance>=1000){ diff --git a/pages/list/hotel/index.wxml b/pages/list/hotel/index.wxml index b4f9455..48cf1ef 100644 --- a/pages/list/hotel/index.wxml +++ b/pages/list/hotel/index.wxml @@ -5,10 +5,11 @@ + 特色民宿 精品酒店 舒适酒店 经济连锁 - 特色民宿 + 距离排序 diff --git a/pages/map/index.js b/pages/map/index.js index f679038..3daa7e7 100644 --- a/pages/map/index.js +++ b/pages/map/index.js @@ -58,26 +58,33 @@ Page({ longitude:r.longitude, latitude:r.latitude }) + that.getIsTest() + }, + fail(){ + that.getIsTest() } }) - commonApi._post("pbservice/Other/getClientConfig",{ - unique_key:"wechatxcx" - }).then(res=>{ - let data = JSON.parse(res.data) - this.setData({ - indexHot:data.indexHot, - isTest:data.isTest - }) - if(data.isTest==true){ - this.setData({ - type:1 - }) - } - that.getList() - }) }) }, + getIsTest(){ + if(app.globalData.configJson){ + this.setData({ + isTest:app.globalData.configJson.isTest + }) + if(app.globalData.configJson.isTest==true){ + this.setData({ + type:1 + }) + } + this.getList() + } + else { + setTimeout(()=>{ + this.getIsTest() + },200) + } + }, gotoDetail:function(){ if(this.data.info.info.type=='relic'){ wx.navigateTo({ diff --git a/pages/order/components/address/index.wxss b/pages/order/components/address/index.wxss index 49d5094..2065a88 100644 --- a/pages/order/components/address/index.wxss +++ b/pages/order/components/address/index.wxss @@ -85,6 +85,7 @@ padding: 0 25rpx; overflow-y: auto; background: #F7F7F7; + max-height: 50%; } .linkmanlist-item { background: white; diff --git a/pages/order/components/contact/index.wxss b/pages/order/components/contact/index.wxss index e3d2575..ecbc0b4 100644 --- a/pages/order/components/contact/index.wxss +++ b/pages/order/components/contact/index.wxss @@ -83,6 +83,7 @@ padding: 0 25rpx; overflow-y: auto; background: #F7F7F7; + max-height: 50%; } .linkmanlist-item { background: white; diff --git a/pages/order/components/date/index.js b/pages/order/components/date/index.js index adc9886..4a46db2 100644 --- a/pages/order/components/date/index.js +++ b/pages/order/components/date/index.js @@ -202,7 +202,7 @@ Component({ }) }, selectTime: function (e) { - if (this.data.timelist[e.currentTarget.dataset.index].stock_number != 0) { + if (this.data.timelist[e.currentTarget.dataset.index].stock_number >0) { this.setData({ timeIndex: e.currentTarget.dataset.index }) diff --git a/pages/order/components/date/index.wxml b/pages/order/components/date/index.wxml index f107cdd..924cc7a 100644 --- a/pages/order/components/date/index.wxml +++ b/pages/order/components/date/index.wxml @@ -4,7 +4,8 @@ {{item.date}} - {{item.price==0 || kjIdCom?'免费':('¥'+item.price/100)}} + 不开放 + {{item.price==0 || kjIdCom?'免费':('¥'+item.price/100)}} {{item.tipText?item.tipText:'售罄'}} @@ -17,7 +18,7 @@ - {{item.start_time}}-{{item.end_time}} 有票 无票({{item.stock_number==-1?'无限':('余票'+item.stock_number)}}) + {{item.start_time}}-{{item.end_time}} 有票 无票不开放({{'余票'+item.stock_number}}) - 在线支付:¥{{(CtripHotelCart.price_sum/100 * (numberIndex+1) - (coupon?coupon.activity.money/100:0))>0?CtripHotelCart.price_sum/100 * (numberIndex+1) - (coupon?coupon.activity.money/100:0):0}} + 在线支付:¥0¥{{(CtripHotelCart.price_sum/100 * (numberIndex+1) - (coupon?coupon.activity.money/100:0))>0?CtripHotelCart.price_sum/100 * (numberIndex+1) - (coupon?coupon.activity.money/100:0):0}} 每晚明细 去支付 diff --git a/pages/order/movie/index.js b/pages/order/movie/index.js index 2d1a276..21a32fc 100644 --- a/pages/order/movie/index.js +++ b/pages/order/movie/index.js @@ -13,7 +13,8 @@ Page({ tel:'', product:null, price:0, - coupon:null + coupon:null, + prizeId:null }, /** @@ -25,6 +26,9 @@ Page({ util.back() return; } + this.setData({ + prizeId:wx.getStorageSync('prizeId') + }) let product = app.globalData.product,price=0; product.info.selectSeatInfo.map(item=>{ price = Number(item.price) + Number(price) @@ -92,6 +96,9 @@ Page({ if(app.globalData.from){ data.system_name = app.globalData.from; } + if(this.data.prizeId){ + data.lottery_id = this.data.prizeId + } if(app.globalData.retailId){ data.commission_code = app.globalData.retailId; app.globalData.retailId = null; diff --git a/pages/order/movie/index.wxml b/pages/order/movie/index.wxml index 5c51fc5..7ad82ae 100644 --- a/pages/order/movie/index.wxml +++ b/pages/order/movie/index.wxml @@ -18,7 +18,8 @@ - ¥{{((price - (coupon?coupon.activity.money:0))>0?(price - (coupon?coupon.activity.money:0)):0)/100}} + ¥0 + ¥{{((price - (coupon?coupon.activity.money:0))>0?(price - (coupon?coupon.activity.money:0)):0)/100}} 总计优惠{{coupon?coupon.activity.money/100:0}}元 diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js index 92b9779..0dcae05 100644 --- a/pages/order/postOrder/index.js +++ b/pages/order/postOrder/index.js @@ -15,7 +15,8 @@ Page({ coupon:null, sku_id:'', kjId:null, - gp_id:null + gp_id:null, + prizeId:null }, /** @@ -25,7 +26,8 @@ Page({ this.setData({ from:options.from, kjId:app.globalData.kjId, - gp_id:app.globalData.gp_id || app.globalData.team_id + gp_id:app.globalData.gp_id || app.globalData.team_id, + prizeId:wx.getStorageSync('prizeId') }) let price = 0,sku_id=[]; app.globalData.postProduct.map(item=>{ @@ -140,6 +142,9 @@ Page({ data.commission_code = app.globalData.retailId; app.globalData.retailId = null; } + if(this.data.prizeId){ + data.lottery_id = this.data.prizeId + } if(app.globalData.category_id){ data.category_id = app.globalData.category_id; } diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml index ce6793b..d973e7f 100644 --- a/pages/order/postOrder/index.wxml +++ b/pages/order/postOrder/index.wxml @@ -40,6 +40,7 @@ - 合计:¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}} + 合计:¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}} + 合计:¥{{postFee?(0+postFee)/100:0}} 提交订单 \ No newline at end of file diff --git a/pages/order/roadOrder/index.js b/pages/order/roadOrder/index.js index 9890e52..06cffba 100644 --- a/pages/order/roadOrder/index.js +++ b/pages/order/roadOrder/index.js @@ -21,13 +21,17 @@ Page({ editId:null, price:0, coupon:null, - sku_ids:"" + sku_ids:"", + prizeId:null }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + this.setData({ + prizeId:wx.getStorageSync('prizeId') + }) userApi.user_post("user/getMyInfo").then(res=>{ this.setData({ reserve_mobile:res.data.mobile @@ -246,6 +250,9 @@ Page({ source:"WECHATXCX", remark:this.data.remark } + if(this.data.prizeId){ + data.lottery_id = this.data.prizeId + } if(app.globalData.from){ data.system_name = app.globalData.from; } diff --git a/pages/order/roadOrder/index.wxml b/pages/order/roadOrder/index.wxml index fc75220..c28f663 100644 --- a/pages/order/roadOrder/index.wxml +++ b/pages/order/roadOrder/index.wxml @@ -39,7 +39,8 @@ --> - 订单金额:¥{{((price - (coupon?coupon.activity.money:0))>0?(price - (coupon?coupon.activity.money:0)):0)/100}} + 订单金额:¥0 + 订单金额:¥{{((price - (coupon?coupon.activity.money:0))>0?(price - (coupon?coupon.activity.money:0)):0)/100}} 去支付 diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 325ae52..1c16b66 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -20,7 +20,8 @@ Page({ isLogin:false, kjId:null, gp_id:null, - groupName:"" + groupName:"", + prizeId:null }, /** @@ -30,7 +31,8 @@ Page({ this.setData({ type:options.type, kjId:app.globalData.kjId, - gp_id:app.globalData.gp_id || app.globalData.team_id + gp_id:app.globalData.gp_id || app.globalData.team_id, + prizeId:wx.getStorageSync('prizeId') }) if(!app.globalData.product){ util.back(); @@ -199,6 +201,9 @@ Page({ if(app.globalData.category_id){ data.category_id = app.globalData.category_id; } + if(this.data.prizeId){ + data.lottery_id = this.data.prizeId + } let service = 'order/create',postData={ data:JSON.stringify(data) } @@ -208,6 +213,7 @@ Page({ postData.team_name = this.data.groupName postData.type = 1; } + commonApi.user_post(service,postData).then(res=>{ if(app.globalData.kjId){ this.setData({ diff --git a/pages/order/scene/index.wxml b/pages/order/scene/index.wxml index 7aac402..5689e66 100644 --- a/pages/order/scene/index.wxml +++ b/pages/order/scene/index.wxml @@ -31,7 +31,8 @@ - 合计:¥0 + 合计:¥0 + 合计:¥{{((singlePrice * productNum - (coupon?coupon.activity.money:0))>0?(singlePrice * productNum - (coupon?coupon.activity.money:0)):0)/ 100}} 提交订单 diff --git a/pages/order/showOrder/index.js b/pages/order/showOrder/index.js index d22aaa0..cd371ff 100644 --- a/pages/order/showOrder/index.js +++ b/pages/order/showOrder/index.js @@ -9,7 +9,8 @@ Page({ data: { product:app.globalData.product, contact:[], - coupon:null + coupon:null, + prizeId:null }, /** @@ -17,7 +18,8 @@ Page({ */ onLoad: function (options) { this.setData({ - product:app.globalData.product + product:app.globalData.product, + prizeId:wx.getStorageSync('prizeId') }) }, setLinkman:function(e){ @@ -54,6 +56,9 @@ Page({ "seats_ids":product.seats }] }; + if(this.data.prizeId){ + data.lottery_id = this.data.prizeId + } if(app.globalData.from){ data.system_name = app.globalData.from; } diff --git a/pages/order/showOrder/index.wxml b/pages/order/showOrder/index.wxml index acaee06..1ef4642 100644 --- a/pages/order/showOrder/index.wxml +++ b/pages/order/showOrder/index.wxml @@ -16,6 +16,7 @@ - 订单金额:¥{{((product.timeInfo.price * product.seats.length - (coupon?coupon.activity.money:0))>0?(product.timeInfo.price * product.seats.length - (coupon?coupon.activity.money:0)):0) / 100}} + 订单金额:¥0 + 订单金额:¥{{((product.timeInfo.price * product.seats.length - (coupon?coupon.activity.money:0))>0?(product.timeInfo.price * product.seats.length - (coupon?coupon.activity.money:0)):0) / 100}} 提交订单 \ No newline at end of file diff --git a/pages/pbService/appreciate/index.js b/pages/pbService/appreciate/index.js index 5f5d0fb..7857825 100644 --- a/pages/pbService/appreciate/index.js +++ b/pages/pbService/appreciate/index.js @@ -1,5 +1,6 @@ // pages/pbService/appreciate/index.js import commonApi from "../../../utils/https/common" +let app = getApp() Page({ /** @@ -29,14 +30,6 @@ Page({ isIos:true }) } - commonApi._post("pbservice/Other/getClientConfig",{ - unique_key:"wechatxcx" - }).then(res=>{ - let data = JSON.parse(res.data) - this.setData({ - isTest:data.isTest - }) - }) // 获取视频的标签 commonApi._post("pbservice/Artpopulate/videoTags").then(res=>{ res.data.unshift({ @@ -142,8 +135,17 @@ Page({ /** * 生命周期函数--监听页面初次渲染完成 */ - onReady: function () { - + onReady:function(){ + if(app.globalData.configJson){ + this.setData({ + isTest:app.globalData.configJson.isTest + }) + } + else { + setTimeout(()=>{ + this.onReady() + },300) + } }, /** diff --git a/pages/user/user.wxml b/pages/user/user.wxml index fd3a72d..e4ee9c1 100644 --- a/pages/user/user.wxml +++ b/pages/user/user.wxml @@ -45,6 +45,12 @@ 购物车 + + 团体订单 + + 在线客服 @@ -54,15 +60,19 @@ 我的收藏 + 实名认证 - - 团体订单 - + diff --git a/pages/user/videoCoupon/index.js b/pages/user/videoCoupon/index.js new file mode 100644 index 0000000..2f98442 --- /dev/null +++ b/pages/user/videoCoupon/index.js @@ -0,0 +1,96 @@ +// pages/user/videoCoupon/index.js +import commonApi from "../../../utils/https/common" +import util from "../../../utils/util" +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + page:1, + total:1, + list:[] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getList() + }, + getList(){ + if(this.data.list.length>=this.data.total) return; + commonApi.user_post("actonline/video_act/prizeLog",{ + id:5, + page:this.data.page, + limit:20 + }).then(res=>{ + this.setData({ + total:res.data.total, + list:this.data.list.concat(res.data.data) + }) + }) + }, + gotoDetail(e){ + let item = e.currentTarget.dataset.item + if(item.type=='coupon'){ + wx.navigateTo({ + url: '/pages/user/coupon/index', + }) + } + else if(item.type=='product'){ + util.gotoDetail(item.prize_product) + wx.setStorageSync('prizeId', item.id) + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.getList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/user/videoCoupon/index.json b/pages/user/videoCoupon/index.json new file mode 100644 index 0000000..35cf02f --- /dev/null +++ b/pages/user/videoCoupon/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader" + } +} \ No newline at end of file diff --git a/pages/user/videoCoupon/index.wxml b/pages/user/videoCoupon/index.wxml new file mode 100644 index 0000000..c90e803 --- /dev/null +++ b/pages/user/videoCoupon/index.wxml @@ -0,0 +1,11 @@ + + + + + + {{item.prize_name}} + 获取来源:{{item.act_name}} + 获取时间:{{item.create_time}} + + +暂无数据 \ No newline at end of file diff --git a/pages/user/videoCoupon/index.wxss b/pages/user/videoCoupon/index.wxss new file mode 100644 index 0000000..f4f051e --- /dev/null +++ b/pages/user/videoCoupon/index.wxss @@ -0,0 +1,39 @@ +/* pages/user/videoCoupon/index.wxss */ +page { + background: #EDEDED; +} +.item { + margin: 20rpx 30rpx; + background: white; + border-radius: 20rpx; + display: flex; + align-items: center; + justify-content: space-between; + padding: 10rpx 13rpx; +} +.item image { + width: 250rpx; + height: 180rpx; + flex-shrink: 0; + display: block; + border-radius: 11rpx; +} +.info { + flex: 1; + margin-left: 20rpx; + font-size: 27rpx; + color: #999999; + line-height: 42rpx; +} +.info .title { + color: #000; + font-size: 30rpx; + font-weight: 500; + margin-bottom: 20rpx; +} +.nomore { + text-align: center; + margin-top: 40rpx; + font-size: 0.28rem; + color: #666; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json index 2786333..88a16c0 100644 --- a/project.config.json +++ b/project.config.json @@ -4,7 +4,7 @@ "ignore": [] }, "setting": { - "urlCheck": true, + "urlCheck": false, "es6": true, "enhance": false, "postcss": true, diff --git a/project.private.config.json b/project.private.config.json index cc76cd2..ee63f36 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -13,8 +13,8 @@ "miniprogram": { "list": [ { - "name": "pages/group/index", - "pathName": "pages/group/index", + "name": "pages/pbService/web/index", + "pathName": "pages/pbService/web/index", "query": "authCode=2c290d21383ccd3350747bba95f306f0", "scene": null }, diff --git a/utils/https.js b/utils/https.js index 62e53c5..08cf030 100644 --- a/utils/https.js +++ b/utils/https.js @@ -192,7 +192,10 @@ function user_post_new(url,data={}){ return; } else if (res.data.code != 1 && res.data.msg) { - if(url.indexOf('actonline/act_online/vote')!=-1 && res.data.code==0){ + if(url.indexOf('actonline/video_act/getRaffle')!=-1){ + + } + else if(url.indexOf('actonline/act_online/vote')!=-1 && res.data.code==0){ wx.showToast({ title: res.data.msg, icon: "none", @@ -211,6 +214,7 @@ function user_post_new(url,data={}){ if(res.statusCode == 200){ if(url.indexOf('/order/create')!=-1 && res.data.code==1 && res.data.data){ // 下单成功 + wx.removeStorageSync('prizeId') if(res.data.data.pay_status==1){ // 0元直接付款成功 wx.navigateTo({ @@ -227,6 +231,13 @@ function user_post_new(url,data={}){ }) } } + else if(url.indexOf('/order/create')!=-1 && res.data.msg=='您有正在进行中或待支付的拼团,请查看拼团订单'){ + setTimeout(() => { + wx.navigateTo({ + url: '/pages/user/order/list', + }) + }, 1000); + } if(url.indexOf('product/get_product_detail')!=-1){ // 如果是产品详情的话 需要加埋点 _post('browse/ProductStatistics',{ diff --git a/utils/util.js b/utils/util.js index 74b37bd..411d890 100644 --- a/utils/util.js +++ b/utils/util.js @@ -151,7 +151,7 @@ const checkLocation = function(){ }) } const gotoDetail = (item) =>{ - console.log(item) + wx.removeStorageSync('prizeId'); switch(item.type){ case "tenscenic": wx.navigateTo({