洪海涛 8 жил өмнө
parent
commit
d69350618b

+ 32 - 4
www/vue/src/components/pay.vue

@@ -11,12 +11,16 @@
 		<group>
 			<a href="javascript:void(0)" class="pay-option checked" data-value="wx_pub"> <i class="icon-weixin"></i> 微信支付 </a>
 		</group>
-		<div class="btn">确认支付</div>
+		<div class="btn" @click="btnPay">确认支付</div>
 	</div>
 </template>
 
 <script>
   import {CheckIcon, Group} from 'vux'
+  import axios from 'axios'
+  import config from '../config/config'
+  //  import api from '../config/api'
+  import qs from 'qs'
   export default {
     data () {
       return {
@@ -29,9 +33,33 @@
       Group
     },
     created () {
-      console.log(this.$route.query.payRecharge)
-      this.orderType = this.$route.query.payRecharge.products
-      this.payType = this.$route.query.payRecharge.final_price
+      console.log(this.$route.query.payRecharge !== {})
+      if (this.$route.query.payRecharge !== {}) {
+        this.orderType = this.$route.query.payRecharge.products
+        this.payType = this.$route.query.payRecharge.final_price
+      }
+    },
+    methods: {
+      btnPay () {
+        if (this.$route.query.payRecharge !== {}) {
+          let payRecharge = {
+            user_id: config.userId,
+            order_id: this.$route.query.payRecharge.order_id,
+            pay_channel: 'wx_pub'
+          }
+          axios.post('o2o/recharge/payRecharge', qs.stringify(payRecharge)).then(res => {
+            console.log(res.data.data.credential.wx_pub)
+//            window.location.href = 'http://common.yiguanjia.me/webapp/o2o/module/pay/index.html?appId=' +
+//              option.appId + '&nonceStr=' + option.nonceStr +
+//              '&package=' + prepay + '&signType=' +
+//              option.signType + '&timeStamp=' +
+//              option.timeStamp + '&paySign=' +
+//              option.paySign + '&amount=' + wxPay.amount +
+//              '&created=' + wxPay.created + '&body=' +
+//              wxPay.body + '&bookingTime=' + bookingTime
+          })
+        }
+      }
     }
   }
 </script>

+ 13 - 1
www/vue/src/components/recharge.vue

@@ -245,7 +245,19 @@
 		transition: all 2s;
 		margin-top: 10px;
 	}
-	
+	@media (max-width: 320px) {
+		ul {
+			li.media {
+				&:nth-child(5) {
+					padding: 10px 0;
+					input{
+						margin-top: -15px;
+						width: 35%;
+					}
+				}
+			}
+		}
+	}
 	/*动画*/
 	.slide {
 		padding: 0 20px;