| 
					
				 | 
			
			
				@@ -1,6 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   <zj-page-layout :hasFooter="true"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <view class="address-container" @tap="goAddress"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <view v-if="!pam.orderId && pam" class="address-container" @tap="goAddress"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <view class="left"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <view class="icon"><text class="iconfont icon-dingwei1"></text></view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <view class="nodata" v-if="!hasAddress">选择收货地址</view> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -13,8 +13,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <text class="right iconfont icon-jinru"></text> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <view class="goods-container"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <view class="goods-container" v-if="goodsDetail"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <view class="goods"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <image v-if="goodsDetail.goodsPicUrl" :src="imageUrl + goodsDetail.goodsPicUrl||''"></image> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <view class="main"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,14 +27,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <view class="total">订单总金额<text>¥{{goodsDetail.amount||''}}</text></view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <view v-if="goodsDetail" class="total">订单总金额<text>¥{{goodsDetail.amount||''}}</text></view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <template slot="footer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <view class="bottom-container"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <view class="left"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           实付款:<text>¥{{goodsDetail.amount||''}}</text> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <u-button type="primary" :disabled="!hasAddress" text="提交订单" @click="submitOrder"></u-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <u-button type="primary" :disabled="!hasAddress && !pam.orderId" text="提交订单" @click="submitOrder"></u-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </view> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </zj-page-layout> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,10 +46,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     data() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         imageUrl: this.$imageUrl, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        addressInfo: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         hasAddress: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        pam: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        goodsDetail: {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        addressInfo: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pam: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        goodsDetail: null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     onLoad(pam) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -66,64 +65,76 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       submitOrder() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        api.post('/orderPay/buy', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          goodsId: this.pam.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          userAddress: this.addressInfo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }, false).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          uni.showModal({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            title: '支付查询', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            content: '等待支付结果', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            showCancel: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            confirmText: "订单管理", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            success: () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (this.pam.orderId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          api.postJson('/orderPay/wait/pay', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderId: this.pam.orderId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userId: this.$store.state.user.userId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }, false).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.goPay(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          api.post('/orderPay/buy', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            goodsId: this.pam.goodsId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userAddress: this.addressInfo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }, false).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.goPay(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      goPay(res) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uni.showModal({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          title: '支付查询', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          content: '等待支付结果', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          showCancel: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          confirmText: "订单管理", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          success: () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (this.timeId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              clearTimeout(this.timeId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$navToPage({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              url: '/pages/mine/myBuy/list' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }, "reLaunch") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uni.requestPayment({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          provider: 'wxpay', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          timeStamp: res.data.timeStamp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          nonceStr: res.data.nonceStr, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          package: res.data.payPackage, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          signType: "MD5", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          paySign: res.data.paySign, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          success: () => {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          fail: () => {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          complete: () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var getList = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               if (this.timeId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 clearTimeout(this.timeId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              this.$navToPage({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                url: '/pages/mine/myBuy/list' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              }, "reLaunch") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          uni.requestPayment({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            provider: 'wxpay', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            timeStamp: res.data.timeStamp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            nonceStr: res.data.nonceStr, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            package: res.data.payPackage, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            signType: "MD5", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            paySign: res.data.paySign, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            success: () => {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            fail: () => {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            complete: () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              var getList = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (this.timeId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  clearTimeout(this.timeId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                api.postJson('/orderPay/detail', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  orderId: res.data.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }, false).then(res2 => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  if (res2.data.payStatus === "WAIT") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (this.timeId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      clearTimeout(this.timeId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    this.$navToPage({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      url: '/pages/mine/myBuy/list' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }, "reLaunch") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    this.timeId = setTimeout(getList, 1000) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              api.postJson('/orderPay/detail', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                orderId: res.data.id || this.pam.orderId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }, false).then(res2 => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (res2.data.payStatus === "PAID") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  if (this.timeId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    clearTimeout(this.timeId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              getList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  this.$navToPage({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    url: '/pages/mine/myBuy/list' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  }, "reLaunch") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  this.timeId = setTimeout(getList, 1000) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            getList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       getGoods() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!this.pam.id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!this.pam.goodsId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         api.postJson('/goods/detail', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          id: this.pam.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          id: this.pam.goodsId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, false).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           console.log(res.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.goodsDetail = res.data 
			 |