123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <view class="sign">
- <ujp-navbar title="签字"></ujp-navbar>
-
- <p>请在下方空白区域使用正楷字体进行电子签名</p>
- <view class="signature">
- <l-signature disableScroll ref="signatureRef" :penColor="penColor" :penSize="penSize"
- :openSmooth="openSmooth"></l-signature>
- </view>
- <view class="clean-save">
- <view class="clean" @click="onClick('clear')">
- <img src="../../../assets/img/riLine-eraser-line.svg" alt="">
- <view class="">
- 清除
- </view>
- </view>
- <view class="save" @click="onClick('save')">
- <img src="../../../assets/img/riLine-eraser-line.svg" alt="">
- <view class="">
- 保存
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import LSignature from '@/components/l-signature/l-signature.vue'
- import * as API from '@/apis/finance.js'
- import * as API_Common from '@/apis/common.js'
- import {
-
- parseUnixTime,
-
- } from '@/utils'
- export default {
- data() {
- return {
- info: null,
- detailList:null,
- penColor: '',
- penSize: 5,
- url: '',
- suburl: '',
- openSmooth: true,
- nowTime:"",
- serverUrl: "",
- token: "",
- uuid:"",
- }
- },onLoad(op){
- //this.userInfo=this.carhelp.getPersonInfo()
- this.uuid=op.uuid;
- this.id=op.id
- this.getInfo()
- // alert(this.carhelp.getToken({
- // jp_identity:
- // }))
- },
- methods: {
- //上传图片
- uploadpic() {
- uni.showLoading({
- title: "图片上传中",
- mask: true,
- })
- var formData = {
- "photoName":"signature.png",
- "photoBase64Data": this.url
- }
- // formData.append('photoName', '1.jpg');
- // formData.append('photoBase64Data', this.url);
-
-
- API_Common.uploadBase64Json(formData).then(response => {
- //this.suburl=response.data;
- this.info.status=0;
- this.info.signUrl=response.data;
- //this.$emit("signsubmit",0,this.suburl)
- this.submitFrom()
- }).catch(error => {
- uni.hideLoading()
- uni.showModal({
- title:"提示",
- content:error,
- showCancel:false
- })
- })
-
-
- },
- submitFrom(){
-
-
- uni.showLoading({
- title: "提交中...",
- mask: true,
- })
-
- //this.info.status=0;
-
- //var str=JSON.stringify();
- API.applyWithdrawByAccounting({
-
- record:this.info,
- detailList:this.detailList
-
- }).then((res) => {
-
- this.carhelp.set("withdrawRecord",{
- uuid:this.uuid,
- })
- this.id=res.data;
- uni.hideLoading()
- uni.redirectTo({
- url:"/pagesFinance/user/applyResult?value="+this.info.applicationAmount
- })
-
- }).catch(error => {
- uni.hideLoading()
- uni.showModal({
- title:"提示",
- content:error,
- showCancel:false
- })
- })
- },
- getInfo(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.getWithdrawInfoByAccounting(this.id).then((res) => {
-
- this.info=res.data.record
-
- this.detailList=res.data.detailList
- uni.hideLoading()
-
- }).catch(error => {
- uni.showToast({
- title: error
- })
- })
- },
- onClick(type) {
- this.url =""
- if(type == 'openSmooth') {
- this.openSmooth = !this.openSmooth
- return
- }
- if (type == 'save') {
- this.$refs.signatureRef.canvasToTempFilePath({
- success: (res) => {
- // 是否为空画板 无签名
- if(res.isEmpty){
- this.url ="";
- }else{
- this.url = res.tempFilePath
-
- console.log(this.url)
- // 生成图片的临时路径
- // app | H5 | 微信小程序 生成的是base64
- //this.uploadpic()
- uni.showLoading({
- title: '上传中'
- });
- this.token=this.carhelp.getToken();
- this.serverUrl=process.car.BASE_URL;
- var time= "";//parseUnixTime(new Date(), '{y}{m}{d}-{h}-{i}');
- uni.request({
- url: this.serverUrl + "/uploadBase64Json",
- method: "POST",
- header: {
- Authorization: this.token
- },
- data: {
- "photoName":"signature"+time+".png",
- "photoBase64Data": this.url
- },
- success: (res) => {
- uni.hideLoading();
-
- console.log(res)
-
- if(res.data.result){
- uni.showToast({
- title: '签名保存成功!',
- duration: 2000
- });
-
- this.info.status=0;
- this.info.signUrl=res.data.data;
- //this.$emit("signsubmit",0,this.suburl)
- this.submitFrom()
- }
- else{
- uni.showToast({
- title: '签名保存失败!'+ JSON.stringify(res),
- duration: 2000
- });
- }
- }
- })
- }
- }
- })
- return
- }
- if (this.$refs.signatureRef)
- this.$refs.signatureRef[type]()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .sign{
- margin: 32rpx 16rpx ;
- font-weight: bold;
- line-height: 20px;
- p{
- color: rgba(16, 16, 16, 1);
- }
- .signature{
- background-color: #fff;
- margin-top: 8px;
- height: 160px;
- border: #c2c2c2 1px solid;
- }
- .clean-save{
- background-color: #fff;
- display: flex;
- .clean,.save{
- width: 50%;
- text-align: center;
- color: #252525;
- line-height: 40px;
- }
- .clean,.save{
- border:#c2c2c2 1px solid;
- display: flex;
- justify-content: center;
- img{
- margin-right: 4px;
- }
- }
- }
- }
- </style>
|