detail.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="wrap">
  3. <view class="order_detail">
  4. <view class="top">
  5. <view class="address_detail">
  6. {{order.consigneeAddress}}
  7. <br>
  8. </view>
  9. <view class="footer_btn">
  10. <u-button size="mini" type="info" @click="contact"> 联系客服</u-button>
  11. <u-button size="mini" type="primary" @click="payment" v-show="order.statusName=='待付款'">立即付款</u-button>
  12. <u-button size="mini" type="success" @click="confirmReceive" v-show="order.statusName=='已发货'">确认收货</u-button>
  13. </view>
  14. </view>
  15. <view class="content">
  16. <view class="title">
  17. {{'订单编号: ' + order.orderSn}}
  18. </view>
  19. <view class="list">
  20. <view class="item" v-for="(item,index) in order.items" :key="index">
  21. <u-row gutter="16">
  22. <u-col :span="3">
  23. <u-image width="100%" height="150rpx" :src="imgUrl+item.goods.pic"></u-image>
  24. </u-col>
  25. <u-col :span="9" @click="toGoods(item.goods.id)">
  26. <view class="gl-name">{{item.goods.name}}</view>
  27. <view class="gl-descript">{{item.goods.descript}}</view>
  28. <view class="gl-price">
  29. <u-row>
  30. <u-col offset="6" :span="3" text-align="right">
  31. ¥{{formatPrice(item.price)}}
  32. </u-col>
  33. <u-col :span="3" text-align="right">
  34. x{{item.count}}
  35. </u-col>
  36. </u-row>
  37. </view>
  38. </u-col>
  39. </u-row>
  40. </view>
  41. </view>
  42. <view class="total">合计: {{formatPrice(order.totalPrice)}}</view>
  43. </view>
  44. <view>
  45. <u-cell-group title="订单信息">
  46. <u-cell-item title="订单编号" :value="order.orderSn" :arrow="false"></u-cell-item>
  47. <u-cell-item title="创建时间" :value="order.createTime" :arrow="false"></u-cell-item>
  48. </u-cell-group>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. imgUrl: this.baseApi + '/file/getImgStream?idFile=',
  58. order: {
  59. orderSn: '',
  60. consigneeAddress: '',
  61. address: {
  62. name: ''
  63. }
  64. }
  65. }
  66. },
  67. onLoad(option) {
  68. this.order.orderSn = option.orderSn
  69. this.getData()
  70. },
  71. methods: {
  72. getData() {
  73. this.$u.get('user/order/' + this.order.orderSn).then(res => {
  74. this.order = res
  75. })
  76. },
  77. formatPrice(price) {
  78. return (price / 100).toFixed(2);
  79. },
  80. toGoods(id) {
  81. this.$router.push({
  82. path: '/goods/' + id
  83. })
  84. },
  85. payment() {
  86. this.$u.route({
  87. url: '/pages/order/payment/payment',
  88. params: {
  89. orderSn: this.order.orderSn,
  90. totalPrice: this.order.totalPrice
  91. }
  92. })
  93. },
  94. confirmReceive(){
  95. this.$u.post('user/order/confirm/' + this.order.orderSn).then(res => {
  96. this.order = res
  97. })
  98. },
  99. contact(){
  100. this.$u.toast('敬请期待')
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .order_detail {
  107. margin: 30rpx;
  108. .top {
  109. .address_detail {
  110. padding: 5px;
  111. }
  112. .footer_btn {
  113. text-align: right;
  114. .u-btn {
  115. margin-left: 20rpx;
  116. }
  117. }
  118. }
  119. .content {
  120. margin-top: 40rpx;
  121. .total {
  122. text-align: right;
  123. padding: 10px;
  124. }
  125. .list {
  126. .item {
  127. margin-top: 20rpx;
  128. .gl-name {
  129. font-size: 26rpx;
  130. }
  131. .gl-descript {
  132. margin-top: 14rpx;
  133. font-size: 20rpx;
  134. }
  135. .gl-price {
  136. margin-top: 26rpx;
  137. font-size: 24rpx;
  138. }
  139. }
  140. }
  141. .total{
  142. }
  143. }
  144. }
  145. </style>