quoteRecords.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view class="page">
  3. <view class="header">
  4. <uni-NavBar headerTitle="报价记录" background="#fff" rightText="搜索" :isSlot="false" @share="search"
  5. :rightIcon="false" :rightTextStyle="{fontSize:'30rpx'}"></uni-NavBar>
  6. </view>
  7. <view class="data-content dis f-c ">
  8. <view class="view-item dis a-c j-s" v-for="(item,index) in quoteRecordsList" :key="index">
  9. <view class="info dis a-c">
  10. <image class="img mr-1" src="/static/image/car.png" mode=""></image>
  11. <view class="dis f-c j-s">
  12. <text class="license">{{item.licenseNo}}</text>
  13. <text class="count">{{item.quoteNumber}}次报价记录</text>
  14. </view>
  15. </view>
  16. <view class="btn" @click="revisedQuote(item.orderNo)">
  17. 重新报价
  18. </view>
  19. <view class="btn ml-2" @click="historyQuery(item.licenseNo)">
  20. 历史查询
  21. </view>
  22. </view>
  23. <u-loadmore v-if="quoteRecordsList.length!=0" :status="status" />
  24. </view>
  25. <!-- 报价记录弹窗 -->
  26. <uni-Popup :show="quotationRecordShow" @close='quotationRecordShow=false' :headerSlot="true" :closeable="false"
  27. headerTitle="选择出单机构" overflow="auto" maxHeight="1162rpx">
  28. <template #header>
  29. <view class="RecordPopup-header dis j-s a-c">
  30. <view class="license dis a-c">
  31. <image src="/static/image/car.png" mode=""></image>
  32. <text>{{licenseNo}}</text>
  33. </view>
  34. <text class="count">{{insuranceCompanyList.length}}次报价记录</text>
  35. </view>
  36. </template>
  37. <template #content>
  38. <view class="RecordPopup-overflow">
  39. <view class="item mb-2" v-for="(item,index) in insuranceCompanyList" :key="index">
  40. <view class="quotationInfo dis f-c ">
  41. <view class="Info-header dis a-c j-s ">
  42. <view class="dis a-c ">
  43. <image class="insuranceCompany" :src="item.logo" mode=""></image>
  44. <text class="Company-title">{{item.companyName}}</text>
  45. </view>
  46. <view class="time dis a-c ">
  47. <image src="/static/icon/time.png" mode=""></image>
  48. <text>{{item.quoteTime}}</text>
  49. </view>
  50. </view>
  51. <view class=" dis sum">
  52. <text>险种:{{item.productName}}</text>
  53. <text>保费:¥{{item.sumPremium || 0 }}</text>
  54. </view>
  55. </view>
  56. <view class="combination-btn dis ">
  57. <view class="dis a-c j-c " @click="revisedQuote(item.orderNo)">
  58. 重新报价
  59. </view>
  60. <view class="dis a-c j-c " @click="Detailview(item.orderNo)">
  61. 查看
  62. </view>
  63. </view>
  64. </view>
  65. <view class=" dis a-c f-c" v-if="insuranceCompanyList.length==0">
  66. <u-empty mode="car" icon="/static/image/Empty1.png" text="暂无报价记录" width="120" height="120">
  67. </u-empty>
  68. <view class="empty-btn mt-2" @click="quote">
  69. 去报价
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. </uni-Popup>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. quotationRecordShow: true,
  82. pageRequest: {
  83. pages: 1,
  84. size: 20,
  85. licenseNo: "", //车牌号
  86. },
  87. status: 'loadmore',
  88. totalPages: 0, //订单总页数
  89. licenseNo: "",
  90. quoteRecordsList: [], //报价记录列表
  91. insuranceCompanyList: [], //保险公司列表
  92. }
  93. },
  94. onReachBottom() {
  95. this.loadNextPage(); //触底加载(加载中/没有更多时内部自动忽略)
  96. },
  97. onShow() {
  98. },
  99. onLoad(options) {
  100. if (options) {
  101. this.licenseNo = options.license;
  102. this.fetchQuoteHistory();
  103. this.quoteHistory(this.licenseNo);
  104. }
  105. },
  106. methods: {
  107. // 加载下一页(触底与自动补屏共用)
  108. loadNextPage() {
  109. if (this.status == 'loading' || this.status == 'nomore') return; //加载中/没有更多:忽略
  110. this.status = 'loading';
  111. this.pageRequest.pages = this.pageRequest.pages + 1;
  112. setTimeout(async () => {
  113. let res = await this.$http.post('/supplementOrder/getHistoryQuoteList', this.pageRequest);
  114. if (res.code == '200') {
  115. this.quoteRecordsList = [...this.quoteRecordsList, ...res.data.records];
  116. this.totalPages = res.data.pages; //以接口返回的总页数为准
  117. if (this.pageRequest.pages >= this.totalPages) this.status = 'nomore';
  118. else this.status = 'loadmore'; //还有下一页:回到"加载更多"
  119. this.autoLoadMore(); //追加后若仍不满一屏,继续自动补页
  120. } else {
  121. this.status = 'loadmore'; //请求失败:回到"加载更多",允许重试
  122. }
  123. }, 1000)
  124. },
  125. // 列表内容不满一屏时自动加载,直到占满或没有更多(报价记录少于一屏时触底事件不会触发)
  126. autoLoadMore() {
  127. this.$nextTick(() => {
  128. uni.createSelectorQuery().in(this)
  129. .select('.data-content').boundingClientRect()
  130. .selectViewport().boundingClientRect()
  131. .exec((res) => {
  132. if (!res || !res[0] || !res[1]) return;
  133. // 内容底部已超出可视区底部:已占满一屏,无需补页
  134. if (res[0].bottom >= res[1].height) return;
  135. // 没有更多数据:直接置为"没有更多"
  136. if (this.pageRequest.pages >= this.totalPages) {
  137. if (this.quoteRecordsList.length > 0) this.status = 'nomore';
  138. return;
  139. }
  140. // 还有数据:自动翻页(loadNextPage 成功后还会再次检查)
  141. this.loadNextPage();
  142. });
  143. });
  144. },
  145. //报价记录
  146. async fetchQuoteHistory() {
  147. this.pageRequest.pages = 1; //每次重新查询都从第一页开始
  148. this.status = 'loadmore'; //重置加载状态
  149. let res = await this.$http.post('/supplementOrder/getHistoryQuoteList', this.pageRequest);
  150. if (res.code == 200) {
  151. this.quoteRecordsList = res.data.records;
  152. this.totalPages = res.data.pages;
  153. this.autoLoadMore(); //数据不满一屏时自动补页/置为"没有更多"
  154. }
  155. },
  156. async quoteHistory(licenseNo) {
  157. let res = await this.$http.post('/supplementOrder/getHistoryQuoteByLicenseNo', {
  158. licenseNo: licenseNo,
  159. });
  160. if (res.code == 200) {
  161. this.insuranceCompanyList = res.data;
  162. }
  163. },
  164. //重新报价
  165. revisedQuote(orderNo) {
  166. uni.navigateTo({
  167. url: "/pages/quote/premiumCalc?ordersNo=" + orderNo
  168. })
  169. },
  170. //报价历史查询
  171. async historyQuery(item) {
  172. this.licenseNo = item;
  173. await this.quoteHistory(item)
  174. this.quotationRecordShow = true;
  175. },
  176. search() {
  177. uni.navigateTo({
  178. url: '/pages/quote/quoteRecordSearch'
  179. })
  180. },
  181. //去报价
  182. quote() {
  183. uni.switchTab({
  184. url: '/pages/index/index'
  185. })
  186. },
  187. //查看详情
  188. Detailview(orderNo) {
  189. this.quotationRecordShow = false;
  190. uni.navigateTo({
  191. url: '/pages/quote/quoteRecordDetail?ordersNo=' + orderNo
  192. })
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. .page {
  199. background-color: #F8F8F8;
  200. }
  201. .header {
  202. position: fixed;
  203. top: 0;
  204. left: 0;
  205. right: 0;
  206. z-index: 9999;
  207. }
  208. .data-content {
  209. padding-top: 180rpx;
  210. .view-item {
  211. padding: 20rpx 30rpx;
  212. box-sizing: border-box;
  213. border-bottom: 1rpx solid #eee;
  214. background-color: #fff;
  215. .info {
  216. flex: 1;
  217. }
  218. .img {
  219. width: 90rpx;
  220. height: 90rpx;
  221. }
  222. .license {
  223. font-size: 34rpx;
  224. color: #333;
  225. font-weight: bold;
  226. }
  227. .count {
  228. font-size: 28rpx;
  229. color: #999;
  230. }
  231. .btn {
  232. padding: 13rpx 20rpx;
  233. box-sizing: border-box;
  234. background: rgba(253, 233, 53, 0.2);
  235. border-radius: 58rpx 58rpx 58rpx 58rpx;
  236. border: 1rpx solid #FDE935;
  237. font-size: 30rpx;
  238. color: #1F1F1F;
  239. }
  240. }
  241. }
  242. // 弹窗样式
  243. .RecordPopup-header {
  244. .license {
  245. image {
  246. width: 48rpx;
  247. height: 48rpx;
  248. }
  249. text {
  250. font-size: 34rpx;
  251. color: #333;
  252. margin-left: 10rpx;
  253. font-weight: bold;
  254. }
  255. }
  256. .count {
  257. font-size: 28rpx;
  258. color: #999;
  259. }
  260. }
  261. // 弹窗内容区
  262. .RecordPopup-overflow {
  263. padding: 30rpx;
  264. box-sizing: border-box;
  265. .item {
  266. background: #FFFFFF;
  267. border-radius: 10rpx 10rpx 10rpx 10rpx;
  268. border: 1rpx solid #EEEEEE;
  269. }
  270. .quotationInfo {
  271. padding: 30rpx 30rpx 24rpx;
  272. box-sizing: border-box;
  273. border-bottom: 1rpx solid #EEEEEE;
  274. .insuranceCompany {
  275. width: 40rpx;
  276. height: 40rpx;
  277. }
  278. // 保险公司
  279. .Company-title {
  280. font-size: 32rpx;
  281. color: #333;
  282. margin-left: 10rpx;
  283. }
  284. // 日期
  285. .time {
  286. image {
  287. width: 22rpx;
  288. height: 22rpx;
  289. }
  290. font-size: 22rpx;
  291. color: #666;
  292. }
  293. .sum {
  294. width: 100%;
  295. font-size: 30rpx;
  296. color: #666;
  297. margin-top: 24rpx;
  298. text {
  299. width: 50%;
  300. }
  301. }
  302. }
  303. .combination-btn {
  304. view {
  305. width: 49%;
  306. padding: 14rpx;
  307. box-sizing: border-box;
  308. font-size: 30rpx;
  309. color: #333;
  310. font-weight: bold;
  311. }
  312. view:last-child {
  313. border-left: 1rpx solid #eee;
  314. }
  315. }
  316. }
  317. .empty-btn {
  318. padding: 13rpx 30rpx;
  319. box-sizing: border-box;
  320. background: rgba(253, 233, 53, 0.2);
  321. border-radius: 58rpx 58rpx 58rpx 58rpx;
  322. border: 1rpx solid #FDE935;
  323. font-size: 30rpx;
  324. color: #1F1F1F;
  325. }
  326. </style>