editRelease.vue 27 KB

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