StoreHeader.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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"><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" ><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. const foucusList = this.$store.state.shop.storeInfo.focusList.data
  89. return foucusList === 'true'
  90. }
  91. },
  92. mounted () {
  93. this.$nextTick(() => {
  94. this.loadFocusList()
  95. })
  96. },
  97. methods: {
  98. loadFocusList () {
  99. if (this.user.logged) {
  100. this.$store.dispatch('shop/StoreFocusList', {id: this.storeInfo.id})
  101. }
  102. },
  103. closeDropDown () {
  104. this.isOpen = false
  105. },
  106. openDropDown () {
  107. this.isOpen = true
  108. },
  109. focus (id, name) {
  110. if (!this.user.logged) {
  111. this.$http.get('/login/page').then(response => {
  112. if (response.data) {
  113. this.$router.push('/auth/login')
  114. }
  115. })
  116. } else {
  117. this.dialogVisible = true
  118. this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
  119. this.isFocus = true
  120. }
  121. }
  122. }
  123. }
  124. </script>
  125. <style scoped>
  126. body{
  127. font-family: "Microsoft Yahei", "微软雅黑";
  128. }
  129. .header-text {
  130. text-align: center;
  131. font-size: 20px;
  132. color: #008B00;
  133. margin-top: 0;
  134. }
  135. .el-dialog__body{
  136. padding: 20px !important;
  137. }
  138. .focus button.focus-btn a{
  139. color: #fff;
  140. }
  141. #nav_fragment {
  142. margin-bottom: 20px;
  143. }
  144. #nav_fragment .shop-name {
  145. font-size: 24px;
  146. color: RGB(50,50,50);
  147. }
  148. #nav_fragment div#shop {
  149. width: 440px;
  150. padding: 5px;
  151. }
  152. #nav_fragment .shop-info {
  153. font-size: 12px;
  154. color: rgb(50,50,50);
  155. }
  156. #nav_fragment .shop-data {
  157. font-size: 12px;
  158. line-height: 25px;
  159. font-weight: 600;
  160. color: RGB(255,0,0);
  161. }
  162. #nav_fragment .btn-nav{
  163. width: 40px;
  164. height: 20px;
  165. line-height: 14px;
  166. padding: 0;
  167. }
  168. #nav_fragment .btn-nav .watch {
  169. font-size: 12px;
  170. color: white;
  171. }
  172. #nav_fragment .btn-nav .message {
  173. font-size: 12px;
  174. color: rgb(50,50,50);
  175. }
  176. #nav_fragment div.dropdown {
  177. margin-top: -5px;
  178. padding: 5px;
  179. }
  180. #nav_fragment .shop-contact {
  181. font-size: 14px;
  182. color: rgb(120,120,120);
  183. line-height: 25px;
  184. }
  185. #nav_fragment .shop-contact a{
  186. color: rgb(33,71,151);
  187. }
  188. #nav_fragment #search_input {
  189. height: 40px;
  190. font-size: 16px;
  191. font-family: '微软雅黑';
  192. border: 2px solid #5078cb;
  193. border-top-left-radius: 0px;
  194. border-bottom-left-radius: 0px;
  195. line-height: 40px;
  196. }
  197. #nav_fragment #search_input:focus {
  198. border-color: #5078cb;
  199. outline: 0;
  200. -webkit-box-shadow: none;
  201. box-shadow: none;
  202. }
  203. #nav_fragment #search_btn {
  204. background-color: #5078cb;
  205. color: rgb(255, 255, 255);
  206. font-size: 16px;
  207. width: 78px;
  208. height: 40px;
  209. border: 2px solid #5078cb;
  210. border-radius: 0;
  211. }
  212. #nav_fragment #search_btn_this {
  213. height: 36px;
  214. line-height: 36px;
  215. padding-top: 0px;
  216. padding-bottom: 0px;
  217. font-size: 16px;
  218. font-weight: 600;
  219. color: #5078cb;
  220. background: #fff;
  221. border-radius: 0;
  222. border: 1px #5078cb solid;
  223. }
  224. #nav_fragment .my-cart {
  225. margin-top: 20px;
  226. margin-left: 20px;
  227. }
  228. #nav_fragment .my-cart #my-cart{
  229. font-size: 14px;
  230. color: #5078cb;
  231. }
  232. #nav_fragment .my-cart .badge {
  233. background-color: #ff0000;
  234. position: absolute;
  235. top: -10px;
  236. }
  237. #nav_fragment .list-unstyled {
  238. list-style: none;
  239. }
  240. #nav_fragment a:hover,a:focus {
  241. text-decoration: none;
  242. }
  243. #nav_fragment .row>div {
  244. float: left;
  245. }
  246. #nav_fragment #shop {
  247. width: 100%;
  248. position: absolute;
  249. float: left;
  250. }
  251. #nav_fragment #search-group {
  252. padding-top: 20px;
  253. margin-left: 10px;
  254. padding-left: 20px;
  255. top: -12px;
  256. position: relative;
  257. }
  258. #nav_fragment #search-group .input-group {
  259. margin-right: 10px;
  260. float: left;
  261. width: 480px;
  262. }
  263. #nav_fragment .dropdown .dropdown-menu .dropdown-btn {
  264. float: left;
  265. margin-top: 30px;
  266. }
  267. #nav_fragment .dropdown .dropdown-score .description {
  268. padding-top: 10px;
  269. color: #323232;
  270. font-size: 12px;
  271. }
  272. #nav_fragment .dropdown .dropdown-score .score {
  273. display: inline-block;
  274. padding-top: 5px;
  275. color: #FF6868;
  276. font-size: 12px;
  277. }
  278. #nav_fragment .dropdown .dropdown-menu .dropdown-score>div>div {
  279. margin-top: 0px;
  280. width: 25px;
  281. margin-right: 10px;
  282. }
  283. #nav_fragment .shop-score {
  284. margin-top: 20px;
  285. margin-left: 70px;
  286. }
  287. #nav_fragment .shop-score>div>div {
  288. margin-right: 10px;
  289. width: 25px;
  290. }
  291. #nav_fragment .hot-search .active-search-item {
  292. color: #ff0101;
  293. font-size: 13px;
  294. display: inline-block;
  295. margin-right: 1em;
  296. }
  297. #nav_fragment .hot-search .resources {
  298. font-size: 12px;
  299. font-family: "Microsoft Yahei", "微软雅黑";
  300. color: rgb(250,50,50);
  301. }
  302. #nav_fragment .hot-search .hot-word {
  303. font-size: 12px;
  304. color: rgb(50,50,50);
  305. margin-left: 20px;
  306. }
  307. #nav_fragment .drop-down-active {
  308. z-index: 20;
  309. -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  310. box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 2px rgba(210,209,209,.9);
  311. border: #f5f5f5 1px solid;
  312. background-color: white;
  313. transition: dispaly .5s ease;
  314. }
  315. .hot-search{
  316. margin-top: 5px;
  317. }
  318. .hot-search .static{
  319. color: #f00;
  320. }
  321. .hot-search a{
  322. color: #838383;
  323. }
  324. .hot-search a:hover{
  325. color: #f00;
  326. }
  327. .my-cart .btn{
  328. top: -8px;
  329. position: relative;
  330. }
  331. #search-group .association {
  332. position: absolute;
  333. left: 0;
  334. top: 100%;
  335. right: 61px;
  336. list-style: none;
  337. -webkit-padding-start: 0;
  338. background: #ffffff;
  339. border: 1px solid #dddddd;
  340. z-index: 21;
  341. }
  342. #search-group .association li {
  343. padding: 0 15px;
  344. line-height: 30px;
  345. text-align: left;
  346. font-family: "Microsoft Yahei";
  347. }
  348. #search-group .association li:hover {
  349. background: #EEEEEE;
  350. cursor: pointer;
  351. }
  352. .text-right{
  353. text-align: right;
  354. }
  355. .text-right a:hover{
  356. color: #d32526 !important;
  357. text-decoration: underline;
  358. }
  359. .icon-style img{
  360. vertical-align: top;
  361. position: relative;
  362. top: -9px;
  363. }
  364. </style>