signReceipt.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <view>
  3. <view class="receipt">
  4. <view class="title">
  5. 收据
  6. </view>
  7. <view class="content">
  8. <view class="item">
  9. <view class="date">
  10. 日期:{{nowTime}}
  11. </view>
  12. <view class="no">
  13. No.<text style="color: red;">{{obj.invoiceNo }}</text>
  14. </view>
  15. </view>
  16. <view class="item company-way">
  17. <view class="left">
  18. <view class="name">交款单位</view><view class="text">{{obj.payer }}</view>
  19. </view>
  20. <view class="right">
  21. <view class="name">收款方式</view><view class="text">{{obj.paymentMethod }}</view>
  22. </view>
  23. </view>
  24. <view class="item company-way">
  25. <view class="left">
  26. <view class="name">人民币(大写)</view><view class="text">{{getDX(obj.chargingProfitAmount)}}</view>
  27. </view>
  28. <view class="right">
  29. <view class="name">¥</view><view class="text">{{obj.chargingProfitAmount?showNumJP(obj.chargingProfitAmount):0}}</view>
  30. </view>
  31. </view>
  32. <view class="">
  33. <text class="reason">
  34. 收款事由
  35. </text>
  36. <text class="reason-content">
  37. {{obj.stationName}}{{showTime(obj.startTime)}}{{showTime(obj.endTime)}}充电提成
  38. </text>
  39. </view>
  40. <view class="infos">
  41. <view class="infos-item">
  42. <p>桩主</p>
  43. <p>(收款人)</p>
  44. </view>
  45. <view class="infos-item" style="width:140rpx ;">
  46. <image :src="url" style="width: 140rpx;height: 100%;"></image>
  47. </view>
  48. <view class="infos-item" >
  49. <p>平台</p>
  50. <p>核准</p>
  51. </view>
  52. <view class="infos-item" style="margin-left: 75rpx;">
  53. <p>财务</p>
  54. <p>负责人</p>
  55. </view>
  56. <view class="infos-item" style="margin-left: 75rpx;line-height: 64rpx;">
  57. 会计
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="sign">
  63. <p>请在下方空白区域使用正楷字体进行电子签名</p>
  64. <view class="signature">
  65. <l-signature disableScroll ref="signatureRef" :penColor="penColor" :penSize="penSize" :openSmooth="openSmooth" ></l-signature>
  66. </view>
  67. <view class="clean-save">
  68. <view class="clean" @click="onClick('clear')" >
  69. <img src="../../../assets/img/riLine-eraser-line.svg" alt=""><view class="">
  70. 清除
  71. </view>
  72. </view>
  73. <view class="save" @click="onClick('save')">
  74. <img src="../../../assets/img/riLine-eraser-line.svg" alt=""><view class="">
  75. 保存
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <button :class="{
  81. submit:this.url,
  82. submitNo:!this.url
  83. }" @click="submit()">提交电子收据</button>
  84. </view>
  85. </template>
  86. <script>
  87. import LSignature from '@/components/l-signature/l-signature.vue'
  88. import * as WxJsApi from '@/utils/wxJsApi'
  89. import * as API_Common from '@/apis/common.js'
  90. import {
  91. parseUnixTime,
  92. DX
  93. } from '@/utils'
  94. export default {
  95. components: {
  96. LSignature
  97. },
  98. data() {
  99. return {
  100. penColor: '',
  101. penSize: 5,
  102. url: '',
  103. suburl: '',
  104. openSmooth: true,
  105. nowTime:"",
  106. }
  107. },
  108. props:{
  109. obj:{},
  110. },
  111. onReady() {
  112. },
  113. created() {
  114. this.nowTime = parseUnixTime(new Date(), '{y}年{m}月{d}日')
  115. console.log(this.nowTime)
  116. },
  117. methods: {
  118. showTime(name) {
  119. if (!name) {
  120. return ''
  121. }
  122. return parseUnixTime(new Date(name), '{y}年{m}月{d}日');
  123. },
  124. getDX(value) {
  125. if (value) {
  126. var c = DX(value)
  127. return c
  128. } else {
  129. return '零元整'
  130. }
  131. },
  132. //上传图片
  133. uploadpic() {
  134. uni.showLoading({
  135. title: "加载中",
  136. mask: true,
  137. })
  138. var formData = {
  139. photoName:"1.jpg",
  140. 'photoBase64Data': this.url
  141. };
  142. // formData.append('photoName', '1.jpg');
  143. // formData.append('photoBase64Data', this.url);
  144. API_Common.uploadBase64(formData).then(response => {
  145. this.suburl=response.data;
  146. this.$emit("signsubmit",0,this.suburl)
  147. }).catch(error => {
  148. uni.hideLoading()
  149. uni.showModal({
  150. title:"提示",
  151. content:error,
  152. showCancel:false
  153. })
  154. })
  155. },
  156. submit(){
  157. if(this.url){
  158. this.uploadpic()
  159. }else{
  160. uni.showToast({
  161. title: "请签字后,点击保存"
  162. })
  163. }
  164. },
  165. onClick(type) {
  166. this.url =""
  167. if(type == 'openSmooth') {
  168. this.openSmooth = !this.openSmooth
  169. return
  170. }
  171. if (type == 'save') {
  172. this.$refs.signatureRef.canvasToTempFilePath({
  173. success: (res) => {
  174. // 是否为空画板 无签名
  175. console.log(res.isEmpty)
  176. if(res.isEmpty){
  177. this.url ="";
  178. }else{
  179. this.url = res.tempFilePath
  180. }
  181. // 生成图片的临时路径
  182. // app | H5 | 微信小程序 生成的是base64
  183. }
  184. })
  185. return
  186. }
  187. if (this.$refs.signatureRef)
  188. this.$refs.signatureRef[type]()
  189. },
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. page{
  195. background-color: #f3f4f7;
  196. }
  197. @media screen and (min-width: 290px) {
  198. .receipt{
  199. margin: 24rpx 0px !important ;
  200. }
  201. }
  202. .receipt{
  203. background-color: #fff;
  204. margin: 24rpx 16rpx ;
  205. padding-bottom: 10px;
  206. .title{
  207. font-size: 18px;
  208. color: #101010;
  209. text-align: center;
  210. padding: 20rpx 0;
  211. }
  212. @media screen and (min-width: 290px) {
  213. .content{
  214. margin: 0 0px;
  215. padding: 24rpx 0;
  216. font-size: 2px;
  217. border: 1px solid rgba(51, 51, 51, 1);
  218. .item{
  219. display: flex;
  220. justify-content: space-between;
  221. margin-bottom: 12px;
  222. }
  223. .left,.right{
  224. display: flex;
  225. .text{
  226. flex: 1;
  227. margin-left: 2px;
  228. border-bottom: 1px solid #101010;
  229. }
  230. }
  231. .right{
  232. min-width: 100px;
  233. }
  234. }
  235. }
  236. @media screen and (min-width: 320px) {
  237. .content{
  238. margin: 0 6rpx;
  239. padding: 24rpx 12rpx 24rpx 12rpx;
  240. font-size: 24rpx;
  241. border: 1px solid rgba(51, 51, 51, 1);
  242. .item{
  243. display: flex;
  244. justify-content: space-between;
  245. margin-bottom: 12px;
  246. }
  247. .left,.right{
  248. display: flex;
  249. .text{
  250. flex: 1;
  251. margin-left: 6rpx;
  252. border-bottom: 1px solid #101010;
  253. }
  254. }
  255. .left{
  256. //width: 65%;
  257. }
  258. }
  259. }
  260. .reason-content{
  261. margin-left:2px;
  262. border-bottom: 1px solid #101010;
  263. }
  264. .infos{
  265. margin-top: 12px;
  266. text-align: center;
  267. display: flex;
  268. p{
  269. line-height: 16px;
  270. }
  271. }
  272. }
  273. .sign{
  274. margin: 32rpx 16rpx ;
  275. font-weight: bold;
  276. line-height: 20px;
  277. p{
  278. color: rgba(16, 16, 16, 1);
  279. }
  280. .signature{
  281. background-color: #fff;
  282. margin-top: 8px;
  283. height: 160px;
  284. border-bottom: #c2c2c2 1px solid;
  285. }
  286. .clean-save{
  287. background-color: #fff;
  288. display: flex;
  289. .clean,.save{
  290. width: 50%;
  291. text-align: center;
  292. color: #252525;
  293. line-height: 40px;
  294. }
  295. .clean,.save{
  296. border-right:#c2c2c2 1px solid;
  297. display: flex;
  298. justify-content: center;
  299. img{
  300. margin-right: 4px;
  301. }
  302. }
  303. }
  304. }
  305. .submit{
  306. border-radius: 8px;
  307. background-color: rgba(24, 90, 198, 1);
  308. color: rgba(255, 255, 255, 1);
  309. font-size: 16px;
  310. line-height: 44px;
  311. margin: 0 16px;
  312. position: fixed;
  313. bottom: 12px;
  314. left: 0;
  315. right: 0;
  316. }
  317. .submitNo{
  318. border-radius: 8px;
  319. background-color: #185ac6a8;
  320. color: rgba(255, 255, 255, 1);
  321. font-size: 16px;
  322. line-height: 44px;
  323. margin: 0 16px;
  324. position: fixed;
  325. bottom: 12px;
  326. left: 0;
  327. right: 0;
  328. }
  329. </style>