search-supplier.vue 12 KB

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