release.vue 30 KB

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