This commit is contained in:
魏啾
2024-05-11 18:26:49 +08:00
parent 9d6e4bb57c
commit 7c568a8383
9 changed files with 999 additions and 21 deletions

262
common/js/EscPosUtil.js Normal file
View File

@@ -0,0 +1,262 @@
// 打印机纸宽58mm页的宽度384字符宽度为1每行最多盛放32个字符
// 打印机纸宽80mm页的宽度576字符宽度为1每行最多盛放48个字符
const PAGE_WIDTH = 576;
const MAX_CHAR_COUNT_EACH_LINE = 48;
//字符串转字节序列
function stringToByte(str) {
var bytes = new Array();
var len, c;
len = str.length;
for (var i = 0; i < len; i++) {
c = str.charCodeAt(i);
if (c >= 0x010000 && c <= 0x10FFFF) {
bytes.push(((c >> 18) & 0x07) | 0xF0);
bytes.push(((c >> 12) & 0x3F) | 0x80);
bytes.push(((c >> 6) & 0x3F) | 0x80);
bytes.push((c & 0x3F) | 0x80);
} else if (c >= 0x000800 && c <= 0x00FFFF) {
bytes.push(((c >> 12) & 0x0F) | 0xE0);
bytes.push(((c >> 6) & 0x3F) | 0x80);
bytes.push((c & 0x3F) | 0x80);
} else if (c >= 0x000080 && c <= 0x0007FF) {
bytes.push(((c >> 6) & 0x1F) | 0xC0);
bytes.push((c & 0x3F) | 0x80);
} else {
bytes.push(c & 0xFF);
}
}
return bytes;
}
//字节序列转ASCII码
//[0x24, 0x26, 0x28, 0x2A] ==> "$&C*"
function byteToString(arr) {
if (typeof arr === 'string') {
return arr;
}
var str = '',
_arr = arr;
for (var i = 0; i < _arr.length; i++) {
var one = _arr[i].toString(2),
v = one.match(/^1+?(?=0)/);
if (v && one.length == 8) {
var bytesLength = v[0].length;
var store = _arr[i].toString(2).slice(7 - bytesLength);
for (var st = 1; st < bytesLength; st++) {
store += _arr[st + i].toString(2).slice(2);
}
str += String.fromCharCode(parseInt(store, 2));
i += bytesLength - 1;
} else {
str += String.fromCharCode(_arr[i]);
}
}
return str;
}
//居中
function Center() {
var Center = [];
Center.push(27);
Center.push(97);
Center.push(1);
var strCenter = byteToString(Center);
return strCenter;
}
//居左
function Left() {
var Left = [];
Left.push(27);
Left.push(97);
Left.push(0);
var strLeft = byteToString(Left);
return strLeft;
}
//居右
function Right() {
var right = [];
Left.push(27);
Left.push(97);
Left.push(2);
var strRight = byteToString(right);
return strRight;
}
//标准字体
function Size1() {
var Size1 = [];
Size1.push(29);
Size1.push(33);
Size1.push(0);
var strSize1 = byteToString(Size1);
return strSize1;
}
//大号字体
/* 放大1倍 n = 0
* 长宽各放大2倍 n = 17 */
function Size2(n) {
var Size2 = [];
Size2.push(29);
Size2.push(33);
Size2.push(n);
var strSize2 = byteToString(Size2);
return strSize2;
}
// 字体加粗
function boldFontOn() {
var arr = []
arr.push(27)
arr.push(69)
arr.push(1)
var cmd = byteToString(arr);
return cmd
}
// 取消字体加粗
function boldFontOff() {
var arr = []
arr.push(27)
arr.push(69)
arr.push(0)
var cmd = byteToString(arr);
return cmd
}
// 打印并走纸n行
function feedLines(n = 1) {
var feeds = []
feeds.push(27)
feeds.push(100)
feeds.push(n)
var printFeedsLines = byteToString(feeds);
return printFeedsLines
}
// 切纸
function cutPaper() {
var cut = []
cut.push(29)
cut.push(86)
cut.push(49)
var cutType = byteToString(cut);
return cutType
}
// 开钱箱
function open_money_box() {
var open = []
open.push(27)
open.push(112)
open.push(0)
open.push(60)
open.push(255)
var openType = byteToString(open)
return openType
}
// 初始化打印机
function init() {
var arr = []
arr.push(27)
arr.push(68)
arr.push(0)
var str = byteToString(arr)
return str
}
/*
设置左边距
len:
*/
function setLeftMargin(len = 1) {
var arr = []
arr.push(29)
arr.push(76)
arr.push(len)
var str = byteToString(arr)
return str
}
// 设置打印区域宽度
function setPrintAreaWidth(width) {
var arr = []
arr.push(29)
arr.push(87)
arr.push(width)
var str = byteToString(arr)
return str
}
/**
* @param str
* @returns {boolean} str是否全是中文
*/
function isChinese(str) {
return /^[\u4e00-\u9fa5]$/.test(str);
}
// str是否全含中文或者中文标点
function isHaveChina(str) {
if (escape(str).indexOf("%u") < 0) {
return 0
} else {
return 1
}
}
/**
* 返回字符串宽度(1个中文=2个英文字符)
* @param str
* @returns {number}
*/
function getStringWidth(str) {
let width = 0;
for (let i = 0, len = str.length; i < len; i++) {
width += isHaveChina(str.charAt(i)) ? 2 : 1;
}
return width;
}
/**
* 同一行输出str1, str2str1居左, str2居右
* @param {string} str1 内容1
* @param {string} str2 内容2
* @param {string} fillWith str1 str2之间的填充字符
* @param {number} fontWidth 字符宽度 1/2
*
*/
function inline(str1, str2, fillWith = ' ', fontWidth = 1) {
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
// 需要填充的字符数量
let fillCount = lineWidth - (getStringWidth(str1) + getStringWidth(str2)) % lineWidth;
let fillStr = new Array(fillCount).fill(fillWith.charAt(0)).join('');
return str1 + fillStr + str2;
}
/**
* 用字符填充一整行
* @param {string} fillWith 填充字符
* @param {number} fontWidth 字符宽度 1/2
*/
function fillLine(fillWith = '-', fontWidth = 1) {
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
return new Array(lineWidth).fill(fillWith.charAt(0)).join('');
}
/**
* 文字内容居中,左右用字符填充
* @param {string} str 文字内容
* @param {number} fontWidth 字符宽度 1/2
* @param {string} fillWith str1 str2之间的填充字符
*/
function fillAround(str, fillWith = '-', fontWidth = 1) {
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
let strWidth = getStringWidth(str);
// 内容已经超过一行了,没必要填充
if (strWidth >= lineWidth) {
return str;
}
// 需要填充的字符数量
let fillCount = lineWidth - strWidth;
// 左侧填充的字符数量
let leftCount = Math.round(fillCount / 2);
// 两侧的填充字符,需要考虑左边需要填充,右边不需要填充的情况
let fillStr = new Array(leftCount).fill(fillWith.charAt(0)).join('');
return fillStr + str + fillStr.substr(0, fillCount - leftCount);
}

View File

@@ -14,4 +14,13 @@ export default {
storeinvoicelist(data) { //记录 storeinvoicelist(data) { //记录
return uni.api.post("store/invoicelist", data); return uni.api.post("store/invoicelist", data);
}, },
szzpyaddinvoicer(data) { //新增开票人
return uni.api.post("szzpy/addinvoicer", data);
},
szzpytypeofinvoicer(data) { //开票员类型列表
return uni.api.post("szzpy/typeofinvoicer", data);
},
szzpyaddinvoicersendsms(data) { //上传验证码(新增开票员)
return uni.api.post("szzpy/addinvoicersendsms", data);
},
} }

View File

@@ -15,12 +15,24 @@
"navigationBarTitleText": "完善商户信息", "navigationBarTitleText": "完善商户信息",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "pages/index/drawer",
"style": {
"navigationBarTitleText": "新增开票员",
"navigationStyle": "custom"
}
}, { }, {
"path": "pages/index/notification", "path": "pages/index/notification",
"style": { "style": {
"navigationBarTitleText": "绑定通知", "navigationBarTitleText": "绑定通知",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "pages/index/notificationdd",
"style": {
"navigationBarTitleText": "绑定通知",
"navigationStyle": "custom"
}
}, { }, {
"path": "pages/index/merchant", "path": "pages/index/merchant",
"style": { "style": {

374
pages/index/drawer.vue Normal file
View File

@@ -0,0 +1,374 @@
<template>
<view class="Box">
<view class="Box_box_O">
<view class="Box_box flex-between">
<view>开票员姓名</view>
<view class="Box_box_input"><input type="text" v-model="form.taxname" placeholder="请填写开票员姓名"
data-key="mobile" /></view>
</view>
<view class="Box_box flex-between">
<view>开票员电话</view>
<view class="Box_box_input"><input type="text" v-model="form.taxphone" placeholder="请填写开票员电话"
data-key="mobile" /></view>
</view>
<view class="Box_box flex-between" @click="showpicker = true">
<view>开票员身份</view>
<view class="flex-start">
{{form.dlsf_name || ''}}<u-icon name="arrow-right" color="#999999" size="16"></u-icon>
</view>
</view>
<view class="Box_box flex-between">
<view>开票员身份证号</view>
<view class="Box_box_input"><input type="text" v-model="form.dlzh" placeholder="请填写开票员身份证号" /></view>
</view>
<view class="Box_box flex-between">
<view>开票员密码</view>
<view class="Box_box_input"><input type="text" v-model="form.dlmm" placeholder="请填写开票员密码"
data-key="mobile" /></view>
</view>
<view class="Box_box flex-between">
<view>验证码</view>
<view class="Box_box_input" style="display: flex; justify-content: flex-start;align-items: center;">
<input class="Box_box_inpuinputt" type="text" maxlength="6" v-model="form.code" placeholder="验证码"
data-key="mobile" />
<view class="repeats">
<view v-if="showText == true" style="padding: 8rpx;background: #288EFB; border-radius: 15rpx;"
@tap="$u.debounce(CodeRegister, 500)">
{{ Recapture }}
</view>
<view v-else
style="color: #ccc; background-color: #f9f9f9; padding: 8rpx; border-radius: 15rpx;">
{{ second }}s重新发送
</view>
</view>
</view>
</view>
</view>
<view class="preservation flex-colum">
<!-- <view v-if="form.status == '2'"
style="width: 100%; color: #FF2B2B; padding: 28rpx 0;word-wrap: break-word;">
拒接原因:({{form.no|| '无'}})</view> -->
<view v-if="!codefailed" class="preservation_boxs">提交</view>
<view v-else class="preservation_box" @tap="$u.throttle(saveMerchantBaseInfoV2, 1000)">提交</view>
</view>
<u-picker :show="showpicker" :columns="columns" @confirm='confirm' keyName="name"
@cancel='showpicker = false'></u-picker>
</view>
</template>
<script>
import selectaddress from '@/components/yixuan-selectAddress/yixuan-selectAddress.vue';
export default {
components: {
selectaddress
},
data() {
return {
showpicker: false,
disabled: false,
Uploadurlnumber: '',
namelang: '',
merchantAuditStatus: '',
columns: [
],
codefailed: false, //验证码是否发送成功
store_id: '',
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码',
form: {
store_id: uni.getStorageSync('userId'),
dlzh: '',
dlmm: '',
taxname: '',
taxphone: '',
code: '',
dlsf_name: '',
dlsf: ''
}
};
},
onLoad(e) {
console.log(e.store)
let data = uni.getStorageSync('form')
},
onShow() {
this.onShowdata()
},
methods: {
async CodeRegister() {
if (this.form.dlzh == null || this.form.dlzh == '') {
uni.showToast({
title: '请填写电税账号',
icon: 'none'
});
return false;
}
if (this.form.dlmm == null || this.form.dlmm == '') {
uni.showToast({
title: '请填写电税密码',
icon: 'none'
});
return false;
}
if (this.form.taxname == null || this.form.taxname == '') {
uni.showToast({
title: '请填写办税员',
icon: 'none'
});
return false;
}
if (this.form.taxphone == null || this.form.taxphone == '') {
uni.showToast({
title: '请填写办税员电话',
icon: 'none'
});
return false;
}
if (this.form.dlsf == null || this.form.dlsf == '') {
uni.showToast({
title: '请选择办税员身份',
icon: 'none'
});
return false;
}
let res = await this.api.szzpyaddinvoicer(this.form)
if (res.code == 1) {
uni.showToast({
title: res.message || res.msg,
icon: "none",
})
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
this.codefailed = true
}
},
async saveMerchantBaseInfoV2() {
if (this.form.code == null || this.form.code == '') {
uni.showToast({
title: '请填写验证码',
icon: 'none'
});
return false;
}
let res = await this.api.szzpyaddinvoicersendsms(this.form)
if (res.code == 1) {
uni.showToast({
title: res.message || res.msg,
icon: "none",
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
//请求数电授权
// this.szzpyauthorization()
}
},
async szzpyauthorization() {
let res = await this.api.szzpyauthorization({
store_id: this.store_id
})
if (res.code == 1) {
setTimeout(() => {
uni.cache.set('form', '');
uni.reLaunch({
url: '/pages/index/index'
});
}, 2000);
}
},
async onShowdata() {
let res = await this.api.szzpytypeofinvoicer()
console.log(res)
this.columns = [res.data]
},
confirm(e) {
this.form.dlsf = e.value[0].id
this.form.dlsf_name = e.value[0].name
this.showpicker = false
},
Upload(i) {
if (this.disabled) {
return false;
} else {
this.Uploadurlnumber = i;
uni.chooseImage({
count: 1, //默认9
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择,和摄像头功能,默认二者都有
success: res => {
uni.pro.showLoading({
title: '上传中',
mask: true
});
var thisimgUrlcaca = res.tempFilePaths[0];
var that = this;
uni.uploadFile({
url: 'https://cashieradmin.sxczgkj.cn' + '/api/qiNiuContent',
filePath: thisimgUrlcaca,
name: 'file', // 后端接收的文件名
header: {
userId: uni.cache.get('userId'),
token: uni.cache.get('token'),
myLoginName: uni.cache.get('myLoginName')
},
success: res => {
console.log(res)
var thisdata_ = JSON.parse(res.data);
uni.showToast({
title: '上传成功',
icon: 'none',
success: () => {
uni.pro.hideLoading();
console.log(thisdata_.data[0]);
if (this.Uploadurlnumber == 0) {
this.$set(this.form,
'id_card_straight', thisdata_
.data[0])
} else if (this.Uploadurlnumber == 1) {
this.$set(this.form, 'id_card_reverse',
thisdata_.data[0])
} else {
this.$set(this.form,
'business_license', thisdata_
.data[0])
}
console.log(this.form)
}
});
},
fail: err => {
uni.pro.hideLoading();
uni.showToast({
title: thisdata_.message || thisdata_.msg,
icon: 'none',
});
}
});
}
});
}
},
}
};
</script>
<style lang="scss">
page {
background: #fff;
}
.Box {
.Box_box_O {
padding: 0 28rpx;
.Box_box {
text-align: right;
padding: 24rpx;
border-bottom: 1px solid #e5e5e5;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
.Box_box_input {
position: relative;
width: 60%;
.Box_box_inpuinputt {
padding-right: 15rpx;
}
.repeats {
flex: none;
text-align: center;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
border-radius: 12rpx;
}
}
}
}
.Box_box_T {
padding: 0 28rpx;
border-top: 16rpx solid #e5e5e5;
.Box_box_T_o {
padding: 28rpx 0;
text-align: center;
}
.flex-colum {
image {
width: 396rpx;
height: 240rpx;
}
padding-bottom: 16rpx;
border-bottom: 1px solid #e5e5e5;
.Box_box_Ts {
width: 396rpx;
height: 240rpx;
background: #ffffff;
border-radius: 8rpx;
border: 2rpx dashed #707070;
background: url(@/static/my2.png) no-repeat;
background-position: 50% 50%;
background-size: 50%;
}
}
}
.preservation {
width: 100%;
padding: 50rpx;
.preservation_box {
width: 70%;
height: 72rpx;
background: #288efb;
text-align: center;
line-height: 72rpx;
border-radius: 50rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
}
.preservation_boxs {
width: 70%;
height: 72rpx;
background: #999999;
text-align: center;
line-height: 72rpx;
border-radius: 50rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
}
}
}
</style>

View File

@@ -16,6 +16,10 @@
<image src="@/static/item6.png" mode="aspectFill"></image> <image src="@/static/item6.png" mode="aspectFill"></image>
<text>绑定通知</text> <text>绑定通知</text>
</view> </view>
<view class="content flex-colum" @click="drawer" v-if="improveinformation">
<image src="@/static/item5.png" mode="aspectFill"></image>
<text>新增开票员</text>
</view>
</view> </view>
</template> </template>
<script> <script>
@@ -75,6 +79,9 @@
}, },
onShow() {}, onShow() {},
methods: { methods: {
drawer(){
uni.pro.navigateTo('index/drawer');
},
merchant() { merchant() {
uni.pro.navigateTo('index/merchant'); uni.pro.navigateTo('index/merchant');
}, },

View File

@@ -2,29 +2,29 @@
<view class="Box"> <view class="Box">
<view class="Box_box_O"> <view class="Box_box_O">
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>请填写公司名字</view> <view>公司名字</view>
<view class="Box_box_input"><input type="text" :disabled="disabled" v-model="form.title" <view class="Box_box_input"><input type="text" :disabled="disabled" v-model="form.title"
placeholder="请填写" data-key="mobile" /></view> placeholder="请填写公司名字" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>请填写法人姓名</view> <view>法人姓名</view>
<view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.legal_person_name" <view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.legal_person_name"
placeholder="请填写" data-key="mobile" /></view> placeholder="请填写法人姓名" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>请填写法人手机号</view> <view>法人手机号</view>
<view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.phone" <view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.phone"
placeholder="请填写" data-key="mobile" /></view> placeholder="请填写法人手机号" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>电子税局账号</view> <view>开票员身份证号码</view>
<view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.dlzh" <view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.dlzh"
placeholder="请填写" data-key="mobile" /></view> placeholder="开票员身份证号码" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>电子税局密码</view> <view>开票员税局密码</view>
<view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.dlmm" <view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.dlmm"
placeholder="请填写" data-key="mobile" /></view> placeholder="开票员税局密码" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between" @click="showpicker = true"> <view class="Box_box flex-between" @click="showpicker = true">
<view>省份</view> <view>省份</view>
@@ -32,20 +32,26 @@
{{form.provinceno_name || ''}}<u-icon name="arrow-right" color="#999999" size="16"></u-icon> {{form.provinceno_name || ''}}<u-icon name="arrow-right" color="#999999" size="16"></u-icon>
</view> </view>
</view> </view>
<view class="Box_box flex-between" @click="showpickerdlsf = true">
<view>开票员身份</view>
<view class="flex-start">
{{form.dlsf_name || ''}}<u-icon name="arrow-right" color="#999999" size="16"></u-icon>
</view>
</view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>邀请码</view> <view>邀请码</view>
<view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.code" <view class="Box_box_input"><input type="text" maxlength="6" :disabled='disabled' v-model="form.code"
placeholder="请填写" data-key="mobile" /></view> placeholder="请填写邀请码" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>办税人姓名</view> <view>开票员姓名</view>
<view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.taxname" <view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.taxname"
placeholder="请填写" data-key="mobile" /></view> placeholder="请填写开票员姓名" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>办税人手机号码</view> <view>开票员手机号码</view>
<view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.taxphone" <view class="Box_box_input"><input type="text" :disabled='disabled' v-model="form.taxphone"
placeholder="请填写" data-key="mobile" /></view> placeholder="请填写开票员手机号码" data-key="mobile" /></view>
</view> </view>
<view class="Box_box flex-between"> <view class="Box_box flex-between">
<view>验证码</view> <view>验证码</view>
@@ -53,13 +59,12 @@
<input class="Box_box_inpuinputt" type="text" v-model="form.verification" placeholder="请填写" <input class="Box_box_inpuinputt" type="text" v-model="form.verification" placeholder="请填写"
data-key="mobile" /> data-key="mobile" />
<view class="repeats"> <view class="repeats">
<view v-if="showText == true" <view v-if="showText == true" style="padding: 8rpx;background: #288EFB; border-radius: 15rpx;"
style="padding: 8rpx 0;background: #288EFB; border-radius: 15rpx;"
@tap="$u.debounce(CodeRegister, 500)"> @tap="$u.debounce(CodeRegister, 500)">
{{ Recapture }} {{ Recapture }}
</view> </view>
<view v-else <view v-else
style="color: #ccc; background-color: #f9f9f9; padding: 8rpx 0; border-radius: 15rpx;"> style="color: #ccc; background-color: #f9f9f9; padding: 8rpx; border-radius: 15rpx;">
{{ second }}s重新发送 {{ second }}s重新发送
</view> </view>
</view> </view>
@@ -99,6 +104,8 @@
</view> </view>
<u-picker :show="showpicker" :columns="columns" @confirm='confirm' keyName="name" <u-picker :show="showpicker" :columns="columns" @confirm='confirm' keyName="name"
@cancel='showpicker = false'></u-picker> @cancel='showpicker = false'></u-picker>
<u-picker :show="showpickerdlsf" :columns="columnsdlsf" @confirm='confirmdlsf' keyName="name"
@cancel='showpickerdlsf = false'></u-picker>
</view> </view>
</template> </template>
<script> <script>
@@ -110,12 +117,16 @@
data() { data() {
return { return {
showpicker: false, showpicker: false,
showpickerdlsf: false,
disabled: false, disabled: false,
Uploadurlnumber: '', Uploadurlnumber: '',
namelang: '', namelang: '',
merchantAuditStatus: '', merchantAuditStatus: '',
columns: [ columns: [
],
columnsdlsf: [
], ],
codefailed: false, //验证码是否发送成功 codefailed: false, //验证码是否发送成功
store_id: '', store_id: '',
@@ -142,6 +153,7 @@
}, },
onLoad(e) { onLoad(e) {
console.log(e.store) console.log(e.store)
this.onShowdatadlsf()
let data = uni.getStorageSync('form') let data = uni.getStorageSync('form')
console.log(data) console.log(data)
// if (data.status == '0') { // if (data.status == '0') {
@@ -166,6 +178,8 @@
this.form.provinceno_name = data.provinceno_name this.form.provinceno_name = data.provinceno_name
this.form.taxname = data.bsryxm this.form.taxname = data.bsryxm
this.form.taxphone = data.taxphone this.form.taxphone = data.taxphone
this.form.dlsf_name = data.dlsf_name
this.form.dlsf = data.dlsf
} }
}, },
@@ -237,6 +251,13 @@
}); });
return false; return false;
} }
if (this.form.dlsf == null || this.form.dlsf == '') {
uni.showToast({
title: '请选择开票员身份',
icon: 'none'
});
return false;
}
if (this.form.dlmm == null || this.form.dlmm == '') { if (this.form.dlmm == null || this.form.dlmm == '') {
uni.showToast({ uni.showToast({
title: '请填写电子税局账密码', title: '请填写电子税局账密码',
@@ -339,6 +360,17 @@
this.form.provinceno = e.value[0].code this.form.provinceno = e.value[0].code
this.showpicker = false this.showpicker = false
}, },
confirmdlsf(e) {
console.log('confirm', e)
this.form.dlsf = e.value[0].id
this.form.dlsf_name = e.value[0].name
this.showpickerdlsf = false
},
async onShowdatadlsf() {
let res = await this.api.szzpytypeofinvoicer()
console.log(res)
this.columnsdlsf = [res.data]
},
Upload(i) { Upload(i) {
if (this.disabled) { if (this.disabled) {
return false; return false;
@@ -434,7 +466,7 @@
} }
.repeats { .repeats {
width: 280rpx; flex: none;
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN; font-family: Source Han Sans CN-Regular, Source Han Sans CN;

View File

@@ -0,0 +1,282 @@
<template>
<view class="content">
<!-- <view class="content_boxtop flex-between">
<view class="content_boxtopone">
{{datalsit.type}}
</view>
</view> -->
<view class="content_boxt_tow" id="printSection" ref="print">
<view class="content_boxt_towtext">
扫码绑定公众号将会收到通知
</view>
<view class="content_boxt_towrelative" style="242px;height: 242px;">
<canvas id="qrcode" style="242px;height: 242px;" ref="qrcode" canvas-id="qrcode"></canvas>
<image class="content_boxt_towabsolute" src="@/static/icons.png" mode=""></image>
</view>
<button @click="print">打印</button>
</view>
</view>
</template>
<script>
import uQRCode from '@/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js'; // npm install uqrcodejs
export default {
data() {
return {
text: 'uQRCode',
size: 242,
datalsit: {},
ID: '',
resurl: ''
};
},
onLoad(e) {
this.ID = e.id
this.status = e.status
},
onReady() {
setTimeout(() => {
uni.$u.debounce(this.storeinvoicelist(), 500)
}, 500)
},
methods: {
print() {
// const receipt = document.getElementById('receipt');
// const printWindow = window.open('', '_blank');
// printWindow.document.write(receipt.innerHTML);
// printWindow.document.close();
// printWindow.focus();
// printWindow.print();
// printWindow.close();
window.print({
mediaType: 'print',
orientation: 'portrait',
pageSize: '50mm',
printBackground: true,
scale: 0.5
});
},
storeinvoicelist() {
uni.request({
url: uni.conf.baseUrl + 'store/bindinginvopush',
data: {
//参数
store_id: uni.getStorageSync('userId')
},
method: 'POST', //请求方式,必须为大写
success: res => {
this.datalsit = res.data.data.qrcode;
console.log(this.datalsit)
// 获取uQRCode实例
var qr = new uQRCode();
// 设置二维码内容
qr.data = res.data.data.qrcode;
// 设置二维码大小必须与canvas设置的宽高一致
qr.size = this.size;
// 调用制作二维码方法
qr.make();
// 获取canvas上下文
var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件this必须传入
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
}
});
},
savealbum(e) {
uni.pro.navigateBack();
},
// savealbum(e) {
// // #ifdef APP
// uni.showLoading({
// //加载框
// title: '保存中...',
// mask: true
// });
// var pages = getCurrentPages();
// var page = pages[pages.length - 1];
// console.log('当前页' + pages.length - 1);
// var bitmap = null;
// var currentWebview = page.$getAppWebview();
// bitmap = new plus.nativeObj.Bitmap('amway_img');
// // 将webview内容绘制到Bitmap对象中
// currentWebview.draw(
// bitmap,
// function() {
// console.log('截屏绘制图片成功');
// bitmap.save(
// '_doc/a.jpg', {},
// function(i) {
// console.log('保存图片成功:' + JSON.stringify(i));
// uni.saveImageToPhotosAlbum({
// filePath: i.target,
// success: function() {
// bitmap.clear(); //销毁Bitmap图片
// uni.showToast({
// title: '保存图片成功',
// mask: false,
// duration: 1500
// });
// uni.hideLoading();
// }
// });
// },
// function(e) {
// console.log('保存图片失败:' + JSON.stringify(e));
// }
// );
// },
// function(e) {
// console.log('截屏绘制图片失败:' + JSON.stringify(e));
// }
// );
// // #endif
// },
}
}
</script>
<style media="print">
@page {
size: 56mm 60mm;
/* 宽度50mm, 高度100mm */
margin: 0;
}
@media print {
body {
width: 50px;
/* 小票宽度 */
height: 60mm;
/* 小票宽度 */
border: 1px solid #999;
}
#printSection {
width: 60mm;
/* 小票宽度 */
height: 60mm;
/* 小票高度 */
}
}
.content {
padding: 32rpx 28rpx;
.content_boxtop {
padding: 22rpx 16rpx;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
.content_boxtopone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.content_boxtoptow {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
.content_boxt_one {
margin-top: 32rpx;
padding: 32rpx;
border-radius: 18rpx 18rpx 18rpx 18rpx;
background: #FFFFFF;
.content_boxt_oneone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #FF6565;
}
.classvie_item {
margin-top: 16rpx;
.classvie_itemone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #666666;
font-style: normal;
text-transform: none;
}
.classvie_itemtow {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #999999;
font-style: normal;
text-transform: none;
}
}
}
.content_boxt_tow {
margin: 32rpx 0;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding-bottom: 50rpx;
.content_boxt_towtext {
padding-top: 32rpx;
text-align: center;
width: 100%;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #999999;
}
.content_boxt_towtexts {
margin: 50rpx auto 0 auto;
width: 558rpx;
height: 84rpx;
background: #288EFB;
border-radius: 50rpx 50rpx 50rpx 50rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 36rpx;
color: #FFFFFF;
line-height: 84rpx;
text-align: center;
font-style: normal;
}
.content_boxt_towrelative {
position: relative;
width: 242px;
height: 242px;
margin: 32rpx auto;
.content_boxt_towabsolute {
position: absolute;
top: 50%;
left: 50%;
margin-top: -50rpx;
margin-left: -50rpx;
border-radius: 16rpx;
// transform: translate(-50% -50%);
width: 100rpx;
height: 100rpx;
}
}
}
}
</style>

BIN
static/item5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>发票</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>发票</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<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' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.517faf40.js></script><script src=/h5/static/js/index.b0f06631.js></script></body></html> document.write('<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' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.ddf13236.js></script><script src=/h5/static/js/index.b3cb82d5.js></script></body></html>