Changyongdizhi.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="contentV">
  3. <customNav :shownav="true" :title="$t('index.changydz')" titledetl=""></customNav>
  4. <view v-if="userAddr!=''" class="contentColumn newaddrcvt">
  5. <text class="addrV" style="margin: 20rpx;font-size: 30rpx;">{{userAddr.name}}</text>
  6. <text class="addrV" style="margin: 20rpx;font-size: 28rpx;">{{userAddr.address}}</text>
  7. <view class="contentInRowS" style="margin: 20rpx;">
  8. <view class="contentInRowC newaddract" style="background-color: #00A6FF;" @click="addadr">
  9. <text>{{$t('index.tianjiashdz')}}</text>
  10. </view>
  11. <view class="contentColumnC newaddract" style="background-color:black;" @click="addrselect">
  12. <text>{{$t('index.yihouzais')}}</text>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="contentColumn" style="margin-bottom: 120rpx;">
  17. <view v-for="item in addrList">
  18. <view class="itemView" @click="selectAddr(item)">
  19. <view class="textView">
  20. <text class="addrV textfontB4">{{item.area}}</text>
  21. <text class="addrV textfontB5">{{item.address}}</text>
  22. <text class="nameph">{{item.name}}: {{item.phone}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view style="height: 10rpx;"></view>
  28. <view class="addbtV">
  29. <view class="addbt" @click="newdizhi">{{$t('index.qitadizhi')}}</view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import api from "@/pages/api/api.js";
  35. export default {
  36. data() {
  37. return {
  38. addrList:[],
  39. isNewAddr:false,
  40. userAddr:''
  41. }
  42. },
  43. onShow() {
  44. if(this.isNewAddr){
  45. this.gettempLocate();
  46. this.isNewAddr=false;
  47. }
  48. this.getaddressList();
  49. },
  50. methods: {
  51. newdizhi(){
  52. this.isNewAddr=true;
  53. uni.redirectTo({
  54. url:'/pages/UserCenter/map/map?state=0'
  55. })
  56. },
  57. gettempLocate(){
  58. uni.setStorageSync('tempLocation','');
  59. var data = uni.getStorageSync("userAddrLocation");
  60. if(''==data || undefined==data || null==data){
  61. return;
  62. }
  63. else{
  64. this.userAddr=data;
  65. uni.setStorageSync('userAddrLocation',"");
  66. uni.setStorageSync('tempLocation','');
  67. return;
  68. }
  69. },
  70. selectAddr(item){
  71. var addr={
  72. address:item.address,
  73. name:item.area,
  74. longitude:item.longitude,
  75. latitude:item.latitude,
  76. }
  77. uni.setStorageSync('userAddrLocation',addr);
  78. uni.navigateBack();
  79. },
  80. getaddressList(){
  81. api('getaddressList',{
  82. },res=>{
  83. this.addrList=res.data.data;
  84. },failc=>{
  85. //console.log('getadvertis----',failc)
  86. })
  87. },
  88. addadr(){
  89. var token = uni.getStorageSync("token");
  90. if(''==token || undefined==token ||null==token){
  91. uni.navigateTo({
  92. url:'/pages/UserCenter/LoginView'
  93. })
  94. return;
  95. }
  96. uni.setStorageSync('tempLocation',this.userAddr);
  97. uni.navigateTo({
  98. url:'/pages/UserCenter/dizhi/newdizhi?id=-2'
  99. })
  100. },
  101. addrselect(){
  102. uni.setStorageSync('userAddrLocation',this.userAddr);
  103. uni.navigateBack();
  104. },
  105. }
  106. }
  107. </script>
  108. <style>
  109. .contentV{
  110. width: 100%;
  111. position: relative;
  112. height: 90vh;
  113. }
  114. .newaddrcvt {
  115. width: 92%;
  116. margin-left: 4%;
  117. margin-top: 40rpx;
  118. margin-bottom: 20rpx;
  119. box-shadow: 0rpx 0rpx 10rpx 0rpx darkgray;
  120. }
  121. .newaddract{
  122. font-size: 26rpx;
  123. width: 43%;
  124. height: 80rpx;
  125. color: white;
  126. text-align: center;
  127. }
  128. .itemView{
  129. margin: 30rpx;
  130. padding: 30rpx;
  131. display: flex;
  132. flex-direction: row;
  133. align-items: center;
  134. justify-content:flex-start;
  135. border-radius: 20rpx;
  136. box-shadow: 0rpx 0rpx 10rpx 0rpx darkgray;
  137. }
  138. .textView{
  139. display: flex;
  140. flex-direction: column;
  141. }
  142. .addrV{
  143. color: black;
  144. overflow: hidden;
  145. text-overflow: ellipsis;
  146. display: -webkit-box;
  147. -webkit-line-clamp: 2;
  148. -webkit-box-orient: vertical;
  149. }
  150. .nameph{
  151. font-size: 28rpx;
  152. color: darkslategray;
  153. }
  154. .addbtV{
  155. position: fixed;
  156. width: 100%;
  157. height: 120rpx;
  158. bottom: 0rpx;
  159. left: 0;
  160. background-color: whitesmoke;
  161. }
  162. .addbt{
  163. margin-left: 10%;
  164. margin-top: 20rpx;
  165. text-align: center;
  166. font-size: 36rpx;
  167. width: 80%;
  168. height: 80rpx;
  169. line-height: 80rpx;
  170. background-color: #00A6FF;
  171. color: white;
  172. box-shadow: 0rpx 0rpx 10rpx 0rpx #00A6FF;
  173. border-radius: 10rpx;
  174. }
  175. </style>