signContract.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  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" type="digit" 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" type="digit" 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(), 1000)" 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. console.log(ctx)
  304. ctx.drawImage(res.path, 0, 0, 340, 250)
  305. ctx.save()
  306. ctx.draw()
  307. },
  308. fail(res) {
  309. console.log("fail -> res", res)
  310. uni.showToast({
  311. title: "图片下载异常",
  312. duration: 2000,
  313. icon: "none"
  314. })
  315. }
  316. })
  317. }
  318. }
  319. })
  320. })
  321. .exec();
  322. });
  323. uni.showLoading({
  324. title: '加载中'
  325. })
  326. this.$request.baseRequest('get', '/driverCarInfo/selectDriverCar', {
  327. // driverId: that.userInfo.driverId,
  328. commonId: this.userInfo.id
  329. }).then(res => {
  330. if (res.code == '200') {
  331. uni.hideLoading()
  332. if (res.data.length > 0) {
  333. let _list = []
  334. for (let i = 0; i < res.data.length; i++) {
  335. if (res.data[i].status == '已通过') {
  336. _list.push(res.data[i].carNumber)
  337. }
  338. }
  339. that.carlistCopy = res.data
  340. that.carList = [_list]
  341. }
  342. } else {
  343. uni.$u.toast(res.message);
  344. }
  345. })
  346. .catch(res => {
  347. uni.$u.toast(res.message);
  348. });
  349. },
  350. methods: {
  351. preMoney() {
  352. if (this.dataDetails.freightAdvance == 1) {
  353. this.dataDetails.advanceCharge = this.dataDetails.freight1 * this.proportion?this.proportion:0
  354. }
  355. },
  356. collection() {
  357. if(!this.dataDetails.carCaptainCommonId){ //carCaptainCommonId没有值 证明他没有车队 可以选择收款账户
  358. uni.$u.route('/pages/order/bankCard');
  359. }
  360. },
  361. confirmBtn(e) {
  362. this.dataDetails.carrierInfo.carNo = e.value[0]
  363. for (let i = 0; i < this.carlistCopy.length; i++) {
  364. if (e.value[0] == this.carlistCopy[i].carNumber) {
  365. this.dataDetails.trailerNumber = this.carlistCopy[i].guaCarNumber
  366. }
  367. }
  368. this.showCarList = false
  369. },
  370. selectTypeClose() {
  371. this.showCarList = false
  372. },
  373. carClick() {
  374. this.showCarList = true
  375. },
  376. //车牌号弹出键盘
  377. handleShowKeyboard() {
  378. if (!this.dataDetails.carrierInfo.carNo) {
  379. this.carNumber = ''
  380. } else {
  381. this.carNumber = this.dataDetails.carrierInfo.carNo
  382. }
  383. if (this.$refs.keyboard.open) {
  384. this.$refs.keyboard.open(false) //true 键盘显示 false 键盘隐藏
  385. } else {
  386. this.$refs.keyboard[0].open(false)
  387. }
  388. if (this.$refs.keyboard.open) {
  389. this.$refs.keyboard.open(true) //true 键盘显示 false 键盘隐藏
  390. } else {
  391. this.$refs.keyboard[0].open(true)
  392. }
  393. },
  394. //车牌号弹出键盘
  395. handleClick(e) {
  396. this.carNumber = e.value
  397. this.dataDetails.carrierInfo.carNo = e.value //键盘输入值
  398. },
  399. dateShow() {
  400. this.startShow = true
  401. },
  402. removeStart() {
  403. this.startShow = false
  404. },
  405. removeEnd() {
  406. this.endShow = false
  407. },
  408. startDate(e) {
  409. this.startShow = false
  410. this.dataDetails.tranStartDate = e[0]
  411. },
  412. endDate(e) {
  413. this.dataDetails.tranEndDate = e[0]
  414. this.endShow = false
  415. },
  416. submit(num) {
  417. this.dataDetails.freight=this.dataDetails.freight1
  418. let _obj = {}
  419. if (num == 1) { //预览合同
  420. _obj.submitFlag = 1
  421. this.contractCheck = false
  422. } else { //提交合同
  423. this.contractCheck = true
  424. _obj.submitFlag = 2
  425. if (!that.isScaleStart) {
  426. if (!this.userInfo.signImg) {
  427. that.$refs.uToast.show({
  428. type: 'error',
  429. message: "手写签名不能为空!",
  430. })
  431. return
  432. }
  433. }
  434. if (uni.$u.test.isEmpty(that.dataDetails.carrierInfo.carNo)) {
  435. that.$refs.uToast.show({
  436. type: 'error',
  437. message: "车牌号不能为空!",
  438. })
  439. return
  440. }
  441. if (uni.$u.test.isEmpty(that.dataDetails.grossWeight)) {
  442. that.$refs.uToast.show({
  443. type: 'error',
  444. message: "装车毛重不能为空!",
  445. })
  446. return
  447. }
  448. if (uni.$u.test.isEmpty(that.dataDetails.weight)) {
  449. that.$refs.uToast.show({
  450. type: 'error',
  451. message: "装车净重不能为空!",
  452. })
  453. return
  454. }
  455. if(Number(that.dataDetails.weight) > Number(that.dataDetails.grossWeight)){
  456. that.$refs.uToast.show({
  457. type: 'error',
  458. message: "装车净重大于装车毛重!",
  459. })
  460. return
  461. }
  462. if (uni.$u.test.isEmpty(that.dataDetails.freight)) {
  463. that.$refs.uToast.show({
  464. type: 'error',
  465. message: "运费不能为空!",
  466. })
  467. return
  468. }
  469. if (uni.$u.test.isEmpty(that.dataDetails.tranStartDate)) {
  470. that.$refs.uToast.show({
  471. type: 'error',
  472. message: "运输起始日期不能为空!",
  473. })
  474. return
  475. }
  476. if (uni.$u.test.isEmpty(that.dataDetails.tranEndDate)) {
  477. that.$refs.uToast.show({
  478. type: 'error',
  479. message: "运输截止日期不能为空!",
  480. })
  481. return
  482. }
  483. if (uni.$u.test.isEmpty(that.dataDetails.driverName)) {
  484. that.$refs.uToast.show({
  485. type: 'error',
  486. message: "联络人姓名不能为空!",
  487. })
  488. return
  489. }
  490. if (uni.$u.test.isEmpty(that.dataDetails.driverPhone)) {
  491. that.$refs.uToast.show({
  492. type: 'error',
  493. message: "联络人电话不能为空!",
  494. })
  495. return
  496. }
  497. if (uni.$u.test.isEmpty(that.dataDetails.advanceCharge) && that.dataDetails.advanceCharge != 0) {
  498. that.$refs.uToast.show({
  499. type: 'error',
  500. message: "装车后预付款不能为空!",
  501. })
  502. return
  503. }
  504. if (uni.$u.test.isEmpty(that.dataDetails.bankDeposit)) {
  505. that.$refs.uToast.show({
  506. type: 'error',
  507. message: "收款账号不能为空!",
  508. })
  509. return
  510. }
  511. }
  512. _obj.trailerNumber = that.dataDetails.trailerNumber
  513. _obj.tranStartDate = that.dataDetails.tranStartDate
  514. _obj.tranEndDate = that.dataDetails.tranEndDate
  515. _obj.contactPersonName = that.dataDetails.driverName
  516. _obj.contactPersonPhone = that.dataDetails.driverPhone
  517. _obj.freightCars = that.dataDetails.freight
  518. // _obj.advanceCharge = that.dataDetails.advanceCharge
  519. _obj.carNumber = that.dataDetails.carrierInfo.carNo
  520. _obj.weight = that.dataDetails.weight
  521. _obj.grossWeight = that.dataDetails.grossWeight
  522. _obj.advanceCharge = that.dataDetails.advanceCharge
  523. // _obj.bankCard = that.dataDetails.bankCard
  524. // _obj.bankDeposit = that.dataDetails.bankDeposit
  525. // _obj.bankDepositBranch = that.dataDetails.bankDepositBranch
  526. // _obj.payeeName = that.dataDetails.payeeName
  527. _obj.id = that.dataDetails.id
  528. _obj.typeFlag = 2
  529. _obj.carCaptainAccountNumber = that.dataDetails.carCaptainAccountNumber
  530. _obj.payeeIdCard = that.dataDetails.payeeIdCard
  531. if(!this.dataDetails.carCaptainCommonId){ //carCaptainCommonId没有值 证明他没有车队长 (有车队长不传收款账户信息)
  532. _obj.bankCard = that.dataDetails.bankCard
  533. _obj.bankDeposit = that.dataDetails.bankDeposit
  534. _obj.bankDepositBranch = that.dataDetails.bankDepositBranch
  535. _obj.payeeName = that.dataDetails.payeeName
  536. }
  537. uni.canvasToTempFilePath({
  538. canvasId: 'handWriting',
  539. fileType: 'png',
  540. quality: 1, //图片质量
  541. success(res) {
  542. uploadImage('image', res.tempFilePath, 'appData/',
  543. result => {
  544. // 上传成功
  545. that.dataDetails.cargoOwnerAutograph = result
  546. _obj.driverAutograph = result
  547. uni.showLoading({
  548. title: '加载中',
  549. mask: true
  550. })
  551. that.$request.baseRequest('get', '/orderInfo/setPdf', _obj).then(
  552. res => {
  553. if (res.code == 200) {
  554. uni.hideLoading()
  555. that.contractSrc = res.data
  556. uni.downloadFile({
  557. url: res.data,
  558. success: function(res) {
  559. var filePath = res.tempFilePath;
  560. // uni.openDocument({
  561. // filePath: filePath,
  562. // showMenu: true,
  563. // success: function(res) {
  564. // console.log('打开文档成功');
  565. // }
  566. // });
  567. }
  568. });
  569. if (that.contractCheck) { //提交
  570. that.$refs.uToast.show({
  571. type: 'success',
  572. message: "提交成功",
  573. complete() {
  574. uni.removeStorageSync(
  575. "payInfo") //如果要有银行卡缓存就删除
  576. // uni.$u.route(
  577. // '/pages/order/confirmLoading', {
  578. // obj: JSON.stringify(that
  579. // .dataDetails),
  580. // });
  581. uni.setStorageSync('contractdata',that.dataDetails)
  582. uni.navigateBack({
  583. delta:1
  584. })
  585. // that.upCallback({
  586. // size: 10,
  587. // num: 1
  588. // })
  589. }
  590. })
  591. }
  592. } else {
  593. uni.$u.toast(res.message);
  594. uni.hideLoading()
  595. }
  596. })
  597. .catch(res => {
  598. uni.hideLoading()
  599. uni.$u.toast(res.message);
  600. });
  601. }
  602. )
  603. }
  604. });
  605. },
  606. // change(e){
  607. // if(this.value){
  608. // this.$set(this.dataDetails,'advanceFreightService',1)
  609. // }else{
  610. // this.$set(this.dataDetails,'advanceFreightService',0)
  611. // }
  612. // },
  613. // 笔迹开始
  614. uploadScaleStart(e) {
  615. this.isScaleStart = true
  616. this.startX = e.changedTouches[0].x
  617. this.startY = e.changedTouches[0].y
  618. //设置画笔参数
  619. //画笔颜色
  620. this.ctx.setStrokeStyle(this.lineColor)
  621. //设置线条粗细
  622. this.ctx.setLineWidth(this.lineSize)
  623. //设置线条的结束端点样式
  624. this.ctx.setLineCap("round") //'butt'、'round'、'square'
  625. //开始画笔
  626. this.ctx.beginPath()
  627. },
  628. // 笔迹移动
  629. uploadScaleMove(e) {
  630. //取点
  631. let temX = e.changedTouches[0].x
  632. let temY = e.changedTouches[0].y
  633. //画线条
  634. this.ctx.moveTo(this.startX, this.startY)
  635. this.ctx.lineTo(temX, temY)
  636. this.ctx.stroke()
  637. this.startX = temX
  638. this.startY = temY
  639. this.ctx.draw(true)
  640. },
  641. /**
  642. * 重写
  643. */
  644. retDraw() {
  645. this.ctx.clearRect(0, 0, 700, 730);
  646. this.ctx.draw();
  647. //设置canvas背景
  648. this.setCanvasBg('#fff');
  649. },
  650. /**
  651. * @param {Object} str
  652. * @param {Object} color
  653. * 选择颜色
  654. */
  655. selectColorEvent(str, color) {
  656. this.selectColor = str;
  657. this.lineColor = color;
  658. },
  659. //完成
  660. subCanvas() {
  661. uni.canvasToTempFilePath({
  662. canvasId: 'handWriting',
  663. fileType: 'png',
  664. quality: 1, //图片质量
  665. success(res) {
  666. // console.log(res.tempFilePath, 'canvas生成图片地址');
  667. uni.showToast({
  668. title: '以保存'
  669. });
  670. //保存到系统相册
  671. uni.saveImageToPhotosAlbum({
  672. filePath: res.tempFilePath,
  673. success(res) {
  674. uni.showToast({
  675. title: '已成功保存到相册',
  676. duration: 2000
  677. });
  678. }
  679. });
  680. }
  681. });
  682. },
  683. //保存到相册
  684. saveCanvasAsImg() {
  685. uni.canvasToTempFilePath({
  686. canvasId: 'handWriting',
  687. fileType: 'png',
  688. quality: 1, //图片质量
  689. success(res) {
  690. console.log(res.tempFilePath, 'canvas生成图片地址');
  691. uni.saveImageToPhotosAlbum({
  692. filePath: res.tempFilePath,
  693. success(res) {
  694. uni.showToast({
  695. title: '已保存到相册',
  696. duration: 2000
  697. });
  698. }
  699. });
  700. }
  701. });
  702. },
  703. //预览
  704. previewCanvasImg() {
  705. uni.canvasToTempFilePath({
  706. canvasId: 'handWriting',
  707. fileType: 'jpg',
  708. quality: 1, //图片质量
  709. success(res) {
  710. uni.previewImage({
  711. urls: [res.tempFilePath] //预览图片 数组
  712. });
  713. }
  714. });
  715. },
  716. //设置canvas背景色 不设置 导出的canvas的背景为透明
  717. //@params:字符串 color
  718. setCanvasBg(color) {
  719. /* 将canvas背景设置为 白底,不设置 导出的canvas的背景为透明 */
  720. //rect() 参数说明 矩形路径左上角的横坐标,左上角的纵坐标, 矩形路径的宽度, 矩形路径的高度
  721. //这里是 canvasHeight - 4 是因为下边盖住边框了,所以手动减了写
  722. this.ctx.rect(0, 0, this.canvasWidth, this.canvasHeight - 4);
  723. // ctx.setFillStyle('red')
  724. this.ctx.setFillStyle(color);
  725. this.ctx.fill(); //设置填充
  726. this.ctx.draw(); //开画
  727. }
  728. }
  729. };
  730. </script>
  731. <style lang="scss" scoped>
  732. page {
  733. background: #fbfbfb;
  734. height: auto;
  735. }
  736. .content1 {
  737. background: white;
  738. border-radius: 20rpx;
  739. margin: 20rpx;
  740. padding: 30rpx 20rpx;
  741. display: flex;
  742. justify-content: space-between;
  743. .right {
  744. display: flex;
  745. }
  746. }
  747. .content2 {
  748. background: white;
  749. border-radius: 20rpx;
  750. margin: 20rpx;
  751. padding: 30rpx 20rpx;
  752. .title {
  753. font-size: 36rpx;
  754. font-weight: 700;
  755. margin-bottom: 20rpx;
  756. width: 50%;
  757. }
  758. .preview {
  759. width: 50%;
  760. text-align: right;
  761. color: #F5BA3C;
  762. font-size: 26rpx;
  763. }
  764. .row-between {
  765. margin-bottom: 20rpx;
  766. }
  767. .left-text {
  768. margin-right: 20rpx;
  769. }
  770. .yf-input {
  771. padding-right: 10rpx;
  772. }
  773. }
  774. .content3 {
  775. background: white;
  776. border-radius: 20rpx;
  777. margin: 20rpx;
  778. padding: 30rpx 20rpx;
  779. }
  780. .place {
  781. width: 80%;
  782. text-align: right;
  783. }
  784. .handCenter {
  785. border: 4rpx dashed #e9e9e9;
  786. overflow: hidden;
  787. box-sizing: border-box;
  788. height: 500rpx;
  789. }
  790. .handWriting {
  791. background: #F9F9FB;
  792. width: 340px;
  793. height: 250px;
  794. }
  795. .handRight {
  796. display: inline-flex;
  797. align-items: center;
  798. }
  799. .handCenter {
  800. border: 4rpx dashed #e9e9e9;
  801. flex: 5;
  802. overflow: hidden;
  803. box-sizing: border-box;
  804. }
  805. .handTitle {
  806. font-size: 36rpx;
  807. color: #666;
  808. font-weight: 700;
  809. color: #333333;
  810. margin-bottom: 20rpx;
  811. }
  812. .retDraw-image {
  813. width: 50rpx;
  814. }
  815. .qm-row {
  816. display: flex;
  817. justify-content: space-between;
  818. }
  819. .saveBtn {
  820. width: 80%;
  821. background: #F5BA3C;
  822. color: white;
  823. text-align: center;
  824. border-radius: 50rpx;
  825. padding: 20rpx;
  826. }
  827. .handBtn {
  828. display: flex;
  829. justify-content: center;
  830. }
  831. /*
  832. .wrapper {
  833. width: 100%;
  834. height: 95vh;
  835. margin: 30rpx 0;
  836. overflow: hidden;
  837. display: flex;
  838. align-content: center;
  839. flex-direction: row;
  840. justify-content: center;
  841. font-size: 28rpx;
  842. }
  843. .handBtn button {
  844. font-size: 28rpx;
  845. }
  846. .handBtn {
  847. height: 95vh;
  848. display: inline-flex;
  849. flex-direction: column;
  850. justify-content: space-between;
  851. align-content: space-between;
  852. flex: 1;
  853. }
  854. .delBtn {
  855. position: absolute;
  856. top: 250rpx;
  857. left: 0rpx;
  858. transform: rotate(90deg);
  859. color: #666;
  860. }
  861. .delBtn image {
  862. position: absolute;
  863. top: 13rpx;
  864. left: 25rpx;
  865. }
  866. .subBtn {
  867. position: absolute;
  868. bottom: 52rpx;
  869. left: -3rpx;
  870. display: inline-flex;
  871. transform: rotate(90deg);
  872. background: #008ef6;
  873. color: #fff;
  874. margin-bottom: 30rpx;
  875. text-align: center;
  876. justify-content: center;
  877. }
  878. .saveBtn {
  879. position: absolute;
  880. top: 375rpx;
  881. left: 0rpx;
  882. transform: rotate(90deg);
  883. color: #666;
  884. }
  885. .previewBtn {
  886. position: absolute;
  887. top: 500rpx;
  888. left: 0rpx;
  889. transform: rotate(90deg);
  890. color: #666;
  891. }
  892. .uploadBtn {
  893. position: absolute;
  894. top: 625rpx;
  895. left: 0rpx;
  896. transform: rotate(90deg);
  897. color: #666;
  898. }
  899. .black-select {
  900. width: 60rpx;
  901. height: 60rpx;
  902. position: absolute;
  903. top: 30rpx;
  904. left: 25rpx;
  905. }
  906. .black-select.color_select {
  907. width: 90rpx;
  908. height: 90rpx;
  909. top: 100rpx;
  910. left: 10rpx;
  911. }
  912. .red-select {
  913. width: 60rpx;
  914. height: 60rpx;
  915. position: absolute;
  916. top: 140rpx;
  917. left: 25rpx;
  918. }
  919. .red-select.color_select {
  920. width: 90rpx;
  921. height: 90rpx;
  922. top: 120rpx;
  923. left: 10rpx;
  924. } */
  925. // /deep/.uni-input-input:disabled {
  926. // background:#fff;
  927. // }
  928. </style>