14
package.json
14
package.json
@@ -3,10 +3,8 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint",
|
||||
"build-watch": "vue-cli-service --env.NODE_ENV=development build-watch --mode development"
|
||||
"dev": "vue-cli-service --env.NODE_ENV=development build-watch --mode development",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/g2plot": "^2.4.31",
|
||||
@@ -14,8 +12,11 @@
|
||||
"core-js": "^3.8.3",
|
||||
"dayjs": "^1.11.9",
|
||||
"element-ui": "^2.15.13",
|
||||
"v-viewer": "^1.6.4",
|
||||
"vue": "^2.6.14",
|
||||
"vue-cropper": "^0.6.4",
|
||||
"vue-json-excel": "^0.3.0",
|
||||
"vue-qr": "^4.0.9",
|
||||
"vue-router": "^3.2.0",
|
||||
"vuex": "^3.4.0",
|
||||
"vuex-persistedstate": "^4.1.0"
|
||||
@@ -26,11 +27,12 @@
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"copy-webpack-plugin": "^6.4.1",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^8.0.3",
|
||||
"javascript-obfuscator": "2.6.0",
|
||||
"sass": "^1.62.1",
|
||||
"sass-loader": "7.2.0",
|
||||
"sass": "^1.68.0",
|
||||
"sass-loader": "^7.3.1",
|
||||
"vue-cli-plugin-chrome-extension-cli": "~1.1.4",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"webpack-obfuscator": "2.6.0"
|
||||
|
||||
244
public/js/FileSaver.js
Normal file
244
public/js/FileSaver.js
Normal file
@@ -0,0 +1,244 @@
|
||||
/* FileSaver.js
|
||||
* A saveAs() FileSaver implementation.
|
||||
* 2014-11-29
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* License: X11/MIT
|
||||
* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
/*global self */
|
||||
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
|
||||
|
||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
|
||||
var saveAs = saveAs
|
||||
// IE 10+ (native saveAs)
|
||||
|| (typeof navigator !== "undefined" &&
|
||||
navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
|
||||
// Everyone else
|
||||
|| (function(view) {
|
||||
"use strict";
|
||||
// IE <10 is explicitly unsupported
|
||||
if (typeof navigator !== "undefined" &&
|
||||
/MSIE [1-9]\./.test(navigator.userAgent)) {
|
||||
return;
|
||||
}
|
||||
var
|
||||
doc = view.document
|
||||
// only get URL when necessary in case Blob.js hasn't overridden it yet
|
||||
, get_URL = function() {
|
||||
return view.URL || view.webkitURL || view;
|
||||
}
|
||||
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
|
||||
, can_use_save_link = "download" in save_link
|
||||
, click = function(node) {
|
||||
var event = doc.createEvent("MouseEvents");
|
||||
event.initMouseEvent(
|
||||
"click", true, false, view, 0, 0, 0, 0, 0
|
||||
, false, false, false, false, 0, null
|
||||
);
|
||||
node.dispatchEvent(event);
|
||||
}
|
||||
, webkit_req_fs = view.webkitRequestFileSystem
|
||||
, req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
|
||||
, throw_outside = function(ex) {
|
||||
(view.setImmediate || view.setTimeout)(function() {
|
||||
throw ex;
|
||||
}, 0);
|
||||
}
|
||||
, force_saveable_type = "application/octet-stream"
|
||||
, fs_min_size = 0
|
||||
// See https://code.google.com/p/chromium/issues/detail?id=375297#c7 and
|
||||
// https://github.com/eligrey/FileSaver.js/commit/485930a#commitcomment-8768047
|
||||
// for the reasoning behind the timeout and revocation flow
|
||||
, arbitrary_revoke_timeout = 500 // in ms
|
||||
, revoke = function(file) {
|
||||
var revoker = function() {
|
||||
if (typeof file === "string") { // file is an object URL
|
||||
get_URL().revokeObjectURL(file);
|
||||
} else { // file is a File
|
||||
file.remove();
|
||||
}
|
||||
};
|
||||
if (view.chrome) {
|
||||
revoker();
|
||||
} else {
|
||||
setTimeout(revoker, arbitrary_revoke_timeout);
|
||||
}
|
||||
}
|
||||
, dispatch = function(filesaver, event_types, event) {
|
||||
event_types = [].concat(event_types);
|
||||
var i = event_types.length;
|
||||
while (i--) {
|
||||
var listener = filesaver["on" + event_types[i]];
|
||||
if (typeof listener === "function") {
|
||||
try {
|
||||
listener.call(filesaver, event || filesaver);
|
||||
} catch (ex) {
|
||||
throw_outside(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
, FileSaver = function(blob, name) {
|
||||
// First try a.download, then web filesystem, then object URLs
|
||||
var
|
||||
filesaver = this
|
||||
, type = blob.type
|
||||
, blob_changed = false
|
||||
, object_url
|
||||
, target_view
|
||||
, dispatch_all = function() {
|
||||
dispatch(filesaver, "writestart progress write writeend".split(" "));
|
||||
}
|
||||
// on any filesys errors revert to saving with object URLs
|
||||
, fs_error = function() {
|
||||
// don't create more object URLs than needed
|
||||
if (blob_changed || !object_url) {
|
||||
object_url = get_URL().createObjectURL(blob);
|
||||
}
|
||||
if (target_view) {
|
||||
target_view.location.href = object_url;
|
||||
} else {
|
||||
var new_tab = view.open(object_url, "_blank");
|
||||
if (new_tab == undefined && typeof safari !== "undefined") {
|
||||
//Apple do not allow window.open, see http://bit.ly/1kZffRI
|
||||
view.location.href = object_url
|
||||
}
|
||||
}
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
revoke(object_url);
|
||||
}
|
||||
, abortable = function(func) {
|
||||
return function() {
|
||||
if (filesaver.readyState !== filesaver.DONE) {
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
, create_if_not_found = {create: true, exclusive: false}
|
||||
, slice
|
||||
;
|
||||
filesaver.readyState = filesaver.INIT;
|
||||
if (!name) {
|
||||
name = "download";
|
||||
}
|
||||
if (can_use_save_link) {
|
||||
object_url = get_URL().createObjectURL(blob);
|
||||
save_link.href = object_url;
|
||||
save_link.download = name;
|
||||
click(save_link);
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
revoke(object_url);
|
||||
return;
|
||||
}
|
||||
// Object and web filesystem URLs have a problem saving in Google Chrome when
|
||||
// viewed in a tab, so I force save with application/octet-stream
|
||||
// http://code.google.com/p/chromium/issues/detail?id=91158
|
||||
// Update: Google errantly closed 91158, I submitted it again:
|
||||
// https://code.google.com/p/chromium/issues/detail?id=389642
|
||||
if (view.chrome && type && type !== force_saveable_type) {
|
||||
slice = blob.slice || blob.webkitSlice;
|
||||
blob = slice.call(blob, 0, blob.size, force_saveable_type);
|
||||
blob_changed = true;
|
||||
}
|
||||
// Since I can't be sure that the guessed media type will trigger a download
|
||||
// in WebKit, I append .download to the filename.
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=65440
|
||||
if (webkit_req_fs && name !== "download") {
|
||||
name += ".download";
|
||||
}
|
||||
if (type === force_saveable_type || webkit_req_fs) {
|
||||
target_view = view;
|
||||
}
|
||||
if (!req_fs) {
|
||||
fs_error();
|
||||
return;
|
||||
}
|
||||
fs_min_size += blob.size;
|
||||
req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
|
||||
fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
|
||||
var save = function() {
|
||||
dir.getFile(name, create_if_not_found, abortable(function(file) {
|
||||
file.createWriter(abortable(function(writer) {
|
||||
writer.onwriteend = function(event) {
|
||||
target_view.location.href = file.toURL();
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "writeend", event);
|
||||
revoke(file);
|
||||
};
|
||||
writer.onerror = function() {
|
||||
var error = writer.error;
|
||||
if (error.code !== error.ABORT_ERR) {
|
||||
fs_error();
|
||||
}
|
||||
};
|
||||
"writestart progress write abort".split(" ").forEach(function(event) {
|
||||
writer["on" + event] = filesaver["on" + event];
|
||||
});
|
||||
writer.write(blob);
|
||||
filesaver.abort = function() {
|
||||
writer.abort();
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
};
|
||||
filesaver.readyState = filesaver.WRITING;
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
};
|
||||
dir.getFile(name, {create: false}, abortable(function(file) {
|
||||
// delete file if it already exists
|
||||
file.remove();
|
||||
save();
|
||||
}), abortable(function(ex) {
|
||||
if (ex.code === ex.NOT_FOUND_ERR) {
|
||||
save();
|
||||
} else {
|
||||
fs_error();
|
||||
}
|
||||
}));
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
}
|
||||
, FS_proto = FileSaver.prototype
|
||||
, saveAs = function(blob, name) {
|
||||
return new FileSaver(blob, name);
|
||||
}
|
||||
;
|
||||
FS_proto.abort = function() {
|
||||
var filesaver = this;
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "abort");
|
||||
};
|
||||
FS_proto.readyState = FS_proto.INIT = 0;
|
||||
FS_proto.WRITING = 1;
|
||||
FS_proto.DONE = 2;
|
||||
|
||||
FS_proto.error =
|
||||
FS_proto.onwritestart =
|
||||
FS_proto.onprogress =
|
||||
FS_proto.onwrite =
|
||||
FS_proto.onabort =
|
||||
FS_proto.onerror =
|
||||
FS_proto.onwriteend =
|
||||
null;
|
||||
|
||||
return saveAs;
|
||||
}(
|
||||
typeof self !== "undefined" && self
|
||||
|| typeof window !== "undefined" && window
|
||||
|| this.content
|
||||
));
|
||||
// `self` is undefined in Firefox for Android content script context
|
||||
// while `this` is nsIContentFrameMessageManager
|
||||
// with an attribute `content` that corresponds to the window
|
||||
|
||||
if (typeof module !== "undefined" && module !== null) {
|
||||
module.exports = saveAs;
|
||||
} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
|
||||
define([], function() {
|
||||
return saveAs;
|
||||
});
|
||||
}
|
||||
193
public/js/download.js
Normal file
193
public/js/download.js
Normal file
@@ -0,0 +1,193 @@
|
||||
function init() {
|
||||
if (window.location.href.startsWith('https://www.aliexpress.us/item/')) {
|
||||
const popup = document.createElement("div")
|
||||
popup.innerText = "下载图片"
|
||||
const styles = {
|
||||
position: "fixed",
|
||||
right: '10px',
|
||||
top: '60px',
|
||||
zIndex: 9999,
|
||||
padding: "8px",
|
||||
background: "#409EFF",
|
||||
color: "#fff",
|
||||
borderRadius: "8px",
|
||||
cursor: "pointer"
|
||||
}
|
||||
for (const e in styles) {
|
||||
popup.style[e] = styles[e]
|
||||
}
|
||||
|
||||
popup.addEventListener('click', async () => {
|
||||
let obj = window.runParams.data;
|
||||
let id = obj.productInfoComponent.idStr
|
||||
|
||||
var baseList = [];
|
||||
var downloadList = []
|
||||
|
||||
var imgObjList = document.querySelectorAll('#product-description img')
|
||||
for (var i = 0; i < imgObjList.length; i++) {
|
||||
baseList.push({type: 0, index: i+1, src: imgObjList[i].src})
|
||||
}
|
||||
|
||||
for (var j = 0; j < obj.imageComponent.imagePathList.length; j++) {
|
||||
baseList.push({type: 1, index: j+1, src: obj.imageComponent.imagePathList[j]})
|
||||
}
|
||||
|
||||
var video = document.querySelector('video')
|
||||
if (video) {
|
||||
baseList.push({type: 2, index: 1, src: video.src})
|
||||
}
|
||||
|
||||
var zip = new JSZip();
|
||||
var imgsBanner = zip.folder("轮播图");
|
||||
var imgsDetail = zip.folder("详情图");
|
||||
var videos = zip.folder("视频");
|
||||
for (var k = 0; k < baseList.length; k++) {
|
||||
let type = baseList[k].type
|
||||
let index = baseList[k].index
|
||||
if (type == 2) {
|
||||
let x = new XMLHttpRequest()
|
||||
x.open('GET', baseList[k].src, true)
|
||||
x.responseType = 'blob'
|
||||
x.onload = (e) => {
|
||||
downloadList.push({type: type, index: index, data: x.response});
|
||||
if (downloadList.length === baseList.length && downloadList.length > 0) {
|
||||
for (let l = 0; l < downloadList.length; l++) {
|
||||
if (downloadList[l].type == '0') {
|
||||
imgsDetail.file(`详情图${downloadList[l].index}.png`, downloadList[l].data, { base64: true });
|
||||
} else if (downloadList[l].type == '1') {
|
||||
imgsBanner.file(`轮播图${downloadList[l].index}.png`, downloadList[l].data, { base64: true });
|
||||
} else if (downloadList[l].type == '2') {
|
||||
videos.file(`视频.mp4`, downloadList[l].data, { Blob: true });
|
||||
}
|
||||
}
|
||||
zip.generateAsync({ type: "blob" }).then(function (content) {
|
||||
// see FileSaver.js
|
||||
saveAs(content, "aliexpress_" + id + ".zip");
|
||||
});
|
||||
}
|
||||
}
|
||||
x.send()
|
||||
} else {
|
||||
let image = new Image();
|
||||
// 解决跨域 Canvas 污染问题
|
||||
image.setAttribute("crossOrigin", "anonymous");
|
||||
image.onload = function () {
|
||||
let canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
let context = canvas.getContext("2d");
|
||||
context.drawImage(image, 0, 0, image.width, image.height);
|
||||
let url = canvas.toDataURL(); // 得到图片的base64编码数据
|
||||
canvas.toDataURL("image/png");
|
||||
downloadList.push({type: type, index: index, data: url.substring(22)}); // 去掉base64编码前的 data:image/png;base64,
|
||||
if (downloadList.length === baseList.length && downloadList.length > 0) {
|
||||
for (let l = 0; l < downloadList.length; l++) {
|
||||
if (downloadList[l].type == '0') {
|
||||
imgsDetail.file(`详情图${downloadList[l].index}.png`, downloadList[l].data, { base64: true });
|
||||
} else if (downloadList[l].type == '1') {
|
||||
imgsBanner.file(`轮播图${downloadList[l].index}.png`, downloadList[l].data, { base64: true });
|
||||
} else if (downloadList[l].type == '2') {
|
||||
videos.file(`视频.mp4`, downloadList[l].data, { Blob: true });
|
||||
}
|
||||
}
|
||||
zip.generateAsync({ type: "blob" }).then(function (content) {
|
||||
// see FileSaver.js
|
||||
saveAs(content, "aliexpress_" + id + ".zip");
|
||||
});
|
||||
}
|
||||
};
|
||||
image.src = baseList[k].src;
|
||||
}
|
||||
}
|
||||
})
|
||||
document.body.appendChild(popup)
|
||||
} else if (window.location.href.startsWith('https://www.amazon.com/')) {
|
||||
var content = document.getElementById('ATFCriticalFeaturesDataContainer').innerHTML
|
||||
content = content.substring(content.indexOf('jQuery.parseJSON('))
|
||||
content = content.substring(content.indexOf("("))
|
||||
content = content.substring(2, content.indexOf("');"))
|
||||
let obj = JSON.parse(content)
|
||||
let colorImages = obj.colorImages
|
||||
if (colorImages) {
|
||||
const popup = document.createElement("div")
|
||||
popup.innerText = "下载图片"
|
||||
const styles = {
|
||||
position: "fixed",
|
||||
right: '10px',
|
||||
top: '60px',
|
||||
zIndex: 9999,
|
||||
padding: "8px",
|
||||
background: "#409EFF",
|
||||
color: "#fff",
|
||||
borderRadius: "8px",
|
||||
cursor: "pointer"
|
||||
}
|
||||
for (const e in styles) {
|
||||
popup.style[e] = styles[e]
|
||||
}
|
||||
|
||||
popup.addEventListener('click', async () => {
|
||||
var baseList = [];
|
||||
var downloadList = []
|
||||
|
||||
var zip = new JSZip();
|
||||
var imgsBanner = zip.folder("轮播图");
|
||||
var imgsDetail = zip.folder("详情图");
|
||||
// var videos = zip.folder("视频");
|
||||
|
||||
for (let i in colorImages) {
|
||||
let folderName = imgsBanner.folder(i)
|
||||
let item1 = colorImages[i]
|
||||
let index = 0
|
||||
for (let j in item1) {
|
||||
let item2 = item1[j]
|
||||
baseList.push({type: 1, index: ++index, src: item2.hiRes, folder: folderName})
|
||||
}
|
||||
}
|
||||
|
||||
var imgObjList = document.querySelectorAll('div.aplus-v2 img')
|
||||
for (var i = 0; i < imgObjList.length; i++) {
|
||||
baseList.push({type: 0, index: i+1, src: imgObjList[i].getAttribute('data-src'), folder: imgsDetail})
|
||||
}
|
||||
|
||||
for (var k = 0; k < baseList.length; k++) {
|
||||
let type = baseList[k].type
|
||||
let index = baseList[k].index
|
||||
let folder = baseList[k].folder
|
||||
|
||||
let image = new Image();
|
||||
// 解决跨域 Canvas 污染问题
|
||||
image.setAttribute("crossOrigin", "anonymous");
|
||||
image.onload = function () {
|
||||
let canvas = document.createElement("canvas");
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
let context = canvas.getContext("2d");
|
||||
context.drawImage(image, 0, 0, image.width, image.height);
|
||||
let url = canvas.toDataURL(); // 得到图片的base64编码数据
|
||||
canvas.toDataURL("image/png");
|
||||
downloadList.push({type: type, index: index, folder: folder, data: url.substring(22)}); // 去掉base64编码前的 data:image/png;base64,
|
||||
if (downloadList.length === baseList.length && downloadList.length > 0) {
|
||||
for (let l = 0; l < downloadList.length; l++) {
|
||||
if (downloadList[l].type == '0') {
|
||||
downloadList[l].folder.file(`详情图${downloadList[l].index}.png`, downloadList[l].data, { base64: true });
|
||||
} else if (downloadList[l].type == '1') {
|
||||
downloadList[l].folder.file(`轮播图${downloadList[l].index}.png`, downloadList[l].data, { base64: true });
|
||||
}
|
||||
}
|
||||
zip.generateAsync({ type: "blob" }).then(function (content) {
|
||||
// see FileSaver.js
|
||||
saveAs(content, "amazon.zip");
|
||||
});
|
||||
}
|
||||
};
|
||||
image.src = baseList[k].src;
|
||||
}
|
||||
})
|
||||
document.body.appendChild(popup)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
13
public/js/jszip.min.js
vendored
Normal file
13
public/js/jszip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -24,6 +24,34 @@ export async function sendChromeAPIMessage(message) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 向Chrome发送消息
|
||||
* @param message 消息
|
||||
*/
|
||||
export async function sendTemuAPIMessage(message) {
|
||||
message.type = 'temuApi'
|
||||
message.url = "https://www.temu.com/" + message.url;
|
||||
message.anti = message.anti || false
|
||||
if (message.anti) {
|
||||
message.anti = await genAnti.a()
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
// @ts-ignore
|
||||
chrome.runtime.sendMessage(message, resolve)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 向Chrome发送消息
|
||||
* @param message 消息
|
||||
*/
|
||||
export async function sendChromeWebReqMessage(message) {
|
||||
return new Promise((resolve) => {
|
||||
// @ts-ignore
|
||||
chrome.runtime.sendMessage(message, resolve)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 向Chrome发送消息
|
||||
* @param message 消息
|
||||
|
||||
BIN
src/assets/back.png
Normal file
BIN
src/assets/back.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
BIN
src/assets/coin.png
Normal file
BIN
src/assets/coin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
@@ -1,3 +1,4 @@
|
||||
@import "./styles.scss";
|
||||
|
||||
@font-face {
|
||||
font-family: 'iconfont'; /* project id 1995974 */
|
||||
@@ -8,8 +9,9 @@
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.ttf') format('truetype'),
|
||||
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.svg#iconfont') format('svg');
|
||||
}
|
||||
.iconfont{
|
||||
font-family: "iconfont"!important;
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
@@ -33,7 +35,7 @@ h1 {
|
||||
|
||||
hr {
|
||||
-webkit-box-sizing: content-box;
|
||||
box-sizing: content-box; /* 1 */
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
@@ -51,7 +53,7 @@ abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
b,
|
||||
@@ -146,7 +148,7 @@ fieldset {
|
||||
|
||||
legend {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box; /* 1 */
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
@@ -165,9 +167,10 @@ textarea {
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box; /* 1 */
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
@@ -265,11 +268,20 @@ img {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-align {
|
||||
.flex-align, .flex-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex-base {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
|
||||
&.center {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.flex-between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -295,6 +307,7 @@ img {
|
||||
.fade-enter-active, .fade-leave-active {
|
||||
transition: opacity .3s ease-in-out;
|
||||
}
|
||||
|
||||
.fade-enter, .fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
@@ -329,15 +342,16 @@ img {
|
||||
}
|
||||
|
||||
.el-button--primary:focus {
|
||||
background: #1FBAD6!important;
|
||||
border-color: #1FBAD6!important;
|
||||
background: #1FBAD6 !important;
|
||||
border-color: #1FBAD6 !important;
|
||||
}
|
||||
|
||||
.link-hover {
|
||||
cursor: pointer;
|
||||
transition: all ease .5s;
|
||||
|
||||
&:hover {
|
||||
color: #1FBAD6!important;
|
||||
color: #1FBAD6 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,8 +398,8 @@ img {
|
||||
}
|
||||
|
||||
.text-disabled {
|
||||
color: #bbb!important;
|
||||
cursor: not-allowed!important;
|
||||
color: #bbb !important;
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
|
||||
.btn-disabled {
|
||||
@@ -404,25 +418,25 @@ img {
|
||||
|
||||
&:hover {
|
||||
opacity: 0.3;
|
||||
color: #1FBAD6!important;
|
||||
background: #fff!important;
|
||||
color: #1FBAD6 !important;
|
||||
background: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.el-button--primary {
|
||||
color: #fff!important;
|
||||
color: #fff !important;
|
||||
border-color: #1FBAD6;
|
||||
background-color: #1FBAD6;
|
||||
}
|
||||
|
||||
.el-button--danger:focus, .el-button.el-button--danger.is-link:not(.is-disabled):hover{
|
||||
color: #fff!important;
|
||||
.el-button--danger:focus, .el-button.el-button--danger.is-link:not(.is-disabled):hover {
|
||||
color: #fff !important;
|
||||
border-color: #FA5555;
|
||||
background-color: #FA5555;
|
||||
}
|
||||
|
||||
.el-input-group__append .el-button {
|
||||
background-color: #1FBAD6!important;
|
||||
background-color: #1FBAD6 !important;
|
||||
}
|
||||
|
||||
.admin-main {
|
||||
@@ -438,11 +452,11 @@ img {
|
||||
}
|
||||
|
||||
.el-menu--inline .el-menu-item {
|
||||
padding-left: 55px!important;
|
||||
padding-left: 55px !important;
|
||||
}
|
||||
|
||||
.el-menu {
|
||||
border: none!important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.el-menu .el-menu-item i {
|
||||
@@ -452,3 +466,20 @@ img {
|
||||
.fill {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.search-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 16px 12px;
|
||||
|
||||
label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 240px;
|
||||
}
|
||||
}
|
||||
|
||||
35
src/assets/css/styles.scss
Normal file
35
src/assets/css/styles.scss
Normal file
@@ -0,0 +1,35 @@
|
||||
@each $c in (333, 666, 999, f00) {
|
||||
@each $t, $v in (c:color, bg:background) {
|
||||
.#{$t}-#{$c} {
|
||||
#{$v}: #{'#'+$c};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@for $i from 1 through 30 {
|
||||
.f-#{$i} {
|
||||
font-size: #{$i}px;
|
||||
}
|
||||
@each $p, $pv in (margin:m, padding:p) {
|
||||
.#{$pv}-#{$i} {
|
||||
#{$p}: #{$i}px;
|
||||
}
|
||||
.#{$pv}v-#{$i} {
|
||||
#{$p}-top: #{$i}px;
|
||||
#{$p}-bottom: #{$i}px;
|
||||
}
|
||||
.#{$pv}h-#{$i} {
|
||||
#{$p}-left: #{$i}px;
|
||||
#{$p}-right: #{$i}px;
|
||||
}
|
||||
|
||||
@each $pos, $v in (left:l, right:r, top:t, bottom:b) {
|
||||
.#{$pv+$v}-#{$i} {
|
||||
#{$p}-#{$pos}: #{$i}px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.through{
|
||||
text-decoration: line-through;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 84 KiB |
BIN
src/assets/wechat_logo.png
Normal file
BIN
src/assets/wechat_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -1,333 +0,0 @@
|
||||
<template>
|
||||
<div class="ai-article">
|
||||
<div v-html="value"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AiArticle',
|
||||
|
||||
props: {
|
||||
value: {
|
||||
type: String
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ai-article {
|
||||
width: 100%;
|
||||
line-height: 1.75;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
text-align: justify;
|
||||
overflow-x: auto;
|
||||
word-break: break-word;
|
||||
|
||||
:deep( h1 ){
|
||||
margin: 1.3rem 0;
|
||||
line-height: 1.2
|
||||
}
|
||||
|
||||
:deep( p ){
|
||||
line-height: 2.27rem
|
||||
}
|
||||
|
||||
:deep( hr ){
|
||||
border: none;
|
||||
border-top: 1px solid #ddd;
|
||||
margin-top: 2.7rem;
|
||||
margin-bottom: 2.7rem
|
||||
}
|
||||
|
||||
:deep( img:not(.equation)), :deep( iframe), :deep( embed), :deep( video ){
|
||||
display: block;
|
||||
margin: 18px auto;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
:deep( img.equation ){
|
||||
margin: 0 .1em;
|
||||
max-width: 100% !important;
|
||||
vertical-align: middle
|
||||
}
|
||||
|
||||
:deep( figure ){
|
||||
margin: 2.7rem auto;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
:deep( img:not(.equation) ){
|
||||
cursor: zoom-in
|
||||
}
|
||||
|
||||
:deep( figure figcaption ){
|
||||
text-align: center;
|
||||
font-size: 1rem;
|
||||
line-height: 2.7rem;
|
||||
color: #909090
|
||||
}
|
||||
|
||||
:deep( pre ){
|
||||
line-height: 1.93rem;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
:deep( code),
|
||||
:deep( pre ){
|
||||
font-family: Menlo, Monaco, Consolas, Courier New, monospace
|
||||
}
|
||||
|
||||
:deep( code ){
|
||||
font-size: 1rem;
|
||||
padding: .26rem .53em;
|
||||
word-break: break-word;
|
||||
color: #4e5980;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 2px;
|
||||
overflow-x: auto
|
||||
}
|
||||
|
||||
:deep( pre>code ){
|
||||
font-size: 1rem;
|
||||
padding: .67rem 1.3rem;
|
||||
margin: 0;
|
||||
word-break: normal;
|
||||
display: block
|
||||
}
|
||||
|
||||
:deep( a ){
|
||||
color: #259
|
||||
}
|
||||
|
||||
:deep( a:active),
|
||||
:deep( a:hover ){
|
||||
color: #275b8c
|
||||
}
|
||||
|
||||
:deep( table ){
|
||||
width: 100%;
|
||||
margin-top: 18px;
|
||||
margin-bottom: 18px;
|
||||
overflow: auto;
|
||||
font-size: 1rem;
|
||||
text-align: center;
|
||||
border-top: 1px solid #ccc;
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
|
||||
:deep( thead ){
|
||||
background: #f6f6f6;
|
||||
color: #000;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
:deep( td),
|
||||
:deep( th ){
|
||||
padding: 3px 5px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
|
||||
:deep( td ){
|
||||
min-width: 10rem
|
||||
}
|
||||
|
||||
:deep( blockquote ){
|
||||
margin: 1em 0;
|
||||
border-left: 4px solid #ddd;
|
||||
padding: 0 1.3rem
|
||||
}
|
||||
|
||||
:deep( blockquote>p ){
|
||||
margin: .6rem 0
|
||||
}
|
||||
|
||||
:deep( ol),
|
||||
:deep( ul ){
|
||||
padding-left: 2.7rem
|
||||
}
|
||||
|
||||
:deep( ol li),
|
||||
:deep( ul li ){
|
||||
margin-bottom: .6rem
|
||||
}
|
||||
|
||||
:deep( ol ol),
|
||||
:deep( ol ul),
|
||||
:deep( ul ol),
|
||||
:deep( ul ul ){
|
||||
margin-top: .27rem
|
||||
}
|
||||
|
||||
:deep( pre>code ){
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
color: #333;
|
||||
background: #f8f8f8
|
||||
}
|
||||
|
||||
:deep( p ){
|
||||
line-height: inherit;
|
||||
margin-top: 18px;
|
||||
margin-bottom: 18px
|
||||
}
|
||||
:deep( p:first-child){
|
||||
margin-top: 0!important;
|
||||
}
|
||||
:deep( img ){
|
||||
max-height: none
|
||||
}
|
||||
|
||||
:deep( a ){
|
||||
color: #0269c8;
|
||||
border-bottom: 1px solid #d1e9ff
|
||||
}
|
||||
|
||||
:deep( code ){
|
||||
background-color: #fff5f5;
|
||||
color: #ff502c;
|
||||
font-size: .87em;
|
||||
padding: .065em .4em
|
||||
}
|
||||
|
||||
:deep( blockquote ){
|
||||
color: #666;
|
||||
padding: 1px 23px;
|
||||
margin: 18px 0;
|
||||
border-left: 4px solid #cbcbcb;
|
||||
background-color: #f8f8f8
|
||||
}
|
||||
|
||||
:deep( blockquote:after ){
|
||||
display: block;
|
||||
content: ""
|
||||
}
|
||||
|
||||
:deep( blockquote>p ){
|
||||
margin: 10px 0
|
||||
}
|
||||
|
||||
:deep( blockquote.warning ){
|
||||
position: relative;
|
||||
border-left-color: #f75151;
|
||||
margin-left: 8px
|
||||
}
|
||||
|
||||
:deep( blockquote.warning:before ){
|
||||
position: absolute;
|
||||
top: 14px;
|
||||
left: -12px;
|
||||
background: #f75151;
|
||||
border-radius: 50%;
|
||||
content: "!";
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center
|
||||
}
|
||||
|
||||
:deep( ol),
|
||||
:deep( ul ){
|
||||
padding-left: 28px
|
||||
}
|
||||
|
||||
:deep( ol li),
|
||||
:deep( ul li ){
|
||||
margin-bottom: 0;
|
||||
list-style: inherit
|
||||
}
|
||||
|
||||
:deep( ol li.task-list-item),
|
||||
:deep( ul li.task-list-item ){
|
||||
list-style: none
|
||||
}
|
||||
|
||||
:deep( ol li.task-list-item ol),
|
||||
:deep( ol li.task-list-item ul),
|
||||
:deep( ul li.task-list-item ol),
|
||||
:deep( ul li.task-list-item ul ){
|
||||
margin-top: 0
|
||||
}
|
||||
|
||||
:deep( ol li ){
|
||||
padding-left: 6px
|
||||
}
|
||||
|
||||
:deep( pre ){
|
||||
position: relative;
|
||||
line-height: 1.75
|
||||
}
|
||||
|
||||
:deep( pre>code ){
|
||||
padding: 15px 12px
|
||||
}
|
||||
|
||||
:deep( pre>code.hljs[lang] ){
|
||||
padding: 18px 15px 12px
|
||||
}
|
||||
|
||||
:deep( h1),
|
||||
:deep( h2),
|
||||
:deep( h3),
|
||||
:deep( h4),
|
||||
:deep( h5),
|
||||
:deep( h6 ){
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
margin-top: 35px;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 5px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
:deep( h1 ){
|
||||
font-size: 30px;
|
||||
margin-bottom: 5px
|
||||
}
|
||||
|
||||
:deep( h2 ){
|
||||
padding-bottom: 12px;
|
||||
font-size: 24px;
|
||||
border-bottom: 1px solid #ececec
|
||||
}
|
||||
|
||||
:deep( h3 ){
|
||||
font-size: 18px;
|
||||
padding-bottom: 0
|
||||
}
|
||||
|
||||
:deep( h4 ){
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
:deep( h5 ){
|
||||
font-size: 15px
|
||||
}
|
||||
|
||||
:deep( h6 ){
|
||||
margin-top: 5px
|
||||
}
|
||||
|
||||
:deep( h1.heading+h2.heading ){
|
||||
margin-top: 20px
|
||||
}
|
||||
|
||||
:deep( h1.heading+h3.heading ){
|
||||
margin-top: 15px
|
||||
}
|
||||
|
||||
:deep( .heading+.heading ){
|
||||
margin-top: 0
|
||||
}
|
||||
|
||||
:deep( h1+:not(.heading) ){
|
||||
margin-top: 25px
|
||||
}
|
||||
}
|
||||
</style>
|
||||
68
src/components/AiAvatar.vue
Normal file
68
src/components/AiAvatar.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<section class="AiAvatar">
|
||||
<el-row type="flex" v-if="type=='rect'">
|
||||
<div class="image-box">
|
||||
<el-image :src="value" :preview-src-list="preview?[value]:null"/>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-avatar v-else-if="type=='circle'" :src="value">
|
||||
<slot v-if="!value"/>
|
||||
</el-avatar>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "AiAvatar",
|
||||
model: {
|
||||
prop: "value",
|
||||
event: "change"
|
||||
},
|
||||
props: {
|
||||
value: {type: String, default: ""},
|
||||
preview: {type: Boolean, default: true},
|
||||
type: {default: "rect"}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AiAvatar {
|
||||
font-size: 12px;
|
||||
line-height: initial;
|
||||
|
||||
.iconProfile_Picture {
|
||||
color: #89b;
|
||||
}
|
||||
|
||||
:deep(.el-avatar) {
|
||||
background: #26f;
|
||||
}
|
||||
|
||||
.image-box {
|
||||
width: 104px !important;
|
||||
height: 120px;
|
||||
text-align: center;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid rgba(208, 212, 220, 1);
|
||||
border-radius: 2px;
|
||||
padding: 0;
|
||||
|
||||
.iconfont {
|
||||
font-size: 32px
|
||||
}
|
||||
|
||||
.el-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
.ai-card__body {
|
||||
height: calc(100% - 72px);
|
||||
padding: 0 20px 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
&.panel, &.headerPanel {
|
||||
|
||||
264
src/components/AiCopyFromTemu.vue
Normal file
264
src/components/AiCopyFromTemu.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form class="ai-form" :model="form" label-width="140px" ref="form">
|
||||
<el-form-item label="来源:" style="width: 100%;" prop="type" :rules="[{ required: true, message: '请选择来源', trigger: 'blur' }]">
|
||||
<el-radio-group v-model="form.type" size="medium">
|
||||
<el-radio :label="1">TEMU</el-radio>
|
||||
<!--<el-radio :label="2">速卖通</el-radio>-->
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品地址:" style="width: 100%;" prop="url" :rules="[{ required: true, message: '请输入商品地址', trigger: 'blur' }]">
|
||||
<el-input type="textarea" :rows="5" v-model="form.url"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺:" style="width: 100%;" prop="targetMallId" :rules="[{ required: true, message: '请选择店铺', trigger: 'blur' }]">
|
||||
<el-select style="width: 380px" v-model="form.targetMallId" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
:key="item.mallId"
|
||||
:label="item.mallName"
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类:" style="width: 100%;" prop="targetCatId" :rules="[{ required: true, message: '请选择商品分类', trigger: 'blur' }]">
|
||||
<el-cascader style="width: 380px" v-model="form.targetCatId" :props="props"></el-cascader>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="bottom flex-center">
|
||||
<el-button @click="$emit('onClose')">取 消</el-button>
|
||||
<el-button type="primary" @click="addToDraft">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {sendChromeAPIMessage, sendChromeWebReqMessage} from '@/api/chromeApi'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
export default {
|
||||
name: 'AiCopyFromTemu',
|
||||
props: ['params'],
|
||||
data() {
|
||||
return {
|
||||
props: {
|
||||
value: 'catId',
|
||||
label: 'catName',
|
||||
lazy: true,
|
||||
lazyLoad (node, resolve) {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-anniston-mms/category/children/list',
|
||||
needMallId: true,
|
||||
data: {
|
||||
parentCatId: node.value || ''
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode === 1000000) {
|
||||
resolve(res.result.categoryNodeVOS.map(v => {
|
||||
return {
|
||||
...v,
|
||||
leaf: v.isLeaf
|
||||
}
|
||||
}))
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
form: {
|
||||
url: '',
|
||||
type: 1, // 默认从temu复制
|
||||
targetMallId: '',
|
||||
targetCatId: []
|
||||
},
|
||||
goods: {},
|
||||
sku: {},
|
||||
productDetail: {}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
console.log(this.params?.url)
|
||||
if (this.params?.url) {
|
||||
this.form.url = this.params.url
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async addToDraft() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http.post('/api/copyProduct/check',null, {params: {type: 0}}).then(res => {
|
||||
if (res.code == 0) {
|
||||
let source
|
||||
if (this.form.type == '1') {
|
||||
source = 'temu'
|
||||
} else if (this.form.type == '2') {
|
||||
source = 'aliexpress'
|
||||
}
|
||||
sendChromeWebReqMessage({
|
||||
type: source,
|
||||
url: this.form.url,
|
||||
}).then((res) => {
|
||||
if (this.form.type == '1') {
|
||||
if (res.indexOf("rawData") == -1) {
|
||||
Message.error("请检查地址是否正确,或者“TEMU”网站是否出现图形验证码")
|
||||
return
|
||||
}
|
||||
let str = res.substring(res.indexOf("rawData"))
|
||||
str = str.substring(0, str.indexOf("<\/script>"))
|
||||
str = str.substring(str.indexOf("{"))
|
||||
str = str.substring(0, str.lastIndexOf("}"))
|
||||
str = str + "}"
|
||||
|
||||
let goodsObj = JSON.parse(str)
|
||||
this.goods = goodsObj.store.goods
|
||||
this.sku = goodsObj.store.sku
|
||||
this.productDetail = goodsObj.store.productDetail
|
||||
|
||||
let specIds = []
|
||||
this.sku.forEach(item => {
|
||||
item.specs.forEach(item1 => {
|
||||
let flag = false
|
||||
specIds.forEach(item2 => {
|
||||
if (item2.specValue == item1.specValue) {
|
||||
flag = true
|
||||
}
|
||||
})
|
||||
if (!flag) {
|
||||
specIds.push({specKeyId: item1.specKeyId, specValue: item1.specValue})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Promise.all(specIds.map(item => this.getSpecId(item).then(res => {
|
||||
this.sku.forEach(item1 => {
|
||||
item1.specs.forEach(item2 => {
|
||||
if (item2.specValue == item.specValue) {
|
||||
item2.specValueId = res.result.specId
|
||||
}
|
||||
})
|
||||
})
|
||||
return 0
|
||||
}))).then(() => {
|
||||
this.$http.post('/api/copyProduct/translate',{type: 1, goods: this.goods, sku: this.sku, productDetail: this.productDetail}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.createDraft(res.data)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (this.form.type == '2') {
|
||||
/*if (res.indexOf("runParams") == -1) {
|
||||
Message.error("请检查地址是否正确,或者“速卖通”网站是否出现滑动条")
|
||||
return
|
||||
}
|
||||
let str = res.substring(res.indexOf("runParams"))
|
||||
str = str.substring(0, str.indexOf("<\/script>"))
|
||||
str = str.substring(str.indexOf("{"))
|
||||
str = str.substring(0, str.lastIndexOf("}"))
|
||||
str = str.substring(str.indexOf('data'))
|
||||
str = str.substring(5)
|
||||
|
||||
let obj = JSON.parse(str)
|
||||
|
||||
sendChromeWebReqMessage({
|
||||
type: source,
|
||||
url: obj.productDescComponent.descriptionUrl,
|
||||
}).then((res1) => {
|
||||
res1 = res1.substring(0, res1.indexOf("<script>"))
|
||||
let str = res1.replace(/<img[^>]+src="([^">]+)"[^>]+>/g, '$1\n').replace(/<.*?>/g, '[||]')
|
||||
let arr = str.split('[||]')
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
console.log(arr[i])
|
||||
}
|
||||
})*/
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
createDraft(data) {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/draft/add',
|
||||
needMallId: true,
|
||||
mallId: this.form.targetMallId,
|
||||
data: {
|
||||
catId: this.form.targetCatId[this.form.targetCatId.length - 1]
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
let draftId = res.result.productDraftId
|
||||
let content = data
|
||||
let i = 0
|
||||
for (; i < this.form.targetCatId.length; i++) {
|
||||
content['cat' + (i+1) + 'Id'] = this.form.targetCatId[i]
|
||||
}
|
||||
for (; i < 10; i++) {
|
||||
content['cat' + (i+1) + 'Id'] = ''
|
||||
}
|
||||
content.productDraftId = draftId
|
||||
|
||||
this.createProduct(content)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.createDraft(data)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
},
|
||||
createProduct(content) {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/draft/save',
|
||||
needMallId: true,
|
||||
mallId: this.form.targetMallId,
|
||||
data: {
|
||||
...content
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
Message.success("成功添加到草稿箱")
|
||||
this.saveInfo()
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.createProduct(content)
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
},
|
||||
getSpecId(data) {
|
||||
return sendChromeAPIMessage({
|
||||
url: 'bg-anniston-mms/sku/spec/byName/queryOrAdd',
|
||||
needMallId: true,
|
||||
mallId: this.form.targetMallId,
|
||||
data: {
|
||||
parentSpecId: data.specKeyId,
|
||||
specName: data.specValue
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
return res
|
||||
} else {
|
||||
this.getSpecId(data)
|
||||
}
|
||||
})
|
||||
},
|
||||
saveInfo() {
|
||||
let mallInfo = this.$store.state.mallList.filter(item => {
|
||||
return item.mallId == this.form.targetMallId
|
||||
})
|
||||
this.$http.post('/api/copyProduct/add', {
|
||||
mallId: mallInfo[0].mallId,
|
||||
mallName: mallInfo[0].mallName,
|
||||
url: this.form.url,
|
||||
type: this.form.type
|
||||
}).then(res1 => {
|
||||
if (res1.code == 0) {
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.$emit('onSuccess')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bottom {
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
289
src/components/AiPayment.vue
Normal file
289
src/components/AiPayment.vue
Normal file
@@ -0,0 +1,289 @@
|
||||
<template>
|
||||
<section class="AiPayment">
|
||||
<el-tabs type="card" stretch v-model="search.module" @tab-click="getPayments">
|
||||
<el-tab-pane label="激活码兑换" name="2"/>
|
||||
<el-tab-pane label="基础会员" name="0"/>
|
||||
<el-tab-pane label="金币充值" name="1"/>
|
||||
</el-tabs>
|
||||
<div class="content">
|
||||
<div v-if="search.module == '0'" class="mb-16">
|
||||
<div style="grid-template-columns: 1fr 1fr" class="payments ">
|
||||
<div class="card" v-for="pay in payments" :key="pay.id" :class="{active:pay.id==selected.id}"
|
||||
@click="getQrcode(pay)">
|
||||
<div v-text="pay.title"/>
|
||||
<div class="c-f00 mt-16" v-text="`¥${pay.price}`"/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-form :model="vipForm" label-position="top" ref="vipForm" label-width="100px" class="form">
|
||||
<el-form-item
|
||||
prop="mallName"
|
||||
label="当前绑定店铺"
|
||||
:rules="[{ required: true, message: '请先登录拼多多跨境卖家中心', trigger: 'blur' }]">
|
||||
<el-input readonly placeholder="请先登录拼多多跨境卖家中心" v-model="vipForm.mallName"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="search.module == '1' " class="payments mb-16">
|
||||
<div class="card" v-for="pay in payments" :key="pay.id" :class="{active:pay.id==selected.id}"
|
||||
@click="getQrcode(pay)">
|
||||
<div class="mt-16 flex-base center">
|
||||
<div class="c-f00 f-20 mr-4" v-text="`¥${pay.price}`"/>
|
||||
<div class="c-999 through" v-text="`¥${pay.originPrice}`"/>
|
||||
</div>
|
||||
<div class="c-999 mt-16" v-text="`${pay.coin}金币`"/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="search.module == '2'" style="grid-template-columns: 1fr" class="payments mb-16">
|
||||
<el-form :model="form" label-position="top" ref="form" label-width="100px" class="form">
|
||||
<el-form-item
|
||||
prop="mallName"
|
||||
label="当前绑定店铺"
|
||||
:rules="[{ required: true, message: '请先登录拼多多跨境卖家中心', trigger: 'blur' }]">
|
||||
<el-input readonly placeholder="请先登录拼多多跨境卖家中心" v-model="form.mallName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="mallId"
|
||||
v-show="false"
|
||||
:rules="[{ message: '请输入商城ID', trigger: 'blur' }]">
|
||||
<el-input placeholder="请输入商城ID" v-model="form.mallId"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="code"
|
||||
label="激活码"
|
||||
:rules="[{ required: true, message: '请输入激活码', trigger: 'blur' }]">
|
||||
<el-input placeholder="请输入激活码" v-model="form.code"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-row type="flex" align="middle">
|
||||
<ul class="fill" v-if="search.module == '0'">
|
||||
<li v-for="(desc,i) in descriptionsModule0" :key="i" v-text="desc"/>
|
||||
</ul>
|
||||
<ul class="fill" v-if="search.module == '1'">
|
||||
<li v-for="(desc,i) in descriptionsModule1" :key="i" v-text="desc"/>
|
||||
</ul>
|
||||
<div class="fill flex-center" v-if="search.module != '2'">
|
||||
<vue-qr v-if="qrcode" :text="qrcode" :size="120" :margin="8" :logoSrc="wechatLogo"/>
|
||||
<div v-else class="qrcode c-666">请选择<br>项目</div>
|
||||
<div class="c-999 ml-16">
|
||||
<div class="flex-center mb-16">
|
||||
应付金额:
|
||||
<div class="c-f00" style="font-size: 20px;">¥{{ selected.price }}</div>
|
||||
</div>
|
||||
<div class="wechat flex-center">
|
||||
微信扫码支付
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<div class="bottom flex-center" v-if="search.module != '2'">
|
||||
<el-button size="small" @click="$store.commit('setActiveDlgShow', false)">取消支付</el-button>
|
||||
<el-button size="small" @click="paied">已扫码支付</el-button>
|
||||
</div>
|
||||
<div class="bottom flex-center" v-else>
|
||||
<el-button size="small" @click="$store.commit('setActiveDlgShow', false)">取消</el-button>
|
||||
<el-button size="small" @click="active">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
<script>
|
||||
import { Message } from "element-ui"
|
||||
import VueQr from "vue-qr"
|
||||
|
||||
export default {
|
||||
name: "AiPayment",
|
||||
components: {VueQr},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
mallId: this.$store.state.mallId,
|
||||
mallName: this.$store.state.mallName,
|
||||
code: ''
|
||||
},
|
||||
vipForm: {
|
||||
mallId: this.$store.state.mallId,
|
||||
mallName: this.$store.state.mallName
|
||||
},
|
||||
vipType: ["体验会员","年会员","年会员多店通用"],
|
||||
|
||||
search: {module: "0"},
|
||||
show: true,
|
||||
descriptionsModule0: ["抢仓发货", "数据下载", "复制商品", "会员服务"],
|
||||
descriptionsModule1: ["智能复制"],
|
||||
payments: [],
|
||||
qrcode: "",
|
||||
amount: 0,
|
||||
selected: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
wechatLogo: () => require("../assets/wechat_logo.png")
|
||||
},
|
||||
methods: {
|
||||
getPayments() {
|
||||
if (this.search.module == '2') return
|
||||
this.$http.post("/api/priceConfig/page", null, {
|
||||
params: {...this.search}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.payments = res.data.records || []
|
||||
}
|
||||
})
|
||||
},
|
||||
getQrcode(item) {
|
||||
if (item.module == '0' && !this.vipForm.mallId) {
|
||||
Message.error("请先登录拼多多垮境卖家中心")
|
||||
return
|
||||
}
|
||||
this.selected = item
|
||||
this.$http.post("/api/order/createOrder", null, {
|
||||
params: {priceConfigId: item.id}
|
||||
}).then(res => {
|
||||
if (res?.data?.id) {
|
||||
return res.data.id
|
||||
}
|
||||
}).then(id => this.$http.post("/api/order/createPrepayOrder", null, {
|
||||
params: {id}
|
||||
})).then(res => {
|
||||
if (res?.data) {
|
||||
this.qrcode = res.data.codeUrl
|
||||
}
|
||||
})
|
||||
},
|
||||
paied() {
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.$store.commit('setActiveDlgShow', false)
|
||||
},
|
||||
active() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http.post(`/api/coupon/getDetail`, null, {
|
||||
params: {
|
||||
code: this.form.code
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
let msg = this.getMessage(res.data.type);
|
||||
this.$confirm(msg, '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info'
|
||||
}).then(() => {
|
||||
this.$http.post(`/api/order/upgradeByCode`, null, {
|
||||
params: {
|
||||
...this.form
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('激活成功')
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.$store.commit('setActiveDlgShow', false)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getPayments()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.AiPayment {
|
||||
font-size: 16px;
|
||||
|
||||
:deep(.el-tabs) {
|
||||
z-index: 4;
|
||||
|
||||
.is-active {
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ul {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: 16px;
|
||||
|
||||
li {
|
||||
list-style-type: circle;
|
||||
margin-left: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
.payments {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr 1fr;
|
||||
grid-gap: 32px;
|
||||
|
||||
.card {
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
border: 1px solid #ddd;
|
||||
padding: 32px 16px;
|
||||
border-radius: 4px;
|
||||
|
||||
&.active {
|
||||
border-color: #26f;
|
||||
position: relative;
|
||||
|
||||
&:after {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
bottom: 8px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
line-height: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 16px;
|
||||
content: "✔";
|
||||
color: white;
|
||||
background: #26f;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px 32px;
|
||||
margin-top: -16px;
|
||||
border: 1px solid #ddd;
|
||||
z-index: 9;
|
||||
|
||||
.qrcode {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
background-color: #eee;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.wechat {
|
||||
line-height: 20px;
|
||||
padding-left: 28px;
|
||||
background-image: url("../assets/wechat_logo.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
background-size: 20px 20px;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
justify-content: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
85
src/components/AiProductDetail.vue
Normal file
85
src/components/AiProductDetail.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<ai-detail class="audit">
|
||||
<template slot="content">
|
||||
<ai-card title="基本信息">
|
||||
<ai-product-drop-down v-if="info" :params="info" slot="right"></ai-product-drop-down>
|
||||
<template #content>
|
||||
<div class="flex">
|
||||
<ai-avatar v-model="info.imgUrl" :editable="false" :preview="true"/>
|
||||
<ai-wrapper
|
||||
label-width="120px" class="fill">
|
||||
<ai-info-item label="价格:" :value="'$' + info.price"></ai-info-item>
|
||||
<ai-info-item label="销量:" :value="info.saleTotal"></ai-info-item>
|
||||
</ai-wrapper>
|
||||
</div>
|
||||
</template>
|
||||
</ai-card>
|
||||
<ai-card title="趋势信息">
|
||||
<template #content>
|
||||
<div id="chart"></div>
|
||||
</template>
|
||||
</ai-card>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
<script>
|
||||
import AiProductDropDown from './AiProductDropDown.vue'
|
||||
import { DualAxes } from '@antv/g2plot'
|
||||
|
||||
export default {
|
||||
name: "AiProductDetail",
|
||||
props: ['params'],
|
||||
components: {
|
||||
AiProductDropDown
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
info: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
created() {
|
||||
this.getInfo()
|
||||
},
|
||||
methods: {
|
||||
getInfo() {
|
||||
this.$http.post('/api/monitorDetail/queryDetail',null,{
|
||||
params: {
|
||||
goodsId: this.params.goodsId
|
||||
}
|
||||
}).then(res => {
|
||||
this.info = res.data
|
||||
|
||||
const dualAxes = new DualAxes('chart', {
|
||||
data: [this.info.priceAndSale, this.info.priceAndSale],
|
||||
xField: '日期',
|
||||
yField: ['价格', '销量'],
|
||||
geometryOptions: [
|
||||
{
|
||||
geometry: 'line',
|
||||
color: '#5B8FF9',
|
||||
},
|
||||
{
|
||||
geometry: 'line',
|
||||
color: '#5AD8A6',
|
||||
}
|
||||
],
|
||||
smooth: true,
|
||||
// @TODO 后续会换一种动画方式
|
||||
animation: {
|
||||
appear: {
|
||||
animation: 'path-in',
|
||||
duration: 5000,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
dualAxes.render();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
80
src/components/AiProductDropDown.vue
Normal file
80
src/components/AiProductDropDown.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dropdown @command="handleClick">
|
||||
<span class="el-dropdown-link">
|
||||
操作<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-if="isShowDetail" :command="beforeGoDetail(params.goodsId)">查看详情</el-dropdown-item>
|
||||
<el-dropdown-item divided :command="beforeCopy(params.url)">复制商品</el-dropdown-item>
|
||||
<el-dropdown-item divided :command="beforeGoWeb(params.url)">访问商品</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeGoMal(params.mallId)">访问店铺</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
<ai-dialog
|
||||
title="复制"
|
||||
:visible.sync="copyFromDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="790px"
|
||||
customFooter
|
||||
:append-to-body="true"
|
||||
@close="handleClose">
|
||||
<ai-copy-from-temu v-if="copyFromDlgShow" :params="temuParams" @onClose="handleClose" @onSuccess="handleSuccess"></ai-copy-from-temu>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import AiCopyFromTemu from "./AiCopyFromTemu.vue";
|
||||
export default {
|
||||
name: "AiProductDropDown",
|
||||
components: {AiCopyFromTemu},
|
||||
props: ['params', 'isShowDetail'],
|
||||
data() {
|
||||
return {
|
||||
info: {},
|
||||
copyFromDlgShow: false,
|
||||
temuParams: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
handleClick(e) {
|
||||
if (e.type == 'detail') {
|
||||
this.$emit('onGoDetail')
|
||||
} else if (e.type == 'copy') {
|
||||
this.temuParams = {url: 'https://www.temu.com/' + e.url}
|
||||
this.copyFromDlgShow = true
|
||||
} else if (e.type == 'goMall') {
|
||||
window.open('https://www.temu.com/mall.html?mall_id=' + e.mallId, '_blank');
|
||||
} else if (e.type == 'goWeb') {
|
||||
console.log(e.url)
|
||||
window.open('https://www.temu.com/' + e.url, '_blank');
|
||||
}
|
||||
},
|
||||
beforeGoDetail(goodsId) {
|
||||
return {type: 'detail', goodsId: goodsId}
|
||||
},
|
||||
beforeCopy(url) {
|
||||
return {type: 'copy', url: url}
|
||||
},
|
||||
beforeGoMal(mallId) {
|
||||
return {type: 'goMall', mallId: mallId}
|
||||
},
|
||||
beforeGoWeb (url) {
|
||||
return {type: 'goWeb', url: url}
|
||||
},
|
||||
handleClose() {
|
||||
this.copyFromDlgShow = false
|
||||
},
|
||||
handleSuccess() {
|
||||
this.copyFromDlgShow = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@@ -8,7 +8,6 @@
|
||||
<slot name="right"/>
|
||||
</div>
|
||||
</div>
|
||||
<ai-pull-down v-if="!isSingleRow" @change="handlePullDown" :height="rightHeight"/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<section class="AiTitle" :class="{ 'bottomBorder': isShowBottomBorder, AiTitleSub: isHasSub}">
|
||||
<i class="iconfont iconBack_Large" v-if="isShowBack" @click="onBackBtnClick"/>
|
||||
<div class="fill">
|
||||
<div class="ailist-title">
|
||||
<div class="ailist-title__left">
|
||||
<i class="el-icon-back" title="返回" style="color: #1989fa; cursor: pointer;" v-if="isShowBack" @click="onBackBtnClick"></i>
|
||||
<h2>{{ title }}</h2>
|
||||
<p>{{ tips }}</p>
|
||||
</div>
|
||||
@@ -59,9 +59,7 @@
|
||||
|
||||
methods: {
|
||||
onBackBtnClick() {
|
||||
this.closePage()
|
||||
this.$emit('onBackClick')
|
||||
this.$emit('back')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,6 +129,9 @@
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.iconBack_Large:before {
|
||||
content: "\e63d";
|
||||
}
|
||||
|
||||
.iconBack_Large {
|
||||
line-height: 48px;
|
||||
|
||||
497
src/components/AiUploader.vue
Normal file
497
src/components/AiUploader.vue
Normal file
@@ -0,0 +1,497 @@
|
||||
<template>
|
||||
<section class="uploader">
|
||||
<el-upload
|
||||
action
|
||||
multiple
|
||||
ref="upload"
|
||||
:class="{validError:!validateState}"
|
||||
:http-request="submitUpload"
|
||||
:on-remove="handleRemove"
|
||||
:on-change="handleChange"
|
||||
:before-upload="onBeforeUpload"
|
||||
:file-list="fileList"
|
||||
:limit="limit"
|
||||
:disabled="disabled"
|
||||
:list-type="isImg ? 'picture-card' : 'text'"
|
||||
:accept="accept"
|
||||
:show-file-list="!isSingle"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:auto-upload="isAutoUpload"
|
||||
:on-exceed="handleExceed">
|
||||
<template v-if="!disabled">
|
||||
<template v-if="hasUploaded&&isSingle">
|
||||
<div class="fileItem">
|
||||
<div class="uploadFile" @click.stop>
|
||||
<div class="info">
|
||||
<span v-text="uploadFile.name"/>
|
||||
<span class="size" v-text="uploadFile.size"/>
|
||||
</div>
|
||||
</div>
|
||||
<el-button>重新选择</el-button>
|
||||
<el-button v-if="clearable" plain type="danger" @click.stop="handleClear">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="limit > fileList.length">
|
||||
<slot v-if="hasTriggerSlot" name="trigger"/>
|
||||
<div v-else class="uploaderBox">
|
||||
<span class="iconfont" :class="isImg ? 'iconPhoto' : 'iconAdd'"/>
|
||||
<p>上传{{ isImg ? '图片' : '附件' }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<div slot="tip" class="el-upload__tip" v-if="showTips">
|
||||
<p v-if="fileType === 'img' && !acceptType && !hasTipsSlot">最多上传{{
|
||||
limit
|
||||
}}张图片,单个文件最大10MB,支持jpg、jpeg、png格式</p>
|
||||
<p v-if="fileType === 'file' && !acceptType && !hasTipsSlot">最多上传{{ limit }}个附件,单个文件最大10MB</p>
|
||||
<p v-if="fileType === 'file' && !acceptType && !hasTipsSlot">
|
||||
支持.zip、.rar、.doc、.docx、.xls、.xlsx、.ppt、.pptx、.pdf、.txt、.jpg、.png格式</p>
|
||||
<p>
|
||||
<slot name="tips" v-if="hasTipsSlot"></slot>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<el-dialog :visible.sync="dialog" title="图片预览编辑器" :modal="false" :show-close="false" z-index="202204131734"
|
||||
append-to-body>
|
||||
<vue-cropper
|
||||
ref="cropper"
|
||||
style="height: 400px;"
|
||||
:img="fileList.length ? fileList[0].url : ''" v-bind="crop"/>
|
||||
<div style="text-align: center;margin-top: 10px;">
|
||||
<el-radio-group v-if="crop.fixed" size="small" v-model="currFixedIndex" @change="onFixedChange"
|
||||
style="margin-right: 8px;">
|
||||
<el-radio-button
|
||||
:label="0"
|
||||
size="small">
|
||||
1.6:1
|
||||
</el-radio-button>
|
||||
<el-radio-button
|
||||
:label="1"
|
||||
size="small">
|
||||
4:3
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-button size="small" circle icon="el-icon-refresh-right" @click="$refs.cropper.rotateRight()"></el-button>
|
||||
<el-button size="small" circle icon="el-icon-refresh-left" @click="$refs.cropper.rotateLeft()"></el-button>
|
||||
</div>
|
||||
<div slot="footer">
|
||||
<el-button type="primary" @click="previewCrop">保存</el-button>
|
||||
<el-button @click="onClose">关闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<div class="images" v-viewer="{movable: true}" v-show="false">
|
||||
<img v-for="(item, index) in imgList" :src="item" :key="index" alt="">
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {VueCropper} from 'vue-cropper'
|
||||
import 'viewerjs/dist/viewer.css'
|
||||
import Viewer from 'v-viewer'
|
||||
import Vue from "vue";
|
||||
|
||||
Viewer.setDefaults({
|
||||
zIndex: 20170
|
||||
})
|
||||
Vue.use(Viewer)
|
||||
export default {
|
||||
name: 'AiUploader',
|
||||
components: {VueCropper},
|
||||
inject: {
|
||||
elFormItem: {default: ""},
|
||||
elForm: {default: ''},
|
||||
},
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change'
|
||||
},
|
||||
props: {
|
||||
value: {default: () => []},
|
||||
url: {
|
||||
type: String,
|
||||
default: '/api/upload/uploadFile?folder=admin'
|
||||
},
|
||||
isShowTip: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isWechat: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
maxSize: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
instance: Function,
|
||||
acceptType: {type: String},
|
||||
fileType: {type: String, default: 'img'},
|
||||
limit: {type: Number, default: 9},
|
||||
disabled: {type: Boolean, default: false},
|
||||
isCrop: {type: Boolean, default: false},
|
||||
cropOps: Object,
|
||||
isImport: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
clearable: {default: true},
|
||||
valueIsUrl: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileList: [],
|
||||
dialog: false,
|
||||
currFixedIndex: 0,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(v) {
|
||||
this.dispatch('ElFormItem', 'el.form.change', [v]);
|
||||
if (v?.length > 0) {
|
||||
this.fileList = this.valueIsUrl ? v?.split(",")?.map(url => ({url})) : [...v]
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isImg() {
|
||||
return this.fileType === 'img'
|
||||
},
|
||||
validateState() {
|
||||
return ['', 'success'].includes(this.elFormItem?.validateState)
|
||||
},
|
||||
isAutoUpload() {
|
||||
return !(this.isCrop || this.isImport);
|
||||
},
|
||||
hasTipsSlot() {
|
||||
return this.$slots.tips
|
||||
},
|
||||
hasTriggerSlot() {
|
||||
return this.$slots.trigger
|
||||
},
|
||||
accept() {
|
||||
if (this.acceptType) {
|
||||
return this.acceptType
|
||||
}
|
||||
|
||||
return this.isImg ? '.jpg,.png,.jpeg' : '.zip,.rar,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.txt,.jpg,.png'
|
||||
},
|
||||
crop() {
|
||||
return {
|
||||
autoCrop: true,
|
||||
outputType: 'png',
|
||||
fixedBox: false,
|
||||
fixed: true,
|
||||
fixedNumber: [1.6, 1],
|
||||
width: 0,
|
||||
height: 0,
|
||||
...this.cropOps
|
||||
}
|
||||
},
|
||||
imgList() {
|
||||
return this.fileList.map(v => v.url)
|
||||
},
|
||||
isSingle() {
|
||||
return this.limit == 1 && this.isImport
|
||||
},
|
||||
showTips() {
|
||||
return this.isShowTip || this.$slots.tips
|
||||
},
|
||||
hasUploaded() {
|
||||
return this.fileList?.length > 0
|
||||
},
|
||||
uploadFile() {
|
||||
let file = this.fileList?.[0],
|
||||
size = Number(file.size),
|
||||
icon = "iconTxt"
|
||||
//显示大小
|
||||
if (size > Math.pow(1024, 2)) {
|
||||
size = (size / Math.pow(1024, 2)).toFixed(1) + 'MB'
|
||||
} else {
|
||||
size = (size / 1024).toFixed(1) + 'KB'
|
||||
}
|
||||
//显示图标
|
||||
if (/\.(xls|xlsx)$/.test(file.name)) {
|
||||
icon = "iconExcel"
|
||||
} else if (/\.(zip)$/.test(file.name)) {
|
||||
icon = "iconZip"
|
||||
} else if (/\.(rar)$/.test(file.name)) {
|
||||
icon = "iconRar"
|
||||
} else if (/\.(png)$/.test(file.name)) {
|
||||
icon = "iconPng"
|
||||
} else if (/\.(pptx|ppt)$/.test(file.name)) {
|
||||
icon = "iconPPT"
|
||||
} else if (/\.(doc|docx)$/.test(file.name)) {
|
||||
icon = "iconWord"
|
||||
}
|
||||
|
||||
return {...file, size, icon}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onFixedChange(e) {
|
||||
this.fixedNumber = e === 0 ? [1.6, 1] : [4, 3]
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs.cropper.goAutoCrop()
|
||||
})
|
||||
},
|
||||
handleChange(file, fileList) {
|
||||
if (this.isImport) {
|
||||
if (!this.onOverSize(file)) {
|
||||
this.fileList = []
|
||||
return false
|
||||
}
|
||||
this.fileList = fileList
|
||||
this.emitChange(fileList)
|
||||
return false
|
||||
}
|
||||
if (this.isCrop) {
|
||||
if (file.raw.type === 'image/gif') {
|
||||
this.$message.error(`不支持gif格式的图片`)
|
||||
this.fileList = []
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
if (!this.onOverSize(file)) {
|
||||
this.fileList = []
|
||||
|
||||
return false
|
||||
}
|
||||
this.dialog = true
|
||||
this.fileList = fileList
|
||||
} else {
|
||||
this.fileList = fileList
|
||||
}
|
||||
},
|
||||
handleExceed(files) {
|
||||
if (this.isSingle && files[0]) {
|
||||
this.$refs.upload?.clearFiles()
|
||||
this.$refs.upload?.handleStart(files[0])
|
||||
} else this.$message.warning(`最多上传${this.limit}个${this.isImg ? '图片' : '文件'}`)
|
||||
},
|
||||
handlePictureCardPreview(file) {
|
||||
if (this.fileType !== 'img') return
|
||||
|
||||
const index = this.imgList.indexOf(file.url)
|
||||
const viewer = this.$el.querySelector('.images').$viewer
|
||||
viewer.view(index)
|
||||
},
|
||||
|
||||
handleRemove(file, fileList) {
|
||||
this.fileList = fileList
|
||||
this.emitChange(fileList)
|
||||
},
|
||||
emitChange(files) {
|
||||
this.$emit('change', this.valueIsUrl ? files?.map(e => e.url)?.toString() : files)
|
||||
},
|
||||
handleClear() {
|
||||
this.fileList = []
|
||||
},
|
||||
getExtension(name) {
|
||||
return name.substring(name.lastIndexOf('.'))
|
||||
},
|
||||
|
||||
onOverSize(e) {
|
||||
const isLt10M = e.size / 1024 / 1024 < this.maxSize
|
||||
const suffixName = this.getExtension(e.name)
|
||||
const suffixNameList = this.accept.split(',')
|
||||
|
||||
if (suffixNameList.indexOf(`${suffixName.toLowerCase()}`) === -1) {
|
||||
this.$message.error(`不支持该格式`)
|
||||
return false
|
||||
}
|
||||
|
||||
if (!isLt10M) {
|
||||
this.$message.error(`${this.isImg ? '图片' : '文件'}大小不超过${this.maxSize}MB!`)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
},
|
||||
|
||||
onBeforeUpload(event) {
|
||||
return this.onOverSize(event)
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.fileList = []
|
||||
this.dialog = false
|
||||
},
|
||||
|
||||
submitUpload(file) {
|
||||
let formData = new FormData()
|
||||
formData.append('file', file.file)
|
||||
this.instance.post(this.url, formData, {
|
||||
withCredentials: false
|
||||
}).then(res => {
|
||||
if (res?.code == 0) {
|
||||
let data = res.data
|
||||
this.fileList.forEach(item => {
|
||||
if (item.uid === file.file.uid) {
|
||||
item.path = data
|
||||
item.url = data
|
||||
}
|
||||
})
|
||||
this.emitChange(this.fileList)
|
||||
this.$message.success('上传成功')
|
||||
}
|
||||
})
|
||||
},
|
||||
previewCrop() {
|
||||
this.$refs.cropper.getCropBlob(data => {
|
||||
data.name = this.fileList[0].name;
|
||||
this.fileList[0].file = new window.File([data], data.name, {type: data.type})
|
||||
this.fileList[0].file.uid = this.fileList[0].uid
|
||||
})
|
||||
setTimeout(() => document.querySelector('.v-modal').style.zIndex = 2000, 500)
|
||||
this.$confirm('是否关闭图片预览器,并上传图片?', {type: "warning"}).then(() => {
|
||||
this.submitUpload(this.fileList[0])
|
||||
this.dialog = false
|
||||
}).catch(() => 0)
|
||||
},
|
||||
/**
|
||||
* 表单验证
|
||||
* @param componentName
|
||||
* @param eventName
|
||||
* @param params
|
||||
*/
|
||||
dispatch(componentName, eventName, params) {
|
||||
let parent = this.$parent || this.$root;
|
||||
let name = parent.$options.componentName;
|
||||
|
||||
while (parent && (!name || name !== componentName)) {
|
||||
parent = parent.$parent;
|
||||
|
||||
if (parent) {
|
||||
name = parent.$options.componentName;
|
||||
}
|
||||
}
|
||||
if (parent) {
|
||||
parent.$emit.apply(parent, [eventName].concat(params));
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uploader {
|
||||
line-height: 1;
|
||||
|
||||
::v-deep.el-upload {
|
||||
width: 100%;
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
::v-deep.validError {
|
||||
.el-button {
|
||||
border-color: #f46;
|
||||
color: #f46;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep.el-upload--picture-card {
|
||||
border: none;
|
||||
}
|
||||
|
||||
::v-deep .el-list-leave-active, ::v-deep .el-upload-list__item {
|
||||
transition: all 0s !important;
|
||||
}
|
||||
|
||||
::v-deep.el-upload-list--picture-card .el-upload-list__item {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
::v-deep.el-upload--picture-card {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.el-upload__tip p {
|
||||
color: #999;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
::v-deep.fileItem {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #D0D4DC;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
cursor: default;
|
||||
|
||||
.uploadFile {
|
||||
text-align: start;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
color: #222;
|
||||
|
||||
.AiIcon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 8px;
|
||||
margin-right: 40px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.size {
|
||||
color: #888;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.uploaderBox {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
line-height: 1;
|
||||
background: #F3F4F7;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #D0D4DC;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 32px;
|
||||
color: #8899bb;
|
||||
|
||||
&:hover {
|
||||
color: #8899bb;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding-top: 4px;
|
||||
color: #555;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -24,6 +24,91 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
resolve(res.json());
|
||||
});
|
||||
}).then(sendResponse);
|
||||
} else if (request.type == 'temuApi') {
|
||||
new Promise((resolve) => {
|
||||
let headers = {};
|
||||
if (request.anti) {
|
||||
headers["Anti-Content"] = request.anti
|
||||
}
|
||||
headers['Content-Type'] = 'application/json';
|
||||
headers.cookie = getTemuCookie();
|
||||
Promise.resolve().then(() => fetch(request.url, {
|
||||
'headers': headers,
|
||||
'method': 'POST',
|
||||
'referrerPolicy': 'no-referrer',
|
||||
'credentials': 'include',
|
||||
'body': JSON.stringify(request.data),
|
||||
'mode': 'cors'
|
||||
})).then((res) => {
|
||||
resolve(res.json());
|
||||
});
|
||||
}).then(sendResponse);
|
||||
} else if (request.type == 'temu') {
|
||||
new Promise((resolve) => {
|
||||
let headers = {};
|
||||
headers['Content-Type'] = 'text/html';
|
||||
headers.cookie = getTemuCookie();
|
||||
Promise.resolve().then(() => fetch(request.url, {
|
||||
'headers': headers,
|
||||
'method': 'GET',
|
||||
'referrerPolicy': 'no-referrer',
|
||||
'credentials': 'include',
|
||||
'mode': 'cors'
|
||||
})).then((res) => {
|
||||
// 创建了一个数据读取器
|
||||
const reader = res.body.getReader();
|
||||
// 创建了一个文本解码器
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
let text = ""
|
||||
reader.read().then(function processText({ done, value }) {
|
||||
// Result 对象包含了两个属性:
|
||||
// done - 当 stream 传完所有数据时则变成 true
|
||||
// value - 数据片段。当 done 为 true 时始终为 undefined
|
||||
if (done) {
|
||||
resolve(text);
|
||||
return;
|
||||
}
|
||||
// 将字节流转换为字符
|
||||
text = text + decoder.decode(value)
|
||||
// 再次调用这个函数以读取更多数据
|
||||
return reader.read().then(processText);
|
||||
});
|
||||
});
|
||||
}).then(sendResponse);
|
||||
} else if (request.type == 'aliexpress') {
|
||||
new Promise((resolve) => {
|
||||
let headers = {};
|
||||
headers['Content-Type'] = 'text/html';
|
||||
headers.cookie = getAliexpressCookie();
|
||||
Promise.resolve().then(() => fetch(request.url, {
|
||||
'headers': headers,
|
||||
'method': 'GET',
|
||||
'referrerPolicy': 'no-referrer',
|
||||
'credentials': 'include',
|
||||
'mode': 'cors'
|
||||
})).then((res) => {
|
||||
// 创建了一个数据读取器
|
||||
const reader = res.body.getReader();
|
||||
// 创建了一个文本解码器
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
let text = ""
|
||||
reader.read().then(function processText({ done, value }) {
|
||||
// Result 对象包含了两个属性:
|
||||
// done - 当 stream 传完所有数据时则变成 true
|
||||
// value - 数据片段。当 done 为 true 时始终为 undefined
|
||||
if (done) {
|
||||
resolve(text);
|
||||
return;
|
||||
}
|
||||
// 将字节流转换为字符
|
||||
text = text + decoder.decode(value)
|
||||
// 再次调用这个函数以读取更多数据
|
||||
return reader.read().then(processText);
|
||||
});
|
||||
});
|
||||
}).then(sendResponse);
|
||||
} else if (request.type == 'notify') {
|
||||
chrome.notifications.create(
|
||||
"" + Math.random(), {
|
||||
@@ -84,3 +169,25 @@ function getCookie() {
|
||||
});
|
||||
return cStr;
|
||||
}
|
||||
|
||||
function getTemuCookie() {
|
||||
const url = new URL("https://www.temu.com/");
|
||||
let cStr = '';
|
||||
chrome.cookies.getAll({domain: url.host}, (cookie) => {
|
||||
cookie.map((c) => {
|
||||
cStr += c.name + '=' + c.value + ';';
|
||||
});
|
||||
});
|
||||
return cStr;
|
||||
}
|
||||
|
||||
function getAliexpressCookie() {
|
||||
const url = new URL("https://www.aliexpress.us/");
|
||||
let cStr = '';
|
||||
chrome.cookies.getAll({domain: url.host}, (cookie) => {
|
||||
cookie.map((c) => {
|
||||
cStr += c.name + '=' + c.value + ';';
|
||||
});
|
||||
});
|
||||
return cStr;
|
||||
}
|
||||
@@ -1,25 +1,10 @@
|
||||
// import {genAnti} from "@/api/genAnti";
|
||||
|
||||
// const popup = document.createElement("div")
|
||||
// popup.innerText = "获取Anti"
|
||||
// const styles = {
|
||||
// position: "fixed",
|
||||
// right: '10px',
|
||||
// top: '60px',
|
||||
// zIndex: 9999,
|
||||
// padding: "8px",
|
||||
// background: "#409EFF",
|
||||
// color: "#fff",
|
||||
// borderRadius: "8px",
|
||||
// cursor: "pointer"
|
||||
// }
|
||||
// for (const e in styles) {
|
||||
// popup.style[e] = styles[e]
|
||||
// }
|
||||
//
|
||||
// popup.addEventListener('click', async () => {
|
||||
// const anti = await genAnti.a()
|
||||
// console.log(anti)
|
||||
// })
|
||||
// document.body.appendChild(popup)
|
||||
|
||||
function injectScript(file, node) {
|
||||
var th = document.getElementsByTagName(node)[0];
|
||||
var s = document.createElement('script');
|
||||
s.setAttribute('type', 'text/javascript');
|
||||
s.setAttribute('src', file);
|
||||
th.appendChild(s);
|
||||
}
|
||||
injectScript( chrome.runtime.getURL('/js/jszip.min.js'), 'body');
|
||||
injectScript( chrome.runtime.getURL('/js/FileSaver.js'), 'body');
|
||||
injectScript( chrome.runtime.getURL('/js/download.js'), 'body');
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
"action": {
|
||||
},
|
||||
"host_permissions": [
|
||||
"*://*.pinduoduo.com/"
|
||||
"*://*.pinduoduo.com/",
|
||||
"*://*.temu.com/",
|
||||
"*://*.aliexpress.us/",
|
||||
"*://*.amazon.com/"
|
||||
],
|
||||
"permissions": [
|
||||
"cookies",
|
||||
@@ -37,11 +40,18 @@
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"<all_urls>"
|
||||
"*://*.aliexpress.us/item/*",
|
||||
"*://*.amazon.com/*"
|
||||
],
|
||||
"js": [
|
||||
"/content.js"
|
||||
]
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": [ "js/download.js","js/jszip.min.js","js/FileSaver.js" ],
|
||||
"matches": [ "*://*.aliexpress.us/*", "*://*.amazon.com/*" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"manifest_version": 3,
|
||||
"name": "TEMU助手",
|
||||
"description": "TEMU助手 - 自动化提高生产效率",
|
||||
"version": "2.3.3",
|
||||
"version": "3.0.0",
|
||||
"background": {
|
||||
"service_worker": "/background.js"
|
||||
},
|
||||
@@ -14,7 +14,10 @@
|
||||
"action": {
|
||||
},
|
||||
"host_permissions": [
|
||||
"*://*.pinduoduo.com/"
|
||||
"*://*.pinduoduo.com/",
|
||||
"*://*.temu.com/",
|
||||
"*://*.aliexpress.us/",
|
||||
"*://*.amazon.com/"
|
||||
],
|
||||
"permissions": [
|
||||
"cookies",
|
||||
@@ -37,11 +40,18 @@
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"<all_urls>"
|
||||
"*://*.aliexpress.us/item/*",
|
||||
"*://*.amazon.com/*"
|
||||
],
|
||||
"js": [
|
||||
"/content.js"
|
||||
]
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": [ "js/download.js","js/jszip.min.js","js/FileSaver.js" ],
|
||||
"matches": [ "*://*.aliexpress.us/*", "*://*.amazon.com/*" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ const router = new VueRouter({
|
||||
name: 'shippingList',
|
||||
component: () => import('../view/shipping/ShippingList.vue')
|
||||
},
|
||||
{
|
||||
path: 'waitPackageList',
|
||||
name: 'waitPackageList',
|
||||
component: () => import('../view/shipping/WaitPackageList.vue')
|
||||
},
|
||||
{
|
||||
path: 'waitShippingList',
|
||||
name: 'waitShippingList',
|
||||
@@ -57,11 +62,33 @@ const router = new VueRouter({
|
||||
component: () => import('../view/product/ReducePrice.vue')
|
||||
},
|
||||
|
||||
{
|
||||
path: 'niubiCopy',
|
||||
name: 'niubiCopy',
|
||||
component: () => import('../view/selection/NiubiCopy.vue')
|
||||
},
|
||||
{
|
||||
path: 'storeTrack',
|
||||
name: 'storeTrack',
|
||||
component: () => import('../view/selection/storetrack/Index.vue')
|
||||
},
|
||||
{
|
||||
path: 'keywordTrack',
|
||||
name: 'keywordTrack',
|
||||
component: () => import('../view/selection/keywordtrack/Index.vue')
|
||||
},
|
||||
|
||||
{
|
||||
path: 'message',
|
||||
name: 'message',
|
||||
component: () => import('../view/Message.vue')
|
||||
},
|
||||
|
||||
{
|
||||
path: 'coinFlow',
|
||||
name: 'coinFlow',
|
||||
component: () => import('../view/CoinFlow.vue')
|
||||
},
|
||||
|
||||
{
|
||||
path: 'saleData',
|
||||
|
||||
@@ -7,79 +7,78 @@ import router from '@/router'
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
token: '',
|
||||
mallId: '',
|
||||
mallName: '',
|
||||
mallList: [],
|
||||
activeDlgShow: false,
|
||||
userInfo: {}
|
||||
},
|
||||
|
||||
mutations: {
|
||||
setToken (state, token) {
|
||||
state.token = token
|
||||
},
|
||||
setMallId (state, mallId) {
|
||||
state.mallId = mallId
|
||||
},
|
||||
setMallName (state, mallName) {
|
||||
state.mallName = mallName
|
||||
},
|
||||
setMallList (state, mallList) {
|
||||
state.mallList = mallList
|
||||
},
|
||||
logout (state) {
|
||||
state.token = ''
|
||||
state.userInfo = {}
|
||||
state.mallList = []
|
||||
state.mallName = ''
|
||||
state.mallId = ''
|
||||
|
||||
setTimeout(() => {
|
||||
router.push('/login')
|
||||
}, 200)
|
||||
},
|
||||
|
||||
setUserInfo (state, userInfo) {
|
||||
state.userInfo = userInfo
|
||||
},
|
||||
setActiveDlgShow (state, flag) {
|
||||
state.activeDlgShow = flag
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
getUserInfo (store) {
|
||||
return new Promise(resolve => {
|
||||
request.post('/api/malluser/info').then(res => {
|
||||
if (res.code === 0) {
|
||||
store.commit('setUserInfo', res.data)
|
||||
resolve(res.data)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
SignOut (store, isClear) {
|
||||
if (isClear) {
|
||||
store.commit('logout')
|
||||
return false
|
||||
}
|
||||
|
||||
request.post('/api/token/logout').then(res => {
|
||||
if (res.code === 0) {
|
||||
store.commit('logout')
|
||||
}
|
||||
})
|
||||
}
|
||||
state: {
|
||||
token: '',
|
||||
mallId: '',
|
||||
mallName: '',
|
||||
mallList: [],
|
||||
activeDlgShow: false,
|
||||
userInfo: {}
|
||||
},
|
||||
|
||||
getters: {
|
||||
isLogin: state => {
|
||||
return !!state.token
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setToken(state, token) {
|
||||
state.token = token
|
||||
},
|
||||
setMallId(state, mallId) {
|
||||
state.mallId = mallId
|
||||
},
|
||||
setMallName(state, mallName) {
|
||||
state.mallName = mallName
|
||||
},
|
||||
setMallList(state, mallList) {
|
||||
state.mallList = mallList
|
||||
},
|
||||
logout(state) {
|
||||
state.token = ''
|
||||
state.userInfo = {}
|
||||
state.mallList = []
|
||||
state.mallName = ''
|
||||
state.mallId = ''
|
||||
|
||||
setTimeout(() => {
|
||||
router.push('/login')
|
||||
}, 200)
|
||||
},
|
||||
|
||||
setUserInfo(state, userInfo) {
|
||||
state.userInfo = userInfo
|
||||
},
|
||||
setActiveDlgShow(state, flag) {
|
||||
state.activeDlgShow = flag
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
getUserInfo(store) {
|
||||
return new Promise(resolve => {
|
||||
request.post('/api/malluser/info').then(res => {
|
||||
if (res.code === 0) {
|
||||
store.commit('setUserInfo', res.data)
|
||||
resolve(res.data)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
SignOut(store, isClear) {
|
||||
if (isClear) {
|
||||
store.commit('logout')
|
||||
return false
|
||||
}
|
||||
|
||||
request.post('/api/token/logout').then(res => {
|
||||
if (res.code === 0) {
|
||||
store.commit('logout')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getters: {
|
||||
isLogin: state => {
|
||||
return !!state.token
|
||||
}
|
||||
},
|
||||
|
||||
plugins: [preState()]
|
||||
})
|
||||
|
||||
@@ -16,7 +16,6 @@ export function transform(leftData) {
|
||||
// 普通属性
|
||||
rightData.productName = leftData.productName;
|
||||
rightData.materialMultiLanguages = leftData.productLocalExtAttr.materialMultiLanguages;
|
||||
rightData.productI18nReqs = leftData.productI18nList;
|
||||
rightData.productPropertyReqs = [];
|
||||
for (let i = 0; i < leftData.productPropertyList.length; i++) {
|
||||
rightData.productPropertyReqs.push({
|
||||
@@ -121,9 +120,18 @@ export function transform(leftData) {
|
||||
imageUrl: leftData.outerPackageImages[i].imageUrl
|
||||
})
|
||||
}
|
||||
if (leftData.productGuideFileI18nList) {
|
||||
rightData.productGuideFileI18nReqs = leftData.productGuideFileI18nList.map(item => {
|
||||
return {fileName: item.fileName,
|
||||
fileUrl: item.fileUrl,
|
||||
language: item.language,
|
||||
languages: item.languages}
|
||||
});
|
||||
} else {
|
||||
rightData.productGuideFileI18nReqs = []
|
||||
}
|
||||
rightData.productOuterPackageReq = leftData.productWhExtAttr.productOuterPackage;
|
||||
rightData.sensitiveTransNormalFileReqs = leftData.productWhExtAttr.sensitiveTransNormalFiles;
|
||||
rightData.productGuideFileI18nReqs = leftData.productGuideFileI18nList;
|
||||
rightData.productSaleExtAttrReq = {};
|
||||
rightData.productDraftId = "";
|
||||
|
||||
|
||||
87
src/view/CoinFlow.vue
Normal file
87
src/view/CoinFlow.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<ai-list class="Learning">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="金币流水"
|
||||
isShowBottomBorder>
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<div class="search-item">
|
||||
<label style="width:80px">分类:</label>
|
||||
<ai-select :selectList="$dict.getDict('coin_change_type')" :clearable="true" v-model="search.category" @change="search.current =1, getList()"></ai-select>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label style="width:80px">类型:</label>
|
||||
<ai-select :selectList="$dict.getDict('coin_type')" :clearable="true" v-model="search.type" @change="search.current =1, getList()"></ai-select>
|
||||
</div>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-button type="primary" @click="search.current =1, getList()">查询</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
style="margin-top: 8px;"
|
||||
@getList="getList">
|
||||
<el-table-column slot="coin" label="金币" align="left">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.category == '0'" style="color: green">{{ scope.row.coin }}</div>
|
||||
<div v-else style="color: red">{{ -scope.row.coin }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
colConfigs: [
|
||||
{ prop: 'category', label: '分类', align: 'left',format: v => this.$dict.getLabel('coin_change_type', v), },
|
||||
{ prop: 'type', label: '类型', align: 'left',format: v => this.$dict.getLabel('coin_type', v), },
|
||||
{ slot: 'coin', label: '金币', align: 'left' },
|
||||
{ prop: 'createTime', label: '时间', align: 'center' },
|
||||
],
|
||||
tableData: [],
|
||||
total: 0,
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
category: '',
|
||||
type: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.$dict.load('coin_change_type', 'coin_type');
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.$http.post('/api/coinFlow/myPage', null, {
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@@ -160,7 +160,7 @@ import { Message } from 'element-ui'
|
||||
mallName: '',
|
||||
type: '0',
|
||||
isLoading: false,
|
||||
pageSize: 10,
|
||||
pageSize: 100,
|
||||
currentPage: 1,
|
||||
todayTotal: 0,
|
||||
todayMoney: 0.0,
|
||||
@@ -171,9 +171,11 @@ import { Message } from 'element-ui'
|
||||
allProductList: [],
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
skuIds: [],
|
||||
jsonFields: {
|
||||
"商品名称": "productName",
|
||||
"店铺名称": "mallName",
|
||||
"评分": "mark",
|
||||
"SPU": "productId",
|
||||
"SKC": "productSkcId",
|
||||
"SKU ID": "productSkuId",
|
||||
@@ -241,6 +243,13 @@ import { Message } from 'element-ui'
|
||||
width: '120px',
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'mark',
|
||||
label: '评分',
|
||||
"show-overflow-tooltip": true,
|
||||
width: '80px',
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'productId',
|
||||
label: 'SPU',
|
||||
@@ -596,6 +605,7 @@ import { Message } from 'element-ui'
|
||||
data.skcExtCode = item.skcExtCode;
|
||||
data.purchaseConfig = item.purchaseConfig;
|
||||
data.productSkcPicture = item.productSkcPicture;
|
||||
data.mark = item.mark.toFixed(1)
|
||||
data.mallName = this.mallName;
|
||||
|
||||
this.last30DaySkcList.push({
|
||||
@@ -678,7 +688,10 @@ import { Message } from 'element-ui'
|
||||
}
|
||||
return temp
|
||||
})
|
||||
this.getSkuDetailList()
|
||||
this.skuIds = this.list.map(item => {
|
||||
return item.productSkuId
|
||||
})
|
||||
this.getSkuDetailList(0)
|
||||
}
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
@@ -690,17 +703,24 @@ import { Message } from 'element-ui'
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
getSkuDetailList () {
|
||||
let skuIds = this.list.map(item => {
|
||||
return item.productSkuId
|
||||
})
|
||||
getSkuDetailList (page) {
|
||||
let tempSkuId = []
|
||||
let i = page * 500
|
||||
let j = 0
|
||||
for (; i < this.skuIds.length; i++) {
|
||||
tempSkuId.push(this.skuIds[i])
|
||||
j ++
|
||||
if (j == 500) break
|
||||
}
|
||||
if (tempSkuId.length == 0) return
|
||||
sendChromeAPIMessage({
|
||||
url: 'oms/bg/venom/api/supplier/sales/management/querySkuSalesNumber',
|
||||
needMallId: true,
|
||||
mallId: this.mallId,
|
||||
data: {
|
||||
"productSkuIds": skuIds,
|
||||
"productSkuIds": tempSkuId,
|
||||
"startDate": this.startDate,
|
||||
// "startDate": '2023-01-17',
|
||||
"endDate": this.endDate
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
@@ -719,9 +739,10 @@ import { Message } from 'element-ui'
|
||||
}
|
||||
}
|
||||
}
|
||||
this.getSkuDetailList(page + 1)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.getSkuDetailList()
|
||||
this.getSkuDetailList(page)
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
<span>v{{ version }}</span>
|
||||
</div>
|
||||
<div class="admin-right">
|
||||
<el-tooltip class="item" effect="dark" content="金币信息" placement="top">
|
||||
<div class="left" @click="toActive">
|
||||
<div :style="{marginLeft: '0px'}">{{ $store.state.userInfo.coin }}</div>
|
||||
<span style="margin-right: 10px;"><img src="../assets/coin.png" width="30"/></span>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<el-tooltip class="item" effect="dark" content="用户激活" placement="top">
|
||||
<div class="left" @click="toActive">
|
||||
<span>会员信息:</span>
|
||||
@@ -21,6 +27,7 @@
|
||||
<!-- <el-dropdown-item command="phone">修改手机</el-dropdown-item> -->
|
||||
<el-dropdown-item command="pwd">修改密码</el-dropdown-item>
|
||||
<el-dropdown-item command="message">消息推送</el-dropdown-item>
|
||||
<el-dropdown-item command="coin">金币流水</el-dropdown-item>
|
||||
<el-dropdown-item command="logout">退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
@@ -47,6 +54,7 @@
|
||||
</template>
|
||||
<el-menu-item index="/normalSendGoods">抢仓发货</el-menu-item>
|
||||
<el-menu-item index="/shippingDesk">发货台管理</el-menu-item>
|
||||
<el-menu-item index="/waitPackageList">待装箱发货单</el-menu-item>
|
||||
<el-menu-item index="/waitShippingList">待收货发货单</el-menu-item>
|
||||
<el-menu-item index="/shippingList">已收货发货单</el-menu-item>
|
||||
</el-submenu>
|
||||
@@ -57,7 +65,15 @@
|
||||
<span slot="title">商品管理</span>
|
||||
</template>
|
||||
<el-menu-item index="/copyProduct">商品复制</el-menu-item>
|
||||
<!--<el-menu-item index="/reducePrice">商品调价</el-menu-item>-->
|
||||
</el-submenu>
|
||||
<el-submenu index="/niubiCopy">
|
||||
<template slot="title">
|
||||
<i class="el-icon-magic-stick"></i>
|
||||
<span slot="title">选品采集</span>
|
||||
</template>
|
||||
<el-menu-item index="/niubiCopy">智能复制</el-menu-item>
|
||||
<el-menu-item index="/storeTrack">店铺跟踪</el-menu-item>
|
||||
<el-menu-item index="/keywordTrack">关键字跟踪</el-menu-item>
|
||||
</el-submenu>
|
||||
|
||||
<el-menu-item index="/saleData">
|
||||
@@ -83,43 +99,22 @@
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog
|
||||
title="用户激活"
|
||||
title="激活充值"
|
||||
:visible="$store.state.activeDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="30%"
|
||||
width="1200"
|
||||
:before-close="handleClose">
|
||||
<el-form :model="form" label-position="top" ref="form" label-width="100px" class="form">
|
||||
<el-form-item
|
||||
prop="mallName"
|
||||
label="当前绑定账号"
|
||||
:rules="[{ required: true, message: '请先登录拼多多跨境卖家中心', trigger: 'blur' }]">
|
||||
<el-input readonly placeholder="请先登录拼多多跨境卖家中心" v-model="form.mallName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="mallId"
|
||||
v-show="false"
|
||||
:rules="[{ message: '请输入商城ID', trigger: 'blur' }]">
|
||||
<el-input placeholder="请输入商城ID" v-model="form.mallId"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="code"
|
||||
label="激活码"
|
||||
:rules="[{ required: true, message: '请输入激活码', trigger: 'blur' }]">
|
||||
<el-input placeholder="请输入激活码" v-model="form.code"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="$store.commit('setActiveDlgShow', false)">取 消</el-button>
|
||||
<el-button type="primary" @click="active">确 定</el-button>
|
||||
</span>
|
||||
<ai-payment/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import {mapMutations, mapState} from 'vuex'
|
||||
import AiPayment from "@/components/AiPayment.vue";
|
||||
|
||||
export default {
|
||||
components: {AiPayment},
|
||||
data () {
|
||||
return {
|
||||
isCollapse: false,
|
||||
@@ -130,7 +125,7 @@
|
||||
code: ''
|
||||
},
|
||||
version: '',
|
||||
vipType: ["体验会员","月会员","半年会员","年会员","年会员多店通用"]
|
||||
vipType: ["体验会员","月会员","半年会员","年会员","多店通用年会员"]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -139,9 +134,9 @@
|
||||
return '未激活';
|
||||
} else if (this.$store.state.userInfo.flag == 1) {
|
||||
if (this.$store.state.userInfo.type != 4) {
|
||||
return `(${this.$store.state.userInfo.mallName})` + this.vipType[this.$store.state.userInfo.type] + '/有效期至' + this.$store.state.userInfo.expireTime;
|
||||
return `(${this.$store.state.userInfo.mallName})` + this.vipType[this.$store.state.userInfo.type];
|
||||
} else {
|
||||
return this.vipType[this.$store.state.userInfo.type] + '/有效期至' + this.$store.state.userInfo.expireTime
|
||||
return this.vipType[this.$store.state.userInfo.type]
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -166,6 +161,7 @@
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapMutations(['setActiveDlgShow']),
|
||||
handleClick (e) {
|
||||
if (e === 'logout') {
|
||||
this.$store.dispatch('SignOut', false)
|
||||
@@ -173,16 +169,18 @@
|
||||
this.$router.push('changePwd')
|
||||
} else if (e === 'message') {
|
||||
this.$router.push('message')
|
||||
} else if (e === 'coin') {
|
||||
this.$router.push('coinFlow')
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.form.mallId = "";
|
||||
this.form.mallName = "";
|
||||
this.form.code = "";
|
||||
this.$store.commit('setActiveDlgShow', false)
|
||||
this.setActiveDlgShow(false)
|
||||
},
|
||||
toActive() {
|
||||
this.$store.commit('setActiveDlgShow', true)
|
||||
this.setActiveDlgShow(true)
|
||||
},
|
||||
getMessage(type) {
|
||||
return `你使用的是“${this.vipType[type]}”兑换券,确定兑换?`;
|
||||
@@ -210,7 +208,7 @@
|
||||
if (res.code == 0) {
|
||||
this.$message.success('激活成功')
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.$store.commit('setActiveDlgShow', false)
|
||||
this.setActiveDlgShow(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'AdminHome',
|
||||
|
||||
data () {
|
||||
return {
|
||||
noticeList: [],
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
:rules="[{ required: true, message: '请再次输入密码', trigger: 'blur' }]">
|
||||
<el-input placeholder="请再次输入密码" type="password" v-model="form.repassword"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="inviteCode">
|
||||
<el-input placeholder="请输入邀请码(非必填)" v-model="form.inviteCode"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="code" :rules="[{ required: true, message: '请输入验证码', trigger: 'blur' }]">
|
||||
<div class="code-item">
|
||||
<el-input style="width: 300px;" maxlength="4" placeholder="请输入验证码" v-model="form.code"></el-input>
|
||||
@@ -56,6 +60,7 @@
|
||||
password: '',
|
||||
repassword: '',
|
||||
code: '',
|
||||
inviteCode: '',
|
||||
phone: ''
|
||||
},
|
||||
phoneReg: (rule, value, callback) => {
|
||||
|
||||
@@ -51,6 +51,6 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss">
|
||||
@import '../assets/css/index.scss';
|
||||
</style>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
productName: '',
|
||||
productSkcIds: ''
|
||||
}, getProductList()">重置</el-button>
|
||||
<el-button type="primary" @click="search.page =1, getProductList()">查询</el-button>
|
||||
<el-button type="primary" @click="productPage.page =1, getProductList()">查询</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
@@ -284,7 +284,7 @@ import { Message } from 'element-ui'
|
||||
};
|
||||
})
|
||||
} else {
|
||||
Message.error("【拼多多】" + res.errorMsg)
|
||||
this.getProductList()
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -300,37 +300,42 @@ import { Message } from 'element-ui'
|
||||
return;
|
||||
}
|
||||
this.productIds.map((productSpu, index) => {
|
||||
setTimeout(() => {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/query',
|
||||
needMallId: true,
|
||||
mallId: this.productPage.mallId,
|
||||
data: {
|
||||
productEditTaskUid: '',
|
||||
productId: productSpu
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
let content = transform(res.result)
|
||||
let mallInfo = this.$store.state.mallList.filter(item => {
|
||||
return item.mallId == this.productPage.mallId
|
||||
})
|
||||
this.$http.post('/api/product/add', {
|
||||
mallId: mallInfo[0].mallId,
|
||||
mallName: mallInfo[0].mallName,
|
||||
productSpu: res.result.productId,
|
||||
productName: res.result.productName,
|
||||
content: content
|
||||
}).then(res1 => {
|
||||
if (res1.code == 0) {
|
||||
Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
|
||||
if (index == this.productIds.length - 1) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.saveTemplate(productSpu, index)
|
||||
}, 200 * index)
|
||||
})
|
||||
},
|
||||
saveTemplate(spu, index) {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/query',
|
||||
needMallId: true,
|
||||
mallId: this.productPage.mallId,
|
||||
data: {
|
||||
productEditTaskUid: '',
|
||||
productId: spu
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
let content = transform(res.result)
|
||||
let mallInfo = this.$store.state.mallList.filter(item => {
|
||||
return item.mallId == this.productPage.mallId
|
||||
})
|
||||
this.$http.post('/api/product/add', {
|
||||
mallId: mallInfo[0].mallId,
|
||||
mallName: mallInfo[0].mallName,
|
||||
productSpu: res.result.productId,
|
||||
productName: res.result.productName,
|
||||
content: content
|
||||
}).then(res1 => {
|
||||
if (res1.code == 0) {
|
||||
Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
|
||||
if (index == this.productIds.length - 1) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 200 * index)
|
||||
} else {
|
||||
this.saveTemplate(spu, index)
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeAddToDraft() {
|
||||
|
||||
340
src/view/selection/KeywordTrack.vue
Normal file
340
src/view/selection/KeywordTrack.vue
Normal file
@@ -0,0 +1,340 @@
|
||||
<template>
|
||||
<div>
|
||||
<ai-list class="list">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="店铺跟踪"
|
||||
isShowBottomBorder>
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<div class="content">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<el-button type="button" :icon="'el-icon-delete'" :class="'el-button el-button--primary'" @click="remove()">删除</el-button>
|
||||
<el-button v-if="$store.state.mallName" type="button" :class="'el-button el-button--primary'" @click="toAddTemplate()">添加商品模板</el-button>
|
||||
<el-button v-if="$store.state.mallName" type="button" :class="'el-button el-button--primary'" @click="beforeAddToDraft">添加到草稿箱</el-button>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-button size="small" circle icon="el-icon-refresh-right" @click="getList()"></el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
:current.sync="search.current" :size.sync="search.size"
|
||||
@selection-change="handleSelectionChange"
|
||||
@getList="getList">
|
||||
</ai-table>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
|
||||
<ai-dialog
|
||||
title="添加店铺"
|
||||
:visible.sync="mallDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="790px"
|
||||
customFooter
|
||||
@close="handleClose">
|
||||
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
|
||||
<el-form-item label="店铺" style="width: 100%;" prop="targetMallId" :rules="[{ required: true, message: '请选择店铺', trigger: 'blur' }]">
|
||||
<el-select style="width: 380px" v-model="form.targetMallId" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
:key="item.mallId"
|
||||
:label="item.mallName"
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类" style="width: 100%;" prop="targetCatId" :rules="[{ required: true, message: '请选择商品分类', trigger: 'blur' }]">
|
||||
<el-cascader style="width: 380px" v-model="form.targetCatId" :props="props"></el-cascader>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="dialog-footer" slot="footer">
|
||||
<el-button @click="mallDlgShow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="addToDraft">确定</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {sendChromeAPIMessage} from '@/api/chromeApi'
|
||||
import {timestampToTime} from '@/utils/date'
|
||||
import {transform} from '@/utils/product'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
export default {
|
||||
name: 'CopyProduct',
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
productName: '',
|
||||
mallName: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
},
|
||||
props: {
|
||||
value: 'catId',
|
||||
label: 'catName',
|
||||
lazy: true,
|
||||
lazyLoad (node, resolve) {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-anniston-mms/category/children/list',
|
||||
needMallId: true,
|
||||
data: {
|
||||
parentCatId: node.value || ''
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.errorCode === 1000000) {
|
||||
resolve(res.result.categoryNodeVOS.map(v => {
|
||||
return {
|
||||
...v,
|
||||
leaf: v.isLeaf
|
||||
}
|
||||
}))
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
colConfigs: [
|
||||
{ type: "selection", width: '70px', align: 'left', fixed: 'left'},
|
||||
{ prop: 'productSpu', label: 'SPU', align: 'left' },
|
||||
{ prop: 'productName', label: '商品名称', align: 'left' },
|
||||
{ prop: 'mallName', label: '来源店铺', align: 'left'},
|
||||
{ prop: 'createTime', label: '添加时间', width: '180px', fixed: 'right'}
|
||||
],
|
||||
tableData: [],
|
||||
total: 0,
|
||||
ids: [],
|
||||
|
||||
dlgShow: false,
|
||||
productTableData: [],
|
||||
productPage: {page: 1, pageSize: 10, mallId: '', productName: '', productSkcIds: '', total: 0},
|
||||
productColConfigs: [
|
||||
{ type: "selection", width: '70px', align: 'left', fixed: 'left'},
|
||||
{ prop: 'productSpu', label: 'SPU ID', align: 'left' },
|
||||
{ prop: 'productSkc', label: 'SKC ID', align: 'left' },
|
||||
{ prop: 'productName', label: '商品名称', align: 'left' },
|
||||
{ prop: 'createTime', label: '创建时间', align: 'left' }
|
||||
],
|
||||
|
||||
mallDlgShow: false,
|
||||
productIds: [],
|
||||
form: {
|
||||
targetMallId: '',
|
||||
targetCatId: []
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.getList()
|
||||
if (this.$store.state.mallList.length > 0) {
|
||||
this.productPage.mallId = this.$store.state.mallList[0].mallId
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.$http.post('/api/product/myPage',null,{
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
remove () {
|
||||
if (this.ids.length <= 0) {
|
||||
alert('请选择要删除的商品');
|
||||
return;
|
||||
}
|
||||
this.$confirm('确定要删除?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post('/api/product/delByIds',this.ids
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = [];
|
||||
val.forEach(e => {
|
||||
this.ids.push(e.id);
|
||||
});
|
||||
},
|
||||
|
||||
// 添加模板
|
||||
handleClose() {
|
||||
this.productTableData = []
|
||||
this.productPage = {page: 1, pageSize: 10, total: 0}
|
||||
this.dlgShow = false
|
||||
},
|
||||
toAddTemplate() {
|
||||
this.$http.post('/api/malluser/info').then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$store.commit('setUserInfo', res.data)
|
||||
if (res.data.flag != 1) {
|
||||
Message.error('您的账号未激活或已失效,请激活后使用')
|
||||
this.$store.commit('setActiveDlgShow', true)
|
||||
return;
|
||||
}
|
||||
this.dlgShow = true
|
||||
this.getProductList()
|
||||
}
|
||||
})
|
||||
},
|
||||
getProductList() {
|
||||
let params = {};
|
||||
params.page = this.productPage.page;
|
||||
params.pageSize = this.productPage.pageSize;
|
||||
if (this.productPage.productName) {
|
||||
params.productName = this.productPage.productName
|
||||
}
|
||||
if (this.productPage.productSkcIds) {
|
||||
params.productSkcIds = this.productPage.productSkcIds.split(',')
|
||||
}
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/skc/pageQuery',
|
||||
needMallId: true,
|
||||
mallId: this.productPage.mallId,
|
||||
data: {
|
||||
...params
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
this.productPage.total = res.result.total
|
||||
this.productTableData = res.result.pageItems.map((item) => {
|
||||
return {
|
||||
productSpu: item.productId,
|
||||
productSkc: item.productSkcId,
|
||||
productName: item.productName,
|
||||
createTime: timestampToTime(item.createdAt)
|
||||
};
|
||||
})
|
||||
} else {
|
||||
this.getProductList()
|
||||
}
|
||||
});
|
||||
},
|
||||
productHandleSelectionChange(val) {
|
||||
this.productIds = [];
|
||||
val.forEach(e => {
|
||||
this.productIds.push(e.productSpu);
|
||||
});
|
||||
},
|
||||
saveProduct() {
|
||||
if (this.productIds.length <= 0) {
|
||||
Message.error('请选择商品');
|
||||
return;
|
||||
}
|
||||
this.productIds.map((productSpu, index) => {
|
||||
setTimeout(() => {
|
||||
this.saveTemplate(productSpu, index)
|
||||
}, 200 * index)
|
||||
})
|
||||
},
|
||||
saveTemplate(spu, index) {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/query',
|
||||
needMallId: true,
|
||||
mallId: this.productPage.mallId,
|
||||
data: {
|
||||
productEditTaskUid: '',
|
||||
productId: spu
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
let content = transform(res.result)
|
||||
let mallInfo = this.$store.state.mallList.filter(item => {
|
||||
return item.mallId == this.productPage.mallId
|
||||
})
|
||||
this.$http.post('/api/product/add', {
|
||||
mallId: mallInfo[0].mallId,
|
||||
mallName: mallInfo[0].mallName,
|
||||
productSpu: res.result.productId,
|
||||
productName: res.result.productName,
|
||||
content: content
|
||||
}).then(res1 => {
|
||||
if (res1.code == 0) {
|
||||
Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
|
||||
if (index == this.productIds.length - 1) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.saveTemplate(spu, index)
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeAddToDraft() {
|
||||
if (this.ids.length <= 0) {
|
||||
Message.error('请选择商品模板');
|
||||
return;
|
||||
}
|
||||
this.mallDlgShow = true
|
||||
},
|
||||
addToDraft() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.ids.map((id, index) => {
|
||||
let product = this.tableData.filter((item) => {
|
||||
return item.id == id
|
||||
})
|
||||
setTimeout(() => {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/draft/add',
|
||||
needMallId: true,
|
||||
mallId: this.form.targetMallId,
|
||||
data: {
|
||||
catId: this.form.targetCatId[this.form.targetCatId.length - 1]
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
let draftId = res.result.productDraftId
|
||||
let content = JSON.parse(product[0].content)
|
||||
let i = 0
|
||||
for (; i < this.form.targetCatId.length; i++) {
|
||||
content['cat' + (i+1) + 'Id'] = this.form.targetCatId[i]
|
||||
}
|
||||
for (; i < 10; i++) {
|
||||
content['cat' + (i+1) + 'Id'] = ''
|
||||
}
|
||||
content.productDraftId = draftId
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/draft/save',
|
||||
needMallId: true,
|
||||
mallId: this.form.targetMallId,
|
||||
data: {
|
||||
...content
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
Message.success("商品【" + product[0].productName + "】成功添加到草稿箱")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Message.error("【拼多多】" + res.errorMsg)
|
||||
}
|
||||
})
|
||||
}, 1000*index)
|
||||
})
|
||||
this.mallDlgShow = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
127
src/view/selection/NiubiCopy.vue
Normal file
127
src/view/selection/NiubiCopy.vue
Normal file
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div>
|
||||
<ai-list class="list">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="智能复制"
|
||||
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
|
||||
isShowBottomBorder>
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<div class="content">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<div class="search-item">
|
||||
<label style="width:80px">来源:</label>
|
||||
<ai-select :selectList="$dict.getDict('copy_from')" :clearable="true" v-model="search.type" @change="search.current =1, getList()"></ai-select>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label style="width:80px">店铺:</label>
|
||||
<el-select v-model="search.mallId" :clearable="true" @change="search.current =1, getList()" placeholder="请选择店铺" size="small">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
:key="item.mallId"
|
||||
:label="item.mallName"
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-button type="primary" @click="search.current =1, getList()">查询</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<el-button type="button" :class="'el-button el-button--primary'" @click="beforeCopy()">开始复制</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
:current.sync="search.current" :size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column slot="url" label="商品地址" align="left">
|
||||
<template slot-scope="scope">
|
||||
<div><a :href="scope.row.url" target="_blank">{{ scope.row.url }}</a></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
|
||||
<ai-dialog
|
||||
title="复制"
|
||||
:visible.sync="copyFromDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="790px"
|
||||
customFooter
|
||||
@close="handleClose">
|
||||
<ai-copy-from-temu v-if="copyFromDlgShow" @onClose="handleClose" @onSuccess="handleSuccess"></ai-copy-from-temu>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AiCopyFromTemu from "@/components/AiCopyFromTemu.vue";
|
||||
export default {
|
||||
name: 'NiubiCopy',
|
||||
components: {AiCopyFromTemu},
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
type: '',
|
||||
mallId: ''
|
||||
},
|
||||
|
||||
colConfigs: [
|
||||
{ slot: 'url', label: '商品地址', align: 'left' },
|
||||
{ prop: 'type', label: '来源', width: '100px', align: 'left',format: v => this.$dict.getLabel('copy_from', v), },
|
||||
{ prop: 'mallName', label: '店铺名称', width: '200px', align: 'left'},
|
||||
{ prop: 'createTime', label: '复制时间', width: '180px', fixed: 'right'}
|
||||
],
|
||||
tableData: [],
|
||||
total: 0,
|
||||
copyFromDlgShow: false,
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.$dict.load('copy_from');
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.$http.post('/api/copyProduct/myPage',null,{
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
beforeCopy() {
|
||||
this.copyFromDlgShow = true
|
||||
},
|
||||
handleClose() {
|
||||
this.copyFromDlgShow = false
|
||||
},
|
||||
// 添加模板成功
|
||||
handleSuccess() {
|
||||
this.copyFromDlgShow = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
57
src/view/selection/keywordtrack/Index.vue
Normal file
57
src/view/selection/keywordtrack/Index.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div style="height: 100%;">
|
||||
<transition name="fade-transform" mode="out-in">
|
||||
<keep-alive :include="['List']">
|
||||
<component ref="component" :is="component" @change="onChange" :params="params"></component>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import List from './components/List.vue'
|
||||
import Detail from './components/Detail.vue'
|
||||
|
||||
export default {
|
||||
name: 'KeywordTrack',
|
||||
label: '关键字跟踪',
|
||||
|
||||
components: {
|
||||
List,
|
||||
Detail
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
component: 'List',
|
||||
params: {}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChange (data) {
|
||||
if (data.type === 'Detail') {
|
||||
this.component = 'Detail'
|
||||
this.params = data.params
|
||||
}
|
||||
|
||||
if (data.type === 'List') {
|
||||
this.component = 'List'
|
||||
this.params = data.params
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (data.isRefresh) {
|
||||
setTimeout(() => {
|
||||
this.$refs.component.getList()
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
||||
169
src/view/selection/keywordtrack/components/Detail.vue
Normal file
169
src/view/selection/keywordtrack/components/Detail.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<div>
|
||||
<ai-list class="list">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="商品列表"
|
||||
isShowBottomBorder isShowBack @onBackClick="cancel(false)">
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; gap: 16px;">
|
||||
<el-card v-for="item in tableData" :key="item.id" :body-style="{ padding: '0px', margin: '5px' }">
|
||||
<img :src="item.imgUrl" class="image">
|
||||
<div style="padding: 14px;">
|
||||
<div class="bottom clearfix">
|
||||
<div style="margin-bottom: 5px;">
|
||||
<div style="display: inline; margin-left: 5px;">${{ item.priceAndSale[0].price }}<sub style="margin-left: 2px;" v-html="getPricePercent(item.priceAndSale)"></sub></div>
|
||||
<div style="display: inline; margin-right: 5px; float: right;">{{ item.priceAndSale[0].sale_total }}<sub style="margin-left: 2px;" v-html="getSalePercent(item.priceAndSale)"></sub></div>
|
||||
</div>
|
||||
<ai-product-drop-down :params="item" :isShowDetail="true" @onGoDetail="goDetail(item.goodsId)" style="float: right;"></ai-product-drop-down>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
|
||||
<div class="productDetail">
|
||||
<el-dialog
|
||||
title="商品详情"
|
||||
:visible="isShowDetailDlg"
|
||||
:close-on-click-modal="false"
|
||||
width="80%"
|
||||
:before-close="handleClose">
|
||||
<ai-product-detail v-if="isShowDetailDlg" :params="detailParams"/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AiProductDetail from "@/components/AiProductDetail.vue";
|
||||
import AiProductDropDown from '@/components/AiProductDropDown.vue';
|
||||
|
||||
export default {
|
||||
name: 'DetailPage',
|
||||
props: ['params'],
|
||||
components: {AiProductDetail, AiProductDropDown},
|
||||
data () {
|
||||
return {
|
||||
monitorId: '',
|
||||
search: {
|
||||
current: 1,
|
||||
type: '1',
|
||||
size: 120
|
||||
},
|
||||
tableData: [],
|
||||
total: 0,
|
||||
isShowDetailDlg: false,
|
||||
detailParams: {}
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.monitorId = this.params.id
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.$http.post('/api/monitorDetail/myPage',null,{
|
||||
params: {
|
||||
monitorId: this.monitorId,
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'List',
|
||||
isRefresh: !!isRefresh
|
||||
})
|
||||
},
|
||||
getPricePercent(data) {
|
||||
if (data.length == 2) {
|
||||
let a = (data[0].price - data[1].price) / data[1].price
|
||||
if (a < 0) {
|
||||
return '<div style="display: inline; color: green">↓' + (a*100).toFixed(2) + '%</div>'
|
||||
} else if (a == 0) {
|
||||
return ''
|
||||
} else if (a > 0) {
|
||||
return '<div style="display: inline; color: red">↑' + (a*100).toFixed(2) + '%</div>'
|
||||
}
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
getSalePercent(data) {
|
||||
if (data.length == 2) {
|
||||
let a = (data[0].sale_total - data[1].sale_total) / data[1].sale_total
|
||||
if (a < 0) {
|
||||
return '<div style="display: inline; color: green">↓' + (a*100).toFixed(2) + '%</div>'
|
||||
} else if (a == 0) {
|
||||
return ''
|
||||
} else if (a > 0) {
|
||||
return '<div style="display: inline; color: red">↑' + (a*100).toFixed(2) + '%</div>'
|
||||
}
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.isShowDetailDlg = false
|
||||
},
|
||||
goDetail (goodsId) {
|
||||
this.detailParams = {goodsId: goodsId}
|
||||
this.isShowDetailDlg = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.productDetail {
|
||||
:deep(.el-dialog) {
|
||||
height: 78vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
}
|
||||
.time {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
margin-top: 13px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both
|
||||
}
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
241
src/view/selection/keywordtrack/components/List.vue
Normal file
241
src/view/selection/keywordtrack/components/List.vue
Normal file
@@ -0,0 +1,241 @@
|
||||
<template>
|
||||
<div>
|
||||
<ai-list class="list">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="关键字跟踪"
|
||||
isShowBottomBorder>
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<div class="content">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<el-button type="button" :class="'el-button el-button--primary'" @click="addStore()">添加关键字</el-button>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-button size="small" circle icon="el-icon-refresh-right" @click="getList()"></el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
:current.sync="search.current" :size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column slot="options" label="操作" width="200px" show-overflow-tooltip align="center" fixed="right">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="deleteMonitor(row.id)">删除</el-button>
|
||||
<el-button type="text" @click="renew(row.id)">续费</el-button>
|
||||
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
|
||||
<el-button type="text" @click="toBegin(row)">采集数据</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
|
||||
<ai-dialog
|
||||
title="添加店铺"
|
||||
:visible.sync="isDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="790px"
|
||||
customFooter
|
||||
@close="isDlgShow = false">
|
||||
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
|
||||
<el-form-item
|
||||
prop="content"
|
||||
label="关键字"
|
||||
:rules="[{ required: true, message: '请输入关键字', trigger: 'blur' }]">
|
||||
<el-input placeholder="请输入关键字" v-model="form.content"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="dialog-footer" slot="footer">
|
||||
<el-button @click="isDlgShow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="saveStore">确定</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {sendTemuAPIMessage} from '@/api/chromeApi'
|
||||
|
||||
export default {
|
||||
name: 'List',
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
type: '0',
|
||||
size: 10
|
||||
},
|
||||
colConfigs: [
|
||||
{ prop: 'content', label: '关键字', align: 'left' },
|
||||
{ prop: 'lastUpdateTime', label: '最后一次更新时间', align: 'left' },
|
||||
{ prop: 'status', label: '状态', align: 'left', format: v => this.$dict.getLabel('monitor_status', v), },
|
||||
{ prop: 'expireTime', label: '失效时间', align: 'left' },
|
||||
{ prop: 'createTime', label: '添加时间', width: '180px', fixed: 'right'}
|
||||
],
|
||||
tableData: [],
|
||||
total: 0,
|
||||
|
||||
form: {
|
||||
content: ''
|
||||
},
|
||||
|
||||
isDlgShow: false,
|
||||
detailsVo: {},
|
||||
pageNo: 1,
|
||||
pageSize: 120
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.$dict.load('monitor_status');
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.$http.post('/api/monitor/myPage',null,{
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
saveStore () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http.post('/api/monitor/check',null, {params: {type: 0}}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$http.post(`/api/monitor/add`, {content: this.form.content, type: this.search.type}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('添加成功!')
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.getList()
|
||||
this.isDlgShow = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
renew(id) {
|
||||
this.$confirm('确定要续费?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post('/api/monitor/renew',null, {
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
}
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('续费成功!')
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
deleteMonitor(id) {
|
||||
this.$confirm('确定要删除?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post('/api/monitor/del',null, {
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
}
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
toDetail (id) {
|
||||
this.$emit('change', {
|
||||
type: 'Detail',
|
||||
params: {
|
||||
id: id || ''
|
||||
}
|
||||
})
|
||||
},
|
||||
addStore() {
|
||||
this.form.content = ''
|
||||
this.isDlgShow = true
|
||||
},
|
||||
toBegin(row) {
|
||||
this.detailsVo = {}
|
||||
this.detailsVo.monitorId = row.id
|
||||
this.detailsVo.details = []
|
||||
this.pageNo = 1
|
||||
|
||||
this.beginCollect(row)
|
||||
},
|
||||
beginCollect(row) {
|
||||
sendTemuAPIMessage({
|
||||
url: 'api/poppy/v1/search?scene=search',
|
||||
anti: true,
|
||||
data:
|
||||
{
|
||||
"scene": "search",
|
||||
"offset": (this.pageNo-1) * this.pageSize,
|
||||
"pageSize": 120,
|
||||
"query": row.content,
|
||||
"filterItems": "0:1",
|
||||
"searchMethod": "suggest"
|
||||
}}).then((res) => {
|
||||
if (res.success) {
|
||||
res.result.data.goods_list.map(item => {
|
||||
console.log(item.sales_tip_text[0])
|
||||
let total = 0
|
||||
if (item.sales_tip_text[0]) {
|
||||
total = item.sales_tip_text[0]
|
||||
total = total.replace('+', '')
|
||||
if (total.indexOf('K') != -1) {
|
||||
total = total.replace('K', '')
|
||||
total = total * 1000
|
||||
} else if (total.indexOf('M') != -1) {
|
||||
total = total.replace('M', '')
|
||||
total = total * 1000000
|
||||
}
|
||||
}
|
||||
this.detailsVo.details.push({
|
||||
url: item.link_url,
|
||||
price: item.price_info.price_schema,
|
||||
saleTotal: total,
|
||||
goodsId: item.goods_id,
|
||||
imgUrl: item.thumb_url,
|
||||
mallId: item.mall_id
|
||||
})
|
||||
})
|
||||
console.log(this.detailsVo)
|
||||
|
||||
this.$http.post('/api/monitorDetail/addDetails',this.detailsVo
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('关键字【' + row.content + '】数据采集成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
57
src/view/selection/storetrack/Index.vue
Normal file
57
src/view/selection/storetrack/Index.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div style="height: 100%;">
|
||||
<transition name="fade-transform" mode="out-in">
|
||||
<keep-alive :include="['List']">
|
||||
<component ref="component" :is="component" @change="onChange" :params="params"></component>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import List from './components/List.vue'
|
||||
import Detail from './components/Detail.vue'
|
||||
|
||||
export default {
|
||||
name: 'StoreTrack',
|
||||
label: '店铺跟踪',
|
||||
|
||||
components: {
|
||||
List,
|
||||
Detail
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
component: 'List',
|
||||
params: {}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChange (data) {
|
||||
if (data.type === 'Detail') {
|
||||
this.component = 'Detail'
|
||||
this.params = data.params
|
||||
}
|
||||
|
||||
if (data.type === 'List') {
|
||||
this.component = 'List'
|
||||
this.params = data.params
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (data.isRefresh) {
|
||||
setTimeout(() => {
|
||||
this.$refs.component.getList()
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
||||
169
src/view/selection/storetrack/components/Detail.vue
Normal file
169
src/view/selection/storetrack/components/Detail.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<div>
|
||||
<ai-list class="list">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="商品列表"
|
||||
isShowBottomBorder isShowBack @onBackClick="cancel(false)">
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; gap: 16px;">
|
||||
<el-card v-for="item in tableData" :key="item.id" :body-style="{ padding: '0px', margin: '5px' }">
|
||||
<img :src="item.imgUrl" class="image">
|
||||
<div style="padding: 14px;">
|
||||
<div class="bottom clearfix">
|
||||
<div style="margin-bottom: 5px;">
|
||||
<div style="display: inline; margin-left: 5px;">${{ item.priceAndSale[0].price }}<sub style="margin-left: 2px;" v-html="getPricePercent(item.priceAndSale)"></sub></div>
|
||||
<div style="display: inline; margin-right: 5px; float: right;">{{ item.priceAndSale[0].sale_total }}<sub style="margin-left: 2px;" v-html="getSalePercent(item.priceAndSale)"></sub></div>
|
||||
</div>
|
||||
<ai-product-drop-down :params="item" :isShowDetail="true" @onGoDetail="goDetail(item.goodsId)" style="float: right;"></ai-product-drop-down>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
|
||||
<div class="productDetail">
|
||||
<el-dialog
|
||||
title="商品详情"
|
||||
:visible="isShowDetailDlg"
|
||||
:close-on-click-modal="false"
|
||||
width="80%"
|
||||
:before-close="handleClose">
|
||||
<ai-product-detail v-if="isShowDetailDlg" :params="detailParams"/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AiProductDetail from "@/components/AiProductDetail.vue";
|
||||
import AiProductDropDown from '@/components/AiProductDropDown.vue';
|
||||
|
||||
export default {
|
||||
name: 'DetailPage',
|
||||
props: ['params'],
|
||||
components: {AiProductDetail, AiProductDropDown},
|
||||
data () {
|
||||
return {
|
||||
monitorId: '',
|
||||
search: {
|
||||
current: 1,
|
||||
type: '1',
|
||||
size: 120
|
||||
},
|
||||
tableData: [],
|
||||
total: 0,
|
||||
isShowDetailDlg: false,
|
||||
detailParams: {}
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.monitorId = this.params.id
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.$http.post('/api/monitorDetail/myPage',null,{
|
||||
params: {
|
||||
monitorId: this.monitorId,
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'List',
|
||||
isRefresh: !!isRefresh
|
||||
})
|
||||
},
|
||||
getPricePercent(data) {
|
||||
if (data.length == 2) {
|
||||
let a = (data[0].price - data[1].price) / data[1].price
|
||||
if (a < 0) {
|
||||
return '<div style="display: inline; color: green">↓' + (a*100).toFixed(2) + '%</div>'
|
||||
} else if (a == 0) {
|
||||
return ''
|
||||
} else if (a > 0) {
|
||||
return '<div style="display: inline; color: red">↑' + (a*100).toFixed(2) + '%</div>'
|
||||
}
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
getSalePercent(data) {
|
||||
if (data.length == 2) {
|
||||
let a = (data[0].sale_total - data[1].sale_total) / data[1].sale_total
|
||||
if (a < 0) {
|
||||
return '<div style="display: inline; color: green">↓' + (a*100).toFixed(2) + '%</div>'
|
||||
} else if (a == 0) {
|
||||
return ''
|
||||
} else if (a > 0) {
|
||||
return '<div style="display: inline; color: red">↑' + (a*100).toFixed(2) + '%</div>'
|
||||
}
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.isShowDetailDlg = false
|
||||
},
|
||||
goDetail (goodsId) {
|
||||
this.detailParams = {goodsId: goodsId}
|
||||
this.isShowDetailDlg = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.productDetail {
|
||||
:deep(.el-dialog) {
|
||||
height: 78vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
}
|
||||
.time {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
margin-top: 13px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both
|
||||
}
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
238
src/view/selection/storetrack/components/List.vue
Normal file
238
src/view/selection/storetrack/components/List.vue
Normal file
@@ -0,0 +1,238 @@
|
||||
<template>
|
||||
<div>
|
||||
<ai-list class="list">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="店铺跟踪"
|
||||
isShowBottomBorder>
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<div class="content">
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<el-button type="button" :class="'el-button el-button--primary'" @click="addStore()">添加店铺</el-button>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-button size="small" circle icon="el-icon-refresh-right" @click="getList()"></el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
:current.sync="search.current" :size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column slot="options" label="操作" width="200px" show-overflow-tooltip align="center" fixed="right">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="deleteMonitor(row.id)">删除</el-button>
|
||||
<el-button type="text" @click="renew(row.id)">续费</el-button>
|
||||
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
|
||||
<el-button type="text" @click="toBegin(row)">采集数据</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
|
||||
<ai-dialog
|
||||
title="添加店铺"
|
||||
:visible.sync="isDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="790px"
|
||||
customFooter
|
||||
@close="isDlgShow = false">
|
||||
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
|
||||
<el-form-item
|
||||
prop="mallId"
|
||||
label="店铺ID"
|
||||
:rules="[{ required: true, message: '请输入店铺ID', trigger: 'blur' }]">
|
||||
<el-input placeholder="请输入店铺ID" v-model="form.mallId"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="dialog-footer" slot="footer">
|
||||
<el-button @click="isDlgShow = false">取 消</el-button>
|
||||
<el-button type="primary" @click="saveStore">确定</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {sendTemuAPIMessage} from '@/api/chromeApi'
|
||||
|
||||
export default {
|
||||
name: 'List',
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
type: '1',
|
||||
size: 10
|
||||
},
|
||||
colConfigs: [
|
||||
{ prop: 'content', label: '店铺ID', align: 'left' },
|
||||
{ prop: 'lastUpdateTime', label: '最后一次更新时间', align: 'left' },
|
||||
{ prop: 'status', label: '状态', align: 'left', format: v => this.$dict.getLabel('monitor_status', v), },
|
||||
{ prop: 'expireTime', label: '失效时间', align: 'left' },
|
||||
{ prop: 'createTime', label: '添加时间', width: '180px', fixed: 'right'}
|
||||
],
|
||||
tableData: [],
|
||||
total: 0,
|
||||
|
||||
form: {
|
||||
mallId: ''
|
||||
},
|
||||
|
||||
isDlgShow: false,
|
||||
detailsVo: {},
|
||||
pageNo: 1,
|
||||
pageSize: 120
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.$dict.load('monitor_status');
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.$http.post('/api/monitor/myPage',null,{
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
saveStore () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http.post('/api/monitor/check',null, {params: {type: 1}}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$http.post(`/api/monitor/add`, {content: this.form.mallId, type: this.search.type}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('添加成功!')
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.getList()
|
||||
this.isDlgShow = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
renew(id) {
|
||||
this.$confirm('确定要续费?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post('/api/monitor/renew',null, {
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
}
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('续费成功!')
|
||||
this.$store.dispatch('getUserInfo')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
deleteMonitor(id) {
|
||||
this.$confirm('确定要删除?', '温馨提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post('/api/monitor/del',null, {
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
}
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
toDetail (id) {
|
||||
this.$emit('change', {
|
||||
type: 'Detail',
|
||||
params: {
|
||||
id: id || ''
|
||||
}
|
||||
})
|
||||
},
|
||||
addStore() {
|
||||
this.form.mallId = ''
|
||||
this.isDlgShow = true
|
||||
},
|
||||
toBegin(row) {
|
||||
this.detailsVo = {}
|
||||
this.detailsVo.monitorId = row.id
|
||||
this.detailsVo.details = []
|
||||
this.pageNo = 1
|
||||
|
||||
this.beginCollect(row)
|
||||
},
|
||||
beginCollect(row) {
|
||||
sendTemuAPIMessage({
|
||||
url: 'api/bg/circle/c/mall/newGoodsList',
|
||||
anti: true,
|
||||
data: {
|
||||
"mall_id": row.content,
|
||||
"filter_items": "0:1",
|
||||
"page_number": this.pageNo,
|
||||
"page_size": this.pageSize
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
res.result.data.goods_list.map(item => {
|
||||
let total = item.sales_tip_text[0]
|
||||
total = total.replace('+', '')
|
||||
if (total.indexOf('K') != -1) {
|
||||
total = total.replace('K', '')
|
||||
total = total * 1000
|
||||
} else if (total.indexOf('M') != -1) {
|
||||
total = total.replace('M', '')
|
||||
total = total * 1000000
|
||||
}
|
||||
this.detailsVo.details.push({
|
||||
url: item.link_url,
|
||||
price: item.price_info.price_schema,
|
||||
saleTotal: total,
|
||||
goodsId: item.goods_id,
|
||||
imgUrl: item.thumb_url,
|
||||
mallId: item.mall_id
|
||||
})
|
||||
})
|
||||
|
||||
if (res.result.data.goods_list.length == this.pageSize) {
|
||||
this.pageNo = this.pageNo + 1
|
||||
this.beginCollect(row)
|
||||
} else {
|
||||
this.$http.post('/api/monitorDetail/addDetails',this.detailsVo
|
||||
).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('店铺ID【' + row.content + '】数据采集成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
268
src/view/shipping/WaitPackageList.vue
Normal file
268
src/view/shipping/WaitPackageList.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<ai-list class="list" v-loading="isLoading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="待装箱发货列表"
|
||||
isShowBottomBorder>
|
||||
<template #rightBtn>
|
||||
<div class="title-right">
|
||||
<div>
|
||||
<label style="width:90px">店铺:</label>
|
||||
<el-select v-model="mallId" @change="beforeGetList" placeholder="请选择" size="small">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
:key="item.mallId"
|
||||
:label="item.mallName"
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<ai-card title="数据明细" style="padding-bottom: 40px;">
|
||||
<template #right>
|
||||
<json-excel
|
||||
:data="tableData"
|
||||
:fields="jsonFields"
|
||||
:before-generate = "startDownload"
|
||||
name="待装箱发货单明细.xls"
|
||||
worksheet="待装箱发货单明细">
|
||||
<el-button type="primary">导出数据</el-button>
|
||||
</json-excel>
|
||||
</template>
|
||||
<ai-table
|
||||
:isShowPagination="false"
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="tableData.length"
|
||||
height="500"
|
||||
style="margin-top: 8px;"
|
||||
@getList="() => {}">
|
||||
</ai-table>
|
||||
</ai-card>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {sendChromeAPIMessage} from '@/api/chromeApi'
|
||||
import JsonExcel from 'vue-json-excel'
|
||||
import {timestampToTime} from '@/utils/date'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
export default {
|
||||
name: 'WaitShippingList',
|
||||
|
||||
data () {
|
||||
return {
|
||||
isLoading: false,
|
||||
list: [],
|
||||
tableData: [],
|
||||
mallId: '',
|
||||
colConfigs: [
|
||||
{ prop: 'subPurchaseOrderSn', label: '备货单号', align: 'left' },
|
||||
{ prop: 'deliveryOrderSn', label: '发货单号', align: 'left' },
|
||||
{ prop: 'productName', label: '商品名称', align: 'left' },
|
||||
{ prop: 'productSkcId', label: 'SKC ID', align: 'left' },
|
||||
{ prop: 'skcExtCode', label: 'SKC货号', align: 'left' },
|
||||
{ prop: 'productSkuId', label: 'SKU ID', align: 'left' },
|
||||
{ prop: 'skuExtCode', label: 'SKU货号', align: 'left' },
|
||||
{ prop: 'specName', label: '属性集', align: 'left' },
|
||||
{ prop: 'supplierPrice', label: '申报价格', align: 'left' },
|
||||
{ prop: 'skuNum', label: '发货数量', align: 'left' },
|
||||
{ prop: 'subWarehouseName', label: '收货仓库', align: 'left' },
|
||||
{ prop: 'createTime', label: '创建时间', align: 'left' }
|
||||
],
|
||||
jsonFields: {
|
||||
"备货单号": "subPurchaseOrderSn",
|
||||
"发货单号": "deliveryOrderSn",
|
||||
"商品名称": "productName",
|
||||
"SKC ID": "productSkcId",
|
||||
"SKC货号": "skcExtCode",
|
||||
"SKU ID": "productSkuId",
|
||||
"SKU货号": "skuExtCode",
|
||||
"属性集": "specName",
|
||||
"申报价格": "supplierPrice",
|
||||
"发货数量": "skuNum",
|
||||
"收货仓库": "subWarehouseName",
|
||||
"创建时间": "createTime"
|
||||
},
|
||||
|
||||
currentPage: 1,
|
||||
packageNumber: 0,
|
||||
|
||||
skcIds: []
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
},
|
||||
|
||||
components: {
|
||||
JsonExcel
|
||||
},
|
||||
|
||||
created () {
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeDataType() {
|
||||
|
||||
},
|
||||
beforeGetList() {
|
||||
if (!this.mallId) {
|
||||
Message.error("请先选择店铺")
|
||||
return
|
||||
}
|
||||
this.currentPage = 1
|
||||
this.list = []
|
||||
this.$userCheck(this.mallId).then(() => {
|
||||
this.isLoading = true
|
||||
this.skcIds = []
|
||||
this.getList()
|
||||
}).catch((err) => {
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
getList () {
|
||||
sendChromeAPIMessage({
|
||||
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryOrders',
|
||||
needMallId: true,
|
||||
mallId: this.mallId,
|
||||
anti: true,
|
||||
data: {
|
||||
"pageNo": this.currentPage,
|
||||
"pageSize": 100,
|
||||
"sortType": 0,
|
||||
"status": 0
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
for(let i = 0;i < res.result.list.length; i++) {
|
||||
let item = res.result.list[i];
|
||||
let data = {};
|
||||
data.subWarehouseName = item.subWarehouseName
|
||||
data.skcExtCode = item.skcExtCode
|
||||
data.createTime = timestampToTime(item.deliveryOrderCreateTime)
|
||||
data.productName = item.subPurchaseOrderBasicVO.productName,
|
||||
data.productSkcId = item.productSkcId
|
||||
data.deliveryOrderSn = item.deliveryOrderSn
|
||||
data.subPurchaseOrderSn = item.subPurchaseOrderSn
|
||||
|
||||
if (this.skcIds.indexOf(item.productSkcId) == -1) {
|
||||
this.skcIds.push(item.productSkcId)
|
||||
}
|
||||
|
||||
for(let j = 0; j < item.packageDetailList.length; j++) {
|
||||
let item1 = item.packageDetailList[j]
|
||||
data = {...data,
|
||||
productSkuId: item1.productSkuId,
|
||||
skuNum: item1.skuNum}
|
||||
|
||||
this.list.push(data)
|
||||
}
|
||||
}
|
||||
if (100 == res.result.list.length) {
|
||||
this.currentPage ++
|
||||
setTimeout(() => {
|
||||
this.getList()
|
||||
}, 1000)
|
||||
} else {
|
||||
this.getProductDetailList(0)
|
||||
}
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.getList()
|
||||
}, 1000)
|
||||
// Message.error("【拼多多】" + res.errorMsg + ", 请重新尝试加载")
|
||||
}
|
||||
})
|
||||
},
|
||||
getProductDetailList(page) {
|
||||
let productSkcIds = []
|
||||
let i = page * 100
|
||||
let j = 0
|
||||
for (; i < this.skcIds.length; i++) {
|
||||
productSkcIds.push(this.skcIds[i])
|
||||
j ++
|
||||
if (j == 100) break
|
||||
}
|
||||
if (productSkcIds.length == 0) {
|
||||
this.isLoading = false
|
||||
this.tableData = this.list
|
||||
return
|
||||
}
|
||||
|
||||
sendChromeAPIMessage({
|
||||
url: 'bg-visage-mms/product/skc/pageQuery',
|
||||
needMallId: true,
|
||||
anti: true,
|
||||
mallId: this.mallId,
|
||||
data: {
|
||||
"productSkcIds": productSkcIds,
|
||||
"page": 1,
|
||||
"pageSize": 100
|
||||
}}).then((res) => {
|
||||
if (res.errorCode == 1000000) {
|
||||
for(let i = 0;i < res.result.pageItems.length; i++) {
|
||||
let item = res.result.pageItems[i]
|
||||
|
||||
item.productSkuSummaries.map(temp1 => {
|
||||
for (let j = 0; j < this.list.length; j++) {
|
||||
if (this.list[j].productSkuId == temp1.productSkuId) {
|
||||
this.list[j].skuExtCode = temp1.extCode
|
||||
this.list[j].supplierPrice = (temp1.supplierPrice / 100).toFixed(2)
|
||||
|
||||
let specList = temp1.productSkuSpecList.map(temp3 => {
|
||||
return temp3.specName
|
||||
})
|
||||
|
||||
this.list[j].specName = specList.join(",")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
this.getProductDetailList(page + 1)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.getProductDetailList(page)
|
||||
}, 200)
|
||||
}
|
||||
})
|
||||
},
|
||||
startDownload() {
|
||||
this.$http.post('/api/malluser/info').then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$store.commit('setUserInfo', res.data)
|
||||
if (res.data.flag != 1) {
|
||||
Message.error('您的账号未激活或已失效,请激活后使用')
|
||||
this.$store.commit('setActiveDlgShow', true)
|
||||
return;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.list {
|
||||
.title-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
& > div:first-child {
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
::v-deep.ai-list {
|
||||
.ai-list__content--right-wrapper {
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
padding: 0!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -61,6 +61,7 @@ import { Message } from 'element-ui'
|
||||
list: [],
|
||||
mallId: '',
|
||||
colConfigs: [
|
||||
{ prop: 'subPurchaseOrderSn', label: '备货单号', align: 'left' },
|
||||
{ prop: 'productName', label: '商品名称', align: 'left' },
|
||||
{ prop: 'skcExtCode', label: '货号', align: 'left' },
|
||||
{ prop: 'productSkcId', label: 'SKC ID', align: 'left' },
|
||||
@@ -71,9 +72,11 @@ import { Message } from 'element-ui'
|
||||
{ prop: 'expressDeliverySn', label: '物流单号', align: 'left' },
|
||||
{ prop: 'deliveryOrderSn', label: '发货单号', align: 'left' },
|
||||
{ prop: 'subWarehouseName', label: '收货仓库', align: 'left' },
|
||||
{ prop: 'deliverTime', label: '发货时间', align: 'left' },
|
||||
{ prop: 'expectPickUpGoodsTime', label: '预约取货时间', align: 'left' }
|
||||
],
|
||||
jsonFields: {
|
||||
"备货单号": "subPurchaseOrderSn",
|
||||
"商品名称": "productName",
|
||||
"货号": "skcExtCode",
|
||||
"SKC ID": "productSkcId",
|
||||
@@ -84,6 +87,7 @@ import { Message } from 'element-ui'
|
||||
"物流单号": "expressDeliverySn",
|
||||
"发货单号": "deliveryOrderSn",
|
||||
"收货仓库": "subWarehouseName",
|
||||
"发货时间": "deliverTime",
|
||||
"预约取货时间": "expectPickUpGoodsTime"
|
||||
},
|
||||
|
||||
@@ -138,13 +142,15 @@ import { Message } from 'element-ui'
|
||||
data.expressDeliverySn = item.expressDeliverySn
|
||||
data.subWarehouseName = item.subWarehouseName
|
||||
data.expectPickUpGoodsTime = timestampToTime(item.expectPickUpGoodsTime)
|
||||
|
||||
|
||||
for(let j = 0;j < item.deliveryOrderList.length; j++) {
|
||||
let item1 = item.deliveryOrderList[j]
|
||||
data = {...data,
|
||||
subPurchaseOrderSn: item1.subPurchaseOrderSn,
|
||||
deliveryOrderSn: item1.deliveryOrderSn,
|
||||
productName: item1.subPurchaseOrderBasicVO.productName,
|
||||
skcExtCode: item1.subPurchaseOrderBasicVO.skcExtCode,
|
||||
deliverTime: timestampToTime(item1.deliverTime),
|
||||
productSkcId: item1.productSkcId}
|
||||
|
||||
for(let k = 0; k < item1.packageDetailList.length; k++) {
|
||||
@@ -162,15 +168,13 @@ import { Message } from 'element-ui'
|
||||
}, 200 * i)
|
||||
}
|
||||
}
|
||||
if (this.pageSize == res.result.deliveryOrderList.length) {
|
||||
if (100 == res.result.list.length) {
|
||||
this.currentPage ++
|
||||
setTimeout(() => {
|
||||
this.getList()
|
||||
}, 1500)
|
||||
} else {
|
||||
if (this.currentPage == 1 && res.result.list.length == 0) {
|
||||
this.isLoading = false
|
||||
}
|
||||
this.isLoading = false
|
||||
}
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -1,84 +1,56 @@
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const JavaScriptObfuscator = require('webpack-obfuscator')
|
||||
const obfuscateConfig = require('./obfuscator.config')
|
||||
|
||||
// Generate pages object
|
||||
const pages = {}
|
||||
|
||||
function getEntryFile (entryPath) {
|
||||
let files = fs.readdirSync(entryPath)
|
||||
return files
|
||||
function getEntryFile(entryPath) {
|
||||
return fs.readdirSync(entryPath)
|
||||
}
|
||||
|
||||
const chromeName = getEntryFile(path.resolve(`src/entry`))
|
||||
|
||||
function getFileExtension (filename) {
|
||||
function getFileExtension(filename) {
|
||||
return /[.]/.exec(filename) ? /[^.]+$/.exec(filename)[0] : undefined
|
||||
}
|
||||
|
||||
chromeName.forEach((name) => {
|
||||
const fileExtension = getFileExtension(name)
|
||||
const fileName = name.replace('.' + fileExtension, '')
|
||||
pages[fileName] = {
|
||||
entry: `src/entry/${name}`,
|
||||
template: 'public/index.html',
|
||||
filename: `${fileName}.html`
|
||||
entry: `src/entry/${name}`, template: 'public/index.html', filename: `${fileName}.html`
|
||||
}
|
||||
})
|
||||
|
||||
const isDevMode = process.env.NODE_ENV === 'development'
|
||||
|
||||
module.exports = {
|
||||
pages,
|
||||
filenameHashing: false,
|
||||
chainWebpack: (config) => {
|
||||
config.plugin('copy').use(require('copy-webpack-plugin'), [
|
||||
{
|
||||
patterns: [
|
||||
{
|
||||
from: path.resolve(`src/manifest.${process.env.NODE_ENV}.json`),
|
||||
to: `${path.resolve('dist')}/manifest.json`
|
||||
},
|
||||
{
|
||||
from: path.resolve(`public/`),
|
||||
to: `${path.resolve('dist')}/`
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
},
|
||||
devServer: {
|
||||
port: 8080,
|
||||
open: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
},
|
||||
proxy: {
|
||||
pages, filenameHashing: false, chainWebpack: (config) => {
|
||||
config.plugin('copy').use(require('copy-webpack-plugin'), [{
|
||||
patterns: [{
|
||||
from: path.resolve(`src/manifest.${process.env.NODE_ENV}.json`), to: `${path.resolve('dist')}/manifest.json`
|
||||
}, {
|
||||
from: path.resolve(`public/`), to: `${path.resolve('dist')}/`
|
||||
}]
|
||||
}])
|
||||
}, devServer: {
|
||||
port: 8080, open: true, overlay: {
|
||||
warnings: false, errors: true
|
||||
}, proxy: {
|
||||
'/api': {
|
||||
target: 'http://pdd.jjcp52.com',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
pathRewrite: {
|
||||
target: 'http://pdd.jjcp52.com', changeOrigin: true, ws: true, pathRewrite: {
|
||||
'^/api': '/'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
lintOnSave: false,
|
||||
configureWebpack: {
|
||||
}, lintOnSave: false, configureWebpack: {
|
||||
output: {
|
||||
filename: `[name].js`,
|
||||
chunkFilename: `[name].js`
|
||||
},
|
||||
devtool: isDevMode ? 'inline-source-map' : false,
|
||||
plugins: isDevMode ? [] : [
|
||||
new JavaScriptObfuscator({
|
||||
rotateStringArray: true,
|
||||
}, [])
|
||||
]
|
||||
},
|
||||
css: {
|
||||
filename: `[name].js`, chunkFilename: `[name].js`
|
||||
}, devtool: isDevMode ? 'inline-source-map' : false, plugins: isDevMode ? [] : [new JavaScriptObfuscator({
|
||||
rotateStringArray: true,
|
||||
}, [])]
|
||||
}, css: {
|
||||
extract: false // Make sure the css is the same
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user