search-supplier.vue 11 KB

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