release.vue 37 KB

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