StoreHeader.vue 9.4 KB

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