Files
Hfive/pages/index/index.vue
2024-05-31 14:34:57 +08:00

305 lines
8.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="content">
<view class="Box flex-between">
<view class="content flex-colum" @click="indexInvoicing" v-if="improveinformation">
<image src="@/static/item3.png" mode="aspectFill"></image>
<text>极速开票</text>
</view>
<view class="content flex-colum" @click="webview" v-if="improveinformation">
<image src="@/static/item2.png" mode="aspectFill"></image>
<text>后台管理</text>
</view>
<view class="content flex-colum" @click="indexorder" v-if="improveinformation">
<image src="@/static/item1.png" mode="aspectFill"></image>
<text>开票记录</text>
</view>
<view class="content flex-colum" @click="notification" v-if="improveinformation">
<image src="@/static/item6.png" mode="aspectFill"></image>
<text>绑定通知</text>
</view>
<view class="content flex-colum" @click="drawer" v-if="improveinformation">
<image src="@/static/item5.png" mode="aspectFill"></image>
<text>新增开票员</text>
</view>
<view class="content flex-colum" @click="billingcode" v-if="improveinformation">
<image src="@/static/item7.png" mode="aspectFill"></image>
<text>开票码</text>
</view>
<view class="content flex-colum" @click="auditbilling" v-if="improveinformation">
<image src="@/static/item8.png" mode="aspectFill"></image>
<text>审核开票</text>
</view>
<!-- <view class="content flex-colum" @click="jumpToMiniProgram" v-if="improveinformation">
<image src="@/static/item8.png" mode="aspectFill"></image>
<text>跳转小程序</text>
</view>
<wx-open-launch-weapp class="content flex-colum" id="launch-btn" @launch="handleLaunch" @error="handleError"
username="gh_fa9286427a5b" path="pages/index/index.html">
<script type="text/wxtag-template">
<style>
.btn { padding: 12px;opacity:0 }
</style>
<button class="btn">打开小程序</button>
</script>
</wx-open-launch-weapp> -->
</view>
<view class="setClipboardDataclass" @click="setClipboardData" v-if="infos.deviceType != 'pc'">
网页版地址:https://h5-invoice.sxczgkj.cn
</view>
<!-- <pdf style="width: 400px; height: 400px;"
src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182">
</pdf> -->
<!-- <iframe width="100%" height="100%" src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182" frameborder="0"></iframe> -->
</view>
</template>
<script>
import pdf from 'vue-pdf'
import wx from 'weixin-js-sdk';
export default {
components: {
pdf
},
data() {
return {
improveinformation: false,
improveinformationlist: {},
onLoaduserId: '',
onLoadtype: '',
infos: uni.getSystemInfoSync()
};
},
async onLoad(e) {
// alert(location.href.split('#')[0])
if (e.userId) {
// this.onLoaduserId = e.userId
// this.onLoadtype = e.type//295
uni.cache.set('userId', e.userId);
}
// this.jumpToMiniProgram()
let res = await this.api.storestorestatus({
store_id: uni.cache.get('userId')
})
if (res.code == 1) {
this.improveinformationform = res.data.store
uni.cache.set('form', this.improveinformationform);
// uni.cache.set('userId', this.improveinformationform.id);
if (res.data.sz_status == 0) {
uni.reLaunch({
url: '/pages/index/information'
});
} else {
this.improveinformation = true
}
}
uni.request({
url: uni.conf.baseUrl + 'store/storestatus',
data: {
//参数
store_id: uni.cache.get('userId')
// type: this.onLoadtype
},
method: 'POST', //请求方式,必须为大写
success: res => {
this.improveinformationform = res.data.data.store
uni.cache.set('form', this.improveinformationform);
// uni.cache.set('userId', this.improveinformationform.id);
if (res.data.data.sz_status == 0) {
uni.reLaunch({
url: '/pages/index/information'
});
} else {
this.improveinformation = true
}
},
});
},
// 监听跳转
handleLaunch() {
console.log('跳转');
},
// 监听错误
handleError() {
console.log('失败');
},
onShow() {},
methods: {
async jumpToMiniProgram() {
let res = await this.api.userttwechat({
url: location.href.split('#')[0]
})
console.log(res)
// plus.share.getServices(function (res) {
// var sweixin = null;
// for (var i = 0; i < res.length; i++) {
// var t = res[i];
// if (t.id == 'weixin') {
// sweixin = t;
// }
// }
// if (sweixin) {
// sweixin.launchMiniProgram({
// id:'gh_fa9286427a5b', //这里写你的小程序原始id以gh开头
// type: 0, // //小程序版本 0-正式版; 1-测试版; 2-体验版
// path: 'pages/index/index' //这里是指定页的路径,如需传参直接字符串拼接(首页可以省略)
// });
// }
// });
// wx.config({
// "debug": true,
// "beta": false,
// "jsApiList": ['wx-open-launch-weapp'],
// openTagList: ['wx-open-launch-weapp'], // 跳转小程序时必填
// "appId": res.data.wechat_mini.appId,
// "nonceStr": res.data.wechat_mini.nonceStr,
// "timestamp": res.data.wechat_mini.timestamp,
// "url": res.data.wechat_mini.url,
// "signature": res.data.wechat_mini.signature,
// });
wx.config(res.data.wechat_mini);
// res.data.wechat_mini
// 在wx.ready内调用
wx.ready(res => {
console.log(res);
this.$nextTick(() => {
let btn = document.getElementById('launch-btn');
btn.addEventListener('launch', e => {
console.log('success');
});
btn.addEventListener('error', e => {
alert('小程序打开失败');
console.log('fail', e.detail);
});
});
});
wx.error(function(res) {
console.log('err', res)
});
// // #ifdef H5
// // 在H5环境中调用此函数来跳转到小程序
// wx.navigateToMiniProgram({
// appId: 'wxd88fffa983758a30', // 小程序的appid
// path: 'pages/index/index', // 打开的页面路径,若为空则打开首页
// extraData: {}, // 需要传递给小程序的数据
// success(res) {
// // 打开成功的回调
// console.log('跳转成功');
// },
// fail(err) {
// // 打开失败的回调
// console.error('跳转失败', err);
// }
// });
// // jumpToMiniProgram('小程序的appid', '小程序页面路径');
// // #endif
},
setClipboardData() {
uni.setClipboardData({
data: 'https://h5-invoice.sxczgkj.cn/?userId=' + uni.cache.get('userId'),
success: function() {}
});
},
auditbilling() {
uni.pro.navigateTo('index/auditbilling');
},
billingcode() {
uni.pro.navigateTo('index/billingcode');
},
drawer() {
uni.pro.navigateTo('index/drawer');
},
merchant() {
uni.pro.navigateTo('index/merchant');
},
information() {
uni.pro.navigateTo('index/information', this.improveinformationform);
},
notification() {
uni.pro.navigateTo('index/notification');
},
indexInvoicing() {
uni.pro.navigateTo('index/Invoicing');
},
webview() {
uni.pro.showLoading({
title: '加载中',
mask: true
})
try {
uni.request({
url: uni.conf.baseUrl + 'szzpy/h5url',
data: {
//参数
store_id: uni.getStorageSync('userId')
},
method: 'POST', //请求方式,必须为大写
success: res => {
console.log(res.data.data.url)
uni.pro.navigateTo('webview/webview', {
url: res.data.data.url,
tape: 1
});
uni.pro.hideLoading()
}
});
} catch (e) {
uni.pro.hideLoading()
}
},
indexorder() {
uni.pro.navigateTo('index/order');
}
}
};
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.content {
.setClipboardDataclass {
width: 100%;
text-align: center;
margin-top: 90rpx;
color: #2f87fd;
font-weight: bold;
font-size: 28rpx;
}
.Box {
padding: 0rpx 28rpx;
.content {
margin-top: 32rpx;
width: 30%;
height: 218rpx;
background: #FFFFFF;
image {
width: 60rpx;
height: 60rpx;
}
text {
margin-top: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
}
.Box::after {
content: '';
width: 30%;
display: inline-block;
}
}
</style>