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.

ETC-product-status-list-query.vue 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="allContent">
  3. <view class="search-content">
  4. <view class="item">
  5. <text>产品名称:</text><input placeholder="请输入产品名称" v-model="state.promoteName" />
  6. </view>
  7. <view class="item">
  8. <text>产品状态:</text>
  9. <view>
  10. <picker @change="bindPickerChange" :value="state.index" :range="state.array">
  11. <view v-if="state.index>=0" class="uni-input">{{state.array[state.index]}}</view>
  12. <view v-else class="uni-input">请选择</view>
  13. </picker>
  14. </view>
  15. </view>
  16. <view class="item">
  17. <text>产品编号:</text><input placeholder="请输入产品编号" v-model="state.promoteId" /><text class="time-btn"
  18. @click="query(1)">查询</text>
  19. </view>
  20. </view>
  21. <view class="content">
  22. <view class="list-item" v-for="(item,index) in state.tableData" @click="goDeatls(item)">
  23. <view><text>产品编号:</text><text>{{item.promoteId}}</text></view>
  24. <view><text>产品名称:</text><text>{{item.promoteName}}</text></view>
  25. <view><text>产品状态:</text><text>{{item.status}}</text></view>
  26. <view><text>产品生效时间:</text><text>{{item.start}}</text></view>
  27. <view><text>产品过期时间:</text><text>{{item.end}}</text></view>
  28. <view><text>产品发行渠道名称:</text><text>{{item.agencyName[0]}}</text></view>
  29. </view>
  30. </view>
  31. <view class="noRecord" v-if="state.noRecord">暂无ETC状态名单查询记录</view>
  32. </view>
  33. </template>
  34. <script setup lang="ts">
  35. import { reactive } from "vue";
  36. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  37. import { ETCProductStatusListQueryApi } from "@/utils/network/api.js";
  38. import { request } from "@/utils/network/request.js";
  39. import { stringToJson } from "@/utils/network/encryption.js";
  40. const state = reactive({
  41. promoteName: "", //产品名称
  42. promoteId: "",//产品编号
  43. index: 0,
  44. array: ['可使用', '禁用'],
  45. carData: [], //所有车的数据
  46. tableData: [],
  47. noRecord: false,
  48. pageNo: 1,
  49. pageSize: 10,
  50. flags: false,
  51. });
  52. const bindPickerChange = (e) => {
  53. state.index = e.detail.value
  54. }
  55. const query = (params) => {
  56. // 点搜索的时候每次都从1开始
  57. if (params == 1) {
  58. state.pageNo = 1
  59. }
  60. if (state.pageNo == 1 && state.tableData.length > 0) {
  61. state.tableData = []
  62. }
  63. const options = {
  64. type: 2,
  65. data: {
  66. "agencyId": "52010106004",
  67. "pageNo": state.pageNo,
  68. "pageSize": state.pageSize,
  69. "status": state.index == 1 ? 'DISABLE' : "ENABLE",
  70. "promoteName": state.promoteName,
  71. "promoteId": state.promoteId,
  72. },
  73. method: "POST",
  74. showLoading: true,
  75. };
  76. console.log("options111111", options)
  77. //调用方式
  78. request(ETCProductStatusListQueryApi, options).then((res) => {
  79. // state.pageNo = 1
  80. const data = (stringToJson(res.bizContent)).data
  81. state.tableData = [...stringToJson(res.bizContent).data, ...state.tableData]
  82. if (state.tableData.length != 0) {
  83. state.noRecord = false
  84. } else {
  85. state.noRecord = true
  86. state.tableData = []
  87. }
  88. console.log("res", data, state.noRecord)
  89. })
  90. }
  91. // 触底加载
  92. onReachBottom(() => {
  93. if (state.tableData.length < state.pageNo * 10) return state.flags = true
  94. console.log("触底了")
  95. state.pageNo++
  96. query(2)
  97. })
  98. const goDeatls = (item) => {
  99. const params = encodeURIComponent(JSON.stringify(item))
  100. uni.navigateTo({
  101. url: `/subpackage/after-sale/ETC-product-status-list-query/ETC-product-status-list-query-details?params=${params}`
  102. })
  103. }
  104. </script>
  105. <style scoped>
  106. .allContent {
  107. background-color: #EEF7F7;
  108. height: calc(100vh - 200rpx);
  109. }
  110. .item {
  111. display: flex;
  112. font-size: 30rpx;
  113. margin: 20rpx 0 0 20rpx;
  114. }
  115. input,
  116. .uni-input {
  117. border: 1rpx solid #ccc;
  118. padding: 0 10rpx;
  119. }
  120. .time-btn {
  121. width: 120rpx;
  122. height: 60rpx;
  123. background: #00B38B;
  124. border-radius: 40rpx;
  125. color: #FFFFFF;
  126. font-size: 32rpx;
  127. line-height: 60rpx;
  128. text-align: center;
  129. margin-left: 60rpx;
  130. }
  131. .noRecord {
  132. text-align: center;
  133. margin: 100rpx auto;
  134. font-size: 32rpx;
  135. /* background-color: white; */
  136. }
  137. .list-item {
  138. width: 95%;
  139. border-radius: 10rpx;
  140. margin: 30rpx auto;
  141. font-size: 28rpx;
  142. border: 1rpx solid #ccc;
  143. padding: 12rpx;
  144. box-sizing: border-box;
  145. background-color: white;
  146. }
  147. .list-item>view {
  148. margin-bottom: 10rpx;
  149. }
  150. .search-content {
  151. padding: 10rpx;
  152. position: fixed;
  153. top: 0;
  154. left: 0;
  155. background: white;
  156. box-sizing: border-box;
  157. }
  158. .content {
  159. margin-top: 30%;
  160. padding-bottom: 20rpx;
  161. background-color: #EEF7F7;
  162. padding-top: 20rpx;
  163. }
  164. </style>