Browse Source

更新下

master
Myth 5 years ago
parent
commit
7370e4cfbe
  1. 6
      app.json
  2. 83
      pages/kj/his/index.js
  3. 5
      pages/kj/his/index.json
  4. 10
      pages/kj/his/index.wxml
  5. 33
      pages/kj/his/index.wxss
  6. 322
      pages/kj/index.js
  7. 5
      pages/kj/index.json
  8. 76
      pages/kj/index.wxml
  9. 184
      pages/kj/index.wxss
  10. 376
      pages/kj/info/index.js
  11. 5
      pages/kj/info/index.json
  12. 105
      pages/kj/info/index.wxml
  13. 241
      pages/kj/info/index.wxss
  14. 66
      pages/kj/mine/index.js
  15. 3
      pages/kj/mine/index.json
  16. 2
      pages/kj/mine/index.wxml
  17. 1
      pages/kj/mine/index.wxss
  18. 8
      pages/order/components/date/index.js
  19. 2
      pages/order/components/date/index.wxml
  20. 1
      pages/order/scene/index.js
  21. 14
      pages/user/order/list.js
  22. 2
      pages/user/order/list.wxml
  23. 15
      pages/user/order/museumOrderInfo/index.js
  24. 2
      pages/user/order/museumOrderInfo/index.wxml
  25. 14
      project.private.config.json

6
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": {

83
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 () {
}
})

5
pages/kj/his/index.json

@ -0,0 +1,5 @@
{
"usingComponents": {
"title":"/pages/component/TitleHeader"
}
}

10
pages/kj/his/index.wxml

@ -0,0 +1,10 @@
<!--pages/info/pddInfo/pddhis/index.wxml-->
<title title="帮砍记录"></title>
<view class="his-item" wx:for="{{list}}">
<image src="{{item.helpUserAvatar}}" mode="aspectFill"></image>
<view class="his-info">
<view class="username">{{item.help_user_name}}</view>
<view class="his-time">{{item.created_time}}</view>
</view>
<view class="money">-¥{{item.bargined_money/100}}</view>
</view>

33
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;
}

322
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 () {
}
})

5
pages/kj/index.json

@ -0,0 +1,5 @@
{
"usingComponents": {
"title":"/pages/component/TitleHeader"
}
}

76
pages/kj/index.wxml

@ -0,0 +1,76 @@
<!--pages/user/pdd/index.wxml-->
<title title="我的砍价"></title>
<view class="top-menus">
<view class="top-menu{{type==1?' active':''}}" bindtap="changeType" data-type="1">进行中</view>
<view class="top-menu{{type==2?' active':''}}" bindtap="changeType" data-type="2">活动预热</view>
</view>
<view class="list" wx:if="{{type==1}}">
<view class="top-line-box">我参与的活动</view>
<navigator class="item" wx:for="{{mineList}}" wx:key="id" url="/pages/info/pddInfo/index?userid={{item.originateUserId}}&id={{item.id}}">
<view class="item-top">
<image src="{{item.headimg}}" mode="aspectFill"></image>
<view class="item-info">
<view class="item-info-top">
<view class="item-title">{{item.title+item.sku_name}}</view>
<view class="item-price">¥{{item.kjMoney/100}}</view>
</view>
<view class="item-info-bottom">
<view class="item-info-time" wx:if="{{item.isOver}}">已结束</view>
<view class="item-info-time" wx:else><text>{{item.timeText}}</text>后结束</view>
<view class="info-btn{{item.isOver?' disable':''}}">{{item.isOver?'已结束':'继续砍价'}}</view>
</view>
</view>
</view>
</navigator>
<view wx:if="{{mineAllList.length>2}}" class="morebtn" bindtap="showMineMore">{{showMoreFlag?'点击收起':'点击查看更多'}}</view>
<view wx:if="{{mineAllList.length==0}}" style="font-size:24rpx;color:#fff;text-align:center;line-height:100rpx">暂无活动</view>
<view class="top-line-box">更多砍价活动</view>
<view class="menu-box">
<view bindtap="changeMenu" data-index="{{index}}" class="menu-item{{menuIndex==index?' active':''}}" wx:for="{{menuList}}" wx:key="id">{{item.act_name}}</view>
</view>
<view class="item" wx:for="{{list}}" wx:key="id" style="margin:0 30rpx;border-radius:0;border-bottom:1rpx solid #ccc" bindtap="gotoDetail" data-index="{{index}}" data-id="{{item.id}}" data-aid="{{item.actId}}" data-sid="{{item.skuId}}">
<view class="item-top">
<image src="{{item.headimg}}" mode="aspectFill"></image>
<view class="item-info">
<view class="item-info-top">
<view class="item-title">{{item.title+""+item.sku_name}}</view>
<view class="item-price">¥{{item.kj_money/100}}</view>
</view>
<view class="item-info-bottom">
<view class="item-info-time">剩余库存:{{item.act_stock}}</view>
<view class="info-btn disable" wx:if="{{item.buy_status=='end'}}">已购买</view>
<view class="info-btn" wx:elif="{{item.buy_status=='over'}}">前往下单</view>
<view class="info-btn disable" wx:elif="{{item.act_stock==0}}">售罄</view>
<view class="info-btn" wx:else>砍价免费领</view>
</view>
</view>
</view>
</view>
<view class="item" wx:if="{{list.length==0}}" style="margin:0 30rpx;border-radius:0;border-bottom:1rpx solid #ccc">
<view style="width:100%;line-height:100rpx;text-align:center">暂无砍价产品</view>
</view>
</view>
<view class="list" wx:if="{{type==2}}" wx:for="{{nextList}}" wx:key="id">
<view class="top-line-box">{{item.act_name}}</view>
<view wx:for="{{item.showList}}" wx:key="id" style="border-radius:20rpx !important" class="item" bindtap="nextShowInfo">
<view class="item-top">
<image src="{{item.headimg}}" mode="aspectFill"></image>
<view class="item-info">
<view class="item-info-top">
<view class="item-title">{{item.title+item.sku_name}}</view>
<view class="item-price">¥{{item.kj_money/100}}</view>
</view>
<view class="item-info-bottom">
<view class="item-info-time"></view>
<view class="info-btn">砍价</view>
</view>
</view>
</view>
</view>
<view wx:if="{{item.showList.length>2}}" class="morebtn" bindtap="showMore" data-index="{{index}}">{{item.showMoreFlag?'点击收起':'点击查看更多'}}</view>
<view wx:if="{{nextList.length==0}}" style="font-size:24rpx;color:#fff;text-align:center;line-height:100rpx">暂无活动</view>
</view>
<navigator url="/pages/user/pdd/index" class="mine-btn">
<view>我的</view>
<view>砍价</view>
</navigator>

184
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;
}

376
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;
}
})

5
pages/kj/info/index.json

@ -0,0 +1,5 @@
{
"usingComponents": {
"title":"/pages/component/TitleHeader"
}
}

105
pages/kj/info/index.wxml

@ -0,0 +1,105 @@
<!--pages/kj/info/index.wxml-->
<title title="砍价详情"></title>
<view class="content" wx:if="{{info}}">
<view class="top-info" wx:if="{{info.user_record && info.user_record.over_time && info.isOver}}">
<image src="{{info.user_record.user_avatar}}" mode="aspectFill"></image>
<view class="time-tip time-tip1">已结束</view>
<view class="rule-box" bindtap="showRule">活动规则</view>
</view>
<view class="top-info" wx:elif="{{info.user_record && info.user_record.over_time}}">
<image src="{{info.user_record.user_avatar}}" mode="aspectFill"></image>
<view class="time-box">{{info.h}}</view>
<view class="time-tip">:</view>
<view class="time-box">{{info.m}}</view>
<view class="time-tip">:</view>
<view class="time-box">{{info.s}}</view>
<view class="time-tip time-tip1">后结束</view>
<view class="rule-box" bindtap="showRule">活动规则</view>
</view>
<view wx:else style="height:30rpx"></view>
<view class="info-box">
<view class="info-tip">砍至0元可进行购买</view>
<image src="{{info.detail.headimg}}" mode="aspectFill"></image>
<view class="info">
<view class="info-top">
<view class="info-top-left">
<view class="info-title">{{info.detail.title+info.detail.sku_name}}</view>
<view class="info-price">¥{{info.detail.kj_money/100}}</view>
</view>
<view class="info-top-right">
<navigator url="../{{info.baseInfo.frontShowModel=='line'?'p':(info.baseInfo.frontShowModel=='ctriphotel'?'hotelP':'skuP')}}roductInfo/index?id={{info.baseInfo.frontShowModel=='ctriphotel'?info.baseInfo.winesceneId:info.baseInfo.productId}}" class="info-more">查看详情 ></navigator>
<view class="info-num">数量:1</view>
</view>
</view>
<view class="info-progress">
<view class="info-progress-text">已砍<text class="info-progress-num1">¥{{info.user_record.bargined_money/100}}</text><text>剩余</text><text class="info-progress-num">¥{{(info.detail.kj_money-info.user_record.bargined_money)/100}}</text></view>
<view class="info-progress-bg">
<view class="info-progress-top" style="width:{{info.user_record.bargined_money/info.detail.kj_money*100}}%"></view>
</view>
</view>
<!-- 砍价未发起的时候 -->
<view wx:if="{{isKj==false && !info.user_record.id}}">
<view class="info-btns" style="border:none">
<view class="info-btn-kan" bindtap="startKj">发起活动,喊好友砍一刀</view>
</view>
<view class="faqi-tip">点击上方“发起活动”按钮,邀请好友来砍价!</view>
<view class="buy-tip" bindtap="gotoDetail">原价购买 >></view>
</view>
<!-- 砍价已发起未结束的时候 -->
<view wx:if="{{isKj==false && info.user_record && info.user_record.flag=='ing'}}">
<view class="info-btns" style="border:none">
<button class="info-btn-kan" open-type="share">喊好友砍一刀</button>
</view>
<view class="faqi-tip" wx:if="{{info.detail.alert_num}}">预计再邀请<text style="color:#E14135;font-size:30rpx;font-weight:bold;margin:0 5rpx">{{info.detail.alert_num}}</text>人后砍价完成</view>
<view class="buy-tip" bindtap="gotoDetail">原价购买 >></view>
</view>
<!-- 帮好友砍价前 -->
<view class="info-btns" style="border:none" wx:if="{{isKj && info.isHelp==false}}">
<view class="info-btn-kan" bindtap="kanjia">帮好友砍一刀</view>
</view>
<!-- 帮好友砍价后 -->
<view wx:if="{{isKj && info.isHelp}}" class="info-btns" style="border:none;background: rgba(255, 145, 36, 0.3);">
<view class="info-disable-btn" style="background: linear-gradient(0deg, #E14135, #FF9124);">已帮好友砍价!</view>
<view class="info-btn" bindtap="join">我也要参与 >></view>
</view>
<!-- 砍价成功的时候 -->
<view wx:if="{{isKj==false && info.user_record && info.user_record.flag=='over'}}" class="info-btns" style="border:none;background: rgba(255, 145, 36, 0.3);">
<view class="info-disable-btn" style="background: linear-gradient(0deg, #E14135, #FF9124);">恭喜已砍成!</view>
<view class="info-btn" bindtap="gotoDetail">前往填写订单 >></view>
</view>
<!-- 砍价失败的时候 -->
<view wx:if="{{isKj==false && info.user_record && (info.user_record.flag=='fail' || info.user_record.flag=='expired')}}" class="info-btns">
<view class="info-disable-btn">{{info.user_record.failMsg || '砍价失败'}}</view>
<view class="info-btn" bindtap="gotoDetail" data-type='fail'>继续购买 >></view>
</view>
</view>
</view>
<view class="kanjia-his" wx:if="{{info.user_record && info.user_record.id && helpList && helpList.length>0}}">
<view class="kanjia-title-box">
<view class="kanjia-line"></view>
<view class="kanjia-title">帮砍记录</view>
<navigator url="../his/index?id={{info.user_record.id}}" class="kanjia-tip">{{info.user_record.bargined_num}}人已帮砍 ></navigator>
</view>
<view class="kanjia-list">
<view class="kanjia-item" wx:for="{{helpList}}">
<image src="{{item.helpUserAvatar}}" mode="aspectFill"></image>
<view class="username">{{item.help_user_name}}</view>
<view class="userprice">-¥{{item.bargined_money/100}}</view>
</view>
</view>
</view>
</view>
<view class="mask" wx:if="{{info && showRuleFlag}}">
<view class="mask-bg" bindtap="showRule"></view>
<view class="mask-content" style="padding:20rpx;max-height:50%;overflow-y:auto;min-height:30%;">
<rich-text nodes="{{info.act.rule_content}}"></rich-text>
</view>
</view>
<view class="mask" wx:if="{{showShareFlag}}">
<view class="mask-bg" bindtap="hideShare"></view>
<view class="mask-content" style="width:500rpx;overflow:hidden;text-align:center;color:#E14135;padding:40rpx 0;">
<view>请先关注公众号</view>
<image bindlongpress="saveImg" style="width:260rpx;height:260rpx;display:block;margin:40rpx auto;border-radius:10rpx;border:1rpx solid" src="https://resources.jszhwlpt.com/d3c2d106-b893-474f-bf5c-091bd04f247f.jpeg" mode="aspectFill" class="codeimg"></image>
<view style="color:#333">长按保存二维码</view>
</view>
</view>

241
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;
}

66
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 () {
}
})

3
pages/kj/mine/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
pages/kj/mine/index.wxml

@ -0,0 +1,2 @@
<!--pages/kj/mine/index.wxml-->
<text>pages/kj/mine/index.wxml</text>

1
pages/kj/mine/index.wxss

@ -0,0 +1 @@
/* pages/kj/mine/index.wxss */

8
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){
// 获取价格日历

2
pages/order/components/date/index.wxml

@ -25,7 +25,7 @@
</view>
</view>
<view class="date-times" wx:if="{{timelist.length>0}}">
<view bindtap="selectTime" data-index="{{index}}" wx:for="{{timelist}}" class="textOver date-time{{timeIndex==index?' active':''}}{{item.stock_number>0?'':' disable'}}">{{item.start_time}}-{{item.end_time}}{{item.stock_number==-1?'无限':('余票'+item.stock_number)}})</view>
<view bindtap="selectTime" data-index="{{index}}" wx:for="{{timelist}}" class="textOver date-time{{timeIndex==index?' active':''}}{{item.stock_number>0?'':' disable'}}">{{item.start_time}}-{{item.end_time}}<text wx:if="{{isSzMuseum && (item.stock_number>10 || item.stock_number==-1)}}"> 有票</text><text wx:else>({{item.stock_number==-1?'无限':('余票'+item.stock_number)}})</text></view>
<!-- <view class="date-time disable">09:00-10:00(余票0)</view> -->
<!-- <view class="date-time">09:00-10:00(余票0)</view> -->
<!-- <view class="date-time">09:00-10:00(余票0)</view> -->

1
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

14
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,17 +109,25 @@ 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)
})
})
})
})
},

2
pages/user/order/list.wxml

@ -21,7 +21,7 @@
<view class="order-item" bindtap="gotoDetail" data-item="{{item}}" wx:for="{{list}}">
<view class="order-top">
<text>订单号:{{item.order_id}}</text>
<text class="status">{{orderState[item.state]}}</text>
<text class="status">{{item.orderStateText?item.orderStateText:orderState[item.state]}}</text>
</view>
<view data-item="{{item}}" class="order-info" wx:for="{{item.order_product_list}}">
<image src="{{item.product_model=='movie'?item.product_img:item.sku_headimg}}" mode="aspectFill"></image>

15
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,

2
pages/user/order/museumOrderInfo/index.wxml

@ -3,7 +3,7 @@
<title title="订单详情"></title>
<view class="top-bg"></view>
<canvas wx:for="{{info.order_product_list[0].qrcode}}" class="code-img" style="position:absolute;z-index:-1;" canvas-id="damocode{{index}}"></canvas>
<view class="state-text" wx:if="{{info}}">{{productState[info.order_product_list[0].state]}}</view>
<view class="state-text" wx:if="{{info}}">{{info.orderStateText || productState[info.order_product_list[0].state]}}</view>
<view class="code-box box" wx:if="{{info && codeImgs.length>0}}">
<view bindtap="prevCodeImg" class="iconfont icon-you-copy"></view>
<view wx:for="{{info.order_product_list[0].qrcode}}" wx:if="{{codeIndex==index && codeImgs[codeIndex]}}">

14
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
}

Loading…
Cancel
Save