oftenRoute.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="center">
  3. <view class="route">
  4. <view v-for="(item,index) in routeData" class="route_css">
  5. <view class="route_site flex">
  6. <span class="blueDot dot"></span>
  7. <view class="site_text">
  8. <!-- {{item.sendProvince}} -->{{item.sendCity ? item.sendCity: item.sendProvince}}
  9. {{item.sendArea}}
  10. </view>
  11. <!-- {{item.sendCity ? item.sendCity: item.sendProvince}} {{item.sendArea}} -->
  12. <image class="jt_css" src="@/static/images/goodSource/jt.png" mode='widthFix'></image>
  13. <span class="redDot dot"></span>
  14. <view class="site_text">
  15. <!-- {{item.unloadProvince}} -->{{item.unloadCity ? item.unloadCity: item.unloadProvince}}
  16. {{item.unloadArea}}
  17. </view>
  18. </view>
  19. <view class="flex btns">
  20. <view class="btn_css" @click="addRoute(item)">修改</view>
  21. <view class="btn_css" @click="del(item.id)">删除</view>
  22. </view>
  23. </view>
  24. <u-loadmore :status="status" :nomore-text="nomoreText" />
  25. </view>
  26. <u-toast ref="uToast"></u-toast>
  27. <view class="bottom_add">
  28. <view class="add_btn" @click="addRoute(1)">添加常用路线</view>
  29. <span class="tips">最多可创建50条</span>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. routeData: [],
  38. status: 'loadmore',
  39. nomoreText: '实在没有了'
  40. }
  41. },
  42. onShow() {},
  43. onLoad() {
  44. this.getList()
  45. },
  46. onNavigationBarButtonTap(e) {
  47. this.addRoute(1)
  48. },
  49. methods: {
  50. del(ids) {
  51. this.$request.baseRequest('post', '/commonRoute/api/delete', {
  52. id: ids
  53. }).then(res => {
  54. if (res.code == 200) {
  55. this.$refs.uToast.show({
  56. type: 'success',
  57. message: "删除成功!",
  58. })
  59. this.getList()
  60. }
  61. })
  62. .catch(res => {
  63. uni.$u.toast(res.message);
  64. });
  65. },
  66. getList() {
  67. this.status = 'loading';
  68. this.$request.baseRequest('get', '/commonRoute/select', {
  69. commonId: uni.getStorageSync("firstAuthentication").commonId,
  70. pageSize: 10,
  71. currentPage: 1
  72. }).then(res => {
  73. if (res.code == 200) {
  74. this.routeData = res.data.records
  75. if(res.data.total == 0){
  76. this.status = 'nomore'
  77. }else{
  78. this.status = 'loadmore'
  79. }
  80. }
  81. })
  82. .catch(res => {
  83. uni.$u.toast(res.message);
  84. });
  85. },
  86. addRoute(item) {
  87. if (item == 1 && this.routeData.length == 50) {
  88. this.$refs.uToast.show({
  89. type: 'success',
  90. message: "最多可创建50条常用路线!",
  91. })
  92. } else {
  93. uni.$u.route("pages/mine/often/addRoute", {
  94. id: item.id
  95. })
  96. }
  97. },
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .center {
  103. padding: 30rpx 30rpx 200rpx;
  104. background: #F2F4F7;
  105. position: flex;
  106. position: relative;
  107. }
  108. .route {
  109. .route_css {
  110. background: #FFFFFF;
  111. margin-bottom: 40rpx;
  112. padding: 30rpx 50rpx;
  113. border-radius: 20rpx;
  114. .route_site {
  115. border-bottom: 1px solid #E6E6E6;
  116. height: 120rpx;
  117. .site_text {
  118. // width: 180rpx;
  119. max-width: 200rpx;
  120. overflow: hidden;
  121. // height: 60rpx;
  122. text-overflow: ellipsis;
  123. white-space: nowrap;
  124. font-size: 32rpx;
  125. // font-weight: 500;
  126. // margin: 0 20rpx;
  127. }
  128. }
  129. .jt_css {
  130. width: 60rpx;
  131. height: 20rpx;
  132. margin: 0 23rpx;
  133. }
  134. .dot {
  135. display: inline-block;
  136. width: 12rpx;
  137. height: 12rpx;
  138. border-radius: 6rpx;
  139. margin: 20rpx 20rpx 0 0;
  140. }
  141. .blueDot {
  142. background: #2772FB;
  143. }
  144. .redDot {
  145. background: #FE6300;
  146. }
  147. .btns {
  148. width: 100%;
  149. justify-content: flex-end;
  150. margin-top: 40rpx;
  151. }
  152. .btn_css {
  153. margin-left: 30rpx;
  154. width: 120rpx;
  155. height: 66rpx;
  156. border-radius: 33px;
  157. border: 1px solid #CDCDCD;
  158. line-height: 66rpx;
  159. text-align: center;
  160. }
  161. }
  162. }
  163. .bottom_add {
  164. position: fixed;
  165. left: 0;
  166. bottom: 0;
  167. width: 100%;
  168. height: 160rpx;
  169. padding-top: 30rpx ;
  170. background: #FFFFFF;
  171. text-align: center;
  172. .add_btn{
  173. width: 90%;
  174. height: 70rpx;
  175. line-height: 70rpx;
  176. background: #2772FB;
  177. text-align: center;
  178. border-radius: 35rpx;
  179. color: #FFFFFF;
  180. margin-top: 30rpx;
  181. // height: 60rpx;
  182. margin: 0 auto;
  183. }
  184. .tips{
  185. text-align: center;
  186. color: #ABABAB;
  187. font-size: 24rpx;
  188. }
  189. }
  190. </style>