云锦报销
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
bxsdk-front-yunjin/getInvoice.html

77 lines
3.0 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.0/axios.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/Base64/1.1.0/base64.min.js"></script>
<script>
axios.post('https://bxsdk-pre.ele-cloud.com/wxservice/api/getJsApiSign', {
url: window.location.href,
gzh_appid: 'wx9546d3b33085d924'
})
.then(function (response) {
console.log(response.data);
//alert('getJsApiSign'+JSON.stringify(response.data))
getChooseInvoice(response.data)
})
.catch(function (error) {
console.log(error);
//alert('getJsApiSign'+error)
});
function getChooseInvoice(data){
//alert(JSON.stringify(data));
wx.config({
beta: true,
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr:data.nonceStr,
signature: data.signature,
jsApiList: ['chooseInvoice']
});
wx.ready(function () {
wx.invoke('chooseInvoice', {
'timestamp': data.timestamp,
'nonceStr': data.nonceStr,
}, function(res) {
//alert('chooseInvoice'+JSON.stringify(res));
//getInvoiceInfo(res.choose_invoice_info)
window.location.href=window.location.href.split('toPath=')[1]+'?chooseInvoiceData='+res.choose_invoice_info;
}
);
});
}
function getInvoiceInfo(data){
//alert('getInvoiceInfo接参'+JSON.stringify(data))
let infoData=JSON.parse(data);
let newArr=[];
for (var i=0;i<infoData.length;i++){
newArr.push({
gzh_appid:'wx9546d3b33085d924',
encrypt_code:infoData[i].encrypt_code,
card_id:infoData[i].card_id
})
}
let param={
item_list:newArr
}
//alert('getInvoiceInfo参数'+JSON.stringify(param));
axios.post('https://bxsdk-pre.ele-cloud.com/wxservice/api/getInvoiceInfo', {item_list:newArr})
.then(function (response) {
console.log('获取发票信息',response);
//alert('获取发票信息'+JSON.stringify(response));
})
.catch(function (error) {
console.log(error);
//alert('获取发票信息error'+JSON.stringify(response));
});
}
</script>
</body>
</html>