领料退料电子签名

This commit is contained in:
binbin_pan 2025-01-09 15:14:30 +08:00
parent 64c336db01
commit b945f4eec9
4 changed files with 309 additions and 176 deletions

View File

@ -40,6 +40,7 @@
</uni-row> </uni-row>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container"> <scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<div class="table-list-item" v-for="(item, index) in tableList" :key="index" @click="handleItem(item)"> <div class="table-list-item" v-for="(item, index) in tableList" :key="index" @click="handleItem(item)">
<uni-swipe-action>
<uni-swipe-action-item :right-options="item.taskStatus==0 ? options:options2" @click="onClick($event,item)" @change="onSwipeChange"> <uni-swipe-action-item :right-options="item.taskStatus==0 ? options:options2" @click="onClick($event,item)" @change="onSwipeChange">
<div class="title"> <div class="title">
<span class="code">{{ item.code }}</span> <span class="code">{{ item.code }}</span>
@ -107,6 +108,7 @@
> >
</uni-row> </uni-row>
</uni-swipe-action-item> </uni-swipe-action-item>
</uni-swipe-action>
</div> </div>
<view class="loading-text"> <view class="loading-text">
{{ finish ? '没有更多数据了~' : '正在加载...' }} {{ finish ? '没有更多数据了~' : '正在加载...' }}
@ -136,6 +138,14 @@ const queryParams = ref({
// - // -
const options = ref([ const options = ref([
{
text: '电子签名',
style: {
backgroundColor: '#65a1ff',
color: '#fff',
fontSize: '30rpx',
},
},
{ {
text: '提交', text: '提交',
style: { style: {
@ -156,13 +166,21 @@ const options = ref([
// - // -
const options2 = ref([ const options2 = ref([
{ {
text: '查看', text: '电子签名',
style: { style: {
backgroundColor: '#65a1ff', backgroundColor: '#65a1ff',
color: '#fff', color: '#fff',
fontSize: '30rpx', fontSize: '30rpx',
}, },
}, },
{
text: '查看',
style: {
backgroundColor: '#65a1ff !important',
color: '#fff',
fontSize: '30rpx',
},
},
// { // {
// text: '', // text: '',
// style: { // style: {
@ -174,9 +192,21 @@ const options2 = ref([
]) ])
// //
const onClick=(e,item)=> { const onClick=(e,item)=> {
console.log('🚀 ~ onClick ~ item:', item)
const { index } = e const { index } = e
console.log(index) console.log(index)
if (index === 0) { if (index === 0) {
const params = {
id: item.id,
backSignUrl: item.backSignUrl,
backSignType: item.backSignType,
isBack: true
}
uni.navigateTo({
url: `/pages/my/signature?params=${JSON.stringify(params)}`,
})
}
if (index === 1) {
if (item.taskStatus == 0) {//- if (item.taskStatus == 0) {//-
console.log(item) console.log(item)
let param = { let param = {
@ -200,7 +230,7 @@ const onClick=(e,item)=> {
} }
} }
// 2. // 2.
if (index === 1) { if (index === 2) {
console.log(item) console.log(item)
let param = { let param = {
id:item.id id:item.id
@ -524,13 +554,13 @@ const warningStyle = {
font-size: 28rpx; font-size: 28rpx;
font-weight: 600; font-weight: 600;
&:nth-child(1) { /* &:nth-child(1) {
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%); background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
} }
&:nth-child(2) { &:nth-child(2) {
background: linear-gradient(135deg, #ff4d4f 0%, #ed6042 100%); background: linear-gradient(135deg, #ff4d4f 0%, #ed6042 100%);
} } */
} }
} }
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<div class="img" :class="{ rotate: isRotate }" v-if="imgPath"> <div class="img" v-if="imgPath">
<image :src="imgPath" @click="preview"></image> <image :class="{ rotate: isRotate }" :src="imgPath" @click="preview"></image>
</div> </div>
<div class="img" v-else>暂无数据</div> <div class="img" v-else>暂无数据</div>
<div class="tips"> <div class="tips">
@ -17,7 +17,13 @@
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted } from 'vue'
import { getSign, updateSign } from '@/services/signature.js' import { onLoad } from '@dcloudio/uni-app'
import {
getSign,
updateSign,
updateLeaseApplyInfoSign,
updateSignById,
} from '@/services/signature.js'
import { baseURL } from '@/utils/http' import { baseURL } from '@/utils/http'
let isCanvas = ref(false) let isCanvas = ref(false)
@ -25,8 +31,30 @@ let imgPath = ref('')
let isRotate = ref(false) let isRotate = ref(false)
let actionUrl = `${baseURL}/file/upload` let actionUrl = `${baseURL}/file/upload`
let signType = ref(0) let signType = ref(0)
const opts = reactive({})
onLoad((opt) => {
// console.log('🚀 ~ onLoad ~ opt:', opt)
Object.assign(opts, JSON.parse(opt.params))
if (opts.isLease) {
signType.value = opts.leaseSignType
imgPath.value = opts.leaseSignUrl
}
if (opts.isBack) {
signType.value = opts.backSignType
imgPath.value = opts.backSignUrl
}
if (signType.value == 1) {
isRotate.value = false
} else {
isRotate.value = true
}
console.log('🚀 ~ onLoad ~ opts:', opts)
console.log('🚀 ~ onLoad ~ signType:', signType.value)
})
onMounted(() => { onMounted(() => {
if (opts.isLease || opts.isBack) return
getSignData() getSignData()
}) })
// //
@ -62,9 +90,9 @@ const open = () => {
// //
const preview = () => { const preview = () => {
console.log('预览', imgPath.value) console.log('预览', imgPath.value)
uni.previewImage({ // uni.previewImage({
urls: [imgPath.value], // urls: [imgPath.value],
}) // })
} }
// / // /
const handlePhoto = () => { const handlePhoto = () => {
@ -91,21 +119,46 @@ const uploadImg = (path) => {
header: { header: {
// Authorization: this.token, // Authorization: this.token,
}, },
success: (res) => { success: async (res) => {
console.log('🚀 ~ uploadImg ~ res:', res) console.log('🚀 ~ uploadImg ~ res:', res)
// imgPath.value = JSON.parse(res.data).data.url try {
const signUrl = JSON.parse(res.data).data.url
if (opts.isLease) {
const params = { const params = {
signUrl: JSON.parse(res.data).data.url, id: opts.id,
leaseSignUrl: signUrl,
leaseSignType: signType.value,
}
console.log('🚀 ~ success: ~ params:', params)
const res = await updateLeaseApplyInfoSign(params)
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
uni.navigateBack()
} else if (opts.isBack) {
const params = {
id: opts.id,
backSignUrl: signUrl,
backSignType: signType.value,
}
console.log('🚀 ~ success: ~ params:', params)
const res = await updateSignById(params)
console.log('🚀 ~ uploadImg-退料 ~ res:', res)
uni.navigateBack()
} else {
const params = {
signUrl: signUrl,
signType: signType.value, signType: signType.value,
} }
updateSign(params) const res = await updateSign(params)
.then((res) => { console.log('🚀 ~ uploadImg-个人中心 ~ res:', res)
console.log('🚀 ~ .then ~ res:', res)
getSignData() getSignData()
}
} catch (error) {
console.log('🚀 ~ uploadImg ~ error:', error)
uni.showToast({
title: '上传失败',
icon: 'none',
}) })
.catch((err) => { }
console.log('🚀 ~ .then ~ err:', err)
})
}, },
fail: (err) => { fail: (err) => {
console.log('🚀 ~ uploadImg ~ err:', err) console.log('🚀 ~ uploadImg ~ err:', err)

View File

@ -20,7 +20,7 @@
@maskClick="maskClick" @maskClick="maskClick"
@change="onChangeDate" @change="onChangeDate"
placeholder="选择日期范围" placeholder="选择日期范围"
style="width: 100%;" style="width: 100%"
/> />
</view> </view>
</uni-col> </uni-col>
@ -36,13 +36,17 @@
</uni-col> </uni-col>
</uni-row> </uni-row>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container"> <scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<view <view
class="table-list-item" class="table-list-item"
:key="index" :key="index"
@click="handleItem(item)" @click="handleItem(item)"
v-for="(item, index) in tableList" v-for="(item, index) in tableList"
>
<uni-swipe-action class="swipe-action">
<uni-swipe-action-item
:right-options="options"
@click="onSignature($event, item)"
> >
<div class="title"> <div class="title">
<span class="code">{{ item.code }}</span> <span class="code">{{ item.code }}</span>
@ -103,6 +107,8 @@
<div class="cont">{{ item.preCountNum - item.alNum }}</div> <div class="cont">{{ item.preCountNum - item.alNum }}</div>
</uni-col> </uni-col>
</uni-row> </uni-row>
</uni-swipe-action-item>
</uni-swipe-action>
</view> </view>
<view class="loading-text"> <view class="loading-text">
{{ finish ? '没有更多数据了~' : '正在加载...' }} {{ finish ? '没有更多数据了~' : '正在加载...' }}
@ -112,11 +118,11 @@
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue' import { ref, reactive, computed } from 'vue'
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js' import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import { onBackPress } from '@dcloudio/uni-app'; import { onBackPress } from '@dcloudio/uni-app'
const total = ref(0) // const total = ref(0) //
const active = ref(1) // tap const active = ref(1) // tap
const tableList = ref([]) // const tableList = ref([]) //
@ -131,6 +137,31 @@ const queryParams = ref({
pageSize: 3, pageSize: 3,
}) })
const options = reactive([
{
text: '电子签名',
style: {
backgroundColor: '#3784fb',
fontSize: '28rpx',
},
},
])
//
const onSignature = (e, item) => {
console.log('电子签名-e', e)
console.log('电子签名-item', item)
const params = {
id: item.id,
leaseSignUrl: item.leaseSignUrl,
leaseSignType: item.leaseSignType,
isLease: true,
}
uni.navigateTo({
url: `/pages/my/signature?params=${JSON.stringify(params)}`,
})
}
// change // change
const onChangeDate = (val) => { const onChangeDate = (val) => {
const [val_1, val_2] = val const [val_1, val_2] = val
@ -206,7 +237,7 @@ const successStyle = {
color: '#52c41a', color: '#52c41a',
backgroundColor: 'rgba(82, 196, 26, 0.1)', backgroundColor: 'rgba(82, 196, 26, 0.1)',
border: '2rpx solid rgba(82, 196, 26, 0.2)', border: '2rpx solid rgba(82, 196, 26, 0.2)',
fontWeight: '600' fontWeight: '600',
} }
</script> </script>
@ -238,7 +269,7 @@ const successStyle = {
transition: all 0.3s ease; transition: all 0.3s ease;
&.active { &.active {
color: #007AFF; color: #007aff;
font-weight: 600; font-weight: 600;
} }
} }
@ -250,7 +281,7 @@ const successStyle = {
transform: translateX(-50%); transform: translateX(-50%);
width: 56rpx; width: 56rpx;
height: 6rpx; height: 6rpx;
background: linear-gradient(90deg, #007AFF, #4b8eff); background: linear-gradient(90deg, #007aff, #4b8eff);
border-radius: 6rpx; border-radius: 6rpx;
} }
} }
@ -352,9 +383,9 @@ const successStyle = {
.code { .code {
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
color: #007AFF; color: #007aff;
letter-spacing: 1rpx; letter-spacing: 1rpx;
background: linear-gradient(90deg, #007AFF, #4b8eff); background: linear-gradient(90deg, #007aff, #4b8eff);
-webkit-background-clip: text; -webkit-background-clip: text;
color: transparent; color: transparent;
} }
@ -368,13 +399,13 @@ const successStyle = {
border: none; border: none;
transition: all 0.3s ease; transition: all 0.3s ease;
&[type="warning"] { &[type='warning'] {
background-color: rgba(250, 140, 22, 0.1); background-color: rgba(250, 140, 22, 0.1);
color: #fa8c16; color: #fa8c16;
border: 2rpx solid rgba(250, 140, 22, 0.2); border: 2rpx solid rgba(250, 140, 22, 0.2);
} }
&[type="success"] { &[type='success'] {
// custom-style // custom-style
} }
@ -389,7 +420,8 @@ const successStyle = {
.line { .line {
margin: 24rpx 0; margin: 24rpx 0;
height: 2rpx; height: 2rpx;
background: linear-gradient(90deg, background: linear-gradient(
90deg,
rgba(232, 232, 232, 0) 0%, rgba(232, 232, 232, 0) 0%,
rgba(232, 232, 232, 1) 50%, rgba(232, 232, 232, 1) 50%,
rgba(232, 232, 232, 0) 100% rgba(232, 232, 232, 0) 100%
@ -440,11 +472,11 @@ const successStyle = {
color: #fff; color: #fff;
&:nth-child(1) { &:nth-child(1) {
background: linear-gradient(to bottom, #3ad980, #34C759); background: linear-gradient(to bottom, #3ad980, #34c759);
} }
&:nth-child(2) { &:nth-child(2) {
background: linear-gradient(to bottom, #3b95ff, #007AFF); background: linear-gradient(to bottom, #3b95ff, #007aff);
} }
} }
} }

View File

@ -17,3 +17,21 @@ export const updateSign = (data) => {
data, data,
}) })
} }
// 签名-领料
export const updateLeaseApplyInfoSign = (data) => {
return http({
method: 'POST',
url: '/material/lease_apply_info/updateLeaseApplyInfoSign',
data,
})
}
// 签名-退料
export const updateSignById = (data) => {
return http({
method: 'POST',
url: '/material/back_apply_info/updateSignById',
data,
})
}