更新
This commit is contained in:
parent
2d8bc14de2
commit
78b0019cf0
@ -149,7 +149,7 @@
|
||||
</u-button>
|
||||
<u-button class="button" @click="hge=true;getProject(item)"
|
||||
v-if="isExamine && tapValue == '7'" size="10">重审项目</u-button>
|
||||
<u-button class="button" v-if="!detailButtonNoShow.includes(tapValue)"
|
||||
<u-button class="button" v-if="!detailButtonNoShow.includes(tapValue + '')"
|
||||
@click="godetails(item)" size="10">查看详情</u-button>
|
||||
<u-button class="button" v-if="tapValue == '8'" @click="goMeetOrderCreate(item)"
|
||||
size="10">创建订单</u-button>
|
||||
@ -306,7 +306,7 @@
|
||||
meetCarButtonShow: ['6'],
|
||||
adminCanShow: ['7', '8'],
|
||||
leadMeadShow: ['7', '8'],
|
||||
detailButtonNoShow: ['6', '8'],
|
||||
detailButtonNoShow: ['1', '6', '8'],
|
||||
belowStandardShow: ['7', '4'],
|
||||
countMap: [],
|
||||
csId: [],
|
||||
@ -855,7 +855,8 @@
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
userId: this.userId,
|
||||
status: this.tapValue
|
||||
status: this.tapValue,
|
||||
carNum: this.carNum
|
||||
}
|
||||
})
|
||||
if (res.code == 200) {
|
||||
|
@ -1,219 +1,367 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- <view class="top-heder">-->
|
||||
<!-- <view class="t-left" @click="handleBack">-->
|
||||
<!-- <uni-icons type="left" size="18"></uni-icons>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="c-title">个人信息</view>-->
|
||||
<!-- <view style="width: 5%; height: 10px;"></view>-->
|
||||
<!-- </view>-->
|
||||
<view class="content">
|
||||
<!-- <view class="top-heder">-->
|
||||
<!-- <view class="t-left" @click="handleBack">-->
|
||||
<!-- <uni-icons type="left" size="18"></uni-icons>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="c-title">个人信息</view>-->
|
||||
<!-- <view style="width: 5%; height: 10px;"></view>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<headersVue titles="个人信息" style="position: static !important;">
|
||||
<u-icon name="arrow-left" color="#fff" size="18"></u-icon>
|
||||
</headersVue>
|
||||
<headersVue titles="个人信息" style="position: static !important;">
|
||||
<u-icon name="arrow-left" color="#fff" size="18"></u-icon>
|
||||
</headersVue>
|
||||
|
||||
<view class="body">
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="@/static/icons/userInfo_1.png"></image>
|
||||
<text class="formLabel">头像</text>
|
||||
<view class="formValue">
|
||||
<image style="width: 64rpx;height: 64rpx;border-radius: 50%;"
|
||||
v-if="customInfo && customInfo.avatar === null" :src="defaultAvatar" mode="scaleToFill" class="avatar"></image>
|
||||
<image v-else :src="customInfo.avatar" class="avatar" mode="scaleToFill"
|
||||
style="width: 64rpx;height: 64rpx;border-radius: 50%;"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="@/static/icons/userInfo_2.png"></image>
|
||||
<text class="formLabel">账号昵称</text>
|
||||
<text class="formValue">{{ customInfo.nickname }}</text>
|
||||
<!-- <u-icon color="#999" name="arrow-right" size="12"></u-icon>-->
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="@/static/icons/userInfo_3.png"></image>
|
||||
<text class="formLabel">绑定电话</text>
|
||||
<text class="formValue">{{ customInfo.mobile }}</text>
|
||||
<!-- <u-icon color="#999" name="arrow-right" size="12"></u-icon>-->
|
||||
</view>
|
||||
<!-- <view class="formItem" v-if="showUniCode">-->
|
||||
<!-- <image class="formIcon" mode="aspectFit" src="@/static/icons/userInfo_3.png"></image>-->
|
||||
<!-- <text class="formLabel">我的邀请码</text>-->
|
||||
<!-- <text class="formValue"></text>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem" v-if="showUniCode">-->
|
||||
<!-- <canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;margin: auto"></canvas>-->
|
||||
<!-- <!– <image style="width: 200px; height: 200px;margin: auto" class="formIcon" mode="scaleToFill" src="@/pages-home/static/yaoqingma.png"></image>–>-->
|
||||
<!-- </view>-->
|
||||
<view class="body">
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="@/static/icons/userInfo_1.png"></image>
|
||||
<text class="formLabel">头像</text>
|
||||
<view class="formValue">
|
||||
<image style="width: 64rpx;height: 64rpx;border-radius: 50%;"
|
||||
v-if="customInfo && customInfo.avatar === null" :src="defaultAvatar" mode="scaleToFill"
|
||||
class="avatar"></image>
|
||||
<image v-else :src="customInfo.avatar" class="avatar" mode="scaleToFill"
|
||||
style="width: 64rpx;height: 64rpx;border-radius: 50%;"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="@/static/icons/userInfo_2.png"></image>
|
||||
<text class="formLabel">账号昵称</text>
|
||||
<text class="formValue">{{ customInfo.nickname }}</text>
|
||||
<!-- <u-icon color="#999" name="arrow-right" size="12"></u-icon>-->
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="@/static/icons/userInfo_3.png"></image>
|
||||
<text class="formLabel">绑定电话</text>
|
||||
<text class="formValue">{{ customInfo.mobile }}</text>
|
||||
<!-- <u-icon color="#999" name="arrow-right" size="12"></u-icon>-->
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="../../static/icons/userInfo_3.png"></image>
|
||||
<text class="formLabel">我的邀请码</text>
|
||||
<text class="formValue"></text>
|
||||
</view>
|
||||
<view style="padding-bottom: 60rpx;" class="formItem">
|
||||
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;margin: auto"
|
||||
@longpress="saveQRCode"></canvas>
|
||||
</view>
|
||||
<text
|
||||
style="display: block; font-weight: bold; text-align: center; color: #000000; font-size: 30rpx; border-bottom: 1px solid #ddd;">
|
||||
长按邀请码可保存到相册
|
||||
</text>
|
||||
<canvas canvas-id="saveCanvas"
|
||||
style="position: fixed; left: -9999px; width: 240px; height: 240px;"></canvas>
|
||||
|
||||
<view class="btns">
|
||||
<view class="btn" @click="logout">
|
||||
退出登录
|
||||
</view>
|
||||
<view class="btn" @click="changePassword">
|
||||
修改密码
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btns">
|
||||
<view class="btn" @click="logout">
|
||||
退出登录
|
||||
</view>
|
||||
<view class="btn" @click="changePassword">
|
||||
修改密码
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-popup ref="alertDialog" type="dialog">
|
||||
<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="同意" title="通知" content="您确认要退出登录吗" @confirm="dialogConfirm"
|
||||
@close="dialogClose"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
<uni-popup ref="alertDialog" type="dialog">
|
||||
<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="同意" title="通知" content="您确认要退出登录吗"
|
||||
@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getStorageWithExpiry, setStorageWithExpiry} from "../../utils/auth";
|
||||
import request from '../../utils/request';
|
||||
import config from '@/config'
|
||||
import headersVue from "@/components/header/headers.vue";
|
||||
export default {
|
||||
name: "UserInfo",
|
||||
components: {headersVue},
|
||||
data(){
|
||||
return{
|
||||
customInfo: {},
|
||||
defaultAvatar: require('@/static/icons/avatar.png'),
|
||||
msgType: 'success',
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
this.getCustomInfo()
|
||||
},
|
||||
methods:{
|
||||
changePassword(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/Login/modify'
|
||||
})
|
||||
},
|
||||
dialogConfirm() {
|
||||
uni.clearStorageSync();
|
||||
uni.reLaunch({
|
||||
url:'/pages/Login/login'
|
||||
})
|
||||
import {
|
||||
getStorageWithExpiry,
|
||||
setStorageWithExpiry
|
||||
} from "../../utils/auth";
|
||||
import request from '../../utils/request';
|
||||
import config from '@/config'
|
||||
const UQRCode = require('uqrcodejs');
|
||||
import headersVue from "@/components/header/headers.vue";
|
||||
export default {
|
||||
name: "UserInfo",
|
||||
components: {
|
||||
headersVue
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
customInfo: {},
|
||||
defaultAvatar: require('@/static/icons/avatar.png'),
|
||||
msgType: 'success',
|
||||
shareUrl: config.shareUrl,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getCustomInfo()
|
||||
},
|
||||
methods: {
|
||||
changePassword() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/Login/modify'
|
||||
})
|
||||
},
|
||||
dialogConfirm() {
|
||||
uni.clearStorageSync();
|
||||
uni.reLaunch({
|
||||
url: '/pages/Login/login'
|
||||
})
|
||||
|
||||
},
|
||||
dialogClose() {
|
||||
},
|
||||
logout(){
|
||||
this.$refs.alertDialog.open()
|
||||
},
|
||||
getCustomInfo(){
|
||||
let roleNames = getStorageWithExpiry("roleNames")
|
||||
if (!roleNames){
|
||||
request({
|
||||
url: '/inspection/util/getRoleName',
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
roleNames = res.data
|
||||
setStorageWithExpiry("roleNames", roleNames)
|
||||
})
|
||||
}
|
||||
const data = getStorageWithExpiry("userInfo")
|
||||
if (!data) {
|
||||
request({
|
||||
url: '/system/user/profile/get',
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.customInfo = res.data
|
||||
if (this.customInfo.avatar) {
|
||||
this.customInfo.avatar = config.baseImageUrl + this.customInfo.avatar
|
||||
}
|
||||
this.customInfo.roleNames = roleNames
|
||||
setStorageWithExpiry("userInfo", this.customInfo)
|
||||
})
|
||||
} else {
|
||||
this.customInfo = data
|
||||
}
|
||||
},
|
||||
handleBack(){
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
dialogClose() {},
|
||||
logout() {
|
||||
this.$refs.alertDialog.open()
|
||||
},
|
||||
getCustomInfo() {
|
||||
let roleNames = getStorageWithExpiry("roleNames")
|
||||
if (!roleNames) {
|
||||
request({
|
||||
url: '/inspection/util/getRoleName',
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
roleNames = res.data
|
||||
setStorageWithExpiry("roleNames", roleNames)
|
||||
})
|
||||
}
|
||||
const data = getStorageWithExpiry("userInfo")
|
||||
if (!data || !data.uniqueCode) {
|
||||
request({
|
||||
url: '/inspectionStaff/get',
|
||||
method: 'get',
|
||||
params: {
|
||||
id: uni.getStorageSync('userId')
|
||||
}
|
||||
}).then(res => {
|
||||
this.customInfo = res.data
|
||||
if (this.customInfo.avatar) {
|
||||
this.customInfo.avatar = config.baseImageUrl + this.customInfo.avatar
|
||||
}
|
||||
this.customInfo.roleNames = roleNames
|
||||
setStorageWithExpiry("userInfo", this.customInfo)
|
||||
this.generateUniCode(this.customInfo.uniqueCode)
|
||||
})
|
||||
} else {
|
||||
this.customInfo = data
|
||||
this.generateUniCode(this.customInfo.uniqueCode)
|
||||
}
|
||||
},
|
||||
handleBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
generateUniCode(code) {
|
||||
this.$nextTick(() => {
|
||||
// 获取uQRCode实例
|
||||
const qr = new UQRCode();
|
||||
// 设置二维码内容
|
||||
qr.data = this.shareUrl + code;
|
||||
// 设置二维码大小,必须与canvas设置的宽高一致
|
||||
qr.size = 200;
|
||||
// 调用制作二维码方法
|
||||
qr.make();
|
||||
// 获取canvas上下文
|
||||
const canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入
|
||||
// 设置uQRCode实例的canvas上下文
|
||||
qr.canvasContext = canvasContext;
|
||||
// 调用绘制方法将二维码图案绘制到canvas上
|
||||
qr.drawCanvas();
|
||||
})
|
||||
},
|
||||
// 弹窗提示
|
||||
saveQRCode() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要保存邀请码到相册吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.doSaveQRCode();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 保存邀请码
|
||||
async doSaveQRCode() {
|
||||
uni.showLoading({
|
||||
title: '保存中...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
try {
|
||||
// 获取原始二维码图片路径
|
||||
const tempPath = await this.getCanvasTempPath('qrcode');
|
||||
|
||||
// 创建一个带留白的新canvas
|
||||
const paddedPath = await this.createPaddedImage(tempPath);
|
||||
|
||||
// 保存带留白的图片
|
||||
await this.saveToAlbum(paddedPath);
|
||||
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success'
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('保存失败:', err);
|
||||
uni.showToast({
|
||||
title: '保存失败: ' + (err.errMsg || '未知错误'),
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
getCanvasTempPath(canvasId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: canvasId,
|
||||
success: resolve,
|
||||
fail: reject
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
createPaddedImage(tempPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const padding = 20; // 留白大小(单位:px)
|
||||
const qrSize = 200; // 二维码原始大小
|
||||
const canvasSize = qrSize + padding * 2; // 带留白的总大小
|
||||
const nameHeight = 30; // 姓名区域高度
|
||||
const totalHeight = canvasSize + nameHeight; // 总高度(二维码 + 姓名)
|
||||
|
||||
const ctx = uni.createCanvasContext('saveCanvas', this);
|
||||
|
||||
// 1. 绘制白色背景(扩展到包含姓名区域)
|
||||
ctx.setFillStyle('#ffffff');
|
||||
ctx.fillRect(0, 0, canvasSize, totalHeight);
|
||||
|
||||
// 2. 绘制姓名(居中显示)
|
||||
ctx.setFontSize(16); // 字体大小
|
||||
ctx.setFillStyle('#000000'); // 字体颜色
|
||||
ctx.setTextAlign('center'); // 水平居中
|
||||
console.log('当前信息', this.customInfo);
|
||||
ctx.fillText(this.customInfo.nickname || '未设置姓名', canvasSize / 2, nameHeight - 5);
|
||||
|
||||
// 3. 绘制二维码(在姓名下方)
|
||||
ctx.drawImage(tempPath.tempFilePath, padding, nameHeight, qrSize, qrSize);
|
||||
|
||||
ctx.draw(false, () => {
|
||||
setTimeout(() => {
|
||||
this.getCanvasTempPath('saveCanvas')
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
},
|
||||
saveToAlbum(filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: filePath.tempFilePath,
|
||||
success: resolve,
|
||||
fail: (err) => {
|
||||
// 处理权限问题
|
||||
if (err.errMsg.includes('auth')) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要相册权限才能保存图片',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.openSetting();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.top-heder{
|
||||
width: 100%;
|
||||
height: 88px;
|
||||
background: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 5px 15px;
|
||||
padding-top: 45px;
|
||||
}
|
||||
.t-left{
|
||||
width: 10%;
|
||||
}
|
||||
.c-title{
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
.body {
|
||||
border-top: 1px solid #ddd;
|
||||
padding: 20rpx 32rpx;
|
||||
}
|
||||
.top-heder {
|
||||
width: 100%;
|
||||
height: 88px;
|
||||
background: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 5px 15px;
|
||||
padding-top: 45px;
|
||||
}
|
||||
|
||||
.formItem {
|
||||
box-sizing: border-box;
|
||||
padding: 40rpx 0;
|
||||
.t-left {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
column-gap: 20rpx;
|
||||
}
|
||||
.c-title {
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.formIcon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
}
|
||||
.body {
|
||||
border-top: 1px solid #ddd;
|
||||
padding: 20rpx 32rpx;
|
||||
}
|
||||
|
||||
.formLabel {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.formItem {
|
||||
box-sizing: border-box;
|
||||
padding: 40rpx 0;
|
||||
|
||||
.formValue {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
text-align: right;
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
column-gap: 20rpx;
|
||||
}
|
||||
|
||||
.formBtn {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
.formIcon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 108rpx;
|
||||
height: 108rpx;
|
||||
}
|
||||
.formLabel {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 520rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx 40rpx 40rpx 40rpx;
|
||||
border: 1rpx solid #999999;
|
||||
.formValue {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
text-align: right;
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
margin: 60rpx auto;
|
||||
.formBtn {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.avatar {
|
||||
width: 108rpx;
|
||||
height: 108rpx;
|
||||
}
|
||||
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.btn {
|
||||
width: 520rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx 40rpx 40rpx 40rpx;
|
||||
border: 1rpx solid #999999;
|
||||
|
||||
.btns{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
||||
margin: 60rpx auto;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.btns {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
@ -340,7 +340,6 @@
|
||||
this.businessChannelId = result.parent.id
|
||||
this.cssj = this.customerSourceId
|
||||
}
|
||||
console.log(this.customerSource, this.businessChannel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
<text>来源:</text>
|
||||
<text>{{ detailData.customerSource }}</text>
|
||||
</view>
|
||||
<view class="dis-hui" v-if="roleSelect == 'shop'">
|
||||
<view class="dis-hui" v-if="roleSelect == 'shop' || roleType == 'business'">
|
||||
<text>¥:</text>
|
||||
<text>{{ detailData.goodsPrice / 100 }}元</text>
|
||||
</view>
|
||||
@ -408,6 +408,7 @@
|
||||
fileList2: [],
|
||||
shelist: [],
|
||||
type: 1,
|
||||
roleType: 1,
|
||||
isPass: "1",
|
||||
remark: '',
|
||||
csId: [],
|
||||
@ -453,6 +454,7 @@
|
||||
this.roleSelect = res.data
|
||||
}
|
||||
})
|
||||
this.roleType = option.type
|
||||
if (option.type == 'staff') {
|
||||
const res = await ifHasRoleByDictType("inspection_detail_view")
|
||||
this.isShowClient = res
|
||||
|
@ -26,7 +26,7 @@
|
||||
<!-- 店铺商铺 -->
|
||||
|
||||
<!-- -->
|
||||
<view class="ian-box">
|
||||
<view class="ian-box" v-if="showCheckout">
|
||||
<!-- <view class="on-input" @click="golieb()">
|
||||
<view class="dix">
|
||||
<view class="d-icon">
|
||||
@ -132,7 +132,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="on-input" @click="checkoutRole()">
|
||||
<view class="on-input" @click="checkoutRole()" v-if="showCheckout">
|
||||
<view class="dix">
|
||||
<view class="d-icon">
|
||||
<image src="../../static/detection/tc.png" mode=""></image>
|
||||
@ -144,6 +144,23 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ian-box">
|
||||
<view class="formItem">
|
||||
<image class="formIcon" mode="aspectFit" src="../../static/icons/userInfo_3.png"></image>
|
||||
<text class="formLabel">我的邀请码</text>
|
||||
<text class="formValue"></text>
|
||||
</view>
|
||||
<view style="padding-bottom: 60rpx;" class="formItem">
|
||||
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;margin: auto"
|
||||
@longpress="saveQRCode"></canvas>
|
||||
</view>
|
||||
<text
|
||||
style="display: block; font-weight: bold; text-align: center; color: #000000; font-size: 30rpx; border-bottom: 1px solid #ddd;">
|
||||
长按邀请码可保存到相册
|
||||
</text>
|
||||
<canvas canvas-id="saveCanvas"
|
||||
style="position: fixed; left: -9999px; width: 240px; height: 240px;"></canvas>
|
||||
</view>
|
||||
</view>
|
||||
<uni-popup ref="alertDialog" type="dialog">
|
||||
<uni-popup-dialog cancelText="关闭" confirmText="同意" title="通知" content="您确认要退出吗!" @confirm="dialogConfirm"
|
||||
@ -161,6 +178,7 @@
|
||||
<script>
|
||||
import config from '@/config'
|
||||
import request from '../../utils/request';
|
||||
const UQRCode = require('uqrcodejs');
|
||||
import tabBar from '../../components/staffTabBer/tabBar.vue'
|
||||
|
||||
export default {
|
||||
@ -172,7 +190,9 @@
|
||||
chooseIdx: undefined,
|
||||
partnerId: '',
|
||||
myindex: {},
|
||||
lookAppointment: false
|
||||
lookAppointment: false,
|
||||
shareUrl: config.shareUrl,
|
||||
showCheckout: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -199,6 +219,24 @@
|
||||
url: '/pages/modifyPassword/modifyPassword' // 修改密码页面路径
|
||||
});
|
||||
},
|
||||
generateUniCode(code) {
|
||||
this.$nextTick(() => {
|
||||
// 获取uQRCode实例
|
||||
const qr = new UQRCode();
|
||||
// 设置二维码内容
|
||||
qr.data = this.shareUrl + code;
|
||||
// 设置二维码大小,必须与canvas设置的宽高一致
|
||||
qr.size = 200;
|
||||
// 调用制作二维码方法
|
||||
qr.make();
|
||||
// 获取canvas上下文
|
||||
const canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入
|
||||
// 设置uQRCode实例的canvas上下文
|
||||
qr.canvasContext = canvasContext;
|
||||
// 调用绘制方法将二维码图案绘制到canvas上
|
||||
qr.drawCanvas();
|
||||
})
|
||||
},
|
||||
dialogConfirm() {
|
||||
this.tui()
|
||||
this.$refs.alertDialog.close()
|
||||
@ -232,7 +270,7 @@
|
||||
}
|
||||
setTimeout(function() {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
}, 500);
|
||||
this.chooseIdx = uni.getStorageSync("chooseIdx")
|
||||
},
|
||||
dialogClose() {
|
||||
@ -247,11 +285,21 @@
|
||||
// })
|
||||
// this.myindex = res.data
|
||||
let ress = await request({
|
||||
url: '/system/user/profile/get',
|
||||
url: '/inspectionStaff/get',
|
||||
method: 'get',
|
||||
params: {
|
||||
id: uni.getStorageSync('userId')
|
||||
}
|
||||
})
|
||||
console.log('个人信息', ress.data)
|
||||
this.user = ress.data
|
||||
this.generateUniCode(ress.data.uniqueCode)
|
||||
// 判断角色是否只有一个业务经理
|
||||
if (ress.data.userRoles.length == 1 && ress.data.userRoles[0].roleCode == 'jcywjl') {
|
||||
this.showCheckout = false
|
||||
} else {
|
||||
this.showCheckout = true
|
||||
}
|
||||
},
|
||||
tui() {
|
||||
uni.clearStorageSync();
|
||||
@ -297,7 +345,115 @@
|
||||
uni.navigateTo({
|
||||
url: "/pages/my/shoporder"
|
||||
})
|
||||
}
|
||||
},
|
||||
// 弹窗提示
|
||||
saveQRCode() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要保存邀请码到相册吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.doSaveQRCode();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 保存邀请码
|
||||
async doSaveQRCode() {
|
||||
uni.showLoading({
|
||||
title: '保存中...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
try {
|
||||
// 获取原始二维码图片路径
|
||||
const tempPath = await this.getCanvasTempPath('qrcode');
|
||||
|
||||
// 创建一个带留白的新canvas
|
||||
const paddedPath = await this.createPaddedImage(tempPath);
|
||||
|
||||
// 保存带留白的图片
|
||||
await this.saveToAlbum(paddedPath);
|
||||
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success'
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('保存失败:', err);
|
||||
uni.showToast({
|
||||
title: '保存失败: ' + (err.errMsg || '未知错误'),
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
getCanvasTempPath(canvasId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: canvasId,
|
||||
success: resolve,
|
||||
fail: reject
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
createPaddedImage(tempPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const padding = 20; // 留白大小(单位:px)
|
||||
const qrSize = 200; // 二维码原始大小
|
||||
const canvasSize = qrSize + padding * 2; // 带留白的总大小
|
||||
const nameHeight = 30; // 姓名区域高度
|
||||
const totalHeight = canvasSize + nameHeight; // 总高度(二维码 + 姓名)
|
||||
|
||||
const ctx = uni.createCanvasContext('saveCanvas', this);
|
||||
|
||||
// 1. 绘制白色背景(扩展到包含姓名区域)
|
||||
ctx.setFillStyle('#ffffff');
|
||||
ctx.fillRect(0, 0, canvasSize, totalHeight);
|
||||
|
||||
// 2. 绘制姓名(居中显示)
|
||||
ctx.setFontSize(16); // 字体大小
|
||||
ctx.setFillStyle('#000000'); // 字体颜色
|
||||
ctx.setTextAlign('center'); // 水平居中
|
||||
ctx.fillText(this.user.nickname || '未设置姓名', canvasSize / 2, nameHeight - 5);
|
||||
|
||||
// 3. 绘制二维码(在姓名下方)
|
||||
ctx.drawImage(tempPath.tempFilePath, padding, nameHeight, qrSize, qrSize);
|
||||
|
||||
ctx.draw(false, () => {
|
||||
setTimeout(() => {
|
||||
this.getCanvasTempPath('saveCanvas')
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
},
|
||||
saveToAlbum(filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: filePath.tempFilePath,
|
||||
success: resolve,
|
||||
fail: (err) => {
|
||||
// 处理权限问题
|
||||
if (err.errMsg.includes('auth')) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '需要相册权限才能保存图片',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.openSetting();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -555,6 +711,39 @@
|
||||
}
|
||||
}
|
||||
|
||||
.formItem {
|
||||
box-sizing: border-box;
|
||||
padding: 40rpx 0;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
column-gap: 20rpx;
|
||||
}
|
||||
|
||||
.formIcon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
}
|
||||
|
||||
.formLabel {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.formValue {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
text-align: right;
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.formBtn {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
//.edit-button:hover {
|
||||
// text-decoration: underline;
|
||||
//}
|
||||
|
@ -22,6 +22,21 @@
|
||||
<view class="">{{ data2.jxzNum || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="d_b"
|
||||
style="border-top: 1px solid #F5F5F5; margin-top: 30rpx;box-sizing: border-box;padding-top: 30rpx;">
|
||||
<view class="three_" @click="goOrderList">
|
||||
<view class="text_">重检数量</view>
|
||||
<view class="">{{ data2.reinspectNum|| 0 }}</view>
|
||||
</view>
|
||||
<view class="three_">
|
||||
<view class="text_">复检数量</view>
|
||||
<view class="">{{ data2.recheckNum || 0 }}</view>
|
||||
</view>
|
||||
<view class="three_">
|
||||
<view class="text_">退办理数量</view>
|
||||
<view class="">{{ data2.tblNum || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title_">营业额统计</view>
|
||||
<view class="box_">
|
||||
@ -48,6 +63,7 @@
|
||||
</view>
|
||||
<view class="title_">业务渠道统计</view>
|
||||
<view class="box_" v-if="data3.length > 0">
|
||||
<uni-datetime-picker v-model="businessRange" type="daterange" @maskClick="maskBusinessClick" />
|
||||
<view class="box_top">
|
||||
<view class="l_">业务渠道</view>
|
||||
<view class="n_">数量</view>
|
||||
@ -157,6 +173,7 @@
|
||||
data5: '',
|
||||
fileRes: {},
|
||||
range: ['2023-9-28', '2023-10-7'],
|
||||
businessRange: ['2023-9-28', '2023-10-7'],
|
||||
ranges: ['2023-9-28', '2023-10-7'],
|
||||
//检测类型统计
|
||||
skuList: [],
|
||||
@ -282,6 +299,9 @@
|
||||
ranges(newval) {
|
||||
this.getfive()
|
||||
},
|
||||
businessRange(newval) {
|
||||
this.getfive()
|
||||
},
|
||||
},
|
||||
async onLoad() {
|
||||
//显示加载框
|
||||
@ -385,12 +405,13 @@
|
||||
var currentTime = year + '-' + month + '-' + date
|
||||
this.range[0] = currentTime
|
||||
this.range[1] = currentTime
|
||||
this.businessRange[0] = currentTime
|
||||
this.businessRange[1] = currentTime
|
||||
this.ranges[0] = currentTime
|
||||
this.ranges[1] = currentTime
|
||||
},
|
||||
// 五条
|
||||
async getfive() {
|
||||
|
||||
let data1 = {
|
||||
startTime: this.range[0],
|
||||
endTime: this.range[1]
|
||||
@ -493,6 +514,9 @@
|
||||
})
|
||||
},
|
||||
maskClick(e) {},
|
||||
maskBusinessClick() {
|
||||
|
||||
},
|
||||
// 折线图
|
||||
async chartLineInspectionAmount() {
|
||||
let data = {
|
||||
|
@ -364,6 +364,7 @@
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
this.datas = []
|
||||
if (this.type == 'add') {
|
||||
this.datas = res.data.insertFile
|
||||
} else {
|
||||
@ -388,6 +389,9 @@
|
||||
if (this.id == 5) {
|
||||
this.getCustomerSourceCount()
|
||||
}
|
||||
if (this.id == 6) {
|
||||
this.getFileBytype()
|
||||
}
|
||||
},
|
||||
getback() {
|
||||
uni.navigateBack()
|
||||
|
Loading…
Reference in New Issue
Block a user