index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <div class="purchase-layout">
  3. <div class="plate01">
  4. <div class="main-layout">
  5. <!-- <img class="pro" :src="`${$cdn}images/banner_pro.png`" alt=""> -->
  6. <browse
  7. :idata='browdata'
  8. :floder="'probrowse'"
  9. />
  10. <div class="txt-con">
  11. <img class="p-logo" :src="language==='en'?`${$cdn}images/pro-logo-m-en.png`:`${$cdn}images/pro-logo-m.png`" alt="">
  12. <p class="sub b-label" v-html="langPurchase.dec"></p>
  13. <div class="p-price">{{langPurchase.price}}</div>
  14. </div>
  15. <div class="attr-con">
  16. <div class="attr">{{langPurchase.color.key}}</div>
  17. <div class="box color">
  18. <i class="iconfont icon-yuandian"><span>{{langPurchase.color.val}}</span></i>
  19. </div>
  20. <div class="attr">{{langPurchase.service.key}}</div>
  21. <div class="box service">
  22. <i class="iconfont icon-yuandian">
  23. <div class="flex-content">
  24. <span>{{langPurchase.service.type}}</span>
  25. <a class="title peijian" @click="$router.push({name:'pricedetail'})">
  26. <img :src="`${$cdn}images/perjian-warn.png`" alt="">
  27. {{$t('mall.knowMore')}}
  28. </a>
  29. </div>
  30. </i>
  31. <!-- <span @click="scrollTo('rlgz')">{{langPurchase.why}}</span> -->
  32. <ul>
  33. <li v-for="(item,i) in langPurchase.service.val" :key="i" v-html="item"></li>
  34. </ul>
  35. </div>
  36. <div class="attr">{{langPurchase.gift.key}}</div>
  37. <div class="box zhijia" :class="{'no-active':!selectParts}" @click="selectParts=!selectParts">
  38. <img :src="`${$cdn}images/tag-icon.png`" class="t-click" alt>
  39. <img :src="`${$cdn}images/zhijia.png`" alt>
  40. <div>
  41. <p class="title1">{{langPurchase.gift.val}}</p>
  42. <p>{{langPurchase.gift.price}}</p>
  43. </div>
  44. </div>
  45. <p class="title peijian" @click="$router.push({name:'purchasezhijia'})">
  46. <img :src="`${$cdn}images/perjian-warn.png`" alt="">
  47. <span>{{$t('mall.knowMore')}}</span>
  48. </p>
  49. <div v-if="language!=='en'" class="attr">{{langPurchase.count.key}}</div>
  50. <spinner v-if="language!=='en'" class="count" @count='handleNum' />
  51. <div class="dec" v-if="language === 'zh'"><h-icon class="gouwuche" type="gouwuche" />{{langPurchase.tiaokuan}}</div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="plate02" ref="jsgg">
  56. <ul class="plate02-type-list">
  57. <li :class="{'is-active': plate02ShowType === 'product'}" @click="plate02ShowType='product'">{{$t('mall.product')}}</li>
  58. <li :class="{'is-active': plate02ShowType === 'tech'}" @click="plate02ShowType='tech'">{{$t('mall.techDetail')}}</li>
  59. </ul>
  60. <div v-show="plate02ShowType === 'product'">
  61. <ul class="desc-video">
  62. <li v-for="item in videoArr" :key="item.name">
  63. <h1 class="common-title" v-html="item.name"></h1>
  64. <div class="player">
  65. <video class="video" controls="controls" playsinline="playsinline" muted="muted" :poster="`${$cdn}images/postv${item.post}.png`">
  66. <source :src="`${$cdn}video/homevideo/v${item.img}.mp4`" type="video/mp4">
  67. </video>
  68. </div>
  69. </li>
  70. </ul>
  71. </div>
  72. <div v-show="plate02ShowType === 'tech'">
  73. <div class="common-title">{{ $t('mall.techDetail') }}</div>
  74. <div class="p2-pramas">
  75. <div v-for="(item,i) in langPurchase.guige.arr" :key="i">
  76. <p class="title">{{item.name}}</p>
  77. <div class="detail" >
  78. <div v-for="(sub,idx) in item.val" v-html="sub" :key="idx">
  79. <!-- <span v-html="sub">* 付款成功后5个工作日内发货,默认顺丰快递包邮</span> -->
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="plate02-white">
  85. <div class="common-title">{{ $t('mall.widthDetail') }}</div>
  86. <div class="p2-imgc">
  87. <img :src="`${$cdn}images/m-paramspro.png`" alt="">
  88. </div>
  89. <p class="small-tip">*{{ $t('mall.smallTip') }}</p>
  90. </div>
  91. </div>
  92. </div>
  93. <!-- <div class="plate03" ref="rlgz">
  94. <div class="p03">
  95. <div class="b-title">{{langPurchase.pricename}}</div>
  96. <priceTable/>
  97. <ul class="price-txt">
  98. <li v-for="(item,i) in langPurchase.pricetxt" :key="i">
  99. <p>{{item.q}}</p>
  100. <p v-html="item.a"></p>
  101. </li>
  102. </ul>
  103. <p class="peijian" @click="$router.push({name:'pricedetail'})">
  104. <img :src="`${$cdn}images/perjian-warn.png`" alt="">
  105. <span style="width:calc(100% - 24px);margin-left:1%;">{{langPurchase.view}}</span>
  106. </p>
  107. </div>
  108. </div> -->
  109. <div class="hover-btns">
  110. <div class="h-price">
  111. {{language!=='en'? `RMB ${totalPrice}`:''}}
  112. </div>
  113. <div class="h-btns">
  114. <span v-if="language!=='en'" @click="addcart">加入购物车</span>
  115. <span class="primary" @click="tobuy">{{langPurchase.buy}}</span>
  116. </div>
  117. </div>
  118. </div>
  119. </template>
  120. <script>
  121. import { mapState } from 'vuex'
  122. import spinner from '@/components/spinner'
  123. import priceTable from '@/components/priceTable'
  124. import browse from '@/components/browse'
  125. import { getPosition } from '@/util'
  126. import mallConfig from '@/../../common/mall/mall'
  127. import { i18n } from '@/lang'
  128. export default {
  129. components: {
  130. spinner,
  131. browse,
  132. priceTable
  133. },
  134. computed: {
  135. ...mapState({
  136. token: state => state.user.token,
  137. language: state => state.language.current,
  138. langPurchase: state => state.language.home.purchase
  139. }),
  140. totalPrice () {
  141. return mallConfig.price * this.count + (this.selectParts ? mallConfig.zhijiaPrice * this.count : 0)
  142. }
  143. },
  144. data () {
  145. let browdata = [
  146. {
  147. small: 'small-0',
  148. big: 'big-0',
  149. video: 'pro-post'
  150. }, {
  151. small: 'small-1',
  152. big: 'big-1'
  153. },
  154. {
  155. small: 'small-2',
  156. big: 'big-2'
  157. },
  158. {
  159. small: 'small-3',
  160. big: 'big-3'
  161. }]
  162. return {
  163. plate02ShowType: 'product',
  164. mallConfig,
  165. count: 1,
  166. browdata,
  167. selectParts: true,
  168. techData: [
  169. {
  170. label: '机身尺寸',
  171. desc: [`高度:220.7mm / 宽度:78.2mm / 厚度:78.2mm`]
  172. },
  173. {
  174. label: '分辨率',
  175. desc: [`4608*3456像素(每个);8192*4096像素(合计)`]
  176. },
  177. {
  178. label: '存储内存',
  179. desc: ['16GB']
  180. },
  181. {
  182. label: 'WiFi',
  183. desc: ['802.11a/b/g/n网络协议 / ', '支持2.4/5GHz通信']
  184. },
  185. {
  186. label: '镜头',
  187. desc: [`类型:200°鱼眼镜头 孔径:f/2.0 数量:8个`]
  188. },
  189. {
  190. label: '传感器',
  191. desc: [`范围:1/2.3英寸 数量:8个`]
  192. },
  193. {
  194. label: '电池',
  195. desc: ['7.4V 4200mAh / 可通过USB快速充电']
  196. },
  197. {
  198. label: '设备接口',
  199. desc: ['TYPE-C']
  200. }
  201. ],
  202. videoArr: [
  203. {
  204. name: i18n.t('conduct.coreProduct.itemTitle1'),
  205. img: 1,
  206. post: 1,
  207. runAnimation: true
  208. },
  209. {
  210. name: i18n.t('conduct.coreProduct.itemTitle2'),
  211. img: 2,
  212. post: 2,
  213. runAnimation: true
  214. },
  215. {
  216. name: i18n.t('conduct.coreProduct.itemTitle4'),
  217. img: 6,
  218. post: 6,
  219. runAnimation: true
  220. },
  221. {
  222. name: i18n.t('conduct.coreProduct.itemTitle5'),
  223. img: 3,
  224. post: 3,
  225. runAnimation: true
  226. },
  227. {
  228. name: i18n.t('conduct.coreProduct.itemTitle6'),
  229. img: 4,
  230. post: 4,
  231. runAnimation: true
  232. },
  233. {
  234. name: i18n.t('conduct.coreProduct.itemTitle7'),
  235. img: 5,
  236. post: 5,
  237. runAnimation: true
  238. }
  239. ]
  240. }
  241. },
  242. methods: {
  243. handleNum (data) {
  244. this.count = data
  245. },
  246. async addcart () {
  247. if (!this.token) {
  248. return this.$router.push({path: '/login'})
  249. }
  250. let params = {
  251. goodsId: 4,
  252. goodsCount: this.count,
  253. skuSn: mallConfig.goodsMap[4].skuSn
  254. }
  255. let zhijia = {
  256. goodsId: 7,
  257. goodsCount: this.count,
  258. skuSn: mallConfig.goodsMap[7].skuSn
  259. }
  260. await this.$store.dispatch('addCart', params)
  261. this.selectParts && await this.$store.dispatch('addCart', zhijia)
  262. this.$toast.showAddCart('success', '商品加入购物车成功', '前往购物车', () => {
  263. this.$router.push({path: '/cart'})
  264. })
  265. },
  266. async tobuy () {
  267. if (this.language === 'en') {
  268. window.location.href = 'https://www.alibaba.com/product-detail/4DKanKan-Pro-3D-camera-3D-space_62183626283.html?spm=a2700.icbuShop.74.1.66b35b10I4miJd'
  269. return
  270. }
  271. if (!this.token) {
  272. return this.$router.push({path: '/login'})
  273. }
  274. let params = {
  275. goodsId: 4,
  276. price: mallConfig.price,
  277. goodsCount: this.count,
  278. skuSn: mallConfig.goodsMap[4].skuSn
  279. }
  280. let zhijia = {
  281. goodsId: 7,
  282. goodsCount: this.count,
  283. price: mallConfig.zhijiaPrice,
  284. skuSn: mallConfig.goodsMap[7].skuSn
  285. }
  286. let tmpcart = []
  287. let temp = {}
  288. tmpcart.push(params)
  289. this.selectParts && tmpcart.push(zhijia)
  290. temp['goods'] = tmpcart
  291. this.$store.commit('PAYINFO', temp)
  292. this.$router.push({path: '/vieworder'})
  293. },
  294. scrollTo (href) {
  295. this.interval = null
  296. let inter = 0
  297. let tag = getPosition(this.$refs[href]).y - 80
  298. let speed = Math.ceil(tag / 40)
  299. this.interval = setInterval(() => {
  300. window.scrollTo(0, inter)
  301. inter += speed
  302. if ((window.scrollY || window.pageYOffset) >= tag) {
  303. clearInterval(this.interval)
  304. }
  305. })
  306. }
  307. }
  308. }
  309. </script>
  310. <style lang="scss" scoped>
  311. @import './style.scss';
  312. .plate01{
  313. .top{
  314. height: 60px;
  315. padding-top: 20px;
  316. text-align: right;
  317. span{
  318. padding-right: 5%;
  319. font-size: 14px;
  320. color: rgba(0, 0, 0, 0.7);
  321. line-height: 18px;
  322. font-weight: bold;
  323. }
  324. }
  325. .main-layout{
  326. width: 100%;
  327. text-align: center;
  328. .pro{
  329. width: 20%;
  330. margin: 40px auto;
  331. }
  332. .txt-con{
  333. width: 90%;
  334. margin: 0 auto;
  335. text-align: left;
  336. padding: 16px 0 !important;
  337. .p-title{
  338. font-size: 20px;
  339. color: #202020;
  340. line-height: 24px;
  341. font-weight: 700;
  342. }
  343. .p-logo{
  344. width: 165px;
  345. margin-bottom: 8px;
  346. }
  347. .p-label{
  348. font-size: 12px;
  349. color: #202020;
  350. line-height: 16px;
  351. }
  352. .p-price{
  353. margin-top: 10px;
  354. font-size: 20px;
  355. line-height: 1;
  356. color: #202020;
  357. font-weight: 700;
  358. .zdj{
  359. font-size: 16px;
  360. color: #1fe4dc;
  361. }
  362. }
  363. }
  364. .attr-con{
  365. text-align: left;
  366. width: 90%;
  367. margin: 0 auto;
  368. padding: 0 0 40px;
  369. .icon-yuandian{
  370. font-size: 12px !important;
  371. span {
  372. margin-left: 8px;
  373. color: #202020 !important;
  374. }
  375. }
  376. .attr{
  377. font-size: 12px;
  378. color: #202020;
  379. line-height: 18px;
  380. font-weight: bold;
  381. margin: 12px 0 8px;
  382. }
  383. .box{
  384. display: inline-block;
  385. color: rgba(0,0,0,.45);
  386. padding: 0 63px;
  387. box-sizing: border-box;
  388. position: relative;
  389. text-align: left;
  390. .t-click{
  391. position: absolute;
  392. right: 0;
  393. bottom: 0;
  394. margin: 0;
  395. width: 16px;
  396. height: 16px;
  397. padding: 0;
  398. }
  399. }
  400. .color{
  401. width: 100%;
  402. padding: 0;
  403. font-size: 14px;
  404. color: #202020;
  405. font-weight: bold;
  406. }
  407. .service{
  408. width: 100%;
  409. display: inline-block;
  410. padding: 0;
  411. .icon-yuandian{
  412. font-size: 14px;
  413. color: rgba(0, 0, 0, 0.7);
  414. font-weight: bold;
  415. display: flex;
  416. align-items: center;
  417. a {
  418. color: #486ACE !important;
  419. line-height: 18px;
  420. margin-top: 0;
  421. display: flex;
  422. align-items: center;
  423. img {
  424. vertical-align: middle;
  425. margin-right: 2px;
  426. }
  427. }
  428. }
  429. .flex-content {
  430. display: flex;
  431. justify-content: space-between;
  432. min-width: 271px;
  433. align-items: center;
  434. }
  435. ul{
  436. padding: 6px 10px 0 15px;
  437. display: inline-block;
  438. width: 100%;
  439. vertical-align: top;
  440. li{
  441. font-size: 12px;
  442. line-height: 18px;
  443. position: relative;
  444. color: #909090;
  445. &::before{
  446. content: '';
  447. width: 3px;
  448. height: 3px;
  449. border-radius: 50%;
  450. display: inline-block;
  451. position: absolute;
  452. left: -10px;
  453. top: 8px;
  454. background-color: rgba(0,0,0,.45);
  455. }
  456. }
  457. }
  458. span{
  459. color: #1fe4dc;
  460. font-weight: bold;
  461. cursor: pointer;
  462. margin-left: 2%;
  463. }
  464. }
  465. .zhijia{
  466. padding: 0;
  467. text-align: left;
  468. width: 100%;
  469. border: 1px solid #70eee9;
  470. padding-left: 22px;
  471. >div{
  472. display: inline-block;
  473. vertical-align: middle;
  474. }
  475. p{
  476. line-height: 18px;
  477. text-align: left;
  478. color: #202020;
  479. }
  480. }
  481. .peijian{
  482. vertical-align: middle;
  483. margin-top: 10px;
  484. color: #486ace;
  485. font-size: 12px;
  486. cursor: pointer;
  487. font-weight: normal;
  488. img{
  489. vertical-align: middle;
  490. width: 14px;
  491. height: 14px;
  492. }
  493. span{
  494. display: inline-block;
  495. vertical-align: middle;
  496. }
  497. }
  498. .count{
  499. margin: 0;
  500. }
  501. .no-active{
  502. border: 1px solid #e3e3e3;
  503. background-color: #fff;
  504. .t-click{
  505. display: none;
  506. }
  507. }
  508. .btn{
  509. cursor: pointer;
  510. width: 100%;
  511. height: 50px;
  512. margin-top: 35px;
  513. line-height: 50px;
  514. color: #414141;
  515. font-size: 14px;
  516. background-color: #1fe4dc;
  517. display: inline-block;
  518. text-align: center;
  519. }
  520. .dec{
  521. color: #909090;
  522. font-size: 12px;
  523. display: flex;
  524. align-items: center;
  525. text-align: left;
  526. margin-top: 12px;
  527. .gouwuche {
  528. font-size: 18px;
  529. margin-right: 5px;
  530. }
  531. }
  532. }
  533. }
  534. }
  535. .goods-name {
  536. font-size: 22px;
  537. font-weight: bold;
  538. color: #202020;
  539. margin-top: 15px;
  540. }
  541. </style>