Compare commits

..

No commits in common. "bc53f9552e7b51ff72b867a574a7ca67b0bed3f5" and "82e922eab0e1f1eb0728a9db4ce89bee41f0f257" have entirely different histories.

1 changed files with 272 additions and 191 deletions

View File

@ -9,7 +9,7 @@
<view class="group_45764" v-if="!selectedImage" :style="{'padding-top':$systemInfo.statusBarHeight+'px'}"> <view class="group_45764" v-if="!selectedImage" :style="{'padding-top':$systemInfo.statusBarHeight+'px'}">
<view class="rectangle_23284"> <view class="rectangle_23284">
<view class="flexcontainer"> <view class="flexcontainer">
<view class="group_8" @click="back"> <view class="group_8" @click="back">
<image class="frame" src="/static/image/other/bank/gsyh/back.png" /> <image class="frame" src="/static/image/other/bank/gsyh/back.png" />
</view> </view>
<view class="group_7"> <view class="group_7">
@ -26,10 +26,12 @@
</NavBar> </NavBar>
<view v-if="!selectedImage" :style="{'height':$systemInfo.statusBarHeight*2+88+'rpx'}"> <view v-if="!selectedImage" :style="{'height':$systemInfo.statusBarHeight*2+88+'rpx'}">
</view> </view>
<view class="group_48164"> <view class="group_48164">
<view class="rectangle_23292"> <view class="rectangle_23292">
<image class="group_48163" src="/static/image/other/bank/gsyh/mrzh.png" /> <image class="group_48163" src="/static/image/other/bank/gsyh/mrzh.png" />
<view class="flexcontainer_1"> <view class="flexcontainer_1">
<view class="rectangle_23290"> <view class="rectangle_23290">
<image class="f0763869907c4a2a56d1061936006358" src="/static/image/other/bank/gsyh/gsyh.png" /> <image class="f0763869907c4a2a56d1061936006358" src="/static/image/other/bank/gsyh/gsyh.png" />
@ -39,8 +41,7 @@
<view class="text_3"> <view class="text_3">
{{maskCardNumber(data.form.cardNumber)}} {{maskCardNumber(data.form.cardNumber)}}
<view <view
style="color:#3E82BD;margin-left: 52rpx;text-align: center;font-size: 22rpx; width: 52rpx;height: 32rpx;background: #F3F6FB;border-radius: 2px 2px 2px 2px;" style="color:#3E82BD;margin-left: 52rpx;text-align: center;font-size: 22rpx; width: 52rpx;height: 32rpx;background: #F3F6FB;border-radius: 2px 2px 2px 2px;" @click="data.isShow=true">查看</view>
@click="data.isShow=true">查看</view>
</view> </view>
</view> </view>
</view> </view>
@ -56,31 +57,37 @@
</view> </view>
<view v-if="!selectedImage" class="image-box" @touchstart="handleTouchStart" @touchend="handleTouchEnd"> <view v-if="!selectedImage" class="image-box" @touchstart="handleTouchStart" @touchend="handleTouchEnd">
<image class="group_48140_3x" :src="data.bannerImage || '/static/image/other/bank/gsyh/gnimg.png'" <image class="group_48140_3x" :src="data.bannerImage || '/static/image/other/bank/gsyh/gnimg.png'" mode="aspectFill" />
mode="aspectFill" /> <!-- <view class="image-tip">
<text>长按替换真实截图</text>
</view> -->
</view> </view>
<view v-else class="scroll-image-box flex-1"> <view v-else class="scroll-image-box flex-1">
<scroll-view class="image-box h100" style="width: 100%;height: 182px;" scroll-y :show-scrollbar="false" <scroll-view class="image-box h100" style="width: 100%;height: 182px;" scroll-y :show-scrollbar="false"
@scroll="onImageScroll"> @scroll="onImageScroll">
<image class="crop-image-target" style="width:100%;" :src="selectedImage" mode="widthFix"></image> <image class="crop-image-target" style="width:100%;" :src="selectedImage" mode="widthFix"></image>
</scroll-view> </scroll-view>
<view class="dashed-line-box"> <view class="dashed-line-box">
<view class="dashed-line-text">我是分割线</view> <view class="dashed-line-text">我是分割线</view>
</view> </view>
</view> </view>
<canvas canvas-id="crop-canvas" <canvas canvas-id="crop-canvas"
style="position: fixed; left: -9999px; width: 750rpx; height: 100vh; pointer-events: none;"></canvas> style="position: fixed; left: -9999px; width: 750rpx; height: 100vh; pointer-events: none;"></canvas>
<!-- 蒙层 --> <!-- 蒙层 -->
<view v-if="showMask" class="mask" @click="closeMask"> <view v-if="showMask" class="mask" @click="closeMask">
<image class="mask-icon" src="/static/image/common/mask-icon.png" mode="widthFix"></image> <image class="mask-icon" src="/static/image/common/mask-icon.png" mode="widthFix">
</image>
</view> </view>
<!-- 卡号信息弹窗 --> <!-- 卡号信息弹窗 -->
<view class="dask" v-if="data.isShow"> <view class="dask" v-if="data.isShow">
<view class="info"> <view class="info">
<view class="title">完整卡号</view> <view class="title">
<view class="dec">{{addSpaceEveryFourChars(data.form.cardNumber)}}</view> 完整卡号
</view>
<view class="dec">
{{addSpaceEveryFourChars(data.form.cardNumber)}}
</view>
<view class="btnbox"> <view class="btnbox">
<view class="btn" @click="data.isShow=false">取消</view> <view class="btn" @click="data.isShow=false">取消</view>
<view class="btn btns" @click="data.isShow=false">复制卡号</view> <view class="btn btns" @click="data.isShow=false">复制卡号</view>
@ -93,6 +100,7 @@
<text class="text_7">限额</text> <text class="text_7">限额</text>
<image class="group_48165" src="/static/image/other/bank/gsyh/titleIcon.png" /> <image class="group_48165" src="/static/image/other/bank/gsyh/titleIcon.png" />
</view> </view>
<view class="panel_limits" @click="openEditDialog"> <view class="panel_limits" @click="openEditDialog">
<view class="flexcontainer_4"> <view class="flexcontainer_4">
<view class="flexcontainer_5"> <view class="flexcontainer_5">
@ -100,16 +108,22 @@
<text class="text_9">日累积{{data.form.dayLimit}}</text> <text class="text_9">日累积{{data.form.dayLimit}}</text>
</view> </view>
<text class="text_10">{{data.form.dayRemain}}</text> <text class="text_10">{{data.form.dayRemain}}</text>
<view class="line"></view> <view class="line">
</view>
</view> </view>
<view class="flexcontainer_6"> <view class="flexcontainer_6">
<view class="flexcontainer_7"> <view class="flexcontainer_7">
<text class="text_11">当月剩余额度()</text> <text class="text_11">当月剩余额度()</text>
<text class="text_12">日累积{{data.form.monthLimit}}</text> <text class="text_12">日累积{{data.form.monthLimit}}</text>
</view> </view>
<text class="text_13">{{data.form.monthRemain}}</text> <text class="text_13">{{data.form.monthRemain}}</text>
<view class="line"></view> <view class="line">
</view>
</view> </view>
<view class="flexcontainer_8"> <view class="flexcontainer_8">
<view class="flexcontainer_9"> <view class="flexcontainer_9">
<text class="text_14">当年剩余额度()</text> <text class="text_14">当年剩余额度()</text>
@ -130,21 +144,24 @@
</view> </view>
</view> </view>
</view> </view>
<view class="group_13989" @click="openEditDialog"> <view class="group_13989" @click="openEditDialog">
<view class="rectangle_23294_1"> <view class="rectangle_23294_1">
<text class="text_19">启用日期</text> <text class="text_19">启用日期</text>
<text class="text_20">{{data.form.startDate}}</text> <text class="text_20">{{data.form.startDate}}</text>
</view> </view>
</view> </view>
<view class="group_13990" @click="openEditDialog"> <view class="group_13990" @click="openEditDialog">
<view class="rectangle_23294_2"> <view class="rectangle_23294_2">
<view class="rightInfo"> <view class="rightInfo">
<text class="text_21">到期日期</text> <text class="text_21">到期日期</text>
<image class="group_48165_1" src="/static/image/other/bank/gsyh/titleIcon.png" /> <image class="group_48165_1" src="/static/image/other/bank/gsyh/titleIcon.png" />
</view> </view>
<text class="text_22">{{data.form.endDate}}</text> <text class="text_22">{{data.form.endDate}}</text>
</view> </view>
</view> </view>
<view class="group_13991" @click="openEditDialog"> <view class="group_13991" @click="openEditDialog">
<view class="rectangle_23294_3"> <view class="rectangle_23294_3">
<text class="text_23">设置别名</text> <text class="text_23">设置别名</text>
@ -154,24 +171,28 @@
</view> </view>
</view> </view>
</view> </view>
<view class="group_13992"> <view class="group_13992">
<view class="rectangle_23294_4"> <view class="rectangle_23294_4">
<text class="text_25">账户互转</text> <text class="text_25">账户互转</text>
<image class="group_13987_2" src="/static/image/other/bank/gsyh/rightIcon.png" /> <image class="group_13987_2" src="/static/image/other/bank/gsyh/rightIcon.png" />
</view> </view>
</view> </view>
<view class="group_13993"> <view class="group_13993">
<view class="rectangle_23294_5"> <view class="rectangle_23294_5">
<text class="text_26">当面收款</text> <text class="text_26">当面收款</text>
<image class="group_13987_3" src="/static/image/other/bank/gsyh/rightIcon.png" /> <image class="group_13987_3" src="/static/image/other/bank/gsyh/rightIcon.png" />
</view> </view>
</view> </view>
<view class="group_13994"> <view class="group_13994">
<view class="rectangle_23294_6"> <view class="rectangle_23294_6">
<text class="text_27">绑手机号</text> <text class="text_27">绑手机号</text>
<image class="group_13987_4" src="/static/image/other/bank/gsyh/rightIcon.png" /> <image class="group_13987_4" src="/static/image/other/bank/gsyh/rightIcon.png" />
</view> </view>
</view> </view>
</view> </view>
<view class="group_13994_1"> <view class="group_13994_1">
@ -184,7 +205,9 @@
<image class="group_13987_6" src="/static/image/other/bank/gsyh/rightIcon.png" /> <image class="group_13987_6" src="/static/image/other/bank/gsyh/rightIcon.png" />
</view> </view>
<image class="dee351fc65540488ca79ac78c10072f2" src="/static/image/other/bank/gsyh/bottomImg.png" /> <image class="dee351fc65540488ca79ac78c10072f2" src="/static/image/other/bank/gsyh/bottomImg.png" />
<view class="footer"></view> <view class="footer">
</view>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
<view v-if="editDialog.show" class="editDialog"> <view v-if="editDialog.show" class="editDialog">
@ -195,12 +218,7 @@
<view class="editDialog_body"> <view class="editDialog_body">
<view class="formItem"> <view class="formItem">
<text>余额</text> <text>余额</text>
<input <input v-model="editDialog.data.balance" type="digit" placeholder="请输入余额" />
:value="editDialog.data.balance"
@input="(e) => onNumberInputRaw('balance', e.detail.value)"
type="digit"
placeholder="请输入余额"
/>
</view> </view>
<view class="formItem"> <view class="formItem">
<text>卡类型</text> <text>卡类型</text>
@ -211,59 +229,29 @@
<input v-model="editDialog.data.cardNumber" placeholder="请输入完整卡号" /> <input v-model="editDialog.data.cardNumber" placeholder="请输入完整卡号" />
</view> </view>
<view class="formItem"> <view class="formItem">
<text>当日额度上限</text> <text>当日额度上限</text>
<input <input :value="editDialog.data.dayLimit" @input="(e) => onNumberInput('dayLimit', e.detail.value)" placeholder="如: 50,000.00" />
:value="editDialog.data.dayLimit" </view>
@input="(e) => onNumberInputRaw('dayLimit', e.detail.value)" <view class="formItem">
type="digit" <text>当日剩余额度</text>
placeholder="如: 50000" <input :value="editDialog.data.dayRemain" @input="(e) => onNumberInput('dayRemain', e.detail.value)" placeholder="如: 50,000.00" />
/> </view>
</view> <view class="formItem">
<view class="formItem"> <text>当月额度上限</text>
<text>当日剩余额度</text> <input :value="editDialog.data.monthLimit" @input="(e) => onNumberInput('monthLimit', e.detail.value)" placeholder="如: 500,000.00" />
<input </view>
:value="editDialog.data.dayRemain" <view class="formItem">
@input="(e) => onNumberInputRaw('dayRemain', e.detail.value)" <text>当月剩余额度</text>
type="digit" <input :value="editDialog.data.monthRemain" @input="(e) => onNumberInput('monthRemain', e.detail.value)" placeholder="如: 500,000.00" />
placeholder="如: 50000" </view>
/> <view class="formItem">
</view> <text>当年额度上限</text>
<view class="formItem"> <input :value="editDialog.data.yearLimit" @input="(e) => onNumberInput('yearLimit', e.detail.value)" placeholder="如: 2,500,000.00" />
<text>当月额度上限</text> </view>
<input <view class="formItem">
:value="editDialog.data.monthLimit" <text>当年剩余额度</text>
@input="(e) => onNumberInputRaw('monthLimit', e.detail.value)" <input :value="editDialog.data.yearRemain" @input="(e) => onNumberInput('yearRemain', e.detail.value)" placeholder="如: 2,500,000.00" />
type="digit" </view>
placeholder="如: 500000"
/>
</view>
<view class="formItem">
<text>当月剩余额度</text>
<input
:value="editDialog.data.monthRemain"
@input="(e) => onNumberInputRaw('monthRemain', e.detail.value)"
type="digit"
placeholder="如: 500000"
/>
</view>
<view class="formItem">
<text>当年额度上限</text>
<input
:value="editDialog.data.yearLimit"
@input="(e) => onNumberInputRaw('yearLimit', e.detail.value)"
type="digit"
placeholder="如: 2500000"
/>
</view>
<view class="formItem">
<text>当年剩余额度</text>
<input
:value="editDialog.data.yearRemain"
@input="(e) => onNumberInputRaw('yearRemain', e.detail.value)"
type="digit"
placeholder="如: 2500000"
/>
</view>
<view class="formItem"> <view class="formItem">
<text>基本账户</text> <text>基本账户</text>
<input v-model="editDialog.data.baseAccount" placeholder="请输入基本账户卡号" /> <input v-model="editDialog.data.baseAccount" placeholder="请输入基本账户卡号" />
@ -289,7 +277,6 @@
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { reactive, onMounted, ref, getCurrentInstance } from 'vue'; import { reactive, onMounted, ref, getCurrentInstance } from 'vue';
import NavBar from '@/components/nav-bar/nav-bar' import NavBar from '@/components/nav-bar/nav-bar'
@ -297,7 +284,6 @@ import NavBar from '@/components/nav-bar/nav-bar'
const instance = getCurrentInstance(); const instance = getCurrentInstance();
const CACHE_KEY = 'gsyh_account_info'; const CACHE_KEY = 'gsyh_account_info';
const BANNER_IMAGE_KEY = 'gsyh_banner_image'; const BANNER_IMAGE_KEY = 'gsyh_banner_image';
const FONT_KEY = 'gsyh_font_path'; // key
const data = reactive({ const data = reactive({
form: { form: {
@ -331,13 +317,17 @@ const editDialog = reactive({
onMounted(() => { onMounted(() => {
loadCache(); loadCache();
// banner
const savedBanner = uni.getStorageSync(BANNER_IMAGE_KEY); const savedBanner = uni.getStorageSync(BANNER_IMAGE_KEY);
if (savedBanner) { if (savedBanner) {
data.bannerImage = savedBanner; data.bannerImage = savedBanner;
} }
const config = uni.getStorageSync('config')
console.log("---config---", config);
const font = config.config['client.uniapp.font']
const config = uni.getStorageSync('config'); console.log("字体地址信息", font.bank);
const font = config.config['client.uniapp.font']; // Font loading logic
const fontUrl = font.bank; const fontUrl = font.bank;
const fontName = 'zsyhFt'; const fontName = 'zsyhFt';
@ -355,12 +345,13 @@ onMounted(() => {
}; };
// #ifdef H5 // #ifdef H5
// H5 URL
loadFont(fontUrl); loadFont(fontUrl);
// #endif // #endif
// #ifndef H5 // #ifndef H5
// FONT_KEY // H5 使
const savedFontPath = uni.getStorageSync(FONT_KEY); const savedFontPath = uni.getStorageSync(' ');
if (savedFontPath) { if (savedFontPath) {
loadFont(savedFontPath); loadFont(savedFontPath);
} else { } else {
@ -371,10 +362,14 @@ onMounted(() => {
uni.saveFile({ uni.saveFile({
tempFilePath: res.tempFilePath, tempFilePath: res.tempFilePath,
success: (saveRes) => { success: (saveRes) => {
uni.setStorageSync(FONT_KEY, saveRes.savedFilePath); // key const savedPath = saveRes.savedFilePath;
loadFont(saveRes.savedFilePath); uni.setStorageSync('certificate2_font_path', savedPath);
console.log("字体保存路径", savedPath);
loadFont(savedPath);
}, },
fail: () => { fail: (err) => {
console.error('保存文件失败', err);
// Fallback:
loadFont(res.tempFilePath); loadFont(res.tempFilePath);
} }
}); });
@ -387,11 +382,9 @@ onMounted(() => {
} }
// #endif // #endif
}); });
function back(){
function back() { uni.navigateBack()
uni.navigateBack();
} }
function loadCache() { function loadCache() {
const cache = uni.getStorageSync(CACHE_KEY); const cache = uni.getStorageSync(CACHE_KEY);
if (cache) { if (cache) {
@ -403,32 +396,13 @@ function saveCache() {
uni.setStorageSync(CACHE_KEY, data.form); uni.setStorageSync(CACHE_KEY, data.form);
} }
//
const NUMBER_FIELDS = ['balance', 'dayLimit', 'dayRemain', 'monthLimit', 'monthRemain', 'yearLimit', 'yearRemain'];
//
function toRawNumber(val) {
if (!val && val !== 0) return '';
return String(val).replace(/[^\d.]/g, '');
}
function openEditDialog() { function openEditDialog() {
const raw = JSON.parse(JSON.stringify(data.form)); editDialog.data = JSON.parse(JSON.stringify(data.form));
// 便
NUMBER_FIELDS.forEach(field => {
raw[field] = toRawNumber(raw[field]);
});
editDialog.data = raw;
editDialog.show = true; editDialog.show = true;
} }
function saveEdit() { function saveEdit() {
const saved = { ...editDialog.data }; data.form = { ...data.form, ...editDialog.data };
//
NUMBER_FIELDS.forEach(field => {
saved[field] = formatNumber(saved[field]);
});
data.form = { ...data.form, ...saved };
saveCache(); saveCache();
editDialog.show = false; editDialog.show = false;
uni.showToast({ uni.showToast({
@ -448,8 +422,36 @@ function addSpaceEveryFourChars(str) {
return str.replace(/(.{4})/g, '$1 ').trim(); return str.replace(/(.{4})/g, '$1 ').trim();
} }
function copyAll() {
const text = `户 名: ${data.form.name}\n卡 号: ${addSpaceEveryFourChars(data.form.cardNumber)}\n开户行: ${data.form.bankName}`;
uni.setClipboardData({
data: text,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
});
data.isShow = false;
}
});
}
function copyCardNumber() {
uni.setClipboardData({
data: data.form.cardNumber,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
});
data.isShow = false;
}
});
}
// //
const handleTouchStart = (e) => { const handleTouchStart = (e) => {
// iOSHOME
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'ios' && systemInfo.safeAreaInsets?.bottom) { if (systemInfo.platform === 'ios' && systemInfo.safeAreaInsets?.bottom) {
const clientY = e.touches[0].clientY; const clientY = e.touches[0].clientY;
@ -458,6 +460,7 @@ const handleTouchStart = (e) => {
return; return;
} }
} }
longPressTimer = setTimeout(() => { longPressTimer = setTimeout(() => {
uni.vibrateShort(); uni.vibrateShort();
chooseImage(); chooseImage();
@ -471,86 +474,128 @@ const handleTouchEnd = () => {
} }
}; };
//
const chooseImage = () => { const chooseImage = () => {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
sourceType: ['album'], sourceType: ['album'],
success: (res) => { success: (res) => {
selectedImage.value = res.tempFilePaths[0]; selectedImage.value = res.tempFilePaths[0]
data.showMask = true; data.showMask = true
} }
}); });
}; };
//
const closeMask = () => { const closeMask = () => {
data.showMask = false; data.showMask = false
}; };
//
const onImageScroll = (e) => { const onImageScroll = (e) => {
scrollTop.value = e.detail.scrollTop; scrollTop.value = e.detail.scrollTop;
}; };
//
const confirmImage = () => { const confirmImage = () => {
uni.showLoading({ title: '处理中...' }); uni.showLoading({
const query = uni.createSelectorQuery().in(instance); title: '处理中...'
query.select('.image-box').boundingClientRect(); })
query.select('.crop-image-target').boundingClientRect(); const query = uni.createSelectorQuery().in(instance)
//
query.select('.image-box').boundingClientRect()
query.select('.crop-image-target').boundingClientRect()
query.exec(res => { query.exec(res => {
if (!res[0] || !res[1]) { if (!res[0] || !res[1]) {
uni.hideLoading(); uni.hideLoading()
return; return
} }
const container = res[0];
const image = res[1]; console.log('rects', res)
const container = res[0] //
const image = res[1] //
//
uni.getImageInfo({ uni.getImageInfo({
src: selectedImage.value, src: selectedImage.value,
success: (imgInfo) => { success: (imgInfo) => {
const scale = imgInfo.width / image.width; const scale = imgInfo.width / image.width // 图片 原始宽 / 渲染宽
const sTop = scrollTop.value * scale; const sTop = scrollTop.value * scale // Y
const sHeight = container.height * scale; const sHeight = container.height * scale //
const sWidth = imgInfo.width;
const canvasW = container.width; // widthFix
const canvasH = container.height; const sWidth = imgInfo.width
const ctx = uni.createCanvasContext('crop-canvas', instance);
ctx.clearRect(0, 0, canvasW, canvasH); // (使)
ctx.drawImage(imgInfo.path, 0, sTop, sWidth, sHeight, 0, 0, canvasW, canvasH); const canvasW = container.width
const canvasH = container.height
const ctx = uni.createCanvasContext('crop-canvas', instance)
//
ctx.clearRect(0, 0, canvasW, canvasH)
//
ctx.drawImage(
imgInfo.path,
0, sTop, sWidth, sHeight, //
0, 0, canvasW, canvasH //
)
ctx.draw(false, () => { ctx.draw(false, () => {
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
canvasId: 'crop-canvas', canvasId: 'crop-canvas',
width: canvasW, width: canvasW,
height: canvasH, height: canvasH,
destWidth: sWidth, destWidth: sWidth, // 使,
destHeight: sHeight, destHeight: sHeight, // 使,
success: (res) => { success: (res) => {
console.log('crop success (temp)', res.tempFilePath)
//
uni.saveFile({ uni.saveFile({
tempFilePath: res.tempFilePath, tempFilePath: res.tempFilePath,
success: (saveRes) => { success: (saveRes) => {
data.bannerImage = saveRes.savedFilePath; console.log('save success (saved)', saveRes.savedFilePath)
selectedImage.value = ''; data.bannerImage = saveRes.savedFilePath
uni.setStorageSync(BANNER_IMAGE_KEY, data.bannerImage); selectedImage.value = '' //
uni.hideLoading(); //
uni.setStorageSync(BANNER_IMAGE_KEY, data.bannerImage)
uni.hideLoading()
}, },
fail: () => { fail: (err) => {
uni.hideLoading(); console.error('saveFile fail', err)
uni.showToast({ title: '保存失败', icon: 'none' }); uni.hideLoading()
uni.showToast({
title: '保存失败',
icon: 'none'
})
} }
}); })
}, },
fail: () => { fail: (err) => {
uni.hideLoading(); console.error(err)
uni.showToast({ title: '裁剪失败', icon: 'none' }); uni.hideLoading()
uni.showToast({
title: '裁剪失败',
icon: 'none'
})
} }
}, instance); }, instance)
}); })
}, },
fail: () => { fail: () => {
uni.hideLoading(); uni.hideLoading()
uni.showToast({ title: '图片加载失败', icon: 'none' }); uni.showToast({
title: '图片加载失败',
icon: 'none'
})
} }
}); })
}); })
}; };
//
const closeImageEdit = () => { const closeImageEdit = () => {
selectedImage.value = ''; selectedImage.value = '';
}; };
@ -558,31 +603,34 @@ const closeImageEdit = () => {
// //
function formatNumber(num) { function formatNumber(num) {
if (!num && num !== 0) return ''; if (!num && num !== 0) return '';
//
let cleanNum = String(num).replace(/[^\d.]/g, ''); let cleanNum = String(num).replace(/[^\d.]/g, '');
//
const parts = cleanNum.split('.'); const parts = cleanNum.split('.');
if (parts.length > 2) { if (parts.length > 2) {
cleanNum = parts[0] + '.' + parts.slice(1).join(''); cleanNum = parts[0] + '.' + parts.slice(1).join('');
} }
//
let number = parseFloat(cleanNum); let number = parseFloat(cleanNum);
if (isNaN(number)) return ''; if (isNaN(number)) return '';
//
number = Math.round(number * 100) / 100; number = Math.round(number * 100) / 100;
//
return number.toLocaleString('en-US', { return number.toLocaleString('en-US', {
minimumFractionDigits: 2, minimumFractionDigits: 2,
maximumFractionDigits: 2 maximumFractionDigits: 2
}); });
} }
// //
function onNumberInputRaw(field, value) { function onNumberInput(field, value) {
editDialog.data[field] = value; editDialog.data[field] = formatNumber(value);
} }
</script> </script>
<style lang="scss" >
<style lang="scss"> page{
page {
background: #F8F8F8; background: #F8F8F8;
} }
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
@ -603,8 +651,6 @@ function onNumberInputRaw(field, value) {
width: 750rpx; width: 750rpx;
position: fixed; position: fixed;
z-index: 999; z-index: 999;
left: 0;
top: 0;
background-color: #ffffff; background-color: #ffffff;
} }
@ -644,6 +690,11 @@ function onNumberInputRaw(field, value) {
justify-content: center; justify-content: center;
} }
.rectangle_18503 {
width: 240rpx;
height: 88rpx;
}
.text_1 { .text_1 {
font-size: 36rpx; font-size: 36rpx;
color: #617280; color: #617280;
@ -654,8 +705,7 @@ function onNumberInputRaw(field, value) {
width: 240rpx; width: 240rpx;
height: 88rpx; height: 88rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row; justify-content: flex-end;
justify-content: flex-end;
align-items: center; align-items: center;
} }
@ -666,6 +716,11 @@ function onNumberInputRaw(field, value) {
margin-left: 28rpx; margin-left: 28rpx;
} }
.div_1 {
width: 754rpx;
height: 2rpx;
}
/* ===== card ===== */ /* ===== card ===== */
.group_48164 { .group_48164 {
width: 692rpx; width: 692rpx;
@ -680,11 +735,12 @@ function onNumberInputRaw(field, value) {
border-radius: 20rpx; border-radius: 20rpx;
background-color: #ffffff; background-color: #ffffff;
box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.1); box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.1);
padding: 40rpx 40rpx 20rpx 40rpx; padding: 40rpx 40rpx 20rpx 40rpx ;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
position: relative; position: relative;
} }
.group_48163 { .group_48163 {
@ -720,6 +776,13 @@ function onNumberInputRaw(field, value) {
flex-direction: row; flex-direction: row;
} }
.group_48162 {
width: 52rpx;
height: 32rpx;
margin-left: 20rpx;
margin-top: 46rpx;
}
.rectangle_23290 { .rectangle_23290 {
width: 108rpx; width: 108rpx;
height: 78rpx; height: 78rpx;
@ -814,8 +877,7 @@ function onNumberInputRaw(field, value) {
align-items: center; align-items: center;
margin: 0 26rpx 0 26rpx; margin: 0 26rpx 0 26rpx;
position: relative; position: relative;
.line{
.line {
width: calc(100%); width: calc(100%);
position: absolute; position: absolute;
height: 1rpx; height: 1rpx;
@ -824,13 +886,13 @@ function onNumberInputRaw(field, value) {
left: 0; left: 0;
} }
} }
.flexcontainer_5, .flexcontainer_5,
.flexcontainer_7, .flexcontainer_7,
.flexcontainer_9 { .flexcontainer_9 {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.text_8, .text_8,
@ -855,6 +917,14 @@ function onNumberInputRaw(field, value) {
font-weight: bold; font-weight: bold;
} }
/* 分割线 */
.div_2,
.div_3 {
width: 694rpx;
height: 2rpx;
margin-left: 28rpx;
}
/* ===== list ===== */ /* ===== list ===== */
.panel_limits_1 { .panel_limits_1 {
width: 750rpx; width: 750rpx;
@ -876,27 +946,20 @@ function onNumberInputRaw(field, value) {
align-items: center; align-items: center;
border-bottom: 1rpx solid #eee; border-bottom: 1rpx solid #eee;
justify-content: space-between; justify-content: space-between;
.rightInfo{
.rightInfo {
display: flex; display: flex;
align-items: center; align-items: center;
} }
} }
.text_20,.text_22{
.text_20, margin-right: 28rpx;
.text_22 { }
.text_18,.text_24{
margin-right: 28rpx; margin-right: 28rpx;
} }
.text_24{
.text_18, color: #AAAAAA;
.text_24 { }
margin-right: 28rpx;
}
.text_24 {
color: #AAAAAA;
}
.text_17, .text_17,
.text_19, .text_19,
.text_21, .text_21,
@ -950,12 +1013,16 @@ function onNumberInputRaw(field, value) {
height: 200rpx; height: 200rpx;
margin-top: 12rpx; margin-top: 12rpx;
} }
.footer{
.footer {
width: 100%; width: 100%;
background-color: #ffffff; background-color: #ffffff;
height: 60rpx; height: 60rpx;
} }
.home {
position: absolute;
bottom: 0;
left: 0;
}
/* 图片编辑样式 */ /* 图片编辑样式 */
.image-box { .image-box {
@ -965,6 +1032,20 @@ function onNumberInputRaw(field, value) {
overflow: hidden; overflow: hidden;
} }
.image-tip {
position: absolute;
bottom: 20rpx;
left: 50%;
transform: translateX(-50%);
background-color: rgba(0, 0, 0, 0.5);
padding: 10rpx 20rpx;
border-radius: 20rpx;
text {
font-size: 24rpx;
color: #fff;
}
}
.scroll-image-box { .scroll-image-box {
width: 100%; width: 100%;
min-height: 0; min-height: 0;
@ -1039,6 +1120,8 @@ function onNumberInputRaw(field, value) {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.title { .title {
font-weight: 400; font-weight: 400;
font-size: 16px; font-size: 16px;
@ -1076,6 +1159,7 @@ function onNumberInputRaw(field, value) {
} }
.btns { .btns {
/* border-left: 1rpx solid #F2F2F2; */
color: #DA1C01; color: #DA1C01;
} }
} }
@ -1121,9 +1205,7 @@ function onNumberInputRaw(field, value) {
.editDialog_body { .editDialog_body {
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
overflow-y: auto; overflow-y: auto;
-webkit-overflow-scrolling: touch;
max-height: 60vh; max-height: 60vh;
flex: 1;
} }
.formItem { .formItem {
@ -1173,11 +1255,10 @@ function onNumberInputRaw(field, value) {
color: #fff; color: #fff;
} }
} }
.text_6, .text_6,
.text_10, .text_10,
.text_13, .text_13,
.text_16 { .text_16{
font-family: "zsyhFt"; font-family:"zsyhFt";
} }
</style> </style>