1class ScriptDetailButtonInquiry extends Script { 2 constructor(params) { 3 super(params) 4 this.$dom = document.querySelector(`#${this.attrId}`) 5 this.$btn = this.$dom.querySelector(`.unit-detail-button-inquiry`) 6 this.$form = this.$dom.querySelector(`#inquiry-${this.attrId}`) 7 this.modal = null 8 this.info = window.app.info 9 this.$btn_match_products = this.$dom.querySelector(`.unit-detail-match-product-inquiry`) 10 this.$btn_together = this.$dom.querySelector(`.unit-detail-button-buytogether`) 11 this.$priceDoms = null 12 } 13 init() { 14 this.$priceDoms = document.querySelector('.unit-detail-product-match') 15 this.initModal() 16 this.initBtnEvent() 17 this.$btn_match_products = this.$dom.querySelector(`.unit-detail-match-product-inquiry`) 18 if(this.$btn_match_products) { 19 this.initmatchProsuctsBtnEvent() 20 } 21 } 22 initBtnEvent() { 23 this.$btn.addEventListener('click', () => { 24 this.info.isMatchProducts = false 25 // æå 访é®è®°å½ 26 this.utilts.setInquiryRecord('inquiry_jump').then(res => console.log(res.msg)) 27 this.info.addProductInquire(this.info.page) 28 this.info.removeTempProductPage() 29 this.info.renderInquiryProduct() 30 this.modal.open() 31 }) 32 } 33 initmatchProsuctsBtnEvent() { 34 this.$btn_match_products.addEventListener('click', () => { 35 this.info.isMatchProducts = true 36 // æå 访é®è®°å½ 37 this.utilts.setInquiryRecord('inquiry_jump').then(res => console.log(res.msg)) 38 this.info.addProductInquire(this.info.page) 39 this.info.removeTempProductPage() 40 this.info.renderInquiryProduct() 41 this.modal.open() 42 }) 43 } 44 initModal() { 45 this.modal = new Modal() 46 const $modal = this.$dom.querySelector('.inquiry-modal-inner') 47 if (!$modal) return 48 this.modal.init({ 49 body: $modal, 50 title_style: 1, 51 title: window.app.utilts.$t('Free Quote & Information Request'), 52 size: 'lg', 53 className: 'inquiry-modal', 54 onSubmit: () => { 55 $modal.querySelector(`.btn`).click() 56 } 57 }) 58 } 59 render() { 60 if (window.app.info.productDetail.config.button_authority.includes('inquiry')) { 61 this.$btn.classList.add('show') 62 const isOrderOpen = window.app.info.productDetail.config.button_authority.includes('order') 63 let showBuyTogether = isOrderOpen && window.app.info.productDetail.min_price > 0 && this.$btn_together 64 if (this.$btn_match_products) { 65 this.$btn_match_products.classList.add('show') 66 } 67 if (!showBuyTogether && this.$priceDoms) { 68 this.$priceDoms.classList.add('no-price') 69 } 70 } 71 } 72}
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.