release.vue 32 KB

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