index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="orderGoods borRadius14">
  3. <view class='total'>共{{ totalNmu }}件商品</view>
  4. <view class='goodWrapper pad30'>
  5. <view class='item acea-row row-between-wrapper' v-for="(item,index) in cartInfo" :key="index"
  6. @click="jumpCon(item.spuId)">
  7. <view class='pictrue'>
  8. <image :src='item.picUrl' />
  9. </view>
  10. <view class='text'>
  11. <view class='acea-row row-between-wrapper'>
  12. <view class='name line1'>{{ item.spuName }}</view>
  13. <view class='num'>x {{ item.count }}</view>
  14. </view>
  15. <view class='attr line1'>
  16. <text v-for="(property, propertyIndex) in item.properties" :key="propertyIndex" style="padding-right: 10rpx;">
  17. {{ property.valueName }} 
  18. </text>
  19. </view>
  20. <view class='money font-color'>¥{{ fen2yuan(item.price) }}</view>
  21. <!-- 售后状态 -->
  22. <!-- TODO 芋艿:这样式不太合理;应该顺着向右对齐 -->
  23. <view class="evaluate" style="right: 60px;" v-if="afterSale" @click.stop="afterSaleTap(item)">
  24. {{
  25. item.afterSaleStatus === 0 ? '申请退款' :
  26. item.afterSaleStatus === 10 ? '退款中' : '退款成功'
  27. }}
  28. </view>
  29. <!-- 评价状态 -->
  30. <view class='evaluate' v-if='item.commentStatus === false && evaluate === 2' @click.stop="evaluateTap(item)">评价</view>
  31. <view class='evaluate' v-else-if="item.replyStatus === true">已评价</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import * as Util from '@/utils/util.js';
  39. export default {
  40. props: {
  41. evaluate: {
  42. type: Number,
  43. default: 0, // 是否开启评价功能 0 - 不开启;2 - 开启
  44. },
  45. afterSale: { // 是否开启售后功能
  46. type: Boolean,
  47. default: false,
  48. },
  49. cartInfo: {
  50. type: Array,
  51. default: function() {
  52. return [];
  53. }
  54. },
  55. orderId: {
  56. type: String,
  57. default: '',
  58. },
  59. jump: {
  60. type: Boolean,
  61. default: false,
  62. },
  63. productType: {
  64. type: Number,
  65. default: function() {
  66. return 0;
  67. }
  68. }
  69. },
  70. data() {
  71. return {
  72. totalNmu: 0 // 商品数量
  73. };
  74. },
  75. watch: {
  76. cartInfo: function(nVal, oVal) {
  77. let num = 0
  78. nVal.forEach((item, index) => {
  79. num += item.count
  80. })
  81. this.totalNmu = num
  82. }
  83. },
  84. methods: {
  85. evaluateTap(item) {
  86. uni.navigateTo({
  87. url: "/pages/users/goods_comment_con/index?orderItemId=" + item.id
  88. })
  89. },
  90. afterSaleTap(item) {
  91. if (item.afterSaleStatus === 0) {
  92. uni.navigateTo({
  93. url: "/pages/users/goods_return/index?orderId=" + item.orderId + '&orderItemId=' + item.id
  94. })
  95. return;
  96. }
  97. uni.navigateTo({
  98. url: "/pages/users/user_return_detail/index?id=" + item.afterSaleId
  99. })
  100. },
  101. jumpCon: function(id) {
  102. let type = this.productType === 0 ?'normal':'video'
  103. if (this.jump) {
  104. uni.navigateTo({
  105. url: `/pages/goods_details/index?id=${id}&type=${type}`
  106. })
  107. }
  108. },
  109. fen2yuan(price) {
  110. return Util.fen2yuan(price)
  111. },
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .orderGoods {
  117. background-color: #fff;
  118. margin-top: 15rpx;
  119. }
  120. .orderGoods .total {
  121. width: 100%;
  122. height: 86rpx;
  123. padding: 0 24rpx;
  124. border-bottom: 2rpx solid #f0f0f0;
  125. font-size: 30rpx;
  126. color: #282828;
  127. line-height: 86rpx;
  128. box-sizing: border-box;
  129. }
  130. .pictrue image {
  131. background: #f4f4f4;
  132. }
  133. </style>