zhongtianhaoyuan 2 年之前
父節點
當前提交
f446fc76bb
共有 3 個文件被更改,包括 195 次插入212 次删除
  1. 139 42
      pages/order/signContract.vue
  2. 20 63
      pages/release/editRelease.vue
  3. 36 107
      pages/release/release.vue

+ 139 - 42
pages/order/signContract.vue

@@ -58,7 +58,7 @@
 					width="17px" height="17px"></u--image>
 				我已阅读并同意
 				<view>
-					<u--text type="primary" text="《货物运输委托协议》" @click="lookContract" ></u--text>
+					<u--text type="primary" text="《货物运输委托协议》" @click="lookContract"></u--text>
 				</view>
 				条款
 			</view>
@@ -77,7 +77,7 @@
 			<view class="handRight">
 
 			</view>
-		
+
 		</view>
 		<view class="handBtn">
 			<!-- 			<image @click="selectColorEvent('black','#1A1A1A')"
@@ -86,7 +86,7 @@
 			<image @click="selectColorEvent('red','#ca262a')"
 				:src="selectColor === 'red' ? '/static/other/color_red_selected.png' : '/static/other/color_red.png'"
 				:class="[selectColor === 'red' ? 'color_select' : '', 'black-select']"></image> -->
-		
+
 			<!-- <button @click="saveCanvasAsImg" class="saveBtn">保存</button> -->
 			<view @click="$u.throttle(submit, 1000)" class="saveBtn">提交</view>
 			<!-- <button @click="previewCanvasImg" class="previewBtn">预览</button> -->
@@ -135,6 +135,7 @@
 				chargeProportion: "", //收费比例
 				consentStatus: false,
 				codestatus: false,
+				addType: "",
 			};
 		},
 		computed: {
@@ -150,8 +151,8 @@
 				//收费比例从缓存中取
 				that.chargeProportion = uni.getStorageSync("firstAuthentication").chargeProportion * 100
 			})
-
 			this.dataDetails = JSON.parse(decodeURIComponent(options.obj))
+			this.addType = JSON.parse(decodeURIComponent(options.type))
 			// this.dataDetails.advanceFreightService = '平台垫付运费'
 			this.ctx = uni.createCanvasContext("handWriting");
 			this.$nextTick(() => {
@@ -197,7 +198,7 @@
 			});
 		},
 		methods: {
-			lookContract(){
+			lookContract() {
 				uni.downloadFile({
 					url: "https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/hzContract.pdf",
 					success: function(res) {
@@ -234,7 +235,7 @@
 				// 	})
 				// 	return
 				// }
-				if (!this.consentStatus) {
+				if (!that.consentStatus) {
 					that.$refs.uToast.show({
 						type: 'error',
 						message: "请阅读并确认协议条款!",
@@ -261,45 +262,141 @@
 									title: '加载中',
 									mask: true
 								})
-								let _obj = {}
-								_obj.id = that.dataDetails.id
-								_obj.cargoOwnerAutograph = that.dataDetails.cargoOwnerAutograph
-								that.$request.baseRequest('get', '/publishTaskInfo/signContract', _obj).then(
-										res => {
+								if (that.addType == 1) { //新增
+									that.$request.baseRequest('post', '/publishTaskInfo/api/addTask', that
+											.dataDetails).then(res => {
+											if (res.code == 200) {
+												uni.removeStorage({
+													key: 'storage_saddress'
+												});
+												uni.removeStorage({
+													key: 'storage_faddress'
+												});
+												uni.removeStorage({
+													key: 'releaseCargoOwner'
+												});
+												uni.removeStorage({
+													key: 'releasecompId'
+												});
+												// uni.redirectTo({
+												// 		url: "/pages/release/release"
+												// })
+												that.dataDetails.id = res.data
+												let _obj = {}
+												_obj.id = that.dataDetails.id
+												_obj.cargoOwnerAutograph = that.dataDetails
+													.cargoOwnerAutograph
+												that.$request.baseRequest('get',
+														'/publishTaskInfo/signContract', _obj).then(
+														res => {
+															uni.hideLoading()
+															if (res.code == 200) {
+
+																// that.contractSrc = res.data
+																// uni.downloadFile({
+																// 	url: res.data,
+																// 	success: function(res) {
+																// 		var filePath = res.tempFilePath;
+																// 		uni.openDocument({
+																//  		filePath: filePath,
+																// 			showMenu: true,
+																// 			success: function(res) {
+																// 				console.log('打开文档成功');
+																// 			}
+																// 		});
+																// 	}
+																// });
+																that.$refs.uToast.show({
+																	type: 'success',
+																	message: "发布成功",
+																	complete() {
+																		uni.switchTab({
+																			url: '/pages/order/index'
+																		});
+																	}
+																})
+															}
+														})
+													.catch(res => {
+														uni.hideLoading()
+														uni.$u.toast(res.message);
+													});
+											}
+										})
+										.catch(res => {
 											uni.hideLoading()
+											uni.showToast({
+												title: res.message,
+												icon: 'none',
+												duration: 2000
+											})
+										});
+								} else if (that.addType == 2) { //编辑
+									that.$request.baseRequest('post', '/publishTaskInfo/api/editTask', that
+											.dataDetails).then(res => {
 											if (res.code == 200) {
-												// that.contractSrc = res.data
-												// uni.downloadFile({
-												// 	url: res.data,
-												// 	success: function(res) {
-												// 		var filePath = res.tempFilePath;
-												// 		uni.openDocument({
-												//  		filePath: filePath,
-												// 			showMenu: true,
-												// 			success: function(res) {
-												// 				console.log('打开文档成功');
-												// 			}
-												// 		});
-												// 	}
-												// });
-												that.$refs.uToast.show({
-													type: 'success',
-													message: "发布成功",
-													complete() {
-														uni.switchTab({
-															url: '/pages/order/index'
-														});
-													}
-												})
+												uni.removeStorage({
+													key: 'storage_saddress'
+												});
+												uni.removeStorage({
+													key: 'storage_faddress'
+												});
+												uni.removeStorage({
+													key: 'releaseCargoOwner'
+												});
+												uni.removeStorage({
+													key: 'releasecompId'
+												});
+												let _obj = {}
+												_obj.id = that.dataDetails.id
+												_obj.cargoOwnerAutograph = that.dataDetails
+													.cargoOwnerAutograph
+												that.$request.baseRequest('get',
+														'/publishTaskInfo/signContract', _obj).then(
+														res => {
+															uni.hideLoading()
+															if (res.code == 200) {
+																// that.contractSrc = res.data
+																// uni.downloadFile({
+																// 	url: res.data,
+																// 	success: function(res) {
+																// 		var filePath = res.tempFilePath;
+																// 		uni.openDocument({
+																//  		filePath: filePath,
+																// 			showMenu: true,
+																// 			success: function(res) {
+																// 				console.log('打开文档成功');
+																// 			}
+																// 		});
+																// 	}
+																// });
+																that.$refs.uToast.show({
+																	type: 'success',
+																	message: "修改成功",
+																	complete() {
+																		uni.switchTab({
+																			url: '/pages/order/index'
+																		});
+																	}
+																})
+															}
+														})
+													.catch(res => {
+														uni.hideLoading()
+														uni.$u.toast(res.message);
+													});
 											}
 										})
-									.catch(res => {
-										uni.hideLoading()
-										uni.$u.toast(res.message);
-									});
-							}
-						)
-
+										.catch(res => {
+											uni.hideLoading()
+											uni.showToast({
+												title: res.message,
+												icon: 'none',
+												duration: 2000
+											})
+										});
+								}
+							})
 					}
 				});
 			},
@@ -552,7 +649,7 @@
 		//条款
 		display: inline-block;
 		color: #2772FB;
-		
+
 	}
 
 	/* 

+ 20 - 63
pages/release/editRelease.vue

@@ -552,7 +552,7 @@
 				}
 				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 && String(this.dataObj.freightPrice).length -
 						(String(this.dataObj.freightPrice).indexOf(
 							'.') + 1) > 2)
 				) {
@@ -566,7 +566,7 @@
 				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 && String(this.dataObj.weight).length -
 							(String(this.dataObj.weight).indexOf(
 								'.') + 1) > 2)
 					) {
@@ -677,67 +677,24 @@
 				}
 				this.dataObj.carModel = _list.toString()
 				this.dataObj.commonId = this.userInfo.id
-				this.$request.baseRequest('post', '/publishTaskInfo/api/editTask', this.dataObj).then(res => {
-					if(res.code == 200){
-						uni.$u.route('/pages/order/signContract', {
-							obj: JSON.stringify(this.dataObj)
-						});
-					}
-
-						// 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
-						})
-					});
+				uni.$u.route('/pages/order/signContract', {
+					obj: JSON.stringify(this.dataObj),
+					type:2,//编辑
+				});
+				// this.$request.baseRequest('post', '/publishTaskInfo/api/editTask', this.dataObj).then(res => {
+				// 	if(res.code == 200){
+				// 		uni.$u.route('/pages/order/signContract', {
+				// 			obj: JSON.stringify(this.dataObj)
+				// 		});
+				// 	}
+				// 	})
+				// 	.catch(res => {
+				// 		uni.showToast({
+				// 			title: res.message,
+				// 			icon: 'none',
+				// 			duration: 2000
+				// 		})
+				// 	});
 
 			},
 			cancelClick() {

+ 36 - 107
pages/release/release.vue

@@ -761,7 +761,7 @@
 				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 && String(this.dataObj.weight).length -
 							(String(this.dataObj.weight).indexOf(
 								'.') + 1) > 2)
 					) {
@@ -807,7 +807,7 @@
 				if (this.dataObj.loadWeightSmall) {
 					if (
 						this.dataObj.loadWeightSmall < 0.1 || this.dataObj.loadWeightSmall > 100 || (
-							String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(tthis.dataObj
+							String(this.dataObj.loadWeightSmall).indexOf('.') != -1 && String(this.dataObj
 								.loadWeightSmall).length -
 							(String(this.dataObj.loadWeightSmall).indexOf(
 								'.') + 1) > 3)
@@ -823,7 +823,7 @@
 				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 && String(this.dataObj.loadWeight).length -
 							(String(this.dataObj.loadWeight).indexOf(
 								'.') + 1) > 3)
 					) {
@@ -900,111 +900,39 @@
 				}
 				this.dataObj.carModel = _list.toString()
 				this.dataObj.commonId = this.userInfo.id
-				this.$request.baseRequest('post', '/publishTaskInfo/api/addTask', this.dataObj).then(res => {
+				uni.$u.route('/pages/order/signContract', {
+					obj: JSON.stringify(this.dataObj),
+					type:1
+				});
+				// this.$request.baseRequest('post', '/publishTaskInfo/api/addTask', this.dataObj).then(res => {
 					
-					if(res.code == 200){
-						uni.removeStorage({
-							key: 'storage_saddress'
-						});
-						uni.removeStorage({
-							key: 'storage_faddress'
-						});
-						uni.removeStorage({
-							key: 'releaseCargoOwner'
-						});
-						uni.removeStorage({
-							key: 'releasecompId'
-						});
-						// uni.redirectTo({
-						// 		url: "/pages/release/release"
-						// })
+				// 	if(res.code == 200){
+				// 		uni.removeStorage({
+				// 			key: 'storage_saddress'
+				// 		});
+				// 		uni.removeStorage({
+				// 			key: 'storage_faddress'
+				// 		});
+				// 		uni.removeStorage({
+				// 			key: 'releaseCargoOwner'
+				// 		});
+				// 		uni.removeStorage({
+				// 			key: 'releasecompId'
+				// 		});
+				// 		// uni.redirectTo({
+				// 		// 		url: "/pages/release/release"
+				// 		// })
+				// 		this.dataObj.id = res.data 
 						
-						uni.$u.route('/pages/order/signContract', {
-							obj: JSON.stringify(this.dataObj)
-						});
-					}
-						
-						// 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: '',
-						// 		// 	receiverIdcard:'',
-						// 		// 	sendLatitude: '',
-						// 		// 	receiverCreditCode:'',
-						// 		// 	unsendLongitude: '',
-						// 		// 	unsendLatitude: '',
-						// 		// }
-						// 		// _this.checkboxValue1 = ['不限']
-						// 		// _this.queryGoodsList() // 查询货物类别
-						// 		// let goods = uni.getStorageSync("goodsType")
-						// 		// if(goods){
-						// 		// 	_this.dataObj.goodsType = goods.name
-						// 		// 	_this.dataObj.goodsTypeKey = goods.key
-						// 		// }
-						// 		// const pages = getCurrentPages()
-						// 		// console.log(pages)
-						// 		// 声明一个pages使用getCurrentPages方法
-						// 		// const curPage = pages[pages.length - 1]
-						// 		// 声明一个当前页面
-						// 		// curPage.$vm.$options.onLoad[1].bind(curPage.$vm); // 传入参数
-						// 		// curPage.$vm.$options.onShow[1].bind(curPage.$vm); // curPage.onShow()
-						// 		//       curPage.$vm.$options.onReady[1].bind(curPage.$vm);
-						// 		// curPage.onReady()
-						// 		// uni.switchTab({
-						// 		// 	url: '/pages/mine/index'
-						// 		// })
-						// 		// uni.switchTab({
-						// 		// 	url: '/pages/mine/index'
-						// 		// })
-						// 		uni.redirectTo({
-						// 			url: "/pages/release/release"
-						// 		})
-						// 		// uni.reLaunch({url:"/pages/release/release"})
-						// 		// uni.redirectTo("/pages/release/record")
-						// 		// uni.$u.route("/pages/release/record")
-						// 	}
-						// })
-						
-
-					})
-					.catch(res => {
-						uni.showToast({
-							title: res.message,
-							icon: 'none',
-							duration: 2000
-						})
-					});
+				// 	}
+				// 	})
+				// 	.catch(res => {
+				// 		uni.showToast({
+				// 			title: res.message,
+				// 			icon: 'none',
+				// 			duration: 2000
+				// 		})
+				// 	});
 			},
 			cancelClick() {
 				this.isShowAlert = false
@@ -1206,7 +1134,8 @@
 						}
 					}
 				}
-				this.isShowAlert = true;
+				uni.$u.throttle(this.requestdata, 500)
+				// this.isShowAlert = true;
 			},
 		}
 	}