index.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="">
  3. <u-popup :customStyle="{ backgroundColor: '#f4f4f4' }" :show="popShow" :round="10" mode="bottom" @close="popShow = false" closeable>
  4. <view class="popCon o-plr-30 o-pt-20 o-pb-40">
  5. <view class="l-flex-center c-text-20">金额明细</view>
  6. <view class="content">
  7. <view class="l-flex-between o-mt-20">
  8. <text class="c-text-12">商品总价</text>
  9. <text class="c-color-MR c-text-12">¥{{ allDiscounts.allPrice }}</text>
  10. </view>
  11. <view class="l-flex-between o-mt-20">
  12. <text class="c-text-12">共减</text>
  13. <text class="c-color-MR c-text-12">¥{{ allDiscounts.discountPrices }}</text>
  14. </view>
  15. <!-- <block v-for="(value, key, index) in goodsDiscDetail">
  16. <view v-if="value != 0" class="l-flex-between o-mt-20 o-plr-30">
  17. <text class="c-text-12 c-color-8">{{ key }}</text>
  18. <text class="c-text-12 c-color-MR">¥{{ value }}</text>
  19. </view>
  20. </block> -->
  21. <view class="l-flex-between o-mt-20">
  22. <text class="c-text-12">合计</text>
  23. <text class="c-color-MR c-text-12">¥{{ allDiscounts.totalPrice }}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </u-popup>
  28. </view>
  29. </template>
  30. <script>
  31. /**
  32. * discountPop 金额明细弹窗组件
  33. * @description 本组件主要是金额明细弹窗。
  34. *
  35. * @property {Boolean} popShow 是否展示弹窗
  36. *
  37. */
  38. export default {
  39. data() {
  40. return {
  41. // 是否展示弹窗
  42. popShow: false,
  43. shopsData: [],
  44. allDiscounts: {}
  45. };
  46. },
  47. // computed: {
  48. // goodsDiscDetail() {
  49. // let discDetail = {};
  50. // if (this.shopsData.length > 0) {
  51. // this.shopsData.forEach(item => {
  52. // if (item.isCheck) {
  53. // if (!discDetail[item.imgName]) {
  54. // discDetail[item.imgName] = item.discountList.reduce((prev, cur) => {
  55. // return this.$M_Big(prev)
  56. // .add(cur)
  57. // .toNumber();
  58. // }, 0);
  59. // }
  60. // }
  61. // });
  62. // }
  63. // console.log('各种商品的优惠', discDetail);
  64. // return discDetail;
  65. // }
  66. // },
  67. methods: {
  68. // 开启弹窗
  69. popOpen(shopsData, allDiscounts) {
  70. // 算出总价格
  71. allDiscounts.allPrice = this.$M_Big(allDiscounts.totalPrice)
  72. .add(allDiscounts.discountPrices)
  73. .toNumber();
  74. this.allDiscounts = allDiscounts;
  75. this.shopsData = shopsData;
  76. this.popShow = true;
  77. }
  78. }
  79. };
  80. </script>
  81. <style lang="scss" scoped></style>