开发票
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
<view class="Box_boxone">*单位名称</view>
|
||||
<view class="Box_boxtow" style="position: relative; width: 70%">
|
||||
<input type="text" v-model="form.user_name" placeholder="请填写公司名称" @input="onInput" />
|
||||
<!-- <u-icon name="weixin-fill" color="#04be02" size="28"></u-icon> -->
|
||||
<view class="position" v-if="subCategoryList.length != 0">
|
||||
<view class="positionitem" v-for="(item, index) in subCategoryList" :key="index"
|
||||
@click="categorySubClick(item)">
|
||||
@@ -87,12 +88,16 @@
|
||||
({{ form.status_note || '无' }})</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content_weixin flex-center" @click="doReady" v-if="showtitle">
|
||||
<u-icon name="weixin-fill" color="#04be02" size="28"></u-icon>
|
||||
微信抬头一键导入
|
||||
</view>
|
||||
<view class="content_bottom" @click="saveMerchantBaseInfo">确定</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import jWeixin from 'jweixin-module's
|
||||
// import jWeixin from 'jweixin-module'
|
||||
import wx from 'weixin-js-sdk';
|
||||
import _ from 'lodash';
|
||||
export default {
|
||||
@@ -113,10 +118,12 @@
|
||||
c_bank_name: '',
|
||||
c_bank_account: ''
|
||||
},
|
||||
showElse: false
|
||||
showElse: false,
|
||||
showtitle: false
|
||||
};
|
||||
},
|
||||
async onLoad(e) {
|
||||
this.getInvoiceList()
|
||||
this.form.id = e.id;
|
||||
this.form.open_id = e.open_id;
|
||||
if (e.view_type == 'fail') {
|
||||
@@ -139,21 +146,66 @@
|
||||
stopPropagation() {
|
||||
this.subCategoryList = [];
|
||||
},
|
||||
wxInit() {
|
||||
wx.config({
|
||||
debug: false, // true:调试时候弹窗
|
||||
appId: res.appId, // 微信appid
|
||||
timestamp: res.timestamp, // 时间戳
|
||||
nonceStr: res.nonceStr, // 随机字符串
|
||||
signature: res.signature, // 签名
|
||||
jsApiList: [
|
||||
// 所有要调用的 API 都要加到这个列表中
|
||||
'onMenuShareTimeline', // 分享到朋友圈接口
|
||||
'onMenuShareAppMessage', // 分享到朋友接口
|
||||
'onMenuShareQQ', // 分享到QQ接口
|
||||
'onMenuShareWeibo' // 分享到微博接口
|
||||
]
|
||||
removeUrlParameters(url) {
|
||||
return url.split('?')[0];
|
||||
},
|
||||
//点击按钮获取微信参数配置
|
||||
async getInvoiceList() {
|
||||
let _this = this
|
||||
// 获取当前页面的 URL
|
||||
var currentUrl = this.removeUrlParameters(location.href.split('#')[0])
|
||||
let res = await this.api.usergetwechatjssdk({
|
||||
url: location.href.split('#')[0]
|
||||
})
|
||||
wx.config(res.data);
|
||||
wx.ready(function() {
|
||||
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
|
||||
wx.checkJsApi({
|
||||
jsApiList: [
|
||||
// 所有要调用的 API 都要加到这个列表中
|
||||
'chooseInvoiceTitle'
|
||||
], // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
||||
success: function(res) {
|
||||
_this.showtitle = true
|
||||
}
|
||||
});
|
||||
});
|
||||
wx.error(function(res) {
|
||||
_this.showtitle = false
|
||||
console.log(res, '失败!')
|
||||
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
||||
});
|
||||
|
||||
},
|
||||
doReady() {
|
||||
let _this = this
|
||||
wx.invoke('chooseInvoiceTitle', {
|
||||
"scene": "1"
|
||||
}, function(res) {
|
||||
// 这里处理调用结果X``
|
||||
var info = JSON.parse(JSON.stringify(res)).choose_invoice_title_info;
|
||||
var infoJ = JSON.parse(JSON.parse(JSON.stringify(info)));
|
||||
_this.form.user_name = infoJ.title ? infoJ.title : '' //发票抬头
|
||||
_this.form.user_duty = infoJ.taxNumber ? infoJ.taxNumber : '' //税号
|
||||
_this.form.c_address = infoJ.companyAddress ? infoJ.companyAddress : '' //公司地址
|
||||
_this.form.c_phone = infoJ.telephone ? infoJ.telephone : '' //电话
|
||||
_this.form.c_bank_name = infoJ.bankAccount ? infoJ.bankAccount : '' //开户银行
|
||||
_this.form.c_bank_account = infoJ.bankName ? infoJ.bankName : '' // 银行账号
|
||||
_this.form.user_type = infoJ.type == 0 ? 2 : 1 //发票抬头类型 微信返回0是企业 1是个人
|
||||
// form: {
|
||||
// user_type: 2,
|
||||
// img: '',
|
||||
// user_name: '',
|
||||
// user_duty: '',
|
||||
// email: '',
|
||||
// mobile: '',
|
||||
// status_note: '',
|
||||
// c_address: '',
|
||||
// c_phone: '',
|
||||
// c_bank_name: '',
|
||||
// c_bank_account: ''
|
||||
// },
|
||||
})
|
||||
},
|
||||
onInput(e) {
|
||||
if (this.form.user_type == 2) {
|
||||
@@ -491,8 +543,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
.content_weixin {
|
||||
margin-top: 40rpx;
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #04be02;
|
||||
// font-weight: 400;
|
||||
}
|
||||
|
||||
.content_bottom {
|
||||
margin: 100rpx auto;
|
||||
margin: 60rpx auto;
|
||||
width: 80%;
|
||||
height: 84rpx;
|
||||
background: #288efb;
|
||||
|
||||
Reference in New Issue
Block a user