RightBar.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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. <li class="right-bar-item contact-menu">
  32. <a href="javascript:void(0)" class="title" @click="goWebChat">
  33. <i class="fa fa-comments-o" aria-hidden="true" style="font-size: 18px;color: #FFFFFF;">
  34. </i>
  35. </a>
  36. <div class="sidebar-menu" title="优软互联"><a @click="goWebChat">优软互联</a><em><!-- ngIf: userInfo --></em></div>
  37. </li>
  38. </ul>
  39. <ul class="right-bar-bottom">
  40. <li class="right-bar-item">
  41. <a href="http://www.usoftmall.com/user#/browsingHistory" class="title" target="_blank">
  42. <i class="iconfont icon-zuji icon-xlg"></i>
  43. </a>
  44. <div class="sidebar-menu" v-if="!user.logged"><a href="/user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
  45. <div class="sidebar-menu" v-if="user.logged && listMe(history).length == 0"><a href="/user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
  46. <div class="foot-record sidebar-menu" v-if="user.logged && listMe(history).length > 0">
  47. <h3><a href="">浏览历史</a></h3>
  48. <dl>
  49. <dd v-for="item in listMe(history)">
  50. <a :href="'/store/' + item.storeid + '/' + item.batchCode" :title="item.code" v-text="item.code" v-if="item.status== 1"></a>
  51. <a :title="item.code" v-text="item.code" v-if="item.status== 0" disabled="disabled"></a>
  52. <div class="hover-shows">
  53. <em :class="{ 'off' : item.status== 0}"></em>
  54. <span :class="{ 'off' : item.status== 0}">失效</span>
  55. <a @click="deleteHistory(item,item.id)">&times;</a>
  56. </div>
  57. </dd>
  58. </dl>
  59. </div>
  60. </li>
  61. <li class="right-bar-item">
  62. <a @click="toTop()" class="title">
  63. <i class="iconfont icon-arrow-up icon-xlg"></i>
  64. </a>
  65. <div class="sidebar-menu"><a @click="toTop()" title="返回顶部" target="_blank">返回顶部</a></div>
  66. </li>
  67. </ul>
  68. </div>
  69. <el-dialog class="dialog"
  70. :visible.sync="dialogVisible"
  71. size="tiny">
  72. <message-board @pageEvent="listenPage" @openBoardEvent="listenOpen"/>
  73. </el-dialog>
  74. </div>
  75. </template>
  76. <script>
  77. import axios from '~/plugins/axios'
  78. import { scrollTo } from '~utils/scroll'
  79. import MessageBoard from '~components/messageBoard/MessageBoard.vue'
  80. export default {
  81. name: 'right-bar',
  82. data () {
  83. return {
  84. historyLength: [],
  85. dialogVisible: false,
  86. dialogImageUrl: '',
  87. page: 1,
  88. count: 3,
  89. currentPage: 1
  90. }
  91. },
  92. created () {
  93. this.$store.dispatch('getMessageBoardInformation', {page: 1, count: 3})
  94. },
  95. components: {
  96. MessageBoard
  97. },
  98. computed: {
  99. user () {
  100. return this.$store.state.option.user
  101. },
  102. cartCount () {
  103. return this.$store.state.user.history.cartCount.data
  104. },
  105. history () {
  106. let arr = this.$store.state.user.history.historyList.data.slice(0, 8)
  107. return arr
  108. },
  109. enterprise () {
  110. let ens = this.user.data.enterprises
  111. if (ens && ens.length) {
  112. return ens.find(item => item.current) || ens[0]
  113. }
  114. return {}
  115. }
  116. },
  117. mounted () {
  118. this.$nextTick(() => {
  119. this.loadHistorys()
  120. this.loadCarCount()
  121. })
  122. },
  123. methods: {
  124. listenPage: function (p) {
  125. this.page = p
  126. this.$store.dispatch('getMessageBoardInformation', {page: this.page, count: 3})
  127. },
  128. listenOpen: function (flag) {
  129. this.dialogVisible = flag
  130. },
  131. listMe: function (list) {
  132. return list.filter(function (item) {
  133. return item.isDelete === 1
  134. })
  135. },
  136. loadHistorys () {
  137. this.$store.dispatch('user/loadHistory')
  138. },
  139. loadCarCount () {
  140. this.$store.dispatch('user/CarCount')
  141. },
  142. toTop () {
  143. scrollTo('body', 300)
  144. },
  145. toBottom () {
  146. scrollTo(window.scrollY + window.innerHeight, 300)
  147. },
  148. // 打开留言板
  149. onLeaveMessageClick () {
  150. },
  151. deleteHistory (item, id) {
  152. this.$store.dispatch('user/deleteHistory', {id: id})
  153. this.loadHistorys()
  154. },
  155. goWebChat: function () {
  156. if (!this.$store.state.option.user.logged) {
  157. this.$http.get('/login/page').then(response => {
  158. if (response.data) {
  159. this.$router.push('/auth/login')
  160. }
  161. })
  162. } else {
  163. // 获得窗口的垂直位置
  164. let iTop = (window.screen.availHeight - 30 - 600) / 2
  165. // 获得窗口的水平位置
  166. let iLeft = (window.screen.availWidth - 10 - 1030) / 2
  167. let newTab = window.open('', '即时对话框', 'height=600, width=1030, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
  168. axios.get('/basic/enterprise/' + this.enterprise.uu + '/info')
  169. .then(response => {
  170. let obj = {}
  171. obj.enUU = response.data.uu
  172. obj.enterprise = {enUU: response.data.uu, name: response.data.enName}
  173. obj.type = 'LIST'
  174. obj.userPhone = this.user.data.userTel
  175. axios.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
  176. .then(response => {
  177. if (response.data.success) {
  178. newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
  179. }
  180. })
  181. }, err => {
  182. console.log(err)
  183. })
  184. }
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. a[disabled] {
  191. cursor: not-allowed;
  192. }
  193. em,i{
  194. font-style: inherit;
  195. }
  196. .right-bar ul li{
  197. position: relative;
  198. }
  199. .right-bar ul li .sidebar-menu {
  200. position: absolute;
  201. display: block;
  202. right: -100%;
  203. top: 0px;
  204. bottom: 0;
  205. width: 120px;
  206. line-height: 38px;
  207. height: 38px;
  208. color: #ffffff;
  209. background: #555;
  210. -webkit-transform: translateX(100%);
  211. -moz-transform: translateX(100%);
  212. -ms-transform: translateX(100%);
  213. -o-transform: translateX(100%);
  214. transform: translateX(100%);
  215. -webkit-transition: transform .5s;
  216. -moz-transition: transform .5s;
  217. -ms-transition: transform .5s;
  218. -o-transition: transform .5s;
  219. transition: transform .5s;
  220. z-index: 19;
  221. }
  222. .right-bar ul li .sidebar-menu a{
  223. background-color: #555555;
  224. }
  225. .right-bar ul li:hover a{
  226. background-color: #555555;
  227. }
  228. .right-bar ul li:hover .sidebar-menu {
  229. display: block;
  230. -webkit-transform: translateX(-72px);
  231. -moz-transform: translateX(-72px);
  232. -ms-transform: translateX(-72px);
  233. -o-transform: translateX(-72px);
  234. transform: translateX(-72px);
  235. }
  236. /*浏览记录*/
  237. .right-bar ul li .foot-record{
  238. /* display: none; */
  239. width: 210px !important;
  240. max-height: 230px;
  241. line-height: 30px;
  242. /* right: 200px;*/
  243. top: inherit;
  244. bottom: -100%;
  245. height: inherit;
  246. /*padding-bottom: 10px;*/
  247. }
  248. .right-bar ul li .foot-record h3{
  249. line-height: 39px;
  250. border-bottom: #767575 1px solid;
  251. text-align: left;
  252. padding-left: 10px;
  253. width: 96%;
  254. display: inline-block;
  255. margin: 0 auto;
  256. font-size: 12px;
  257. height: 39px;
  258. }
  259. .right-bar ul li .foot-record h3:hover a{
  260. color: #fbb029;
  261. }
  262. .right-bar ul li .foot-record h3 a{
  263. color: #fff;
  264. background-color: inherit;
  265. line-height: 39px;
  266. text-align: left;
  267. }
  268. .right-bar ul li .foot-record dl{
  269. padding-top: 5px;
  270. display: inline-block;
  271. background: #555;
  272. }
  273. .right-bar ul li .foot-record dl,.right-bar ul li .foot-record dl dd{
  274. width: 100%;
  275. margin: 0 auto;
  276. background: #555;
  277. }
  278. .right-bar ul li .foot-record dl dd{
  279. line-height: 22px;
  280. width: 100%;
  281. display: inline-block;
  282. float: left;
  283. height: 22px;
  284. position: relative;
  285. }
  286. .right-bar ul li .foot-record dl dd a{
  287. display: inline-block;
  288. height: 22px;
  289. padding: 0 10px;
  290. width: 91%;
  291. font-size: 12px;
  292. color: #fff;
  293. line-height: 22px;
  294. white-space: nowrap;
  295. overflow: hidden;
  296. text-overflow: ellipsis;
  297. background: none;
  298. text-align: left;
  299. padding-right: 44px;
  300. }
  301. .right-bar ul li li a:hover div.foot-record{
  302. display: inline-block !important;
  303. }
  304. .right-bar ul li .foot-record dl dd:hover{
  305. background: #fff;
  306. }
  307. .right-bar ul li .foot-record dl dd:hover a{
  308. color: #333;
  309. }
  310. .right-bar ul li .foot-record dl dd:hover div.hover-shows{
  311. display: inline-block;
  312. }
  313. .right-bar ul li .foot-record dl dd div.hover-shows{
  314. position: absolute;
  315. top: 0;
  316. right: 2px;
  317. max-width: 55px;
  318. line-height: 20px;
  319. padding-right: 0;
  320. z-index: 100;
  321. display: none;
  322. }
  323. .right-bar ul li .foot-record dl dd div.hover-shows span{
  324. display: inline-block;
  325. width: 30px;
  326. height: 20px;
  327. text-align: center;
  328. line-height: 20px;
  329. background: #e04b38;
  330. color: #fff;
  331. border-radius: 5px;
  332. opacity: 0;
  333. margin-top: 1px;
  334. }
  335. .right-bar ul li .foot-record dl dd:first-child{
  336. /* margin-top: 5px;*/
  337. }
  338. .right-bar ul li .foot-record dl dd:last-child{
  339. /* margin-bottom: 10px;*/
  340. }
  341. .right-bar ul li .foot-record dl dd div.hover-shows a{
  342. font-size: 23px;
  343. float: right;
  344. width: 20px;
  345. padding: 0;
  346. text-align: center;
  347. color: #999;
  348. top: -2px;
  349. }
  350. .right-bar ul li .foot-record dl dd div.hover-shows a:hover{
  351. color: #fbb029;
  352. }
  353. .right-bar ul li .foot-record dl dd div.hover-shows em{
  354. display: inline-block;
  355. position: absolute;
  356. width: 0;
  357. height: 0;
  358. border-top: 8px solid transparent;
  359. border-left: 7px solid #fbb029;
  360. border-bottom: 8px solid transparent;
  361. left: -158px;
  362. top: 4px;
  363. }
  364. .right-bar ul li .foot-record dl dd div.hover-shows em.off{
  365. border-left: 8px solid #b2b0b0;
  366. }
  367. .right-bar ul li .foot-record dl dd div.hover-shows span.off{
  368. opacity: 1;
  369. }
  370. /*浏览记录结束*/
  371. .right-bar ul li .contact-us{
  372. /*right: 200px;*/
  373. height: 180px;
  374. padding-top: 10px;
  375. width: 210px;
  376. top: -76px;
  377. }
  378. .right-bar ul li .contact-us p{
  379. line-height: 33px;
  380. text-align: left;
  381. padding-left: 10px;
  382. margin-bottom: 0;
  383. white-space: nowrap;
  384. font-size: 12px;
  385. }
  386. .right-bar ul li .contact-us .contact-btn{
  387. width: 62px;
  388. height: 18px;
  389. line-height: 18px;
  390. background: #ef7f03;
  391. display: inline-block;
  392. text-align: center;
  393. color: #fff;
  394. font-size: 12px;
  395. border-radius: 5px;
  396. padding: 0;
  397. }
  398. .right-bar-item{
  399. width: 36px;
  400. /* height: 38px;*/
  401. }
  402. .right-bar .right-bar-item a.title{
  403. display: inline-block;
  404. width: 36px;
  405. height: 38px;
  406. line-height: 38px;
  407. padding: 0;
  408. }
  409. .right-bar {
  410. position: fixed;
  411. z-index: 1000;
  412. right: 0;
  413. top: 0;
  414. width: 36px;
  415. height: 100%;
  416. .right-bar-center {
  417. position: absolute;
  418. top: 50%;
  419. transform: translateY(-50%);
  420. list-style: none;
  421. padding: 0;
  422. width: 100%;
  423. }
  424. .right-bar-bottom {
  425. position: absolute;
  426. right: 0;
  427. bottom: 0;
  428. width: 36px;
  429. }
  430. .right-bar-item {
  431. a {
  432. position: relative;
  433. display: block;
  434. width: 100%;
  435. color: #fff;
  436. background-color: #5078CB;
  437. text-align: center;
  438. -webkit-transition: background-color ease .5s;
  439. -moz-transition: background-color ease 0.5s;
  440. -ms-transition: background-color ease 0.5s;
  441. -o-transition: background-color ease 0.5s;
  442. transition: background-color ease 0.5s;
  443. z-index: 20;
  444. font-size: 12px;
  445. }
  446. }
  447. }
  448. </style>