north 8 жил өмнө
parent
commit
ce38478eb3

+ 8 - 4
www/vue/src/components/product.vue

@@ -1,5 +1,6 @@
 <template>
 <template>
   <div class="product">
   <div class="product">
+    <router-link to="/order">返回</router-link>
     <!--extra-->
     <!--extra-->
     <div class="extra">
     <div class="extra">
       <div v-if="extraB" v-for="(itemExtra,index) in productBox.extra">
       <div v-if="extraB" v-for="(itemExtra,index) in productBox.extra">
@@ -32,8 +33,11 @@
       }
       }
     },
     },
 
 
-    create () {
-      console.log(this.productBox)
+    created () {
+      if (typeof(this.$route.query.productBox) ) {
+        config.productInfo = this.$route.query.productBox
+        console.log(config.productInfo)
+      }
     },
     },
     computed: mapState({
     computed: mapState({
       order: state => state.order,
       order: state => state.order,
@@ -56,7 +60,7 @@
           count: '1' // 产品数量
           count: '1' // 产品数量
         }])
         }])
         //  let coupons = qs.stringify({0: '5836a1979f5160a7048b5a51'})
         //  let coupons = qs.stringify({0: '5836a1979f5160a7048b5a51'})
-        let coupons = JSON.stringify({0: '594b78a09f5160c7048b697c'})
+        //  let coupons = JSON.stringify({0: ''})
         console.log(productParamJson)
         console.log(productParamJson)
         let extraJson = ''
         let extraJson = ''
         extraJson = JSON.stringify([{type: '整间日常清洁', price: '388'}])
         extraJson = JSON.stringify([{type: '整间日常清洁', price: '388'}])
@@ -87,7 +91,7 @@
           user_id: config.userId,
           user_id: config.userId,
           address_id: addressId,
           address_id: addressId,
           station: '57db39709f5160bb048b456a',
           station: '57db39709f5160bb048b456a',
-          coupons: coupons,
+          //  coupons: coupons,
           counts: 1,
           counts: 1,
           extra: extraJson
           extra: extraJson
         }
         }

+ 34 - 35
www/vue/src/config/api.js

@@ -1,7 +1,7 @@
 import axios from 'axios'
 import axios from 'axios'
 import config from './config'
 import config from './config'
 import qs from 'qs'
 import qs from 'qs'
-//  import pingpp from '../../../webapp/common/js/pingpp'
+import pingpp from '../../../webapp/common/js/pingpp'
 // let apiPath = 'http://commontest.yiguanjia.me/index.php?r='
 // let apiPath = 'http://commontest.yiguanjia.me/index.php?r='
 
 
 export default ({
 export default ({
@@ -61,41 +61,40 @@ export default ({
           console.log(61)
           console.log(61)
           console.log(res.data)
           console.log(res.data)
           // let WxPay = res.data
           // let WxPay = res.data
-          /*  if (false) {
-           pingpp.createPayment(res.data.data, function (result, err) {
-           if (result === 'success') {
-           // 只有微信公众账号 wx_pub 支付成功的结果会在这里返回,其他的支付结果都会跳转到 extra 中对应的 URL。
-           var res = {
-           success: true
-           }
-           console.log(res)
-           } else if (result === 'fail') {
-           // charge 不正确或者微信公众账号支付失败时会在此处返回
-           console.log(err)
-           } else if (result === 'cancel') {
-           // 微信公众账号支付取消支付
-           console.log(err)
-           }
-           })
-           } else {
-           */
-          // window.location.href='http://commontest.yiguanjia.me/index.php?r=o2o/web/index';
-          // 支付凭据
-          console.log(82)
-          let wxPay = res.data.data
-          console.log(wxPay.credential)
-          let option = wxPay.credential.wx_pub
+          if (!config.test) {
+            pingpp.createPayment(res.data.data, function (result, err) {
+              if (result === 'success') {
+                // 只有微信公众账号 wx_pub 支付成功的结果会在这里返回,其他的支付结果都会跳转到 extra 中对应的 URL。
+                var res = {
+                  success: true
+                }
+                console.log(res)
+              } else if (result === 'fail') {
+                // charge 不正确或者微信公众账号支付失败时会在此处返回
+                console.log(err)
+              } else if (result === 'cancel') {
+                // 微信公众账号支付取消支付
+                console.log(err)
+              }
+            })
+          } else {
+            // window.location.href='http://commontest.yiguanjia.me/index.php?r=o2o/web/index';
+            // 支付凭据
+            console.log(82)
+            let wxPay = res.data.data
+            console.log(wxPay.credential)
+            let option = wxPay.credential.wx_pub
 
 
-          let prepay = option['package'].replace('prepay_id=', '')
-          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
-          //  }
+            let prepay = option['package'].replace('prepay_id=', '')
+            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
+          }
 
 
           //  cb(tmp)
           //  cb(tmp)
         }).catch(function (e) {
         }).catch(function (e) {

+ 3 - 1
www/vue/src/config/config.js

@@ -5,6 +5,7 @@ let test = true
 var userId = ''
 var userId = ''
 var formData = ''
 var formData = ''
 var orderInfo = []
 var orderInfo = []
+var productInfo = {}
 if (uri.indexOf('common.yiguanjia.me') > -1) {
 if (uri.indexOf('common.yiguanjia.me') > -1) {
   test = false
   test = false
 }
 }
@@ -31,5 +32,6 @@ export default {
   userId: userId,
   userId: userId,
   formData: formData,
   formData: formData,
   orderInfo: orderInfo,
   orderInfo: orderInfo,
-  test: test
+  test: test,
+  productInfo: productInfo
 }
 }

+ 12 - 0
www/webapp/o2o/module/pay/index.html

@@ -289,6 +289,18 @@
 </div>
 </div>
 <script src="../../../common/js/zepto.min.js"></script>
 <script src="../../../common/js/zepto.min.js"></script>
 <script>
 <script>
+  $(document).ready(function(e) {
+    var counter = 0;
+    if (window.history && window.history.pushState) {
+      $(window).on('popstate', function () {
+        window.history.pushState('forward', null, '#');
+        window.history.forward(1);
+        location.href="http://common.yiguanjia.me/index.php?r=o2o/web/index";
+      });
+    }
+    window.history.pushState('forward', null, '#'); //在IE中必须得有这两行
+    window.history.forward(1);
+  });
   if (location.search.length > 1) {
   if (location.search.length > 1) {
     var urlParam = {};
     var urlParam = {};
     // 循环遍历WebApp通过url传过来的参数,赋值给urlParam
     // 循环遍历WebApp通过url传过来的参数,赋值给urlParam