From 7370e4cfbef212ed1e477e812f0896046af8d814 Mon Sep 17 00:00:00 2001 From: Myth Date: Fri, 21 May 2021 17:28:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 6 +- pages/kj/his/index.js | 83 +++++ pages/kj/his/index.json | 5 + pages/kj/his/index.wxml | 10 + pages/kj/his/index.wxss | 33 ++ pages/kj/index.js | 322 +++++++++++++++++ pages/kj/index.json | 5 + pages/kj/index.wxml | 76 ++++ pages/kj/index.wxss | 184 ++++++++++ pages/kj/info/index.js | 376 ++++++++++++++++++++ pages/kj/info/index.json | 5 + pages/kj/info/index.wxml | 105 ++++++ pages/kj/info/index.wxss | 241 +++++++++++++ pages/kj/mine/index.js | 66 ++++ pages/kj/mine/index.json | 3 + pages/kj/mine/index.wxml | 2 + pages/kj/mine/index.wxss | 1 + pages/order/components/date/index.js | 8 +- pages/order/components/date/index.wxml | 2 +- pages/order/scene/index.js | 1 + pages/user/order/list.js | 20 +- pages/user/order/list.wxml | 2 +- pages/user/order/museumOrderInfo/index.js | 15 + pages/user/order/museumOrderInfo/index.wxml | 2 +- project.private.config.json | 14 +- 25 files changed, 1571 insertions(+), 16 deletions(-) create mode 100644 pages/kj/his/index.js create mode 100644 pages/kj/his/index.json create mode 100644 pages/kj/his/index.wxml create mode 100644 pages/kj/his/index.wxss create mode 100644 pages/kj/index.js create mode 100644 pages/kj/index.json create mode 100644 pages/kj/index.wxml create mode 100644 pages/kj/index.wxss create mode 100644 pages/kj/info/index.js create mode 100644 pages/kj/info/index.json create mode 100644 pages/kj/info/index.wxml create mode 100644 pages/kj/info/index.wxss create mode 100644 pages/kj/mine/index.js create mode 100644 pages/kj/mine/index.json create mode 100644 pages/kj/mine/index.wxml create mode 100644 pages/kj/mine/index.wxss diff --git a/app.json b/app.json index 980412d..96d8e65 100644 --- a/app.json +++ b/app.json @@ -118,7 +118,11 @@ "pages/activity/spring2021/index", "pages/activity/springten/list/index", "pages/activity/springten/index", - "pages/activity/newarrival/index" + "pages/activity/newarrival/index", + "pages/kj/index", + "pages/kj/his/index", + "pages/kj/info/index", + "pages/kj/mine/index" ], "permission": { "scope.userLocation": { diff --git a/pages/kj/his/index.js b/pages/kj/his/index.js new file mode 100644 index 0000000..bf58ddb --- /dev/null +++ b/pages/kj/his/index.js @@ -0,0 +1,83 @@ +// pages/info/pddInfo/pddhis/index.js +import productApi from "../../../utils/https/common" +Page({ + + /** + * 页面的初始数据 + */ + data: { + list:[], + page:1, + total:1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + id:options.id + }) + this.getList() + }, + getList:function(){ + if(this.data.list.length==this.data.total) return; + productApi.user_post("activity.haggle/help_list?limit=10&id="+this.data.id+'&page='+this.data.page,{ + }).then(res=>{ + this.setData({ + list:this.data.list.concat(res.data.data), + page:this.data.page+1, + total:res.data.total + }) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + 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/kj/his/index.json b/pages/kj/his/index.json new file mode 100644 index 0000000..35cf02f --- /dev/null +++ b/pages/kj/his/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader" + } +} \ No newline at end of file diff --git a/pages/kj/his/index.wxml b/pages/kj/his/index.wxml new file mode 100644 index 0000000..827f5d6 --- /dev/null +++ b/pages/kj/his/index.wxml @@ -0,0 +1,10 @@ + + + + + + {{item.help_user_name}} + {{item.created_time}} + + -¥{{item.bargined_money/100}} + \ No newline at end of file diff --git a/pages/kj/his/index.wxss b/pages/kj/his/index.wxss new file mode 100644 index 0000000..43d5900 --- /dev/null +++ b/pages/kj/his/index.wxss @@ -0,0 +1,33 @@ +/* pages/info/pddInfo/pddhis/index.wxss */ +page { + background: #E14135; +} +.his-item { + margin: 20rpx 30rpx; + border-radius: 20rpx; + background: white; + display: flex; + justify-content: space-between; + align-items: center; + padding: 33rpx; + font-size: 30rpx; +} +.his-item .money { + color: #E14135; + flex-shrink: 0; +} +.his-info { + flex: 1; +} +.his-item image { + width: 74rpx; + height: 74rpx; + border-radius: 50%; + display: block; + flex-shrink: 0; + margin-right: 12rpx; +} +.his-time { + font-size: 24rpx; + color: #999; +} \ No newline at end of file diff --git a/pages/kj/index.js b/pages/kj/index.js new file mode 100644 index 0000000..141a407 --- /dev/null +++ b/pages/kj/index.js @@ -0,0 +1,322 @@ +// pages/user/pdd/index.js +import productApi from "../../utils/https/common" +let timer = null,app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + type:1, + nextList:[], + menuList:[], + menuIndex:-1, + list:[], + mineList:[], + showMoreFlag:false, + mineAllList:[], + nextPage:1, + page:1, + nextTotal:1, + total:1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // this.getMine(); + productApi.user_post("activity.haggle/get_act_list",{limit:100,page:1}).then(res=>{ + this.setData({ + menuList:res.data.data, + menuIndex:0 + }) + this.getList() + }) + }, + changeType:function(e){ + let type = e.currentTarget.dataset.type; + if(this.data.type==type) return; + this.setData({ + type:type, + nextPage:1, + page:1, + nextTotal:1, + total:1, + list:[], + nextList:[] + }) + this.onReachBottom() + }, + changeMenu:function(e){ + let index = e.currentTarget.dataset.index; + if(this.data.menuIndex==index) return; + this.setData({ + menuIndex:index, + page:1, + total:1, + list:[] + }) + this.getList() + }, + gotoDetail:function(e){ + let data = e.currentTarget.dataset; + if(data.index || data.index==0){ + let item = this.data.list[data.index]; + console.log(item) + // 已砍成已下单 + if(item.myOriginateFlag=='over' && item.isBuyed==1){ + 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 + }) + } + } + }) + 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' + }) + return; + } + let skuIndex = res.data.skuInfo.findIndex(skuItem=>skuItem.id==item.skuId); + if(skuIndex==-1) { + wx.showToast({ + title:"该产品规格不存在", + icon:'none' + }) + 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){ + 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 + }) + } + } + }) + return; + } + + } + wx.navigateTo({ + url:"info/index?id="+data.id+"&sid="+data.sid+"&aid="+data.aid + }) + }, + getMine:function(){ + productApi.user_post("kj/getMyKjIngProductsNeedAuth",{}).then(res=>{ + this.setData({ + mineList:this.data.showMoreFlag?res.data:res.data.slice(0,2), + mineAllList:res.data + }) + this.setTime(); + timer = setInterval(()=>{ + this.setTime() + },1000) + }) + }, + getNext:function(){ + if(this.data.nextTotal==this.data.nextList.length) return; + productApi.user_post("activity.haggle/get_warm_up",{ + limit:100, + page:this.data.nextPage + }).then(res=>{ + res.data.data.map(item=>{ + item.showMoreFlag = false; + item.showList = item.product.slice(0,2); + }) + this.setData({ + nextList:this.data.nextList.concat(res.data.data), + nextPage:this.data.nextPage+1, + nextTotal:res.data.total + }) + }) + }, + getList:function(){ + if(this.data.total==this.data.list.length) return; + let dataStr = this.getStrParams({ + act_id:this.data.menuList[this.data.menuIndex].id, + limit:100, + page:this.data.page + }) + productApi.user_post("activity.haggle/get_act_products"+dataStr,{ + + }).then(res=>{ + this.setData({ + list:this.data.list.concat(res.data.data), + page:this.data.page+1, + total:res.data.total + }) + }) + }, + showMore:function(e){ + let index = e.currentTarget.dataset.index,nextList=this.data.nextList; + nextList[index].showMoreFlag = !nextList[index].showMoreFlag; + if(nextList[index].showMoreFlag){ + item.showList = item.product; + } + else { + item.showList = item.product.slice(0,2); + } + this.setData({ + nextList:nextList + }) + }, + showMineMore:function(){ + this.setData({ + showMoreFlag:!this.data.showMoreFlag + }) + let mineList = this.data.mineAllList; + if(!this.data.showMoreFlag){ + mineList= mineList.slice(0,2); + } + this.setData({ + mineList:mineList + }) + }, + // 倒计时 + setTime:function(){ + let mineList = this.data.mineList,now = new Date().getTime(); + mineList.map(item=>{ + let overTime = new Date(item.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({ + mineList:mineList + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(this.data.mineList.length>0){ + this.setTime(); + timer = setInterval(()=>{ + this.setTime() + },1000) + } + if(this.data.menuIndex>-1){ + this.getMine(); + this.getList(); + } + }, + nextShowInfo:function(){ + wx.showModal({ + title:"提示", + content:"活动暂未开始", + confirmText:"我知道了", + confirmColor:"#E14135", + showCancel:false + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + if(timer){ + clearInterval(timer) + timer = null; + } + }, + getStrParams:function(data){ + let dataStr = []; + for(let i in data){ + dataStr.push(i+'='+data[i]); + } + return ("?"+dataStr.join("&")); + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + if(this.data.type==1){ + this.getList() + } + else { + this.getNext() + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/kj/index.json b/pages/kj/index.json new file mode 100644 index 0000000..35cf02f --- /dev/null +++ b/pages/kj/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader" + } +} \ No newline at end of file diff --git a/pages/kj/index.wxml b/pages/kj/index.wxml new file mode 100644 index 0000000..dad3a9c --- /dev/null +++ b/pages/kj/index.wxml @@ -0,0 +1,76 @@ + + + + 进行中 + 活动预热 + + + 我参与的活动 + + + + + + {{item.title+item.sku_name}} + ¥{{item.kjMoney/100}} + + + 已结束 + {{item.timeText}}后结束 + {{item.isOver?'已结束':'继续砍价'}} + + + + + {{showMoreFlag?'点击收起':'点击查看更多'}} + 暂无活动 + 更多砍价活动 + + {{item.act_name}} + + + + + + + {{item.title+""+item.sku_name}} + ¥{{item.kj_money/100}} + + + 剩余库存:{{item.act_stock}} + 已购买 + 前往下单 + 售罄 + 砍价免费领 + + + + + + 暂无砍价产品 + + + + {{item.act_name}} + + + + + + {{item.title+item.sku_name}} + ¥{{item.kj_money/100}} + + + + 砍价 + + + + + {{item.showMoreFlag?'点击收起':'点击查看更多'}} + 暂无活动 + + + 我的 + 砍价 + \ No newline at end of file diff --git a/pages/kj/index.wxss b/pages/kj/index.wxss new file mode 100644 index 0000000..61d4182 --- /dev/null +++ b/pages/kj/index.wxss @@ -0,0 +1,184 @@ +page { + background: #E14135; +} +.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; +} +.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; +} +.info-btn.disable { + background: #CCCCCC; + color: #fff; +} +.list { + padding-top: 80rpx; + padding-bottom: 20rpx; +} +.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; +} +.top-line-box { + display: flex; + color: #fff; + font-size: 30rpx; + justify-content: center; + align-items: center; + margin-top: 20rpx; +} +.top-line-box::before,.top-line-box::after { + content: "1"; + font-size: 0; + display: block; + width: 100rpx; + height: 2rpx; + background: #FFFFFF; + margin: 0 20rpx; +} +.morebtn { + width: 690rpx; + line-height: 60rpx; + background: #FFFFFF; + border-radius: 20rpx; + text-align: center; + color: #333333; + font-size: 26rpx; + margin: 20rpx auto; +} +.menu-box { + display: flex; + margin: 30rpx; + margin-bottom: 0; + overflow-x: auto; +} +.menu-item { + width: 228rpx; + flex-shrink: 0; + font-size: 26rpx; + background: #FFDEBD; + border-radius: 20rpx 20rpx 0px 0px; + text-align: center; + height: 80rpx; + display: flex; + align-items: center; + justify-content: center; + margin-right: 2rpx; +} +.menu-box .menu-item:last-child { + margin-right: 0; +} +.menu-item.active { + color: #E14135; + background: white; +} +.list .item:last-child { + border-radius: 0 0 20rpx 20rpx !important; + border: none; +} +.mine-btn { + width: 100rpx; + height: 100rpx; + background: #FF9124; + box-shadow: 0px 0px 14rpx 0px rgba(60, 4, 0, 0.35); + border-radius: 50%; + position: fixed; + right: 30rpx; + bottom: 80rpx; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + font-size: 30rpx; + color: #fff; + line-height: 34rpx; +} \ No newline at end of file diff --git a/pages/kj/info/index.js b/pages/kj/info/index.js new file mode 100644 index 0000000..e17d740 --- /dev/null +++ b/pages/kj/info/index.js @@ -0,0 +1,376 @@ +// pages/info/pddInfo/index.js +import productApi from "../../../utils/https/common"; +let app = getApp(); +let timer = null; +Page({ + + /** + * 页面的初始数据 + */ + data: { + info:null, + showRuleFlag:false, + kjId:null, + isKj:false,//是否是被邀请进来砍价的 本人去除 + isFollow:false,//是否已经关注公众号 + showShareFlag:false,//是否显示公众号的二维码 + userInfo:null, + helpList:[] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // 获取用户信息 后面的砍价接口和发起活动接口需要用到 + productApi.user_post("uservice/user/getMyInfo",{}).then(r=>{ + this.setData({ + userInfo:r.data + }) + let userid = r.data.id,service="activity.haggle/get_haggle_detail"; + // 如果不是当前用户并且打开了分享的页面的话 是砍价页面 + if(options.userid && userid && options.userid!=userid){ + this.setData({ + isKj:true + }) + } + else { + this.setData({ + isKj:false + }) + } + // 对于所有打开了分享页面的人来说 都调用的是邀请接口 + if(options.userid){ + service="activity.haggle/get_haggle_detail" + } + productApi.user_post(service+'?id='+options.id,{ + id:options.id + }).then(res=>{ + if(!res.data.user_record || !res.data.user_record.id){ + res.data.user_record = { + bargined_money:0 + } + } + this.setData({ + kjId:res.data.user_record.id + }) + // 判断是否助力过 + res.data.isHelp = false; + if(res.data.myHelpKj && res.data.myHelpKj.id){ + res.data.isHelp = true; + } + this.setData({ + info:res.data + }) + + // 只有发起了的活动才需要倒计时 + if(res.data.user_record.id && res.data.user_record.over_time){ + // 获取砍价记录 + productApi.user_post("activity.haggle/help_list?limit=10&page=1&id="+res.data.user_record.id,{ + limit:10, + page:1, + id:res.data.user_record.id + }).then(r=>{ + this.setData({ + helpList:r.data.data + }) + }) + this.setTime(); + timer = setInterval(()=>{ + this.setTime() + },1000) + // 判断是否是自己发起的活动 + if(res.data.user_record.user_id==userid){ + this.setData({ + isKj:false + }) + } + if(this.data.isKj){ + // 发起者状态是砍价完成,提示用户:我已经砍价完成了,你也快来试试吧,点击否停留当前页面,点击是,跳转砍价专区 + if(res.data.user_record.flag=='over'){ + wx.showModal({ + title:"提示", + content:"我已经砍价完成了,你也快来试试吧,点击否停留当前页面", + success:function(r){ + if(r.confirm){ + wx.redirectTo({ + url: '/pages/list/kj/index' + }) + } + } + }) + } + // 如果状态是砍价失败,提示用户:{发起者昵称}发起的砍价活动已结束,你也快来试试吧,点击否返回商城首页,点击是,跳转砍价专区 + else if(res.data.originOriginateInfo.flag=='fail' || res.data.originOriginateInfo.flag=='expired'){ + wx.showModal({ + title:"提示", + content:res.data.user_record.user_phone+"发起的砍价活动已结束,你也快来试试吧", + success:function(r){ + if(r.confirm){ + wx.redirectTo({ + url: '/pages/list/kj/index' + }) + } + else { + wx.reLaunch({ + url: '/pages/index/index', + }) + } + } + }) + } + } + } + }) + }) + + }, + // 如果已经发起活动的话需要倒计时 + setTime(){ + let info = this.data.info; + let overTime = new Date(info.user_record.over_time.replace(/-/g,'/')).getTime(),now = new Date().getTime(); + if(overTime<=now){ + info.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; + } + info.h = h; + info.m = m; + info.s = s; + } + this.setData({ + info:info + }) + }, + // 隐藏关注二维码 + hideShare:function(){ + this.setData({ + showShareFlag:false + }) + }, + // 保存二维码到手机 + saveImg:function(){ + wx.downloadFile({ + url: 'https://resources.jszhwlpt.com/d3c2d106-b893-474f-bf5c-091bd04f247f.jpeg', + success:function(res){ + wx.saveImageToPhotosAlbum({ + filePath: res.tempFilePath + }) + } + }) + + }, + // 隐藏或显示活动规则 + showRule:function(){ + this.setData({ + showRuleFlag:!this.data.showRuleFlag + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(this.data.info && this.data.info.originOriginateInfo && this.data.info.originOriginateInfo.id){ + this.setTime(); + timer = setInterval(()=>{ + this.setTime() + },1000) + } + productApi.user_post("wx/get_user_keep",{}).then(res=>{ + this.setData({ + isFollow:res.data.subscribe==1 + }) + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + clearInterval(timer); + timer = null; + }, + // 详情和下单的第一步 + gotoDetail:function(e){ + let info = this.data.info.baseInfo || null,type=e.currentTarget.dataset.type; + if(!info) return; + if(type=='fail'){ + wx.showModal({ + title:"提示", + content:"您未砍价成功,是否原价购买", + confirmColor:"#E14135", + success:function(res){ + if(res.confirm){ + this.pushOrderData() + } + } + }) + } + else { + this.pushOrderData() + } + }, + // 真实的获取产品信息去下单 + pushOrderData:function(){ + productApi._get('productfront/getProductInfo',{ + productId:this.data.info.baseInfo.productId + }).then(res=>{ + if(!res.data){ + wx.showToast({ + title:"该产品不存在或已下架", + icon:'none' + }) + return; + } + let skuIndex = res.data.skuInfo.findIndex(item=>item.id==this.data.info.baseInfo.skuId); + if(skuIndex==-1) { + wx.showToast({ + title:"该产品规格不存在", + icon:'none' + }) + return; + } + let sku = res.data.skuInfo[skuIndex]; + app.globalData.shoppingCart=[{ + baseInfo:res.data.baseInfo, + modelInfo:sku.modelInfo, + skuInfo:sku, + productNum:1 + }]; + if(this.data.info.originOriginateInfo.flag=='over'){ + app.globalData.kjOrderId = this.data.info.originOriginateInfo.id || null; + } + else { + app.globalData.kjOrderId = null; + } + app.globalData.discounts = 0; + wx.navigateTo({ + url: '../../order/index', + }) + }) + }, + // 帮好友砍一刀 + kanjia:function(){ + if(!this.data.isFollow){ + // 未关注需要先关注公众号 + this.setData({ + showShareFlag:true + }) + return; + } + let userInfo = this.data.userInfo,info = this.data.info; + productApi.user_post("activity.haggle/help_bargain",{ + originate_id:info.user_record.id + }).then(res=>{ + if(res.code==200){ + wx.showToast({ + title: '砍价成功', + icon:'success' + }) + this.onLoad({userid:info.user_record.user_id,id:info.user_record.id}) + } + }) + }, + // 发起砍价 + startKj:function(){ + if(!this.data.isFollow){ + // 未关注需要先关注公众号 + this.setData({ + showShareFlag:true + }) + return; + } + let info = this.data.info; + let userInfo = this.data.userInfo; + productApi.user_post('activity.haggle/bargain_launch',{ + act_id:info.detail.act_id, + id:info.detail.id + }).then(res=>{ + if(res.code==1){ + wx.showToast({ + title: '发起成功', + icon:'success' + }) + this.onLoad({id:info.detail.id}) + } + }) + }, + // 喊好友砍一刀 + shareHelp:function(){ + + }, + // 我也要参与 + join:function(){ + this.onLoad({id:this.data.info.baseInfo.id}); + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + let kjId = this.data.kjId,info = this.data.info; + let shareObj = { + title: kjId?"就差你这一刀了,快来帮帮我~":(info.detail.productName+info.detail.skuName), // 默认是小程序的名称(可以写slogan等) + path: kjId?('/pages/kj/info/index?userid='+info.user_record.user_id+'&id='+kjId):('/pages/kj/info/index?&id='+info.detail.id), // 默认是当前页面,必须是以‘/’开头的完整路径 + imageUrl: info.baseInfo.headImg, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 + success: function(res){ + // 转发成功之后的回调 + if(res.errMsg == 'shareAppMessage:ok'){ + wx.showToast({ + title: '转发成功,马上就要砍成了~', + }) + } + }, + fail: function(){ + // 转发失败之后的回调 + if(res.errMsg == 'shareAppMessage:fail cancel'){ + + }else if(res.errMsg == 'shareAppMessage:fail'){ + // 转发失败,其中 detail message 为详细失败信息 + } +    }, + }; + console.log(shareObj) + return shareObj; + } +}) \ No newline at end of file diff --git a/pages/kj/info/index.json b/pages/kj/info/index.json new file mode 100644 index 0000000..35cf02f --- /dev/null +++ b/pages/kj/info/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader" + } +} \ No newline at end of file diff --git a/pages/kj/info/index.wxml b/pages/kj/info/index.wxml new file mode 100644 index 0000000..5680549 --- /dev/null +++ b/pages/kj/info/index.wxml @@ -0,0 +1,105 @@ + + + + + + 已结束 + 活动规则 + + + + {{info.h}} + : + {{info.m}} + : + {{info.s}} + 后结束 + 活动规则 + + + + 砍至0元可进行购买 + + + + + {{info.detail.title+info.detail.sku_name}} + ¥{{info.detail.kj_money/100}} + + + 查看详情 > + 数量:1 + + + + 已砍¥{{info.user_record.bargined_money/100}}剩余¥{{(info.detail.kj_money-info.user_record.bargined_money)/100}} + + + + + + + + 发起活动,喊好友砍一刀 + + 点击上方“发起活动”按钮,邀请好友来砍价! + 原价购买 >> + + + + + + + 预计再邀请{{info.detail.alert_num}}人后砍价完成 + 原价购买 >> + + + + 帮好友砍一刀 + + + + 已帮好友砍价! + 我也要参与 >> + + + + 恭喜已砍成! + 前往填写订单 >> + + + + {{info.user_record.failMsg || '砍价失败'}} + 继续购买 >> + + + + + + + 帮砍记录 + {{info.user_record.bargined_num}}人已帮砍 > + + + + + {{item.help_user_name}} + -¥{{item.bargined_money/100}} + + + + + + + + + + + + + + 请先关注公众号 + + 长按保存二维码 + + \ No newline at end of file diff --git a/pages/kj/info/index.wxss b/pages/kj/info/index.wxss new file mode 100644 index 0000000..5136ef5 --- /dev/null +++ b/pages/kj/info/index.wxss @@ -0,0 +1,241 @@ +/* pages/kj/info/index.wxss */ +.top-info { + display: flex; + justify-content: space-between; + align-items: center; + color: #fff; + margin-bottom: 20rpx; +} +.content { + padding: 20rpx 30rpx; + font-size: 26rpx; +} +page { + background: #E14135; +} +.top-info image{ + width: 80rpx; + height: 80rpx; + background: #F2F2F2; + border-radius: 50%; + margin-right: 28rpx; + flex-shrink: 0; +} +.time-tip { + width: 30rpx; + text-align: center; +} +.time-box { + width: 50rpx; + line-height: 50rpx; + background: #FFFFFF; + border-radius: 10rpx; + text-align: center; + color: #333; +} +.time-tip1 { + flex:1; + width:300rpx; + text-align:left; + margin-left: 20rpx; +} +.rule-box { + width: 140rpx; + line-height: 50rpx; + background: #BF261B; + text-align:center; + color: #fff; + border-radius: 25rpx; +} +.info-box { + border-radius: 20rpx; + position: relative; + background: white; + overflow: hidden; +} +.info-box image { + width: 100%; + height: 340rpx; + display: block; +} +.info-tip { + width: 320rpx; + line-height: 40rpx; + background: #FF9124; + border-radius: 0 0 20rpx 20rpx; + text-align: center; + color:#fff; + position: absolute; + left: 50%; + margin-left: -160rpx; + top: 0; + z-index: 1; +} +.info { + padding: 0 30rpx; + padding-bottom: 50rpx; +} +.info-top { + display: flex; + padding: 20rpx 0; + justify-content: space-between; + border-bottom: 1rpx solid #d8d8d8; +} +.info-top-left { + flex: 1; + font-size: 30rpx; + line-height: 42rpx; + font-weight: bold; +} +.info-top-right { + flex-shrink: 0; + margin-left: 20rpx; +} +.info-num { + color: #666666; +} +.info-more { + font-size: 24rpx; + color: #FF9124; + margin-bottom: 10rpx; +} +.info-price { + color: #E14135; + margin-top: 10rpx; +} +.info-progress { + text-align: center; + font-size: 30rpx; + padding-top: 20rpx; + padding-bottom: 40rpx; +} +.info-progress-num { + color: #E14135; + font-size: 36rpx; + font-weight: bold; +} +.info-progress-num1 { + font-weight: bold; + margin-right: 20rpx; +} +.info-progress-bg { + position: relative; + margin-top: 20rpx; + width: 630rpx; + height: 30rpx; + background: #FFD6D3; + border-radius: 15rpx; +} +.info-progress-top { + position: absolute; + left: 0; + top: 0; + height: 30rpx; + background: linear-gradient(90deg, #E14135, #FF9124); + border-radius: 15rpx; + min-width: 30rpx; +} +.info-btns { + margin: 0 15rpx; + display: flex; + line-height: 80rpx; + background: #FFFFFF; + border: 2rpx solid #CCCCCC; + border-radius: 40rpx; + box-sizing: border-box; + height: 80rpx; + text-align: center; + font-weight: bold; +} +.info-btn-kan { + width: 600rpx; + border-radius: 40rpx; + line-height: 80rpx; + background: linear-gradient(0deg, #E14135, #FF9124); + color: #fff; + font-size: 30rpx; + padding: 0; +} +.info-disable-btn { + width: 360rpx; + background: linear-gradient(0deg, #8F8F8F, #C1C1C1); + border-radius: 40rpx; + color: #fff; + font-size: 30rpx; +} +.info-btn { + width: 240rpx; + color: #E14135; +} +.kanjia-title-box { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10rpx 0; +} +.kanjia-his { + padding: 0 20rpx; + border-radius: 20rpx; + background: white; + font-size: 24rpx; + margin-top: 20rpx; + padding-bottom: 36rpx; +} +.kanjia-line { + width: 6rpx; + height: 26rpx; + background: linear-gradient(0deg, #E14135, #FF9124); + border-radius: 3rpx; +} +.kanjia-title { + font-size: 30rpx; + font-weight: 500; + color: #333; + margin: 0 14rpx; + flex: 1; +} +.kanjia-tip { + color: #FF9124; +} +.kanjia-list { + display: flex; + overflow-x: auto; +} +.kanjia-item { + flex-shrink: 0; + margin-right: 30rpx; + width: 120rpx; + text-align: center; +} +.kanjia-item image { + display: block; + width: 80rpx; + height: 80rpx; + background: #F2F2F2; + border-radius: 50%; + margin: 0 auto; + margin-bottom: 10rpx; +} +.kanjia-item view { + white-space: nowrap; + width: 120rpx; + overflow: hidden; + text-overflow: ellipsis; +} +.userprice { + color: #E14135; +} +.faqi-tip { + margin-top: 14rpx; + color: #999; + font-size: 24rpx; + text-align: center; + line-height: 30rpx; +} +.buy-tip { + font-size: 26rpx; + font-weight: bold; + margin-top: 30rpx; + color: #E14135; + text-align: center; +} \ No newline at end of file diff --git a/pages/kj/mine/index.js b/pages/kj/mine/index.js new file mode 100644 index 0000000..06eea71 --- /dev/null +++ b/pages/kj/mine/index.js @@ -0,0 +1,66 @@ +// pages/kj/mine/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/kj/mine/index.json b/pages/kj/mine/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/kj/mine/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/kj/mine/index.wxml b/pages/kj/mine/index.wxml new file mode 100644 index 0000000..288de7e --- /dev/null +++ b/pages/kj/mine/index.wxml @@ -0,0 +1,2 @@ + +pages/kj/mine/index.wxml diff --git a/pages/kj/mine/index.wxss b/pages/kj/mine/index.wxss new file mode 100644 index 0000000..fd2b7ff --- /dev/null +++ b/pages/kj/mine/index.wxss @@ -0,0 +1 @@ +/* pages/kj/mine/index.wxss */ \ No newline at end of file diff --git a/pages/order/components/date/index.js b/pages/order/components/date/index.js index 361f275..771c269 100644 --- a/pages/order/components/date/index.js +++ b/pages/order/components/date/index.js @@ -27,13 +27,19 @@ Component({ showMoreDateFlag:false, moreFlag:true, timelist:[], - timeIndex:0 + timeIndex:0, + isSzMuseum:false }, lifetimes: { attached: function() { // 在组件实例进入页面节点树时执行 let product = app.globalData.product,today = util.formatDate(new Date()),end_date = util.formatDate(new Date(new Date().getTime() + 60 * 24 * 60 * 60 * 1000)); + if(product.product.title.indexOf("苏州博物馆")!=-1){ + this.setData({ + isSzMuseum:true + }) + } commonApi.user_post("token/check").then(res=>{ if(res.code==1){ // 获取价格日历 diff --git a/pages/order/components/date/index.wxml b/pages/order/components/date/index.wxml index 0695d36..977bf40 100644 --- a/pages/order/components/date/index.wxml +++ b/pages/order/components/date/index.wxml @@ -25,7 +25,7 @@ - {{item.start_time}}-{{item.end_time}}{{item.stock_number==-1?'无限':('余票'+item.stock_number)}}) + {{item.start_time}}-{{item.end_time}} 有票({{item.stock_number==-1?'无限':('余票'+item.stock_number)}}) diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 70f4fed..6cd7a5a 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -31,6 +31,7 @@ Page({ util.back(); return; } + console.log(app.globalData.product) this.setData({ product:app.globalData.product, singlePrice:app.globalData.product.sku.price diff --git a/pages/user/order/list.js b/pages/user/order/list.js index cdfddbe..4466ccd 100644 --- a/pages/user/order/list.js +++ b/pages/user/order/list.js @@ -92,6 +92,10 @@ Page({ let orderNum = 0; item.order_product_list.map(order=>{ orderNum = orderNum + order.product_num; + // 景点线路场馆酒店四类产品的订单 如果是已支付未出票的显示出票中 + if(order.state=='PAID' && (order.product_model=='venue' || order.product_model=='ticket' || order.product_model=='hotel' || order.product_model=='line')){ + item.orderStateText="出票中" + } }) if(item.order_product_list.length==1 && item.order_product_list[0].scene_id && item.state!='UNPAID' && item.state!='CLOSED' && item.state.indexOf("REFUND")==-1){ let ajax = commonApi.user_post("order/tripplan",{ @@ -105,15 +109,23 @@ Page({ } item.orderNum = orderNum; }) + console.log(ajaxes) + if(ajaxes.length==0){ + this.setData({ + total:res.data.total, + list:list.concat(res.data.list) + }) + return; + } Promise.all(ajaxes).then((r)=>{ r.map((item,index)=>{ if(item && item.data && item.data.url){ res.data.list[indexes[index]].guihuaUrl = item.data.url } - this.setData({ - total:res.data.total, - list:list.concat(res.data.list) - }) + }) + this.setData({ + total:res.data.total, + list:list.concat(res.data.list) }) }) diff --git a/pages/user/order/list.wxml b/pages/user/order/list.wxml index 359edd4..679be59 100644 --- a/pages/user/order/list.wxml +++ b/pages/user/order/list.wxml @@ -21,7 +21,7 @@ 订单号:{{item.order_id}} - {{orderState[item.state]}} + {{item.orderStateText?item.orderStateText:orderState[item.state]}} diff --git a/pages/user/order/museumOrderInfo/index.js b/pages/user/order/museumOrderInfo/index.js index 1057590..3293767 100644 --- a/pages/user/order/museumOrderInfo/index.js +++ b/pages/user/order/museumOrderInfo/index.js @@ -183,6 +183,21 @@ Page({ order.contacts_info = order.contacts_info?JSON.parse(order.contacts_info):[]; state = state + order.state; }) + if(state.indexOf('PAID')>-1 && res.data.state=='PAID'){ + res.data.orderStateText = "待出票"; + } + else if(state.indexOf('WAIT_USE')>-1 && res.data.state=='PAID'){ + res.data.orderStateText = "已出票"; + } + else if(state.indexOf('TICKET_ERROR')>-1){ + res.data.orderStateText = "出票失败"; + } + else if(res.data.state=='WAIT_REFUND'){ + res.data.orderStateText = "退票中"; + } + else if(res.data.state=='REFUND'){ + res.data.orderStateText = "已退票"; + } this.setData({ isRefund:state.indexOf("REFUND")!=-1, info:res.data, diff --git a/pages/user/order/museumOrderInfo/index.wxml b/pages/user/order/museumOrderInfo/index.wxml index 54c8422..9b7d80f 100644 --- a/pages/user/order/museumOrderInfo/index.wxml +++ b/pages/user/order/museumOrderInfo/index.wxml @@ -3,7 +3,7 @@ -{{productState[info.order_product_list[0].state]}} +{{info.orderStateText || productState[info.order_product_list[0].state]}} diff --git a/project.private.config.json b/project.private.config.json index 8b46003..35d3742 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -13,15 +13,15 @@ "miniprogram": { "list": [ { - "name": "支付成页面", - "pathName": "pages/order/payresult/index", + "name": "pages/kj/index", + "pathName": "pages/kj/index", "query": "tid=59532104301613182765&type=ticket", "scene": null }, { - "name": "五一", - "pathName": "pages/list/mayday/index", - "query": "", + "name": "pages/kj/info/index", + "pathName": "pages/kj/info/index", + "query": "id=5", "scene": null }, { @@ -55,8 +55,8 @@ "scene": null }, { - "name": "pages/list/strategy/index", - "pathName": "pages/list/strategy/index", + "name": "pages/pbService/web/index", + "pathName": "pages/pbService/web/index", "query": "id=10973", "scene": null }