release.vue 33 KB

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