editRelease.vue 30 KB

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