detail.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view>
  3. <view v-if="(data || null) != null" class="padding-horizontal-main padding-top-main">
  4. <view class="padding-main border-radius-main bg-white oh spacing-mb">
  5. <image class="express-icon fl radius" :src="data.icon" mode="aspectFill"></image>
  6. <view class="fl margin-left-lg">
  7. <view class="cr-base fw-b">{{data.name}}</view>
  8. <view class="cr-base margin-top-sm">{{data.number}}</view>
  9. </view>
  10. </view>
  11. <view v-if="(data.msg || null) != null" class="notice-content-blue spacing-mt">{{data.msg}}</view>
  12. <view v-if="(data.data || null) != null && data.data.length > 0" class="express-data margin-top-xl">
  13. <block v-for="(item, index) in data.data" :key="index">
  14. <view :class="'item padding-main border-radius-main bg-white margin-left-sm br-b br-l br-r pr '+(index == 0 ? 'br-t' : '')">
  15. <view :class="'i pa round '+(index == 0 ? 'bg-green' : 'bg-gray')"></view>
  16. <view :class="'cr-base '+(index == 0 ? 'fw-b' : '')">{{item.desc}}</view>
  17. <view class="cr-grey margin-top-sm">{{item.time}}</view>
  18. </view>
  19. </block>
  20. </view>
  21. </view>
  22. <!-- 提示信息 -->
  23. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  24. <!-- 结尾 -->
  25. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  26. </view>
  27. </template>
  28. <script>
  29. const app = getApp();
  30. import componentNoData from "../../../../components/no-data/no-data";
  31. import componentBottomLine from "../../../../components/bottom-line/bottom-line";
  32. export default {
  33. data() {
  34. return {
  35. data_list_loding_status: 1,
  36. data_list_loding_msg: '',
  37. data_bottom_line_status: false,
  38. params: null,
  39. data: null,
  40. data_status: false
  41. };
  42. },
  43. components: {
  44. componentNoData,
  45. componentBottomLine
  46. },
  47. props: {},
  48. onLoad(params) {
  49. this.setData({
  50. params: params
  51. });
  52. },
  53. onShow() {
  54. // 数据加载
  55. this.get_data();
  56. // 分享菜单处理
  57. app.globalData.page_share_handle();
  58. },
  59. // 下拉刷新
  60. onPullDownRefresh() {
  61. this.get_data();
  62. },
  63. methods: {
  64. // 初始化
  65. get_data() {
  66. if(!this.data_status) {
  67. this.setData({
  68. data_list_loding_status: 1,
  69. data_list_loding_msg: ''
  70. });
  71. }
  72. uni.showLoading({
  73. title: '加载中...'
  74. });
  75. // 是否指定方法
  76. uni.request({
  77. url: app.globalData.get_request_url("index", "index", "express"),
  78. method: 'POST',
  79. data: this.params,
  80. dataType: 'json',
  81. success: res => {
  82. uni.hideLoading();
  83. uni.stopPullDownRefresh();
  84. if (res.data.code == 0) {
  85. var data = res.data.data || null;
  86. var status = (data != null && ((data.msg || null) != null || ((data.data || null) != null && data.data.length > 0)));
  87. this.setData({
  88. data_bottom_line_status: status,
  89. data_list_loding_status: status ? 3 : 0,
  90. data_list_loding_msg: status ? '' : '暂无物流信息',
  91. data_status: status,
  92. data: data
  93. });
  94. } else {
  95. this.setData({
  96. data_list_loding_status: 0,
  97. data_list_loding_msg: res.data.msg
  98. });
  99. app.globalData.showToast(res.data.msg);
  100. }
  101. },
  102. fail: () => {
  103. uni.hideLoading();
  104. uni.stopPullDownRefresh();
  105. this.setData({
  106. data_list_loding_status: 2,
  107. data_list_loding_msg: '服务器请求出错'
  108. });
  109. app.globalData.showToast('服务器请求出错');
  110. }
  111. });
  112. }
  113. }
  114. };
  115. </script>
  116. <style>
  117. @import './detail.css';
  118. </style>