merchant.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <div class="merchant">
  3. <div class="container">
  4. <div class="top clearfix">
  5. <div class="title">
  6. <p>High quality dealer</p>
  7. <h2>供应商列表</h2>
  8. <div class="count">
  9. <img src="/images/supplier/count.png" alt=""/>
  10. <span v-for="(spCount, index) in all" :class="'_c' + index">
  11. {{spCount}}
  12. </span>
  13. </div>
  14. </div>
  15. <div class="search">
  16. <div class="input-group">
  17. <input type="search" class="form-control" title="code" placeholder="名称/地址/行业"
  18. v-model="searchCode" @keyup.13="goodsSearch(searchCode)" @search="goodsSearch(searchCode)"/>
  19. <span class="input-group-btn">
  20. <button type="button" class="btn" @click="goodsSearch(searchCode)">&nbsp;查 询</button>
  21. </span>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="list_info">
  26. <div class="empty" v-if="!list.content || list.content.length === 0">
  27. <img src="/images/supplier/icon/empty.png">
  28. <div class="info">
  29. <p>暂无供应商信息</p>
  30. <a href="javascript:history.go(-1)"><i class="fa fa-reply" style="margin-right:5px;"></i>返回上一页</a>
  31. </div>
  32. </div>
  33. <ul class="list-inline">
  34. <li v-for="item in list.content" @click="jumpResource(item.enUU)">
  35. <div class="has_shop" v-if="item.isStore === 1">已开店</div>
  36. <div class="enterprise_name" v-text="item.enName">深圳英优软科技有限公司</div>
  37. <div class="select_btn" v-html="isInFrame ? '添加为<br/>供应商' : '查看<br/>更多'" @mouseleave="hasJump = false" @mouseenter="hasJump = true" @click="addResource(item.enUU)"></div>
  38. <div class="popups">
  39. <p>企业执照号:</p><p v-text="item.enBusinesscode ? item.enBusinesscode : '暂无信息'">1</p>
  40. <p>地址:</p><p v-text="item.enAddress ? item.enAddress : '暂无信息'">1</p>
  41. <p>邮箱:</p><p v-text="item.enEmail ? item.enEmail : '暂无信息'">h</p>
  42. <p>电话:</p><p v-text="item.enTel ? item.enTel : '暂无信息'">1</p>
  43. <p>行业:</p><p v-text="item.enIndustry ? item.enIndustry : '暂无信息'">1</p>
  44. </div>
  45. </li>
  46. </ul>
  47. <div style="float: right;">
  48. <page :total="list.totalElements" :page-size="pageParams.count"
  49. :current="pageParams.page" v-on:childEvent="handleCurrentChange">
  50. </page>
  51. </div>
  52. </div>
  53. <el-dialog
  54. title="提示"
  55. :visible.sync="hasDialog ">
  56. <div class="form_dialog">
  57. <p><span>供应商正在完善产品信息,</span>暂时不能查看更多。 </p>
  58. </div>
  59. <span slot="footer" class="dialog-footer">
  60. <a type="button" @click="hasDialog=false">我知道了</a>
  61. </span>
  62. </el-dialog>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import Page from '~components/common/page/pageComponent.vue'
  68. export default {
  69. name: 'MerchantView',
  70. data () {
  71. return {
  72. hasDialog: false,
  73. hasJump: false,
  74. searchCode: '',
  75. pageParams: {
  76. count: 20,
  77. page: 1
  78. }
  79. }
  80. },
  81. components: {
  82. Page
  83. },
  84. computed: {
  85. isInFrame () {
  86. if (this.$route.query.type === 'erp') {
  87. return true
  88. }
  89. },
  90. list () {
  91. return this.$store.state.supplier.merchant.merchant.data
  92. },
  93. all () {
  94. let count = this.$store.state.supplier.merchant.merchantAll.data
  95. let supplierCount = count.content ? count.totalElements + '' : '00000'
  96. // console.log(this.formatNumber(supplierCount))
  97. return this.formatNumber(supplierCount)
  98. }
  99. },
  100. methods: {
  101. // 供应商数字格式转换
  102. formatNumber (num) {
  103. let _arr = []
  104. for (var i = 0; i < num.length; i++) {
  105. _arr.push(num[i])
  106. }
  107. if (_arr.length < 5) {
  108. for (let j = _arr.length; j < 5; j++) {
  109. _arr.unshift('0')
  110. }
  111. }
  112. return _arr
  113. },
  114. addResource (id) {
  115. if (this.isInFrame) {
  116. this.$http.get(`/basic/enterprise /${id}/info`)
  117. .then(res => {
  118. if (res.data) {
  119. window.open(this.$route.query.localPath + this.$route.query.erpPath + '?b2bdata=' + encodeURIComponent(JSON.stringify(res.data)))
  120. }
  121. })
  122. .catch(err => {
  123. console.log(err)
  124. })
  125. } else {
  126. this.isVaildSupplier(id)
  127. }
  128. },
  129. jumpResource (id) {
  130. if (!this.hasJump) {
  131. this.isVaildSupplier(id)
  132. }
  133. },
  134. // 判断是否有有效物料信息
  135. isVaildSupplier (id) {
  136. this.$http.get('vendor/introduction/product/count', {params: {vendUU: id}})
  137. .then(res => {
  138. if (res.data.count !== 0) {
  139. this.$router.push('supplier/' + id)
  140. } else {
  141. this.hasDialog = true
  142. }
  143. }, err => {
  144. console.log(err)
  145. })
  146. },
  147. goodsSearch (type) {
  148. this.pageParams.page = 1
  149. this.$store.dispatch('supplier/loadVendorList', {page: this.pageParams.page, size: this.pageParams.count, keyword: type})
  150. },
  151. handleCurrentChange (type) {
  152. this.pageParams.page = type
  153. this.$store.dispatch('supplier/loadVendorList', {page: type, size: this.pageParams.count, keyword: this.searchCode})
  154. }
  155. }
  156. }
  157. </script>
  158. <style type="text/scss" lang="scss">
  159. .merchant{
  160. background: #ecf1f1 url(/images/supplier/banner.jpg)no-repeat;
  161. border-top:3px solid #000;
  162. padding-bottom:25px;
  163. margin-top:-1.5em;
  164. .el-dialog{
  165. width: 290px!important;
  166. .el-dialog__header{
  167. background: #4290f7;
  168. line-height: 40px;
  169. padding: 0 20px 0;
  170. .el-dialog__title{
  171. color:#fff;
  172. }
  173. .el-dialog__headerbtn:hover .el-dialog__close, .el-dialog__headerbtn:focus .el-dialog__close{
  174. color:#fff;
  175. }
  176. }
  177. .el-dialog__body{
  178. padding: 10px 20px;
  179. }
  180. .el-dialog__footer{
  181. text-align: center;
  182. a{
  183. display:inline-block;
  184. background: #3c7cf5;
  185. color:#fff;
  186. font-size: 14px;
  187. line-height: 30px;
  188. height:30px;
  189. padding:0 10px;
  190. border-radius:5px;
  191. }
  192. }
  193. }
  194. .form_dialog{
  195. p{
  196. width:200px;
  197. font-size: 14px;
  198. color:#666666;
  199. margin:0 auto;
  200. padding-top:5px;
  201. line-height: 20px;
  202. span{
  203. color:#eb6054;
  204. }
  205. }
  206. }
  207. .top{
  208. padding-top:30px;
  209. margin-bottom:40px;
  210. .title{
  211. margin:0 auto;
  212. text-align: center;
  213. width:215px;
  214. border-bottom:1px solid #ff5151;
  215. color:#fff;
  216. p{
  217. margin:0;
  218. }
  219. h2{
  220. font-size: 32px;
  221. margin:0;
  222. line-height: 46px;
  223. }
  224. div.count{
  225. position: relative;
  226. span {
  227. font-size: 28px;
  228. color: #4a2f01;
  229. position: absolute;
  230. top: 5px;
  231. &:first-child(1){
  232. left: 7px;
  233. }
  234. &:nth-child(2){
  235. left: 7px;
  236. }
  237. &:nth-child(3){
  238. left: 37px;
  239. }
  240. &:nth-child(4){
  241. left: 67px;
  242. }
  243. &:nth-child(5){
  244. left: 97px;
  245. }
  246. &:nth-child(6){
  247. left: 127px;
  248. }
  249. }
  250. }
  251. &:before{
  252. content: '';
  253. display:block;
  254. position:relative;
  255. left:55px;
  256. top:61px;
  257. width:105px;
  258. height:1px;
  259. background: #ff8a00;
  260. }
  261. &:after{
  262. content: '';
  263. display:block;
  264. position:relative;
  265. left:55px;
  266. top:4px;
  267. width:105px;
  268. height:1px;
  269. background: #fff600;
  270. }
  271. }
  272. .search{
  273. float:right;
  274. width:310px;
  275. text-align: right;
  276. margin-right:10px;
  277. .btn{
  278. width:68px;
  279. background: #ffa200;
  280. color:#fff;
  281. }
  282. }
  283. }
  284. .list_info{
  285. padding: 0 10px;
  286. min-height:300px;
  287. margin-bottom:100px;
  288. .empty{
  289. height:418px;
  290. border:15px solid #c4e9f9;
  291. background: #eef9fd;
  292. padding-top:165px;
  293. text-align: center;
  294. img{
  295. vertical-align: top;
  296. margin-right:15px;
  297. }
  298. .info{
  299. display: inline-block;
  300. padding-top:10px;
  301. }
  302. }
  303. > ul{
  304. margin-left:5px;
  305. li{
  306. position:relative;
  307. vertical-align: top;
  308. width:267px;
  309. height:115px;
  310. border-radius:5px;
  311. margin-right:32px;
  312. margin-bottom:60px;
  313. background: #ffffff;
  314. box-shadow: 0 3px 10px rgba(0,0,0,.8);
  315. &:nth-child(4n) {
  316. margin-right:0;
  317. }
  318. &:after{
  319. content: '';
  320. display:block;
  321. position:absolute;
  322. top:99%;
  323. left:50%;
  324. z-index:200;
  325. width:88px;
  326. height:22px;
  327. margin-left:-44px;
  328. background: url(/images/supplier/icon/bottom_center_img.png)no-repeat;
  329. }
  330. .has_shop {
  331. position:absolute;
  332. right:0;
  333. top:0;
  334. width:68px;
  335. height:22px;
  336. background: url(/images/supplier/icon/top_right_img.png)no-repeat;
  337. color:#fff;
  338. font-weight: bold;
  339. text-align: center;
  340. line-height: 22px;
  341. }
  342. .enterprise_name{
  343. padding-top:15px;
  344. width:98%;
  345. overflow: hidden;
  346. text-overflow: ellipsis;
  347. white-space:nowrap;
  348. border-bottom:1px solid #b9def7;
  349. font-weight: bold;
  350. color:#1891e4;
  351. font-size: 18px;
  352. line-height: 48px;
  353. text-align: center;
  354. }
  355. .select_btn{
  356. position:absolute;
  357. bottom:-10px;
  358. left:50%;
  359. z-index:250;
  360. width:56px;
  361. height:56px;
  362. padding:10px 0;
  363. margin-left:-28px;
  364. text-align: center;
  365. line-height: 18px;
  366. background: #1891e4;
  367. border-radius:50%;
  368. color:#fff;
  369. }
  370. &:hover{
  371. cursor:pointer;
  372. .popups{
  373. top:99%;
  374. opacity:1;
  375. z-index:100;
  376. }
  377. }
  378. .popups{
  379. position:absolute;
  380. top:50px;
  381. left:0;
  382. background: #6c6c6c;
  383. width:267px;
  384. min-height:20px;
  385. padding:20px 15px 5px 10px;
  386. transition: all .5s ease;
  387. opacity: 0;
  388. color:#fff;
  389. overflow: hidden;
  390. p{
  391. float:left;
  392. margin: 0 !important;
  393. line-height: 18px;
  394. max-height:18px;
  395. overflow: hidden;
  396. text-overflow: ellipsis;
  397. white-space: nowrap;
  398. &:nth-child(2n-1){
  399. width:42px;
  400. }
  401. &:first-child{
  402. width:85px;
  403. }
  404. &:nth-child(2n){
  405. width:200px;
  406. }
  407. &:nth-child(2){
  408. width:155px;
  409. }
  410. &:nth-child(4){
  411. max-height:38px;
  412. overflow: hidden;
  413. white-space:pre-wrap;
  414. word-wrap:break-word;
  415. }
  416. &:last-child{
  417. overflow: hidden;
  418. text-overflow: ellipsis;
  419. white-space: nowrap;
  420. }
  421. }
  422. }
  423. }
  424. }
  425. }
  426. }
  427. </style>