release.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312
  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 style='width:120px;' 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 style='width:120px;' 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='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. <itmister-date-picker :overdueContent="'任务已过期'" :dateStatus="1" :periodOfValidity="true" :startYear='2022' ref="dateEl" :endDate="array" :futureYear="30" @dateConfirm="confirmValidityPeriodcq"></itmister-date-picker>
  223. </view>
  224. <view class="submit" @click="submit">立即发布</view>
  225. <!-- <u-picker :show="isShowValidity" ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
  226. :closeOnClickOverlay='true' @close='isShowValidity=false' @cancel='isShowValidity=false'>
  227. </u-picker> -->
  228. <itmister-date-picker :dateStatus="2" :startYear='2022' ref="datezc" :futureYear="30" @dateConfirm="confirmValidityPeriod"></itmister-date-picker>
  229. <!-- //货物类别 -->
  230. <u-picker :show="isGoodsType" ref="uPicker" :columns="goodsList" keyName="constValue" @confirm="goodsSubmit"
  231. :closeOnClickOverlay='true' @close='isGoodsType=false' @cancel='isGoodsType=false'>
  232. </u-picker>
  233. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='false'
  234. :showCancelButton='showCancelButton' confirmColor='#2772FB' @confirm="$u.throttle(confirmClick(), 5000)" @close="cancelClick"
  235. @cancel="cancelClick"></u-modal>
  236. <u-modal :show="isShowAlert1" :title="alertTitle" :confirmText='confirmText' :content='alertContent'
  237. :closeOnClickOverlay='false' :showCancelButton='showCancelButton' confirmColor='#2772FB'
  238. @confirm="$u.throttle(confirmClick(), 5000)" @close="cancelClick" @cancel="cancelClick"></u-modal>
  239. <u-toast ref="uToast"></u-toast>
  240. </view>
  241. </template>
  242. <script>
  243. var _this;
  244. import {
  245. mapState
  246. } from 'vuex';
  247. export default {
  248. data() {
  249. return {
  250. showCancelButton: true,
  251. qyList: [],
  252. isShowAlert: false,
  253. alertTitle: '确定发布运输任务?',
  254. alertContent: null,
  255. radioCustomStyle: {
  256. margin: '0 0 0 20rpx'
  257. },
  258. show: false,
  259. columns: [
  260. []
  261. ],
  262. array:{},
  263. freightAdvance: false,
  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. ValidityPeriodType: '',
  321. dataDetails: {
  322. type: '元/吨'
  323. },
  324. radiolist1: [{
  325. name: '元/吨',
  326. disabled: false
  327. },
  328. {
  329. name: '元/车',
  330. disabled: false
  331. },
  332. ],
  333. // 货物类别
  334. isGoodsType:false,
  335. goodsList:[]
  336. }
  337. },
  338. onNavigationBarButtonTap(e) {
  339. console.log("success")
  340. this.goToRecord()
  341. },
  342. onShow() {
  343. var datetime = new Date().getTime()
  344. var datetime1 = datetime + (24 * 60 * 60 * 1000 * 30 * 6)
  345. var date=new Date(datetime1)
  346. this.array={year:date.getFullYear(),month:date.getMonth() + 1,day:date.getDate()}
  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. let _faddress = uni.getStorageSync('storage_faddress');
  394. let _saddress = uni.getStorageSync('storage_saddress');
  395. if (_faddress) {
  396. this.dataObj.sendCity = _faddress.city
  397. this.dataObj.sendArea = _faddress.area
  398. this.dataObj.sendPrivate = _faddress.province
  399. this.dataObj.sendDetailedAddress = _faddress.detailedAddress
  400. this.dataObj.sendLongitude = _faddress.longitude
  401. this.dataObj.sendLatitude = _faddress.latitude
  402. if(_faddress.contactPhone){
  403. this.dataObj.senderPhone = _faddress.contactPhone
  404. }
  405. if(_faddress.contacts){
  406. this.dataObj.sender = _faddress.contacts
  407. }
  408. } else {
  409. this.getDefaultPlace(0)
  410. }
  411. if (_saddress) {
  412. this.dataObj.unloadDetailedAddress = _saddress.detailedAddress
  413. this.dataObj.unloadCity = _saddress.city
  414. this.dataObj.unloadArea = _saddress.area
  415. this.dataObj.unloadPrivate = _saddress.province
  416. this.dataObj.unsendLongitude = _saddress.longitude
  417. this.dataObj.unsendLatitude = _saddress.latitude
  418. if(_saddress.contacts){
  419. this.dataObj.receiver = _saddress.contacts
  420. }
  421. if(_saddress.contactPhone){
  422. this.dataObj.receiverPhone = _saddress.contactPhone
  423. }
  424. } else {
  425. this.getDefaultPlace(1)
  426. }
  427. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude && this.dataObj
  428. .unsendLongitude) {
  429. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  430. .unsendLongitude,
  431. this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  432. }
  433. this.dataObj.loadingDateStart = '随时'
  434. this.dataObj.loadingDateEnd = '随时'
  435. this.dataObj.taskValidity = '长期'
  436. this.getSFList()
  437. },
  438. async onLoad() {
  439. //货物类别(默认上一次)
  440. this.queryGoodsList() // 查询货物类别
  441. let goods = uni.getStorageSync("goodsType")
  442. if(goods){
  443. this.dataObj.goodsType = goods.name
  444. this.dataObj.goodsTypeKey = goods.key
  445. }
  446. // _this = this
  447. // // #ifdef APP-PLUS
  448. // let _status = await this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
  449. // phone: this.userInfo.phone,
  450. // }).then(res => {
  451. // if(res.data){
  452. // return res.data.authenticationStatus
  453. // }
  454. // })
  455. // if (_status == '已禁用') {
  456. // this.isShowAlert = true
  457. // this.alertTitle = '账号审核中'
  458. // this.confirmText = '退出APP'
  459. // this.showCancelButton = false
  460. // return
  461. // } else {}
  462. // // #endif
  463. },
  464. computed: {
  465. ...mapState(['hasLogin', 'userInfo']),
  466. },
  467. methods: {
  468. queryGoodsList(){
  469. this.$request.baseRequest('get', '/commonSysParameter/getInfo', {
  470. constId: "CON1"
  471. }).then(res => {
  472. this.goodsList.push(res.data)
  473. console.log(this.goodsList)
  474. })
  475. },
  476. goodstypeChange(){
  477. this.isGoodsType = true
  478. },
  479. goodsSubmit(e){
  480. this.dataObj.goodsType = e.value[0].constValue
  481. this.dataObj.goodsTypeKey = e.value[0].constKey
  482. let _obj={
  483. name:e.value[0].constValue,
  484. key:e.value[0].constKey
  485. }
  486. uni.setStorageSync("goodsType",_obj)
  487. this.isGoodsType = false
  488. },
  489. getSFList() {
  490. this.dataObj.commonId = this.userInfo.id
  491. this.$request.baseRequest('get', '/cargoOwnerCompInfo/cargoOwnerList', {
  492. commonId: this.userInfo.id
  493. }).then(res => {
  494. if (uni.getStorageSync('releaseCargoOwner')) {
  495. this.dataObj.cargoOwner = uni.getStorageSync('releaseCargoOwner')
  496. this.dataObj.compId =uni.getStorageSync('releasecompId')
  497. }
  498. // 可用企业货主
  499. this.qyList = []
  500. // 自己法人
  501. // let _self = res.data.companyInfoList
  502. let _self = res.data.hyCompanyInfoList
  503. //代理货主
  504. // let _dlhz = res.data.cargoOwnerCompInfoList
  505. let _dlhz = res.data.hyCargoOwnerCompInfoList
  506. if (!_dlhz) _dlhz = []
  507. if (!_self) _self = []
  508. if (_self.length > 0) {
  509. for (let i = 0; i < _self.length; i++) {
  510. _self[i].compStatus='wd'
  511. if (_self[i].status == '已认证') {
  512. this.qyList.push(_self[i])
  513. }
  514. }
  515. }
  516. if (_dlhz.length > 0) {
  517. for (let i = 0; i < _dlhz.length; i++) {
  518. _dlhz[i].compStatus='ss'
  519. if (_dlhz[i].status == '已认证') {
  520. this.qyList.push(_dlhz[i])
  521. }
  522. }
  523. }
  524. this.columns = [
  525. []
  526. ]
  527. let obj = uni.getStorageSync("firstAuthentication")
  528. if (obj && obj.authenticationStatus == '已认证') {
  529. this.columns[0].push("个人货主")
  530. }
  531. for (let i = 0; i < this.qyList.length; i++) {
  532. this.columns[0].push(this.qyList[i].company ? this.qyList[i].company : this.qyList[i]
  533. .companyName)
  534. }
  535. this.$forceUpdate()
  536. })
  537. .catch(res => {});
  538. },
  539. validate() {
  540. if (uni.$u.test.isEmpty(this.dataObj.cargoOwner)) {
  541. this.$refs.uToast.show({
  542. type: 'error',
  543. message: "货主不能为空!",
  544. })
  545. return true
  546. }
  547. if (uni.$u.test.isEmpty(this.dataObj.sendArea)) {
  548. this.$refs.uToast.show({
  549. type: 'error',
  550. message: "请选择发货地区!",
  551. })
  552. return true
  553. }
  554. if (uni.$u.test.isEmpty(this.dataObj.sendDetailedAddress)) {
  555. this.$refs.uToast.show({
  556. type: 'error',
  557. message: "发货详细地址不能为空!",
  558. })
  559. return true
  560. }
  561. if (uni.$u.test.isEmpty(this.dataObj.unloadArea)) {
  562. this.$refs.uToast.show({
  563. type: 'error',
  564. message: "请选择收货地区!",
  565. })
  566. return true
  567. }
  568. if (uni.$u.test.isEmpty(this.dataObj.unloadDetailedAddress)) {
  569. this.$refs.uToast.show({
  570. type: 'error',
  571. message: "收货详细地址不能为空!",
  572. })
  573. return true
  574. }
  575. if (uni.$u.test.isEmpty(this.dataObj.goodsType)) {
  576. this.$refs.uToast.show({
  577. type: 'error',
  578. message: "货物类别不能为空!",
  579. })
  580. return true
  581. }
  582. if (uni.$u.test.isEmpty(this.dataObj.goodsName)) {
  583. this.$refs.uToast.show({
  584. type: 'error',
  585. message: "货名不能为空!",
  586. })
  587. return true
  588. }
  589. if (!uni.$u.test.chinese(this.dataObj.goodsName)) {
  590. this.$refs.uToast.show({
  591. type: 'error',
  592. message: "货名输入错误!",
  593. })
  594. return true
  595. }
  596. console.log(this.dataObj.receiver,"收货方")
  597. console.log(this.dataObj.receiverPhone,"收货方手机号")
  598. if (uni.$u.test.isEmpty(this.dataObj.receiver)) {
  599. this.$refs.uToast.show({
  600. type: 'error',
  601. message: "收货方不能为空!",
  602. })
  603. return true
  604. }
  605. if (uni.$u.test.isEmpty(this.dataObj.receiverPhone)) {
  606. this.$refs.uToast.show({
  607. type: 'error',
  608. message: "收货方手机号不能为空!",
  609. })
  610. return true
  611. }
  612. // if (uni.$u.test.isEmpty(this.dataObj.receiverIdcard)) {
  613. // this.$refs.uToast.show({
  614. // type: 'error',
  615. // message: "收货人身份证不能为空!",
  616. // })
  617. // return true
  618. // }
  619. if (!this.dataObj.receiverIdcard && !this.dataObj.receiverCreditCode) {
  620. this.$refs.uToast.show({
  621. type: 'error',
  622. message: "信用代码和身份证号码至少填写一个!",
  623. duration:2000
  624. })
  625. return true
  626. }
  627. // if(this.dataObj.receiverIdcard&&!uni.$u.test.rangeLength(this.dataObj.receiverIdcard, [18, 18])){
  628. // this.$refs.uToast.show({
  629. // type: 'error',
  630. // message: "身份证号输入错误!",
  631. // })
  632. // return true
  633. // }
  634. if(this.dataObj.receiverIdcard&&this.dataObj.receiverIdcard.length!=18){
  635. this.$refs.uToast.show({
  636. type: 'error',
  637. message: "身份证号输入错误!",
  638. })
  639. return true
  640. }
  641. if(this.dataObj.receiverCreditCode&&this.dataObj.receiverCreditCode.length!=18){
  642. this.$refs.uToast.show({
  643. type: 'error',
  644. message: "信用代码输入错误!",
  645. })
  646. return true
  647. }
  648. if (uni.$u.test.isEmpty(this.dataObj.freightPrice)) {
  649. this.$refs.uToast.show({
  650. type: 'error',
  651. message: "运费单价不能为空!",
  652. })
  653. return true
  654. }
  655. if (
  656. this.dataObj.freightPrice < 0 || this.dataObj.freightPrice > 100000 || (
  657. String(this.dataObj.freightPrice).indexOf('.') != -1 && String(this.dataObj.freightPrice).length -
  658. (String(this.dataObj.freightPrice).indexOf(
  659. '.') + 1) > 2)
  660. ) {
  661. uni.showToast({
  662. title: '运费单价输入错误!',
  663. duration: 2000,
  664. icon: "none",
  665. });
  666. return true
  667. }
  668. if (this.dataObj.weight) {
  669. if (
  670. this.dataObj.weight < 0.1 || this.dataObj.weight > 10000000 || (
  671. String(this.dataObj.weight).indexOf('.') != -1 && String(tthis.dataObj.weight).length -
  672. (String(this.dataObj.weight).indexOf(
  673. '.') + 1) > 2)
  674. ) {
  675. uni.showToast({
  676. title: '重量输入错误!',
  677. duration: 2000,
  678. icon: "none",
  679. });
  680. return true
  681. }
  682. }
  683. if (this.dataObj.carLengthSmall) {
  684. if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
  685. uni.showToast({
  686. title: '最小车长输入错误!',
  687. duration: 2000,
  688. icon: "none",
  689. });
  690. return true
  691. }
  692. }
  693. if (this.dataObj.carLength) {
  694. if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
  695. uni.showToast({
  696. title: '最大车长输入错误!',
  697. duration: 2000,
  698. icon: "none",
  699. });
  700. return true
  701. }
  702. }
  703. if (this.dataObj.carLengthSmall && this.dataObj.carLength && (Number(this.dataObj.carLengthSmall) > Number(
  704. this.dataObj
  705. .carLength))) {
  706. uni.showToast({
  707. title: '最小车长应小于最大车长!',
  708. duration: 2000,
  709. icon: "none",
  710. });
  711. return true
  712. }
  713. if (this.dataObj.loadWeightSmall) {
  714. if (
  715. this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
  716. String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(tthis.dataObj
  717. .loadWeightSmall).length -
  718. (String(this.dataObj.loadWeightSmall).indexOf(
  719. '.') + 1) > 3)
  720. ) {
  721. uni.showToast({
  722. title: '载量输入错误!',
  723. duration: 2000,
  724. icon: "none",
  725. });
  726. return true
  727. }
  728. }
  729. if (this.dataObj.loadWeight) {
  730. if (
  731. this.dataObj.loadWeight < 0.1 || this.dataObj.loadWeight > 100 || (
  732. String(this.dataObj.loadWeight).indexOf('.') != -1 && String(tthis.dataObj.loadWeight).length -
  733. (String(this.dataObj.loadWeight).indexOf(
  734. '.') + 1) > 3)
  735. ) {
  736. uni.showToast({
  737. title: '载量输入错误!',
  738. duration: 2000,
  739. icon: "none",
  740. });
  741. return true
  742. }
  743. }
  744. if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (Number(this.dataObj.loadWeightSmall) >
  745. Number(this.dataObj
  746. .loadWeight))) {
  747. uni.showToast({
  748. title: '最小载重应小于最大载重!',
  749. duration: 2000,
  750. icon: "none",
  751. });
  752. return true
  753. }
  754. },
  755. confirmClick() {
  756. uni.$u.throttle(this.requestdata, 500)
  757. },
  758. requestdata(){
  759. console.log(this.dataObj)
  760. // // #ifdef APP-PLUS
  761. // if (this.alertTitle == '账号审核中') {
  762. // if (uni.getSystemInfoSync().platform == 'ios') {
  763. // plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  764. // } else if (uni.getSystemInfoSync().platform == 'android') {
  765. // plus.runtime.quit();
  766. // }
  767. // return
  768. // }
  769. // // #endif
  770. // if (this.alertTitle == '身份信息未认证,去认证?') {
  771. // uni.switchTab({
  772. // url: '/pages/mine/index'
  773. // })
  774. // return
  775. // }
  776. // this.isShowAlert = false
  777. if (this.dataDetails.type == '元/吨') {
  778. this.dataObj.billingMethod = 0
  779. } else {
  780. this.dataObj.billingMethod = 1
  781. }
  782. if (this.dataObj.freightAdvance) {
  783. this.dataObj.freightAdvance = 1
  784. } else {
  785. this.dataObj.freightAdvance = 0
  786. }
  787. if(!this.dataObj.receiverIdcard){
  788. this.dataObj.receiverIdcard=''
  789. }
  790. if(!this.dataObj.receiverCreditCode){
  791. this.dataObj.receiverCreditCode=''
  792. }
  793. let _list = []
  794. for (let i = 0; i < this.checkboxValue1.length; i++) {
  795. if (this.checkboxValue1[i] == '不限') {
  796. _list.push(1)
  797. } else if (this.checkboxValue1[i] == '高栏') {
  798. _list.push(2)
  799. } else if (this.checkboxValue1[i] == '集装箱') {
  800. _list.push(3)
  801. } else if (this.checkboxValue1[i] == '自卸车') {
  802. _list.push(4)
  803. }
  804. }
  805. this.dataObj.carModel = _list.toString()
  806. this.dataObj.commonId = this.userInfo.id
  807. this.$request.baseRequest('post', '/publishTaskInfo/api/addTask', this.dataObj).then(res => {
  808. uni.removeStorage({
  809. key: 'storage_saddress'
  810. });
  811. uni.removeStorage({
  812. key: 'storage_faddress'
  813. });
  814. uni.removeStorage({
  815. key: 'releaseCargoOwner'
  816. });
  817. uni.removeStorage({
  818. key: 'releasecompId'
  819. });
  820. this.$refs.uToast.show({
  821. type: 'success',
  822. message: "发布成功",
  823. complete() {
  824. _this.dataObj = {
  825. commonId: '',
  826. cargoOwner: '',
  827. sendPrivate: '',
  828. sendCity: '',
  829. sendArea: '',
  830. sendDetailedAddress: '',
  831. unloadPrivate: '',
  832. unloadCity: '',
  833. unloadArea: '',
  834. unloadDetailedAddress: '',
  835. distance: '',
  836. goodsName: '',
  837. billingMethod: '元/吨',
  838. freightPrice: '',
  839. freightAdvance: true,
  840. sender: '',
  841. senderPhone: '',
  842. receiver: '',
  843. receiverPhone: '',
  844. weight: '',
  845. loadingDateStart: '',
  846. loadingDateEnd: '',
  847. carLengthSmall: '',
  848. carLength: '',
  849. loadWeightSmall: '',
  850. loadWeight: '',
  851. carModel: '',
  852. taskDescription: '',
  853. taskValidity: '',
  854. sendLongitude: '',
  855. receiverIdcard:'',
  856. sendLatitude: '',
  857. receiverCreditCode:'',
  858. unsendLongitude: '',
  859. unsendLatitude: '',
  860. }
  861. _this.checkboxValue1 = ['不限']
  862. // uni.$u.route("/pages/release/record")
  863. }
  864. })
  865. this.isShowAlert = false
  866. })
  867. .catch(res => {
  868. uni.showToast({
  869. title: res.message,
  870. icon: 'none',
  871. duration: 2000
  872. })
  873. });
  874. },
  875. cancelClick() {
  876. this.isShowAlert = false
  877. },
  878. //获取默认发货地、收货地
  879. getDefaultPlace(type) {
  880. // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
  881. uni.showLoading({
  882. mask: true,
  883. title: '加载中...'
  884. })
  885. this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
  886. commonId: this.userInfo.id
  887. }).then(res => {
  888. uni.hideLoading()
  889. for (let i = 0; i < res.data.length; i++) {
  890. if (res.data[i].defaultShipment == 1 && type == 0) {
  891. this.dataObj.sendCity = res.data[i].city
  892. this.dataObj.sendArea = res.data[i].area
  893. this.dataObj.sendPrivate = res.data[i].province
  894. this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
  895. this.dataObj.sendLongitude = res.data[i].longitude
  896. this.dataObj.sendLatitude = res.data[i].latitude
  897. this.dataObj.sender = res.data[i].contacts
  898. this.dataObj.senderPhone = res.data[i].contactPhone
  899. }
  900. if (res.data[i].defaultReceipt == 1 && type == 1) {
  901. this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
  902. this.dataObj.unloadCity = res.data[i].city
  903. this.dataObj.unloadArea = res.data[i].area
  904. this.dataObj.unloadPrivate = res.data[i].province
  905. this.dataObj.unsendLongitude = res.data[i].longitude
  906. this.dataObj.unsendLatitude = res.data[i].latitude
  907. this.dataObj.receiver = res.data[i].contacts
  908. this.dataObj.receiverPhone = res.data[i].contactPhone
  909. }
  910. }
  911. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
  912. this.dataObj.unsendLongitude) {
  913. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  914. .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  915. }
  916. })
  917. .catch(res => {
  918. uni.hideLoading()
  919. uni.showToast({
  920. title: res.message,
  921. icon: 'none',
  922. duration: 2000
  923. })
  924. });
  925. },
  926. changeHandler(e) {
  927. const {
  928. columnIndex,
  929. value,
  930. values,
  931. index,
  932. picker = this.$refs.uPicker
  933. } = e
  934. // if (columnIndex === 0) {
  935. //
  936. // if (e.index != 0) {
  937. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  938. // }
  939. // } else if (columnIndex === 1) {
  940. // if (e.index != 0) {
  941. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  942. // }
  943. // }
  944. },
  945. selectCargoOwnerClose() {
  946. this.show = false
  947. },
  948. confirmSelectCargoOwner(e) {
  949. this.dataObj.cargoOwner = e.value[0]
  950. for (let i = 0; i < this.qyList.length; i++) {
  951. let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  952. if (_name == e.value[0]) {
  953. if(e.value[0]!='个人货主'){
  954. this.freightAdvance=true
  955. if(this.qyList[i].compStatus=='ss'){
  956. this.dataObj.compId=this.qyList[i].compId
  957. }else{
  958. this.dataObj.compId=this.qyList[i].id
  959. }
  960. // console.log(this.qyList[i].compStatus,this.dataObj.compId)
  961. uni.setStorageSync('releasecompId', this.dataObj.compId)
  962. }else{
  963. this.freightAdvance=false
  964. }
  965. this.freightAdvance= this.qyList[i].advanceFreightService == 1 ? true : false
  966. this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  967. }
  968. }
  969. uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  970. this.show = false
  971. },
  972. selectCargoOwner() {
  973. this.show = true
  974. },
  975. selectAddress(type) {
  976. // uni.removeStorage({
  977. // key: 'storage_faddress'
  978. // });
  979. // uni.removeStorage({
  980. // key: 'storage_saddress'
  981. // });
  982. uni.$u.route('/pages/release/selectAddress', {
  983. type: type,
  984. });
  985. },
  986. checkboxChange(n) {
  987. if (n.length > 1 && n.length < 4 && n.includes('不限')) {
  988. n.shift(0)
  989. } else if (n.length == 4) {
  990. this.checkboxValue1 = n.splice(1, 4)
  991. }
  992. },
  993. selectValidityPeriodcq() {
  994. this.$refs.dateEl.show();
  995. },
  996. confirmValidityPeriod(date) {
  997. switch (this.ValidityPeriodType) {
  998. case 0:
  999. this.dataObj.loadingDateStart = date.date
  1000. break
  1001. case 1:
  1002. this.dataObj.loadingDateEnd =date.date
  1003. break
  1004. }
  1005. },
  1006. getTime: function() {
  1007. var date = new Date().getTime()
  1008. year = date.getFullYear(),
  1009. month = date.getMonth() + 1,
  1010. day = date.getDate(),
  1011. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  1012. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  1013. var timer = year + '-' + month + '-' + day
  1014. return timer;
  1015. },
  1016. confirmValidityPeriodcq(date) {
  1017. this.dataObj.taskValidity=date.date
  1018. },
  1019. selectValidityPeriod(type) {
  1020. this.ValidityPeriodType = type
  1021. this.$refs.datezc.show()
  1022. // this.isShowValidity = true
  1023. },
  1024. change(e) {
  1025. console.log('change', e);
  1026. },
  1027. back() {
  1028. uni.navigateBack({
  1029. delta: 1
  1030. })
  1031. },
  1032. goToRecord() {
  1033. uni.$u.route('/pages/release/record');
  1034. },
  1035. radioChange(n) {
  1036. console.log(n)
  1037. this.dataDetails.type = n
  1038. },
  1039. submit() {
  1040. if (this.validate()) return
  1041. if (this.dataObj.cargoOwner == '个人货主') {
  1042. this.dataObj.compId = ""
  1043. this.dataObj.freightAdvance = 0
  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>