var prod_file = function (option) { var sets = { //類型 type: '1', //1->列表,2->詳細頁,3->活動詳細頁,4.一頁式購物, 5.快速購物跳窗 pageType: 'common', //common || quickshop action: 'poducts', //頁面類型 mode: '', //PreVice時為預覽模式 //商品內容 contBox: 'content', //總容器的class itemBox: 'productBox', //商品容器的class nameBox: 'nameBox', //商品名稱的class prodnoBox: 'prodnoBox', //商品編號的class loveBox: 'product-love', //喜愛清單的class pricebox: 'pricebox', //定價+結帳價的class price2Box: 'font-delete', //定價的class PriceName1: 'PriceName1', //結帳價的名稱 price1Box: 'font-big', //結帳價的class priceBlock: 'priceBlock', //結帳價的block AvgPriceBox: 'AvgPriceBox', //平均售價div的class AvgPrice: 'AvgPrice', //平均售價span的class PopPrice3: 'pop_main_price3', //跳窗會員價的class PopPrice2: 'pop_main_price2', //跳窗定價的class PopPrice1: 'pop_main_price1', //跳窗結帳價的class PopDiffPrice: 'pop_main_price_diff', //跳窗省多少元的class rbonusBox: 'price-rbonus', //紅利兌換的class bonusBox: 'get_bonus', //購物金的class colorBox: 'colorbox', //顏色的class colorSelect: 'color-select', //顏色下拉的class colorName: 'Spec_Name1', //顏色名稱的class sizeBox: 'sizebox', //尺寸-按鈕的class sizeSelect: 'size-select', //尺寸-下拉的class sizeName: 'Spec_Name2', //尺寸名稱的class sp3Box: 'sp3box', //規格三-按鈕的class sp3Select: 'sp3-select', //規格三-下拉的class sp3Name: 'Spec_Name3', //規格三名稱的class numBlock: 'amountBlock', //數量的區塊 amountBox: 'amountBox', //數量的class stockBox: 'stockBox', //庫存的class picpathBox: 'productImg', //主圖片的class picBox: 'owl-carousel', //圖片容器的class specClass: 'checkbox-item', //規格 -按鈕的class specWrap: '.popup-choice', //規格 -按鈕外層的class specID2: 'SID', //規格 -要傳送的標籤屬性 specUrl: Project_Country + 'products/ajax/common/ajax_get_prod_item.php', //規格 -ajax網址 sale_msg: 'sale_msg', //規格的特惠訊息 sale_msg_box: 'salebox', //規格的特惠訊息容器 Wear_Report: 'Wear_Report', //試穿報告 ActStrBox: 'sale-string', //規格活動小字 ActImgBox: 'sale-img', //規格活動圖片 PreTypeBox: 'Pre_Type', //是不是預購品顯示 PreDataBox: 'Pre_Data', //預購到貨時間顯示 PopupBtn1: 'PopupBtn1', //購買跳窗-加入購物車按鈕容器 PopupBtn2: 'PopupBtn2', //購買跳窗-立即結帳按鈕容器 FixedButton: '.FixedButton', //手機版固定選單按鈕 Limit_Purchase_Text: 'Limit_Purchase_Text', //限購文字 ShippingFee_Free_Text: 'ShippingFee_Free_Text', //免運文字 Limit_Purchase_Text_Tips: 'limit-purchase-tips', //限購文字 ShippingFee_Free_Text_Tips: 'shipping-fee-free-tips', //免運文字 //加入購物車 addButton: 'add_to_cart', //加入購物車按鈕的class addButtonIn: 'add_to_cart_In', //直接購買按鈕的class addUrl: Project_Country + 'ajax/ajax_add_to_cart.php', //加入購物車網址 addBox: 'Add_Button', //加入購物車按鈕的容器 addBoxIn: 'Add_Button_In', //直接購買的容器 ordButton: 'button1', //選購按鈕(行銷) //補貨通知 informBtn: 'informButton', //補貨通知按鈕的class informSend: 'informSend', //送出按鈕的ID informID: 'informID', //存ID欄位的ID informEmail: 'informEmail', //Email欄位的ID informClose: 'informClose', //關閉按鈕的ID informUrl: Project_Country + 'products/ajax/common/ajax_add_prod_inform.php', //ajax網址 //wishList loveButton: 'product-love', //列表加入喜愛清單 wishUrl: Project_Country + 'products/ajax/common/ajax_add_wish_list.php', //ajax網址 //設定圖片 mobileUrl: Project_Country + 'products/ajax/detail/productView_moblie.php', //ajax手機網址 pcUrl: Project_Country + 'products/ajax/detail/productView_pc.php', //ajax桌機網址 otherData: '' }; $.extend(sets, option); var _this = this; //初始 this.init = function () { //點選規格 $("." + sets.contBox).on('click', "." + sets.specClass, function () { var _item = $(this).closest("." + sets.itemBox), SID = $(this).attr(sets.specID2), $this = $(this), ActID = $(this).data('aid'), Mark = $(this).data('mark'), Page_Shop_Type = ($("#Page_Shop_Type") ? $("#Page_Shop_Type").val() : _item.attr("type")); var data = 'Type=' + sets.type + '&SID=' + SID + '&ActID=' + ActID + '&Mark=' + Mark + '&mode=' + sets.mode + '&Page_Shop_Type=' + Page_Shop_Type + sets.otherData; if (SID) { $.ajax({ url: sets.specUrl, type: "POST", cache: false, async: false, data: data, dataType: 'json', error: function (d) { alert('網路連線過慢,網頁請重新整理'); }, success: function (d) { _this.setFile(_item, $this, d); console.log(d) // 顯示ajax規格切換叫回來的內容 } }); } }); //尺寸下拉選單 $("." + sets.contBox).on('change', "." + sets.colorSelect + ",." + sets.sizeSelect + ",." + sets.sp3Select, function () { var _item = $(this).closest("." + sets.itemBox), SID = $(this).val(), $this = $(this), ActID = $(this).data('aid'), Mark = $(this).data('mark'), Page_Shop_Type = _item.attr("type"); var data = 'Type=' + sets.type + '&SID=' + SID + '&ActID=' + ActID + '&Mark=' + Mark + '&mode=' + sets.mode + '&Page_Shop_Type=' + Page_Shop_Type + sets.otherData; if (SID) { $.ajax({ url: sets.specUrl, type: "POST", cache: false, async: false, data: data, dataType: 'json', error: function (d) { alert('網路連線過慢,網頁請重新整理'); }, success: function (d) { _this.setFile(_item, $this, d); } }); } }); //數量輸入 $("." + sets.contBox).on('keyup', "." + sets.amountBox, function () { var now_num = $(this).val(), max_num = $(this).attr('max'), max_limit = $(this).attr('limit'), min_num = (parseInt(max_num) > 0) ? 1 : 0; now_num = parseInt(now_num); min_num = parseInt(min_num); max_limit = parseInt(max_limit); $(this).val(now_num); if (now_num > max_limit && max_limit) { alert(_jsLang.一次最多只能加入 + max_num + _jsLang.個); $(this).val(max_limit); } else if (now_num > max_num) { alert(_jsLang.一次最多只能加入 + max_num + _jsLang.個); $(this).val(max_num); } if (now_num < min_num) { $(this).val(min_num); } if (isNaN(now_num)) { $(this).val(min_num); } }); //數量 $("." + sets.contBox).off("click.plus", "[class*=-plus]") $("." + sets.contBox).on("click.plus", "[class*=-plus]", function () { var amount = $(this).prev("." + sets.amountBox).val(), max = $(this).prev("." + sets.amountBox).attr("max"), limit = $(this).prev("." + sets.amountBox).attr("limit"); if (amount == '無庫存' || $(this).hasClass('Prod_Plus')) { return false; } var amount = parseInt(amount); var max = parseInt(max); var limit = parseInt(limit); if (amount + 1 > limit && limit) { alert(_jsLang.一次最多只能加入 + limit + _jsLang.個); $(this).prev("." + sets.amountBox).val(limit); } else if (amount + 1 > max) { alert(_jsLang.一次最多只能加入 + max + _jsLang.個); $(this).prev("." + sets.amountBox).val(max); } else { $(this).prev("." + sets.amountBox).val(amount + 1); } }); $("." + sets.contBox).off("click.minus", "[class*=-minus]") $("." + sets.contBox).on("click.minus", "[class*=-minus]", function () { var amount = $(this).next("." + sets.amountBox).val(), max = $(this).next("." + sets.amountBox).attr("max"), min = (parseInt(max) > 0) ? 1 : 0; if (amount == '無庫存' || $(this).hasClass('Prod_Minus')) { return false; } var amount = parseInt(amount); var min = parseInt(min); if (amount - 1 <= min) { $(this).next("." + sets.amountBox).val(min); } else { $(this).next("." + sets.amountBox).val(amount - 1); } }); //加入購物車按鈕 $("." + sets.contBox).off("click.add", "." + sets.addButton) $("." + sets.contBox).on("click.add", "." + sets.addButton, function () { var _item = $(this).closest("." + sets.itemBox), SID = $(this).attr('sid') || 0, type = $(this).data('type') || 'normal', leftAmount = $(this).attr("left_amount") || 'none', Add_Type = $(this).attr("page_shop_type"); if ($(this).data('aid')) { var ActID = $(this).data('aid'); } $this = $(this); if ($(this).parents().eq(0).attr('class') == 'Add_Button1') { var num = 1; } else if ($(this).hasClass('one_spec_add')) { var num = 1; } else if ($(this).closest(".select-btn-group").find("select").length == 2) { //加購單規格 var num = 1; } else { var num = _item.find("." + sets.amountBox).val() || 0; } if (SID == 0) { alert(_jsLang.請選擇尺寸或規格); //errorbox(); } else if (num == 0) { alert(_jsLang.請選擇數量); } else if (leftAmount >= 0 && num > leftAmount) { var msg = _jsLang?.只能再挑選X件商品 || '只能再挑選%s件商品'; alert(msg.replace("%s", leftAmount)); } else { var data = 'SID=' + SID + '&num=' + num + '&type=' + type + '&webcacheno=' + $('#webcacheno').val() + sets.otherData + '&Add_Type=' + Add_Type; if (ActID) { data += '&ActID=' + ActID; } $.ajax({ url: sets.addUrl, type: "POST", cache: false, async: false, data: data, dataType: 'json', error: function (d) { alert('網路連線過慢,網頁請重新整理'); }, success: function (d) { if (_item.hasClass('popupBox-wrapper')) { _item.remove() $('body').removeClass('overflow-hidden') } if (d.Pre_Flag == 1) { if (d.Stock <= 5) _item.find("." + sets.stockBox).html(_jsLang.預購品); } else { if (d.Stock > 0 && d.Stock <= 5) _item.find("." + sets.stockBox).html(_jsLang.庫存 + ' : ' + d.Stock); } if (d.Amount && d.Amount != 'null') _item.find("." + sets.amountBox).html(d.Amount); $(".cart-total").html(d.Total) if (d.Alert != 'OK') { alert(d.Alert); _this.afterAlert(d.Alert); } _this.setCartOther(d); if (d.Alert == 'OK') { console.log(sets.type) if (sets.type == '4') { $('.successPopupMask').css('display', 'flex').fadeIn() $('.successPopup').fadeIn() setTimeout(function () { $('.successPopupMask').fadeOut() $('.successPopup').fadeOut() }, 1100) } if (d.DataLayer) { eval(d.DataLayer); } // if(sets.type != '4' && typeof FloatCartPopup == 'function') { // FloatCartPopup({Type:'Prod',ID:SID,Act:'Add'}) // } // alert(_jsLang.加入購物車成功); AlertPop({ icon: '', string: _jsLang.加入購物車成功, }) } if (!$(this).hasClass('one_spec_add')) { _item.trigger("add_to_cart_success") } $.ajax({ url: sets.specUrl, type: "POST", cache: false, async: false, data: data, dataType: 'json', error: function (data) { alert('網路連線過慢,網頁請重新整理'); }, success: function (d1) { _this.setFile(_item, $this, d1); } }); } }); } }); //直接購物按鈕 $("." + sets.contBox).off("click.addIn", "." + sets.addButtonIn) $("." + sets.contBox).on("click.addIn", "." + sets.addButtonIn, function () { var _item = $(this).closest("." + sets.itemBox), SID = $(this).attr('sid') || 0, num = _item.find("." + sets.amountBox).val() || 0; type = $(this).data('type') || 'normal'; if (SID == 0) { alert(_jsLang.請選擇尺寸或規格); //errorbox(); } else if (num == 0) { alert(_jsLang.請選擇數量); //errorbox(); } else { var data = 'SID=' + SID + '&num=' + num + '&type=' + type + '&webcacheno=' + $('#webcacheno').val() + sets.otherData; $.ajax({ url: sets.addUrl, type: "POST", cache: false, async: false, data: data, dataType: 'json', error: function (d) { alert('網路連線過慢,網頁請重新整理'); }, success: function (d) { if (_item.hasClass('popupBox-wrapper')) { _item.remove() } if (d.Pre_Flag == 1) { if (d.Stock <= 5) _item.find("." + sets.stockBox).html(_jsLang.預購品); } else { if (d.Stock > 0 && d.Stock <= 5) _item.find("." + sets.stockBox).html(_jsLang.庫存 + ' : ' + d.Stock); } if (d.Amount && d.Amount != 'null') _item.find("." + sets.amountBox).html(d.Amount); $(".cart-total").html(d.Total) // 購物商品數量 if (d.Alert != 'OK') { alert(d.Alert); _this.afterAlert(d.Alert); } _this.setCartOther(d); // if(d.Alert == 'OK'){ // if(d.DataLayer){eval(d.DataLayer)} // FloatCartPopup({Type:'Prod',ID:SID}) // } if (d.RedirectUrl) { window.location.href = d.RedirectUrl; } else if (d.Alert == 'OK') { window.location.href = '/' + $("#Website_Language").val() + '/' + $("#Website_Mall_ID").val() + '/shopcart/step1' + ((type != 'normal') ? '/preorder' : '/single'); } } }); } }); //補貨通知按鈕 $("." + sets.contBox).off("click.inform", "." + sets.informBtn) $("." + sets.contBox).on("click.inform", "." + sets.informBtn, function () { // $("#" + sets.informID).val($(this).attr('SID')); }); $("#" + sets.informSend).off("click.informSend") $("#" + sets.informSend).on("click.informSend", function () { // var email = $("#" + sets.informEmail).val(); if (!email) { alert('請輸入E-mail'); return false; } var emailRule = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]+$/; if (email.search(emailRule) == -1) { alert('E-mail格式錯誤'); return false; } $.ajax({ url: sets.informUrl, type: "POST", cache: false, async: false, data: {SID: $("#" + sets.informID).val(), email: email}, error: function (d) { alert('網路連線過慢,網頁請重新整理'); }, success: function (d) { if (d == 'OK') { alert(_jsLang.您已成功新增一筆補貨通知當商品有貨時我們會儘快通知您); } else { alert(_jsLang.資料庫忙線中); } $("#" + sets.informClose).trigger("click"); } }); }); // 加入我的最愛 $("." + sets.contBox).off("click.love", "." + sets.loveButton) $("." + sets.contBox).on("click.love", "." + sets.loveButton, function () { const $this = $(this).find('.fa') const _item = $(this).parents("." + sets.itemBox) const SID = _item.find('.' + sets.loveBox).attr('sid') let type = 'del' if ($this.hasClass('fa-heart-o')) { type = 'add'; } $.ajax({ url: sets.wishUrl, type: "POST", cache: false, async: false, data: {Type: type, SID: SID}, dataType: 'json', error: function (d) { alert('網路連線過慢,網頁請重新整理'); }, success: function (d) { console.log(d) if (d.Msg == 'OK') { if (type == 'add') { try { if (d.DataLayer) { eval(d.DataLayer) } } catch (e) { } $this.removeClass("fa-heart-o"); $this.addClass("fa-heart"); alert(_jsLang.已加入喜愛清單); } else { $this.removeClass("fa-heart"); $this.addClass("fa-heart-o"); } } else if (d.Msg == 'NO_MEMBER') { alert(_jsLang.請先登入會員); } else { alert(_jsLang.資料庫忙線中); } } }); }); }; //設定內容 this.setFile = function (_item, $this, d) { _item.find("." + sets.loveBox).find('.fa').removeClass("fa-heart,fa-heart-o"); if (d.ID) _item.find("." + sets.ordButton).attr("sid", d.ID); if (d.ID) _item.find("." + sets.loveBox).attr("sid", d.ID); if (d.Name) _item.find("." + sets.nameBox).html(d.Name); if (d.Pos_No) _item.find("." + sets.prodnoBox).html(d.Pos_No); if (d.Love) _item.find("." + sets.loveBox).find('.fa').addClass(d.Love); if (d.Price_Name1) { _item.find("." + sets.PriceName1).html(d.Price_Name1); } if (d.Price1) { _item.find("." + sets.price1Box).html(d.Price1); _item.find("." + sets.priceBlock).show(); } else { _item.find("." + sets.priceBlock).hide(); } if (d.Price2) { _item.find("." + sets.price2Box).html(d.Price2).show(); } else { _item.find("." + sets.price2Box).hide(); } if (d.Avg_Price) { _item.find("." + sets.AvgPriceBox).show(); _item.find("." + sets.AvgPrice).html(d.Avg_Price); _item.find("." + sets.pricebox).hide(); } else { _item.find("." + sets.AvgPriceBox).hide(); _item.find("." + sets.pricebox).show(); } if (d.Price1) { _item.find("." + sets.PopPrice1).html(d.Main_Price1); } if (d.Price2) { _item.find("." + sets.PopPrice2).html(d.Main_Price2); } if (d.Price3) { _item.find("." + sets.PopPrice3).html(d.Main_Price3); } if (d.Price1_Diff) { _item.find("." + sets.PopDiffPrice).html(d.Price1_Diff); _item.find("." + sets.Price1_Diff).show(); } else { _item.find("." + sets.Price1_Diff).hide(); } if (d.RBonus) _item.find("." + sets.rbonusBox).html(d.RBonus); if (d.Get_Bonus) _item.find("." + sets.bonusBox).html(d.Get_Bonus); // if(d.Color)_item.find("."+sets.colorBox).html(d.Color); // if(d.Color_Name)_item.find("."+sets.colorName).html(d.Color_Name); _item.find("." + sets.PreTypeBox).html(d.Pre_Type); _item.find("." + sets.PreDataBox).html(d.Pre_Data); _item.find("." + sets.Limit_Purchase_Text).html(d.Limit_Purchase_Text); _item.find("." + sets.ShippingFee_Free_Text).html(d.ShippingFee_Free_Text); if(d.Limit_Purchase_Text){ _item.find("." + sets.Limit_Purchase_Text_Tips).removeClass('hide'); _item.find("." + sets.Limit_Purchase_Text_Tips + ' .tips-inner').html(d.Limit_Purchase_Text); }else{ _item.find("." + sets.Limit_Purchase_Text_Tips).addClass('hide'); } if(d.ShippingFee_Free_Text){ _item.find("." + sets.ShippingFee_Free_Text_Tips).removeClass('hide'); _item.find("." + sets.ShippingFee_Free_Text_Tips + ' .tips-inner').html(d.ShippingFee_Free_Text); }else{ _item.find("." + sets.ShippingFee_Free_Text_Tips).addClass('hide'); } if (d.sale_msg) { _item.find("." + sets.sale_msg).html(d.sale_msg); _item.find("." + sets.sale_msg_box).show() } else { _item.find("." + sets.sale_msg_box).hide() } // _item.find(".select-btn-group").html(d.ListButton); _item.find("." + sets.Wear_Report).html(d.Wear_Report); if (d.Stock) { _item.find("." + sets.stockBox).html(_jsLang.庫存 + ' : ' + d.Stock); _item.find('.popup-amount-box').removeClass('hide'); } else { _item.find("." + sets.stockBox).html(''); _item.find('.popup-amount-box').addClass('hide'); } if (d.Act_Str) { _item.find("." + sets.ActStrBox).html(d.Act_Str); _item.find("." + sets.ActStrBox).show(); } else { _item.find("." + sets.ActStrBox).html(''); _item.find("." + sets.ActStrBox).hide(); } if (d.Act_Img) { _item.find("." + sets.ActImgBox).html(d.Act_Img); _item.find("." + sets.ActImgBox).show(); } else { if (typeof (d.Act_Data_ID) == 'undefined' || d.Act_Data_ID.length == 0) { _item.find("." + sets.ActImgBox).html(''); _item.find("." + sets.ActImgBox).hide(); } } if (sets.type == 3) { if (d.Size_Sel) $this.next("." + sets.sizeSelect).html(d.Size_Sel); if (d.SP3_Sel) $this.nextAll("." + sets.sp3Select).eq(0).html(d.SP3_Sel); if (d.Amount) { $this.nextAll("." + sets.numBlock).eq(0).show(); $this.nextAll("." + sets.amountBox).eq(0).html(d.Amount); } else { $this.nextAll("." + sets.numBlock).eq(0).hide(); $this.nextAll("." + sets.amountBox).eq(0).html(''); } $this.nextAll("." + sets.amountBox).eq(0).trigger('change'); } else { if (d.Color_Button) _item.find("." + sets.colorBox + ', ' + sets.specWrap).html(d.Color_Button); if (d.Color_Sel) _item.find("." + sets.colorSelect).html(d.Color_Sel); if (d.Color_Name) _item.find("." + sets.colorName).html(d.Color_Name); if (d.Size_Button) _item.find("." + sets.sizeBox).html(d.Size_Button); if (d.Size_Sel) _item.find("." + sets.sizeSelect).html(d.Size_Sel); if (d.Size_Name) _item.find("." + sets.sizeName).html(d.Size_Name); if (d.SP3_Button) _item.find("." + sets.sp3Box).html(d.SP3_Button); if (d.SP3_Sel) _item.find("." + sets.sp3Select).html(d.SP3_Sel); if (d.SP3_Name) _item.find("." + sets.sp3Name).html(d.SP3_Name); if (d.Amount2 || d.Amount2 === 0) { _item.find("." + sets.numBlock).show(); _item.find("." + sets.amountBox).attr('max', d.Amount2); //已選值超過最大值,取最大值 if (_item.find("." + sets.amountBox).val() > d.Amount2) { _item.find("." + sets.amountBox).val(d.Amount2) } } else { _item.find("." + sets.numBlock).hide(); _item.find("." + sets.amountBox).html(''); } if (d.Amount) { _item.find("." + sets.numBlock).eq(0).show(); } if (d.Amount && _item.find("." + sets.amountBox).prop('tagName') == 'SELECT') { _item.find("." + sets.amountBox).eq(0).html(d.Amount); } _item.find("." + sets.amountBox).attr('limit', d.Limit_Purchase); } if (sets.type == 2) { $("." + sets.contBox).find("." + sets.loveButton).attr("sid", d.ID); $("." + sets.contBox).find("." + sets.loveButton).find(".fa").removeClass("fa-heart fa-heart-o"); $("." + sets.contBox).find("." + sets.loveButton).find(".fa").addClass(d.Love); if (d.Serial_No && sets.pageType == 'common' && sets.contBox !== "detail-addpurchase-item") { var new_url = '/' + $("#Website_Language").val() + '/' + $("#Website_Mall_ID").val() + '/product-detail/' + d.Serial_No; if (sets.mode) { new_url += '?mode=' + sets.mode; } window.history.replaceState({id: d.ID}, d.Name, new_url); } if (sets.mode) if (d.Community) $(".followbox").html(d.Community); } if (d.Prod_Multi) $(".Prod_Multi").html(d.Prod_Multi); for ($i = 1; $i <= 3; $i++) { var NewButton = d.Button[$i] || ''; _item.find("." + sets.addBox + $i).html(NewButton); } _item.find("." + sets.addBoxIn).html(d.Button2); _item.find("." + sets.PopupBtn1).html(d.ButtonPop); if (d.ButtonPop2) { if (_item.find("." + sets.PopupBtn2).length <= 0) { _item.find("." + sets.PopupBtn1).after('') } _item.find("." + sets.PopupBtn2).html(d.ButtonPop2); } else { _item.find("." + sets.PopupBtn2).empty() } _item.find(sets.FixedButton).replaceWith(d.FixedButton); _this.setImg(_item, d.Pic_Path, d.Pic, d.Video); _this.setFileOther(_item, d); if (d.Stock > 0) { _item.find(".soldout-cover").hide(); } else { _item.find(".soldout-cover").show(); } } //變更內容自訂Function this.setFileOther = function () { } //加入購物車後自訂Function this.setCartOther = function () { } // alert跳窗後動作 this.afterAlert = function () { } //設定圖片、影片 this.setImg = function (_item, Pic_Path, Pic, Video) { const List_Size = 'L_' const More_Size = 'S_' const ListImgPath = Project_Country + 'upload_files/fonlego-rwd/prodpic/' + List_Size + Pic_Path const pictureTarget = _item.find("." + sets.picpathBox) const moreviewTarget = _item.find("." + sets.picBox) const _Pic = (Pic_Path + ',' + Pic).split(',') const PicsCount = _Pic.filter(ele => !!ele).length; const previewItems = ['', ''] if (sets.type == 1) { //列表 pictureTarget.find('.center-box > img, .hover-box > img').attr('src', ListImgPath) } else if (sets.type == 4) { // 一頁式購物 _this.item_num = 5; let $Pic = '' let $Pic_Path = '' let now_class = 'now' let Pic_Size = 'S' let $loop = false for ($i = 0; $i < _Pic.length; $i++) { if (_Pic[$i]) { // $Pic_Path += '