StoreHeader.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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.length > 0">
  31. <span>电话:</span><span v-text="storeInfo.enterprise.enTel"></span>
  32. </li>
  33. <li v-if="storeInfo.enterprise.enFax.length > 0">
  34. <span>传真:</span><span v-text="storeInfo.enterprise.enFax"></span>
  35. </li>
  36. <li v-if="storeInfo.enterprise.enAddress.length > 0">
  37. <span>地址:</span><span v-text="storeInfo.enterprise.enAddress"></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. }
  127. #nav_fragment {
  128. margin-bottom: 20px;
  129. }
  130. #nav_fragment .shop-name {
  131. font-size: 24px;
  132. color: RGB(50,50,50);
  133. }
  134. #nav_fragment div#shop {
  135. width: 440px;
  136. padding: 5px;
  137. }
  138. #nav_fragment .shop-info {
  139. font-size: 12px;
  140. color: rgb(50,50,50);
  141. }
  142. #nav_fragment .shop-data {
  143. font-size: 12px;
  144. line-height: 25px;
  145. font-weight: 600;
  146. color: RGB(255,0,0);
  147. }
  148. #nav_fragment .btn-nav{
  149. width: 40px;
  150. height: 20px;
  151. line-height: 14px;
  152. padding: 0;
  153. }
  154. #nav_fragment .btn-nav .watch {
  155. font-size: 12px;
  156. color: white;
  157. }
  158. #nav_fragment .btn-nav .message {
  159. font-size: 12px;
  160. color: rgb(50,50,50);
  161. }
  162. #nav_fragment div.dropdown {
  163. margin-top: -5px;
  164. padding: 5px;
  165. }
  166. #nav_fragment .shop-contact {
  167. font-size: 14px;
  168. color: rgb(120,120,120);
  169. line-height: 25px;
  170. }
  171. #nav_fragment .shop-contact a{
  172. color: rgb(33,71,151);
  173. }
  174. #nav_fragment #search_input {
  175. height: 40px;
  176. font-size: 16px;
  177. border: 2px solid #5078cb;
  178. border-top-left-radius: 0px;
  179. border-bottom-left-radius: 0px;
  180. line-height: 40px;
  181. }
  182. #nav_fragment #search_input:focus {
  183. border-color: #5078cb;
  184. outline: 0;
  185. -webkit-box-shadow: none;
  186. box-shadow: none;
  187. }
  188. #nav_fragment #search_btn {
  189. background-color: #5078cb;
  190. color: rgb(255, 255, 255);
  191. font-size: 16px;
  192. width: 78px;
  193. height: 40px;
  194. border: 2px solid #5078cb;
  195. border-radius: 0;
  196. }
  197. #nav_fragment #search_btn_this {
  198. height: 36px;
  199. line-height: 36px;
  200. padding-top: 0px;
  201. padding-bottom: 0px;
  202. font-size: 16px;
  203. font-weight: 600;
  204. color: #5078cb;
  205. background: #fff;
  206. border-radius: 0;
  207. border: 1px #5078cb solid;
  208. }
  209. #nav_fragment .my-cart {
  210. margin-top: 20px;
  211. margin-left: 20px;
  212. }
  213. #nav_fragment .my-cart #my-cart{
  214. font-size: 14px;
  215. color: #5078cb;
  216. }
  217. #nav_fragment .my-cart .badge {
  218. background-color: #ff0000;
  219. position: absolute;
  220. top: -10px;
  221. }
  222. #nav_fragment .list-unstyled {
  223. list-style: none;
  224. }
  225. #nav_fragment a:hover,a:focus {
  226. text-decoration: none;
  227. }
  228. #nav_fragment .row>div {
  229. float: left;
  230. }
  231. #nav_fragment #shop {
  232. width: 100%;
  233. position: absolute;
  234. float: left;
  235. }
  236. #nav_fragment #search-group {
  237. padding-top: 20px;
  238. margin-left: 10px;
  239. padding-left: 20px;
  240. top: -12px;
  241. position: relative;
  242. }
  243. #nav_fragment #search-group .input-group {
  244. margin-right: 10px;
  245. float: left;
  246. width: 480px;
  247. }
  248. #nav_fragment .dropdown .dropdown-menu .dropdown-btn {
  249. float: left;
  250. margin-top: 30px;
  251. }
  252. #nav_fragment .dropdown .dropdown-score .description {
  253. padding-top: 10px;
  254. color: #323232;
  255. font-size: 12px;
  256. }
  257. #nav_fragment .dropdown .dropdown-score .score {
  258. display: inline-block;
  259. padding-top: 5px;
  260. color: #FF6868;
  261. font-size: 12px;
  262. }
  263. #nav_fragment .dropdown .dropdown-menu .dropdown-score>div>div {
  264. margin-top: 0px;
  265. width: 25px;
  266. margin-right: 10px;
  267. }
  268. #nav_fragment .shop-score {
  269. margin-top: 20px;
  270. margin-left: 70px;
  271. }
  272. #nav_fragment .shop-score>div>div {
  273. margin-right: 10px;
  274. width: 25px;
  275. }
  276. #nav_fragment .hot-search .active-search-item {
  277. color: #ff0101;
  278. font-size: 13px;
  279. display: inline-block;
  280. margin-right: 1em;
  281. }
  282. #nav_fragment .hot-search .resources {
  283. font-size: 12px;
  284. color: rgb(250,50,50);
  285. }
  286. #nav_fragment .hot-search .hot-word {
  287. font-size: 12px;
  288. color: rgb(50,50,50);
  289. margin-left: 20px;
  290. }
  291. #nav_fragment .drop-down-active {
  292. z-index: 20;
  293. -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  294. box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  295. border: #f5f5f5 1px solid;
  296. background-color: white;
  297. transition: dispaly .5s ease;
  298. }
  299. .hot-search{
  300. margin-top: 5px;
  301. }
  302. .hot-search .static{
  303. color: #f00;
  304. }
  305. .hot-search a{
  306. color: #838383;
  307. }
  308. .hot-search a:hover{
  309. color: #f00;
  310. }
  311. .my-cart .btn{
  312. top: -8px;
  313. position: relative;
  314. }
  315. #search-group .association {
  316. position: absolute;
  317. left: 0;
  318. top: 100%;
  319. right: 61px;
  320. list-style: none;
  321. -webkit-padding-start: 0;
  322. background: #ffffff;
  323. border: 1px solid #dddddd;
  324. z-index: 21;
  325. }
  326. #search-group .association li {
  327. padding: 0 15px;
  328. line-height: 30px;
  329. text-align: left;
  330. }
  331. #search-group .association li:hover {
  332. background: #EEEEEE;
  333. cursor: pointer;
  334. }
  335. .text-right{
  336. text-align: right;
  337. }
  338. .text-right a:hover{
  339. color: #d32526 !important;
  340. text-decoration: underline;
  341. }
  342. .icon-style img{
  343. vertical-align: top;
  344. position: relative;
  345. top: -9px;
  346. }
  347. </style>