editRelease.vue 31 KB

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