12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346 |
- <template>
- <view class="content">
- <!-- <u-navbar title="发布" :placeholder="true" rightText="记录" @rightClick="goToRecord" @leftClick="back()"> -->
- <!-- view class="u-nav-slot" slot="left">
- <u-icon name="arrow-left" size="19"></u-icon>
- <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
- <u-icon name="home" size="20"></u-icon>
- </view> -->
- <!-- </u-navbar> -->
- <!-- <view class="fixed1"></view>
- <view class='title top-title flex'>
- <u-icon class="back" name="arrow-left" color="" size="20" @click="back"></u-icon>
- <view class="nav-title">发布</view>
- <view class="search" @click="goToRecord">
- <u-icon class="" name="order" color="" size="28"></u-icon>
- <view>
- 记录
- </view>
- </view>
- </view> -->
- <view class="content1">
- <view class="row" @click="selectCargoOwner">
- <view class="left select-sf" :class='dataObj.cargoOwner?"":"select-sf1"'>{{dataObj.cargoOwner?dataObj.cargoOwner:'选择货主身份'}}</view>
- <view class="right"><image src="../../static/right.png" style="width: 22rpx;height: 22rpx;margin-top:14rpx;"></image></view>
- </view>
- <!-- <view class="row" @click="selectCargoOwner" v-if="dataObj.cargoOwner">
- <view class="left">{{dataObj.cargoOwner}}</view>
- <view class="right">></view>
- </view> -->
- <u-picker :show="show" :columns="columns" :closeOnClickOverlay='true' @close='selectCargoOwnerClose'
- @cancel='selectCargoOwnerClose' @confirm='confirmSelectCargoOwner'></u-picker>
- </view>
- <view class="content2">
- <view class="row1">
- <view class="left">
- <view class="top" @click="selectAddress(0)">
- <view class="send">发</view>
- <view class="title">
- {{dataObj.sendArea?(dataObj.sendPrivate + dataObj.sendCity+dataObj.sendArea):'选择发货地区'}}
- </view>
- </view>
- <view class="bottom">
- <input type="text" value="" placeholder="输入详细地址" v-model="dataObj.sendDetailedAddress" />
- </view>
- </view>
- <view class="right" @click="selectAddress(0)" v-if="!dataObj.sendArea">
- <view v-if='dataObj.sendArea' class="right"></view>
- <view class="right" v-else><image src="../../static/right.png" style="width: 22rpx;height: 22rpx;margin-top:14rpx;"></image></view>
- </view>
- </view>
- <view class="row2">
- <view class="left">
- <view class="top" @click="selectAddress(1)">
- <view class="collect">收</view>
- <view class="title">
- {{dataObj.unloadArea?(dataObj.unloadPrivate + dataObj.unloadCity+dataObj.unloadArea):'选择收货地区'}}
- </view>
- </view>
- <view class="bottom">
- <input type="text" value="" placeholder="输入详细地址" v-model="dataObj.unloadDetailedAddress" />
- </view>
- </view>
- <view class="right" @click="selectAddress(1)" v-if="!dataObj.unloadArea">
- <view v-if='dataObj.unloadArea' class="right">{{(dataObj.unloadCity+dataObj.unloadArea)}}</view>
- <view class="right" v-else><image src="../../static/right.png" style="width: 22rpx;height: 22rpx;margin-top:14rpx;"></image></view>
- </view>
- </view>
- </view>
- <view class="content3">
- <view class="row">
- <view class="left">距离</view>
- <!-- <input type="text" value="" class="input" placeholder="自动计算" v-model="dataObj.distance" disabled /> -->
- {{dataObj.distance }}
- km
- </view>
- <view class="row">
- <view class="left">货物类别</view>
- <view class="right" @click="goodstypeChange">{{dataObj.goodsType?dataObj.goodsType:"请选择货物类别"}}</view>
- </view>
- <view class="row">
- <view class="left">货名</view>
- <view class="right"><input type="text" class="input" value="" placeholder="输入货物名称"
- v-model="dataObj.goodsName" /></view>
- </view>
- <view class="row">
- <view class="left">收货方</view>
- <view class="right flex">
- <input type="text" value="" placeholder="输入收货人姓名或企业名称" class="input" v-model="dataObj.receiver" />
- </view>
- </view>
- <view class="row">
- <view class="left">收货方手机号</view>
- <view class="right flex">
- <input type="number" maxlength="11" placeholder="输入收货方手机号" class="input"
- v-model="dataObj.receiverPhone" />
- </view>
- </view>
- <view class="row">
- <view class="left">收货人身份证号</view>
- <view class="right flex">
- <input type="number" maxlength="18" placeholder="输入收货人身份证号" class="input"
- v-model="dataObj.receiverIdcard" />
- </view>
- </view>
- <view class="row">
- <view class="left">收货方信用代码(选填)</view>
- <view class="right flex">
- <input maxlength="18" placeholder="统一社会信用代码" class="input" v-model="dataObj.receiverCreditCode" />
- </view>
- </view>
- <view class="flex row">
- <view class="left-text">运费计算方式</view>
- <u-radio-group placement="row" v-model="dataObj.billingMethod" class="select-type">
- <u-radio :customStyle="radioCustomStyle" v-for="(item, index) in radiolist1" :key="index"
- :label="item.name" :name="item.name" @change="radioChange">
- </u-radio>
- </u-radio-group>
- </view>
- <view class="row">
- <view class="left">运费单价</view>
- <view class="right"><input type="number" value="" placeholder="输入运费单价" class="input"
- v-model="dataObj.freightPrice" /></view>
- </view>
- <view v-if='dataObj.freightAdvance' class="row">
- <view class="left">该任务申请运费垫付</view>
- <view class="right">
- <u-switch v-model="dataObj.freightAdvance" @change="change" size="20"></u-switch>
- </view>
- </view>
- </view>
- <view class="content4 flex">
- <view class="title">以下为附加信息</view>
- <view class="btn-text">选填</view>
- </view>
- <view class="content5">
- <view class="row">
- <view class="left">发货联系人</view>
- <view class="right flex">
- <input type="text" value="" placeholder="输入发货联系人姓名" class="input" v-model="dataObj.sender" />
- </view>
- </view>
- <view class="row">
- <view class="left">发货联系人电话</view>
- <view class="right flex">
- <input type="number" maxlength="11" value="" placeholder="输入发货联系人手机号" class="input"
- v-model="dataObj.senderPhone" />
- </view>
- </view>
- <view class="row">
- <view class="left">重量(吨)</view>
- <view class="right flex">
- <input type="number" value="" placeholder="输入预计发运重量" class="number" v-model="dataObj.weight"
- style="text-align: right;" />
- </view>
- </view>
- <view class="flex row" @click="selectValidityPeriod(0)">
- <view class="left-text">预计装车日期起</view>
- <view :class="!dataObj.loadingDateStart?'select-data':''">
- {{dataObj.loadingDateStart?dataObj.loadingDateStart:'选择有效截止日期>'}}
- </view>
- </view>
- <view class="flex row" @click="selectValidityPeriod(1)">
- <view class="left-text">预计装车日期止</view>
- <view :class="!dataObj.loadingDateEnd?'select-data':''">
- {{dataObj.loadingDateEnd?dataObj.loadingDateEnd:'选择有效截止日期>'}}
- </view>
- </view>
- <view class="row">
- <view class="left">车长要求(米)</view>
- </view>
- <view class="row flex-space-between row-bgc">
- <view class="car-row">
- <input type="number" value="" placeholder="最短不限" class="" v-model="dataObj.carLengthSmall"
- class="car-input" />
- <view>m</view>
- </view>
- <view class="car-line">-</view>
- <view class="car-row">
- <input type="number" value="" placeholder="最长不限" class="" v-model="dataObj.carLength"
- class="car-input" />
- <view>m</view>
- </view>
- </view>
- <view class="row">
- <view class="left">载重要求(吨)</view>
- </view>
- <view class="row flex-space-between row-bgc">
- <view class="car-row">
- <input type="number" value="" placeholder="最小不限" class="car-input"
- v-model="dataObj.loadWeightSmall" />
- <view>吨</view>
- </view>
- <view class="car-line">-</view>
- <view class="car-row">
- <input type="number" value="" placeholder="最大不限" class="car-input" v-model="dataObj.loadWeight" />
- <view>吨</view>
- </view>
- </view>
- <view class="row">
- <view class="left">车型要求</view>
- </view>
- <view class="row">
- <u-checkbox-group v-model="checkboxValue1" placement="row" @change="checkboxChange">
- <u-checkbox :customStyle="radioCustomStyle" v-for="(item, index) in checkboxList1" :key="index"
- :label="item.name" :name="item.name">
- </u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="row">
- <view class="left">任务描述</view>
- </view>
- <view class="row">
- <u--textarea v-model="dataObj.taskDescription" placeholder="请输入内容" :count='true' maxlength='200'>
- </u--textarea>
- </view>
- <view class="flex row noborder" @click="selectValidityPeriodcq">
- <view class="left-text">任务有效期</view>
- <view :class="dataObj.taskValidity?'':'select-data'">
- {{dataObj.taskValidity?dataObj.taskValidity:'选择任务有效期>'}}
- </view>
- </view>
- <u-picker :show="isShowcardValidity" ref="uPicker" :columns="validityPeriodcq"
- @confirm="confirmValidityPeriodcq" @change="changeHandler" @close='isShowcardValidity=false'
- @cancel='isShowcardValidity=false' :closeOnClickOverlay='true'>
- </u-picker>
- </view>
- <view class="submit" @click="submit">立即发布</view>
- <u-picker :show="isShowValidity" ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
- :closeOnClickOverlay='true' @close='isShowValidity=false' @cancel='isShowValidity=false'>
- </u-picker>
- <!-- //货物类别 -->
- <u-picker :show="isGoodsType" ref="uPicker" :columns="goodsList" keyName="constValue" @confirm="goodsSubmit"
- :closeOnClickOverlay='true' @close='isGoodsType=false' @cancel='isGoodsType=false'>
- </u-picker>
- <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='false'
- :showCancelButton='showCancelButton' confirmColor='#2772FB' @confirm="$u.throttle(confirmClick(), 5000)" @close="cancelClick"
- @cancel="cancelClick"></u-modal>
- <u-modal :show="isShowAlert1" :title="alertTitle" :confirmText='confirmText' :content='alertContent'
- :closeOnClickOverlay='false' :showCancelButton='showCancelButton' confirmColor='#2772FB'
- @confirm="$u.throttle(confirmClick(), 5000)" @close="cancelClick" @cancel="cancelClick"></u-modal>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- var _this;
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- showCancelButton: true,
- qyList: [],
- isShowAlert: false,
- alertTitle: '确定发布运输任务?',
- alertContent: null,
- radioCustomStyle: {
- margin: '0 0 0 20rpx'
- },
- show: false,
- columns: [
- []
- ],
- dataObj: {
- commonId: '',
- cargoOwner: '',
- sendPrivate: '',
- sendCity: '',
- sendArea: '',
- sendDetailedAddress: '',
- unloadPrivate: '',
- unloadCity: '',
- unloadArea: '',
- unloadDetailedAddress: '',
- distance: '',
- goodsName: '',
- billingMethod: '元/吨',
- freightPrice: '',
- freightAdvance: false,
- sender: '',
- senderPhone: '',
- receiver: '',
- receiverPhone: '',
- weight: '',
- loadingDateStart: '',
- loadingDateEnd: '',
- carLengthSmall: '',
- carLength: '',
- loadWeightSmall: '',
- loadWeight: '',
- carModel: '',
- taskDescription: '',
- taskValidity: '',
- sendLongitude: '',
- sendLatitude: '',
- unsendLongitude: '',
- unsendLatitude: '',
- },
- confirmText: '',
- isShowAlert1: false,
- checkboxValue1: ['不限'],
- checkboxList1: [{
- name: '不限',
- disabled: false
- },
- {
- name: '高栏',
- disabled: false
- },
- {
- name: '集装箱',
- disabled: false
- },
- {
- name: '自卸车',
- disabled: false
- }
- ],
- value: true,
- isShowcardValidity: false,
- ValidityPeriodType: '',
- validityPeriod: [],
- validityPeriodcq: [],
- isShowValidity: false,
- dataDetails: {
- type: '元/车'
- },
- radiolist1: [{
- name: '元/吨',
- disabled: false
- },
- {
- name: '元/车',
- disabled: false
- },
- ],
- // 货物类别
- isGoodsType:false,
- goodsList:[]
- }
- },
- onNavigationBarButtonTap(e) {
- console.log("success")
- this.goToRecord()
- },
- onShow() {
- _this = this
- // #ifdef APP-PLUS
- // let _status = this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
- // phone: this.userInfo.phone
- // }).then(res => {
- // uni.setStorageSync("firstAuthentication",res.data)
- // return res.data.authenticationStatus
- // })
- // if (_status == '已禁用') {
- // this.isShowAlert = true
- // this.alertTitle = '账号审核中'
- // this.confirmText = '退出APP'
- // this.showCancelButton = false
- // return
- // } else {
- // }
- // #endif
- if (!this.hasLogin) {
- uni.$u.route('/pages/public/login');
- return
- }
- this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
- phone: this.userInfo.phone
- }).then(res => {
- uni.setStorageSync("firstAuthentication", res.data)
- let _obj = res.data
- if (_obj.authenticationStatus == '已认证') {
- uni.$u.route('/pages/components/empty/index');
- } else if (_obj.authenticationStatus == '审核中') {
- uni.showToast({
- title: '身份信息审核中',
- icon: 'none'
- })
- } else if (_obj.authenticationStatus == '已过期') {
- this.alertTitle = '身份信息已过期!'
- this.showCancelButton = false
- this.confirmText = '立即修改'
- this.isShowAlert1 = true
- } else {
- this.alertTitle = '身份信息未认证,去认证?'
- this.confirmText = '确认'
- this.showCancelButton = false
- this.isShowAlert = true
- }
- })
- this.validityPeriod = this.$helper.makeValidityPeriod(0, '随时')
- this.validityPeriodcq = this.$helper.makeValidityPeriod(0, '长期')
- let _faddress = uni.getStorageSync('storage_faddress');
- let _saddress = uni.getStorageSync('storage_saddress');
- if (_faddress) {
- this.dataObj.sendCity = _faddress.city
- this.dataObj.sendArea = _faddress.area
- this.dataObj.sendPrivate = _faddress.province
- this.dataObj.sendDetailedAddress = _faddress.detailedAddress
- this.dataObj.sendLongitude = _faddress.longitude
- this.dataObj.sendLatitude = _faddress.latitude
- if(_faddress.contactPhone){
- this.dataObj.senderPhone = _faddress.contactPhone
- }
- if(_faddress.contacts){
- this.dataObj.sender = _faddress.contacts
- }
- } else {
- this.getDefaultPlace(0)
- }
- if (_saddress) {
- this.dataObj.unloadDetailedAddress = _saddress.detailedAddress
- this.dataObj.unloadCity = _saddress.city
- this.dataObj.unloadArea = _saddress.area
- this.dataObj.unloadPrivate = _saddress.province
- this.dataObj.unsendLongitude = _saddress.longitude
- this.dataObj.unsendLatitude = _saddress.latitude
- if(_saddress.contacts){
- this.dataObj.receiver = _saddress.contacts
- }
- if(_saddress.contactPhone){
- this.dataObj.receiverPhone = _saddress.contactPhone
- }
- } else {
- this.getDefaultPlace(1)
- }
- if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude && this.dataObj
- .unsendLongitude) {
- this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
- .unsendLongitude,
- this.dataObj.sendLatitude, this.dataObj.sendLongitude)
- }
- this.dataObj.loadingDateStart = '随时'
- this.dataObj.loadingDateEnd = '随时'
- this.dataObj.taskValidity = '长期'
- this.getSFList()
-
- },
- async onLoad() {
- //货物类别(默认上一次)
- this.queryGoodsList() // 查询货物类别
- let goods = uni.getStorageSync("goodsType")
- if(goods){
- this.dataObj.goodsType = goods.name
- this.dataObj.goodsTypeKey = goods.key
- }
-
- // _this = this
- // // #ifdef APP-PLUS
- // let _status = await this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
- // phone: this.userInfo.phone,
- // }).then(res => {
- // if(res.data){
- // return res.data.authenticationStatus
- // }
- // })
- // if (_status == '已禁用') {
- // this.isShowAlert = true
- // this.alertTitle = '账号审核中'
- // this.confirmText = '退出APP'
- // this.showCancelButton = false
- // return
- // } else {}
- // // #endif
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- methods: {
- queryGoodsList(){
- this.$request.baseRequest('get', '/commonSysParameter/getInfo', {
- constId: "CON1"
- }).then(res => {
- this.goodsList.push(res.data)
- console.log(this.goodsList)
- })
- },
- goodstypeChange(){
- this.isGoodsType = true
- },
- goodsSubmit(e){
- this.dataObj.goodsType = e.value[0].constValue
- this.dataObj.goodsTypeKey = e.value[0].constKey
- let _obj={
- name:e.value[0].constValue,
- key:e.value[0].constKey
- }
- uni.setStorageSync("goodsType",_obj)
- this.isGoodsType = false
- },
- getSFList() {
- this.dataObj.commonId = this.userInfo.id
- this.$request.baseRequest('get', '/cargoOwnerCompInfo/cargoOwnerList', {
- commonId: this.userInfo.id
- }).then(res => {
- if (uni.getStorageSync('releaseCargoOwner')) {
- this.dataObj.cargoOwner = uni.getStorageSync('releaseCargoOwner')
- this.dataObj.compId =uni.getStorageSync('releasecompId')
-
- }
- // 可用企业货主
- this.qyList = []
- // 自己法人
- // let _self = res.data.companyInfoList
- let _self = res.data.hyCompanyInfoList
- //代理货主
- // let _dlhz = res.data.cargoOwnerCompInfoList
- let _dlhz = res.data.hyCargoOwnerCompInfoList
- if (!_dlhz) _dlhz = []
- if (!_self) _self = []
- if (_self.length > 0) {
- for (let i = 0; i < _self.length; i++) {
- _self[i].compStatus='wd'
- if (_self[i].status == '已认证') {
- this.qyList.push(_self[i])
- }
- }
- }
- if (_dlhz.length > 0) {
- for (let i = 0; i < _dlhz.length; i++) {
- _dlhz[i].compStatus='ss'
- if (_dlhz[i].status == '已认证') {
- this.qyList.push(_dlhz[i])
- }
- }
- }
- this.columns = [
- []
- ]
- let obj = uni.getStorageSync("firstAuthentication")
- if (obj && obj.authenticationStatus == '已认证') {
- this.columns[0].push("个人货主")
- }
- for (let i = 0; i < this.qyList.length; i++) {
- this.columns[0].push(this.qyList[i].company ? this.qyList[i].company : this.qyList[i]
- .companyName)
- }
- this.$forceUpdate()
- })
- .catch(res => {});
- },
- validate() {
- if (uni.$u.test.isEmpty(this.dataObj.cargoOwner)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "货主不能为空!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataObj.sendArea)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请选择发货地区!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataObj.sendDetailedAddress)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "发货详细地址不能为空!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataObj.unloadArea)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请选择收货地区!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataObj.unloadDetailedAddress)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "收货详细地址不能为空!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataObj.goodsName)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "货名不能为空!",
- })
- return true
- }
- if (!uni.$u.test.chinese(this.dataObj.goodsName)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "货名输入错误!",
- })
- return true
- }
- console.log(this.dataObj.receiver,"收货方")
- console.log(this.dataObj.receiverPhone,"收货方手机号")
- if (uni.$u.test.isEmpty(this.dataObj.receiver)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "收货方不能为空!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataObj.receiverPhone)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "收货方手机号不能为空!",
- })
- return true
- }
- // if (uni.$u.test.isEmpty(this.dataObj.receiverIdcard)) {
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "收货人身份证不能为空!",
- // })
- // return true
- // }
- if (!this.dataObj.receiverIdcard && !this.dataObj.receiverCreditCode) {
- this.$refs.uToast.show({
- type: 'error',
- message: "收款方统一社会信用代码和收货人身份证号码至少填写一个!",
- })
- return true
- }
- // if(this.dataObj.receiverIdcard&&!uni.$u.test.rangeLength(this.dataObj.receiverIdcard, [18, 18])){
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "身份证号输入错误!",
- // })
- // return true
- // }
- if(this.dataObj.receiverIdcard&&this.dataObj.receiverIdcard.length!=18){
- this.$refs.uToast.show({
- type: 'error',
- message: "身份证号输入错误!",
- })
- return true
- }
- if(this.dataObj.receiverCreditCode&&this.dataObj.receiverCreditCode.length!=18){
- this.$refs.uToast.show({
- type: 'error',
- message: "信用代码输入错误!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataObj.freightPrice)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "运费单价不能为空!",
- })
- return true
- }
- if (
- this.dataObj.freightPrice < 0 || this.dataObj.freightPrice > 100000 || (
- String(this.dataObj.freightPrice).indexOf('.') != -1 && String(this.dataObj.freightPrice).length -
- (String(this.dataObj.freightPrice).indexOf(
- '.') + 1) > 2)
- ) {
- uni.showToast({
- title: '运费单价输入错误!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- if (this.dataObj.weight) {
- if (
- this.dataObj.weight < 0.1 || this.dataObj.weight > 10000000 || (
- String(this.dataObj.weight).indexOf('.') != -1 && String(tthis.dataObj.weight).length -
- (String(this.dataObj.weight).indexOf(
- '.') + 1) > 2)
- ) {
- uni.showToast({
- title: '重量输入错误!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- }
- if (this.dataObj.carLengthSmall) {
- if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
- uni.showToast({
- title: '最小车长输入错误!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- }
- if (this.dataObj.carLength) {
- if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
- uni.showToast({
- title: '最大车长输入错误!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- }
- if (this.dataObj.carLengthSmall && this.dataObj.carLength && (Number(this.dataObj.carLengthSmall) > Number(
- this.dataObj
- .carLength))) {
- uni.showToast({
- title: '最小车长应小于最大车长!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- if (this.dataObj.loadWeightSmall) {
- if (
- this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
- String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(tthis.dataObj
- .loadWeightSmall).length -
- (String(this.dataObj.loadWeightSmall).indexOf(
- '.') + 1) > 3)
- ) {
- uni.showToast({
- title: '载量输入错误!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- }
- if (this.dataObj.loadWeight) {
- if (
- this.dataObj.loadWeight < 0.1 || this.dataObj.loadWeight > 100 || (
- String(this.dataObj.loadWeight).indexOf('.') != -1 && String(tthis.dataObj.loadWeight).length -
- (String(this.dataObj.loadWeight).indexOf(
- '.') + 1) > 3)
- ) {
- uni.showToast({
- title: '载量输入错误!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- }
- if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (Number(this.dataObj.loadWeightSmall) >
- Number(this.dataObj
- .loadWeight))) {
- uni.showToast({
- title: '最小载重应小于最大载重!',
- duration: 2000,
- icon: "none",
- });
- return true
- }
- },
- confirmClick() {
- uni.$u.throttle(this.requestdata, 500)
- },
- requestdata(){
- // // #ifdef APP-PLUS
- // if (this.alertTitle == '账号审核中') {
- // if (uni.getSystemInfoSync().platform == 'ios') {
- // plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
- // } else if (uni.getSystemInfoSync().platform == 'android') {
- // plus.runtime.quit();
- // }
- // return
- // }
- // // #endif
-
- // if (this.alertTitle == '身份信息未认证,去认证?') {
- // uni.switchTab({
- // url: '/pages/mine/index'
- // })
- // return
- // }
- // this.isShowAlert = false
-
- if (this.dataObj.billingMethod == '元/吨') {
- this.dataObj.billingMethod = 0
- } else {
- this.dataObj.billingMethod = 1
- }
- if (this.dataObj.freightAdvance) {
- this.dataObj.freightAdvance = 1
- } else {
- this.dataObj.freightAdvance = 0
- }
- if(!this.dataObj.receiverIdcard){
- this.dataObj.receiverIdcard=''
- }
- if(!this.dataObj.receiverCreditCode){
- this.dataObj.receiverCreditCode=''
- }
- let _list = []
- for (let i = 0; i < this.checkboxValue1.length; i++) {
- if (this.checkboxValue1[i] == '不限') {
- _list.push(1)
- } else if (this.checkboxValue1[i] == '高栏') {
- _list.push(2)
- } else if (this.checkboxValue1[i] == '集装箱') {
- _list.push(3)
- } else if (this.checkboxValue1[i] == '自卸车') {
- _list.push(4)
- }
- }
- this.dataObj.carModel = _list.toString()
- this.dataObj.commonId = this.userInfo.id
- this.$request.baseRequest('post', '/publishTaskInfo/api/addTask', this.dataObj).then(res => {
- uni.removeStorage({
- key: 'storage_saddress'
- });
- uni.removeStorage({
- key: 'storage_faddress'
- });
- uni.removeStorage({
- key: 'releaseCargoOwner'
- });
- uni.removeStorage({
- key: 'releasecompId'
- });
- this.$refs.uToast.show({
- type: 'success',
- message: "发布成功",
- complete() {
- _this.dataObj = {
- commonId: '',
- cargoOwner: '',
- sendPrivate: '',
- sendCity: '',
- sendArea: '',
- sendDetailedAddress: '',
- unloadPrivate: '',
- unloadCity: '',
- unloadArea: '',
- unloadDetailedAddress: '',
- distance: '',
- goodsName: '',
- billingMethod: '元/吨',
- freightPrice: '',
- freightAdvance: true,
- sender: '',
- senderPhone: '',
- receiver: '',
- receiverPhone: '',
- weight: '',
- loadingDateStart: '',
- loadingDateEnd: '',
- carLengthSmall: '',
- carLength: '',
- loadWeightSmall: '',
- loadWeight: '',
- carModel: '',
- taskDescription: '',
- taskValidity: '',
- sendLongitude: '',
- sendLatitude: '',
- unsendLongitude: '',
- unsendLatitude: '',
- }
- _this.checkboxValue1 = ['不限']
- // uni.$u.route("/pages/release/record")
- }
- })
- this.isShowAlert = false
-
- })
- .catch(res => {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- });
- },
- cancelClick() {
- this.isShowAlert = false
- },
- //获取默认发货地、收货地
- getDefaultPlace(type) {
- // 0时获取默认发货地址,1时获取默认收货地址 通过选择获取的地址无需获取默认地址
- uni.showLoading({
- mask: true,
- title: '加载中...'
- })
- this.$request.baseRequest('get', '/cargoOwnerAddressInfo/addressList', {
- commonId: this.userInfo.id
- }).then(res => {
- for (let i = 0; i < res.data.length; i++) {
- if (res.data[i].defaultShipment == 1 && type == 0) {
- this.dataObj.sendCity = res.data[i].city
- this.dataObj.sendArea = res.data[i].area
- this.dataObj.sendPrivate = res.data[i].province
- this.dataObj.sendDetailedAddress = res.data[i].detailedAddress
- this.dataObj.sendLongitude = res.data[i].longitude
- this.dataObj.sendLatitude = res.data[i].latitude
- this.dataObj.sender = res.data[i].contacts
- this.dataObj.senderPhone = res.data[i].contactPhone
- }
- if (res.data[i].defaultReceipt == 1 && type == 1) {
- this.dataObj.unloadDetailedAddress = res.data[i].detailedAddress
- this.dataObj.unloadCity = res.data[i].city
- this.dataObj.unloadArea = res.data[i].area
- this.dataObj.unloadPrivate = res.data[i].province
- this.dataObj.unsendLongitude = res.data[i].longitude
- this.dataObj.unsendLatitude = res.data[i].latitude
- this.dataObj.receiver = res.data[i].contacts
- this.dataObj.receiverPhone = res.data[i].contactPhone
- }
- }
- if (this.dataObj.sendLatitude && this.dataObj.sendLongitude && this.dataObj.unsendLatitude &&
- this.dataObj.unsendLongitude) {
- this.dataObj.distance = this.$helper.getDistance(this.dataObj.unsendLatitude, this.dataObj
- .unsendLongitude, this.dataObj.sendLatitude, this.dataObj.sendLongitude)
- }
- uni.hideLoading()
- })
- .catch(res => {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- });
- },
- changeHandler(e) {
- const {
- columnIndex,
- value,
- values,
- index,
- picker = this.$refs.uPicker
- } = e
- // if (columnIndex === 0) {
- //
- // if (e.index != 0) {
- // picker.setColumnValues(1, this.validityPeriod[1].shift())
- // }
- // } else if (columnIndex === 1) {
- // if (e.index != 0) {
- // picker.setColumnValues(2, this.validityPeriod[2].shift())
- // }
- // }
- },
- selectCargoOwnerClose() {
- this.show = false
- },
- confirmSelectCargoOwner(e) {
- this.dataObj.cargoOwner = e.value[0]
- for (let i = 0; i < this.qyList.length; i++) {
- let _name = this.qyList[i].company ? this.qyList[i].company : this.qyList[i].companyName
- if (_name == e.value[0]) {
- if(e.value[0]!='个人货主'){
- if(this.qyList[i].compStatus=='ss'){
- this.dataObj.compId=this.qyList[i].compId
- }else{
- this.dataObj.compId=this.qyList[i].id
- }
- console.log(this.qyList[i].compStatus,this.dataObj.compId)
- uni.setStorageSync('releasecompId', this.dataObj.compId)
- }
- this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
- }
- }
-
- uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
- this.show = false
- },
- selectCargoOwner() {
- this.show = true
- },
- selectAddress(type) {
- // uni.removeStorage({
- // key: 'storage_faddress'
- // });
- // uni.removeStorage({
- // key: 'storage_saddress'
- // });
- uni.$u.route('/pages/release/selectAddress', {
- type: type,
- });
- },
- checkboxChange(n) {
- if (n.length > 1 && n.length < 4 && n.includes('不限')) {
- n.shift(0)
- } else if (n.length == 4) {
- this.checkboxValue1 = n.splice(1, 4)
- }
- },
- selectValidityPeriodcq() {
- this.isShowcardValidity = true
- },
- confirmValidityPeriod(e) {
- if (e.value[0] == '随时') {
- switch (this.ValidityPeriodType) {
- case 0:
- this.dataObj.loadingDateStart = e.value[0]
- break
- case 1:
- this.dataObj.loadingDateEnd = e.value[0]
- break
- }
- } else {
- if (!e.value[1] || !e.value[2]) {
- this.$refs.uToast.show({
- type: 'error',
- message: "日期格式错误,请重新选择!",
- })
- return
- }
- switch (this.ValidityPeriodType) {
- case 0:
- this.dataObj.loadingDateStart = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
- break
- case 1:
- this.dataObj.loadingDateEnd = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
- break
- }
- }
- this.isShowValidity = false
- },
- getTime: function() {
- var date = new Date().getTime()
- year = date.getFullYear(),
- month = date.getMonth() + 1,
- day = date.getDate(),
- month >= 1 && month <= 9 ? (month = "0" + month) : "";
- day >= 0 && day <= 9 ? (day = "0" + day) : "";
- var timer = year + '-' + month + '-' + day
- return timer;
- },
- confirmValidityPeriodcq(e) {
- if (e.value[0] == '长期') {
- if(e.value[1]||e.value[2]){
- this.$refs.uToast.show({
- type: 'error',
- message: "选择长期时不允许选择月日!",
- })
- return
- }
- this.dataObj.taskValidity = e.value[0]
- } else {
- if (!e.value[1] || !e.value[2]) {
- this.$refs.uToast.show({
- type: 'error',
- message: "日期格式错误,请重新选择!",
- })
- return
- }
- var datetime = new Date().getTime()
- var datetime1 = datetime + (24 * 60 * 60 * 1000 * 30 * 6)
- var currecttime = new Date(e.value[0] + '-' + e.value[1] + '-' + e.value[2]).getTime()
- if (currecttime < datetime || currecttime > datetime1) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请选择未来六个月之内的日期!",
- })
- } else {
- this.dataObj.taskValidity = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
- this.isShowcardValidity = false
- }
- console.log(datetime, currecttime)
- }
- },
- selectValidityPeriod(type) {
- this.ValidityPeriodType = type
- this.isShowValidity = true
- },
- change(e) {
- console.log('change', e);
- },
- back() {
- uni.navigateBack({
- delta: 1
- })
- },
- goToRecord() {
- uni.$u.route('/pages/release/record');
- },
- radioChange(n) {
- this.dataDetails.type = n
- },
- submit() {
- if (this.validate()) return
- if (this.dataObj.cargoOwner == '个人货主') {
- this.dataObj.compId == ""
- } else {
- for (let i = 0; i < this.qyList.length; i++) {
- if (this.dataObj.cargoOwner == this.qyList[i].companyName) {
- this.dataObj.compId = this.qyList[i].id
- break
- }
- }
- }
- this.isShowAlert = true;
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .input {
- text-align: right;
- }
- .content {
- height: 100vh;
- overflow: scroll;
- }
- .title {
- padding: 0 20rpx;
- display: flex;
- justify-content: center;
- position: relative;
- .nav-title {
- font-size: 32rpx;
- }
- .back {
- position: absolute;
- left: 20rpx;
- }
- .search {
- display: flex;
- align-items: center;
- position: absolute;
- right: 20rpx;
- }
- }
- .fixed1 {
- height: var(--status-bar-height);
- }
- .row {
- display: flex;
- justify-content: space-between;
- }
- .content1 {
- background: white;
- margin: 40rpx 20rpx 0 20rpx;
- border-radius: 20rpx;
- padding: 40rpx;
- .select-sf {
- color: #171717;
- font-size: 34rpx;
- font-weight: 600;
- }
- .select-sf1 {
- color: #999999;
- }
- .right {
- color: #CBCBCB
- }
- }
- .content2,
- .content3,
- .content5 {
- box-sizing: border-box;
- background: white;
- border-radius: 20rpx;
- padding: 20rpx;
- margin: 20rpx;
- .row {
- margin: 30rpx;
- }
- .row1,
- .row2 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .left .top {
- display: flex;
- }
- }
- }
- .select-type {
- display: flex;
- justify-content: flex-end;
- }
- .top-title {
- background: #fff;
- padding: 20rpx;
- position: fixed;
- z-index: 100;
- top: 0;
- box-sizing: border-box;
- width: 100%;
- }
- .content2 {
- padding: 40rpx;
- .row1,
- .row2 {
- .left {
- width: 100%;
- }
- .right {
- color: #CBCBCB
- }
- }
- .row2 {
- margin-top: 40rpx;
- }
- .top {
- display: flex;
- align-items: center;
- }
- .bottom {
- margin-top: 10rpx;
- padding-left: 72rpx;
- }
- .title {
- font-size: 36rpx;
- font-weight: 700;
- color: #171717;
- }
- .collect {
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- background: #2772FB;
- color: white;
- padding: 6rpx;
- border-radius: 50%;
- text-align: center;
- }
- .send {
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- background: #101010;
- color: white;
- padding: 6rpx;
- border-radius: 50%;
- text-align: center;
- }
- }
- .content3 {}
- .content4 {
- margin: 20rpx;
- padding-left: 20rpx;
- .title {
- color: #999999;
- }
- .btn-text {
- color: #2772FB;
- border: 1px solid #2772FB;
- border-radius: 40rpx;
- padding: 0rpx 10rpx;
- box-sizing: border-box;
- }
- }
- .submit {
- width: 90%;
- margin: 100rpx auto;
- font-size: 36rpx;
- font-weight: 500;
- color: #FFFFFF;
- background: #2772FB;
- text-align: center;
- padding: 20rpx 0;
- border-radius: 50rpx;
- }
- .select-data {
- color: #999999;
- }
- .row-bgc {
- background: #F7F8FA;
- padding: 20rpx 30rpx;
- box-sizing: border-box;
- border-radius: 10rpx;
- }
- .car-input {
- // padding:20rpx;
- // box-sizing: border-box;
- // border-radius: 10px;
- }
- .car-line {
- margin: 0 20rpx;
- }
- .car-row {
- display: flex;
- background: white;
- padding: 20rpx;
- box-sizing: border-box;
- border-radius: 10rpx;
- }
- </style>
|