search-instrument.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <view class="container supplier clearfix">
  3. <view class="supplier-search clearfix">
  4. <view class="search-from name">
  5. <text class="iconfont icon-sousuo"></text>
  6. <input class="input"
  7. type="text"
  8. confirm-type="search"
  9. v-model="searchInputVal"
  10. @input="onShowClose"
  11. @confirm="initsupplierList()"
  12. placeholder="请输入仪器名称"
  13. maxlength="16"/>
  14. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText()"></text>
  15. </view>
  16. <view class="search-btn">
  17. <button class="search-btn" type="default" @click.stop="searchsupplierList">搜索</button>
  18. </view>
  19. </view>
  20. <view class="supplier-main">
  21. <view v-if="isEmpty" class="empty-container">
  22. <image class="supplier-empty-image" src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png" mode="aspectFit"></image>
  23. <view class="txt">暂无供应商数据</view>
  24. </view>
  25. <view v-else class="supplier-list">
  26. <view class="list clearfix" v-for="(item, index) in list" :key="index">
  27. <image class="pros-item-image" :src="item.image" mode="scaleToFill"></image>
  28. <view class="pros-name">{{ item.name }}</view>
  29. </view>
  30. <!--加载loadding-->
  31. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  32. <tui-nomore :visible="!pullUpOn" bgcolor="#F7F7F7" :text='nomoreText'></tui-nomore>
  33. <!--加载loadding-->
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import authorize from '@/common/config/authorize.js'
  40. import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
  41. import tuiNomore from "@/components/tui-components/nomore/nomore"
  42. import uniStars from '@/components/uni-stars/uni-stars.vue'
  43. import { getFindAllsupplierList } from "@/api/seller.js"
  44. export default {
  45. components:{
  46. tuiLoadmore,
  47. tuiNomore,
  48. uniStars
  49. },
  50. data() {
  51. return {
  52. iconClass:'icon-aixin',
  53. iconColor:'#ff9100',
  54. serviceProviderId:'',
  55. isShowClose:false,
  56. searchInputVal:'',
  57. isEmpty:false,
  58. nomoreText: '上拉显示更多',
  59. pageNum:1,
  60. pageSize:10,
  61. hasNextPage:false,
  62. loadding: false,
  63. pullUpOn: true,
  64. pullFlag: true,
  65. allowDataStatus:true,
  66. wrapperHeight:'100%',
  67. scrollHeight:'',
  68. deleteAddressId:'',
  69. currPage:'',//当前页面
  70. prevPage:'',//上一个页面
  71. tabCurrentIndex:0,
  72. listStatus:1,
  73. list:[
  74. {
  75. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  76. name:'北京恩盛众成国际贸易有限公司',
  77. },
  78. {
  79. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  80. name:'北京恩盛众成国际贸易有限公司',
  81. },
  82. {
  83. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  84. name:'北京恩盛众成国际贸易有限公司',
  85. },
  86. {
  87. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  88. name:'北京恩盛众成国际贸易有限公司',
  89. },
  90. {
  91. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  92. name:'北京恩盛众成国际贸易有限公司',
  93. },
  94. {
  95. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  96. name:'北京恩盛众成国际贸易有限公司',
  97. },
  98. {
  99. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  100. name:'北京恩盛众成国际贸易有限公司',
  101. },
  102. {
  103. image:'https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png',
  104. name:'北京恩盛众成国际贸易有限公司',
  105. },
  106. ],
  107. isIphoneX:this.$store.state.isIphoneX,
  108. show_index:0,//控制显示那个组件
  109. }
  110. },
  111. onLoad(){
  112. this.setScrollHeight();
  113. },
  114. methods: {
  115. setScrollHeight() {
  116. // 窗口高度 - 底部距离
  117. setTimeout(()=> {
  118. const query = wx.createSelectorQuery().in(this);
  119. query.selectAll('.add-btn').boundingClientRect();
  120. query.exec(res => {
  121. if(res[0][0]){
  122. let winHeight = this.$api.getWindowHeight(),
  123. eleTop = res[0][0].top - 1;
  124. this.scrollHeight = eleTop;
  125. }
  126. })
  127. }, 500)
  128. },
  129. searchsupplierList(){
  130. this.pageNum=1
  131. this.initsupplierList()
  132. },
  133. initsupplierList(){
  134. let params = { searchWord:this.searchInputVal,pageNum:1,pageSize:this.pageSize }
  135. getFindAllsupplierList(params).then(response =>{
  136. let responseData = response.data
  137. if(responseData.results&&responseData.results.length > 0){
  138. this.isEmpty = false
  139. this.hasNextPage = response.data.hasNextPage
  140. this.supplierList =responseData.results
  141. this.pullFlag = false;
  142. setTimeout(()=>{this.pullFlag = true;},500)
  143. if(this.hasNextPage){
  144. this.pullUpOn = false
  145. this.nomoreText = '上拉显示更多'
  146. }else{
  147. this.pullUpOn = true
  148. this.loadding = false
  149. this.nomoreText = '已至底部'
  150. }
  151. }else{
  152. this.isEmpty = true
  153. }
  154. }).catch(error =>{
  155. this.$util.msg(error.msg,2000)
  156. })
  157. },
  158. getOnReachBottomData(){
  159. this.pageNum+=1
  160. let params = {searchWord:this.searchInputVal,pageNum:this.pageNum,pageSize:this.pageSize }
  161. getFindAllsupplierList(params).then(response =>{
  162. let responseData = response.data
  163. if(responseData.results&&responseData.results.length > 0){
  164. this.hasNextPage = response.data.hasNextPage
  165. this.supplierList = this.supplierList.concat(responseData.results)
  166. this.pullFlag = false;// 防上拉暴滑
  167. setTimeout(()=>{this.pullFlag = true;},500)
  168. if(this.hasNextPage){
  169. this.pullUpOn = false
  170. this.nomoreText = '上拉显示更多'
  171. }else{
  172. this.pullUpOn = false
  173. this.loadding = false
  174. this.nomoreText = '已至底部'
  175. }
  176. }
  177. }).catch(error =>{
  178. this.$util.msg(error.msg,2000)
  179. })
  180. },
  181. goOperator(item){
  182. this.$api.setStorage('orderUserInfo',item)
  183. this.$api.navigateTo('/seller/pages/supplier/addoperator')
  184. },
  185. onShowClose () {//输入框失去焦点时触发
  186. if(this.searchInputVal != ''){
  187. this.isShowClose = true
  188. }else{
  189. this.isShowClose = false
  190. this.pageNum=1
  191. this.initsupplierList()
  192. }
  193. },
  194. delInputText(){//清除输入框内容
  195. this.searchInputVal = ''
  196. this.isShowClose = false
  197. this.pageNum=1
  198. this.initsupplierList()
  199. },
  200. hidePhone(val){
  201. let phone
  202. if(val==null || val==""){
  203. phone = ""
  204. }else{
  205. phone = this.$reg.hidePhone(val)
  206. }
  207. return phone
  208. },
  209. checkData (value){
  210. let data;
  211. if(value == null || value ==""){
  212. data = ''
  213. }else{
  214. data = value
  215. }
  216. return data
  217. },
  218. desensitizationName(val){
  219. let name = this.$reg.desensitizationName(val)
  220. return name
  221. }
  222. },
  223. onReachBottom() {
  224. if(this.hasNextPage){
  225. this.loadding = true
  226. this.pullUpOn = true
  227. this.getOnReachBottomData()
  228. }
  229. },
  230. onShow() {
  231. this.$api.getStorage().then(response =>{
  232. this.serviceProviderId = response.serviceProviderID
  233. this.pageNum = 1;
  234. this.initsupplierList();
  235. })
  236. }
  237. }
  238. </script>
  239. <style lang='scss'>
  240. page {
  241. height: auto;
  242. }
  243. page,.container{
  244. /* padding-bottom: 120upx; */
  245. background: #F7F7F7;
  246. }
  247. .container{
  248. position: relative;
  249. }
  250. .supplier {
  251. width: 100%;
  252. height: auto;
  253. box-sizing: border-box;
  254. }
  255. .supplier-search{
  256. height: 64rpx;
  257. width: 702rpx;
  258. padding: 24rpx;
  259. background: #FFFFFF;
  260. display: flex;
  261. align-items: center;
  262. position: fixed;
  263. top: 0;
  264. left: 0;
  265. z-index: 999;
  266. .search-from{
  267. width: 582rpx;
  268. height: 64rpx;
  269. background: #F7F7F7;
  270. border-radius: 32rpx;
  271. float: left;
  272. position: relative;
  273. .input{
  274. width: 500rpx;
  275. height: 64rpx;
  276. float: left;
  277. line-height: 64rpx;
  278. color: $text-color;
  279. font-size: $font-size-24;
  280. }
  281. .icon-sousuo{
  282. width: 64rpx;
  283. height: 64rpx;
  284. line-height: 64rpx;
  285. text-align: center;
  286. display: block;
  287. font-size: $font-size-38;
  288. float: left;
  289. color: #999999;
  290. }
  291. .icon-shanchu1{
  292. font-size: $font-size-32;
  293. color: #999999;
  294. position: absolute;
  295. width: 64rpx;
  296. height: 64rpx;
  297. line-height: 64rpx;
  298. text-align: center;
  299. top: 0;
  300. right: 0;
  301. z-index: 10;
  302. }
  303. }
  304. .search-btn{
  305. width: 120rpx;
  306. line-height: 64rpx;
  307. text-align: center;
  308. font-size: $font-size-28;
  309. color: $text-color;
  310. float: left;
  311. background: #FFFFFF;
  312. }
  313. }
  314. .supplier-main{
  315. box-sizing: border-box;
  316. padding: 0 24rpx;
  317. background-color:#FFFFFF ;
  318. padding-top: 112rpx;
  319. }
  320. .list{
  321. width: 340rpx;
  322. height: 301rpx;
  323. float: left;
  324. margin-right: 20rpx;
  325. margin-top: 10rpx;
  326. margin-bottom: 10rpx;
  327. border-radius: 6rpx;
  328. background-color: #FFFFFF;
  329. &:nth-child(2n){
  330. margin-right: 0;
  331. }
  332. .pros-item-image{
  333. width: 340rpx;
  334. height: 227rpx;
  335. display: block;
  336. float: left;
  337. border-radius: 6rpx 6rpx 0 0;
  338. }
  339. .pros-name{
  340. width: 100%;
  341. height: 74rpx;
  342. background-color: #FFFFFF;
  343. line-height: 74rpx;
  344. box-sizing: border-box;
  345. padding: 0 20rpx;
  346. font-size: $font-size-24;
  347. color: #666666;
  348. white-space: normal;
  349. word-break: break-all;
  350. overflow: hidden;
  351. text-overflow: ellipsis;
  352. display: -webkit-box;
  353. -webkit-box-orient: vertical;
  354. -webkit-line-clamp: 1;
  355. text-align: center;
  356. }
  357. }
  358. </style>