Browse Source

支付逻辑联调

epass
mk 3 months ago
parent
commit
13770e0d33
  1. 14
      api/index.js
  2. 1
      pages/index/index.js
  3. 5
      pages/mine/mine.js
  4. 70
      subpages/OCRCard/pages/deposit/deposit.js
  5. 4
      subpages/index/checkInUser/checkInUser.js
  6. 3
      subpages/index/checkInWait/checkInWait.js
  7. 12
      subpages/index/renewalApplication/renewalApplication.js

14
api/index.js

@ -19,7 +19,6 @@ export function getProcessingCheckOutInfo(pamars) {
export function checkoutConfirm(pamars) { export function checkoutConfirm(pamars) {
return fly.post(`/bysmp/checkout/confirm`,pamars) return fly.post(`/bysmp/checkout/confirm`,pamars)
} }
//新增入住评价 //新增入住评价
export function evaluateAdd(data) { export function evaluateAdd(data) {
return fly.post(`/bysmp/evaluate/add`,data) return fly.post(`/bysmp/evaluate/add`,data)
@ -36,3 +35,16 @@ export function selectMzGraduateInfo(pamars) {
export function eSignDownload(pamars) { export function eSignDownload(pamars) {
return fly.get(`/eSign/download/${pamars.bizId}`,{signType:pamars.signType}) return fly.get(`/eSign/download/${pamars.bizId}`,{signType:pamars.signType})
} }
// 获取待签合同(续期申请)
export function getContractToBeSigned(pamars) {
return fly.get(`/bysmp/renewal/getContractToBeSigned`,pamars)
}
// 获取支付参数
export function pay(data) {
return fly.post(`/bysmp/wx/pay`,data)
}
// 获取支付情况
export function paySuccess(pamars) {
return fly.get(`/bysmp/wx/paySuccess`,pamars)
}

1
pages/index/index.js

@ -140,6 +140,7 @@ Page({
getUserInfo(){ getUserInfo(){
getUserInfo().then(res=>{ getUserInfo().then(res=>{
// 有身份证号直接去信息确认没有的话就去识别身份证信息 // 有身份证号直接去信息确认没有的话就去识别身份证信息
app.globalData.userInfo = res.data;
if(res.data.idCard){ if(res.data.idCard){
wx.navigateTo({ wx.navigateTo({
url: `/subpages/index/checkInUser/checkInUser?idCard=${res.data.idCard}`, url: `/subpages/index/checkInUser/checkInUser?idCard=${res.data.idCard}`,

5
pages/mine/mine.js

@ -45,6 +45,7 @@ Page({
statusHeight: app.globalData.deviceInfo.statusHeight, statusHeight: app.globalData.deviceInfo.statusHeight,
navigationHeight: app.globalData.deviceInfo.navigationHeight, navigationHeight: app.globalData.deviceInfo.navigationHeight,
}); });
this.getUserInfo()
}, },
// 跳转到修改信息页 // 跳转到修改信息页
goToEdit() { goToEdit() {
@ -115,8 +116,8 @@ Page({
}, },
getUserInfo(){ getUserInfo(){
getUserInfo().then(res=>{ getUserInfo().then(res=>{
if(res.code ===200 && data){ if(res.code ===200 && res.data){
app.globalData.userInfo = res.data app.globalData.userInfo = res.data;
this.setData({ this.setData({
registerFlag:false registerFlag:false
}) })

70
subpages/OCRCard/pages/deposit/deposit.js

@ -1,18 +1,27 @@
// subpages/OCRCard/pages/deposit/deposit.js // subpages/OCRCard/pages/deposit/deposit.js
import {
pay,
selectMzGraduateInfo
} from "../../../../api/index"
const app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
show: true, show: false,
status: 2 status: 2,
chooseRoomId: null, //选房记录ID
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.setData({
chooseRoomId: options.chooseRoomId || app.globalData.userInfo.chooseRoomId
})
}, },
goback() { goback() {
@ -69,9 +78,62 @@ Page({
onShareAppMessage() { onShareAppMessage() {
}, },
toCheckInRecord(){ toCheckInRecord() {
wx.navigateTo({ wx.navigateTo({
url: '/subpages/mine/checkInRecord/checkInRecord', url: '/subpages/mine/checkInRecord/checkInRecord',
})
},
submit() {
const that = this;
pay({
chooseRoomId: this.data.chooseRoomId
}).then(res => {
if (res.data.code === 200) {
const {
timeStamp,
nonceStr,
paySign,
packageValue,
appId,
payId
} = res.data
wx.requestPayment({
// 必填参数
timeStamp, // 时间戳,从1970年1月1日00:00:00至今的秒数
nonceStr, // 随机字符串,32位以内
package: packageValue, // 统一下单接口返回的 prepay_id 格式如:prepay_id=xxx
signType: 'RSA', // 签名算法,固定为RSA
paySign, // 签名,使用微信支付平台证书和商户私钥生成
// 可选参数
appId, // 小程序/公众号的appId
// 回调函数
success(res) {
console.log('支付成功', res);
// 支付成功后的业务逻辑
that.paySuccess(payId)
// 可跳转到订单详情页等
},
fail(res) {
that.paySuccess(payId)
},
complete(res) {
that.paySuccess(payId)
console.log('支付完成', res);
// 无论成功失败都会执行
}
});
}
})
},
paySuccess(payId) {
paySuccess({
payId
}).then(res => {
this.setData({
show: true,
status: res.data ? 0 : 1
})
}) })
} }
}) })

4
subpages/index/checkInUser/checkInUser.js

@ -91,17 +91,19 @@ Page({
}, },
submit(){ submit(){
selectMzGraduateInfo({idCard:this.data.form.idCard}).then(res=>{ selectMzGraduateInfo({idCard:this.data.form.idCard}).then(res=>{
console.log(res);
if(res.code === 200){ if(res.code === 200){
this.bindIdCard() this.bindIdCard()
if(res.data.signType === 0){ if(res.data.signType === 0){
//线上支付去跳转签合同 //线上支付去跳转签合同
app.globalData.userInfo.chooseRoomId = res.data.chooseRecId
wx.navigateTo({ wx.navigateTo({
url: '/pages/webView/webView?url=' + encodeURIComponent(res.data.contract), url: '/pages/webView/webView?url=' + encodeURIComponent(res.data.contract),
}) })
}else if(res.data.signType === 1){ }else if(res.data.signType === 1){
// 线下签订去支付 // 线下签订去支付
wx.navigateTo({ wx.navigateTo({
url: '/subpages/OCRCard/pages/deposit/deposit', url: '/subpages/OCRCard/pages/deposit/deposit?chooseRoomId=' + res.data.chooseRecId,
}) })
}else{ }else{
wx.navigateTo({ wx.navigateTo({

3
subpages/index/checkInWait/checkInWait.js

@ -94,13 +94,14 @@ Page({
// }) // })
// 线上签订合同跳转信息确认 // 线上签订合同跳转信息确认
if(res.data.signType === 0){ if(res.data.signType === 0){
app.globalData.userInfo.chooseRoomId = res.data.chooseRecId
wx.navigateTo({ wx.navigateTo({
url: '/pages/webView/webView?url=' + encodeURIComponent(res.data.contract), url: '/pages/webView/webView?url=' + encodeURIComponent(res.data.contract),
}) })
}else if(res.data.signType === 1){ }else if(res.data.signType === 1){
// 线下签订 // 线下签订
wx.navigateTo({ wx.navigateTo({
url: '/subpages/OCRCard/pages/deposit/deposit', url: '/subpages/OCRCard/pages/deposit/deposit?chooseRoomId=' + res.data.chooseRecId,
}) })
}else{ }else{
// 没有合同信息 // 没有合同信息

12
subpages/index/renewalApplication/renewalApplication.js

@ -1,4 +1,5 @@
// subpages/index/renewalApplication/renewalApplication.js // subpages/index/renewalApplication/renewalApplication.js
import {getContractToBeSigned} from "../../../api/index"
Page({ Page({
/** /**
@ -14,7 +15,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.getContractToBeSigned()
}, },
// 跳转首页 // 跳转首页
submit() { submit() {
@ -69,5 +70,14 @@ Page({
*/ */
onShareAppMessage() { onShareAppMessage() {
},
getContractToBeSigned(){
getContractToBeSigned().then(res=>{
if(res.data.code === 1){
wx.navigateTo({
url: '/pages/webView/webView?url=' + encodeURIComponent(res.data.url),
})
}
})
} }
}) })
Loading…
Cancel
Save