search-supplier.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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="listQuery.keyword"
  10. :focus="isFocus"
  11. @input="onShowClose"
  12. @confirm="GetSearchSupplierList()"
  13. placeholder="请输入供应商名称"
  14. maxlength="16"/>
  15. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText()"></text>
  16. </view>
  17. <view class="search-btn">
  18. <button class="search-btn" type="default" @click.stop="searchsupplierList">搜索</button>
  19. </view>
  20. </view>
  21. <view class="supplier-main">
  22. <view v-if="isEmpty" class="empty-container">
  23. <image class="empty-container-image" :src="productNoneImage" mode="aspectFit"></image>
  24. <view class="txt">暂无供应商数据^_^</view>
  25. </view>
  26. <view v-else class="supplier-list">
  27. <view class="list clearfix" v-for="(item, index) in supplierList" :key="index">
  28. <view class="list-top">
  29. <view class="list-top-supplier" @click="goSupplier(item.s_id)">
  30. <view class="logo"><img :src="item.s_logo" alt=""></view>
  31. <view class="main">
  32. <view class="name">{{ item.s_name }}</view>
  33. <view class="massgs">
  34. <view class="label">满意度:</view>
  35. <view class="p-stars">
  36. <uni-stars :stars="6" :iconClass="iconClass" :iconColor="iconColor" :fontSize="36" :widthInfo="176"></uni-stars>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="right"><text class="iconfont icon-xiayibu"></text></view>
  41. </view>
  42. <view class="list-top-msg">
  43. <view class="msg-pin clearfix">
  44. <view class="label">经营品项:</view>
  45. <view class="label-li" v-if="item.s_business">
  46. <text class="text" v-for="(label, idx) in SetNewBusiness(item.s_business)" :key="idx">{{ label }}</text>
  47. </view>
  48. <view class="label-li" v-else>
  49. <text class="none">暂无</text>
  50. </view>
  51. </view>
  52. <view class="msg-pin clearfix">
  53. <view class="label">所在地区:</view>
  54. <view class="label-text">{{ item.s_address ? item.s_address : '暂无'}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="list-bottom">
  59. <view class="pros-item" v-for="(pros, pdx) in item.products" :key="pdx" @click.stop="navToDetailPage(pros.p_id)">
  60. <image class="pros-item-image" :src="pros.p_image" mode="scaleToFill"></image>
  61. <view class="pros-name">{{ pros.p_name }}</view>
  62. </view>
  63. </view>
  64. </view>
  65. <!--加载loadding-->
  66. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  67. <tui-nomore :visible="!pullUpOn" bgcolor="#F7F7F7" :text='nomoreText'></tui-nomore>
  68. <!--加载loadding-->
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import authorize from '@/common/config/authorize.js'
  75. import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
  76. import tuiNomore from "@/components/tui-components/nomore/nomore"
  77. import uniStars from '@/components/uni-stars/uni-stars.vue'
  78. export default {
  79. components:{
  80. tuiLoadmore,
  81. tuiNomore,
  82. uniStars
  83. },
  84. data() {
  85. return {
  86. iconClass:'icon-aixin',
  87. iconColor:'#ff9100',
  88. serviceProviderId:'',
  89. isShowClose:false,
  90. isEmpty:false,
  91. isFocus:true,
  92. productNoneImage:'http://static-b.caimei365.com/app/img/icon/icon-pnone.png',
  93. nomoreText: '上拉显示更多',
  94. loadding: false,
  95. pullUpOn: true,
  96. pullFlag: true,
  97. supplierList:[],
  98. isIphoneX:this.$store.state.isIphoneX,
  99. listQuery:{
  100. keyword: '',
  101. pageSize: 10,
  102. pageNum: 1
  103. },
  104. total:0
  105. }
  106. },
  107. onLoad(option){
  108. if(option.keyword){
  109. this.listQuery.keyword = option.keyword
  110. this.GetSearchSupplierList();
  111. }
  112. },
  113. methods: {
  114. searchsupplierList(){//搜索
  115. this.listQuery.pageNum=1
  116. this.GetSearchSupplierList()
  117. },
  118. GetSearchSupplierList(){//查询供应商列表
  119. this.ShopService.GetSearchSupplierList(this.listQuery).then(response =>{
  120. let data = JSON.parse(response.data)
  121. let dataList = data.items
  122. console.log(data)
  123. this.total = data.total
  124. if(dataList && dataList.length > 0){
  125. this.isEmpty = false
  126. this.supplierList = dataList
  127. this.pullFlag = false;
  128. setTimeout(()=>{this.pullFlag = true;},500)
  129. if(this.total>this.supplierList.length){
  130. this.pullUpOn = false
  131. this.nomoreText = '上拉显示更多'
  132. }else{
  133. this.pullUpOn = true
  134. this.loadding = false
  135. this.nomoreText = '已至底部'
  136. }
  137. }else{
  138. this.isEmpty = true
  139. }
  140. }).catch(error =>{
  141. this.$util.msg(error.msg,2000)
  142. })
  143. },
  144. GetSearchSupplierListBottomData(){//上滑加载
  145. this.listQuery.pageNum+=1
  146. this.ShopService.GetSupplierHomeProductList(this.listQuery).then(response =>{
  147. let data = JSON.parse(response.data)
  148. console.log(data)
  149. this.total = data.total
  150. this.supplierList = this.supplierList.concat(data.items)
  151. if(this.total>this.supplierList.length){
  152. this.pullUpOn = false
  153. this.nomoreText = '上拉显示更多'
  154. }else{
  155. this.pullUpOn = true
  156. this.loadding = false
  157. this.nomoreText = '已至底部'
  158. }
  159. }).catch(error =>{
  160. this.$util.msg(error.msg,2000)
  161. })
  162. },
  163. onShowClose () {//输入框失去焦点时触发
  164. if(this.listQuery.keyword != ''){
  165. this.isShowClose = true
  166. }else{
  167. this.isShowClose = false
  168. this.listQuery.pageNum=1
  169. this.GetSearchSupplierList()
  170. }
  171. },
  172. delInputText(){//清除输入框内容
  173. this.listQuery.keyword = ''
  174. this.isShowClose = false
  175. this.listQuery.pageNum=1
  176. this.GetSearchSupplierList()
  177. },
  178. navToDetailPage(id) {//跳转商品详情页
  179. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  180. },
  181. SetNewBusiness(value){//回显处理主营内容
  182. let Array = []
  183. value.split('/').forEach((item,index) =>{
  184. Array.push(item)
  185. })
  186. return Array
  187. },
  188. goSupplier(value){//跳供应商资料页
  189. this.$api.navigateTo('/supplier/pages/user/supplier?shopId='+value)
  190. },
  191. },
  192. onReachBottom() {
  193. if(this.total>this.supplierList.length){
  194. this.loadding = true
  195. this.pullUpOn = true
  196. this.GetSearchSupplierListBottomData()
  197. }
  198. },
  199. onShow() {
  200. }
  201. }
  202. </script>
  203. <style lang='scss'>
  204. page {
  205. height: auto;
  206. }
  207. page,.container{
  208. /* padding-bottom: 120upx; */
  209. background: #F7F7F7;
  210. }
  211. .container{
  212. position: relative;
  213. }
  214. .supplier {
  215. width: 100%;
  216. height: auto;
  217. box-sizing: border-box;
  218. }
  219. .supplier-search{
  220. height: 84rpx;
  221. width: 100%;
  222. padding:10rpx 24rpx;
  223. background: #FFFFFF;
  224. display: flex;
  225. align-items: center;
  226. position: fixed;
  227. top: 0;
  228. left: 0;
  229. z-index: 999;
  230. box-sizing: border-box;
  231. .search-from{
  232. width: 582rpx;
  233. height: 64rpx;
  234. background: #F7F7F7;
  235. border-radius: 32rpx;
  236. float: left;
  237. position: relative;
  238. .input{
  239. width: 500rpx;
  240. height: 64rpx;
  241. float: left;
  242. line-height: 64rpx;
  243. color: $text-color;
  244. font-size: $font-size-24;
  245. }
  246. .icon-sousuo{
  247. width: 64rpx;
  248. height: 64rpx;
  249. line-height: 64rpx;
  250. text-align: center;
  251. display: block;
  252. font-size: $font-size-38;
  253. float: left;
  254. color: #999999;
  255. }
  256. .icon-shanchu1{
  257. font-size: $font-size-32;
  258. color: #999999;
  259. position: absolute;
  260. width: 64rpx;
  261. height: 64rpx;
  262. line-height: 64rpx;
  263. text-align: center;
  264. top: 0;
  265. right: 0;
  266. z-index: 10;
  267. }
  268. }
  269. .search-btn{
  270. width: 120rpx;
  271. line-height: 64rpx;
  272. text-align: center;
  273. font-size: $font-size-28;
  274. color: #666666;
  275. float: left;
  276. background: #FFFFFF;
  277. }
  278. }
  279. .supplier-main{
  280. margin-top: 94rpx;
  281. }
  282. .list{
  283. box-sizing: border-box;
  284. padding: 0 24rpx;
  285. background-color:#FFFFFF ;
  286. margin-bottom: 20rpx;
  287. }
  288. .list-top{
  289. width: 100%;
  290. height: auto;
  291. }
  292. .list-top-msg{
  293. width: 100%;
  294. height: auto;
  295. box-sizing: border-box;
  296. padding-left: 115rpx;
  297. .msg-pin{
  298. width: 100%;
  299. height: auto;
  300. margin-bottom: 16rpx;
  301. .label{
  302. float: left;
  303. line-height: 37rpx;
  304. font-size: $font-size-26;
  305. color: #999999;
  306. }
  307. .label-li{
  308. width: 476rpx;
  309. float: left;
  310. line-height: 37rpx;
  311. .text{
  312. display: inline-block;
  313. padding: 0 8rpx;
  314. height: 33rpx;
  315. border-radius: 6rpx;
  316. background-color: #86b2fb;
  317. color: #FFFFFF;
  318. line-height: 33rpx;
  319. float: left;
  320. font-size: $font-size-20;
  321. text-align: center;
  322. margin: 10rpx;
  323. margin-top: 5rpx;
  324. }
  325. .none{
  326. font-size: $font-size-20;
  327. color: #999999;
  328. }
  329. }
  330. .label-text{
  331. line-height: 37rpx;
  332. font-size: $font-size-26;
  333. color: #999999;
  334. margin-left: 10rpx;
  335. float: left;
  336. }
  337. }
  338. }
  339. .list-top-supplier{
  340. width: 100%;
  341. height: 140rpx;
  342. padding: 30rpx 0 10rpx 0;
  343. box-sizing: border-box;
  344. background-color: #FFFFFF;
  345. position: relative;
  346. box-sizing: border-box;
  347. .logo{
  348. width: 90rpx;
  349. height: 72rpx;
  350. float: left;
  351. border: 1px solid #efefef;
  352. border-radius: 6rpx;
  353. image{
  354. width: 100%;
  355. height: 100%;
  356. display: block;
  357. border-radius: 6rpx;
  358. }
  359. }
  360. .main{
  361. width: 470rpx;
  362. height: 92rpx;
  363. float: left;
  364. margin-left: 20rpx;
  365. .name{
  366. width: 100%;
  367. line-height: 46rpx;
  368. float: left;
  369. font-size: $font-size-28;
  370. color: $text-color;
  371. float: right;
  372. overflow: hidden;
  373. text-overflow:ellipsis;
  374. white-space: nowrap;
  375. text-align: left;
  376. }
  377. .massgs{
  378. width: 100%;
  379. line-height: 46rpx;
  380. float: left;
  381. font-size: $font-size-24;
  382. color: #999999;
  383. .label{
  384. float: left;
  385. }
  386. .p-stars{
  387. float: left;
  388. margin-left: 20rpx;
  389. }
  390. }
  391. }
  392. .icon-xiayibu{
  393. line-height: 154rpx;
  394. display: inline-block;
  395. position: absolute;
  396. width: 48rpx;
  397. top: 0;
  398. right: 0;
  399. color: #b2b2b2;
  400. }
  401. }
  402. .list-bottom{
  403. width: 100%;
  404. height: auto;
  405. float: left;
  406. padding: 20rpx 0;
  407. .pros-item{
  408. width: 220rpx;
  409. height: auto;
  410. float: left;
  411. margin-right: 20rpx;
  412. &:last-child{
  413. margin-right: 0;
  414. }
  415. .pros-item-image{
  416. width: 218rpx;
  417. height: 218rpx;
  418. display: block;
  419. float: left;
  420. border: 1px solid #EBEBEB;
  421. border-radius: 6rpx;
  422. }
  423. .pros-name{
  424. width: 100%;
  425. height: 54rpx;
  426. line-height: 54rpx;
  427. box-sizing: border-box;
  428. padding: 0 10rpx;
  429. font-size: $font-size-24;
  430. color: #666666;
  431. white-space: normal;
  432. word-break: break-all;
  433. overflow: hidden;
  434. text-overflow: ellipsis;
  435. display: -webkit-box;
  436. -webkit-box-orient: vertical;
  437. -webkit-line-clamp: 1;
  438. }
  439. }
  440. }
  441. </style>