signContract.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. <template>
  2. <view class="content">
  3. <!-- <view class="content1">
  4. <view style='width:70px'>付款方式</view>
  5. <u-radio-group v-model="dataDetails.advanceFreightService" placement="row">
  6. <u-radio :customStyle="radioCustomStyle" v-for="(item, index) in radiolist1" :key="index"
  7. :label="item.name" :name="item.name" @change="radioChange">
  8. </u-radio>
  9. </u-radio-group>
  10. </view> -->
  11. <view class="content2">
  12. <view class="flex">
  13. <view class="title">合同摘要</view>
  14. <view class="preview" @click="submit(1)">预览合同</view>
  15. </view>
  16. <view class='row-between'>
  17. <view class="gray">发货单位</view>
  18. <view class="">{{dataDetails.compName?dataDetails.compName:'个人货主'}}</view>
  19. </view>
  20. <view class='row-between'>
  21. <view class="gray">发货地</view>
  22. <view class="place">
  23. {{dataDetails.sendPrivate}}{{dataDetails.sendCity}}{{dataDetails.sendArea}}{{dataDetails.sendDetailedAddress}}
  24. </view>
  25. </view>
  26. <view class='row-between'>
  27. <view class="gray">卸货地</view>
  28. <view class=" place">
  29. {{dataDetails.unloadPrivate}}{{dataDetails.unloadCity}}{{dataDetails.unloadArea}}{{dataDetails.unloadDetailedAddress}}
  30. </view>
  31. </view>
  32. <view class='row-between'>
  33. <view class="gray">货名</view>
  34. <view class="">{{dataDetails.goodsName}}</view>
  35. </view>
  36. <view class='row-between'>
  37. <view class="gray">距离</view>
  38. <view class="">约{{dataDetails.distance}}公里</view>
  39. </view>
  40. <!-- 司机没有工本费 -->
  41. <!-- <view class='row-between'>
  42. <view class="gray">工本费(元)</view>
  43. <view class="">{{dataDetails.serviceCharge}}</view>
  44. </view> -->
  45. <view class="title">
  46. 完善信息
  47. </view>
  48. <view class='row-between'>
  49. <view class="gray">运费(元/车)</view>
  50. <!-- <view class="">{{dataDetails.freight}}{{dataDetails.illingMethod==0?'元/吨':'元/车'}}</view> -->
  51. <!-- <view class="flex"><input type="text" placeholder="请输入运费" v-model="dataDetails.freight"
  52. class="text-align-right yf-input">{{dataDetails.freight}}元/车</view> -->
  53. <view class="flex">
  54. <u--input placeholder="请输入运费" border="none" type="number" v-model="dataDetails.freight1"
  55. inputAlign='right' clearable @input="preMoney"></u--input>
  56. <!-- <span> 元/车</span> -->
  57. </view>
  58. </view>
  59. <view class='row-between'>
  60. <view class="gray">车牌号</view>
  61. <view class="" :style="{'color':dataDetails.carrierInfo.carNo?'#000':'#BBBBBB'}" @click="carClick">
  62. {{dataDetails.carrierInfo.carNo?dataDetails.carrierInfo.carNo:'请选择车牌号'}}
  63. <!--< u--input placeholder="请输入车牌号" border="none" readOnly v-model="dataDetails.carrierInfo.carNo"
  64. inputAlign='right' clearable></u--input> -->
  65. </view>
  66. <!-- <view class="flex">
  67. <input class="" v-model='dataDetails.carrierInfo.carNo' @click.stop="handleShowKeyboard"
  68. :disabled="true" placeholder="输入车牌号" name="input" style="text-align: right;"></input>
  69. </view> -->
  70. </view>
  71. <view class='row-between'>
  72. <view class="gray">挂车号(选填)</view>
  73. <view class="flex">
  74. <view :style="{'color':dataDetails.trailerNumber?'#000':'#BBBBBB'}">{{dataDetails.trailerNumber?dataDetails.trailerNumber:'自动获取'}}</view>
  75. <!-- <u--input placeholder="请输入挂车号" border="none" readOnly v-model="dataDetails.trailerNumber"
  76. inputAlign='right' clearable></u--input> -->
  77. </view>
  78. </view>
  79. <view class='row-between'>
  80. <view class="gray">装车净重(吨)</view>
  81. <view class="flex">
  82. <u--input placeholder="请输入装车净重" border="none" v-model="dataDetails.weight" inputAlign='right'
  83. clearable></u--input>
  84. </view>
  85. </view>
  86. <view class='row-between'>
  87. <view class="gray">运输开始日期</view>
  88. <view class="">
  89. <view @click="dateShow">{{dataDetails.tranStartDate?dataDetails.tranStartDate:'请选择运输开始日期'}}
  90. </view>
  91. <u-calendar :show="startShow" mode="single" @confirm="startDate" @close="startShow= false">
  92. </u-calendar>
  93. </view>
  94. </view>
  95. <view class='row-between'>
  96. <view class="gray">运输截止日期</view>
  97. <view class="">
  98. <!-- <u--input placeholder="请输入内容" border="none" v-model="dataDetails.value" inputAlign='right'
  99. clearable></u--input> -->
  100. <view class="" @click="endShow = true">
  101. {{dataDetails.tranEndDate?dataDetails.tranEndDate:'请选择运输截止日期'}}
  102. </view>
  103. <u-calendar :show="endShow" mode="single" @confirm="endDate" @close="endShow= false"></u-calendar>
  104. </view>
  105. </view>
  106. <view class='row-between'>
  107. <view class="gray">联络人姓名</view>
  108. <view class="">
  109. <u--input placeholder="请输入联络人姓名" border="none" v-model="dataDetails.driverName" inputAlign='right'
  110. clearable></u--input>
  111. </view>
  112. </view>
  113. <view class='row-between'>
  114. <view class="gray">联络人电话</view>
  115. <view class="">
  116. <u--input placeholder="请输入联络人电话" border="none" type="number" maxlength="11"
  117. v-model="dataDetails.driverPhone" inputAlign='right' clearable></u--input>
  118. </view>
  119. </view>
  120. <view class='row-between'>
  121. <view class="gray">装车后预付款</view>
  122. <view class="">
  123. <u--input placeholder="自动获取,不可编辑" v-if="dataDetails.freightAdvance == 1" border="none"
  124. v-model="dataDetails.advanceCharge" inputAlign='right' clearable disabled></u--input>
  125. <u--input placeholder="请输入装车后预付款" v-else border="none" v-model="dataDetails.advanceCharge"
  126. inputAlign='right' clearable></u--input>
  127. </view>
  128. </view>
  129. <view class='row-between'>
  130. <view style='width:200px;' class="gray">收款账户</view>
  131. <view style='word-wrap:break-word;word-break:normal;text-align:right;' class="" @click="collection">
  132. {{dataDetails.bankDeposit?dataDetails.bankDeposit:"请选择收款账户"}}
  133. (尾号{{dataDetails.bankCard?dataDetails.bankCard.substring(dataDetails.bankCard.length - 4):""}})
  134. </view>
  135. </view>
  136. </view>
  137. <view class="wrapper content3">
  138. <view class="qm-row">
  139. <view class="handTitle">手写签名</view>
  140. <image src="@/static/xiangpica@2x.png" mode="widthFix" @click="retDraw" class="retDraw-image"></image>
  141. <!-- <button @click="retDraw" class="delBtn">重写</button> -->
  142. </view>
  143. <view class="handCenter">
  144. <canvas class="handWriting" :disable-scroll="true" @touchstart="uploadScaleStart"
  145. @touchmove="uploadScaleMove" canvas-id="handWriting"></canvas>
  146. </view>
  147. <view class="handRight">
  148. </view>
  149. <view class="handBtn">
  150. <!-- <image @click="selectColorEvent('black','#1A1A1A')"
  151. :src="selectColor === 'black' ? '/static/other/color_black_selected.png' : '/static/other/color_black.png'"
  152. :class="[selectColor === 'black' ? 'color_select' : '', 'black-select']"></image>
  153. <image @click="selectColorEvent('red','#ca262a')"
  154. :src="selectColor === 'red' ? '/static/other/color_red_selected.png' : '/static/other/color_red.png'"
  155. :class="[selectColor === 'red' ? 'color_select' : '', 'black-select']"></image> -->
  156. <!-- <button @click="saveCanvasAsImg" class="saveBtn">保存</button> -->
  157. <view @click="$u.throttle(submit(), 5000)" class="saveBtn">提交</view>
  158. <!-- <button @click="previewCanvasImg" class="previewBtn">预览</button> -->
  159. <!-- <button @click="subCanvas" class="subBtn">完成</button> -->
  160. </view>
  161. </view>
  162. <u-picker :show="showCarList" :columns="carList" :closeOnClickOverlay='true' @close='selectTypeClose'
  163. @cancel='selectTypeClose' @confirm='confirmBtn'></u-picker>
  164. <master-keyboard ref="keyboard" keyboardtype="car" :show="keyShow" :randomNumber="true" :newCar="false"
  165. :defaultValue="carNumber" @keyboardClick="handleClick"></master-keyboard>
  166. <u-toast ref="uToast"></u-toast>
  167. <u-toast ref="uToast"></u-toast>
  168. </view>
  169. </template>
  170. <script>
  171. import {
  172. mapState
  173. } from 'vuex';
  174. var that;
  175. import uploadImage from '@/components/ossutil/uploadFile.js';
  176. export default {
  177. data() {
  178. return {
  179. showCarList: false,
  180. carList: [],
  181. carlistCopy: [],
  182. keyShow: false,
  183. carNumber: '',
  184. isScaleStart: false,
  185. radioCustomStyle: {
  186. margin: '0 0 0 10rpx'
  187. },
  188. canvasName: 'handWriting',
  189. ctx: "",
  190. startX: null,
  191. startY: null,
  192. canvasWidth: 0,
  193. canvasHeight: 0,
  194. selectColor: 'black',
  195. lineColor: '#1A1A1A', // 颜色
  196. lineSize: 5, // 笔记倍数
  197. value: true,
  198. dataDetails: {
  199. carrierInfo: {
  200. loadingAdvancePayment: ''
  201. },
  202. serviceCharge: '50'
  203. },
  204. radiolist1: [{
  205. name: '平台垫付运费',
  206. disabled: false
  207. },
  208. {
  209. name: '无需平台垫付运费',
  210. disabled: false
  211. },
  212. ],
  213. startShow: false,
  214. endShow: false,
  215. contractCheck: false, //判断合同是否提交
  216. proportion: "", //垫付比例
  217. status:false,
  218. };
  219. },
  220. computed: {
  221. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication']),
  222. },
  223. onShow() {
  224. let payInfo = uni.getStorageSync("payInfo")
  225. if (payInfo) {
  226. this.dataDetails.bankCard = payInfo.bankCard
  227. this.dataDetails.bankDeposit = payInfo.bankDeposit
  228. this.dataDetails.bankDepositBranch = payInfo.bankDepositBranch
  229. this.dataDetails.payeeName = payInfo.payeeName
  230. } else {
  231. this.$request.baseRequest('get', '/driverPayeeInfo/getDriverPayee', {
  232. commonId: that.firstAuthentication.commonId
  233. }).then(res => {
  234. if (res.data) {
  235. this.dataDetails.bankCard = res.data.bankCard
  236. this.dataDetails.bankDeposit = res.data.bankDeposit
  237. this.dataDetails.bankDepositBranch = res.data.bankDepositBranch
  238. this.dataDetails.payeeName = res.data.payeeName
  239. }
  240. })
  241. }
  242. console.log(this.dataDetails)
  243. if (this.dataDetails.carNumber) {
  244. this.$set(this.dataDetails.carrierInfo, 'carNo', this.dataDetails.carNumber)
  245. }
  246. this.preMoney()
  247. // this.$set(this.dataDetails,'advanceCharge',this.dataDetails.advanceCharge)
  248. // this.$set(this.dataDetails.carrierInfo,'carNo',this.dataDetails.carNo)
  249. console.log(this.dataDetails)
  250. },
  251. onLoad(options) {
  252. this.carList = []
  253. that = this
  254. // this.dataDetails = JSON.parse(options.obj)
  255. // console.log(this.dataDetails.billingMethod==1,this.dataDetails.freight)
  256. // console.log(this.dataDetails.carNo,this.dataDetails.carrierInfo)
  257. // this.dataDetails.advanceFreightService = '平台垫付运费'
  258. this.dataDetails = JSON.parse(decodeURIComponent(options.obj))
  259. console.log(this.dataDetails)
  260. if (this.dataDetails.hyCarrierInfo) {
  261. this.dataDetails.weight = this.dataDetails.hyCarrierInfo.loadingWeight
  262. }
  263. if (this.dataDetails.freightAdvance == 1) {
  264. this.proportion = this.dataDetails.driverAdvancePayment >= this.dataDetails.ownerAdvancePayment ? this
  265. .dataDetails.ownerAdvancePayment : this.dataDetails.driverAdvancePayment
  266. }
  267. if(this.dataDetails.billingMethod==1){
  268. this.dataDetails.freight1=this.dataDetails.freight
  269. }else{
  270. if(this.dataDetails.driverContract!=1){
  271. this.dataDetails.freight1=''
  272. }else{
  273. this.dataDetails.freight1=this.dataDetails.freight
  274. }
  275. }
  276. // console.log(this.dataDetails)
  277. this.dataDetails.carrierInfo = {}
  278. this.ctx = uni.createCanvasContext("handWriting");
  279. this.$nextTick(() => {
  280. uni.createSelectorQuery().select('.handCenter').boundingClientRect(rect => {
  281. this.canvasWidth = rect.width;
  282. this.canvasHeight = rect.height;
  283. /* 将canvas背景设置为 白底,不设置 导出的canvas的背景为透明 */
  284. this.setCanvasBg('#fff');
  285. this.$request.baseRequest('get', '/commonUser/getSignatureAddress', {
  286. phone: this.userInfo.phone,
  287. identification: 1
  288. }).then(res => {
  289. if (res.data) {
  290. if (res.data.signImg) {
  291. // 获取远程图片,canvas无法直接绘制远程图片
  292. this.userInfo.signImg = res.data.signImg
  293. uni.getImageInfo({
  294. src: res.data.signImg,
  295. success(res) {
  296. var ctx = uni.createCanvasContext('handWriting')
  297. ctx.drawImage(res.path, 0, 0, 330, 244)
  298. ctx.save()
  299. ctx.draw()
  300. },
  301. fail(res) {
  302. console.log("fail -> res", res)
  303. uni.showToast({
  304. title: "图片下载异常",
  305. duration: 2000,
  306. icon: "none"
  307. })
  308. }
  309. })
  310. }
  311. }
  312. })
  313. })
  314. .exec();
  315. });
  316. uni.showLoading({
  317. title: '加载中'
  318. })
  319. this.$request.baseRequest('get', '/driverCarInfo/selectDriverCar', {
  320. // driverId: that.userInfo.driverId,
  321. commonId: this.userInfo.id
  322. }).then(res => {
  323. if (res.code == '200') {
  324. uni.hideLoading()
  325. if (res.data.length > 0) {
  326. let _list = []
  327. for (let i = 0; i < res.data.length; i++) {
  328. if (res.data[i].status == '已通过') {
  329. _list.push(res.data[i].carNumber)
  330. }
  331. }
  332. that.carlistCopy = res.data
  333. that.carList = [_list]
  334. }
  335. } else {
  336. uni.$u.toast(res.message);
  337. }
  338. })
  339. .catch(res => {
  340. uni.$u.toast(res.message);
  341. });
  342. },
  343. methods: {
  344. preMoney() {
  345. if (this.dataDetails.freightAdvance == 1) {
  346. this.dataDetails.advanceCharge = this.dataDetails.freight1 * this.proportion?this.proportion:0
  347. }
  348. },
  349. collection() {
  350. uni.$u.route('/pages/order/bankCard');
  351. },
  352. confirmBtn(e) {
  353. this.dataDetails.carrierInfo.carNo = e.value[0]
  354. for (let i = 0; i < this.carlistCopy.length; i++) {
  355. if (e.value[0] == this.carlistCopy[i].carNumber) {
  356. this.dataDetails.trailerNumber = this.carlistCopy[i].guaCarNumber
  357. }
  358. }
  359. this.showCarList = false
  360. },
  361. selectTypeClose() {
  362. this.showCarList = false
  363. },
  364. carClick() {
  365. this.showCarList = true
  366. },
  367. //车牌号弹出键盘
  368. handleShowKeyboard() {
  369. if (!this.dataDetails.carrierInfo.carNo) {
  370. this.carNumber = ''
  371. } else {
  372. this.carNumber = this.dataDetails.carrierInfo.carNo
  373. }
  374. if (this.$refs.keyboard.open) {
  375. this.$refs.keyboard.open(false) //true 键盘显示 false 键盘隐藏
  376. } else {
  377. this.$refs.keyboard[0].open(false)
  378. }
  379. if (this.$refs.keyboard.open) {
  380. this.$refs.keyboard.open(true) //true 键盘显示 false 键盘隐藏
  381. } else {
  382. this.$refs.keyboard[0].open(true)
  383. }
  384. },
  385. //车牌号弹出键盘
  386. handleClick(e) {
  387. this.carNumber = e.value
  388. this.dataDetails.carrierInfo.carNo = e.value //键盘输入值
  389. },
  390. dateShow() {
  391. this.startShow = true
  392. },
  393. removeStart() {
  394. this.startShow = false
  395. },
  396. removeEnd() {
  397. this.endShow = false
  398. },
  399. startDate(e) {
  400. this.startShow = false
  401. this.dataDetails.tranStartDate = e[0]
  402. },
  403. endDate(e) {
  404. this.dataDetails.tranEndDate = e[0]
  405. this.endShow = false
  406. },
  407. submit(num) {
  408. this.dataDetails.freight=this.dataDetails.freight1
  409. let _obj = {}
  410. if (num == 1) { //预览合同
  411. _obj.submitFlag = 1
  412. this.contractCheck = false
  413. } else { //提交合同
  414. this.contractCheck = true
  415. _obj.submitFlag = 2
  416. if (!that.isScaleStart) {
  417. if (!this.userInfo.signImg) {
  418. that.$refs.uToast.show({
  419. type: 'error',
  420. message: "手写签名不能为空!",
  421. })
  422. return
  423. }
  424. }
  425. if (uni.$u.test.isEmpty(that.dataDetails.carrierInfo.carNo)) {
  426. that.$refs.uToast.show({
  427. type: 'error',
  428. message: "车牌号不能为空!",
  429. })
  430. return
  431. }
  432. if (uni.$u.test.isEmpty(that.dataDetails.weight)) {
  433. that.$refs.uToast.show({
  434. type: 'error',
  435. message: "装车净重不能为空!",
  436. })
  437. return
  438. }
  439. if (uni.$u.test.isEmpty(that.dataDetails.freight)) {
  440. that.$refs.uToast.show({
  441. type: 'error',
  442. message: "运费不能为空!",
  443. })
  444. return
  445. }
  446. if (uni.$u.test.isEmpty(that.dataDetails.tranStartDate)) {
  447. that.$refs.uToast.show({
  448. type: 'error',
  449. message: "运输起始日期不能为空!",
  450. })
  451. return
  452. }
  453. if (uni.$u.test.isEmpty(that.dataDetails.tranEndDate)) {
  454. that.$refs.uToast.show({
  455. type: 'error',
  456. message: "运输截止日期不能为空!",
  457. })
  458. return
  459. }
  460. if (uni.$u.test.isEmpty(that.dataDetails.driverName)) {
  461. that.$refs.uToast.show({
  462. type: 'error',
  463. message: "联络人姓名不能为空!",
  464. })
  465. return
  466. }
  467. if (uni.$u.test.isEmpty(that.dataDetails.driverPhone)) {
  468. that.$refs.uToast.show({
  469. type: 'error',
  470. message: "联络人电话不能为空!",
  471. })
  472. return
  473. }
  474. if (uni.$u.test.isEmpty(that.dataDetails.advanceCharge) && that.dataDetails.advanceCharge != 0) {
  475. that.$refs.uToast.show({
  476. type: 'error',
  477. message: "装车后预付款不能为空!",
  478. })
  479. return
  480. }
  481. if (uni.$u.test.isEmpty(that.dataDetails.bankDeposit)) {
  482. that.$refs.uToast.show({
  483. type: 'error',
  484. message: "收款账号不能为空!",
  485. })
  486. return
  487. }
  488. }
  489. _obj.trailerNumber = that.dataDetails.trailerNumber
  490. _obj.tranStartDate = that.dataDetails.tranStartDate
  491. _obj.tranEndDate = that.dataDetails.tranEndDate
  492. _obj.contactPersonName = that.dataDetails.driverName
  493. _obj.contactPersonPhone = that.dataDetails.driverPhone
  494. _obj.freightCars = that.dataDetails.freight
  495. // _obj.advanceCharge = that.dataDetails.advanceCharge
  496. _obj.carNumber = that.dataDetails.carrierInfo.carNo
  497. _obj.weight = that.dataDetails.weight
  498. _obj.advanceCharge = that.dataDetails.advanceCharge
  499. _obj.bankCard = that.dataDetails.bankCard
  500. _obj.bankDeposit = that.dataDetails.bankDeposit
  501. _obj.bankDepositBranch = that.dataDetails.bankDepositBranch
  502. _obj.payeeName = that.dataDetails.payeeName
  503. _obj.id = that.dataDetails.id
  504. _obj.typeFlag = 2
  505. uni.canvasToTempFilePath({
  506. canvasId: 'handWriting',
  507. fileType: 'png',
  508. quality: 1, //图片质量
  509. success(res) {
  510. uploadImage('image', res.tempFilePath, 'appData/',
  511. result => {
  512. // 上传成功
  513. that.dataDetails.cargoOwnerAutograph = result
  514. _obj.driverAutograph = result
  515. uni.showLoading({
  516. title: '加载中',
  517. mask: true
  518. })
  519. that.$request.baseRequest('get', '/orderInfo/setPdf', _obj).then(
  520. res => {
  521. if (res.code == 200) {
  522. uni.hideLoading()
  523. that.contractSrc = res.data
  524. uni.downloadFile({
  525. url: res.data,
  526. success: function(res) {
  527. var filePath = res.tempFilePath;
  528. uni.openDocument({
  529. filePath: filePath,
  530. showMenu: true,
  531. success: function(res) {
  532. console.log('打开文档成功');
  533. }
  534. });
  535. }
  536. });
  537. if (that.contractCheck) { //提交
  538. that.$refs.uToast.show({
  539. type: 'success',
  540. message: "提交成功",
  541. complete() {
  542. uni.removeStorageSync(
  543. "payInfo") //如果要有银行卡缓存就删除
  544. // uni.$u.route(
  545. // '/pages/order/confirmLoading', {
  546. // obj: JSON.stringify(that
  547. // .dataDetails),
  548. // });
  549. uni.setStorageSync('contractdata',that.dataDetails)
  550. uni.navigateBack({
  551. delta:1
  552. })
  553. // that.upCallback({
  554. // size: 10,
  555. // num: 1
  556. // })
  557. }
  558. })
  559. }
  560. } else {
  561. uni.$u.toast(res.message);
  562. uni.hideLoading()
  563. }
  564. })
  565. .catch(res => {
  566. uni.hideLoading()
  567. uni.$u.toast(res.message);
  568. });
  569. }
  570. )
  571. }
  572. });
  573. },
  574. // change(e){
  575. // if(this.value){
  576. // this.$set(this.dataDetails,'advanceFreightService',1)
  577. // }else{
  578. // this.$set(this.dataDetails,'advanceFreightService',0)
  579. // }
  580. // },
  581. // 笔迹开始
  582. uploadScaleStart(e) {
  583. this.isScaleStart = true
  584. this.startX = e.changedTouches[0].x
  585. this.startY = e.changedTouches[0].y
  586. //设置画笔参数
  587. //画笔颜色
  588. this.ctx.setStrokeStyle(this.lineColor)
  589. //设置线条粗细
  590. this.ctx.setLineWidth(this.lineSize)
  591. //设置线条的结束端点样式
  592. this.ctx.setLineCap("round") //'butt'、'round'、'square'
  593. //开始画笔
  594. this.ctx.beginPath()
  595. },
  596. // 笔迹移动
  597. uploadScaleMove(e) {
  598. //取点
  599. let temX = e.changedTouches[0].x
  600. let temY = e.changedTouches[0].y
  601. //画线条
  602. this.ctx.moveTo(this.startX, this.startY)
  603. this.ctx.lineTo(temX, temY)
  604. this.ctx.stroke()
  605. this.startX = temX
  606. this.startY = temY
  607. this.ctx.draw(true)
  608. },
  609. /**
  610. * 重写
  611. */
  612. retDraw() {
  613. this.ctx.clearRect(0, 0, 700, 730);
  614. this.ctx.draw();
  615. //设置canvas背景
  616. this.setCanvasBg('#fff');
  617. },
  618. /**
  619. * @param {Object} str
  620. * @param {Object} color
  621. * 选择颜色
  622. */
  623. selectColorEvent(str, color) {
  624. this.selectColor = str;
  625. this.lineColor = color;
  626. },
  627. //完成
  628. subCanvas() {
  629. uni.canvasToTempFilePath({
  630. canvasId: 'handWriting',
  631. fileType: 'png',
  632. quality: 1, //图片质量
  633. success(res) {
  634. // console.log(res.tempFilePath, 'canvas生成图片地址');
  635. uni.showToast({
  636. title: '以保存'
  637. });
  638. //保存到系统相册
  639. uni.saveImageToPhotosAlbum({
  640. filePath: res.tempFilePath,
  641. success(res) {
  642. uni.showToast({
  643. title: '已成功保存到相册',
  644. duration: 2000
  645. });
  646. }
  647. });
  648. }
  649. });
  650. },
  651. //保存到相册
  652. saveCanvasAsImg() {
  653. uni.canvasToTempFilePath({
  654. canvasId: 'handWriting',
  655. fileType: 'png',
  656. quality: 1, //图片质量
  657. success(res) {
  658. console.log(res.tempFilePath, 'canvas生成图片地址');
  659. uni.saveImageToPhotosAlbum({
  660. filePath: res.tempFilePath,
  661. success(res) {
  662. uni.showToast({
  663. title: '已保存到相册',
  664. duration: 2000
  665. });
  666. }
  667. });
  668. }
  669. });
  670. },
  671. //预览
  672. previewCanvasImg() {
  673. uni.canvasToTempFilePath({
  674. canvasId: 'handWriting',
  675. fileType: 'jpg',
  676. quality: 1, //图片质量
  677. success(res) {
  678. uni.previewImage({
  679. urls: [res.tempFilePath] //预览图片 数组
  680. });
  681. }
  682. });
  683. },
  684. //设置canvas背景色 不设置 导出的canvas的背景为透明
  685. //@params:字符串 color
  686. setCanvasBg(color) {
  687. /* 将canvas背景设置为 白底,不设置 导出的canvas的背景为透明 */
  688. //rect() 参数说明 矩形路径左上角的横坐标,左上角的纵坐标, 矩形路径的宽度, 矩形路径的高度
  689. //这里是 canvasHeight - 4 是因为下边盖住边框了,所以手动减了写
  690. this.ctx.rect(0, 0, this.canvasWidth, this.canvasHeight - 4);
  691. // ctx.setFillStyle('red')
  692. this.ctx.setFillStyle(color);
  693. this.ctx.fill(); //设置填充
  694. this.ctx.draw(); //开画
  695. }
  696. }
  697. };
  698. </script>
  699. <style lang="scss" scoped>
  700. page {
  701. background: #fbfbfb;
  702. height: auto;
  703. }
  704. .content1 {
  705. background: white;
  706. border-radius: 20rpx;
  707. margin: 20rpx;
  708. padding: 30rpx 20rpx;
  709. display: flex;
  710. justify-content: space-between;
  711. .right {
  712. display: flex;
  713. }
  714. }
  715. .content2 {
  716. background: white;
  717. border-radius: 20rpx;
  718. margin: 20rpx;
  719. padding: 30rpx 20rpx;
  720. .title {
  721. font-size: 36rpx;
  722. font-weight: 700;
  723. margin-bottom: 20rpx;
  724. width: 50%;
  725. }
  726. .preview {
  727. width: 50%;
  728. text-align: right;
  729. color: #2772FB;
  730. font-size: 26rpx;
  731. }
  732. .row-between {
  733. margin-bottom: 20rpx;
  734. }
  735. .left-text {
  736. margin-right: 20rpx;
  737. }
  738. .yf-input {
  739. padding-right: 10rpx;
  740. }
  741. }
  742. .content3 {
  743. background: white;
  744. border-radius: 20rpx;
  745. margin: 20rpx;
  746. padding: 30rpx 20rpx;
  747. }
  748. .place {
  749. width: 80%;
  750. text-align: right;
  751. }
  752. .handCenter {
  753. border: 4rpx dashed #e9e9e9;
  754. overflow: hidden;
  755. box-sizing: border-box;
  756. height: 500rpx;
  757. }
  758. .handWriting {
  759. background: #F9F9FB;
  760. width: 100%;
  761. height: 100%;
  762. }
  763. .handRight {
  764. display: inline-flex;
  765. align-items: center;
  766. }
  767. .handCenter {
  768. border: 4rpx dashed #e9e9e9;
  769. flex: 5;
  770. overflow: hidden;
  771. box-sizing: border-box;
  772. }
  773. .handTitle {
  774. font-size: 36rpx;
  775. color: #666;
  776. font-weight: 700;
  777. color: #333333;
  778. margin-bottom: 20rpx;
  779. }
  780. .retDraw-image {
  781. width: 50rpx;
  782. }
  783. .qm-row {
  784. display: flex;
  785. justify-content: space-between;
  786. }
  787. .saveBtn {
  788. width: 80%;
  789. background: #2772FB;
  790. color: white;
  791. text-align: center;
  792. border-radius: 50rpx;
  793. padding: 20rpx;
  794. }
  795. .handBtn {
  796. display: flex;
  797. justify-content: center;
  798. }
  799. /*
  800. .wrapper {
  801. width: 100%;
  802. height: 95vh;
  803. margin: 30rpx 0;
  804. overflow: hidden;
  805. display: flex;
  806. align-content: center;
  807. flex-direction: row;
  808. justify-content: center;
  809. font-size: 28rpx;
  810. }
  811. .handBtn button {
  812. font-size: 28rpx;
  813. }
  814. .handBtn {
  815. height: 95vh;
  816. display: inline-flex;
  817. flex-direction: column;
  818. justify-content: space-between;
  819. align-content: space-between;
  820. flex: 1;
  821. }
  822. .delBtn {
  823. position: absolute;
  824. top: 250rpx;
  825. left: 0rpx;
  826. transform: rotate(90deg);
  827. color: #666;
  828. }
  829. .delBtn image {
  830. position: absolute;
  831. top: 13rpx;
  832. left: 25rpx;
  833. }
  834. .subBtn {
  835. position: absolute;
  836. bottom: 52rpx;
  837. left: -3rpx;
  838. display: inline-flex;
  839. transform: rotate(90deg);
  840. background: #008ef6;
  841. color: #fff;
  842. margin-bottom: 30rpx;
  843. text-align: center;
  844. justify-content: center;
  845. }
  846. .saveBtn {
  847. position: absolute;
  848. top: 375rpx;
  849. left: 0rpx;
  850. transform: rotate(90deg);
  851. color: #666;
  852. }
  853. .previewBtn {
  854. position: absolute;
  855. top: 500rpx;
  856. left: 0rpx;
  857. transform: rotate(90deg);
  858. color: #666;
  859. }
  860. .uploadBtn {
  861. position: absolute;
  862. top: 625rpx;
  863. left: 0rpx;
  864. transform: rotate(90deg);
  865. color: #666;
  866. }
  867. .black-select {
  868. width: 60rpx;
  869. height: 60rpx;
  870. position: absolute;
  871. top: 30rpx;
  872. left: 25rpx;
  873. }
  874. .black-select.color_select {
  875. width: 90rpx;
  876. height: 90rpx;
  877. top: 100rpx;
  878. left: 10rpx;
  879. }
  880. .red-select {
  881. width: 60rpx;
  882. height: 60rpx;
  883. position: absolute;
  884. top: 140rpx;
  885. left: 25rpx;
  886. }
  887. .red-select.color_select {
  888. width: 90rpx;
  889. height: 90rpx;
  890. top: 120rpx;
  891. left: 10rpx;
  892. } */
  893. // /deep/.uni-input-input:disabled {
  894. // background:#fff;
  895. // }
  896. </style>