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="11" 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 type="number" maxlength="11" 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. //代理货主
  419. let _dlhz = res.data.cargoOwnerCompInfoList
  420. if (!_dlhz) _dlhz = []
  421. for (let i = 0; i < _self.length; i++) {
  422. if (_self[i].status == '已认证') {
  423. this.qyList.push(_self[i])
  424. }
  425. }
  426. for (let i = 0; i < _dlhz.length; i++) {
  427. if (_dlhz[i].status == '已认证') {
  428. this.qyList.push(_dlhz[i])
  429. }
  430. }
  431. // this.columns: [
  432. // ['个人货主', '黑龙江中天昊元贸易有限公司', '黑龙江利润元贸易有限公司']
  433. // ],
  434. for (let i = 0; i < this.qyList.length; i++) {
  435. this.columns[0].push(this.qyList[i].company ? this.qyList[i].company : this.qyList[i]
  436. .companyName)
  437. }
  438. console.log('1111', _this.columns)
  439. })
  440. .catch(res => {
  441. uni.showToast({
  442. title: res.message,
  443. icon: 'none',
  444. duration: 2000
  445. })
  446. });
  447. },
  448. validate() {
  449. if (uni.$u.test.isEmpty(this.dataObj.cargoOwner)) {
  450. this.$refs.uToast.show({
  451. type: 'error',
  452. message: "货主不能为空!",
  453. })
  454. return true
  455. }
  456. if (uni.$u.test.isEmpty(this.dataObj.sendArea)) {
  457. this.$refs.uToast.show({
  458. type: 'error',
  459. message: "发货地区不能为空!",
  460. })
  461. return true
  462. }
  463. if (uni.$u.test.isEmpty(this.dataObj.unloadArea)) {
  464. this.$refs.uToast.show({
  465. type: 'error',
  466. message: "收货地区不能为空!",
  467. })
  468. return true
  469. }
  470. if (uni.$u.test.isEmpty(this.dataObj.goodsName)) {
  471. this.$refs.uToast.show({
  472. type: 'error',
  473. message: "货名不能为空!",
  474. })
  475. return true
  476. }
  477. if (uni.$u.test.isEmpty(this.dataObj.receiver)) {
  478. this.$refs.uToast.show({
  479. type: 'error',
  480. message: "收货联系人不能为空!",
  481. })
  482. return true
  483. }
  484. if (uni.$u.test.isEmpty(this.dataObj.receiverPhone)) {
  485. this.$refs.uToast.show({
  486. type: 'error',
  487. message: "收货联系人电话不能为空!",
  488. })
  489. return true
  490. }
  491. if (uni.$u.test.isEmpty(this.dataObj.receiverIdcard)) {
  492. this.$refs.uToast.show({
  493. type: 'error',
  494. message: "收货人身份证不能为空!",
  495. })
  496. return true
  497. }
  498. if (uni.$u.test.isEmpty(this.dataObj.freightPrice)) {
  499. this.$refs.uToast.show({
  500. type: 'error',
  501. message: "运费单价不能为空!",
  502. })
  503. return true
  504. }
  505. if (
  506. this.dataObj.freightPrice < 0 || this.dataObj.freightPrice > 100000 || (
  507. String(this.dataObj.freightPrice).indexOf('.') != -1 && String(tthis.dataObj.freightPrice).length -
  508. (String(this.dataObj.freightPrice).indexOf(
  509. '.') + 1) > 2)
  510. ) {
  511. uni.showToast({
  512. title: '运费单价输入错误!',
  513. duration: 2000,
  514. icon: "none",
  515. });
  516. return true
  517. }
  518. if (this.dataObj.weight) {
  519. if (
  520. this.dataObj.weight < 0.1 || this.dataObj.weight > 10000000 || (
  521. String(this.dataObj.weight).indexOf('.') != -1 && String(tthis.dataObj.weight).length -
  522. (String(this.dataObj.weight).indexOf(
  523. '.') + 1) > 2)
  524. ) {
  525. uni.showToast({
  526. title: '重量输入错误!',
  527. duration: 2000,
  528. icon: "none",
  529. });
  530. return true
  531. }
  532. }
  533. if (this.dataObj.carLengthSmall) {
  534. if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
  535. uni.showToast({
  536. title: '最小车长输入错误!',
  537. duration: 2000,
  538. icon: "none",
  539. });
  540. return
  541. }
  542. }
  543. if (this.dataObj.carLength) {
  544. if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
  545. uni.showToast({
  546. title: '最大车长输入错误!',
  547. duration: 2000,
  548. icon: "none",
  549. });
  550. return true
  551. }
  552. }
  553. if (this.dataObj.carLengthSmall && this.dataObj.carLength && (this.dataObj.carLengthSmall > this.dataObj
  554. .carLength)) {
  555. uni.showToast({
  556. title: '最小车长应小于最大车长!',
  557. duration: 2000,
  558. icon: "none",
  559. });
  560. return true
  561. }
  562. if (this.dataObj.loadWeightSmall) {
  563. if (
  564. this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
  565. String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(tthis.dataObj
  566. .loadWeightSmall).length -
  567. (String(this.dataObj.loadWeightSmall).indexOf(
  568. '.') + 1) > 3)
  569. ) {
  570. uni.showToast({
  571. title: '载量输入错误!',
  572. duration: 2000,
  573. icon: "none",
  574. });
  575. return true
  576. }
  577. }
  578. if (this.dataObj.loadWeight) {
  579. if (
  580. this.dataObj.loadWeight < 0.1 || this.dataObj.loadWeight > 100 || (
  581. String(this.dataObj.loadWeight).indexOf('.') != -1 && String(tthis.dataObj.loadWeight).length -
  582. (String(this.dataObj.loadWeight).indexOf(
  583. '.') + 1) > 3)
  584. ) {
  585. uni.showToast({
  586. title: '载量输入错误!',
  587. duration: 2000,
  588. icon: "none",
  589. });
  590. return true
  591. }
  592. }
  593. if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (this.dataObj.loadWeightSmall > this.dataObj
  594. .loadWeight)) {
  595. uni.showToast({
  596. title: '最小载重应小于最大载重!',
  597. duration: 2000,
  598. icon: "none",
  599. });
  600. return true
  601. }
  602. },
  603. confirmClick() {
  604. // #ifdef APP-PLUS
  605. if (this.alertTitle == '账号审核中') {
  606. if (uni.getSystemInfoSync().platform == 'ios') {
  607. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  608. } else if (uni.getSystemInfoSync().platform == 'android') {
  609. plus.runtime.quit();
  610. }
  611. return
  612. }
  613. // #endif
  614. this.isShowAlert = false
  615. if (this.dataObj.billingMethod == '元/吨') {
  616. this.dataObj.billingMethod = 0
  617. } else {
  618. this.dataObj.billingMethod = 1
  619. }
  620. if (this.dataObj.freightAdvance) {
  621. this.dataObj.freightAdvance = 1
  622. } else {
  623. this.dataObj.freightAdvance = 0
  624. }
  625. let _list = []
  626. for (let i = 0; i < this.checkboxValue1.length; i++) {
  627. if (this.checkboxValue1[i] == '不限') {
  628. _list.push(1)
  629. } else if (this.checkboxValue1[i] == '高栏') {
  630. _list.push(2)
  631. } else if (this.checkboxValue1[i] == '集装箱') {
  632. _list.push(3)
  633. } else if (this.checkboxValue1[i] == '自卸车') {
  634. _list.push(4)
  635. }
  636. }
  637. this.dataObj.carModel = _list.toString()
  638. this.dataObj.commonId = this.userInfo.id
  639. this.$request.baseRequest('post', '/publishTaskInfo/api/addTask', this.dataObj).then(res => {
  640. this.$refs.uToast.show({
  641. type: 'success',
  642. message: "发布成功",
  643. complete() {
  644. _this.dataObj = {
  645. commonId: '',
  646. cargoOwner: '',
  647. sendPrivate: '',
  648. sendCity: '',
  649. sendArea: '',
  650. sendDetailedAddress: '',
  651. unloadPrivate: '',
  652. unloadCity: '',
  653. unloadArea: '',
  654. unloadDetailedAddress: '',
  655. distance: '',
  656. goodsName: '',
  657. billingMethod: '元/吨',
  658. freightPrice: '',
  659. freightAdvance: true,
  660. sender: '',
  661. senderPhone: '',
  662. receiver: '',
  663. receiverPhone: '',
  664. weight: '',
  665. loadingDateStart: '',
  666. loadingDateEnd: '',
  667. carLengthSmall: '',
  668. carLength: '',
  669. loadWeightSmall: '',
  670. loadWeight: '',
  671. carModel: '',
  672. taskDescription: '',
  673. taskValidity: '',
  674. sendLongitude: '',
  675. sendLatitude: '',
  676. unsendLongitude: '',
  677. unsendLatitude: '',
  678. }
  679. _this.checkboxValue1 = ['不限']
  680. }
  681. })
  682. })
  683. .catch(res => {
  684. uni.showToast({
  685. title: res.message,
  686. icon: 'none',
  687. duration: 2000
  688. })
  689. });
  690. },
  691. cancelClick() {
  692. this.isShowAlert = false
  693. },
  694. //获取默认发货地、收货地
  695. getDefaultPlace(type) {
  696. // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
  697. uni.showLoading({
  698. mask: true,
  699. title: '加载中...'
  700. })
  701. this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
  702. commonId: this.userInfo.id
  703. }).then(res => {
  704. for (let i = 0; i < res.data.length; i++) {
  705. if (res.data[i].defaultShipment == 1 && type == 0) {
  706. this.dataObj.sendCity = res.data[i].city
  707. this.dataObj.sendArea = res.data[i].area
  708. this.dataObj.sendPrivate = res.data[i].province
  709. this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
  710. this.dataObj.sendLongitude = res.data[i].longitude
  711. this.dataObj.sendLatitude = res.data[i].latitude
  712. this.dataObj.sender = res.data[i].contacts
  713. this.dataObj.senderPhone = res.data[i].contactPhone
  714. }
  715. if (res.data[i].defaultReceipt == 1 && type == 1) {
  716. this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
  717. this.dataObj.unloadCity = res.data[i].city
  718. this.dataObj.unloadArea = res.data[i].area
  719. this.dataObj.unloadPrivate = res.data[i].province
  720. this.dataObj.unsendLongitude = res.data[i].longitude
  721. this.dataObj.unsendLatitude = res.data[i].latitude
  722. this.dataObj.receiver = res.data[i].contacts
  723. this.dataObj.receiverPhone = res.data[i].contactPhone
  724. }
  725. }
  726. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
  727. this.dataObj.unsendLongitude) {
  728. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  729. .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  730. }
  731. uni.hideLoading()
  732. })
  733. .catch(res => {
  734. uni.showToast({
  735. title: res.message,
  736. icon: 'none',
  737. duration: 2000
  738. })
  739. });
  740. },
  741. changeHandler(e) {
  742. const {
  743. columnIndex,
  744. value,
  745. values,
  746. index,
  747. picker = this.$refs.uPicker
  748. } = e
  749. // if (columnIndex === 0) {
  750. //
  751. // if (e.index != 0) {
  752. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  753. // }
  754. // } else if (columnIndex === 1) {
  755. // if (e.index != 0) {
  756. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  757. // }
  758. // }
  759. },
  760. selectCargoOwnerClose() {
  761. this.show = false
  762. },
  763. confirmSelectCargoOwner(e) {
  764. this.dataObj.cargoOwner = e.value[0]
  765. for (let i = 0; i < this.qyList.length; i++) {
  766. let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  767. if (_name == e.value[0]) {
  768. this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  769. }
  770. }
  771. uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  772. this.show = false
  773. },
  774. selectCargoOwner() {
  775. this.show = true
  776. },
  777. selectAddress(type) {
  778. // uni.removeStorage({
  779. // key: 'storage_faddress'
  780. // });
  781. uni.removeStorage({
  782. key: 'storage_saddress'
  783. });
  784. uni.$u.route('/pages/release/selectAddress', {
  785. type: type,
  786. });
  787. },
  788. checkboxChange(n) {
  789. console.log('change', n);
  790. if (n.length > 1 && n.length < 4 && n.includes('不限')) {
  791. n.shift(0)
  792. } else if (n.length == 4) {
  793. this.checkboxValue1 = n.splice(1, 4)
  794. }
  795. },
  796. selectValidityPeriodcq() {
  797. this.isShowcardValidity = true
  798. },
  799. confirmValidityPeriod(e) {
  800. console.log('confirm', e)
  801. if (e.value[0] == '随时') {
  802. switch (this.ValidityPeriodType) {
  803. case 0:
  804. this.dataObj.loadingDateStart = e.value[0]
  805. break
  806. case 1:
  807. this.dataObj.loadingDateEnd = e.value[0]
  808. break
  809. }
  810. } else {
  811. if (!e.value[1] || !e.value[2]) {
  812. this.$refs.uToast.show({
  813. type: 'error',
  814. message: "日期格式错误,请重新选择!",
  815. })
  816. return
  817. }
  818. switch (this.ValidityPeriodType) {
  819. case 0:
  820. this.dataObj.loadingDateStart = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  821. break
  822. case 1:
  823. this.dataObj.loadingDateEnd = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  824. break
  825. }
  826. }
  827. this.isShowValidity = false
  828. },
  829. confirmValidityPeriodcq(e) {
  830. console.log('confirm', e)
  831. if (e.value[0] == '长期') {
  832. this.dataObj.taskValidity = e.value[0]
  833. } else {
  834. if (!e.value[1] || !e.value[2]) {
  835. this.$refs.uToast.show({
  836. type: 'error',
  837. message: "日期格式错误,请重新选择!",
  838. })
  839. return
  840. }
  841. this.dataObj.taskValidity = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  842. }
  843. this.isShowcardValidity = false
  844. },
  845. selectValidityPeriod(type) {
  846. this.ValidityPeriodType = type
  847. this.isShowValidity = true
  848. },
  849. change(e) {
  850. console.log('change', e);
  851. },
  852. back() {
  853. uni.navigateBack()
  854. },
  855. goToRecord() {
  856. uni.$u.route('/pages/release/record');
  857. },
  858. radioChange(n) {
  859. console.log('radioChange', n);
  860. this.dataDetails.type = n
  861. },
  862. submit() {
  863. if (this.validate()) return
  864. this.isShowAlert = true;
  865. },
  866. }
  867. }
  868. </script>
  869. <style scoped lang="scss">
  870. .input {
  871. text-align: right;
  872. }
  873. .title {
  874. padding: 0 20rpx;
  875. display: flex;
  876. justify-content: center;
  877. position: relative;
  878. .nav-title {
  879. font-size: 32rpx;
  880. }
  881. .back {
  882. position: absolute;
  883. left: 20rpx;
  884. }
  885. .search {
  886. display: flex;
  887. align-items: center;
  888. position: absolute;
  889. right: 20rpx;
  890. }
  891. }
  892. .fixed1 {
  893. height: var(--status-bar-height);
  894. }
  895. .row {
  896. display: flex;
  897. justify-content: space-between;
  898. }
  899. .content1 {
  900. background: white;
  901. margin: 40rpx 20rpx 0 20rpx;
  902. border-radius: 20rpx;
  903. padding: 40rpx;
  904. .select-sf {
  905. color: #999999;
  906. }
  907. .right {
  908. color: #CBCBCB
  909. }
  910. }
  911. .content2,
  912. .content3,
  913. .content5 {
  914. box-sizing: border-box;
  915. background: white;
  916. border-radius: 20rpx;
  917. padding: 20rpx;
  918. margin: 20rpx;
  919. .row {
  920. margin: 30rpx;
  921. }
  922. .row1,
  923. .row2 {
  924. display: flex;
  925. justify-content: space-between;
  926. align-items: center;
  927. .left .top {
  928. display: flex;
  929. }
  930. }
  931. }
  932. .select-type {
  933. display: flex;
  934. justify-content: flex-end;
  935. }
  936. .top-title {
  937. background: #fff;
  938. padding: 20rpx;
  939. position: fixed;
  940. z-index: 100;
  941. top: 0;
  942. box-sizing: border-box;
  943. width: 100%;
  944. }
  945. .content2 {
  946. padding: 40rpx;
  947. .row1,
  948. .row2 {
  949. .left {
  950. width: 100%;
  951. }
  952. .right {
  953. color: #CBCBCB
  954. }
  955. }
  956. .row2 {
  957. margin-top: 40rpx;
  958. }
  959. .top {
  960. display: flex;
  961. align-items: center;
  962. }
  963. .bottom {
  964. margin-top: 10rpx;
  965. padding-left: 72rpx;
  966. }
  967. .title {
  968. font-size: 36rpx;
  969. font-weight: 700;
  970. color: #171717;
  971. }
  972. .collect {
  973. width: 40rpx;
  974. height: 40rpx;
  975. line-height: 40rpx;
  976. background: #2772FB;
  977. color: white;
  978. padding: 6rpx;
  979. border-radius: 50%;
  980. text-align: center;
  981. }
  982. .send {
  983. width: 40rpx;
  984. height: 40rpx;
  985. line-height: 40rpx;
  986. background: #101010;
  987. color: white;
  988. padding: 6rpx;
  989. border-radius: 50%;
  990. text-align: center;
  991. }
  992. }
  993. .content3 {}
  994. .content4 {
  995. margin: 20rpx;
  996. padding-left: 20rpx;
  997. .title {
  998. color: #999999;
  999. }
  1000. .btn-text {
  1001. color: #2772FB;
  1002. border: 1px solid #2772FB;
  1003. border-radius: 40rpx;
  1004. padding: 0rpx 10rpx;
  1005. box-sizing: border-box;
  1006. }
  1007. }
  1008. .submit {
  1009. width: 90%;
  1010. margin: 100rpx auto;
  1011. font-size: 36rpx;
  1012. font-weight: 500;
  1013. color: #FFFFFF;
  1014. background: #2772FB;
  1015. text-align: center;
  1016. padding: 20rpx 0;
  1017. border-radius: 50rpx;
  1018. }
  1019. .select-data {
  1020. color: #999999;
  1021. }
  1022. .row-bgc {
  1023. background: #F7F8FA;
  1024. padding: 20rpx 30rpx;
  1025. box-sizing: border-box;
  1026. border-radius: 10rpx;
  1027. }
  1028. .car-input {
  1029. // padding:20rpx;
  1030. // box-sizing: border-box;
  1031. // border-radius: 10px;
  1032. }
  1033. .car-line {
  1034. margin: 0 20rpx;
  1035. }
  1036. .car-row {
  1037. display: flex;
  1038. background: white;
  1039. padding: 20rpx;
  1040. box-sizing: border-box;
  1041. border-radius: 10rpx;
  1042. }
  1043. </style>