release.vue 31 KB

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