| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453 |
- <template>
- <div id="recommend-fragment-self">
- <div class="recommend-product">
- <ul class="main-list clearfix">
- <li>
- <div>
- <div class="list" v-if="$route.params.uuid !== pcbId">
- <div class="information-list">
- <div>主营产品 :</div>
- <div v-if="storeInfo.description" :title="storeInfo.description">{{storeInfo.description | introduceFilter}}</div>
- <div v-else>—</div>
- </div>
- <div class="information-list">
- <div>应用领域 :</div>
- <div v-if="storeInfo.storeApplication" :title="storeInfo.storeApplication">{{storeInfo.storeApplication | introduceFilter}}</div>
- <div v-else>—</div>
- </div>
- <div class="information-list">
- <div>电话 :</div><div>{{storeInfo.enterprise.enTel || '—'}}</div>
- </div>
- <div class="information-list">
- <div>传真 :</div><div>{{storeInfo.enterprise.enFax || '—'}}</div>
- </div>
- <div class="information-list">
- <div>手机 :</div><div>{{storeInfo.enterprise.enPhone || '—'}}</div>
- </div>
- <div class="information-list">
- <div>微信 :</div><div>{{storeInfo.enterprise.enWeixin || '—'}}</div>
- </div>
- <div class="information-list" style="padding-bottom: 10px;">
- <div>Q Q :</div><div>{{storeInfo.enterprise.enQQ || '—'}}</div>
- </div>
- <!--<div class="information-list">
- <div>资质审核 :</div><div>营业执照 <img src="/images/store/home/logo-qualification.jpg"></div>
- </div>-->
- </div>
- <div class="introduce">
- <div><h4>企业简介</h4></div>
- <p class="intro-content" v-if="storeInfo.enterprise.description">
- <span class="info" v-text="getIntro(storeInfo.enterprise.description)"></span>
- <span class="look" @click="dialogVisible = true" v-if="showMore">查看更多 <img src="/images/store/home/angle-right.png" style="margin-top:-2px;"></span>
- </p>
- <p v-else class="empty-introduce">暂无简介</p>
- </div>
- <div class="introduce qualification">
- <div><h4 class="prof">资质证明</h4><span @click="dialogCertificate = true">查看 <img src="/images/store/home/angle-right.png"></span></div>
- <!--<qualification-certificate></qualification-certificate>-->
- </div>
- <div class="product-show">
- <recommend-list v-if="$route.params.uuid !== pcbId"></recommend-list>
- <recommend-pcb v-if="$route.params.uuid === pcbId"></recommend-pcb>
- </div>
- </div>
- </li>
- <li>
- <div style="width: 962px; margin-left: 3px;">
- <!--<recommend-list></recommend-list>-->
- <commodity-list></commodity-list>
- </div>
- </li>
- </ul>
- <div class="remind-area">
- <img src="/images/store/store-remind.png" alt="">
- 所有报价、库存信息的真实性及准确性均由店铺负责,如有疑问请点击
- <a @click="goLink" class="link-seller">联系卖家</a>
- </div>
- </div>
- <!--企业简介-->
- <el-dialog class="dialog-description"
- :visible.sync="dialogVisible"
- size="tiny">
- <div>
- <div class="header">
- <span><img src="/images/store/home/blue.png">企业简介</span>
- <span class="close" @click="dialogVisible = false">×</span>
- </div>
- <div class='content'>
- <p v-if="storeInfo.enterprise.description">{{storeInfo.enterprise.description}}</p>
- <p v-else class="empty-introduce">暂无简介</p>
- </div>
- </div>
- </el-dialog>
- <!--资质证明-->
- <el-dialog class="dialog-description certificate"
- :visible.sync="dialogCertificate"
- size="tiny">
- <div>
- <div class="header">
- <span><img src="/images/store/home/blue.png">资质证明</span>
- <span class="close" @click="dialogCertificate = false">×</span></div>
- <div class="content" style="height: 270px; width: 1070px; padding: 0 50px;"><qualification-certificate></qualification-certificate></div>
- </div>
- </el-dialog>
- <!--联系卖家-->
- <link-saler-box
- :tel="tel"
- v-if="showLinkBox"
- @cancelAction="showLinkBox = false">
- </link-saler-box>
- </div>
- </template>
- <script>
- import Buy from '~components/common/buyOrCar/buyComponent.vue'
- import RecommendList from './RecommendList.vue'
- import RecommendPcb from './RecommendPcb.vue'
- import CommodityList from './CommodityList.vue'
- import QualificationCertificate from './QualificationCertificate.vue'
- import LinkSalerBox from '~components/common/LinkSalerBox.vue'
- export default {
- name: 'product-recommend-self',
- data () {
- return {
- pcbId: process.env.pcbId,
- dialogVisible: false,
- dialogCertificate: false,
- showMore: false,
- showLinkBox: false
- }
- },
- components: {
- RecommendList,
- Buy,
- CommodityList,
- QualificationCertificate,
- LinkSalerBox,
- RecommendPcb
- },
- computed: {
- commodities () {
- return this.$store.state.shop.recommend.products.data
- },
- storeInfo () {
- return this.$store.state.shop.storeInfo.store.data
- }
- },
- filters: {
- introduceFilter: 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 > 20) {
- index = i
- break
- }
- }
- if (index > 0) {
- return title.substring(0, index) + '...'
- } else {
- return title
- }
- }
- },
- methods: {
- // 店铺简介
- getIntro (text) {
- let realLength = this.baseUtils.getRealLen(text)
- if (realLength > 494) {
- this.showMore = true
- text = this.baseUtils.cutOutString(text, 494) + '...'
- } else {
- this.showMore = false
- }
- return text
- },
- // 联系卖家
- goLink: function () {
- this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
- },
- buyNow: function (isBuy, item) {
- if (!this.$store.state.option.user.logged) {
- this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
- if (response.data) {
- this.$router.push('/auth/login')
- }
- })
- } else {
- if (item) {
- if (isBuy) {
- this.$http.post('trade/order/buyNow', [{
- uuid: item.comUuid,
- batchCode: item.batchCode,
- number: item.minBuyQty,
- storeid: item.storeId,
- storeUuid: item.storeUuid,
- currencyName: item.currency,
- minPackQty: item.minPackQty ? item.minPackQty : item.minBuyQty
- }])
- .then(response => {
- // window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
- if (response.data.success) {
- if (response.data.message) {
- this.$message({
- message: response.data.message,
- type: 'success'
- })
- let _self = this
- window.setTimeout(function () {
- window.location.href = '/user#/order/pay/' + _self.enidfilter(response.data.data.orderid)
- }, 1000)
- } else {
- window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.data.orderid)
- }
- } else {
- if (response.data.data && response.data.data.unvailable === 1) {
- this.$message.error('产品信息已失效,请刷新界面')
- } else {
- this.$message.error(response.data.message)
- }
- }
- }, err => {
- // console.log(err)
- if (item.minBuyQty > item.reserve) {
- this.$message.error('商品' + item.code + '的库存已经不满足起订量')
- }
- })
- } else {
- // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
- this.$http.post('trade/cart/add', {
- uuid: item.comUuid,
- batchCode: item.batchCode,
- number: item.minBuyQty,
- storeid: item.storeId,
- storeUuid: item.storeUuid,
- currencyName: item.currency,
- minPackQty: item.minPackQty ? item.minPackQty : item.minBuyQty
- })
- .then(response => {
- if (response.data.success) {
- if (response.data.message) {
- this.$message({
- message: '添加购物车成功,但商品信息有更新',
- type: 'success'
- })
- } else {
- this.$message({
- message: '添加购物车成功',
- type: 'success'
- })
- }
- } else {
- this.$message.error(response.data.message)
- }
- })
- }
- }
- }
- },
- enidfilter: function (str) {
- if (str) {
- let encryptStr = '' // 最终返回的加密后的字符串
- // 产生三位随机数
- let num = ''
- for (let i = 0; i < 3; i++) {
- num += Math.floor(Math.random() * 10)
- }
- encryptStr += num // 产生3位随机数
- // 16位加密
- let tempspit = ''
- let strspit = str.toString().toLowerCase()
- if (strspit.match(/^[-+]?\d*$/) === null) { // 非整数字符,对每一个字符都转换成16进制,然后拼接
- /**
- * Unicode汉字、英文字母、数字的unicode范围
- *汉字:[0x4e00,0x9fa5](或十进制[19968,40869])
- *数字:[0x30,0x39](或十进制[48, 57])
- *小写字母:[0x61,0x7a](或十进制[97, 122])
- *大写字母:[0x41,0x5a](或十进制[65, 90]
- * 'a'的Unicode编码:'a',charCodeAt()的值是97
- * '码'的Unicode编码:'\u7801', new String('码').charCodeAt()的值是30721,30721的16进制表示是7801
- */
- let s = strspit.split('')
- for (let i = 0; i < s.length; i++) {
- s[i] = s[i].charCodeAt() // 先转换成Unicode编码
- s[i] = s[i].toString(16)
- // 因为在服务器是每两位当做一个字符进行解析的,所以这里每个字符的Unicode编码范围必须在0——255之间。数字和大小写满足该要求,特殊字符则不一定,如果后续有特殊字符的要求,需要重写编码器和解码器
- if (s[i].length === 1) {
- s[i] = '0' + s[i]
- }
- tempspit = tempspit + s[i]
- }
- tempspit = tempspit + '{' + 1 // 1代表字符
- } else { // 数字直接转换成16进制
- strspit = parseInt(strspit)
- .toString(16)
- tempspit = strspit + '{' + 0 // 0代表纯数字
- }
- let temp = tempspit.split('{') // 对要加密的字符转换成16进制
- let numLength = temp[0].length // 转换后的字符长度
- numLength = numLength.toString(16) // 字符长度换算成16进制
- if (numLength.length === 1) { // 如果是1,补一个0
- numLength = '0' + numLength
- } else if (numLength.length > 3) { // 转换后的16进制字符长度如果大于2位数,则返回,不支持
- return ''
- }
- encryptStr += numLength
- if (temp[1] === '0') {
- encryptStr += 0
- } else if (temp[1] === '1') {
- encryptStr += 1
- }
- encryptStr += temp[0]
- if (encryptStr.length < 20) { // 如果小于20位,补上随机数
- // 产生三位随机数
- let numtwo = ''
- for (let i = 0; i < 20 - encryptStr.length; i++) {
- numtwo += Math.floor(Math.random() * 10)
- }
- let ran = numtwo // 产生3位随机数
- encryptStr += ran
- }
- return encryptStr
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- #recommend-fragment-self {
- min-width: 1190px;
- background: #ece9ec;
- margin:-18px 0px 0 0px;
- .recommend-product {
- position: relative;
- width: 1190px;
- margin: 0 auto;
- padding-bottom: 50px;
- .main-list {
- width: 100%;
- /*overflow: hidden;*/
- > li {
- position: relative;
- float: left;
- width: 962px;
- margin-left: 9px;
- &:first-child {
- width: 218px;
- /*height: 356px;*/
- /*background: #fff;*/
- margin: -5px 0 0 1px;
- border-radius: 5px;
- .list{
- margin-top: -20px;
- height: 170px;
- border-radius: 5px;
- background: #fff;
- .information-list {
- font-size: 12px;
- color: #333;
- margin-bottom: 2px;
- /*background: #fff;*/
- &:first-child{
- /*padding-top: 10px;*/
- }
- div:first-child {
- width: 72px;
- text-align: right;
- line-height: 20px;
- }
- div:last-child {
- width: 158px;
- line-height: 20px;
- padding: 0px 0px 0px 6px;
- }
- }
- .information-list > div {
- display: table-cell;
- }
- }
- .introduce {
- margin-top: 15px;
- width: 100%;
- height: 336px;
- font-size: 12px;
- line-height: 15px;
- color: #333;
- background: #fff;
- border-radius: 5px;
- p{
- span.info{
- font-size: 12px;
- color: #333;
- word-break: break-all;
- word-wrap:break-word;
- }
- span.look {
- color: #2496f1;
- cursor: pointer;
- position: absolute;
- right: 10px;
- }
- }
- div{
- overflow: hidden;
- height: 35px;
- h4 {
- float: left;
- background: url(/images/store/home/detail1.png) no-repeat 15% 10%;
- font-size: 14px;
- padding: 0 0 5px 30px;
- margin:10px 0;
- }
- h4.prof {
- background: url("/images/store/home/prof.png") no-repeat 15% 10%;
- }
- span{
- float: right;
- margin-top: 10px;
- padding-right: 10px;
- font-size: 12px;
- color: #2496f1;
- cursor: pointer;
- img{
- margin-top: -3px;
- }
- }
- }
- p {
- margin: -7px 0px 0px 9px;
- text-indent: 2em;
- width: 200px;
- line-height: 19px;
- height: 308px;
- overflow: hidden;
- }
- .empty-introduce{
- text-align: center;
- line-height: 153px;
- color: #666;
- }
- }
- .qualification {
- height: 35px;
- min-height: 35px;
- }
- .product-show{
- margin-top: 8px;
- }
- }
- }
- }
- }
- }
- </style>
|