PageSourceSearch

https://www.dxracer.com.ar/static/module/us/product/detail/ProductJsDetail2.js?v=202609231327

js dxracer.com.ar collected 2026-10-05 02:56:18 UTC 17,376 bytes, 504 lines download raw bytes

1new Vue({
2	el: '#productJsDiv',
3	data:{
4		skuList: js_sku_list,
5		variables: js_variables,
6		activeSku: js_sku_list.find(k=>k.skuCode === currentSku.skuCode),
7		currency: {symbol: symbol,value: currencyValue},
8		currentSkuReviews: currentSkuReviews,
9		cartList:[],
10		skuListImage:[],
11		record: [],
12		giftList: giftList,
13		giftRcordList: [],
14		skuGiftList: skuGiftList,
15		skuGiftRecord: {},
16		variableColorList: [],
17		currentSeriesView:currentEndSeries.view,
18		accessoryList:[],
19		showAccessoryList:[],
20		activeUrl:'',
21	},
22	computed:{
23	},
24	mounted() {
25	    this.$nextTick(() => {
26	      $("#productJsDiv .chooseModal-productList .chooseModal-productList-content").slick({
27	      	infinite: true,
28	      	slidesToShow: 4,
29	      	slidesToScroll: 1,
30	      	dots: false,
31	      	focusOnSelect: true,
32	      	touchMove: false,
33	          draggable: false,
34	          swipe: false,
35	          prevArrow: '<div class="arrow-prev"><svg class="icon svg-inline--fa" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.168 6L10.0016 16.1664L19.8352 26" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg></div>',
36	          nextArrow: '<div class="arrow-next"><svg class="icon svg-inline--fa" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none"><path stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" d="M11.832 26L21.9984 15.8336L12.1648 6"/></svg></div>',
37	      })
38	      $('#productJsDiv .chooseModal-productList .chooseModal-productList-content').on('afterChange', this.handleAfterChange);
39	    });
40	},
41	methods:{
42		initAccessory(){
43			axios.get('/api/biz/b2c-us/store/sku/sale/join/findList/'+this.activeSku.id)
44			.then(({data})=>{
45				this.accessoryList = data.data
46				if(this.accessoryList && this.accessoryList.length > 0){
47					let showSku = this.accessoryList.filter(i=>i.orgSkuId === this.activeSku.id)
48					if(showSku && showSku.length > 0){
49						this.showAccessoryList = showSku
50					}else{
51						this.showAccessoryList = this.accessoryList.filter(i=>i.seriesId == this.activeSku.seriesId)
52					}
53				}
54			})
55		},
56		changeAccessory(){
57			if(this.accessoryList && this.accessoryList.length > 0){
58				let showSku = this.accessoryList.filter(i=>i.orgSkuId === this.activeSku.id)
59				if(showSku && showSku.length > 0){
60					this.showAccessoryList = showSku
61				}else{
62					this.showAccessoryList = this.accessoryList.filter(i=>i.seriesId == this.activeSku.seriesId)
63				}
64			}
65		},
66		showAccessory(targetSkuId,skuId,qty){
67			return targetSkuId == skuId && qty > 0 
68		},
69		    checkIfMobile() {
70			      const toMatch = [
71			        /Android/i,
72			        /webOS/i,
73			        /iPhone/i,
74			        /iPad/i,
75			        /iPod/i,
76			        /BlackBerry/i,
77			        /Windows Phone/i
78			      ];
79			 
80			      return toMatch.some((pattern) => {
81			        return navigator.userAgent.match(pattern);
82			      });
83			    },
84		clearVariables(){
85			const allSkuVariableOptionIds = []
86			this.skuList.forEach(sku=>{
87				allSkuVariableOptionIds.push(...sku.variableOptionIds)
88			})
89			this.variables.forEach(v=>{
90				v.options.forEach((c,index)=>{
91					if(allSkuVariableOptionIds.indexOf(c.id)=== -1){
92						v.options.splice(index,1)
93					}
94				})
95			})
96		},
97		generateRandomIndex() {
98			const index = Math.random() < 0.33 ? 0 : (Math.random() < 0.66 ? 1 : 11);
99		    return index;
100		},
101		initImageList(){
102			this.skuList.forEach(sku=>{
103			 	if(null != sku.skuImageAngleList && sku.skuImageAngleList.length > 11){
104			 		const index = this.generateRandomIndex()
105			 		const randomImg = sku.skuImageAngleList[index]
106			 		const skuImg = {id:sku.id,img: randomImg}
107					this.skuListImage.push(skuImg)
108					sku.skuImageMain = randomImg
109			 	}else{
110			 		const skuImg = {id:sku.id,img: sku.skuImageMain}
111				    this.skuListImage.push(skuImg)
112			 	}
113			 	this.record.push(sku)
114			})
115		},
116		initGiftList(){
117			if(this.giftList){
118				const initGiftList = this.giftList.filter(i=>i.skuId == this.activeSku.id)
119				if(initGiftList && initGiftList.length > 0){
120					this.giftRcordList = initGiftList
121				}else{
122					this.giftRcordList = this.giftList.filter(i=>i.seriesId == this.activeSku.seriesId)
123				}
124			}
125		},
126		initSkuGiftList(){
127			if(this.skuGiftList){
128				const initSkuGiftList = this.skuGiftList.filter(i=>i.skuCollection && i.skuCollection.indexOf(this.activeSku.id) > -1)
129				if(initSkuGiftList && initSkuGiftList.length > 0){
130					this.skuGiftRecord = initSkuGiftList[0]
131				}else{
132					const initSeriesGiftList = this.skuGiftList.filter(i=>i.seriesCollection == this.activeSku.seriesId)
133					if(initSeriesGiftList && initSeriesGiftList.length > 0){
134						this.skuGiftRecord = initSeriesGiftList[0]
135					}else{
136						this.skuGiftRecord = {}
137					}
138				}
139			}
140		},
141		checkShowOption(idx,id){
142			return idx<2 || this.filterOptionsVal(idx,id).id != null
143		},
144		showCurrentAttrTitles(){
145			var html = ''
146				const activeAttrValueArr = this.activeSku.variableOptionIds
147				for(var k=0;k<activeAttrValueArr.length;k++){
148					for(var i=0;i<this.variables.length;i++){
149						const variable = this.variables[i]
150						for(var j=0;j<variable.options.length;j++){
151							const row = variable.options[j]
152							if(row.id == activeAttrValueArr[k] && k !==2){
153								html+='<div>'
154								html+= row.label
155								html+='</div>'
156							}
157						}
158					}
159				}
160			return html
161		},
162		showMobileCurrentAttrTitles(){
163			var html = ''
164				const activeAttrValueArr = this.activeSku.variableOptionIds
165				for(var k=0;k<activeAttrValueArr.length;k++){
166					for(var i=0;i<this.variables.length;i++){
167						const variable = this.variables[i]
168						for(var j=0;j<variable.options.length;j++){
169							const row = variable.options[j]
170							if(row.id == activeAttrValueArr[k]){
171								html+='<p class="mb-h2" style="color: #858585">'
172								html+= row.label
173								html+='</p>'
174							}
175						}
176					}
177				}
178			return html
179		},
180		filterOptionsVal(idx,attrValueId){
181			var activeSkuAttrValueIds = this.activeSku.variableOptionIds
182			var currentOptionAttrValurIds  = JSON.stringify(activeSkuAttrValueIds)
183			currentOptionAttrValurIds = JSON.parse(currentOptionAttrValurIds)
184			currentOptionAttrValurIds[idx] = attrValueId
185			currentOptionAttrValurIds =  currentOptionAttrValurIds.join(',')
186			const result = this.skuList.find(k=>k.variableOptionIds == currentOptionAttrValurIds)||{}
187			return result
188		},
189		filterGroup(idx,opGroup){
190			let attrValueIds =  this.variables[idx].options.filter(i=>i.groupText===opGroup).map(i=>i.id)
191			for(var i=0;i<attrValueIds.length;i++){
192				var has = this.filterOptionsVal(idx,attrValueIds[i])
193				if(has && has.id != null){
194					return true
195				}
196			}
197		},
198		optionChecked(attrValueId){
199			return this.activeSku.variableOptionIds.indexOf(attrValueId)>-1?' checked':''
200		},
201		showSizeLabel(idx,attrValueId){
202			const sku = this.filterOptionsVal(idx,attrValueId)
203			let label = sku.variableOptionLabels[0]
204			let labelNew = label.split('/')
205			if(labelNew.length === 2){
206				return labelNew[1]
207			}
208			return label
209		},
210		showOptionTag(idx,attrValueId){
211			const sku = this.filterOptionsVal(idx,attrValueId)
212			return sku
213		},
214		showOptionTagClass(idx,attrValueId){
215			const sku = this.filterOptionsVal(idx,attrValueId)
216			if(sku.skuStatus !== 'SALE'){
217				return ' out-checked'
218			}else{
219				if(sku.isPre === true){
220					return ' pre-checked'
221				}else{
222					if(sku.inventoryQuantity<=0){
223						return ' out-checked'
224					}else{
225						return ''
226					}
227				}
228			}
229		},
230		changeOption(idx,attrValueId){
231			const oldSkuTitle = this.activeSku.skuTitle
232			var newSku = this.filterOptionsVal(idx,attrValueId)
233			if(!newSku || newSku.id == null){
234				newSku = this.skuList.filter(k=>k.variableOptionIds.indexOf(''+attrValueId)>-1)[0]
235				if(!newSku || newSku.id == null){
236					newSku = this.skuList.find(f=>f.skuCode == this.activeSku.skuCode)
237				}
238			}
239
240			this.activeSku = newSku
241			this.changePicByJquery(this.activeSku)
242			this.replaceParamVal('sku',this.activeSku.skuCode,false)
243			document.title= document.title.replace(new RegExp(oldSkuTitle,'g'),this.activeSku.skuTitle)
244			//修改评价
245//			this.selectCurrentSkuReviews(this.activeSku.id,this.activeSku.seriesId)
246			//修改赠品
247			this.initGiftList()
248			//修改真赠品
249			this.initSkuGiftList()
250			//修改关联销售
251			this.changeAccessory()
252			axios.get(location.href)
253		},
254		initSlick(){
255			const variableColor = this.variables.find(row=>row.type === 'COLOR')
256			if(variableColor){
257				const variableIndex = this.variables.findIndex(row=>row.type === 'COLOR')
258				const currentColorId = this.activeSku.variableOptionIds[variableIndex]
259				const children = variableColor.options.filter(row=>row.hasSku == true)
260				const index = children.findIndex(row=>row.id == currentColorId)
261				$("#productJsDiv .chooseModal-productList .chooseModal-productList-content").slick('slickGoTo', index);
262			}
263		},
264		initVariableColorList(){
265			const variableColor = this.variables.find(row=>row.type === 'COLOR')
266			if(variableColor){
267				const children = variableColor.options.filter(row=>row.hasSku == true)
268				this.variableColorList = children
269			}
270		},
271		handleAfterChange(event, slick, currentSlide) {
272			const variableColor = this.variables.find(row=>row.type === 'COLOR')
273			if(variableColor){
274				const variableIndex = this.variables.findIndex(row=>row.type === 'COLOR')
275				const children = variableColor.options.filter(row=>row.hasSku == true)
276				if(children && children.length > 1){
277					const child = children[currentSlide]
278					this.changeOption(variableIndex,child.id)
279				}
280			}
281	    },
282		getQueryString(name){
283			var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
284			var r = window.location.search.substr(1).match(reg);
285			if(r!=null)return  unescape(r[2]); return null;
286		},
287		replaceParamVal(paramName, replaceWith, isRefresh) {
288			var oUrl = location.href.toString();
289			if (paramName && replaceWith) {
290//				if (oUrl.indexOf(paramName + "=" + replaceWith) > 1) {
291//					return;
292//				}
293			}
294			if (oUrl.indexOf(''+paramName+'=') > 0) {
295				var re = eval('/(' + paramName + '=)([^&]*)/gi');
296				var nUrl = oUrl.replace(re, ''+paramName + '=' + replaceWith);
297			} else {
298				if (oUrl.indexOf("?") > 0) {
299					var nUrl = oUrl + "&" + paramName + "=" + replaceWith;
300				} else {
301					var nUrl = oUrl + "?" + paramName + "=" + replaceWith;
302				}
303			}
304			// this.location = nUrl;
305			if (isRefresh) {
306				window.location.href = nUrl
307			}
308			var stateObject = { id: "" };
309			var title = "";
310			this.activeUrl = nUrl
311			history.replaceState(stateObject, title, nUrl);
312		},
313		replacePurchaseWebsite(url1,url2){
314			return this.activeUrl.replace(url1,url2)
315		},
316		outputmoney(value,currency){
317			 if (!value && value !== 0) return '-';
318		      var intPart = Number(value) | 0; //获取整数部分
319		      var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); //将整数部分逢三一断
320		  
321		      var floatPart = ".00"; //预定义小数部分
322		      var value2Array = value.toString().split(".");
323		  
324		      //=2表示数据有小数位
325		      if (value2Array.length == 2) {
326		          floatPart = value2Array[1].toString(); //拿到小数部分
327		  
328		          if (floatPart.length == 1) { //补0,实际上用不着
329			      		if(this.currency.value == 'ARS'){
330			      			 const v1 = intPartFormat;
331		      				 const v2 = v1.replace(/\,/g, '.')
332		      				 return this.currency.symbol + v2
333			      		}else if(this.currency.value == 'CZK'){
334			      			 return intPartFormat + "." + floatPart + '0' + this.currency.symbol;
335			      		}else if(this.currency.value == 'IRR'){
336			      			 return this.currency.symbol + intPartFormat;
337			      		}else{
338				             return this.currency.symbol + intPartFormat + "." + floatPart + '0';
339			      		}
340		          } else {
341		        	  if(this.currency.value == 'ARS'){
342			      			 const v1 = intPartFormat;
343		      				 const v2 = v1.replace(/\,/g, '.')
344		      				 return this.currency.symbol + v2
345			      		}else if(this.currency.value == 'CZK'){
346			      			 return intPartFormat + "." + floatPart+this.currency.symbol;
347			      		}else if(this.currency.value == 'IRR'){
348			      			 return this.currency.symbol + intPartFormat;
349			      		}else{
350			      			 return this.currency.symbol + intPartFormat + "." + floatPart;
351			      		}
352		          }
353		      } else {
354		    	  if(this.currency.value == 'ARS'){
355		      			 const v1 = intPartFormat;
356	      				 const v2 = v1.replace(/\,/g, '.')
357	      				 return this.currency.symbol + v2
358		      		}else if(this.currency.value == 'CZK'){
359		      			 return intPartFormat + floatPart+this.currency.symbol;
360		      		}else if(this.currency.value == 'IRR'){
361		      			 return this.currency.symbol + intPartFormat;
362		      		}else{
363		      			 return this.currency.symbol+intPartFormat + floatPart;
364		      		}
365		      }
366		},
367		changePicByJquery(sku){
368			var img1 = sku.skuImagePartList
369			var img3 = sku.skuImageAngleList
370			
371			var imageTotal = sku.imageTotal
372			if(this.currentSeriesView){
373				if(imageTotal && imageTotal.length > 0){
374					$('#productJsDiv .pic000-left').each((idx,ele)=>{
375						$(ele).html(`<img src="${imageTotal[idx]}?imageView2/2/format/webp/interlace/1" alt="Dxracer-Detail-${idx}" class="">`)
376					})
377					
378					$('#productJsDiv .pic000-right').each((idx,ele)=>{
379						$(ele).html(`<img style="width: 80px" src="${imageTotal[idx]}?imageView2/2/format/webp/interlace/1/w/120" alt="Dxracer-Detail-${idx}" class="">`)
380					})
381					
382				}else{
383					if(this.currentSeriesView.imageSelling1){
384						var imageTotalSeries = this.currentSeriesView.imageSelling1.split(",")
385						
386						$('#productJsDiv .pic000-left').each((idx,ele)=>{
387							$(ele).html(`<img src="${imageTotalSeries[idx]}?imageView2/2/format/webp/interlace/1" alt="Dxracer-Detail-${idx}" class="">`)
388						})
389						
390						$('#productJsDiv .pic000-right').each((idx,ele)=>{
391							$(ele).html(`<img style="width: 80px" src="${imageTotalSeries[idx]}?imageView2/2/format/webp/interlace/1/w/120" alt="Dxracer-Detail-${idx}" class="">`)
392						})
393					}
394					
395				}
396			}
397			
398			$('#productJsDiv .pic360').empty()
399			for(var i=0;i<img3.length;i++){
400				if(img3 && img3.length>0){
401					$('#productJsDiv .pic360').append(`<img src="${img3[i]}?imageView2/2/w/820/format/webp/interlace/1" alt="Dxracer-${i}" class="${i==0?'active':''}">`)
402				}
403			}
404			$('#productJsDiv .view-360').click()
405			
406//			var video = sku.skuVideo
407//			$('#productJsDiv .view-video').hide()
408//			$('#productJsDiv .product_video').hide()
409//			$('#productJsDiv .carousel-video').hide()
410			
411			$('#productJsDiv .product_vr').hide()
412			$('#productJsDiv .carousel-vr').hide()
413			if(this.currentSeriesView){
414				
415				if(this.currentSeriesView.vrUrl){
416					$('#productJsDiv .product_vr').html('<iframe src="'+this.currentSeriesView.vrUrl+'" style="width:100%; height:100%;" frameborder="0" allowfullscreen></iframe>')
417					$('#productJsDiv .product_vr').show()
418					$('#productJsDiv .carousel-vr').show()
419				}
420				
421			}
422		},
423		changeSkuMainImage(idx,attrValueId,type){
424			let currentSku = this.filterOptionsVal(idx,attrValueId)
425			const current = this.skuListImage.find(row=>row.id === currentSku.id)
426			if(type == 'in'){
427				const images = this.record.find(k=>k.id === currentSku.id).skuImageAngleList
428				if(images.length > 7){
429					current['img'] = images[7]
430				}else{
431					current['img'] = this.record.find(k=>k.id === currentSku.id).skuImageMain
432				}
433			}else{
434				current['img'] = this.record.find(k=>k.id === currentSku.id).skuImageMain
435			}
436		},
437		showSKuMainImage(idx,attrValueId){
438			let currentSku = this.filterOptionsVal(idx,attrValueId)
439			return this.skuListImage.find(row=>row.id === currentSku.id).img+'?imageView2/2/format/webp/interlace/1/w/250'
440		},
441		showChangeDetail(idx,attrValueId){
442			let currentSku = this.filterOptionsVal(idx,attrValueId)
443			return currentSku.skuTitle
444		},
445		selectCurrentSkuReviews(skuId,seriesId){
446			axios.get('/api/biz/b2c-us/api/website/order-evaluation/random?skuId='+skuId+'&seriesId='+seriesId)
447			.then(({data})=>{
448				if(null != data.data && null != data.data.top10 && data.data.top10.length > 0){
449					this.currentSkuReviews = data.data.top10
450				}
451			})
452		},
453		addCart(skuId,quantity){
454			if(quantity>0){
455				quantity = this.showCartQuantity(skuId)+1
456			}else{
457				quantity = this.showCartQuantity(skuId)-1
458			}
459			axios.get('/cart/add?skuId='+skuId+'&quantity='+quantity)
460			.then(()=>{
461				 location.reload()
462			}).catch(()=>{
463				location.reload()
464			})
465		},
466		getCart(){
467			axios.get('/cart/list')
468					.then(({data})=>{
469						 this.cartList = data.data
470					})
471		},
472		showCartQuantity(skuId){
473			return this.cartList.find(t=>
473t.id== skuId)?.qty||0
474		},
475		dateFormartArs(value){
476			const arr = value.split("/")
477			const day = arr[1]
478			const month = arr[0]
479			const year = arr[2]
480			return day+"/"+month+"/"+year
481		},
482		dateFormart(value,storeCurrency){
483			if(storeCurrency == 'EUR' || storeCurrency == 'CZK'){
484				const arr = value.trim().split("/")
485				const day = arr[1]
486				const month = arr[0]
487				const year = arr[2]
488				return day+"."+month+"."+year
489			}else{
490				return value
491			}
492		}
493	},
494	created(){
495		this.initImageList()
496		this.clearVariables()
497		this.replaceParamVal('sku',this.activeSku.skuCode,false)
498		this.getCart()
499		this.initGiftList()
500		this.initSkuGiftList()
501		this.initVariableColorList()
502		this.initAccessory()
503	}
504})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.