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