Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
confucius
Commits
c63d8c66
Commit
c63d8c66
authored
Oct 09, 2021
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
adbd0054
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
51 deletions
+79
-51
mySJModule.vue
src/pages/financial/components/mySJModule.vue
+79
-51
No files found.
src/pages/financial/components/mySJModule.vue
View file @
c63d8c66
...
...
@@ -43,7 +43,7 @@
<div
style=
"font-size: 14px; color: #000;padding: 8px 15px;display: flex; justify-content: space-between;"
>
<span
style=
"border-left: 3px solid #e95252;padding-left: 10px;"
>
财务收据
</span>
<div
style=
"display: flex;align-items: center;"
v-if=
"data && data.State "
>
<span
class=
"_btn"
@
click=
"Printreceipt"
v-if=
"data.State==2"
>
打印
</span>
<span
class=
"_btn"
@
click=
"Printreceipt"
>
打印
</span>
<span
class=
"_btn"
@
click=
'addreceipt'
v-if=
"data.State==2&& isoneself"
>
修改
</span>
<span
class=
"_btn"
@
click=
'setdelete'
v-if=
"data.State==2 && isoneself"
>
删除
</span>
<span
class=
"_btn"
@
click=
'getshare'
>
分享
</span>
...
...
@@ -111,13 +111,13 @@
</
template
>
</el-dialog>
<!-- 收据的分享暂时 -->
<el-dialog
custom-class=
'w
2
00'
title=
"分享图"
:visible
.
sync=
"sharedialog"
center
>
<el-dialog
custom-class=
'w
4
00'
title=
"分享图"
:visible
.
sync=
"sharedialog"
center
>
<
template
>
<div
class=
"courserefund_Div"
id=
"proToCol"
style=
"display: flex;flex-direction: column;align-items: center;"
>
<img
src=
"http://192.168.20.214:8130/EduSystem/Test/Upload/Temporary/202109290408209920000000003.jpeg"
alt=
""
style=
"width:150px;"
/
>
<
div>
尊敬的客户
</div
>
<div
>
成都市锦江区甲鹤外语培训学校 发送给您了一个财务收据,请长按识别二维码查收
</div>
</div>
<div
class=
"courserefund_Div"
id=
"proToCol"
style=
"display: flex;flex-direction: column;align-items: center; padding: 15px;"
>
<
img
src=
"http://192.168.20.214:8130/EduSystem/Test/Upload/Temporary/202109290408209920000000003.jpeg"
alt=
""
style=
"width:100%;"
/
>
<div
style=
"margin: 15px 0;"
>
尊敬的客户,
成都市锦江区甲鹤外语培训学校 发送给您了一个财务收据,请长按识别二维码查收
</div>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<button
class=
"hollowFixedBtn"
@
click=
"sharedialog=false"
>
关闭
</button>
<button
class=
"normalBtn"
type=
"primary"
@
click=
"download()"
>
下载
</button>
...
...
@@ -131,6 +131,11 @@
</template>
<
script
>
import
{
Loading
}
from
'quasar'
import
html2canvas
from
"html2canvas"
;
import
{
getReceiptInfoForFinanceId
,
setReceiptInfo
,
...
...
@@ -167,8 +172,9 @@
EmployeeId
:
0
,
isoneself
:
false
,
//是否是本人操作
sharedialog
:
false
,
Money
:
0
,
Fee
:
0
,
Money
:
0
,
Fee
:
0
,
imgurl
:
''
,
//分享的二维码
}
},
watch
:
{
...
...
@@ -234,7 +240,7 @@
this
.
addMsg
.
Remark
=
''
;
//事由
this
.
addMsg
.
Money
=
Number
(
this
.
Money
)
+
Number
(
this
.
Fee
)
this
.
addMsg
.
FinanceId
=
this
.
FrID
this
.
addMsg
.
Id
=
0
this
.
addMsg
.
Id
=
0
}
...
...
@@ -257,7 +263,7 @@
if
(
res
.
Code
==
1
)
{
that
.
Success
(
res
.
Message
);
that
.
getDetails
()
this
.
addMsg
.
Id
=
0
this
.
addMsg
.
Id
=
0
this
.
addMsg
.
Remitter
=
this
.
GetDetail
.
RemitterName
;
//交款人
this
.
addMsg
.
Remark
=
''
;
//事由
this
.
addMsg
.
Money
=
Number
(
this
.
Money
)
+
Number
(
this
.
Fee
)
...
...
@@ -269,23 +275,31 @@
}).
catch
(()
=>
{
});
},
getshare
()
{
// this.apipostDS(
// "/api/user/GetWeiXinQRCodeForHT", {
// Path: "/pages/school/personal/receiptDetails?FinanceId=" + this.FrID,
// With: 212
// },
// (res) => {
// if (res.data.resultCode == 1) {
// if (res.data.data) {
// let getBlob = this.domainManager().mallUrl + res.data.data
// console.log(getBlob)
// }
// } else {
// this.Error(res.data.message);
// }
// }
// );
this
.
sharedialog
=
true
var
tipLoadding
=
Loading
;
tipLoadding
.
show
({
message
:
'正在生成二维码,请稍后...'
})
this
.
apipostDS
(
"/api/user/GetWeiXinQRCodeForHT"
,
{
Path
:
"/pages/school/personal/receiptDetails?id="
+
this
.
FrID
,
With
:
430
},
(
res
)
=>
{
if
(
res
.
data
.
resultCode
==
1
)
{
if
(
res
.
data
.
data
)
{
this
.
imgurl
=
this
.
domainManager
().
mallUrl
+
res
.
data
.
data
console
.
log
(
this
.
imgurl
)
this
.
sharedialog
=
true
tipLoadding
.
hide
();
}
}
else
{
this
.
Error
(
res
.
data
.
message
);
tipLoadding
.
hide
();
}
}
);
},
blobToDataURL
(
blob
,
callback
)
{
var
a
=
new
FileReader
()
...
...
@@ -295,30 +309,44 @@
a
.
readAsDataURL
(
blob
)
},
download
()
{
//下载
this
.
downloadFile
(
'收据分享.png'
,
'http://192.168.20.214:8130/EduSystem/Test/Upload/Temporary/202109290408209920000000003.jpeg'
)
setTimeout
(()
=>
{
let
canvasID
=
document
.
getElementById
(
"proToCol"
);
let
a
=
document
.
createElement
(
"a"
);
html2canvas
(
canvasID
,
{
useCORS
:
true
,
//【重要】开启跨域配置
allowTaint
:
true
,
//允许跨域图片
backgroundColor
:
"#FFFFFF"
,
scale
:
1.3
,
taintTest
:
false
//是否在渲染前测试图片
}).
then
(
canvas
=>
{
let
dom
=
document
.
body
.
appendChild
(
canvas
);
dom
.
style
.
display
=
"none"
;
a
.
style
.
display
=
"none"
;
document
.
body
.
removeChild
(
dom
);
let
blob
=
this
.
dataURLToBlob
(
dom
.
toDataURL
(
"image/png"
));
a
.
setAttribute
(
"href"
,
URL
.
createObjectURL
(
blob
));
var
name
=
'财务收据'
;
a
.
setAttribute
(
"download"
,
name
);
document
.
body
.
appendChild
(
a
);
a
.
click
();
URL
.
revokeObjectURL
(
blob
);
document
.
body
.
removeChild
(
a
);
});
},
1000
);
},
dataURLToBlob
(
dataurl
)
{
let
arr
=
dataurl
.
split
(
","
);
let
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
];
let
bstr
=
atob
(
arr
[
1
]);
let
n
=
bstr
.
length
;
let
u8arr
=
new
Uint8Array
(
n
);
while
(
n
--
)
{
u8arr
[
n
]
=
bstr
.
charCodeAt
(
n
);
}
return
new
Blob
([
u8arr
],
{
type
:
mime
});
},
downloadFile
(
name
,
imgsrc
)
{
var
image
=
new
Image
();
// 解决跨域 Canvas 污染问题
image
.
setAttribute
(
"crossOrigin"
,
"anonymous"
);
image
.
onload
=
function
()
{
var
canvas
=
document
.
createElement
(
"canvas"
);
canvas
.
width
=
image
.
width
;
canvas
.
height
=
image
.
height
;
var
context
=
canvas
.
getContext
(
"2d"
);
context
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
);
var
url
=
canvas
.
toDataURL
(
"image/png"
);
//得到图片的base64编码数据
var
a
=
document
.
createElement
(
"a"
);
// 生成一个a元素
var
event
=
new
MouseEvent
(
"click"
);
// 创建一个单击事件
a
.
download
=
name
||
"photo"
;
// 设置图片名称
a
.
href
=
url
;
// 将生成的URL设置为a.href属性
a
.
dispatchEvent
(
event
);
// 触发a的单击事件
};
image
.
src
=
imgsrc
;
}
}
}
</
script
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment