提供跨境爆品供应、资质证书、品牌授权、海外仓一件代发等跨境电商一站式服务
关于公司信息和数据被盗用的严正声明
提供跨境爆品供应、资质证书、品牌授权、海外仓一件代发等跨境电商一站式服务
抱歉,当前商品不存在
去首页逛逛
`) } else { window.open(url, name); } }, /** * 为用户生成下载验证码 */ async getCheckDigit(){ const loading = this.$loading({ lock: true, text: '正在获取验证码', spinner: 'el-icon-loading', background: 'rgba(255, 255, 255, 0.7)' }); return $http.get(`shop_api/products/get_customer_package_verify_code/${this.product_id}`).then((res) => { if (res.status == "success") { this.identifyCode = res.data.verify_code this.$nextTick(() => { this.random_num_code_show = true }) } else if (res.status == "error") { this.$JComMsg.warning(res.message || '获取验证码失败') } else { this.$JComMsg.warning('获取验证码失败') } }).catch(err => { console.error('获取验证码失败,网络出了点小差') }).finally(() => { loading.close() }) }, /** * 下载请求 */ async downloadAsync() { const code = this.$refs.randomCodeCheck.getCode() if (!code) { this.$JComMsg.warning('验证码错误') return } this.random_num_code_show = false // 图包 const certificate_class = this.download_certificate_list.map(item => { if (item.selected === 1) { return item.id } return undefined }).filter(item => !!item) // 证书 let package_reqData = {} this.download_data_package_list.forEach((item) => { if (item.selected == 1) { package_reqData[item.attribute] = item.selected } }) const reqData = { product_id: this.product_id, certificate_class: certificate_class.join(','), sku_id: this.skuData.id, verify_code: code, ...package_reqData, } const loading = this.$loading({ lock: true, text: '正在获取文件列表', spinner: 'el-icon-loading', background: 'rgba(255, 255, 255, 0.7)' }); $http.get('/shop_api/products/newDownloadImages', reqData).then(async (res) => { if (res.status == 'success') { const zip = new ZipPackage({ start: (total) => { this.load_total = total }, done: ({ errorUrls, successUrls }) => { if (errorUrls.length > 0) { this.$JComMsg.warning(`总共文件数${this.load_total}(${successUrls.length}下载成功,${errorUrls.length}下载失败)`) } this.load_total = 0 this.load_total_done = 0 this.$message.success('下载完成') this.dowShow = false }, oneSuccess: () => { this.load_total_done = this.load_total_done + 1 }, oneError: () => { this.load_total_done = this.load_total_done + 1 } }) const formatFile = this.formatFileFun(res.data) console.log(formatFile) zip.run(formatFile, `商品数据包_${new Date().getTime()}`) } else if (res.status === 'error') { this.$JComMsg.warning(res.message || '获取文件列表失败') } else { this.$JComMsg.warning('获取失败') } }).catch(err => { console.error(err) this.$JComMsg.warning('获取失败(网络出了点小差)') }).finally(() => { loading.close() }) }, formatFileVersion(versionData){ const folderNameMap = { image: '商品图包', tag: '一体化标签', hexahedral: '产品六面图', instruction: '产品使用说明书', copywriting: '产品文案', epr: 'EPR包装法证书', protocol: '英代欧代美代土代协议', video: '视频', protocol_reference_pic: 'TEMU英代欧代美代土代填写参考图', certificate: '证书', real_pic_tag: '实拍图附一体化标签', } const folderMapCertificate_DNC = { ndc_certificate: "NDC配套资质证书", ndc_tag: "一体化标签", ndc_diagram: "实物图" } const eprMap = { france_epr: '法国EPR', germany_epr: '德国EPR', } const list = [] for (let folderEN in versionData) { const folderData = versionData[folderEN] let children = [] if (isObject(folderData)) { if (folderEN === 'certificate') { const certificateData = folderData Object.keys(certificateData).forEach(certificateEN => { children.push({ type: 'folder', fileName: certificateEN, children: certificateData[certificateEN].map(file => { return { type: 'file', fileName: file.name, url: file.url, } }) }) }) } else if (folderEN === 'epr') { for (let en in folderData) { if (folderData?.[en]?.length) { children.push({ type: 'folder', fileName: eprMap[en], children: folderData[en].map(item => { return { type: 'file', fileName: item.name, url: item.url, } }) }) } } } } else if (isArray(folderData)) { folderData.forEach(file => { children.push({ type: 'file', fileName: file.name, url: file.url, }) }) } list.push({ type: 'folder', fileName: folderNameMap[folderEN], children: children, }) } console.log(JSON.parse(JSON.stringify(list))) return list }, formatFileFun(data){ let list = [] if (data?.instruction?.length > 0) { for (let item of data.instruction) { list.push({ type: 'file', fileName: item.name, url: item.url }) } } const folderMapV = { v1: '版本1', v2: '版本2', } for (let v in data) { if (v in folderMapV) { list.push({ type: 'folder', fileName: folderMapV[v], children: this.formatFileVersion(data[v]), }) } } return list }, changePick(pick) { this.pick = { ...this.pick, ...pick, } if (pick.delivery_region_id) { this.getWarehouseAddress() } }, /** * 获取仓库地址 */ async getWarehouseAddress() { const delivery_region_id = this.pick?.delivery_region_id if (!delivery_region_id || delivery_region_id === 5) { this.detailTabList = this.detailTabList.map(item => { if (item.name === '仓库地址') { if (this.detailInfoSelected === item.name) { this.detailInfoSelected = '图文详情' } item.show = false } return item }) return } this.detailTabList = this.detailTabList.map(item => { if (item.name === '仓库地址') { item.show = true } return item }) if (this.WarehouseAddress_html_map?.[delivery_region_id]) { return } const helpId_map = { 3: 52, // 美国 13: 59, // 英国 14: 59, // 欧盟 1: 51, // 印尼 2: 51, // 泰国 4: 51, // 马来西亚 6: 51, // 菲律宾 9: 51, // 越南 10: 35, // 欧洲 15: 35, // 新西兰 12: 49, // 加拿大 19: 60, // 日本 16: 149, // 俄罗斯 } if (!helpId_map?.[delivery_region_id]) { console.error('没有设置对应详情id') return } this.tab_loading = true $http.get(`shop_api/helper/get_one_content/${helpId_map[delivery_region_id]}`).then((res) => { if (res.status == 'success') { const content = res.data.content this.WarehouseAddress_html_map[delivery_region_id] = content } }).catch(err => { console.error(err) }).finally(() => { this.tab_loading = false }) }, /** * 获取售后条款 */ async getAftersalesTerms() { if (this.aftersalesTerms_html) { return } this.tab_loading = true $http.get('shop_api/helper/get_one_content/41').then((res) => { if (res.status == 'success') { this.aftersalesTerms_html = res.data.content } }).catch(err => { console.error(err) }).finally(() => { this.tab_loading = false }) }, /** * 获取sku批次号 */ getRequestBatchNumber() { const reqData = { sku_id: this.skuData.id } this.batchNumber_list = [] $http.get('shop_api/products/get_batch_number', reqData).then((res) => { if (res.status == 'success') { if (!res.data.numbers?.length) { this.detailTabList = this.detailTabList.map(item => { if (item.name === '产品批次号') { if (this.detailInfoSelected === item.name) { this.detailInfoSelected = '图文详情' } item.show = false } return item }) } else { this.detailTabList = this.detailTabList.map(item => { if (item.name === '产品批次号') { item.show = true } return item }) } let arr = res.data.numbers for (let i = 0; i < arr.length; i+=20) { this.batchNumber_list.push(arr.slice(i,i+20)) } } }) }, /** * 收藏 */ collection(item, product_ids, field_name, action) { gtag('event','ProductCollectClick') let url let param let method if (action === 'add') { url = '/shop_api/wishlist/add' method = 'post' param = { product_ids, } } else { url = '/shop_api/wishlist/remove' method = 'delete' param = { product_ids, } } $http[method](url, param).then((res) => { if (res.status === 'success') { window.$vueInstance.layoutHeaderMenu.initUserCountWish() item[field_name] = item[field_name] === 0 ? 1 : 0 // this.$JComMsg.success(res.message) } else if (res.status === 'error') { this.$JComMsg.warning(res.message) } else { this.$JComMsg.warning('失败') } }) }, /** * 获取其他数据 */ getRequestPackageList(){ const reqData = { sku_id: this.skuData.id, } $http.get(`/shop_api/certificate/list`, reqData).then(res => { if(res.status=="success"){ const data = res.data this.data_package_list = data.boxes this.certificate_list = data.certificate_assorts } }) }, /** * 获取其他数据 */ getOtherInfo(){ const reqData = { product_id: this.product_id, locale: localStorage.getItem('locale'), } $http.get(`/shop_api/products/getpicture`, reqData).then(res => { if(res.status=="success"){ const data = res.data this.recommend_list = data.recommend; this.attribute_list = data.attribute; } }) }, // detailAsync() { // const reqData = { // product_id: this.product_id, // } // $http.get('/shop_api/products/detail', reqData).then(res => { // if (res.status === 'success') { // const productDetail = res.data // } // }) // }, // 获取店铺列表 async getShopList() { try { const res = await $http.get('/shop_api/store/list') const defaultItem = {id: 0, store_id: "", store_name: "" } this.storeInformationList[0].stores = res?.data[1] || [{...defaultItem, dataId: 1}] this.storeInformationList[1].stores = res?.data[2] || [{...defaultItem, dataId: 2}] this.storeInformationList[2].stores = res?.data[3] || [{...defaultItem, dataId: 3}] } catch(e) { } }, // 添加店铺 addMoreStore (index) { this.storeInformationList[index].stores.push({id: 0, dataId: new Date().getTime(), store_id: '', store_name: '' }); }, // 删除店铺 deleteStore(item, sonIndex) { const id = item.stores[sonIndex].id item.stores.splice(sonIndex, 1) id && this.storeDelteIds.push(id) }, // 提交店铺信息 async submitStoreInformation () { this.showCheckTip = false const lists = [] const delIdList = [] for (let index = 0; index < this.storeInformationList.length; index++) { const item = this.storeInformationList[index]; for (let idx = 0; idx < item.stores.length; idx++) { const {dataId, customer_store_platform_name, ...args} = item.stores[idx]; args.customer_store_platform_id = index + 1; if(args.store_id && !args.store_name) { this.$JComMsg.warning(`${item.name}-店铺${idx+1}-名称不能为空`) return; } if(args.store_name && !args.store_id) { this.$JComMsg.warning(`${item.name}-店铺${idx+1}-ID不能为空`) return; } if(args.store_name.length > 100 || args.store_id.length > 100) { this.$JComMsg.warning(`${item.name}-店铺${idx+1}-名称或ID长度不能超过100`) return; } if(args.store_id && args.store_name) { lists.push(args) } if(!args.store_id && !args.store_name && args.id) { delIdList.push(args.id) } } } if(!lists.length) { this.showCheckTip = true return; } await Promise.all([...delIdList,...this.storeDelteIds].map(id => this.silentDelete(id))) const res = await $http.post('/shop_api/store/save', {lists}) if(res.status == 'success') { this.storeInformationDialogShow = false this.$JComMsg.success('保存成功') this.getShopList() } }, // 静默删除店铺 async silentDelete(id) { await $http.delete("/shop_api/store/delete", {id}) }, closeStoreInformation() { this.storeInformationList.forEach(i => { i.stores = [{id: 0, store_id: '', store_name: '' }] }) this.storeDelteIds = [] this.storeInformationDialogShow = false }, // 校验是否第一次勾选英代欧代美代协议 checkProtocol() { return $http.get('/shop_api/store/checkProtocol').then(res => { this.is_first = res.data.is_first if(this.is_first) { this.getShopList() this.storeDelteIds = [] this.storeInformationDialogShow = true } return res.data.is_first }) }, changeQuestionType() { this.certificateApply.form.assorts = [] this.certificateApply.form.productDataType = 0 this.certificateApply.form.remark = '' }, handleCertificate() { this.dowShow = false this.certificateApply.show = true this.certificateApply.is_success = false this.certificateApply.form.productName = this.product.name this.certificateApply.form.skuId = this.skuData.id this.certificateApply.form.sku = this.skuData.sku this.certificateApply.form.productId = this.product.id this.certificateApply.form.questionType = 0 this.certificateApply.form.productDataType = 0 this.certificateApply.form.assorts = [] this.certificateApply.form.remark = '' this.getCertificateAssortsAsync() }, changeProductDataType(v, disabled = false) { if (disabled) return if (this.certificateApply.form.productDataType !== v) { this.certificateApply.form.productDataType = v } else { this.certificateApply.form.productDataType = 0 } }, getCertificateAssortsAsync() { this.certificateApply.form.assorts = [] const form = this.certificateApply.form if (!form.skuId) { return } const loading = this.$loading({ lock: true, text: '', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' }); const param = { skuId: form.skuId, } $http.get('/shop_api/package/base', param).then((res) => { if (res.status == 'success') { const { lack, error } = res.data this.questionType_options[0].assorts_options = lack?.assorts || [] this.questionType_options[0].productDataType_options = lack?.productDataTypes || [] this.questionType_options[1].assorts_options = error?.assorts || [] this.questionType_options[1].productDataType_options = error?.productDataTypes || [] this.certificateApply.form.questionType = 1 } else if (res.status === 'error') { this.$JComMsg.warning(res.message || '获取申请数据失败') } else { this.$JComMsg.warning('获取申请数据失败(出错)') } }).catch(err => { this.$JComMsg.warning('获取申请数据失败(网络出了点小差)') console.error(err) }).finally(() => { loading.close() }) }, /** * 资质证书申请提交 */ certificateApplyAsync() { const form = JSON.parse(JSON.stringify(this.certificateApply.form)) if (!form.skuId || !form.productId) { this.$JComMsg.warning('表单不完整') return } if (!form.questionType) { this.$JComMsg.warning('请先完善问题类型') return } if (!form.productDataType && form.assorts.length < 1) { this.$JComMsg.warning('请先选择申请数据') return } if (!form.remark) { this.$JComMsg.warning('请先完善备注') return } const loading = this.$loading({ lock: true, text: '', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)', }); $http.post('/shop_api/package/apply', form).then((res) => { if (res.status == 'success') { // this.$JComMsg.success('您的申请已提交成功') this.certificateApply.is_success = true this.certificateApply.show = false } else if (res.status === 'error') { this.$JComMsg.warning(res.message || '提交申请失败') } else { this.$JComMsg.warning('提交申请失败(出错了)') } }).catch(err => { this.$JComMsg.warning('提交申请失败(网络出了点小差)') console.error(err) }).finally(() => { loading.close() }) }, /** * 放大镜 */ bindMagnifier() { const originalImage = document.getElementById('original-image'); const magnifier = document.getElementById('magnifier'); const magnifiedImageBox = document.getElementById('magnified-image-box'); const magnifiedImage = document.getElementById('magnified-image'); originalImage?.addEventListener('mousemove', function (e) { // scale 放大倍数 const rect = originalImage.getBoundingClientRect(); const magnifierRect = magnifier.getBoundingClientRect(); const magnifiedImageBoxRect = magnifiedImageBox.getBoundingClientRect(); const scale = magnifiedImageBoxRect.width / magnifierRect.width magnifiedImage.style.width = (rect.width * scale) + 'px' magnifiedImage.style.height = (rect.height * scale) + 'px' let max_left = rect.width - magnifierRect.width let max_top = rect.height - magnifierRect.height magnifier.style.display = 'block'; magnifiedImageBox.style.display = 'block'; const x = e.clientX - rect.left; const y = e.clientY - rect.top; let m_left = x - magnifier.offsetWidth / 2 let m_top = y - magnifier.offsetHeight / 2 m_left = Math.max(0, m_left) m_top = Math.max(0, m_top) m_left = Math.min(max_left, m_left) m_top = Math.min(max_top, m_top) magnifier.style.left = m_left + 'px'; magnifier.style.top = m_top + 'px'; let left = magnifierRect.left - rect.left let top = magnifierRect.top - rect.top left = Math.max(0, left) top = Math.max(0, top) magnifiedImage.style.left = `-${left * scale}px` magnifiedImage.style.top = `-${top * scale}px` }); originalImage?.addEventListener('mouseleave', function () { magnifier.style.display = 'none'; magnifiedImageBox.style.display = 'none'; }); }, //跳转品牌页 toPage(id){ window.open(`/products/all?brand_id=${id}`) } } })
OSZAR »