pref#hmc_签字组件、福利

This commit is contained in:
Paidax
2025-12-19 14:54:26 +08:00
parent 1f5e3828c4
commit 57c469bcd6
14 changed files with 698 additions and 473 deletions
@@ -105,6 +105,9 @@
<!--字典混入-->
<script src="${base!}/components/plugins/sysDict/DictData.js"></script>
<!--签字canvas-->
<script src="${base!}/assets/platform/plugins/smooth-signature/index.umd.min.js"></script>
<script src="${base!}/assets/platform/js/chengSh.js"></script>
<script src="${base!}/assets/platform/js/util/commonUtil.js"></script>
<script src="${base!}/assets/platform/plugins/xlsx/xlsx.full.min.js"></script>
@@ -68,6 +68,8 @@
<!--字典混入-->
<script src="${base!}/components/plugins/sysDict/DictData.js"></script>
<!--签字canvas-->
<script src="${base!}/assets/platform/plugins/smooth-signature/index.umd.min.js"></script>
<!--富文本编辑器-->
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wangeditor/wangEditor.css">
@@ -1,55 +1,22 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<!-- 在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值 -->
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
name="viewport">
<title>签字</title>
<!-- 引入样式文件 -->
<link rel="stylesheet" href="${base!}/assets/platform/plugins/vant/vant.css?v=1.0.1">
<link href="https://res.wx.qq.com/open/libs/weui/2.2.0/weui.min.css" rel="stylesheet">
<!-- 引入 Vue 和 Vant 的 JS 文件 -->
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
<script src="${base!}/assets/platform/plugins/vant/vant.js"></script>
<script src="/assets/platform/plugins/jquery/jquery-1.11.1.min.js"></script>
<script src="/assets/platform/plugins/moment/moment.min.js"></script>
<script src="/assets/platform/js/signature.min.js"></script>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
<script src="${base!}/assets/platform/plugins/vue/vue.js"></script>
<script src="${base!}/assets/platform/plugins/vue-loader/httpVueLoader.js"></script>
<script src="${base!}/assets/platform/plugins/smooth-signature/index.umd.min.js"></script>
<script src="${base!}/assets/platform/plugins/jquery/jquery-1.11.1.min.js"></script>
</head>
<style>
[v-clock] {
display: none
}
</style>
<body style="height: 100%;width: 100%">
<div id="app" style="height: 100%;width: 100%" v-clock>
<van-row style="margin-top: 10vh;text-align: center">
<h3 style="color: #1989fa">提示:请在下方区域签字!</h3>
</van-row>
<van-row style="margin-top: 20px">
<canvas id="canvas" style="border: rgb(220,220,220) 1px solid"></canvas>
</van-row>
<van-row style="margin-top: 20px">
<van-col span="24" style="text-align: center">
<van-row justify="space-around" type="flex">
<van-col span="11">
<van-button @click="reset" size="large" type="default">清 空</van-button>
</van-col>
<van-col span="11">
<van-button :disabled="subDis" @click="doSub" size="large" type="info">提 交
</van-button>
</van-col>
</van-row>
</van-col>
</van-row>
<body>
<div id="app">
<signature @save="save"></signature>
</div>
</body>
<script>
document.body.addEventListener('touchmove', function (e) {
e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)
}, {passive: false}); //passive 参数不能省略,用来兼容ios和android
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
@@ -62,98 +29,82 @@
return '';
}
var qmoption = {
el: '#canvas',
lineWidth: 4,
lineColor: '#000',
overflow: false,
background: '#fff'
}
var qm
var
vue = new Vue({
el: "#app",
data: function () {
return {
is_value_base64: true,
prefix: '',
id: '',
base64: '',
subDis: false,
isNull: function (val) {
if (val === null || val === undefined || val === '') {
return true
}
return false
},
}
},
filters: {
none2str: function (value) {
if (vue.isNull(value)) {
return '暂无'
new Vue({
el: "#app",
components: {
signature: httpVueLoader("/components/sign/index.vue?v=" + new Date().getTime())
},
data() {
return {
prefix: '',
id: '',
isNull: function (val) {
if (val === null || val === undefined || val === '') {
return true
}
return value
}
},
methods: {
reset() {
qm.reset()
return false
},
doSub() {
qm.getContentBase64(false, (val) => {
this.base64 = val
}
},
methods: {
save(signature) {
$.post("/mobile/common/signing/pcUpdate", {
sign: signature,
id: this.id
})
.then((res) => {
if (res.code === 0) {
alert("保存成功")
} else {
alert("保存失败")
}
})
$.post("/signature/doSub", {
prefix: this.prefix,
id: this.id,
base64: this.base64,
is_value_base64: this.is_value_base64
}, (data) => {
if (data.code == 0) {
this.$notify({
message: data.msg,
type: 'success'
});
this.subDis = true
} else {
this.$notify({
message: data.msg,
type: 'danger'
});
}
}, "json");
}
// $.post("/signature/doSub", {
// prefix: this.prefix,
// id: this.id,
// base64: signature,
// is_value_base64: false
// })
// .then((res) => {
// if (res.code === 0) {
// alert("保存成功")
// this.showSignaturePanel = false
// } else {
// alert("保存失败")
// }
// })
},
mounted: () => {
canvas = document.getElementById("canvas");
if (canvas.width < window.innerWidth) {
canvas.width = window.innerWidth;
base64ToFile(base64Data, filename) {
// 将base64的数据部分提取出来
const parts = base64Data.split(";base64,")
const contentType = parts[0].split(":")[1]
const raw = window.atob(parts[1])
const rawLength = raw.length
const uInt8Array = new Uint8Array(rawLength)
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i)
}
if (canvas.height < window.innerHeight) {
canvas.height = window.innerHeight * 0.5;
}
qm = new Signature(qmoption);
qm.create();
},
created: function () {
if (this.isNull(getQueryVariable("id")) || this.isNull(getQueryVariable("prefix"))) {
this.$notify({
message: '缺少参数!',
type: 'danger'
});
this.subDis = true
}
this.id = getQueryVariable("id")
this.prefix = getQueryVariable("prefix")
this.is_value_base64 = getQueryVariable("is_value_base64")
// 使用Blob对象创建File对象
const blob = new Blob([uInt8Array], { type: contentType })
blob.lastModifiedDate = new Date()
blob.name = filename
return new File([blob], filename, { type: contentType })
}
})
},
created: function () {
if (this.isNull(getQueryVariable("id"))) {
this.$notify({
message: '缺少参数!',
type: 'danger'
});
this.subDis = true
}
this.id = getQueryVariable("id")
}
})
</script>
</body>
</html>
@@ -88,11 +88,18 @@ layout("/layouts/platform.html"){
prop="tag" width="120">
</el-table-column>
<el-table-column
header-align="left"
header-align="center"
label="日志内容"
prop="msg"
>
</el-table-column>
<el-table-column
:show-overflow-tooltip="true"
header-align="center"
label="参数"
prop="param"
>
</el-table-column>
<el-table-column
:show-overflow-tooltip="true"
@@ -241,4 +248,4 @@ layout("/layouts/platform.html"){
</script>
<!--#
}
#-->
#-->
@@ -1043,6 +1043,12 @@ layout("/layouts/platform.html"){
r.name = "收货地址:" + r.province + r.city + r.county + r.addressDetail + ",收件人:" + r.userName + ",联系方式:" + r.tel
})
this.addressOptions = resp.data
// 回显默认地址
if (this.addressOptions) {
const address = this.addressOptions.find(a => a.isDefault)
this.$set(this.formData, "addressId", address.id)
this.$set(this.editWelfareData, "receiveAddress", address.name)
}
},
addressChange(val) {
const address = this.addressOptions.find(a => a.id === val)
@@ -1123,6 +1129,8 @@ layout("/layouts/platform.html"){
}
})
// 把地址给置空然后重新复制
this.formData.addressId = null
this.exportWelfareListDialog = true
const data = await searchUser(row.loginname, null, null, null, null)
@@ -1165,7 +1173,7 @@ layout("/layouts/platform.html"){
for (const option of options) {
// 检查是否有 specs
if (option.specs) {
if (option.specs && option.specs.length > 0) {
// 检查 selectSpecs 是否为空或未定义
if (!option.selectSpecs) {
this.$message.warning('请选择' + option.optionName + '的规格')
@@ -763,10 +763,26 @@ layout("/layouts/platform.html"){
//如果已选择
if (row.isChoose > 0) {
const data = this.addressOptions.map(r => {
const data = r.name = "收货地址:" + r.province + r.city + r.county + r.addressDetail + ",收件人:" + r.userName + ",联系方式:" + r.tel
const resultData = data.replace(/[,:]/g, '')
return {id: r.id, name: resultData}
})
const replace = this.userSelection[0].receiveAddress.replace(/[,:]/g, '')
let findData = data.find(v => v.name === replace)
if (findData && Array.isArray(findData)) {
findData = findData[0]
}
this.$set(this.formData, "receiveAddress", this.userSelection[0].receiveAddress)
this.$set(this.formData, "addressId", null)
this.$set(this.formData, "addressId", findData.id)
this.$set(this.formData, "sign", this.userSelection[0].userSign)
} else {
debugger
const address = this.addressOptions.find(a => a.isDefault)
if (address) {
this.$set(this.formData, "receiveAddress", address.name)