Browse Source

edit

tags/2.2.4
shark 6 years ago
parent
commit
742528d35f
12 changed files with 334 additions and 111 deletions
  1. +22
    -1
      pages/coupon/detail/index.js
  2. +30
    -9
      pages/couponorder/detail/index.js
  3. +5
    -6
      pages/couponorder/index/index.js
  4. +3
    -3
      pages/couponorder/index/index.wxml
  5. +30
    -12
      pages/index/index.js
  6. +1
    -2
      pages/order/detail/index.js
  7. +37
    -11
      pages/orderquanma/index.js
  8. +2
    -2
      pages/passCar/couponList/couponList.wxml
  9. +122
    -16
      pages/passCar/passCar.js
  10. +33
    -26
      pages/passCar/passCar.wxml
  11. +46
    -20
      pages/passCar/passCar.wxss
  12. +3
    -3
      project.config.json

+ 22
- 1
pages/coupon/detail/index.js View File

@@ -167,10 +167,11 @@ Page({
wx.showLoading({
title: "加载中..."
});
if (that.data.data.type == 5) {
if (that.data.data.type == 6) {
this.initUsrCarList()
// 领取 5.停车券
// TODO 选取用户下的车牌

console.log(1111111111111)
} else {
Http.post({
@@ -349,6 +350,16 @@ Page({
console.log(res);
console.log("支付完成");
if (res.errMsg == "requestPayment:ok") {
if (that.data.data.type == 5) {
setTimeout(() => {
wx.switchTab({
url: '/pages/passCar/passCar'
});
}, 1600);
// this.initUsrCarList()
// 领取 5.停车券
// TODO 选取用户下的车牌
}
} else {
wx.showToast({
title: "支付失败",
@@ -370,11 +381,21 @@ Page({
} else {
// 免费券
that.payOrderUpdate(orderId, "0", 1);

wx.showToast({
title: "领取成功",
duration: 3000,
image: "./../../../assets/img/success.png"
});
//////////////////////////停车券
console.log(that.data.data.type)
if (that.data.data.type == 5) {
setTimeout(() => {
wx.switchTab({
url: '/pages/passCar/passCar'
});
}, 1600);
}
}
}
})


+ 30
- 9
pages/couponorder/detail/index.js View File

@@ -25,11 +25,13 @@ Page({
});

//获得优惠券的详情
if (
options.quancode != null &&
(options.quancode != "" && options.quancode) != undefined
) {
that.data.setInter = setInterval(function(){
that.data.setInter = setInterval(function() {
if (
options.quancode != null &&
options.quancode != "" &&
options.quancode != undefined &&
options.couponorderstatus == 0
) {
Http.get({
url: config.api.couponOrderDetail,
data: {
@@ -46,10 +48,29 @@ Page({
createDate: util.fmtDate(that.data.data.createDate)
});
});
}, 200);
}
util.barcode("barcode", options.quancode, 510, 100);
util.qrcode("qrcode", options.quancode, 350, 350);
}
}, 2000);

// if (options.couponorderstatus != "0") {
Http.get({
url: config.api.couponOrderDetail,
data: {
couponOrderId: options.quancode
}
}).then(res => {
console.log(res);
that.setData({
data: res.data
});
that.setData({
expiredTime: util.fmtDate(that.data.data.expiredTime),
updateDate: util.fmtDate(that.data.data.updateDate),
createDate: util.fmtDate(that.data.data.createDate)
});
util.barcode("barcode", options.quancode, 510, 100);
util.qrcode("qrcode", options.quancode, 350, 350);
});
// }
},
phone: function() {
let that = this;


+ 5
- 6
pages/couponorder/index/index.js View File

@@ -35,22 +35,21 @@ Page({

//点击跳转到券详情页面
gotouse: function(e) {
console.log(e.currentTarget.dataset.quancode);
console.log(e.currentTarget.dataset.couponorderstatus);
console.log("点击跳转到券详情");
wx.navigateTo({
url: `/pages/couponorder/detail/index?quancode=${
e.currentTarget.dataset.quancode
}`
e.currentTarget.dataset.quancode}&couponorderstatus=${e.currentTarget.dataset.couponorderstatus}`
});
},
getList(key, pageNum) {
var that = this;
console.log(key);
console.log(pageNum);
// console.log(key);
// console.log(pageNum);
if (that.data.allow_load) {
that.setData({
loading: true,
content: "小主,我在玩命加载中..."
content: "小主,我在玩命加载中...",
});
Http.get({
url: config.api.couponOrderList,


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

@@ -12,7 +12,7 @@
</navigator>
</view>

<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}">
<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}">
<view class='detail_msg'>
<view class='logo'>
<image src='{{item.coverImg}}'></image>
@@ -25,8 +25,8 @@
<text class="txt1">有效期至:</text>
<text class="txt2">{{item.expiredTime}}</text>
</view>
<view wx:if="{{item.couponOrderStatus==0}}" class="btns" bindtap="gotouse" data-quancode="{{item.id}}">立即使用</view>
<view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view>
<view wx:if="{{item.couponOrderStatus==0}}" class="btns">立即使用</view>
<view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view>
</view>
</view>
</view>


+ 30
- 12
pages/index/index.js View File

@@ -24,7 +24,7 @@ Page({
},

onShow: function() {
this.userLogin()
this.userLogin();
},

onGetCode: function(e) {
@@ -42,33 +42,32 @@ Page({
var that = this;
// 登录
wx.login({
success: ({
code
}) => {
success: ({ code }) => {
var usrdata = {
appId: config.weapp.AppId,
code: code,
sceneAddress: app.globalData.sceneAddress,
}
sceneAddress: app.globalData.sceneAddress
};
if (app.globalData.locationInfo) {
usrdata = {
appId: config.weapp.AppId,
code: code,
sceneAddress: app.globalData.sceneAddress,
latitude: '' + app.globalData.locationInfo.latitude,
longitude: '' + app.globalData.locationInfo.longitude,
}
latitude: "" + app.globalData.locationInfo.latitude,
longitude: "" + app.globalData.locationInfo.longitude
};
}
Http.post({
url: config.api.login,
data: usrdata
})
url: config.api.login,
data: usrdata
})
.then(res => {
console.log("userlogin:app", res);
app.globalData.token = res.data.token;
Http.setToken(res.data.token);
that.checkUserCarStatus();
that.getUserInfo();
that.getBannerlist();
if (app.couponChannelListCallback) {
app.couponChannelListCallback(app.globalData.token);
}
@@ -99,6 +98,25 @@ Page({
});
},

/**
* banner
*/
getBannerlist: function() {
let that = this;
Http.get({
url: config.api.bannerlist,
data: {
pageNum: 1,
pageSize: 10
}
}).then(res => {
console.log(res);
that.setData({
list: res.data.list
});
console.log(res.data.list);
});
},
/**
* 检查用户是否有车
*/


+ 1
- 2
pages/order/detail/index.js View File

@@ -29,7 +29,7 @@ Page({
// 2 已过期
// 3 已经退款
console.log(e);
if (that.data.mystatus == null || that.data.mystatus == undefined) {
if (that.data.mystatus == "" || that.data.mystatus == undefined) {
wx.navigateTo({
url: `/pages/orderquanma/index?quancode=${
e.currentTarget.dataset.quancode
@@ -213,7 +213,6 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onShow: function() {
console.log(this.data.mystatus)
},

/**


+ 37
- 11
pages/orderquanma/index.js View File

@@ -11,6 +11,8 @@ Page({
let that = this;
util.barcode("barcode", options.quancode, 500, 100);
util.qrcode("qrcode", options.quancode, 350, 350);

console.log("zhuangtai");
that.setData({
code: options.quancode,
title: options.title,
@@ -18,6 +20,12 @@ Page({
remark: options.remark,
couponorderstatus: options.couponorderstatus
});

console.log(options.couponorderstatus);
console.log("我是状态");
/**
* 如果没有核销
*/
that.data.setInter = setInterval(function() {
if (that.data.couponorderstatus == 0) {
Http.get({
@@ -30,20 +38,38 @@ Page({
that.setData({
couponorderstatus: res.data.CouponOrderStatus
});
/**
* 动态改变上一级页面的核销状态
*/
var pages = getCurrentPages();
var currPage = pages[pages.length - 1]; //当前页面
var prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
prevPage.setData({
mystatus:res.data.CouponOrderStatus
});
if (res.data.CouponOrderStatus == 1) {
/**
* 动态改变上一级页面的核销状态
*/
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
prevPage.setData({
mystatus: res.data.CouponOrderStatus
});
}
});
}
}, 2000);

if (that.data.couponorderstatus == 1) {
/**
* 如果已经核销
* 不需要循环
*/
Http.get({
url: config.api.getStatus,
data: {
couponOrderId: options.quancode
}
}).then(res => {
console.log(res);
that.setData({
couponorderstatus: res.data.CouponOrderStatus
});
});
}
/**
* couponorderstatus
* 0 没有核销


+ 2
- 2
pages/passCar/couponList/couponList.wxml View File

@@ -30,7 +30,7 @@
</view>
</view>
</view>
<view class='imageBox'>
<!-- <view class='imageBox'>
<image src="../../../assets/img/parkCoupon.png"></image>
<text class='text2'>2小时免费停车券</text>
<text class='text5'>京A88888</text>
@@ -38,6 +38,6 @@
<text class='text6'>至</text>
<text class='text4'>2018-09-30</text>
<text class='text1'>朝阳大悦城</text>
</view>
</view> -->
</view>
</view>

+ 122
- 16
pages/passCar/passCar.js View File

@@ -6,8 +6,10 @@ Page({
data: {
park: null,
carList: [],
payList:[],
addCar: null,
tcq: 2
tcq: 2,
flag:''
},
// ready() {
// app.couponChannelListCallback = token => {
@@ -41,6 +43,7 @@ Page({
onLoad: function (options) {
var that = this
that.init();
this.getList();
},
onShow: function (options) {
var that = this
@@ -78,27 +81,130 @@ Page({
url: '/pages/addPark/addPark',
});
},
jumpToPay: function () {
console.log("停车支付去")
//wx.redirectTo({
// url: '/pages/pay/pay',
//})
},
passb: function () {
wx.showToast({
title: '货物在路上~',
})
},
passc: function () {
wx.showToast({
title: '宝宝最可爱~',
})
},
orderPay: function () {
wx.redirectTo({
url: '/pages/pay/pay'
});
// orderPay: function () {
// wx.redirectTo({
// url: '/pages/pay/pay'
// });
// },

//券绑定卡
bindCoupon: function () {
var that = this
// ETCP
for(let car of that.data.carList){
if (car.stopFee.remainingFee){
that.data.payList.push(car)
console.log(car)
}
}
// if (that.data.payList.length==0){
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: "您还没有在场车辆!",
// })
// return
// }
var etcpData = {
etcpToken: app.globalData.etcpToken,
carNumber: that.data.payList[0].carNumber ? that.data.payList[0].carNumber:'',
couponFreeId:5655,
merchantId: 5655,
}
console.log('--->>>'+JSON.stringify(etcpData))
// 停简单
var tjdData = {
carNumber: that.data.payList[0].carNumber,
}
var postCouponData = (app.globalData.parkVendor == 1) ? etcpData : tjdData
// that.setData({
// loading: true,
// content: "正在进行车牌绑定券,请稍后...",
// });
// wx.showToast({
// title: '00000',
// })
Http.post({
url: config.api.getCoupon,
data: postCouponData,
})
.then(res => {
that.initUsrCarList()
wx.showModal({
title: '提示',
showCancel: false,
content: "车牌绑定优免券成功!",
success: function (res) {
console.log(res);
that.setData({
// flag:res.data.
})
}
})
})
.catch(error => {
console.log(error)
wx.showModal({
title: '提示',
showCancel: false,
content: error.message,
success: function () { }
})
})
},


//获取名下停车券列表
getList() {
var that = this;
console.log('1111111111111111111111.......');
// console.log(key);
// console.log(pageNum);
if (1) {
// wx.showLoading({
// title: "加载中"
// });
Http.get({
url: config.api.couponOrderList + "?type=5",
data: {
pageNum: 1,
pageSize: 8,
couponOrderStatus: 0
}
}).then(res => {
console.log('>>>>>>>>>>>>>>Res'+JSON.stringify(res))
that.setData({
couponList: res.data.list
})
console.log("姐姐的订单列表");
setTimeout(function () {
wx.hideLoading();
}, 1200);
// if (pageNum >= res.data.pages) {
// that.setData({
// allow_load: false
// });
// }
/**
* 先赋值后渲染页面
* concat 不会改变原数组值
* push 会改变原数组值,但不会一条一条插入,而是整个数组插入
*/
// that.data.list = that.data.list.concat(res.data.list);
// that.setData({
// list: that.data.list
// });
});
} else {
console.log("加载完成allow_load设置成false");
}
},

bindCar: function (carNum) {
var that = this
// ETCP


+ 33
- 26
pages/passCar/passCar.wxml View File

@@ -13,11 +13,11 @@
</view>
<view class='borderBox'>
<view class='borderUp'>我的爱车
<label class='carNumber'></label>
<label class='carNumber' bindtap="jumpToAdd" wx:if='{{carList.length<3}}'>+</label>
</view>
<view class='passNumberBox' wx:for='{{carList}}' wx:key='{{index}}'>
<view class='passUp'>
<view class='passNumber' bindtap='orderPay' style='height:{{dataHeight}};font-weight:{{dataWeight}};line-height:{{dataLineHeight}}'>
<view class='passNumber' bindtap='orderPay'>
<text class='number'>{{item.carNumber}}</text>
<!-- <text class='price'>待缴金额:¥{{item.remainingParkFee?item.remainingParkFee:'0'}}</text> -->
<!-- <text class='parkPrice'>待缴金额:¥500</text> -->
@@ -28,13 +28,16 @@
</view>
<view class='orderBox' wx:if='{{item.stopFee.remainingFee}}'>
<view class='priceBox'>
<text>待缴金额:¥{{item.stopFee.remainingFee}}</text>
<text>入场时间:{{item.stopFee.entranceTime}}</text>
</view>
<view class='payBox'>
<view class='priceBox right'>
<text class="textRight">待缴金额:¥{{item.stopFee.remainingFee}}</text>
</view>
<!-- <view class='payBox'>
<navigator target="miniProgram" open-type="navigate" app-id="wx192b7d2e8dcbefd0" path="" extra-data="{{item.extraData}}" version="release">
<button>去支付</button>
</navigator>
</view>
</view> -->
</view>
</view>
<!-- <view class='passNumberBox'>
@@ -53,30 +56,32 @@
<button class='deleteButton' bindtap='unbindCarBtn' data-car='{{item.carNumber}}'>解绑</button>
</view> -->

<view class='addBox' wx:if='{{carList.length<3}}'>
<!-- <view class='addBox' wx:if='{{carList.length<3}}'>
<view class='add' bindtap="jumpToAdd">
<text>+</text>添加爱车</view>
</view>
</view> -->
</view>
<view class='bottonBox'>
<navigator url="/pages/passCar/couponList/couponList">
<view class='textStyle' bindtap='showquan'>
<image src='../../assets/img/quan.png'></image>
我的停车券
<view class='detail'>
<!-- <image wx:if="{{tcq==1}}" src='../../assets/img/down.png'></image> -->
<image src='../../assets/img/right.png'></image>
<navigator url="/pages/passCar/couponList/couponList">
<view class='textStyle' bindtap='showquan'>
<image src='../../assets/img/quan.png'></image>
我的停车券
<view class='detail'>
<!-- <image wx:if="{{tcq==1}}" src='../../assets/img/down.png'></image> -->
<image src='../../assets/img/right.png'></image>
</view>
</view>
</view>
</navigator>
<!-- <view class='voucher' wx:if="{{tcq==1}}">
<text class='textV1'>2小时免费</text>
<text class='textV2'>蒙B35412</text>
<text class='textV1'>¥10.00元</text>
<view class='choice'>
<image src='../../assets/img/choiced.png'></image>
</navigator>
<view class='passNumberBox' wx:for='{{couponList}}' wx:key='{{index}}'>
<view class='voucher' wx:if="!{{tcq==1}}">
<text class='textV1 textV3'>{{item.title}}</text>
<text class='textV2'>{{item.merchantName}}</text>
<text class='textV1'>{{'¥'+item.price/100}}</text>
<view class='choice'>
<image src='../../assets/img/choiced.png'></image>
</view>
</view>
</view> -->
</view>
<!-- <view class='textStyle' bindtap='passb'>
<image src='../../assets/img/jilu.png'></image>
停车记录
@@ -92,7 +97,9 @@
</view>
</view>
</view>
<!-- <view class="buy-view app-border-top">
<button bindtap='orderFunc' class='buy'>立即支付</button>
</view> -->
<view bindtap='bindCoupon' class="buy-view app-border-top" wx:if='{{payList.length}}'>
<navigator class='buyBox' target="miniProgram" open-type="navigate" app-id="wx192b7d2e8dcbefd0" path="" extra-data="{{item.extraData}}" version="release">
</navigator>
<button class='buy'>立即支付</button>
</view>
</view>

+ 46
- 20
pages/passCar/passCar.wxss View File

@@ -63,12 +63,14 @@ color: transparent;

}
.carNumber{
padding: 50rpx;
height: 50rpx;
line-height: 50rpx;
font-size: 28rpx;
color: #cbcbcb;
background-color: white;
height:50rpx;
line-height:50rpx;
font-size:50rpx;
color:#cbcbcb;
background-color:white;
text-align:right;
margin:0 0 0 440rpx;
font-weight:800;
}
.addBox{
width: 750rpx;
@@ -92,7 +94,7 @@ color: transparent;
}
.bottonBox{
width: 750rpx;
margin-top: 26rpx;
margin-top: 50rpx;
}
.textStyle{
background-color: white;
@@ -121,11 +123,10 @@ color: transparent;
}
.passNumber{
width: 400rpx;
height: 150rpx;

height: 100rpx;
font-size: 32rpx;
font-weight: 600;
line-height: 150rpx;
line-height: 100rpx;
left: 55rpx;
position: absolute;
}
@@ -149,6 +150,12 @@ color: transparent;
right: 30rpx;
position: absolute;
transform: translate(0,-50%);
color: white;
background-color: #00c0ff!important;

}
.deleteButton button{
background-color: #00c0ff!important;
}
.detail{
width: 32rpx;
@@ -167,37 +174,39 @@ color: transparent;
.voucher{
width: 90%;
padding: 0 5%;
background-color: rgb(255, 178, 50);
background-color: #fff;
/* background-color: #cbcbcb; */
height: 80rpx;
position: relative;
margin: 24rpx 0;
margin: 0 0 12rpx 0;
border-bottom: 2rpx #fff solid;
display: flex;
justify-content: space-between;
}
.textV1,.textV2{
height: 58rpx;
width: 225rpx;
width: 100rpx;
padding-top: 22rpx;
text-align: center;
line-height: 80rxp;
font-size: 28rpx;
color: #fff;
color: #333;
}
.textV2{
margin-top: -1rpx;
padding: 0;
/* background-color: rgb(0, 192, 255); */
border-radius: 10rpx;
width: 221rpx;
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 36rpx;
font-size: 28rpx;
border: 4rpx #fff solid;
margin-bottom: 22rpx;
}
.textV3{
width: 225rpx;
}
/* .textV1{
position: absolute;
left: 10rpx;
@@ -235,7 +244,7 @@ color: transparent;
background: #00c0ff;
height: 88rpx;
width: 98%;
margin: 30rpx auto;
margin: 0 auto;
color: #fff;
font-size: 36rpx;
line-height: 88rpx;
@@ -256,11 +265,11 @@ color: transparent;

.passUp {
width: 100%;
height: 150rpx;
height: 100rpx;
position: relative;
}
.priceBox{
width: 500rpx;
width: 420rpx;
}
.priceBox text{
margin-top: 35rpx;
@@ -289,3 +298,20 @@ input{
button::after{
border:none;
}
.right{
width: 328rpx;
}
.textRight{
margin-left: 0;
margin-right: 25rpx;
text-align: right;
font-size: 30rpx!important;
color: red!important;
}
.buyBox{
width: 750rpx;
height: 88rpx;
position:absolute;
left: 0;
top: 0;
}

+ 3
- 3
project.config.json View File

@@ -1,5 +1,5 @@
{
"description": "项目配置文件",
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
@@ -11,9 +11,9 @@
"newFeature": true
},
"compileType": "miniprogram",
"libVersion": "2.2.4",
"libVersion": "2.2.5",
"appid": "wxb11603577a84a86d",
"projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2%E6%B5%8B%E8%AF%95",
"projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2",
"isGameTourist": false,
"condition": {
"search": {


Loading…
Cancel
Save