editRelease.vue 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  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="dataObj.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. </view>
  213. <view class="submit" @click="submit">立即发布</view>
  214. <u-picker :show="isShowValidity" ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
  215. :closeOnClickOverlay='true' @close='isShowValidity=false' @cancel='isShowValidity=false'>
  216. </u-picker>
  217. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  218. :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  219. @cancel="cancelClick"></u-modal>
  220. <u-toast ref="uToast"></u-toast>
  221. </view>
  222. </template>
  223. <script>
  224. var _this;
  225. import {
  226. mapState
  227. } from 'vuex';
  228. export default {
  229. data() {
  230. return {
  231. qyList: [],
  232. isShowAlert: false,
  233. alertTitle: '确定发布运输任务?',
  234. alertContent: null,
  235. radioCustomStyle: {
  236. margin: '0 0 0 20rpx'
  237. },
  238. show: false,
  239. columns: [
  240. []
  241. ],
  242. dataObj: {
  243. commonId: '',
  244. cargoOwner: '',
  245. sendPrivate: '',
  246. sendCity: '',
  247. sendArea: '',
  248. sendDetailedAddress: '',
  249. unloadPrivate: '',
  250. unloadCity: '',
  251. unloadArea: '',
  252. unloadDetailedAddress: '',
  253. distance: '',
  254. goodsName: '',
  255. billingMethod: '元/吨',
  256. freightPrice: '',
  257. freightAdvance: true,
  258. sender: '',
  259. senderPhone: '',
  260. receiver: '',
  261. receiverPhone: '',
  262. weight: '',
  263. loadingDateStart: '',
  264. loadingDateEnd: '',
  265. carLengthSmall: '',
  266. carLength: '',
  267. loadWeightSmall: '',
  268. loadWeight: '',
  269. carModel: '',
  270. taskDescription: '',
  271. taskValidity: '',
  272. sendLongitude: '',
  273. sendLatitude: '',
  274. unsendLongitude: '',
  275. unsendLatitude: '',
  276. },
  277. checkboxValue1: [],
  278. checkboxList1: [{
  279. name: '不限',
  280. disabled: false
  281. },
  282. {
  283. name: '高栏',
  284. disabled: false
  285. },
  286. {
  287. name: '集装箱',
  288. disabled: false
  289. },
  290. {
  291. name: '自卸车',
  292. disabled: false
  293. }
  294. ],
  295. value: true,
  296. isShowcardValidity: false,
  297. ValidityPeriodType: '',
  298. validityPeriod: [],
  299. validityPeriodcq: [],
  300. isShowValidity: false,
  301. dataDetails: {
  302. type: '元/车'
  303. },
  304. radiolist1: [{
  305. name: '元/吨',
  306. disabled: false
  307. },
  308. {
  309. name: '元/车',
  310. disabled: false
  311. },
  312. ],
  313. }
  314. },
  315. onShow() {
  316. this.getSFList()
  317. let _faddress = uni.getStorageSync('storage_faddress');
  318. let _saddress = uni.getStorageSync('storage_saddress');
  319. if (_faddress) {
  320. this.dataObj.sendCity = _faddress.city
  321. this.dataObj.sendArea = _faddress.area
  322. this.dataObj.sendPrivate = _faddress.province
  323. this.dataObj.sendDetailedAddress = _faddress.detailedAddress
  324. this.dataObj.sendLongitude = _faddress.longitude
  325. this.dataObj.sendLatitude = _faddress.latitude
  326. this.dataObj.senderPhone = _faddress.contactPhone
  327. this.dataObj.sender = _faddress.contacts
  328. }
  329. if (_saddress) {
  330. this.dataObj.unloadDetailedAddress = _saddress.detailedAddress
  331. this.dataObj.unloadCity = _saddress.city
  332. this.dataObj.unloadArea = _saddress.area
  333. this.dataObj.unloadPrivate = _saddress.province
  334. this.dataObj.unsendLongitude = _saddress.longitude
  335. this.dataObj.unsendLatitude = _saddress.latitude
  336. this.dataObj.receiver = _saddress.contacts
  337. this.dataObj.receiverPhone = _saddress.contactPhone
  338. }
  339. },
  340. onLoad(options) {
  341. _this = this;
  342. _this = this;
  343. this.dataObj = options
  344. if (this.dataObj.billingMethod == 1) {
  345. this.dataObj.billingMethod = '元/车'
  346. } else {
  347. this.dataObj.billingMethod = '元/吨'
  348. }
  349. for (let i = 0; i < this.dataObj.carModel.length; i++) {
  350. if (this.dataObj.carModel[i] == '1') {
  351. this.checkboxValue1.push('不限')
  352. } else if (this.dataObj.carModel[i] == '2') {
  353. this.checkboxValue1.push('高栏')
  354. } else if (this.dataObj.carModel[i] == '3') {
  355. this.checkboxValue1.push('集装箱')
  356. } else if (this.dataObj.carModel[i] == '4') {
  357. this.checkboxValue1.push('自卸车')
  358. }
  359. }
  360. if (this.dataObj.freightAdvance) {
  361. this.dataObj.freightAdvance = true
  362. } else {
  363. this.dataObj.freightAdvance = false
  364. }
  365. console.log(this.dataObj)
  366. this.validityPeriod = this.$helper.makeValidityPeriod(0, '随时')
  367. this.validityPeriodcq = this.$helper.makeValidityPeriod(0, '随时')
  368. },
  369. computed: {
  370. ...mapState(['hasLogin', 'userInfo']),
  371. },
  372. methods: {
  373. goodstypeChange(){
  374. this.isGoodsType = true
  375. },
  376. goodsSubmit(e){
  377. this.dataObj.goodsType = e.value[0].constValue
  378. this.dataObj.goodsTypeKey = e.value[0].constKey
  379. let _obj={
  380. name:e.value[0].constValue,
  381. key:e.value[0].constKey
  382. }
  383. uni.setStorageSync("goodsType",_obj)
  384. this.isGoodsType = false
  385. },
  386. getSFList() {
  387. this.dataObj.commonId = this.userInfo.id
  388. this.$request.baseRequest('get', '/cargoOwnerCompInfo/cargoOwnerList', {
  389. commonId: this.userInfo.id
  390. }).then(res => {
  391. if (uni.getStorageSync('releaseCargoOwner')) {
  392. this.dataObj.cargoOwner = uni.getStorageSync('releaseCargoOwner')
  393. }
  394. // 可用企业货主
  395. this.qyList = []
  396. // 自己法人
  397. let _self = res.data.companyInfoList
  398. //代理货主
  399. let _dlhz = res.data.cargoOwnerCompInfoList
  400. if(_self){
  401. for (let i = 0; i < _self.length; i++) {
  402. if (_self[i].status == '已认证') {
  403. this.qyList.push(_self[i])
  404. }
  405. }
  406. }
  407. if(_dlhz){
  408. for (let i = 0; i < _dlhz.length; i++) {
  409. if (_dlhz[i].status == '已认证') {
  410. this.qyList.push(_dlhz[i])
  411. }
  412. }
  413. }
  414. let obj = uni.getStorageSync("firstAuthentication")
  415. if(obj && obj.authenticationStatus == '已认证'){
  416. this.columns[0].push("个人货主")
  417. }
  418. for (let i = 0; i < this.qyList.length; i++) {
  419. this.columns[0].push(this.qyList[i].company ? this.qyList[i].company : this.qyList[i]
  420. .companyName)
  421. }
  422. console.log('1111', _this.columns)
  423. })
  424. .catch(res => {
  425. uni.showToast({
  426. title: res.message,
  427. icon: 'none',
  428. duration: 2000
  429. })
  430. });
  431. },
  432. validate() {
  433. if (uni.$u.test.isEmpty(this.dataObj.cargoOwner)) {
  434. this.$refs.uToast.show({
  435. type: 'error',
  436. message: "货主不能为空!",
  437. })
  438. return true
  439. }
  440. if (uni.$u.test.isEmpty(this.dataObj.sendArea)) {
  441. this.$refs.uToast.show({
  442. type: 'error',
  443. message: "发货地区不能为空!",
  444. })
  445. return true
  446. }
  447. if (uni.$u.test.isEmpty(this.dataObj.unloadArea)) {
  448. this.$refs.uToast.show({
  449. type: 'error',
  450. message: "收货地区不能为空!",
  451. })
  452. return true
  453. }
  454. if (uni.$u.test.isEmpty(this.dataObj.goodsName)) {
  455. this.$refs.uToast.show({
  456. type: 'error',
  457. message: "货名不能为空!",
  458. })
  459. return true
  460. }
  461. if (uni.$u.test.isEmpty(this.dataObj.freightPrice)) {
  462. this.$refs.uToast.show({
  463. type: 'error',
  464. message: "运费单价不能为空!",
  465. })
  466. return true
  467. }
  468. if (
  469. this.dataObj.freightPrice < 0 || this.dataObj.freightPrice > 100000 || (
  470. String(this.dataObj.freightPrice).indexOf('.') != -1 && String(tthis.dataObj.freightPrice).length -
  471. (String(this.dataObj.freightPrice).indexOf(
  472. '.') + 1) > 2)
  473. ) {
  474. uni.showToast({
  475. title: '运费单价输入错误!',
  476. duration: 2000,
  477. icon: "none",
  478. });
  479. return true
  480. }
  481. if (this.dataObj.weight) {
  482. if (
  483. this.dataObj.weight < 0.1 || this.dataObj.weight > 10000000 || (
  484. String(this.dataObj.weight).indexOf('.') != -1 && String(tthis.dataObj.weight).length -
  485. (String(this.dataObj.weight).indexOf(
  486. '.') + 1) > 2)
  487. ) {
  488. uni.showToast({
  489. title: '重量输入错误!',
  490. duration: 2000,
  491. icon: "none",
  492. });
  493. return true
  494. }
  495. }
  496. if (this.dataObj.carLengthSmall) {
  497. if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
  498. uni.showToast({
  499. title: '最小车长输入错误!',
  500. duration: 2000,
  501. icon: "none",
  502. });
  503. return true
  504. }
  505. }
  506. if (this.dataObj.carLength) {
  507. if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
  508. uni.showToast({
  509. title: '最大车长输入错误!',
  510. duration: 2000,
  511. icon: "none",
  512. });
  513. return true
  514. }
  515. }
  516. if (this.dataObj.carLengthSmall && this.dataObj.carLength && (this.dataObj.carLengthSmall > this.dataObj
  517. .carLength)) {
  518. uni.showToast({
  519. title: '最小车长应小于最大车长!',
  520. duration: 2000,
  521. icon: "none",
  522. });
  523. return true
  524. }
  525. if (this.dataObj.loadWeightSmall) {
  526. if (
  527. this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
  528. String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(this.dataObj
  529. .loadWeightSmall).length -
  530. (String(this.dataObj.loadWeightSmall).indexOf(
  531. '.') + 1) > 3)
  532. ) {
  533. uni.showToast({
  534. title: '最小载重输入错误!',
  535. duration: 2000,
  536. icon: "none",
  537. });
  538. return true
  539. }
  540. }
  541. if (this.dataObj.loadWeight) {
  542. if (
  543. this.dataObj.loadWeight < 0.1 || this.dataObj.loadWeight > 100 || (
  544. String(this.dataObj.loadWeight).indexOf('.') != -1 && String(this.dataObj.loadWeight).length -
  545. (String(this.dataObj.loadWeight).indexOf(
  546. '.') + 1) > 3)
  547. ) {
  548. uni.showToast({
  549. title: '最大载重输入错误!',
  550. duration: 2000,
  551. icon: "none",
  552. });
  553. return true
  554. }
  555. }
  556. if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (Number(this.dataObj.loadWeightSmall)>Number(this.dataObj.loadWeight))) {
  557. uni.showToast({
  558. title: '最小载重应小于最大载重!',
  559. duration: 2000,
  560. icon: "none",
  561. });
  562. return true
  563. }
  564. },
  565. confirmClick() {
  566. this.isShowAlert = false
  567. if (this.validate()) return
  568. if (this.dataObj.billingMethod == '元/吨') {
  569. this.dataObj.billingMethod = 0
  570. } else {
  571. this.dataObj.billingMethod = 1
  572. }
  573. if (this.dataObj.freightAdvance) {
  574. this.dataObj.freightAdvance = 1
  575. } else {
  576. this.dataObj.freightAdvance = 0
  577. }
  578. let _list = []
  579. for (let i = 0; i < this.checkboxValue1.length; i++) {
  580. if (this.checkboxValue1[i] == '不限') {
  581. _list.push(1)
  582. } else if (this.checkboxValue1[i] == '高栏') {
  583. _list.push(2)
  584. } else if (this.checkboxValue1[i] == '集装箱') {
  585. _list.push(3)
  586. } else if (this.checkboxValue1[i] == '自卸车') {
  587. _list.push(4)
  588. }
  589. }
  590. this.dataObj.carModel = _list.toString()
  591. this.dataObj.commonId = this.userInfo.id
  592. this.$request.baseRequest('post', '/publishTaskInfo/api/editTask', this.dataObj).then(res => {
  593. this.$refs.uToast.show({
  594. type: 'success',
  595. message: "修改成功",
  596. complete() {
  597. uni.navigateBack({
  598. delta:1
  599. })
  600. _this.dataObj = {
  601. commonId: '',
  602. cargoOwner: '',
  603. sendPrivate: '',
  604. sendCity: '',
  605. sendArea: '',
  606. sendDetailedAddress: '',
  607. unloadPrivate: '',
  608. unloadCity: '',
  609. unloadArea: '',
  610. unloadDetailedAddress: '',
  611. distance: '',
  612. goodsName: '',
  613. billingMethod: '元/吨',
  614. freightPrice: '',
  615. freightAdvance: true,
  616. sender: '',
  617. senderPhone: '',
  618. receiver: '',
  619. receiverPhone: '',
  620. weight: '',
  621. loadingDateStart: '',
  622. loadingDateEnd: '',
  623. carLengthSmall: '',
  624. carLength: '',
  625. loadWeightSmall: '',
  626. loadWeight: '',
  627. carModel: '',
  628. taskDescription: '',
  629. taskValidity: '',
  630. sendLongitude: '',
  631. sendLatitude: '',
  632. unsendLongitude: '',
  633. unsendLatitude: '',
  634. }
  635. _this.checkboxValue1 = ['不限']
  636. }
  637. })
  638. })
  639. .catch(res => {
  640. uni.showToast({
  641. title: res.message,
  642. icon: 'none',
  643. duration: 2000
  644. })
  645. });
  646. },
  647. cancelClick() {
  648. this.isShowAlert = false
  649. },
  650. //获取默认发货地、收货地
  651. getDefaultPlace(type) {
  652. // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
  653. uni.showLoading({
  654. mask: true,
  655. title: '加载中...'
  656. })
  657. this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
  658. commonId: this.userInfo.id
  659. }).then(res => {
  660. for (let i = 0; i < res.data.length; i++) {
  661. if (res.data[i].defaultShipment == 1 && type == 0) {
  662. this.dataObj.sendCity = res.data[i].city
  663. this.dataObj.sendArea = res.data[i].area
  664. this.dataObj.sendPrivate = res.data[i].province
  665. this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
  666. this.dataObj.sendLongitude = res.data[i].longitude
  667. this.dataObj.sendLatitude = res.data[i].latitude
  668. }
  669. if (res.data[i].defaultReceipt == 1 && type == 1) {
  670. this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
  671. this.dataObj.unloadCity = res.data[i].city
  672. this.dataObj.unloadArea = res.data[i].area
  673. this.dataObj.unloadPrivate = res.data[i].province
  674. this.dataObj.unsendLongitude = res.data[i].longitude
  675. this.dataObj.unsendLatitude = res.data[i].latitude
  676. }
  677. }
  678. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
  679. this.dataObj.unsendLongitude) {
  680. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  681. .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  682. }
  683. uni.hideLoading()
  684. })
  685. .catch(res => {
  686. uni.showToast({
  687. title: res.message,
  688. icon: 'none',
  689. duration: 2000
  690. })
  691. });
  692. },
  693. changeHandler(e) {
  694. const {
  695. columnIndex,
  696. value,
  697. values,
  698. index,
  699. picker = this.$refs.uPicker
  700. } = e
  701. // if (columnIndex === 0) {
  702. //
  703. // if (e.index != 0) {
  704. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  705. // }
  706. // } else if (columnIndex === 1) {
  707. // if (e.index != 0) {
  708. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  709. // }
  710. // }
  711. },
  712. selectCargoOwnerClose() {
  713. this.show = false
  714. },
  715. confirmSelectCargoOwner(e) {
  716. this.dataObj.cargoOwner = e.value[0]
  717. for (let i = 0; i < this.qyList.length; i++) {
  718. let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  719. if (_name == e.value[0]) {
  720. this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  721. }
  722. }
  723. uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  724. this.show = false
  725. },
  726. selectCargoOwner() {
  727. this.show = true
  728. },
  729. selectAddress(type) {
  730. // uni.removeStorage({
  731. // key: 'storage_faddress'
  732. // });
  733. uni.removeStorage({
  734. key: 'storage_saddress'
  735. });
  736. uni.$u.route('/pages/release/selectAddress', {
  737. type: type,
  738. status:1
  739. });
  740. },
  741. checkboxChange(n) {
  742. console.log('change', n);
  743. if (n.length > 1 && n.length < 4 && n.includes('不限')) {
  744. n.shift(0)
  745. } else if (n.length == 4) {
  746. this.checkboxValue1 = n.splice(1, 4)
  747. }
  748. },
  749. selectValidityPeriodcq() {
  750. this.isShowcardValidity = true
  751. },
  752. confirmValidityPeriod(e) {
  753. console.log('confirm', e)
  754. if (e.value[0] == '随时') {
  755. switch (this.ValidityPeriodType) {
  756. case 0:
  757. this.dataObj.loadingDateStart = e.value[0]
  758. break
  759. case 1:
  760. this.dataObj.loadingDateEnd = e.value[0]
  761. break
  762. }
  763. } else {
  764. if (!e.value[1] || !e.value[2]) {
  765. this.$refs.uToast.show({
  766. type: 'error',
  767. message: "日期格式错误,请重新选择!",
  768. })
  769. return
  770. }
  771. switch (this.ValidityPeriodType) {
  772. case 0:
  773. this.dataObj.loadingDateStart = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  774. break
  775. case 1:
  776. this.dataObj.loadingDateEnd = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  777. break
  778. }
  779. }
  780. this.isShowValidity = false
  781. },
  782. confirmValidityPeriodcq(e) {
  783. console.log('confirm', e)
  784. if (e.value[0] == '长期') {
  785. this.dataObj.taskValidity = e.value[0]
  786. } else {
  787. if (!e.value[1] || !e.value[2]) {
  788. this.$refs.uToast.show({
  789. type: 'error',
  790. message: "日期格式错误,请重新选择!",
  791. })
  792. return
  793. }
  794. this.dataObj.taskValidity = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  795. }
  796. this.isShowcardValidity = false
  797. },
  798. selectValidityPeriod(type) {
  799. this.ValidityPeriodType = type
  800. this.isShowValidity = true
  801. },
  802. change(e) {
  803. console.log('change', e);
  804. },
  805. back() {
  806. uni.navigateBack()
  807. },
  808. goToRecord() {
  809. uni.$u.route('/pages/release/record');
  810. },
  811. radioChange(n) {
  812. console.log('radioChange', n);
  813. this.dataDetails.type = n
  814. },
  815. submit() {
  816. this.isShowAlert = true;
  817. },
  818. }
  819. }
  820. </script>
  821. <style scoped lang="scss">
  822. .input {
  823. text-align: right;
  824. }
  825. .title {
  826. padding: 0 20rpx;
  827. display: flex;
  828. justify-content: center;
  829. position: relative;
  830. .nav-title {
  831. font-size: 32rpx;
  832. }
  833. .back {
  834. position: absolute;
  835. left: 20rpx;
  836. }
  837. .search {
  838. display: flex;
  839. align-items: center;
  840. position: absolute;
  841. right: 20rpx;
  842. }
  843. }
  844. .fixed1 {
  845. height: var(--status-bar-height);
  846. }
  847. .row {
  848. display: flex;
  849. justify-content: space-between;
  850. }
  851. .content1 {
  852. background: white;
  853. margin: 20rpx 20rpx 0 20rpx;
  854. border-radius: 20rpx;
  855. padding: 40rpx;
  856. .select-sf {
  857. color: #999999;
  858. }
  859. .right {
  860. color: #CBCBCB
  861. }
  862. }
  863. .content2,
  864. .content3,
  865. .content5 {
  866. box-sizing: border-box;
  867. background: white;
  868. border-radius: 20rpx;
  869. padding: 20rpx;
  870. margin: 20rpx;
  871. .row {
  872. margin: 30rpx;
  873. }
  874. .row1,
  875. .row2 {
  876. display: flex;
  877. justify-content: space-between;
  878. align-items: center;
  879. .left .top {
  880. display: flex;
  881. }
  882. }
  883. }
  884. .select-type {
  885. display: flex;
  886. justify-content: flex-end;
  887. }
  888. .content2 {
  889. padding: 40rpx;
  890. .row1,
  891. .row2 {
  892. .left {
  893. width: 100%;
  894. }
  895. .right {
  896. color: #CBCBCB
  897. }
  898. }
  899. .row2 {
  900. margin-top: 40rpx;
  901. }
  902. .top {
  903. display: flex;
  904. align-items: center;
  905. }
  906. .bottom {
  907. margin-top: 10rpx;
  908. padding-left: 72rpx;
  909. }
  910. .title {
  911. font-size: 36rpx;
  912. font-weight: 700;
  913. color: #171717;
  914. }
  915. .collect {
  916. width: 40rpx;
  917. height: 40rpx;
  918. line-height: 40rpx;
  919. background: #2772FB;
  920. color: white;
  921. padding: 6rpx;
  922. border-radius: 50%;
  923. text-align: center;
  924. }
  925. .send {
  926. width: 40rpx;
  927. height: 40rpx;
  928. line-height: 40rpx;
  929. background: #101010;
  930. color: white;
  931. padding: 6rpx;
  932. border-radius: 50%;
  933. text-align: center;
  934. }
  935. }
  936. .content3 {}
  937. .content4 {
  938. margin: 20rpx;
  939. padding-left: 20rpx;
  940. .title {
  941. color: #999999;
  942. }
  943. .btn-text {
  944. color: #2772FB;
  945. border: 1px solid #2772FB;
  946. border-radius: 40rpx;
  947. padding: 0rpx 10rpx;
  948. box-sizing: border-box;
  949. }
  950. }
  951. .submit {
  952. width: 90%;
  953. margin: 100rpx auto;
  954. font-size: 36rpx;
  955. font-weight: 500;
  956. color: #FFFFFF;
  957. background: #2772FB;
  958. text-align: center;
  959. padding: 20rpx 0;
  960. border-radius: 50rpx;
  961. }
  962. .select-data {
  963. color: #999999;
  964. }
  965. .row-bgc {
  966. background: #F7F8FA;
  967. padding: 20rpx 30rpx;
  968. box-sizing: border-box;
  969. border-radius: 10rpx;
  970. }
  971. .car-input {
  972. // padding:20rpx;
  973. // box-sizing: border-box;
  974. // border-radius: 10px;
  975. }
  976. .car-line {
  977. margin: 0 20rpx;
  978. }
  979. .car-row {
  980. display: flex;
  981. background: white;
  982. padding: 20rpx;
  983. box-sizing: border-box;
  984. border-radius: 10rpx;
  985. }
  986. </style>