release.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315
  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.receiverCreditCode&&!uni.$u.test.rangeLength(this.dataObj.receiverCreditCode, [18, 18])){
  618. this.$refs.uToast.show({
  619. type: 'error',
  620. message: "信用代码输入错误!",
  621. })
  622. return true
  623. }
  624. if (uni.$u.test.isEmpty(this.dataObj.freightPrice)) {
  625. this.$refs.uToast.show({
  626. type: 'error',
  627. message: "运费单价不能为空!",
  628. })
  629. return true
  630. }
  631. if (
  632. this.dataObj.freightPrice < 0 || this.dataObj.freightPrice > 100000 || (
  633. String(this.dataObj.freightPrice).indexOf('.') != -1 && String(this.dataObj.freightPrice).length -
  634. (String(this.dataObj.freightPrice).indexOf(
  635. '.') + 1) > 2)
  636. ) {
  637. uni.showToast({
  638. title: '运费单价输入错误!',
  639. duration: 2000,
  640. icon: "none",
  641. });
  642. return true
  643. }
  644. if (this.dataObj.weight) {
  645. if (
  646. this.dataObj.weight < 0.1 || this.dataObj.weight > 10000000 || (
  647. String(this.dataObj.weight).indexOf('.') != -1 && String(tthis.dataObj.weight).length -
  648. (String(this.dataObj.weight).indexOf(
  649. '.') + 1) > 2)
  650. ) {
  651. uni.showToast({
  652. title: '重量输入错误!',
  653. duration: 2000,
  654. icon: "none",
  655. });
  656. return true
  657. }
  658. }
  659. if (this.dataObj.carLengthSmall) {
  660. if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
  661. uni.showToast({
  662. title: '最小车长输入错误!',
  663. duration: 2000,
  664. icon: "none",
  665. });
  666. return true
  667. }
  668. }
  669. if (this.dataObj.carLength) {
  670. if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
  671. uni.showToast({
  672. title: '最大车长输入错误!',
  673. duration: 2000,
  674. icon: "none",
  675. });
  676. return true
  677. }
  678. }
  679. if (this.dataObj.carLengthSmall && this.dataObj.carLength && (Number(this.dataObj.carLengthSmall) > Number(
  680. this.dataObj
  681. .carLength))) {
  682. uni.showToast({
  683. title: '最小车长应小于最大车长!',
  684. duration: 2000,
  685. icon: "none",
  686. });
  687. return true
  688. }
  689. if (this.dataObj.loadWeightSmall) {
  690. if (
  691. this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
  692. String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(tthis.dataObj
  693. .loadWeightSmall).length -
  694. (String(this.dataObj.loadWeightSmall).indexOf(
  695. '.') + 1) > 3)
  696. ) {
  697. uni.showToast({
  698. title: '载量输入错误!',
  699. duration: 2000,
  700. icon: "none",
  701. });
  702. return true
  703. }
  704. }
  705. if (this.dataObj.loadWeight) {
  706. if (
  707. this.dataObj.loadWeight < 0.1 || this.dataObj.loadWeight > 100 || (
  708. String(this.dataObj.loadWeight).indexOf('.') != -1 && String(tthis.dataObj.loadWeight).length -
  709. (String(this.dataObj.loadWeight).indexOf(
  710. '.') + 1) > 3)
  711. ) {
  712. uni.showToast({
  713. title: '载量输入错误!',
  714. duration: 2000,
  715. icon: "none",
  716. });
  717. return true
  718. }
  719. }
  720. if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (Number(this.dataObj.loadWeightSmall) >
  721. Number(this.dataObj
  722. .loadWeight))) {
  723. uni.showToast({
  724. title: '最小载重应小于最大载重!',
  725. duration: 2000,
  726. icon: "none",
  727. });
  728. return true
  729. }
  730. },
  731. confirmClick() {
  732. uni.$u.throttle(this.requestdata, 500)
  733. },
  734. requestdata(){
  735. // // #ifdef APP-PLUS
  736. // if (this.alertTitle == '账号审核中') {
  737. // if (uni.getSystemInfoSync().platform == 'ios') {
  738. // plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  739. // } else if (uni.getSystemInfoSync().platform == 'android') {
  740. // plus.runtime.quit();
  741. // }
  742. // return
  743. // }
  744. // // #endif
  745. // if (this.alertTitle == '身份信息未认证,去认证?') {
  746. // uni.switchTab({
  747. // url: '/pages/mine/index'
  748. // })
  749. // return
  750. // }
  751. // this.isShowAlert = false
  752. if (this.dataObj.billingMethod == '元/吨') {
  753. this.dataObj.billingMethod = 0
  754. } else {
  755. this.dataObj.billingMethod = 1
  756. }
  757. if (this.dataObj.freightAdvance) {
  758. this.dataObj.freightAdvance = 1
  759. } else {
  760. this.dataObj.freightAdvance = 0
  761. }
  762. let _list = []
  763. for (let i = 0; i < this.checkboxValue1.length; i++) {
  764. if (this.checkboxValue1[i] == '不限') {
  765. _list.push(1)
  766. } else if (this.checkboxValue1[i] == '高栏') {
  767. _list.push(2)
  768. } else if (this.checkboxValue1[i] == '集装箱') {
  769. _list.push(3)
  770. } else if (this.checkboxValue1[i] == '自卸车') {
  771. _list.push(4)
  772. }
  773. }
  774. this.dataObj.carModel = _list.toString()
  775. this.dataObj.commonId = this.userInfo.id
  776. this.$request.baseRequest('post', '/publishTaskInfo/api/addTask', this.dataObj).then(res => {
  777. uni.removeStorage({
  778. key: 'storage_saddress'
  779. });
  780. uni.removeStorage({
  781. key: 'storage_faddress'
  782. });
  783. uni.removeStorage({
  784. key: 'releaseCargoOwner'
  785. });
  786. uni.removeStorage({
  787. key: 'releasecompId'
  788. });
  789. this.$refs.uToast.show({
  790. type: 'success',
  791. message: "发布成功",
  792. complete() {
  793. _this.dataObj = {
  794. commonId: '',
  795. cargoOwner: '',
  796. sendPrivate: '',
  797. sendCity: '',
  798. sendArea: '',
  799. sendDetailedAddress: '',
  800. unloadPrivate: '',
  801. unloadCity: '',
  802. unloadArea: '',
  803. unloadDetailedAddress: '',
  804. distance: '',
  805. goodsName: '',
  806. billingMethod: '元/吨',
  807. freightPrice: '',
  808. freightAdvance: true,
  809. sender: '',
  810. senderPhone: '',
  811. receiver: '',
  812. receiverPhone: '',
  813. weight: '',
  814. loadingDateStart: '',
  815. loadingDateEnd: '',
  816. carLengthSmall: '',
  817. carLength: '',
  818. loadWeightSmall: '',
  819. loadWeight: '',
  820. carModel: '',
  821. taskDescription: '',
  822. taskValidity: '',
  823. sendLongitude: '',
  824. sendLatitude: '',
  825. unsendLongitude: '',
  826. unsendLatitude: '',
  827. }
  828. _this.checkboxValue1 = ['不限']
  829. // uni.$u.route("/pages/release/record")
  830. }
  831. })
  832. this.isShowAlert = false
  833. })
  834. .catch(res => {
  835. uni.showToast({
  836. title: res.message,
  837. icon: 'none',
  838. duration: 2000
  839. })
  840. });
  841. },
  842. cancelClick() {
  843. this.isShowAlert = false
  844. },
  845. //获取默认发货地、收货地
  846. getDefaultPlace(type) {
  847. // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
  848. uni.showLoading({
  849. mask: true,
  850. title: '加载中...'
  851. })
  852. this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
  853. commonId: this.userInfo.id
  854. }).then(res => {
  855. for (let i = 0; i < res.data.length; i++) {
  856. if (res.data[i].defaultShipment == 1 && type == 0) {
  857. this.dataObj.sendCity = res.data[i].city
  858. this.dataObj.sendArea = res.data[i].area
  859. this.dataObj.sendPrivate = res.data[i].province
  860. this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
  861. this.dataObj.sendLongitude = res.data[i].longitude
  862. this.dataObj.sendLatitude = res.data[i].latitude
  863. this.dataObj.sender = res.data[i].contacts
  864. this.dataObj.senderPhone = res.data[i].contactPhone
  865. }
  866. if (res.data[i].defaultReceipt == 1 && type == 1) {
  867. this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
  868. this.dataObj.unloadCity = res.data[i].city
  869. this.dataObj.unloadArea = res.data[i].area
  870. this.dataObj.unloadPrivate = res.data[i].province
  871. this.dataObj.unsendLongitude = res.data[i].longitude
  872. this.dataObj.unsendLatitude = res.data[i].latitude
  873. this.dataObj.receiver = res.data[i].contacts
  874. this.dataObj.receiverPhone = res.data[i].contactPhone
  875. }
  876. }
  877. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
  878. this.dataObj.unsendLongitude) {
  879. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  880. .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  881. }
  882. uni.hideLoading()
  883. })
  884. .catch(res => {
  885. uni.showToast({
  886. title: res.message,
  887. icon: 'none',
  888. duration: 2000
  889. })
  890. });
  891. },
  892. changeHandler(e) {
  893. const {
  894. columnIndex,
  895. value,
  896. values,
  897. index,
  898. picker = this.$refs.uPicker
  899. } = e
  900. // if (columnIndex === 0) {
  901. //
  902. // if (e.index != 0) {
  903. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  904. // }
  905. // } else if (columnIndex === 1) {
  906. // if (e.index != 0) {
  907. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  908. // }
  909. // }
  910. },
  911. selectCargoOwnerClose() {
  912. this.show = false
  913. },
  914. confirmSelectCargoOwner(e) {
  915. this.dataObj.cargoOwner = e.value[0]
  916. for (let i = 0; i < this.qyList.length; i++) {
  917. let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  918. if (_name == e.value[0]) {
  919. if(e.value[0]!='个人货主'){
  920. if(this.qyList[i].compStatus=='ss'){
  921. this.dataObj.compId=this.qyList[i].compId
  922. }else{
  923. this.dataObj.compId=this.qyList[i].id
  924. }
  925. uni.setStorageSync('releasecompId', this.dataObj.compId)
  926. }
  927. this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  928. }
  929. }
  930. uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  931. this.show = false
  932. },
  933. selectCargoOwner() {
  934. this.show = true
  935. },
  936. selectAddress(type) {
  937. // uni.removeStorage({
  938. // key: 'storage_faddress'
  939. // });
  940. // uni.removeStorage({
  941. // key: 'storage_saddress'
  942. // });
  943. uni.$u.route('/pages/release/selectAddress', {
  944. type: type,
  945. });
  946. },
  947. checkboxChange(n) {
  948. if (n.length > 1 && n.length < 4 && n.includes('不限')) {
  949. n.shift(0)
  950. } else if (n.length == 4) {
  951. this.checkboxValue1 = n.splice(1, 4)
  952. }
  953. },
  954. selectValidityPeriodcq() {
  955. this.isShowcardValidity = true
  956. },
  957. confirmValidityPeriod(e) {
  958. if (e.value[0] == '随时') {
  959. switch (this.ValidityPeriodType) {
  960. case 0:
  961. this.dataObj.loadingDateStart = e.value[0]
  962. break
  963. case 1:
  964. this.dataObj.loadingDateEnd = e.value[0]
  965. break
  966. }
  967. } else {
  968. if (!e.value[1] || !e.value[2]) {
  969. this.$refs.uToast.show({
  970. type: 'error',
  971. message: "日期格式错误,请重新选择!",
  972. })
  973. return
  974. }
  975. switch (this.ValidityPeriodType) {
  976. case 0:
  977. this.dataObj.loadingDateStart = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  978. break
  979. case 1:
  980. this.dataObj.loadingDateEnd = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  981. break
  982. }
  983. }
  984. this.isShowValidity = false
  985. },
  986. getTime: function() {
  987. var date = new Date().getTime()
  988. year = date.getFullYear(),
  989. month = date.getMonth() + 1,
  990. day = date.getDate(),
  991. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  992. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  993. var timer = year + '-' + month + '-' + day
  994. return timer;
  995. },
  996. confirmValidityPeriodcq(e) {
  997. if (e.value[0] == '长期') {
  998. this.dataObj.taskValidity = e.value[0]
  999. } else {
  1000. if (!e.value[1] || !e.value[2]) {
  1001. this.$refs.uToast.show({
  1002. type: 'error',
  1003. message: "日期格式错误,请重新选择!",
  1004. })
  1005. return
  1006. }
  1007. var datetime = new Date().getTime()
  1008. var datetime1 = datetime + (24 * 60 * 60 * 1000 * 30 * 6)
  1009. var currecttime = new Date(e.value[0] + '-' + e.value[1] + '-' + e.value[2]).getTime()
  1010. if (currecttime < datetime || currecttime > datetime1) {
  1011. this.$refs.uToast.show({
  1012. type: 'error',
  1013. message: "请选择未来六个月之内的日期!",
  1014. })
  1015. } else {
  1016. this.dataObj.taskValidity = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  1017. this.isShowcardValidity = false
  1018. }
  1019. console.log(datetime, currecttime)
  1020. }
  1021. },
  1022. selectValidityPeriod(type) {
  1023. this.ValidityPeriodType = type
  1024. this.isShowValidity = true
  1025. },
  1026. change(e) {
  1027. console.log('change', e);
  1028. },
  1029. back() {
  1030. uni.navigateBack({
  1031. delta: 1
  1032. })
  1033. },
  1034. goToRecord() {
  1035. uni.$u.route('/pages/release/record');
  1036. },
  1037. radioChange(n) {
  1038. this.dataDetails.type = n
  1039. },
  1040. submit() {
  1041. if (this.validate()) return
  1042. if (this.dataObj.cargoOwner == '个人货主') {
  1043. this.dataObj.compId == ""
  1044. } else {
  1045. for (let i = 0; i < this.qyList.length; i++) {
  1046. if (this.dataObj.cargoOwner == this.qyList[i].companyName) {
  1047. this.dataObj.compId = this.qyList[i].id
  1048. break
  1049. }
  1050. }
  1051. }
  1052. this.isShowAlert = true;
  1053. },
  1054. }
  1055. }
  1056. </script>
  1057. <style scoped lang="scss">
  1058. .input {
  1059. text-align: right;
  1060. }
  1061. .content {
  1062. height: 100vh;
  1063. overflow: scroll;
  1064. }
  1065. .title {
  1066. padding: 0 20rpx;
  1067. display: flex;
  1068. justify-content: center;
  1069. position: relative;
  1070. .nav-title {
  1071. font-size: 32rpx;
  1072. }
  1073. .back {
  1074. position: absolute;
  1075. left: 20rpx;
  1076. }
  1077. .search {
  1078. display: flex;
  1079. align-items: center;
  1080. position: absolute;
  1081. right: 20rpx;
  1082. }
  1083. }
  1084. .fixed1 {
  1085. height: var(--status-bar-height);
  1086. }
  1087. .row {
  1088. display: flex;
  1089. justify-content: space-between;
  1090. }
  1091. .content1 {
  1092. background: white;
  1093. margin: 40rpx 20rpx 0 20rpx;
  1094. border-radius: 20rpx;
  1095. padding: 40rpx;
  1096. .select-sf {
  1097. color: #171717;
  1098. font-size: 34rpx;
  1099. font-weight: 600;
  1100. }
  1101. .select-sf1 {
  1102. color: #999999;
  1103. }
  1104. .right {
  1105. color: #CBCBCB
  1106. }
  1107. }
  1108. .content2,
  1109. .content3,
  1110. .content5 {
  1111. box-sizing: border-box;
  1112. background: white;
  1113. border-radius: 20rpx;
  1114. padding: 20rpx;
  1115. margin: 20rpx;
  1116. .row {
  1117. margin: 30rpx;
  1118. }
  1119. .row1,
  1120. .row2 {
  1121. display: flex;
  1122. justify-content: space-between;
  1123. align-items: center;
  1124. .left .top {
  1125. display: flex;
  1126. }
  1127. }
  1128. }
  1129. .select-type {
  1130. display: flex;
  1131. justify-content: flex-end;
  1132. }
  1133. .top-title {
  1134. background: #fff;
  1135. padding: 20rpx;
  1136. position: fixed;
  1137. z-index: 100;
  1138. top: 0;
  1139. box-sizing: border-box;
  1140. width: 100%;
  1141. }
  1142. .content2 {
  1143. padding: 40rpx;
  1144. .row1,
  1145. .row2 {
  1146. .left {
  1147. width: 100%;
  1148. }
  1149. .right {
  1150. color: #CBCBCB
  1151. }
  1152. }
  1153. .row2 {
  1154. margin-top: 40rpx;
  1155. }
  1156. .top {
  1157. display: flex;
  1158. align-items: center;
  1159. }
  1160. .bottom {
  1161. margin-top: 10rpx;
  1162. padding-left: 72rpx;
  1163. }
  1164. .title {
  1165. font-size: 36rpx;
  1166. font-weight: 700;
  1167. color: #171717;
  1168. }
  1169. .collect {
  1170. width: 40rpx;
  1171. height: 40rpx;
  1172. line-height: 40rpx;
  1173. background: #2772FB;
  1174. color: white;
  1175. padding: 6rpx;
  1176. border-radius: 50%;
  1177. text-align: center;
  1178. }
  1179. .send {
  1180. width: 40rpx;
  1181. height: 40rpx;
  1182. line-height: 40rpx;
  1183. background: #101010;
  1184. color: white;
  1185. padding: 6rpx;
  1186. border-radius: 50%;
  1187. text-align: center;
  1188. }
  1189. }
  1190. .content3 {}
  1191. .content4 {
  1192. margin: 20rpx;
  1193. padding-left: 20rpx;
  1194. .title {
  1195. color: #999999;
  1196. }
  1197. .btn-text {
  1198. color: #2772FB;
  1199. border: 1px solid #2772FB;
  1200. border-radius: 40rpx;
  1201. padding: 0rpx 10rpx;
  1202. box-sizing: border-box;
  1203. }
  1204. }
  1205. .submit {
  1206. width: 90%;
  1207. margin: 100rpx auto;
  1208. font-size: 36rpx;
  1209. font-weight: 500;
  1210. color: #FFFFFF;
  1211. background: #2772FB;
  1212. text-align: center;
  1213. padding: 20rpx 0;
  1214. border-radius: 50rpx;
  1215. }
  1216. .select-data {
  1217. color: #999999;
  1218. }
  1219. .row-bgc {
  1220. background: #F7F8FA;
  1221. padding: 20rpx 30rpx;
  1222. box-sizing: border-box;
  1223. border-radius: 10rpx;
  1224. }
  1225. .car-input {
  1226. // padding:20rpx;
  1227. // box-sizing: border-box;
  1228. // border-radius: 10px;
  1229. }
  1230. .car-line {
  1231. margin: 0 20rpx;
  1232. }
  1233. .car-row {
  1234. display: flex;
  1235. background: white;
  1236. padding: 20rpx;
  1237. box-sizing: border-box;
  1238. border-radius: 10rpx;
  1239. }
  1240. </style>