Browse Source

[停车选择优惠券][修改]:停车选择优惠券的修改,停车页面样式的问题

tags/2.2.4
meo 6 years ago
parent
commit
392b264597
13 changed files with 526 additions and 162 deletions
  1. +1
    -0
      app.json
  2. BIN
      assets/img/gou.png
  3. +74
    -0
      pages/passCar/choicecoupon/choicecoupon.js
  4. +3
    -0
      pages/passCar/choicecoupon/choicecoupon.json
  5. +39
    -0
      pages/passCar/choicecoupon/choicecoupon.wxml
  6. +211
    -0
      pages/passCar/choicecoupon/choicecoupon.wxss
  7. +3
    -2
      pages/passCar/couponDetail/couponDetail.wxss
  8. +3
    -3
      pages/passCar/couponList/couponList.wxml
  9. +145
    -122
      pages/passCar/passCar.js
  10. +19
    -22
      pages/passCar/passCar.wxml
  11. +26
    -11
      pages/passCar/passCar.wxss
  12. +1
    -1
      pages/ques/ques.wxss
  13. +1
    -1
      pages/user/index.wxml

+ 1
- 0
app.json View File

@@ -25,6 +25,7 @@
"pages/addPark/addPark",
"pages/orderquanma/index",
"pages/passCar/couponList/couponList",
"pages/passCar/choicecoupon/choicecoupon",
"pages/passCar/couponDetail/couponDetail",
"pages/managelicenseplate/managelicenseplate"
],


BIN
assets/img/gou.png View File

Before After
Width: 81  |  Height: 82  |  Size: 16 KiB

+ 74
- 0
pages/passCar/choicecoupon/choicecoupon.js View File

@@ -0,0 +1,74 @@
const format = require("../../../utils/util.js");
const config = require("../../../config/config.js");
const app = getApp();
const Http = require("../../../utils/HttpBasics");
Page({
data: {
list: [],
current: "0",
current_scroll: "0",
page: 1,
allow_load: true
},
onLoad(options) {
this.getList(0, 0);
if (options.quanid){
this.setData({
quanid: options.quanid
})
}
},
/**
* 选择使用的优惠券
*/
choicecoupon: function(e) {
wx.navigateBack();
console.log(e);
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2] //上一个页面
var that = this;
var quantitle = e.currentTarget.dataset.title;
var quanid = e.currentTarget.dataset.id;
prevPage.setData({
quantitle: quantitle,
quanid: quanid,
});
wx.setStorage({
key: 'chosed',
data: 'chosed',
})
},
getList(key, pageNum) {
var that = this;
console.log(key);
console.log(pageNum);
if (that.data.allow_load) {
Http.get({
url: config.api.couponOrderList + "?type=5",
data: {
pageNum: pageNum,
pageSize: 20,
couponOrderStatus: key
}
}).then(res => {
console.log(res);
res.data.list.map(file => {
file.expiredTime = format.formatTime(
file.expiredTime,
"yyyy-MM-dddd hh:mm:ss"
);
});
if (pageNum > res.data.pages) {
that.setData({
allow_load: false
});
}
that.data.list = that.data.list.concat(res.data.list);
that.setData({
list: that.data.list
});
});
}
},
});

+ 3
- 0
pages/passCar/choicecoupon/choicecoupon.json View File

@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "停车券"
}

+ 39
- 0
pages/passCar/choicecoupon/choicecoupon.wxml View File

@@ -0,0 +1,39 @@
<view class="market">
<view style='padding-top:30rpx;'>
<view class="nocoupon" wx:if="{{list.length==0}}">
<image src="./../../../assets/img/coupon.png" mode="widthFix" />
<text class="txt001">请您敬请期待</text>
<text class='txt002'>我们正在筹备一大波优惠活动</text>
<navigator class='nav' url="/pages/index/index" open-type="switchTab" hover-class="other-navigator-hover">
<button hover-class='active'>前往首页看看</button>
</navigator>
</view>

<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="choicecoupon" data-title="{{item.title}}" data-id="{{item.id}}">
<view class='mms'>
<image class='gou' wx:if="{{item.id==quanid}}" mode='widthFix' src='../../../assets/img/gou.png'></image>
<view class='detail_msg'>
<view class='info'>
<view class='title'>
<text>{{item.title}}</text>
</view>
<view class='subtitle'>
<text>{{item.subTitle}}</text>
</view>
<view class="btns">{{item.salePrice/100}}
<text class='yuan'>元</text>
</view>
</view>
</view>
<image class="liness" src='./../../../assets/img/liness.png' mode="widthFix"></image>
<view class='expiretime'>
<text class="txt1">有效期至:</text>
<text class="txt2">{{item.expiredTime}}</text>
</view>
</view>
</view>
<view class="loading" wx:if="{{loading}}">
<image src="./../../../assets/img/loading.gif" mode="widthFix"></image>{{content}}
</view>
</view>
</view>

+ 211
- 0
pages/passCar/choicecoupon/choicecoupon.wxss View File

@@ -0,0 +1,211 @@
.market {
width: 100%;
height: 100%;
/* background: #f5f5f5; */
}

.tabs {
width: 100% !important;
height: 88rpx;
text-align: center;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100000;
}

.i-tab {
width: 25% !important;
display: inline-block;
}

.section {
position: relative;
}

.mms {
position: relative;
width: 690rpx;
background: #fff;
padding: 20rpx 0 0;
margin: 0 auto 46rpx;
border-top: 8rpx solid #02b7ff;
box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.10);
}

.detail_msg {
display: flex;
}

.expiretime {
display: block;
width: 100%;
text-align: left;
text-indent: 1em;
height: 50rpx;
line-height: 50rpx;
font-size: 22rpx;
color: #999;
letter-spacing: 0;
}

.liness {
display: block;
width: 100%;
margin-top: 20rpx;
}

.logo {
width: 60rpx;
height: 60rpx;
border: 1px solid #f8f8f8;
border-radius: 50rpx;
display: block;
margin-left: 20rpx;
}

.logo image {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
}

.info view:nth-child(1) {
display: flex;
justify-content: space-between;
padding: 0 2%;
}

.info {
width: 100%;
}

.info view:nth-child(1) text {
font-size: 32rpx;
line-height: 32rpx;
height: 32rpx;
color: #333;
letter-spacing: 0;
width: 400rpx;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}

.info view:nth-child(2) {
padding-left: 2%;
font-size: 22rpx;
color: #333;
letter-spacing: 0;
margin-top: 6rpx;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 400rpx;
}

.info view:nth-child(3) {
margin-left: 20rpx;
}

.btns {
position: absolute;
right: 57rpx;
top: 0;
bottom: 0;
margin: auto;
width: 180rpx;
height: 48rpx;
line-height: 48rpx;
text-align: right;
color: #f96563;
font-size: 40rpx;
}

.yuan {
color: #333;
font-size: 26rpx;
}

.txt1 {
font-size: 22rpx;
color: #333;
letter-spacing: 0;
}

.nocoupon image {
width: 300rpx;
display: block;
margin: 3% auto 0;
}

.txt001 {
display: block;
line-height: 48rpx;
font-size: 34rpx;
color: #333;
letter-spacing: 0;
text-align: center;
}

.txt002 {
display: block;
margin-top: 1%;
font-size: 28rpx;
color: #999;
letter-spacing: 0;
line-height: 40rpx;
text-align: center;
}

.nocoupon button {
background: #00c0ff;
color: #fff;
font-style: 30rpx;
width: 100%;
border-radius: 60rpx;
}

.loading {
text-align: center;
height: 80rpx;
line-height: 80rpx;
font-size: 26rpx;
color: #999;
}

.loading image {
width: 60rpx;
height: 60rpx;
vertical-align: middle;
margin-right: 10rpx;
}

.active {
opacity: 0.6;
}

.nav {
position: absolute;
bottom: 3.3%;
left: 0;
right: 0;
margin: auto;
width: 670rpx;
border-radius: 60rpx;
background: #02c0ff;
font-size: 32px;
color: #fff;
text-align: center;
line-height: 32px;
}

.gou {
position: absolute;
top: -15rpx;
right: -10rpx;
width: 60rpx;
}

+ 3
- 2
pages/passCar/couponDetail/couponDetail.wxss View File

@@ -73,6 +73,7 @@
}
.coupon_detail {
padding: 0 20rpx;
margin-top: 30rpx;
}
.fl {
@@ -154,8 +155,8 @@
display: flex;
flex-direction: column;
background: #fff;
border-bottom: 20rpx solid #f5f5f5;
border-top: 20rpx solid #f5f5f5;
border-bottom: 6rpx solid #f5f5f5;
border-top: 6rpx solid #f5f5f5;
position: relative;
}


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

@@ -16,9 +16,9 @@
<view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}">
<view class='mms'>
<view class='detail_msg'>
<view class='logo'>
<!-- <view class='logo'>
<image mode="aspectFill" src='{{item.coverImg}}'></image>
</view>
</view> -->
<view class='info'>
<view class='title'>
<text>{{item.title}}</text>
@@ -26,7 +26,7 @@
<view class='subtitle'>
<text>{{item.subTitle}}</text>
</view>
<view hover-class='active' wx:if="{{item.couponOrderStatus==0}}" class="btns">去使用</view>
<view hover-class='active' wx:if="{{item.couponOrderStatus==0}}" class="btns">查看</view>
<view hover-class='active' wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view>
</view>
</view>


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

@@ -43,6 +43,23 @@ Page({
url: '/pages/managelicenseplate/managelicenseplate',
})
},

onShow: function (options) {
var that = this;
that.getList();
that.init();
/**
* 只有用户选择了优惠券
* 才会进行券和车牌的绑定
*/
if (wx.getStorageSync("chosed") && that.data.quanid) {
that.bindCoupon(that.data.quanid);
wx.setStorage({
key: 'chosed',
data: '',
})
}
},
onLoad: function (options) {
var that = this;
/**
@@ -50,13 +67,12 @@ Page({
* title
* desc
*/

Http.get({
url: config.api.getWeapNote,
data: {
appId: config.weapp.AppId,
}
})
url: config.api.getWeapNote,
data: {
appId: config.weapp.AppId,
}
})
.then(res => {
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
@@ -64,7 +80,6 @@ Page({
title: weapNote.carpage.title
})
});

},


@@ -80,48 +95,62 @@ Page({
},


//券绑定车牌
bindCoupon: function (e) {
console.log(e);
/**
* 券绑定车牌
*/
bindCoupon: function (quanid) {
var that = this;
wx.showLoading({
title: '加载中...',
});
if (that.data.couponList.length > 0) {
/**
* etcp
*/
var etcpData = {
etcpToken: app.globalData.etcpToken,
carNumber: that.data.listCardNum,
/**
* 待解决
*/
couponOrderId: that.data.couponList[0].id
};
console.log(etcpData);
/**
* etcp
*/
var etcpData = {
etcpToken: app.globalData.etcpToken,
carNumber: that.data.listCardNum,
/**
* 停简单
* 待解决
*/
var tjdData = {
carNumber: that.data.listCardNum
};
var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
Http.post({
url: config.api.getCarCoupon,
data: postCouponData
})
.then(res => {
that.initUsrCarList();
wx.hideLoading();
})
.catch(error => {
console.log(error);
couponOrderId: quanid
};
console.log(etcpData);
/**
* 停简单
*/
var tjdData = {
carNumber: that.data.listCardNum
};
var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
Http.post({
url: config.api.getCarCoupon,
data: postCouponData
})
.then(res => {
that.initUsrCarList();
})
.catch(error => {
wx.showModal({
content: error.message,
showCancel: false,
confirmText: "确定",
})
} else {
console.log("没有停车券可以绑定")
wx.hideLoading();
console.log(error);
})
},
/**
* 选择优惠券
*/
gotoquan: function () {
let that = this;
console.log(that.data.quanid);
if (that.data.quanid){
wx.navigateTo({
url: `/pages/passCar/choicecoupon/choicecoupon?quanid=${that.data.quanid}`,
})
}else{
wx.navigateTo({
url: '/pages/passCar/choicecoupon/choicecoupon',
})
}
},

//获取名下停车券列表
@@ -142,16 +171,70 @@ Page({
});
},

onShow: function (options) {

/**
* 共同登录
*/
init: function (carNumber) {
var that = this;
that.getList();
that.init();
app.parkInitCallback = token => {
that.initPark();
if (!app.globalData.carLogin) {
/**
* 判断是否授权手机号
*/
Http.post({
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
console.log(res);
Http.post({
url: config.api.carInit,
data: {
phone: app.globalData.phone
}
}).then(res => {
console.log(res);
app.globalData.carLogin = true;
app.globalData.parkVendor = res.data.vendor;
if (res.data.token) {
app.globalData.etcpToken = res.data.token;
}
/**
* 获得停车费用
*/
that.initUsrCarList("flags");
console.log(app.globalData.etcpToken);
});
})
.catch(err => {
console.log(err);
if (err.code == 11005) {
// 用户手机未授权
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index"
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput"
});
}
})
}
};
if (app.globalData.token && app.globalData.token != null) {
app.parkInitCallback(app.globalData.token);
}
},

/**
* 绑定车牌
*/

bindCar: function (carNum) {
var that = this;
// ETCP
@@ -164,9 +247,9 @@ Page({
};
var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
Http.post({
url: config.api.bindCar,
data: postData
})
url: config.api.bindCar,
data: postData
})
.then(res => {
console.log(res);
// that.initUsrCarList();
@@ -174,7 +257,7 @@ Page({
title: "提示",
showCancel: false,
content: "绑车牌成功!",
success: function () {}
success: function () { }
});
})
.catch(error => {
@@ -183,7 +266,7 @@ Page({
title: "提示",
showCancel: false,
content: error.message,
success: function () {}
success: function () { }
});
});
},
@@ -223,7 +306,7 @@ Page({
* flag ==flags
* 表示从首页onShow进来的
*/
if (flag == "flags") {
if (flag == "flags" && res.data.length > 0) {
var listCardNum = res.data[0].carNumber;
console.log(listCardNum);
that.setData({
@@ -247,9 +330,9 @@ Page({
etcpToken: app.globalData.etcpToken,
carNumber: carNumber
} : {
carNumber: carNumber,
outCarId: outCarId
};
carNumber: carNumber,
outCarId: outCarId
};
var extraDataStr = {
params: {
CarNumber: carNumber
@@ -259,9 +342,9 @@ Page({
extraData: extraDataStr
});
Http.post({
url: config.api.getCarStopFee,
data: postData
})
url: config.api.getCarStopFee,
data: postData
})
.then(res => {
that.setData({
stopFees: res.data
@@ -284,69 +367,9 @@ Page({
},

/**
* 共同登录
*/
init: function (carNumber) {
var that = this;
app.parkInitCallback = token => {
that.initPark();
if (!app.globalData.carLogin) {
/**
* 判断是否授权手机号
*/
Http.post({
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
console.log(res);
Http.post({
url: config.api.carInit,
data: {
phone: app.globalData.phone
}
}).then(res => {
console.log(res);
app.globalData.carLogin = true;
app.globalData.parkVendor = res.data.vendor;
if (res.data.token) {
app.globalData.etcpToken = res.data.token;
}
/**
* 获得停车费用
*/
that.initUsrCarList("flags");
console.log(app.globalData.etcpToken);
});
})
.catch(err => {
console.log(err);
if (err.code == 11005) {
// 用户手机未授权
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index"
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput"
});
}
})
}
};
if (app.globalData.token && app.globalData.token != null) {
app.parkInitCallback(app.globalData.token);
}
},
/**
* 下拉刷新
*/
onPullDownRefresh: function(e) {
onPullDownRefresh: function (e) {
let that = this;
that.initUsrCarList("flags");
wx.stopPullDownRefresh();


+ 19
- 22
pages/passCar/passCar.wxml View File

@@ -4,9 +4,9 @@
<view class='fl'>
<text class='mycar'>{{park.addr}}</text>
</view>
<view class='fr' bindtap='gotomange'>
总车位:{{park.number}}个
</view>
</view>
<view class='price clearfix'>
<text style='color:#666;'>总车位:{{park.number}}个</text>
</view>
<view class='price clearfix'>
<text class='fl'>停车费:</text>
@@ -19,8 +19,7 @@
<!-- 有车牌的时候显示 -->
<view class='passUp'>
<view class='addicense_active' wx:if='{{carList.length>0}}'>
<swiper current="{{current}}" bindchange='onSlideChangeEnd' class='swiper' circular='true' indicator-dots='{{indicatorDots}}'
autoplay='{{autoplay}}' interval='500' duration='500'>
<swiper current="{{current}}" bindchange='onSlideChangeEnd' class='swiper' circular='true' indicator-dots='{{indicatorDots}}' autoplay='{{autoplay}}' interval='500' duration='500'>
<block wx:for='{{carList}}' wx:key="unique">
<swiper-item class="swiper-item" data-memberKeyword='{{item.carNumber}}'>
<view class='clearfix clearfix1'>
@@ -47,18 +46,27 @@
<text class="fl">停车时长:</text>
<text class='fr time'>{{timecha}}</text>
</view>
<view class='coupon clearfix' wx:if="{{couponList.length>0}}">


<view class='coupon clearfix' bindtap='gotoquan' wx:if="{{couponList.length>0}}">
<text class='fl'><text class='jians'>券</text>优惠券:</text>
<text class='fr'>2小时优免券</text>
<view class="fr">
<text wx:if="{{quantitle}}">{{quantitle}}</text>
<text wx:else>{{couponList.length}}张可用</text>
<image class='jiant' src='../../assets/img/jian.png' mode='widthFix'></image>
</view>


</view>

<view class="clearfix">
<text class="fl">待缴费用:</text>
<text class='fr'>{{stopFees.remainingFee}}<text class='yuan'>元</text></text>
<text class='fr' style='color:#ff4949;'>{{stopFees.remainingFee}}<text class='yuan'>元</text></text>
</view>

<view bindtap='bindCoupon' class="buy-view" wx:if="{{stopFees.remainingFee&&carList.length>0&&3>=carList.length}}">
<navigator class='buyBox' target="miniProgram" open-type="navigate" app-id="wx192b7d2e8dcbefd0" path=""
extra-data='{{extraData}}' version="release">
<view class="buy-view" wx:if="{{stopFees.remainingFee}}">
<navigator class='buyBox' target="miniProgram" open-type="navigate" app-id="wx192b7d2e8dcbefd0" extra-data='{{extraData}}' version="release">
</navigator>
<button class='buy' hover-class='active'>立即支付</button>
</view>
@@ -98,16 +106,5 @@
<image src='../../assets/img/jian.png'></image>
</view>
</view>

</view>
<!-- <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>

+ 26
- 11
pages/passCar/passCar.wxss View File

@@ -3,7 +3,11 @@
page {
background-color: #fff;
}
.container{
padding-bottom: 60rpx;
}
.top{
padding-bottom: 34rpx;
}
.headBox {
width: 690rpx;
@@ -60,7 +64,7 @@ page {
width: 690rpx;
font-size: 28rpx;
color: #999;
margin: 10rpx auto 60rpx;
margin: 10rpx auto 0;
}

.time {
@@ -150,7 +154,10 @@ page {

.bottonBox {
width: 750rpx;
margin-top: 30rpx;
margin-top: 32rpx;
margin-bottom: 80rpx;
border-top: 16rpx #f8f8f8 solid;
padding-top: 13rpx;
}

.textStyle {
@@ -218,7 +225,7 @@ page {

.passNumberBox {
width: 690rpx;
margin: 50rpx auto 0;
margin: 32rpx auto 0;
position: relative;
background-color: white;
}
@@ -383,7 +390,7 @@ page {
background: #fff;
position: relative;
height: 88rpx;
margin-top: 50rpx;
margin-top: 30rpx;
}

.buy {
@@ -415,15 +422,15 @@ page {

.borderBox {
width: 750rpx;
border-top: 4rpx #f8f8f8 solid;
border-top: 16rpx #f8f8f8 solid;
}

.carmanage {
position: relative;
width: 690rpx;
margin: 0 auto;
height: 80rpx;
line-height: 82rpx;
margin: 15rpx auto 0;
height: 60rpx;
line-height: 60rpx;
/* border-bottom: 1rpx solid #eee; */
}

@@ -464,7 +471,7 @@ page {
.mycar {
display: inline-block;
font-size: 33rpx;
color: #333;
color: #666;
line-height: 35rpx;
letter-spacing: 1.16rpx;
}
@@ -579,13 +586,13 @@ button::after {
}

.orderBox .fl {
line-height: 60rpx;
line-height: 67rpx;
font-size: 28rpx;
color: #333;
}

.orderBox .fr {
line-height: 60rpx;
line-height: 67rpx;
font-size: 28rpx;
color: #ff4949;
}
@@ -602,3 +609,11 @@ button::after {
border-radius: 6rpx;
margin-right: 6rpx;
}
.jiant{
display: inline-block;
width: 44rpx;
height: 44rpx;
vertical-align: middle;
margin-top: -6rpx;
margin-right: -10rpx;
}

+ 1
- 1
pages/ques/ques.wxss View File

@@ -1,5 +1,5 @@
.content {
padding: 0 30rpx;
padding: 0 30rpx 30rpx 30rpx;
margin: 30rpx auto;
}



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

@@ -67,7 +67,7 @@
<view class="margin"></view>
<!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> -->
<view bindlongtap='showVersion' class='version'>
<view wx:if="{{flag=='show'}}">版本号:2.0.8</view>
<view wx:if="{{flag=='show'}}">版本号:2.0.9</view>
<view wx:if="{{flag=='hidden'}}"></view>
</view>
</view>


Loading…
Cancel
Save