app-my-order.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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"
  23. :class="theme+ '-m-back ' + theme"
  24. v-if="item.num && item.num !== '' && item.num !== null && item.num !== 0 && item.num !== '0'">
  25. {{item.num}}
  26. </view>
  27. <view>
  28. <image class="icon" :src="item.icon_url"></image>
  29. </view>
  30. <view class="name">{{item.name}}</view>
  31. </view>
  32. </app-form-id>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  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. theme: String
  60. },
  61. methods: {
  62. goUrl(url, openType = 'navigate') {
  63. switch (openType) {
  64. case 'navigate':
  65. uni.navigateTo({
  66. url: url,
  67. });
  68. break;
  69. case 'redirect':
  70. uni.redirectTo({
  71. url: url,
  72. });
  73. break;
  74. default:
  75. uni.navigateTo({
  76. url: url,
  77. });
  78. break;
  79. }
  80. },
  81. }
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. .app-my-order.no-margin {
  86. width: 100%;
  87. margin: 0 auto;
  88. box-shadow: none;
  89. }
  90. .app-my-order.no-round {
  91. border-radius: 0;
  92. }
  93. .app-my-order {
  94. width: #{702rpx};
  95. border-radius: #{16rpx};
  96. margin: #{24rpx} auto;
  97. box-shadow: 0 0 #{8rpx} rgba(0, 0, 0, .05);
  98. .title {
  99. padding: #{32rpx} #{32rpx} #{16rpx};
  100. .more {
  101. color: $uni-general-color-two;
  102. margin-right: #{12rpx};
  103. }
  104. .arrow {
  105. width: #{12rpx};
  106. height: #{22rpx};
  107. }
  108. }
  109. .nav-list {
  110. padding: 0 0 #{24rpx};
  111. .nav-item {
  112. padding: #{16rpx};
  113. text-align: center;
  114. position: relative;
  115. .text {
  116. position: absolute;
  117. top: 0;
  118. right: #{24rpx};
  119. border-radius: #{1000rpx};
  120. font-size: $uni-font-size-weak-two;
  121. height: #{32rpx};
  122. line-height: #{32rpx};
  123. min-width: #{32rpx};
  124. text-align: center;
  125. padding: 0 #{8rpx};
  126. z-index: 10;
  127. color: #ffffff;
  128. }
  129. .icon {
  130. width: #{60rpx};
  131. height: #{60rpx};
  132. display: block;
  133. margin: 0 auto #{20rpx};
  134. }
  135. .name {
  136. font-size: $uni-font-size-weak-one;
  137. color: $uni-general-color-one;
  138. white-space: nowrap;
  139. overflow: hidden;
  140. text-overflow: ellipsis;
  141. line-height: 1;
  142. }
  143. }
  144. }
  145. }
  146. </style>