Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

month-statement-query-list.vue 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="content">
  3. <view class="top-content">
  4. <view class="example-body">
  5. <text>请选择月份:</text>
  6. <picker mode="date" @change="bindDateChange" fields="month">
  7. <view class="uni-input">{{state.date}}</view>
  8. </picker>
  9. <button size="mini" style="color: #ffffff;
  10. backgroundColor: rgb(118, 200, 77);
  11. borderColor: rgb(118, 200, 77);
  12. font-size: 26rpx;
  13. flex-shrink: 0;margin-left: 20rpx;" @click="search()">搜索</button>
  14. </view>
  15. </view>
  16. <view class="uni-container" v-if="state.listData.length>0">
  17. <view class="list-item" v-for="(item,index) in state.listData"
  18. @click="query(item.handleDate,item.vehicleId)">
  19. <view><text>姓名:</text><text>{{item.customerName}}</text></view>
  20. <view><text>证件号码:</text><text>{{item.customerIdNum}}</text></view>
  21. <view><text>通行次数:</text><text>{{item.num}}</text></view>
  22. <view><text>通行年月:</text><text>{{item.handleDate}}</text></view>
  23. <view><text>通行车牌号:</text><text>{{state.vehicleNum}}</text></view>
  24. <view><text>通行车牌颜色:</text><text>{{state.vehicleColor}}</text></view>
  25. <view><text>月通行总额:</text><text>{{item.money/100}}元</text></view>
  26. </view>
  27. <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup lang="ts">
  32. import { reactive } from "vue";
  33. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  34. import { monthStatementApi, getUserMsg,monthlyStatementQuery } from "@/utils/network/api.js";
  35. import { stringToJson } from "@/utils/network/encryption";
  36. import { request, requestNew } from "@/utils/network/request.js";
  37. import { getItem, StorageKeys } from "@/utils/storage";
  38. import { getVehiclePlateColor } from "@/datas/vehiclePlateColor";
  39. import { msg, navTo } from "@/utils/utils";
  40. const state = reactive({
  41. startTime: Date.now(), //日期
  42. listData: [],
  43. range: ['', ''],
  44. flags: false,
  45. vehicleId: "",
  46. customerIdNum: "",
  47. vehicleNum: "",
  48. vehicleColor: "",
  49. date: "请选择月份"
  50. })
  51. onLoad((option) => {
  52. console.log("option", option.vehicleId)
  53. state.vehicleId = option.vehicleId;
  54. state.vehicleNum = option.vehicleId.split('_')[0];
  55. state.vehicleColor = getVehiclePlateColor(option.vehicleId.split('_')[1]);
  56. getUserinfo()
  57. })
  58. const bindDateChange = (e) => {
  59. state.date = e.detail.value
  60. }
  61. const getUserinfo = () => {
  62. const options = {
  63. type: 2,
  64. data: { openId: getItem('openId') },
  65. method: "POST",
  66. showLoading: true,
  67. };
  68. request(getUserMsg, options).then((res) => {
  69. const data = stringToJson(res.bizContent);
  70. console.log(data, "用户信息");
  71. state.customerIdNum = data.customerIdNum
  72. });
  73. }
  74. //业务完成日志
  75. const search = () => {
  76. if (state.date == '请选择月份') {
  77. msg("请选择月份");
  78. return;
  79. }
  80. var data = {
  81. startTime: state.date,
  82. // endTime: state.range[1],
  83. vehicleId: state.vehicleId,
  84. customerIdNum: state.customerIdNum
  85. };
  86. const options = {
  87. type: 2,
  88. data: data,
  89. method: "POST",
  90. showLoading: true,
  91. };
  92. requestNew(monthlyStatementQuery, options).then((res) => {
  93. const data = stringToJson(res.bizContent);
  94. state.listData = stringToJson(res.bizContent).data
  95. console.log("业务完成日志", state.listData,)
  96. });
  97. }
  98. const query = (handleDate, vehicleId) => {
  99. navTo(`/subpackage/personal-center/search/select-card?vehicleId=${vehicleId}&&handleDate=${handleDate}`)
  100. }
  101. </script>
  102. <style scoped>
  103. .top-content {
  104. position: fixed;
  105. left: 0;
  106. top: 0;
  107. background-color: white;
  108. width: 100%;
  109. padding: 20rpx;
  110. box-sizing: border-box;
  111. }
  112. .content {
  113. font-size: 32rpx;
  114. padding: 20rpx 30rpx;
  115. background-color: #EEF7F7;
  116. min-height: 100vh;
  117. }
  118. .card {
  119. display: flex;
  120. margin: 0 20rpx;
  121. align-items: center;
  122. }
  123. .title {
  124. margin-bottom: 20rpx;
  125. }
  126. .uni-container {
  127. margin: 50rpx 0;
  128. margin-top: 150rpx;
  129. }
  130. .example-body {
  131. display: flex;
  132. align-items: center;
  133. margin-top: 20rpx;
  134. }
  135. /deep/.uni-date-x {
  136. height: 76rpx !important;
  137. }
  138. .list-item {
  139. width: 95%;
  140. border-radius: 10rpx;
  141. margin: 30rpx auto;
  142. font-size: 28rpx;
  143. border: 1rpx solid #ccc;
  144. padding: 12rpx;
  145. box-sizing: border-box;
  146. background-color: white;
  147. }
  148. .list-item>view {
  149. margin-bottom: 10rpx;
  150. }
  151. .bottom-line {
  152. text-align: center;
  153. margin: 30rpx 0;
  154. }
  155. .uni-input {
  156. width: 200rpx;
  157. border: 1rpx solid #ccc;
  158. border-radius: 10rpx;
  159. }
  160. </style>