myCar.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view :class="$isEmpty(list) ? 'bg-white':''">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  4. <!-- <myCarCard @delItem="delItem" :list="list"></myCarCard> -->
  5. <u-popup v-model="detailShow" mode="center" width="670" :closeable="true" border-radius="10" negative-top="300">
  6. <view style="padding: 60rpx 5rpx 40rpx;">
  7. <u-cell-group >
  8. <u-cell-item :icon-style="iconStyle" :border-top="false" :arrow="false" icon="eye-fill" title="车牌号码:" :value="detailData.number"></u-cell-item>
  9. <u-cell-item :key="index" v-for="(item,index) in carTypeList" v-if="item.value==detailData.type" :value="item.label" :icon-style="iconStyle" :arrow="false" icon="car-fill" title="车辆类型:" ></u-cell-item>
  10. <u-cell-item :key="index" v-for="(item,index) in carPropertiesList" v-if="item.value==detailData.properties" :value="item.label" :icon-style="iconStyle" :arrow="false" icon="error-circle-fill" title="车辆性质:" ></u-cell-item>
  11. <u-cell-item value-style="{'color':'#5064eb'}" :key="index" v-for="(item,index) in fuelCategoryList" v-if="item.value==detailData.fuelCategory" :value="item.label" :icon-style="iconStyle" :border-bottom="false" :arrow="false" icon="grid-fill" title="燃油类别:" ></u-cell-item>
  12. <u-cell-item v-if="detailData.opinion" :icon-style="iconStyle" :border-top="false" :arrow="false" icon="more-circle-fill" title="审核意见:" :value="detailData.opinion"></u-cell-item>
  13. </u-cell-group>
  14. </view>
  15. </u-popup>
  16. <view @click="detailData=item;detailShow=true" class="card" v-for="(item,index) in list" :key="index">
  17. <view class="top" >
  18. <text class="number">车牌号:{{item.number}}</text>
  19. <!-- <text @click.stop="jump('/pages/index/car/list?carNo='+item.number)" style="text-decoration: underline;margin-top: 10rpx;">出入记录</text> -->
  20. </view>
  21. <view class="center">
  22. <view style="display: flex;">
  23. <view @click.stop="$util.preview(item.carImg)" class="justify-center align-center">
  24. <image :src="item.carImg" mode=""></image>
  25. </view>
  26. <view class="content">
  27. <text class="padding-bottom-10">车主姓名:{{item.personName}}</text>
  28. <text class="padding-top-10">车主电话:{{item.personPhone}}</text>
  29. <view class="padding-bottom-10" v-if="false">
  30. 审核状态:
  31. <text style="color: #008f69;" v-if="item.auditStatus==1">已通过</text>
  32. <text style="color: #ea7500;" v-if="item.auditStatus==0">待审核</text>
  33. <text style="color: #da0000;" v-if="item.auditStatus==-1">未通过</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="bottom" >
  39. <view @click.stop="edit(item)" style="font-size: 22rpx;" class="cu-btn sm round base-line margin-right-20" >
  40. <u-icon name="edit-pen-fill" style="padding-right: 10rpx;"></u-icon>
  41. 编辑
  42. </view>
  43. <!-- <view @click.stop="delItem(item)" style="font-size: 22rpx;" class="cu-btn sm round red-line" >
  44. <u-icon name="edit-pen-fill" style="padding-right: 10rpx;"></u-icon>
  45. 删除
  46. </view> -->
  47. </view>
  48. </view>
  49. <view style="height: 80rpx;" v-if="status">
  50. <u-divider bgColor="#f1f1f1;" height="80">到底了</u-divider>
  51. </view>
  52. </mescroll-body>
  53. <view class="addCar" @click="add">
  54. <u-icon name="plus-circle-fill" size="70" color="#5064eb"></u-icon>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import MescrollMixin from "@/comps/mescroll-body/mescroll-mixins.js";
  60. import DtEmpty from '@/comps/dt_empty.vue';
  61. var app = getApp();
  62. export default {
  63. mixins: [MescrollMixin], // 使用mixin
  64. components: {
  65. DtEmpty
  66. },
  67. data() {
  68. return {
  69. list: [],
  70. iconStyle: {
  71. color: '#5064eb'
  72. },
  73. page: {
  74. current: 1,
  75. size:30,
  76. },
  77. status: false,
  78. //详情
  79. detailShow: false,
  80. detailData: {},
  81. carTypeList: [],
  82. carPropertiesList: [],
  83. fuelCategoryList: []
  84. }
  85. },
  86. onLoad() {
  87. // this.personId = this.$cache.get('userId');
  88. this.getDict();
  89. },
  90. onShow() {
  91. //刷新mescroll数据
  92. this.$util.reload(this.mescroll);
  93. },
  94. methods: {
  95. add() {
  96. uni.navigateTo({
  97. url: "add"
  98. })
  99. },
  100. delItem(item) {
  101. this.$util.showModal('确认要删除此记录吗?').then(res => {
  102. // this.$api.car.carRemove(item.id).then(res => {
  103. // if (res.success == true) {
  104. // this.$u.toast('操作成功')
  105. // this.mescroll.resetUpScroll();
  106. // } else {
  107. // this.$util.showModal(res.msg, false)
  108. // }
  109. // })
  110. })
  111. },
  112. edit(item) {
  113. //重新编辑,审核状态重置为0
  114. let params = {
  115. id: item.id,
  116. auditOpinion: "",
  117. auditStatus: 0,
  118. carImg: item.carImg,
  119. fuelCategory: item.fuelCategory,
  120. number: item.number,
  121. properties: item.properties,
  122. type: item.type,
  123. vehicleDrivingLicense1: item.vehicleDrivingLicense1,
  124. vehicleDrivingLicense2: item.vehicleDrivingLicense2
  125. }
  126. uni.navigateTo({
  127. url:"/pages/myCar/add"+this.$u.queryParams(params)
  128. })
  129. },
  130. jump(url) {
  131. if (!this.$isEmpty(url)) {
  132. uni.navigateTo({
  133. url
  134. })
  135. }
  136. },
  137. getDict() {
  138. let carType = uni.getStorageSync("carType");
  139. let carProperty = uni.getStorageSync("carProperty");
  140. let fuelCategory = uni.getStorageSync("fuelCategory");
  141. if (!this.$isEmpty(carType) || !this.$isEmpty(carProperty) || !this.$isEmpty(fuelCategory)) {
  142. this.carTypeList = carType;
  143. this.carPropertiesList = carProperty;
  144. this.fuelCategoryList = fuelCategory;
  145. return;
  146. }
  147. // let operation = 'permissions/dict/getByCode?code=car_type';
  148. let that = this;
  149. let params = {};
  150. //车辆类型
  151. that.$http.getDictByCode("car_type").then (res=>{
  152. if (res.data.code != 200) {
  153. app.globalData.oneFailHint(res.data.msg, function () {
  154. uni.switchTab({
  155. url:"../index/index"
  156. })
  157. });
  158. }
  159. res.data.data.forEach((item) => {
  160. let tmp = {
  161. value: item.dictKey,
  162. label: item.dictValue
  163. }
  164. that.carTypeList.push(tmp)
  165. })
  166. uni.setStorageSync("carType",that.carTypeList)
  167. });
  168. //车辆性质
  169. // operation = "permissions/dict/getByCode?code=car_properties"
  170. that.$http.getDictByCode("car_properties").then(res=>{
  171. if (res.data.code != 200) {
  172. app.globalData.oneFailHint(res.data.msg, function () {
  173. uni.switchTab({
  174. url:"../index/index"
  175. })
  176. });
  177. }
  178. res.data.data.forEach((item) => {
  179. let tmp = {
  180. value:item.dictKey,
  181. label:item.dictValue
  182. }
  183. that.carPropertiesList.push(tmp)
  184. })
  185. uni.setStorageSync("carProperty",that.carPropertiesList)
  186. });
  187. //燃油类别
  188. // operation = "permissions/dict/getByCode?code=fuel_category"
  189. that.$http.getDictByCode("fuel_category").then (res=>{
  190. if (res.data.code != 200) {
  191. app.globalData.oneFailHint(res.data.msg, function () {
  192. uni.switchTab({
  193. url:"../index/index"
  194. })
  195. });
  196. }
  197. res.data.data.forEach((item)=>{
  198. let tmp = {
  199. value:item.dictKey,
  200. label:item.dictValue
  201. }
  202. that.fuelCategoryList.push(tmp);
  203. })
  204. uni.setStorageSync("fuelCategory",that.fuelCategoryList)
  205. });
  206. },
  207. downCallback(mescroll){
  208. setTimeout(()=>{
  209. this.mescroll.resetUpScroll()
  210. },200)
  211. },
  212. upCallback(mescroll) {
  213. let that = this;
  214. let params = {
  215. current: mescroll.num,
  216. size: 10,
  217. residentialId:uni.getStorageSync("residentialId"),
  218. memberId:this.vuex_member.id
  219. }
  220. try {
  221. that.$http.carPage(params).then (res=>{
  222. let data = res.data.data.records
  223. let total = res.data.data.total;
  224. mescroll.endBySize(data.length, total);
  225. if (mescroll.num == 1) {
  226. that.list = []; //如果是第一页需手动制空列表
  227. }
  228. that.list = that.list.concat(data); //追加新数据
  229. });
  230. } catch(e) {
  231. this.mescroll.endErr()
  232. }
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="scss" scoped>
  238. .detail-img {
  239. display: flex;
  240. justify-content: space-around;
  241. text-align: center;
  242. color: #707175;
  243. view {
  244. display: flex;
  245. flex-direction: column;
  246. width: 48%;
  247. height: 300rpx;
  248. text{
  249. padding: 10rpx 0;
  250. }
  251. }
  252. }
  253. .addCar {
  254. width: 100upx;
  255. height: 90upx;
  256. border-radius: 60upx 0 0 60upx;
  257. position: fixed;
  258. bottom: 200upx;
  259. right: 0;
  260. z-index: 999;
  261. display: flex;
  262. justify-content: center;
  263. align-items: center;
  264. background: #ffffff;
  265. box-shadow: -4upx -4upx 30upx #888888;
  266. }
  267. .base-line{
  268. font-weight: 800;
  269. color: #5064eb;
  270. border: 1rpx solid #5064eb;
  271. }
  272. .red-line{
  273. font-weight: 800;
  274. color: #da0000;
  275. border: 1rpx solid #da0000;
  276. }
  277. .card {
  278. background-color: #FFFFFF;
  279. margin: 20rpx;
  280. padding: 0 40rpx;
  281. border-radius: 20rpx;
  282. display: flex;
  283. flex-direction: column;
  284. image{
  285. width: 120rpx;
  286. height: 120rpx;
  287. }
  288. .top {
  289. display: flex;
  290. justify-content: space-between;
  291. padding: 20rpx 0 20rpx 0rpx;
  292. border-bottom: 1rpx solid #e5e5e5;
  293. .number {
  294. font-size: 34rpx;
  295. }
  296. .audit {
  297. font-size: 30rpx;
  298. }
  299. }
  300. .center {
  301. padding: 40rpx 0;
  302. border-bottom: 1rpx solid #e5e5e5;
  303. display: flex;
  304. justify-content: space-between;
  305. .content {
  306. padding-left: 30rpx;
  307. display: flex;
  308. flex-direction: column;
  309. font-size: 30rpx;
  310. text {
  311. padding-bottom: 10rpx;
  312. }
  313. }
  314. .record {
  315. display: flex;
  316. justify-content: center;
  317. align-items: center;
  318. color: #545454;
  319. }
  320. }
  321. .bottom {
  322. display: flex;
  323. justify-content: flex-end;
  324. padding: 20rpx 0;
  325. }
  326. }
  327. </style>