EnterpriseInfo.vue 14 KB

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