Browse Source

委托列表bug

zhaoxw 4 years ago
parent
commit
981fb76a52

+ 7 - 3
pagesMain/couponList.vue

@@ -114,9 +114,13 @@
 					pageIndex: this['pageIndex' + (this.tabIndex + 1)],
 					pageSize: 10,
 				}, 'POST').then(res => {
-					this.loadingData = false
-					this.isOver = res.data.list.length != 10
-					this['couponList' + (this.tabIndex + 1)] = this['couponList' + (this.tabIndex + 1)].concat(res.data.list)
+					if (res.isSuccess) {
+						if (res.data.list.length) {
+							this.loadingData = false
+							this.isOver = res.data.list.length != 10
+							this['couponList' + (this.tabIndex + 1)] = this['couponList' + (this.tabIndex + 1)].concat(res.data.list)
+						}
+					}
 				}).catch(error => {
 					this.loadingData = false
 					this.$refs.uTips.show({

+ 77 - 31
pagesMain/entrustForm.vue

@@ -2,11 +2,11 @@
 	<view class="container">
 		<view class="entrust-form">
 			<u-cell-group :border="false">
-				<u-cell-item title="委托金额" title-width="180" :arrow="false">
-					<u-number-box :positive-integer="false" :min="0" v-model="entrustForm.payAomount" bg-color="#51A539" color="#ffffff"></u-number-box>
+				<u-cell-item title="委托金额" title-width="180" :arrow="false" :value="price">
+					<!-- <u-number-box digit :positive-integer="false" :min="0" v-model="entrustForm.payAomount" bg-color="#51A539" color="#ffffff"></u-number-box> -->
 				</u-cell-item>
 				<u-cell-item title="委托时长" title-width="180" :arrow="false">
-					<u-number-box :min="1" v-model="entrustForm.entrustDurationTime" bg-color="#51A539" color="#ffffff"></u-number-box>
+					<u-number-box digit :min="1" v-model="entrustForm.entrustDurationTime" bg-color="#51A539" color="#ffffff"></u-number-box>
 				</u-cell-item>
 				<u-cell-item title="委托开始时间" title-width="180" @click="dateShow = true">
 					<text class="">{{entrustForm.entrustStartTime}}</text>
@@ -15,7 +15,7 @@
 			</u-cell-group>
 		</view>
 		<view class="entrust-handle">
-			<u-button type="success" shape="circle" :ripple="true" @click="toPay()" class="handle-custom" :disabled="!entrustForm.payAomount">支付</u-button>
+			<u-button type="success" shape="circle" :ripple="true" @click="toPay()" class="handle-custom">支付</u-button>
 		</view>
 		<u-picker mode="time" v-model="dateShow" :start-year="startYear" :params="params" @confirm="setDate"></u-picker>
 		<u-top-tips ref="uTips"></u-top-tips>
@@ -28,6 +28,7 @@
 	export default {
 		data() {
 			return {
+				price: 0,
 				userData: {},
 				entrustForm: {
 					productId: '',
@@ -35,7 +36,7 @@
 					tenantCode: '',
 					areaSize: '',
 					payAomount: '',
-					entrustDurationTime: '',
+					entrustDurationTime: 1,
 					entrustStartTime: '',
 					remarks: '',
 				},
@@ -48,7 +49,8 @@
 					minute: true,
 					second: true
 				},
-				startYear: ''
+				startYear: '',
+				orderId: ''
 			}
 		},
 		onLoad(options) {
@@ -58,6 +60,8 @@
 			this.entrustForm.productName = options.productName
 			this.entrustForm.tenantCode = options.tenantCode
 			this.entrustForm.areaSize = options.areaSize
+			debugger
+			this.getPrice()
 		},
 		methods: {
 			//  设置时间
@@ -65,44 +69,86 @@
 				this.entrustForm.entrustStartTime = data.year + '-' + data.month + '-' + data.day + ' ' + data.hour + ':' + data.minute +
 					':' + data.second
 			},
+			// 获取委托金额
+			getPrice() {
+				NET.request(API.getShareTaskPric, {}, 'GET').then(res => {
+					if (res.isSuccess) {
+						if (res.data) {
+							this.price = res.data
+						}
+					} else {
+						this.$refs.uTips.show({
+							title: res.msg,
+							type: 'warning',
+						})
+					}
+				})
+			},
 			//  支付
 			toPay() {
+				debugger
+				if (!this.entrustForm.remarks) {
+					this.$refs.uTips.show({
+						title: '请填写备注信息',
+						type: 'warning',
+					})
+					return
+				}
+				if (!this.entrustForm.entrustStartTime) {
+					this.$refs.uTips.show({
+						title: '请选择开始时间',
+						type: 'warning',
+					})
+					return
+				}
 				NET.request(API.submitEvaluate, {
 					//  会员
 					mid: this.userData.userId,
 					nickname: this.userData.userName,
 					//  数据
 					...this.entrustForm,
-					entrustDurationTime: JSON.stringify(this.entrustForm.entrustDurationTime)
+					entrustDurationTime: JSON.stringify(this.entrustForm.entrustDurationTime),
+					payAomount: this.price * Number(this.entrustForm.entrustDurationTime)
 				}, 'POST').then(res => {
-					uni.requestPayment({
-						provider: 'wxpay',
-						timeStamp: res.data.timeStamp,
-						nonceStr: res.data.nonceStr,
-						package: res.data.packageValue,
-						signType: res.data.signType,
-						paySign: res.data.paySign,
-						success: (payRes) => {
-							this.$refs.uTips.show({
-								title: '支付成功',
-								type: 'success',
-							})
-							setTimeout(() => {
-								uni.reLaunch({
-									url: '/pagesMain/paySuccess'
-								});
-							}, 1000)
-						},
-						fail: (error) => {
-							this.$refs.uTips.show({
-								title: '支付失败',
-								type: 'warning',
+					if (res.isSuccess) {
+						if (res.data) {
+							this.orderId = res.data.orderId
+							uni.requestPayment({
+									provider: 'wxpay',
+									timeStamp: res.data.timeStamp,
+									nonceStr: res.data.nonceStr,
+									package: res.data.packageValue,
+									signType: res.data.signType,
+									paySign: res.data.paySign,
+									success: (payRes) => {
+										this.$refs.uTips.show({
+											title: '支付成功',
+											type: 'success',
+										})
+										// setTimeout(() => {
+										// 	uni.reLaunch({
+										// 		url: '/pagesMain/paySuccess?orderId=' + this.orderId
+										// 	});
+										// }, 1000)
+										uni.navigateBack(-1);
+									},
+									fail: (error) => {
+										this.$refs.uTips.show({
+											title: '支付失败',
+											type: 'warning',
+										})
+									}
 							})
 						}
-					})
+					} else {
+						this.$refs.uTips.show({
+							title: res.msg,
+							type: 'warning',
+						})
+					}
 				}).catch(error => {
 					this.$refs.uTips.show({
-						title: '支付失败',
+						title: '支付未成功',
 						type: 'warning',
 					})
 				})

+ 1 - 1
pagesMain/entrustList.vue

@@ -10,7 +10,7 @@
 			<view class="entrust-text">委托金额:
 				<text class="entrust-price">¥{{item.payAomount}}</text>
 			</view>
-			<view class="entrust-text">备注信息:</view>
+			<view class="entrust-text">备注信息:{{item.remarks}}</view>
 		</view>
 		<view class="entrust-handle">
 			<u-button type="success" shape="circle" :ripple="true" @click="goToAdd()" class="handle-custom">发布委托</u-button>

+ 7 - 2
pagesMain/paySuccess.vue

@@ -19,12 +19,17 @@
 		data() {
 			return {}
 		},
-		onLoad(options) {},
+		onLoad(options) {
+			this.orderId = options.orderId
+		},
 		methods: {
 			//  查看订单
 			goToOrderList() {
+				// uni.navigateTo({
+				// 	url: '/pagesMain/orderList?type=1'
+				// });
 				uni.navigateTo({
-					url: '/pagesMain/orderList?type=1'
+					 url: '/pagesMain/orderDetail?orderId=' + this.orderId + '&orderStatus=' + 2
 				});
 			},
 			//  返回首页

+ 1 - 1
pagesMain/plantList.vue

@@ -54,7 +54,7 @@
 					pageSize: 10,
 				}, 'GET').then(res => {
 					if (res.isSuccess) {
-						if (res.data.list) {
+						if (res.data.list.length) {
 							this.isOver = res.data.list.length != 10
 							this.plantList = this.plantList.concat(res.data.list)
 						}

+ 6 - 1
uview-ui/components/u-number-box/u-number-box.vue

@@ -10,7 +10,7 @@
 		</view>
 		<input :disabled="disabledInput || disabled" :cursor-spacing="getCursorSpacing" :class="{ 'u-input-disabled': disabled }"
 		    v-model="inputVal" class="u-number-input" @blur="onBlur"
-		    type="number" :style="{
+		    :type="digit ? 'digit' :'number'" :style="{
 				color: color,
 				fontSize: size + 'rpx',
 				background: bgColor,
@@ -58,6 +58,11 @@
 	export default {
 		name: "u-number-box",
 		props: {
+			// 显示的小数点
+			digit: {
+				type: Boolean,
+				default: false
+			},
 			// 预显示的数字
 			value: {
 				type: Number,