From 2aac095e8aa1f0bd54da5acd3c37aa1e6990d8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAPTOP-9N9MIRBL=5C=E7=90=A5?= <2838199541@qq.com> Date: Fri, 5 Jan 2024 20:03:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC1.0.6=20=202024-01-05=20xh=20?= =?UTF-8?q?1=E3=80=81=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8A=9F=E8=83=BD=E6=94=AF=E4=BB=98=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 6 +- pages/my/my.wxml | 2 +- pages/orderList/orderList.js | 241 ++++++++++++++++++++++++++++++++++++++++ pages/orderList/orderList.json | 10 ++ pages/orderList/orderList.wxml | 62 +++++++++++ pages/orderList/orderList.wxss | 43 +++++++ pagesA/orderList/orderList.js | 176 ----------------------------- pagesA/orderList/orderList.json | 10 -- pagesA/orderList/orderList.wxml | 62 ----------- pagesA/orderList/orderList.wxss | 36 ------ utils/request.js | 3 +- 11 files changed, 362 insertions(+), 289 deletions(-) create mode 100644 pages/orderList/orderList.js create mode 100644 pages/orderList/orderList.json create mode 100644 pages/orderList/orderList.wxml create mode 100644 pages/orderList/orderList.wxss delete mode 100644 pagesA/orderList/orderList.js delete mode 100644 pagesA/orderList/orderList.json delete mode 100644 pagesA/orderList/orderList.wxml delete mode 100644 pagesA/orderList/orderList.wxss diff --git a/app.json b/app.json index 2a112fe..34f99af 100644 --- a/app.json +++ b/app.json @@ -23,7 +23,8 @@ "pages/config/config", "pages/rentDetail/rentDetail", "pages/rentManagement/rentManagement", - "pages/paymentInterface/paymentInterface" + "pages/paymentInterface/paymentInterface", + "pages/orderList/orderList" ], "subPackages": [ { @@ -36,8 +37,7 @@ "faceinfo/faceinfo", "selectFace/selectFace", "newconstructionitem/newconstructionitem", - "activatePayment/activatePayment", - "orderList/orderList" + "activatePayment/activatePayment" ] } ], diff --git a/pages/my/my.wxml b/pages/my/my.wxml index ad57bb8..f5889e2 100644 --- a/pages/my/my.wxml +++ b/pages/my/my.wxml @@ -77,7 +77,7 @@ - + diff --git a/pages/orderList/orderList.js b/pages/orderList/orderList.js new file mode 100644 index 0000000..b8865db --- /dev/null +++ b/pages/orderList/orderList.js @@ -0,0 +1,241 @@ +// pagesA/orderList/orderList.js +const app = getApp() +const WXAPI = require('../../utils/request') +import moment from '../../utils/moment' +var util = require('../../utils/util'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + active:0, + orderLogList:[], + pageSize:10, + pageNum:1, + radio:'2', + leases:{}, + show:false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getOrderList() + }, + + onChange(event){ + this.setData({ + active:event.detail.name + }) + if(event.detail.name=='0'){ + this.getOrderList() + }else if(event.detail.name==1){ + this.getOrderList() + }else if(event.detail.name==2){ + this.getOrderList() + } + }, + onClose() { + this.setData({ show: false }); + }, + confirmMethods(event) { + this.confimPay() + }, + confimPay(){ + let leases =this.data.leases + let userInfo = wx.getStorageSync('userInfo') + let productName = leases.orderType == '0'?'短信充值':leases.orderType == '1'?'交租':leases.orderType == '2'?'语音电话充值':leases.orderType == '3'?'系统续费':'未知' + var data = { + description: productName, + productName: productName, + total: parseInt(leases.totalFee)*100,//parseInt(this.data.leases.expand.rent)*100, + userId: leases.cardId, + cardId:leases.cardId, + openid:wx.getStorageSync('openid'), + appid:'wx885b65d99da00084',//'wx20de9fe5943934a1',//'wx885b65d99da00084', + uid:userInfo.id, + eid:userInfo.enterpriseId, + orderType:leases.orderType, + payType:this.data.radio, + expand:JSON.stringify({ + phone:leases.phone, + nickname:leases.cardName + }), + relevanceId:leases.id + } + WXAPI.miniPrepayOrderT(data).then(res=>{ + wx.requestPayment({ + timeStamp: res.data.data.timeStamp, + appid: res.data.data.appId, + nonceStr: res.data.data.nonceStr, + package: res.data.data.package, + signType: res.data.data.signType, + totalFee: parseInt(leases.totalFee)*100, + paySign: res.data.data.paySign, + success (res1) { + wx.showToast({ + title: "支付成功", + duration: 2000, + icon: 'success' + }) + let dataOne={ + code: "wx/updatePrepayStatus", + cardId:leases.cardId, + data: { + orderNo: res.data.data.orderNo, + status:0 + } + } + WXAPI.sendCommand(dataOne).then(res2=>{ + wx.showToast({ + title: '支付成功', + duration:2000 + }) + }) + }, + fail (res1) { + wx.showToast({ + title: "支付失败", + duration: 2000, + icon: 'none' + }) + let dataOne={} + if(res1.errMsg == 'requestPayment:fail cancel'){ + dataOne={ + code: "wx/updatePrepayStatus", + data: { + orderNo: res.data.data.orderNo, + status:8 + } + } + }else{ + dataOne={ + code: "wx/updatePrepayStatus", + cardId:leases.cardId, + data: { + orderNo: res.data.data.orderNo, + status:6 + } + } + } + WXAPI.sendCommand(dataOne).then(res2=>{ + + }) + } + }) + // WXAPI.miniPrepayOrder(data).then(res=>{ + // let dataOne={ + // code: "wx/updatePrepayStatus", + // data: { + // orderNo: res.data.data.orderNo, + // status:0 + // } + // } + // WXAPI.sendCommand(dataOne).then(res2=>{ + // if(res2.success){ + // wx.showToast({ + // title: "支付成功", + // duration: 2000, + // icon: 'success' + // }) + // }else{ + // wx.showToast({ + // title: res2.message, + // duration: 2000, + // icon: 'error' + // }) + // } + // }) + // }) + }) + }, + onChangeRadio(event){ + this.setData({ + radio: event.detail, + }); + }, + rentMethods(e){ + let leases = e.currentTarget.dataset.item + this.setData({ + show:true, + leases + }) + }, + getOrderList(){ + let data={ + pageSize:this.data.pageSize, + pageNum:this.data.pageNum, + q:JSON.stringify({ + orderStatus:this.data.active + }) + } + WXAPI.getSiteOrder(data).then(res=>{ + if(res.success){ + res.data.list.map(li=>{ + li.createTime = moment(li.createTime).format('YYYY-MM-DD HH:mm:ss') + li.waterFee = parseFloat(li.waterFee/100).toFixed(2) + li.electricityFee = parseFloat(li.electricityFee/100).toFixed(2) + }) + this.setData({ + orderLogList:res.data.list + }) + }else{ + wx.showToast({ + title: res.message, + duration:200, + icon:'none' + }) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/orderList/orderList.json b/pages/orderList/orderList.json new file mode 100644 index 0000000..861b550 --- /dev/null +++ b/pages/orderList/orderList.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "van-tab": "../../components/dist/tab/index", + "van-tabs": "../../components/dist/tabs/index", + "van-empty": "../../components/dist/empty/index", + "van-radio": "../../components/dist/radio/index", + "van-radio-group": "../../components/dist/radio-group/index", + "van-dialog": "../../components/dist/dialog/index" + } +} \ No newline at end of file diff --git a/pages/orderList/orderList.wxml b/pages/orderList/orderList.wxml new file mode 100644 index 0000000..2352d87 --- /dev/null +++ b/pages/orderList/orderList.wxml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + 去支付 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 现金 + 刷卡 + 微信支付 + + \ No newline at end of file diff --git a/pages/orderList/orderList.wxss b/pages/orderList/orderList.wxss new file mode 100644 index 0000000..4045ba0 --- /dev/null +++ b/pages/orderList/orderList.wxss @@ -0,0 +1,43 @@ +/* pagesA/orderList/orderList.wxss */ +.loglist { + padding: 20upx; + box-sizing: border-box; +} + +.lockli { + margin-bottom: 10upx; + padding: 20upx; + border-bottom: 2upx solid #f2f3f5; + line-height: 50upx; +} + +.blue { + color: #02BFFF; +} +.box{ + margin-bottom: 10px; + box-sizing: border-box; + margin: 30rpx; + box-shadow: 2px 2px 10px #eeee; +} + +.d-fixed{ + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 99; +} + +.groupRadio{ + margin: 0 40rpx; + display: flex; + flex-wrap: nowrap; + justify-content: space-between; + margin-top: 10px; +} +.groupRadio .radioView{ + display: inline-block; + width: 50%; + margin-bottom: 10px; +} diff --git a/pagesA/orderList/orderList.js b/pagesA/orderList/orderList.js deleted file mode 100644 index 23a6ae8..0000000 --- a/pagesA/orderList/orderList.js +++ /dev/null @@ -1,176 +0,0 @@ -// pagesA/orderList/orderList.js -const app = getApp() -const WXAPI = require('../../utils/request') -import moment from '../../utils/moment' -var util = require('../../utils/util'); -Page({ - - /** - * 页面的初始数据 - */ - data: { - active:0, - orderLogList:[], - pageSize:10, - pageNum:1, - radio:'2', - leases:{}, - show:false - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - this.getOrderList() - }, - - onChange(event){ - this.setData({ - active:event.detail.name - }) - if(event.detail.name=='0'){ - this.getOrderList() - }else if(event.detail.name==1){ - this.getOrderList() - }else if(event.detail.name==2){ - this.getOrderList() - } - }, - onClose() { - this.setData({ show: false }); - }, - confirmMethods(event) { - this.confimPay() - }, - confimPay(){ - let leases =this.data.leases - let userInfo = wx.getStorageSync('userInfo') - var data = { - description: "交租", - productName: "交租", - total: parseInt(leases.monthRent)*100,//parseInt(this.data.leases.expand.rent)*100, - userId: leases.cardId, - cardId:leases.cardId, - openid:wx.getStorageSync('openid'), - appid:'wx20de9fe5943934a1', - uid:userInfo.id, - eid:userInfo.enterpriseId, - orderType:1, - payType:this.data.radio, - expand:JSON.stringify({ - phone:leases.phone, - nickname:leases.name - }) - } - // WXAPI.miniPrepayOrder(data).then(res=>{ - // let dataOne={ - // code: "wx/updatePrepayStatus", - // data: { - // orderNo: res.data.data.orderNo, - // status:0 - // } - // } - // WXAPI.sendCommand(dataOne).then(res2=>{ - // if(res2.success){ - // wx.showToast({ - // title: "支付成功", - // duration: 2000, - // icon: 'success' - // }) - // }else{ - // wx.showToast({ - // title: res2.message, - // duration: 2000, - // icon: 'error' - // }) - // } - // }) - // }) - }, - onChangeRadio(event){ - this.setData({ - radio: event.detail, - }); - }, - rentMethods(e){ - let leases = e.currentTarget.dataset.item - this.setData({ - show:true, - leases - }) - }, - getOrderList(){ - let data={ - pageSize:this.data.pageSize, - pageNum:this.data.pageNum, - q:JSON.stringify({ - orderStatus:this.data.active - }) - } - WXAPI.getSiteOrder(data).then(res=>{ - if(res.success){ - res.data.list.map(li=>{ - li.createTime = moment(li.createTime).format('YYYY-MM-DD HH:mm:ss') - }) - this.setData({ - orderLogList:res.data.list - }) - }else{ - wx.showToast({ - title: res.message, - duration:200, - icon:'none' - }) - } - }) - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } -}) \ No newline at end of file diff --git a/pagesA/orderList/orderList.json b/pagesA/orderList/orderList.json deleted file mode 100644 index 861b550..0000000 --- a/pagesA/orderList/orderList.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "usingComponents": { - "van-tab": "../../components/dist/tab/index", - "van-tabs": "../../components/dist/tabs/index", - "van-empty": "../../components/dist/empty/index", - "van-radio": "../../components/dist/radio/index", - "van-radio-group": "../../components/dist/radio-group/index", - "van-dialog": "../../components/dist/dialog/index" - } -} \ No newline at end of file diff --git a/pagesA/orderList/orderList.wxml b/pagesA/orderList/orderList.wxml deleted file mode 100644 index 2352d87..0000000 --- a/pagesA/orderList/orderList.wxml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - 去支付 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 现金 - 刷卡 - 微信支付 - - \ No newline at end of file diff --git a/pagesA/orderList/orderList.wxss b/pagesA/orderList/orderList.wxss deleted file mode 100644 index 1614ec3..0000000 --- a/pagesA/orderList/orderList.wxss +++ /dev/null @@ -1,36 +0,0 @@ -/* pagesA/orderList/orderList.wxss */ -.box{ - padding: 10rpx; - box-shadow: 10px ; -} -.voucher-list{ - box-sizing: border-box; - padding: 10rpx; - width: 100%; -} -.voucher-item{ - width: 90%; - margin: 20rpx auto; - border-radius: 20rpx; - border: 2rpx solid #eee; - box-shadow: 2rpx 2rpx 10rpx #eee; - padding: 20rpx; -} -.voucheritem{ - display: flex; - justify-content: space-between; - padding: 10rpx; -} -.btn{ - margin-top: 10rpx; - width: 20%; - height: 50rpx; - border: 2rpx solid #e54857; - border-radius: 10rpx; - text-align: center; - line-height: 50rpx; - background-color: #e54857; - color: #ffffff; - font-size: 32rpx; - margin: 0 0 0 80%; -} diff --git a/utils/request.js b/utils/request.js index f611aaa..fb631ea 100644 --- a/utils/request.js +++ b/utils/request.js @@ -499,8 +499,9 @@ module.exports = { tsAddCertificate:(data)=>requestOne('v1/card/ts/addCertificate', 'POST', data),//租客端添加凭证 toWXCorpUser:(data)=>requestOne('v1/account/to/WXCorp/user', 'POST', data),//租客端登录 getApartmentCardInfo:(data)=>requestOne('v1/account/get/apartmentCardInfo', 'POST', data),// 获取合同信息,交租订单 - createOrderPay:(data)=>requestOne('v1/pay/createOrder', 'POST', data),// 创建交租订单 + createOrderPay:(data)=>request('v1/pay/createOrder', 'POST', data),// 创建交租订单 miniPrepayOrder:(data)=>requestOne('v1/pay/miniPrepayOrder','POST',data),//租客端创建订单 + miniPrepayOrderT:(data)=>request('v1/pay/miniPrepayOrder','POST',data),//租客端创建订单 minGetOpenLocks:(data)=>requestOne('v1/card/ts/getOpenLocks','POST',data),//租客端获取开锁记录 getBleUnlockRecord:(data)=>requestOne('v1/card/ts/getBleUnlockRecord','POST',data),//租客端获取开锁记录 updateCard:(data)=>requestOne('v1/account/edit/myKey','POST',data),