Browse Source

edit

tags/2.2.4
shark 6 years ago
parent
commit
3a5635115e
17 changed files with 432 additions and 128 deletions
  1. BIN
      assets/img/fail.png
  2. +6
    -1
      config/config.js
  3. +50
    -29
      pages/coupon/detail/index.js
  4. +2
    -2
      pages/couponorder/detail/index.js
  5. +1
    -1
      pages/couponorder/index/index.js
  6. +1
    -0
      pages/couponorder/index/index.wxml
  7. +91
    -26
      pages/order/detail/index.js
  8. +33
    -25
      pages/order/detail/index.wxml
  9. +200
    -22
      pages/order/detail/index.wxss
  10. +11
    -9
      pages/order/index/index.js
  11. +7
    -3
      pages/order/index/index.wxml
  12. +2
    -2
      pages/order/index/index.wxss
  13. +0
    -1
      pages/rushToBuy/index.wxml
  14. +3
    -3
      pages/user/index.wxml
  15. +2
    -2
      pages/user/index.wxss
  16. +1
    -1
      project.config.json
  17. +22
    -1
      utils/util.js

BIN
assets/img/fail.png View File

Before After
Width: 200  |  Height: 200  |  Size: 6.7 KiB

+ 6
- 1
config/config.js View File

@@ -55,6 +55,11 @@ var config = {
* 订单列表
*/
orderList: "/order/list",

/**
* 订单详情
*/
orderDetail: "/order/detail",
/**
* 券包
*/
@@ -131,4 +136,4 @@ for (var key in config.api) {
config.api[key] = apiPrefix + config.api[key];
}
*/
module.exports = config;
module.exports = config;

+ 50
- 29
pages/coupon/detail/index.js View File

@@ -29,7 +29,7 @@ Page({
Http.get({
url: config.api.couponDetail,
data: {
id: options.couponChannelId,
couponChannelId: options.couponChannelId,
}
}).then(res => {
console.log(res);
@@ -82,15 +82,18 @@ Page({
})
.then(res => {
console.log("payOrderUpdate then", res);
wx.showToast({
title: "购买成功",
duration: 2500
});
// wx.showToast({
// title: "购买成功",
// duration: 2500
// });
})
.catch(err => {
console.log("payOrderUpdate catch", err);
});
},
/**
* 发起支付
*/
orderFunc() {
var that = this;
wx.showLoading({
@@ -105,6 +108,10 @@ Page({
data: {}
})
.then(res => {
console.log(res);
/**
* orderSave 下单
*/
return Http.post({
url: config.api.orderSave,
data: {
@@ -136,6 +143,9 @@ Page({
});
if (res.data.payment > 0) {
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
@@ -154,49 +164,60 @@ Page({
signType: "MD5",
paySign: res.data.paySign,
success: res => {
console.log(res);
console.log("姐在检查付款异常");

that.payOrderUpdate(that.data.orderId, payOrderId, 1); // 支付成功

console.log(res);
console.log("支付成功");
wx.showToast({
title: "购买成功",
duration: 2500
});
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);
console.log("支付失败");
return;
},
complete: res => {
console.log(res);
console.log("支付完成");
var url = res.data.url;
console.log("get url", url);
// 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.showModal({
title: "错误提示",
content: res.errMsg
});
// 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;
}


+ 2
- 2
pages/couponorder/detail/index.js View File

@@ -46,9 +46,9 @@ Page({
phone: function() {
let that = this;
console.log(that.data);
if (that.data.merchantLinkPhone) {
if (that.data.data.merchantLinkPhone) {
wx.makePhoneCall({
phoneNumber: that.data.merchantLinkPhone //仅为示例,并非真实的电话号码
phoneNumber: that.data.data.merchantLinkPhone //仅为示例,并非真实的电话号码
});
}
}


+ 1
- 1
pages/couponorder/index/index.js View File

@@ -22,7 +22,7 @@ Page({
name: "已退款"
}
],
list: [{wm:'000'}],
list: [],
current: "0",
current_scroll: "0",
page: 1,


+ 1
- 0
pages/couponorder/index/index.wxml View File

@@ -11,6 +11,7 @@
<button>去领券</button>
</navigator>
</view>
<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}">
<view class='detail_msg'>
<view class='logo'>


+ 91
- 26
pages/order/detail/index.js View File

@@ -1,65 +1,130 @@
let config = require("../../../config/config.js");
let util = require("../../../utils/util");
let Http = require("../../../utils/HttpBasics");
let app = getApp();
Page({

/**
* 页面的初始数据
*/
data: {
showModalStatus: false,
flag: 0
},

/**
* 点击弹出二维码
* 然后再关闭
*/

powerDrawer: function(e) {
var currentStatu = e.currentTarget.dataset.statu;
console.log(e.currentTarget.dataset.statu);
console.log(e.currentTarget.dataset.quancode);
this.utils(currentStatu, e.currentTarget.dataset.quancode);
},
utils: function(currentStatu, quancode) {
/* 动画部分 */
// 第1步:创建动画实例
var animation = wx.createAnimation({
duration: 200, //动画时长
timingFunction: "linear", //线性
delay: 0 //0则不延迟
}); // 第2步:这个动画实例赋给当前的动画实例
this.animation = animation; // 第3步:执行第一组动画
animation.opacity(0).step(); // 第4步:导出动画对象赋给数据对象储存
this.setData({
animationData: animation.export()
}); // 第5步:设置定时器到指定时候后,执行第二组动画
setTimeout(
function() {
// 执行第二组动画
animation.opacity(1).step(); // 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
this.setData({
animationData: animation
}); //关闭
if (currentStatu == "close") {
this.setData({
showModalStatus: false
});
}
}.bind(this),
20
);
// 显示
if (currentStatu == "open") {
this.setData({
showModalStatus: true
});
this.data.flag++;

console.log(this.data.flag);
util.barcode("barcode" + this.data.flag, quancode, 500, 100);
util.qrcode("qrcode" + this.data.flag, quancode, 350, 350);
this.setData({
flag: this.data.flag
});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
let that = this;
console.log(options.orderId);
Http.get({
url: config.api.orderDetail,
data: {
orderId: options.orderId
}
}).then(res => {
console.log(res);
console.log("我是订单详情");
that.setData({
data: res.data
});

//createDate 创建时间
var createDate = util.fmtDate(res.data.createDate);
console.log(createDate);
that.setData({
createDate:createDate,
})
});
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
onReady: function() {},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
onShow: function(options) {},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
onHide: function() {},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
onUnload: function() {},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
onPullDownRefresh: function() {},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
onReachBottom: function() {},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
onShareAppMessage: function() {}
});

+ 33
- 25
pages/order/detail/index.wxml View File

@@ -1,61 +1,69 @@
<view class='order'>
<view class='tips'>
<text class='iconfont icon-choose'></text>
<text>付款成功,请尽快到门店使用</text>
<text wx:if="{{data.orderStatus==1}}">付款成功,请尽快到门店使用</text>
</view>
<view class='section'>
<view class='detail_msg'>
<view class='logo'>
<image src='http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg'></image>
<image src='{{data.coverImg}}'></image>
</view>
<view class='info'>
<view>
<text>黑椒牛排</text>
<text>{{data.subTitle}}</text>
</view>
<view>
<text>购买数量:</text>1件</view>
<text>{{data.title}}</text>
</view>
<!-- <view>
<text>购买数量:</text>1件
</view> -->
<view>
<text>下单时间:</text>2018-07-10 11:30</view>
</view>
</view>
<view class='payment'>
<view></view>
<view>
<text>¥1.00</text>
<text>¥59.00</text>
<text>下单时间:</text>{{createDate}}</view>
</view>
</view>

</view>
<view class='classif'>
<view>
<text>有效期:</text>
<text>2018-07-10 至 2018-07-10</text>
</view>
<view>
<view class="clearfix">
<text>适用门店</text>
<text class='iconfont icon-right'></text>
<text class="fr">{{data.merchantName}}</text>
</view>
<view>
<view wx:if="{{data.orderStatus==1}}" data-quancode="{{data.id}}" bindtap="powerDrawer" data-statu="open">
<view>
<text>兑换码:</text>
<text>1234567890</text>
<text>{{data.id}}</text>
</view>
<view>
<icon class='iconfont icon-dingweib'></icon>
<icon class='iconfont icon-right'></icon>
<image class="spcode" src="./../../../assets/img/spcode.png" mode="widthFix"></image>
</view>
</view>
<view>
<text>下单时间</text>
<text>2018-07-10 11:30</text>
<text>{{createDate}}</text>
</view>
<view>
<text>订单编号</text>
<text>1234567890</text>
<text>{{data.orderNumber}}</text>
</view>
<view>
<text>订单金额</text>
<text>¥1.00</text>
<text class="jine">¥{{data.salePrice/100}}</text>
</view>
</view>
</view>


<!--mask-->
<view class="drawer_screen" data-quancode="{{data.id}}" wx:if="{{showModalStatus}}" bindtap="powerDrawer" data-statu="close"></view>
<view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus}}">
<view class="panel">
<view class="barcode">
<canvas canvas-id="barcode{{flag+1}}" />
</view>
<view class="qrcode">
<canvas canvas-id="qrcode{{flag+1}}" />
</view>
<view class="barnum"><text>兑换码:</text>{{data.id}}</view>
</view>
</view>

+ 200
- 22
pages/order/detail/index.wxss View File

@@ -1,11 +1,11 @@
@import '../../../app.wxss';
@import "../../../app.wxss";
.order {
width: 100%;
}
.tips {
width: 92%;
height: 88rpx;
background: #00C0FF;
background: #00c0ff;
color: #fff;
padding: 0 4%;
line-height: 88rpx;
@@ -19,7 +19,7 @@
height: 32rpx;
background: #fff;
border-radius: 50%;
color: #00C0FF;
color: #00c0ff;
line-height: 32rpx;
text-align: center;
display: inline-block;
@@ -35,7 +35,7 @@
display: flex;
margin: 0 4%;
margin-top: 2%;
border-bottom: 1px solid #ededed;
/* border-bottom: 1px solid #ededed; */
}

.logo {
@@ -47,6 +47,7 @@
.logo image {
width: 100%;
height: 100%;
border-radius:16rpx;
}

.info view:nth-child(1) {
@@ -60,7 +61,7 @@
}

.info view:nth-child(1) {
margin-bottom: 72rpx;
margin-bottom: 30rpx;
}

.info view:nth-child(1) text {
@@ -72,13 +73,15 @@
font-size: 24rpx;
}

.info view:nth-child(2), .info view:nth-child(3) {
.info view:nth-child(2),
.info view:nth-child(3) {
color: #ff3434;
font-size: 24rpx;
padding-left: 4%;
}

.info view:nth-child(2) text, .info view:nth-child(3) text {
.info view:nth-child(2) text,
.info view:nth-child(3) text {
font-size: 22rpx;
color: #b8b8b8;
}
@@ -94,7 +97,7 @@
padding: 0 4%;
display: flex;
justify-content: space-between;
border-bottom: 20rpx solid #EDEDED;
border-bottom: 20rpx solid #ededed;
}

.payment view:nth-child(2) text:nth-child(1) {
@@ -112,34 +115,209 @@
.classif {
width: 100%;
}
.classif>view{
.classif > view {
height: 88rpx;
line-height: 88rpx;
display: flex;
justify-content: space-between;
padding-left: 4%;
padding-right: 4%;
border-bottom: 1rpx solid #eee;
}
.classif>view text{
.classif > view text {
font-size: 30rpx;
}
.classif>view text:nth-child(2){
color: #B8B8B8;
font-size: 30rpx;
.classif > view text:nth-child(2) {
color: #b8b8b8;
font-size: 30rpx;
}
.classif>view:nth-child(1) {
.classif > view:nth-child(1) {
display: block;
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;
}
.classif>view:nth-child(3),.classif>view:nth-child(4) {
border-top: 20rpx solid #EDEDED;
.classif > view:nth-child(3),
.classif > view:nth-child(4) {
border-top: 20rpx solid #f8f8f8;
}
.classif > view:nth-child(3) view text:nth-child(2) {
padding-left: 15rpx;
}
.classif>view:nth-child(3) view text:nth-child(2) {
padding-left: 15rpx;
}
.classif>view:nth-child(6) text:nth-child(2){
color: #FF3434;
.classif > view:nth-child(6) text:nth-child(2) {
color: #ff3434;
font-weight: bold;
}
.spcode {
width: 60rpx;
display: inline-block;
margin-top: 15rpx;
}

/*mask*/
.drawer_screen {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 1000;
background: #000;
opacity: 0.5;
overflow: hidden;
}

.drawer_box {
width: 650rpx;
position: fixed;
overflow: hidden;
top: 50%;
left: 0;
z-index: 1001;
margin: -150px 50rpx 0 50rpx;
border-radius: 3px;
}
.drawer_title {
padding: 15px;
font: 20px "microsoft yahei";
text-align: center;
}
.drawer_content {
height: 210px;
overflow-y: scroll; /*超出父盒子高度可滚动*/
}
.btn_ok {
padding: 10px;
font: 20px "microsoft yahei";
text-align: center;
border-top: 1px solid #e8e8ea;
color: #3cc51f;
}
.top {
padding-top: 8px;
}
.bottom {
padding-bottom: 8px;
}
.title {
height: 30px;
line-height: 30px;
width: 160rpx;
text-align: center;
display: inline-block;
font: 300 28rpx/30px "microsoft yahei";
}
.input_base {
border: 2rpx solid #ccc;
padding-left: 10rpx;
margin-right: 50rpx;
}
.input_h30 {
height: 30px;
line-height: 30px;
}
.input_h60 {
height: 60px;
}
.input_view {
font: 12px "microsoft yahei";
background: #fff;
color: #000;
line-height: 30px;
}
input {
font: 12px "microsoft yahei";
background: #fff;
color: #000;
}
radio {
margin-right: 20px;
}
.grid {
display: -webkit-box;
display: box;
}
.col-0 {
-webkit-box-flex: 0;
box-flex: 0;
}
.col-1 {
-webkit-box-flex: 1;
box-flex: 1;
}

.fl {
float: left;
}
.fr {
float: right;
}

.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.panel {
width: 600rpx;
border-radius: 10rpx;
background-color: #fff;
margin: 30rpx auto 0;
padding: 30rpx 0;
position: relative;
z-index: 10000000000;
}
.pane2{
background: #fff;
opacity: .6;
}
.pane2 image{
width: 500rpx;
display: block;
margin: 40rpx auto 0;
}

.barcode {
height: 100rpx;
width: 500rpx;
margin: 0 auto;
}

.barnum {
height: 46rpx;
line-height: 46rpx;
font-size: 32rpx;
text-align: center;
letter-spacing: 2rpx;
white-space: nowrap;
color: #999;
}

.barnum text {
color: #333;
}

.barcode > canvas {
width: 500rpx;
height: 100rpx;
}

.qrcode {
height: 340rpx;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
}

.qrcode > canvas {
width: 350rpx;
height: 350rpx;
}
.jine{
color: #f96563!important;
font-size: 36rpx!important;
}

+ 11
- 9
pages/order/index/index.js View File

@@ -6,15 +6,15 @@ Page({
data: {
tabs: [
{
key: 0,
key: "all",
name: "全部"
},
{
key: 1,
key: 0,
name: "待付款"
},
{
key: 2,
key: 1,
name: "已完成"
}
],
@@ -30,10 +30,10 @@ Page({
current_scroll: e.id
});
},
gotopay:function(){
console.log("000000");
gotopay:function(e){
console.log("orderId"+e.currentTarget.dataset.id);
wx.navigateTo({
url: '/pages/order/detail/index',
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}`,
success: function(res){
// success
},
@@ -54,16 +54,18 @@ Page({
* key==0
* 不发送该字段
*/
if (key == 0) {
if (key == 'all') {
var variable = {
pageNum: pageNum,
pageSize: 5
pageSize: 5,
paymentType:0
};
} else {
var variable = {
pageNum: pageNum,
pageSize: 5,
orderStatus: key
orderStatus: key,
paymentType:0
};
}



+ 7
- 3
pages/order/index/index.wxml View File

@@ -11,7 +11,9 @@
<view class='info'>
<view>
<text>{{item.title}}</text>
<text wx:if="{{item.orderStatus==1}}">等待付款</text>
<text wx:if="{{item.orderStatus==0}}">等待付款</text>
<text wx:if="{{item.orderStatus==1}}">已付款</text>
<text wx:if="{{item.orderStatus==2}}">取消</text>
</view>
<view>{{item.subTitle}}</view>
<view>
@@ -24,8 +26,10 @@
<text>¥{{item.salePrice/100}}</text>
<text>¥{{item.price/100}}</text>
</view>
<view class="btn" bindtap="gotopay">
<text>支付</text>
<view class="btn" data-id="{{item.id}}" bindtap="gotopay">
<text wx:if="{{item.orderStatus==1}}">查看详情</text>
<text wx:if="{{item.orderStatus==0}}">支付</text>
<text wx:if="{{item.orderStatus==2}}">支付</text>
</view>
</view>
</view>


+ 2
- 2
pages/order/index/index.wxss View File

@@ -25,7 +25,7 @@
display: flex;
margin: 0 4%;
margin-top: 2%;
border-bottom: 1px solid #ededed;
border-bottom: 1rpx solid #ededed;
}
.logo {
@@ -88,7 +88,7 @@
padding: 0 4%;
display: flex;
justify-content: space-between;
border-bottom: 20rpx solid #ededed;
border-bottom: 20rpx solid #f8f8f8;
}
.payment view:nth-child(1) text:nth-child(1) {


+ 0
- 1
pages/rushToBuy/index.wxml View File

@@ -24,7 +24,6 @@
<view class="view1"><text class="remainingNumber">剩余件数:</text><text class='realnumber'>{{item.remainInventory}}件</text></view>
<view class='buy'>购买</view>
</view>

</view>
</view>
</view>


+ 3
- 3
pages/user/index.wxml View File

@@ -9,13 +9,13 @@
</view>
<view class="margin"></view>
<view class="user-btns">
<navigator url="/pages/order/index/index?id=0">
<navigator url="/pages/order/index/index?id=all">
<view class="user-btn app-border-bottom">
<view>我的订单</view>
<view>全部订单</view>
</view>
</navigator>
<navigator url="/pages/order/index/index?id=1">
<navigator url="/pages/order/index/index?id=0">
<view class="user-btn app-border-bottom">
<view>待付款</view>
<view>
@@ -23,7 +23,7 @@
</view>
</view>
</navigator>
<navigator url="/pages/order/index/index?id=2">
<navigator url="/pages/order/index/index?id=1">
<view class="user-btn app-border-bottom">
<view>已完成</view>
<view>


+ 2
- 2
pages/user/index.wxss View File

@@ -1,10 +1,10 @@
.margin {
background: #f5f5f5;
background: #f8f8f8;
height: 20rpx;
}

.user {
background: #f5f5f5;
background: #f8f8f8;
min-height: 100vh;
}



+ 1
- 1
project.config.json View File

@@ -11,7 +11,7 @@
"newFeature": true
},
"compileType": "miniprogram",
"libVersion": "2.2.2",
"libVersion": "2.2.4",
"appid": "wx8eb8275b78db4ede",
"projectname": "%E5%AF%8C%E8%8C%82%E6%94%AF%E4%BB%98%E6%B5%8B%E8%AF%95",
"isGameTourist": false,


+ 22
- 1
utils/util.js View File

@@ -76,9 +76,30 @@ function fmtDate(obj) {
d.substring(d.length - 2, d.length)
);
}

//计算下单的时间与现在的时间的
function timechuo(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(month, day, hour, minute, second);
return (day+"天"+hour+"小时"+minute+"分钟")
}
module.exports = {
formatTime: formatTime,
barcode: barc,
qrcode: qrc,
fmtDate: fmtDate
fmtDate: fmtDate,
timechuo:timechuo
};

Loading…
Cancel
Save