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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. import { agentId } from "@/utils/network/difference";
  41. const state = reactive({
  42. promoteName: "", //产品名称
  43. promoteId: "",//产品编号
  44. index: 0,
  45. array: ['可使用', '禁用'],
  46. carData: [], //所有车的数据
  47. tableData: [],
  48. noRecord: false,
  49. pageNo: 1,
  50. pageSize: 10,
  51. flags: false,
  52. });
  53. const bindPickerChange = (e) => {
  54. state.index = e.detail.value
  55. }
  56. const query = (params) => {
  57. // 点搜索的时候每次都从1开始
  58. if (params == 1) {
  59. state.pageNo = 1
  60. }
  61. if (state.pageNo == 1 && state.tableData.length > 0) {
  62. state.tableData = []
  63. }
  64. const options = {
  65. type: 2,
  66. data: {
  67. "agencyId": agentId,
  68. "pageNo": state.pageNo,
  69. "pageSize": state.pageSize,
  70. "status": state.index == 1 ? 'DISABLE' : "ENABLE",
  71. "promoteName": state.promoteName,
  72. "promoteId": state.promoteId,
  73. },
  74. method: "POST",
  75. showLoading: true,
  76. };
  77. console.log("options111111", options)
  78. //调用方式
  79. request(ETCProductStatusListQueryApi, options).then((res) => {
  80. // state.pageNo = 1
  81. const data = (stringToJson(res.bizContent)).data
  82. state.tableData = [...stringToJson(res.bizContent).data, ...state.tableData]
  83. if (state.tableData.length != 0) {
  84. state.noRecord = false
  85. } else {
  86. state.noRecord = true
  87. state.tableData = []
  88. }
  89. console.log("res", data, state.noRecord)
  90. })
  91. }
  92. // 触底加载
  93. onReachBottom(() => {
  94. if (state.tableData.length < state.pageNo * 10) return state.flags = true
  95. console.log("触底了")
  96. state.pageNo++
  97. query(2)
  98. })
  99. const goDeatls = (item) => {
  100. const params = encodeURIComponent(JSON.stringify(item))
  101. uni.navigateTo({
  102. url: `/subpackage/after-sale/ETC-product-status-list-query/ETC-product-status-list-query-details?params=${params}`
  103. })
  104. }
  105. </script>
  106. <style scoped>
  107. .allContent {
  108. background-color: #EEF7F7;
  109. height: calc(100vh - 200rpx);
  110. }
  111. .item {
  112. display: flex;
  113. font-size: 30rpx;
  114. margin: 20rpx 0 0 20rpx;
  115. }
  116. input,
  117. .uni-input {
  118. border: 1rpx solid #ccc;
  119. padding: 0 10rpx;
  120. }
  121. .time-btn {
  122. width: 120rpx;
  123. height: 60rpx;
  124. background: #00B38B;
  125. border-radius: 40rpx;
  126. color: #FFFFFF;
  127. font-size: 32rpx;
  128. line-height: 60rpx;
  129. text-align: center;
  130. margin-left: 60rpx;
  131. }
  132. .noRecord {
  133. text-align: center;
  134. margin: 100rpx auto;
  135. font-size: 32rpx;
  136. /* background-color: white; */
  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. .search-content {
  152. padding: 10rpx;
  153. position: fixed;
  154. top: 0;
  155. left: 0;
  156. background: white;
  157. box-sizing: border-box;
  158. }
  159. .content {
  160. margin-top: 30%;
  161. padding-bottom: 20rpx;
  162. background-color: #EEF7F7;
  163. padding-top: 20rpx;
  164. }
  165. </style>