Commit 1222607b authored by 14699's avatar 14699

'app跳转小程序微信支付'

parent 7772cabc
...@@ -4,6 +4,8 @@ VITE_DEBUG='true' ...@@ -4,6 +4,8 @@ VITE_DEBUG='true'
VITE_HTTP_HEADER={} VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='http://139.196.201.22:8080/leaf_dev' VITE_HTTP_BASE_URL='http://139.196.201.22:8080/leaf_dev'
VITE_HTTP_NOAUTH_BASE_URL='' VITE_HTTP_NOAUTH_BASE_URL=''
VITE_MiniprogramId= "gh_68a702d09b16"
VITE_MiniprogramType= "2"
VITE_Alipay='https://test-api-open.chinaums.com/v1/netpay/trade/h5-pay' VITE_Alipay='https://test-api-open.chinaums.com/v1/netpay/trade/h5-pay'
VITE_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay' VITE_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order' VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order'
...@@ -4,6 +4,8 @@ VITE_DEBUG='false' ...@@ -4,6 +4,8 @@ VITE_DEBUG='false'
VITE_HTTP_HEADER={} VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='https://kflc.komatsu-fl.com.cn/xszl_prod' VITE_HTTP_BASE_URL='https://kflc.komatsu-fl.com.cn/xszl_prod'
VITE_HTTP_NOAUTH_BASE_URL='' VITE_HTTP_NOAUTH_BASE_URL=''
VITE_MiniprogramId= "gh_68a702d09b16"
VITE_MiniprogramType= "0"
VITE_Alipay='https://api-mop.chinaums.com/v1/netpay/trade/h5-pay' VITE_Alipay='https://api-mop.chinaums.com/v1/netpay/trade/h5-pay'
VITE_Wechat='https://api-mop.chinaums.com/v1/netpay/wxpay/h5-pay' VITE_Wechat='https://api-mop.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://api-mop.chinaums.com/v1/netpay/uac/order' VITE_Unionpay='https://api-mop.chinaums.com/v1/netpay/uac/order'
NODE_ENV=test NODE_ENV=test
VITE_LOCAL='false' VITE_LOCAL='true'
VITE_DEBUG='true' VITE_DEBUG='true'
VITE_HTTP_HEADER={} VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='http://139.196.201.22:8080/leaf_dev' VITE_HTTP_BASE_URL='http://139.196.201.22:8080/leaf_dev'
VITE_HTTP_NOAUTH_BASE_URL='' VITE_HTTP_NOAUTH_BASE_URL=''
VITE_MiniprogramId= "gh_68a702d09b16"
VITE_MiniprogramType= "2"
VITE_Alipay='https://test-api-open.chinaums.com/v1/netpay/trade/h5-pay' VITE_Alipay='https://test-api-open.chinaums.com/v1/netpay/trade/h5-pay'
VITE_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay' VITE_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order' VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order'
...@@ -76,5 +76,8 @@ npm run preview 本地预览打包完的文件 ...@@ -76,5 +76,8 @@ npm run preview 本地预览打包完的文件
- 这上方网址下搜索功能 "子应用管理",找到对应的模块,新建版本,提交 zip包 ,点击确认退出 - 这上方网址下搜索功能 "子应用管理",找到对应的模块,新建版本,提交 zip包 ,点击确认退出
### 配置文件参数
miniprogramId:'' 小程序的id值
payPath:'' 小程序支付界面的路径(带支付参数)
miniprogramType:'' 小程序的版本,值分别为: 体验版传 2 , 开发版传 1, 正式版传 0
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="content"> <div class="content">
<header> <header>
<div class="header-top"> <div class="header-top">
<p class="key">融资金</p> <p class="key">租金总</p>
<p class="value">{{ currencyObj.financingCurrency }}</p> <p class="value">{{ currencyObj.financingCurrency }}</p>
<div class="times"> <div class="times">
......
...@@ -26,20 +26,20 @@ ...@@ -26,20 +26,20 @@
let repaymentMessageList = $ref([]) let repaymentMessageList = $ref([])
let repaymentMessageTotal = $ref() let repaymentMessageTotal = $ref()
const getList = async () => { const getList = async (param) => {
let res = await api.messageQuery({ let res = await api.messageQuery({...param})
readFlag: 'N'
})
if (res.success && res.rows.length > 0) { if (res.success && res.rows.length > 0) {
messageList = res.rows messageList = res.rows
messageTotal = res.total + '条新消息' messageTotal = res.total + '条新消息'
} }
}; };
getList() getList(); // 查询所有消息
getList({readFlag: 'N'}); //查询未读消息
const getRepaymentList = async () => { const getRepaymentList = async () => {
let result = await api.messageQuery({ let result = await api.messageQuery({
readFlag: 'N', // readFlag: 'N',
messageCode: "repaymentMessage" messageCode: "repaymentMessage"
}) })
if (result.success && result.rows.length > 0) { if (result.success && result.rows.length > 0) {
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
repaymentMessageTotal = result.total + '条新消息' repaymentMessageTotal = result.total + '条新消息'
} }
}; };
getRepaymentList() getRepaymentList(); // 查询还款消息
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
......
...@@ -88,29 +88,8 @@ ...@@ -88,29 +88,8 @@
@blur="show = false" @blur="show = false"
@delete="onDelete" @delete="onDelete"
/> />
<!-- <Cell title="支付方式" is-link value="内容" />-->
</div> </div>
</Popup> </Popup>
<!-- <Popup v-model:show="showDialog" position="bottom" :style="{ height: '60%', padding: '20px' }">-->
<!-- <i class="van-badge__wrapper van-icon van-icon-cross van-popup__close-icon van-popup__close-icon&#45;&#45;top-right van-haptics-feedback" role="button" tabindex="0">&lt;!&ndash;&ndash;&gt;&lt;!&ndash;&ndash;&gt;&lt;!&ndash;&ndash;&gt;</i>-->
<!-- <div>-->
<!-- <div :style="{fontWeight: '600', marginLeft: '130px'}">请输入密码</div>-->
<!-- <div :style="{marginLeft: '135px',marginTop:'10px', marginBottom: '20px'}">-->
<!-- <span :style="{fontSize: '13px'}">金额:{{orderAmount}}</span>-->
<!-- </div>-->
<!-- <PasswordInput-->
<!-- :value="password"-->
<!-- :gutter="10"-->
<!-- :focused="showKeyboard"-->
<!-- @focus="showKeyboard = true"-->
<!-- />-->
<!-- <div class="finish-pay" @click="handleFinishAmount">完成</div>-->
<!-- <NumberKeyboard-->
<!-- v-model="password"-->
<!-- :show="showKeyboard"-->
<!-- />-->
<!-- </div>-->
<!-- </Popup>-->
</template> </template>
<script setup> <script setup>
...@@ -120,7 +99,7 @@ import { pay } from '@/utils/pay'; ...@@ -120,7 +99,7 @@ import { pay } from '@/utils/pay';
import api from "../api"; import api from "../api";
import { Base } from '@hips/plugin-vue-jssdk'; import { Base } from '@hips/plugin-vue-jssdk';
const { openWebLink } = Base; const { openWebLink } = Base;
import moment from 'moment'
const props = defineProps({ const props = defineProps({
visible: { type: Boolean }, // 是否打开弹框 visible: { type: Boolean }, // 是否打开弹框
payInfoObj: { payInfoObj: {
...@@ -129,10 +108,12 @@ const props = defineProps({ ...@@ -129,10 +108,12 @@ const props = defineProps({
cashflowId: '', cashflowId: '',
payAmount: '', payAmount: '',
cfItem: '', cfItem: '',
cfItemN:'',
times: ''
} }
}, },
}) })
const emit = defineEmits(['payMoneyClick', 'closePage', 'paySuccess', 'payFail']) const emit = defineEmits(['payMoneyClick', 'closePage', 'paySuccess', 'payFail', 'wechatPayCallBack'])
// const state = reactive({ // const state = reactive({
// showDialog: true, //弹窗 // showDialog: true, //弹窗
...@@ -147,6 +128,8 @@ const password = ref([]); ...@@ -147,6 +128,8 @@ const password = ref([]);
const showKeyboard = ref(true); const showKeyboard = ref(true);
const checkArray = {UNION_PAY:'云闪付(银行卡)',WECHAT_PAY:'微信支付',ALI_PAY:'支付宝'}; const checkArray = {UNION_PAY:'云闪付(银行卡)',WECHAT_PAY:'微信支付',ALI_PAY:'支付宝'};
let isModify = ref(false); // 支付金额是否可修改 现金流项目为 罚息:9,租金:1 可修改部分支付 let isModify = ref(false); // 支付金额是否可修改 现金流项目为 罚息:9,租金:1 可修改部分支付
const miniprogramId = import.meta.env.VITE_MiniprogramId;
const miniprogramType = +import.meta.env.VITE_MiniprogramType;
watchEffect(() => { watchEffect(() => {
payAmount.value = props.payInfoObj.payAmount payAmount.value = props.payInfoObj.payAmount
...@@ -176,9 +159,22 @@ const payMoney = () => { ...@@ -176,9 +159,22 @@ const payMoney = () => {
const info = { const info = {
payAmount: orderAmount.value, payAmount: orderAmount.value,
payType: checked.value, payType: checked.value,
cashflowId: props.payInfoObj.cashflowId cashflowId: props.payInfoObj.cashflowId,
cfItemN:props.payInfoObj.cfItemN,
times: props.payInfoObj.times
} }
if(checked.value == 'UNION_PAY'){ if(checked.value == 'WECHAT_PAY'){
// let payStartTime = moment().format("YYYY-MM-DD HH:mm:ss.SSS")
// let payEndTime = moment().add(5, 'minutes').format("YYYY-MM-DD HH:mm:ss.SSS")
let payStartTime = moment().valueOf(); // 当前支付时间
let payEndTime = moment().add(5, 'minutes').valueOf(); // 支付到期时间 5分钟
let wechatParams = {...info,payStartTime,payEndTime,access_token: window.localStorage.access_token}
console.log(wechatParams)
wechatParams = encodeURIComponent(JSON.stringify(wechatParams))
console.log(wechatParams)
WXLaunchMiniProgram(wechatParams)
// Toast.fail('微信支付当前暂不支持!')
} else if(checked.value == 'UNION_PAY'){
Toast.fail('云闪付(银行卡)当前暂不支持!') Toast.fail('云闪付(银行卡)当前暂不支持!')
} else { } else {
goPayApp(info) goPayApp(info)
...@@ -242,10 +238,47 @@ const unifyPay = (paramsData) => { ...@@ -242,10 +238,47 @@ const unifyPay = (paramsData) => {
HandBridge.postMessage(JSON.stringify(params)); HandBridge.postMessage(JSON.stringify(params));
}; };
const handleFinishAmount = () => { // APP 跳转小程序微信支付
showDialog.value = false; // miniprogramId:小程序的id值
pay(); // payPath:小程序支付界面的路径(带支付参数)
} // miniprogramType: 小程序的版本,值分别为: 体验版传 2 , 开发版传 1, 正式版传 0
const WXLaunchMiniProgram = (payInfo) => {
window.onQmfSuccess = function(res){
console.log('成功' + res)
let result = res
try {
console.log('转码')
result = JSON.parse(res)
} catch (e) {
result = res
}
emit('wechatPayCallBack', result);
};
window.onQmfError = function(res) {
console.log('失败' + res)
let result = res
try {
result = JSON.parse(res)
} catch (e) {
result = res
}
emit('wechatPayCallBack', result);
};
let paramsData = {
miniprogramId:miniprogramId,
miniprogramType:miniprogramType,
payPath:"/pages/appWechatPay/index?wechatParams=" + payInfo,
}
console.log(paramsData)
let params = {
className:"UnifyPayBridge",
function:"wxMiniProgramPay",
params:paramsData,
successCallBack:"onQmfSuccess",
failCallBack:"onQmfError"
}
HandBridge.postMessage(JSON.stringify(params));
};
const getPayResult = (res) => { const getPayResult = (res) => {
let resultList = [ let resultList = [
......
...@@ -51,7 +51,7 @@ const getList = async (param) => { ...@@ -51,7 +51,7 @@ const getList = async (param) => {
...item, ...item,
title: item.contractNumber, title: item.contractNumber,
other_title: item.applyDate?.split(' ')[0], other_title: item.applyDate?.split(' ')[0],
values: [["剩余应还金额", "状态", "已支付金额(合计)"], [currency(item.residueAmount), item.contractStatusN, currency(item.receivedAmount)]] values: [["剩余应还租金", "状态", "已支付租金(合计)"], [currency(item.residueAmount), item.contractStatusN, currency(item.receivedRentAmount)]]
})) }))
}else { }else {
list = []; list = [];
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</div> </div>
</div> </div>
</div> </div>
<Pay :visible="showModal" :payInfoObj="payInfo" @paySuccess="paySuccessFunction" @payFail="payFailFunction" @closePage="handleColse"/> <Pay :visible="showModal" :payInfoObj="payInfo" @paySuccess="paySuccessFunction" @payFail="payFailFunction" @closePage="handleColse" @wechatPayCallBack="wechatPayFunction"/>
</template> </template>
<template #footer> <template #footer>
</template> </template>
...@@ -74,7 +74,13 @@ const router = useRouter(); ...@@ -74,7 +74,13 @@ const router = useRouter();
const handleClick = (item) => { const handleClick = (item) => {
// Toast.fail('当前暂不支持进行APP支付!') // Toast.fail('当前暂不支持进行APP支付!')
showModal.value = true showModal.value = true
payInfo = {cashflowId:item.cashflowId,payAmount:item.obligation,cfItem:item.cfItem} payInfo = {
cashflowId:item.cashflowId,
payAmount:item.obligation,
cfItem:item.cfItem,
cfItemN:item.cfItemN,
times: item.times
}
} }
const handleColse = (param) => { const handleColse = (param) => {
...@@ -109,6 +115,33 @@ const payFailFunction = (result) => { ...@@ -109,6 +115,33 @@ const payFailFunction = (result) => {
}) })
}; };
// 微信支付回调 小程序成功返回APP才会有回调
const wechatPayFunction = (result) => {
console.log("支付成功",result)
console.log("errCode",result.errCode)
console.log("extMsg",result.extMsg)
showModal.value = false;
let message = '支付失败!'
if(result.errCode == '0'){
let extMsg = JSON.parse(decodeURIComponent(result.extMsg))
console.log("extMsg json",extMsg)
console.log("extMsg.resultCode",extMsg.resultCode)
if(extMsg.resultCode == true){
message = '支付成功!'
console.log("支付成功",message)
} else {
message = extMsg.resultMsg
}
}
Dialog.confirm({
title: '提示',
message: message,
showCancelButton: false
}).then(() => {
getRepayPlanInfo();
})
};
const goDamagesDetail = () => { const goDamagesDetail = () => {
router.push({ name: 'makeRepayment-views-liquidatedDamagesDetails' }) router.push({ name: 'makeRepayment-views-liquidatedDamagesDetails' })
} }
...@@ -118,12 +151,12 @@ const getRepayPlanInfo = async () => { ...@@ -118,12 +151,12 @@ const getRepayPlanInfo = async () => {
if(result.success){ if(result.success){
const rows = result.rows[0]; const rows = result.rows[0];
currencyObj = { currencyObj = {
financingCurrency: currency(rows.financeAmount), financingCurrency: currency(rows.rentAmount),
headerCurrency: currency(rows.residueAmount), headerCurrency: currency(rows.residueAmount),
fristCurrency: currency(rows.receivedAmount), fristCurrency: currency(rows.receivedRentAmount),
times: rows.leaseTerm, times: rows.leaseTerm,
key1: "剩余未还金额(合计)", key1: "剩余未还租金(合计)",
key2: "已支付金额(合计)" key2: "已支付租金(合计)"
} }
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item }) rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item })
cashflow = rows.cashflow cashflow = rows.cashflow
......
...@@ -65,10 +65,12 @@ const getRepayPlanInfo = async () => { ...@@ -65,10 +65,12 @@ const getRepayPlanInfo = async () => {
if(result.success){ if(result.success){
const rows = result.rows[0]; const rows = result.rows[0];
currencyObj = { currencyObj = {
financingCurrency: currency(rows.financeAmount), financingCurrency: currency(rows.rentAmount),
headerCurrency: currency(rows.firstGold), headerCurrency: currency(rows.residueAmount),
fristCurrency: currency(rows.firstRental), fristCurrency: currency(rows.receivedRentAmount),
times: rows.leaseTerm times: rows.leaseTerm,
key1: "剩余未还租金(合计)",
key2: "已支付租金(合计)"
} }
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item }) rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item })
cashflow = rows.cashflow cashflow = rows.cashflow
......
...@@ -49,7 +49,7 @@ const getList = async (param) => { ...@@ -49,7 +49,7 @@ const getList = async (param) => {
...item, ...item,
title: item.contractNumber, title: item.contractNumber,
other_title: item.applyDate?.split(' ')[0], other_title: item.applyDate?.split(' ')[0],
values: [["剩余应还金额", "合同状态", "已支付金额(合计)"], [currency(item.residueAmount),item.contractStatusN, currency(item.receivedAmount)]] values: [["剩余应还租金", "合同状态", "已支付租金(合计)"], [currency(item.residueAmount),item.contractStatusN, currency(item.receivedRentAmount)]]
})) }))
}else { }else {
list = []; list = [];
......
...@@ -66,12 +66,12 @@ const getRepayPlanInfo = async () => { ...@@ -66,12 +66,12 @@ const getRepayPlanInfo = async () => {
if(result.message === '请求成功'){ if(result.message === '请求成功'){
const rows = result.rows[0]; const rows = result.rows[0];
currencyObj = { currencyObj = {
financingCurrency: currency(rows.financeAmount), financingCurrency: currency(rows.rentAmount),
headerCurrency: currency(rows.residueAmount), headerCurrency: currency(rows.residueAmount),
fristCurrency: currency(rows.receivedAmount), fristCurrency: currency(rows.receivedRentAmount),
times: rows.leaseTerm, times: rows.leaseTerm,
key1: "剩余未还金额(合计)", key1: "剩余未还租金(合计)",
key2: "已支付金额(合计)" key2: "已支付租金(合计)"
} }
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate.split(" ")[0]; return item }) rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate.split(" ")[0]; return item })
cashflow = rows.cashflow cashflow = rows.cashflow
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment