Commit a85b23d1 by chenwq

feat(签收): 添加签名预设功能并优化签收对话框

在签收对话框中新增签名预设功能,用户可以选择已有签名或手写签名。主要修改包括:
1. 添加获取签名预设列表的API接口
2. 在签收对话框中展示签名预设选项
3. 优化签名区域布局和样式
4. 调整按钮位置和交互逻辑
1 parent 2594b48f
...@@ -90,4 +90,16 @@ const deliverySign = params => { ...@@ -90,4 +90,16 @@ const deliverySign = params => {
}) })
} }
export default { getTypeList, getDeliveryList, addPurchaseOrder, exportExcel, getDeliveryDetail, deliverySignDetail, deliverySign }
\ No newline at end of file \ No newline at end of file
// 分页查询签名预设
const getSignList = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = 'dj.api.smartcarlife.purchaseOrder.preset.sign.page'
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getTypeList, getDeliveryList, addPurchaseOrder, exportExcel, getDeliveryDetail, deliverySignDetail, deliverySign, getSignList }
\ No newline at end of file \ No newline at end of file
<template> <template>
<GLDialog v-if="dialogShow" bigTitle="确认签收" mode="big" :visible.sync="dialogShow" :close-on-click-modal="false" @onCancel="handleDetailClose" @onOk="save"> <GLDialog v-if="dialogShow" bigTitle="确认签收" mode="big" :visible.sync="dialogShow" :close-on-click-modal="false" @onCancel="handleDetailClose">
<div class="detail-info"> <div class="detail-info">
<div> <div>
发货单号: 发货单号:
...@@ -14,23 +14,45 @@ ...@@ -14,23 +14,45 @@
<span>{{ dayjs(detailInfo.deliveryDate).format('YYYY-MM-DD HH:mm:ss') }}</span> <span>{{ dayjs(detailInfo.deliveryDate).format('YYYY-MM-DD HH:mm:ss') }}</span>
</div> </div>
</div> </div>
<div class="table-wrap"> <div v-loading="btnLoading">
<el-form ref="addForm" :model="detailInfo" size="small"> <div class="table-wrap">
<GLTable :tableData="detailInfo.deliveryDetailList" :noDataImg="url" :tableParams="tableParams" :hasPage="false"> <el-form ref="addForm" :model="detailInfo" size="small">
</GLTable> <GLTable :tableData="detailInfo.deliveryDetailList" :noDataImg="url" :tableParams="tableParams" :hasPage="false">
</el-form> </GLTable>
<div class="sign-box"> </el-form>
<div class="red-txt">*请在区域内签字完成</div> <div class="sign-box-wrap">
<div class="background-text">签字区</div> <div class="preset-box">
<div class="signature-container"> <div class="title">已有签名预设</div>
<VueSignaturePad width="100%" height="100%" ref="signaturePad" :options="options" /> <div v-if="signList.length" class="sign-img-box">
</div> <div v-for="(item, index) in signList" :key="index">
<div class="btns"> <img :src="item.signFileUrl" @click="handleSignClick(item, index)" :class="{'active': activeSignIdx == index, 'sign-img': true}" alt="" />
<el-button type="text" size="mini" @click="clear">清除</el-button> </div>
<el-button type="text" size="mini" @click="undo">撤销</el-button> </div>
<div class="emptyCom" v-else>
<img :src="emptyImgUrl" class="emptyImg" alt="" />
<span class="tips">暂无数据</span>
</div>
</div>
<div v-if="activeSignIdx != -1" class="sign-box">
<img :src="signList[activeSignIdx].signFileUrl" class="check-sign-img" alt="" />
</div>
<div class="sign-box" v-show="activeSignIdx == -1">
<div class="red-txt">*空白区域内写下名字</div>
<div class="background-text">签字区</div>
<div class="signature-container">
<VueSignaturePad width="100%" height="100%" ref="signaturePad" :options="options" />
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<template slot="footer">
<span class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="clear" v-loading="btnLoading">重写</el-button>
<el-button v-show="activeSignIdx == -1" plain size="small" class="btn-three" style="margin-left: 10px;" @click="undo" v-loading="btnLoading">撤销</el-button>
<el-button type="primary" size="small" style="margin-left: 10px;" @click="save" v-loading="btnLoading">确定</el-button>
</span>
</template>
</GLDialog> </GLDialog>
</template> </template>
...@@ -73,6 +95,9 @@ export default { ...@@ -73,6 +95,9 @@ export default {
backgroundColor: 'rgba(255, 255, 255, 0.0)' backgroundColor: 'rgba(255, 255, 255, 0.0)'
}, },
btnLoading: false, btnLoading: false,
activeSignIdx: -1,
signList: [],
emptyImgUrl: require('@/assets/empty.png'),
membraneTypeList: membraneTypeList, membraneTypeList: membraneTypeList,
dayjs: dayjs, dayjs: dayjs,
goodsList: [], goodsList: [],
...@@ -109,12 +134,18 @@ export default { ...@@ -109,12 +134,18 @@ export default {
detailInfo: {} detailInfo: {}
} }
}, },
created() { }, mounted() {
this.getSignList()
},
methods: { methods: {
undo() { undo() {
this.$refs.signaturePad.undoSignature() this.$refs.signaturePad.undoSignature()
}, },
clear() { clear() {
if (this.activeSignIdx != -1) {
this.activeSignIdx = -1
return true
}
this.$refs.signaturePad.clearSignature() this.$refs.signaturePad.clearSignature()
}, },
save() { save() {
...@@ -126,7 +157,7 @@ export default { ...@@ -126,7 +157,7 @@ export default {
if (this.btnLoading) { if (this.btnLoading) {
return return
} }
if (isEmpty) { if (isEmpty && this.activeSignIdx == -1) {
this.$message({ this.$message({
message: '请先完成签名', message: '请先完成签名',
type: 'warning', type: 'warning',
...@@ -135,15 +166,30 @@ export default { ...@@ -135,15 +166,30 @@ export default {
return return
} }
console.log(data, '保存图片----') console.log(data, '保存图片----')
const base64 = 'png@' + data.split('base64,')[1] if (this.activeSignIdx != -1) {
this.loading = true this.deliverySign(this.signList[this.activeSignIdx].signFileUrl)
this.$apis.sysBase.uploadImg({ file: base64, fileType: 'image' }).then(res => { } else {
console.log(res, 'res----') const base64 = 'png@' + data.split('base64,')[1]
this.deliverySign(res) this.loading = true
}).catch(() => { this.$apis.sysBase.uploadImg({ file: base64, fileType: 'image' }).then(res => {
this.loading = false console.log(res, 'res----')
this.deliverySign(res)
}).catch(() => {
this.loading = false
})
}
},
getSignList() {
this.$apis.delivery.getSignList({}).then(res => {
console.log(res.list, 'res----')
this.signList = res.list
}) })
}, },
handleSignClick(item, index) {
this.activeSignIdx = index
this.$refs.signaturePad.clearSignature()
},
deliverySign(url) { deliverySign(url) {
const params = { const params = {
id: this.info.orderDeliveryId, id: this.info.orderDeliveryId,
...@@ -218,6 +264,60 @@ export default { ...@@ -218,6 +264,60 @@ export default {
z-index: 9999999; z-index: 9999999;
position: static; position: static;
} }
.sign-box-wrap {
display: flex;
justify-content: space-between;
height: 226px;
margin: 24px auto 19px;
}
.preset-box {
width: calc(100% - 640px);
.title {
color: #333333;
font-size: 14px;
font-weight: 600;
}
.sign-img-box {
display: flex;
flex-wrap: wrap;
}
.sign-img {
width: 128px;
height: 48px;
cursor: pointer;
border: 1px solid #ffffff;
margin-top: 16px;
}
.sign-img:nth-child(odd) {
margin-right: 14px;
}
.sign-img.active {
border: 1px solid #5850ff;
}
}
.check-sign-img {
width: 640px;
height: 226px;
}
.emptyCom {
display: flex;
flex-direction: column;
justify-items: center;
align-items: center;
margin: 75px auto;
text-align: center;
.emptyImg {
width: 64px;
height: 41px;
}
.tips {
color: #999999;
font-size: 14px;
margin: 16px 0;
}
}
.sign-box { .sign-box {
position: relative; position: relative;
width: 640px; width: 640px;
...@@ -226,7 +326,6 @@ export default { ...@@ -226,7 +326,6 @@ export default {
opacity: 1; opacity: 1;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
background: #fafafa; background: #fafafa;
margin: 24px auto 19px;
.signature-container { .signature-container {
position: relative; position: relative;
...@@ -244,7 +343,6 @@ export default { ...@@ -244,7 +343,6 @@ export default {
color: #ededed; color: #ededed;
font-size: 88px; font-size: 88px;
pointer-events: none; pointer-events: none;
letter-spacing: 32px;
} }
::v-deep .vue-signature-pad { ::v-deep .vue-signature-pad {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!