detail.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="content">
  3. <view class="text-area">
  4. <text class="title">{{title}}</text>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. id: '',
  13. user: {},
  14. info: {},
  15. }
  16. },
  17. onLoad: async function(e) {
  18. const that = this;
  19. that.$set(that, `id`, e && e.id || '');
  20. that.searchToken();
  21. await that.searchOther();
  22. await that.search();
  23. },
  24. methods: {
  25. searchToken() {
  26. const that = this;
  27. try {
  28. const res = uni.getStorageSync('token');
  29. if (res) that.$set(that, `user`, res);
  30. } catch (e) {
  31. uni.showToast({
  32. title: err.errmsg,
  33. icon: 'error',
  34. duration: 2000
  35. });
  36. }
  37. },
  38. async search() {
  39. const that = this;
  40. if (that.id) {
  41. const res = await that.$api(`/OrderDetail/detail/${that.id}`, 'GET', {})
  42. if (res.errcode == '0') {
  43. that.$set(that, `info`, res.data)
  44. } else {
  45. uni.showToast({
  46. title: res.errmsg,
  47. });
  48. }
  49. }
  50. },
  51. // 查询其他信息
  52. async searchOther() {
  53. const that = this;
  54. let res;
  55. // 查询状态
  56. res = await that.$api(`/DictData`, 'GET', {
  57. type: 'order_status',
  58. is_use: '0',
  59. })
  60. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  61. },
  62. }
  63. }
  64. </script>
  65. <style>
  66. .content {
  67. display: flex;
  68. flex-direction: column;
  69. align-items: center;
  70. justify-content: center;
  71. }
  72. .text-area {
  73. display: flex;
  74. justify-content: center;
  75. }
  76. </style>