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

Merge branch 'master' of http://18.167.157.193:1026/guanli/ngds

theo 3 лет назад
Родитель
Сommit
d5d4ccd532
1 измененных файлов с 42 добавлено и 6 удалено
  1. 42 6
      frontendEle/src/views/shop/index.vue

+ 42 - 6
frontendEle/src/views/shop/index.vue

@@ -60,10 +60,21 @@
                 </el-tab-pane>
             </el-tabs>
             <div class="white-box-footer">
-
-                <el-button @click="goToAccounts()">Check Out</el-button><!--去结算-->
-
-                <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
+                <el-row>
+                  <el-col :span="2">
+                      <el-button type="primary" size="small" @click="goToAccounts()">Check Out</el-button><!--去结算-->
+                  </el-col>
+                  <el-col :span="16">
+                      <div class='flex data' style="flex:1; justify-content: center; line-height: 35px; font-size: 14px;">
+                          <div style="margin-right: 2rem;">Product price:₦ {{ sell_price_sum }}</div><!--商品价格-->
+                          <div style="margin-right: 2rem;">Product BV:{{ price_pv_sum }}</div><!--商品BV-->
+                          <div>Product Tax:₦ {{ tax_sum }}</div><!--商品BV-->
+                      </div>
+                  </el-col>
+                  <el-col :span="6">
+                      <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
+                  </el-col>
+                </el-row>
             </div>
         </div>
     </div>
@@ -103,6 +114,9 @@
                 goodsCategory: '1',
                 goodsActive: [],
                 maxHeight: tool.getTableHeight(),
+                sell_price_sum: 0.00,
+                price_pv_sum: 0.00,
+                tax_sum: 0.00,
             }
         },
         watch: {
@@ -118,7 +132,7 @@
         },
         methods: {
             handleChange(val){
-                console.log(val);
+
             },
             goToAccounts() {
                 if (this.multipleSelection.length <= 0) {
@@ -167,7 +181,27 @@
                     }
                 }
                 this.multipleSelection[this.currentPage] = val;
-                console.log(this.multipleSelection);
+
+                // 计算统计
+                this.handleSureChange()
+            },
+            handleSureChange() {
+                if (this.multipleSelection.length > 0) {
+                    let accumulatorSellPrice = 0, accumulatorPricePv = 0, accumulatorTax = 0;
+                    this.multipleSelection.forEach(item => {
+                        item.forEach(accumulator => { accumulatorSellPrice += accumulator.SELL_PRICE * accumulator.chose_num * accumulator.DISCOUNT / 100; });
+                        item.forEach(accumulator => { accumulatorPricePv += Number(accumulator.PRICE_PV) * Number(accumulator.chose_num) * (Number(accumulator.DISCOUNT) / 100); });
+                        item.forEach(accumulator => { accumulatorTax += tool.calculateTax(Number(accumulator.SELL_PRICE), Number(accumulator.TAX_RATE), Number(accumulator.chose_num)); });
+                    })
+
+                    this.sell_price_sum = parseFloat(accumulatorSellPrice).toFixed(2);
+                    this.price_pv_sum = parseFloat(accumulatorPricePv).toFixed(2);
+                    this.tax_sum = parseFloat(accumulatorTax).toFixed(2);
+                } else {
+                    this.sell_price_sum = 0.00;
+                    this.price_pv_sum = 0.00;
+                    this.tax_sum = 0.00;
+                }
             },
             handleInputNumber(val, row){
                 let pageList = this.multipleSelection[this.currentPage];
@@ -182,6 +216,8 @@
 
                 if( selectStatus ) {
                     this.multipleSelection[this.currentPage] = pageList;
+                  // 计算统计
+                  this.handleSureChange()
                 }
             },
             getScope(scope){