release.vue 28 KB

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