index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  3. <tm-menubars title="消息列表" :shadow="0" :showback="true"></tm-menubars>
  4. <div class="dizhi">
  5. <view class="contdz pt-20" v-for="item in addList" :key="item.id">
  6. <view>
  7. <text> {{item.name}}</text>
  8. <text class="ml-40 text-gray text-size-m">{{item.mobile}}</text>
  9. <tm-button class="ml-50" :round="10" theme="gray" size="s">{{item.label}}</tm-button>
  10. <tm-button class="ml-10" :round="10" size="s" v-if="item.default_address==1">默认</tm-button>
  11. </view>
  12. <view class="text-gray text-size-s mt-15">
  13. <text>{{item.region}} {{item.address}}</text>
  14. <image class="fr xiugai" src="/static/img/109.png" mode="widthFix" @click="goRedact(item)"></image>
  15. </view>
  16. </view>
  17. </div>
  18. <tm-button :round="24" class="sao mb-40 mt-40" block @click="xinjian">新建收获地址</tm-button>
  19. <!-- 弹出层消息 -->
  20. <tm-message ref="toast"></tm-message>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. myRequest
  26. } from '@/api/request.js'
  27. export default {
  28. data() {
  29. return {
  30. checked1: false,
  31. checked2: false,
  32. checked3: false,
  33. beizu: '',
  34. addList: []
  35. };
  36. },
  37. onLoad() {
  38. },
  39. created() {
  40. var that = this;
  41. setTimeout(function() {
  42. if (uni.getStorageSync("token") == "") {
  43. uni.redirectTo({
  44. url: "/pages/login/index"
  45. })
  46. }
  47. }, 1000)
  48. this.sys = uni.getSystemInfoSync();
  49. this.getAddList();
  50. },
  51. methods: {
  52. xinjian() {
  53. uni.navigateTo({
  54. url: "/pages/shouhuodi/index",
  55. })
  56. },
  57. // 获取地址列表
  58. getAddList() {
  59. let that = this;
  60. myRequest({
  61. url: '/api/Address/addressList',
  62. method: 'get',
  63. data: that.reqData
  64. }).then(res => {
  65. console.log(res.data);
  66. if (res.data.code == 200) {
  67. that.addList = res.data.data;
  68. } else {
  69. that.$refs.toast.show({
  70. model: 'error',
  71. label: res.data.msg
  72. })
  73. }
  74. })
  75. },
  76. // 编辑地址
  77. goRedact(item) {
  78. uni.navigateTo({
  79. // url: '/pages/shouhuodi/index?data='+data
  80. url: '/pages/shouhuodi/index?id='+item.id
  81. })
  82. }
  83. },
  84. }
  85. </script>
  86. <style lang="scss">
  87. /deep/ .tm-menubars .body {
  88. background-color: #1b1b1b !important;
  89. }
  90. /deep/ .zhuti {
  91. padding: 10px 10px;
  92. }
  93. /deep/ .kuang {
  94. margin: 0 !important;
  95. padding: 0px !important;
  96. }
  97. .sao {
  98. width: 88%;
  99. margin: 0 auto;
  100. margin-top: 30px;
  101. }
  102. .dizhi {
  103. background: #1B1B1B;
  104. }
  105. .xiugai {
  106. width: 18px;
  107. height: 18px;
  108. }
  109. .contdz {
  110. width: 90%;
  111. margin: 0 auto;
  112. border-bottom: 1px solid #303030;
  113. padding-bottom: 15px;
  114. }
  115. </style>