You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

transferRecord.vue 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="content">
  3. <text class="please">请选择车辆:</text>
  4. <view class="uni-list-cell-db">
  5. <picker @change="bindPickerChange" :value="state.index" :range="state.array">
  6. <view class="uni-input">{{state.array[state.index]}}</view>
  7. </picker>
  8. </view>
  9. <view class="time-btn" @click="query">查询</view>
  10. </view>
  11. <view class="list" v-for="(item,index) in state.tableData" :key="index">
  12. <view><text class="title">卡号:</text><text>{{item.cardId}}</text></view>
  13. <view><text class="title">签号:</text><text>{{item.obuId}}</text></view>
  14. <view><text class="title">车牌号:</text><text>{{item.vehiclePlate}}</text></view>
  15. <view><text class="title">过户状态:</text><text>{{item.statusChinese}}</text></view>
  16. <view><text class="title">过户开始时间:</text><text>{{item.insertTime}}</text></view>
  17. <view><text class="title">过户结束时间:</text><text>{{item.updateTime}}</text></view>
  18. </view>
  19. <view class="noRecord" v-if="state.noRecord">暂无过户记录</view>
  20. <view style="text-align: center;margin: 20rpx;margin-bottom: 50rpx;" v-if="state.flags">我是有底线的</view>
  21. </template>
  22. <script setup lang="ts">
  23. import { ref, reactive } from "vue";
  24. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  25. import { selectCarInfo, transferRecordApi } from "@/utils/network/api.js";
  26. import { getItem } from "@/utils/storage";
  27. import { request } from "@/utils/network/request.js";
  28. import { stringToJson } from "@/utils/network/encryption.js";
  29. const state = reactive({
  30. index: 0, //渠道订单编号
  31. array: [],
  32. carData: [], //所有车的数据
  33. vehicleId: "", //传给后端的车牌id
  34. tableData: [],
  35. noRecord: false,
  36. pageNo: 1,
  37. pageSize: 10,
  38. flags: false,
  39. });
  40. onLoad(() => {
  41. queryCarMsg();
  42. });
  43. const bindPickerChange = (e) => {
  44. state.index = e.detail.value
  45. }
  46. // 查询车辆信息
  47. const queryCarMsg = () => {
  48. const options = {
  49. type: 2,
  50. data: {
  51. "openId": getItem('openId')
  52. },
  53. method: "POST",
  54. showLoading: true,
  55. };
  56. //调用方式
  57. request(selectCarInfo, options).then((res) => {
  58. const data = (stringToJson(res.bizContent).vehicleManages)
  59. for (var i = 0; i < data.length; i++) {
  60. state.array.push(data[i]['vehiclePlate'])
  61. var obj = {};
  62. obj["vehiclePlate"] = data[i]['vehiclePlate']
  63. obj["vehicleId"] = data[i]['vehicleId']
  64. state.carData.push(obj)
  65. }
  66. console.log("state.list", data)
  67. console.log("state.carData", state.carData)
  68. })
  69. }
  70. const query = () => {
  71. for (var i = 0; i < state.carData.length; i++) {
  72. if (state.carData[i]["vehiclePlate"] == state.array[state.index]) {
  73. state.vehicleId = state.carData[i]["vehicleId"]
  74. }
  75. }
  76. console.log("state.array[state.index]", state.vehicleId)
  77. const options = {
  78. type: 2,
  79. data: {
  80. "openId": getItem('openId'),
  81. "uniqueId": state.vehicleId,
  82. "pageNo": state.pageNo,
  83. "pageSize": state.pageSize,
  84. },
  85. method: "POST",
  86. showLoading: true,
  87. };
  88. //调用方式
  89. request(transferRecordApi, options).then((res) => {
  90. const data = (stringToJson(res.bizContent)).data
  91. state.tableData = [...stringToJson(res.bizContent).data, ...state.tableData]
  92. if (state.tableData.length != 0) {
  93. for (var k = 0; k < state.tableData.length; k++) {
  94. // WAITING("等待使用", 0) USE("已使用", 1) CANCEL("弃置", -1)
  95. if (state.tableData[k]["status"] == "WAITING") {
  96. state.tableData[k]["statusChinese"] = "等待使用"
  97. } else if (state.tableData[k]["status"] == "USE") {
  98. state.tableData[k]["statusChinese"] = "已使用"
  99. } else {
  100. state.tableData[k]["statusChinese"] = "弃置"
  101. }
  102. state.tableData[k]["vehiclePlate"] = state.tableData[k]["uniquneId"].substring(0, state.tableData[k]["uniquneId"].length - 2)
  103. }
  104. state.noRecord = false
  105. // state.tableData = state.tableData
  106. } else {
  107. state.noRecord = true
  108. state.tableData = []
  109. }
  110. console.log("res", data, state.noRecord)
  111. })
  112. }
  113. // 触底加载
  114. onReachBottom(() => {
  115. if (state.tableData.length < state.pageNo * 10) return state.flags = true
  116. console.log("触底了")
  117. state.pageNo++
  118. query()
  119. })
  120. </script>
  121. <style scoped>
  122. .content {
  123. font-size: 32rpx;
  124. display: flex;
  125. padding: 20rpx;
  126. align-items: center;
  127. }
  128. .uni-input {
  129. border: 1rpx solid #c1c1c1;
  130. border-radius: 5rpx;
  131. padding: 2rpx 10rpx;
  132. }
  133. .please {
  134. margin-right: 26rpx;
  135. display: inline-block;
  136. }
  137. .time-btn {
  138. width: 120rpx;
  139. height: 60rpx;
  140. background: #00B38B;
  141. border-radius: 40rpx;
  142. color: #FFFFFF;
  143. font-size: 32rpx;
  144. line-height: 60rpx;
  145. text-align: center;
  146. margin-left: 60rpx;
  147. }
  148. .list {
  149. width: 93%;
  150. margin: 20rpx auto;
  151. background-color: #f4f4f4;
  152. border-radius: 10rpx;
  153. font-size: 32rpx;
  154. padding: 10rpx;
  155. box-sizing: border-box;
  156. }
  157. .list>view {
  158. margin: 20rpx;
  159. }
  160. .title {
  161. width: 30%;
  162. }
  163. .noRecord {
  164. text-align: center;
  165. margin: 100rpx auto;
  166. font-size: 32rpx;
  167. }
  168. </style>