Compare commits

...

2 Commits

Author SHA1 Message Date
zhouyanli
d26bd4e86b 银联支付插件 2026-06-04 17:55:18 +08:00
zhouyanli
a8e3d1f875 银联支付集成和购买插件;修改首页小区更改后获取数据;对接我的信息接口 2026-06-04 17:42:29 +08:00
57 changed files with 2178 additions and 324 deletions

View File

@@ -3,7 +3,7 @@
"appid" : "__UNI__29C3D60", "appid" : "__UNI__29C3D60",
"description" : "物业用户端app", "description" : "物业用户端app",
"versionName" : "1.0.1", "versionName" : "1.0.1",
"versionCode" : "103", "versionCode" : 105,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
@@ -23,7 +23,9 @@
"Camera" : {}, "Camera" : {},
"Contacts" : {}, "Contacts" : {},
"Gallery" : {}, "Gallery" : {},
"Push" : {} "Push" : {},
"Barcode" : {},
"Payment" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {
@@ -48,7 +50,8 @@
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>" "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>"
] ],
"schemes" : ""
}, },
/* ios */ /* ios */
"ios" : { "ios" : {
@@ -56,7 +59,9 @@
"privacyDescription" : { "privacyDescription" : {
"NSPhotoLibraryUsageDescription" : "需要访问您的相册,用于选择图片上传", "NSPhotoLibraryUsageDescription" : "需要访问您的相册,用于选择图片上传",
"NSPhotoLibraryAddUsageDescription" : "保存二维码图片到相册" "NSPhotoLibraryAddUsageDescription" : "保存二维码图片到相册"
} },
"urltypes" : "uppaylyhuts",
"urlschemewhitelist" : "uppaywallet,uppaysdk,uppayx1,uppayx2,uppayx3,paesuperbank,ccbmbsylunionpay,bocom,bankabc,cmbmobilebank,cmblife,com.icbc.iphoneclient,spdbbank,spdbcccUnionPay,citicbankpay,credit,uppayxingyecredit,uppayhuaxiacredit,uppaybeijingcredit,uppayzhonghangcredit,uppayguangdacredit,uppaygonghangcredit,uppayjianhangcredit,uppayjiaohangcredit,uppayguangfa,psbccashier,uppayyouchucredit,com.cebbank.ebank,BankOfShangHai,boscgdlf,citicbankdkkj,cmbc,cibmb,bocmbankpsn,bankofbjpay,uppaynonghangcredit,uppayhuaxia,zytuppay,LZYHSJYHAUTHSSOAPP,bnbpay,dlrcb,czbank,uppayCbhb"
}, },
/* SDK */ /* SDK */
"sdkConfigs" : { "sdkConfigs" : {
@@ -89,7 +94,20 @@
"UniversalLinks" : "" "UniversalLinks" : ""
} }
}, },
"payment" : {} "payment" : {
"appleiap" : {},
"alipay" : {
"__platform__" : [ "ios", "android" ]
},
"unionpay" : {
"__platform__" : [ "ios", "android" ]
},
"weixin" : {
"__platform__" : [ "ios", "android" ],
"appid" : "",
"UniversalLinks" : ""
}
}
} }
} }
}, },

View File

@@ -136,8 +136,7 @@ export const getTopUpSelectByResident = (data) => {
} }
// 绑定设备 // 绑定设备
export const getTopUpBindDevice = (data) => { export const getTopUpBindDevice = (data) => {
return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.openid}/${data.deviceType}`, return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.deviceType}`, data)
data)
} }
// 充值调用 // 充值调用
// /${data.rechargeAmount}/${data.type}/${data.deviceCode} // /${data.rechargeAmount}/${data.type}/${data.deviceCode}
@@ -148,9 +147,9 @@ export const getopenIdByCode = (data) => {
return get(`/api/topUp/getOpenIdByCode?code=${data.code}`, data) return get(`/api/topUp/getOpenIdByCode?code=${data.code}`, data)
} }
// 微信支付调用 // 银联支付下单
export const getToWxPay = (data) => { export const getUnionPayTn = (data) => {
return post(`/api/topUp/wxPay/${data.orderId}/${data.openid}`, data) return post('/api/topUp/unionPay/getTn', data)
} }
// 缴费记录查询 // 缴费记录查询
export const getTopupRecordWithStat = (data) => { export const getTopupRecordWithStat = (data) => {
@@ -223,3 +222,16 @@ export const getParkingDetail = (data) => {
export const rebindCar = (data) => { export const rebindCar = (data) => {
return post(`/ResidentCarAreaManage/rebind`, data) return post(`/ResidentCarAreaManage/rebind`, data)
} }
// 查询版本信息
export const getAppVersion = (platform, channel) => {
return get(`/api/app/version/${platform}/${channel}`)
}
// 检查是否需要更新
export const checkAppUpdate = (data) => {
return post(`/api/app/checkUpdate`, data)
}
// 记录更新日志
export const postUpdateLog = (data) => {
return post(`/api/app/updateLog`, data)
}

View File

@@ -39,12 +39,14 @@
onPullDownRefresh onPullDownRefresh
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import { import {
authLogout, getUserProfile, getUserNotify, changeUserNotify authLogout, getUserProfile, getUserNotify, changeUserNotify, getAppVersion, checkAppUpdate, postUpdateLog
} from '/pageSubPack/api/apiSub.js' } from '/pageSubPack/api/apiSub.js'
// //
const statusBarHeight = ref(20) const statusBarHeight = ref(20)
const cacheSize = ref(0) const cacheSize = ref(0)
const currentVersion = ref('1.0.0')
const currentVersionCode = ref(1)
const settingList = ref([{ const settingList = ref([{
title: '更改手机号码', title: '更改手机号码',
type: 'text', type: 'text',
@@ -67,11 +69,142 @@
{ {
title: '升级版本', title: '升级版本',
type: 'text', type: 'text',
value: '当前版本 2.9.8', value: '当前版本 1.0.0',
valueClass: 'item-version' valueClass: 'item-version'
} }
]) ])
// 格式化字节大小
const formatSize = (bytes) => {
if (!bytes || bytes === 0) return '0B'
const k = 1024
const sizes = ['B', 'KB', 'M', 'G']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + sizes[i]
}
// 获取真实缓存大小
const getCacheSizeData = () => {
return new Promise((resolve) => {
// #ifdef APP-PLUS
// App 端获取完整缓存(含图片、文件等)
plus.cache.calculate((size) => {
resolve(formatSize(size))
})
// #endif
// #ifndef APP-PLUS
// 小程序/H5 端只能获取 storage 缓存
const info = uni.getStorageInfoSync()
const size = (info.currentSize || 0) * 1024 // currentSize 单位 KB
resolve(formatSize(size))
// #endif
})
}
// 获取当前运行版本号
const initCurrentVersion = () => {
// #ifdef APP-PLUS
currentVersion.value = plus.runtime.version || '1.0.0'
currentVersionCode.value = plus.runtime.versionCode || 1
// #endif
// #ifndef APP-PLUS
const manifest = uni.getAppAuthorizeSetting ? uni.getAppAuthorizeSetting() : null
if (manifest && manifest.version) {
currentVersion.value = manifest.version
}
// #endif
settingList.value[4].value = '当前版本 ' + currentVersion.value
}
// 版本号比较v1 > v2 返回 1v1 = v2 返回 0v1 < v2 返回 -1
const compareVersion = (v1, v2) => {
const arr1 = v1.split('.').map(Number)
const arr2 = v2.split('.').map(Number)
const len = Math.max(arr1.length, arr2.length)
for (let i = 0; i < len; i++) {
const n1 = arr1[i] || 0
const n2 = arr2[i] || 0
if (n1 > n2) return 1
if (n1 < n2) return -1
}
return 0
}
// 检查版本更新
const checkVersionUpdate = async () => {
uni.showLoading({ title: '检查中...', mask: true })
try {
const systemInfo = uni.getSystemInfoSync()
const platform = systemInfo.platform === 'ios' ? 'ios' : 'android'
const channel = 'resident'
// 1. 查询最新版本
const versionRes = await getAppVersion(platform, channel)
if (versionRes.code === 200 && versionRes.data) {
const latestVersion = versionRes.data.versionName || ''
const latestVersionCode = versionRes.data.versionCode || 0
// 2. 调 checkAppUpdate 检查是否需要更新
const checkRes = await checkAppUpdate({
platform: platform,
channel: channel,
currentVersionCode: currentVersionCode.value
})
uni.hideLoading()
if (checkRes.code === 200 && checkRes.data) {
const needUpdate = checkRes.data.needUpdate !== false
if (needUpdate) {
const updateType = checkRes.data.updateType || versionRes.data.updateType || 'optional'
const isForce = updateType === 'force'
uni.showModal({
title: isForce ? '强制更新' : '发现新版本',
content: `当前版本:${currentVersion.value}\n最新版本${latestVersion}${versionRes.data.releaseNotes || versionRes.data.updateDesc ? '\n\n更新内容' + (versionRes.data.releaseNotes || versionRes.data.updateDesc) : ''}`,
showCancel: !isForce,
confirmText: '立即更新',
cancelText: '稍后',
success: (modalRes) => {
if (modalRes.confirm && versionRes.data.downloadUrl) {
// 记录更新日志
const userId = uni.getStorageSync('userId')
if (userId) {
postUpdateLog({
userId: userId,
platform: platform,
fromVersion: currentVersionCode.value,
toVersion: latestVersionCode
})
}
// #ifdef APP-PLUS
plus.runtime.openURL(versionRes.data.downloadUrl)
// #endif
// #ifndef APP-PLUS
uni.showToast({ title: '请在应用商店更新', icon: 'none' })
// #endif
} else if (isForce && !modalRes.confirm) {
// 强制更新时用户点取消,退出应用
// #ifdef APP-PLUS
plus.runtime.quit()
// #endif
}
}
})
} else {
uni.showToast({ title: '已是最新版本', icon: 'success' })
}
} else {
uni.showToast({ title: '检查失败', icon: 'none' })
}
} else {
uni.hideLoading()
uni.showToast({ title: '检查失败', icon: 'none' })
}
} catch (err) {
uni.hideLoading()
uni.showToast({ title: '检查失败', icon: 'none' })
}
}
// //
const onItemClick = (item) => { const onItemClick = (item) => {
if (item.title == '更改手机号码') { if (item.title == '更改手机号码') {
@@ -84,7 +217,10 @@
}); });
} else if (item.title == '清除缓存') { } else if (item.title == '清除缓存') {
uni.clearStorageSync(); uni.clearStorageSync();
settingList.value[3].value = '0M' // #ifdef APP-PLUS
plus.cache.clear(() => {})
// #endif
settingList.value[3].value = '0B'
uni.showLoading({ uni.showLoading({
title: '清除中...', title: '清除中...',
mask: true mask: true
@@ -98,6 +234,8 @@
setTimeout(() => { setTimeout(() => {
uni.hideLoading(); uni.hideLoading();
}, 2500); }, 2500);
} else if (item.title == '升级版本') {
checkVersionUpdate()
} }
} }
@@ -166,7 +304,9 @@
}); });
} }
onMounted(() => { onMounted(async () => {
initCurrentVersion()
settingList.value[3].value = await getCacheSizeData()
getUserProfile().then(res => { getUserProfile().then(res => {
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
const phone = res.data.phone || '' const phone = res.data.phone || ''

View File

@@ -124,13 +124,22 @@ const openDoorClick = () => {
// }) // })
// return // return
// } // }
getAccessOpenData() uni.showToast({
title: '正在对接硬件中...',
icon: 'none'
})
// getAccessOpenData()
} }
// 开门接口 // 开门接口
const getAccessOpenData = async () =>{ const getAccessOpenData = async () =>{
uni.showLoading({
title: '开门中...',
mask: true
})
try{ try{
let params = {deviceId:selectedDoor.value} let params = {deviceId:selectedDoor.value}
const res = await getAccessOpen(params) const res = await getAccessOpen(params)
uni.hideLoading()
if(res.code === 200){ if(res.code === 200){
uni.showToast({ uni.showToast({
title:'开门成功', title:'开门成功',
@@ -141,8 +150,9 @@ const getAccessOpenData = async () =>{
title:'开门失败', title:'开门失败',
icon:"error" icon:"error"
}) })
} }
}catch(err){ }catch(err){
uni.hideLoading()
uni.showToast({ uni.showToast({
title: err.msg || '开门失败', title: err.msg || '开门失败',
icon:"none" icon:"none"

View File

@@ -10,7 +10,7 @@
<!-- 头部物业费A标题+水滴图标 --> <!-- 头部物业费A标题+水滴图标 -->
<view class="card-header"> <view class="card-header">
<image class="iconStyle" <image class="iconStyle"
:src="paymentType=='物业费A'?'https://wuyeadmin.bugtc.com/images/propertyImgs/water.png':'https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png'"> :src="paymentType=='水费'?'https://wuyeadmin.bugtc.com/images/propertyImgs/water.png':'https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png'">
</image> </image>
<text class="card-title">{{paymentType}}</text> <text class="card-title">{{paymentType}}</text>
</view> </view>
@@ -175,10 +175,18 @@
// return // return
// } // }
const openid = uni.getStorageSync('openid') const openid = uni.getStorageSync('openid')
// if (!openid) {
// uni.hideLoading()
// uni.showToast({
// title: '获取用户信息失败,请重新登录',
// icon: 'none'
// })
// return
// }
await getTopUpBindDevice({ await getTopUpBindDevice({
deviceType: paymentType.value=='物业费A'?'2':'1', deviceType: paymentType.value=='水费'?'2':'1',
deviceCode: deviceNo.value, deviceCode: deviceNo.value,
openid: openid, // openid: openid,
residentUserId: uni.getStorageSync('userId') residentUserId: uni.getStorageSync('userId')
}) })
uni.hideLoading() uni.hideLoading()

View File

@@ -44,8 +44,13 @@
<view style="border-bottom: 2rpx solid #ededed;margin:10rpx 0rpx;"></view> <view style="border-bottom: 2rpx solid #ededed;margin:10rpx 0rpx;"></view>
<view class="input-section" style="display: flex;"> <view class="input-section" style="display: flex;">
<text class="amount-input" style="width: auto;margin: 0rpx 20rpx;">¥</text> <text class="amount-input" style="width: auto;margin: 0rpx 20rpx;">¥</text>
<input type="digit" v-model="payNum" class="amount-input" placeholder="点击输入缴费金额"> <input
</input> type="digit"
:value="payNum"
@input="(e) => payNum = e.detail.value"
class="amount-input"
placeholder="点击输入缴费金额"
/>
</view> </view>
<view style="border-bottom: 2rpx solid #ededed;margin:10rpx 0rpx;"></view> <view style="border-bottom: 2rpx solid #ededed;margin:10rpx 0rpx;"></view>
<view class="arrears-row" v-if="outstandingPayment==true"> <view class="arrears-row" v-if="outstandingPayment==true">
@@ -57,7 +62,6 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 2. 缴费成功页 --> <!-- 2. 缴费成功页 -->
@@ -98,29 +102,18 @@
<script setup> <script setup>
import { import {
ref, ref,
reactive, reactive
onMounted,
computed
} from 'vue' } from 'vue'
import { import {
onShow, onShow,
onReady, onLoad
onReachBottom,
onLoad,
onUnload,
onPullDownRefresh
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import { import {
getTopUp, getPushSingle
getToWxPay, } from '/pageSubPack/api/api.js'
getopenIdByCode,
postSubscribeAuth
} from '/pageSubPack/api/apiSub.js'
// 响应式数据 // 响应式数据
const statusBarHeight = ref(20)
const outstandingPayment = ref(true) const outstandingPayment = ref(true)
const storageValue = uni.getStorageSync('arrearsPayment') const storageValue = uni.getStorageSync('arrearsPayment')
const paymentItem = reactive(typeof storageValue === 'object' && storageValue !== null ? storageValue : {}) const paymentItem = reactive(typeof storageValue === 'object' && storageValue !== null ? storageValue : {})
@@ -132,7 +125,15 @@
// 页面加载时初始化数据 // 页面加载时初始化数据
onLoad(() => { onLoad(() => {
initPaymentData() initPaymentData()
checkAllSubscribeStatus() })
// 从支付收银台返回时检查支付结果
onShow(() => {
const paySuccess = uni.getStorageSync('paySuccess')
if (paySuccess) {
uni.removeStorageSync('paySuccess')
currentStep.value = 2
}
}) })
// 初始化缴费数据 // 初始化缴费数据
@@ -159,7 +160,7 @@
}); });
} }
// 立即缴费 // 立即缴费 — 跳转到支付收银台选择支付方式
const handlePay = () => { const handlePay = () => {
if (!payNum.value || Number(payNum.value) <= 0) { if (!payNum.value || Number(payNum.value) <= 0) {
uni.showToast({ uni.showToast({
@@ -168,235 +169,31 @@
}) })
return return
} }
requestPayOrder() uni.setStorageSync('payData', {
amount: payNum.value,
deviceCode: paymentItem.deviceCode,
type: paymentItem.type,
name: paymentItem.name,
fullAddress: paymentItem.fullAddress
})
uni.navigateTo({ url: '/pageSubPack/payment-list/yinlianPayTn' })
} }
// 统一下单后后端返回的支付参数
const payInfo = ref({
appId: '', // 公众号/小程序ID
timeStamp: '', // 时间戳
nonceStr: '', // 随机串
package: '', // 数据包 如 prepay_id=xxx
signType: 'MD5', // 签名方式
paySign: '' // 签名
})
// 1. 先请求后端接口生成预支付订单 // 缴费成功推送通知
const requestPayOrder = async () => { const sendPaySuccessPush = () => {
try { const userId = uni.getStorageSync('userId')
uni.showLoading({ if (userId) {
title: '发起支付中' getPushSingle({
}) userId: userId,
channel: 'resident',
// // 获取 openid title: '缴费成功',
// const loginRes = await wx.login() content: `您已成功缴纳${paymentItem.type || ''}费用 ¥${payNum.value || payAmount.value}`
// if (!loginRes.code) { }).catch(err => {
// uni.hideLoading() console.log('推送发送失败', err)
// uni.showToast({
// title: '登录失败',
// icon: 'none'
// })
// return
// }
// // 用 code 换 openid
// const openIdRes = await getopenIdByCode({
// code: loginRes.code
// })
// if (openIdRes.code !== 200 || !openIdRes.data) {
// uni.hideLoading()
// uni.showToast({
// title: '获取openid失败',
// icon: 'none'
// })
// return
// }
// const openid = openIdRes.data
const openid = uni.getStorageSync('openid')
// 调用充值接口创建订单
console.log('1111111111', paymentItem);
const topUpRes = await getTopUp({
residentUserId: uni.getStorageSync('userId'),
rechargeAmount: payNum.value,
money: payNum.value || payAmount.value,
deviceCode: paymentItem.deviceCode,
// type: paymentItem.type == '物业费A' ? '2' : paymentItem.type == '物业费B' ? '1' : ''
type:'2'
})
uni.hideLoading()
const topUpData = topUpRes
console.log(topUpData);
if (topUpData.code !== 200) {
uni.showToast({
title: topUpData.msg || '下单失败',
icon: 'none'
})
return
}
// 调用微信支付接口获取支付参数
const payRes = await getToWxPay({
orderId: topUpData.data.orderId,
openid: openid,
// rechargeAmount: payNum.value || payAmount.value,
// type: paymentItem.type == '物业费A' ? '2' : paymentItem.type == '物业费B' ? '1' : ''
})
if (payRes.code !== 200) {
uni.showToast({
title: payRes.msg || '获取支付参数失败',
icon: 'none'
})
return
}
const payData = payRes.data
console.log('payData', payData);
// 赋值支付参数
payInfo.value = {
appId: payData.appId,
timeStamp: payData.timeStamp,
nonceStr: payData.nonceStr,
package: payData.package.startsWith('prepay_id=') ? payData.package : 'prepay_id=' + payData
.package,
signType: payData.signType,
paySign: payData.paySign
}
// 2. 调起微信支付
wx.requestPayment({
...payInfo.value,
success(res) {
console.log('支付成功', res)
currentStep.value = 2
},
fail(err) {
console.log('支付失败', err)
uni.showToast({
title: '支付取消或失败',
icon: 'none'
})
}
})
handleWaterElecSubscribe()
} catch (err) {
uni.hideLoading()
console.log('请求异常', err)
uni.showToast({
title: '支付请求异常',
icon: 'none'
}) })
} }
} }
// 【双模板ID】你提供的 物业费A+物业费B 催缴模板
const TEMPLATE_IDS = {
water: 'DowYnoGKNtl_eYycRCq-nt7DAoFjH7aVcGUQciZl1v0',
elec: 'PE7Neemv0z77JnBIPmb-Qg2Q3pJSUDGaILCryFCxmaw'
}
// 转成数组微信API要求
const TEMPLATE_ID_ARRAY = Object.values(TEMPLATE_IDS)
// 1. 检测 物业费A+物业费B 订阅状态
const checkAllSubscribeStatus = () => {
uni.getSetting({
withSubscriptions: true,
success: (res) => {
const itemSettings = res.subscriptionsSetting?.itemSettings || {}
console.log('物业费A订阅状态', itemSettings[TEMPLATE_IDS.water])
console.log('物业费B订阅状态', itemSettings[TEMPLATE_IDS.elec])
}
})
}
// 2. 点击开启订阅(主方法)
const handleWaterElecSubscribe = () => {
uni.getSetting({
withSubscriptions: true,
success: (res) => {
const itemSettings = res.subscriptionsSetting?.itemSettings || {}
const waterStatus = itemSettings[TEMPLATE_IDS.water]
const elecStatus = itemSettings[TEMPLATE_IDS.elec]
// 如果任意一个被永久拒绝 → 引导去设置
if ((waterStatus === 'reject' || waterStatus === 'ban') ||
(elecStatus === 'reject' || elecStatus === 'ban')) {
uni.showModal({
title: '开启消息通知',
content: '请前往设置页打开物业费A/物业费B提醒开关',
confirmText: '去设置',
success: (modalRes) => {
if (modalRes.confirm) uni.openSetting()
}
})
return
}
// 正常弹出授权框
requestMultiSubscribe()
}
})
}
// 3. 调用微信授权(根据类型传对应模板)
const requestMultiSubscribe = () => {
const tmplIds = paymentItem.type == '物业费A' ? [TEMPLATE_IDS.water] : paymentItem.type == '物业费B' ? [TEMPLATE_IDS.elec] : TEMPLATE_ID_ARRAY
uni.requestSubscribeMessage({
tmplIds: tmplIds,
success: async (res) => {
console.log('双模板授权结果:', res)
let successCount = 0
// 物业费A授权成功
if (res[TEMPLATE_IDS.water] === 'accept') successCount++
// 物业费B授权成功
if (res[TEMPLATE_IDS.elec] === 'accept') successCount++
if (successCount > 0) {
uni.showToast({
title: `已开启${successCount}项提醒`,
icon: 'success'
})
// 保存用户openid到后端
await saveUserSubscribe()
} else {
uni.showToast({
title: '已取消授权',
icon: 'none'
})
}
},
fail: () => {
uni.showToast({
title: '授权失败',
icon: 'none'
})
}
})
}
// 4. 传给后端:保存订阅信息
const saveUserSubscribe = async () => {
const res = await postSubscribeAuth({
openid: uni.getStorageSync('openid'),
templateIds: paymentItem.type == '物业费A' ? [TEMPLATE_IDS.water] : paymentItem.type == '物业费B' ? [TEMPLATE_IDS.elec] : TEMPLATE_ID_ARRAY,
// deviceCode: paymentItem.deviceCode,
// deviceType: paymentItem.type == '物业费A' ? '2' : paymentItem.type == '物业费B' ? '1' : ''
})
if (res.data == 200) {
console.log('111111111111111', res)
} else {
uni.showToast({
title: `${res.msg}`,
icon: 'none'
})
}
}
// 返回缴费列表 // 返回缴费列表
const handleBackToList = () => { const handleBackToList = () => {
uni.redirectTo({ uni.redirectTo({
@@ -764,6 +561,65 @@
margin-bottom: 150rpx; margin-bottom: 150rpx;
} }
/* 支付方式选择 */
.pay-method-section {
margin-top: 30rpx;
padding: 0 20rpx;
}
.pay-method-title {
font-size: 30rpx;
color: #333;
font-weight: 600;
margin-bottom: 20rpx;
display: block;
}
.pay-method-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.pay-method-item {
display: flex;
align-items: center;
padding: 24rpx 30rpx;
background: #fff;
border-radius: 12rpx;
border: 2rpx solid #ededed;
}
.pay-method-item.active {
border-color: #1677ff;
background: #f0f7ff;
}
.pay-icon {
width: 48rpx;
height: 48rpx;
margin-right: 20rpx;
}
.pay-name {
flex: 1;
font-size: 30rpx;
color: #333;
}
.pay-check {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
background: #1677ff;
position: relative;
}
.pay-check::after {
content: '';
position: absolute;
left: 10rpx;
top: 6rpx;
width: 8rpx;
height: 14rpx;
border: 2rpx solid #fff;
border-left: none;
border-top: none;
transform: rotate(45deg);
}
/* 核心:欠费金额行样式 */ /* 核心:欠费金额行样式 */
.arrears-row { .arrears-row {
display: flex; display: flex;

View File

@@ -14,9 +14,9 @@
<view class="bill-item" @click="goToBill(item)" v-for="item,index in paymentList" :key="index"> <view class="bill-item" @click="goToBill(item)" v-for="item,index in paymentList" :key="index">
<image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/water.png" <image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/water.png"
v-if="item.type=='物业费A'"></image> v-if="item.type=='水费'"></image>
<image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png" <image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png"
v-if="item.type=='物业费B'"></image> v-if="item.type=='电费'"></image>
<view class="bill-info"> <view class="bill-info">
<view class="bill-title">{{item.type}} <view class="bill-title">{{item.type}}
<view class="bill-status debt" v-if="item.balance<0">已欠费</view> <view class="bill-status debt" v-if="item.balance<0">已欠费</view>
@@ -80,7 +80,6 @@
import { import {
getTopUpSelectByResident, getTopUpSelectByResident,
getopenIdByCode,
postInsertOpenId, postInsertOpenId,
postSubscribeAuth postSubscribeAuth
} from '/pageSubPack/api/apiSub.js' } from '/pageSubPack/api/apiSub.js'
@@ -105,7 +104,7 @@
// }, // },
// { // {
// id: 3, // id: 3,
// name: '物业费B', // name: '电费',
// status: '已欠费', // status: '已欠费',
// address: '山东省日照市东港区桂花园别墅2号楼2层', // address: '山东省日照市东港区桂花园别墅2号楼2层',
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png", // icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png",
@@ -120,26 +119,25 @@
// iconClass: "gas" // iconClass: "gas"
// }, // },
{ {
name: "物业费A", name: "水费",
type: "water", type: "water",
icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/water.png", icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/water.png",
iconClass: "water" iconClass: "water"
}, },
{
name: "电费",
type: "electric",
icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png",
iconClass: "electric"
},
// { // {
// name: "物业", // name: "物业",
// type: "property", // type: "property",
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/property.png", // icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/property.png",
// iconClass: "property" // iconClass: "property"
// }, // },
// { // {
// name: "物业费B", // name: "车位费",
// type: "electric",
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png",
// iconClass: "electric"
// },
// {
// name: "车位",
// type: "parking", // type: "parking",
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/parkingIcon.png", // icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/parkingIcon.png",
// iconClass: "parking" // iconClass: "parking"
@@ -147,34 +145,18 @@
]) ])
const postOpenId = async () => { const postOpenId = async () => {
// 获取 openid // App 端直接从本地存储获取 openid
try { try {
const loginRes = await wx.login() const openid = uni.getStorageSync('openid')
if (!loginRes.code) { if (!openid) {
uni.hideLoading()
uni.showToast({ uni.showToast({
title: '登录失败', title: '请先登录',
icon: 'none' icon: 'none'
}) })
return return
} }
// 用 code 换 openid
const openIdRes = await getopenIdByCode({
code: loginRes.code
})
if (openIdRes.code !== 200 || !openIdRes.data) {
uni.hideLoading()
uni.showToast({
title: '获取openid失败',
icon: 'none'
})
return
}
const openid = openIdRes.data
uni.setStorageSync('openid', openid)
await postInsertOpenId({ await postInsertOpenId({
openid: uni.getStorageSync('openid'), openid: openid,
residentUserId: uni.getStorageSync('userId') residentUserId: uni.getStorageSync('userId')
}) })
} catch (err) { } catch (err) {
@@ -247,7 +229,7 @@
uni.redirectTo({ uni.redirectTo({
url: '/pageSubPack/payment-list/selectPaymentEntity' url: '/pageSubPack/payment-list/selectPaymentEntity'
}) })
} else if (type.name == '物业费A' || type.name == '物业费B') { } else if (type.name == '水费' || type.name == '电费') {
uni.redirectTo({ uni.redirectTo({
url: '/pageSubPack/payment-list/addHydropower' url: '/pageSubPack/payment-list/addHydropower'
}) })
@@ -425,23 +407,28 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
gap: 26rpx; /* gap: 26rpx; */
} }
.grid-item { .grid-item {
width: calc(25% - 50rpx); width: calc(25% - 60rpx);
background-color: #F6F9FE; background-color: #F6F9FE;
border-radius: 12rpx; border-radius: 12rpx;
padding: 20rpx; padding: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
margin-left: 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
} }
/* 每行第 1 个 item 清除左边距,保证对齐 */
.grid-item:nth-child(4n+1) {
margin-left: 0;
}
.icon-box { .icon-box {
width: 88rpx; width: 52rpx;
height: 88rpx; height: 52rpx;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;

View File

@@ -0,0 +1,420 @@
<template>
<view class="container">
<view class="status-bar"></view>
<!-- 顶部导航 -->
<uni-nav-bar title="支付收银台" left-icon="left" @clickLeft="goBack" />
<!-- 金额区域 -->
<view class="amount-box">
<text class="amount">¥{{ amount }}</text>
<text class="countdown">剩余支付时间{{ countdownTime }}</text>
</view>
<!-- 支付方式列表 -->
<view class="pay-list">
<view class="pay-item" @click="selectPayType('wx')">
<view class="left">
<image src="/static/wechat.png" class="icon" mode="widthFix" />
<view class="pay-info">
<text class="pay-name">微信支付</text>
<text class="pay-desc">微信快捷支付</text>
</view>
</view>
<view class="radio" :class="{ active: selectedType === 'wx' }" />
</view>
<view class="pay-item" @click="selectPayType('alipay')">
<view class="left">
<image src="/static/alipay.png" class="icon" mode="widthFix" />
<view class="pay-info">
<text class="pay-name">支付宝支付</text>
<text class="pay-desc">支付宝快捷支付</text>
</view>
</view>
<view class="radio" :class="{ active: selectedType === 'alipa··y' }" />
</view>
<view class="pay-item" @click="selectPayType('union')">
<view class="left">
<image src="/static/union.png" class="icon" mode="widthFix" />
<view class="pay-info">
<text class="pay-name">银联支付</text>
<text class="pay-desc">云闪付/银行卡</text>
</view>
</view>
<view class="radio" :class="{ active: selectedType === 'union' }" />
</view>
</view>
<view class="tip">请选择支付方式完成缴费</view>
<!-- 底部支付按钮 -->
<view class="pay-btn" @click="handlePayClick">
<text class="btn-text">立即支付 {{ amount }} </text>
</view>
</view>
</template>
<script setup>
import { ref, onUnmounted } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getUnionPayTn } from '/pageSubPack/api/apiSub.js'
import { getPushSingle } from '/pageSubPack/api/api.js'
// #ifdef APP
import { startPay, checkWalletInstalled } from '@/uni_modules/unionpay-full'
// #endif
const amount = ref('0.00')
const countdownTime = ref('29:57')
let timer = null
const payData = ref({})
// 读取支付数据
onLoad(() => {
const data = uni.getStorageSync('payData')
if (data) {
payData.value = data
amount.value = Number(data.amount || 0).toFixed(2)
}
startCountdown()
})
onUnmounted(() => {
if (timer) clearInterval(timer)
})
const startCountdown = () => {
let [min, sec] = countdownTime.value.split(':')
let totalSec = parseInt(min) * 60 + parseInt(sec)
timer = setInterval(() => {
totalSec--
if (totalSec <= 0) {
clearInterval(timer)
uni.showToast({ title: '支付超时', icon: 'none' })
setTimeout(() => uni.navigateBack(), 1500)
return
}
const newMin = Math.floor(totalSec / 60).toString().padStart(2, '0')
const newSec = (totalSec % 60).toString().padStart(2, '0')
countdownTime.value = `${newMin}:${newSec}`
}, 1000)
}
// 选中的支付类型(默认微信)
const selectedType = ref('wx')
// 返回
const goBack = () => uni.navigateBack()
// 选择支付方式
const selectPayType = (type) => {
selectedType.value = type
uni.vibrateShort({ type: 'light' })
}
// 点击底部支付按钮
const handlePayClick = () => {
handlePay()
}
// ==================== 统一支付入口 ====================
const handlePay = async () => {
try {
uni.showLoading({ title: '发起支付中' })
// 向后端请求获取支付参数
const res = await getUnionPayTn({
amount: amount.value,
orderDesc: (payData.value.type || '缴费') + '缴费',
residentUserId: uni.getStorageSync('userId'),
devicecode: payData.value.deviceCode || '',
deviceType: '2'
})
console.log('支付接口返回:', JSON.stringify(res.data))
uni.hideLoading()
if (res.code !== 200 || !res.data) {
uni.showToast({ title: res.msg || '获取支付参数失败', icon: 'none' })
return
}
const payType = selectedType.value
const data = res.data
// 根据支付方式调起对应 SDK
if (payType === 'union') {
// 银联UMS SDK
invokeUmsPay('unionpay', data.union?.tn || data.union || data)
} else if (payType === 'wx') {
// 微信plus.payment等申请微信SDK后切到UMS
invokeWxPay(data.wx || data.wxPayInfo || data)
} else if (payType === 'alipay') {
// 支付宝UMS SDK
invokeUmsPay('alipay', data.alipay || data.aliPayInfo || data)
}
} catch (err) {
uni.hideLoading()
console.log('支付异常', err)
uni.showToast({ title: '支付请求异常', icon: 'none' })
}
}
// ==================== UMS 统一支付(银联/支付宝)====================
const invokeUmsPay = (channel, data) => {
// #ifdef APP
const tn = typeof data === 'string' ? data : (data.tn || JSON.stringify(data))
// 银联渠道检查是否安装云闪付
if (channel === 'unionpay') {
const installed = checkWalletInstalled()
if (!installed) {
uni.showModal({
title: '未安装云闪付',
content: '请先下载安装云闪付App后再进行支付',
showCancel: false,
confirmText: '知道了'
})
return
}
}
// 调起 UMS 支付
startPay({
channel: channel,
tn: tn,
mode: '00',
callback: (result) => {
console.log('UMS支付结果[' + channel + ']', JSON.stringify(result))
const code = result?.code
if (code === 0) {
paySuccess()
} else if (code === 1) {
uni.showModal({
title: '支付处理中',
content: '银行正在处理支付结果,请勿重复支付。您可在「缴费记录」中查看最终状态。',
showCancel: false,
confirmText: '我知道了',
success: () => {
uni.redirectTo({ url: '/pageSubPack/payment-list/paymentIndex' })
}
})
} else if (code === -2) {
uni.showToast({ title: '支付已取消', icon: 'none' })
} else {
uni.showToast({ title: result?.msg || '支付失败', icon: 'none' })
}
}
})
// #endif
// #ifndef APP
uni.showToast({ title: '支付仅支持App端', icon: 'none' })
// #endif
}
// ==================== 微信支付uni.requestPayment====================
const invokeWxPay = (data) => {
const orderInfo = {
appid: data.appId,
partnerid: data.partnerId || data.partnerid || '',
prepayid: data.prepayId || data.prepayid || (data.package || '').replace('prepay_id=', ''),
package: 'Sign=WXPay',
noncestr: data.nonceStr,
timestamp: data.timeStamp,
sign: data.paySign
}
uni.requestPayment({
provider: 'wxpay',
orderInfo: orderInfo,
success: (res) => {
console.log('微信支付成功', res)
paySuccess()
},
fail: (err) => {
console.error('微信支付失败或取消', err)
uni.showToast({ title: '支付取消或失败', icon: 'none' })
}
})
}
// ==================== 支付宝支付uni.requestPayment====================
const invokeAlipay = (data) => {
const orderInfo = data.orderInfo || data
uni.requestPayment({
provider: 'alipay',
orderInfo: orderInfo,
success: (res) => {
console.log('支付宝支付成功', res)
paySuccess()
},
fail: (err) => {
console.error('支付宝支付失败或取消', err)
uni.showToast({ title: '支付取消或失败', icon: 'none' })
}
})
}
// ==================== 支付成功 ====================
const paySuccess = () => {
sendPaySuccessPush()
uni.showToast({ title: '支付成功', icon: 'success' })
uni.setStorageSync('paySuccess', true)
setTimeout(() => {
uni.redirectTo({
url: '/pageSubPack/payment-list/arrearsPayment'
})
}, 1500)
}
// 缴费成功推送通知
const sendPaySuccessPush = () => {
const userId = uni.getStorageSync('userId')
if (userId) {
getPushSingle({
userId: userId,
channel: 'resident',
title: '缴费成功',
content: `您已成功缴纳${payData.value.type || ''}费用 ¥${amount.value}`
}).catch(err => console.log('推送发送失败', err))
}
}
</script>
<style scoped>
/* 全局容器 */
.container {
width: 100%;
height: 100vh;
background-color: #f5f5f5;
display: flex;
flex-direction: column;
}
/* 金额区域 */
.amount-box {
background: #2F77FD;
color: #fff;
padding: 60rpx 20rpx;
text-align: center;
}
.amount {
font-size: 72rpx;
font-weight: bold;
display: block;
margin-bottom: 16rpx;
}
.countdown {
font-size: 26rpx;
opacity: 0.9;
}
/* 支付方式列表 */
.pay-list {
margin-top: 20rpx;
background-color: #fff;
padding: 0 20rpx;
}
.pay-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 20rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.pay-item:last-child {
border-bottom: none;
}
.left {
display: flex;
align-items: center;
}
.icon {
width: 56rpx;
height: 56rpx;
margin-right: 20rpx;
border-radius: 8rpx;
}
.pay-info {
display: flex;
flex-direction: column;
}
.pay-name {
font-size: 32rpx;
color: #333;
font-weight: 500;
}
.pay-desc {
font-size: 24rpx;
color: #999;
margin-top: 4rpx;
}
/* 单选按钮 — 对勾样式 */
.radio {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
border: 2rpx solid #ccc;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.radio.active {
border-color: #2F77FD;
background-color: #2F77FD;
}
.radio.active::after {
content: '';
width: 10rpx;
height: 18rpx;
border: 3rpx solid #fff;
border-left: none;
border-top: none;
transform: rotate(45deg) translate(-2rpx, -2rpx);
}
/* 底部提示 */
.tip {
font-size: 24rpx;
color: #999;
text-align: center;
padding: 30rpx 0;
margin-bottom: 120rpx;
}
/* 底部按钮 — 圆角胶囊 */
.pay-btn {
position: fixed;
bottom: 40rpx;
left: 30rpx;
right: 30rpx;
height: 90rpx;
line-height: 90rpx;
background: #2F77FD;
color: #fff;
text-align: center;
font-size: 32rpx;
font-weight: bold;
border-radius: 45rpx;
}
.status-bar {
width: 100vw;
height: 46px;
}
</style>

View File

@@ -187,7 +187,11 @@
})) }))
} }
} catch (e) { } catch (e) {
console.error('获取房屋列表失败', e) uni.showToast({
title:e.msg || '获取房屋列表失败',
icon:'none'
})
// console.error('获取房屋列表失败', e)
} }
} }
@@ -376,7 +380,7 @@
} }
} catch (e) { } catch (e) {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ title: '网络异常,请重试', icon: 'none' }); uni.showToast({ title: e.msg || '网络异常,请重试', icon: 'none' });
} }
}; };

View File

@@ -392,6 +392,12 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "yinlianPayTn",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
} }
] ]

View File

@@ -184,6 +184,7 @@ const statusBarHeight = ref(0)
const bannerList = ref([]) const bannerList = ref([])
const noticeText = ref('暂无公告') const noticeText = ref('暂无公告')
const noticeId = ref('') const noticeId = ref('')
const lastUserId = ref('') // 用于检测是否切换账号
// =======方法======= // =======方法=======
// 格式化时间 // 格式化时间
@@ -276,9 +277,37 @@ const getNoticeData = async() =>{
} }
} }
onShow(() =>{ // 刷新所有数据(提取公共方法)
}) const refreshAllData = () => {
const token = uni.getStorageSync('token') || '';
const currentVillageId = uni.getStorageSync('currentVillageId');
if (token && currentVillageId && currentVillageId !== '0' && currentVillageId !== 0) {
getCurrentCommunityData();
}
getNoticeData()
getNewActivityList()
getbannarData()
}
onShow(() => {
const currentUserId = uni.getStorageSync('userId') || ''
// 检测到切换账号:重置数据并重新加载
if (lastUserId.value && lastUserId.value !== currentUserId) {
// 切换账号时重置页面数据
currentCommunity.value = '请认证小区'
currentVillageId.value = ''
activityList.value = []
bannerList.value = []
noticeText.value = '暂无公告'
noticeId.value = ''
refreshAllData()
}
// 首次显示 或 非切换账号的普通返回,也刷新数据
else {
refreshAllData()
}
lastUserId.value = currentUserId
})
onLoad(() => { onLoad(() => {
const info = uni.getSystemInfoSync() const info = uni.getSystemInfoSync()
@@ -287,15 +316,11 @@ onLoad(() => {
// 绑定全局事件监听 // 绑定全局事件监听
uni.$on('confirm', slelctHomeData) uni.$on('confirm', slelctHomeData)
// 页面加载时先判断是否有token有则获取认证小区 // 记录当前用户ID用于 onShow 中检测是否切换账号
const token = uni.getStorageSync('token') || ''; lastUserId.value = uni.getStorageSync('userId') || ''
const currentVillageId = uni.getStorageSync('currentVillageId');
if (token && currentVillageId && currentVillageId !== '0' && currentVillageId !== 0) { // 页面加载时刷新数据
getCurrentCommunityData(); // 加载时获取认证小区 refreshAllData()
}
getNoticeData()
getNewActivityList()
getbannarData()
}) })
// 页面销毁时移除监听(防止内存泄漏) // 页面销毁时移除监听(防止内存泄漏)

View File

@@ -6,7 +6,7 @@
<scroll-view class="page" scroll-y> <scroll-view class="page" scroll-y>
<view class="topBox"> <view class="topBox">
<view class="name"> <view class="name">
<image src="http://47.104.199.163:9090/images/propertyImgs/touxiang.jpg" class="img" /> <image :src="avatar" class="img" />
<span style="padding: 5rpx 5rpx;display: flex;flex-direction: column;line-height: 60rpx;"> <span style="padding: 5rpx 5rpx;display: flex;flex-direction: column;line-height: 60rpx;">
<span style="font-size: 36rpx;font-weight: 600;"> <span style="font-size: 36rpx;font-weight: 600;">
{{loginName}} {{loginName}}
@@ -28,7 +28,7 @@
style="align-self: flex-end;font-size: 24rpx;vertical-align: baseline;">{{ item.desc }}</span></span> style="align-self: flex-end;font-size: 24rpx;vertical-align: baseline;">{{ item.desc }}</span></span>
</view> </view>
<view class="item-arrow"></view> <view class="item-arrow"></view>
<!-- <image src="http://47.104.199.163:9090/images/propertyImgs/arrow-right.png" class="arrow-icon" /> --> <!-- <image src="https://wuyeadmin.bugtc.com/images/propertyImgs/arrow-right.png" class="arrow-icon" /> -->
</view> </view>
</view> </view>
@@ -46,32 +46,35 @@
import { import {
ref ref
} from 'vue'; } from 'vue';
import { getUserProfile } from '../../pageSubPack/api/apiSub';
import {onShow} from '@dcloudio/uni-app'
const list = ref([{ const list = ref([{
icon: "http://47.104.199.163:9090/images/propertyImgs/house.png", icon:'https://wuyeadmin.bugtc.com/images/propertyImgs/house.png',
title: "我的房屋" title: "我的房屋"
}, },
{ {
icon: "http://47.104.199.163:9090/images/propertyImgs/user.png", icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/user.png",
title: "住户管理", title: "住户管理",
// desc: "您可以在这里添加家人、朋友、租客~" // desc: "您可以在这里添加家人、朋友、租客~"
}, },
{ {
icon: "http://47.104.199.163:9090/images/propertyImgs/parking.png", icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/parking.png",
title: "我的车位" title: "我的车位"
}, },
{ {
icon: "http://47.104.199.163:9090/images/propertyImgs/car.png", icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/car.png",
title: "我的车辆" title: "我的车辆"
}, },
{ {
icon: "http://47.104.199.163:9090/images/propertyImgs/setting.png", icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/setting.png",
title: "设置" title: "设置"
} }
]) ])
const loginName = ref("wangh") const loginName = ref("")
const phoneNum = ref('156*****1212') const phoneNum = ref('')
const avatar = ref('')
// --方法---- // --方法----
const goToDetail = () => { const goToDetail = () => {
@@ -79,6 +82,19 @@
url: '/pageSubPack/notice-list/noticeListDetails' url: '/pageSubPack/notice-list/noticeListDetails'
}) })
} }
// 获取用户账号信息
function getUserInfoData(){
getUserProfile().then(res => {
if (res.code === 200 && res.data) {
avatar.value = res.data.avatar
loginName.value = res.data.username
phoneNum.value = res.data.phone || ''
}
})
}
// 返回 // 返回
const onItemClick = (item) => { const onItemClick = (item) => {
if (item.title == '我的房屋') { if (item.title == '我的房屋') {
@@ -121,6 +137,9 @@
complete: () => {} complete: () => {}
}); });
} }
onShow(() =>{
getUserInfoData()
})
</script> </script>

View File

@@ -0,0 +1,30 @@
## 1.1.22026-05-25
【文档】增加uniappx项目引用插件的说明
## 1.1.12026-04-07
升级云闪付SDK版本`Androidv3.5.18``IOSv3.6.3``HarmonyOSv3.1.3`
## 1.1.02026-02-27
【优化】文档增加已知问题说明
## 1.0.92026-02-03
【优化】HarmonyOS完善module.json5文件文档增加对鸿蒙平台的特殊说明
## 1.0.82025-09-22
修复频繁调用插件函数报回调被回收的问题
## 1.0.72025-09-03
【修复】修复鸿蒙打包报错问题
## 1.0.6.12025-08-29
【优化】移除插件中module.json5的配置
## 1.0.62025-07-15
【修复】修复鸿蒙打包报错的问题
## 1.0.52025-05-08
修复IOS端modules丢失打包报错的问题
## 1.0.42025-05-08
升级云闪付SDK版本`Androidv3.5.16``IOSv3.6.2``HarmonyOSv3.1.2`
## 1.0.32025-04-25
IOS端修复支持成功之后App闪退问题
## 1.0.22025-03-25
* Android端修复打包冲突问题
## 1.0.12025-03-11
* 代码优化修复bug
## 1.0.02025-01-10
* 第一版发布,同时支持`Android``IOS``HarmonyOS`三端
* 云闪付SDK版本`Androidv3.5.15``IOSv3.6.0``HarmonyOSv3.1.0`
* 初次发布,如有问题请欢迎大家指出,会及时调整

View File

@@ -0,0 +1 @@
Îà^wïøòR<>£LËA ËœÞÂôz…aY¿@6y­»Ióµ¡î?¿mpDqÚ%ÃCc)“­ô²/CÓl7vʲ$ùi|ËꄟQuXsõœä}˜ÌâPíó-q:Ù.?hZ™ZcÃÄdXgµ>ñåøpþR5dÖQß躵 Þœ£­<C2A3>[×üDð

View File

@@ -0,0 +1,132 @@
{
"id": "liyahong-unionpay",
"displayName": "【Android+IOS+harmonyOS】银联云闪付支付",
"version": "1.1.2",
"description": "银联云闪付支付UTS插件全方位支持Android/IOS/harmonyOS支持自定义支付",
"keywords": [
"云闪付",
"云闪付支付",
"银联",
"银联支付",
"支付"
],
"repository": "",
"engines": {
"HBuilderX": "^3.6.8",
"uni-app": "^4.36",
"uni-app-x": "^4.36"
},
"dcloudext": {
"type": "uts",
"sale": {
"regular": {
"price": "89.90"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": "1299259684"
},
"declaration": {
"ads": "无",
"data": "插件使用的云闪付支付SDK会采集数据详情可参考https://wallet.95516.com/s/wl/WebAPP/helpAgree/page/agreement/regPrivacy.html",
"permissions": "安卓访问如下权限: <uses-permission android:name=\"android.permission.INTERNET\" /> <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /> <uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />"
},
"npmurl": "",
"darkmode": "√",
"i18n": "√",
"widescreen": "√"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "√",
"aliyun": "√",
"alipay": "√"
},
"client": {
"uni-app": {
"vue": {
"vue2": {
"extVersion": "1.0.0",
"minVersion": ""
},
"vue3": {
"extVersion": "1.0.0",
"minVersion": ""
}
},
"web": {
"safari": "x",
"chrome": "x"
},
"app": {
"vue": {
"extVersion": "1.0.0",
"minVersion": ""
},
"nvue": {
"extVersion": "1.0.0",
"minVersion": ""
},
"android": {
"extVersion": "1.0.0",
"minVersion": "21"
},
"ios": {
"extVersion": "1.0.0",
"minVersion": "12"
},
"harmony": {
"extVersion": "1.0.0",
"minVersion": "12"
}
},
"mp": {
"weixin": "x",
"alipay": "x",
"toutiao": "x",
"baidu": "x",
"kuaishou": "x",
"jd": "x",
"harmony": "x",
"qq": "x",
"lark": "x",
"xhs": "x"
},
"quickapp": {
"huawei": "x",
"union": "x"
}
},
"uni-app-x": {
"web": {
"safari": "x",
"chrome": "x"
},
"app": {
"android": {
"extVersion": "1.0.0",
"minVersion": "21"
},
"ios": {
"extVersion": "1.0.0",
"minVersion": "12"
},
"harmony": {
"extVersion": "1.0.0",
"minVersion": "12"
}
},
"mp": {
"weixin": "x"
}
}
}
}
}
}

View File

@@ -0,0 +1,260 @@
##插件功能概述
* 支持拉起云闪付并完成支付
* 支持检查是否安装云闪付
* 支持获取已安装的云闪付直通App列表
* 支持配置各个直通银行及手机支付(如小米支付、华为支付等)
* 支持Android/IOS/harmonyOS三端`本插件为原生SDK仅支持App端`
* 待完善功能。。。
##插件接入文档
### 关于更新
有空闲时间会不断更新维护,有问题随便提,有时间一定会修改!
### 特别推荐
其他插件请参考主页如人脸采集、百度OCR等深受广大用户青睐可以一试
* 作者主页:[https://ext.dcloud.net.cn/publisher?id=214114](https://ext.dcloud.net.cn/publisher?id=214114)
### 鸿蒙特殊说明`重要授权说明`
* uni-app项目: 由于官方目前不支持`试用以及普通授权`,建议`新建uni-appx项目`引用插件测通后购买源码授权使用
* uni-appx项目: 可直接使用
###准备工作
1. Android、ios、harmonyOS端证书准备工作
* 1) Android端准备应用的Android打包文件.jks文件。(`如使用官方证书忽略`)参考:[https://ask.dcloud.net.cn/article/35777](https://ask.dcloud.net.cn/article/35777)
* 2) IOS端这里只简单介绍一下windows系统下如何创建ios证书如果你是mac系统直接百度搜索就行网上一堆教程windows证书申请教程参考[https://www.pianshen.com/article/59121497532/](https://www.pianshen.com/article/59121497532/)
* 3) harmonyOS端usb连接真机 ---> 运行 ---> 运行手机或模拟器 ---> 运行到鸿蒙 ---> 配置证书(可以自动生成) ---> 运行
###接入步骤
#### 最简单的接入步骤基本10分钟搞定
* step1插件页右边有个`试用`的按钮,点它,然后弹出来一个模态框,选择`试用的项目`,点击`确认`按钮,点击`继续导入HBuilderX`
* step2将demo里面`index.vue`文件里面的函数方法复制过来
* step3打开你项目的`manifest.json`文件,找到`安卓/iOS常用其他设置`,找到`IOS设置` ---> `UrlSchemes`,将`uppaylyhuts`填写进去。如果你本来就有(比如你原来有XXX)则是:`XXX,uppaylyhuts`
* step4同上`安卓/iOS常用其他设置`中找到`IOS设置` ---> `应用访问白名单`,将`uppaywallet,uppaysdk,uppayx1,uppayx2,uppayx3,paesuperbank,ccbmbsylunionpay,bocom,bankabc,cmbmobilebank,cmblife,com.icbc.iphoneclient,spdbbank,spdbcccUnionPay,citicbankpay,credit,uppayxingyecredit,uppayhuaxiacredit,uppaybeijingcredit,uppayzhonghangcredit,uppayguangdacredit,uppaygonghangcredit,uppayjianhangcredit,uppayjiaohangcredit,uppayguangfa,psbccashier,uppayyouchucredit,com.cebbank.ebank,BankOfShangHai,boscgdlf,citicbankdkkj,cmbc,cibmb,bocmbankpsn,bankofbjpay,uppaynonghangcredit,uppayhuaxia,zytuppay,LZYHSJYHAUTHSSOAPP,bnbpay,dlrcb,czbank,uppayCbhb`填写进去
* step5Android/IOS打自定义基座包然后选择以自定义基座包运行
* step6harmonyOS执行完成准备工作`moudle.json5文件拷贝至harmony-configs -> entry -> src -> main目录下`
* step6.1`module.json5`路径:`unpackage -> dist -> dev -> app-harmony -> entry -> src -> main`
* step6.2:修改`module.json5`文件,新增以下代码
```javascript
"module": {
...
"pages": "$profile:main_pages",
"querySchemes": [
"uppaywallet",
"uppaysdk",
],
"abilities": [
{
...
"skills": [
{
...
"uris": [
{
"scheme": "uppaylyhuts",
}
]
}
]
}
]
}
```
* step7运行项目
#### 详细接入步骤及其他细则
1. 使用插件
* 1) 插件方法说明HX其实都有提示再赘述一遍吧别嫌我啰嗦哈
+ checkWalletInstalled() 检查是否安装云闪付App返回true或者false
+ startPay(object) 拉起云闪付app并发起支付具体说明见下
+ getDirectApps(function) 检查已安装的支持直通模式的银行app列表。`用途是在服务端生成tn时保留域传入"supportBank": "银行标识"``感谢用户cha***@126.com的修正`
---
> `startPay`方法说明
>
> 参数说明入参为object
>
> | 属性 | 类型 | 默认值 | 必填 | 说明 |
> | ------------ | ------------ | ------------ | ------------ | ------------ |
> |mode | string | 无 | 是 | 银联环境可选项00/0100正式环境01测试环境 |
> |tn | string | 无 | 是 | 服务端返回的交易流水号即tn |
> |seType | string | 无 | 否 | `【IOS无效】`手机pay支付类别传入会展示对应的手机支付华为支付就传04具体说明见`seType说明表` |
> |callback | function | 无 | 是 | 支付结果回调,回参为`object`,属性见`返回值说明` |
>
> 返回值说明
>
> | 属性 | 返回值说明 |
> | ------------ | ------------ |
> |code | 【必填】状态码0支付成功、1前台支付成功存在不确定性需要后端查询订单实际支付结果(基于data中的签名判断)、-1支付失败、-2支付取消 |
> |msg | 【必填】提示信息 |
> |data | 【选填】支付签名信息,只有`code=1`的时候返回 |
---
> `getDirectApps`方法说明
>
> 参数说明入参为function函数回参为`object`,属性见`返回值说明`
>
> 返回值说明
>
> | 属性 | 返回值说明 |
> | ------------ | ------------ |
> |code | 【必填】状态码。0请求成功、1请求失败(会将银联的错误code和错误msg都返回在data中组成一个对象) |
> |msg | 【必填】提示信息 |
> |data | 【必填】响应结果。code=0时为Array<string>对象,其中的值代表`直通银行标识`,详见`直通银行标识对照表`、code=1是为object对象是银联的错误对象 |
2. seType说明表`注意seType是string类型不是number`
| 手机品牌 | seType |
| ------------ | ------------ |
| Samsung Pay | 02 |
| Huawei Pay | 04 |
| Meizu Pay | 27 |
| Le Pay | 30 |
| Mi Pay | 25 |
| OPPO Pay | 29 |
| vivo Pay | 33 |
| Smartisan Pay | 32 |
| realme Pay | 35 |
3. 代码示例
```javascript
// uniapp项目引入方式
import { checkWalletInstalled, getDirectApps, startPay } from '../../uni_modules/liyahong-unionpay'
// uniappx项目引用方式注意uniappx项目必须使用@符号的方式引用,否则会报路径找不到的问题)
import { checkWalletInstalled, getDirectApps, startPay } from '@/uni_modules/liyahong-unionpay'
/**
* 检查是否安装云闪付App
*/
checkInstalled() {
const result = checkWalletInstalled()
this.installResult = `是否安装云闪付:${result}`
},
/**
* 【鸿蒙不支持此功能】获取直通银行App列表
*/
getBankAppList() {
getDirectApps((result) => {
console.log(JSON.stringify(result))
})
},
/**
* 拉起云闪付进行支付
*/
startPay() {
startPay({
tn: '',
mode: '00',
callback: (result) => {
console.log(JSON.stringify(result))
}
})
}
```
4. 直通银行标识对照表`服务端生成tn时使用举例supportBank:CQP`
| 银行标识 | 银行 APP 名称 |
| ------------ | ------------ |
| CQP | 云闪付 |
| CMBCC | 全民生活 |
| PAB | 平安口袋银行 |
| CCB | 中国建设银行 |
| BoCom | 交通银行 |
| ABC | 中国农业银行 |
| CMB | 招商银行 |
| CMBLIFE | 掌上生活 |
| ICBC | 中国工商银行 |
| SPDB | 浦发银行 |
| SPDBC | 浦大喜奔 |
| CNCB | 中信银行手机银行 |
| GDBC | 发现精彩 |
| CIBC | 兴业生活(好兴动) |
| HXBC | 华彩生活 |
| BCCBC | 掌上京彩 |
| BOCC | 中国银行缤纷生活 |
| CEBC | 阳光惠生活 |
| ICBCC | 工银 e 生活 |
| CCBC | 建行生活 |
| BoComC | 买单吧 |
| GDB | 广发银行手机银行 |
| PSBC | 邮储银行 |
| PSBCC | 邮储信用卡 |
| CEB | 光大银行手机银行 |
| BOS | 上海银行手机银行 |
| SHBANK | 上银美好生活 |
| CNCBC | 动卡空间 |
| CMBC | 民生银行手机银行 |
| CIB | 兴业银行手机银行 |
| BOC | 中国银行 |
| BCCB | 京彩生活 |
| ABCC | 农银 e 管家 |
| HXB | 华夏手机银行 |
5. iOS访问白名单对照表
| 支付 APP scheme | 对应支付 APP |
| ------------ | ------------ |
| uppaysdk | 云闪付 APP |
| uppaywallet | 云闪付 APP |
| uppayx1 | 全民生活 |
| uppayx2 | 预留 |
| uppayx3 | 预留 |
| paesuperbank | 平安口袋银行 |
| ccbmbsylunionpay | 中国建设银行 |
| bocom | 交通银行 |
| bankabc | 中国农业银行 |
| cmbmobilebank | 招商银行 |
| cmblife | 掌上生活 |
| com.icbc.iphoneclient | 中国工商银行 |
| spdbbank | 浦发银行 |
| spdbcccUnionPay | 浦大喜奔 |
| citicbankpay | 中信银行手机银行 |
| credit | 发现精彩 |
| uppayxingyecredit | 兴业生活(好兴动) |
| uppayhuaxiacredit | 华彩生活 |
| uppaybeijingcredit | 掌上京彩 |
| uppayzhonghangcredit | 中国银行缤纷生活 |
| uppayguangdacredit | 阳光惠生活 |
| uppaygonghangcredit | 工银 e 生活 |
| uppayjianhangcredit | 建行生活 |
| uppayjiaohangcredit | 买单吧 |
| uppayguangfa | 广发银行手机银行 |
| psbccashier | 邮储银行 |
| uppayyouchucredit | 邮储信用卡 |
| com.cebbank.ebank | 光大银行手机银行 |
| BankOfShangHai | 上海银行手机银行 |
| boscgdlf | 上银美好生活 |
| citicbankdkkj | 动卡空间 |
| cmbc | 民生银行手机银行 |
| cibmb | 兴业银行手机银行 |
| bocmbankpsn | 中国银行 |
| bankofbjpay | 京彩生活 |
| uppaynonghangcredit | 农银 e 管家 |
| uppayhuaxia | 华夏手机银行 |
| zytuppay | 中银通 |
| LZYHSJYHAUTHSSOAPP | 兰州银行 |
| bnbpay | 宁波银行 |
| dlrcb | 大连农商行 |
| czbank | 浙商银行 |
| uppayCbhb | 渤海银行 |
6. 其他附属
* 1) 银联测试卡链接:[测试卡直达](https://open.unionpay.com/tjweb/support/faq/mchlist?id=4)
* 2) 商户需按照以下链接及表格内容配置 IP 及地址白名单。[配置服务端白名单链接直达](https://open.unionpay.com/tjweb/support/faq/mchlist?id=228)
| 测试 | 生产 |
| ------------ | ------------ |
| https://appcashier.test.cup.com.cn | https://conf.cup.com.cn |
| https://appcashier.test.95516.com | https://conf.95516.com |
| | https://acpstatic.cup.com.cn |
| | https://acpstatic.95516.com |
| | https://appcashier.95516.com |
* 3) Apple Pay需要自行接入接入参考[链接直达](https://open.unionpay.com/tjweb/support/faq/mchlist?id=741)
* 4) 其他问题请参见 [https://open.unionpay.com](https://open.unionpay.com) 帮助中心-FAQ
7. 已知问题
* Q频繁调用`getDirectApps``startPay`函数会导致callback回调触发多次`感谢用户:[爱心]GLL`
* A多页面可以通过页面路径来判断是否是当前页面触发如果是再执行下一步操作否则拦截

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.liyahong.unionpay"
>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc.hce"/>
<uses-permission android:name="org.simalliance.openmobileapi.SMARTCARD" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<application>
<uses-library android:name="org.simalliance.openmobileapi" android:required="false"/>
<activity
android:name="com.unionpay.UPPayWapActivity"
android:configChanges="orientation|keyboardHidden|fontScale"
android:screenOrientation="portrait"
android:exported="false"
android:windowSoftInputMode="adjustResize" />
</application>
</manifest>

View File

@@ -0,0 +1,3 @@
{
"minSdkVersion": "21"
}

View File

@@ -0,0 +1,5 @@
{
"dependencies":{
"libuppayment": "./libs/libuppayment.har"
}
}

View File

@@ -0,0 +1,75 @@
//
// PaymentControl.h
// PaymentControl
//
// Created by qcao on 15/10/20.
// Copyright © 2015年 China Unionpay Co.,Ltd. All rights reserved.
// v3.6.3 build1(mini)
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef void (^UPPaymentResultBlock)(NSString* code, NSDictionary* data);
typedef void (^UPPaymentDirectAppSucc)(NSArray* directApps);
typedef void (^UPPaymentDirectAppFail)(NSString* code,NSString* msg);
@interface UPPaymentControl : NSObject
/**
* 创建支付单例服务
*
* @return 返回单例对象
*/
+ (UPPaymentControl *)defaultControl;
/**
* 支付接口
*
* @param tn 订单信息
* @param schemeStr 调用支付的app注册在info.plist中的scheme
* @param mode 支付环境
* @param viewController 启动支付控件的viewController
* @return 返回成功失败
*/
- (BOOL)startPay:(NSString*)tn
fromScheme:(NSString *)schemeStr
mode:(NSString*)mode
viewController:(UIViewController*)viewController;
/// APP是否已安装检测接口通过该接口得知用户是否安装银联支付的APP。
/// @param mode 支付环境
/// @param merchantInfo 商户标识
- (BOOL)isPaymentAppInstalled:(NSString*)mode withMerchantInfo:(NSString *)merchantInfo;
/**
* 接口非线程安全通过主线程回调异步返回直通可用app列表
* @param mode 支付环境
* @param merchantInfo 商户标识
* @param succBlock 主线程成功回调回调参数directApps表示直通可用app列表如无可用App则directApps为空数组@[]
* @param succBlock 主线程成功回调回调参数一code表示错误码参数错误 : 01网络错误 : 02其它 : 03
* 回调参数二msg表示错误信息参数错误 : parameter error网络错误 : network error其它 : unknown error
*/
- (void)getDirectApps:(NSString*)mode
withMerchantInfo:(NSString*)merchantInfo
succBlock:(UPPaymentDirectAppSucc)succBlock
failBlock:(UPPaymentDirectAppFail)failBlock;
/**
* 处理钱包或者独立快捷app支付跳回商户app携带的支付结果Url
*
* @param url 支付结果url传入后由SDK解析
* @param completionBlock 结果回调保证跳转钱包支付过程中即使调用方app被系统kill时能通过这个回调取到支付结果。
*/
- (void)handlePaymentResult:(NSURL*)url completeBlock:(UPPaymentResultBlock)completionBlock;
@end

View File

@@ -0,0 +1,19 @@
//
// UPPaymentControlMini.h
// UPPaymentControlMini
//
// Created by jianchen on 2024/3/21.
// Copyright © 2024 China Unionpay Co.,Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UPPaymentControlMini/UPPaymentControl.h>
//! Project version number for UPPaymentControlMini.
FOUNDATION_EXPORT double UPPaymentControlMiniVersionNumber;
//! Project version string for UPPaymentControlMini.
FOUNDATION_EXPORT const unsigned char UPPaymentControlMiniVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <UPPaymentControlMini/PublicHeader.h>

View File

@@ -0,0 +1,6 @@
framework module UPPaymentControlMini {
umbrella header "UPPaymentControlMini.h"
export *
module * { export * }
}

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>1C8F.1</string>
<string>CA92.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Headers/UPPaymentControl.h</key>
<data>
lUIYX/vWkeiAf8yN5e76vTBXzm4=
</data>
<key>Headers/UPPaymentControlMini.h</key>
<data>
vet6Fb0UERMco/wGncRFVXS8TXQ=
</data>
<key>Info.plist</key>
<data>
DJf/0h9lOKhmpP6EWhqv2Gr9Tyk=
</data>
<key>Modules/module.modulemap</key>
<data>
Sh7SIRMAu2cPHe58dK3I34oDN9w=
</data>
<key>PaymentControlPrivacy.bundle/PrivacyInfo.xcprivacy</key>
<data>
0OHpv8paT+zhCRgwkm8W01cB2I0=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/UPPaymentControl.h</key>
<dict>
<key>hash</key>
<data>
lUIYX/vWkeiAf8yN5e76vTBXzm4=
</data>
<key>hash2</key>
<data>
mLUdwyl5s6nFTrRvWFLorErec/OiYl+oFc3rvt+5VfQ=
</data>
</dict>
<key>Headers/UPPaymentControlMini.h</key>
<dict>
<key>hash</key>
<data>
vet6Fb0UERMco/wGncRFVXS8TXQ=
</data>
<key>hash2</key>
<data>
MXfiWTa0rtbqZoTW8jF9ZBdd4RAwXaZGPEnvx8QFDVc=
</data>
</dict>
<key>Modules/module.modulemap</key>
<dict>
<key>hash</key>
<data>
Sh7SIRMAu2cPHe58dK3I34oDN9w=
</data>
<key>hash2</key>
<data>
qjfQ26DcOeeqGITBWz4flSg5RUaRECAcHha+Rc0o26w=
</data>
</dict>
<key>PaymentControlPrivacy.bundle/PrivacyInfo.xcprivacy</key>
<dict>
<key>hash</key>
<data>
0OHpv8paT+zhCRgwkm8W01cB2I0=
</data>
<key>hash2</key>
<data>
trLG3kFk3BQb4Gg32fmJfZUhCnOO9gKdSuoR/XPSnC0=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>uppaysdk</string>
<string>uppaywallet</string>
<string>uppayx1</string>
<string>uppayx2</string>
<string>uppayx3</string>
<string>paesuperbank</string>
<string>ccbmbsylunionpay</string>
<string>bocom</string>
<string>bankabc</string>
<string>cmbmobilebank</string>
<string>cmblife</string>
<string>com.icbc.iphoneclient</string>
<string>spdbbank</string>
<string>spdbcccUnionPay</string>
<string>citicbankpay</string>
<string>credit</string>
<string>uppayxingyecredit</string>
<string>uppayhuaxiacredit</string>
<string>uppaybeijingcredit</string>
<string>uppayzhonghangcredit</string>
<string>uppayguangdacredit</string>
<string>uppaygonghangcredit</string>
<string>uppayjianhangcredit</string>
<string>uppayjiaohangcredit</string>
<string>uppayguangfa</string>
<string>psbccashier</string>
<string>uppayyouchucredit</string>
<string>com.cebbank.ebank</string>
<string>BankOfShangHai</string>
<string>boscgdlf</string>
<string>citicbankdkkj</string>
<string>cmbc</string>
<string>cibmb</string>
<string>bocmbankpsn</string>
<string>bankofbjpay</string>
<string>uppaynonghangcredit</string>
<string>uppayhuaxia</string>
<string>zytuppay</string>
<string>LZYHSJYHAUTHSSOAPP</string>
<string>bnbpay</string>
<string>dlrcb</string>
<string>czbank</string>
<string>uppayCbhb</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,12 @@
{
"deploymentTarget": "11",
"validArchitectures": [ // 可选,支持的 CPU 架构类型 默认arm64
"arm64"
],
"frameworks": [ // 可选,依赖的系统库(系统库有.framework和.tbd和.dylib类型)
"SystemConfiguration.framework",
"libz.tbd",
"LocalAuthentication.framework",
"libc++.tbd"
]
}

View File

@@ -0,0 +1,39 @@
/**
* uts插件接口定义文件按规范定义接口文件可以在HBuilderX中更好的做到语法提示
*/
type modeType = '00' | '01'
export type startPayOptions = {
/**
* 银联环境00正式环境01测试环境
*/
mode: modeType,
/**
* 服务端返回的交易流水号即tn
*/
tn: string,
/**
* 【可选】【IOS无效】手机pay支付类别传入会展示对应的手机支付华为支付
*/
seType?: string,
/**
* 支付结果回调
*/
callback: (result: any) => void
}
/**
* 检查是否安装云闪付App
*/
export type checkWalletInstalled = () => boolean
/**
* 拉起云闪付app并发起支付
*/
export type startPay = (options: startPayOptions) => void
/**
* 检查已安装的支持直通模式的银行app列表
* 用途是在服务端生成tn时保留域传入"ebankEnAbbr" : "银行标识"
*/
export type getDirectApps = (callback: Function) => void

View File

@@ -0,0 +1,33 @@
{
"id": "unionpay-full",
"displayName": "银联商务支付(正式版)",
"version": "1.0.0",
"description": "银联商务UMS支付UTS插件支持云闪付/微信/支付宝正式版SDK",
"keywords": [
"银联商务",
"UMS",
"云闪付",
"支付"
],
"engines": {
"HBuilderX": "^3.6.8",
"uni-app": "^4.36"
},
"uni_modules": {
"dependencies": [],
"platforms": {
"client": {
"uni-app": {
"app": {
"android": {
"minVersion": "21"
},
"ios": {
"minVersion": "11"
}
}
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unionpay.full">
<!-- 基础网络权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- UMS SDK 需要的 meta-data -->
<application>
<meta-data
android:name="PPPaySDK"
android:value="true" />
</application>
</manifest>

View File

@@ -0,0 +1,3 @@
{
"minSdkVersion": "21"
}

View File

@@ -0,0 +1,90 @@
import { startPayOptions } from '../../interface.uts'
// UMS SDK 核心类包名
const UMS_PKG = 'com.chinaums.pppay.unify'
/**
* 检查是否安装云闪付App
* 【注】UMS SDK 未提供安装检测接口,默认返回 true
*/
export function checkWalletInstalled(): boolean {
return true
}
/**
* 发起支付(云闪付)
* 调用 UMS SDK 的 UnifyPayPlugin 进行支付
*/
export function startPay(options: startPayOptions): void {
try {
const activity = UTSAndroid.getUniActivity()
if (activity == null) {
options.callback({ code: -1, msg: '获取当前 Activity 失败' })
return
}
// 动态导入 UMS SDK 类
const UnifyPayPlugin = plus.android.importClass(UMS_PKG + '.UnifyPayPlugin')
const UnifyPayListener = plus.android.importClass(UMS_PKG + '.UnifyPayListener')
// payData后端返回的 appPayRequest 对应的 JSON 字符串
// 如果后端返回的 tn 字段已经是 JSON 格式,直接传入即可
const payData = options.tn
// 创建支付结果监听器
const listener = new UnifyPayListener({
onResult: (resultCode: string, resultInfo: string) => {
console.log('UMS 支付结果:', resultCode, resultInfo)
let code = -1
let msg = resultInfo || '支付失败'
if (resultCode === '0000' || resultCode === '0') {
code = 0
msg = '支付成功'
} else if (resultCode === '-2' || resultCode === '2000' || resultCode === '2001') {
code = -2
msg = '支付已取消'
} else if (resultCode === '1') {
code = 1
msg = '支付处理中'
}
options.callback({
code: code,
msg: msg,
data: { resultCode: resultCode, resultInfo: resultInfo }
})
}
})
// 根据支付渠道调用不同方法
const channel = options.channel || 'unionpay'
if (channel === 'unionpay') {
// 云闪付
UnifyPayPlugin.cloudPay(activity, 'uppayfull', payData, listener)
} else if (channel === 'alipay') {
// 支付宝间联支付
// 如果 aliSafePay 方法不存在,请尝试改用 pay 方法:
// UnifyPayPlugin.pay(activity, 'ALIPAY', payData, listener)
UnifyPayPlugin.aliSafePay(activity, 'uppayfull', payData, listener)
} else if (channel === 'weixin') {
// 微信支付需申请微信SDK后才能使用
// UnifyPayPlugin.pay(activity, 'WEIXIN', payData, listener)
options.callback({ code: -1, msg: '微信支付暂不支持请先申请微信SDK' })
} else {
options.callback({ code: -1, msg: '未知支付渠道: ' + channel })
}
} catch (e) {
console.error('UMS 支付调用异常:', e)
options.callback({ code: -1, msg: '支付调用异常: ' + (e.message || String(e)) })
}
}
/**
* 获取直通银行 App 列表
* 【注】UMS SDK 暂未实现此功能
*/
export function getDirectApps(callback: Function): void {
callback({ code: 0, msg: 'UMS SDK 暂不支持此功能', data: [] })
}

View File

@@ -0,0 +1,59 @@
//
// UMSPluginSettings.h
// UMSPosPay
//
// Created by chinaums on 15/10/19.
// Copyright © 2015年 ChinaUMS. All rights reserved.
//
// sdk_version = 3.1.8
#import <Foundation/Foundation.h>
//1 是走apple 0是不走
//#define SHOULD_CONTAIN_APPLE_PAY_CODES 0
/*!
@enum
@abstract 交易环境
@constant UMSP_PROD 生产环境
@constant UMSP_TEST 测试环境
*/
typedef NS_ENUM(NSInteger, UMSPluginEnvironment) {
UMSP_PROD,
UMSP_TEST
};
/**
* 进入插件的方式
*/
typedef NS_ENUM(NSInteger, UMSPluginEnterType) {
///默认方式
UMSPluginEnterType_Default,
///C扫B方式
UMSPluginEnterType_ScanCode
};
@interface UMSPPPayPluginSettings : NSObject
+ (UMSPPPayPluginSettings *)sharedInstance;
/*!
@property
@abstract 设置交易环境默认UMSP_PROD
*/
@property (nonatomic, assign) UMSPluginEnvironment umspEnviroment;
/**
* 进入插件方式默认UMSPluginEnterType_Default
*/
@property (nonatomic, assign) UMSPluginEnterType umspEnterType;
/*!
@property
@abstract 设置是否需要启动页默认YES
*/
@property (nonatomic, assign) BOOL umspSplash;
@end

View File

@@ -0,0 +1,118 @@
//
// UMSPPPayUnifyPayPlugin.h
// UMSPosPay
//
// Created by SunXP on 17/4/25.
// Copyright © 2017年 ChinaUMS. All rights reserved.
//
// sdk_version = 3.1.8
#import <Foundation/Foundation.h>
#import "WXApi.h"
/**
* 支付渠道
*
* @param CHANNEL_WEIXIN 微信支付
* @param CHANNEL_ALIPAY 支付宝支付
* @param CHANNEL_ALIMINIPAY 支付宝小程序支付
* @param CHANNEL_WEIXINMINI 微信小程序支付
*/
FOUNDATION_EXTERN NSString *const CHANNEL_WEIXIN;
FOUNDATION_EXTERN NSString *const CHANNEL_ALIPAY;
FOUNDATION_EXTERN NSString *const CHANNEL_ALIMINIPAY;
FOUNDATION_EXTERN NSString *const CHANNEL_WEIXINMINI;
typedef void(^TransactionResultBlock)(NSString *resultCode, NSString *resultInfo);
@interface UMSPPPayUnifyPayPlugin : NSObject
/**
* 商户下单支付接口
*
* @param payChannel 支付渠道
* @param payData 订单信息:appPayRequest对应的json字符串
* @param callbackBlock 交易结果回调Block
*/
+ (void)payWithPayChannel:(NSString *)payChannel payData:(NSString *)payData callbackBlock:(TransactionResultBlock)callbackBlock;
/**
云闪付下单接口
@param schemes url schemes
@param payData 订单信息:appPayRequest对应的json字符串
@param viewController 启动支付控件的viewController
@param callbackBlock 交易结果回调Block
*/
+ (void)cloudPayWithURLSchemes:(NSString *)schemes
payData:(NSString *)payData
viewController:(UIViewController *)viewController
callbackBlock:(TransactionResultBlock)callbackBlock;
/**
支付宝的间联原生app支付
@param schemes url schemes
@param payData 订单信息:appPayRequest对应的json字符串
@param callbackBlock 交易结果回调Block
*/
+ (void)aliSafePayWithURLSchemes:(NSString *)schemes
payData:(NSString *)payData
callbackBlock:(TransactionResultBlock)callbackBlock;
/**
* 微信支付配置参数
*
* @param appId 商户注册的微信支付appId
* @param universalLink 微信开发者Universal Link
* @return YES成功 NO失败
* 需在AppDelegate的didFinishLaunchingWithOptions方法中调用
*/
+ (BOOL)registerApp:(NSString *)appId universalLink:(NSString *)universalLink;
/**
* 微信支付配置参数
*
* @param url App处理的openUrl
* @param otherDelegate WXApiDelegate对象用来接收微信触发的非本功能的消息。
* @return YES成功 NO失败
* 需在AppDelegate中的方法中调用
* iOS9.0之前版本:- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
* - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
* iOS9.0之后版本:- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options
*/
+ (BOOL)handleOpenURL:(NSURL *)url otherDelegate:(id<WXApiDelegate>)otherDelegate;
/*! @brief 处理微信通过Universal Link启动App时传递的数据
*
* 需要在 application:continueUserActivity:restorationHandler:中调用。
* @param userActivity 微信启动第三方应用时系统API传递过来的userActivity
* @param otherDelegate WXApiDelegate对象用来接收微信触发的非本功能的消息。
* 需在AppDelegate中的方法中调用
需要在 application:continueUserActivity:restorationHandler:中调用。
* @return 成功返回YES失败返回NO。
*/
+(BOOL)handleOpenUniversalLink:(NSUserActivity *)userActivity otherDelegate:(id<WXApiDelegate>)otherDelegate API_AVAILABLE(ios(8.0));
/**
云闪付处理
@param url App处理的openUrl
@return YES成功 NO失败
*/
+ (BOOL)cloudPayHandleOpenURL:(NSURL *)url;
/**
支付宝小程序处理
@param url App处理的openUrl
*/
+ (void)aliMiniPayHandleOpenURL:(NSURL *)url;
/**
支付宝间联原生app支付处理
@param url App处理的openUrl
*/
+ (void)aliSafePayHandleOpenURL:(NSURL *)url;
@end

View File

@@ -0,0 +1,17 @@
//
// libUMSVersionsInfo.h
// UMSPosPay
//
// Created by diudiu on 16/6/28.
// Copyright © 2016年 ChinaUMS. All rights reserved.
//
// sdk_version = 3.1.8
#import <Foundation/Foundation.h>
@interface UMSPPPayVersionsInfo : NSObject
+ (NSMutableDictionary *)getVersionsInfoForPosPayPlugin;
@end

View File

@@ -0,0 +1,13 @@
{
"deploymentTarget": "11",
"validArchitectures": [
"arm64"
],
"frameworks": [
"SystemConfiguration.framework",
"libz.tbd",
"LocalAuthentication.framework",
"libc++.tbd",
"CFNetwork.framework"
]
}

View File

@@ -0,0 +1,96 @@
import { startPayOptions } from '../../interface.uts'
/**
* 检查是否安装云闪付App
* 通过 canOpenURL 检测云闪付 scheme
*/
export function checkWalletInstalled(): boolean {
try {
const UIApplication = plus.ios.importClass('UIApplication')
const app = UIApplication.sharedApplication()
const url = plus.ios.importClass('NSURL')!.URLWithString('uppaywallet://')
return app.canOpenURL(url)
} catch (e) {
console.log('检测云闪付安装状态失败:', e)
return true
}
}
/**
* 发起支付(云闪付)
* 调用 UMS SDK 的 UMSPPPayUnifyPayPlugin 进行支付
*/
export function startPay(options: startPayOptions): void {
try {
const UMSPPPayUnifyPayPlugin = plus.ios.importClass('UMSPPPayUnifyPayPlugin')
if (UMSPPPayUnifyPayPlugin == null) {
options.callback({ code: -1, msg: 'UMS 支付插件加载失败' })
return
}
const viewController = UTSiOS.getCurrentViewController()
if (viewController == null) {
options.callback({ code: -1, msg: '获取当前视图控制器失败' })
return
}
// payData后端返回的 appPayRequest 对应的 JSON 字符串
const payData = options.tn
const channel = options.channel || 'unionpay'
// 统一结果处理 block
const resultBlock = (resultCode: string, resultInfo: string) => {
console.log('UMS iOS 支付结果:', resultCode, resultInfo)
let code = -1
let msg = resultInfo || '支付失败'
if (resultCode === '0000' || resultCode === '0') {
code = 0
msg = '支付成功'
} else if (resultCode === '-2' || resultCode === '2000' || resultCode === '2001') {
code = -2
msg = '支付已取消'
} else if (resultCode === '1') {
code = 1
msg = '支付处理中'
}
options.callback({
code: code,
msg: msg,
data: { resultCode: resultCode, resultInfo: resultInfo }
})
}
// 根据支付渠道调用不同方法
if (channel === 'unionpay') {
// 云闪付
UMSPPPayUnifyPayPlugin.cloudPayWithURLSchemes_payData_viewController_callbackBlock(
'uppayfull', payData, viewController, resultBlock
)
} else if (channel === 'alipay') {
// 支付宝间联支付
UMSPPPayUnifyPayPlugin.aliSafePayWithURLSchemes_payData_callbackBlock(
'uppayfull', payData, resultBlock
)
} else if (channel === 'weixin') {
// 微信支付需申请微信SDK后才能使用
// UMSPPPayUnifyPayPlugin.payWithPayChannel_payData_callbackBlock('CHANNEL_WEIXIN', payData, resultBlock)
options.callback({ code: -1, msg: '微信支付暂不支持请先申请微信SDK' })
} else {
options.callback({ code: -1, msg: '未知支付渠道: ' + channel })
}
} catch (e) {
console.error('UMS iOS 支付调用异常:', e)
options.callback({ code: -1, msg: '支付调用异常: ' + (e.message || String(e)) })
}
}
/**
* 获取直通银行 App 列表
* 【注】UMS SDK 暂未实现此功能
*/
export function getDirectApps(callback: Function): void {
callback({ code: 0, msg: 'UMS SDK 暂不支持此功能', data: [] })
}

View File

@@ -0,0 +1,53 @@
/**
* 银联商务 UMS 支付 UTS 插件接口定义
* 适配正式版 UMS SDKAndroid: qmf-ppplugin / iOS: libUMSPosPayOnly
*/
type modeType = '00' | '01'
export type PayChannel = 'unionpay' | 'alipay' | 'weixin'
export type startPayOptions = {
/**
* 支付渠道,默认 unionpay
* unionpay: 云闪付
* alipay: 支付宝
* weixin: 微信需申请微信SDK后使用
*/
channel?: PayChannel,
/**
* 支付环境00正式环境01测试环境
* 【注】UMS SDK 内部根据 payData 中的环境字段判断,此参数保留兼容
*/
mode: modeType,
/**
* 服务端返回的支付参数
* UMS SDKappPayRequest 对应的 JSON 字符串(由后端返回)
*/
tn: string,
/**
* 【可选】手机pay支付类别保留兼容字段
*/
seType?: string,
/**
* 支付结果回调
* result.code: 0成功 / -1失败 / -2取消
* result.msg: 提示信息
*/
callback: (result: any) => void
}
/**
* 检查是否安装云闪付App
* 【注】UMS SDK 未提供安装检测接口,默认返回 true
*/
export type checkWalletInstalled = () => boolean
/**
* 发起支付
*/
export type startPay = (options: startPayOptions) => void
/**
* 检查已安装的支持直通模式的银行app列表
* 【注】UMS SDK 暂未实现此功能
*/
export type getDirectApps = (callback: Function) => void