From a843f858e43e47e798f1ed9c0f22be4b639b9506 Mon Sep 17 00:00:00 2001 From: meo <958484406@qq.com> Date: Tue, 28 Aug 2018 22:39:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B4=AD=E4=B9=B0=E5=85=8D=E8=B4=B9=E5=88=B8?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=88=90=E5=8A=9F][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E8=BF=94=E5=9B=9E=E5=88=B8=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=88=90=E5=8A=9F=EF=BC=8C=E6=B6=88=E6=81=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/coupons/index.wxml | 8 +- pages/bannerdetail/index.wxml | 2 +- pages/bannerdetail/index.wxss | 1 - pages/coupon/detail/index.js | 81 +++++++------- pages/coupon/detail/index.wxml | 3 +- pages/order/detail/index.js | 191 ++++++++++++++++++++++++++++++++- pages/order/detail/index.wxml | 8 +- pages/order/detail/index.wxss | 41 +++++-- pages/order/index/index.js | 10 +- pages/order/index/index.wxml | 4 +- 10 files changed, 284 insertions(+), 65 deletions(-) diff --git a/components/coupons/index.wxml b/components/coupons/index.wxml index df5d796..ee55585 100644 --- a/components/coupons/index.wxml +++ b/components/coupons/index.wxml @@ -23,11 +23,9 @@ 剩余: {{data.remainInventory}} - 领取 - 购买 + 领取 + 购买 - - - \ No newline at end of file + \ No newline at end of file diff --git a/pages/bannerdetail/index.wxml b/pages/bannerdetail/index.wxml index aab3fcf..b1b2c15 100644 --- a/pages/bannerdetail/index.wxml +++ b/pages/bannerdetail/index.wxml @@ -37,7 +37,7 @@ --> - + diff --git a/pages/bannerdetail/index.wxss b/pages/bannerdetail/index.wxss index db56dcb..17f9b83 100644 --- a/pages/bannerdetail/index.wxss +++ b/pages/bannerdetail/index.wxss @@ -4,7 +4,6 @@ background: #f6f6f6; position: relative; overflow: hidden; - padding-bottom: 120rpx; } .coupons-body { diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 85a5610..c0039ac 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -18,7 +18,7 @@ Page({ that.setData({ couponChannelId: options.couponChannelId, couponId: options.couponId - }) + }); wx.showLoading({ title: "加载中..." }); @@ -29,7 +29,7 @@ Page({ Http.get({ url: config.api.couponDetail, data: { - couponChannelId: options.couponChannelId, + couponChannelId: options.couponChannelId } }).then(res => { console.log(res); @@ -72,14 +72,14 @@ Page({ payOrderUpdate: (orderId, payOrderId, status, reason) => { // 支付成功 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 => { console.log("payOrderUpdate then", res); // wx.showToast({ @@ -104,9 +104,9 @@ Page({ // TODO 选取用户下的车牌 } else { Http.post({ - url: config.api.checkPhoneStatus, - data: {} - }) + url: config.api.checkPhoneStatus, + data: {} + }) .then(res => { console.log(res); /** @@ -115,8 +115,8 @@ Page({ return Http.post({ url: config.api.orderSave, 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) { // 用户手机未授权 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) { // 用户手机已加密 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 => { + console.log(res); + console.log("点击领取卡券一直在loading"); if (res != "undefined") { const orderId = "" + res.data.id; that.setData({ @@ -153,7 +163,7 @@ Page({ } }).then(res => { console.log(res); - + /// Begin payment ---- var payOrderId = "" + res.data.payOrderId; wx.hideLoading(); @@ -166,17 +176,15 @@ Page({ success: res => { console.log(res); console.log("姐在检查付款异常"); - that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 - console.log(res); - if(res.errMsg=='requestPayment:ok'){ + if (res.errMsg == "requestPayment:ok") { wx.showToast({ title: "购买成功", duration: 2500 }); } - + wx.navigateBack({ delta: 2 }); @@ -208,22 +216,19 @@ Page({ // wx.navigateBack(); // }, 2000); // } - - } - - else { + } else { wx.showToast({ - title:'支付失败', - image:'./../../../assets/img/fail.png', + title: "支付失败", + image: "./../../../assets/img/fail.png", duration: 1500, - mask:false - }) + mask: false + }); } return; } }); /// End payment -------- - + ///// virtual pay //var payOrderId = "" + res.data.out_trade_no; //that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功 @@ -231,13 +236,11 @@ Page({ }); } 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({ }); } } -}); \ No newline at end of file +}); diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml index b384ab6..e6af32a 100644 --- a/pages/coupon/detail/index.wxml +++ b/pages/coupon/detail/index.wxml @@ -47,6 +47,7 @@ - + + \ No newline at end of file diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js index ba79212..50e88f2 100644 --- a/pages/order/detail/index.js +++ b/pages/order/detail/index.js @@ -71,6 +71,8 @@ Page({ onLoad: function(options) { let that = this; console.log(options.orderId); + console.log(options.flag + "我是付款的标识"); + Http.get({ url: config.api.orderDetail, data: { @@ -85,14 +87,197 @@ Page({ //createDate 创建时间 var createDate = util.fmtDate(res.data.createDate); - + console.log(createDate); 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); + // }); + // }, + /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/order/detail/index.wxml b/pages/order/detail/index.wxml index d386672..a26827b 100644 --- a/pages/order/detail/index.wxml +++ b/pages/order/detail/index.wxml @@ -1,7 +1,7 @@ - + - 付款成功,请尽快到门店使用 + 付款成功,请尽快到门店使用 @@ -51,6 +51,10 @@ ¥{{data.salePrice/100}} + + diff --git a/pages/order/detail/index.wxss b/pages/order/detail/index.wxss index 5c70f34..26a98cd 100644 --- a/pages/order/detail/index.wxss +++ b/pages/order/detail/index.wxss @@ -47,7 +47,7 @@ .logo image { width: 100%; height: 100%; - border-radius:16rpx; + border-radius: 16rpx; } .info view:nth-child(1) { @@ -133,7 +133,7 @@ } .classif > view:nth-child(1) { display: block; - border-top:20rpx solid #f8f8f8; + border-top: 20rpx solid #f8f8f8; } .classif > view:nth-child(1) text:nth-child(2) { padding-left: 15rpx; @@ -260,7 +260,7 @@ radio { height: 0; clear: both; visibility: hidden; - } +} .panel { width: 600rpx; border-radius: 10rpx; @@ -270,11 +270,11 @@ radio { position: relative; z-index: 10000000000; } -.pane2{ +.pane2 { background: #fff; - opacity: .6; + opacity: 0.6; } -.pane2 image{ +.pane2 image { width: 500rpx; display: block; margin: 40rpx auto 0; @@ -317,7 +317,28 @@ radio { width: 350rpx; height: 350rpx; } -.jine{ - color: #f96563!important; - font-size: 36rpx!important; -} \ No newline at end of file +.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; +} diff --git a/pages/order/index/index.js b/pages/order/index/index.js index 2fd7ce6..37a19b9 100644 --- a/pages/order/index/index.js +++ b/pages/order/index/index.js @@ -1,5 +1,6 @@ let config = require("../../../config/config.js"); let Http = require("../../../utils/HttpBasics"); +const util = require("../../../utils/util"); let app = getApp(); Page({ @@ -30,10 +31,11 @@ Page({ current_scroll: e.id }); }, + gotopay:function(e){ console.log("orderId"+e.currentTarget.dataset.id); 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 }, @@ -96,6 +98,12 @@ Page({ that.setData({ list: that.data.list }); + for(let i=0; i{{item.title}} 等待付款 已付款 - 取消 + 订单取消 {{item.subTitle}} - 下单时间:2018-07-10 11:30 + 下单时间:{{createDate}}