search-supplier.vue 12 KB

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