app-my-order.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="app-my-order" :style="{background: backgroundColor}"
  3. :class="[!margin?'no-margin':'', !round?'no-round':'',]">
  4. <app-form-id @click="goUrl('/pages/order/index/index')">
  5. <view class="dir-left-nowrap cross-center title">
  6. <view class="box-grow-1">我的订单</view>
  7. <view class="box-grow-0 more">查看更多</view>
  8. <view class="box-grow-0">
  9. <image class="arrow" src="/static/image/icon/arrow-right.png"></image>
  10. </view>
  11. </view>
  12. </app-form-id>
  13. <view class="dir-left-nowrap main-around nav-list">
  14. <view class="box-grow-0"
  15. v-for="(item,index) in order_bar"
  16. :key="index"
  17. :style="{
  18. width: (100/order_bar.length) + '%',
  19. }">
  20. <app-form-id @click="goUrl(item.link_url, item.open_type)">
  21. <view class="nav-item">
  22. <view class="text" :class="[`${theme}-background`]"
  23. v-if="item.num && item.num !== '' && item.num !== null && item.num !== 0 && item.num !== '0'">
  24. {{item.num}}
  25. </view>
  26. <view>
  27. <image class="icon" :src="item.icon_url"></image>
  28. </view>
  29. <view class="name">{{item.name}}</view>
  30. </view>
  31. </app-form-id>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {mapState} from 'vuex';
  38. export default {
  39. name: 'app-my-order',
  40. props: {
  41. order_bar: {
  42. type: Array,
  43. default: [],
  44. },
  45. backgroundColor: {
  46. type: String,
  47. default() {
  48. return '#ffffff'
  49. }
  50. },
  51. margin: {
  52. type: Boolean,
  53. default: false,
  54. },
  55. round: {
  56. type: Boolean,
  57. default: false,
  58. },
  59. },
  60. computed: {
  61. ...mapState({
  62. theme: state => state.mallConfig.theme,
  63. }),
  64. },
  65. methods: {
  66. goUrl(url, openType = 'navigate') {
  67. switch (openType) {
  68. case 'navigate':
  69. uni.navigateTo({
  70. url: url,
  71. });
  72. break;
  73. case 'redirect':
  74. uni.redirectTo({
  75. url: url,
  76. });
  77. break;
  78. default:
  79. uni.navigateTo({
  80. url: url,
  81. });
  82. break;
  83. }
  84. },
  85. }
  86. }
  87. </script>
  88. <style scoped lang="scss">
  89. .app-my-order.no-margin {
  90. width: 100%;
  91. margin: 0 auto;
  92. box-shadow: none;
  93. }
  94. .app-my-order.no-round {
  95. border-radius: 0;
  96. }
  97. .app-my-order {
  98. width: #{702rpx};
  99. border-radius: #{16rpx};
  100. margin: #{24rpx} auto;
  101. box-shadow: 0 0 #{8rpx} rgba(0, 0, 0, .05);
  102. .title {
  103. padding: #{32rpx} #{32rpx} #{16rpx};
  104. .more {
  105. color: $uni-general-color-two;
  106. margin-right: #{12rpx};
  107. }
  108. .arrow {
  109. width: #{12rpx};
  110. height: #{22rpx};
  111. }
  112. }
  113. .nav-list {
  114. padding: 0 0 #{24rpx};
  115. .nav-item {
  116. padding: #{16rpx};
  117. text-align: center;
  118. position: relative;
  119. .text {
  120. position: absolute;
  121. top: 0;
  122. right: #{24rpx};
  123. border-radius: #{1000rpx};
  124. font-size: $uni-font-size-weak-two;
  125. height: #{32rpx};
  126. line-height: #{32rpx};
  127. min-width: #{32rpx};
  128. text-align: center;
  129. padding: 0 #{8rpx};
  130. z-index: 10;
  131. }
  132. .icon {
  133. width: #{60rpx};
  134. height: #{60rpx};
  135. display: block;
  136. margin: 0 auto #{20rpx};
  137. }
  138. .name {
  139. font-size: $uni-font-size-weak-one;
  140. color: $uni-general-color-one;
  141. white-space: nowrap;
  142. overflow: hidden;
  143. text-overflow: ellipsis;
  144. line-height: 1;
  145. }
  146. }
  147. }
  148. }
  149. </style>