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

fix:提交订单-待支付价格计算 改用后端返回

DaMoWang 2 лет назад
Родитель
Сommit
c8c6be89dd
1 измененных файлов с 10 добавлено и 15 удалено
  1. 10 15
      src/pages/to-pay-list/index.vue

+ 10 - 15
src/pages/to-pay-list/index.vue

@@ -104,7 +104,7 @@
       </view>
       <view
         class="order_list flex_r flex_ac flex_jb"
-        v-if="Data.type != 4 && Data.type != 5"
+        v-if="['1','2','3'].includes(Data.type)"
       >
         <view class="list_name">可用余额</view>
         <view class="list_con p_color">¥{{ userinfo.user_money }}</view>
@@ -167,24 +167,19 @@ export default {
       post("goods/goodsDetail", da).then((res) => {
         if (res.code === 0) {
           this.goodsInfo = res.data.data;
+          this.obligation = res.data.data.pickerPrice.price;
           post("goods/freight", { type: da.type }).then((res) => {
             if (res.code === 0) this.freight = res.data.freight;
 
             // 计算待支付
-            let p =
-              this.Data.type == 2
-                ? this.goodsInfo.trade_price
-                : this.goodsInfo.cost_price; //商品单价
-            let y = this.Data.is_sell == 1 ? 0 : this.freight; // 运费   寄售的话退运费为0
-            if(this.Data.prom_type == "1"){
-              y = 0
-            }
-            let a = (p * this.Data.num + y * this.Data.num) * 100; //商品总价
-            let b = (a - this.userinfo.user_money * 100) / 100; //待支付金额
-            if (["4", "6"].includes(this.Data.type)) this.obligation = a / 100;
-            else if (this.Data.type == 5) {
-              this.obligation = a / 100;
-            } else this.obligation = b > 0 ? b : 0;
+            // let p = this.Data.type == 2 ? this.goodsInfo.trade_price : this.goodsInfo.cost_price; //商品单价
+            // let y = (this.Data.is_sell == 1 || this.Data.prom_type == 1) ? 0 : this.freight; // 运费   寄售的话退运费为0
+            // // let a = p * this.Data.num + y * this.Data.num; //商品总价
+            // // let b = a - this.userinfo.user_money; //待支付金额
+            // let a = this.$h.Mul(p,this.Data.num) + this.$h.Mul(y,this.Data.num); //商品总价
+            // let b = this.$h.Sub(a,this.userinfo.user_money); //待支付金额
+            // if (["4", "5", "6"].includes(this.Data.type)) this.obligation = a;
+            // else this.obligation = b > 0 ? b : 0;
           });
         }
       });