diff --git a/assets/images/parking.png b/assets/images/parking.png new file mode 100644 index 0000000..2483808 Binary files /dev/null and b/assets/images/parking.png differ diff --git a/pages/passCar/showDetail/showDetail.js b/pages/passCar/showDetail/showDetail.js index 8888068..4e52a2f 100644 --- a/pages/passCar/showDetail/showDetail.js +++ b/pages/passCar/showDetail/showDetail.js @@ -19,9 +19,9 @@ Page({ */ onLoad(options) { const detail = JSON.parse(options.item) - detail.payTime = this.timestampToTime(detail.payTime) - detail.createTime = this.timestampToTime(detail.createTime) - detail.updateTime = this.timestampToTime(detail.updateTime) + detail.payTime = this.timestampToTime(detail.payTime, 'YYYY-MM-DD hh:mm:ss') + detail.createTime = this.timestampToTime(detail.createTime, 'YYYY-MM-DD hh:mm:ss') + detail.updateTime = this.timestampToTime(detail.updateTime, 'YYYY-MM-DD hh:mm:ss') this.setData({ detail: detail }) diff --git a/pages/passCar/showDetail/showDetail.wxml b/pages/passCar/showDetail/showDetail.wxml index 60a193a..10eb1e5 100644 --- a/pages/passCar/showDetail/showDetail.wxml +++ b/pages/passCar/showDetail/showDetail.wxml @@ -23,10 +23,7 @@ 车场订单号:{{detail.parkOrderNo}} - 商户收款账户:{{detail.merchantAccount}} - - - 商户编号:{{detail.merchantId}} + 商户收款账户:{{detail.merchantAccount}}(尾号) 商户名称:{{detail.merchantName}} diff --git a/pages/passCar/showList/showList.js b/pages/passCar/showList/showList.js index 8b6a7c4..ac3959c 100644 --- a/pages/passCar/showList/showList.js +++ b/pages/passCar/showList/showList.js @@ -11,7 +11,40 @@ Page({ */ data: { navigationBarHeight, - carPayOrderList: [], + carPayOrderList: [ + { + carNumber: '鄂A636VV', + payAmount: '55元', + payTime: '2023-2-20', + createTime: '2023-2-20', + updateTime: '2023-2-20', + parkNotify: 1 + }, + { + carNumber: '鄂A636VV', + payAmount: '55元', + payTime: '2023-2-20', + createTime: '2023-2-20', + updateTime: '2023-2-20', + parkNotify: 1 + }, + { + carNumber: '鄂A636VV', + payAmount: '55元', + payTime: '2023-2-20', + createTime: '2023-2-20', + updateTime: '2023-2-20', + parkNotify: 0 + }, + { + carNumber: '鄂A636VV', + payAmount: '55元', + payTime: '1676877157', + createTime: '1676877157', + updateTime: '1676877157', + parkNotify: 1 + }, + ], pageNum: '1' }, @@ -21,6 +54,10 @@ Page({ url: config.api.carPayOrderList + `?pageNum=${pageNum}&pageSize=10`, }).then(res => { console.log(res, 'res'); + res.data.list.forEach(item => { + item.payTime = this.timestampToTime(item.payTime) + item.createTime = this.timestampToTime(item.createTime) + }) if (pageNum == 1) { const tempArr = res.data.list tempArr.forEach(item => { @@ -56,11 +93,58 @@ Page({ }) }, + /** + * @description 根据时间戳获取时间 + * @param {*} timestamp 必传,number类型,时间戳数据(10位及以下,10位至13位) + * @param {*} format 选传,string类型,提供以下时间格式:YYYY-MM-DD hh:mm:ss、YYYY/MM/DD hh:mm:ss、YYYY.MM.DD hh:mm:ss、YYYY MM DD hh:mm:ss、YYYY年MM月DD日 hh:mm:ss、YYYY-MM-DD、YYYY/MM/DD、YYYY.MM.DD、YYYY MM DD、YYYY年MM月DD日;若不传,则默认为:YYYY-MM-DD + * @returns 根据要求的时间格式 + * @version V 1.0, Created by YWQ, 2022.10.20 + */ + timestampToTime(timestamp, format) { + //时间戳为10位需*1000,时间戳为13位不需乘1000 + const length = timestamp.length + if (length <= 10) { + var date = new Date(timestamp * 1000) + } else { + var date = new Date(timestamp) + } + let Y = String(date.getFullYear()) + let M = String(date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + let D = String(date.getDate() + 1 < 10 ? '0' + (date.getDate()) : date.getDate()) + let h = String(date.getHours() + 1 < 10 ? '0' + (date.getHours()) : date.getHours()) + let m = String(date.getMinutes() + 1 < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + let s = String(date.getSeconds() + 1 < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + // return Y + M + D + h + m + s + if (format == "YYYY-MM-DD hh:mm:ss") { + return Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s + } else if (format == "YYYY/MM/DD hh:mm:ss") { + return Y + "/" + M + "/" + D + " " + h + ":" + m + ":" + s + } else if (format == "YYYY.MM.DD hh:mm:ss") { + return Y + "." + M + "." + D + " " + h + ":" + m + ":" + s + } else if (format == "YYYY MM DD hh:mm:ss") { + return Y + " " + M + " " + D + " " + h + ":" + m + ":" + s + } else if (format == "YYYY年MM月DD日 hh:mm:ss") { + return Y + "年" + M + "月" + D + "日" + " " + h + ":" + m + ":" + s + } else if (format == "YYYY-MM-DD") { + return Y + "-" + M + "-" + D + } else if (format == "YYYY/MM/DD") { + return Y + "/" + M + "/" + D + } else if (format == "YYYY.MM.DD") { + return Y + "." + M + "." + D + } else if (format == "YYYY MM DD") { + return Y + " " + M + " " + D + } else if (format == "YYYY年MM月DD日") { + return Y + "年" + M + "月" + D + "日" + } else { + return Y + "-" + M + "-" + D + } + }, + /** * 生命周期函数--监听页面加载 */ onLoad(options) { - this.getList(this.data.pageNum) + // this.getList(this.data.pageNum) }, /** diff --git a/pages/passCar/showList/showList.wxml b/pages/passCar/showList/showList.wxml index c8a9a8d..de5f824 100644 --- a/pages/passCar/showList/showList.wxml +++ b/pages/passCar/showList/showList.wxml @@ -4,8 +4,16 @@ 车牌号:{{item.carNumber}} - 支付金额:{{item.payAmount}} - 支付时间:{{item.payTime}} + + + + 创建时间:{{item.createTime}} + 支付时间:{{item.payTime}} + + + + + 支付金额:{{item.payAmount}} 查看详情 diff --git a/pages/passCar/showList/showList.wxss b/pages/passCar/showList/showList.wxss index fc702cc..3ff6c5b 100644 --- a/pages/passCar/showList/showList.wxss +++ b/pages/passCar/showList/showList.wxss @@ -1,36 +1,70 @@ /* pages/passCar/showList.wxss */ -page { - background-color: #dfdfdf; -} +page {} .list { + padding-top: 10rpx; - padding: 40rpx; } .list .item { position: relative; background-color: #fff; - margin-bottom: 40rpx; + margin-bottom: 15rpx; border-radius: 20rpx; - padding: 20rpx; + padding: 20rpx 0 15rpx 0; } .list .item .child { - margin-bottom: 20rpx; + font-size: 28rpx; + margin: 0 0 20rpx 20rpx; +} + +.list .item .payInfo { + display: flex; + padding: 0 0 20rpx 40rpx; + border-bottom: 1px solid #d1d1d1; +} + +.list .item .payInfo .parking { + width: 110rpx; + height: 110rpx; +} + +.list .item .payInfo .time { + position: relative; + color: #979797; + font-size: 25rpx; + top: 10rpx; + left: 30rpx; +} + +.list .item .payFee { + margin: 20rpx 0 0 20rpx; +} + +.list .item .payFee .highLight { + color: #fe725c; } .list .item .detail { position: absolute; right: 40rpx; top: 50%; + width: 100rpx; + height: 40rpx; + color: #fff; + line-height: 40rpx; + font-size: 25rpx; transform: translateY(-50%); + border-radius: 10rpx; + background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%); + padding: 5rpx 10rpx 5rpx 10rpx; } .list .item .notice { position: absolute; right: 40rpx; - top: 25rpx; + top: 30rpx; transform: translateY(-50%); color: #ff0000; } \ No newline at end of file