order.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="order">
  3. <view class="header">
  4. <view class="title">
  5. 订单明细
  6. </view>
  7. <view class="tabs">
  8. <view class="tab-item active">全部</view>
  9. <view class="tab-item">已付款</view>
  10. <view class="tab-item">已完成</view>
  11. </view>
  12. </view>
  13. <view class="order-list">
  14. <view class="order-item" v-for="order in orders">
  15. <view class="order-head">
  16. <view class="factory-name">{{order.factory}}</view>
  17. <view v-if="order.status === 0" class="order-status">待付款</view>
  18. <view v-if="order.status === 2" class="order-status">待收货</view>
  19. </view>
  20. <view class="order-info" @tap="openDetails()">
  21. <view class="product-item" v-for="product in order.products">
  22. <view class="product-image">
  23. <image class="image" :src="product.image" mode="scaleToFill"></image>
  24. </view>
  25. <view class="product-info">
  26. <view class="row">
  27. <view class="name">{{product.name}}</view>
  28. <view class="price">¥{{product.price}}</view>
  29. </view>
  30. <view class="row">
  31. <view class="spec">{{product.specs_name}}</view>
  32. <view class="num">×{{product.specs_num}}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="total-price">
  38. 总价 <text class="warning">¥{{order.total}}</text>
  39. </view>
  40. <view class="option">
  41. <button v-if="order.status === 0" class="pay-btn" type="default">立即支付</button>
  42. <button v-if="order.status === 2" class="confirm-btn" type="default">确认收货</button>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. orders: [{
  53. factory: '省心一号工厂',
  54. products: [{
  55. name: '泰国Mistine小黄帽防晒霜',
  56. image: 'https://img.alicdn.com/i4/2929053804/O1CN01RSromv1dyHBcuS4I6_!!2929053804.jpg',
  57. price: 9.52,
  58. specs_name: "白色",
  59. specs_num: 5
  60. }],
  61. status: 2,
  62. total: '99.51'
  63. }, {
  64. factory: '省心二号工厂',
  65. products: [{
  66. name: '【三只松鼠】元宵送礼坚果礼盒1498g',
  67. image: 'https://img.alicdn.com/i4/880734502/O1CN01tA7hal1j7xjnwHQZC_!!880734502.jpg',
  68. price: 9.52,
  69. specs_name: "白色",
  70. specs_num: 5
  71. },
  72. {
  73. name: '泰国Mistine小黄帽防晒霜',
  74. image: 'https://img.alicdn.com/i4/2929053804/O1CN01RSromv1dyHBcuS4I6_!!2929053804.jpg',
  75. price: 9.52,
  76. specs_name: "白色",
  77. specs_num: 5
  78. }
  79. ],
  80. status: 0,
  81. total: '58.51'
  82. }]
  83. }
  84. },
  85. methods: {
  86. openDetails() {
  87. uni.navigateTo({
  88. url:"order-details"
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. .message {
  96. overflow: hidden;
  97. }
  98. .header {
  99. margin: 20upx;
  100. background: white;
  101. text-align: center;
  102. border-radius: 20upx;
  103. .title {
  104. height: 100upx;
  105. font-size: 30upx;
  106. line-height: 100upx;
  107. // font-weight: bold;
  108. }
  109. .tabs {
  110. display: flex;
  111. justify-content: space-between;
  112. .tab-item {
  113. flex: 1;
  114. padding: 10upx 0;
  115. font-size: 28upx;
  116. color: #999999;
  117. &.active {
  118. background: $primary-color;
  119. color: white;
  120. border-radius: 20upx;
  121. }
  122. }
  123. }
  124. }
  125. .order-list {
  126. .order-item {
  127. background: white;
  128. margin: 20upx;
  129. padding: 20upx;
  130. border-radius: 20upx;
  131. .order-head {
  132. display: flex;
  133. justify-content: space-between;
  134. margin-bottom: 20upx;
  135. .order-status {
  136. color: $primary-color;
  137. font-size: 24upx;
  138. }
  139. }
  140. .factory-name {
  141. font-size: 28upx;
  142. font-weight: bold;
  143. }
  144. .product-item {
  145. display: flex;
  146. .product-image {
  147. width: 120upx;
  148. height: 120upx;
  149. margin-right: 20upx;
  150. margin-top: 10upx;
  151. .image {
  152. width: 120upx;
  153. height: 120upx;
  154. }
  155. }
  156. .product-info {
  157. flex-grow: 1;
  158. font-size: 28upx;
  159. .name {
  160. font-size: 28upx;
  161. white-space: normal;
  162. display: -webkit-box;
  163. -webkit-box-orient: vertical;
  164. -webkit-line-clamp: 2;
  165. overflow: hidden;
  166. }
  167. .num {
  168. color: #999999;
  169. }
  170. .spec {
  171. font-size: 26upx;
  172. background: #CCCCCC;
  173. color: white;
  174. padding: 0 10upx;
  175. border-radius: 10upx;
  176. }
  177. }
  178. .row {
  179. display: flex;
  180. justify-content: space-between;
  181. margin-bottom: 10upx;
  182. }
  183. }
  184. .total-price {
  185. text-align: right;
  186. font-size: 28upx;
  187. padding: 10upx 0;
  188. .warning {
  189. color: $primary-color;
  190. font-weight: bold;
  191. }
  192. }
  193. .option {
  194. text-align: right;
  195. .pay-btn,
  196. .confirm-btn {
  197. background: white;
  198. border: 2upx solid $primary-color;
  199. display: inline-block;
  200. line-height: normal;
  201. font-size: 28upx;
  202. color: $primary-color;
  203. border-radius: 40upx;
  204. padding: 5upx 10upx;
  205. }
  206. }
  207. }
  208. }
  209. </style>