editRelease.vue 31 KB

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