Commit acd76905 authored by youjie's avatar youjie

修复

parent 756cee67
......@@ -61,8 +61,9 @@
<swiper :indicator-dots="false" circular style="height:500rpx;width:500rpx" :current="current"
@change="changeHandler">
<swiper-item v-for="(item, index) in list" :key="index">
<canvas :canvas-id="`firstCanvas_${index}`" class="sty-box"
@error="(e)=>canvasIdErrorCallback(e,index)"></canvas>
<!-- <canvas :canvas-id="`firstCanvas_${index}`" class="sty-box"
@error="(e)=>canvasIdErrorCallback(e,index)"></canvas> -->
<image class="sty-box" mode="aspectFit" :src="item.Url" />
</swiper-item>
</swiper>
</view>
......@@ -133,14 +134,16 @@
let findIndex = this.BaseInfo.findIndex(item => item.TCIDS == x)
this.list.push({
Url: 'data:image/png;base64,' + res.data,
data: res.data,
TCID: x,
TCNUMS: this.BaseInfo[findIndex].TCNUMS
})
if (this.list.length == this.TCIDsList.length) {
uni.hideLoading()
this.currencyVisible = true
this.list.forEach((x, i) => {
this.drawCtx(i)
})
// this.list.forEach((x, i) => {
// this.drawCtx(i)
// })
}
}
})
......@@ -153,9 +156,9 @@
let ctx = uni.createCanvasContext(`firstCanvas_${i}`, this);
let that = this;
ctx.drawImage(that.list[i].Url, 0, 0, 250, 250); //绘制图
that.drawQrCode(ctx)
that.drawQrCode(ctx,i)
},
drawQrCode(ctx) {
drawQrCode(ctx,i) {
let that = this;
setTimeout(() => {
ctx.draw(false, () => {
......@@ -166,7 +169,7 @@
height: 1344,
destWidth: 750.0,
destHeight: 1344.0,
canvasId: "firstCanvas",
canvasId: `firstCanvas_${i}`,
success: (res) => {
uni.hideLoading();
// that.tempPic = res.tempFilePath;
......@@ -182,7 +185,35 @@
}, 200)
},
preservation() {
let that = this;
let that= this
// 1. 清理 Base64 前缀(如 data:image/png;base64,)
const base64Data = this.list[this.current].data
// 2. 解码 Base64 为二进制字符串
// 3. 转换为 Uint8Array(二进制数组)
const arrayBuffer = wx.base64ToArrayBuffer(base64Data);
// 3. 转换为临时文件路径(微信小程序需通过临时文件)
const tempDir = wx.env.USER_DATA_PATH; // 临时目录(无需权限)
const fileName = `temp_${Date.now()}.png`;
const filePath = `${tempDir}/${fileName}`;
// 4. 写入临时文件(使用 uni.getFileSystemManager)
const fs = uni.getFileSystemManager();
fs.writeFile({
filePath: filePath,
data: arrayBuffer, // 直接写入 ArrayBuffer
encoding: 'binary', // 必须指定为 binary
success: () => {
uni.showToast({ title: '临时文件路径:' + filePath });
// 可选:保存到相册(需授权)
that.saveFileToPhone(filePath);
},
fail: (err) => {
uni.showToast({ title: '写入失败', icon: 'none' });
console.error('写入错误', err);
}
});
return
uni.canvasToTempFilePath({
canvasId: `firstCanvas_${that.current}`,
success: (res) => {
......@@ -260,6 +291,31 @@
);
},
base64ToBlob(base64Data, mimeType) {
// 解码 Base64 数据
const byteString = atob(base64Data);
// 计算字节长度
const arrayBuffer = new ArrayBuffer(byteString.length);
const uintArray = new Uint8Array(arrayBuffer);
// 填充字节数据
for (let i = 0; i < byteString.length; i++) {
uintArray[i] = byteString.charCodeAt(i);
}
// 创建 Blob 对象(指定 MIME 类型)
return new Blob([arrayBuffer], { type: mimeType });
},
saveFileToPhone(tempFilePath) {
uni.saveFile({
tempFilePath: tempFilePath,
success: (saveRes) => {
uni.showToast({ title: '文件已保存至:' + saveRes.savedFilePath });
},
fail: (err) => {
uni.showToast({ title: '保存失败', icon: 'none' });
console.error('保存错误', err);
}
});
},
canvasIdErrorCallback: function(e, index) {
console.error(e.detail.errMsg, '---index', index);
}
......
......@@ -177,7 +177,7 @@
<text>金额</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
......@@ -189,7 +189,7 @@
<text>返佣</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.Rebate"
@input="handleInput($event,item,index,'Rebate')"
@blur="handleBlur(item,index,'Rebate')" />
......
......@@ -149,7 +149,7 @@
<text>金额</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
......
......@@ -149,7 +149,7 @@
<text>金额</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
......
......@@ -168,7 +168,7 @@
<text>金额</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
......
......@@ -159,7 +159,7 @@
<text>金额</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
......@@ -171,7 +171,7 @@
<text>返佣</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.Rebate"
@input="handleInput($event,item,index,'Rebate')"
@blur="handleBlur(item,index,'Rebate')" />
......
......@@ -168,7 +168,7 @@
<!--其他线路填写购物店-->
<view v-else>
<view class="inputBoxRight">
<input class="text-right" type="text" v-model="item.ShopName" />
<input class="text-right" placeholder="请输入购物店名称" type="text" v-model="item.ShopName" />
</view>
</view>
</view>
......@@ -186,7 +186,7 @@
<text>金额</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.ShopMoney"
@input="handleInput($event,item,index,'ShopMoney')"
@blur="handleBlur(item,index,'ShopMoney')" />
......
......@@ -112,19 +112,19 @@
color: red;
}
.inputBoxRight {
position: relative;
}
// .inputBoxRight {
// position: relative;
// }
.inputBoxRight u-number-box{
position: absolute;
right: 0;
top: -7rpx;
}
/deep/.inputBoxRight u-number-box input{
width: 130rpx !important;
min-width: 130rpx !important;
}
// .inputBoxRight u-number-box{
// position: absolute;
// right: 0;
// top: -7rpx;
// }
// /deep/.inputBoxRight u-number-box input{
// width: 130rpx !important;
// min-width: 130rpx !important;
// }
.inforCenterTopDel {
position: absolute;
......@@ -164,7 +164,8 @@
<text>数量</text>
</view>
<view class="inputBoxRight">
<u-number-box :min="0" v-model="item.UserNum" @change="(e)=>getNum(e,index)"/>
<input class="text-right" type="number" v-model="item.UserNum"
@input="getTotal()"/>
</view>
</view>
<view class="inputBox row justify-between">
......@@ -172,17 +173,17 @@
<text>金额</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
@input="handleInput($event,item,'UnitPrice',1)"
@blur="handleBlur(item,'UnitPrice',1)" />
</view>
</view>
<view class="inputBox row justify-between noBorder">
<view class="row">
<text>金额小计</text>
</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2) }}</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2)?(item.UserNum*item.UnitPrice).toFixed(2):0 }}</view>
</view>
</view>
</view>
......@@ -279,24 +280,24 @@
this.getTotal()
},
// 在模板中的使用示例
handleInput(e,item,index,field) {
handleInput(e,item,field,type) {
const value = e.detail.value
if(this.$utils.checkIsNum(value)){
item[field] = value
this.getTotal()
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
},
handleBlur(item,index,field) {
handleBlur(item,field,type) {
if(this.$utils.checkIsNum(item[field])){
this.getTotal();
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
......
......@@ -112,20 +112,20 @@
color: red;
}
.inputBoxRight {
position: relative;
}
// .inputBoxRight {
// position: relative;
// }
.inputBoxRight u-number-box {
position: absolute;
right: 0;
top: -7rpx;
}
// .inputBoxRight u-number-box {
// position: absolute;
// right: 0;
// top: -7rpx;
// }
/deep/.inputBoxRight u-number-box input {
width: 130rpx !important;
min-width: 130rpx !important;
}
// /deep/.inputBoxRight u-number-box input {
// width: 130rpx !important;
// min-width: 130rpx !important;
// }
.inforCenterTopDel {
position: absolute;
......@@ -154,7 +154,8 @@
<text>数量</text>
</view>
<view class="inputBoxRight">
<u-number-box :min="0" v-model="item.UserNum" @change="(e)=>getNum(e,index)"/>
<input class="text-right" type="number" v-model="item.UserNum"
@input="getTotal()"/>
</view>
</view>
<view class="inputBox row justify-between">
......@@ -162,10 +163,10 @@
<text>单价</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
@input="handleInput($event,item,'UnitPrice',1)"
@blur="handleBlur(item,'UnitPrice',1)" />
<!--<input class="text-right" type="text" v-model="item.UnitPrice" @input="getNum()" />-->
</view>
</view>
......@@ -173,7 +174,7 @@
<view class="row">
<text>金额小计</text>
</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2) }}</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2)?(item.UserNum*item.UnitPrice).toFixed(2):0 }}</view>
</view>
</view>
</view>
......@@ -285,24 +286,24 @@
this.getTotal()
},
// 在模板中的使用示例
handleInput(e,item,index,field) {
handleInput(e,item,field,type) {
const value = e.detail.value
if(this.$utils.checkIsNum(value)){
item[field] = value
this.getTotal()
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
},
handleBlur(item,index,field) {
handleBlur(item,field,type) {
if(this.$utils.checkIsNum(item[field])){
this.getTotal();
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
......
......@@ -112,20 +112,20 @@
color: red;
}
.inputBoxRight {
position: relative;
}
// .inputBoxRight {
// position: relative;
// }
.inputBoxRight u-number-box {
position: absolute;
right: 0;
top: -7rpx;
}
// .inputBoxRight u-number-box {
// position: absolute;
// right: 0;
// top: -7rpx;
// }
/deep/.inputBoxRight u-number-box input {
width: 130rpx !important;
min-width: 130rpx !important;
}
// /deep/.inputBoxRight u-number-box input {
// width: 130rpx !important;
// min-width: 130rpx !important;
// }
.inforCenterTopDel {
position: absolute;
......@@ -154,7 +154,8 @@
<text>数量</text>
</view>
<view class="inputBoxRight">
<u-number-box :min="0" v-model="item.UserNum" @change="(e)=>getNum(e,index)"/>
<input class="text-right" type="number" v-model="item.UserNum"
@input="getTotal()" />
</view>
</view>
<view class="inputBox row justify-between">
......@@ -162,7 +163,7 @@
<text>单价</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
......@@ -172,7 +173,7 @@
<view class="row">
<text>金额小计</text>
</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2) }}</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2)?(item.UserNum*item.UnitPrice).toFixed(2):0 }}</view>
</view>
</view>
</view>
......@@ -284,24 +285,24 @@
this.getTotal()
},
// 在模板中的使用示例
handleInput(e,item,index,field) {
handleInput(e,item,field,type) {
const value = e.detail.value
if(this.$utils.checkIsNum(value)){
item[field] = value
this.getTotal()
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
},
handleBlur(item,index,field) {
handleBlur(item,field,type) {
if(this.$utils.checkIsNum(item[field])){
this.getTotal();
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
......
......@@ -112,20 +112,20 @@
color: red;
}
.inputBoxRight {
position: relative;
}
// .inputBoxRight {
// position: relative;
// }
.inputBoxRight u-number-box {
position: absolute;
right: 0;
top: -7rpx;
}
// .inputBoxRight u-number-box {
// position: absolute;
// right: 0;
// top: -7rpx;
// }
/deep/.inputBoxRight u-number-box input {
width: 130rpx !important;
min-width: 130rpx !important;
}
// /deep/.inputBoxRight u-number-box input {
// width: 130rpx !important;
// min-width: 130rpx !important;
// }
.inforCenterTopDel {
position: absolute;
......@@ -154,7 +154,8 @@
<text>数量</text>
</view>
<view class="inputBoxRight">
<u-number-box :min="0" v-model="item.UserNum" @change="(e)=>getNum(e,index)"/>
<input class="text-right" type="number" v-model="item.UserNum"
@input="getTotal()" />
<!--<input class="text-right" type="number" v-model="item.UserNum" @input="getNum()" />-->
</view>
</view>
......@@ -163,10 +164,10 @@
<text>单价</text>
</view>
<view class="inputBoxRight">
<input class="text-right" type="number"
<input class="text-right" type="text"
v-model="item.UnitPrice"
@input="handleInput($event,item,index,'UnitPrice')"
@blur="handleBlur(item,index,'UnitPrice')" />
@input="handleInput($event,item,'UnitPrice',1)"
@blur="handleBlur(item,'UnitPrice',1)" />
<!--<input class="text-right" type="text" v-model="item.UnitPrice" @input="getNum()" />-->
</view>
</view>
......@@ -174,7 +175,7 @@
<view class="row">
<text>金额小计</text>
</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2) }}</view>
<view class="text-right">{{ (item.UserNum*item.UnitPrice).toFixed(2)?(item.UserNum*item.UnitPrice).toFixed(2):0 }}</view>
</view>
</view>
</view>
......@@ -286,24 +287,24 @@
this.getTotal()
},
// 在模板中的使用示例
handleInput(e,item,index,field) {
handleInput(e,item,field,type) {
const value = e.detail.value
if(this.$utils.checkIsNum(value)){
item[field] = value
this.getTotal()
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
},
handleBlur(item,index,field) {
handleBlur(item,field,type) {
if(this.$utils.checkIsNum(item[field])){
this.getTotal();
}else{
uni.showToast({
title: '请输入正确的金额',
title: `请输入正确的${type?'金额':'数量'}`,
icon: 'none'
})
}
......
......@@ -211,7 +211,7 @@
</view>
</view>
<view class="col"></view>
<view class="teamLeaderMakeNote row PX50"
<view class="teamLeaderMakeNote row PX50 PT20"
:class="[params.LeaderApply.ID==0||(params.LeaderApply.ID>0&&params.LeaderApply.Status==2)?'justify-between':'justify-center']">
<view v-if="params.LeaderApply.ID==0||(params.LeaderApply.ID>0&&params.LeaderApply.Status!=2)"
class="text-center" @click="goUrl('/pages/teamLeader/reimbursementInfor')">记一笔</view>
......
......@@ -359,7 +359,7 @@
) {
msg = `请选择[` + obj.UseTime + `]车辆币种`;
}
if(msg == ''&&!this.$utils.checkIsNum(child.UnitPrice)){
if(msg == ''&&child.UnitPrice!=0&&child.UnitPrice!=null&&child.UnitPrice!=''&&!this.$utils.checkIsNum(child.UnitPrice)){
msg = `请输入正确的车金额`
}
// if (msg == '' && child.StartPlace == '' &&
......@@ -397,7 +397,7 @@
) {
msg = `请选择酒店币种`
}
if(msg == ''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
if(msg == ''&&grandson.UnitPrice!=0&&grandson.UnitPrice!=null&&grandson.UnitPrice!=''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
msg = `请输入正确的酒店金额`
}
}
......@@ -422,7 +422,7 @@
) {
msg = `请选择餐币种`
}
if(msg == ''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
if(msg == ''&&grandson.UnitPrice!=0&&grandson.UnitPrice!=null&&grandson.UnitPrice!=''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
msg = `请输入正确的餐金额`
}
}
......@@ -447,7 +447,7 @@
) {
msg = `请选择门票币种`
}
if(msg == ''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
if(msg == ''&&grandson.UnitPrice!=0&&grandson.UnitPrice!=null&&grandson.UnitPrice!=''&&!this.$utils.checkIsNum(grandson.UnitPrice)){
msg = `请输入正确的门票金额`
}
}
......@@ -478,10 +478,10 @@
) {
msg = `请选择其他费用币种`
}
if(msg == ''&&!this.$utils.checkIsNum(obj.UnitPrice)){
if(msg == ''&&obj.UnitPrice!=0&&obj.UnitPrice!=null&&obj.UnitPrice!=''&&!this.$utils.checkIsNum(obj.UnitPrice)){
msg = `请输入正确的其他费用金额`
}
if(msg == ''&&!this.$utils.checkIsNum(obj.Rebate)){
if(msg == ''&&obj.Rebate!=0&&obj.Rebate!=null&&obj.Rebate!=''&&!this.$utils.checkIsNum(obj.Rebate)){
msg = `请输入正确的其他费用返佣金额`
}
......@@ -504,7 +504,7 @@
) {
msg = `请选择自费收入币种`
}
if(msg == ''&&!this.$utils.checkIsNum(obj.UnitPrice)){
if(msg == ''&&obj.UnitPrice!=0&&obj.UnitPrice!=null&&obj.UnitPrice!=''&&!this.$utils.checkIsNum(obj.UnitPrice)){
msg = `请输入正确的自费收入金额`
}
......@@ -521,10 +521,10 @@
) {
msg = `请选择自费支出使用时间`
}
if(msg == ''&&!this.$utils.checkIsNum(obj.UnitPrice)){
if(msg == ''&&obj.UnitPrice!=0&&!this.$utils.checkIsNum(obj.UnitPrice)){
msg = `请输入正确的自费支出金额`
}
if(msg == ''&&!this.$utils.checkIsNum(obj.Rebate)){
if(msg == ''&&obj.Rebate!=0&&obj.Rebate!=null&&obj.Rebate!=''&&!this.$utils.checkIsNum(obj.Rebate)){
msg = `请输入正确的自费支出返佣金额`
}
}
......@@ -558,7 +558,7 @@
) {
msg = `请选择购物报账币种`
}
if(msg == ''&&!this.$utils.checkIsNum(obj.ShopMoney)){
if(msg == ''&&obj.ShopMoney!=0&&obj.ShopMoney!=null&&!this.$utils.checkIsNum(obj.ShopMoney)){
msg = `请输入正确的购物金额`
}
}
......@@ -780,13 +780,13 @@
},
scroll(e) {
this.old.scrollTop = e.detail.scrollTop
this.boxOption = Math.floor((e.detail.scrollTop - 50) / 1.5);
this.boxOption = Math.floor((e.detail.scrollTop - 500) / 1.5);
this.titleStyle.opacity =
e.detail.scrollTop - 50 < 0 ?
e.detail.scrollTop - 500 < 0 ?
0 :
Math.floor(e.detail.scrollTop - 50) / 100 > 1 ?
Math.floor(e.detail.scrollTop - 500) / 100 > 1 ?
1 :
Math.floor(e.detail.scrollTop - 50) / 100;
Math.floor(e.detail.scrollTop - 500) / 100;
this.$forceUpdate();
},
getOptionData() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment