diff --git a/app.js b/app.js index e8899e2..3228d7e 100644 --- a/app.js +++ b/app.js @@ -99,6 +99,7 @@ App({ WEIXIN:"微信支付", JIANSHEYINHANG:"建行支付", ZHIFUBAO:"支付宝支付" - } + }, + kjId:null } }) \ No newline at end of file diff --git a/app.json b/app.json index 96d8e65..6be562c 100644 --- a/app.json +++ b/app.json @@ -87,6 +87,8 @@ "pages/list/minitrip/index", "pages/list/oneday/index", "pages/pbService/index", + "pages/pbService/museum/index", + "pages/pbService/museum/info/index", "pages/pbService/PRpark/index", "pages/pbService/sceneComfort/index", "pages/pbService/gym/index", @@ -113,6 +115,7 @@ "pages/ask/index", "pages/ask/info/index", "pages/ask/my/index", + "pages/activity/graduate/index", "pages/activity/year2020/index", "pages/activity/suyear/index", "pages/activity/spring2021/index", diff --git a/pages/activity/graduate/index.js b/pages/activity/graduate/index.js new file mode 100644 index 0000000..9d1618a --- /dev/null +++ b/pages/activity/graduate/index.js @@ -0,0 +1,114 @@ +// pages/activity/graduate/index.js +import commonApi from "../../../utils/https/common" +import util from "../../../utils/util" +Page({ + + /** + * 页面的初始数据 + */ + data: { + list:[[],[],[],[]] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let ajaxes = [],list = []; + wx.showLoading({ + title: '加载中', + }); + ['62','63','64'].map(item=>{ + ajaxes.push(commonApi._post("product/get_product_by_tag",{ + tag_id: item, + offset: 0, + limit: 100 + })) + }); + ajaxes.push(commonApi._post("scene/get_scene_by_tag",{ + tag_id: 30, + offset: 0, + limit: 100 + })) + Promise.all(ajaxes).then(res=>{ + res.map(item=>{ + item.data.list.map(i=>{ + i.display_tags = i.display_tags?i.display_tags.split(","):[]; + i.display_tags = i.display_tags.slice(0,2); + }) + list.push(item.data.list); + }) + this.setData({ + list:list + }) + wx.hideLoading({}) + }) + }, + gotoDetail:function(e){ + let item = e.currentTarget.dataset.item; + util.gotoDetail(item) + }, + scrollToBox:function(e){ + let index = e.currentTarget.dataset.index; + const query=wx.createSelectorQuery(); //创建节点查询器 + query.select("#box"+index).boundingClientRect() //选择toViewid获取位置信息 + query.selectViewport().scrollOffset() //获取页面查询位置的 + query.exec(function(res) { + console.log(res) + let scrollTop = res[0].top + res[1].scrollTop ; + wx.pageScrollTo({ + scrollTop: scrollTop - 60, + duration: 200 + }) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/activity/graduate/index.json b/pages/activity/graduate/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/activity/graduate/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/activity/graduate/index.wxml b/pages/activity/graduate/index.wxml new file mode 100644 index 0000000..25806d5 --- /dev/null +++ b/pages/activity/graduate/index.wxml @@ -0,0 +1,30 @@ + + + + + 好玩景点 + 一日游 + 文创特产 + 精选酒店 + + + + + + + + {{item.title}} + + {{item}} + + + {{item.price/100}} + + + + + + + + + \ No newline at end of file diff --git a/pages/activity/graduate/index.wxss b/pages/activity/graduate/index.wxss new file mode 100644 index 0000000..b88e397 --- /dev/null +++ b/pages/activity/graduate/index.wxss @@ -0,0 +1,132 @@ +/* pages/activity/graduate/index.wxss */ +.mainimg { + display: block; + width: 100%; +} +page { + background: url(https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/activity/graduate/bg.png); + background-size: 100%; + background-repeat: repeat-y; +} +.top-menus { + display: flex; + align-items: center; + position: absolute; + justify-content: space-between; + left: 34rpx; + right: 34rpx; + top: 546rpx; + z-index: 1; + color: #fff; + line-height: 51rpx; +} +.top-menu { + width: 149rpx; + border-radius: 19rpx; + font-size: 26rpx; + flex-shrink: 0; + letter-spacing: 3rpx; + background: #308506; + text-align: center; + font-weight: lighter; +} +.list { + position: relative; + margin: 10rpx 27rpx; + border: solid 1rpx #7c9112; + padding: 8rpx; + border-radius: 16rpx; + z-index: 1; + margin-bottom: 40rpx; +} +.list-box { + border-radius: 16rpx; + background-color: #f6f0e4; + border: solid 3rpx #7c9112; + padding: 56rpx 30rpx; + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} +.item .mainimg { + width: 286rpx; + height: 253rpx; + border-radius: 16rpx; +} +.item { + border-radius: 16rpx; + padding: 7rpx; + width: 286rpx; + border: 1rpx dashed; + color: #7c9112; + margin-top: 27rpx; +} +.titleimg { + position: absolute; + display: block; + width: 326rpx; + height: 67rpx; + left: 50%; + margin-left: -163rpx; + top: -28rpx; +} +.item .title { + font-size: 25rpx; + line-height: 38rpx; + letter-spacing: -2rpx; + color: #469115; + margin: 5rpx 10rpx; +} +.product-tags { + margin: 0 10rpx; + display: flex; + align-items: center; + margin-bottom: 10rpx; + height: 20rpx; +} +.product-tag { + line-height: 20rpx; + background-color: #b1c346; + padding: 0 15rpx; + font-size: 12rpx; + color: #495800; + margin-right: 8rpx; +} +.product-tags:last-child { + margin-right: 0; +} +.product-bottom { + display: flex; + justify-content: space-between; + margin: 0 10rpx; + padding-bottom: 6rpx; + color: #6ea21b; + font-size: 14rpx; + align-items: flex-end; +} +.product-bottom image { + width: 120rpx; + display: block; + flex-shrink: 0; +} +.product-bottom text { + font-size: 31rpx; + font-weight: 500; + line-height: 31rpx; + margin-left: 10rpx; +} +.bottombg { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + display: block; + z-index: 0; +} +.bottomtext { + position: absolute; + right: 0; + width: 439rpx; + bottom: 0; + z-index: 2; +} \ No newline at end of file diff --git a/pages/kj/his/index.wxml b/pages/kj/his/index.wxml index 827f5d6..5d3d3e4 100644 --- a/pages/kj/his/index.wxml +++ b/pages/kj/his/index.wxml @@ -1,7 +1,7 @@ - + {{item.help_user_name}} {{item.created_time}} diff --git a/pages/kj/index.js b/pages/kj/index.js index 141a407..5999f53 100644 --- a/pages/kj/index.js +++ b/pages/kj/index.js @@ -1,5 +1,6 @@ // pages/user/pdd/index.js import productApi from "../../utils/https/common" +import util from "../../utils/util" let timer = null,app = getApp(); Page({ @@ -25,7 +26,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - // this.getMine(); + this.getMine(); productApi.user_post("activity.haggle/get_act_list",{limit:100,page:1}).then(res=>{ this.setData({ menuList:res.data.data, @@ -60,73 +61,54 @@ Page({ this.getList() }, gotoDetail:function(e){ - let data = e.currentTarget.dataset; + let data = e.currentTarget.dataset,that = this; if(data.index || data.index==0){ let item = this.data.list[data.index]; console.log(item) // 已砍成已下单 - if(item.myOriginateFlag=='over' && item.isBuyed==1){ + if(item.buy_status=='end'){ wx.showModal({ title:"提示", content:"单个商品单账户只可参与一次,是否原价购买", confirmColor:"#e14135", success:function(res){ if(res.confirm){ - wx.navigateTo({ - url: '/pages/info/'+(item.frontShowModel=='line'?'productInfo':'skuProductInfo')+'/index?id='+item.productId - }) + that.gotoProduct(item.goods_id) } } }) return; } // 已砍成未下单 - if(item.myOriginateFlag=='over' && item.isBuyed!=1){ - productApi._get('productfront/getProductInfo',{ - productId:item.productId - }).then(res=>{ - if(!res.data){ - wx.showToast({ - title:"该产品不存在或已下架", - icon:'none' + if(item.buy_status=='over'){ + app.globalData.kjId = item.buy_id; + // todo + util.goKjOrder(item).then(product=>{ + app.globalData.couponInfo = null; + if(item.type=='post'){ + app.globalData.postProduct = product; + wx.navigateTo({ + url: '/pages/order/postOrder/index', }) - return; } - let skuIndex = res.data.skuInfo.findIndex(skuItem=>skuItem.id==item.skuId); - if(skuIndex==-1) { - wx.showToast({ - title:"该产品规格不存在", - icon:'none' + else if(item.type=='ticket' || item.type=='scene'){ + app.globalData.product = product; + wx.navigateTo({ + url: '/pages/order/scene/index', }) - return; } - let sku = res.data.skuInfo[skuIndex]; - app.globalData.shoppingCart=[{ - baseInfo:res.data.baseInfo, - modelInfo:sku.modelInfo, - skuInfo:sku, - productNum:1 - }] - app.globalData.discounts = 0; - // todo - app.globalData.kjOrderId = item.originateId || null - wx.navigateTo({ - url: '/pages/order/index', - }) }) return; } // 已售罄 - if(item.stock<=0){ + if(item.act_stock<=0){ wx.showModal({ title:"提示", content:"此商品已售罄,是否原价购买", confirmColor:"#e14135", success:function(res){ if(res.confirm){ - wx.navigateTo({ - url: '/pages/info/'+(item.frontShowModel=='line'?'productInfo':'skuProductInfo')+'/index?id='+item.productId - }) + that.gotoProduct(item.goods_id) } } }) @@ -138,13 +120,24 @@ Page({ url:"info/index?id="+data.id+"&sid="+data.sid+"&aid="+data.aid }) }, + gotoProduct:function(id){ + productApi._post("product/get_product_detail",{ + id:id + }).then(res=>{ + util.gotoDetail(res.data) + }) + }, getMine:function(){ - productApi.user_post("kj/getMyKjIngProductsNeedAuth",{}).then(res=>{ + productApi.user_post("order/my_haggle_list?status=1&limit=100&page=1",{ + }).then(res=>{ this.setData({ - mineList:this.data.showMoreFlag?res.data:res.data.slice(0,2), - mineAllList:res.data + mineList:this.data.showMoreFlag?res.data.data:res.data.data.slice(0,2), + mineAllList:res.data.data }) this.setTime(); + if(timer){ + clearInterval(timer); + } timer = setInterval(()=>{ this.setTime() },1000) @@ -213,7 +206,7 @@ Page({ setTime:function(){ let mineList = this.data.mineList,now = new Date().getTime(); mineList.map(item=>{ - let overTime = new Date(item.overTime.replace(/-/g,'/')).getTime(); + let overTime = new Date(item.over_time.replace(/-/g,'/')).getTime(); if(overTime<=now){ item.isOver=true; } diff --git a/pages/kj/index.wxml b/pages/kj/index.wxml index dad3a9c..0d108be 100644 --- a/pages/kj/index.wxml +++ b/pages/kj/index.wxml @@ -6,13 +6,13 @@ 我参与的活动 - + {{item.title+item.sku_name}} - ¥{{item.kjMoney/100}} + ¥{{item.kj_money/100}} 已结束 @@ -70,7 +70,7 @@ {{item.showMoreFlag?'点击收起':'点击查看更多'}} 暂无活动 - + 我的 砍价 \ No newline at end of file diff --git a/pages/kj/info/index.js b/pages/kj/info/index.js index e17d740..3eaa10a 100644 --- a/pages/kj/info/index.js +++ b/pages/kj/info/index.js @@ -1,5 +1,6 @@ // pages/info/pddInfo/index.js import productApi from "../../../utils/https/common"; +import util from "../../../utils/util" let app = getApp(); let timer = null; Page({ @@ -12,7 +13,7 @@ Page({ showRuleFlag:false, kjId:null, isKj:false,//是否是被邀请进来砍价的 本人去除 - isFollow:false,//是否已经关注公众号 + isFollow:true,//是否已经关注公众号 showShareFlag:false,//是否显示公众号的二维码 userInfo:null, helpList:[] @@ -125,6 +126,13 @@ Page({ }) }, + gotoProduct:function(){ + productApi._post('product/get_product_detail',{ + id:this.data.info.detail.goods_id + }).then(res=>{ + util.gotoDetail(res.data); + }) + }, // 如果已经发起活动的话需要倒计时 setTime(){ let info = this.data.info; @@ -196,11 +204,6 @@ Page({ this.setTime() },1000) } - productApi.user_post("wx/get_user_keep",{}).then(res=>{ - this.setData({ - isFollow:res.data.subscribe==1 - }) - }) }, /** @@ -212,7 +215,7 @@ Page({ }, // 详情和下单的第一步 gotoDetail:function(e){ - let info = this.data.info.baseInfo || null,type=e.currentTarget.dataset.type; + let info = this.data.info.detail || null,type=e?e.currentTarget.dataset.type:null; if(!info) return; if(type=='fail'){ wx.showModal({ @@ -221,13 +224,13 @@ Page({ confirmColor:"#E14135", success:function(res){ if(res.confirm){ - this.pushOrderData() + this.gotoProduct() } } }) } else { - this.pushOrderData() + this.gotoProduct() } }, // 真实的获取产品信息去下单 diff --git a/pages/kj/info/index.wxml b/pages/kj/info/index.wxml index 5680549..473a902 100644 --- a/pages/kj/info/index.wxml +++ b/pages/kj/info/index.wxml @@ -2,12 +2,12 @@ - - 已结束 + + 已结束 活动规则 - + {{info.h}} : {{info.m}} @@ -16,7 +16,11 @@ 后结束 活动规则 - + + + {{userInfo.nickname}} + 活动规则 + 砍至0元可进行购买 @@ -27,7 +31,7 @@ ¥{{info.detail.kj_money/100}} - 查看详情 > + 查看详情 > 数量:1 diff --git a/pages/kj/mine/index.js b/pages/kj/mine/index.js index 06eea71..b169495 100644 --- a/pages/kj/mine/index.js +++ b/pages/kj/mine/index.js @@ -1,20 +1,129 @@ -// pages/kj/mine/index.js +// pages/user/pdd/index.js +import productApi from "../../../utils/https/common"; +import util from "../../../utils/util" +let timer = null,app = getApp(); Page({ /** * 页面的初始数据 */ data: { - + type:1, + list:[], + page:1, + total:1 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.getList() + }, + changeType:function(e){ + let type = e.currentTarget.dataset.type; + if(this.data.type==type) return; + this.setData({ + type:type, + total:1, + page:1, + list:[] + }) + this.getList(); + }, + gotoDetail:function(e){ + let data = e.currentTarget.dataset.item; + if(this.data.type==2 && data.flag!='expired'){ + if(data.flag=='end'){ + this.goOrder(e); + } + else { + this.goProduct(e) + } + return; + } + wx.navigateTo({ + url:"../info/index?id="+data.act_product_id+"&userid="+data.user_id + }) + }, + getList:function(){ + if(this.data.list.length>=this.data.total) return; + productApi.user_post("order/my_haggle_list?limit=10&page="+this.data.page+"&status="+this.data.type,{}).then(res=>{ + this.setData({ + list:this.data.list.concat(res.data.data), + page:this.data.page+1, + total:res.data.total + }) + if(this.data.type==1){ + this.setTime(); + if(timer){ + clearInterval(timer); + } + timer = setInterval(()=>{ + this.setTime() + },1000) + } + }) + }, + setTime:function(){ + let list = this.data.list,now = new Date().getTime(); + list.map(item=>{ + let overTime = item.over_time; + overTime = new Date(overTime.replace(/-/g,'/')).getTime(); + if(overTime<=now){ + item.isOver=true; + } + else { + let t = (overTime - now)/1000; + let h = Math.floor(t/(60*60)); + t = t - h * 60*60; + let m = Math.floor(t/60),s=Math.floor(t-m*60); + if(h<10) { + h="0"+h; + } + if(m<10) { + m="0"+m; + } + if(s<10) { + s="0"+s; + } + item.timeText=[h,m,s].join(" : "); + } + }) + this.setData({ + list:list + }) + }, + goProduct:function(e){ + let item = e.currentTarget.dataset.item; + console.log(item); + productApi._post('product/get_product_detail',{ + id:item.goods_id + }).then(res=>{ + util.gotoDetail(res.data); + }) + }, + goOrder:function(e){ + productApi.user_post("order/query",{ + order_id:e.currentTarget.dataset.item.order_id, + }).then(res=>{ + util.gotoOrder(res.data) + }) + }, + gotoPdd:function(){ + let page = getCurrentPages(); + if(page[page.length-2] && page[page.length-2].route && page[page.length-2].route.indexOf('pages/kj/index')!=-1){ + // 如果是从专题页列表来的 那么直接返回 + wx.navigateBack({ + delta: -1, + }) + } + else { + wx.navigateTo({ + url: '/pages/kj/index', + }) + } }, - /** * 生命周期函数--监听页面初次渲染完成 */ @@ -26,14 +135,22 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + if(this.data.list.length>0){ + this.setTime(); + timer = setInterval(()=>{ + this.setTime() + },1000) + } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { - + if(timer){ + clearInterval(timer); + timer = null; + } }, /** @@ -54,7 +171,7 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + this.getList() }, /** diff --git a/pages/kj/mine/index.json b/pages/kj/mine/index.json index 8835af0..35cf02f 100644 --- a/pages/kj/mine/index.json +++ b/pages/kj/mine/index.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "title":"/pages/component/TitleHeader" + } } \ No newline at end of file diff --git a/pages/kj/mine/index.wxml b/pages/kj/mine/index.wxml index 288de7e..11cf770 100644 --- a/pages/kj/mine/index.wxml +++ b/pages/kj/mine/index.wxml @@ -1,2 +1,37 @@ - -pages/kj/mine/index.wxml + + + + 进行中 + 砍成记录 + + + + + + + + {{item.title+item.sku_name}} + ¥{{item.kj_money/100}} + + + 已结束 + {{item.timeText}}后结束 + 继续砍价 + + + 砍成日期:{{item.finish_time}} + + + + + 前往下单 + 查看订单 + + + + + + 您暂时还未参加砍价活动 + 您暂时还未砍价成功 + 立即前往 + \ No newline at end of file diff --git a/pages/kj/mine/index.wxss b/pages/kj/mine/index.wxss index fd2b7ff..20faf52 100644 --- a/pages/kj/mine/index.wxss +++ b/pages/kj/mine/index.wxss @@ -1 +1,116 @@ -/* pages/kj/mine/index.wxss */ \ No newline at end of file +.top-menus { + position: fixed; + left: 0; + right: 0; + height: 80rpx; + background: white; + display: flex; + justify-content: space-around; + align-items: center; + font-size: 30rpx; + line-height: 80rpx; +} +page { + background: #F2F2F2; +} +.top-menu.active { + color: #E14135; + position: relative; + font-weight: 500; +} +.top-menu.active::after { + content: "1"; + font-size: 0; + width: 40rpx; + height: 6rpx; + background: linear-gradient(270deg, #E14135, #FF9124); + display: block; + border-radius: 3rpx; + position: absolute; + left: 50%; + margin-left: -20rpx; + bottom: 10rpx; +} +.title-header { + background: #fff !important; +} +.item { + margin: 20rpx 30rpx; + background: white; + border-radius: 20rpx; + font-size: 26rpx; +} +.item-top { + display: flex; + padding: 30rpx; +} +.item-top image { + width: 160rpx; + height: 160rpx; + display: block; + flex-shrink: 0; +} +.item-info { + margin-left: 30rpx; + color: #333333; + display: flex; + flex-direction: column; + justify-content: space-between; + flex: 1; + height: 160rpx; + width: 440rpx; +} +.item-info-top { + font-size: 30rpx; +} +.item-title { + font-weight: 500; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-bottom: 6rpx; +} +.item-info-bottom { + display: flex; + justify-content: space-between; + align-items: center; +} +.item-info-bottom text { + color: #E14135; +} +.info-btn { + width: 160rpx; + text-align: center; + line-height: 50rpx; + height: 50rpx; + background: linear-gradient(0deg, #E14135, #FF9124); + border-radius: 25rpx; + color: #fff; + margin-left: 20rpx; +} +.list { + padding-top: 80rpx; +} +.item-bottom { + display: flex; + padding: 20rpx 30rpx; + border-top: 1rpx solid #d8d8d8; + justify-content: flex-end; +} +.info-btn-new { + background: #fff; + border: 2rpx solid; + color: #F34922; + box-sizing: border-box; +} +.empty-btn { + width: 240rpx; + height: 80rpx; + background: linear-gradient(0deg, #E14135, #FF9124); + border-radius: 40rpx; + line-height: 80rpx; + text-align: center; + color: #fff; + margin-top: 100rpx; + font-size: 30rpx; +} \ No newline at end of file diff --git a/pages/map/index.js b/pages/map/index.js index 8fcb741..f2941ba 100644 --- a/pages/map/index.js +++ b/pages/map/index.js @@ -25,7 +25,8 @@ Page({ menuIndex:-1, productList:[], productPage:1, - productTotal:1 + productTotal:1, + timeList:{} }, /** @@ -149,6 +150,18 @@ Page({ tenscenic_id:info.info.id, page_no:1, page_num:10 + }), + commonApi._post("multimedia/media_list",{ + tenscenic_id:info.info.id, + type:0, + page:1, + limit:10 + }), + commonApi._post("multimedia/media_list",{ + tenscenic_id:info.info.id, + type:1, + page:1, + limit:10 })] Promise.all(ajaxes).then(res=>{ let menus = [],menuIndex=-1; @@ -172,6 +185,14 @@ Page({ if(menuIndex==-1) menuIndex = 4; menus[4] = "攻略" } + if(res[5].data.total>0){ + if(menuIndex==-1) menuIndex = 4; + menus[5] = "讲解" + } + if(res[6].data.total>0){ + if(menuIndex==-1) menuIndex = 4; + menus[6] = "视频" + } this.setData({ menus:menus, menuIndex:menuIndex @@ -244,9 +265,27 @@ Page({ delete data.limit; service="travels/getList"; break; + case "讲解": + service="multimedia/media_list"; + data = { + tenscenic_id:data.tenscenic_id, + page:data.page_no, + limit:10, + type:0 + } + break; + case "视频": + service="multimedia/media_list"; + data = { + tenscenic_id:data.tenscenic_id, + page:data.page_no, + limit:10, + type:1 + } + break; } commonApi._post(service,data).then(res=>{ - let list = res.data.list || res.data.rows; + let list = res.data.list || res.data.rows || res.data.data; list.map(item=>{ item.display_tags = item.display_tags?item.display_tags.split(","):[]; item.display_tags = item.display_tags.slice(0,2); @@ -260,15 +299,66 @@ Page({ } }) this.setData({ - productTotal:res.data.productTotal, + productTotal:res.data.productTotal || res.data.total, productPage:this.data.productPage+1, productList:this.data.productList.concat(list) }) + if(menu=='讲解'){ + // 获取音频长度 + let timeList = this.data.timeList; + list.map(item=>{ + this['audioCtx'+item.id] = wx.createInnerAudioContext("audio"+item.id); + this['audioCtx'+item.id].src = item.multimedia_url; + this['audioCtx'+item.id].onEnded(()=>{ + let productList = this.data.productList; + let productIndex = productList.findIndex(i=>i.id==item.id); + productList[productIndex].play = false; + this.setData({ + productList:productList + }) + }) + this['audioCtx'+item.id].onTimeUpdate((e)=>{ + timeList['audio'+item.id].time = this.audioTimeInit(this['audioCtx'+item.id].currentTime); + timeList['audio'+item.id].width = this['audioCtx'+item.id].currentTime / this['audioCtx'+item.id].duration * 100; + this.setData({ + timeList:timeList + }) + }) + this['audioCtx'+item.id].onCanplay(() => { + this['audioCtx'+item.id].duration //类似初始化-必须触发-不触发此函数延时也获取不到 +       setTimeout( ()=>{ +        //在这里就可以获取到大家梦寐以求的时长了 + if(!timeList['audio'+item.id]){ + timeList['audio'+item.id] = {}; + } +         timeList['audio'+item.id].all_time=this.audioTimeInit(this['audioCtx'+item.id].duration);//延时获取长度 单位:秒 + this.setData({ + timeList:timeList + }) +       }, 1000)  //这里设置延时1秒获取 +     }) + }) + } }) } }, + audioTimeInit:function(second=0){ + second = Math.round(second); + let min = Math.floor(second/60); + min = min<10?('0'+min):min; + second = second%60; + second = second<10?('0'+second):second; + return min+':'+second; + }, gotoDetailNew:function(e){ + if(this.data.menus[this.data.menuIndex]=='讲解') return; let item = e.currentTarget.dataset.item; + if(this.data.menus[this.data.menuIndex]=='视频') { + wx.navigateTo({ + url: '/pages/pbService/appreciate/info/index?info='+encodeURIComponent(JSON.stringify(item)), + }) + return; + } util.gotoDetail(item); }, showImages:function(e){ @@ -361,6 +451,32 @@ Page({ this.setData(e.detail) this.getList() }, + // 讲解播放 + startAuido:function(e){ + let index = e.currentTarget.dataset.index,productList = this.data.productList; + productList[index].play = productList[index].play?false:true; + let audioCtx = this['audioCtx'+productList[index].id]; + if(productList[index].play){ + productList.map((item,i)=>{ + if(item.play==true && index!=i){ + item.play = false; + this['audioCtx'+item.id].pause() + } + }) + audioCtx.play() + commonApi._post("multimedia/viewsInc",{ + id:productList[index].id + }).then(res=>{ + + }) + } + else { + audioCtx.pause() + } + this.setData({ + productList:productList + }) + }, /** * 生命周期函数--监听页面初次渲染完成 diff --git a/pages/map/index.wxml b/pages/map/index.wxml index f4e7935..41eca0a 100644 --- a/pages/map/index.wxml +++ b/pages/map/index.wxml @@ -66,9 +66,38 @@ {{item}} - + - + + + {{item.title}} + + + {{item.views}} + + {{item.like_number}} + + + + + + + + + {{item.title}} + + {{timeList['audio'+item.id] && timeList['audio'+item.id].time?timeList['audio'+item.id].time:"00:00"}} / {{timeList['audio'+item.id]?timeList['audio'+item.id].all_time:"00:00"}} + + + + + + + + + + + diff --git a/pages/map/index.wxss b/pages/map/index.wxss index 61e092c..461d29d 100644 --- a/pages/map/index.wxss +++ b/pages/map/index.wxss @@ -152,14 +152,14 @@ } .map-item1 { position: absolute; - left: 20rpx; - right: 20rpx; + left: 0rpx; + right: 0rpx; height: 70%; bottom: 0; border-radius: 20rpx 20rpx 0 0; background:white; box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.2); - padding: 0 25rpx; + padding: 0 30rpx; padding-top: 35rpx; overflow-y: auto; z-index: 100; @@ -290,6 +290,11 @@ .list .item:last-child { border: none; } +.list.videolist { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} .returnImg { position: absolute; display: block; @@ -327,4 +332,133 @@ margin-left: 50rpx; flex-shrink: 0; margin-right: 8rpx; +} +.audio-item { + padding: 30rpx; + height: 160rpx; + background: #EFF9F9; + border-radius: 11rpx; + display: flex; + justify-content: space-between; + position: relative; + margin: 30rpx auto; +} +.audio-item .mainimg { + width: 160rpx; + height: 160rpx; + flex-shrink: 0; + display: block; + border-radius: 50%; + margin-right: 30rpx; +} +.audio-info { + width: 450rpx; + flex: 1; + display: flex; + height: 160rpx; + flex-direction: column; + justify-content: space-between; +} +.audio-title { + color: #2F2F2F; + font-size: 33rpx; +} +.audio-bottom { + font-size: 20rpx; + color: #8D8D8D; +} +.audio-new-bg { + width: 450rpx; + height: 4rpx; + background: #70B4B7; + border-radius: 2rpx; + position: relative; + margin-top: 40rpx; +} +.audio-line { + border-radius: 2rpx; + background: #DBDBDB; + height: 4rpx; + position: absolute; + top: 0; + right: 0; + left: 0; + transition: all .1s; +} +.audio-new-bg image { + position: absolute; + width: 36rpx; + height: 36rpx; + display: block; + left: 0; + transition: all .1s; + top: 50%; + margin-top: -18rpx; + margin-left: -18rpx; +} +.playimg { + position: absolute; + right: 0; + bottom: 60rpx; + width: 97rpx; + height: 97rpx; + display: block; + +} +.audio-info audio { + position: absolute; + left: 0; + top: 0; + width: 0; + height: 0; +} +.video-item { + padding: 14rpx; + background: #FFFFFF; + box-shadow: 0px 0px 11rpx 0px rgba(4, 0, 0, 0.14); + border-radius: 14rpx; + width: 309rpx; + margin: 30rpx 0; + position: relative; +} +.video-play-mask { + position: absolute; + left: 14rpx; + top: 14rpx; + right: 14rpx; + border-radius: 10rpx 10rpx 0px 0px; + background: rgba(0, 0, 0, 0.3); + display: flex; + justify-content: center; + align-items: center; + height: 214rpx; + z-index: 1; +} +.video-play-mask image { + width: 91rpx; + height: 90rpx; + display: block; +} +.video-item image.main-img { + display: block; + width: 309rpx; + border-radius: 10rpx 10rpx 0px 0px; + height: 214rpx; + margin-bottom: 10rpx; +} +.video-title { + font-size: 31rpx; + font-weight: bold; + color: #333; + line-height: 46rpx; +} +.video-bottom { + display: flex; + align-items: center; + color: #999999; + font-size: 20rpx; + margin-top: 20rpx; +} +.video-bottom .iconfont { + margin-right: 10rpx; } \ No newline at end of file diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js index e1b812a..d8160ba 100644 --- a/pages/order/postOrder/index.js +++ b/pages/order/postOrder/index.js @@ -13,7 +13,8 @@ Page({ address:null, postFee:0, coupon:null, - sku_id:'' + sku_id:'', + kjId:null }, /** @@ -21,15 +22,19 @@ Page({ */ onLoad: function (options) { this.setData({ - product:app.globalData.postProduct, - from:options.from + from:options.from, + kjId:app.globalData.kjId }) let price = 0,sku_id=[]; app.globalData.postProduct.map(item=>{ + if(app.globalData.kjId){ + item.sku.price = 0; + } price = price + item.sku.price * item.productNum; sku_id.push(item.sku.id) }) this.setData({ + product:app.globalData.postProduct, showPrice:price, sku_id:sku_id.join(",") }) @@ -114,7 +119,8 @@ Page({ let data = { source:"WECHATXCX", product_list:product_list, - coupon:this.data.coupon?this.data.coupon.id:null + coupon:this.data.coupon?this.data.coupon.id:null, + originate_order_id:this.data.kjId }; commonApi.user_post("order/create",{ data:JSON.stringify(data) @@ -195,7 +201,10 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload: function () { - + this.setData({ + kjId:null + }); + app.globalData.kjId = null; }, /** diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml index fe39bbb..5db3486 100644 --- a/pages/order/postOrder/index.wxml +++ b/pages/order/postOrder/index.wxml @@ -21,9 +21,9 @@ 购票数量 - + {{item.productNum}} - + 运费 diff --git a/pages/pbService/appreciate/info/index.js b/pages/pbService/appreciate/info/index.js index 1464077..09742fd 100644 --- a/pages/pbService/appreciate/info/index.js +++ b/pages/pbService/appreciate/info/index.js @@ -1,4 +1,5 @@ // pages/pbService/appreciate/info/index.js +import commonApi from "../../../../utils/https/common" Page({ /** @@ -17,8 +18,51 @@ Page({ this.setData({ info:info }) + if(info.multimedia_url){ + commonApi._post("multimedia/viewsInc",{ + id:info.id + }).then(res=>{ + + }) + commonApi.user_post("multimedia/detail",{ + id:info.id + }).then(res=>{ + this.setData({ + info:res.data + }) + console.log(res) + }) + } console.log(info) }, + like:function(){ + let info = this.data.info; + commonApi.user_post("multimedia/favorite",{ + id:info.id + }).then(res=>{ + if(res.code==1){ + if(info.is_like==1){ + wx.showToast({ + title: '取消点赞成功', + icon:'success' + }) + info.is_like=0; + info.like_number--; + } + else { + wx.showToast({ + title: '点赞成功', + icon:'success' + }) + info.is_like=1; + info.like_number++; + } + this.setData({ + info:info + }) + } + }) + }, /** * 生命周期函数--监听页面初次渲染完成 diff --git a/pages/pbService/appreciate/info/index.wxml b/pages/pbService/appreciate/info/index.wxml index 32219bd..4288ac2 100644 --- a/pages/pbService/appreciate/info/index.wxml +++ b/pages/pbService/appreciate/info/index.wxml @@ -1,6 +1,12 @@ - + - - {{info.Name}} - + + {{info.Name || info.title}} + + + {{info.views}} + + {{info.like_number}} + + \ No newline at end of file diff --git a/pages/pbService/appreciate/info/index.wxss b/pages/pbService/appreciate/info/index.wxss index f4421be..491c4e9 100644 --- a/pages/pbService/appreciate/info/index.wxss +++ b/pages/pbService/appreciate/info/index.wxss @@ -3,4 +3,17 @@ font-size: 30rpx; color: #333; margin: 20rpx; +} +.video-bottom { + display: flex; + align-items: center; + color: #999999; + font-size: 20rpx; + margin: 20rpx; +} +.video-bottom .iconfont { + margin-right: 10rpx; +} +.icon-zan.active { + color: red; } \ No newline at end of file diff --git a/pages/pbService/index.wxml b/pages/pbService/index.wxml index 495f404..78cbea4 100644 --- a/pages/pbService/index.wxml +++ b/pages/pbService/index.wxml @@ -81,6 +81,9 @@ 垃圾分类 - + + + 博物馆查询 + \ No newline at end of file diff --git a/pages/pbService/museum/index.js b/pages/pbService/museum/index.js new file mode 100644 index 0000000..0863a09 --- /dev/null +++ b/pages/pbService/museum/index.js @@ -0,0 +1,109 @@ +// pages/pbService/museum/index.js +import commonApi from "../../../utils/https/common" +Page({ + + /** + * 页面的初始数据 + */ + data: { + keywords:"", + realKeywords:"", + list:[], + type:1, + page_no:1, + total:1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getList() + }, + getList:function(){ + if(this.data.list.length>=this.data.total) return; + commonApi._post("pbservice/Museum/getMuseumsByType",{ + page_no:this.data.page_no, + page_num:10, + search_key:this.data.realKeywords, + type:this.data.type + }).then(res=>{ + this.setData({ + total:res.data.total, + list:this.data.list.concat(res.data.rows), + page_no:this.data.page_no+1 + }) + }) + }, + changeKeyword:function(e){ + this.setData({ + keywords:e.detail.value + }) + }, + search:function(){ + this.setData({ + realKeywords:this.data.keywords, + list:[], + page_no:1, + total:1 + }) + this.getList(); + }, + changeType:function(e){ + this.setData({ + type:e.currentTarget.dataset.type, + list:[], + page_no:1, + total:1 + }) + this.getList(); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + 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/pbService/museum/index.json b/pages/pbService/museum/index.json new file mode 100644 index 0000000..35cf02f --- /dev/null +++ b/pages/pbService/museum/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader" + } +} \ No newline at end of file diff --git a/pages/pbService/museum/index.wxml b/pages/pbService/museum/index.wxml new file mode 100644 index 0000000..a48f5de --- /dev/null +++ b/pages/pbService/museum/index.wxml @@ -0,0 +1,31 @@ + + + + + + + 搜索 + + + 博物馆 + 陈列馆 + 纪念馆 + 美术馆 + + + + + + + {{item.name}} + + + {{item.phone}} + + + + {{item.address}} + + + +暂无数据 \ No newline at end of file diff --git a/pages/pbService/museum/index.wxss b/pages/pbService/museum/index.wxss new file mode 100644 index 0000000..ab4d483 --- /dev/null +++ b/pages/pbService/museum/index.wxss @@ -0,0 +1,114 @@ +/* pages/pbService/museum/index.wxss */ +page { + background: #EDEDED; +} +.search-top-box { + padding-top: 20rpx; + background: white; + position: fixed; + left: 0; + right: 0; + font-size: 26rpx; +} +.search-box { + display: flex; + margin: 0 30rpx; + justify-content: space-between; + height: 60rpx; + border-radius: 30rpx; + background: #ededed; + align-items: center; + padding-left: 20rpx; +} +.search-box .iconfont { + flex-shrink: 0; +} +.search-box input { + flex: 1; + width: 500rpx; + display: block; + margin: 0 20rpx; +} +.search-box .search-btn { + line-height: 40rpx; + width: 110rpx; + border-left: 1rpx solid #ccc; + text-align: center; + color: #0B898E; +} +.search-menus { + height: 95rpx; + margin: 0 30rpx; + margin-top: 5rpx; + display: flex; + justify-content: space-between; + align-items: center; +} +.search-menu { + position: relative; + line-height: 50rpx; + width: 25%; + text-align: center; +} +.search-menu.active { + color: #0B898E; +} +.search-menu.active::after { + content: "1"; + font-size: 0; + display: block; + position: absolute; + left: 50%; + background: #0B898E; + height: 4rpx; + border-radius: 2rpx; + width: 30rpx; + margin-left: -15rpx; + bottom: 0; +} +.item { + display: flex; + width: 690rpx; + height: 200rpx; + background: #FFFFFF; + border-radius: 20rpx; + margin: 20rpx 30rpx; + overflow: hidden; + color: #888888; + font-size: 26rpx; +} +.item image { + width: 200rpx; + height: 200rpx; + display: block; + flex-shrink: 0; + margin-right: 20rpx; +} +.item .icon-box { + display: flex; + align-items: center; + height: 50rpx; +} +.item .right-info { + flex: 1; + width: 430rpx; + margin-top: 20rpx; + margin-right: 20rpx; +} +.item .title { + font-size: 30rpx; + font-weight: bold; + color: #333; + margin-bottom: 30rpx; +} +.item .iconfont { + color: #0B898E; + margin-right: 10rpx; +} +.nodata { + text-align: center; + margin-top: 50rpx; + line-height: 50rpx; + font-size: 26rpx; + color: #999; +} \ No newline at end of file diff --git a/pages/pbService/museum/info/index.js b/pages/pbService/museum/info/index.js new file mode 100644 index 0000000..092ff59 --- /dev/null +++ b/pages/pbService/museum/info/index.js @@ -0,0 +1,74 @@ +// pages/pbService/museum/info/index.js +import commonApi from "../../../../utils/https/common" +Page({ + + /** + * 页面的初始数据 + */ + data: { + info:null + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + commonApi._post("pbservice/Museum/getDetail",{ + id:options.id + }).then(res=>{ + res.data.listimg = res.data.listimg?res.data.listimg.split(","):[]; + this.setData({ + info:res.data + }) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/pbService/museum/info/index.json b/pages/pbService/museum/info/index.json new file mode 100644 index 0000000..35cf02f --- /dev/null +++ b/pages/pbService/museum/info/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader" + } +} \ No newline at end of file diff --git a/pages/pbService/museum/info/index.wxml b/pages/pbService/museum/info/index.wxml new file mode 100644 index 0000000..8a68453 --- /dev/null +++ b/pages/pbService/museum/info/index.wxml @@ -0,0 +1,27 @@ + + + + + + + + + + + + {{info.name}} + + + {{info.phone}} + + + + {{info.address}} + + 场馆详情 + + 接待时间 + + 交通路线 + + \ No newline at end of file diff --git a/pages/pbService/museum/info/index.wxss b/pages/pbService/museum/info/index.wxss new file mode 100644 index 0000000..308ffe2 --- /dev/null +++ b/pages/pbService/museum/info/index.wxss @@ -0,0 +1,45 @@ +/* pages/pbService/museum/info/index.wxss */ +.mainimg { + display: block; + width: 100%; + height: 300rpx; +} +.swiper { + width: 100%; + height: 300rpx; + margin-bottom: 30rpx; +} +.content { + padding: 20rpx; + color: #666666; + font-size: 28rpx; +} +page { + background: white; +} +.title { + font-size: 36rpx; + font-weight: bold; + color: #333; + margin-bottom: 10rpx; +} +.tips { + display: flex; + align-items: center; + height: 50rpx; +} +.tips .iconfont { + flex-shrink: 0; + margin-right: 10rpx; + color: #999; +} +.subtitle { + padding-left: 20rpx; + border-left: 6rpx solid #0F9095; + line-height: 30rpx; + color: #333; + font-size: 30rpx; + font-weight: bold; + margin-top: 40rpx; + margin-bottom: 20rpx; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json index 65cd319..9f22940 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 35d3742..be92d25 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -15,12 +15,12 @@ { "name": "pages/kj/index", "pathName": "pages/kj/index", - "query": "tid=59532104301613182765&type=ticket", + "query": "id=203", "scene": null }, { - "name": "pages/kj/info/index", - "pathName": "pages/kj/info/index", + "name": "pages/activity/graduate/index", + "pathName": "pages/activity/graduate/index", "query": "id=5", "scene": null }, diff --git a/utils/https.js b/utils/https.js index dd5a38b..ebfd83b 100644 --- a/utils/https.js +++ b/utils/https.js @@ -1,8 +1,8 @@ var app = getApp(); import util from "../utils/util" import userApi from "../utils/https/user.js"; -// const baseUrl = "https://js-tript-test.xmainc.com"; -const baseUrl = "https://api.cloud.sz-trip.com/api/"; +const baseUrl = "https://test.api.cloud.sz-trip.com/api/"; +// const baseUrl = "https://api.cloud.sz-trip.com/api/"; const orders = ['','weight','distance','sale_number','sale_price','price']; //封装GET请求 function _get(url,data) { diff --git a/utils/util.js b/utils/util.js index 17518e3..e02d35e 100644 --- a/utils/util.js +++ b/utils/util.js @@ -1,4 +1,5 @@ var app = getApp() +import commonApi from "./https/common" const formatTime = date => { const year = date.getFullYear() const month = date.getMonth() + 1 @@ -315,6 +316,25 @@ const gotoOrder = function(item){ return; } } +// 砍价的去下单 +const goKjOrder = function(item) { + return new Promise((resolve,reject)=>{ + commonApi._post("product/get_product_detail",{ + id:item.goods_id + }).then(res=>{ + let product = [{ + product:res.data, + sku:res.data.sku.find(s=>s.id==item.sku_id), + productNum:1 + }]; + // 因为util里面不好改app.globalData的数据 但是下单是把产品信息先保存到globalData的 所以只能在页面内操作 + // 购买 只能把产品信息回传过去 可能还要改 暂时先回传整个的 + resolve(product); + }).catch(err=>{ + reject(err) + }) + }) +} module.exports = { formatTime: formatTime, formatNumber: formatNumber, @@ -327,5 +347,6 @@ module.exports = { dateToText:dateToText, gotoDetail:gotoDetail, gotoOrder:gotoOrder, - orderMoreTime:orderMoreTime + orderMoreTime:orderMoreTime, + goKjOrder:goKjOrder }