shish 6 سال پیش
والد
کامیت
cdad8c58bf
2فایلهای تغییر یافته به همراه16 افزوده شده و 11 حذف شده
  1. 8 0
      mall/src/api/express/index.js
  2. 8 11
      mall/src/pages/order/buy.vue

+ 8 - 0
mall/src/api/express/index.js

@@ -0,0 +1,8 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+/** *
+ * 计算客户的距离和运费
+ */
+export const getUserDistance = data => {
+	return https.get('/express/get-user-distance', data)
+}

+ 8 - 11
mall/src/pages/order/buy.vue

@@ -83,8 +83,8 @@
         <div>
         <div>
           <span>超过</span>
           <span>超过</span>
           <span class="app-price">{{ `${orderShop.freight.first}公里` }}</span>
           <span class="app-price">{{ `${orderShop.freight.first}公里` }}</span>
-          <span>每增加1公里</span>
-          <span class="app-price">{{ `+${orderShop.freight.add}元` }}</span>
+          <span>每增加1公里运费加</span>
+          <span class="app-price">{{ `${orderShop.freight.add}元` }}</span>
         </div>
         </div>
       </div>
       </div>
     </alert-module>
     </alert-module>
@@ -105,6 +105,7 @@ import { calcDistance } from "@/utils/common";
 import { getShopUser } from "@/utils/auth";
 import { getShopUser } from "@/utils/auth";
 import { getOrderShop } from "@/utils/config";
 import { getOrderShop } from "@/utils/config";
 import { createOrder } from "@/api/order";
 import { createOrder } from "@/api/order";
+import { getUserDistance } from "@/api/express";
 export default {
 export default {
   name: "order-buy",
   name: "order-buy",
   components: {
   components: {
@@ -151,8 +152,7 @@ export default {
       goodsNum: 1
       goodsNum: 1
     };
     };
   },
   },
-  mounted() {
-  },
+  mounted() {},
   computed: {
   computed: {
     ...mapGetters({ orderShop: "getOrderShop" }),
     ...mapGetters({ orderShop: "getOrderShop" }),
     ...mapGetters({ shopUser: "getShopUser" }),
     ...mapGetters({ shopUser: "getShopUser" }),
@@ -242,12 +242,9 @@ export default {
     },
     },
     // 选择地址
     // 选择地址
     changeAddress(e) {
     changeAddress(e) {
-      // 计算距离价格
-      this.freightPrice = calcDistance(
-        this.orderShop.shop,
-        this.$refs.appDelivery.region,
-        this.orderShop.freight
-      );
+      // 计算客户距离和运费
+      //this.$refs.appDelivery.region.location
+      getUserDistance({lat:1,lng:20}).then(res => {});
     },
     },
     // 表单验证
     // 表单验证
     formSubmit(e) {
     formSubmit(e) {
@@ -360,4 +357,4 @@ export default {
     margin: 10px 0;
     margin: 10px 0;
   }
   }
 }
 }
-</style>
+</style>