index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="orderGoods borRadius14">
  3. <view class="total"
  4. >共{{ orderProNum ? orderProNum : totalNmu }}件商品</view
  5. >
  6. <view class="goodWrapper pad30">
  7. <view
  8. class="item acea-row row-between-wrapper"
  9. v-for="(item, index) in cartInfo"
  10. :key="index"
  11. @click="jumpCon(item.productId)"
  12. >
  13. <view class="pictrue">
  14. <image :src="item.image"></image>
  15. </view>
  16. <view class="text">
  17. <view class="acea-row row-between-wrapper">
  18. <view class="name line1">
  19. {{ item.productName ? item.productName : item.storeName }}
  20. </view>
  21. <view class="num">
  22. x {{ item.payNum ? item.payNum : item.cartNum }}
  23. </view>
  24. </view>
  25. <view class="attr line1" v-if="item.sku">属性: {{ item.sku }}</view>
  26. <view v-if="mallType === 0" class="money font-color">
  27. ¥{{ Number(item.storePrice).toFixed(2) }}
  28. </view>
  29. <view v-else class="money font-color">
  30. 贝币:{{ Number(item.storePrice).toFixed(2) }}
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup>
  38. import { ref, watch } from "vue";
  39. const props = defineProps({
  40. evaluate: {
  41. type: Number,
  42. default: 0,
  43. },
  44. mallType: {
  45. type: Number,
  46. default: 0, // 0: 水贝商城, 1: 贝币商城
  47. },
  48. cartInfo: {
  49. type: Array,
  50. default: () => [],
  51. },
  52. orderId: {
  53. type: String,
  54. default: "",
  55. },
  56. ids: {
  57. type: Number,
  58. default: 0,
  59. },
  60. jump: {
  61. type: Boolean,
  62. default: false,
  63. },
  64. orderProNum: {
  65. type: Number,
  66. default: 0,
  67. },
  68. productType: {
  69. type: Number,
  70. default: 0,
  71. },
  72. });
  73. const totalNmu = ref("");
  74. watch(
  75. () => props.cartInfo,
  76. (nVal) => {
  77. let num = 0;
  78. nVal.forEach((item) => {
  79. num += item.cartNum;
  80. });
  81. totalNmu.value = num;
  82. },
  83. { immediate: true }
  84. );
  85. function evaluateTap(item) {
  86. uni.navigateTo({
  87. url: `/pages/users/goods_comment_con/index?unique=${item.attrId}&orderId=${props.orderId}&id=${props.ids}`,
  88. });
  89. }
  90. function jumpCon(id) {
  91. let type = props.productType == 0 ? "normal" : "video";
  92. if (props.jump) {
  93. uni.navigateTo({
  94. url: `/pages/goods_details/index?id=${id}&type=${type}`,
  95. });
  96. }
  97. }
  98. </script>
  99. <style scoped lang="scss">
  100. .orderGoods {
  101. background-color: #fff;
  102. margin-top: 15rpx;
  103. }
  104. .orderGoods .total {
  105. width: 100%;
  106. height: 86rpx;
  107. padding: 0 24rpx;
  108. border-bottom: 2rpx solid #f0f0f0;
  109. font-size: 30rpx;
  110. color: #282828;
  111. line-height: 86rpx;
  112. box-sizing: border-box;
  113. }
  114. .pictrue image {
  115. background: #f4f4f4;
  116. }
  117. </style>