1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123 |
- <template>
- <view class="content">
- <u-navbar title="发布" :placeholder="true" @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="content1">
- <view class="row" @click="selectCargoOwner">
- <view class="left select-sf">{{dataObj.cargoOwner?dataObj.cargoOwner:'选择货主身份'}}</view>
- <view class="right">></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.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 class="right">{{dataObj.sendArea?'':'>'}}</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.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 class="right">{{dataObj.unloadArea?(dataObj.unloadCity+dataObj.unloadArea):'>'}}</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="" />
- <view>Km</view>
- </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 class="row" v-if="freightAdvance">
- <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="text" 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-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
- :showCancelButton='true' 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 {
- qyList: [],
- isShowAlert: false,
- alertTitle: '确定发布运输任务?',
- alertContent: null,
- radioCustomStyle: {
- margin: '0 0 0 20rpx'
- },
- show: false,
- freightAdvance:false,
- columns: [
- []
- ],
- 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: '',
- },
- 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
- },
- ],
- }
- },
- onShow() {
- this.getSFList()
- 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
- this.dataObj.senderPhone = _faddress.contactPhone
- this.dataObj.sender = _faddress.contacts
- }
- 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
- this.dataObj.receiver = _saddress.contacts
- this.dataObj.receiverPhone = _saddress.contactPhone
- }
- },
- onLoad(options) {
- _this = this;
- _this = this;
- this.dataObj = options
- if (this.dataObj.billingMethod == 1) {
- this.dataObj.billingMethod = '元/车'
- } else {
- this.dataObj.billingMethod = '元/吨'
- }
-
- for (let i = 0; i < this.dataObj.carModel.length; i++) {
-
- if (this.dataObj.carModel[i] == '1') {
- this.checkboxValue1.push('不限')
- } else if (this.dataObj.carModel[i] == '2') {
- this.checkboxValue1.push('高栏')
- } else if (this.dataObj.carModel[i] == '3') {
- this.checkboxValue1.push('集装箱')
- } else if (this.dataObj.carModel[i] == '4') {
- this.checkboxValue1.push('自卸车')
- }
- }
- if (this.dataObj.freightAdvance==1) {
- this.dataObj.freightAdvance = true
- this.freightAdvance=true
- } else {
- this.dataObj.freightAdvance = false
- this.freightAdvance=false
- }
- console.log(this.dataObj)
- this.validityPeriod = this.$helper.makeValidityPeriod(0, '随时')
- this.validityPeriodcq = this.$helper.makeValidityPeriod(0, '长期')
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- methods: {
- 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.qyList = []
- // 自己法人
- let _self = res.data.companyInfoList
- //代理货主
- let _dlhz = res.data.cargoOwnerCompInfoList
- if(_self){
- for (let i = 0; i < _self.length; i++) {
- _self[i].compStatus='wd'
- if (_self[i].status == '已认证') {
- this.qyList.push(_self[i])
- }
- }
- }
- if(_dlhz){
- for (let i = 0; i < _dlhz.length; i++) {
- _dlhz[i].compStatus='ss'
- if (_dlhz[i].status == '已认证') {
- this.qyList.push(_dlhz[i])
- }
- }
- }
- 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)
- }
- console.log('1111', _this.columns)
- })
- .catch(res => {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- });
- },
- 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.unloadArea)) {
- 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.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(tthis.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(this.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(this.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() {
- 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
- }
- 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/editTask', this.dataObj).then(res => {
- this.$refs.uToast.show({
- type: 'success',
- message: "修改成功",
- complete() {
- uni.navigateBack({
- delta:1
- })
- _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 = ['不限']
- }
- })
- })
- .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
- }
- 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
- }
- }
- 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]) {
- // this.dataObj.freightAdvance = this.qyList[i].advanceFreightService == 1 ? true : false
- // }
- // }
- // uni.setStorageSync('releaseCargoOwner', this.dataObj.cargoOwner)
- // 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]!='个人货主'){
- this.freightAdvance=true
- 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)
- }else{
- this.freightAdvance=false
- }
- 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,
- status:1
- });
- },
- checkboxChange(n) {
- console.log('change', 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) {
- console.log('confirm', 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
- },
- confirmValidityPeriodcq(e) {
- console.log('confirm', 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 date=new Date()
- var text='任务已过期!'
- if(e.value[0]<date.getFullYear()){
- this.$refs.uToast.show({
- type: 'error',
- message: text,
- })
- return
- }
- if(e.value[0]==date.getFullYear()&&Number(e.value[1])<(date.getMonth()+1)){
- this.$refs.uToast.show({
- type: 'error',
- message: text,
- })
- return
- }
- if(e.value[0]==date.getFullYear()&&Number(e.value[1])==(date.getMonth()+1)&&Number(e.value[2])<=(date.getDate())){
- this.$refs.uToast.show({
- type: 'error',
- message: text,
- })
- 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
- },
- selectValidityPeriod(type) {
- this.ValidityPeriodType = type
- this.isShowValidity = true
- },
- change(e) {
- console.log('change', e);
- },
- back() {
- uni.navigateBack()
- },
- goToRecord() {
- uni.$u.route('/pages/release/record');
- },
- radioChange(n) {
- console.log('radioChange', n);
- this.dataDetails.type = n
- },
- submit() {
- if (this.validate()) return
- this.isShowAlert = true;
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .input {
- text-align: right;
- }
- .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: 20rpx 20rpx 0 20rpx;
- border-radius: 20rpx;
- padding: 40rpx;
- .select-sf {
- 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;
- }
- .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>
|