search-supplier.vue 11 KB

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