EnterpriseInfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <div id="recommend-fragment-self">
  3. <div class="recommend-product">
  4. <ul class="main-list clearfix">
  5. <li>
  6. <div>
  7. <div class="list" v-if="$route.params.uuid !== pcbId">
  8. <div class="information-list">
  9. <div>主营产品&nbsp;:</div>
  10. <div v-if="storeInfo.description" :title="storeInfo.description">{{storeInfo.description | introduceFilter}}</div>
  11. <div v-else>—</div>
  12. </div>
  13. <div class="information-list">
  14. <div>应用领域&nbsp;:</div>
  15. <div v-if="storeInfo.storeApplication" :title="storeInfo.storeApplication">{{storeInfo.storeApplication | introduceFilter}}</div>
  16. <div v-else>—</div>
  17. </div>
  18. <div class="information-list">
  19. <div>电话&nbsp;:</div><div>{{storeInfo.enterprise.enTel || '—'}}</div>
  20. </div>
  21. <div class="information-list">
  22. <div>传真&nbsp;:</div><div>{{storeInfo.enterprise.enFax || '—'}}</div>
  23. </div>
  24. <div class="information-list">
  25. <div>手机&nbsp;:</div><div>{{storeInfo.enterprise.enPhone || '—'}}</div>
  26. </div>
  27. <div class="information-list">
  28. <div>微信&nbsp;:</div><div>{{storeInfo.enterprise.enWeixin || '—'}}</div>
  29. </div>
  30. <div class="information-list" style="padding-bottom: 10px;">
  31. <div>Q Q&nbsp;:</div><div>{{storeInfo.enterprise.enQQ || '—'}}</div>
  32. </div>
  33. <!--<div class="information-list">
  34. <div>资质审核&nbsp;:</div><div>营业执照&nbsp;&nbsp;<img src="/images/store/home/logo-qualification.jpg"></div>
  35. </div>-->
  36. </div>
  37. <div class="introduce">
  38. <div><h4>企业简介</h4></div>
  39. <p class="intro-content" v-if="storeInfo.enterprise.description">
  40. <span class="info" v-text="getIntro(storeInfo.enterprise.description)"></span>
  41. <span class="look" @click="dialogVisible = true" v-if="showMore">查看更多 <img src="/images/store/home/angle-right.png" style="margin-top:-2px;"></span>
  42. </p>
  43. <p v-else class="empty-introduce">暂无简介</p>
  44. </div>
  45. <div class="introduce qualification">
  46. <div><h4 class="prof">资质证明</h4><span @click="dialogCertificate = true">查看 <img src="/images/store/home/angle-right.png"></span></div>
  47. <!--<qualification-certificate></qualification-certificate>-->
  48. </div>
  49. <div class="product-show">
  50. <recommend-list v-if="$route.params.uuid !== pcbId"></recommend-list>
  51. <recommend-pcb v-if="$route.params.uuid === pcbId"></recommend-pcb>
  52. </div>
  53. </div>
  54. </li>
  55. <li>
  56. <div style="width: 962px; margin-left: 3px;">
  57. <!--<recommend-list></recommend-list>-->
  58. <commodity-list></commodity-list>
  59. </div>
  60. </li>
  61. </ul>
  62. <div class="remind-area">
  63. <img src="/images/store/store-remind.png" alt="">
  64. 所有报价、库存信息的真实性及准确性均由店铺负责,如有疑问请点击
  65. <a @click="goLink" class="link-seller">联系卖家</a>
  66. </div>
  67. </div>
  68. <!--企业简介-->
  69. <el-dialog class="dialog-description"
  70. :visible.sync="dialogVisible"
  71. size="tiny">
  72. <div>
  73. <div class="header">
  74. <span><img src="/images/store/home/blue.png">企业简介</span>
  75. <span class="close" @click="dialogVisible = false">&times;</span>
  76. </div>
  77. <div class='content'>
  78. <p v-if="storeInfo.enterprise.description">{{storeInfo.enterprise.description}}</p>
  79. <p v-else class="empty-introduce">暂无简介</p>
  80. </div>
  81. </div>
  82. </el-dialog>
  83. <!--资质证明-->
  84. <el-dialog class="dialog-description certificate"
  85. :visible.sync="dialogCertificate"
  86. size="tiny">
  87. <div>
  88. <div class="header">
  89. <span><img src="/images/store/home/blue.png">资质证明</span>
  90. <span class="close" @click="dialogCertificate = false">&times;</span></div>
  91. <div class="content" style="height: 270px; width: 1070px; padding: 0 50px;"><qualification-certificate></qualification-certificate></div>
  92. </div>
  93. </el-dialog>
  94. <!--联系卖家-->
  95. <link-saler-box
  96. :tel="tel"
  97. v-if="showLinkBox"
  98. @cancelAction="showLinkBox = false">
  99. </link-saler-box>
  100. </div>
  101. </template>
  102. <script>
  103. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  104. import RecommendList from './RecommendList.vue'
  105. import RecommendPcb from './RecommendPcb.vue'
  106. import CommodityList from './CommodityList.vue'
  107. import QualificationCertificate from './QualificationCertificate.vue'
  108. import LinkSalerBox from '~components/common/LinkSalerBox.vue'
  109. export default {
  110. name: 'product-recommend-self',
  111. data () {
  112. return {
  113. pcbId: process.env.pcbId,
  114. dialogVisible: false,
  115. dialogCertificate: false,
  116. showMore: false,
  117. showLinkBox: false
  118. }
  119. },
  120. components: {
  121. RecommendList,
  122. Buy,
  123. CommodityList,
  124. QualificationCertificate,
  125. LinkSalerBox,
  126. RecommendPcb
  127. },
  128. computed: {
  129. commodities () {
  130. return this.$store.state.shop.recommend.products.data
  131. },
  132. storeInfo () {
  133. return this.$store.state.shop.storeInfo.store.data
  134. }
  135. },
  136. filters: {
  137. introduceFilter: function (title) {
  138. if (title === '') {
  139. return title
  140. }
  141. let len = 0
  142. let index = 0
  143. for (let i = 0; i < title.length; i++) {
  144. if (index === 0 && title.charAt(i).charCodeAt(0) > 255) {
  145. len = len + 2
  146. } else {
  147. len++
  148. }
  149. if (len > 20) {
  150. index = i
  151. break
  152. }
  153. }
  154. if (index > 0) {
  155. return title.substring(0, index) + '...'
  156. } else {
  157. return title
  158. }
  159. }
  160. },
  161. methods: {
  162. // 店铺简介
  163. getIntro (text) {
  164. let realLength = this.baseUtils.getRealLen(text)
  165. if (realLength > 494) {
  166. this.showMore = true
  167. text = this.baseUtils.cutOutString(text, 494) + '...'
  168. } else {
  169. this.showMore = false
  170. }
  171. return text
  172. },
  173. // 联系卖家
  174. goLink: function () {
  175. this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
  176. },
  177. buyNow: function (isBuy, item) {
  178. if (!this.$store.state.option.user.logged) {
  179. this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
  180. if (response.data) {
  181. this.$router.push('/auth/login')
  182. }
  183. })
  184. } else {
  185. if (item) {
  186. if (isBuy) {
  187. this.$http.post('trade/order/buyNow', [{
  188. uuid: item.comUuid,
  189. batchCode: item.batchCode,
  190. number: item.minBuyQty,
  191. storeid: item.storeId,
  192. storeUuid: item.storeUuid,
  193. currencyName: item.currency,
  194. minPackQty: item.minPackQty ? item.minPackQty : item.minBuyQty
  195. }])
  196. .then(response => {
  197. // window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
  198. if (response.data.success) {
  199. if (response.data.message) {
  200. this.$message({
  201. message: response.data.message,
  202. type: 'success'
  203. })
  204. let _self = this
  205. window.setTimeout(function () {
  206. window.location.href = '/user#/order/pay/' + _self.enidfilter(response.data.data.orderid)
  207. }, 1000)
  208. } else {
  209. window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.data.orderid)
  210. }
  211. } else {
  212. if (response.data.data && response.data.data.unvailable === 1) {
  213. this.$message.error('产品信息已失效,请刷新界面')
  214. } else {
  215. this.$message.error(response.data.message)
  216. }
  217. }
  218. }, err => {
  219. // console.log(err)
  220. if (item.minBuyQty > item.reserve) {
  221. this.$message.error('商品' + item.code + '的库存已经不满足起订量')
  222. }
  223. })
  224. } else {
  225. // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
  226. this.$http.post('trade/cart/add', {
  227. uuid: item.comUuid,
  228. batchCode: item.batchCode,
  229. number: item.minBuyQty,
  230. storeid: item.storeId,
  231. storeUuid: item.storeUuid,
  232. currencyName: item.currency,
  233. minPackQty: item.minPackQty ? item.minPackQty : item.minBuyQty
  234. })
  235. .then(response => {
  236. if (response.data.success) {
  237. if (response.data.message) {
  238. this.$message({
  239. message: '添加购物车成功,但商品信息有更新',
  240. type: 'success'
  241. })
  242. } else {
  243. this.$message({
  244. message: '添加购物车成功',
  245. type: 'success'
  246. })
  247. }
  248. } else {
  249. this.$message.error(response.data.message)
  250. }
  251. })
  252. }
  253. }
  254. }
  255. },
  256. enidfilter: function (str) {
  257. if (str) {
  258. let encryptStr = '' // 最终返回的加密后的字符串
  259. // 产生三位随机数
  260. let num = ''
  261. for (let i = 0; i < 3; i++) {
  262. num += Math.floor(Math.random() * 10)
  263. }
  264. encryptStr += num // 产生3位随机数
  265. // 16位加密
  266. let tempspit = ''
  267. let strspit = str.toString().toLowerCase()
  268. if (strspit.match(/^[-+]?\d*$/) === null) { // 非整数字符,对每一个字符都转换成16进制,然后拼接
  269. /**
  270. * Unicode汉字、英文字母、数字的unicode范围
  271. *汉字:[0x4e00,0x9fa5](或十进制[19968,40869])
  272. *数字:[0x30,0x39](或十进制[48, 57])
  273. *小写字母:[0x61,0x7a](或十进制[97, 122])
  274. *大写字母:[0x41,0x5a](或十进制[65, 90]
  275. * 'a'的Unicode编码:'&#97;',charCodeAt()的值是97
  276. * '码'的Unicode编码:'\u7801', new String('码').charCodeAt()的值是30721,30721的16进制表示是7801
  277. */
  278. let s = strspit.split('')
  279. for (let i = 0; i < s.length; i++) {
  280. s[i] = s[i].charCodeAt() // 先转换成Unicode编码
  281. s[i] = s[i].toString(16)
  282. // 因为在服务器是每两位当做一个字符进行解析的,所以这里每个字符的Unicode编码范围必须在0——255之间。数字和大小写满足该要求,特殊字符则不一定,如果后续有特殊字符的要求,需要重写编码器和解码器
  283. if (s[i].length === 1) {
  284. s[i] = '0' + s[i]
  285. }
  286. tempspit = tempspit + s[i]
  287. }
  288. tempspit = tempspit + '{' + 1 // 1代表字符
  289. } else { // 数字直接转换成16进制
  290. strspit = parseInt(strspit)
  291. .toString(16)
  292. tempspit = strspit + '{' + 0 // 0代表纯数字
  293. }
  294. let temp = tempspit.split('{') // 对要加密的字符转换成16进制
  295. let numLength = temp[0].length // 转换后的字符长度
  296. numLength = numLength.toString(16) // 字符长度换算成16进制
  297. if (numLength.length === 1) { // 如果是1,补一个0
  298. numLength = '0' + numLength
  299. } else if (numLength.length > 3) { // 转换后的16进制字符长度如果大于2位数,则返回,不支持
  300. return ''
  301. }
  302. encryptStr += numLength
  303. if (temp[1] === '0') {
  304. encryptStr += 0
  305. } else if (temp[1] === '1') {
  306. encryptStr += 1
  307. }
  308. encryptStr += temp[0]
  309. if (encryptStr.length < 20) { // 如果小于20位,补上随机数
  310. // 产生三位随机数
  311. let numtwo = ''
  312. for (let i = 0; i < 20 - encryptStr.length; i++) {
  313. numtwo += Math.floor(Math.random() * 10)
  314. }
  315. let ran = numtwo // 产生3位随机数
  316. encryptStr += ran
  317. }
  318. return encryptStr
  319. }
  320. }
  321. }
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. #recommend-fragment-self {
  326. min-width: 1190px;
  327. background: #ece9ec;
  328. margin:-18px 0px 0 0px;
  329. .recommend-product {
  330. position: relative;
  331. width: 1190px;
  332. margin: 0 auto;
  333. padding-bottom: 50px;
  334. .main-list {
  335. width: 100%;
  336. /*overflow: hidden;*/
  337. > li {
  338. position: relative;
  339. float: left;
  340. width: 962px;
  341. margin-left: 9px;
  342. &:first-child {
  343. width: 218px;
  344. /*height: 356px;*/
  345. /*background: #fff;*/
  346. margin: -5px 0 0 1px;
  347. border-radius: 5px;
  348. .list{
  349. margin-top: -20px;
  350. height: 170px;
  351. border-radius: 5px;
  352. background: #fff;
  353. .information-list {
  354. font-size: 12px;
  355. color: #333;
  356. margin-bottom: 2px;
  357. /*background: #fff;*/
  358. &:first-child{
  359. /*padding-top: 10px;*/
  360. }
  361. div:first-child {
  362. width: 72px;
  363. text-align: right;
  364. line-height: 20px;
  365. }
  366. div:last-child {
  367. width: 158px;
  368. line-height: 20px;
  369. padding: 0px 0px 0px 6px;
  370. }
  371. }
  372. .information-list > div {
  373. display: table-cell;
  374. }
  375. }
  376. .introduce {
  377. margin-top: 15px;
  378. width: 100%;
  379. height: 336px;
  380. font-size: 12px;
  381. line-height: 15px;
  382. color: #333;
  383. background: #fff;
  384. border-radius: 5px;
  385. p{
  386. span.info{
  387. font-size: 12px;
  388. color: #333;
  389. word-break: break-all;
  390. word-wrap:break-word;
  391. }
  392. span.look {
  393. color: #2496f1;
  394. cursor: pointer;
  395. position: absolute;
  396. right: 10px;
  397. }
  398. }
  399. div{
  400. overflow: hidden;
  401. height: 35px;
  402. h4 {
  403. float: left;
  404. background: url(/images/store/home/detail1.png) no-repeat 15% 10%;
  405. font-size: 14px;
  406. padding: 0 0 5px 30px;
  407. margin:10px 0;
  408. }
  409. h4.prof {
  410. background: url("/images/store/home/prof.png") no-repeat 15% 10%;
  411. }
  412. span{
  413. float: right;
  414. margin-top: 10px;
  415. padding-right: 10px;
  416. font-size: 12px;
  417. color: #2496f1;
  418. cursor: pointer;
  419. img{
  420. margin-top: -3px;
  421. }
  422. }
  423. }
  424. p {
  425. margin: -7px 0px 0px 9px;
  426. text-indent: 2em;
  427. width: 200px;
  428. line-height: 19px;
  429. height: 308px;
  430. overflow: hidden;
  431. }
  432. .empty-introduce{
  433. text-align: center;
  434. line-height: 153px;
  435. color: #666;
  436. }
  437. }
  438. .qualification {
  439. height: 35px;
  440. min-height: 35px;
  441. }
  442. .product-show{
  443. margin-top: 8px;
  444. }
  445. }
  446. }
  447. }
  448. }
  449. }
  450. </style>