orderDetails.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <!-- 订单详情 -->
  3. <view>
  4. <u-navbar title="详情" autoBack placeholder></u-navbar>
  5. <view class="card_order_details">
  6. <view class="details_title" style="color: #3c9cff;" v-if="orderData.state == 2">待配送</view>
  7. <view class="details_title" style="color: #f9ae3d;" v-else-if="orderData.state == 5">配送中</view>
  8. <view class="details_title" style="color: #5ac725;" v-else-if="orderData.state == 3">已送达</view>
  9. <view class="details_title" style="color: #f56c6c;" v-else-if="orderData.state == 4">已取消</view>
  10. <view class="gas_card">
  11. <image class="gas_iamge" src="../../static/image/bottle.png" mode=""></image>
  12. <view class="gas_card_tl">
  13. <view class="title_gas" v-if="orderData.goods && orderData.spec">
  14. {{orderData.goods.name}}{{orderData.spec.name}}
  15. </view>
  16. <view class="title_gas_num">×{{orderData.quantity}}</view>
  17. </view>
  18. </view>
  19. <view class="details_title1">订单编号: <span>{{orderData.orderId}}</span></view>
  20. <view class="details_title1">配送地址: <span>{{orderData.address}}</span></view>
  21. <view class="details_title1" v-if="orderData.state == 5 || orderData.state == 4">联系电话:
  22. <span>{{orderData.phone}}</span> <u-icon color="#70B603" size="26" name="phone-fill"
  23. @click.native.stop="phone(orderData.phone)"></u-icon>
  24. </view>
  25. <view class="details_title1">下单时间: <span>{{orderData.orderTime}}</span></view>
  26. <view class="details_title1" v-if="orderData.state == 5 || orderData.state == 4">配送时间:
  27. <span>{{orderData.deliveryTime}}</span>
  28. </view>
  29. <view class="details_title1" v-if="orderData.state == 3 || orderData.state == 4">送达时间:
  30. <span>{{orderData.arriveTime}}</span>
  31. </view>
  32. </view>
  33. <view class="btn_cancel" v-if="orderData.state == 3">
  34. <u-button text="取消订单" color="#d7d7d7" @click="cancel"></u-button>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. orderData: {},
  43. }
  44. },
  45. mounted() {
  46. var value = uni.getStorageSync('detailsData');
  47. this.orderData = value
  48. uni.$on('refresh', () => {
  49. this.getOrderList()
  50. })
  51. },
  52. methods: {
  53. getOrderList() {
  54. var value = uni.getStorageSync('detailsData');
  55. this.orderData = value
  56. },
  57. cancel() {
  58. uni.redirectTo({
  59. url: '/pages/order/delivery?id=' + '100' + '&title=' + '确定取消' + '&orderId=' + this.orderData.id
  60. });
  61. },
  62. phone(phone) {
  63. uni.makePhoneCall({
  64. phoneNumber: phone,
  65. success: () => {
  66. console.log('拨打电话成功!');
  67. },
  68. fail: () => {
  69. console.error('拨打电话失败!');
  70. }
  71. });
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .card_order_details {
  78. margin: 20rpx 30rpx;
  79. }
  80. .details_title {
  81. display: flex;
  82. margin-left: 20rpx;
  83. color: #333;
  84. font-size: 32rpx;
  85. font-weight: 500;
  86. }
  87. .gas_card {
  88. margin-top: 20rpx;
  89. display: flex;
  90. }
  91. .gas_iamge {
  92. width: 160rpx;
  93. height: 160rpx;
  94. border-radius: 10rpx;
  95. }
  96. .gas_card_tl {
  97. margin-left: 20rpx;
  98. }
  99. .title_gas {
  100. font-size: 40rpx;
  101. font-weight: 700;
  102. }
  103. .title_gas_num {
  104. font-size: 30rpx;
  105. font-weight: 500;
  106. margin-top: 10rpx;
  107. }
  108. .details_title1 {
  109. display: flex;
  110. align-items: center;
  111. font-size: 26rpx;
  112. color: #7f7f7f;
  113. margin-top: 20rpx;
  114. span {
  115. margin-left: 10rpx;
  116. font-size: 26rpx;
  117. color: #000;
  118. }
  119. }
  120. .btn_cancel {
  121. margin-top: 40rpx;
  122. margin-left: 30rpx;
  123. width: 300rpx;
  124. }
  125. </style>