StoreHeader.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <template>
  2. <div id="nav_fragment">
  3. <div class="container">
  4. <div class="row" style="height: 120px; padding-top: 30px; margin: 0;">
  5. <!-- 店铺信息以及下拉菜单 -->
  6. <div id = "shop" :class="{ 'drop-down-active' : isOpen }" @mouseleave="closeDropDown()">
  7. <div class="dropdown">
  8. <div style="width: 440px;">
  9. <div class="dropdown-btn" style="margin-top: 0;">
  10. <div style="margin-bottom: 15px;">
  11. <a role="button" class="dropdown-toggle" @mouseover="openDropDown()">
  12. <span class="shop-name" v-text="storeInfo.storeName || '店铺名称'"></span>
  13. <span><i class="fa fa-angle-down fa-fw" style="font-size: 20px;"></i></span>
  14. </a>
  15. </div>
  16. <div class="icon-style">
  17. <!--<button class="btn btn-xs btn-danger btn-nav" v-if="!isFocus"><span class="watch">关注</span></button>-->
  18. <span v-if="isFocus == 'false' || typeof isFocus == 'object'"><button type="text" @click="focus(storeInfo.id, storeInfo.storeName)" class="btn btn-xs btn-danger btn-nav"><span class="watch">关注</span></button></span>
  19. <span v-if="isFocus == 'true'" ><button class="btn btn-xs btn-default btn-nav" style="width:50px"><span>已关注</span></button></span>
  20. <span v-if="storeInfo.type == 'ORIGINAL_FACTORY'">&nbsp;<img src="/images/store/icon/icon-factory.png"/></span>
  21. <span v-else-if="storeInfo.type == 'AGENCY'">&nbsp;<img src="/images/store/icon/icon-agent.png"/></span>
  22. <span v-else-if="storeInfo.type == 'DISTRIBUTION'">&nbsp;<img src="/images/store/icon/icon-distribution.png"/></span>
  23. <span v-else-if="storeInfo.type == 'CONSIGNMENT'">&nbsp;<img src="/images/store/icon/consignment.png"/></span>
  24. <span class="link-seller">
  25. <img src="/images/all/songguo.png">
  26. <a @click="goWebChat()" class="contact_btn">联系卖家</a>
  27. </span>
  28. </div>
  29. </div>
  30. <div class="clearfix"></div>
  31. </div>
  32. <div style="background: #FFFFFF;" v-if="isOpen">
  33. <ul class = "shop-contact list-unstyled" style="padding: 15px 0; margin-bottom: 0; border-top: #e8e8e8 1px solid; margin-top: 20px;">
  34. <li v-if="storeInfo.enterprise.enTel&&storeInfo.enterprise.enTel.length > 0">
  35. <span>电话:</span><span v-text="storeInfo.enterprise.enTel"></span>
  36. </li>
  37. <li v-if="storeInfo.enterprise.enFax&&storeInfo.enterprise.enFax.length > 0">
  38. <span>传真:</span><span v-text="storeInfo.enterprise.enFax"></span>
  39. </li>
  40. <li v-if="storeInfo.enterprise.address&&storeInfo.enterprise.address.length > 0">
  41. <span>地址:</span><span v-text="storeInfo.enterprise.address"></span>
  42. </li>
  43. <li class="text-right">
  44. <nuxt-link :to="{ name: 'store-uuid-description', params: { uuid: storeInfo.uuid } }">了解更多&gt;</nuxt-link>
  45. </li>
  46. </ul>
  47. </div>
  48. </div>
  49. </div>
  50. <!-- 搜索框 -->
  51. <div id="search-group" style="margin-left: 450px;">
  52. <search-box/>
  53. </div>
  54. </div>
  55. </div>
  56. <!--关注-->
  57. <el-dialog
  58. :visible.sync="dialogVisible"
  59. size="tiny"
  60. >
  61. <h3 class="header-text">关注成功!</h3>
  62. <div class="focus modal-body">
  63. <button type="button" @click="dialogVisible = false" class="btn" style="margin-left:25px;">关&nbsp;&nbsp;闭</button>
  64. <button type="button" @click="dialogVisible = false" class="focus-btn btn btn btn-info" style="margin-left:35px;">
  65. <a href="/user#/storeFocus" target="_blank">查看我的店铺关注</a>
  66. </button>
  67. </div>
  68. </el-dialog>
  69. </div>
  70. </template>
  71. <script>
  72. import SearchBox from '~components/main/Search.vue'
  73. export default {
  74. name: 'store-header',
  75. data () {
  76. return {
  77. isOpen: false,
  78. dialogVisible: false
  79. }
  80. },
  81. components: {
  82. SearchBox
  83. },
  84. computed: {
  85. storeInfo () {
  86. return this.$store.state.shop.storeInfo.store.data
  87. },
  88. user () {
  89. return this.$store.state.option.user
  90. },
  91. isFocus () {
  92. return this.$store.state.shop.storeInfo.focusList.data
  93. },
  94. tab () {
  95. return this.$store.state.chat.tab.tab.data
  96. }
  97. },
  98. methods: {
  99. closeDropDown () {
  100. this.isOpen = false
  101. },
  102. openDropDown () {
  103. this.isOpen = true
  104. },
  105. focus (id, name) {
  106. if (!this.user.logged) {
  107. this.$http.get('/login/page').then(response => {
  108. if (response.data) {
  109. this.$router.push('/auth/login')
  110. }
  111. })
  112. } else {
  113. this.dialogVisible = true
  114. this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
  115. this.isFocus = true
  116. }
  117. },
  118. goWebChat: function () {
  119. if (!this.user.logged) {
  120. this.$http.get('/login/page').then(response => {
  121. if (response.data) {
  122. this.$router.push('/auth/login')
  123. }
  124. })
  125. } else {
  126. // 获得窗口的垂直位置
  127. let iTop = (window.screen.availHeight - 30 - 780) / 2
  128. // 获得窗口的水平位置
  129. let iLeft = (window.screen.availWidth - 10 - 1030) / 2
  130. if (this.tab.close) {
  131. this.tab.close()
  132. }
  133. let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
  134. this.$store.dispatch('chat/setChatTab', {tab: newTab})
  135. this.$http.get('/basic/enterprise/' + this.storeInfo.enUU + '/info')
  136. .then(response => {
  137. let obj = {}
  138. obj.userPhone = this.user.data.userTel
  139. obj.userType = 'ENTERPRISE'
  140. this.user.data.enterprises.forEach(function (item, index) {
  141. if (item.current) {
  142. obj.enUU = item.uu
  143. obj.enterprise = {enUU: item.uu, name: item.enName}
  144. }
  145. })
  146. obj.otherEnUU = response.data.uu
  147. obj.otherUserType = 'STORE'
  148. obj.otherEnterprise = {enUU: response.data.uu, name: response.data.enName}
  149. obj.type = 'CHAT'
  150. if (!(/^1\d{10}$/).test(response.data.enTel)) {
  151. this.$http.get('/basic/enterprise/' + response.data.uu + '/admin').then(response => {
  152. console.log(response)
  153. obj.toPhone = response.data.userTel
  154. console.log(obj)
  155. this.openWebChat(newTab, obj)
  156. }, err => {
  157. console.log(err)
  158. this.$message.error('暂无卖家管理员手机号!')
  159. })
  160. } else {
  161. obj.toPhone = response.data.enTel
  162. console.log(obj)
  163. this.openWebChat(newTab, obj)
  164. }
  165. }, err => {
  166. console.log(err)
  167. })
  168. }
  169. },
  170. openWebChat: function (newTab, obj) {
  171. this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
  172. .then(response => {
  173. if (response.data.success) {
  174. newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
  175. }
  176. })
  177. }
  178. }
  179. }
  180. </script>
  181. <style scoped>
  182. .header-text {
  183. text-align: center;
  184. font-size: 20px;
  185. color: #008B00;
  186. margin-top: 0;
  187. }
  188. .el-dialog__body{
  189. padding: 20px !important;
  190. }
  191. .focus button.focus-btn a{
  192. color: #fff;
  193. width: 100%;
  194. height: 100%;
  195. display: inline-block;
  196. }
  197. .focus button.focus-btn{
  198. width: 138px;
  199. height: 36px;
  200. line-height: 36px;
  201. padding: 0;
  202. }
  203. #nav_fragment {
  204. margin-bottom: 20px;
  205. }
  206. #nav_fragment .shop-name {
  207. font-size: 24px;
  208. color: RGB(50,50,50);
  209. }
  210. #nav_fragment div#shop {
  211. width: 440px;
  212. padding: 5px;
  213. }
  214. #nav_fragment .shop-info {
  215. font-size: 12px;
  216. color: rgb(50,50,50);
  217. }
  218. #nav_fragment .shop-data {
  219. font-size: 12px;
  220. line-height: 25px;
  221. font-weight: 600;
  222. color: RGB(255,0,0);
  223. }
  224. #nav_fragment .btn-nav{
  225. width: 40px;
  226. height: 20px;
  227. line-height: 14px;
  228. padding: 0;
  229. }
  230. #nav_fragment .btn-nav .watch {
  231. font-size: 12px;
  232. color: white;
  233. }
  234. #nav_fragment .btn-nav .message {
  235. font-size: 12px;
  236. color: rgb(50,50,50);
  237. }
  238. #nav_fragment div.dropdown {
  239. margin-top: -5px;
  240. padding: 5px;
  241. }
  242. #nav_fragment .shop-contact {
  243. font-size: 14px;
  244. color: rgb(120,120,120);
  245. line-height: 25px;
  246. }
  247. #nav_fragment .shop-contact a{
  248. color: rgb(33,71,151);
  249. }
  250. #nav_fragment #search_input {
  251. height: 40px;
  252. font-size: 16px;
  253. border: 2px solid #5078cb;
  254. border-top-left-radius: 0px;
  255. border-bottom-left-radius: 0px;
  256. line-height: 40px;
  257. }
  258. #nav_fragment #search_input:focus {
  259. border-color: #5078cb;
  260. outline: 0;
  261. -webkit-box-shadow: none;
  262. box-shadow: none;
  263. }
  264. #nav_fragment #search_btn {
  265. background-color: #5078cb;
  266. color: rgb(255, 255, 255);
  267. font-size: 16px;
  268. width: 78px;
  269. height: 40px;
  270. border: 2px solid #5078cb;
  271. border-radius: 0;
  272. }
  273. #nav_fragment #search_btn_this {
  274. height: 36px;
  275. line-height: 36px;
  276. padding-top: 0px;
  277. padding-bottom: 0px;
  278. font-size: 16px;
  279. font-weight: 600;
  280. color: #5078cb;
  281. background: #fff;
  282. border-radius: 0;
  283. border: 1px #5078cb solid;
  284. }
  285. #nav_fragment .my-cart {
  286. margin-top: 20px;
  287. margin-left: 20px;
  288. }
  289. #nav_fragment .my-cart #my-cart{
  290. font-size: 14px;
  291. color: #5078cb;
  292. }
  293. #nav_fragment .my-cart .badge {
  294. background-color: #ff0000;
  295. position: absolute;
  296. top: -10px;
  297. }
  298. #nav_fragment .list-unstyled {
  299. list-style: none;
  300. }
  301. #nav_fragment a:hover,a:focus {
  302. text-decoration: none;
  303. }
  304. #nav_fragment .row>div {
  305. float: left;
  306. }
  307. #nav_fragment #shop {
  308. width: 100%;
  309. position: absolute;
  310. float: left;
  311. }
  312. #nav_fragment #search-group {
  313. padding-top: 20px;
  314. margin-left: 10px;
  315. padding-left: 20px;
  316. top: -12px;
  317. position: relative;
  318. }
  319. #nav_fragment #search-group .input-group {
  320. margin-right: 10px;
  321. float: left;
  322. width: 480px;
  323. }
  324. #nav_fragment .dropdown .dropdown-menu .dropdown-btn {
  325. float: left;
  326. margin-top: 30px;
  327. }
  328. #nav_fragment .dropdown .dropdown-score .description {
  329. padding-top: 10px;
  330. color: #323232;
  331. font-size: 12px;
  332. }
  333. #nav_fragment .dropdown .dropdown-score .score {
  334. display: inline-block;
  335. padding-top: 5px;
  336. color: #FF6868;
  337. font-size: 12px;
  338. }
  339. #nav_fragment .dropdown .dropdown-menu .dropdown-score>div>div {
  340. margin-top: 0px;
  341. width: 25px;
  342. margin-right: 10px;
  343. }
  344. #nav_fragment .shop-score {
  345. margin-top: 20px;
  346. margin-left: 70px;
  347. }
  348. #nav_fragment .shop-score>div>div {
  349. margin-right: 10px;
  350. width: 25px;
  351. }
  352. #nav_fragment .hot-search .active-search-item {
  353. color: #ff0101;
  354. font-size: 13px;
  355. display: inline-block;
  356. margin-right: 1em;
  357. }
  358. #nav_fragment .hot-search .resources {
  359. font-size: 12px;
  360. color: rgb(250,50,50);
  361. }
  362. #nav_fragment .hot-search .hot-word {
  363. font-size: 12px;
  364. color: rgb(50,50,50);
  365. margin-left: 20px;
  366. }
  367. #nav_fragment .drop-down-active {
  368. z-index: 20;
  369. -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  370. box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  371. border: #f5f5f5 1px solid;
  372. background-color: white;
  373. transition: dispaly .5s ease;
  374. }
  375. .hot-search{
  376. margin-top: 5px;
  377. }
  378. .hot-search .static{
  379. color: #f00;
  380. }
  381. .hot-search a{
  382. color: #838383;
  383. }
  384. .hot-search a:hover{
  385. color: #f00;
  386. }
  387. .my-cart .btn{
  388. top: -8px;
  389. position: relative;
  390. }
  391. #search-group .association {
  392. position: absolute;
  393. left: 0;
  394. top: 100%;
  395. right: 61px;
  396. list-style: none;
  397. -webkit-padding-start: 0;
  398. background: #ffffff;
  399. border: 1px solid #dddddd;
  400. z-index: 21;
  401. }
  402. #search-group .association li {
  403. padding: 0 15px;
  404. line-height: 30px;
  405. text-align: left;
  406. }
  407. #search-group .association li:hover {
  408. background: #EEEEEE;
  409. cursor: pointer;
  410. }
  411. .text-right{
  412. text-align: right;
  413. }
  414. .text-right a:hover{
  415. color: #d32526 !important;
  416. text-decoration: underline;
  417. }
  418. .icon-style img{
  419. vertical-align: top;
  420. position: relative;
  421. top: -9px;
  422. }
  423. .icon-style >span {
  424. margin-right: 5px;
  425. }
  426. .icon-style .link-seller {
  427. cursor: pointer;
  428. }
  429. .icon-style .link-seller img {
  430. top: -2px;
  431. }
  432. .icon-style .link-seller a {
  433. font-size: 12px;
  434. color: #fff;
  435. line-height: 20px;
  436. height: 20px;
  437. padding: 0 7px;
  438. background: #ef7f03;
  439. border-radius: 2px;
  440. }
  441. </style>