index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  6. <view class="list-scroll-view">
  7. <view class="list" v-for="(item,index) in list" :key="index">
  8. <view class="name">
  9. <text>{{item.name}}</text>
  10. <text>{{item.phone}}</text>
  11. </view>
  12. <view class="address">
  13. <text>{{item.province}}</text>
  14. <text>{{item.city}}</text>
  15. <text>{{item.area}}</text>
  16. <text>{{item.address}}</text>
  17. <text>{{item.number}}</text>
  18. </view>
  19. <view class="btn">
  20. <view class="btn_1" v-if="item.is_default==false">
  21. <button type="default" size="mini" @click="toDefa(item)">设为默认</button>
  22. </view>
  23. <view class="btn_1">
  24. <button type="default" size="mini" @click="toCommon(item)">编辑</button>
  25. </view>
  26. <view class="btn_1">
  27. <button type="default" size="mini" @click="toDel(item)">删除</button>
  28. </view>
  29. </view>
  30. <view class="default" v-if="item.is_default==true">
  31. <text>默认</text>
  32. </view>
  33. </view>
  34. </view>
  35. </scroll-view>
  36. </view>
  37. <view class="two">
  38. <view class="two_1">
  39. <button type="default">获取微信地址</button>
  40. </view>
  41. <view class="two_1">
  42. <button type="default" @click="toCommon()">新增收货地址</button>
  43. </view>
  44. </view>
  45. </view>
  46. </mobile-frame>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. list: [ //信息列表
  53. {
  54. id: '1234567',
  55. name: '姓名',
  56. phone: '13174420325',
  57. province: '吉林省',
  58. city: '长春市',
  59. area: '朝阳区',
  60. address: '详细地址',
  61. number: 0,
  62. is_default: false
  63. },
  64. {
  65. id: '123456',
  66. name: '姓名',
  67. phone: '13174420325',
  68. province: '吉林省',
  69. city: '长春市',
  70. area: '朝阳区',
  71. address: '详细地址',
  72. number: 11,
  73. is_default: true
  74. }
  75. ]
  76. };
  77. },
  78. onShow: function() {},
  79. methods: {
  80. // 分页
  81. toPage() {
  82. },
  83. // 设置默认
  84. toDefa(e) {
  85. uni.showModal({
  86. title: '提示',
  87. content: '确定设置该地址为默认地址吗?',
  88. success: function(res) {
  89. if (res.confirm) {
  90. console.log('用户点击确定');
  91. }
  92. }
  93. });
  94. },
  95. // 编辑
  96. toCommon(e) {
  97. uni.navigateTo({
  98. url: `/pagesMy/address/add?id=${e&&e.id?e.id:''}`
  99. })
  100. },
  101. // 删除
  102. toDel(e) {
  103. uni.showModal({
  104. title: '提示',
  105. content: '确定删除该地址吗?',
  106. success: function(res) {
  107. if (res.confirm) {
  108. console.log('用户点击确定');
  109. }
  110. }
  111. });
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss">
  117. .main {
  118. display: flex;
  119. flex-direction: column;
  120. width: 100vw;
  121. height: 100vh;
  122. .one {
  123. position: relative;
  124. flex-grow: 1;
  125. background-color: var(--f5Color);
  126. .list {
  127. position: relative;
  128. background: var(--fffColor);
  129. padding: 2vw;
  130. width: 92vw;
  131. margin: 2vw 2vw 0 2vw;
  132. border-radius: 5px;
  133. .name {
  134. font-size: var(--font16Size);
  135. margin: 0 0 1vw 0;
  136. text {
  137. padding: 0 2vw 0 0;
  138. }
  139. }
  140. .address {
  141. font-size: var(--font14Size);
  142. margin: 0 0 1vw 0;
  143. text {
  144. padding: 0 2vw 0 0;
  145. }
  146. }
  147. .btn {
  148. display: flex;
  149. flex-direction: row;
  150. justify-content: space-around;
  151. border-top: 1px solid var(--font16Size);
  152. padding: 2vw 0 0 0;
  153. .btn_1 {
  154. button {
  155. width: 100%;
  156. color: var(--fffColor);
  157. background-color: var(--f35BColor);
  158. }
  159. }
  160. .btn_1:nth-child(2) {
  161. button {
  162. background-color: var(--f0fColor);
  163. }
  164. }
  165. .btn_1:last-child {
  166. button {
  167. background-color: var(--fFB1Color);
  168. }
  169. }
  170. }
  171. .default {
  172. position: absolute;
  173. top: 0;
  174. right: 0;
  175. text {
  176. background: var(--ff0Color);
  177. color: var(--fffColor);
  178. font-size: var(--font12Size);
  179. padding: 1vw;
  180. border-radius: 5px;
  181. }
  182. }
  183. }
  184. }
  185. .two {
  186. display: flex;
  187. flex-direction: row;
  188. justify-content: space-between;
  189. .two_1 {
  190. width: 50vw;
  191. button {
  192. width: 100%;
  193. color: var(--fffColor);
  194. background-color: var(--f08Color);
  195. }
  196. }
  197. .two_1:nth-child(2) {
  198. button {
  199. background-color: var(--fFB1Color);
  200. }
  201. }
  202. }
  203. }
  204. .scroll-view {
  205. position: absolute;
  206. top: 0;
  207. left: 0;
  208. right: 0;
  209. bottom: 0;
  210. .list-scroll-view {
  211. display: flex;
  212. flex-direction: column;
  213. }
  214. }
  215. </style>