如何汇总所有购物车数据?使用Ionic 3和Firebase

时间:2019-03-15 01:16:47

标签: firebase ionic-framework firebase-realtime-database ionic3 angularfire2

This is my Mobile cart

我想汇总或合并购物车中的所有数据,并在按提交顺序后将其传递到另一个列表中。

This is my firebase

我想要做的是,在合并购物车中的所有数据之后,我希望将其传递到“放置”表上。

example output

此示例输出将放置在“放置”表上。

我的Cart.html

 <ion-list *ngFor="let item of orderList$ | async">
    <ion-item>
      <ion-label text-wrap>
        <h2 style="font-weight: bold">{{item?.name}}</h2>
       <!-- <ion-input type="hidden"  [(ngModel)]="placed.name" [value]="item?.price">{{item?.name}}</ion-input>-->
        <p  style="color: black">Quantity :  {{item?.qty}}</p>
        <!--<ion-input type="hidden"  [(ngModel)]="placed.qty" [value]="item?.qty">{{item?.qty}}</ion-input>-->
         <p style="color: black">Price :  {{item?.price}}</p>
         <p class="pr" style="font-weight: bold; color: black">Total :</p><p class="pr" style="color: red"> {{item?.total}}</p>
         <button ion-button block clear color="default" navPush="EditCartPage" [navParams]="{item : item}" >Delete Order</button>
      </ion-label>

    </ion-item>
  </ion-list>
  <p style="color: black">Vat : {{vatTotal}}</p>
  <p style="color: black">Item Total : {{priceTotal}}</p>
  <label>Total :</label>
  <ion-input type="number"  [value]="vatTotal + priceTotal" required="true" disabled="true" style="font-size: 18px;">{{vatTotal + priceTotal}}</ion-input>
  <button ion-button block clear navPush="PlacedPage" [navParams]="{item : item}">Submit Order</button>

this is my cart.ts file

这是我的ts文件的图片,在这里我禁用了代码,因为它不起作用

或者有没有其他方法可以汇总数据了?我也可以通过其他方式或建议来获取数据

0 个答案:

没有答案