editRelease.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  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. _this.dataObj = {
  569. commonId: '',
  570. cargoOwner: '',
  571. sendPrivate: '',
  572. sendCity: '',
  573. sendArea: '',
  574. sendDetailedAddress: '',
  575. unloadPrivate: '',
  576. unloadCity: '',
  577. unloadArea: '',
  578. unloadDetailedAddress: '',
  579. distance: '',
  580. goodsName: '',
  581. billingMethod: '元/吨',
  582. freightPrice: '',
  583. freightAdvance: true,
  584. sender: '',
  585. senderPhone: '',
  586. receiver: '',
  587. receiverPhone: '',
  588. weight: '',
  589. loadingDateStart: '',
  590. loadingDateEnd: '',
  591. carLengthSmall: '',
  592. carLength: '',
  593. loadWeightSmall: '',
  594. loadWeight: '',
  595. carModel: '',
  596. taskDescription: '',
  597. taskValidity: '',
  598. sendLongitude: '',
  599. sendLatitude: '',
  600. unsendLongitude: '',
  601. unsendLatitude: '',
  602. }
  603. _this.checkboxValue1 = ['不限']
  604. }
  605. })
  606. })
  607. .catch(res => {
  608. uni.showToast({
  609. title: res.message,
  610. icon: 'none',
  611. duration: 2000
  612. })
  613. });
  614. },
  615. cancelClick() {
  616. this.isShowAlert = false
  617. },
  618. //获取默认发货地、收货地
  619. getDefaultPlace(type) {
  620. // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
  621. uni.showLoading({
  622. mask: true,
  623. title: '加载中...'
  624. })
  625. this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
  626. commonId: this.userInfo.id
  627. }).then(res => {
  628. for (let i = 0; i < res.data.length; i++) {
  629. if (res.data[i].defaultShipment == 1 && type == 0) {
  630. this.dataObj.sendCity = res.data[i].city
  631. this.dataObj.sendArea = res.data[i].area
  632. this.dataObj.sendPrivate = res.data[i].province
  633. this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
  634. this.dataObj.sendLongitude = res.data[i].longitude
  635. this.dataObj.sendLatitude = res.data[i].latitude
  636. }
  637. if (res.data[i].defaultReceipt == 1 && type == 1) {
  638. this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
  639. this.dataObj.unloadCity = res.data[i].city
  640. this.dataObj.unloadArea = res.data[i].area
  641. this.dataObj.unloadPrivate = res.data[i].province
  642. this.dataObj.unsendLongitude = res.data[i].longitude
  643. this.dataObj.unsendLatitude = res.data[i].latitude
  644. }
  645. }
  646. if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
  647. this.dataObj.unsendLongitude) {
  648. this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
  649. .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
  650. }
  651. uni.hideLoading()
  652. })
  653. .catch(res => {
  654. uni.showToast({
  655. title: res.message,
  656. icon: 'none',
  657. duration: 2000
  658. })
  659. });
  660. },
  661. changeHandler(e) {
  662. const {
  663. columnIndex,
  664. value,
  665. values,
  666. index,
  667. picker = this.$refs.uPicker
  668. } = e
  669. // if (columnIndex === 0) {
  670. //
  671. // if (e.index != 0) {
  672. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  673. // }
  674. // } else if (columnIndex === 1) {
  675. // if (e.index != 0) {
  676. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  677. // }
  678. // }
  679. },
  680. selectCargoOwnerClose() {
  681. this.show = false
  682. },
  683. confirmSelectCargoOwner(e) {
  684. this.dataObj.cargoOwner = e.value[0]
  685. for (let i = 0; i < this.qyList.length; i++) {
  686. let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
  687. if (_name == e.value[0]) {
  688. this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
  689. }
  690. }
  691. uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
  692. this.show = false
  693. },
  694. selectCargoOwner() {
  695. this.show = true
  696. },
  697. selectAddress(type) {
  698. // uni.removeStorage({
  699. // key: 'storage_faddress'
  700. // });
  701. uni.removeStorage({
  702. key: 'storage_saddress'
  703. });
  704. uni.$u.route('/pages/release/selectAddress', {
  705. type: type,
  706. status:1
  707. });
  708. },
  709. checkboxChange(n) {
  710. console.log('change', n);
  711. if (n.length > 1 && n.length < 4 && n.includes('不限')) {
  712. n.shift(0)
  713. } else if (n.length == 4) {
  714. this.checkboxValue1 = n.splice(1, 4)
  715. }
  716. },
  717. selectValidityPeriodcq() {
  718. this.isShowcardValidity = true
  719. },
  720. confirmValidityPeriod(e) {
  721. console.log('confirm', e)
  722. if (e.value[0] == '随时') {
  723. switch (this.ValidityPeriodType) {
  724. case 0:
  725. this.dataObj.loadingDateStart = e.value[0]
  726. break
  727. case 1:
  728. this.dataObj.loadingDateEnd = e.value[0]
  729. break
  730. }
  731. } else {
  732. if (!e.value[1] || !e.value[2]) {
  733. this.$refs.uToast.show({
  734. type: 'error',
  735. message: "日期格式错误,请重新选择!",
  736. })
  737. return
  738. }
  739. switch (this.ValidityPeriodType) {
  740. case 0:
  741. this.dataObj.loadingDateStart = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  742. break
  743. case 1:
  744. this.dataObj.loadingDateEnd = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  745. break
  746. }
  747. }
  748. this.isShowValidity = false
  749. },
  750. confirmValidityPeriodcq(e) {
  751. console.log('confirm', e)
  752. if (e.value[0] == '长期') {
  753. this.dataObj.taskValidity = e.value[0]
  754. } else {
  755. if (!e.value[1] || !e.value[2]) {
  756. this.$refs.uToast.show({
  757. type: 'error',
  758. message: "日期格式错误,请重新选择!",
  759. })
  760. return
  761. }
  762. this.dataObj.taskValidity = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  763. }
  764. this.isShowcardValidity = false
  765. },
  766. selectValidityPeriod(type) {
  767. this.ValidityPeriodType = type
  768. this.isShowValidity = true
  769. },
  770. change(e) {
  771. console.log('change', e);
  772. },
  773. back() {
  774. uni.navigateBack()
  775. },
  776. goToRecord() {
  777. uni.$u.route('/pages/release/record');
  778. },
  779. radioChange(n) {
  780. console.log('radioChange', n);
  781. this.dataDetails.type = n
  782. },
  783. submit() {
  784. this.isShowAlert = true;
  785. },
  786. }
  787. }
  788. </script>
  789. <style scoped lang="scss">
  790. .input {
  791. text-align: right;
  792. }
  793. .title {
  794. padding: 0 20rpx;
  795. display: flex;
  796. justify-content: center;
  797. position: relative;
  798. .nav-title {
  799. font-size: 32rpx;
  800. }
  801. .back {
  802. position: absolute;
  803. left: 20rpx;
  804. }
  805. .search {
  806. display: flex;
  807. align-items: center;
  808. position: absolute;
  809. right: 20rpx;
  810. }
  811. }
  812. .fixed1 {
  813. height: var(--status-bar-height);
  814. }
  815. .row {
  816. display: flex;
  817. justify-content: space-between;
  818. }
  819. .content1 {
  820. background: white;
  821. margin: 20rpx 20rpx 0 20rpx;
  822. border-radius: 20rpx;
  823. padding: 40rpx;
  824. .select-sf {
  825. color: #999999;
  826. }
  827. .right {
  828. color: #CBCBCB
  829. }
  830. }
  831. .content2,
  832. .content3,
  833. .content5 {
  834. box-sizing: border-box;
  835. background: white;
  836. border-radius: 20rpx;
  837. padding: 20rpx;
  838. margin: 20rpx;
  839. .row {
  840. margin: 30rpx;
  841. }
  842. .row1,
  843. .row2 {
  844. display: flex;
  845. justify-content: space-between;
  846. align-items: center;
  847. .left .top {
  848. display: flex;
  849. }
  850. }
  851. }
  852. .select-type {
  853. display: flex;
  854. justify-content: flex-end;
  855. }
  856. .content2 {
  857. padding: 40rpx;
  858. .row1,
  859. .row2 {
  860. .left {
  861. width: 100%;
  862. }
  863. .right {
  864. color: #CBCBCB
  865. }
  866. }
  867. .row2 {
  868. margin-top: 40rpx;
  869. }
  870. .top {
  871. display: flex;
  872. align-items: center;
  873. }
  874. .bottom {
  875. margin-top: 10rpx;
  876. padding-left: 72rpx;
  877. }
  878. .title {
  879. font-size: 36rpx;
  880. font-weight: 700;
  881. color: #171717;
  882. }
  883. .collect {
  884. width: 40rpx;
  885. height: 40rpx;
  886. line-height: 40rpx;
  887. background: #2772FB;
  888. color: white;
  889. padding: 6rpx;
  890. border-radius: 50%;
  891. text-align: center;
  892. }
  893. .send {
  894. width: 40rpx;
  895. height: 40rpx;
  896. line-height: 40rpx;
  897. background: #101010;
  898. color: white;
  899. padding: 6rpx;
  900. border-radius: 50%;
  901. text-align: center;
  902. }
  903. }
  904. .content3 {}
  905. .content4 {
  906. margin: 20rpx;
  907. padding-left: 20rpx;
  908. .title {
  909. color: #999999;
  910. }
  911. .btn-text {
  912. color: #2772FB;
  913. border: 1px solid #2772FB;
  914. border-radius: 40rpx;
  915. padding: 0rpx 10rpx;
  916. box-sizing: border-box;
  917. }
  918. }
  919. .submit {
  920. width: 90%;
  921. margin: 100rpx auto;
  922. font-size: 36rpx;
  923. font-weight: 500;
  924. color: #FFFFFF;
  925. background: #2772FB;
  926. text-align: center;
  927. padding: 20rpx 0;
  928. border-radius: 50rpx;
  929. }
  930. .select-data {
  931. color: #999999;
  932. }
  933. .row-bgc {
  934. background: #F7F8FA;
  935. padding: 20rpx 30rpx;
  936. box-sizing: border-box;
  937. border-radius: 10rpx;
  938. }
  939. .car-input {
  940. // padding:20rpx;
  941. // box-sizing: border-box;
  942. // border-radius: 10px;
  943. }
  944. .car-line {
  945. margin: 0 20rpx;
  946. }
  947. .car-row {
  948. display: flex;
  949. background: white;
  950. padding: 20rpx;
  951. box-sizing: border-box;
  952. border-radius: 10rpx;
  953. }
  954. </style>