Просмотр исходного кода

tMerge branch 'zhongqi-intraCityExpress'

shish 11 месяцев назад
Родитель
Сommit
e8652f953d
1 измененных файлов с 16 добавлено и 8 удалено
  1. 16 8
      mallApp/src/pages/order/buy.vue

+ 16 - 8
mallApp/src/pages/order/buy.vue

@@ -30,7 +30,8 @@
         </tui-list-cell>
         <tui-list-cell class="line-cell" :hover="false">
             <view class="tui-title">运费</view>
-            <view class="tui-input">¥{{ freightPrice?parseFloat(freightPrice):0 }}</view>
+            <view class="tui-input" v-if="isFreight">¥{{ freightPrice?parseFloat(freightPrice):0 }}</view>
+            <view class="tui-input" v-else>免运费(¥{{ freightPrice?parseFloat(freightPrice):0 }})</view>
         </tui-list-cell>
       </view>
       <view style="height:90upx;"> </view>
@@ -69,7 +70,7 @@ export default {
       option: {},
       goodsInfo: {},
       form: {
-        sendDistance:"",
+        sendDistance:0,
         sendCost: 0,
         goodsId: "",
         goodsStyleId: "",
@@ -79,10 +80,12 @@ export default {
         lat:'',
         long:''
       },
-      freightPrice: 0,
+      freightPrice: 0, // 配送费
       showDistance: 0,
       goodsTotalPrice: 0,
-      hasMap: 0 // 是否具备定位功能 0不具备 1具备
+      hasMap: 0, // 是否具备定位功能 0不具备 1具备
+      // 是否收配送费
+      isFreight: false,
     };
   },
   onLoad(option) {
@@ -92,13 +95,17 @@ export default {
   computed: {
     mayPayAmount(){
       let price = (this.goodsInfo.price || 0) * (this.goodsInfo.buyNum || 0)
-      price = Number(this.freightPrice)+Number(price)
+      // 收配送费时,商品价格加上配送费
+      if(this.isFreight){
+        price = Number(this.freightPrice)+Number(price)
+      }
       return parseFloat(price.toFixed(2))
     }
   },
   methods: {
     init() {
       let goodsInfo = uni.getStorageSync("buyGoodsDetil") || {}
+      this.isFreight = goodsInfo.freightType == '0'
 
       getOrderShop()
       getShopUser();
@@ -180,7 +187,7 @@ export default {
             this.freightPrice = data.est_fee ? parseFloat(Number(data.est_fee/100)) : 0;
             this.showDistance = (data.distance/1000 || 0).toFixed(2);
             this.form.sendDistance = (data.distance/1000 || 0).toFixed(2);
-            this.form.sendCost = this.freightPrice
+            this.form.sendCost = this.isFreight ? this.freightPrice : 0
           }
         }).catch(() => {});
       } catch (e) {}
@@ -195,7 +202,7 @@ export default {
           this.$msg('由于地图定位服务停用,无法使用代叫跑腿')
           return
         }
-        if(this.form.freightPrice <= 0) {
+        if(this.freightPrice <= 0 && this.isFreight) {
           this.$msg('选择代叫跑腿,必须获取运费')
           return
         }
@@ -227,10 +234,11 @@ export default {
       createOrder({...form, ...this.form,hdId:hdId}).then(res => {
         uni.hideLoading()
         uni.removeStorageSync("buyGoodsDetil")
+
         this.$util.pageTo({ 
           url: "/pages/callback/pay",
           type: 2,
-          query: { pageStatus: 1, ...res.data, hdId:hdId, account:account, freightPrice: this.freightPrice } 
+          query: { pageStatus: 1, ...res.data, hdId:hdId, account:account } 
         })
       }).catch(()=>{
         uni.hideLoading()