editRelease.vue 31 KB

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