| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <div class="container" id="title-fragment">
- <div class="container">
- <div class="row" style="margin-bottom: 20px;">
- <!-- 商标展示 -->
- <div class="logo" v-if="storeInfo.type == 'AGENCY'">代理商</div>
- <div class="logo" v-if="storeInfo.type == 'DISTRIBUTION'">经销商</div>
- <div class="logo">代理商</div>
- <div class="shop-logo">
- <img :src="storeInfo.logoUrl || '/images/store/common/default.png'" />
- <!-- <p id="shop-title" v-if="storeInfo.storeShortName" v-text="storeInfo.storeShortName">店铺名称</p>-->
- <p id="shop-name" v-if="storeInfo.storeShortName">{{storeInfo.storeShortName | nameFilter}}</p>
- <div class="enter-store">
- <a @click="focus(storeInfo.id, storeInfo.storeName)">关注店铺</a>
- <a @click="goWebChat()">联系卖家</a>
- </div>
- </div>
- <!-- 店名展示 -->
- <div class="shop-banner">
- <img :src="storeInfo.bannerUrl || '/images/store/default/shop_banner.png'">
- <!-- <div id="shop-title" v-if="storeInfo.storeShortName" v-text="storeInfo.storeShortName">店铺名称</div>-->
- </div>
- </div>
- <el-dialog
- :visible.sync="dialogVisible"
- size="tiny"
- >
- <h3 class="header-text">关注成功!</h3>
- <div class="focus modal-body">
- <button type="button" @click="dialogVisible = false" class="btn" style="margin-left:25px;">关 闭</button>
- <button type="button" @click="dialogVisible = false" class="focus-btn btn btn btn-info" style="margin-left:35px;">
- <a href="/user#/storeFocus" target="_blank">查看我的店铺关注</a>
- </button>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'store-title',
- data () {
- return {
- dialogVisible: false
- }
- },
- methods: {
- focus (id, name) {
- if (!this.user.logged) {
- this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
- if (response.data) {
- this.$router.push('/auth/login')
- }
- })
- } else {
- this.dialogVisible = true
- this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
- }
- },
- goWebChat: function () {
- if (!this.user.logged) {
- this.$http.get('/login/page').then(response => {
- if (response.data) {
- this.$router.push('/auth/login')
- }
- })
- } else {
- // 获得窗口的垂直位置
- let iTop = (window.screen.availHeight - 30 - 780) / 2
- // 获得窗口的水平位置
- let iLeft = (window.screen.availWidth - 10 - 1030) / 2
- if (this.tab.close) {
- this.tab.close()
- }
- let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
- newTab.close()
- newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
- this.$store.dispatch('chat/setChatTab', {tab: newTab})
- this.$http.get('/basic/enterprise/' + this.storeInfo.enUU + '/info')
- .then(response => {
- let obj = {}
- obj.userPhone = this.user.data.userTel
- obj.userType = 'ENTERPRISE'
- this.user.data.enterprises.forEach(function (item, index) {
- if (item.current) {
- obj.enUU = item.uu
- obj.enterprise = {enUU: item.uu, name: item.enName}
- }
- })
- obj.otherEnUU = response.data.uu
- obj.otherUserType = 'STORE'
- obj.otherEnterprise = {enUU: response.data.uu, name: response.data.enName}
- obj.type = 'CHAT'
- if (!(/^1\d{10}$/).test(response.data.enTel)) {
- this.$http.get('/basic/enterprise/' + response.data.uu + '/admin').then(response => {
- console.log(response)
- obj.toPhone = response.data.userTel
- console.log(obj)
- this.openWebChat(newTab, obj)
- }, err => {
- console.log(err)
- this.$message.error('暂无卖家管理员手机号!')
- })
- } else {
- obj.toPhone = response.data.enTel
- console.log(obj)
- this.openWebChat(newTab, obj)
- }
- }, err => {
- console.log(err)
- })
- }
- },
- openWebChat: function (newTab, obj) {
- this.$http.post('https://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
- .then(response => {
- if (response.data.success) {
- newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
- }
- })
- }
- },
- filters: {
- nameFilter: function (title) {
- if (title === '') {
- return title
- }
- let len = 0
- let index = 0
- for (let i = 0; i < title.length; i++) {
- if (index === 0 && title.charAt(i).charCodeAt(0) > 255) {
- len = len + 2
- } else {
- len++
- }
- if (len > 24) {
- index = i
- break
- }
- }
- if (index > 0) {
- return title.substring(0, index) + '...'
- } else {
- return title
- }
- },
- date: function (input) {
- const d = new Date(input)
- const year = d.getFullYear()
- const monthTemp = d.getMonth() + 1
- const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
- const hour = d.getHours() < 10 ? '0' + d.getHours() : '' + d.getHours() + ' '
- const minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : '' + d.getMinutes() + ' '
- const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
- return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
- }
- },
- computed: {
- storeInfo () {
- return this.$store.state.shop.storeInfo.store.data
- },
- isConsignment () {
- return this.storeInfo.type === 'CONSIGNMENT'
- },
- tab () {
- return this.$store.state.chat.tab.tab.data
- },
- user () {
- return this.$store.state.option.user
- }
- }
- }
- </script>
- <style lang="scss">
- .header-text {
- text-align: center;
- font-size: 20px;
- color: #008B00;
- margin-top: 0;
- }
- .el-dialog__wrapper .el-dialog--tiny {
- width: 320px !important;
- }
- .el-dialog__body {
- padding: 14px !important;
- }
- .focus button.focus-btn a{
- color: #fff;
- width: 100%;
- height: 100%;
- display: inline-block;
- }
- .focus button.focus-btn{
- width: 138px;
- height: 36px;
- line-height: 36px;
- padding: 0;
- }
- #title-fragment {
- padding: 0;
- }
- #title-fragment .container {
- width: 1190px;
- padding-left: 0px;
- padding-right: 0px;
- }
- #title-fragment .container >.row {
- margin-left: 0px;
- margin-right: 0px;
- position: relative;
- background: #fff;
- }
- .logo{
- width: 28px;
- padding-right: 3px;
- height: 60px;
- text-align: center;
- line-height: 15px;
- position: absolute;
- top: 13px;
- left: 10px;
- color: #fff;
- margin-top: -20px;
- background: url('/images/store/home/logo-type.png') no-repeat;
- z-index: 100;
- padding-top: 3px;
- }
- #title-fragment .shop-logo {
- width: 220px;
- height: 220px;
- border: 1px solid #e8e8e8;
- float: left;
- text-align: center;
- line-height: 210px;
- overflow: hidden;
- position: relative;
- #shop-name{
- height: 40px;
- line-height: 40px;
- margin-top: -90px;
- width: 100%;
- }
- .enter-store {
- width: 100%;
- height: 30px;
- line-height: 30px;
- text-align: left;
- margin-top: -10px;
- padding-left: 20px;
- a {
- width: 70px;
- height: 24px;
- display: inline-block;
- line-height: 22px;
- text-align: center;
- font-size: 13px;
- margin-left: 12px;
- border-radius: 3px;
- &:first-child {
- background: #bd0505;
- border: 1px solid #bd0505;
- color: #fff;
- }
- &:last-child {
- background: #3c7cf7;
- border: 1px solid #3c7cf7;
- color: #fff;
- }
- }
- }
- }
- #title-fragment .shop-logo img {
- width: 80%;
- height: 60px;
- margin-top: -30px;
- }
- #title-fragment .shop-banner {
- float: left;
- position: relative;
- width: 970px;
- height: 220px;
- border: 1px solid #e8e8e8;
- border-left: none;
- overflow: hidden;
- }
- #title-fragment .shop-banner img {
- width: 970px;
- height: 220px;
- }
- #title-fragment .shop-banner #shop-title {
- position: absolute;
- top: 50px;
- left: 60px;
- font-size: 30px;
- color: rgb(255,255,255);
- }
- .container{
- width: 1190px;
- padding: 0;
- }
- </style>
|