Browse Source

自助采摘未付款逻辑

zhaoxw 4 years ago
parent
commit
925fcdf301
5 changed files with 137 additions and 56 deletions
  1. 2 2
      pagesGood/goodList.vue
  2. 73 41
      pagesMain/orderDetail.vue
  3. 12 4
      pagesMain/orderItem.vue
  4. 2 0
      pagesMain/orderList.vue
  5. 48 9
      pagesMain/paySuccess.vue

+ 2 - 2
pagesGood/goodList.vue

@@ -172,7 +172,6 @@
 			},
 			//  添加购物车
 			addCart(item) {
-                debugger
 				this.goodItem = {
 					productId: this.goodType == 5 ? item.productId : item.id,
 					productName: item.productName,
@@ -320,7 +319,8 @@
 						-webkit-line-clamp: 2;
 						-webkit-box-orient: vertical;
 						word-wrap: break-word;
-						margin: 4px 0 10px 0;
+						// margin: 4px 0 10px 0;
+						margin-top: 4px
 					}
 
 					.goods-area {

+ 73 - 41
pagesMain/orderDetail.vue

@@ -44,8 +44,8 @@
 			<view class="order-info">
 				<u-cell-group :border="false">
 					<u-cell-item title="商品金额" :value="'¥' + orderData.orderSum" :arrow="false" :border-bottom="false"></u-cell-item>
-					<u-cell-item title="积分抵扣" :value="'-¥' + orderData.integralAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1"></u-cell-item>
-					<u-cell-item title="优惠券" :value="'-¥' + orderData.couponDiscountAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1"></u-cell-item>
+					<u-cell-item title="积分抵扣" :value="'-¥' + orderData.integralAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1 || goodType == 3"></u-cell-item>
+					<u-cell-item title="优惠券" :value="'-¥' + orderData.couponDiscountAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1 || goodType == 3"></u-cell-item>
 					<u-cell-item title="备注" :value="orderData.notes" :arrow="false" :border-bottom="false"></u-cell-item>
 				</u-cell-group>
 			</view>
@@ -205,21 +205,41 @@
 				}
 				if (this.orderData.merchantInfoResVO.products.length && this.orderData.merchantInfoResVO.products[0].productType !=
 					2 && this.orderData.merchantInfoResVO.products[0].productType != 4) {
-					this.goodType = 1
+				    if (this.orderData.merchantInfoResVO.products[0].productType != 3) {
+						this.goodType = 1
+					} else {
+						this.goodType = 3
+					}
 				} else {
 					this.goodType = 2
 				}
 				switch (JSON.stringify(this.orderData.orderStatus)) {
 					case '1':
-						this.buttonGroup = [{
-							text: '取消订单',
-							backgroundColor: '#75BD60',
-							color: '#fff'
-						}, {
-							text: '立即支付',
-							backgroundColor: '#52A63A',
-							color: '#fff'
-						}]
+					    if (this.goodType == 3) {
+							this.buttonGroup = [{
+								text: '取消订单',
+								backgroundColor: '#75BD60',
+								color: '#fff'
+							}, {
+								text: '立即支付',
+								backgroundColor: '#52A63A',
+								color: '#fff'
+							}, {
+								text: '自助采摘',
+								backgroundColor: '#75BD60',
+								color: '#fff'
+							}]
+						} else {
+							this.buttonGroup = [{
+								text: '取消订单',
+								backgroundColor: '#75BD60',
+								color: '#fff'
+							}, {
+								text: '立即支付',
+								backgroundColor: '#52A63A',
+								color: '#fff'
+							}]
+						}
 						break;
 					case '2':
 						var someVaule = this.orderData.merchantInfoResVO.products.some(v => {
@@ -420,6 +440,9 @@
 						this.modalContent = '请确定是否立即支付'
 						this.handleType = 2
 						this.modalShow = true
+					} else if (e.index == 2) {
+						// 跳转自助采摘
+						this.goPickVideo()
 					}
 				} else {
 					if (e.index == 0) {
@@ -438,33 +461,8 @@
 						})
 					} else {
 						if (this.orderData.orderStatus == 2) {
-							var that=this;
-							if(uni.getStorageSync("firstTimeLiveUser")==""){
-								uni.setStorage({
-									key: 'firstTimeLiveUser',
-									data: 1
-								})
-								uni.navigateTo({
-									url: '/pagesGood/pickVideo?orderId=' + that.orderData.orderId + '&tenantCode=' + that.orderData.tenantCode
-								});
-							}else{
-								wx.getSetting({
-								  success(res) {
-									/*if (!res.authSetting['scope.camera']){
-									  that.show_qx=false;
-									}else*/ 
-									if (!res.authSetting['scope.record']){
-									  that.show_qx=false;
-									}else{
-										uni.navigateTo({
-											url: '/pagesGood/pickVideo?orderId=' + that.orderData.orderId + '&tenantCode=' + that.orderData.tenantCode
-										});
-									}
-								  }
-								})
-							}
-							
 							//  自助采摘
+							this.goPickVideo()
 						} else if (this.orderData.orderStatus == 3) {
 							if (e.index == 1) {
 								//  确认收货
@@ -537,9 +535,15 @@
 							paySign: res.data.paySign,
 							success: (payRes) => {
 								console.log('success:' + JSON.stringify(payRes));
-								uni.navigateTo({
-									url: '/pagesMain/paySuccess?orderId=' + this.orderData.orderId
-								});
+								if (this.goodType == 3) {
+									uni.navigateTo({
+										url: '/pagesMain/paySuccess?orderId=' + this.orderData.orderId + '&goodType=' + this.goodType + '&tenantCode=' + this.orderData.tenantCode
+									});
+								} else {
+									uni.navigateTo({
+										url: '/pagesMain/paySuccess?orderId=' + this.orderData.orderId
+									});
+								}
 							},
 							fail: (error) => {
 								console.log('fail:' + JSON.stringify(error));
@@ -585,6 +589,34 @@
 					})
 				}
 			},
+			// 跳转自助采摘直播
+			goPickVideo() {
+				var that=this;
+				if(uni.getStorageSync("firstTimeLiveUser")==""){
+					uni.setStorage({
+						key: 'firstTimeLiveUser',
+						data: 1
+					})
+					uni.navigateTo({
+						url: '/pagesGood/pickVideo?orderId=' + that.orderData.orderId + '&tenantCode=' + that.orderData.tenantCode
+					});
+				}else{
+					wx.getSetting({
+					  success(res) {
+						/*if (!res.authSetting['scope.camera']){
+						  that.show_qx=false;
+						}else*/ 
+						if (!res.authSetting['scope.record']){
+						  that.show_qx=false;
+						}else{
+							uni.navigateTo({
+								url: '/pagesGood/pickVideo?orderId=' + that.orderData.orderId + '&tenantCode=' + that.orderData.tenantCode
+							});
+						}
+					  }
+					})
+				}
+			},
 			//  跳转留言列表
 			goToMessage() {
 				uni.navigateTo({

+ 12 - 4
pagesMain/orderItem.vue

@@ -32,7 +32,7 @@
 			<!-- <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
 			 v-if="tabIndex != 1 && tabIndex != 2" @click.stop="handleOrder(3)">申请售后</u-button> -->
 			<u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
-			 v-if="tabIndex == 3 && pickHandle" @click.stop="handleOrder(4)">自助采摘</u-button>
+			 v-if="(tabIndex == 2 || tabIndex == 3) && pickHandle" @click.stop="handleOrder(4)">自助采摘</u-button>
 			 <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
 			  v-if="tabIndex == 3 && sharePlant" @click.stop="handleOrder(8)">我的种植</u-button>
 			  <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
@@ -110,11 +110,13 @@
 				modalShow: false,
 				modalContent: '',
 				handleType: '',
+				goodType: ''
 			}
 		},
 		onReady() {
 			this.pickHandle = this.orderData.products.filter(site => site.productType == 3).length > 0
 			this.sharePlant = this.orderData.products.filter(site => site.productType == 4).length > 0
+			this.goodType = this.pickHandle ? 3 : ''
 		},
 		methods: {
 			closeSetting:function(){
@@ -285,9 +287,15 @@
 							paySign: res.data.paySign,
 							success: (payRes) => {
 								console.log('success:' + JSON.stringify(payRes));
-								uni.navigateTo({
-									url: '/pagesMain/paySuccess?orderId=' + this.orderData.orderId
-								});
+								if (this.goodType == 3) {
+									uni.navigateTo({
+										url: '/pagesMain/paySuccess?orderId=' + this.orderData.orderId + '&goodType=' + this.goodType + '&tenantCode=' + this.orderData.tenantCode
+									});
+								} else {
+									uni.navigateTo({
+										url: '/pagesMain/paySuccess?orderId=' + this.orderData.orderId
+									});
+								}
 							},
 							fail: (error) => {
 								console.log('fail:' + JSON.stringify(error));

+ 2 - 0
pagesMain/orderList.vue

@@ -81,6 +81,8 @@
 			this.tabIndex = options.type - 1
 			this.getOrderList(options.type)
 		},
+		onShow() {
+		},
 		onReady(options) {},
 		onPullDownRefresh() {
 			this['isOver' + (this.tabIndex + 1)] = false

+ 48 - 9
pagesMain/paySuccess.vue

@@ -4,10 +4,11 @@
 			<view class="iconfont iconqueding"></view>
 		</view>
 		<view class="pay-title">支付成功</view>
-		<view class="pay-text">您已支付成功,您所购买的商品正在向您飞奔, 请耐心等待!</view>
-		<view class="pay-text">3秒后自动跳转订单详情...</view>
+		<view class="pay-text">{{goodType ? '您已支付成功, 您所购买的商品需要留言卖家后进行自助采摘' : '您已支付成功,您所购买的商品正在向您飞奔, 请耐心等待!'}}</view>
+		<view v-if="!goodType" class="pay-text">3秒后自动跳转订单详情...</view>
 		<view class="pay-handle">
-			<u-button type="success" shape="circle" :ripple="true" @click="goToOrderList()" class="button1">查看订单</u-button>
+			<u-button v-if="!goodType" type="success" shape="circle" :ripple="true" @click="goToOrderList()" class="button1">查看订单</u-button>
+			<u-button v-if="goodType" type="success" shape="circle" :ripple="true" @click="goPickVideo()" class="button1">自助采摘</u-button>
 			<u-button type="success" shape="circle" :ripple="true" :hair-line="false" :plain="true" @click="goToIndex()" class="button2">返回首页</u-button>
 		</view>
 	</view>
@@ -20,18 +21,28 @@
 		data() {
 			return {
 			    orderId: '',
-				timeoutID:0
+				timeoutID:0,
+				goodType: '',
+				tenantCode: ''
 			}
 		},
 		onLoad(options) {
 			this.orderId = options.orderId
-			this.timeoutID = setTimeout(() => {
-				uni.redirectTo({
-					url: '/pagesMain/orderDetail?orderId=' + this.orderId + '&orderStatus=' + 2
-				});
-			},3000)
+			this.goodType = options.goodType ? options.goodType : ''
+			this.tenantCode = options.tenantCode ? options.tenantCode : ''
+			if (!this.goodType) {
+				this.autoJump()
+			}
 		},
 		methods: {
+			// 自动跳转页面
+			autoJump() {
+				this.timeoutID = setTimeout(() => {
+					uni.redirectTo({
+						url: '/pagesMain/orderDetail?orderId=' + this.orderId + '&orderStatus=' + 2
+					});
+				},3000)
+			},
 			//  查看订单
 			goToOrderList() {
 				// uni.navigateTo({
@@ -42,6 +53,34 @@
 					 url: '/pagesMain/orderDetail?orderId=' + this.orderId + '&orderStatus=' + 2
 				});
 			},
+			// 跳转自助采摘直播
+			goPickVideo() {
+				var that=this;
+				if(uni.getStorageSync("firstTimeLiveUser")==""){
+					uni.setStorage({
+						key: 'firstTimeLiveUser',
+						data: 1
+					})
+					uni.navigateTo({
+						url: '/pagesGood/pickVideo?orderId=' + that.orderId + '&tenantCode=' + that.tenantCode
+					});
+				}else{
+					wx.getSetting({
+					  success(res) {
+						/*if (!res.authSetting['scope.camera']){
+						  that.show_qx=false;
+						}else*/ 
+						if (!res.authSetting['scope.record']){
+						  that.show_qx=false;
+						}else{
+							uni.navigateTo({
+								url: '/pagesGood/pickVideo?orderId=' + that.orderId + '&tenantCode=' + that.tenantCode
+							});
+						}
+					  }
+					})
+				}
+			},
 			//  返回首页
 			goToIndex() {
 				clearTimeout(this.timeoutID)