oftenRoute.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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 class="btn_css" @click="showChane(item)">{{item.displayFlag == 1?"显示中":"已隐藏"}}</view>
  23. </view>
  24. </view>
  25. <u-loadmore :status="status" :nomore-text="nomoreText" />
  26. </view>
  27. <u-toast ref="uToast"></u-toast>
  28. <u-modal :show="tipsShow" :title="tipsText" :closeOnClickOverlay='true' :showCancelButton='true'
  29. confirmColor='#2772FB' @confirm="delSubmit" @close="cancelClick" @cancel="cancelClick"></u-modal>
  30. <view class="bottom_add">
  31. <view class="add_btn" @click="addRoute(1)">添加常用路线</view>
  32. <span class="tips">最多可创建50条</span>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. routeData: [],
  41. status: 'loadmore',
  42. nomoreText: '实在没有了~',
  43. tipsShow: false,
  44. tipsText: "",
  45. delId: "",
  46. }
  47. },
  48. onShow() {},
  49. onLoad() {
  50. this.getList()
  51. },
  52. onNavigationBarButtonTap(e) {
  53. this.addRoute(1)
  54. },
  55. methods: {
  56. delSubmit() {
  57. this.$request.baseRequest('post', '/commonRoute/api/delete', {
  58. id: this.delId
  59. }).then(res => {
  60. if (res.code == 200) {
  61. this.$refs.uToast.show({
  62. type: 'success',
  63. message: "删除成功!",
  64. })
  65. this.tipsShow = false
  66. this.getList()
  67. }
  68. })
  69. .catch(res => {
  70. uni.$u.toast(res.message);
  71. });
  72. },
  73. del(ids) {
  74. this.tipsText = "确定删除改常用路线?"
  75. this.tipsShow = true
  76. this.delId = ids
  77. },
  78. cancelClick() {
  79. this.tipsShow = false
  80. },
  81. getList() {
  82. this.status = 'loading';
  83. this.$request.baseRequest('get', '/commonRoute/select', {
  84. commonId: uni.getStorageSync("firstAuthentication").commonId,
  85. pageSize: 10,
  86. currentPage: 1
  87. }).then(res => {
  88. if (res.code == 200) {
  89. this.routeData = res.data.records
  90. if (res.data.total == 0) {
  91. this.status = 'nomore'
  92. } else {
  93. this.status = 'loadmore'
  94. }
  95. }
  96. })
  97. .catch(res => {
  98. uni.$u.toast(res.message);
  99. });
  100. },
  101. showChane(item) {
  102. if (item.displayFlag == 1) {
  103. item.displayFlag = 2
  104. } else {
  105. item.displayFlag = 1
  106. }
  107. this.$request.baseRequest('post', '/commonRoute/api/edit', item).then(res => {
  108. if (res.code == 200) {
  109. if (item.displayFlag == 1) {
  110. this.$refs.uToast.show({
  111. type: 'success',
  112. message: "路线展示中!",
  113. })
  114. } else {
  115. this.$refs.uToast.show({
  116. type: 'success',
  117. message: "路线已隐藏!",
  118. })
  119. }
  120. }
  121. })
  122. .catch(res => {
  123. uni.$u.toast(res.message);
  124. });
  125. },
  126. addRoute(item) {
  127. if (item == 1 && this.routeData.length == 50) {
  128. this.$refs.uToast.show({
  129. type: 'success',
  130. message: "最多可创建50条常用路线!",
  131. })
  132. } else {
  133. uni.$u.route("pages/mine/often/addRoute", {
  134. id: item.id
  135. })
  136. }
  137. },
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .center {
  143. height: calc(100vh - 25vh);
  144. padding: 30rpx 30rpx 200rpx;
  145. background: #F2F4F7;
  146. position: flex;
  147. position: relative;
  148. }
  149. .route {
  150. .route_css {
  151. background: #FFFFFF;
  152. margin-bottom: 40rpx;
  153. padding: 30rpx 50rpx;
  154. border-radius: 20rpx;
  155. .route_site {
  156. border-bottom: 1px solid #E6E6E6;
  157. height: 120rpx;
  158. .site_text {
  159. // width: 180rpx;
  160. max-width: 200rpx;
  161. overflow: hidden;
  162. // height: 60rpx;
  163. text-overflow: ellipsis;
  164. white-space: nowrap;
  165. font-size: 32rpx;
  166. // font-weight: 500;
  167. // margin: 0 20rpx;
  168. }
  169. }
  170. .jt_css {
  171. width: 60rpx;
  172. height: 20rpx;
  173. margin: 0 23rpx;
  174. }
  175. .dot {
  176. display: inline-block;
  177. width: 12rpx;
  178. height: 12rpx;
  179. border-radius: 6rpx;
  180. margin: 20rpx 20rpx 0 0;
  181. }
  182. .blueDot {
  183. background: #2772FB;
  184. }
  185. .redDot {
  186. background: #FE6300;
  187. }
  188. .btns {
  189. width: 100%;
  190. justify-content: flex-end;
  191. margin-top: 40rpx;
  192. }
  193. .btn_css {
  194. margin-left: 30rpx;
  195. width: 120rpx;
  196. height: 66rpx;
  197. border-radius: 33px;
  198. border: 1px solid #CDCDCD;
  199. line-height: 66rpx;
  200. text-align: center;
  201. }
  202. }
  203. }
  204. .bottom_add {
  205. position: fixed;
  206. left: 0;
  207. bottom: 0;
  208. width: 100%;
  209. height: 160rpx;
  210. padding-top: 30rpx;
  211. background: #FFFFFF;
  212. text-align: center;
  213. .add_btn {
  214. width: 90%;
  215. height: 70rpx;
  216. line-height: 70rpx;
  217. background: #2772FB;
  218. text-align: center;
  219. border-radius: 35rpx;
  220. color: #FFFFFF;
  221. margin-top: 30rpx;
  222. // height: 60rpx;
  223. margin: 0 auto;
  224. }
  225. .tips {
  226. text-align: center;
  227. color: #ABABAB;
  228. font-size: 24rpx;
  229. }
  230. }
  231. </style>