editRelease.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  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.freightPrice)) {
  475. this.$refs.uToast.show({
  476. type: 'error',
  477. message: "运费单价不能为空!",
  478. })
  479. return true
  480. }
  481. if (
  482. this.dataObj.freightPrice < 0 || this.dataObj.freightPrice > 100000 || (
  483. String(this.dataObj.freightPrice).indexOf('.') != -1 && String(tthis.dataObj.freightPrice).length -
  484. (String(this.dataObj.freightPrice).indexOf(
  485. '.') + 1) > 2)
  486. ) {
  487. uni.showToast({
  488. title: '运费单价输入错误!',
  489. duration: 2000,
  490. icon: "none",
  491. });
  492. return true
  493. }
  494. if (this.dataObj.weight) {
  495. if (
  496. this.dataObj.weight < 0.1 || this.dataObj.weight > 10000000 || (
  497. String(this.dataObj.weight).indexOf('.') != -1 && String(tthis.dataObj.weight).length -
  498. (String(this.dataObj.weight).indexOf(
  499. '.') + 1) > 2)
  500. ) {
  501. uni.showToast({
  502. title: '重量输入错误!',
  503. duration: 2000,
  504. icon: "none",
  505. });
  506. return true
  507. }
  508. }
  509. if (this.dataObj.carLengthSmall) {
  510. if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
  511. uni.showToast({
  512. title: '最小车长输入错误!',
  513. duration: 2000,
  514. icon: "none",
  515. });
  516. return true
  517. }
  518. }
  519. if (this.dataObj.carLength) {
  520. if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
  521. uni.showToast({
  522. title: '最大车长输入错误!',
  523. duration: 2000,
  524. icon: "none",
  525. });
  526. return true
  527. }
  528. }
  529. if (this.dataObj.carLengthSmall && this.dataObj.carLength && (Number(this.dataObj.carLengthSmall) > Number(this.dataObj.carLength))) {
  530. uni.showToast({
  531. title: '最小车长应小于最大车长!',
  532. duration: 2000,
  533. icon: "none",
  534. });
  535. return true
  536. }
  537. if (this.dataObj.loadWeightSmall) {
  538. if (
  539. this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
  540. String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(this.dataObj
  541. .loadWeightSmall).length -
  542. (String(this.dataObj.loadWeightSmall).indexOf(
  543. '.') + 1) > 3)
  544. ) {
  545. uni.showToast({
  546. title: '最小载重输入错误!',
  547. duration: 2000,
  548. icon: "none",
  549. });
  550. return true
  551. }
  552. }
  553. if (this.dataObj.loadWeight) {
  554. if (
  555. this.dataObj.loadWeight < 0.1 || this.dataObj.loadWeight > 100 || (
  556. String(this.dataObj.loadWeight).indexOf('.') != -1 && String(this.dataObj.loadWeight).length -
  557. (String(this.dataObj.loadWeight).indexOf(
  558. '.') + 1) > 3)
  559. ) {
  560. uni.showToast({
  561. title: '最大载重输入错误!',
  562. duration: 2000,
  563. icon: "none",
  564. });
  565. return true
  566. }
  567. }
  568. if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (Number(this.dataObj.loadWeightSmall)>Number(this.dataObj.loadWeight))) {
  569. uni.showToast({
  570. title: '最小载重应小于最大载重!',
  571. duration: 2000,
  572. icon: "none",
  573. });
  574. return true
  575. }
  576. },
  577. confirmClick() {
  578. this.isShowAlert = false
  579. if (this.dataObj.billingMethod == '元/吨') {
  580. this.dataObj.billingMethod = 0
  581. } else {
  582. this.dataObj.billingMethod = 1
  583. }
  584. if (this.dataObj.freightAdvance) {
  585. this.dataObj.freightAdvance = 1
  586. } else {
  587. this.dataObj.freightAdvance = 0
  588. }
  589. let _list = []
  590. for (let i = 0; i < this.checkboxValue1.length; i++) {
  591. if (this.checkboxValue1[i] == '不限') {
  592. _list.push(1)
  593. } else if (this.checkboxValue1[i] == '高栏') {
  594. _list.push(2)
  595. } else if (this.checkboxValue1[i] == '集装箱') {
  596. _list.push(3)
  597. } else if (this.checkboxValue1[i] == '自卸车') {
  598. _list.push(4)
  599. }
  600. }
  601. this.dataObj.carModel = _list.toString()
  602. this.dataObj.commonId = this.userInfo.id
  603. this.$request.baseRequest('post', '/publishTaskInfo/api/editTask', this.dataObj).then(res => {
  604. this.$refs.uToast.show({
  605. type: 'success',
  606. message: "修改成功",
  607. complete() {
  608. uni.navigateBack({
  609. delta:1
  610. })
  611. _this.dataObj = {
  612. commonId: '',
  613. cargoOwner: '',
  614. sendPrivate: '',
  615. sendCity: '',
  616. sendArea: '',
  617. sendDetailedAddress: '',
  618. unloadPrivate: '',
  619. unloadCity: '',
  620. unloadArea: '',
  621. unloadDetailedAddress: '',
  622. distance: '',
  623. goodsName: '',
  624. billingMethod: '元/吨',
  625. freightPrice: '',
  626. freightAdvance: true,
  627. sender: '',
  628. senderPhone: '',
  629. receiver: '',
  630. receiverPhone: '',
  631. weight: '',
  632. loadingDateStart: '',
  633. loadingDateEnd: '',
  634. carLengthSmall: '',
  635. carLength: '',
  636. loadWeightSmall: '',
  637. loadWeight: '',
  638. carModel: '',
  639. taskDescription: '',
  640. taskValidity: '',
  641. sendLongitude: '',
  642. sendLatitude: '',
  643. unsendLongitude: '',
  644. unsendLatitude: '',
  645. }
  646. _this.checkboxValue1 = ['不限']
  647. }
  648. })
  649. })
  650. .catch(res => {
  651. uni.showToast({
  652. title: res.message,
  653. icon: 'none',
  654. duration: 2000
  655. })
  656. });
  657. },
  658. cancelClick() {
  659. this.isShowAlert = false
  660. },
  661. //获取默认发货地、收货地
  662. getDefaultPlace(type) {
  663. // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
  664. uni.showLoading({
  665. mask: true,
  666. title: '加载中...'
  667. })
  668. this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
  669. commonId: this.userInfo.id
  670. }).then(res => {
  671. uni.hideLoading()
  672. for (let i = 0; i < res.data.length; i++) {
  673. if (res.data[i].defaultShipment == 1 && type == 0) {
  674. this.dataObj.sendCity = res.data[i].city
  675. this.dataObj.sendArea = res.data[i].area
  676. this.dataObj.sendPrivate = res.data[i].province
  677. this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
  678. this.dataObj.sendLongitude = res.data[i].longitude
  679. this.dataObj.sendLatitude = res.data[i].latitude
  680. }
  681. if (res.data[i].defaultReceipt == 1 && type == 1) {
  682. this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
  683. this.dataObj.unloadCity = res.data[i].city
  684. this.dataObj.unloadArea = res.data[i].area
  685. this.dataObj.unloadPrivate = res.data[i].province
  686. this.dataObj.unsendLongitude = res.data[i].longitude
  687. this.dataObj.unsendLatitude = res.data[i].latitude
  688. }
  689. }
  690. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
  691. this.dataObj.unsendLongitude) {
  692. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  693. .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  694. }
  695. })
  696. .catch(res => {
  697. uni.hideLoading()
  698. uni.showToast({
  699. title: res.message,
  700. icon: 'none',
  701. duration: 2000
  702. })
  703. });
  704. },
  705. changeHandler(e) {
  706. const {
  707. columnIndex,
  708. value,
  709. values,
  710. index,
  711. picker = this.$refs.uPicker
  712. } = e
  713. // if (columnIndex === 0) {
  714. //
  715. // if (e.index != 0) {
  716. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  717. // }
  718. // } else if (columnIndex === 1) {
  719. // if (e.index != 0) {
  720. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  721. // }
  722. // }
  723. },
  724. selectCargoOwnerClose() {
  725. this.show = false
  726. },
  727. // confirmSelectCargoOwner(e) {
  728. // this.dataObj.cargoOwner = e.value[0]
  729. // for (let i = 0; i < this.qyList.length; i++) {
  730. // let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  731. // if (_name == e.value[0]) {
  732. // this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  733. // }
  734. // }
  735. // uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  736. // this.show = false
  737. // },
  738. confirmSelectCargoOwner(e) {
  739. this.dataObj.cargoOwner = e.value[0]
  740. for (let i = 0; i < this.qyList.length; i++) {
  741. let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  742. if (_name == e.value[0]) {
  743. if(e.value[0]!='个人货主'){
  744. this.freightAdvance=true
  745. if(this.qyList[i].compStatus=='ss'){
  746. this.dataObj.compId=this.qyList[i].compId
  747. }else{
  748. this.dataObj.compId=this.qyList[i].id
  749. }
  750. // console.log(this.qyList[i].compStatus,this.dataObj.compId)
  751. uni.setStorageSync('releasecompId', this.dataObj.compId)
  752. }else{
  753. this.freightAdvance=false
  754. }
  755. this.freightAdvance= this.qyList[i].advanceFreightService == 1 ? true : false
  756. this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  757. }
  758. }
  759. uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  760. this.show = false
  761. },
  762. selectCargoOwner() {
  763. this.show = true
  764. },
  765. selectAddress(type) {
  766. // uni.removeStorage({
  767. // key: 'storage_faddress'
  768. // });
  769. uni.removeStorage({
  770. key: 'storage_saddress'
  771. });
  772. uni.$u.route('/pages/release/selectAddress', {
  773. type: type,
  774. status:1
  775. });
  776. },
  777. checkboxChange(n) {
  778. console.log('change', n);
  779. if (n.length > 1 && n.length < 4 && n.includes('不限')) {
  780. n.shift(0)
  781. } else if (n.length == 4) {
  782. this.checkboxValue1 = n.splice(1, 4)
  783. }
  784. },
  785. selectValidityPeriodcq() {
  786. var datetime = new Date().getTime()
  787. var datetime1 = datetime + (24 * 60 * 60 * 1000 * 30 * 6)
  788. var date=new Date(datetime1)
  789. this.array={year:date.getFullYear(),month:date.getMonth() + 1,day:date.getDate()}
  790. console.log(this.array)
  791. if(this.dataObj.taskValidity&&this.dataObj.taskValidity!='长期'){
  792. const arr=this.dataObj.taskValidity.split('-')
  793. this.year=arr[0]
  794. this.month=arr[1]
  795. this.day=arr[2]
  796. }
  797. if(this.dataObj.taskValidity=='长期'){
  798. this.year='长期'
  799. }
  800. this.$refs.dateEl.show()
  801. },
  802. confirmValidityPeriod(date) {
  803. switch (this.ValidityPeriodType) {
  804. case 0:
  805. this.dataObj.loadingDateStart =date.date
  806. break
  807. case 1:
  808. this.dataObj.loadingDateEnd = date.date
  809. break
  810. }
  811. },
  812. confirmValidityPeriodcq(date) {
  813. this.dataObj.taskValidity = date.date
  814. },
  815. selectValidityPeriod(type) {
  816. this.ValidityPeriodType = type
  817. switch (this.ValidityPeriodType) {
  818. case 0:
  819. if(this.dataObj.loadingDateStart&&this.dataObj.loadingDateStart!='随时'){
  820. const arr=this.dataObj.loadingDateStart.split('-')
  821. this.year=arr[0]
  822. this.month=arr[1]
  823. this.day=arr[2]
  824. }
  825. if(this.dataObj.loadingDateStart=='随时'){
  826. this.year='随时'
  827. }
  828. break
  829. case 1:
  830. if(this.dataObj.loadingDateEnd&&this.dataObj.loadingDateEnd!='随时'){
  831. const arr=this.dataObj.loadingDateEnd.split('-')
  832. this.year=arr[0]
  833. this.month=arr[1]
  834. this.day=arr[2]
  835. }
  836. if(this.dataObj.loadingDateEnd=='随时'){
  837. this.year='随时'
  838. }
  839. break
  840. }
  841. this.$refs.datezc.show()
  842. },
  843. change(e) {
  844. console.log('change', e);
  845. },
  846. back() {
  847. uni.navigateBack()
  848. },
  849. goToRecord() {
  850. uni.$u.route('/pages/release/record');
  851. },
  852. radioChange(n) {
  853. console.log('radioChange', n);
  854. this.dataDetails.type = n
  855. },
  856. submit() {
  857. if (this.validate()) return
  858. this.isShowAlert = true;
  859. },
  860. }
  861. }
  862. </script>
  863. <style scoped lang="scss">
  864. .input {
  865. text-align: right;
  866. }
  867. .title {
  868. padding: 0 20rpx;
  869. display: flex;
  870. justify-content: center;
  871. position: relative;
  872. .nav-title {
  873. font-size: 32rpx;
  874. }
  875. .back {
  876. position: absolute;
  877. left: 20rpx;
  878. }
  879. .search {
  880. display: flex;
  881. align-items: center;
  882. position: absolute;
  883. right: 20rpx;
  884. }
  885. }
  886. .fixed1 {
  887. height: var(--status-bar-height);
  888. }
  889. .row {
  890. display: flex;
  891. justify-content: space-between;
  892. }
  893. .content1 {
  894. background: white;
  895. margin: 20rpx 20rpx 0 20rpx;
  896. border-radius: 20rpx;
  897. padding: 40rpx;
  898. .select-sf {
  899. color: #999999;
  900. }
  901. .right {
  902. color: #CBCBCB
  903. }
  904. }
  905. .content2,
  906. .content3,
  907. .content5 {
  908. box-sizing: border-box;
  909. background: white;
  910. border-radius: 20rpx;
  911. padding: 20rpx;
  912. margin: 20rpx;
  913. .row {
  914. margin: 30rpx;
  915. }
  916. .row1,
  917. .row2 {
  918. display: flex;
  919. justify-content: space-between;
  920. align-items: center;
  921. .left .top {
  922. display: flex;
  923. }
  924. }
  925. }
  926. .select-type {
  927. display: flex;
  928. justify-content: flex-end;
  929. }
  930. .content2 {
  931. padding: 40rpx;
  932. .row1,
  933. .row2 {
  934. .left {
  935. width: 100%;
  936. }
  937. .right {
  938. color: #CBCBCB
  939. }
  940. }
  941. .row2 {
  942. margin-top: 40rpx;
  943. }
  944. .top {
  945. display: flex;
  946. align-items: center;
  947. }
  948. .bottom {
  949. margin-top: 10rpx;
  950. padding-left: 72rpx;
  951. }
  952. .title {
  953. font-size: 36rpx;
  954. font-weight: 700;
  955. color: #171717;
  956. }
  957. .collect {
  958. width: 40rpx;
  959. height: 40rpx;
  960. line-height: 40rpx;
  961. background: #2772FB;
  962. color: white;
  963. padding: 6rpx;
  964. border-radius: 50%;
  965. text-align: center;
  966. }
  967. .send {
  968. width: 40rpx;
  969. height: 40rpx;
  970. line-height: 40rpx;
  971. background: #101010;
  972. color: white;
  973. padding: 6rpx;
  974. border-radius: 50%;
  975. text-align: center;
  976. }
  977. }
  978. .content3 {}
  979. .content4 {
  980. margin: 20rpx;
  981. padding-left: 20rpx;
  982. .title {
  983. color: #999999;
  984. }
  985. .btn-text {
  986. color: #2772FB;
  987. border: 1px solid #2772FB;
  988. border-radius: 40rpx;
  989. padding: 0rpx 10rpx;
  990. box-sizing: border-box;
  991. }
  992. }
  993. .submit {
  994. width: 90%;
  995. margin: 100rpx auto;
  996. font-size: 36rpx;
  997. font-weight: 500;
  998. color: #FFFFFF;
  999. background: #2772FB;
  1000. text-align: center;
  1001. padding: 20rpx 0;
  1002. border-radius: 50rpx;
  1003. }
  1004. .select-data {
  1005. color: #999999;
  1006. }
  1007. .row-bgc {
  1008. background: #F7F8FA;
  1009. padding: 20rpx 30rpx;
  1010. box-sizing: border-box;
  1011. border-radius: 10rpx;
  1012. }
  1013. .car-input {
  1014. // padding:20rpx;
  1015. // box-sizing: border-box;
  1016. // border-radius: 10px;
  1017. }
  1018. .car-line {
  1019. margin: 0 20rpx;
  1020. }
  1021. .car-row {
  1022. display: flex;
  1023. background: white;
  1024. padding: 20rpx;
  1025. box-sizing: border-box;
  1026. border-radius: 10rpx;
  1027. }
  1028. </style>