orderDetails.vue 3.4 KB

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