editRelease.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  1. <template>
  2. <view class="content">
  3. <u-navbar title="发布" :placeholder="true" @leftClick="back()">
  4. <!-- view class="u-nav-slot" slot="left">
  5. <u-icon name="arrow-left" size="19"></u-icon>
  6. <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
  7. <u-icon name="home" size="20"></u-icon>
  8. </view> -->
  9. </u-navbar>
  10. <view class="content1">
  11. <view class="row" @click="selectCargoOwner">
  12. <view class="left select-sf">{{dataObj.cargoOwner?dataObj.cargoOwner:'选择货主身份'}}</view>
  13. <image src="../../static/right.png" style="width: 22rpx;height: 22rpx;margin-top:14rpx;"></image>
  14. </view>
  15. <!-- <view class="row" @click="selectCargoOwner" v-if="dataObj.cargoOwner">
  16. <view class="left">{{dataObj.cargoOwner}}</view>
  17. <view class="right">></view>
  18. </view> -->
  19. <u-picker :show="show" :columns="columns" :closeOnClickOverlay='true' @close='selectCargoOwnerClose'
  20. @cancel='selectCargoOwnerClose' @confirm='confirmSelectCargoOwner'></u-picker>
  21. </view>
  22. <view class="content2">
  23. <view class="row1">
  24. <view class="left">
  25. <view class="top" @click="selectAddress(0)">
  26. <view class="send">发</view>
  27. <view class="title">
  28. {{dataObj.sendArea?((dataObj.sendPrivate?dataObj.sendPrivate:'' )+ dataObj.sendCity+dataObj.sendArea):'选择发货地区'}}
  29. </view>
  30. </view>
  31. <view class="bottom">
  32. <input type="text" value="" placeholder="输入详细地址" v-model="dataObj.sendDetailedAddress" />
  33. </view>
  34. </view>
  35. <view v-if='dataObj.sendArea' class="right"></view>
  36. <view class="right" @click="selectAddress(0)" v-else>
  37. <image src="../../static/right.png" style="width: 22rpx;height: 22rpx;margin-top:14rpx;"></image>
  38. </view>
  39. </view>
  40. <view class="row2">
  41. <view class="left">
  42. <view class="top" @click="selectAddress(1)">
  43. <view class="collect">收</view>
  44. <view class="title">
  45. {{dataObj.unloadArea?((dataObj.unloadPrivate?dataObj.unloadPrivate:'') + dataObj.unloadCity+dataObj.unloadArea):'选择收货地区'}}
  46. </view>
  47. </view>
  48. <view class="bottom">
  49. <input type="text" value="" placeholder="输入详细地址" v-model="dataObj.unloadDetailedAddress" />
  50. </view>
  51. </view>
  52. <view v-if='dataObj.unloadPrivate' class="right"></view>
  53. <view class="right" @click="selectAddress(1)" v-else>
  54. <image src="../../static/right.png" style="width: 22rpx;height: 22rpx;margin-top:14rpx;"></image>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="content3">
  59. <view class="row">
  60. <view class="left">距离</view>
  61. <!-- <input type="text" class="input" placeholder="自动计算" v-model="dataObj.distance" disabled /> -->
  62. <view class="input">{{dataObj.distance?dataObj.distance:"自动计算"}} km</view>
  63. </view>
  64. <view class="row">
  65. <view class="left">业务类型</view>
  66. <view class="right" >{{dataObj.businessType?dataObj.businessType:"请选择业务类型"}}
  67. </view>
  68. </view>
  69. <view class="row">
  70. <view class="left">货物类别</view>
  71. <view class="right" @click="goodstypeChange">{{dataObj.goodsType?dataObj.goodsType:"请选择货物类别"}}</view>
  72. </view>
  73. <view class="row">
  74. <view class="left">货名</view>
  75. <view class="right"><input type="text" class="input" value="" placeholder="输入货物名称"
  76. v-model="dataObj.goodsName" /></view>
  77. </view>
  78. <view class="row">
  79. <view class="left">收货方</view>
  80. <view class="right flex">
  81. <input type="text" value="" placeholder="输入收货方姓名或企业名称" class="input" v-model="dataObj.receiver" />
  82. </view>
  83. </view>
  84. <view class="row">
  85. <view class="left">收货方手机号</view>
  86. <view class="right flex">
  87. <input type="number" maxlength="11" placeholder="输入收货方手机号" class="input"
  88. v-model="dataObj.receiverPhone" />
  89. </view>
  90. </view>
  91. <view class="row">
  92. <view class="left" style="width: 240rpx;">收货方身份证号(选填)</view>
  93. <view class="right flex">
  94. <input type="number" maxlength="18" placeholder="输入收货人身份证号" class="input"
  95. v-model="dataObj.receiverIdcard" />
  96. </view>
  97. </view>
  98. <view class="row">
  99. <view class="left" style="width: 240rpx;">收货方信用代码(选填)</view>
  100. <view class="right flex">
  101. <input maxlength="18" placeholder="统一社会信用代码" class="input" v-model="dataObj.receiverCreditCode" />
  102. </view>
  103. </view>
  104. <view class="flex row">
  105. <view class="left-text">运费计算方式</view>
  106. <u-radio-group placement="row" v-model="dataObj.billingMethod" class="select-type">
  107. <u-radio :customStyle="radioCustomStyle" v-for="(item, index) in radiolist1" :key="index"
  108. :label="item.name" :name="item.name" @change="radioChange">
  109. </u-radio>
  110. </u-radio-group>
  111. </view>
  112. <view class="row">
  113. <view class="left">运费单价</view>
  114. <view class="right"><input type="number" value="" placeholder="输入运费单价" class="input"
  115. v-model="dataObj.freightPrice" /></view>
  116. </view>
  117. <view class="row" v-if="freightAdvance">
  118. <view class="left">该任务申请运费垫付</view>
  119. <view class="right">
  120. <u-switch v-model="dataObj.freightAdvance" @change="change" size="20"></u-switch>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="content4 flex">
  125. <view class="title">以下为附加信息</view>
  126. <view class="btn-text">选填</view>
  127. </view>
  128. <view class="content5">
  129. <view class="row">
  130. <view class="left">发货联系人</view>
  131. <view class="right flex">
  132. <input type="text" value="" placeholder="输入发货联系人姓名" class="input" v-model="dataObj.sender" />
  133. </view>
  134. </view>
  135. <view class="row">
  136. <view class="left">发货人手机号</view>
  137. <view class="right flex">
  138. <input type="number" maxlength="11" value="" placeholder="输入发货联系人手机号" class="input"
  139. v-model="dataObj.senderPhone" />
  140. </view>
  141. </view>
  142. <view class="row">
  143. <view class="left">重量(吨)</view>
  144. <view class="right flex">
  145. <input type="text" value="" placeholder="输入预计发运重量" class="number" v-model="dataObj.weight"
  146. style="text-align: right;" />
  147. </view>
  148. </view>
  149. <view class="flex row" @click="selectValidityPeriod(0)">
  150. <view class="left-text">预计装车日期起</view>
  151. <view :class="!dataObj.loadingDateStart?'select-data':''">
  152. {{dataObj.loadingDateStart?dataObj.loadingDateStart:'选择有效截止日期>'}}
  153. </view>
  154. </view>
  155. <view class="flex row" @click="selectValidityPeriod(1)">
  156. <view class="left-text">预计装车日期止</view>
  157. <view :class="!dataObj.loadingDateEnd?'select-data':''">
  158. {{dataObj.loadingDateEnd?dataObj.loadingDateEnd:'选择有效截止日期>'}}
  159. </view>
  160. </view>
  161. <view class="row">
  162. <view class="left">车长要求(米)</view>
  163. </view>
  164. <view class="row flex-space-between row-bgc">
  165. <view class="car-row">
  166. <input type="number" value="" placeholder="最短不限" class="" v-model="dataObj.carLengthSmall"
  167. class="car-input" />
  168. <view>m</view>
  169. </view>
  170. <view class="car-line">-</view>
  171. <view class="car-row">
  172. <input type="number" value="" placeholder="最长不限" class="" v-model="dataObj.carLength"
  173. class="car-input" />
  174. <view>m</view>
  175. </view>
  176. </view>
  177. <view class="row">
  178. <view class="left">载重要求(吨)</view>
  179. </view>
  180. <view class="row flex-space-between row-bgc">
  181. <view class="car-row">
  182. <input type="number" value="" placeholder="最小不限" class="car-input"
  183. v-model="dataObj.loadWeightSmall" />
  184. <view>吨</view>
  185. </view>
  186. <view class="car-line">-</view>
  187. <view class="car-row">
  188. <input type="number" value="" placeholder="最大不限" class="car-input" v-model="dataObj.loadWeight" />
  189. <view>吨</view>
  190. </view>
  191. </view>
  192. <view class="row">
  193. <view class="left">车型要求</view>
  194. </view>
  195. <view class="row">
  196. <u-checkbox-group v-model="checkboxValue1" placement="row" @change="checkboxChange">
  197. <u-checkbox :customStyle="radioCustomStyle" v-for="(item, index) in checkboxList1" :key="index"
  198. :label="item.name" :name="item.name">
  199. </u-checkbox>
  200. </u-checkbox-group>
  201. </view>
  202. <view class="row">
  203. <view class="left">任务描述</view>
  204. </view>
  205. <view class="row">
  206. <u--textarea v-model="dataObj.taskDescription" placeholder="请输入内容" :count='true' maxlength='200'>
  207. </u--textarea>
  208. </view>
  209. <view class="flex row noborder" @click="selectValidityPeriodcq">
  210. <view class="left-text">任务有效期</view>
  211. <view :class="dataObj.taskValidity?'':'select-data'">
  212. {{dataObj.taskValidity?dataObj.taskValidity:'选择任务有效期>'}}
  213. </view>
  214. </view>
  215. <!-- <u-picker :show="isShowcardValidity" ref="uPicker" :columns="validityPeriodcq"
  216. @confirm="confirmValidityPeriodcq" @change="changeHandler" @close='isShowcardValidity=false'
  217. @cancel='isShowcardValidity=false' :closeOnClickOverlay='true'>
  218. </u-picker> -->
  219. <itmister-date-picker :overdueContent="'任务已过期'" :dateStatus="1" :periodOfValidity="true" :startYear='2022' :checkYear="year" :checkMonth="month" :checkDay="day" ref="dateEl" :endDate="array" :futureYear="30" @dateConfirm="confirmValidityPeriodcq"></itmister-date-picker>
  220. <view class="flex row noborder">
  221. <view class="left-text flex">查看
  222. <u--text type="primary" text="《货物运输委托协议》" @click="lookContract"></u--text>
  223. </view>
  224. </view>
  225. </view>
  226. <view class="submit" @click="submit">下一步</view>
  227. <!-- <u-picker :show="isShowValidity" ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
  228. :closeOnClickOverlay='true' @close='isShowValidity=false' @cancel='isShowValidity=false'>
  229. </u-picker> -->
  230. <itmister-date-picker :dateStatus="2" :startYear='2022' ref="datezc" :futureYear="30" :checkYear="year" :checkMonth="month" :checkDay="day" @dateConfirm="confirmValidityPeriod"></itmister-date-picker>
  231. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  232. :showCancelButton='true' confirmColor='#F5BA3C' @confirm="$u.throttle(confirmClick(), 1000)" @close="cancelClick"
  233. @cancel="cancelClick"></u-modal>
  234. <u-toast ref="uToast"></u-toast>
  235. </view>
  236. </template>
  237. <script>
  238. var _this;
  239. import {
  240. mapState
  241. } from 'vuex';
  242. export default {
  243. data() {
  244. return {
  245. qyList: [],
  246. isShowAlert: false,
  247. alertTitle: '确定发布运输任务?',
  248. alertContent: null,
  249. radioCustomStyle: {
  250. margin: '0 0 0 20rpx'
  251. },
  252. show: false,
  253. freightAdvance:false,
  254. columns: [
  255. []
  256. ],
  257. array:{},
  258. year:'',
  259. month:'',
  260. day:'',
  261. dataObj: {
  262. commonId: '',
  263. cargoOwner: '',
  264. sendPrivate: '',
  265. sendCity: '',
  266. sendArea: '',
  267. sendDetailedAddress: '',
  268. unloadPrivate: '',
  269. unloadCity: '',
  270. unloadArea: '',
  271. unloadDetailedAddress: '',
  272. distance: '',
  273. goodsName: '',
  274. billingMethod: '元/吨',
  275. freightPrice: '',
  276. freightAdvance: true,
  277. sender: '',
  278. senderPhone: '',
  279. receiver: '',
  280. receiverPhone: '',
  281. weight: '',
  282. loadingDateStart: '',
  283. loadingDateEnd: '',
  284. carLengthSmall: '',
  285. carLength: '',
  286. loadWeightSmall: '',
  287. loadWeight: '',
  288. carModel: '',
  289. taskDescription: '',
  290. taskValidity: '',
  291. sendLongitude: '',
  292. sendLatitude: '',
  293. unsendLongitude: '',
  294. unsendLatitude: '',
  295. },
  296. checkboxValue1: [],
  297. checkboxList1: [{
  298. name: '不限',
  299. disabled: false
  300. },
  301. {
  302. name: '高栏',
  303. disabled: false
  304. },
  305. {
  306. name: '集装箱',
  307. disabled: false
  308. },
  309. {
  310. name: '自卸车',
  311. disabled: false
  312. }
  313. ],
  314. value: true,
  315. isShowcardValidity: false,
  316. ValidityPeriodType: '',
  317. validityPeriod: [],
  318. validityPeriodcq: [],
  319. isShowValidity: false,
  320. dataDetails: {
  321. type: '元/车'
  322. },
  323. radiolist1: [{
  324. name: '元/吨',
  325. disabled: false
  326. },
  327. {
  328. name: '元/车',
  329. disabled: false
  330. },
  331. ],
  332. }
  333. },
  334. onShow() {
  335. this.getSFList()
  336. let _faddress = uni.getStorageSync('storage_faddress');
  337. let _saddress = uni.getStorageSync('storage_saddress');
  338. if (_faddress) {
  339. this.dataObj.sendCity = _faddress.city
  340. this.dataObj.sendArea = _faddress.area
  341. this.dataObj.sendPrivate = _faddress.province
  342. this.dataObj.sendDetailedAddress = _faddress.detailedAddress
  343. this.dataObj.sendLongitude = _faddress.longitude
  344. this.dataObj.sendLatitude = _faddress.latitude
  345. this.dataObj.senderPhone = _faddress.contactPhone
  346. this.dataObj.sender = _faddress.contacts
  347. this.dataObj.sendAdCode = _faddress.adCode
  348. }
  349. if (_saddress) {
  350. this.dataObj.unloadDetailedAddress = _saddress.detailedAddress
  351. this.dataObj.unloadCity = _saddress.city
  352. this.dataObj.unloadArea = _saddress.area
  353. this.dataObj.unloadPrivate = _saddress.province
  354. this.dataObj.unsendLongitude = _saddress.longitude
  355. this.dataObj.unsendLatitude = _saddress.latitude
  356. this.dataObj.receiver = _saddress.contacts
  357. this.dataObj.receiverPhone = _saddress.contactPhone
  358. this.dataObj.unsendAdCode = _faddress.adCode
  359. }
  360. },
  361. onLoad(options) {
  362. _this = this;
  363. _this = this;
  364. this.dataObj = options
  365. if (this.dataObj.billingMethod == 1) {
  366. this.dataObj.billingMethod = '元/车'
  367. } else {
  368. this.dataObj.billingMethod = '元/吨'
  369. }
  370. for (let i = 0; i < this.dataObj.carModel.length; i++) {
  371. if (this.dataObj.carModel[i] == '1') {
  372. this.checkboxValue1.push('不限')
  373. } else if (this.dataObj.carModel[i] == '2') {
  374. this.checkboxValue1.push('高栏')
  375. } else if (this.dataObj.carModel[i] == '3') {
  376. this.checkboxValue1.push('集装箱')
  377. } else if (this.dataObj.carModel[i] == '4') {
  378. this.checkboxValue1.push('自卸车')
  379. }
  380. }
  381. if (this.dataObj.freightAdvance==1) {
  382. this.dataObj.freightAdvance = true
  383. this.freightAdvance=true
  384. } else {
  385. this.dataObj.freightAdvance = false
  386. this.freightAdvance=false
  387. }
  388. this.validityPeriod = this.$helper.makeValidityPeriod(0, '随时')
  389. this.validityPeriodcq = this.$helper.makeValidityPeriod(0, '长期')
  390. },
  391. computed: {
  392. ...mapState(['hasLogin', 'userInfo']),
  393. },
  394. methods: {
  395. lookContract(){
  396. uni.downloadFile({
  397. url: "https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/hzContract.pdf",
  398. success: function(res) {
  399. var filePath = res.tempFilePath;
  400. uni.openDocument({
  401. filePath: filePath,
  402. showMenu: true,
  403. success: function(res) {
  404. console.log('打开文档成功');
  405. }
  406. });
  407. }
  408. });
  409. },
  410. goodstypeChange(){
  411. this.isGoodsType = true
  412. },
  413. goodsSubmit(e){
  414. this.dataObj.goodsType = e.value[0].constValue
  415. this.dataObj.goodsTypeKey = e.value[0].constKey
  416. let _obj={
  417. name:e.value[0].constValue,
  418. key:e.value[0].constKey
  419. }
  420. uni.setStorageSync("goodsType",_obj)
  421. this.isGoodsType = false
  422. },
  423. getSFList() {
  424. this.dataObj.commonId = this.userInfo.id
  425. this.$request.baseRequest('get', '/cargoOwnerCompInfo/cargoOwnerList', {
  426. commonId: this.userInfo.id
  427. }).then(res => {
  428. if (uni.getStorageSync('releaseCargoOwner')) {
  429. this.dataObj.cargoOwner = uni.getStorageSync('releaseCargoOwner')
  430. }
  431. // 可用企业货主
  432. this.qyList = []
  433. // 自己法人
  434. let _self = res.data.companyInfoList
  435. //代理货主
  436. let _dlhz = res.data.cargoOwnerCompInfoList
  437. if(_self){
  438. for (let i = 0; i < _self.length; i++) {
  439. _self[i].compStatus='wd'
  440. if (_self[i].status == '已认证') {
  441. this.qyList.push(_self[i])
  442. }
  443. }
  444. }
  445. if(_dlhz){
  446. for (let i = 0; i < _dlhz.length; i++) {
  447. _dlhz[i].compStatus='ss'
  448. if (_dlhz[i].status == '已认证') {
  449. this.qyList.push(_dlhz[i])
  450. }
  451. }
  452. }
  453. let obj = uni.getStorageSync("firstAuthentication")
  454. if(obj && obj.authenticationStatus == '已认证'){
  455. this.columns[0].push("个人货主")
  456. }
  457. for (let i = 0; i < this.qyList.length; i++) {
  458. this.columns[0].push(this.qyList[i].company ? this.qyList[i].company : this.qyList[i]
  459. .companyName)
  460. }
  461. })
  462. .catch(res => {
  463. uni.showToast({
  464. title: res.message,
  465. icon: 'none',
  466. duration: 2000
  467. })
  468. });
  469. },
  470. validate() {
  471. if (uni.$u.test.isEmpty(this.dataObj.cargoOwner)) {
  472. this.$refs.uToast.show({
  473. type: 'error',
  474. message: "货主不能为空!",
  475. })
  476. return true
  477. }
  478. if (uni.$u.test.isEmpty(this.dataObj.sendArea)) {
  479. this.$refs.uToast.show({
  480. type: 'error',
  481. message: "发货地区不能为空!",
  482. })
  483. return true
  484. }
  485. if (uni.$u.test.isEmpty(this.dataObj.unloadArea)) {
  486. this.$refs.uToast.show({
  487. type: 'error',
  488. message: "收货地区不能为空!",
  489. })
  490. return true
  491. }
  492. if (uni.$u.test.isEmpty(this.dataObj.goodsName)) {
  493. this.$refs.uToast.show({
  494. type: 'error',
  495. message: "货名不能为空!",
  496. })
  497. return true
  498. }
  499. if (uni.$u.test.isEmpty(this.dataObj.receiver)) {
  500. this.$refs.uToast.show({
  501. type: 'error',
  502. message: "收货方不能为空!",
  503. })
  504. return true
  505. }
  506. if (uni.$u.test.isEmpty(this.dataObj.receiverPhone)) {
  507. this.$refs.uToast.show({
  508. type: 'error',
  509. message: "收货方手机号不能为空!",
  510. })
  511. return true
  512. }
  513. if (!this.dataObj.receiverIdcard && !this.dataObj.receiverCreditCode) {
  514. this.$refs.uToast.show({
  515. type: 'error',
  516. message: "信用代码和身份证号码至少填写一个!",
  517. duration:4000
  518. })
  519. return true
  520. }
  521. if(this.dataObj.receiverIdcard&&this.dataObj.receiverIdcard.length!=18){
  522. this.$refs.uToast.show({
  523. type: 'error',
  524. message: "身份证号输入错误!",
  525. })
  526. return true
  527. }
  528. if(this.dataObj.receiverCreditCode&&this.dataObj.receiverCreditCode.length!=18){
  529. this.$refs.uToast.show({
  530. type: 'error',
  531. message: "信用代码输入错误!",
  532. })
  533. return true
  534. }
  535. if (uni.$u.test.isEmpty(this.dataObj.freightPrice)) {
  536. this.$refs.uToast.show({
  537. type: 'error',
  538. message: "运费单价不能为空!",
  539. })
  540. return true
  541. }
  542. if (
  543. this.dataObj.freightPrice < 0 || this.dataObj.freightPrice > 100000 || (
  544. String(this.dataObj.freightPrice).indexOf('.') != -1 && String(this.dataObj.freightPrice).length -
  545. (String(this.dataObj.freightPrice).indexOf(
  546. '.') + 1) > 2)
  547. ) {
  548. uni.showToast({
  549. title: '运费单价输入错误!',
  550. duration: 2000,
  551. icon: "none",
  552. });
  553. return true
  554. }
  555. if (this.dataObj.weight) {
  556. if (
  557. this.dataObj.weight < 0.1 || this.dataObj.weight > 10000000 || (
  558. String(this.dataObj.weight).indexOf('.') != -1 && String(this.dataObj.weight).length -
  559. (String(this.dataObj.weight).indexOf(
  560. '.') + 1) > 2)
  561. ) {
  562. uni.showToast({
  563. title: '重量输入错误!',
  564. duration: 2000,
  565. icon: "none",
  566. });
  567. return true
  568. }
  569. }
  570. if (this.dataObj.carLengthSmall) {
  571. if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
  572. uni.showToast({
  573. title: '最小车长输入错误!',
  574. duration: 2000,
  575. icon: "none",
  576. });
  577. return true
  578. }
  579. }
  580. if (this.dataObj.carLength) {
  581. if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
  582. uni.showToast({
  583. title: '最大车长输入错误!',
  584. duration: 2000,
  585. icon: "none",
  586. });
  587. return true
  588. }
  589. }
  590. if (this.dataObj.carLengthSmall && this.dataObj.carLength && (Number(this.dataObj.carLengthSmall) > Number(this.dataObj.carLength))) {
  591. uni.showToast({
  592. title: '最小车长应小于最大车长!',
  593. duration: 2000,
  594. icon: "none",
  595. });
  596. return true
  597. }
  598. if (this.dataObj.loadWeightSmall) {
  599. if (
  600. this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
  601. String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(this.dataObj
  602. .loadWeightSmall).length -
  603. (String(this.dataObj.loadWeightSmall).indexOf(
  604. '.') + 1) > 3)
  605. ) {
  606. uni.showToast({
  607. title: '最小载重输入错误!',
  608. duration: 2000,
  609. icon: "none",
  610. });
  611. return true
  612. }
  613. }
  614. if (this.dataObj.loadWeight) {
  615. if (
  616. this.dataObj.loadWeight < 0.1 || this.dataObj.loadWeight > 100 || (
  617. String(this.dataObj.loadWeight).indexOf('.') != -1 && String(this.dataObj.loadWeight).length -
  618. (String(this.dataObj.loadWeight).indexOf(
  619. '.') + 1) > 3)
  620. ) {
  621. uni.showToast({
  622. title: '最大载重输入错误!',
  623. duration: 2000,
  624. icon: "none",
  625. });
  626. return true
  627. }
  628. }
  629. if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (Number(this.dataObj.loadWeightSmall)>Number(this.dataObj.loadWeight))) {
  630. uni.showToast({
  631. title: '最小载重应小于最大载重!',
  632. duration: 2000,
  633. icon: "none",
  634. });
  635. return true
  636. }
  637. },
  638. confirmClick() {
  639. this.isShowAlert = false
  640. if (this.dataObj.billingMethod == '元/吨') {
  641. this.dataObj.billingMethod = 0
  642. } else {
  643. this.dataObj.billingMethod = 1
  644. }
  645. if (this.dataObj.freightAdvance) {
  646. this.dataObj.freightAdvance = 1
  647. } else {
  648. this.dataObj.freightAdvance = 0
  649. }
  650. let _list = []
  651. for (let i = 0; i < this.checkboxValue1.length; i++) {
  652. if (this.checkboxValue1[i] == '不限') {
  653. _list.push(1)
  654. } else if (this.checkboxValue1[i] == '高栏') {
  655. _list.push(2)
  656. } else if (this.checkboxValue1[i] == '集装箱') {
  657. _list.push(3)
  658. } else if (this.checkboxValue1[i] == '自卸车') {
  659. _list.push(4)
  660. }
  661. }
  662. this.dataObj.carModel = _list.toString()
  663. this.dataObj.commonId = this.userInfo.id
  664. uni.$u.route('/pages/order/signContract', {
  665. obj: JSON.stringify(this.dataObj),
  666. type:2,//编辑
  667. });
  668. // this.$request.baseRequest('post', '/publishTaskInfo/api/editTask', this.dataObj).then(res => {
  669. // if(res.code == 200){
  670. // uni.$u.route('/pages/order/signContract', {
  671. // obj: JSON.stringify(this.dataObj)
  672. // });
  673. // }
  674. // })
  675. // .catch(res => {
  676. // uni.showToast({
  677. // title: res.message,
  678. // icon: 'none',
  679. // duration: 2000
  680. // })
  681. // });
  682. },
  683. cancelClick() {
  684. this.isShowAlert = false
  685. },
  686. //获取默认发货地、收货地
  687. getDefaultPlace(type) {
  688. // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
  689. uni.showLoading({
  690. mask: true,
  691. title: '加载中...'
  692. })
  693. this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
  694. commonId: this.userInfo.id
  695. }).then(res => {
  696. uni.hideLoading()
  697. for (let i = 0; i < res.data.length; i++) {
  698. if (res.data[i].defaultShipment == 1 && type == 0) {
  699. this.dataObj.sendCity = res.data[i].city
  700. this.dataObj.sendArea = res.data[i].area
  701. this.dataObj.sendPrivate = res.data[i].province
  702. this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
  703. this.dataObj.sendLongitude = res.data[i].longitude
  704. this.dataObj.sendLatitude = res.data[i].latitude
  705. }
  706. if (res.data[i].defaultReceipt == 1 && type == 1) {
  707. this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
  708. this.dataObj.unloadCity = res.data[i].city
  709. this.dataObj.unloadArea = res.data[i].area
  710. this.dataObj.unloadPrivate = res.data[i].province
  711. this.dataObj.unsendLongitude = res.data[i].longitude
  712. this.dataObj.unsendLatitude = res.data[i].latitude
  713. }
  714. }
  715. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
  716. this.dataObj.unsendLongitude) {
  717. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  718. .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  719. }
  720. })
  721. .catch(res => {
  722. uni.hideLoading()
  723. uni.showToast({
  724. title: res.message,
  725. icon: 'none',
  726. duration: 2000
  727. })
  728. });
  729. },
  730. changeHandler(e) {
  731. const {
  732. columnIndex,
  733. value,
  734. values,
  735. index,
  736. picker = this.$refs.uPicker
  737. } = e
  738. // if (columnIndex === 0) {
  739. //
  740. // if (e.index != 0) {
  741. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  742. // }
  743. // } else if (columnIndex === 1) {
  744. // if (e.index != 0) {
  745. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  746. // }
  747. // }
  748. },
  749. selectCargoOwnerClose() {
  750. this.show = false
  751. },
  752. // confirmSelectCargoOwner(e) {
  753. // this.dataObj.cargoOwner = e.value[0]
  754. // for (let i = 0; i < this.qyList.length; i++) {
  755. // let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  756. // if (_name == e.value[0]) {
  757. // this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  758. // }
  759. // }
  760. // uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  761. // this.show = false
  762. // },
  763. confirmSelectCargoOwner(e) {
  764. this.dataObj.cargoOwner = e.value[0]
  765. for (let i = 0; i < this.qyList.length; i++) {
  766. let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  767. if (_name == e.value[0]) {
  768. if(e.value[0]!='个人货主'){
  769. this.freightAdvance=true
  770. if(this.qyList[i].compStatus=='ss'){
  771. this.dataObj.compId=this.qyList[i].compId
  772. }else{
  773. this.dataObj.compId=this.qyList[i].id
  774. }
  775. // console.log(this.qyList[i].compStatus,this.dataObj.compId)
  776. uni.setStorageSync('releasecompId', this.dataObj.compId)
  777. }else{
  778. this.freightAdvance=false
  779. }
  780. this.freightAdvance= this.qyList[i].advanceFreightService == 1 ? true : false
  781. this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  782. }
  783. }
  784. uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  785. this.show = false
  786. },
  787. selectCargoOwner() {
  788. this.show = true
  789. },
  790. selectAddress(type) {
  791. // uni.removeStorage({
  792. // key: 'storage_faddress'
  793. // });
  794. uni.removeStorage({
  795. key: 'storage_saddress'
  796. });
  797. uni.$u.route('/pages/release/selectAddress', {
  798. type: type,
  799. status:1
  800. });
  801. },
  802. checkboxChange(n) {
  803. console.log('change', n);
  804. if (n.length > 1 && n.length < 4 && n.includes('不限')) {
  805. n.shift(0)
  806. } else if (n.length == 4) {
  807. this.checkboxValue1 = n.splice(1, 4)
  808. }
  809. },
  810. selectValidityPeriodcq() {
  811. var datetime = new Date().getTime()
  812. var datetime1 = datetime + (24 * 60 * 60 * 1000 * 30 * 6)
  813. var date=new Date(datetime1)
  814. this.array={year:date.getFullYear(),month:date.getMonth() + 1,day:date.getDate()}
  815. console.log(this.array)
  816. if(this.dataObj.taskValidity&&this.dataObj.taskValidity!='长期'){
  817. const arr=this.dataObj.taskValidity.split('-')
  818. this.year=arr[0]
  819. this.month=arr[1]
  820. this.day=arr[2]
  821. }
  822. if(this.dataObj.taskValidity=='长期'){
  823. this.year='长期'
  824. this.month=''
  825. this.day=''
  826. }
  827. this.$refs.dateEl.show()
  828. },
  829. confirmValidityPeriod(date) {
  830. switch (this.ValidityPeriodType) {
  831. case 0:
  832. this.dataObj.loadingDateStart =date.date
  833. break
  834. case 1:
  835. this.dataObj.loadingDateEnd = date.date
  836. break
  837. }
  838. },
  839. confirmValidityPeriodcq(date) {
  840. this.dataObj.taskValidity = date.date
  841. },
  842. selectValidityPeriod(type) {
  843. this.ValidityPeriodType = type
  844. switch (this.ValidityPeriodType) {
  845. case 0:
  846. if(this.dataObj.loadingDateStart&&this.dataObj.loadingDateStart!='随时'){
  847. const arr=this.dataObj.loadingDateStart.split('-')
  848. this.year=arr[0]
  849. this.month=arr[1]
  850. this.day=arr[2]
  851. }
  852. if(this.dataObj.loadingDateStart=='随时'){
  853. this.year='随时'
  854. this.month=''
  855. this.day=''
  856. }
  857. break
  858. case 1:
  859. if(this.dataObj.loadingDateEnd&&this.dataObj.loadingDateEnd!='随时'){
  860. const arr=this.dataObj.loadingDateEnd.split('-')
  861. this.year=arr[0]
  862. this.month=arr[1]
  863. this.day=arr[2]
  864. }
  865. if(this.dataObj.loadingDateEnd=='随时'){
  866. this.year='随时'
  867. this.month=''
  868. this.day=''
  869. }
  870. break
  871. }
  872. this.$refs.datezc.show()
  873. },
  874. change(e) {
  875. console.log('change', e);
  876. },
  877. back() {
  878. uni.navigateBack()
  879. },
  880. goToRecord() {
  881. uni.$u.route('/pages/release/record');
  882. },
  883. radioChange(n) {
  884. console.log('radioChange', n);
  885. this.dataDetails.type = n
  886. },
  887. submit() {
  888. if (this.validate()) return
  889. this.confirmClick()
  890. // this.isShowAlert = true;
  891. },
  892. }
  893. }
  894. </script>
  895. <style scoped lang="scss">
  896. .input {
  897. text-align: right;
  898. }
  899. .title {
  900. padding: 0 20rpx;
  901. display: flex;
  902. justify-content: center;
  903. position: relative;
  904. .nav-title {
  905. font-size: 32rpx;
  906. }
  907. .back {
  908. position: absolute;
  909. left: 20rpx;
  910. }
  911. .search {
  912. display: flex;
  913. align-items: center;
  914. position: absolute;
  915. right: 20rpx;
  916. }
  917. }
  918. .fixed1 {
  919. height: var(--status-bar-height);
  920. }
  921. .row {
  922. display: flex;
  923. justify-content: space-between;
  924. }
  925. .content1 {
  926. background: white;
  927. margin: 20rpx 20rpx 0 20rpx;
  928. border-radius: 20rpx;
  929. padding: 40rpx;
  930. .select-sf {
  931. color: #999999;
  932. }
  933. .right {
  934. color: #CBCBCB
  935. }
  936. }
  937. .content2,
  938. .content3,
  939. .content5 {
  940. box-sizing: border-box;
  941. background: white;
  942. border-radius: 20rpx;
  943. padding: 20rpx;
  944. margin: 20rpx;
  945. .row {
  946. margin: 30rpx;
  947. }
  948. .row1,
  949. .row2 {
  950. display: flex;
  951. justify-content: space-between;
  952. align-items: center;
  953. .left .top {
  954. display: flex;
  955. }
  956. }
  957. }
  958. .select-type {
  959. display: flex;
  960. justify-content: flex-end;
  961. }
  962. .content2 {
  963. padding: 40rpx;
  964. .row1,
  965. .row2 {
  966. .left {
  967. width: 100%;
  968. }
  969. .right {
  970. color: #CBCBCB
  971. }
  972. }
  973. .row2 {
  974. margin-top: 40rpx;
  975. }
  976. .top {
  977. display: flex;
  978. align-items: center;
  979. }
  980. .bottom {
  981. margin-top: 10rpx;
  982. padding-left: 72rpx;
  983. }
  984. .title {
  985. font-size: 36rpx;
  986. font-weight: 700;
  987. color: #171717;
  988. }
  989. .collect {
  990. width: 40rpx;
  991. height: 40rpx;
  992. line-height: 40rpx;
  993. background: #F5BA3C;
  994. color: white;
  995. padding: 6rpx;
  996. border-radius: 50%;
  997. text-align: center;
  998. }
  999. .send {
  1000. width: 40rpx;
  1001. height: 40rpx;
  1002. line-height: 40rpx;
  1003. background: #101010;
  1004. color: white;
  1005. padding: 6rpx;
  1006. border-radius: 50%;
  1007. text-align: center;
  1008. }
  1009. }
  1010. .content3 {}
  1011. .content4 {
  1012. margin: 20rpx;
  1013. padding-left: 20rpx;
  1014. .title {
  1015. color: #999999;
  1016. }
  1017. .btn-text {
  1018. color: #F5BA3C;
  1019. border: 1px solid #F5BA3C;
  1020. border-radius: 40rpx;
  1021. padding: 0rpx 10rpx;
  1022. box-sizing: border-box;
  1023. }
  1024. }
  1025. .submit {
  1026. width: 90%;
  1027. margin: 100rpx auto;
  1028. font-size: 36rpx;
  1029. font-weight: 500;
  1030. color: #FFFFFF;
  1031. background: #F5BA3C;
  1032. text-align: center;
  1033. padding: 20rpx 0;
  1034. border-radius: 50rpx;
  1035. }
  1036. .select-data {
  1037. color: #999999;
  1038. }
  1039. .row-bgc {
  1040. background: #F7F8FA;
  1041. padding: 20rpx 30rpx;
  1042. box-sizing: border-box;
  1043. border-radius: 10rpx;
  1044. }
  1045. .car-input {
  1046. // padding:20rpx;
  1047. // box-sizing: border-box;
  1048. // border-radius: 10px;
  1049. }
  1050. .car-line {
  1051. margin: 0 20rpx;
  1052. }
  1053. .car-row {
  1054. display: flex;
  1055. background: white;
  1056. padding: 20rpx;
  1057. box-sizing: border-box;
  1058. border-radius: 10rpx;
  1059. }
  1060. uni-navigator {//条款
  1061. display: inline-block;
  1062. color: #F5BA3C;
  1063. }
  1064. </style>