RightBar.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <div>
  3. <div class="right-bar">
  4. <ul class="right-bar-center">
  5. <li class="right-bar-item">
  6. <a href="/user#/cart" class="title" target="_blank">
  7. <i class="iconfont icon-shopping-cart icon-xlg"></i>
  8. </a>
  9. <div class="sidebar-menu"><a href="/user#/cart" title="我的购物车" target="_blank">我的购物车<em><span>(<span v-text="cartCount.count || 0"></span>)</span></em></a></div>
  10. </li>
  11. <li class="right-bar-item">
  12. <el-button type="text" @click="dialogVisible = true">
  13. <a @click="onLeaveMessageClick()" class="title">
  14. <i class="iconfont icon-liuyan icon-xlg"></i>
  15. </a>
  16. <div class="sidebar-menu"><a title="留言板" target="_blank">留言板</a></div>
  17. </el-button>
  18. </li>
  19. <li class="right-bar-item contact-menu">
  20. <a href="http://wpa.qq.com/msgrd?v=3&uin=3432892085&site=www.ubtoc.com&menu=yes" target="_blank" class="title">
  21. <i class="iconfont icon-kefu icon-xlg"></i>
  22. </a>
  23. <div class="contact-us sidebar-menu">
  24. <p>在线客服:<img src="/images/all/songguo.png" /><a href="http://wpa.qq.com/msgrd?v=3&uin=3432892085&site=www.ubtoc.com&menu=yes" class="contact-btn" target="_blank">联系客服</a></p>
  25. <p>服务电话:400-830-1818</p>
  26. <p>服务邮箱:yrsc@usoftchina.com</p>
  27. <p>工作时间:</p>
  28. <p>周一至周五 9:00-18:00</p>
  29. </div>
  30. </li>
  31. </ul>
  32. <ul class="right-bar-bottom">
  33. <li class="right-bar-item">
  34. <a href="http://www.usoftmall.com/user#/browsingHistory" class="title" target="_blank">
  35. <i class="iconfont icon-zuji icon-xlg"></i>
  36. </a>
  37. <div class="sidebar-menu" v-if="!user.logged"><a href="/user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
  38. <div class="sidebar-menu" v-if="user.logged && listMe(history).length == 0"><a href="/user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
  39. <div class="foot-record sidebar-menu" v-if="user.logged && listMe(history).length > 0">
  40. <h3><a href="">浏览历史</a></h3>
  41. <dl>
  42. <dd v-for="item in listMe(history)">
  43. <a :href="'/store/' + item.storeid + '/' + item.batchCode" :title="item.code" v-text="item.code" v-if="item.status== 1"></a>
  44. <a :title="item.code" v-text="item.code" v-if="item.status== 0" disabled="disabled"></a>
  45. <div class="hover-shows">
  46. <em :class="{ 'off' : item.status== 0}"></em>
  47. <span :class="{ 'off' : item.status== 0}">失效</span>
  48. <a @click="deleteHistory(item,item.id)">&times;</a>
  49. </div>
  50. </dd>
  51. </dl>
  52. </div>
  53. </li>
  54. <li class="right-bar-item">
  55. <a @click="toTop()" class="title">
  56. <i class="iconfont icon-arrow-up icon-xlg"></i>
  57. </a>
  58. <div class="sidebar-menu"><a @click="toTop()" title="返回顶部" target="_blank">返回顶部</a></div>
  59. </li>
  60. </ul>
  61. </div>
  62. <el-dialog class="dialog"
  63. :visible.sync="dialogVisible"
  64. size="tiny">
  65. <message-board @pageEvent="listenPage" @openBoardEvent="listenOpen"/>
  66. </el-dialog>
  67. </div>
  68. </template>
  69. <script>
  70. import { scrollTo } from '~utils/scroll'
  71. import MessageBoard from '~components/messageBoard/MessageBoard.vue'
  72. export default {
  73. name: 'right-bar',
  74. data () {
  75. return {
  76. historyLength: [],
  77. dialogVisible: false,
  78. dialogImageUrl: '',
  79. page: 1,
  80. count: 3,
  81. currentPage: 1
  82. }
  83. },
  84. created () {
  85. this.$store.dispatch('getMessageBoardInformation', {page: 1, count: 3})
  86. },
  87. components: {
  88. MessageBoard
  89. },
  90. computed: {
  91. user () {
  92. return this.$store.state.option.user
  93. },
  94. cartCount () {
  95. return this.$store.state.user.history.cartCount.data
  96. },
  97. history () {
  98. let arr = this.$store.state.user.history.historyList.data.slice(0, 8)
  99. return arr
  100. }
  101. },
  102. mounted () {
  103. this.$nextTick(() => {
  104. this.loadHistorys()
  105. this.loadCarCount()
  106. })
  107. },
  108. methods: {
  109. listenPage: function (p) {
  110. this.page = p
  111. this.$store.dispatch('getMessageBoardInformation', {page: this.page, count: 3})
  112. },
  113. listenOpen: function (flag) {
  114. this.dialogVisible = flag
  115. },
  116. listMe: function (list) {
  117. return list.filter(function (item) {
  118. return item.isDelete === 1
  119. })
  120. },
  121. loadHistorys () {
  122. this.$store.dispatch('user/loadHistory')
  123. },
  124. loadCarCount () {
  125. this.$store.dispatch('user/CarCount')
  126. },
  127. toTop () {
  128. scrollTo('body', 300)
  129. },
  130. toBottom () {
  131. scrollTo(window.scrollY + window.innerHeight, 300)
  132. },
  133. // 打开留言板
  134. onLeaveMessageClick () {
  135. },
  136. deleteHistory (item, id) {
  137. this.$store.dispatch('user/deleteHistory', {id: id})
  138. this.loadHistorys()
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. a[disabled] {
  145. cursor: not-allowed;
  146. }
  147. em,i{
  148. font-style: inherit;
  149. }
  150. .right-bar ul li{
  151. position: relative;
  152. }
  153. .right-bar ul li .sidebar-menu {
  154. position: absolute;
  155. display: block;
  156. right: -100%;
  157. top: 0px;
  158. bottom: 0;
  159. width: 120px;
  160. line-height: 38px;
  161. height: 38px;
  162. color: #ffffff;
  163. background: #555;
  164. -webkit-transform: translateX(100%);
  165. -moz-transform: translateX(100%);
  166. -ms-transform: translateX(100%);
  167. -o-transform: translateX(100%);
  168. transform: translateX(100%);
  169. -webkit-transition: transform .5s;
  170. -moz-transition: transform .5s;
  171. -ms-transition: transform .5s;
  172. -o-transition: transform .5s;
  173. transition: transform .5s;
  174. z-index: 19;
  175. }
  176. .right-bar ul li .sidebar-menu a{
  177. background-color: #555555;
  178. }
  179. .right-bar ul li:hover a{
  180. background-color: #555555;
  181. }
  182. .right-bar ul li:hover .sidebar-menu {
  183. display: block;
  184. -webkit-transform: translateX(-72px);
  185. -moz-transform: translateX(-72px);
  186. -ms-transform: translateX(-72px);
  187. -o-transform: translateX(-72px);
  188. transform: translateX(-72px);
  189. }
  190. /*浏览记录*/
  191. .right-bar ul li .foot-record{
  192. /* display: none; */
  193. width: 210px !important;
  194. max-height: 230px;
  195. line-height: 30px;
  196. /* right: 200px;*/
  197. top: inherit;
  198. bottom: -100%;
  199. height: inherit;
  200. /*padding-bottom: 10px;*/
  201. }
  202. .right-bar ul li .foot-record h3{
  203. line-height: 39px;
  204. border-bottom: #767575 1px solid;
  205. text-align: left;
  206. padding-left: 10px;
  207. width: 96%;
  208. display: inline-block;
  209. margin: 0 auto;
  210. font-size: 12px;
  211. height: 39px;
  212. }
  213. .right-bar ul li .foot-record h3:hover a{
  214. color: #fbb029;
  215. }
  216. .right-bar ul li .foot-record h3 a{
  217. color: #fff;
  218. background-color: inherit;
  219. line-height: 39px;
  220. text-align: left;
  221. }
  222. .right-bar ul li .foot-record dl{
  223. padding-top: 5px;
  224. display: inline-block;
  225. background: #555;
  226. }
  227. .right-bar ul li .foot-record dl,.right-bar ul li .foot-record dl dd{
  228. width: 100%;
  229. margin: 0 auto;
  230. background: #555;
  231. }
  232. .right-bar ul li .foot-record dl dd{
  233. line-height: 22px;
  234. width: 100%;
  235. display: inline-block;
  236. float: left;
  237. height: 22px;
  238. position: relative;
  239. }
  240. .right-bar ul li .foot-record dl dd a{
  241. display: inline-block;
  242. height: 22px;
  243. padding: 0 10px;
  244. width: 91%;
  245. font-size: 12px;
  246. color: #fff;
  247. line-height: 22px;
  248. white-space: nowrap;
  249. overflow: hidden;
  250. text-overflow: ellipsis;
  251. background: none;
  252. text-align: left;
  253. padding-right: 44px;
  254. }
  255. .right-bar ul li li a:hover div.foot-record{
  256. display: inline-block !important;
  257. }
  258. .right-bar ul li .foot-record dl dd:hover{
  259. background: #fff;
  260. }
  261. .right-bar ul li .foot-record dl dd:hover a{
  262. color: #333;
  263. }
  264. .right-bar ul li .foot-record dl dd:hover div.hover-shows{
  265. display: inline-block;
  266. }
  267. .right-bar ul li .foot-record dl dd div.hover-shows{
  268. position: absolute;
  269. top: 0;
  270. right: 2px;
  271. max-width: 55px;
  272. line-height: 20px;
  273. padding-right: 0;
  274. z-index: 100;
  275. display: none;
  276. }
  277. .right-bar ul li .foot-record dl dd div.hover-shows span{
  278. display: inline-block;
  279. width: 30px;
  280. height: 20px;
  281. text-align: center;
  282. line-height: 20px;
  283. background: #e04b38;
  284. color: #fff;
  285. border-radius: 5px;
  286. opacity: 0;
  287. margin-top: 1px;
  288. }
  289. .right-bar ul li .foot-record dl dd:first-child{
  290. /* margin-top: 5px;*/
  291. }
  292. .right-bar ul li .foot-record dl dd:last-child{
  293. /* margin-bottom: 10px;*/
  294. }
  295. .right-bar ul li .foot-record dl dd div.hover-shows a{
  296. font-size: 23px;
  297. float: right;
  298. width: 20px;
  299. padding: 0;
  300. text-align: center;
  301. color: #999;
  302. top: -2px;
  303. }
  304. .right-bar ul li .foot-record dl dd div.hover-shows a:hover{
  305. color: #fbb029;
  306. }
  307. .right-bar ul li .foot-record dl dd div.hover-shows em{
  308. display: inline-block;
  309. position: absolute;
  310. width: 0;
  311. height: 0;
  312. border-top: 8px solid transparent;
  313. border-left: 7px solid #fbb029;
  314. border-bottom: 8px solid transparent;
  315. left: -158px;
  316. top: 4px;
  317. }
  318. .right-bar ul li .foot-record dl dd div.hover-shows em.off{
  319. border-left: 8px solid #b2b0b0;
  320. }
  321. .right-bar ul li .foot-record dl dd div.hover-shows span.off{
  322. opacity: 1;
  323. }
  324. /*浏览记录结束*/
  325. .right-bar ul li .contact-us{
  326. /*right: 200px;*/
  327. height: 180px;
  328. padding-top: 10px;
  329. width: 210px;
  330. top: -76px;
  331. }
  332. .right-bar ul li .contact-us p{
  333. line-height: 33px;
  334. text-align: left;
  335. padding-left: 10px;
  336. margin-bottom: 0;
  337. white-space: nowrap;
  338. font-size: 12px;
  339. }
  340. .right-bar ul li .contact-us .contact-btn{
  341. width: 62px;
  342. height: 18px;
  343. line-height: 18px;
  344. background: #ef7f03;
  345. display: inline-block;
  346. text-align: center;
  347. color: #fff;
  348. font-size: 12px;
  349. border-radius: 5px;
  350. padding: 0;
  351. }
  352. .right-bar-item{
  353. width: 36px;
  354. /* height: 38px;*/
  355. }
  356. .right-bar .right-bar-item a.title{
  357. display: inline-block;
  358. width: 36px;
  359. height: 38px;
  360. line-height: 38px;
  361. padding: 0;
  362. }
  363. .right-bar {
  364. position: fixed;
  365. z-index: 1000;
  366. right: 0;
  367. top: 0;
  368. width: 36px;
  369. height: 100%;
  370. .right-bar-center {
  371. position: absolute;
  372. top: 50%;
  373. transform: translateY(-50%);
  374. list-style: none;
  375. padding: 0;
  376. width: 100%;
  377. }
  378. .right-bar-bottom {
  379. position: absolute;
  380. right: 0;
  381. bottom: 0;
  382. width: 36px;
  383. }
  384. .right-bar-item {
  385. a {
  386. position: relative;
  387. display: block;
  388. width: 100%;
  389. color: #fff;
  390. background-color: #5078CB;
  391. text-align: center;
  392. -webkit-transition: background-color ease .5s;
  393. -moz-transition: background-color ease 0.5s;
  394. -ms-transition: background-color ease 0.5s;
  395. -o-transition: background-color ease 0.5s;
  396. transition: background-color ease 0.5s;
  397. z-index: 20;
  398. font-size: 12px;
  399. }
  400. }
  401. }
  402. </style>