addressList.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view>
  3. <scroll-list ref="list" :option="option" @load="load" @refresh="refresh" @loadSuccess="loadSuccess"
  4. @scrolltolower="scrolltolower">
  5. <view v-for="(item, index) in list" :key="index" @click="handleTest(item)">
  6. <view class="infoBody">
  7. <view>
  8. <view style="border-bottom: 1px #b8b8b8 solid;">
  9. <uni-row class="demo-uni-row">
  10. <uni-col :span="12">
  11. <view class="demo-uni-col dark"
  12. style="font-size: 36rpx;margin: -20rpx 0 0 0;font-weight: bold;letter-spacing:5rpx;">
  13. {{item.userName}}
  14. </view>
  15. </uni-col>
  16. <uni-col :span="12">
  17. <view class="demo-uni-col light" style="padding-bottom: 20rpx;">
  18. {{item.phone}}
  19. </view>
  20. </uni-col>
  21. </uni-row>
  22. </view>
  23. <uni-row class="demo-uni-row">
  24. <uni-col>
  25. <view class="demo-uni-col light" style="padding: 8rpx;color: #959595;">
  26. <view v-if="item.provinces ">
  27. {{item.provinces}}
  28. </view>
  29. <view v-if="item.detailedAddress">
  30. {{ item.detailedAddress}}
  31. </view>
  32. </view>
  33. </uni-col>
  34. </uni-row>
  35. <uni-row class="demo-uni-row">
  36. <uni-col :span="13">
  37. <view class="demo-uni-col light" style="color: #727272;">
  38. </view>
  39. </uni-col>
  40. <uni-col :span="11">
  41. <view class="demo-uni-col light" style="color: #727272;">
  42. </view>
  43. </uni-col>
  44. </uni-row>
  45. </view>
  46. </view>
  47. </view>
  48. </scroll-list>
  49. <view>
  50. <view class="content" @click="plusAdd">
  51. <!-- @touchstart="handleStart" @touchmove="handleMove" @touchend="handleEnd" -->
  52. <view :style="{'transform':'translate3d('+0+'px,'+-80+'px,0)'}" class="touch">
  53. <view style="font-size: 45rpx;">
  54. +
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <style lang="scss">
  62. .touch {
  63. position: fixed;
  64. right: 40rpx;
  65. bottom: 60rpx;
  66. width: 95rpx;
  67. height: 95rpx;
  68. /* 知识点
  69. line-height是行高,针对的对象是文字,height针对的是容器,
  70. 也就是高度,当height和line-height值相同时会居中,
  71. 当line-height值小于height时文字向上移动,反之向下移动。
  72. */
  73. line-height: 95rpx;
  74. /* 文字垂直居中 */
  75. text-align: center;
  76. /* 水平居中 */
  77. background-color: rgba(0, 0, 0, 0.6);
  78. border-radius: 50%;
  79. color: #fff;
  80. font-size: 60rpx;
  81. /* 去除标签点击事件高亮效果 */
  82. -webkit-tap-highlight-color: transparent;
  83. /* 使用transform: translate3d 处理性能高 GUP */
  84. }
  85. .page-wrap {}
  86. .infoBody {
  87. background-color: #ffffff;
  88. padding: 40rpx;
  89. border-radius: 20rpx;
  90. margin: 20rpx;
  91. box-shadow: 0px 2px 10px #cccccc;
  92. }
  93. .content {
  94. display: flex;
  95. flex-direction: column;
  96. align-items: center;
  97. justify-content: center;
  98. }
  99. </style>
  100. <script>
  101. export default {
  102. data() {
  103. return {
  104. option: {
  105. page: 1,
  106. size: 5,
  107. auto: true
  108. },
  109. userName: uni.getStorageSync("userInfo").nickName,
  110. page: 1,
  111. list: [],
  112. total: 0,
  113. clickType: 0
  114. }
  115. },
  116. onLoad() {},
  117. onShow() {
  118. this.refresh({
  119. page: 1,
  120. size: 5
  121. })
  122. },
  123. methods: {
  124. plusAdd() {
  125. uni.navigateTo({
  126. url: 'addressMgt',
  127. success() {
  128. uni.removeStorageSync("addressData")
  129. }
  130. })
  131. },
  132. handleTest(item) {
  133. if (uni.getStorageSync("clickType") === 0) {
  134. uni.setStorageSync("addressData", item)
  135. this.$goto('addressMgt')
  136. } else {
  137. uni.redirectTo({
  138. url: '../../pages/integral/list',
  139. success() {
  140. uni.setStorageSync("addressData", item)
  141. uni.setStorageSync("clickType", 1)
  142. }
  143. })
  144. }
  145. },
  146. async taskList(paging) {
  147. // 发送请求
  148. const {
  149. data: res
  150. } = await this.$httpRequest({
  151. url: '/app/uadsList?userCode=' + uni.getStorageSync("userInfo").userName + '&pageNum=' +
  152. paging.page +
  153. '&pageSize=' + paging.size,
  154. method: 'get',
  155. urlType: 2
  156. });
  157. if (res.code === 200) {
  158. setTimeout(() => {
  159. if (paging.page === 1) {
  160. //this.list = res.rows
  161. this.total = res.total
  162. this.$refs.list.loadSuccess({
  163. list: res.rows,
  164. total: this.total
  165. });
  166. } else if (paging.page > 1) {
  167. for (var i = 0; i < res.rows.length; i++) {
  168. this.list.push(res.rows[i])
  169. }
  170. this.$refs.list.loadSuccess({
  171. list: this.list,
  172. total: this.total
  173. });
  174. }
  175. }, 300)
  176. }
  177. },
  178. // 刷新刷剧
  179. refresh(paging) {
  180. this.taskList(paging)
  181. },
  182. scrolltolower(e) {
  183. console.log(e)
  184. },
  185. load(paging) {
  186. console.log(2, paging)
  187. this.taskList(paging)
  188. },
  189. loadSuccess(list) {
  190. console.log(3, list)
  191. this.list = list
  192. }
  193. }
  194. }
  195. </script>