StoreHeader.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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. },
  95. methods: {
  96. closeDropDown () {
  97. this.isOpen = false
  98. },
  99. openDropDown () {
  100. this.isOpen = true
  101. },
  102. focus (id, name) {
  103. if (!this.user.logged) {
  104. this.$http.get('/login/page').then(response => {
  105. if (response.data) {
  106. this.$router.push('/auth/login')
  107. }
  108. })
  109. } else {
  110. this.dialogVisible = true
  111. this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
  112. this.isFocus = true
  113. }
  114. },
  115. goWebChat: function () {
  116. if (!this.user.logged) {
  117. this.$http.get('/login/page').then(response => {
  118. if (response.data) {
  119. this.$router.push('/auth/login')
  120. }
  121. })
  122. } else {
  123. // 获得窗口的垂直位置
  124. let iTop = (window.screen.availHeight - 30 - 780) / 2
  125. // 获得窗口的水平位置
  126. let iLeft = (window.screen.availWidth - 10 - 1030) / 2
  127. let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
  128. this.$http.get('/basic/enterprise/' + this.storeInfo.enUU + '/info')
  129. .then(response => {
  130. let obj = {}
  131. obj.enUU = response.data.uu
  132. obj.enterprise = {enUU: response.data.uu, name: response.data.enName}
  133. obj.type = 'STORE'
  134. if (!(/^1\d{10}$/).test(this.user.data.userTel)) {
  135. this.$http.get('/basic/enterprise/' + obj.enUU + '/admin').then(response => {
  136. obj.userPhone = response.userTel
  137. this.openWebChat(newTab, obj)
  138. }, err => {
  139. console.log(err)
  140. this.$message.error('暂无卖家管理员手机号!')
  141. })
  142. } else {
  143. obj.userPhone = this.user.data.userTel
  144. this.openWebChat(newTab, obj)
  145. }
  146. }, err => {
  147. console.log(err)
  148. })
  149. }
  150. },
  151. openWebChat: function (newTab, obj) {
  152. this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
  153. .then(response => {
  154. if (response.data.success) {
  155. newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
  156. }
  157. })
  158. }
  159. }
  160. }
  161. </script>
  162. <style scoped>
  163. .header-text {
  164. text-align: center;
  165. font-size: 20px;
  166. color: #008B00;
  167. margin-top: 0;
  168. }
  169. .el-dialog__body{
  170. padding: 20px !important;
  171. }
  172. .focus button.focus-btn a{
  173. color: #fff;
  174. width: 100%;
  175. height: 100%;
  176. display: inline-block;
  177. }
  178. .focus button.focus-btn{
  179. width: 138px;
  180. height: 36px;
  181. line-height: 36px;
  182. padding: 0;
  183. }
  184. #nav_fragment {
  185. margin-bottom: 20px;
  186. }
  187. #nav_fragment .shop-name {
  188. font-size: 24px;
  189. color: RGB(50,50,50);
  190. }
  191. #nav_fragment div#shop {
  192. width: 440px;
  193. padding: 5px;
  194. }
  195. #nav_fragment .shop-info {
  196. font-size: 12px;
  197. color: rgb(50,50,50);
  198. }
  199. #nav_fragment .shop-data {
  200. font-size: 12px;
  201. line-height: 25px;
  202. font-weight: 600;
  203. color: RGB(255,0,0);
  204. }
  205. #nav_fragment .btn-nav{
  206. width: 40px;
  207. height: 20px;
  208. line-height: 14px;
  209. padding: 0;
  210. }
  211. #nav_fragment .btn-nav .watch {
  212. font-size: 12px;
  213. color: white;
  214. }
  215. #nav_fragment .btn-nav .message {
  216. font-size: 12px;
  217. color: rgb(50,50,50);
  218. }
  219. #nav_fragment div.dropdown {
  220. margin-top: -5px;
  221. padding: 5px;
  222. }
  223. #nav_fragment .shop-contact {
  224. font-size: 14px;
  225. color: rgb(120,120,120);
  226. line-height: 25px;
  227. }
  228. #nav_fragment .shop-contact a{
  229. color: rgb(33,71,151);
  230. }
  231. #nav_fragment #search_input {
  232. height: 40px;
  233. font-size: 16px;
  234. border: 2px solid #5078cb;
  235. border-top-left-radius: 0px;
  236. border-bottom-left-radius: 0px;
  237. line-height: 40px;
  238. }
  239. #nav_fragment #search_input:focus {
  240. border-color: #5078cb;
  241. outline: 0;
  242. -webkit-box-shadow: none;
  243. box-shadow: none;
  244. }
  245. #nav_fragment #search_btn {
  246. background-color: #5078cb;
  247. color: rgb(255, 255, 255);
  248. font-size: 16px;
  249. width: 78px;
  250. height: 40px;
  251. border: 2px solid #5078cb;
  252. border-radius: 0;
  253. }
  254. #nav_fragment #search_btn_this {
  255. height: 36px;
  256. line-height: 36px;
  257. padding-top: 0px;
  258. padding-bottom: 0px;
  259. font-size: 16px;
  260. font-weight: 600;
  261. color: #5078cb;
  262. background: #fff;
  263. border-radius: 0;
  264. border: 1px #5078cb solid;
  265. }
  266. #nav_fragment .my-cart {
  267. margin-top: 20px;
  268. margin-left: 20px;
  269. }
  270. #nav_fragment .my-cart #my-cart{
  271. font-size: 14px;
  272. color: #5078cb;
  273. }
  274. #nav_fragment .my-cart .badge {
  275. background-color: #ff0000;
  276. position: absolute;
  277. top: -10px;
  278. }
  279. #nav_fragment .list-unstyled {
  280. list-style: none;
  281. }
  282. #nav_fragment a:hover,a:focus {
  283. text-decoration: none;
  284. }
  285. #nav_fragment .row>div {
  286. float: left;
  287. }
  288. #nav_fragment #shop {
  289. width: 100%;
  290. position: absolute;
  291. float: left;
  292. }
  293. #nav_fragment #search-group {
  294. padding-top: 20px;
  295. margin-left: 10px;
  296. padding-left: 20px;
  297. top: -12px;
  298. position: relative;
  299. }
  300. #nav_fragment #search-group .input-group {
  301. margin-right: 10px;
  302. float: left;
  303. width: 480px;
  304. }
  305. #nav_fragment .dropdown .dropdown-menu .dropdown-btn {
  306. float: left;
  307. margin-top: 30px;
  308. }
  309. #nav_fragment .dropdown .dropdown-score .description {
  310. padding-top: 10px;
  311. color: #323232;
  312. font-size: 12px;
  313. }
  314. #nav_fragment .dropdown .dropdown-score .score {
  315. display: inline-block;
  316. padding-top: 5px;
  317. color: #FF6868;
  318. font-size: 12px;
  319. }
  320. #nav_fragment .dropdown .dropdown-menu .dropdown-score>div>div {
  321. margin-top: 0px;
  322. width: 25px;
  323. margin-right: 10px;
  324. }
  325. #nav_fragment .shop-score {
  326. margin-top: 20px;
  327. margin-left: 70px;
  328. }
  329. #nav_fragment .shop-score>div>div {
  330. margin-right: 10px;
  331. width: 25px;
  332. }
  333. #nav_fragment .hot-search .active-search-item {
  334. color: #ff0101;
  335. font-size: 13px;
  336. display: inline-block;
  337. margin-right: 1em;
  338. }
  339. #nav_fragment .hot-search .resources {
  340. font-size: 12px;
  341. color: rgb(250,50,50);
  342. }
  343. #nav_fragment .hot-search .hot-word {
  344. font-size: 12px;
  345. color: rgb(50,50,50);
  346. margin-left: 20px;
  347. }
  348. #nav_fragment .drop-down-active {
  349. z-index: 20;
  350. -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  351. box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  352. border: #f5f5f5 1px solid;
  353. background-color: white;
  354. transition: dispaly .5s ease;
  355. }
  356. .hot-search{
  357. margin-top: 5px;
  358. }
  359. .hot-search .static{
  360. color: #f00;
  361. }
  362. .hot-search a{
  363. color: #838383;
  364. }
  365. .hot-search a:hover{
  366. color: #f00;
  367. }
  368. .my-cart .btn{
  369. top: -8px;
  370. position: relative;
  371. }
  372. #search-group .association {
  373. position: absolute;
  374. left: 0;
  375. top: 100%;
  376. right: 61px;
  377. list-style: none;
  378. -webkit-padding-start: 0;
  379. background: #ffffff;
  380. border: 1px solid #dddddd;
  381. z-index: 21;
  382. }
  383. #search-group .association li {
  384. padding: 0 15px;
  385. line-height: 30px;
  386. text-align: left;
  387. }
  388. #search-group .association li:hover {
  389. background: #EEEEEE;
  390. cursor: pointer;
  391. }
  392. .text-right{
  393. text-align: right;
  394. }
  395. .text-right a:hover{
  396. color: #d32526 !important;
  397. text-decoration: underline;
  398. }
  399. .icon-style img{
  400. vertical-align: top;
  401. position: relative;
  402. top: -9px;
  403. }
  404. .icon-style >span {
  405. margin-right: 5px;
  406. }
  407. .icon-style .link-seller {
  408. cursor: pointer;
  409. }
  410. .icon-style .link-seller img {
  411. top: -2px;
  412. }
  413. .icon-style .link-seller a {
  414. font-size: 12px;
  415. color: #fff;
  416. line-height: 20px;
  417. height: 20px;
  418. padding: 0 7px;
  419. background: #ef7f03;
  420. border-radius: 2px;
  421. }
  422. </style>