editRelease.vue 30 KB

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