release.vue 33 KB

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