order-detail.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <view v-if="detail != null">
  4. <view class="padding-horizontal-main padding-top-main">
  5. <view v-if="detail_list.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
  6. <view class="panel-content oh">
  7. <view class="item br-b oh padding-vertical-main">
  8. <view class="title fl padding-right-main cr-gray">用户头像</view>
  9. <view class="content fl br-l padding-left-main">
  10. <image :src="detail.avatar" class="avatar dis-block circle fl" mode="widthFix" @tap="avatar_event" :data-value="detail.avatar"></image>
  11. </view>
  12. </view>
  13. <view v-for="(item, index) in detail_list" :key="index" class="item br-b oh padding-vertical-main">
  14. <view class="title fl padding-right-main cr-gray">{{item.name}}</view>
  15. <view class="content fl br-l padding-left-main">{{item.value}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 结尾 -->
  21. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  22. </view>
  23. <view v-else>
  24. <!-- 提示信息 -->
  25. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. const app = getApp();
  31. import componentNoData from "../../../../components/no-data/no-data";
  32. import componentBottomLine from "../../../../components/bottom-line/bottom-line";
  33. export default {
  34. data() {
  35. return {
  36. params: null,
  37. data_list_loding_status: 1,
  38. data_list_loding_msg: '',
  39. data_bottom_line_status: false,
  40. detail: null,
  41. detail_list: []
  42. };
  43. },
  44. components: {
  45. componentNoData,
  46. componentBottomLine
  47. },
  48. props: {},
  49. onLoad(params) {
  50. //params['id'] = 1;
  51. this.setData({
  52. params: params
  53. });
  54. this.init();
  55. },
  56. onShow() {
  57. // 分享菜单处理
  58. app.globalData.page_share_handle();
  59. },
  60. // 下拉刷新
  61. onPullDownRefresh() {
  62. this.init();
  63. },
  64. methods: {
  65. init() {
  66. uni.showLoading({
  67. title: '加载中...'
  68. });
  69. this.setData({
  70. data_list_loding_status: 1
  71. });
  72. uni.request({
  73. url: app.globalData.get_request_url("detail", "order", "distribution"),
  74. method: 'POST',
  75. data: {
  76. id: this.params.id
  77. },
  78. dataType: 'json',
  79. success: res => {
  80. uni.hideLoading();
  81. uni.stopPullDownRefresh();
  82. if (res.data.code == 0) {
  83. var data = res.data.data;
  84. this.setData({
  85. detail: data.data,
  86. detail_list: [
  87. { name: "用户昵称", value: data.data.user_name_view || '' },
  88. { name: "订单金额", value: data.data.total_price + ' 元' || '' },
  89. { name: "退款金额", value: data.data.refund_price + ' 元' || '' },
  90. { name: "订单状态", value: data.data.order_status_name || '' },
  91. { name: "支付状态", value: data.data.order_pay_status_name || '' },
  92. { name: "来源终端", value: data.data.order_client_type_name || '' },
  93. { name: "下单时间", value: data.data.add_time_time || '' },
  94. ],
  95. data_list_loding_status: 3,
  96. data_bottom_line_status: true,
  97. data_list_loding_msg: ''
  98. });
  99. } else {
  100. this.setData({
  101. data_list_loding_status: 2,
  102. data_bottom_line_status: false,
  103. data_list_loding_msg: res.data.msg
  104. });
  105. if (app.globalData.is_login_check(res.data, this, 'init')) {
  106. app.globalData.showToast(res.data.msg);
  107. }
  108. }
  109. },
  110. fail: () => {
  111. uni.hideLoading();
  112. uni.stopPullDownRefresh();
  113. this.setData({
  114. data_list_loding_status: 2,
  115. data_bottom_line_status: false,
  116. data_list_loding_msg: '服务器请求出错'
  117. });
  118. app.globalData.showToast('服务器请求出错');
  119. }
  120. });
  121. },
  122. // 头像查看
  123. avatar_event(e) {
  124. var value = e.currentTarget.dataset.value || null;
  125. if (value != null) {
  126. uni.previewImage({
  127. current: value,
  128. urls: [value]
  129. });
  130. } else {
  131. app.globalData.showToast('头像地址有误');
  132. }
  133. }
  134. }
  135. };
  136. </script>
  137. <style>
  138. @import './order-detail.css';
  139. </style>