search-supplier.vue 11 KB

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