index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <div class="purchase-layout ">
  3. <div class="plate01 container">
  4. <div class="main-detail">
  5. <browse
  6. :idata='browdata'
  7. :iactive='browactive'
  8. :floder="'probrowse'"
  9. class="product-img"
  10. />
  11. <div class="layout">
  12. <img class="pro-logo" :src="language==='en'?`${$cdn}images/pro-logo-en.png`:`${$cdn}images/pro-logo.png`" alt="">
  13. <p class="sub b-label" v-html="langPurchase.dec"></p>
  14. <p class="price">
  15. {{langPurchase.price}}
  16. </p>
  17. <template>
  18. <div class="intro-item">
  19. <h4 class="intro-title">{{langPurchase.color.key}}</h4>
  20. <span class="color"><i class=" iconfont icon-yuandian"></i>{{langPurchase.color.val}}</span>
  21. </div>
  22. <div class="intro-item">
  23. <h4 class="intro-title">{{langPurchase.service.key}}</h4>
  24. <ul>
  25. <!-- <li>{{langPurchase.service.type}} <a :href="`${pathname}#/mall/cloudCapacity`" target="_blank">{{ $t('mall.knowMore') }}</a></li> -->
  26. <span class="color"><i class=" iconfont icon-yuandian"></i>{{langPurchase.service.type}} <a :href="`${pathname}#/mall/cloudCapacity`" target="_blank">{{ $t('mall.knowMore') }}</a></span>
  27. <li>{{ langPurchase.service.val[0] }}</li>
  28. <li>{{ langPurchase.service.val[1] }}</li>
  29. <li>{{ langPurchase.service.val[2] }}</li>
  30. </ul>
  31. </div>
  32. <div class="intro-item">
  33. <h4 class="intro-title">{{langPurchase.gift.peijian}}</h4>
  34. <div class="detail-box zhijia" :class="{'no-active':!selectParts}" @click="changeSelectParts">
  35. <!-- <img :src="`${$cdn}images/tag-icon.png`" class="t-click" alt> -->
  36. <img :src="`${$cdn}images/zhijia.png`" alt>
  37. <div class="zhijia-info">
  38. <h6>{{ $t('mall.jiaojia') }}<span class="zhijia-price">{{ purchasezhijia.price }}</span></h6>
  39. <p>{{ $t('mall.jiaojiaDetail') }}</p>
  40. <a :href="`${pathname}#/mall/zhijia`" target="_blank">{{ $t('mall.knowMore')}}</a>
  41. </div>
  42. <div class="zhijia-actions">
  43. </div>
  44. </div>
  45. </div>
  46. <div class="number-w" v-if="language==='zh'">{{ $t('mall.count') }} <number v-model="count" :max="99" style="margin-left:12px;" /></div>
  47. </template>
  48. <template v-if="language==='zh'">
  49. <div class="totalPrice">RMB {{ totalPrice }}</div>
  50. </template>
  51. <div>
  52. <div class="btns">
  53. <div v-if="language==='zh'" class="button add-cart" @click="addcart" style="margin-right:28px;">
  54. <vcenter>
  55. <span>{{ $t('mall.cart') }}</span>
  56. </vcenter>
  57. </div>
  58. <div class="button" @click="pay">
  59. <vcenter>
  60. <span>{{langPurchase.buy}}</span>
  61. </vcenter>
  62. </div>
  63. </div>
  64. <div class="btn-dec" v-if="language==='zh'"><h-icon type="gouwuche" class="shop-cart-icon" />{{ langPurchase.tiaokuan }}</div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="plate02" >
  70. <div class="tabs ">
  71. <ul class="container">
  72. <li class="tabs-item" :class="{'is-active': detailType === 'product'}" @click="detailType = 'product'">{{$t('mall.product')}}</li><li class="tabs-item" :class="{'is-active': detailType === 'tech'}" @click="detailType = 'tech'">{{$t('mall.techDetail')}}</li>
  73. </ul>
  74. </div>
  75. <div class="product-detail container" v-show="detailType === 'product'" ref="homeLayout">
  76. <div class="plate item" v-for="(item,i) in sequenceArr" :key="i">
  77. <div class="container">
  78. <h2 class="common-title">{{item.name}}</h2>
  79. <sequence :runAnimation="item.runAnimation" :img="item.img.indexOf('http') > -1 ? item.img :`${$cdn}images/sequence/v${language === 'zh' ? item.img : item.enImg}.jpg`" />
  80. </div>
  81. </div>
  82. </div>
  83. <div class="tech-detail" v-show="detailType === 'tech'">
  84. <div class="params-body">
  85. <div class="container">
  86. <h1 class="common-title">{{$t('mall.techDetail')}}</h1>
  87. <div class="params-con">
  88. <div class="params-item" v-for="(item,index) in langPurchase.guige.arr" :key="index">
  89. <div class="p-l">{{item.name}}</div>
  90. <div class="p-r">
  91. <div v-html="sub" v-for="(sub,i) in item.val" :key="i"></div>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="sub">
  96. <p>{{langPurchase.guige.dec}}</p>
  97. </div>
  98. </div>
  99. </div>
  100. <div class="params-img-con container">
  101. <h1 class="common-title">{{ $t('mall.widthDetail')}}</h1>
  102. <img class="params-img" :src="`${$cdn}images/product_img_content_6_w.png`" alt="">
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </template>
  108. <script>
  109. import { mapState } from 'vuex'
  110. import spinner from '@/components/spinner'
  111. import vcenter from '@/components/vcenter'
  112. import browse from '@/components/browse'
  113. import priceTable from '@/components/priceTable'
  114. import { getPosition } from '@/util'
  115. import number from '@/components/mall/number'
  116. import mallConfig from '@/config/mall'
  117. import sequence from '@/components/sequence'
  118. import { saveConfirmGoods } from '@/util/storage'
  119. export default {
  120. components: {
  121. spinner,
  122. vcenter,
  123. browse,
  124. priceTable,
  125. number,
  126. sequence
  127. },
  128. computed: {
  129. ...mapState({
  130. split: state => state.ui.navDivision,
  131. isLogin: state => state.user.name,
  132. langPurchase: state => state.language.home.purchase,
  133. purchasezhijia: state => state.language.home.purchasezhijia,
  134. language: state => state.language.current,
  135. langToast: state => state.language.home.toast,
  136. token: state => state.user.token,
  137. cart: state => JSON.parse(state.user.cart)
  138. }),
  139. totalPrice () {
  140. return mallConfig.formatNum(mallConfig.price * this.count + (this.selectParts ? mallConfig.zhijiaPrice * this.count : 0))
  141. }
  142. },
  143. data () {
  144. let detail = {
  145. left: [
  146. '数据永久存储',
  147. '高速上传计算队列',
  148. '场景分享、热点编辑、隐私加密'
  149. ],
  150. right: ['多种个性化功能', '附送30G终身容量']
  151. }
  152. let guige = [
  153. {
  154. name: '容量和内存',
  155. val: ['LPDDR4X双通道', '6G内存', 'UFS 2.1', '64GB 机身存储']
  156. },
  157. {
  158. name: '机身尺寸和重量',
  159. val: ['高度 = 153.3m', '宽度 = 74.5mm', '厚度 = 7.9mm', '重量 = 170g']
  160. },
  161. {
  162. name: '处理器平台',
  163. val: [
  164. 'Qualcomm® 骁龙™ 845 处理器',
  165. '10nm 先进制程',
  166. '单核主频可达 2.8GHz',
  167. 'Adreno™ 630 图形处理器,主频可达 700MHz',
  168. '配备人工智能引擎(AI Engine)'
  169. ]
  170. },
  171. {
  172. name: '网络',
  173. val: ['支持 VoLTE 高质量宽带', '支持三载波聚', '支持 LTE B41 4x4 MIMO']
  174. },
  175. {
  176. name: '屏幕',
  177. val: [
  178. '6.17 英寸 In-Cell 全高清显示屏',
  179. '2242 x 1080 分辨率,403 ppi',
  180. '康宁®第三代大猩猩®玻璃'
  181. ]
  182. }
  183. ]
  184. let browdata = [
  185. {
  186. small: 'small-0',
  187. big: 'big-0',
  188. video: true
  189. }, {
  190. small: 'small-1',
  191. big: 'big-1'
  192. },
  193. {
  194. small: 'small-2',
  195. big: 'big-2'
  196. },
  197. {
  198. small: 'small-3',
  199. big: 'big-3'
  200. }]
  201. let browactive = browdata[0]
  202. return {
  203. detail,
  204. guige,
  205. browactive,
  206. browdata,
  207. count: 1,
  208. selectParts: true,
  209. mallConfig,
  210. zhijiaCount: 1,
  211. detailType: 'product',
  212. pathname: window.location.pathname,
  213. sequenceArr: [
  214. {
  215. name: this.$t('conduct.coreProduct.itemTitle1'),
  216. img: '6',
  217. enImg: '1en',
  218. runAnimation: true
  219. },
  220. {
  221. name: this.$t('conduct.coreProduct.itemTitle2'),
  222. img: '7',
  223. enImg: '7',
  224. runAnimation: true
  225. },
  226. {
  227. name: this.$t('conduct.coreProduct.itemTitle4'),
  228. img: 'https://4dscene.oss-cn-shenzhen.aliyuncs.com/new4dkk/v2/video/qiumu.mp4',
  229. runAnimation: true
  230. },
  231. {
  232. name: this.$t('conduct.coreProduct.itemTitle5'),
  233. img: '8',
  234. enImg: '8en',
  235. runAnimation: true
  236. },
  237. {
  238. name: this.$t('conduct.coreProduct.itemTitle6'),
  239. img: '9',
  240. enImg: '9',
  241. runAnimation: true
  242. },
  243. {
  244. name: this.$t('conduct.coreProduct.itemTitle7'),
  245. img: '10',
  246. enImg: '10en',
  247. runAnimation: true
  248. }
  249. ]
  250. }
  251. },
  252. methods: {
  253. handleSpinner (data) {
  254. this.count = data
  255. },
  256. async addcart () {
  257. let zhijia = {
  258. goodsId: 7,
  259. goodsCount: this.count,
  260. skuSn: 'U15604134406280073'
  261. }
  262. let params = {
  263. goodsId: 4,
  264. goodsCount: this.count,
  265. skuSn: 'U15609161635760015'
  266. }
  267. if (!this.token) {
  268. this.$router.push('/login/login')
  269. return
  270. }
  271. await this.$store.dispatch('addCart', params)
  272. this.selectParts && await this.$store.dispatch('addCart', zhijia)
  273. this.$toast.show('success', this.langToast['39'])
  274. },
  275. pay () {
  276. if (this.language === 'en') {
  277. return window.open('https://www.alibaba.com/product-detail/4DKanKan-Pro-3D-camera-3D-space_62183626283.html?spm=a2700.icbuShop.74.1.66b35b10I4miJd')
  278. }
  279. if (!this.token) {
  280. this.$router.push('/login/login')
  281. return
  282. }
  283. let params = {
  284. type: 'detail',
  285. sku: [{
  286. goodsId: 4,
  287. goodsCount: this.count,
  288. price: 12800,
  289. skuSn: 'U15609161635760015'
  290. }],
  291. fromList: false
  292. }
  293. let zhijia = {
  294. goodsId: 7,
  295. goodsCount: this.count,
  296. price: mallConfig.zhijiaPrice,
  297. skuSn: 'U15604134406280073'
  298. }
  299. this.selectParts && params.sku.push(zhijia)
  300. saveConfirmGoods(params.sku)
  301. this.$router.push('/mall/confirm')
  302. },
  303. scrollTo (href) {
  304. this.interval = null
  305. let inter = 0
  306. let tag = getPosition(this.$refs[href]).y - 90
  307. let speed = Math.ceil(tag / 40)
  308. this.interval = setInterval(() => {
  309. window.scrollTo(0, inter)
  310. inter += speed
  311. if ((window.scrollY || window.pageYOffset) >= tag) {
  312. clearInterval(this.interval)
  313. }
  314. })
  315. },
  316. changeSelectParts () {
  317. this.selectParts=!this.selectParts
  318. }
  319. },
  320. mounted () {
  321. this.sizeHandle = () => {
  322. if (this.detailType !== 'product') {
  323. return
  324. }
  325. let height = getPosition(this.$refs.homeLayout).y
  326. let items = Array.from(this.$refs.homeLayout.querySelectorAll('.plate'))
  327. if (this.startNumCount && this.slideActive) {
  328. window.removeEventListener('scroll', this.sizeHandle)
  329. }
  330. items.forEach((item, index) => {
  331. let addHeight = item.offsetParent && (item.offsetParent.nodeName).toLowerCase() === 'body' ? (item.offsetTop + height) : (item.offsetTop + item.offsetParent.offsetTop + height)
  332. if (addHeight <= window.innerHeight + (window.scrollY || window.pageYOffset) + 500) {
  333. this.sequenceArr[index]['runAnimation'] = false
  334. } else {
  335. this.sequenceArr[index]['runAnimation'] = true
  336. }
  337. })
  338. }
  339. window.addEventListener('scroll', this.sizeHandle)
  340. },
  341. beforeDestroy () {
  342. clearInterval(this.interval)
  343. window.removeEventListener('scroll', this.sizeHandle)
  344. }
  345. }
  346. </script>
  347. <style lang="scss" scoped>
  348. @import "./style.scss";
  349. .intro-title {
  350. font-size: 16px;
  351. font-weight: 600;
  352. color: #202020;
  353. }
  354. .color {
  355. display: inline-block;
  356. margin: 7px 0 13px;
  357. font-weight: bold;
  358. line-height: 33px;
  359. i {
  360. font-weight: normal;
  361. margin-right: 4px;
  362. }
  363. // font-weight: bold;
  364. }
  365. .intro-item {
  366. ul {
  367. margin: 15px 0 25px;
  368. padding-left: 23px;
  369. .color {
  370. margin: 0 0 0 -24px;
  371. a {
  372. font-size: 12px;
  373. color: #202020;
  374. font-weight: normal;
  375. text-decoration: underline;
  376. }
  377. }
  378. }
  379. li {
  380. list-style: disc;
  381. color: #909090;
  382. line-height: 33px;
  383. font-size: 16px;
  384. }
  385. }
  386. </style>