浏览代码

[我的,停车优惠券][修改]:我的页面样式修改,停车优惠券换接口

tags/2.2.4
meo 6 年前
父节点
当前提交
8a70e509f6
共有 21 个文件被更改,包括 832 次插入873 次删除
  1. 二进制
      assets/img/active.gif
  2. 二进制
      assets/img/edit.png
  3. 二进制
      assets/img/redirect.png
  4. +1
    -1
      pages/coupon/detail/index.js
  5. +6
    -6
      pages/couponorder/detail/index.js
  6. +56
    -86
      pages/edit/edit.js
  7. +1
    -1
      pages/edit/edit.wxml
  8. +3
    -2
      pages/index/index.js
  9. +4
    -2
      pages/index/index.wxml
  10. +1
    -1
      pages/order/detail/index.js
  11. +1
    -1
      pages/order/index/index.js
  12. +1
    -1
      pages/passCar/choicecoupon/choicecoupon.js
  13. +2
    -2
      pages/passCar/couponDetail/couponDetail.js
  14. +35
    -35
      pages/passCar/couponDetail/couponDetail.wxml
  15. +1
    -1
      pages/passCar/couponDetail/couponDetail.wxss
  16. +2
    -2
      pages/passCar/couponList/couponList.js
  17. +483
    -479
      pages/passCar/passCar.js
  18. +1
    -1
      pages/rushToBuy/index.js
  19. +117
    -155
      pages/user/index.js
  20. +76
    -76
      pages/user/index.wxml
  21. +41
    -21
      pages/user/index.wxss

二进制
assets/img/active.gif 查看文件

之前 之后
宽度: 175  |  高度: 101  |  大小: 32 KiB

二进制
assets/img/edit.png 查看文件

之前 之后
宽度: 46  |  高度: 46  |  大小: 2.0 KiB

二进制
assets/img/redirect.png 查看文件

之前 之后
宽度: 10  |  高度: 17  |  大小: 364 B

+ 1
- 1
pages/coupon/detail/index.js 查看文件

@@ -103,7 +103,7 @@ Page({
if (res.data.endTime){
that.countdown(res.data.endTime);
//当前时间与优惠券下架时间做计算
var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dddd hh:mm:ss");
var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss");
if (util.timechuo(endTime).indexOf('-') == 0) {
that.setData({
endtime: "活动已结束",


+ 6
- 6
pages/couponorder/detail/index.js 查看文件

@@ -66,9 +66,9 @@ Page({
});
}
that.setData({
expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dddd hh:mm:ss"),
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dddd hh:mm:ss"),
createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dddd hh:mm:ss")
expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"),
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"),
createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss")
});
});
}
@@ -89,9 +89,9 @@ Page({
data: res.data
});
that.setData({
expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dddd hh:mm:ss"),
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dddd hh:mm:ss"),
createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dddd hh:mm:ss")
expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"),
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"),
createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss")
});
util.barcode("barcode", options.quancode, 510, 100);
util.qrcode("qrcode", options.quancode, 350, 350);


+ 56
- 86
pages/edit/edit.js 查看文件

@@ -13,7 +13,8 @@ Page({
items: [
{ name: 1, value: '男', checked: false },
{ name: 2, value: '女', checked: false },
]
],
username: ""
},
/**
* 获得生日
@@ -34,7 +35,7 @@ Page({
console.log(res);
that.setData({
name: res.name,
address: res,
address: JSON.stringify(res),
})
},
fail: function (error) {
@@ -60,15 +61,15 @@ Page({
var sex = that.data.sex;
}
if (that.data.address) {
var address = JSON.stringify(that.data.address);
var address = that.data.address;
}
else {
var address = null;
}
console.log(e.detail.value.username)
if (e.detail.value.username) {
var username = e.detail.value.username;
} else if (that.data.username) {
}
else if (that.data.username) {
var username = that.data.username;
}
else {
@@ -79,11 +80,6 @@ Page({
} else {
var birthdate = null;
}
console.log(username);
console.log(address);
console.log(sex);
console.log(birthdate);

if (username == null || address == null || sex == 0 || birthdate == null) {
wx.showModal({
title: '提示',
@@ -91,6 +87,10 @@ Page({
showCancel: false
})
} else {
console.log(username)
console.log(address)
console.log(sex)
console.log(birthdate)
Http.post({
url: config.api.updateInfo,
data: {
@@ -114,7 +114,6 @@ Page({
})
})
}

},
radioChange: function (e) {
console.log(e.detail.value)
@@ -128,80 +127,51 @@ Page({
*/
onLoad: function (options) {
let that = this;
that.setData({
username: options.name,
sex: options.sex,
date: util.fmtDate(parseInt(options.birthdate)),
name: JSON.parse(options.address).name,
address: JSON.parse(options.address),
flag: 2
});
if (options.sex == "1") {
var checked = 'items[' + 0 + '].checked'
that.setData({
[checked]: true
})
that.setData({
flagsex: 1
})
} else if (options.sex == "2") {
var checked = 'items[' + 1 + '].checked'
that.setData({
[checked]: true
})
that.setData({
flagsex: 1
})
console.log(that.data.items);
}
},

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

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
console.log("oShow")
},

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

},

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

},

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

},

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

},

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

Http.get({
url: config.api.getScore,
data: {}
}).then(res => {
console.log(res);
if (res.data.address && JSON.parse(res.data.address).name) {
that.setData({
address: res.data.address,
name: JSON.parse(res.data.address).name,
})
}
if (!JSON.parse(res.data.address).name) {
that.setData({
name: null,
})
}
if (res.data.name) {
that.setData({
username: res.data.name
})
}
if (res.data.sex) {
if (res.data.sex == 1) {
var checked = 'items[' + 0 + '].checked'
that.setData({
[checked]: true,
flagsex: 1
})
} else if (res.data.sex == 2) {
var checked = 'items[' + 1 + '].checked'
that.setData({
[checked]: true,
flagsex: 1
})
}
that.setData({
sex: res.data.sex
})
}
if (res.data.birthdate) {
that.setData({
date: util.fmtDate(parseInt(res.data.birthdate)),
flag: 2
})
}
})
}
})

+ 1
- 1
pages/edit/edit.wxml 查看文件

@@ -2,7 +2,7 @@
<view class='section'>
<text>姓名</text>
<input wx:if="{{username}}" name="username" type="text" placeholder='{{username}}'/>
<input wx:if="{{!username}}" type="text" placeholder='请填写名字' disabled/>
<input wx:if="{{!username}}" name="username" type="text" placeholder='请填写名字'/>
</view>
<view class="section sec">
<text>生日</text>


+ 3
- 2
pages/index/index.js 查看文件

@@ -1,3 +1,4 @@

const Http = require("../../utils/HttpBasics");
const config = require("../../config/config");
let app = getApp();
@@ -26,6 +27,7 @@ Page({
url: '../game/index',
})
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -159,7 +161,7 @@ Page({
}
Http.setToken(res.data.token);
that.checkUserCarStatus();
// that.getUserInfo();
that.getUserInfo();
that.getBannerlist();
if (app.couponChannelListCallback) {
app.couponChannelListCallback(app.globalData.token);
@@ -273,7 +275,6 @@ Page({
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
debugger
console.log("getUserInfo", res);
}
});


+ 4
- 2
pages/index/index.wxml 查看文件

@@ -1,11 +1,13 @@

<view class="container">
<c-banner wx:key="unique" list="{{list}}" />
<c-rushToBuy />
<view class='game' bindtap="gotogame" wx:if="{{showGame}}">
<!-- 小游戏暂时注释 -->
<!-- <view class='game' bindtap="gotogame" wx:if="{{showGame}}">
<image src='./../../assets/img/game.png' mode='widthFix'></image>
<text>新用户专享神秘礼物</text>
<text>独家福利,抢完即止</text>
</view>
</view> -->
<c-coupons id="lists" bind:myevent="onGetCode" />
<g-entry id="listss" wx:if="{{showGame&&!played&&!havePlayEd}}" gamedata="{{gamedata}}" bind:myevent="" />
</view>

+ 1
- 1
pages/order/detail/index.js 查看文件

@@ -77,7 +77,7 @@ Page({
});

//createDate 创建时间
var createDate = util.formatTime(res.data.createDate, "yyyy-MM-dddd hh:mm:ss");
var createDate = util.formatTime(res.data.createDate, "yyyy-MM-dd hh:mm:ss");
console.log(createDate);
that.setData({
createDate: createDate


+ 1
- 1
pages/order/index/index.js 查看文件

@@ -105,7 +105,7 @@ Page({


for (let i = 0; i < that.data.list.length; i++) {
var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dddd hh:mm:ss");
var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dd hh:mm:ss");
/**
* 修改list的endtime
* 渲染到页面


+ 1
- 1
pages/passCar/choicecoupon/choicecoupon.js 查看文件

@@ -56,7 +56,7 @@ Page({
res.data.list.map(file => {
file.expiredTime = format.formatTime(
file.expiredTime,
"yyyy-MM-dddd hh:mm:ss"
"yyyy-MM-dd hh:mm:ss"
);
});
if (pageNum > res.data.pages) {


+ 2
- 2
pages/passCar/couponDetail/couponDetail.js 查看文件

@@ -36,8 +36,8 @@ Page({
});
that.setData({
expiredTime: util.fmtDate(that.data.data.expiredTime),
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dddd hh:mm:ss"),
createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dddd hh:mm:ss")
updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"),
createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss")
});
util.barcode("barcode", options.quancode, 510, 100);
util.qrcode("qrcode", options.quancode, 350, 350);


+ 35
- 35
pages/passCar/couponDetail/couponDetail.wxml 查看文件

@@ -1,36 +1,36 @@
<view class="container page">
<view class="coupon_detail clearfix">
<view class="fl wmfl">
<image src="{{data.coverImg}}"/>
</view>
<view class="fl right">
<!-- <text class="title">{{data.title}}</text> -->
<text class="title">优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券优免2小时券</text>
<view class="time">{{data.subTitle}}</view>
<view class="money">
<text>¥{{data.salePrice/100}}</text>
<del>{{data.price/100}}小时</del>
<text wx:if="{{data.usePrice!=undefined}}" class="manjian">满{{data.usePrice/100}}元可用</text>
<text wx:if="{{data.usePrice==undefined}}" class="manjian">仅限本店使用</text>
</view>
</view>
</view>
<view class='note'>
<view wx:if="{{data.couponOrderStatus==0}}"><text>下单时间</text><text>{{createDate}}</text></view>
<view wx:if="{{data.couponOrderStatus==1}}"><text>核销时间</text><text>{{updateDate}}</text></view>
<view wx:if="{{data.couponOrderStatus==2}}"><text>过期时间</text><text>{{updateDate}}</text></view>
<view wx:if="{{data.couponOrderStatus==3}}"><text>退款时间</text><text>{{updateDate}}</text></view>
<view><text>有效期至:</text><text>{{expiredTime}}</text></view>
<view><text>订单编号</text><text>{{data.orderId}}</text></view>
<view><text>实付金额</text><text style='color:#ff4949;font-size:32rpx;'>{{data.couponPrice/100}}元</text></view>
</view>
<view class='notes' style="border-bottom:0">
<view>
<text>购买须知</text>
</view>
<view>
<text><text class='spot'></text>{{data.remark}}</text>
</view>
</view>
<view class="container page">
<view class="coupon_detail clearfix">
<view class="fl wmfl">
<image src="{{data.coverImg}}"/>
</view>
<view class="fl right">
<text class="title">{{data.title}}</text>
<view class="time">{{data.subTitle}}</view>
<view class="money">
<text>¥{{data.salePrice/100}}</text>
<!-- <del>{{data.price/100}}小时</del> -->
<del>{{data.price/100}}小时</del>
<text wx:if="{{data.usePrice!=undefined}}" class="manjian">满{{data.usePrice/100}}元可用</text>
<text wx:if="{{data.usePrice==undefined}}" class="manjian">仅限本店使用</text>
</view>
</view>
</view>
<view class='note'>
<view wx:if="{{data.couponOrderStatus==0}}"><text>下单时间</text><text>{{createDate}}</text></view>
<view wx:if="{{data.couponOrderStatus==1}}"><text>核销时间</text><text>{{updateDate}}</text></view>
<view wx:if="{{data.couponOrderStatus==2}}"><text>过期时间</text><text>{{updateDate}}</text></view>
<view wx:if="{{data.couponOrderStatus==3}}"><text>退款时间</text><text>{{updateDate}}</text></view>
<view><text>有效期至:</text><text>{{expiredTime}}</text></view>
<view><text>订单编号</text><text>{{data.orderId}}</text></view>
<view><text>实付金额</text><text style='color:#ff4949;font-size:32rpx;'>{{data.couponPrice/100}}元</text></view>
</view>
<view class='notes' style="border-bottom:0">
<view>
<text>购买须知</text>
</view>
<view>
<text><text class='spot'></text>{{data.remark}}</text>
</view>
</view>
</view>

+ 1
- 1
pages/passCar/couponDetail/couponDetail.wxss 查看文件

@@ -131,7 +131,7 @@
font-size: 26rpx;
color: #999;
width: 420rpx;
height: 32rpx;
height: 40rpx;
white-space: nowrap;
text-overflow:ellipsis;
overflow: hidden;


+ 2
- 2
pages/passCar/couponList/couponList.js 查看文件

@@ -61,7 +61,7 @@ Page({
title: "加载中"
});
Http.get({
url: config.api.couponOrderList + "?type=5",
url: config.api.couponOrderCarList + "?type=5",
data: {
pageNum: pageNum,
pageSize: 8,
@@ -72,7 +72,7 @@ Page({
res.data.list.map(file => {
file.expiredTime = format.formatTime(
file.expiredTime,
"yyyy-MM-dddd hh:mm:ss"
"yyyy-MM-dd hh:mm:ss"
);
});
console.log("姐姐的订单列表");


+ 483
- 479
pages/passCar/passCar.js 查看文件

@@ -1,480 +1,484 @@
let config = require("../../config/config.js");
let Http = require("../../utils/HttpBasics");
let Util = require("../../utils/util");
let app = getApp();
Page({
data: {
park: null,
carList: [],
payList: [],
addCar: null,
tcq: 2,
flag: "",
extraData: {},
desc: '',
title: '',
indicatorDots: true,
autoplay: false,
interval: 5000,
duration: 1000,
current: 0,
stopFees: {},
canIUse: wx.canIUse("navigator")
},
/**
* 车牌轮播滑动
*/
onSlideChangeEnd: function(e) {
var that = this;
/**
* 获得当前的车牌号码
*/
var listCardNum = (that.data.carList)[e.detail.current].carNumber;
console.log(listCardNum);
that.setData({
listCardNum: listCardNum
});
/**
* 获得停车费用
*/
that.getStopFee(listCardNum);
},
gotomange: function() {
wx.navigateTo({
url: '/pages/managelicenseplate/managelicenseplate',
})
},
gotoetcp:function(){
wx.navigateToMiniProgram({
appId:'wx192b7d2e8dcbefd0',
extraData: this.data.extraData,
envVersion:'release'
})
},
showquan: function() {
wx.navigateTo({
url: '/pages/passCar/couponList/couponList',
})
},
/**
* 待完成
*/
gotodetail: function(e) {
console.log(e.target.dataset.rule);
wx.showModal({
title: '缴费规则',
content: e.target.dataset.rule,
showCancel: false,
})
},
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: '',
})
};
that.initUsrCarList();
if (that.data.addCar) {
// 绑车牌
if (app.globalData.carLogin) {
that.bindCar(that.data.addCar);
} else {
that.bindCar(that.data.addCar);
}
that.setData({
addCar: null
});
}
},
onLoad: function(options) {
var that = this;
/**
* 获得分享小程序的
* title
* desc
*/
Http.get({
url: config.api.getWeapNote,
data: {
appId: config.weapp.AppId,
}
})
.then(res => {
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
desc: weapNote.carpage.desc,
title: weapNote.carpage.title
})
});
},


jumpToAdd: function() {
wx.navigateTo({
url: `/pages/addPark/addPark?flags=managepalte`
});
},
passc: function() {
wx.navigateTo({
url: '/pages/ques/ques',
})
},


/**
* 券绑定车牌
*/
bindCoupon: function(quanid) {
var that = this;
/**
* etcp
*/
var etcpData = {
etcpToken: app.globalData.etcpToken,
carNumber: that.data.listCardNum,
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: "确定",
})
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',
})
}

},

//获取名下停车券列表
getList() {
var that = this;
Http.get({
url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0",
data: {
pageNum: 1,
pageSize: 8,
couponOrderStatus: 0
}
}).then(res => {
console.log(res);
that.setData({
couponList: res.data.list
});
});
},


/**
* 共同登录
*/
init: function(carNumber) {
var that = this;
app.parkInitCallback = token => {
that.initPark();
that.getParkStatus();
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
// var etcpData = {
// etcpToken: app.globalData.etcpToken,
// carNumber: carNum
// };
// var tjdData = {
// carNumber: carNum
// };
// var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
// Http.post({
// url: config.api.bindCar,
// data: postData
// })
// .then(res => {
// console.log(res);
// // that.initUsrCarList();
// wx.showModal({
// title: "提示",
// showCancel: false,
// content: "绑车牌成功!",
// success: function() {}
// });
// })
// .catch(error => {
// console.log(error);
// wx.showModal({
// title: "提示",
// showCancel: false,
// content: error.message,
// success: function() {}
// });
// });
// },

bindCar: function (carNum) {
var that = this;
// ETCP
var etcpData = {
etcpToken: app.globalData.etcpToken,
carNumber: carNum
};
var tjdData = {
carNumber: carNum
};
var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
Http.post({
url: config.api.bindCar,
data: postData
})
.then(res => {
console.log(res);
that.setData({
addCar: null
});
that.initUsrCarList();
wx.showModal({
title: "提示",
showCancel: false,
content: "绑车牌成功!",
success: function () { }
});
})
.catch(error => {
console.log(error);
wx.showModal({
title: "提示",
showCancel: false,
content: error.data.message,
success: function () { }
});
});
},
/**
* 车场信息获取
*/
initPark: function() {
var that = this;
Http.get({
url: config.api.getParkInfo,
data: {}
}).then(res => {
that.setData({
park: res.data
});
});
},

/**
* 车场状态获取
*/
getParkStatus: function() {
var that = this;
Http.get({
url: config.api.getParkStatus,
})
.then(res => {
console.log(res);
});
},


/**
* 绑定车获取
*/
initUsrCarList: function(flag) {
console.log(flag);
var that = this;
Http.get({
url: config.api.getUserCarList,
data: {}
}).then(res => {
console.log(res)
that.setData({
carList: res.data
});
/**
* flag ==flags
* 表示从首页onShow进来的
*/
if (flag == "flags" && res.data.length > 0) {
var listCardNum = res.data[0].carNumber;
console.log(listCardNum);
that.setData({
listCardNum: listCardNum
})
/**
* 获得停车费用
*/
that.getStopFee(listCardNum);
}
})
},

/**
* 获得停车费用修改
*/
getStopFee: function(carNumber) {
var that = this;
var postData =
app.globalData.parkVendor == 1 ? {
etcpToken: app.globalData.etcpToken,
carNumber: carNumber
} : {
carNumber: carNumber,
outCarId: outCarId
};
Http.post({
url: config.api.getCarStopFee,
data: postData
})
.then(res => {
var extraDataStr = {
params: {
token: app.globalData.etcpToken,
syncId: res.data.orderId,
payType: 6, // 小程序支付
CarNumber: carNumber,
returnUrl: "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback",
source: "FUMAO-001",
actionId: "1" //操作ID,1:小程序支付
}
};
that.setData({
extraData: extraDataStr
});
that.setData({
stopFees: res.data
})
that.setData({
timecha: Util.timecha(res.data.exitTime, res.data.entranceTime)
})
})
.catch(error => {
console.log(error);
wx.showModal({
title: '提示',
content: error.message,
showCancel: false
})
that.setData({
stopFees: {}
})
});
},

/**
* 下拉刷新
*/
onPullDownRefresh: function(e) {
let that = this;
that.initUsrCarList("flags");
wx.stopPullDownRefresh();
},
// 用户点击右上角分享
onShareAppMessage: function() {
return {
title: this.data.title,
desc: this.data.desc,
success: function(res) {
wx.showToast({
title: "分享成功",
duration: 1000,
icon: "success"
});
}
}
}
let config = require("../../config/config.js");
let Http = require("../../utils/HttpBasics");
let Util = require("../../utils/util");
let app = getApp();
Page({
data: {
park: null,
carList: [],
payList: [],
addCar: null,
tcq: 2,
flag: "",
extraData: {},
desc: '',
title: '',
indicatorDots: true,
autoplay: false,
interval: 5000,
duration: 1000,
current: 0,
stopFees: {},
canIUse: wx.canIUse("navigator")
},
/**
* 车牌轮播滑动
*/
onSlideChangeEnd: function(e) {
var that = this;
/**
* 获得当前的车牌号码
*/
var listCardNum = (that.data.carList)[e.detail.current].carNumber;
console.log(listCardNum);
that.setData({
listCardNum: listCardNum
});
/**
* 获得停车费用
*/
that.getStopFee(listCardNum);
},
gotomange: function() {
wx.navigateTo({
url: '/pages/managelicenseplate/managelicenseplate',
})
},
gotoetcp:function(){
wx.navigateToMiniProgram({
appId:'wx192b7d2e8dcbefd0',
extraData: this.data.extraData,
envVersion:'release'
})
},
showquan: function() {
wx.navigateTo({
url: '/pages/passCar/couponList/couponList',
})
},
gotodetail: function(e) {
console.log(e.target.dataset.rule);
wx.showModal({
title: '缴费规则',
content: e.target.dataset.rule,
showCancel: false,
})
},
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: '',
})
};
that.initUsrCarList();
if (that.data.addCar) {
// 绑车牌
if (app.globalData.carLogin) {
that.bindCar(that.data.addCar);
} else {
that.bindCar(that.data.addCar);
}
that.setData({
addCar: null
});
}
},
onLoad: function(options) {
var that = this;
/**
* 获得分享小程序的
* title
* desc
*/
Http.get({
url: config.api.getWeapNote,
data: {
appId: config.weapp.AppId,
}
})
.then(res => {
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
desc: weapNote.carpage.desc,
title: weapNote.carpage.title
})
});
},
jumpToAdd: function() {
wx.navigateTo({
url: `/pages/addPark/addPark?flags=managepalte`
});
},
passc: function() {
wx.navigateTo({
url: '/pages/ques/ques',
})
},
/**
* 券绑定车牌
*/
bindCoupon: function(quanid) {
var that = this;
/**
* etcp
*/
var etcpData = {
etcpToken: app.globalData.etcpToken,
carNumber: that.data.listCardNum,
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: "确定",
})
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',
})
}
},
//获取名下停车券列表
getList() {
var that = this;
Http.get({
url: config.api.couponOrderCarList + "?type=5&couponOrderStatus=0",
data: {
pageNum: 1,
pageSize: 8,
couponOrderStatus: 0
}
}).then(res => {
console.log(res);
that.setData({
couponList: res.data.list
});
});
},
/**
* 共同登录
*/
init: function(carNumber) {
var that = this;
app.parkInitCallback = token => {
that.initPark();
that.getParkStatus();
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
// var etcpData = {
// etcpToken: app.globalData.etcpToken,
// carNumber: carNum
// };
// var tjdData = {
// carNumber: carNum
// };
// var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
// Http.post({
// url: config.api.bindCar,
// data: postData
// })
// .then(res => {
// console.log(res);
// // that.initUsrCarList();
// wx.showModal({
// title: "提示",
// showCancel: false,
// content: "绑车牌成功!",
// success: function() {}
// });
// })
// .catch(error => {
// console.log(error);
// wx.showModal({
// title: "提示",
// showCancel: false,
// content: error.message,
// success: function() {}
// });
// });
// },
bindCar: function (carNum) {
var that = this;
// ETCP
var etcpData = {
etcpToken: app.globalData.etcpToken,
carNumber: carNum
};
var tjdData = {
carNumber: carNum
};
var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData;
Http.post({
url: config.api.bindCar,
data: postData
})
.then(res => {
console.log(res);
that.setData({
addCar: null
});
that.initUsrCarList();
wx.showModal({
title: "提示",
showCancel: false,
content: "绑车牌成功!",
success: function () { }
});
})
.catch(error => {
console.log(error);
wx.showModal({
title: "提示",
showCancel: false,
content: error.data.message,
success: function () { }
});
});
},
/**
* 车场信息获取
*/
initPark: function() {
var that = this;
Http.get({
url: config.api.getParkInfo,
data: {}
})
.then(res => {
that.setData({
park: res.data
})
})
.catch(error=>{
console.log(error)
})
},
/**
* 车场状态获取
*/
getParkStatus: function() {
var that = this;
Http.get({
url: config.api.getParkStatus,
})
.then(res => {
console.log(res);
})
.catch(error=>{
console.log(error)
})
},
/**
* 绑定车获取
*/
initUsrCarList: function(flag) {
console.log(flag);
var that = this;
Http.get({
url: config.api.getUserCarList,
data: {}
}).then(res => {
console.log(res)
that.setData({
carList: res.data
});
/**
* flag ==flags
* 表示从首页onShow进来的
*/
if (flag == "flags" && res.data.length > 0) {
var listCardNum = res.data[0].carNumber;
console.log(listCardNum);
that.setData({
listCardNum: listCardNum
})
/**
* 获得停车费用
*/
that.getStopFee(listCardNum);
}
})
},
/**
* 获得停车费用修改
*/
getStopFee: function(carNumber) {
var that = this;
var postData =
app.globalData.parkVendor == 1 ? {
etcpToken: app.globalData.etcpToken,
carNumber: carNumber
} : {
carNumber: carNumber,
outCarId: outCarId
};
Http.post({
url: config.api.getCarStopFee,
data: postData
})
.then(res => {
var extraDataStr = {
params: {
token: app.globalData.etcpToken,
syncId: res.data.orderId,
payType: 6, // 小程序支付
CarNumber: carNumber,
returnUrl: "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback",
source: "FUMAO-001",
actionId: "1" //操作ID,1:小程序支付
}
};
that.setData({
extraData: extraDataStr
});
that.setData({
stopFees: res.data
})
that.setData({
timecha: Util.timecha(res.data.exitTime, res.data.entranceTime)
})
})
.catch(error => {
console.log(error);
wx.showModal({
title: '提示',
content: error.message,
showCancel: false
})
that.setData({
stopFees: {}
})
});
},
/**
* 下拉刷新
*/
onPullDownRefresh: function(e) {
let that = this;
that.initUsrCarList("flags");
wx.stopPullDownRefresh();
},
// 用户点击右上角分享
onShareAppMessage: function() {
return {
title: this.data.title,
desc: this.data.desc,
success: function(res) {
wx.showToast({
title: "分享成功",
duration: 1000,
icon: "success"
});
}
}
}
});

+ 1
- 1
pages/rushToBuy/index.js 查看文件

@@ -65,7 +65,7 @@ Page({
list: tmpArr
})
for (let i = 0; i < that.data.list.length; i++) {
var startTime = util.formatTime(that.data.list[i].endTime, "yyyy-MM-dddd hh:mm:ss");
var startTime = util.formatTime(that.data.list[i].endTime, "yyyy-MM-dd hh:mm:ss");
var alsell = Math.floor((that.data.list[i].inventory - (that.data.list[i].remainInventory))/(that.data.list[i].inventory)*100);
util.timechuo(startTime);
console.log(alsell);


+ 117
- 155
pages/user/index.js 查看文件

@@ -1,156 +1,118 @@
var config = require("../../config/config.js");
var app = getApp();
const Http = require("../../utils/HttpBasics");
Page({
/**
* 页面的初始数据
*/
data: {
canIUse: wx.canIUse('official-account'),
flag: 'hidden',
score:'0'
},
/**
* 跳转到成长值的页面
*/
gotograde:function(){
wx.navigateTo({
url: '/pages/grade/grade',
})
},
// getrun:function(){
// let that = this;
// wx.getWeRunData({
// success: function (res) {
// console.log(res);
// Http.post({
// url: config.api.getWeRunData,
// data: {
// encryptedData: res.encryptedData,
// iv: res.iv
// }
// }).then(res => {
// console.log(res);
// that.setData({
// step: res.data.stepInfoList[30].step
// })
// })
// }
// })
// },
/**
*
*/
// getxinghao:function(){
// wx.getSystemInfo({
// success:function(res){
// console.log(res);
// wx.showModal({
// content: res.brand,
// })
// }
// })
// },
navigateTo() {
wx.navigateTo({
url: `/pages/login/index`
});
},
showVersion: function() {
/**
* 长按显示版本号
*/
let that = this;
if (that.data.flag == 'hidden') {
that.setData({
flag: 'show'
});
}
console.log(that.data.flag)
},
gotoedit:function(){
wx.navigateTo({
url: `/pages/edit/edit?name=${this.data.name}&birthdate=${this.data.birthdate}&sex=${this.data.sex}&address=${this.data.address}`,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},

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

/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
let that = this;
let num = wx.getStorageSync('couponNum');
wx.hideTabBarRedDot({
index: 2
});
console.log("我是渲染")
if (num == 'couponNum1') {
wx.setStorage({
key: 'couponNum',
data: "couponNum1",
})
that.setData({
couponNum: "couponNum1"
})
} else if (num == 'couponNum') {
that.setData({
couponNum: "couponNum"
})
};
Http.get({
url: config.api.getScore,
data: {}
}).then(res=>{
console.log(res);
that.setData({
score: res.data.score,
levelName: res.data.levelName
})
if(res.data.address&&res.data.name&&res.data.sex&&res.data.birthdate){
that.setData({
address: res.data.address,
name: res.data.name,
sex: res.data.sex,
birthdate: res.data.birthdate
})
}
});
// that.getrun();
},

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

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

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

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

/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {}
var config = require("../../config/config.js");
var app = getApp();
const Http = require("../../utils/HttpBasics");
Page({
/**
* 页面的初始数据
*/
data: {
canIUse: wx.canIUse('official-account'),
flag: 'hidden',
score:'0',
name:"",
birthdate:"",
sex:""
},
/**
* 跳转到成长值的页面
*/
gotograde:function(){
wx.navigateTo({
url: '/pages/grade/grade',
})
},
// getrun:function(){
// let that = this;
// wx.getWeRunData({
// success: function (res) {
// console.log(res);
// Http.post({
// url: config.api.getWeRunData,
// data: {
// encryptedData: res.encryptedData,
// iv: res.iv
// }
// }).then(res => {
// console.log(res);
// that.setData({
// step: res.data.stepInfoList[30].step
// })
// })
// }
// })
// },
/**
*
*/
// getxinghao:function(){
// wx.getSystemInfo({
// success:function(res){
// console.log(res);
// wx.showModal({
// content: res.brand,
// })
// }
// })
// },
navigateTo() {
wx.navigateTo({
url: `/pages/login/index`
});
},
showVersion: function() {
/**
* 长按显示版本号
*/
let that = this;
if (that.data.flag == 'hidden') {
that.setData({
flag: 'show'
});
}
console.log(that.data.flag)
},
gotoedit:function(){
wx.navigateTo({
url: '/pages/edit/edit',
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
let that = this;
let num = wx.getStorageSync('couponNum');
wx.hideTabBarRedDot({
index: 2
});
console.log("我是渲染")
if (num == 'couponNum1') {
wx.setStorage({
key: 'couponNum',
data: "couponNum1",
})
that.setData({
couponNum: "couponNum1"
})
} else if (num == 'couponNum') {
that.setData({
couponNum: "couponNum"
})
};
Http.get({
url: config.api.getScore,
data: {}
}).then(res=>{
console.log(res);
that.setData({
score: res.data.score,
levelName: res.data.levelName,
address: res.data.address,
birthdate: res.data.birthdate,
name: res.data.name,
address: res.data.sex,
})
});
// that.getrun();
}
});

+ 76
- 76
pages/user/index.wxml 查看文件

@@ -1,77 +1,77 @@
<view class="user">
<view class='bannerbg'>
<image src='./../../assets/img/banner.png' mode="widthFix"></image>
</view>
<view class="user-title">
<view class="user-avatar">
<open-data class="open" type="userAvatarUrl"></open-data>
</view>
<view class="user-phone" bindtap='gotoedit'>
<open-data type="userNickName"></open-data>
<view class='chengzhang'>完善个人信息(获得成长值)</view>
</view>
<view class='chengzhang1' bindtap='gotograde'>
<text style="color:#01bffe;">当前成长值</text>
<view class="view">{{score}}
<image src='./../../assets/img/shang.png' mode="widthFix"></image>
</view>
<text>{{levelName}}</text>
</view>
</view>
<view class="user-btns">
<navigator url="/pages/order/index/index?id=all">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="./../../assets/img/ding.png" mode='widthFix'></image>我的订单</view>
<view>
<text class='look'>查看全部</text>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/order/index/index?id=0">
<view class="user-btn app-border-bottom">
<view style='padding-left:64rpx;color:#666;'>待付款</view>
<view>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/order/index/index?id=1">
<view class="user-btn app-border-bottom">
<view style='padding-left:64rpx;color:#666;'>已完成</view>
<view>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/couponorder/index/index">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="./../../assets/img/quans.png" mode='widthFix'></image>券包</view>
<view>
<text class="couponnum" wx:if="{{couponNum=='couponNum'}}"></text>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/passCar/passCar" open-type="switchTab">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="./../../assets/img/che.png" mode='widthFix'></image>智能停车</view>
<view>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
</view>
<view class="margin"></view>
<!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> -->
<view bindlongtap='showVersion' class='version'>
<view wx:if="{{flag=='show'}}">版本号:2.1.8</view>
<view wx:if="{{flag=='hidden'}}"></view>
</view>
</view>
<view class='of'>
<official-account wx:if="{{canIUse}}" class="gzh"></official-account>
<view class="user">
<view class='bannerbg'>
<image src='./../../assets/img/banner.png' mode="widthFix"></image>
</view>
<view class="user-title">
<view class="user-avatar" bindtap='gotograde'>
<open-data class="open" type="userAvatarUrl"></open-data>
</view>
<view class="user-phone" bindtap='gotograde'>
<open-data type="userNickName"></open-data>
<text class='chengzhang'>{{levelName}}</text>
<view class="view">成长值{{score}}
<image src='./../../assets/img/redirect.png' mode='widthFix'></image>
</view>
</view>
<view class='chengzhang1' bindtap='gotoedit'>
<!-- <text style="color:#01bffe;">编辑</text> -->
<image class='activeimg' src='./../../assets/img/active.gif' mode='widthFix'></image>
</view>
</view>
<view class="user-btns">
<navigator url="/pages/order/index/index?id=all">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="./../../assets/img/ding.png" mode='widthFix'></image>我的订单</view>
<view>
<text class='look'>查看全部</text>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/order/index/index?id=0">
<view class="user-btn app-border-bottom">
<view style='padding-left:64rpx;color:#666;'>待付款</view>
<view>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/order/index/index?id=1">
<view class="user-btn app-border-bottom">
<view style='padding-left:64rpx;color:#666;'>已完成</view>
<view>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/couponorder/index/index">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="./../../assets/img/quans.png" mode='widthFix'></image>券包</view>
<view>
<text class="couponnum" wx:if="{{couponNum=='couponNum'}}"></text>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
<navigator url="/pages/passCar/passCar" open-type="switchTab">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="./../../assets/img/che.png" mode='widthFix'></image>智能停车</view>
<view>
<text class="iconfont icon-right"></text>
</view>
</view>
</navigator>
</view>
<view class="margin"></view>
<!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> -->
<view bindlongtap='showVersion' class='version'>
<view wx:if="{{flag=='show'}}">版本号:2.1.9</view>
<view wx:if="{{flag=='hidden'}}"></view>
</view>
</view>
<view class='of'>
<official-account wx:if="{{canIUse}}" class="gzh"></official-account>
</view>

+ 41
- 21
pages/user/index.wxss 查看文件

@@ -1,22 +1,25 @@
.icons{
.icons {
width: 40rpx;
margin-right: 20rpx;
vertical-align: middle;
}

.user {
background: #fff;
min-height: 100vh;
}
.navigator-hover{
opacity: 1!important;

.navigator-hover {
opacity: 1 !important;
background: #fff;
}

.user-title {
position: relative;
box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.10);
border-radius: 8px;
width: 698rpx;
padding: 0 30rpx;
width: 728rpx;
padding-left: 30rpx;
display: flex;
flex-direction: row;
box-sizing: border-box;
@@ -34,7 +37,8 @@
overflow: hidden;
border: 1px solid red;
} */
.version{

.version {
width: 600rpx;
height: 300rpx;
line-height: 300rpx;
@@ -87,16 +91,18 @@
}

.chengzhang {
font-size: 22rpx;
color: #999;
line-height: 40rpx;
font-size: 24rpx;
font-weight: 400;
color: rgba(122, 122, 122, 1);
margin-left: 10rpx;
}

.chengzhang1 {
position: absolute;
right: 24rpx;
right: 0;
bottom: 0;
top: 19rpx;
/* top: 19rpx; */
top: 42rpx;
}

.chengzhang1 text {
@@ -109,17 +115,21 @@
vertical-align: top;
}

.chengzhang1 .view {
font-size: 44rpx;
.view {
font-size: 24rpx;
color: #01bffe;
line-height: 67rpx;
}

.view image{
width: 12rpx;
vertical-align: middle;
margin-top: -6rpx;
}
.chengzhang1 text {
text-align: center;
font-size: 24rpx;
font-size: 26rpx;
color: #333;
line-height: 33rpx;
margin-right: 30rpx;
}

.bannerbg {
@@ -205,23 +215,33 @@
.user-out-btn::after {
opacity: 0;
}
.gzh{

.gzh {
display: none;
position: absolute;
bottom: 6%;
width: 90%;
left: 0;
right: 0;
margin: auto;
margin: auto;
z-index: 1000000;
background: #ccc;
border-radius: 16rpx;
overflow: hidden;
box-shadow:0 6px 20px 0 rgba(0,0,0,0.15);
box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.15);
}
.act{

.act {
display: none;
}
.of{

.of {
display: block;
}
.activeimg{
width: 176rpx!important;
position: absolute;
bottom: 0;
right: 0;
z-index: 10000;
}

正在加载...
取消
保存