@@ -23,11 +23,9 @@ | |||||
<view class="coupons-info-name subtitle sy">剩余: {{data.remainInventory}}</view> | <view class="coupons-info-name subtitle sy">剩余: {{data.remainInventory}}</view> | ||||
<!-- <text class="coupons-info-price-o"><text class='i'>¥</text>{{data.priceStr}}</text> --> | <!-- <text class="coupons-info-price-o"><text class='i'>¥</text>{{data.priceStr}}</text> --> | ||||
</view> | </view> | ||||
<i-button i-class="coupons-btn-gm" wx:if="{{data.type==4}}" data-date='{{data}}'>领取</i-button> | |||||
<i-button i-class="coupons-btn-gm" wx:elif="{{data.type == 1||data.type == 2||data.type==3||data.type==4}}" data-date='{{data}}'>购买</i-button> | |||||
<i-button i-class="coupons-btn-gm" wx:if="{{data.salePriceStr==0}}" data-date='{{data}}'>领取</i-button> | |||||
<i-button i-class="coupons-btn-gm" wx:elif="{{data.salePriceStr!=0}}" data-date='{{data}}'>购买</i-button> | |||||
</view> | </view> | ||||
<view class="coupons-border"></view> | <view class="coupons-border"></view> | ||||
</view> | </view> | ||||
</navigator> | |||||
<view class="loading" hidden="{{!searchLoading}}">正在载入更多...</view> | |||||
<view class="loading complete" hidden="{{!searchLoadingComplete}}">已加载全部</view> | |||||
</navigator> |
@@ -37,7 +37,7 @@ | |||||
</view> --> | </view> --> | ||||
<!-- 优惠券 --> | <!-- 优惠券 --> | ||||
<navigator wx:for="{{data.coupons}}" url="/pages/coupon/detail/index?id={{item.id}}"> | |||||
<navigator wx:for="{{data.coupons}}" wx:key="{{index}}" url="/pages/coupon/detail/index?id={{item.id}}"> | |||||
<!-- 首页优惠券列表页面 --> | <!-- 首页优惠券列表页面 --> | ||||
<view class="coupons1"> | <view class="coupons1"> | ||||
<view class="coupons1-img"> | <view class="coupons1-img"> | ||||
@@ -4,7 +4,6 @@ | |||||
background: #f6f6f6; | background: #f6f6f6; | ||||
position: relative; | position: relative; | ||||
overflow: hidden; | overflow: hidden; | ||||
padding-bottom: 120rpx; | |||||
} | } | ||||
.coupons-body { | .coupons-body { | ||||
@@ -18,7 +18,7 @@ Page({ | |||||
that.setData({ | that.setData({ | ||||
couponChannelId: options.couponChannelId, | couponChannelId: options.couponChannelId, | ||||
couponId: options.couponId | couponId: options.couponId | ||||
}) | |||||
}); | |||||
wx.showLoading({ | wx.showLoading({ | ||||
title: "加载中..." | title: "加载中..." | ||||
}); | }); | ||||
@@ -29,7 +29,7 @@ Page({ | |||||
Http.get({ | Http.get({ | ||||
url: config.api.couponDetail, | url: config.api.couponDetail, | ||||
data: { | data: { | ||||
couponChannelId: options.couponChannelId, | |||||
couponChannelId: options.couponChannelId | |||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
console.log(res); | console.log(res); | ||||
@@ -72,14 +72,14 @@ Page({ | |||||
payOrderUpdate: (orderId, payOrderId, status, reason) => { | payOrderUpdate: (orderId, payOrderId, status, reason) => { | ||||
// 支付成功 | // 支付成功 | ||||
Http.post({ | Http.post({ | ||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
orderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
orderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
console.log("payOrderUpdate then", res); | console.log("payOrderUpdate then", res); | ||||
// wx.showToast({ | // wx.showToast({ | ||||
@@ -104,9 +104,9 @@ Page({ | |||||
// TODO 选取用户下的车牌 | // TODO 选取用户下的车牌 | ||||
} else { | } else { | ||||
Http.post({ | Http.post({ | ||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
url: config.api.checkPhoneStatus, | |||||
data: {} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
console.log(res); | console.log(res); | ||||
/** | /** | ||||
@@ -115,8 +115,8 @@ Page({ | |||||
return Http.post({ | return Http.post({ | ||||
url: config.api.orderSave, | url: config.api.orderSave, | ||||
data: { | data: { | ||||
couponChannelId: '' + that.data.couponChannelId, | |||||
couponId: '' + that.data.couponId | |||||
couponChannelId: "" + that.data.couponChannelId, | |||||
couponId: "" + that.data.couponId | |||||
} | } | ||||
}); | }); | ||||
}) | }) | ||||
@@ -125,17 +125,27 @@ Page({ | |||||
if (err.code == 11005) { | if (err.code == 11005) { | ||||
// 用户手机未授权 | // 用户手机未授权 | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: "../../getphoneInfo/index?couponChannelId=" + that.data.couponChannelId + "&couponId=" + that.data.couponId | |||||
url: | |||||
"../../getphoneInfo/index?couponChannelId=" + | |||||
that.data.couponChannelId + | |||||
"&couponId=" + | |||||
that.data.couponId | |||||
}); | }); | ||||
} | } | ||||
if (err.code == 11006) { | if (err.code == 11006) { | ||||
// 用户手机已加密 | // 用户手机已加密 | ||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: "../../phoneinput/phoneinput?couponChannelId=" + that.data.couponChannelId + "& couponId=" + that.data.couponId | |||||
url: | |||||
"../../phoneinput/phoneinput?couponChannelId=" + | |||||
that.data.couponChannelId + | |||||
"& couponId=" + | |||||
that.data.couponId | |||||
}); | }); | ||||
} | } | ||||
}) | }) | ||||
.then(res => { | .then(res => { | ||||
console.log(res); | |||||
console.log("点击领取卡券一直在loading"); | |||||
if (res != "undefined") { | if (res != "undefined") { | ||||
const orderId = "" + res.data.id; | const orderId = "" + res.data.id; | ||||
that.setData({ | that.setData({ | ||||
@@ -153,7 +163,7 @@ Page({ | |||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
console.log(res); | console.log(res); | ||||
/// Begin payment ---- | /// Begin payment ---- | ||||
var payOrderId = "" + res.data.payOrderId; | var payOrderId = "" + res.data.payOrderId; | ||||
wx.hideLoading(); | wx.hideLoading(); | ||||
@@ -166,17 +176,15 @@ Page({ | |||||
success: res => { | success: res => { | ||||
console.log(res); | console.log(res); | ||||
console.log("姐在检查付款异常"); | console.log("姐在检查付款异常"); | ||||
that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | ||||
console.log(res); | console.log(res); | ||||
if(res.errMsg=='requestPayment:ok'){ | |||||
if (res.errMsg == "requestPayment:ok") { | |||||
wx.showToast({ | wx.showToast({ | ||||
title: "购买成功", | title: "购买成功", | ||||
duration: 2500 | duration: 2500 | ||||
}); | }); | ||||
} | } | ||||
wx.navigateBack({ | wx.navigateBack({ | ||||
delta: 2 | delta: 2 | ||||
}); | }); | ||||
@@ -208,22 +216,19 @@ Page({ | |||||
// wx.navigateBack(); | // wx.navigateBack(); | ||||
// }, 2000); | // }, 2000); | ||||
// } | // } | ||||
} | |||||
else { | |||||
} else { | |||||
wx.showToast({ | wx.showToast({ | ||||
title:'支付失败', | |||||
image:'./../../../assets/img/fail.png', | |||||
title: "支付失败", | |||||
image: "./../../../assets/img/fail.png", | |||||
duration: 1500, | duration: 1500, | ||||
mask:false | |||||
}) | |||||
mask: false | |||||
}); | |||||
} | } | ||||
return; | return; | ||||
} | } | ||||
}); | }); | ||||
/// End payment -------- | /// End payment -------- | ||||
///// virtual pay | ///// virtual pay | ||||
//var payOrderId = "" + res.data.out_trade_no; | //var payOrderId = "" + res.data.out_trade_no; | ||||
//that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | //that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | ||||
@@ -231,13 +236,11 @@ Page({ | |||||
}); | }); | ||||
} else { | } else { | ||||
// 免费券 | // 免费券 | ||||
that.payOrderUpdate(orderId, "0", 1) // 支付成功 | |||||
.then(res => { | |||||
wx.showToast({ | |||||
title: "支付成功", | |||||
duration: 3000 | |||||
}); | |||||
}); | |||||
that.payOrderUpdate(orderId, "0", 1); | |||||
wx.showToast({ | |||||
title: "领取成功", | |||||
duration: 3000 | |||||
}); | |||||
} | } | ||||
} | } | ||||
}) | }) | ||||
@@ -246,4 +249,4 @@ Page({ | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
}); | |||||
}); |
@@ -47,6 +47,7 @@ | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="buy-view app-border-top"> | <view class="buy-view app-border-top"> | ||||
<button bindtap='orderFunc' class='buy'>立即购买</button> | |||||
<button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr!=0}}">立即购买</button> | |||||
<button bindtap='orderFunc' class='buy' wx:elif="{{data.salePriceStr==0}}">免费领取</button> | |||||
</view> | </view> | ||||
</view> | </view> |
@@ -71,6 +71,8 @@ Page({ | |||||
onLoad: function(options) { | onLoad: function(options) { | ||||
let that = this; | let that = this; | ||||
console.log(options.orderId); | console.log(options.orderId); | ||||
console.log(options.flag + "我是付款的标识"); | |||||
Http.get({ | Http.get({ | ||||
url: config.api.orderDetail, | url: config.api.orderDetail, | ||||
data: { | data: { | ||||
@@ -85,14 +87,197 @@ Page({ | |||||
//createDate 创建时间 | //createDate 创建时间 | ||||
var createDate = util.fmtDate(res.data.createDate); | var createDate = util.fmtDate(res.data.createDate); | ||||
console.log(createDate); | console.log(createDate); | ||||
that.setData({ | that.setData({ | ||||
createDate:createDate, | |||||
}) | |||||
createDate: createDate | |||||
}); | |||||
}); | }); | ||||
}, | }, | ||||
/** | |||||
* 发起支付 | |||||
*/ | |||||
// orderFunc(e) { | |||||
// var that = this; | |||||
// console.log(e.currentTarget.dataset.couponchannelid); | |||||
// wx.showLoading({ | |||||
// title: "加载中..." | |||||
// }); | |||||
// Http.post({ | |||||
// url: config.api.checkPhoneStatus, | |||||
// data: {} | |||||
// }) | |||||
// .then(res => { | |||||
// console.log(res); | |||||
// /** | |||||
// * orderSave 下单 | |||||
// */ | |||||
// return Http.post({ | |||||
// url: config.api.orderSave, | |||||
// data: { | |||||
// couponChannelId: "" + e.currentTarget.dataset.couponchannelid, | |||||
// couponId: "" + that.data.couponId | |||||
// } | |||||
// }); | |||||
// }) | |||||
// .catch(err => { | |||||
// console.log(err); | |||||
// if (err.code == 11005) { | |||||
// // 用户手机未授权 | |||||
// wx.redirectTo({ | |||||
// url: | |||||
// "../../getphoneInfo/index?couponChannelId=" + | |||||
// that.data.couponChannelId + | |||||
// "&couponId=" + | |||||
// that.data.couponId | |||||
// }); | |||||
// } | |||||
// if (err.code == 11006) { | |||||
// // 用户手机已加密 | |||||
// wx.redirectTo({ | |||||
// url: | |||||
// "../../phoneinput/phoneinput?couponChannelId=" + | |||||
// that.data.couponChannelId + | |||||
// "& couponId=" + | |||||
// that.data.couponId | |||||
// }); | |||||
// } | |||||
// }) | |||||
// .then(res => { | |||||
// if (res != "undefined") { | |||||
// const orderId = "" + res.data.id; | |||||
// that.setData({ | |||||
// orderId: orderId | |||||
// }); | |||||
// if (res.data.payment > 0) { | |||||
// // 支付金额不为0 | |||||
// /** | |||||
// * 支付订单创建 | |||||
// */ | |||||
// Http.post({ | |||||
// url: config.api.payOrderCreate, | |||||
// data: { | |||||
// orderId: orderId | |||||
// } | |||||
// }).then(res => { | |||||
// console.log(res); | |||||
// /// Begin payment ---- | |||||
// var payOrderId = "" + res.data.payOrderId; | |||||
// wx.hideLoading(); | |||||
// wx.requestPayment({ | |||||
// timeStamp: res.data.timeStamp, | |||||
// nonceStr: res.data.nonceStr, | |||||
// package: res.data.package, | |||||
// signType: "MD5", | |||||
// paySign: res.data.paySign, | |||||
// success: res => { | |||||
// console.log(res); | |||||
// console.log("姐在检查付款异常"); | |||||
// that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | |||||
// console.log(res); | |||||
// if (res.errMsg == "requestPayment:ok") { | |||||
// wx.showToast({ | |||||
// title: "购买成功", | |||||
// duration: 2500 | |||||
// }); | |||||
// } | |||||
// wx.navigateBack({ | |||||
// delta: 2 | |||||
// }); | |||||
// }, | |||||
// fail: res => { | |||||
// that.payOrderUpdate(that.data.orderId, payOrderId, 2); // 支付失败 | |||||
// console.log(res); | |||||
// return; | |||||
// }, | |||||
// complete: res => { | |||||
// console.log(res); | |||||
// console.log("支付完成"); | |||||
// // var url = res.data.url; | |||||
// // console.log("get url", url); | |||||
// if (res.errMsg == "requestPayment:ok") { | |||||
// wx.showModal({ | |||||
// title: "提示", | |||||
// content: "支付成功" | |||||
// }); | |||||
// // if (url) { | |||||
// // setTimeout(function () { | |||||
// // wx.redirectTo({ | |||||
// // url: "/pages" + url | |||||
// // }); | |||||
// // }, 2000); | |||||
// // } else { | |||||
// // setTimeout(() => { | |||||
// // wx.navigateBack(); | |||||
// // }, 2000); | |||||
// // } | |||||
// } else { | |||||
// wx.showToast({ | |||||
// title: "支付失败", | |||||
// image: "./../../../assets/img/fail.png", | |||||
// duration: 1500, | |||||
// mask: false | |||||
// }); | |||||
// } | |||||
// return; | |||||
// } | |||||
// }); | |||||
// /// End payment -------- | |||||
// ///// virtual pay | |||||
// //var payOrderId = "" + res.data.out_trade_no; | |||||
// //that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 | |||||
// ///// end virtual pay | |||||
// }); | |||||
// } else { | |||||
// // 免费券 | |||||
// that | |||||
// .payOrderUpdate(orderId, "0", 1) // 支付成功 | |||||
// .then(res => { | |||||
// wx.showToast({ | |||||
// title: "支付成功", | |||||
// duration: 3000 | |||||
// }); | |||||
// }); | |||||
// } | |||||
// } | |||||
// }) | |||||
// .catch(err => { | |||||
// console.log(err); | |||||
// }); | |||||
// }, | |||||
/** | |||||
* 支付订单更新 | |||||
*/ | |||||
// payOrderUpdate: (orderId, payOrderId, status, reason) => { | |||||
// // 支付成功 | |||||
// Http.post({ | |||||
// url: config.api.payOrderUpdate, | |||||
// data: { | |||||
// payOrderId: payOrderId, | |||||
// orderId: orderId, | |||||
// status: status, | |||||
// reason: reason | |||||
// } | |||||
// }) | |||||
// .then(res => { | |||||
// console.log("payOrderUpdate then", res); | |||||
// // wx.showToast({ | |||||
// // title: "购买成功", | |||||
// // duration: 2500 | |||||
// // }); | |||||
// }) | |||||
// .catch(err => { | |||||
// console.log("payOrderUpdate catch", err); | |||||
// }); | |||||
// }, | |||||
/** | /** | ||||
* 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
*/ | */ | ||||
@@ -1,7 +1,7 @@ | |||||
<view class='order'> | <view class='order'> | ||||
<view class='tips'> | |||||
<view wx:if="{{data.orderStatus==1}}" class='tips'> | |||||
<text class='iconfont icon-choose'></text> | <text class='iconfont icon-choose'></text> | ||||
<text wx:if="{{data.orderStatus==1}}">付款成功,请尽快到门店使用</text> | |||||
<text>付款成功,请尽快到门店使用</text> | |||||
</view> | </view> | ||||
<view class='section'> | <view class='section'> | ||||
<view class='detail_msg'> | <view class='detail_msg'> | ||||
@@ -51,6 +51,10 @@ | |||||
<text class="jine">¥{{data.salePrice/100}}</text> | <text class="jine">¥{{data.salePrice/100}}</text> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<!-- 待付款 显示立即购买的按钮 --> | |||||
<!-- <view wx:if="{{data.orderStatus==1}}" class="buy-view app-border-top"> | |||||
<button bindtap='orderFunc' data-couponChannelId="{{data.id}}" class='buy'>立即购买</button> | |||||
</view> --> | |||||
</view> | </view> | ||||
@@ -47,7 +47,7 @@ | |||||
.logo image { | .logo image { | ||||
width: 100%; | width: 100%; | ||||
height: 100%; | height: 100%; | ||||
border-radius:16rpx; | |||||
border-radius: 16rpx; | |||||
} | } | ||||
.info view:nth-child(1) { | .info view:nth-child(1) { | ||||
@@ -133,7 +133,7 @@ | |||||
} | } | ||||
.classif > view:nth-child(1) { | .classif > view:nth-child(1) { | ||||
display: block; | display: block; | ||||
border-top:20rpx solid #f8f8f8; | |||||
border-top: 20rpx solid #f8f8f8; | |||||
} | } | ||||
.classif > view:nth-child(1) text:nth-child(2) { | .classif > view:nth-child(1) text:nth-child(2) { | ||||
padding-left: 15rpx; | padding-left: 15rpx; | ||||
@@ -260,7 +260,7 @@ radio { | |||||
height: 0; | height: 0; | ||||
clear: both; | clear: both; | ||||
visibility: hidden; | visibility: hidden; | ||||
} | |||||
} | |||||
.panel { | .panel { | ||||
width: 600rpx; | width: 600rpx; | ||||
border-radius: 10rpx; | border-radius: 10rpx; | ||||
@@ -270,11 +270,11 @@ radio { | |||||
position: relative; | position: relative; | ||||
z-index: 10000000000; | z-index: 10000000000; | ||||
} | } | ||||
.pane2{ | |||||
.pane2 { | |||||
background: #fff; | background: #fff; | ||||
opacity: .6; | |||||
opacity: 0.6; | |||||
} | } | ||||
.pane2 image{ | |||||
.pane2 image { | |||||
width: 500rpx; | width: 500rpx; | ||||
display: block; | display: block; | ||||
margin: 40rpx auto 0; | margin: 40rpx auto 0; | ||||
@@ -317,7 +317,28 @@ radio { | |||||
width: 350rpx; | width: 350rpx; | ||||
height: 350rpx; | height: 350rpx; | ||||
} | } | ||||
.jine{ | |||||
color: #f96563!important; | |||||
font-size: 36rpx!important; | |||||
} | |||||
.jine { | |||||
color: #f96563 !important; | |||||
font-size: 36rpx !important; | |||||
} | |||||
.buy-view { | |||||
background: #fff; | |||||
position: fixed; | |||||
padding-top: 10rpx; | |||||
height: 98rpx; | |||||
bottom: 0rpx; | |||||
left: 0; | |||||
right: 0; | |||||
} | |||||
.buy { | |||||
background: #00c0ff; | |||||
height: 88rpx; | |||||
width: 98%; | |||||
margin: 0 auto; | |||||
color: #fff; | |||||
font-size: 36rpx; | |||||
line-height: 88rpx; | |||||
border-radius: 6rpx; | |||||
} |
@@ -1,5 +1,6 @@ | |||||
let config = require("../../../config/config.js"); | let config = require("../../../config/config.js"); | ||||
let Http = require("../../../utils/HttpBasics"); | let Http = require("../../../utils/HttpBasics"); | ||||
const util = require("../../../utils/util"); | |||||
let app = getApp(); | let app = getApp(); | ||||
Page({ | Page({ | ||||
@@ -30,10 +31,11 @@ Page({ | |||||
current_scroll: e.id | current_scroll: e.id | ||||
}); | }); | ||||
}, | }, | ||||
gotopay:function(e){ | gotopay:function(e){ | ||||
console.log("orderId"+e.currentTarget.dataset.id); | console.log("orderId"+e.currentTarget.dataset.id); | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}`, | |||||
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&flag='pay'`, | |||||
success: function(res){ | success: function(res){ | ||||
// success | // success | ||||
}, | }, | ||||
@@ -96,6 +98,12 @@ Page({ | |||||
that.setData({ | that.setData({ | ||||
list: that.data.list | list: that.data.list | ||||
}); | }); | ||||
for(let i=0; i<that.data.list.length; i++){ | |||||
console.log(i); | |||||
that.setData({ | |||||
createDate:util.fmtDate(that.data.list[i].createDate) | |||||
}) | |||||
} | |||||
}); | }); | ||||
} else { | } else { | ||||
console.log("加载完成allow_load设置成false"); | console.log("加载完成allow_load设置成false"); | ||||
@@ -13,11 +13,11 @@ | |||||
<text>{{item.title}}</text> | <text>{{item.title}}</text> | ||||
<text wx:if="{{item.orderStatus==0}}">等待付款</text> | <text wx:if="{{item.orderStatus==0}}">等待付款</text> | ||||
<text wx:if="{{item.orderStatus==1}}">已付款</text> | <text wx:if="{{item.orderStatus==1}}">已付款</text> | ||||
<text wx:if="{{item.orderStatus==2}}">取消</text> | |||||
<text wx:if="{{item.orderStatus==2}}">订单取消</text> | |||||
</view> | </view> | ||||
<view>{{item.subTitle}}</view> | <view>{{item.subTitle}}</view> | ||||
<view> | <view> | ||||
<text>下单时间:</text>2018-07-10 11:30 | |||||
<text>下单时间:</text>{{createDate}} | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | </view> | ||||