myCar.vue 10 KB

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