achao 3 лет назад
Родитель
Сommit
251520e9a5
5 измененных файлов с 365 добавлено и 70 удалено
  1. 60 23
      App.vue
  2. 8 2
      common/helper.js
  3. 2 2
      config/index.js
  4. 1 0
      pages/mine/company/index.vue
  5. 294 43
      pages/release/release.vue

+ 60 - 23
App.vue

@@ -5,7 +5,8 @@
 </style>
 <script>
 	import {
-		mapMutations
+		mapMutations,
+		mapState
 	} from 'vuex';
 	import Vue from 'vue'
 	import * as config from '@/config'
@@ -15,32 +16,68 @@
 		methods: {
 			...mapMutations(['login']),
 		},
+		computed: {
+			...mapState(['hasLogin', 'userInfo']),
+		},
 		onLaunch: function() {
+			let that = this
+			uni.onTabBarMidButtonTap(() => {
+				debugger
+				console.log("点击发布")
+				if (!that.hasLogin) {
+					// uni.$u.route('/pages/public/login');
+					uni.navigateTo({
+						url: "/pages/public/login",
+						animationType: "slide-in-bottom", // 动画类型
+						animationDuration: 150, // 窗口动画持续时间,单位为 ms
+						fail(err) {
+							console.log(err)
+						},
+						success(res) {
+							console.log(res)
+						}
+					})
+				}
+				if (uni.getStorageSync('userInfo').statusFlag == '已认证') {
+					uni.$u.route('/pages/components/empty/index');
+				} else if (uni.getStorageSync('userInfo').statusFlag == '审核中') {
+					uni.showToast({
+						title: '身份信息审核中'
+					})
+				} else {
+					uni.showToast({
+						title: '请重新提交身份信息',
+						complete() {
+							uni.$u.route('/pages/mine/cargoowner/editpersonalinformation');
+						}
+					})
+				}
+			})
 			uni.getSystemInfo({
-			        success:function(e){
-			            Vue.prototype.statusBar = e.statusBarHeight
-			            // #ifndef MP
-			            if(e.platform == 'android') {
-			                Vue.prototype.customBar = e.statusBarHeight + 50
-			            }else {
-			                Vue.prototype.customBar = e.statusBarHeight + 45
-			            }
-			            // #endif
-			            
-			            // #ifdef MP-WEIXIN
-			            let custom = wx.getMenuButtonBoundingClientRect()
-			            Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight
-			            // #endif
-			            
-			            // #ifdef MP-ALIPAY
-			            Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
-			            // #endif
-			        }
-			    })
-			uni.onTabBarMidButtonTap(()=>{
+				success: function(e) {
+					Vue.prototype.statusBar = e.statusBarHeight
+					// #ifndef MP
+					if (e.platform == 'android') {
+						Vue.prototype.customBar = e.statusBarHeight + 50
+					} else {
+						Vue.prototype.customBar = e.statusBarHeight + 45
+					}
+					// #endif
+
+					// #ifdef MP-WEIXIN
+					let custom = wx.getMenuButtonBoundingClientRect()
+					Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight
+					// #endif
+
+					// #ifdef MP-ALIPAY
+					Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
+					// #endif
+				}
+			})
+			uni.onTabBarMidButtonTap(() => {
 				uni.navigateTo({
 					url: '/pages/release/release'
-			    });
+				});
 			})
 			// #ifdef APP-PLUS
 			let type = uni.getSystemInfoSync().platform

+ 8 - 2
common/helper.js

@@ -112,10 +112,16 @@ const contactCustomerService = (item) => {
 }
 // 获取市、区简称
 const filterUrban = (s) => {
-	return s.substring(0, s.length - 1)
+	if (s.lastIndexOf('市') != -1) {
+		return s.substring(0, s.length - 1)
+	}
+	return s
 }
 const filterArea = (q) => {
-	return q.substring(0, q.length - 1)
+	if (q.lastIndexOf('区') != -1) {
+		return q.substring(0, q.length - 1)
+	}
+	return q
 }
 // const getAddress = (item) => {
 // 	let regex = "(?<province>[^省]+省|.+自治区)(?<city>[^自治州]+自治州|[^市]+市|[^盟]+盟|[^地区]+地区|.+区划)(?<county>[^市]+市|[^县]+县|[^旗]+旗|.+区)?(?<town>[^区]+区|.+镇)?(?<village>.*)";

+ 2 - 2
config/index.js

@@ -1,6 +1,6 @@
 const dev = {
-	baseUrlNew: 'https://apitest.eliangeyun.com',
-	// baseUrlNew: 'http://192.168.1.114:8091',
+	// baseUrlNew: 'https://apitest.eliangeyun.com',
+	baseUrlNew: 'http://192.168.1.114:8091',
 	h5Appid: 'wxb66b599f7f61b46f',
 	debug: false
 }

+ 1 - 0
pages/mine/company/index.vue

@@ -13,6 +13,7 @@
 					<view v-if='item.status=="已认证"' class='status passed'>{{item.status}}</view>
 					<view v-if='item.status=="审核中"' class='status aduit'>{{item.status}}</view>
 					<view v-if='item.status=="已驳回"' class='status reject'>{{item.status}}</view>
+					<view v-if='item.status=="已过期"' class='status reject'>{{item.status}}</view>
 				</view>
 				<view class="row2">
 					<image v-if='item.status!="审核中"' @click='edit(item)' style='width:17px;height:17px;margin:0 10px;' src="@/static/mine/company/edit.png"></image>

+ 294 - 43
pages/release/release.vue

@@ -12,14 +12,14 @@
 			</view>
 		</view>
 		<view class="content1">
-			<view class="row" @click="selectCargoOwner" v-if="!dataObj.cargoOwner">
-				<view class="left select-sf">选择货主身份</view>
+			<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="row" @click="selectCargoOwner" v-if="dataObj.cargoOwner">
 				<view class="left">{{dataObj.cargoOwner}}</view>
 				<view class="right">></view>
-			</view>
+			</view> -->
 			<u-picker :show="show" :columns="columns" :closeOnClickOverlay='true' @close='selectCargoOwnerClose'
 				@cancel='selectCargoOwnerClose' @confirm='confirmSelectCargoOwner'></u-picker>
 		</view>
@@ -61,7 +61,7 @@
 			<view class="row">
 				<view class="left">距离</view>
 				<input type="text" value="" class="input" placeholder="自动计算" v-model="dataObj.distance" disabled="" />
-				<view>公里</view>
+				<view>Km</view>
 			</view>
 			<view class="row">
 				<view class="left">货名</view>
@@ -82,7 +82,7 @@
 				<view class="right"><input type="number" value="" placeholder="输入运费单价" class="input"
 						v-model="dataObj.freightPrice" /></view>
 			</view>
-			<view class="row">
+			<view class="row" v-if="dataObj.freightAdvance">
 				<view class="left">该任务申请运费垫付</view>
 				<view class="right">
 					<u-switch v-model="dataObj.freightAdvance" @change="change" size="20"></u-switch>
@@ -103,7 +103,8 @@
 			<view class="row">
 				<view class="left">发货联系人电话</view>
 				<view class="right flex">
-					<input type="text" value="" placeholder="输入发货联系人手机号" class="input" v-model="dataObj.senderPhone" />
+					<input type="number" maxlength="11" value="" placeholder="输入发货联系人手机号" class="input"
+						v-model="dataObj.senderPhone" />
 				</view>
 			</view>
 			<view class="row">
@@ -115,25 +116,26 @@
 			<view class="row">
 				<view class="left">收货联系人电话</view>
 				<view class="right flex">
-					<input type="text" value="" placeholder="输入收货联系人手机号" class="input"
+					<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="text" value="" placeholder="输入预计发运重量" class="number" v-model="dataObj.weight" />
+					<input type="text" value="" placeholder="输入预计发运重量" class="number" v-model="dataObj.weight"
+						style="text-align: right;" />
 				</view>
 			</view>
-			<view class="flex row">
+			<view class="flex row" @click="selectValidityPeriod(0)">
 				<view class="left-text">预计装车日期起</view>
-				<view :class="!dataObj.loadingDateStart?'select-data':''" @click="selectValidityPeriod(0)">
+				<view :class="!dataObj.loadingDateStart?'select-data':''">
 					{{dataObj.loadingDateStart?dataObj.loadingDateStart:'选择有效截止日期>'}}
 				</view>
 			</view>
-			<view class="flex row">
+			<view class="flex row" @click="selectValidityPeriod(1)">
 				<view class="left-text">预计装车日期止</view>
-				<view :class="!dataObj.loadingDateEnd?'select-data':''" @click="selectValidityPeriod(1)">
+				<view :class="!dataObj.loadingDateEnd?'select-data':''">
 					{{dataObj.loadingDateEnd?dataObj.loadingDateEnd:'选择有效截止日期>'}}
 				</view>
 			</view>
@@ -203,7 +205,9 @@
 		<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="confirmClick" @close="cancelClick" @cancel="cancelClick"></u-modal>
+		<u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
+			:showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
+			@cancel="cancelClick"></u-modal>
 		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
@@ -216,15 +220,16 @@
 	export default {
 		data() {
 			return {
-				isShowAlert:false,
-				alertTitle:'确定发布运输任务?',
-				alertContent:null,
+				qyList: [],
+				isShowAlert: false,
+				alertTitle: '确定发布运输任务?',
+				alertContent: null,
 				radioCustomStyle: {
 					margin: '0 0 0 20rpx'
 				},
 				show: false,
 				columns: [
-					['个人货主', '黑龙江中天昊元贸易有限公司', '黑龙江利润元贸易有限公司']
+					[]
 				],
 				dataObj: {
 					commonId: '',
@@ -301,21 +306,45 @@
 			}
 		},
 		onShow() {
-
+			
+			console.log("点击发布")
+			if (!_this.hasLogin) {
+				uni.$u.route('/pages/public/login');
+				return
+			}
+			if (uni.getStorageSync('userInfo').statusFlag == '已认证') {
+				uni.$u.route('/pages/components/empty/index');
+			} else if (uni.getStorageSync('userInfo').statusFlag == '审核中') {
+				uni.showToast({
+					title: '身份信息审核中'
+				})
+			} else {
+				uni.showToast({
+					title: '请重新提交身份信息',
+					complete() {
+						uni.$u.route('/pages/mine/cargoowner/editpersonalinformation');
+					}
+				})
+			}
+			this.getSFList()
 		},
-		 onLoad(options) {
+		onLoad(options) {
+			
 			_this = this;
-			this.validityPeriod = this.$helper.makeValidityPeriod()
-			this.validityPeriodcq = this.$helper.makeValidityPeriod(0,'长期')
+			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
+				this.dataObj.senderPhone = _faddress.contactPhone
+				this.dataObj.sender = _faddress.contacts
 			} else {
 				this.getDefaultPlace(0)
 			}
@@ -326,12 +355,18 @@
 				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
 			} 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)
+			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 = '随时'
 
 
 		},
@@ -339,9 +374,190 @@
 			...mapState(['hasLogin', 'userInfo']),
 		},
 		methods: {
-			confirmClick(){
-				
-				// 校验没写
+			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
+						for (let i = 0; i < _self.length; i++) {
+							if (_self[i].status == '已认证') {
+								this.qyList.push(_self[i])
+							}
+						}
+
+						for (let i = 0; i < _dlhz.length; i++) {
+							if (_dlhz[i].status == '已认证') {
+								this.qyList.push(_dlhz[i])
+							}
+						}
+						// 		this.columns: [
+						// 	['个人货主', '黑龙江中天昊元贸易有限公司', '黑龙江利润元贸易有限公司']
+						// ],
+						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
+				}
+				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
+					}
+				}
+				if (this.dataObj.carLengthSmall) {
+					if (this.dataObj.carLengthSmall < 2 || this.dataObj.carLengthSmall > 30) {
+						uni.showToast({
+							title: '最小车长输入错误!',
+							duration: 2000,
+							icon: "none",
+						});
+						return
+					}
+				}
+				if (this.dataObj.carLength) {
+					if (this.dataObj.carLength < 2 || this.dataObj.carLength > 30) {
+						uni.showToast({
+							title: '最大车长输入错误!',
+							duration: 2000,
+							icon: "none",
+						});
+						return
+					}
+				}
+				if (this.dataObj.carLengthSmall && this.dataObj.carLength && (this.dataObj.carLengthSmall > this.dataObj
+						.carLength)) {
+					uni.showToast({
+						title: '最小车长应小于最大车长!',
+						duration: 2000,
+						icon: "none",
+					});
+					return
+				}
+
+				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
+					}
+				}
+				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
+					}
+				}
+				if (this.dataObj.loadWeightSmall && this.dataObj.loadWeight && (this.dataObj.loadWeightSmall > this.dataObj
+						.loadWeight)) {
+					uni.showToast({
+						title: '最小载重应小于最大载重!',
+						duration: 2000,
+						icon: "none",
+					});
+					return
+				}
+
+
+			},
+			confirmClick() {
+				this.validate()
 				if (this.dataObj.billingMethod == '元/吨') {
 					this.dataObj.billingMethod = 0
 				} else {
@@ -367,13 +583,13 @@
 				this.dataObj.carModel = _list.toString()
 				this.dataObj.commonId = this.userInfo.id
 				this.$request.baseRequest('post', '/publishTaskInfo/api/addTask', this.dataObj).then(res => {
-						
+
 						this.$refs.uToast.show({
 							type: 'success',
 							message: "发布成功",
 							complete() {
 								_this.isShowAlert = false
-								_this.dataObj={
+								_this.dataObj = {
 									commonId: '',
 									cargoOwner: '',
 									sendPrivate: '',
@@ -408,10 +624,10 @@
 									unsendLongitude: '',
 									unsendLatitude: '',
 								}
-								_this.checkboxValue1=['不限']
+								_this.checkboxValue1 = ['不限']
 							}
 						})
-				
+
 					})
 					.catch(res => {
 						uni.showToast({
@@ -420,9 +636,9 @@
 							duration: 2000
 						})
 					});
-				
+
 			},
-			cancelClick(){
+			cancelClick() {
 				this.isShowAlert = false
 			},
 			//获取默认发货地、收货地
@@ -453,8 +669,10 @@
 								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)
+						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()
 
@@ -494,6 +712,14 @@
 			},
 			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
 			},
 			selectCargoOwner() {
@@ -510,23 +736,48 @@
 					type: type,
 				});
 			},
-			checkboxChange(n) {
+			checkboxChange(n) {debugger
 				console.log('change', n);
+				if(n.length>1&&n.length<3&&n.includes('不限')){
+					n.shift(0)
+				}else{
+					
+				}
 			},
 			selectValidityPeriodcq() {
 				this.isShowcardValidity = true
 			},
 			confirmValidityPeriod(e) {
 				console.log('confirm', e)
-				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
+				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) {