search-supplier.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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.shopId)">
  30. <view class="logo"><img :src="item.logo" alt=""></view>
  31. <view class="main">
  32. <view class="name">{{ item.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.business">
  46. <text class="text" v-for="(label, idx) in SetNewBusiness(item.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.address ? item.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.productId)">
  60. <image class="pros-item-image" :src="pros.image" mode="scaleToFill"></image>
  61. <view class="pros-name">{{ pros.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" :backgroundColor="'#ffffff'" :text='nomoreText'></tui-nomore>
  68. <!--加载loadding-->
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
  75. import tuiNomore from "@/components/tui-components/nomore/nomore"
  76. import uniStars from '@/components/uni-stars/uni-stars.vue'
  77. import authorize from '@/common/config/authorize.js'
  78. import wxLogin from "@/common/config/wxLogin.js"
  79. import { mapState } from 'vuex'
  80. export default {
  81. components:{
  82. tuiLoadmore,
  83. tuiNomore,
  84. uniStars
  85. },
  86. data() {
  87. return {
  88. iconClass:'icon-aixin',
  89. iconColor:'#ff9100',
  90. serviceProviderId:'',
  91. isShowClose:false,
  92. isEmpty:false,
  93. isFocus:true,
  94. productNoneImage:'https://static.caimei365.com/app/img/icon/icon-pnone.png',
  95. nomoreText: '上拉显示更多',
  96. loadding: false,
  97. pullUpOn: true,
  98. pullFlag: true,
  99. supplierList:[],
  100. isIphoneX:this.$store.state.isIphoneX,
  101. listQuery:{
  102. keyword: '',
  103. pageSize: 10,
  104. pageNum: 1
  105. },
  106. total:0
  107. }
  108. },
  109. onLoad(option){
  110. if(option.type =='share'){
  111. wxLogin.wxLoginAuthorize()
  112. }
  113. if(option.keyWord){
  114. console.log(option.keyWord)
  115. this.listQuery.keyword = option.keyWord
  116. this.GetSearchSupplierList();
  117. }
  118. },
  119. methods: {
  120. searchsupplierList(){//搜索
  121. this.listQuery.pageNum=1
  122. this.GetSearchSupplierList()
  123. // 友盟埋点供应商搜索点击
  124. if(process.env.NODE_ENV != 'development'){
  125. this.$uma.trackEvent('Um_Event_SearchSupplierButton', {
  126. Um_Key_Keyword: `${this.listQuery.keyword}`,
  127. Um_Key_PageName: '供应商',
  128. Um_Key_SourcePage: '搜索供应商',
  129. })
  130. }
  131. },
  132. GetSearchSupplierList(){//查询供应商列表
  133. this.ShopService.GetSearchSupplierList(this.listQuery).then(response =>{
  134. let data = JSON.parse(response.data)
  135. let dataList = data.items
  136. console.log(data)
  137. this.total = data.total
  138. if(dataList && dataList.length > 0){
  139. this.isEmpty = false
  140. this.supplierList = dataList
  141. this.pullFlag = false;
  142. setTimeout(()=>{this.pullFlag = true;},500)
  143. if(this.total>this.supplierList.length){
  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. GetSearchSupplierListBottomData(){//上滑加载
  159. this.listQuery.pageNum+=1
  160. this.ShopService.GetSupplierHomeProductList(this.listQuery).then(response =>{
  161. let data = JSON.parse(response.data)
  162. console.log(data)
  163. this.total = data.total
  164. this.supplierList = this.supplierList.concat(data.items)
  165. if(this.total>this.supplierList.length){
  166. this.pullUpOn = false
  167. this.nomoreText = '上拉显示更多'
  168. }else{
  169. this.pullUpOn = true
  170. this.loadding = false
  171. this.nomoreText = '已至底部'
  172. }
  173. }).catch(error =>{
  174. this.$util.msg(error.msg,2000)
  175. })
  176. },
  177. onShowClose () {//输入框失去焦点时触发
  178. if(this.listQuery.keyword != ''){
  179. this.isShowClose = true
  180. }else{
  181. this.isShowClose = false
  182. this.listQuery.pageNum=1
  183. this.GetSearchSupplierList()
  184. }
  185. },
  186. delInputText(){//清除输入框内容
  187. this.listQuery.keyword = ''
  188. this.isShowClose = false
  189. this.listQuery.pageNum=1
  190. this.GetSearchSupplierList()
  191. },
  192. navToDetailPage(id) {//跳转商品详情页
  193. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  194. },
  195. SetNewBusiness(value){//回显处理主营内容
  196. let Array = []
  197. value.split('/').forEach((item,index) =>{
  198. Array.push(item)
  199. })
  200. return Array
  201. },
  202. goSupplier(value){//跳供应商资料页
  203. this.$api.navigateTo('/pages/supplier/user/my-shop?shopId='+value)
  204. },
  205. },
  206. onReachBottom() {
  207. if(this.total>this.supplierList.length){
  208. this.loadding = true
  209. this.pullUpOn = true
  210. this.GetSearchSupplierListBottomData()
  211. }
  212. },
  213. onShareAppMessage(res){//分享转发
  214. if (res.from === 'button') {
  215. // 来自页面内转发按钮
  216. }
  217. return {
  218. title: `采美正品供应商,质量有保证!`,
  219. path: `pages/search/search-supplier?type=share&keyWord=${this.listQuery.keyword}`
  220. }
  221. },
  222. onShow() {
  223. }
  224. }
  225. </script>
  226. <style lang='scss'>
  227. page {
  228. height: auto;
  229. }
  230. page,.container{
  231. /* padding-bottom: 120upx; */
  232. background: #F7F7F7;
  233. }
  234. .container{
  235. position: relative;
  236. }
  237. .supplier {
  238. width: 100%;
  239. height: auto;
  240. box-sizing: border-box;
  241. }
  242. .supplier-search{
  243. height: 84rpx;
  244. width: 100%;
  245. padding:10rpx 24rpx;
  246. background: #FFFFFF;
  247. display: flex;
  248. align-items: center;
  249. position: fixed;
  250. top: 0;
  251. left: 0;
  252. z-index: 999;
  253. box-sizing: border-box;
  254. .search-from{
  255. width: 582rpx;
  256. height: 64rpx;
  257. background: #F7F7F7;
  258. border-radius: 32rpx;
  259. float: left;
  260. position: relative;
  261. .input{
  262. width: 500rpx;
  263. height: 64rpx;
  264. float: left;
  265. line-height: 64rpx;
  266. color: $text-color;
  267. font-size: $font-size-24;
  268. }
  269. .icon-sousuo{
  270. width: 64rpx;
  271. height: 64rpx;
  272. line-height: 64rpx;
  273. text-align: center;
  274. display: block;
  275. font-size: $font-size-38;
  276. float: left;
  277. color: #999999;
  278. }
  279. .icon-shanchu1{
  280. font-size: $font-size-32;
  281. color: #999999;
  282. position: absolute;
  283. width: 64rpx;
  284. height: 64rpx;
  285. line-height: 64rpx;
  286. text-align: center;
  287. top: 0;
  288. right: 0;
  289. z-index: 10;
  290. }
  291. }
  292. .search-btn{
  293. width: 120rpx;
  294. line-height: 64rpx;
  295. text-align: center;
  296. font-size: $font-size-28;
  297. color: #666666;
  298. float: left;
  299. background: #FFFFFF;
  300. }
  301. }
  302. .supplier-main{
  303. margin-top: 94rpx;
  304. }
  305. .list{
  306. box-sizing: border-box;
  307. padding: 0 24rpx;
  308. background-color:#FFFFFF ;
  309. margin-bottom: 20rpx;
  310. }
  311. .list-top{
  312. width: 100%;
  313. height: auto;
  314. }
  315. .list-top-msg{
  316. width: 100%;
  317. height: auto;
  318. box-sizing: border-box;
  319. padding-left: 115rpx;
  320. .msg-pin{
  321. width: 100%;
  322. height: auto;
  323. margin-bottom: 16rpx;
  324. .label{
  325. float: left;
  326. line-height: 37rpx;
  327. font-size: $font-size-26;
  328. color: #999999;
  329. }
  330. .label-li{
  331. width: 476rpx;
  332. float: left;
  333. line-height: 37rpx;
  334. .text{
  335. display: inline-block;
  336. padding: 0 8rpx;
  337. height: 33rpx;
  338. border-radius: 6rpx;
  339. background-color: #86b2fb;
  340. color: #FFFFFF;
  341. line-height: 33rpx;
  342. float: left;
  343. font-size: $font-size-20;
  344. text-align: center;
  345. margin: 10rpx;
  346. margin-top: 5rpx;
  347. }
  348. .none{
  349. font-size: $font-size-20;
  350. color: #999999;
  351. }
  352. }
  353. .label-text{
  354. line-height: 37rpx;
  355. font-size: $font-size-26;
  356. color: #999999;
  357. margin-left: 10rpx;
  358. float: left;
  359. }
  360. }
  361. }
  362. .list-top-supplier{
  363. width: 100%;
  364. height: 140rpx;
  365. padding: 30rpx 0 10rpx 0;
  366. box-sizing: border-box;
  367. background-color: #FFFFFF;
  368. position: relative;
  369. box-sizing: border-box;
  370. .logo{
  371. width: 90rpx;
  372. height: 72rpx;
  373. float: left;
  374. border: 1px solid #efefef;
  375. border-radius: 6rpx;
  376. image{
  377. width: 100%;
  378. height: 100%;
  379. display: block;
  380. border-radius: 6rpx;
  381. }
  382. }
  383. .main{
  384. width: 470rpx;
  385. height: 92rpx;
  386. float: left;
  387. margin-left: 20rpx;
  388. .name{
  389. width: 100%;
  390. line-height: 46rpx;
  391. float: left;
  392. font-size: $font-size-28;
  393. color: $text-color;
  394. float: right;
  395. overflow: hidden;
  396. text-overflow:ellipsis;
  397. white-space: nowrap;
  398. text-align: left;
  399. }
  400. .massgs{
  401. width: 100%;
  402. line-height: 46rpx;
  403. float: left;
  404. font-size: $font-size-24;
  405. color: #999999;
  406. .label{
  407. float: left;
  408. }
  409. .p-stars{
  410. float: left;
  411. margin-left: 20rpx;
  412. }
  413. }
  414. }
  415. .icon-xiayibu{
  416. line-height: 154rpx;
  417. display: inline-block;
  418. position: absolute;
  419. width: 48rpx;
  420. top: 0;
  421. right: 0;
  422. color: #b2b2b2;
  423. }
  424. }
  425. .list-bottom{
  426. width: 100%;
  427. height: auto;
  428. float: left;
  429. padding: 20rpx 0;
  430. .pros-item{
  431. width: 220rpx;
  432. height: auto;
  433. float: left;
  434. margin-right: 20rpx;
  435. &:last-child{
  436. margin-right: 0;
  437. }
  438. .pros-item-image{
  439. width: 218rpx;
  440. height: 218rpx;
  441. display: block;
  442. float: left;
  443. border: 1px solid #EBEBEB;
  444. border-radius: 6rpx;
  445. }
  446. .pros-name{
  447. width: 100%;
  448. height: 54rpx;
  449. line-height: 54rpx;
  450. box-sizing: border-box;
  451. padding: 0 10rpx;
  452. font-size: $font-size-24;
  453. color: #666666;
  454. white-space: normal;
  455. word-break: break-all;
  456. overflow: hidden;
  457. text-overflow: ellipsis;
  458. display: -webkit-box;
  459. -webkit-box-orient: vertical;
  460. -webkit-line-clamp: 1;
  461. }
  462. }
  463. }
  464. </style>