StoreHeader.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  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. </div>
  25. </div>
  26. <div class="clearfix"></div>
  27. </div>
  28. <div style="background: #FFFFFF;" v-if="isOpen">
  29. <ul class = "shop-contact list-unstyled" style="padding: 15px 0; margin-bottom: 0; border-top: #e8e8e8 1px solid; margin-top: 20px;">
  30. <li v-if="storeInfo.enterprise.enTel&&storeInfo.enterprise.enTel.length > 0">
  31. <span>电话:</span><span v-text="storeInfo.enterprise.enTel"></span>
  32. </li>
  33. <li v-if="storeInfo.enterprise.enFax&&storeInfo.enterprise.enFax.length > 0">
  34. <span>传真:</span><span v-text="storeInfo.enterprise.enFax"></span>
  35. </li>
  36. <li v-if="storeInfo.enterprise.address&&storeInfo.enterprise.address.length > 0">
  37. <span>地址:</span><span v-text="storeInfo.enterprise.address"></span>
  38. </li>
  39. <li class="text-right">
  40. <nuxt-link :to="{ name: 'store-uuid-description', params: { uuid: storeInfo.uuid } }">了解更多&gt;</nuxt-link>
  41. </li>
  42. </ul>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- 搜索框 -->
  47. <div id="search-group" style="margin-left: 450px;">
  48. <search-box/>
  49. </div>
  50. </div>
  51. </div>
  52. <!--关注-->
  53. <el-dialog
  54. :visible.sync="dialogVisible"
  55. size="tiny"
  56. >
  57. <h3 class="header-text">关注成功!</h3>
  58. <div class="focus modal-body">
  59. <button type="button" @click="dialogVisible = false" class="btn" style="margin-left:25px;">关&nbsp;&nbsp;闭</button>
  60. <button type="button" @click="dialogVisible = false" class="focus-btn btn btn btn-info" style="margin-left:35px;">
  61. <a href="/user#/storeFocus" target="_blank">查看我的店铺关注</a>
  62. </button>
  63. </div>
  64. </el-dialog>
  65. </div>
  66. </template>
  67. <script>
  68. import SearchBox from '~components/main/Search.vue'
  69. export default {
  70. name: 'store-header',
  71. data () {
  72. return {
  73. isOpen: false,
  74. dialogVisible: false
  75. }
  76. },
  77. components: {
  78. SearchBox
  79. },
  80. computed: {
  81. storeInfo () {
  82. return this.$store.state.shop.storeInfo.store.data
  83. },
  84. user () {
  85. return this.$store.state.option.user
  86. },
  87. isFocus () {
  88. return this.$store.state.shop.storeInfo.focusList.data
  89. }
  90. },
  91. methods: {
  92. closeDropDown () {
  93. this.isOpen = false
  94. },
  95. openDropDown () {
  96. this.isOpen = true
  97. },
  98. focus (id, name) {
  99. if (!this.user.logged) {
  100. this.$http.get('/login/page').then(response => {
  101. if (response.data) {
  102. this.$router.push('/auth/login')
  103. }
  104. })
  105. } else {
  106. this.dialogVisible = true
  107. this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
  108. this.isFocus = true
  109. }
  110. }
  111. }
  112. }
  113. </script>
  114. <style scoped>
  115. .header-text {
  116. text-align: center;
  117. font-size: 20px;
  118. color: #008B00;
  119. margin-top: 0;
  120. }
  121. .el-dialog__body{
  122. padding: 20px !important;
  123. }
  124. .focus button.focus-btn a{
  125. color: #fff;
  126. width: 100%;
  127. height: 100%;
  128. display: inline-block;
  129. }
  130. .focus button.focus-btn{
  131. width: 138px;
  132. height: 36px;
  133. line-height: 36px;
  134. padding: 0;
  135. }
  136. #nav_fragment {
  137. margin-bottom: 20px;
  138. }
  139. #nav_fragment .shop-name {
  140. font-size: 24px;
  141. color: RGB(50,50,50);
  142. }
  143. #nav_fragment div#shop {
  144. width: 440px;
  145. padding: 5px;
  146. }
  147. #nav_fragment .shop-info {
  148. font-size: 12px;
  149. color: rgb(50,50,50);
  150. }
  151. #nav_fragment .shop-data {
  152. font-size: 12px;
  153. line-height: 25px;
  154. font-weight: 600;
  155. color: RGB(255,0,0);
  156. }
  157. #nav_fragment .btn-nav{
  158. width: 40px;
  159. height: 20px;
  160. line-height: 14px;
  161. padding: 0;
  162. }
  163. #nav_fragment .btn-nav .watch {
  164. font-size: 12px;
  165. color: white;
  166. }
  167. #nav_fragment .btn-nav .message {
  168. font-size: 12px;
  169. color: rgb(50,50,50);
  170. }
  171. #nav_fragment div.dropdown {
  172. margin-top: -5px;
  173. padding: 5px;
  174. }
  175. #nav_fragment .shop-contact {
  176. font-size: 14px;
  177. color: rgb(120,120,120);
  178. line-height: 25px;
  179. }
  180. #nav_fragment .shop-contact a{
  181. color: rgb(33,71,151);
  182. }
  183. #nav_fragment #search_input {
  184. height: 40px;
  185. font-size: 16px;
  186. border: 2px solid #5078cb;
  187. border-top-left-radius: 0px;
  188. border-bottom-left-radius: 0px;
  189. line-height: 40px;
  190. }
  191. #nav_fragment #search_input:focus {
  192. border-color: #5078cb;
  193. outline: 0;
  194. -webkit-box-shadow: none;
  195. box-shadow: none;
  196. }
  197. #nav_fragment #search_btn {
  198. background-color: #5078cb;
  199. color: rgb(255, 255, 255);
  200. font-size: 16px;
  201. width: 78px;
  202. height: 40px;
  203. border: 2px solid #5078cb;
  204. border-radius: 0;
  205. }
  206. #nav_fragment #search_btn_this {
  207. height: 36px;
  208. line-height: 36px;
  209. padding-top: 0px;
  210. padding-bottom: 0px;
  211. font-size: 16px;
  212. font-weight: 600;
  213. color: #5078cb;
  214. background: #fff;
  215. border-radius: 0;
  216. border: 1px #5078cb solid;
  217. }
  218. #nav_fragment .my-cart {
  219. margin-top: 20px;
  220. margin-left: 20px;
  221. }
  222. #nav_fragment .my-cart #my-cart{
  223. font-size: 14px;
  224. color: #5078cb;
  225. }
  226. #nav_fragment .my-cart .badge {
  227. background-color: #ff0000;
  228. position: absolute;
  229. top: -10px;
  230. }
  231. #nav_fragment .list-unstyled {
  232. list-style: none;
  233. }
  234. #nav_fragment a:hover,a:focus {
  235. text-decoration: none;
  236. }
  237. #nav_fragment .row>div {
  238. float: left;
  239. }
  240. #nav_fragment #shop {
  241. width: 100%;
  242. position: absolute;
  243. float: left;
  244. }
  245. #nav_fragment #search-group {
  246. padding-top: 20px;
  247. margin-left: 10px;
  248. padding-left: 20px;
  249. top: -12px;
  250. position: relative;
  251. }
  252. #nav_fragment #search-group .input-group {
  253. margin-right: 10px;
  254. float: left;
  255. width: 480px;
  256. }
  257. #nav_fragment .dropdown .dropdown-menu .dropdown-btn {
  258. float: left;
  259. margin-top: 30px;
  260. }
  261. #nav_fragment .dropdown .dropdown-score .description {
  262. padding-top: 10px;
  263. color: #323232;
  264. font-size: 12px;
  265. }
  266. #nav_fragment .dropdown .dropdown-score .score {
  267. display: inline-block;
  268. padding-top: 5px;
  269. color: #FF6868;
  270. font-size: 12px;
  271. }
  272. #nav_fragment .dropdown .dropdown-menu .dropdown-score>div>div {
  273. margin-top: 0px;
  274. width: 25px;
  275. margin-right: 10px;
  276. }
  277. #nav_fragment .shop-score {
  278. margin-top: 20px;
  279. margin-left: 70px;
  280. }
  281. #nav_fragment .shop-score>div>div {
  282. margin-right: 10px;
  283. width: 25px;
  284. }
  285. #nav_fragment .hot-search .active-search-item {
  286. color: #ff0101;
  287. font-size: 13px;
  288. display: inline-block;
  289. margin-right: 1em;
  290. }
  291. #nav_fragment .hot-search .resources {
  292. font-size: 12px;
  293. color: rgb(250,50,50);
  294. }
  295. #nav_fragment .hot-search .hot-word {
  296. font-size: 12px;
  297. color: rgb(50,50,50);
  298. margin-left: 20px;
  299. }
  300. #nav_fragment .drop-down-active {
  301. z-index: 20;
  302. -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  303. box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  304. border: #f5f5f5 1px solid;
  305. background-color: white;
  306. transition: dispaly .5s ease;
  307. }
  308. .hot-search{
  309. margin-top: 5px;
  310. }
  311. .hot-search .static{
  312. color: #f00;
  313. }
  314. .hot-search a{
  315. color: #838383;
  316. }
  317. .hot-search a:hover{
  318. color: #f00;
  319. }
  320. .my-cart .btn{
  321. top: -8px;
  322. position: relative;
  323. }
  324. #search-group .association {
  325. position: absolute;
  326. left: 0;
  327. top: 100%;
  328. right: 61px;
  329. list-style: none;
  330. -webkit-padding-start: 0;
  331. background: #ffffff;
  332. border: 1px solid #dddddd;
  333. z-index: 21;
  334. }
  335. #search-group .association li {
  336. padding: 0 15px;
  337. line-height: 30px;
  338. text-align: left;
  339. }
  340. #search-group .association li:hover {
  341. background: #EEEEEE;
  342. cursor: pointer;
  343. }
  344. .text-right{
  345. text-align: right;
  346. }
  347. .text-right a:hover{
  348. color: #d32526 !important;
  349. text-decoration: underline;
  350. }
  351. .icon-style img{
  352. vertical-align: top;
  353. position: relative;
  354. top: -9px;
  355. }
  356. </style>