EnterpriseInfo.vue 13 KB

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