Browse Source

商品列表、购物车展示税率、税额

kevin_zhangl 3 years ago
parent
commit
901171b7de
2 changed files with 27 additions and 1 deletions
  1. 13 0
      frontendEle/src/views/shop/index.vue
  2. 14 1
      frontendEle/src/views/shop/order.vue

+ 13 - 0
frontendEle/src/views/shop/index.vue

@@ -33,6 +33,19 @@
                               <span>{{ Math.round(scope.row.PRICE_PV * 100) / 100 }}</span>
                           </template>
                       </el-table-column>
+
+                      <el-table-column label="税率" prop="TAX_RATE"><!--税率-->
+                          <template slot-scope="scope">
+                              <span>{{ Math.round(scope.row.TAX_RATE * 100) / 100 }}</span>
+                          </template>
+                      </el-table-column>
+
+                      <el-table-column label="税额"><!--税额-->
+                          <template slot-scope="scope">
+                              <span>{{ Math.round((scope.row.SELL_PRICE - scope.row.SELL_PRICE / (1 + scope.row.TAX_RATE / 100)) * 100) / 100 }}</span>
+                          </template>
+                      </el-table-column>
+
                       <el-table-column label="Inventory" prop="STORE_NUMS"><!--库存-->
                       </el-table-column>
 

+ 14 - 1
frontendEle/src/views/shop/order.vue

@@ -27,6 +27,17 @@
                             <span>{{ Math.round(scope.row.member_pv * 100) / 100 }}</span>
                         </template>
                     </el-table-column>
+                    <el-table-column label="税率" prop="TAX_RATE"><!--税率-->
+                        <template slot-scope="scope">
+                            <span>{{ Math.round(scope.row.TAX_RATE * 100) / 100 }}</span>
+                        </template>
+                    </el-table-column>
+
+                    <el-table-column label="税额" prop="tax_amount_plus"><!--税额-->
+                      <template slot-scope="scope">
+                        <span>{{ Math.round(scope.row.tax_amount_plus * 100) / 100 }}</span>
+                      </template>
+                    </el-table-column>
 <!--                    <el-table-column label="库存" prop="STORE_NUMS">-->
 <!--                    </el-table-column>-->
 
@@ -252,6 +263,8 @@
                             pageData.member_pv = Math.round(pageData.PRICE_PV * discount * 100) / 100;
                             pageData.member_pv_plus = Math.round(pageData.PRICE_PV * Number(pageData.chose_num) * discount * 100) / 100;
 
+                            pageData.tax_amount_plus = Math.round((pageData.member_price - pageData.member_price / (1 + pageData.TAX_RATE / 100)) * pageData.chose_num * 100) / 100;
+
                             this.goods.push(pageData)
                         }
                     })
@@ -288,7 +301,7 @@
                   return;
                 }
                 const values = data.map(item => Number(item[column.property]));
-                if ((!values.every(value => isNaN(value))) && [4, 5, 6].includes(index)) {
+                if ((!values.every(value => isNaN(value))) && [5, 6, 7, 8].includes(index)) {
                   sums[index] = values.reduce((prev, curr) => {
                     const value = Number(curr);
                     if (!isNaN(value)) {