Selaa lähdekoodia

[限时抢购 查看更多 立即支付,修改购买时手机号的验证][修改]:修改限时抢购列表的支付,修改购买时手机号的验证

tags/2.2.4
meo 6 vuotta sitten
vanhempi
commit
4097f8090e
7 muutettua tiedostoa jossa 96 lisäystä ja 89 poistoa
  1. +1
    -1
      app.json
  2. +86
    -71
      pages/coupon/detail/index.js
  3. +1
    -2
      pages/coupon/detail/index.wxss
  4. +1
    -1
      pages/couponorder/detail/index.js
  5. +0
    -11
      pages/couponorder/detail/index.wxml
  6. +6
    -2
      pages/getphoneInfo/index.js
  7. +1
    -1
      pages/rushToBuy/index.js

+ 1
- 1
app.json Näytä tiedosto

@@ -3,7 +3,6 @@
"pages/index/index", "pages/index/index",
"pages/bannerdetail/index", "pages/bannerdetail/index",
"pages/getuserinfo/index", "pages/getuserinfo/index",
"pages/getphoneInfo/index",
"pages/phoneinput/phoneinput", "pages/phoneinput/phoneinput",
"pages/market/index", "pages/market/index",
"pages/user/index", "pages/user/index",
@@ -19,6 +18,7 @@
"pages/login/index", "pages/login/index",
"pages/park/park", "pages/park/park",
"pages/passCar/passCar", "pages/passCar/passCar",
"pages/getphoneInfo/index",
"pages/addPark/addPark", "pages/addPark/addPark",
"pages/youhuiquanma/index" "pages/youhuiquanma/index"
], ],


+ 86
- 71
pages/coupon/detail/index.js Näytä tiedosto

@@ -35,70 +35,75 @@ Page({
title: "加载中..." title: "加载中..."
}); });


if (options.flag) {
this.orderFunc();
} else {
if (options.couponChannelId == "iambannercoupon") {
that.setData({
couponId: options.couponId
});
/**
* 待解决
*/
var parmer = {
url: config.api.bannercoupondetai,
data: {
couponId: options.couponId
}
};
} else {
that.setData({
couponChannelId: options.couponChannelId,
/**
* 暂时注销
* this.orderFunc()
*/
// if (options.flag) {
// // this.orderFunc();
// }
// else {
if (options.couponChannelId == "iambannercoupon") {
that.setData({
couponId: options.couponId
});
/**
* 待解决
*/
var parmer = {
url: config.api.bannercoupondetai,
data: {
couponId: options.couponId couponId: options.couponId
});
var parmer = {
url: config.api.couponDetail,
data: {
couponChannelId: options.couponChannelId
}
};
}

Http.get(parmer).then(res => {
console.log(res);
console.log("details");
//当前时间与优惠券下架时间做计算
var startTime = util.fmtDate(res.data.endTime);
console.log(startTime);
var s1 = new Date(startTime.replace(/-/g, "/"));
var s2 = new Date();
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000);
var year = Math.floor(runTime / 86400 / 365);
var runTime = runTime % (86400 * 365);
var month = Math.floor(runTime / 86400 / 30);
var runTime = runTime % (86400 * 30);
var day = Math.floor(runTime / 86400);
var runTime = runTime % 86400;
var hour = Math.floor(runTime / 3600);
var runTime = runTime % 3600;
var minute = Math.floor(runTime / 60);
var runTime = runTime % 60;
var second = runTime;
console.log(year, month, day, hour, minute, second);
that.setData({
year: year,
month: month,
day: day,
hour: hour,
minute: minute
});
console.log(that.data.day);
wx.hideLoading();
that.setData({
data: res.data
});
}
};
} else {
that.setData({
couponChannelId: options.couponChannelId,
couponId: options.couponId
}); });
var parmer = {
url: config.api.couponDetail,
data: {
couponChannelId: options.couponChannelId
}
};
} }

Http.get(parmer).then(res => {
console.log(res);
console.log("details");
//当前时间与优惠券下架时间做计算
var startTime = util.fmtDate(res.data.endTime);
console.log(startTime);
var s1 = new Date(startTime.replace(/-/g, "/"));
var s2 = new Date();
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000);
var year = Math.floor(runTime / 86400 / 365);
var runTime = runTime % (86400 * 365);
var month = Math.floor(runTime / 86400 / 30);
var runTime = runTime % (86400 * 30);
var day = Math.floor(runTime / 86400);
var runTime = runTime % 86400;
var hour = Math.floor(runTime / 3600);
var runTime = runTime % 3600;
var minute = Math.floor(runTime / 60);
var runTime = runTime % 60;
var second = runTime;
console.log(year, month, day, hour, minute, second);
that.setData({
year: year,
month: month,
day: day,
hour: hour,
minute: minute
});
console.log(that.data.day);
wx.hideLoading();
that.setData({
data: res.data
});
});
// }
}, },
/** /**
* 支付订单更新 * 支付订单更新
@@ -143,12 +148,13 @@ Page({
}) })
.then(res => { .then(res => {
console.log(res); console.log(res);
console.log("姐姐在检查手机号是否授权的情况");
var data = { var data = {
couponChannelId: "" + that.data.couponChannelId, couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId couponId: "" + that.data.couponId
}; };
if (that.data.couponChannelId == null) { if (that.data.couponChannelId == null) {
data = {
var data = {
couponId: "" + that.data.couponId couponId: "" + that.data.couponId
}; };
} }
@@ -162,11 +168,18 @@ Page({
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
console.log(that.data.couponChannelId);
console.log(that.data.couponId);
console.log("我即将要跳转到用户手机号授权的页面");
if (err.code == 11005) { if (err.code == 11005) {
// 用户手机未授权 // 用户手机未授权
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({ wx.redirectTo({
url: url:
"../../getphoneInfo/index?couponChannelId=" +
"/pages/getphoneInfo/index?couponChannelId=" +
that.data.couponChannelId + that.data.couponChannelId +
"&couponId=" + "&couponId=" +
that.data.couponId that.data.couponId
@@ -176,9 +189,9 @@ Page({
// 用户手机已加密 // 用户手机已加密
wx.redirectTo({ wx.redirectTo({
url: url:
"../../phoneinput/phoneinput?couponChannelId=" +
"/pages/phoneinput/phoneinput?couponChannelId=" +
that.data.couponChannelId + that.data.couponChannelId +
"& couponId=" +
"&couponId=" +
that.data.couponId that.data.couponId
}); });
} }
@@ -187,7 +200,8 @@ Page({
console.log(res); console.log(res);
console.log("点击领取卡券一直在loading"); console.log("点击领取卡券一直在loading");
if (res != "undefined") { if (res != "undefined") {
const orderId = "" + res.data.id;
console.log(res);
let orderId = "" + res.data.id;
that.setData({ that.setData({
orderId: orderId orderId: orderId
}); });
@@ -203,7 +217,6 @@ 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();
@@ -223,11 +236,13 @@ Page({
title: "购买成功", title: "购买成功",
duration: 2500 duration: 2500
}); });
/**
* 用户支付成功以后跳转到券包列表
*/
wx.redirectTo({
url: '/pages/couponorder/index/index',
})
} }

wx.navigateBack({
delta: 2
});
}, },


fail: res => { fail: res => {


+ 1
- 2
pages/coupon/detail/index.wxss Näytä tiedosto

@@ -162,12 +162,11 @@


.notes view:nth-child(2) { .notes view:nth-child(2) {
width: 92%; width: 92%;
padding: 0 4%;
padding: 2% 4%;
background: #fff; background: #fff;
border-bottom: 1rpx solid #f5f5f5; border-bottom: 1rpx solid #f5f5f5;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-top: 2%;
} }


.notes view:nth-child(2)>text { .notes view:nth-child(2)>text {


+ 1
- 1
pages/couponorder/detail/index.js Näytä tiedosto

@@ -48,7 +48,7 @@ Page({
console.log(that.data); console.log(that.data);
if (that.data.data.merchantLinkPhone) { if (that.data.data.merchantLinkPhone) {
wx.makePhoneCall({ wx.makePhoneCall({
phoneNumber: that.data.data.merchantLinkPhone //仅为示例,并非真实的电话号码
phoneNumber: that.data.data.merchantLinkPhone
}); });
} }
} }


+ 0
- 11
pages/couponorder/detail/index.wxml Näytä tiedosto

@@ -16,18 +16,7 @@
<text>有效期至:</text> <text>有效期至:</text>
<text>{{expiredTime}}</text> <text>{{expiredTime}}</text>
</view> </view>
<!-- <view class="pane2" wx:if="{{data.couponOrderStatus==1}}">
<image src="./../../../assets/img/shiyong.jpg" mode="widthFix"></image>
</view>
<view class="pane2" wx:if="{{data.couponOrderStatus==2}}">
<image src="./../../../assets/img/guoqi.jpg" mode="widthFix"></image>
</view>
<view class="pane2" wx:if="{{data.couponOrderStatus==3}}">
<image src="./../../../assets/img/tui.jpg" mode="widthFix"></image>
</view> -->

<view class="panel"> <view class="panel">

<view class="barcode"> <view class="barcode">
<canvas canvas-id="barcode" /> <canvas canvas-id="barcode" />
</view> </view>


+ 6
- 2
pages/getphoneInfo/index.js Näytä tiedosto

@@ -4,8 +4,8 @@ var app = getApp();
Page({ Page({
data: { data: {
canIUse: wx.canIUse('button.open-type.getPhoneNumber'), canIUse: wx.canIUse('button.open-type.getPhoneNumber'),
couponChannelId: null,
couponId: null
couponChannelId: "",
couponId:""
}, },
onLoad: function(options) { onLoad: function(options) {
var that = this; var that = this;
@@ -28,6 +28,10 @@ Page({
}) })
.then(function(res) { .then(function(res) {
console.log(res); console.log(res);
console.log("这是用户授权手机号的结果")
console.log(that.data.couponChannelId)
console.log(that.data.couponId)
console.log("这是从立即支付传回来的值 因为用户没有授权手机号")
app.globalData.phone = res.data.phone; app.globalData.phone = res.data.phone;
wx.showToast({ wx.showToast({
title: res.data.msg, title: res.data.msg,


+ 1
- 1
pages/rushToBuy/index.js Näytä tiedosto

@@ -118,7 +118,7 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: `/pages/coupon/detail/index?couponChannelId=${ url: `/pages/coupon/detail/index?couponChannelId=${
e.currentTarget.dataset.couponchannelid e.currentTarget.dataset.couponchannelid
}&couponId=${e.currentTarget.dataset.couponId}`,
}&couponId=${e.currentTarget.dataset.couponid}`,
success: function(res) { success: function(res) {
// success // success
}, },


Ladataan…
Peruuta
Tallenna