| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489 |
- <template>
- <div class="container" id="title-fragment">
- <div class="container">
- <div class="row" style="margin-bottom: 20px;">
- <!-- 商标展示 -->
- <div class="logo two-word" v-if="storeInfo.type == 'ORIGINAL_FACTORY'">原厂</div>
- <div class="logo two-word" v-else-if="storeInfo.type == 'CONSIGNMENT'">寄售</div>
- <div class="logo" v-else-if="storeInfo.type == 'AGENCY'">代理商</div>
- <div class="logo" v-else-if="storeInfo.type == 'DISTRIBUTION'">经销商</div>
- <div class="shop-logo">
- <img class="logo-img" :src="storeInfo.logoUrl || '/images/store/common/default.png'" />
- <!-- <p id="shop-title" v-if="storeInfo.storeShortName" v-text="storeInfo.storeShortName">店铺名称</p>-->
- <p class="shop-name" v-if="storeInfo.storeName">{{storeInfo.storeName | nameFilter}}</p>
- <p class="shop-name" v-else></p>
- <div class="enter-store">
- <a v-if="isFocus === 'false'" @click="focusStore(storeInfo, $event)">关注店铺</a>
- <a v-else class="focus" @click="focusStore(storeInfo, $event)">已关注</a>
- <a @click="goLink()">联系卖家</a>
- </div>
- <div class="share">
- <span @click="setShowShare(!showShare, $event)">手机版链接 <img src="/images/store/home/qrccode-small.png"> <img :class="{'active': showCate}" src="/images/store/home/arrow-down.png" alt=""></span>
- <div v-show="showShare">
- <i class="icon-guanbi1 iconfont" @click="setShowShare(false, $event)"></i>
- <h1>分享链接</h1>
- <p>随时随地使用手机查看店铺现货</p>
- <canvas id="qrccode-canvas"></canvas>
- <!--<input v-show="showShare" :value="url" readonly>-->
- <span v-if="showShare" id="copyLink" :data-clipboard-text="url">复制链接</span>
- </div>
- </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>
- <el-dialog
- :visible.sync="dialogInvisible"
- size="tiny"
- >
- <h3 class="header-text">关注取消!</h3>
- <div class="focus modal-body">
- <button type="button" @click="dialogInvisible = false" class="btn" style="margin-left:25px;">关 闭</button>
- <button type="button" @click="dialogInvisible = false" class="focus-btn btn btn btn-info" style="margin-left:35px;">
- <a href="/user#/storeFocus" target="_blank">查看我的店铺关注</a>
- </button>
- </div>
- </el-dialog>
- <link-saler-box
- :tel="tel"
- v-if="showLinkBox"
- @cancelAction="showLinkBox = false">
- </link-saler-box>
- </div>
- </div>
- </template>
- <script>
- import Clipboard from 'clipboard'
- import LinkSalerBox from '~components/common/LinkSalerBox.vue'
- let QRCode = require('qrcode')
- export default {
- name: 'store-banner',
- data () {
- return {
- dialogVisible: false,
- dialogInvisible: false,
- showShare: false,
- clipboard: {},
- showLinkBox: false,
- showCate: false,
- tel: ''
- }
- },
- mounted () {
- let _this = this
- _this.url = window.location.href
- _this.clipboard = new Clipboard('#copyLink')
- _this.clipboard.on('success', e => {
- _this.clipboard.destroy()
- _this.$message.success('已复制到剪切板')
- })
- _this.clipboard.on('error', e => {
- _this.$message.error('浏览器不支持自动复制,请手动复制')
- _this.clipboard.destroy()
- })
- document.addEventListener('click', function () {
- // _this.showShare = false
- // _this.showCate = false
- })
- },
- components: {
- LinkSalerBox
- },
- methods: {
- loadQRcode: function () {
- let canvas = document.getElementById('qrccode-canvas')
- QRCode.toCanvas(canvas, this.url, (error) => {
- console.log(error || 'QRcode success')
- })
- },
- setShowShare: function (flag, event) {
- event.stopPropagation()
- this.loadQRcode()
- this.showShare = flag
- this.showCate = flag
- },
- focusStore: function (item, $event) {
- $event.stopPropagation()
- if (this.user.logged) {
- if (this.isFocus === 'false') {
- this.dialogVisible = true
- this.$store.dispatch('shop/StoreFocus', {storeName: item.storeName, storeid: item.id})
- } else {
- this.$http.post('/trade/storeFocus/delete/storeId', [item.id])
- .then(response => {
- this.dialogInvisible = true
- this.$store.dispatch('shop/StoreFocusList', {id: item.id})
- })
- }
- } else {
- this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
- if (response.data) {
- window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
- }
- })
- }
- },
- // focus (id, name) {
- // if (!this.user.logged) {
- // this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
- // if (response.data) {
- // window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
- // }
- // })
- // } else {
- // this.dialogVisible = true
- // this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
- // this.isFocus = true
- // }
- // },
- goLink: function () {
- this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
- }
- // 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
- },
- isFocus () {
- return this.user.logged ? this.$store.state.shop.storeInfo.focusList.data : 'false'
- },
- url: {
- get: function () {
- return window.location.protocol + '//' + window.location.host + '/mobile/share/storeShare/' + this.storeInfo.uuid
- },
- set: function () {
- }
- }
- }
- }
- </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;*/
- }
- #title-fragment .logo{
- width: 28px;
- padding-right: 3px;
- height: 60px;
- text-align: center;
- line-height: 15px;
- position: absolute;
- top: 13px;
- left: 0px;
- color: #fff;
- margin-top: -20px;
- background: url('/images/store/home/logo-type.png') no-repeat;
- z-index: 100;
- padding-top: 3px;
- }
- .two-word{
- padding-top: 10px;
- }
- #title-fragment .shop-logo {
- margin-right: 10px;
- width: 220px;
- height: 260px;
- border: 1px solid #e8e8e8;
- float: left;
- text-align: center;
- line-height: 210px;
- position: relative;
- background: #fff;
- .shop-name{
- height: 40px;
- line-height: 40px;
- margin-top: -105px;
- width: 100%;
- }
- .enter-store {
- width: 100%;
- height: 30px;
- line-height: 30px;
- text-align: left;
- margin: 10px 0;
- 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: #2496f1;
- border: 1px solid #2496f1;
- color: #fff;
- }
- &.focus{
- background-color: #c1c1c1;
- border: 1px solid #c1c1c1;
- }
- &:last-child {
- background: #fff;
- border: 1px solid #2496f1;
- color: #2496f1;
- }
- }
- }
- .share {
- display: inline-block;
- position: relative;
- > span {
- position: relative;
- top: -81px;
- color: #2496f1;
- cursor: pointer;
- .active {
- transform:rotate(180deg);
- -ms-transform:rotate(180deg); /* Internet Explorer */
- -moz-transform:rotate(180deg); /* Firefox */
- -webkit-transform:rotate(180deg); /* Safari 和 Chrome */
- -o-transform:rotate(180deg); /* Opera */
- }
- }
- > div {
- position: absolute;
- top: 38px;
- left: -47px;
- width: 211px;
- height: 321px;
- background: #fff;
- box-shadow: 1px 1px 4px 0 #ccbebe;
- z-index: 1300000;
- text-align: center;
- h1, p{
- height: 30px;
- width: 100%;
- }
- h1{
- margin-top: -80px;
- }
- p{
- margin-top: -10px;
- }
- canvas{
- margin-top: 75px;
- }
- /*input {
- display: inline-block;
- width: 140px;
- overflow: hidden;
- height: 35px;
- vertical-align: middle;
- }*/
- span {
- display: inline-block;
- color: #fff;
- background: #4290f7;
- height: 36px;
- line-height: 36px;
- width: 70px;
- font-style: normal;
- vertical-align: middle;
- cursor: pointer;
- margin-top: -380px;
- }
- i {
- position: absolute;
- right: 10px;
- top: -89px;
- cursor: pointer;
- font-size: 14px;
- font-weight: bold;
- }
- }
- }
- }
- #title-fragment .shop-logo .logo-img {
- width: 173px;
- height: 86px;
- margin-top: -102px;
- }
- #title-fragment .shop-banner {
- float: left;
- position: relative;
- width: 955px;
- height: 280px;
- border: 1px solid #e8e8e8;
- border-left: none;
- overflow: hidden;
- border-radius: 5px;
- }
- #title-fragment .shop-banner img {
- width: 955px;
- height: 280px;
- }
- #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>
|