authList.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view class="listbox" :style="colorStyle">
  3. <view class="item" v-for="(item,ind) in list">
  4. <view class="acea-row">
  5. <image class="img" src="../static/cart.png" mode="scaleToFill"></image>
  6. <view class="title line2">
  7. {{item.car.machine_name}}
  8. </view>
  9. </view>
  10. <view class="machine ">
  11. <view class="acea-row row-between">
  12. <view class="it">
  13. 当前位置:{{item.car.address?item.car.address:'未定位'}}
  14. </view>
  15. <view class="status">
  16. 电量:{{item.car.residue}}%
  17. </view>
  18. </view>
  19. </view>
  20. <view class="machine acea-row row-between-wrapper">
  21. <view class="acea-row row-left">
  22. <view class="it">
  23. 编号:
  24. </view>
  25. <view class="code">
  26. {{item.car.machine_no}}
  27. </view>
  28. </view>
  29. <view class="acea-row row-rightss" v-if="item.plate_number">
  30. <view class="it">
  31. 车牌号:
  32. </view>
  33. <view class="code">
  34. {{item.car.plate_number}}
  35. </view>
  36. </view>
  37. </view>
  38. <view class="machine acea-row row-between-wrapper" v-if="item.touser">
  39. <view class="acea-row row-left">
  40. <view class="it">
  41. 姓名:
  42. </view>
  43. <view>
  44. {{item.touser.nickname}}
  45. </view>
  46. </view>
  47. <view class="acea-row row-left">
  48. <view class="it">
  49. 电话:
  50. </view>
  51. <view>
  52. {{item.touser.phone}}
  53. </view>
  54. </view>
  55. <view class="acea-row row-left">
  56. <view class="it">
  57. 备注:
  58. </view>
  59. <view>
  60. {{item.nickname}}
  61. </view>
  62. </view>
  63. </view>
  64. <view class="machine acea-row row-between-wrapper">
  65. <view class="acea-row row-right shrink-no">
  66. <view class="it">
  67. 到期:
  68. </view>
  69. <view>
  70. {{item.end_time}}
  71. </view>
  72. </view>
  73. <view @click="outAuth(item.id,ind)" class="acea-row row-right shrink-no">
  74. <view class="btn">
  75. 撤销授权
  76. </view>
  77. </view>
  78. </view>
  79. <view v-if="item.car.status==0" class="text_red tip ">
  80. 关锁
  81. </view>
  82. <view v-if="item.car.status==1" class="text_blue tip">
  83. 开锁
  84. </view>
  85. <view v-if="item.car.status==2" class="text_greed tip">
  86. 解锁
  87. </view>
  88. </view>
  89. <view class="loadingicon acea-row row-center-wrapper font-color-white" v-if="list.length > 0">
  90. <text class="loading iconfont icon-jiazai font-color-white" :hidden="loading == false"></text>
  91. {{ loadTitle }}
  92. </view>
  93. <view v-if="list.length == 0">
  94. <emptyPage v-if="!loading" :title="$t(`暂无授权`)"></emptyPage>
  95. <view class="loadingicon acea-row row-center-wrapper">
  96. <text class="loading iconfont icon-jiazai font-color-white" :hidden="loading == false"></text>
  97. </view>
  98. </view>
  99. <navigator :url="`./auth?id=`+id">
  100. <button class='modifyBnt acea-row row-middle row-center'>
  101. <text>
  102. {{$t(`新增授权`)}}
  103. </text>
  104. </button>
  105. </navigator>
  106. </view>
  107. </template>
  108. <script>
  109. import {
  110. toLogin
  111. } from '@/libs/login.js';
  112. import {
  113. getOneinfo,
  114. deleteCarAuth
  115. } from '@/api/rent.js';
  116. import {
  117. mapGetters
  118. } from "vuex";
  119. import colors from '@/mixins/color.js';
  120. import emptyPage from '@/components/emptyPage.vue';
  121. export default {
  122. mixins: [colors],
  123. components: {
  124. emptyPage,
  125. },
  126. data() {
  127. return {
  128. loading: false, //是否加载中
  129. loadend: false, //是否加载完毕
  130. loadTitle: this.$t(`加载更多`), //提示语
  131. list: [],
  132. page: 1,
  133. limit: 20,
  134. id: '',
  135. };
  136. },
  137. computed: mapGetters(['isLogin']),
  138. watch: {
  139. isLogin: {
  140. handler: function(newV, oldV) {
  141. if (newV) {
  142. this.getList();
  143. }
  144. },
  145. deep: true
  146. }
  147. },
  148. onLoad(options) {
  149. this.id = options.id
  150. if (this.isLogin) {
  151. this.getList();
  152. } else {
  153. toLogin();
  154. }
  155. },
  156. methods: {
  157. // 撤销授权
  158. outAuth(id, ind) {
  159. const that = this;
  160. uni.showLoading({
  161. title: '申请撤销授权中',
  162. mask: true
  163. });
  164. deleteCarAuth({
  165. id
  166. }).then((res) => {
  167. uni.hideLoading()
  168. uni.showToast({
  169. title: '撤销授权成功'
  170. });
  171. that.list.splice(ind, 1)
  172. }).catch((res) => {
  173. uni.hideLoading()
  174. })
  175. },
  176. // 授权列表
  177. getList: function() {
  178. let that = this;
  179. if (that.loadend) return;
  180. if (that.loading) return;
  181. that.loading = true;
  182. that.loadTitle = that.$t(`加载更多`);
  183. getOneinfo({
  184. id: that.id,
  185. type: 'auth',
  186. page: that.page,
  187. limit: that.limit
  188. })
  189. .then(res => {
  190. let list = res.data.list || [];
  191. let loadend = list.length < that.limit;
  192. that.list = that.$util.SplitArray(list, that.list);
  193. that.$set(that, 'list', that.list);
  194. that.loadend = loadend;
  195. that.loading = false;
  196. that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
  197. that.page = that.page + 1;
  198. console.log(that.list);
  199. })
  200. .catch(err => {
  201. that.loading = false;
  202. that.loadTitle = that.$t(`加载更多`);
  203. });
  204. },
  205. },
  206. onReachBottom: function() {
  207. this.getList();
  208. },
  209. // 滚动监听
  210. onPageScroll(e) {
  211. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  212. uni.$emit('scroll');
  213. },
  214. }
  215. </script>
  216. <style scoped lang="scss">
  217. .item {
  218. position: relative;
  219. background-color: var(--view-theme-16);
  220. padding: 30rpx;
  221. border-radius: 10rpx;
  222. margin-bottom: 20rpx;
  223. overflow: hidden;
  224. .title {
  225. font-weight: bold;
  226. font-size: $uni-font-size-lg;
  227. color: #fff;
  228. padding-left: 10rpx;
  229. }
  230. .machine {
  231. font-size: $uni-font-size-sm;
  232. color: #999999;
  233. margin-top: 20rpx;
  234. .code {
  235. color: var(--view-priceColor);
  236. background-color: rgba(#75EFFA, 0.2);
  237. padding: 5rpx 10rpx;
  238. border-radius: 10rpx;
  239. }
  240. .shrink-no {
  241. flex-shrink: 0;
  242. }
  243. .btn {
  244. color: #FFF;
  245. background-color: $uni-color-primary;
  246. line-height: 1;
  247. padding: 10rpx 20rpx;
  248. border-radius: 10rpx;
  249. }
  250. }
  251. .img {
  252. width: 40rpx;
  253. height: 40rpx;
  254. }
  255. .tip {
  256. position: absolute;
  257. top: 0;
  258. right: 0;
  259. padding: 5rpx 20rpx;
  260. font-size: 20rpx;
  261. border-bottom-left-radius: 10rpx;
  262. &.text_greed {
  263. color: #49D8A8;
  264. background-color: rgba(#49D8A8, 0.2);
  265. }
  266. &.text_red {
  267. color: rgba(254, 92, 45, 1);
  268. background-color: rgba(rgba(254, 92, 45, 1), 0.2);
  269. }
  270. &.text_blue {
  271. color: #1db0fc;
  272. background-color: rgba(#1db0fc, 0.2);
  273. }
  274. }
  275. }
  276. .listbox {
  277. padding: 30rpx;
  278. min-height: 100vh;
  279. background-color: var(--view-theme);
  280. padding-bottom: 150rpx;
  281. }
  282. .modifyBnt {
  283. position: fixed;
  284. bottom: 30rpx;
  285. left: 30rpx;
  286. // border: 2px solid #FFF;
  287. font-size: 32rpx;
  288. color: #fff;
  289. width: 690rpx;
  290. height: 90rpx;
  291. border-radius: 50rpx;
  292. text-align: center;
  293. background-color: var(--view-bntColor);
  294. }
  295. </style>