signReceipt.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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" >
  46. <image :src="url" style="height: 100%;width: 100%;"></image>
  47. </view>
  48. <view class="infos-item" >
  49. <p>平台</p>
  50. <p>核准</p>
  51. </view>
  52. <view class="infos-item">
  53. <p>财务</p>
  54. <p>负责人</p>
  55. </view>
  56. <view class="infos-item" style="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. .infos-item{
  195. min-width: 20%;
  196. max-width: 25%;
  197. }
  198. page{
  199. background-color: #f3f4f7;
  200. }
  201. @media screen and (min-width: 290px) {
  202. .receipt{
  203. margin: 24rpx 0px !important ;
  204. }
  205. }
  206. .receipt{
  207. background-color: #fff;
  208. margin: 24rpx 16rpx ;
  209. padding-bottom: 10px;
  210. .title{
  211. font-size: 18px;
  212. color: #101010;
  213. text-align: center;
  214. padding: 20rpx 0;
  215. }
  216. @media screen and (min-width: 290px) {
  217. .content{
  218. margin: 0 0px;
  219. padding: 24rpx 0;
  220. font-size: 2px;
  221. border: 1px solid rgba(51, 51, 51, 1);
  222. .item{
  223. display: flex;
  224. justify-content: space-between;
  225. margin-bottom: 12px;
  226. }
  227. .left,.right{
  228. display: flex;
  229. .text{
  230. flex: 1;
  231. margin-left: 2px;
  232. border-bottom: 1px solid #101010;
  233. }
  234. }
  235. .right{
  236. min-width: 100px;
  237. }
  238. }
  239. }
  240. @media screen and (min-width: 320px) {
  241. .content{
  242. margin: 0 12rpx;
  243. padding: 24rpx 12rpx 24rpx 12rpx;
  244. font-size: 24rpx;
  245. border: 1px solid rgba(51, 51, 51, 1);
  246. .item{
  247. display: flex;
  248. justify-content: space-between;
  249. margin-bottom: 12px;
  250. }
  251. .left,.right{
  252. display: flex;
  253. .text{
  254. flex: 1;
  255. margin-left: 6rpx;
  256. border-bottom: 1px solid #101010;
  257. }
  258. }
  259. .left{
  260. //width: 65%;
  261. }
  262. }
  263. }
  264. .reason-content{
  265. margin-left:2px;
  266. border-bottom: 1px solid #101010;
  267. }
  268. .infos{
  269. margin-top: 12px;
  270. text-align: center;
  271. display: flex;
  272. p{
  273. line-height: 16px;
  274. }
  275. }
  276. }
  277. .sign{
  278. margin: 32rpx 16rpx ;
  279. font-weight: bold;
  280. line-height: 20px;
  281. p{
  282. color: rgba(16, 16, 16, 1);
  283. }
  284. .signature{
  285. background-color: #fff;
  286. margin-top: 8px;
  287. height: 160px;
  288. border-bottom: #c2c2c2 1px solid;
  289. }
  290. .clean-save{
  291. background-color: #fff;
  292. display: flex;
  293. .clean,.save{
  294. width: 50%;
  295. text-align: center;
  296. color: #252525;
  297. line-height: 40px;
  298. }
  299. .clean,.save{
  300. border-right:#c2c2c2 1px solid;
  301. display: flex;
  302. justify-content: center;
  303. img{
  304. margin-right: 4px;
  305. }
  306. }
  307. }
  308. }
  309. .submit{
  310. border-radius: 8px;
  311. background-color: rgba(24, 90, 198, 1);
  312. color: rgba(255, 255, 255, 1);
  313. font-size: 16px;
  314. line-height: 44px;
  315. margin: 0 16px;
  316. position: fixed;
  317. bottom: 12px;
  318. left: 0;
  319. right: 0;
  320. }
  321. .submitNo{
  322. border-radius: 8px;
  323. background-color: #185ac6a8;
  324. color: rgba(255, 255, 255, 1);
  325. font-size: 16px;
  326. line-height: 44px;
  327. margin: 0 16px;
  328. position: fixed;
  329. bottom: 12px;
  330. left: 0;
  331. right: 0;
  332. }
  333. </style>