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.8KB

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