Page({
data: {
array: [],
carData: [],
index: 0,
dateHan: "",
timeHan: "",
dateTake: "",
timeTake: "",
pointInfo: '',
starttime: '',
point_id: '',
carnumber: '',
brandname: '',
detailcase: '',
totalmoney: ''
},
onLoad: function (options) {
var vm = this
var date = new Date()
var nowYear = date.getFullYear()
var nowMonth = date.getMonth() + 1
var nowDay = date.getDate()
var nowHour = date.getHours()
var nowMinute = date.getMinutes() + 1
if( date.getMinutes() > 30 ) {
}
if (nowMonth < 10) {
nowMonth = "0" + nowMonth;
}
if (nowHour < 10) {
nowHour = "0" + nowHour;
}
if (nowMinute < 10) {
nowMinute = "0" + nowMinute;
}
if (nowDay < 10) {
nowDay = "0" + nowDay;
}
vm.setData({
dateHan: nowYear + '-' + nowMonth + '-' + nowDay
})
vm.setData({
timeHan: nowHour + ':' + nowMinute
})
vm.setData({
dateTake: nowYear + '-' + nowMonth + '-' + nowDay
})
vm.setData({
timeTake: nowHour + 3 + ':' + nowMinute
})
vm.setData({
point_id: options.id
})
wx.request({
url: 'https://wx.viparker.com/valetparking/api/web/index.php/parking/point-info',
data: {
point_id: options.id
},
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
success: function (res) {
console.log(res.data.data.info.address)
vm.setData({
pointInfo: res.data.data.info.address
})
}
})
wx.request({
url: 'https://wx.viparker.com/valetparking/api/web/index.php/cars/my-car-list',
header: {//请求头
"Content-Type": "application/x-www-form-urlencoded"
},
data: {
openid: wx.getStorageSync('openid')
},
method: "POST",//get为默认方法/POST
success: function (res) {
var carData = []
var carnumber = []
var brandname = []
for (var x in res.data.message) {
carData.push(res.data.message[x].brand_name + '--' + res.data.message[x].car_name)
carnumber = res.data.message[x].car_name
brandname = res.data.message[x].brand_name
}
vm.setData({
carData: carData
})
vm.setData({
carnumber: carnumber
})
vm.setData({
brandname: brandname
})
}
})
},
bindPickerChange: function (e) {
this.setData({
index: e.detail.value
})
},
bindDateHan: function (e) {
var vm = this
vm.setData({
dateHan: e.detail.value
})
},
bindTimeHan: function (e) {
var vm = this
vm.setData({
timeHan: e.detail.value
})
},
bindDateTake: function (e) {
var vm = this
vm.setData({
dateTake: e.detail.value
})
},
bindTimeTake: function (e) {
var vm = this
console.log('picker发送选择改变,携带值为', e.detail.value)
vm.setData({
timeTake: e.detail.value
})
},
bindSuccess: function () {
var vm = this
wx.request({
url: 'https://wx.viparker.com/valetparking/api/web/index.php/order/get-best-case',
header: {//请求头
"Content-Type": "application/x-www-form-urlencoded"
},
data: {
point_id: vm.data.point_id,
car_id: 59,
starttime: vm.data.dateHan + ' ' + vm.data.timeHan,
endtime: vm.data.dateTake + ' ' + vm.data.timeTake
},
method: "POST",//get为默认方法/POST
success: function (res) {
vm.setData({
detailcase: res.data.data.detailcase
})
vm.setData({
totalmoney: res.data.data.totalmoney
})
wx.showModal({
title: '预约付款',
confirmText: '微信支付',
content: '根据您提交的泊车时间,系统计算出您本次泊车的最优方案为【 '
+ res.data.data.detailcase + ' 】共需要支付的费用为【 '
+ res.data.data.totalmoney + ' 】元',
success: function (res) {
if (res.confirm) {
wx.request({
url: 'https://wx.viparker.com/valetparking/api/web/index.php/order/save-order',
data: {
openid: wx.getStorageSync('openid'), //微信唯一标识openid
point_id: vm.data.point_id, // 泊车点编号
carnumber: '京A88588', // 车牌
brandname: '宝马', // 车辆品牌
starttime: vm.data.dateHan + ' ' + vm.data.timeHan, // 交车时间
endtime: vm.data.dateTake + ' ' + vm.data.timeTake, // 还车时间
detailcase: vm.data.detailcase, // 最佳收费方案
totalmoney: vm.data.totalmoney // 总金额
},
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
success: function (res) {
console.log(res.data.data)
wx.requestPayment({
'timeStamp': res.data.data.timeStamp,//时间戳从1970年1月1日00:00:00至今的秒数,即当前的时间
'nonceStr': res.data.data.nonceStr,//随机字符串,长度为32个字符以下。
'package': res.data.data.package,//统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*
'signType': 'MD5',//签名算法,暂支持 MD5
'paySign': res.data.data.paySign,//签名
'success': function (item) {
wx.showToast({
title: '支付成功',
duration: 2000,
success: function () {
wx.showModal({
title: '完成预约',
confirmText: '返回首页',
content: '您已成功完成预约,请您在交车时间到达泊车点,我们会派专人为您服务,您可在我的订单查看本次泊车订单,进行相关操作!',
success: function (res) {
if (res.confirm) {
wx.navigateBack({
delta: 3
})
}
}
})
}
})
},
'fail': function (item) {
wx.showToast({
title: '支付失败',
duration: 2000
})
}
})
}
})
}
}
})
}
})
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
小程序源码(无后台)_预约类demo:Pnpack代泊车.rar
共93个文件
png:20个
wxss:18个
json:18个
需积分: 5 0 下载量 71 浏览量
2023-06-12
08:22:47
上传
评论
收藏 157KB RAR 举报
温馨提示
版权声明: 本资源仅供学习参考,不得进行任何商业用途!
资源推荐
资源详情
资源评论
收起资源包目录
小程序源码(无后台)_预约类demo:Pnpack代泊车.rar (93个子文件)
预约类demo:Pnpack代泊车
Pnpack-master
pages
.DS_Store 6KB
evaluate
evaluate.wxss 1KB
evaluate.json 42B
evaluate.wxml 2KB
evaluate.js 2KB
validate
validate.js 1KB
validate.wxml 601B
validate.wxss 616B
validate.json 48B
personal
personal.wxss 1KB
personal.wxml 2KB
personal.json 48B
personal.js 4KB
index
index.wxml 1KB
index.js 5KB
index.json 88B
index.wxss 1KB
trip
order
order.wxml 6KB
order.json 84B
order.js 6KB
order.wxss 2KB
trip.json 48B
trip.wxss 974B
compensate
compensate.wxml 332B
compensate.js 1KB
compensate.wxss 174B
compensate.json 48B
trip.js 2KB
trip.wxml 834B
car
addCar
addCar.wxml 532B
addCar.js 946B
addCar.json 166B
chooseBrand
chooseBrand.js 2KB
chooseBrand.wxss 478B
chooseBrand.wxml 1KB
chooseBrand.json 50B
chooseVehicle
chooseVehicle.js 1KB
chooseVehicle.wxml 639B
chooseVehicle.wxss 242B
chooseVehicle.json 50B
addCar.wxss 159B
car.wxss 756B
car.js 4KB
car.json 50B
car.wxml 1KB
editCar
editCar.json 166B
editCar.wxml 532B
editCar.wxss 159B
editCar.js 1KB
park
summary
summary.wxml 2KB
summary.js 1KB
summary.wxss 686B
order
order.wxml 2KB
order.json 44B
pay
pay.wxss 168B
pay.js 348B
pay.wxml 413B
pay.json 2B
order.js 7KB
order.wxss 2KB
summary.json 51B
park.wxss 490B
park.json 45B
park.js 688B
park.wxml 506B
login
login.js 2KB
login.json 51B
login.wxml 733B
login.wxss 974B
app.json 772B
app.js 0B
app.wxss 3KB
更多 (1).png 445B
images
.DS_Store 6KB
phon1.png 6KB
jz-h.png 4KB
sfz-h.png 3KB
bl-l.png 2KB
jz-l.png 3KB
phone.png 1KB
park.png 7KB
bl-h.png 2KB
car.png 8KB
set.png 9KB
hz-l.png 8KB
code.png 3KB
fz-h.png 9KB
sfz-l.png 2KB
shadow.png 4KB
more2.png 479B
history.png 6KB
star.png 3KB
park-icon.png 34KB
共 93 条
- 1
资源评论
2301_78600126
- 粉丝: 1
- 资源: 686
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 广东省2021年普通高考音乐学类总分分数段统计表(含本、专科层次加分)
- 广东省2021年普通高考舞蹈类总分分数段统计表(含本、专科层次加分)
- Python教程-快速入门基础必看课程10-函数基础
- tensorflow-2.9.2-cp39-cp39-win-amd64.whl
- tensorflow-2.9.2-cp37-cp37m-win-amd64.whl
- 广东省2021年普通高考体育类总分分数段统计表(含本、专科层次加分)
- VBA超市商品定价-按指定毛利率计算最佳价格.xlsm
- tensorflow-gpu-2.9.2-cp39-cp39-win-amd64.whl
- Python教程-快速入门基础必看课程09-文件处理
- tomcat安装及配置教程.md
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功