signContract.vue 27 KB

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