signContract.vue 27 KB

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