开发票

This commit is contained in:
魏啾
2024-08-08 13:40:34 +08:00
parent fb7d0cc232
commit 7dcde9f91f
9 changed files with 244 additions and 4067 deletions

View File

@@ -92,4 +92,7 @@ export default {
szzpydownloadurl(data) { szzpydownloadurl(data) {
return uni.api.post("szzpy/downloadurl", data); return uni.api.post("szzpy/downloadurl", data);
}, },
usergetwechatjssdk(data) {
return uni.api.post("user/getwechatjssdk", data);
},
} }

View File

@@ -8,9 +8,9 @@ const baseUrl = 'https://invoice.sxczgkj.cn/api/' //正式
// const baseUrl = 'http://test.invoice.sxczgkj.cn/api/'//测试 // const baseUrl = 'http://test.invoice.sxczgkj.cn/api/'//测试
// #endif // #endif
import VConsole from "./vConsole.js" import VConsole from "./vConsole.js"
// if (debug) { if (debug) {
// new VConsole() new VConsole()
// } }
const version = '120' const version = '120'
const autoRemoveCache = { const autoRemoveCache = {
count: 100000, count: 100000,

4046
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,12 @@
"navigationBarTitleText": "开票", "navigationBarTitleText": "开票",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},{
"path": "pages/hindex/indexess",
"style": {
"navigationBarTitleText": "开票",
"navigationStyle": "custom"
}
}, { }, {
"path": "pages/index/information", "path": "pages/index/information",
"style": { "style": {

View File

@@ -13,6 +13,7 @@
<view class="Box_boxone">*单位名称</view> <view class="Box_boxone">*单位名称</view>
<view class="Box_boxtow" style="position: relative; width: 70%"> <view class="Box_boxtow" style="position: relative; width: 70%">
<input type="text" v-model="form.user_name" placeholder="请填写公司名称" @input="onInput" /> <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="position" v-if="subCategoryList.length != 0">
<view class="positionitem" v-for="(item, index) in subCategoryList" :key="index" <view class="positionitem" v-for="(item, index) in subCategoryList" :key="index"
@click="categorySubClick(item)"> @click="categorySubClick(item)">
@@ -87,12 +88,16 @@
({{ form.status_note || '无' }})</view> ({{ form.status_note || '无' }})</view>
</view> </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 class="content_bottom" @click="saveMerchantBaseInfo">确定</view>
</view> </view>
</template> </template>
<script> <script>
// import jWeixin from 'jweixin-module's // import jWeixin from 'jweixin-module'
import wx from 'weixin-js-sdk'; import wx from 'weixin-js-sdk';
import _ from 'lodash'; import _ from 'lodash';
export default { export default {
@@ -113,10 +118,12 @@
c_bank_name: '', c_bank_name: '',
c_bank_account: '' c_bank_account: ''
}, },
showElse: false showElse: false,
showtitle: false
}; };
}, },
async onLoad(e) { async onLoad(e) {
this.getInvoiceList()
this.form.id = e.id; this.form.id = e.id;
this.form.open_id = e.open_id; this.form.open_id = e.open_id;
if (e.view_type == 'fail') { if (e.view_type == 'fail') {
@@ -139,21 +146,66 @@
stopPropagation() { stopPropagation() {
this.subCategoryList = []; this.subCategoryList = [];
}, },
wxInit() { removeUrlParameters(url) {
wx.config({ return url.split('?')[0];
debug: false, // true:调试时候弹窗 },
appId: res.appId, // 微信appid //点击按钮获取微信参数配置
timestamp: res.timestamp, // 时间戳 async getInvoiceList() {
nonceStr: res.nonceStr, // 随机字符串 let _this = this
signature: res.signature, // 签名 // 获取当前页面的 URL
jsApiList: [ var currentUrl = this.removeUrlParameters(location.href.split('#')[0])
// 所有要调用的 API 都要加到这个列表中 let res = await this.api.usergetwechatjssdk({
'onMenuShareTimeline', // 分享到朋友圈接口 url: location.href.split('#')[0]
'onMenuShareAppMessage', // 分享到朋友接口 })
'onMenuShareQQ', // 分享到QQ接口 wx.config(res.data);
'onMenuShareWeibo' // 分享到微博接口 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) { onInput(e) {
if (this.form.user_type == 2) { 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 { .content_bottom {
margin: 100rpx auto; margin: 60rpx auto;
width: 80%; width: 80%;
height: 84rpx; height: 84rpx;
background: #288efb; background: #288efb;

151
pages/index/drawerlist.vue Normal file
View File

@@ -0,0 +1,151 @@
<template>
<view class="content">
<view class="contentitem" v-for="(item,index) in list" :key="index">
<view class="contentitemtop flex-start">
<view>{{item.name}}</view>
<text>开票员</text>
</view>
<view class="contentitembotton">
{{item.dlzh}}
</view>
<view class="contentitemabsolute flex-start" @click="szzpydeltaxation(item)">
<image src="@/static/drawerlistdelete.png" mode="aspectFill"></image>
<text>删除</text>
</view>
</view>
<view class="contentitemadd flex-start" @click="clickadd">
<u-icon name="plus-circle-fill" color="#2979ff" size="16"></u-icon>
<text>添加开票员</text>
</view>
</view>
</template>
<script>
import dayjs from 'dayjs'
export default {
data() {
return {
list: []
};
},
onLoad(e) {},
onShow() {
this.szzpynewissuedbylist()
},
methods: {
async szzpynewissuedbylist() {
let res = await this.api.szzpynewissuedbylist({
store_id: uni.cache.get('userId')
})
this.list = res.data
},
async szzpydeltaxation(item) {
uni.showModal({
title: '提示',
content: '确认删除吗?',
success: async (res) => {
if (res.confirm) {
let time = dayjs().unix()
await this.api.szzpydeltaxation({
id: item.id,
del_sign: uni.utils.md5(time + '|||' +
'cab37132-fae4-4031-8549-e49aa89f7631'),
time_str: time,
store_id: uni.cache.get('userId')
})
this.szzpynewissuedbylist()
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
clickadd() {
uni.pro.navigateTo('index/drawer');
}
}
};
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.content {
padding: 32rpx 28rpx;
.contentitem:nth-child(1) {
margin-top: 0;
}
.contentitem {
position: relative;
margin-top: 32rpx;
width: 100%;
padding: 32rpx 24rpx;
background: url(@/static/drawerlist.png) no-repeat;
background-size: 100% 100%;
.contentitemabsolute {
position: absolute;
right: 24rpx;
top: 32rpx;
image {
width: 24rpx;
height: 24rpx;
}
text {
margin-left: 8rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #FFFFFF;
}
}
.contentitemtop {
view {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
}
text {
margin-left: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: rgba(255, 255, 255, 0.71);
}
}
.contentitembotton {
margin-top: 24rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 32rpx;
color: #FFFFFF;
}
}
.contentitemadd {
margin-top: 32rpx;
padding: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
text {
margin-left: 10rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 32rpx;
color: #333333;
}
}
}
</style>

BIN
static/drawerlist.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
static/drawerlistdelete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

View File

@@ -3,4 +3,4 @@
document.write( document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + (coverSupport ? ', viewport-fit=cover' : '') +
'" />')</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.41073de1.js></script><script src=/static/js/index.eb42db61.js></script></body></html> '" />')</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.41073de1.js></script><script src=/static/js/index.8ef16d6b.js></script></body></html>