EnterpriseInfo.vue 14 KB

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