Commit 1222607b authored by 14699's avatar 14699

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

parent 7772cabc
......@@ -4,6 +4,8 @@ VITE_DEBUG='true'
VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='http://139.196.201.22:8080/leaf_dev'
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_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order'
......@@ -4,6 +4,8 @@ VITE_DEBUG='false'
VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='https://kflc.komatsu-fl.com.cn/xszl_prod'
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_Wechat='https://api-mop.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://api-mop.chinaums.com/v1/netpay/uac/order'
NODE_ENV=test
VITE_LOCAL='false'
VITE_LOCAL='true'
VITE_DEBUG='true'
VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='http://139.196.201.22:8080/leaf_dev'
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_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order'
......@@ -76,5 +76,8 @@ npm run preview 本地预览打包完的文件
- 这上方网址下搜索功能 "子应用管理",找到对应的模块,新建版本,提交 zip包 ,点击确认退出
### 配置文件参数
miniprogramId:'' 小程序的id值
payPath:'' 小程序支付界面的路径(带支付参数)
miniprogramType:'' 小程序的版本,值分别为: 体验版传 2 , 开发版传 1, 正式版传 0
......@@ -4,7 +4,7 @@
<div class="content">
<header>
<div class="header-top">
<p class="key">融资金</p>
<p class="key">租金总</p>
<p class="value">{{ currencyObj.financingCurrency }}</p>
<div class="times">
......
......@@ -26,20 +26,20 @@
let repaymentMessageList = $ref([])
let repaymentMessageTotal = $ref()
const getList = async () => {
let res = await api.messageQuery({
readFlag: 'N'
})
const getList = async (param) => {
let res = await api.messageQuery({...param})
if (res.success && res.rows.length > 0) {
messageList = res.rows
messageTotal = res.total + '条新消息'
}
};
getList()
getList(); // 查询所有消息
getList({readFlag: 'N'}); //查询未读消息
const getRepaymentList = async () => {
let result = await api.messageQuery({
readFlag: 'N',
// readFlag: 'N',
messageCode: "repaymentMessage"
})
if (result.success && result.rows.length > 0) {
......@@ -47,7 +47,7 @@
repaymentMessageTotal = result.total + '条新消息'
}
};
getRepaymentList()
getRepaymentList(); // 查询还款消息
</script>
<style scoped lang="less">
......
......@@ -88,29 +88,8 @@
@blur="show = false"
@delete="onDelete"
/>
<!-- <Cell title="支付方式" is-link value="内容" />-->
</div>
</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>
<script setup>
......@@ -120,7 +99,7 @@ import { pay } from '@/utils/pay';
import api from "../api";
import { Base } from '@hips/plugin-vue-jssdk';
const { openWebLink } = Base;
import moment from 'moment'
const props = defineProps({
visible: { type: Boolean }, // 是否打开弹框
payInfoObj: {
......@@ -129,10 +108,12 @@ const props = defineProps({
cashflowId: '',
payAmount: '',
cfItem: '',
cfItemN:'',
times: ''
}
},
})
const emit = defineEmits(['payMoneyClick', 'closePage', 'paySuccess', 'payFail'])
const emit = defineEmits(['payMoneyClick', 'closePage', 'paySuccess', 'payFail', 'wechatPayCallBack'])
// const state = reactive({
// showDialog: true, //弹窗
......@@ -147,6 +128,8 @@ const password = ref([]);
const showKeyboard = ref(true);
const checkArray = {UNION_PAY:'云闪付(银行卡)',WECHAT_PAY:'微信支付',ALI_PAY:'支付宝'};
let isModify = ref(false); // 支付金额是否可修改 现金流项目为 罚息:9,租金:1 可修改部分支付
const miniprogramId = import.meta.env.VITE_MiniprogramId;
const miniprogramType = +import.meta.env.VITE_MiniprogramType;
watchEffect(() => {
payAmount.value = props.payInfoObj.payAmount
......@@ -176,9 +159,22 @@ const payMoney = () => {
const info = {
payAmount: orderAmount.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('云闪付(银行卡)当前暂不支持!')
} else {
goPayApp(info)
......@@ -242,10 +238,47 @@ const unifyPay = (paramsData) => {
HandBridge.postMessage(JSON.stringify(params));
};
const handleFinishAmount = () => {
showDialog.value = false;
pay();
}
// APP 跳转小程序微信支付
// miniprogramId:小程序的id值
// 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) => {
let resultList = [
......
......@@ -51,7 +51,7 @@ const getList = async (param) => {
...item,
title: item.contractNumber,
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 {
list = [];
......
......@@ -43,7 +43,7 @@
</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 #footer>
</template>
......@@ -74,7 +74,13 @@ const router = useRouter();
const handleClick = (item) => {
// Toast.fail('当前暂不支持进行APP支付!')
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) => {
......@@ -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 = () => {
router.push({ name: 'makeRepayment-views-liquidatedDamagesDetails' })
}
......@@ -118,12 +151,12 @@ const getRepayPlanInfo = async () => {
if(result.success){
const rows = result.rows[0];
currencyObj = {
financingCurrency: currency(rows.financeAmount),
financingCurrency: currency(rows.rentAmount),
headerCurrency: currency(rows.residueAmount),
fristCurrency: currency(rows.receivedAmount),
fristCurrency: currency(rows.receivedRentAmount),
times: rows.leaseTerm,
key1: "剩余未还金额(合计)",
key2: "已支付金额(合计)"
key1: "剩余未还租金(合计)",
key2: "已支付租金(合计)"
}
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item })
cashflow = rows.cashflow
......
......@@ -65,10 +65,12 @@ const getRepayPlanInfo = async () => {
if(result.success){
const rows = result.rows[0];
currencyObj = {
financingCurrency: currency(rows.financeAmount),
headerCurrency: currency(rows.firstGold),
fristCurrency: currency(rows.firstRental),
times: rows.leaseTerm
financingCurrency: currency(rows.rentAmount),
headerCurrency: currency(rows.residueAmount),
fristCurrency: currency(rows.receivedRentAmount),
times: rows.leaseTerm,
key1: "剩余未还租金(合计)",
key2: "已支付租金(合计)"
}
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item })
cashflow = rows.cashflow
......
......@@ -49,7 +49,7 @@ const getList = async (param) => {
...item,
title: item.contractNumber,
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 {
list = [];
......
......@@ -66,12 +66,12 @@ const getRepayPlanInfo = async () => {
if(result.message === '请求成功'){
const rows = result.rows[0];
currencyObj = {
financingCurrency: currency(rows.financeAmount),
financingCurrency: currency(rows.rentAmount),
headerCurrency: currency(rows.residueAmount),
fristCurrency: currency(rows.receivedAmount),
fristCurrency: currency(rows.receivedRentAmount),
times: rows.leaseTerm,
key1: "剩余未还金额(合计)",
key2: "已支付金额(合计)"
key1: "剩余未还租金(合计)",
key2: "已支付租金(合计)"
}
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate.split(" ")[0]; return item })
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