Compare commits

..

58 Commits

Author SHA1 Message Date
aixianling
b1d1f60f96 调整Home.vue页面布局和功能 2024-11-06 09:31:58 +08:00
aixianling
191edd1eb4 Merge remote-tracking branch 'gitee/master'
# Conflicts:
#	src/router/index.js
#	src/view/Home.vue
#	yarn.lock
2024-11-06 09:31:25 +08:00
juanmao2009
0cbe017a95 !10 调整文字
Merge pull request !10 from juanmao2009/label
2024-11-05 13:45:05 +00:00
liushiwei
b1abecfb29 调整 2024-11-05 21:44:30 +08:00
juanmao2009
2511778c9f !9 调整
Merge pull request !9 from juanmao2009/label
2024-11-05 13:29:24 +00:00
liushiwei
fea7848653 调整 2024-11-05 21:28:49 +08:00
juanmao2009
3cdaba63b7 !8 调整
Merge pull request !8 from juanmao2009/label
2024-11-05 13:28:27 +00:00
liushiwei
5ece8b562f 调整 2024-11-05 21:27:16 +08:00
juanmao2009
15614d9489 !7 标签管理
Merge pull request !7 from juanmao2009/label
2024-11-05 13:21:56 +00:00
liushiwei
7b43c97f5f Merge branch 'label' of https://gitee.com/three-make-money/temu-plugin into label 2024-11-05 21:20:17 +08:00
liushiwei
74043c55ae 调整 2024-11-05 21:20:05 +08:00
yanran200730
1285b0644c 新增全局提示 2024-11-03 20:27:58 +08:00
yanran200730
b6e721826f 修改模板库样式 2024-11-02 23:16:59 +08:00
yanran200730
0f6f894f84 修复bug 2024-11-02 15:47:45 +08:00
yanran200730
0baccbf650 完善zhifu 2024-11-02 12:07:29 +08:00
yanran200730
ffcebb2913 修复bug 2024-10-31 21:31:51 +08:00
yanran200730
a2bbe798b8 修复弹窗bug 2024-10-31 21:20:33 +08:00
yanran200730
57d58cdad3 模板库 图片预览 2024-10-31 21:03:16 +08:00
yanran200830
b3c7dde44f 修复bug 2024-10-31 18:07:09 +08:00
yanran200830
3574f8ce83 修复模板bug 2024-10-31 13:39:09 +08:00
yanran200830
11a9972329 修复图片组件 2024-10-31 11:37:50 +08:00
yanran200730
56ee90ed30 修复bug和更改会员界面 2024-10-30 22:01:57 +08:00
liushiwei
e920251718 调整 2024-10-30 19:53:17 +08:00
yanran200830
d38206a1a0 Merge branch 'label' of https://gitee.com/three-make-money/temu-plugin into label 2024-10-30 17:29:42 +08:00
yanran200830
4bfb4c2d1a 【新增】支付弹窗和修复bug 2024-10-30 17:29:34 +08:00
liushiwei
aa36ce497a 调整 2024-10-30 09:56:08 +08:00
liushiwei
81d4f10c14 调整 2024-10-30 09:50:06 +08:00
liushiwei
fdac7fc7d3 调整 2024-10-30 09:45:12 +08:00
liushiwei
bbde4e3f3f 调整 2024-10-30 09:42:08 +08:00
yanran200730
4b6e221369 修复bug 2024-10-29 21:36:51 +08:00
yanran200830
b4c3e3796f 打印组件修改 2024-10-29 18:08:50 +08:00
yanran200730
6618242f7f 【新增】模板库 2024-10-28 22:10:07 +08:00
yanran200830
8225f21d14 1 2024-10-28 18:30:27 +08:00
liushiwei
86f4256eb4 Merge branch 'label' of https://gitee.com/three-make-money/temu-plugin into label 2024-10-27 18:30:22 +08:00
liushiwei
5a74b0d382 调整 2024-10-27 18:30:18 +08:00
yanran200730
6261be7807 Merge branch 'label' of https://gitee.com/three-make-money/temu-plugin into label 2024-10-27 18:29:43 +08:00
yanran200730
275f5f6abd 【新增】打印 2024-10-27 18:29:16 +08:00
yanran200730
244d84d45d 【删除】多余代码 2024-10-26 23:15:17 +08:00
yanran200730
8900853066 【新增】模板接口对接 2024-10-26 22:49:23 +08:00
yanran200730
4f4f303867 打印组件 2024-10-26 21:13:12 +08:00
yanran200730
05f63c7af5 【新增】晚上打印页面和标签组件 2024-10-26 13:56:07 +08:00
liushiwei
49b9b2c280 Merge branch 'label' of https://gitee.com/three-make-money/temu-plugin into label 2024-10-25 18:33:21 +08:00
liushiwei
d6e3d7bbe1 新增功能 2024-10-25 18:33:12 +08:00
yanran200830
a51a0d49bc 【新增】打印组件 2024-10-25 15:31:13 +08:00
yanran200830
4d0cc14001 修复bug 2024-10-24 18:02:31 +08:00
yanran200730
d763045c94 新增代码添加添加元素 2024-10-23 22:13:17 +08:00
yanran200730
b4cbdce74a 【新增】加入依赖 2024-10-23 20:09:26 +08:00
yanran200830
9d7ed6f701 【修复】vue-plugin-hiprint.js组件eval适配问题 2024-10-23 13:58:08 +08:00
yanran200730
f7530ed1f5 修复bug 2024-10-22 22:41:36 +08:00
yanran200830
28264e43b5 【修复】模板内temu标签组件bug 2024-10-22 15:11:48 +08:00
yanran200830
432d4351d3 【新增】完成temu标签组件 2024-10-22 11:10:27 +08:00
yanran200730
d9fe8dea7b 调样式 2024-10-21 21:56:40 +08:00
yanran200830
441510a4e4 修复样式bug 2024-10-21 18:11:08 +08:00
yanran200830
5a7058c036 【新增】temu标签组件 2024-10-21 18:02:06 +08:00
yanran200730
5157d601cc 【新增】1.temu条码组件 2.添加SKU 2024-10-20 21:52:29 +08:00
liushiwei
649ddc2504 调整 2024-10-19 18:21:46 +08:00
liushiwei
006f84ccbb 接口地址调整 2024-10-19 17:50:14 +08:00
juanmao2009
2d14cb7c6d !6 111
Merge pull request !6 from juanmao2009/master
2024-10-19 09:48:10 +00:00
42 changed files with 129264 additions and 11670 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ node_modules
/dist
/artifacts
package-lock.json
/node_modules
# local env files
.env.local

62364
node_modules/vue-plugin-hiprint/dist/vue-plugin-hiprint.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -8,14 +8,17 @@
},
"dependencies": {
"@antv/g2plot": "^2.4.25",
"@babel/standalone": "^7.25.8",
"axios": "^1.4.0",
"bi-vue-mindmap": "^0.6.12",
"core-js": "^3.8.3",
"crypto-js": "^4.0.0",
"dayjs": "^1.11.9",
"element-ui": "^2.15.13",
"eval5": "^1.4.8",
"file-saver": "^2.0.5",
"html2canvas": "^1.4.1",
"jsbarcode": "^3.11.6",
"query-string": "^9.0.0",
"spark-md5": "^3.0.2",
"v-viewer": "^1.6.4",

View File

@@ -347,3 +347,37 @@ table.hiprint-printElement-tableTarget {
text-align: left;
clear: both;
}
.temuBarCode {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 100%;
height: 100%;
padding: 10pt 10pt;
border: 2pt solid #000;
}
.temuBarCode-code {
width: 100%;
height: 100%;
}
.temuBarCode-code svg {
width: 100%;
}
.temuBarCode-top,
.temuBarCode-bottom {
display: flex;
align-items: center;
justify-content: space-between;
width: 94%;
font-weight: 700;
}
.temuBarCode-middle {
width: 88%;
height: 60%;
}

View File

@@ -1,18 +1,57 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" type="text/css" media="print" href="<%= BASE_URL %>css/print-lock.css">
<title>TEMU助手</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" type="text/css" media="print" href="<%= BASE_URL %>css/print-lock.css">
<title>TEMU助手</title>
<style>
.temuBarCode {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 100%;
height: 100%;
padding: 10pt 10pt;
border: 2pt solid #000;
}
.temuBarCode-code {
width: 100%;
height: 100%;
}
.temuBarCode-code svg {
width: 100%;
}
.temuBarCode-top,
.temuBarCode-bottom {
display: flex;
align-items: center;
justify-content: space-between;
width: 94%;
font-weight: 700;
}
.temuBarCode-middle {
width: 88%;
height: 60%;
}
</style>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -123,8 +123,8 @@ function init() {
}
let models3 = document.querySelectorAll('div[class^="modal-content_content"]')
for (let i = 0; i < models2.length; i++) {
let tipsObj = models2[i].parentElement.querySelector('div[class^="modal-content_content"]')
for (let i = 0; i < models3.length; i++) {
let tipsObj = models3[i].parentElement.querySelector('div[class^="modal-content_content"]')
let spanObj = tipsObj.querySelector('div span:last-child')
if (spanObj) {
const popup = document.createElement("div")
@@ -143,7 +143,7 @@ function init() {
spanObj.appendChild(popup)
popup.addEventListener('click', async () => {
let tbodyObj = models2[i].parentElement.querySelector('tbody')
let tbodyObj = models3[i].parentElement.querySelector('tbody')
let trList = tbodyObj.querySelectorAll('tr')
for (let i = 0; i < trList.length; i++) {
let tdObj = trList[i].querySelector('td:last-child')

24
public/rules_12.json Normal file
View File

@@ -0,0 +1,24 @@
[
{
"id": 23,
"priority": 1,
"action": {
"type": "modifyHeaders",
"requestHeaders": [
{
"header": "Origin",
"operation": "set",
"value": "http://xc.rqlis.com:888"
},
{
"header": "Host",
"operation": "set",
"value": "xc.rqlis.com:888"
}
]
},
"condition": {
"urlFilter": "||xc.rqlis.com"
}
}
]

View File

@@ -1,5 +1,6 @@
import store from '@/store'
import {genAnti} from "@/api/genAnti";
import { genAnti } from "@/api/genAnti";
import { Message } from 'element-ui'
/**
* 向Chrome发送消息
@@ -20,9 +21,16 @@ export async function sendChromeAPIMessage(message) {
if (message.anti) {
message.anti = await genAnti.a()
}
return new Promise((resolve) => {
// @ts-ignore
chrome.runtime.sendMessage(message, resolve)
// chrome.runtime.sendMessage(message, resolve)
chrome.runtime.sendMessage(message, res => {
if (res.error_code === 40001) {
Message.error('请先登录拼多多跨境卖家中心')
}
resolve(res)
})
})
}
@@ -152,3 +160,16 @@ export function sendGoodcangAPIMessage(message) {
chrome.runtime.sendMessage(message, resolve)
})
}
/**
* 向Chrome发送消息
* @param message 消息
*/
export async function sendXcAPIMessage(message) {
message.type = 'xcApi'
message.url = "http://xc.rqlis.com:888/" + message.url;
return new Promise((resolve) => {
// @ts-ignore
chrome.runtime.sendMessage(message, resolve)
})
}

View File

@@ -4,7 +4,7 @@ import store from '@/store'
var instance = axios.create({
baseURL: process.env.NODE_ENV === 'production' ? 'http://124.71.2.127:8888' : 'http://124.71.2.127:8888',
baseURL: process.env.NODE_ENV === 'production' ? 'http://temu.jjcp52.com' : 'http://124.71.2.127:10248',
timeout: 50000,
validateStatus: function (status) {
return status < 500

BIN
src/assets/code.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,21 +1,22 @@
@import "./styles.scss";
@font-face {
font-family: 'iconfont'; /* project id 1995974 */
font-family: 'iconfont';
/* project id 1995974 */
src: url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.eot');
src: url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.eot?#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff2') format('woff2'),
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff') format('woff'),
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');
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff2') format('woff2'),
url('https://at.alicdn.com/t/font_1995974_ihzpmuv4lpk.woff') format('woff'),
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');
}
@font-face {
font-family: "iconfont";
src: url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.woff2?t=1725970465332') format('woff2'),
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.woff?t=1725970465332') format('woff'),
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.ttf?t=1725970465332') format('truetype');
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.woff?t=1725970465332') format('woff'),
url('https://at.alicdn.com/t/c/font_4680344_rxl7gevvsys.ttf?t=1725970465332') format('truetype');
}
.iconfont {
@@ -28,12 +29,15 @@
}
html {
line-height: 1; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
line-height: 1;
/* 1 */
-webkit-text-size-adjust: 100%;
/* 2 */
}
body {
margin: 0;
overflow: hidden;
}
h1 {
@@ -43,14 +47,19 @@ h1 {
hr {
-webkit-box-sizing: content-box;
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
box-sizing: content-box;
/* 1 */
height: 0;
/* 1 */
overflow: visible;
/* 2 */
}
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
font-family: monospace, monospace;
/* 1 */
font-size: 1em;
/* 2 */
}
a {
@@ -58,10 +67,13 @@ a {
}
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
border-bottom: none;
/* 1 */
text-decoration: underline;
/* 2 */
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted; /* 2 */
text-decoration: underline dotted;
/* 2 */
}
b,
@@ -72,8 +84,10 @@ strong {
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
font-family: monospace, monospace;
/* 1 */
font-size: 1em;
/* 2 */
}
small {
@@ -105,14 +119,19 @@ input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
font-family: inherit;
/* 1 */
font-size: 100%;
/* 1 */
line-height: 1.15;
/* 1 */
margin: 0;
/* 2 */
}
button,
input { /* 1 */
input {
/* 1 */
overflow: visible;
font-family: SJsuqian;
}
@@ -124,7 +143,8 @@ input::placeholder {
}
button,
select { /* 1 */
select {
/* 1 */
text-transform: none;
}
@@ -156,12 +176,18 @@ fieldset {
legend {
-webkit-box-sizing: border-box;
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
box-sizing: border-box;
/* 1 */
color: inherit;
/* 2 */
display: table;
/* 1 */
max-width: 100%;
/* 1 */
padding: 0;
/* 3 */
white-space: normal;
/* 1 */
}
progress {
@@ -175,8 +201,10 @@ textarea {
[type="checkbox"],
[type="radio"] {
-webkit-box-sizing: border-box;
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
box-sizing: border-box;
/* 1 */
padding: 0;
/* 2 */
}
[type="number"]::-webkit-inner-spin-button,
@@ -185,8 +213,10 @@ textarea {
}
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
-webkit-appearance: textfield;
/* 1 */
outline-offset: -2px;
/* 2 */
}
[type="search"]::-webkit-search-decoration {
@@ -194,8 +224,10 @@ textarea {
}
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
-webkit-appearance: button;
/* 1 */
font: inherit;
/* 2 */
}
details {
@@ -214,7 +246,10 @@ template {
display: none;
}
h1, h2, h3, h4 {
h1,
h2,
h3,
h4 {
font-weight: normal;
font-size: 14px;
padding: 0;
@@ -232,7 +267,8 @@ a {
transition: all .3s ease;
}
ul, li {
ul,
li {
list-style: none;
margin: 0;
padding: 0;
@@ -246,7 +282,8 @@ img {
vertical-align: middle;
}
html, body {
html,
body {
width: 100%;
min-height: 100vh;
}
@@ -276,7 +313,8 @@ img {
display: flex;
}
.flex-align, .flex-center {
.flex-align,
.flex-center {
display: flex;
align-items: center;
}
@@ -312,11 +350,13 @@ img {
flex: 1;
}
.fade-enter-active, .fade-leave-active {
transition: opacity .3s ease-in-out;
.fade-enter-active,
.fade-leave-active {
transition: opacity .2s ease-in-out;
}
.fade-enter, .fade-leave-to {
.fade-enter,
.fade-leave-to {
opacity: 0;
}
@@ -387,7 +427,8 @@ img {
line-height: 17px;
margin-bottom: 14px;
font-size: 14px;
font-family: SJsuqian;;
font-family: SJsuqian;
;
label {
margin-right: 6px;
@@ -437,7 +478,8 @@ img {
background-color: #1FBAD6;
}
.el-button--danger:focus, .el-button.el-button--danger.is-link:not(.is-disabled):hover {
.el-button--danger:focus,
.el-button.el-button--danger.is-link:not(.is-disabled):hover {
color: #fff !important;
border-color: #FA5555;
background-color: #FA5555;
@@ -478,17 +520,17 @@ img {
.search-item {
display: flex;
align-items: center;
margin: 0 16px 12px;
margin: 0 25px 10px 0;
label {
&>label {
width: 80px;
font-size: 14px;
color: #666;
font-weight: 500;
width: 100px;
}
input {
width: 240px;
// width: 240px;
}
}
@@ -504,3 +546,34 @@ img {
display: flex;
justify-content: center;
}
.print-images {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 420px;
max-height: 400px;
padding: 0 10px;
overflow-y: auto;
img {
width: 180px;
height: 80px;
margin-bottom: 10px;
cursor: pointer;
object-fit: contain;
}
p {
width: 100%;
line-height: 1.3;
margin-bottom: 10px;
font-size: 14px;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

BIN
src/assets/tab_middle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@@ -1,6 +1,6 @@
<template>
<section class="ai-dialog__wrapper">
<el-dialog custom-class="ai-dialog" v-on="$listeners" v-bind="$attrs" :visible.sync="dialog">
<el-dialog custom-class="ai-dialog" v-on="$listeners" v-bind="$attrs" :visible.sync="dialog" :close-on-click-modal="false">
<div class="ai-dialog__header fill" slot="title" v-text="title"/>
<div class="ai-dialog__content">
<div class="ai-dialog__content--wrapper">

View File

@@ -7,6 +7,9 @@
<h2>{{ title }}</h2>
<p>{{ tips }}</p>
</div>
<div class="ailist-title__middle">
<slot name="center"/>
</div>
<div class="ailist-title__right">
<div class="aititle-right__btns">
<slot name="rightBtn"/>
@@ -75,6 +78,11 @@
justify-content: space-between;
height: 48px;
.ailist-title__middle {
display: flex;
align-items: center;
}
.ailist-title__left {
display: flex;
align-items: center;

View File

@@ -0,0 +1,511 @@
<template>
<transition name="fade">
<div class="LablesMember" v-if="isShow">
<div class="mask"></div>
<div class="LablesMember-wrapper">
<i class="el-icon-close" @click="hide"></i>
<div class="top">
<img src="../assets/images/avatar.png" />
<div class="top-right">
<div class="top-user">
<h2>用户{{ $store.state.userInfo.name }}</h2>
<span></span>
</div>
<p>会员中心</p>
</div>
</div>
<div class="middle">
<div class="middle-top">
<div class="tab">
<div @click="tabIndex = 0, currIndex = 0, getPriceList(1)" :class="[tabIndex === 0 ? 'active' : '']">
<span>金币充值</span>
</div>
<div @click="tabIndex = 1, currIndex = 0, getPriceList(0)" :class="[tabIndex === 1 ? 'active' : '']">
<span>年度会员</span>
</div>
<div @click="tabIndex = 2, currIndex = 0, getPriceList(2)" :class="[tabIndex === 2 ? 'active' : '']">
<span>高级功能</span>
</div>
</div>
<div class="tab-content" v-if="tabIndex === 0">
<div class="title">金币充值</div>
<div class="tab-content__item--wrapper">
<div
class="tab-content__item"
:class="[currIndex === i ? 'active' : '']"
v-for="(price, i) in priceList"
:key="i"
@click="currIndex = i, getQrcode(price)">
<h3>{{ price.remark }}</h3>
<div class="price">
<i>¥</i>
<span>{{ price.price }}</span>
</div>
<div class="original-price">
<i>¥</i>
<span>{{ price.originPrice }}</span>
</div>
<p>{{ price.coin }}/每年</p>
</div>
</div>
</div>
<div class="tab-content" v-if="tabIndex === 1">
<div class="title">年度会员</div>
<div class="tab-content__item--wrapper">
<div
class="tab-content__item"
:class="[currIndex === i ? 'active' : '']"
v-for="(price, i) in priceList"
:key="i"
@click="currIndex = i, getQrcode(price)">
<h3>{{ price.title }}</h3>
<div class="price">
<i>¥</i>
<span>{{ price.price }}</span>
</div>
<div class="original-price">
<i>¥</i>
<span>{{ price.originPrice }}</span>
</div>
<!-- <p>{{ price.coin }}/每年</p> -->
</div>
</div>
</div>
<div class="tab-content" v-if="tabIndex === 2">
<div class="title">标签合成</div>
<div class="tab-content__item--wrapper">
<div
class="tab-content__item"
:class="[currIndex === i ? 'active' : (Number(labelInfo.level) >= Number(price.type) ? 'disabled' : '')]"
:data-level="price.type"
:data-index="labelInfo.level"
v-for="(price, i) in priceList"
:key="i"
@click="getQrcode(price, i)">
<h3>{{ price.remark }}</h3>
<div class="price">
<i>¥</i>
<span>{{ price.price }}</span>
</div>
<div class="original-price">
<i>¥</i>
<span>{{ price.originPrice }}</span>
</div>
<p>{{ price.coin }}/每年</p>
</div>
</div>
</div>
</div>
<div class="title">支付方式</div>
<div class="bottom">
<div class="bottom-left">
<div class="code">
<vue-qr v-if="qrcode" :text="qrcode" :size="110" :margin="0" :logoSrc="wechatLogo"/>
</div>
<div class="paytype">
<svg width="13" height="13" viewBox="0 0 13 13" xmlns="http://www.w3.org/2000/svg">
<path d="M12.11 0H.89A.89.89 0 0 0 0 .89v11.22c0 .491.399.89.89.89h11.22a.89.89 0 0 0 .89-.89V.89a.89.89 0 0 0-.89-.89zM6.5 10.65a5.592 5.592 0 0 1-1.848-.311c-.364.241-.975.639-1.215.75-.352.162-.25-.188-.25-.188L3.395 9.7C2.24 8.895 1.499 7.654 1.499 6.26c0-2.426 2.239-4.392 5-4.392 1.693 0 3.188.74 4.093 1.869l-4.905 2.27s-.4.152-.75-.062c-.35-.213-.813-.564-.813-.564s-.538-.458-.25.376l.751 1.756s.089.524.687.189c.468-.262 4.103-2.454 5.666-3.397a3.94 3.94 0 0 1 .523 1.954c0 2.425-2.239 4.391-5.001 4.391z" fill="#09BB07" fill-rule="nonzero"></path>
</svg>
<span>微信支付</span>
</div>
</div>
<div class="bottom-right">
<div class="right-price">
<i>¥</i>
<span class="price">{{ currGoods.price || '' }}</span>
</div>
<div class="pay-btn">
<el-button round size="mini" style="margin-right: 10px;" @click="isShow = false">取消支付</el-button>
<el-button round size="mini" type="warning" @click="$store.dispatch('getUserInfo'), isShow = false">我已支付</el-button>
</div>
</div>
</div>
</div>
</div>
</div>
</transition>
</template>
<script>
import VueQr from 'vue-qr'
import { mapState } from 'vuex'
export default {
components: {
VueQr
},
data() {
return {
form: {
mallId: this.$store.state.mallId,
mallName: this.$store.state.mallName,
code: ''
},
isShow: false,
tabIndex: 0,
currIndex: 0,
qrcode: '',
priceList: []
}
},
computed: {
wechatLogo: () => require(`../assets/wechat_logo.png`),
...mapState(['labelInfo']),
currGoods () {
if (!this.priceList.length) {
return {}
}
return this.priceList[this.currIndex]
}
},
mounted() {
this.getPriceList(1)
},
methods: {
getPriceList(type) {
this.$http.post(`/api/priceConfig/page?module=${type}`).then(res => {
if (res.code === 0) {
this.priceList = res.data.records
if (res.data.records.length) {
if (this.tabIndex !== 2) {
this.getQrcode(res.data.records[0])
} else {
for (let i = 0; i < res.data.records.length; i++) {
if (res.data.records[i].type > this.labelInfo.level) {
this.getQrcode(res.data.records[i], i)
break
}
}
}
}
}
})
},
getQrcode(item, index) {
if (this.tabIndex === 2 && item.type <= this.labelInfo.level) {
return false
}
if (this.tabIndex === 2) {
this.currIndex = index
}
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?id=${id}`)).then(res => {
if (res?.data) {
this.qrcode = res.data.codeUrl
}
})
},
show(i) {
this.currIndex = 0
this.tabIndex = {
'0': 1,
'1': 0,
'2': 2
}[i]
this.getPriceList(i)
this.isShow = true
},
hide () {
this.isShow = false
}
}
}
</script>
<style lang="scss" scoped>
.LablesMember {
position: fixed;
left: 0;
top: 0;
z-index: 1111;
width: 100%;
height: 100%;
.title {
margin: 20px 0 10px 40px;
font-size: 16px;
text-align: left;
font-weight: 600;
color: #2a2b2e;
font-weight: normal;
}
.mask {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
background: rgba($color: #000000, $alpha: 0.8);
}
.LablesMember-wrapper {
position: absolute;
top: 50%;
left: 50%;
z-index: 11;
min-width: 916px;
// height: 620px;
padding: 40px 40px;
transform: translate(-50%, -50%);
border-radius: 12px;
overflow: hidden;
background: linear-gradient(41deg, #ffebd3, #fff8e3 61%, #fae2c4 99%);
.top {
display: flex;
align-items: center;
margin-bottom: 20px;
img {
width: 40px;
height: 40px;
margin-right: 10px;
}
p {
color: #632e2e;
opacity: 0.8;
}
.top-user {
display: flex;
align-items: center;
margin-bottom: 10px;
h2 {
margin-right: 6px;
font-size: 16px;
color: #333;
}
span {
font-size: 12px;
color: #666;
}
}
}
.el-icon-close {
position: absolute;
top: 12px;
right: 12px;
z-index: 11;
font-size: 32px;
color: #333;
cursor: pointer;
transform-origin: center center;
&:hover {
opacity: 0.6;
// transform: translate(50%, -50%) rotate(180deg);
}
}
.middle {
padding-bottom: 20px;
border-radius: 20px;
overflow: hidden;
background-color: #fff;
box-shadow: 0 0 20px 0 hsla(0, 39%, 56%, .1), 0 0 16px 0 rgba(0, 0, 0, .08);
.middle-top {
flex: 1;
padding: 0 0;
.tab {
display: flex;
align-items: center;
height: 50px;
background: #fff3ee;
div {
position: relative;
flex: 1;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 22px;
font-weight: 600;
cursor: pointer;
color: #b69593;
span {
position: relative;
z-index: 2;
}
&.active {
color: #6f3333;
&::after {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
background: url(../assets/tab_middle.png) no-repeat center;
background-size: contain;
content: '';
}
}
}
}
.tab-content {
display: flex;
flex-direction: column;
padding: 0 40px;
.title {
margin-left: 0;
}
&__item--wrapper {
display: flex;
align-items: center;
}
&__item {
display: flex;
align-items: center;
flex-direction: column;
width: 140px;
height: 170px;
margin-right: 14px;
padding-top: 20px;
background-color: #fff;
border-radius: 10px;
cursor: pointer;
border: 1px solid rgba(0, 0, 0, .08);
&.active {
border: 1px solid #ff7548;
background: linear-gradient(33deg, #ffd1c5 -10%, #ffd1c5 21%, #ffe8e5 85%);
}
&.disabled {
cursor: no-drop;
background: #f4f4f4;
}
&:last-child {
margin-right: 0;
}
h3 {
margin-bottom: 20px;
font-size: 15px;
font-weight: 600;
}
p {
margin-top: 10px;
color: #d9451e;
}
.original-price {
display: flex;
align-items: center;
font-size: 12px;
color: #888;
text-decoration: line-through;
}
.price {
display: flex;
align-items: baseline;
margin-bottom: 6px;
color: #f13d3d;
font-size: 16px;
span {
font-weight: 700;
font-size: 36px;
}
}
}
}
}
.bottom {
display: flex;
align-items: center;
justify-content: flex-end;
padding: 0 40px;
.bottom-right {
display: flex;
flex-direction: column;
align-items: center;
}
.bottom-left {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-right: 20px;
}
.paytype {
display: flex;
align-items: center;
margin-top: 6px;
span {
margin-left: 8px;
font-size: 14px;
color: #666;
}
}
.pay-btn {
display: flex;
align-items: center;
margin-top: 40px;
}
.right-price {
display: flex;
align-items: baseline;
margin-bottom: 16px;
color: #f13d3d;
font-size: 18px;
font-weight: 600;
span {
margin-left: 4px;
font-size: 30px;
font-weight: 900;
}
}
.code {
width: 110px;
height: 110px;
}
}
}
}
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<div class="print">
<div class="print-wrapper">
<div class="print-wrapper" v-if="!isPrint">
<div class="left">
<div class="left-wrapper">
<div class="title">基础元素</div>
@@ -9,10 +9,6 @@
<i class="iconfont">&#xe649;</i>
<span>文本</span>
</div>
<div v-if="false" class="ep-draggable-item item" tid="defaultModule.image">
<i class="iconfont">&#xe61e;</i>
<span>图片</span>
</div>
<div class="ep-draggable-item item" tid="defaultModule.longText">
<i class="iconfont">&#xe7dc;</i>
<span>长文</span>
@@ -21,10 +17,6 @@
<i class="iconfont">&#xea3f;</i>
<span>表格</span>
</div>
<div class="ep-draggable-item item" tid="defaultModule.html">
<i class="iconfont">&#xe633;</i>
<span>html</span>
</div>
</div>
<div class="title">辅助元素</div>
<div class="left-item__wrapper">
@@ -47,21 +39,37 @@
</div>
<div class="title">常用元素</div>
<div class="left-item__wrapper" id="custom-provider">
<div class="ep-draggable-item item" tid="defaultModule.hline">
<i class="iconfont">&#xe7dd;</i>
<span>横线</span>
</div>
<div class="title">
<span>素材</span>
</div>
<div class="left-item__wrapper">
<div
class="item"
style="cursor: pointer;"
@click="search.type = 1, search.current = 1, isShowImage = true, getConfig()">
<div>图片素材</div>
</div>
<div class="ep-draggable-item item" tid="defaultModule.vline">
<i class="iconfont">&#xe70f;</i>
<span>竖线</span>
<div
class="item"
style="cursor: pointer;"
@click="search.type = 0, search.current = 1, isShowImage = true, getConfig()">
<div>文字素材</div>
</div>
<div class="ep-draggable-item item" tid="defaultModule.rect">
<i class="iconfont">&#xe620;</i>
<span>矩形</span>
</div>
<div class="ep-draggable-item item" tid="defaultModule.oval">
<i class="iconfont">&#xe76a;</i>
<span>圆形</span>
</div>
<div class="title">
<span>动态数据如日期</span>
<el-button type="primary" size="mini" @click="addField">添加</el-button>
</div>
<div class="left-item__wrapper">
<div
class="item"
v-for="(item, index) in dynamicFromList"
:key="index"
style="cursor: pointer;"
@click="addItemToCanvas(item.fieldName)">
<div>{{ item.fieldName }}</div>
<span class="el-icon-error" @click.stop="removeField(index)"></span>
</div>
</div>
</div>
@@ -87,15 +95,7 @@
<el-button slot="reference" size="small" :type="'other' == curPaperType ? 'primary' : ''">自定义纸张</el-button>
</el-popover>
</el-button-group>
<!-- <div class="scale">
<el-button @click="changeScale(false)" size="small">
<el-icon size="18"><ZoomOut /></el-icon>
</el-button>
<div style="margin: 0 4px; width: 40px">{{ (scaleValue * 100).toFixed(0) }}%</div>
<el-button @click="changeScale(true)" size="small">
<el-icon size="18"><ZoomIn /></el-icon>
</el-button>
</div> -->
<el-button @click="isShowTemplate = true" type="warning" size="small" style="margin-left: 10px;">模板库</el-button>
</div>
</div>
<div class="center-wrapper">
@@ -112,14 +112,129 @@
<el-button @click="isShowPreview = false">取消</el-button>
</div>
</ai-dialog>
<ai-dialog :visible.sync="isShowImage" title="图片/文字素材" width="960" customFooter>
<el-select v-model="search.type" placeholder="请选择图片/文字素材" size="small" @change="search.current = 1, getConfig()">
<el-option label="图片素材" :value="1"></el-option>
<el-option label="文字素材" :value="0"></el-option>
</el-select>
<ai-table
v-if="search.type === 1"
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
style="margin-top: 8px;"
height="400"
@getList="getConfig">
<el-table-column slot="image" label="图片" align="left">
<template v-slot="{ row }">
<el-image
v-if="search.type === 1"
style="width: 80px; height: 80px"
:src="row.imgUrl"
:preview-src-list="[row.imgUrl]">
</el-image>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" align="center">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="row.type === '1' ? addImage(row.imgUrl) : addText(row.contents), isShowImage = false">添加</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<ai-table
v-if="search.type === 0"
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
style="margin-top: 8px;"
height="400"
@getList="getConfig">
<el-table-column slot="options" label="操作" align="center">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="row.type === '1' ? addImage(row.imgUrl) : addText(row.contents), isShowImage = false">添加</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<div class="dialog-footer" slot="footer">
<el-button @click="isShowImage = false">取消</el-button>
</div>
</ai-dialog>
<ai-dialog
:visible.sync="isShowDynamicForm"
title="动态数据"
width="590px"
@confirm="onConfirm">
<el-form :model="dynamicFrom" ref="form" label-width="100px">
<el-form-item
label="数据名称:"
:prop="`field_${dynamicFromList.length > 9 ? dynamicFromList.length + 1 : '0' + (dynamicFromList.length + 1)}`"
:rules="[{ required: true, message: '请输入数据名称', trigger: 'blur' }]">
<el-input placeholder="请输入数据名称" type="text" v-model="dynamicFrom[`field_${dynamicFromList.length > 9 ? dynamicFromList.length + 1 : '0' + (dynamicFromList.length + 1)}`]"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
<ai-dialog :visible.sync="isShowTemplate" title="模板库" width="1060px" customFooter>
<div class="templateList-wrapper" v-infinite-scroll="getTemplateList" :infinite-scroll-distance="20">
<div class="templateList">
<div class="templateList-item" v-for="(item, index) in templateList" :key="index">
<!-- <img :src="item.previewUrl" /> -->
<el-image
style="height: 180px;"
fit="contain"
:src="item.previewUrl"
:preview-src-list="[item.previewUrl]">
</el-image>
<h2>{{ item.name }}</h2>
<el-button type="warning" size="mini" @click="updateTempate(item)">使用模板</el-button>
</div>
</div>
</div>
<!-- <ai-table
:tableData="templateList"
:col-configs="templateColConfigs"
:total="templateTotal"
:current.sync="searchTemplate.current"
:size.sync="searchTemplate.size"
height="480"
@getList="getTemplateList"
v-loading="templateLoading">
<el-table-column slot="img" label="预览图" align="center">
<template v-slot="{ row }">
<el-image
style="width: 200px; height: 200px"
fit="contain"
:src="row.previewUrl"
:preview-src-list="[row.previewUrl]">
</el-image>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" align="center" width="200">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="showTemplate(row)">模板预览</el-button>
<el-button type="text" @click="updateTempate(row)">使用</el-button>
</div>
</template>
</el-table-column>
</ai-table> -->
<div class="dialog-footer" slot="footer">
<el-button @click="isShowTemplate = false">取消</el-button>
</div>
</ai-dialog>
</div>
</template>
<script>
import { hiprint, defaultElementTypeProvider, disAutoConnect } from 'vue-plugin-hiprint'
import { newHiprintPrintTemplate } from '@/utils/template-helper'
import template from './template'
import printData from './printData'
import { customProvider } from './customProvider'
disAutoConnect()
@@ -131,6 +246,45 @@
default: () => {
return []
}
},
params: {
type: Array,
default: () => {
return []
}
},
printData: {
type: Object,
default: () => {
return {
}
}
},
template: {
type: Object,
default: () => {
return {
"panels": [{
"index": 0,
"name": 1,
"height": 200,
"width": 200,
"printElements": [],
"paperNumberDisabled": true,
"paperNumberContinue": true,
"fontFamily": "Microsoft YaHei",
"watermarkOptions": {}
}]
}
}
},
isPrint: {
type: Boolean,
default: false
}
},
@@ -139,40 +293,79 @@
html: '',
isShowPreview: false,
hiprintTemplate: null,
isShowTemplate: false,
templateList: [],
curPaper: {
type: 'other',
width: 200,
height: 200
},
paperTypes: {
'A3': {
width: 420,
height: 296.6
'100 * 100': {
width: 200,
height: 200
},
'A4': {
width: 210,
height: 296.6
'100 * 80': {
width: 200,
height: 160
},
'A5': {
width: 210,
height: 147.6
'80 * 60': {
width: 160,
height: 120
},
'B3': {
width: 500,
height: 352.6
},
'B4': {
width: 250,
height: 352.6
},
'B5': {
width: 250,
height: 175.6
'60 * 40': {
width: 120,
height: 80
}
},
paperPopVisible: false,
paperWidth: '80',
paperHeight: '60'
paperWidth: 200,
paperHeight: 200,
isShowDynamicForm: false,
dynamicFrom: {
},
dynamicFromList: [],
panel: null,
contents: [],
images: [],
search: {
current: 1,
size: 10,
type: 1
},
searchTemplate: {
current: 1,
size: 8,
type: 1
},
templateTotal: 0,
isShowImage: false,
tableData: [],
total: 0,
templateColConfigs: [
{ prop: 'name', label: '模板名称', align: 'left' },
{ slot: 'img'}
],
templateLoading: false,
hasMore: true
}
},
watch: {
template: {
handler(value) {
if (value && this.hiprintTemplate && !this.isPrint) {
const config = value.panels[0]
this.hiprintTemplate.update(value)
this.curPaper = {type: 'other', width: config.width, height: config.height}
this.hiprintTemplate.setPaper(config.width, config.height)
if (this.params) {
this.dynamicFromList = this.params
}
}
},
deep: true
}
},
@@ -188,30 +381,187 @@
}
}
return type
},
colConfigs () {
if (this.search.type === 1) {
return [
{ slot: 'image' },
{ prop: 'remark', label: '描述', align: 'center' }
]
}
return [
{ prop: 'contents', label: '文本', align: 'center' },
{ prop: 'remark', label: '描述', align: 'center' }
]
}
},
mounted() {
hiprint.init({
providers: [defaultElementTypeProvider(), customProvider({})]
})
if (this.isPrint) {
this.hiprintTemplate = newHiprintPrintTemplate('temulables')
} else {
hiprint.init({
providers: [defaultElementTypeProvider(), customProvider({})]
})
this.buildLeftElement()
this.buildDesigner()
this.getConfig()
this.buildLeftElement()
this.buildDesigner()
this.getTemplateList()
}
},
methods: {
addField() {
const num = this.dynamicFromList.length > 9 ? this.dynamicFromList.length + 1 : `0${this.dynamicFromList.length + 1}`
// eslint-disable-next-line no-empty
if (this.dynamicFromList.length && !this.dynamicFromList.at(-1)[`field_${num}`]) {
} else {
this.$set(this.dynamicFrom, `field_${num}`, '')
}
this.isShowDynamicForm = true
},
removeField(index) {
this.dynamicFromList.splice(index, 1)
},
updateTempate(row) {
this.templateLoading = true
this.$http.post(`/api/templateRecommend/detail?id=${row.id}`).then(res => {
if (res.code === 0) {
const config = JSON.parse(res.data.content)
this.hiprintTemplate.update(config)
this.hiprintTemplate.setPaper(config.panels[0].width, config.panels[0].height)
this.dynamicFromList = JSON.parse(res.data.params)
this.isShowTemplate = false
}
this.templateLoading = false
})
},
getTemplateList() {
if (!this.hasMore) return
if (this.templateLoading) return
this.templateLoading = true
this.$http.post(`/api/templateRecommend/getRecommendPage`, null, {
params: this.searchTemplate
}).then(res => {
if (res.code === 0) {
this.templateList = [...this.templateList, ...res.data.records]
this.templateTotal = res.data.total
if (res.data.records.length < this.searchTemplate.size) {
this.hasMore = false
} else {
this.searchTemplate.current = this.searchTemplate.current + 1
}
this.templateLoading = false
}
})
},
showTemplate (row) {
this.templateLoading = true
this.$http.post(`/api/templateRecommend/detail?id=${row.id}`).then(res => {
this.templateLoading = false
if (res.code === 0) {
this.html = res.data.codes
this.isShowPreview = true
}
})
},
getConfig() {
this.$http.post(`/api/material/getPage?current=${this.search.current}&size=${this.search.size}&type=${this.search.type}`).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
addImage(src) {
this.panel.addPrintImage({
options: {
title: '',
left: 70.5,
top: 58.5,
src: src,
width: 100,
height: 100,
fit: 'contain'
}
})
const el = this.hiprintTemplate.printPanels[0].printElements.at(-1)
const designPaper = this.hiprintTemplate.printPanels[0].designPaper
this.hiprintTemplate.printPanels[0].appendDesignPrintElement(designPaper, el, true)
el.design(void 0, designPaper)
},
addText(text, isSetField = false) {
this.panel.addPrintText({
options: {
field: isSetField ? text : '',
testData: isSetField ? text : '',
title: isSetField ? '' : text,
left: 70.5,
top: 58.5,
width: 140,
height: 20,
coordinateSync: true,
contentPaddingLeft: 5.25,
textContentVerticalAlign: 'middle',
widthHeightSync: true,
hideTitle: true,
fontFamily: 'Microsoft YaHei',
fontWeight: '700'
}
})
const el = this.hiprintTemplate.printPanels[0].printElements.at(-1)
const designPaper = this.hiprintTemplate.printPanels[0].designPaper
this.hiprintTemplate.printPanels[0].appendDesignPrintElement(designPaper, el, true)
el.design(void 0, designPaper)
},
addItemToCanvas(name) {
this.addText(name, true)
},
onConfirm() {
this.$refs.form.validate((valid) => {
if (valid) {
const num = this.dynamicFromList.length > 9 ? this.dynamicFromList.length + 1 : `0${this.dynamicFromList.length + 1}`
this.dynamicFromList.push({
fieldValue: `field_${num}`,
fieldName: this.dynamicFrom[`field_${num}`]
})
this.isShowDynamicForm = false
}
})
},
buildLeftElement() {
// eslint-disable-next-line no-undef
hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'))
// eslint-disable-next-line no-undef
$('#custom-provider').empty()
// eslint-disable-next-line no-undef
hiprint.PrintElementTypeManager.build($('#custom-provider'), 'customProvider')
},
buildDesigner() {
// eslint-disable-next-line no-undef
$('#hiprint-printTemplate').empty()
console.log(template)
this.hiprintTemplate = newHiprintPrintTemplate('temulables', {
template: template,
template: this.template,
settingContainer: '#PrintElementOptionSetting',
onImageChooseClick: (target) => {
let input = document.createElement('input')
@@ -219,7 +569,6 @@
input.click()
input.onchange = function () {
var file = this.files[0]
var reader = new FileReader()
if (file) {
var reader = new FileReader()
reader.readAsDataURL(file)
@@ -232,10 +581,13 @@
}
})
this.$nextTick(() => {
this.hiprintTemplate.design('#hiprint-printTemplate', {
grid: true
})
this.panel = this.hiprintTemplate.printPanels[0]
})
},
@@ -262,42 +614,60 @@
},
print() {
let options = { leftOffset: 0, topOffset: 0 }
let ext = {
callback: () => {
console.log('浏览器打印窗口已打开')
},
this.hiprintTemplate.print(this.printData)
},
styleHandler: () => {
return '<style></style>'
}
}
// js打印不显示设计界面
toPrint (template, printData) {
this.hiprintTemplate = newHiprintPrintTemplate('temulables')
const list = this.labels
this.hiprintTemplate.print(list)
setTimeout(() => {
this.hiprintTemplate.update(template)
this.hiprintTemplate.print(printData)
}, 100)
},
elementToString(el) {
const node = document.createElement('div')
node.appendChild(el)
node.innerHTML = el.html()
return node.innerHTML
document.querySelector('body').appendChild(node)
const html = node.innerHTML
document.querySelector('body').removeChild(node)
return html
},
savePdf() {
const list = this.labels
this.hiprintTemplate.toPdf(printData, '测试导出pdf')
this.hiprintTemplate.toPdf(this.printData, '测试导出pdf',{scale:2 }).then(v => {
console.log(v)
})
},
getHtml() {
const list = this.labels
this.html = this.elementToString(this.hiprintTemplate.getHtml(list)[0])
save() {
const html = this.elementToString(this.hiprintTemplate.getHtml(this.printData))
const json = this.hiprintTemplate.getJson()
console.log(this.html)
return {
html,
json,
params: JSON.stringify(this.dynamicFromList)
}
},
preview() {
this.html = this.elementToString(this.hiprintTemplate.getHtml(this.printData))
this.isShowPreview = true
},
getHtml(template, printData) {
this.hiprintTemplate = newHiprintPrintTemplate('temulables')
this.hiprintTemplate.update(template)
const html = this.elementToString(this.hiprintTemplate.getHtml(printData))
return html
},
clearPaper() {
this.hiprintTemplate.clear()
},
@@ -308,10 +678,17 @@
}
}
</script>
<style lang="scss" scoped>
.print {
height: 100%;
.temuBarCode {
display: flex;
flex-direction: column;
padding: 1pt 3pt;
}
.print-wrapper {
display: flex;
height: calc(100vh - 180px);
@@ -338,8 +715,9 @@
::v-deep(.hiprint-printPanel) {
display: block;
& > div {
// margin: 0 auto !important;
.dynamicField {
background-color: #bfc2e9;
border-color: #bfc2e9;
}
}
@@ -380,6 +758,10 @@
overflow-y: auto;
.title {
display: flex;
align-items: center;
justify-content: space-between;
width: 320px;
margin: 14px 0;
}
@@ -390,9 +772,12 @@
.item {
display: flex;
position: relative;
flex-direction: column;
align-items: center;
justify-content: center;
left: 0!important;
top: 0!important;
width: 100px;
margin-bottom: 10px;
margin-right: 10px;
@@ -404,8 +789,17 @@
margin-right: 0;
}
span {
margin-top: 10px;
i {
margin-bottom: 10px;
}
.el-icon-error {
position: absolute;
top: -6px;
right: -6px;
color: red;
font-size: 18px;
cursor: pointer;
}
}
@@ -494,5 +888,49 @@
.print-viewer {
color: #000;
}
.templateList-wrapper {
padding-right: 10px;
.templateList {
display: flex;
flex-wrap: wrap;
.templateList-item {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
width: 24%;
margin-bottom: 20px;
margin-right: 1.333%;
padding: 10px;
border-radius: 3px;
overflow: hidden;
background-color: #f4f4f4;
.el-button {
position: absolute;
top: 0;
right: 0;
z-index: 1;
}
h2 {
margin-top: 12px;
font-size: 14px;
font-weight: 600;
color: #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&:nth-of-type(4n) {
margin-right: 0;
}
}
}
}
}
</style>

View File

@@ -1,66 +1,132 @@
/* eslint-disable no-undef */
import { hiprint } from 'vue-plugin-hiprint'
export const customProvider = function (options) {
var addElementTypes = function (context) {
export const customProvider = function () {
const addElementTypes = function (context) {
context.removePrintElementTypes('customProvider')
context.addPrintElementTypes('customProvider', [
new hiprint.PrintElementTypeGroup('', [
{
tid: 'providerModule1.date',
title: '业务日期',
data: '2020-01-01',
type: 'text',
options: {
field: 'date',
testData: '2020-01-01',
height: 16,
fontSize: 6.75,
fontWeight: '700',
textAlign: 'left',
textContentVerticalAlign: 'middle',
hideTitle: true
}
},
{
tid: 'providerModule1.barcode',
title: '条形码',
tid: 'providerModule1.html',
title: 'TEMU条码',
data: 'XS888888888',
type: 'text',
type: 'html',
formatter: function (data, options, sukData) {
const elId = options.elId || 'barCode-' + new Date().getTime()
const codeWidth = parseInt((options.width - 22) * 0.85)
let printData = {
labelCode: 123456789,
productSkuId: `XXXXXXXXXXXXXX`,
skuExtCode: 'XXXXXXXXXXXXXX',
skuSpecName: 'XXXXX'
}
options.elId = `${elId}`
if (sukData) {
printData = sukData
}
$('body').append(`<div id="codewrapper-${elId}" style="width: ${codeWidth}pt">
<svg id="${elId}" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg>
</div>`)
JsBarcode('#' + elId, printData.labelCode, {
format: 'CODE128B',
width: 2,
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
margin: 0,
displayValue: false
})
const codeHtml = $(`#codewrapper-${elId}`).html()
$(`body>#codewrapper-${elId}`).remove()
const resizeObserver = new ResizeObserver(() => {
JsBarcode('#' + elId, printData.labelCode, {
format: "CODE128B",
width: 2,
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
margin: 0,
displayValue: false
})
})
setTimeout(() => {
const node = document.getElementById(`temuBarCode-${elId}`)
if (node) {
resizeObserver.observe(node)
}
}, 0)
var html = `
<div class="temuBarCode" id="temuBarCode-${elId}">
<div class="temuBarCode-top">
<div class="hiprint-printElement-text-content hiprint-printElement-content">${printData.skuExtCode || printData.productSkcId}</div>
<div class="hiprint-printElement-text-content hiprint-printElement-content">${printData.skuSpecName}</div>
</div>
<div class="temuBarCode-middle">
<div class="hiprint-printElement-text-content hiprint-printElement-content temuBarCode-code" style="width: 100%">
${codeHtml}
</div>
</div>
<div class="temuBarCode-bottom">
<div class="hiprint-printElement-text-content hiprint-printElement-content">${printData.productSkuId}</div>
<div class="hiprint-printElement-text-content hiprint-printElement-content">Made in China</div>
</div>
</div>
`
return html
},
options: {
field: 'barcode',
testData: 'XS888888888',
height: 32,
fontSize: 12,
lineHeight: 18,
textAlign: 'left',
textType: 'barcode',
hideTitle: false
}
},
{
tid: 'providerModule1.qrcode',
title: '二维码',
data: 'XS888888888',
type: 'text',
options: {
field: '',
testData: '',
height: 32,
fontSize: 12,
lineHeight: 18,
textType: 'qrcode',
hideTitle: false
width: 316,
height: 120,
elId: ''
},
printElementType: {
}
},
// {
// tid: 'providerModule1.barcode',
// title: '条形码',
// data: 'XS888888888',
// type: 'text',
// options: {
// field: 'barcode',
// testData: 'XS888888888',
// height: 32,
// fontSize: 12,
// lineHeight: 18,
// textAlign: 'left',
// textType: 'barcode',
// hideTitle: false
// }
// },
// {
// tid: 'providerModule1.qrcode',
// title: '二维码',
// data: 'XS888888888',
// type: 'text',
// options: {
// field: '',
// testData: '',
// height: 32,
// fontSize: 12,
// lineHeight: 18,
// textType: 'qrcode',
// hideTitle: false
// }
// },
{
tid: 'providerModule1.image',
title: 'Logo',
data: 'https://foruda.gitee.com/avatar/1677050350324030848/5400665_ccsimple_1591166830.png!avatar200',
type: 'image'
title: '图片',
type: 'image',
options: {
contain: 'contain',
src: 'http://lyshunong.oss-cn-beijing.aliyuncs.com/image/material/a6e14259412606502e49f1abd866039.png',
}
}
])
])
}
return {
addElementTypes: addElementTypes
addElementTypes
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -197,6 +197,38 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
resolve({success: false, errorCode: -1})
});
}).then(sendResponse);
} else if (request.type == 'xcApi') {
new Promise(async (resolve) => {
let headers = {}, data;
headers.cookie = await getXcCookie();
console.log(headers)
if (!request.isFormData) {
headers['Content-Type'] = 'application/json';
data = JSON.stringify(request.data)
} else {
const formData = new FormData();
Object.keys(request.data).forEach(key => {
const value = request.data[key]
if (Array.isArray(value)) {
value.forEach((subValue, i) => {
formData.append(key + `[${i}]`, subValue)
})
} else {
if (key == "image") {
//跳过image的处理
} else formData.append(key, request.data[key])
}
})
data = formData
}
Promise.resolve().then(() => fetch(request.url, {
'headers': headers, 'method': request.method, 'referrerPolicy': 'strict-origin-when-cross-origin', 'credentials': 'include', 'body': data, 'mode': 'cors'
})).then((res) => {
resolve(res.json());
}).catch(() => {
resolve({success: false, errorCode: -1})
});
}).then(sendResponse);
} else if (request.type == 'notify') {
chrome.notifications.create("" + Math.random(), {
type: "basic", title: "TEMU助手", message: "您店铺【" + request.mallName + "】的商品【" + request.productName + "】成功加入发货台,请尽快处理", iconUrl: "./icons/48.png"
@@ -285,6 +317,18 @@ function getAliexpressCookie(link = "https://csp.aliexpress.com/") {
})
}
function getXcCookie(link = "http://xc.rqlis.com:888/") {
let cStr = '';
return new Promise((resolve, reject) => {
chrome.cookies.getAll({url: link}, (cookie) => {
cookie.map((c) => {
cStr += c.name + '=' + c.value + ';';
});
resolve(cStr);
});
})
}
function formatParams(data) {
const arr = []
for (let name in data) {

View File

@@ -21,6 +21,24 @@ Vue.prototype.$base = "https://seller.kuajingmaihuo.com"
Object.keys(utils).forEach(v => Vue.prototype[`$${v}`] = utils[v])
Vue.prototype.$http = instance
utils.initWindow()
Vue.directive('throttle', {
bind: function (el, obj) {
let timerId = null
let flag = true
el.addEventListener('input', function () {
if (!flag) return
flag = false
timerId && clearTimeout(timerId)
timerId = setTimeout(function () {
flag = true
obj.value()
}, 800)
})
}
})
new Vue({
store,

View File

@@ -22,7 +22,8 @@
"*://*.shein.com/",
"*://*.geiwohuo.com/",
"*://*.ltwebstatic.com/",
"*://*.goodcang.com/"
"*://*.goodcang.com/",
"*://*.rqlis.com/"
],
"permissions": [
"cookies",
@@ -82,6 +83,11 @@
"id": "11",
"enabled": true,
"path": "rules_11.json"
},
{
"id": "12",
"enabled": true,
"path": "rules_12.json"
}
]
},

View File

@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "TEMU助手",
"description": "TEMU助手 - 自动化提高生产效率",
"version": "3.3.1",
"version": "3.4.0",
"background": {
"service_worker": "/background.js"
},
@@ -21,7 +21,8 @@
"*://*.amazon.com/",
"*://*.shein.com/",
"*://*.geiwohuo.com/",
"*://*.ltwebstatic.com/"
"*://*.ltwebstatic.com/",
"*://*.rqlis.com/"
],
"permissions": [
"cookies",
@@ -81,6 +82,11 @@
"id": "11",
"enabled": true,
"path": "rules_11.json"
},
{
"id": "12",
"enabled": true,
"path": "rules_12.json"
}
]
},

View File

@@ -111,6 +111,11 @@ const router = new VueRouter({
name: 'copyProductAliExpress',
component: () => import('../view/product/CopyProductAliExpress.vue')
},
{
path: 'priceDown',
name: 'priceDown',
component: () => import('../view/product/PriceDown.vue')
},
{
path: 'batchUpload',
name: 'batchUpload',
@@ -289,6 +294,12 @@ const router = new VueRouter({
component: () => import('../view/data/SyncDataTemu.vue')
},
{
path: 'sendGoods_xc',
name: 'sendGoods_xc',
component: () => import('../view/semi/SemiSendGoods_XC.vue')
},
// {
// path: 'statistics',
// name: 'statistics',

View File

@@ -15,7 +15,8 @@ export default new Vuex.Store({
activeDlgShow: false,
showSheinAlert: false,
showTemuAlert: false,
userInfo: {}
userInfo: {},
labelInfo: {}
},
mutations: {
@@ -54,6 +55,9 @@ export default new Vuex.Store({
},
setTemuAlertShow(state, flag) {
state.showTemuAlert = flag
},
setLabelInfo(state, info) {
state.labelInfo = info
}
},
@@ -66,8 +70,25 @@ export default new Vuex.Store({
resolve(res.data)
}
})
store.dispatch('getLabelInfo')
})
},
getLabelInfo(store) {
return new Promise(resolve => {
request.post('/api/userExtend/getLabelDetail').then(res => {
if (res.code === 0) {
const isExpires = new Date().getTime() > new Date(res.data.expireTime).getTime() || res.data.skuUsed > res.data.skuTotal
store.commit('setLabelInfo', {
...res.data,
isExpires
})
resolve(res.data)
}
})
})
},
SignOut(store, isClear) {
if (isClear) {
store.commit('logout')

View File

@@ -1,6 +1,9 @@
import request from '../api'
import store from '../store'
import { Message } from 'element-ui'
import JsBarcode from 'jsbarcode'
import { Interpreter } from 'eval5'
import { transform } from "@babel/standalone"
const dict = {
url: "/api/dictionary/queryValsByCodeList",
@@ -118,11 +121,30 @@ const sleepSync = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
const initWindow = () => {
const transformCode = (codeStr) => {
return transform(codeStr, { presets: ['env'] }).code
}
window.JsBarcode = JsBarcode
window.eval = (code, context) => {
const interpreter = new Interpreter(context || window, {
timeout: 1000,
})
try {
interpreter.evaluate(transformCode(code))
} catch (err) {
console.log(err)
}
}
}
export default {
dict,
dateUtil,
sleepSync,
userCheck
userCheck,
initWindow
}

View File

@@ -108,15 +108,19 @@ export function transform(leftData) {
"valueExtendInfo": ""
});
rightSkuItem.productSkuId = 0;
rightSkuItem.productSkuWhExtAttrReq = {
"productSkuVolumeReq": leftSkuItem.productSkuWhExtAttr.productSkuVolume,
"productSkuWeightReq": leftSkuItem.productSkuWhExtAttr.productSkuWeight,
"productSkuBarCodeReqs": leftSkuItem.productSkuWhExtAttr.productSkuBarCodes,
"productSkuSensitiveAttrReq": {
"isSensitive": leftSkuItem.productSkuWhExtAttr.productSkuSensitiveAttr.isSensitive,
"sensitiveList": leftSkuItem.productSkuWhExtAttr.productSkuSensitiveAttr.sensitiveList},
"productSkuSensitiveLimitReq": leftSkuItem.productSkuWhExtAttr.productSkuSensitiveLimit,
};
if (!leftSkuItem.productSkuWhExtAttr) {
rightSkuItem.productSkuWhExtAttrReq = null
} else {
rightSkuItem.productSkuWhExtAttrReq = {
"productSkuVolumeReq": leftSkuItem.productSkuWhExtAttr?.productSkuVolume,
"productSkuWeightReq": leftSkuItem.productSkuWhExtAttr?.productSkuWeight,
"productSkuBarCodeReqs": leftSkuItem.productSkuWhExtAttr?.productSkuBarCodes,
"productSkuSensitiveAttrReq": {
"isSensitive": leftSkuItem.productSkuWhExtAttr?.productSkuSensitiveAttr.isSensitive,
"sensitiveList": leftSkuItem.productSkuWhExtAttr?.productSkuSensitiveAttr.sensitiveList},
"productSkuSensitiveLimitReq": leftSkuItem.productSkuWhExtAttr?.productSkuSensitiveLimit,
};
}
rightSkuItem.currencyType = leftSkuItem.currencyType;
rightSkcItem.productSkuReqs.push(rightSkuItem);

View File

@@ -7,7 +7,7 @@
</div>
<div class="admin-right">
<el-tooltip class="item" effect="dark" content="金币信息" placement="top">
<div class="left" @click="toActive">
<div class="left" @click="openMember(1)">
<div :style="{marginLeft: '0px'}">{{ $store.state.userInfo.coin }}</div>
<span style="margin-right: 10px;"><img src="../assets/coin.png" width="30"/></span>
</div>
@@ -15,7 +15,7 @@
<el-button type="button" :class="'el-button el-button--primary'" @click="sign">签到</el-button>
<!--<el-button type="button" :class="'el-button el-button--primary'" @click="openFolder">打开文件夹</el-button>-->
<el-tooltip class="item" effect="dark" content="用户激活" placement="top">
<div class="left" @click="toActive">
<div class="left" @click="openMember(0)">
<span>会员信息:</span>
<div :style="{marginLeft: '10px', color: $store.state.userInfo.flag == 1? 'green': 'red'}">{{ getStateInfo }}</div>
</div>
@@ -81,6 +81,7 @@
<el-menu-item index="/productList">商品列表</el-menu-item>
<el-menu-item index="/copyProduct">商品复制</el-menu-item>
<el-menu-item index="/findSeller">查找买手</el-menu-item>
<el-menu-item index="/priceDown">拒绝调价</el-menu-item>
<!--<el-menu-item index="/batchUpload">批量上品</el-menu-item>-->
<el-menu-item v-if="$store.state.userInfo.phone == '18610967550' || isAdmin" index="/draft">
草稿箱管理
@@ -177,6 +178,13 @@
</template>
<el-menu-item index="/syncDataTemu">数据同步(TEMU)</el-menu-item>
</el-submenu>
<el-submenu index="/semi" v-if="$store.state.userInfo.phone == '18571466720'">
<template slot="title">
<i class="el-icon-s-data"></i>
<span slot="title">半托管</span>
</template>
<el-menu-item index="/sendGoods_xc">发货(芯仓)</el-menu-item>
</el-submenu>
<el-menu-item index="/info">
<i class="el-icon-info"></i>
<span slot="title">弹窗消息</span>
@@ -193,13 +201,23 @@
<i class="el-icon-s-data"></i>
<span slot="title">数据统计</span>
</el-menu-item> -->
<el-submenu index="/labelsTemplate">
<el-submenu index="labels">
<template slot="title">
<i class="el-icon-s-goods"></i>
<span slot="title">标签管理</span>
<div slot="title" style="display: inline-block;">
<span>高级功能</span>
</div>
</template>
<el-menu-item index="/labelsTemplate">模板管理</el-menu-item>
<el-menu-item index="/labelsPrint">标签打印</el-menu-item>
<el-submenu index="/labelsTemplate" style="padding-left: 15px;">
<template slot="title">
<div slot="title" style="display: inline-block; ">
<span>标签管理</span>
<el-button type="text" style="margin-left: 57px; padding: 0;" @click.stop="openMember(2)">开通</el-button>
</div>
</template>
<el-menu-item index="/labelsTemplate">模板管理</el-menu-item>
<el-menu-item index="/labelsPrint">标签打印</el-menu-item>
</el-submenu>
</el-submenu>
</el-menu>
@@ -241,20 +259,21 @@
<el-button @click="closeTemuAlert"> </el-button>
</span>
</el-dialog>
<div id="kefu" @click="gotoKefu">
<label slot="reference" class="topBtn" title="联系客服"></label>
</div>
<LablesMember ref="LablesMember"></LablesMember>
</div>
</template>
<script>
import {mapMutations, mapState} from 'vuex'
import AiPayment from "@/components/AiPayment.vue";
import {sendAliexpressAPIMessage, sendTemuSellerAgentMessage, sendGoodcangAPIMessage} from "@/api/chromeApi";
import LablesMember from '@/components/LablesMember'
import {sendAliexpressAPIMessage, sendGoodcangAPIMessage} from "@/api/chromeApi";
export default {
components: {AiPayment},
components: {AiPayment, LablesMember},
data() {
return {
isCollapse: false,
@@ -300,8 +319,6 @@ export default {
},
created() {
window.eval = () => {
}
const devVersion = require('../manifest.development.json').version
const prodVersion = require('../manifest.production.json').version
this.version = process.env.NODE_ENV === 'production' ? prodVersion : devVersion
@@ -326,6 +343,11 @@ export default {
this.$router.push('coinFlow')
}
},
openMember(index) {
this.$refs.LablesMember.show(index)
},
handleClose() {
this.form.mallId = "";
this.form.mallName = "";

View File

@@ -187,9 +187,9 @@ import {timestampToTime} from '@/utils/date'
this.isLoading = false
},
async syncProduct(mallId, mallName) {
let res = await sendChromeAPIMessage({url: 'bg-visage-mms/product/skc/pageQuery',
anti:true,
needMallId: true,
let res = await sendChromeAPIMessage({url: 'bg-visage-mms/product/skc/pageQuery',
anti:true,
needMallId: true,
mallId: mallId,
data: {
pageSize: this.pageSize,
@@ -250,9 +250,9 @@ import {timestampToTime} from '@/utils/date'
let start = now.getTime()
let end = start + 86400*1000 - 1000
let res = await sendChromeAPIMessage({url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryBatch',
anti:true,
needMallId: true,
let res = await sendChromeAPIMessage({url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryBatch',
anti:true,
needMallId: true,
mallId: mallId,
data: {
pageNo: this.pageNo,
@@ -280,7 +280,9 @@ import {timestampToTime} from '@/utils/date'
productName: item1.subPurchaseOrderBasicVO.productName,
skc: item1.productSkcId,
skcCode: item1.skcExtCode,
isFirst: item1.subPurchaseOrderBasicVO.isFirst ? 1: 0
isFirst: item1.subPurchaseOrderBasicVO.isFirst ? 1: 0,
subPurchaseOrderSn: item1.subPurchaseOrderSn,
createTime: timestampToTime(item1.deliverTime)
}
item1.packageDetailList.map(item2 => {
@@ -288,12 +290,12 @@ import {timestampToTime} from '@/utils/date'
...temp,
sku: item2.productSkuId,
num: item2.skuNum
}
}
})
this.deliveryOrderList.push(temp)
})
})
if (res.result.list.length == this.pageSize) {
this.pageNo ++
await this.syncDeliveryOrder(mallId, mallName)
@@ -355,5 +357,5 @@ import {timestampToTime} from '@/utils/date'
</script>
<style scoped lang="scss">
</style>
</style>

View File

@@ -1,21 +1,31 @@
<template>
<AiDetail class="add-label">
<template #title>
<ai-title title="添加标签" isShowBack :isShowBottomBorder="true" @onBackClick="cancel">
<ai-title title="添加模板" isShowBack :isShowBottomBorder="true" @onBackClick="cancel">
<template #center>
<label>模板名称</label>
<el-input placeholder="请输入模板名称" size="small" v-model="name" style="width: 200px;"></el-input>
</template>
<template #rightBtn>
<el-button @click="preview" size="small" type="danger">预览</el-button>
<el-button @click="savePdf" size="small" type="primary">下载pdf</el-button>
<el-button @click="saveTemplate" size="small" type="primary">保存</el-button>
<!-- <el-button @click="savePdf" size="small" type="primary">下载pdf</el-button> -->
<el-button @click="print" size="small">打印</el-button>
<el-button @click="clearPaper" size="small" type="danger">清空纸张</el-button>
<el-button @click="saveTemplate" size="small" type="primary" :loading="isLoading">保存</el-button>
</template>
</ai-title>
</template>
<template #content>
<ai-card title="标签模板" class="card" :hideTitle="true">
<ai-card title="标签模板" class="card" :hideTitle="true" v-loading="isLoading">
<template #content>
<div class="add-label__wrapper">
<Print ref="printRef" :labels="labels"></Print>
<Print
ref="printRef"
:template="template"
:printData="printData"
:isPrint="false"
:params="params">
</Print>
</div>
</template>
</ai-card>
@@ -33,7 +43,45 @@
data () {
return {
labels: []
name: '',
template: {
"panels": [{
"index": 0,
"name": 1,
"height": 200,
"width": 200,
"paperHeader": 0,
"paperFooter": 547,
"printElements": [],
"paperNumberLeft": 500,
"paperNumberTop": 530,
"paperNumberDisabled": true,
"paperNumberContinue": true,
"fontFamily": "Microsoft YaHei",
"scale": 1,
"watermarkOptions": {}
}]
},
printData: {},
id: '',
info: {},
params: [],
isLoading: false
}
},
mounted() {
this.printData = {
labelCode: 123456789,
productSkuId: `XXXXXXXXXXXXXX`,
skuExtCode: 'XXXXXXXXXXXXXX',
skuSpecName: 'XXXXX'
}
if (this.$route.query.id) {
this.id = this.$route.query.id
this.getInfo()
}
},
@@ -42,8 +90,25 @@
this.$router.go(-1)
},
getInfo() {
this.isLoading = true
this.$http.post(`/api/template/detail?id=${this.$route.query.id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.name = res.data.name
this.params = JSON.parse(res.data.params)
this.$nextTick(() => {
this.template = JSON.parse(res.data.content)
})
}
this.isLoading = false
})
},
preview () {
this.$refs.printRef.getHtml()
this.$refs.printRef.preview()
},
savePdf () {
@@ -55,11 +120,32 @@
},
saveTemplate () {
const json = this.$refs.printRef.exportJson()
console.log(json)
if (!this.name) {
return this.$message.error('模板名称不能为空')
}
const data = this.$refs.printRef.save()
this.isLoading = true
const url = this.id ? `/api/template/modify` : `/api/template/addTemplate`
this.$http.post(url, {
name: this.name,
codes: data.html,
content: JSON.stringify(data.json),
params: data.params,
id: this.id || ''
}).then(res => {
if (res.code === 0) {
this.isLoading = false
this.$message.success('模板创建成功')
this.cancel()
} else {
this.isLoading = false
}
})
},
print () {
print() {
this.$refs.printRef.print()
},

View File

@@ -1,135 +1,343 @@
<template>
<ai-list class="Learning">
<ai-list class="Print-page">
<ai-title
slot="title"
title="新手园地"
title="标签打印"
isShowBottomBorder>
</ai-title>
<template slot="content">
<ai-search-bar>
<template #left>
<el-radio-group v-model="search.categoryId" @change="onChange">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button label="isFavorite">我的收藏</el-radio-button>
<el-radio-button :label="item.id" :key="item.id" v-for="item in cateList">{{ item.name }}</el-radio-button>
</el-radio-group>
</template>
<template #right>
</template>
</ai-search-bar>
<div class="search-item__wrapper">
<div class="left">
<div class="search-item">
<el-radio-group v-model="addType" @click="lableList = [], search.productSkuId = '', search.productSkcId = ''">
<el-radio-button label="1">按发货单打印</el-radio-button>
<el-radio-button label="2">按SKC打印</el-radio-button>
<el-radio-button label="3">按SKU打印</el-radio-button>
</el-radio-group>
</div>
</div>
<div class="right"></div>
</div>
<div class="search-item__wrapper">
<div class="left">
<div class="search-item" v-show="addType === '1'">
<label>发货单</label>
<el-select v-model="search.mallId" 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>
<el-button style="margin-left: 10px;" size="small" :disabled="!search.mallId" :loading="isLoading" @click="searchSkuList">查询</el-button>
</div>
<div class="search-item" v-show="addType === '2' || addType === '3'">
<label>{{ addType === '2' ? 'SKC' : 'SKU' }}</label>
<el-input
v-if="addType === '3'"
v-model="search.productSkuId"
style="width: 250px"
size="small"
clearable
placeholder="多个查询请用户逗号分割"
suffix-icon="iconfont iconSearch">
</el-input>
<el-input
v-else
v-model="search.productSkcId"
style="width: 250px"
size="small"
placeholder="多个查询请用户逗号分割"
clearable
suffix-icon="iconfont iconSearch">
</el-input>
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
</div>
</div>
</div>
<ai-table
:tableData="tableData"
:tableData="lableList"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
style="margin-top: 8px;"
@getList="getList">
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
:isShowPagination="false"
:height="height"
@getList="() => {}"
:loading="isLoading">
<el-table-column slot="options" label="操作" align="center" fixed="right" width="120px">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="collection(row.id, row.isFavorite)">{{ row.isFavorite === '0' ? '收藏' : '取消收藏' }}</el-button>
<el-button type="text" @click="toDetail(row.url)">详情</el-button>
<el-button type="text" @click="toPrint(row)">打印</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<Print ref="printRef" :isPrint="true"></Print>
<ai-dialog
:visible.sync="isShow"
title="打印数量"
width="890px"
@confirm="onConfirm">
<el-form class="ai-form" :model="form" ref="form" label-width="100px">
<el-form-item label="打印数量" style="width: 100%;" prop="count" :rules="[{ required: true, message: '请输入打印数量', trigger: 'change' }]">
<el-input-number v-model="form.count" :min="1" :max="500" label="请输入打印数量"></el-input-number>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-list>
</template>
<script>
import Print from '@/components/print/Print'
import template from '@/components/print/template'
import { sendChromeAPIMessage } from '@/api/chromeApi'
export default {
name: 'Learning',
name: 'PrintPage',
components: {
Print
},
data () {
return {
colConfigs: [
{ prop: 'title', label: '标题', align: 'left' },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ prop: 'mallName', label: '店铺名称', align: 'left' },
{ prop: 'labelCode', label: '条码编码', align: 'center' },
{ prop: 'productSkcId', label: 'SKC', align: 'center' },
{ prop: 'productSkuId', label: 'SKU', align: 'center' },
{ prop: 'skuExtCode', label: 'SKU货号', align: 'center' },
{ prop: 'skuSpecName', label: '次销售属性', align: 'center' },
{ prop: 'deliveryNum', label: '发货数', align: 'center' }
],
tableData: [],
total: 0,
search: {
current: 1,
size: 10,
categoryId: ''
mallId: '',
productSkuId: '',
productSkcId: '',
page: 1,
size: -1,
templateId: ''
},
cateList: [],
isFavorite: 0
addType: '1',
isLoading: false,
lableList: [],
height: 600,
skuChoosedList: [],
isShow: false,
form: {
count: 1
},
printData: [],
templateList: [],
page: 1
}
},
created () {
this.$store.dispatch('getUserInfo').then(e => {
console.log(e)
computed: {
currMall () {
if (!this.$store.state.mallList.length) {
return {}
}
return this.$store.state.mallList.filter(v => v.mallId === this.search.mallId)[0]
}
},
mounted() {
this.$nextTick(() => {
this.height = document.querySelector('.ai-list__content--right').clientHeight - 140
})
this.getCateList()
this.getList()
},
methods: {
toDetail (url) {
window.open(url)
},
onChange (e) {
if (e === 'isFavorite') {
this.$http.post('/api/learning/favoritePage', null, {
params: {
...this.search
toPrint(row) {
this.isLoading = true
if (this.addType === '1') {
this.$http.post(`/api/template/myTemplate?productSkuId=${row.productSkuId}`).then(res => {
if (!res.data.records.length) {
this.isLoading = false
return this.$message.error('该SKU未配置模板')
}
}).then(res => {
this.$http.post(`/api/template/detail?id=${res.data.records[0].id}`).then(res => {
if (res.code === 0) {
const params = JSON.parse(res.data.params)
const getValue = v => params.filter(e => e.fieldValue === v)[0].fieldName
Object.keys(row).forEach(key => {
if (params.findIndex(v => v.fieldValue === key) > -1) {
row[getValue(key)] = row[key]
}
})
this.isLoading = false
this.$refs.printRef.toPrint(JSON.parse(res.data.content), new Array(row.deliveryNum).fill(row))
} else {
this.isLoading = false
}
})
})
} else {
this.$http.post(`/api/template/detail?id=${row.templateId}`).then(res => {
this.isLoading = false
if (res.code === 0) {
this.tableData = res.data.records
this.total = res.data.total
if (!res.data) {
this.isLoading = false
return this.$message.error('该SKU未配置模板')
}
const params = JSON.parse(res.data.params)
const getValue = v => params.filter(e => e.fieldValue === v)[0].fieldName
Object.keys(row).forEach(key => {
if (params.findIndex(v => v.fieldValue === key) > -1) {
row[getValue(key)] = row[key]
}
})
this.printData = {
template: JSON.parse(res.data.content),
data: row
}
this.isShow = true
}
})
} else {
this.search.current = 1
this.getList()
}
},
collection (id, isFavorite) {
this.$confirm(isFavorite === '0' ? '确定收藏该文章?' : '确定取消收藏?', '温馨提示', {
confirmButtonText: '确定',
callback: action => {
if (action === 'confirm') {
this.$http.post(isFavorite === '0' ? `/api/learning/addFavorite?id=${id}` : `/api/learning/delFavorite?id=${id}`).then(res => {
if (res.code === 0) {
this.$message.success(isFavorite === '0' ? '收藏成功' : '取消成功')
this.getList()
}
})
}
onConfirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.isShow = false
this.$refs.printRef.toPrint(this.printData.template, new Array(this.form.count).fill(this.printData.data))
}
})
},
getCateList () {
this.$http.post('/api/learningCategory/page?size=50').then(res => {
if (res.code === 0) {
this.cateList = res.data.records
}
})
printAll() {
this.$refs.printRef.toPrint(template, this.skuChoosedList)
},
getSkuList () {
if (!this.search.mallId) {
return this.$message.error('请选择店铺')
}
},
getList () {
this.$http.post('/api/learning/pluginPage', null, {
params: {
...this.search
}
this.$http.post('/api/templateSku/getMySkuPage', null, {
params: this.search
}).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.total = res.data.total
this.lableList = res.data.records
}
})
},
getDeliveryOrderSn (page) {
return new Promise(resolve => {
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryBatch',
needMallId: true,
mallId: this.search.mallId,
anti: true,
data: {
pageNo: page,
status: 1,
onlyTaxWarehouseWaitApply: false,
productLabelCodeStyle: 0,
pageSize: 200
}
}).then(res => {
if (res.errorCode == 1000000) {
resolve({
list: [].concat(res.result.list.map(v => v.deliveryOrderList.map(e => e.deliveryOrderSn)).flat()),
isHasNext: res.result.total && res.result.list.length && (res.result.list.length < 200 && res.result.total > 200)
})
} else {
resolve({ list: [], isHasNext: false })
}
}).catch(() => {
resolve({ list: [], isHasNext: false })
})
})
},
getLabels (deliveryOrderSnList) {
return new Promise(resolve => {
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/printProductSkuLabel',
needMallId: true,
mallId: this.search.mallId,
anti: true,
data: {
deliveryOrderSnList: deliveryOrderSnList
}
}).then(res => {
if (res.errorCode == 1000000) {
resolve(res.result.map(v => {
return {
mallName: this.$store.state.mallList.filter(v => v.mallId === this.search.mallId)[0].mallName,
productName: v.productName,
productSkcId: v.productSkcId,
productSkuId: v.productSkuId,
labelCode: v.labelCode,
skuExtCode: v.skuExtCode,
deliveryNum: v.deliveryNum,
skuSpecName: v.secondarySpecVOList.map(item => {
return item.specName
}).join(',')
}
}))
} else {
resolve([])
}
}).catch(() => {
resolve([])
})
})
},
async searchSkuList () {
let page = 1
let isHasNext = true
let list = []
let deliveryOrderSnList = []
this.isLoading = true
while (isHasNext) {
const result = await this.getDeliveryOrderSn(page)
page = page + 1
isHasNext = result.isHasNext ? true : false
deliveryOrderSnList.push(...result.list)
await this.$sleepSync(1000)
}
const len = Math.ceil(deliveryOrderSnList.length / 100)
for (let i = 0; i < len; i++) {
this.page = 1
const ids = [...new Set(deliveryOrderSnList)].slice(i * 100, i * 100 + 100)
const res = await this.getLabels(ids)
list.push(...res)
await this.$sleepSync(500)
}
this.isLoading = false
this.lableList = list
}
}
}
</script>
<style scoped lang="scss">
.Print-page {
.search-item__wrapper {
display: flex;
align-items: center;
justify-content: space-between;
&>div {
display: flex;
align-items: center;
}
}
}
</style>

View File

@@ -10,32 +10,82 @@
<template slot="content">
<ai-search-bar>
<template #left>
<el-button type="primary" size="small" @click="isShow = true">添加</el-button>
<el-button type="primary" size="small" @click="chooseSkuList = [], isShow = true">添加</el-button>
<el-upload
action
:limit="1"
:show-file-list="false"
accept=".xls,.xlsx"
:auto-upload="false"
:file-list="fileList"
:on-change="onExcelChange">
<el-button size="small" type="danger" :disabled="!skuList.length">Excel导入</el-button>
</el-upload>
<json-excel
:data="skuList"
:fields="jsonFields"
name="SKU列表.xls"
worksheet="SKU列表">
<el-button size="small" type="warning" :disabled="!skuList.length">Excel导出</el-button>
</json-excel>
</template>
<template #right>
</ai-search-bar>
<ai-search-bar>
<template #left>
<div class="search-item" style="margin-bottom: 0;">
<label>SKU</label>
<el-input
v-model="search.productSkuId"
style="width: 250px"
size="small"
clearable
placeholder="请输入SKU"
suffix-icon="iconfont iconSearch"
@clear="getList">
</el-input>
</div>
<div class="search-item" style="margin-bottom: 0;">
<label>SKC</label>
<el-input
v-model="search.productSkcId"
style="width: 250px"
size="small"
placeholder="请输入SKC"
clearable
suffix-icon="iconfont iconSearch"
@clear="getList">
</el-input>
</div>
<div class="search-item" style="margin-bottom: 0;">
<label style="width: 100px;">仅显示未填写</label>
<el-select v-model="search.isShowWhite" placeholder="请选择" clearable size="small">
<el-option label="是" value="1"></el-option>
<el-option label="否" value="0"></el-option>
</el-select>
</div>
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="pageShow">查询</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:tableData="list"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
style="margin-top: 8px;"
@getList="getList">
<el-table-column slot="productName" width="300px" :show-overflow-tooltip='true' label="商品名称" fixed="left">
<template slot-scope="scope">
<div>
<el-image :src="scope.row.mainImageUrl" style="width: 40px; height: 40px" class="image" :preview-src-list="[scope.row.mainImageUrl]" />
{{ scope.row.productName }}
</div>
</template>
@getList="getList"
@selection-change="handleSelectionChange"
v-loading="pageShow"
:isShowPagination="false">
<el-table-column
v-for="(item, index) in relationList"
:key="index"
:prop="item.field"
:show-overflow-tooltip="true"
:label="item.name"
align="center">
</el-table-column>
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
<el-table-column slot="options" label="操作" align="center" fixed="right" width="120px">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.url)">编辑</el-button>
<el-button type="text" @click="toDetail(row.url)">删除</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
@@ -44,32 +94,90 @@
:visible.sync="isShow"
title="添加SKU"
width="1400px"
customFooter
@confirm="onConfirm">
<ai-search-bar>
<template #left>
<el-select v-model="skuSearch.mallId" placeholder="请选择店铺" size="small" @change="onMallChange">
<el-option
v-for="item in $store.state.mallList"
:key="item.mallId"
:label="item.mallName"
:value="item.mallId">
</el-option>
</el-select>
</template>
<template #right>
</template>
</ai-search-bar>
<div class="search-item__wrapper">
<div class="left">
<div class="search-item">
<label>添加方式</label>
<el-radio-group v-model="addType" size="small" @change="onSearchRest">
<el-radio-button label="1">按类目添加</el-radio-button>
<el-radio-button label="2">按SKC添加</el-radio-button>
<el-radio-button label="3">按SKU添加</el-radio-button>
</el-radio-group>
</div>
<div class="search-item">
<label>店铺</label>
<el-select v-model="lableSearch.mallId" 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>
<div class="right"></div>
</div>
<div class="search-item__wrapper">
<div class="left">
<div class="search-item" v-show="addType === '1'">
<label>商品分类</label>
<el-cascader
style="width: 280px;"
v-model="targetCatId"
:props="props"
size="small"
filterable
:show-all-levels="false"
collapse-tags
clearable>
</el-cascader>
<el-button style="margin-left: 10px;" @click="onCateChange" size="small" :disabled="!lableSearch.mallId" :loading="isLoading">查询</el-button>
</div>
<div class="search-item" v-show="addType === '2'">
<label>SKC</label>
<el-input
v-model="skuReqParams.SKC"
style="width: 250px"
size="small"
placeholder="多个查询请用户逗号分割"
clearable
@clear="getSkuList()"
suffix-icon="iconfont iconSearch">
</el-input>
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!lableSearch.mallId" :loading="isLoading">查询</el-button>
</div>
<div class="search-item" v-show="addType === '3'">
<label>SKU</label>
<el-input
v-if="addType === '3'"
v-model="skuReqParams.SKU"
style="width: 250px"
size="small"
placeholder="多个查询请用户逗号分割"
clearable
@clear="getSkuList()"
suffix-icon="iconfont iconSearch">
</el-input>
<el-button style="margin-left: 10px;" @click="getSkuList" size="small" :disabled="!lableSearch.mallId" :loading="isLoading">查询</el-button>
</div>
</div>
</div>
<ai-table
height="400"
:tableData="skuList"
height="370"
:tableData="lableList"
:col-configs="colConfigs"
:total="skuTotal"
:current.sync="skuSearch.current"
:size.sync="skuSearch.size"
:total="lableTotal"
:current.sync="lableSearch.current"
:size.sync="lableSearch.size"
style="margin-top: 8px;"
@getList="getSkuList"
:pageSizes="[10, 20, 50, 100, 500, 1000]"
v-loading="isLoading">
v-loading="isLoading"
:isShowPagination="false"
@getList="() => {}"
@selection-change="handleSelectionChange">
<el-table-column slot="productName" width="300px" :show-overflow-tooltip="true" label="商品名称" fixed="left">
<template slot-scope="scope">
<div>
@@ -79,6 +187,10 @@
</template>
</el-table-column>
</ai-table>
<template #footer>
<el-button @click="isShow = false">取消</el-button>
<el-button @click="onConfirm" type="primary" :loading="btnLoading">确认</el-button>
</template>
</ai-dialog>
</template>
</ai-list>
@@ -86,55 +198,136 @@
<script>
import { sendChromeAPIMessage } from '@/api/chromeApi'
import * as XLSX from 'xlsx'
import JsonExcel from 'vue-json-excel'
export default {
name: 'Template',
name: 'SkuManage',
components: {
JsonExcel
},
data () {
return {
colConfigs: [
// { slot: 'productName', label: '商品名称', width: '300px', align: 'left', fixed: 'left' },
// { prop: 'category', label: '分类', width: '140px', align: 'left', fixed: 'left' },
{ prop: 'mallName', label: '店铺名称', align: 'left' },
{ prop: 'labelCode', label: '条码编码', align: 'center' },
// { prop: 'productSkcId', label: 'SKC', align: 'left' },
{ prop: 'productSkuId', label: 'SKU', align: 'center' },
// { prop: 'extCode', label: 'SKC货号', align: 'left' },
{ prop: 'skuExtCode', label: 'SKU货号', align: 'center' },
{ prop: 'skuSpecName', label: '次销售属性', align: 'center' }
],
tableData: [],
total: 0,
search: {
current: 1,
size: 100
size: -1,
productSkuId: '',
productSkcId: '',
isShowWhite: ''
},
skuSearch: {
lableSearch: {
current: 1,
size: 100,
mallId: ''
},
skuTotal: 0,
skuList: [],
lableTotal: 0,
lableList: [],
isShow: false,
skuReqParams: {
page: 1,
pageSize: 100
pageSize: 100,
SKC: '',
SKU: ''
},
isLoading: false
isLoading: false,
addType: '1',
props: {
value: 'catId',
label: 'catName',
multiple: true,
checkStrictly: true,
lazy: true,
lazyLoad (value, resolve) {
sendChromeAPIMessage({
url: 'bg-anniston-mms/category/children/list',
needMallId: true,
data: {
parentCatId: value.level === 0 ? '' : value.value
}
}).then(res => {
if (res.errorCode === 1000000) {
resolve(res.result.categoryNodeVOS.map(v => {
return {
...v,
leaf: v.isLeaf
}
}))
}
})
}
},
targetCatId: [],
skuList: [],
chooseSkuList: [],
id: '',
fileList: [],
pageShow: false,
relationList: [],
btnLoading: false
}
},
computed: {
list () {
if (!this.skuList.length) {
return []
}
if (this.search.isShowWhite !== '1') {
return this.skuList
}
const keys = this.relationList.map(v => v.field)
return this.skuList.filter(v => keys.some(e => !v[e]))
},
currMall () {
if (!this.$store.state.mallList.length) {
return {}
}
return this.$store.state.mallList.filter(v => v.mallId === this.skuSearch.mallId)[0]
return this.$store.state.mallList.filter(v => v.mallId === this.lableSearch.mallId)[0]
},
colConfigs () {
const fields = this.isShow ? [] : this.relationList.map(v => {
return {
prop: v.field,
label: v.name,
align: 'center'
}
})
return [
{ type: 'selection' },
{ prop: 'mallName', label: '店铺名称', align: 'left' },
{ prop: 'productName', label: '商品名称', align: 'center' },
{ prop: 'labelCode', label: '条码编码', align: 'center' },
{ prop: 'productSkcId', label: 'SKC', align: 'center' },
{ prop: 'productSkuId', label: 'SKU', align: 'center' },
{ prop: 'skuExtCode', label: 'SKU货号', align: 'center' },
{ prop: 'skuSpecName', label: '次销售属性', align: 'center' },
...fields
]
},
jsonFields () {
const obj = {}
this.colConfigs.filter(v => !!v.prop).forEach(v => {
obj[v.label] = v.prop
})
return {
...obj
}
}
},
created () {
this.id = this.$route.query.id || ''
this.getRelation()
this.getList()
},
@@ -143,22 +336,135 @@
this.$router.push('/addLabelsTemplate')
},
requestSKUList () {
sendChromeAPIMessage({
getRelation () {
this.$http.post(`/api/templateRelation/getRelation?templateId=${this.$route.query.id}`).then(res => {
if (res.code === 0) {
this.relationList = res.data
}
})
},
readXLSX(file) {
return new Promise(resolve => {
const reader = new FileReader()
reader.readAsBinaryString(file)
reader.onload = evt => {
const data = evt.target.result
const workbook = XLSX.read(data, { type: 'binary' })
const ws = workbook.Sheets[workbook.SheetNames[0]]
const jsonData = XLSX.utils.sheet_to_json(ws)
resolve(jsonData)
this.fileList = []
}
})
},
onExcelChange (file) {
this.pageShow = true
this.readXLSX(file.raw).then(res => {
this.$http.post(`/api/templateSku/updateBatchSku`, res.map(v => {
const result = {
templateId: this.id
}
Object.keys(this.jsonFields).forEach(item => {
result[this.jsonFields[item]] = v[item]
})
return result
})).then(res => {
if (res.code === 0) {
this.$message.success('导入成功')
this.isShow = false
this.getList()
}
this.pageShow = false
})
})
},
onSearchRest() {
this.skuReqParams.SKC = ''
this.skuReqParams.SKU = ''
},
handleSelectionChange(e) {
this.chooseSkuList = e
},
getSKCList(catIds, page) {
return new Promise(resolve => {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/skc/pageQuery',
needMallId: true,
mallId: this.lableSearch.mallId,
anti: true,
data: {
page,
pageSize: 200,
catIds: catIds
}
}).then(res => {
if (res.errorCode == 1000000) {
resolve({
list: res.result.pageItems.map(v => v.productSkcId),
isHasNext: res.result.total && res.result.pageItems.length && (res.result.pageItems.length < 200 && res.result.total > 200)
})
} else {
resolve({ list: [], isHasNext: false })
}
}).catch(() => {
resolve({ list: [], isHasNext: false })
})
})
},
async onCateChange() {
let page = 1
let list = []
let isHasNext = true
this.lableList = []
this.isLoading = true
while (isHasNext) {
const result = await this.getSKCList([].concat(this.targetCatId.flat()), page)
page = page + 1
isHasNext = result.isHasNext ? true : false
list.push(...result.list)
await this.$sleepSync(1000)
}
const skcList = [...new Set(list)]
const len = Math.ceil(skcList.length / 100)
for (let i = 0; i < len; i++) {
this.skuReqParams.page = 1
this.skuReqParams.SKC = [...new Set(list)].slice(i * 100, i * 100 + 100).join(',')
await this.requestSKUList(true)
await this.$sleepSync(500)
}
this.isLoading = false
},
requestSKUList(flag) {
return sendChromeAPIMessage({
url: 'bg-visage-mms/labelcode/pageQuery',
needMallId: true,
mallId: this.skuSearch.mallId,
mallId: this.lableSearch.mallId,
anti: true,
data: {
page: this.skuSearch.size > 100 ? this.skuReqParams.page : this.skuSearch.current,
pageSize: this.skuSearch.size > 100 ? 100 : this.skuSearch.size
page: this.skuReqParams.page,
pageSize: 200,
productSkcIdList: (['2', '1'].includes(this.addType)) ? this.skuReqParams.SKC.split(',') : [],
productSkuIdList: this.addType === '3' ? this.skuReqParams.SKU.split(',') : []
}
}).then(async (res) => {
if (res.errorCode == 1000000) {
const list = res.result.pageItems.map(v => {
return {
mallId: this.lableSearch.mallId,
mallName: this.currMall.mallName,
productName: v.productName,
productSkcId: v.labelCodeVO.productSkcId,
productSkuId: v.labelCodeVO.productSkuId,
labelCode: v.labelCodeVO.labelCode,
skuExtCode: v.labelCodeVO.skuExtCode,
@@ -167,72 +473,101 @@
}).join(',')
}
})
this.skuTotal = res.result.total
this.skuList.push(...list)
this.lableTotal = res.result.total
this.lableList.push(...list)
if (this.skuSearch.size > 100 && (res.result.total > this.skuList.length)) {
if (res.result.total > this.lableList.length) {
this.skuReqParams.page++
await this.$sleepSync(5000)
this.requestSKUList()
await this.$sleepSync(500)
await this.requestSKUList()
} else {
this.isLoading = false
!flag && (this.isLoading = false)
}
} else {
this.isLoading = false
}
})
},
onMallChange (e) {
if (!e) {
this.skuList = []
return false
}
this.$userCheck(this.skuSearch.mallId).then(() => {
this.skuList = []
this.skuReqParams.page = 1
this.isLoading = true
this.requestSKUList()
}).catch(() => {
this.skuSearch.mallId = ''
})
},
getSkuList () {
if (!this.skuSearch.mallId) {
if (!this.lableSearch.mallId) {
return this.$message.error('请选择店铺')
}
this.$userCheck(this.skuSearch.mallId).then(() => {
this.skuList = []
this.skuReqParams.page = 1
this.isLoading = true
this.requestSKUList()
}).catch(() => {
this.skuSearch.mallId = ''
})
this.lableList = []
this.skuReqParams.page = 1
this.isLoading = true
this.requestSKUList()
},
getList () {
this.$http.post('/api/learning/pluginPage', null, {
this.pageShow = true
this.$http.post(`/api/templateSku/getMySkuPage`, null, {
params: {
...this.search
...this.search,
templateId: this.id
}
}).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.total = res.data.total
this.skuList = res.data.records
}
this.pageShow = false
})
},
onConfirm () {
if (!this.chooseSkuList.length) {
return this.$message.error('请选择SKU')
}
}
this.btnLoading = true
this.$http.post(`/api/templateSku/addBatchSku`, this.chooseSkuList.map(v => {
return {
...v,
templateId: this.id
}
})).then(res => {
if (res.code === 0) {
this.$message.success('添加成功')
this.isShow = false
this.getList()
}
this.btnLoading = false
}).catch(() => {
this.btnLoading = false
})
},
remove (id) {
this.$confirm('确定删除该数据?', '温馨提示', {
type: 'warning'
}).then(() => {
this.$http.post(`/api/templateSku/removeById?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功')
this.getList()
}
})
})
},
}
}
</script>
<style scoped lang="scss">
.Template {
.search-item__wrapper {
display: flex;
align-items: center;
justify-content: space-between;
&>div {
display: flex;
align-items: center;
}
}
}
</style>

View File

@@ -4,13 +4,55 @@
slot="title"
title="模板管理"
isShowBottomBorder>
<template #rightBtn>
<div class="tips" slot="rightBtn" :class="[$store.state.labelInfo.isExpires ? 'active' : '']">
<p>有效期{{ $store.state.labelInfo.expireTime }}</p>
<p>已使用SKU数{{ $store.state.labelInfo.skuUsed }}/{{ $store.state.labelInfo.skuTotal }}</p>
</div>
</template>
</ai-title>
<template slot="content">
<ai-search-bar>
<template #left>
<el-button type="primary" size="small" @click="toAdd">添加</el-button>
<div class="search-item">
<label>SKU</label>
<el-input
v-model="search.productSkuId"
style="width: 250px"
size="small"
clearable
placeholder="请输入SKU"
suffix-icon="iconfont iconSearch">
</el-input>
</div>
<div class="search-item">
<label>SKC</label>
<el-input
v-model="search.productSkcId"
style="width: 250px"
size="small"
placeholder="请输入SKC"
clearable
suffix-icon="iconfont iconSearch">
</el-input>
</div>
<div class="search-item">
<label>模板名称</label>
<el-input
v-model="search.name"
style="width: 250px"
size="small"
placeholder="请输入模板名称"
clearable
suffix-icon="iconfont iconSearch">
</el-input>
</div>
<el-button type="primary" @click="getList" size="small" :loading="isLoading">查询</el-button>
</template>
<template #right>
</ai-search-bar>
<ai-search-bar>
<template #left>
<el-button type="button" class="el-button el-button--primary" @click="toAdd('')">添加</el-button>
</template>
</ai-search-bar>
<ai-table
@@ -20,70 +62,111 @@
:current.sync="search.current"
:size.sync="search.size"
style="margin-top: 8px;"
@getList="getList">
<el-table-column slot="options" label="操作" align="center" fixed="right" width="220px">
@getList="getList"
:loading="isLoading">
<el-table-column slot="options" label="操作" align="center" fixed="right" width="240px">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="toAddSku(row.url)">添加SKU</el-button>
<el-button type="text" @click="toAdd(row.url)">编辑</el-button>
<el-button type="text" @click="toDetail(row.url)">删除</el-button>
<el-button type="text" @click="toAddSku(row.id)">管理SKU</el-button>
<!-- <el-button type="text" @click="savePDF(row.id)">保存PDF</el-button> -->
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<Print ref="printRef" :isPrint="true"></Print>
</template>
</ai-list>
</template>
<script>
import Print from '@/components/print/Print'
export default {
name: 'Template',
name: 'PringTemplate',
components: {
Print
},
data () {
return {
colConfigs: [
{ prop: 'name', label: '模板名称', align: 'left' },
{ prop: 'count', label: '绑定SKU数量', align: 'center' },
{ prop: 'createTime', label: '创建时间', align: 'center' },
],
tableData: [
{
name: '电池',
count: 2
}
{ prop: 'skuTotal', label: '绑定SKU数量', align: 'center' },
{ prop: 'createTime', label: '创建时间', align: 'center' }
],
isLoading: false,
tableData: [],
total: 0,
search: {
current: 1,
size: 10
size: 10,
name: '',
productSkuId: '',
productSkcId: ''
}
}
},
created () {
// this.getList()
this.getList()
},
methods: {
toAdd () {
this.$router.push('/addLabelsTemplate')
toAdd (id = '') {
this.$router.push(`/addLabelsTemplate?id=${id}`)
},
toAddSku () {
this.$router.push('/skuManage')
savePDF (id) {
this.isLoading = true
this.$http.post(`/api/template/detail?id=${id}`).then(res => {
if (res.code === 0) {
const template = JSON.parse(res.data.content)
this.$http.post(`/api/templateSku/getMySkuPage?size=-1&templateId=${id}`).then(res => {
if (res.code === 0) {
const html = this.$refs.printRef.toPrint(template, res.data.records)
console.log(html)
this.isLoading = false
}
})
}
})
},
toAddSku (id) {
this.$router.push(`/skuManage?id=${id}`)
},
getList () {
console.log(this.tableData)
this.$http.post('/api/learning/pluginPage', null, {
this.isLoading = true
this.$http.post('/api/template/myTemplate', null, {
params: {
...this.search
}
}).then(res => {
if (res.code === 0) {
// this.tableData = res.data.records
// this.total = res.data.total
this.tableData = res.data.records
this.total = res.data.total
}
this.isLoading = false
})
},
remove (id) {
this.$confirm('确定删除该模板?', '温馨提示', {
type: 'warning'
}).then(() => {
this.$http.post(`/api/template/removeById?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功')
this.getList()
}
})
})
},
@@ -95,4 +178,28 @@
</script>
<style scoped lang="scss">
.Template {
.search-item {
margin-bottom: 0;
}
.tips {
display: flex;
align-items: center;
color: green;
&.active {
color: red;
}
p {
font-size: 15px;
font-weight: 600;
&:first-child {
margin-right: 20px;
}
}
}
}
</style>

View File

@@ -28,7 +28,7 @@
<span @click="getCode" :loading="btnLoading">{{ isStart ? time + ' S' : '发送验证码' }}</span>
</div>
</el-form-item>
<el-button type="primary" style="width: 100%" @click="login" :loading="btnLoading">重置设置</el-button>
<el-button type="primary" style="width: 100%" @click="login" :loading="btnLoading">设置</el-button>
</el-form>
<div class="login-footer">
<div class="left">
@@ -78,7 +78,7 @@ import CryptoJS from 'crypto-js'
this.$refs.form.validate((valid) => {
if (valid) {
if (this.form.password != this.form.repassword) {
this.$message.success('两次密码输入不一致');
this.$message.error('两次密码输入不一致');
return;
}
this.btnLoading = true

View File

@@ -0,0 +1,269 @@
<template>
<ai-list class="list" v-loading="isLoading" :element-loading-text="loadingText" element-loading-spinner="el-icon-loading">
<ai-title
slot="title"
title="拒绝调价"
isShowBottomBorder>
</ai-title>
<template slot="content">
<div class="content">
<ai-search-bar>
<template #right>
<el-button type="primary" @click="toLoad">加载</el-button>
<el-button type="primary" @click="beforeRejct">拒绝调价</el-button>
</template>
</ai-search-bar>
<ai-card title="数据明细" style="padding-bottom: 40px;">
<ai-table
:isShowPagination="false"
:tableData="tableData"
:col-configs="colConfigs"
:total="tableData.length"
height="700"
style="margin-top: 8px;"
@getList="() => {}">
<el-table-column slot="productName" width="250px" :show-overflow-tooltip='true' label="商品名称" fixed="left">
<template slot-scope="scope">
<div>
<el-image :src="scope.row.image" style="width: 40px; height: 40px" class="image" :preview-src-list="[scope.row.image]" />
{{ scope.row.productName }}
</div>
</template>
</el-table-column>
</ai-table>
</ai-card>
</div>
<AiDialog
title="拒绝原因"
:visible.sync="rejectShow"
:close-on-click-modal="false"
customFooter
height="500px"
width="500px">
<el-form :model="rejectForm" ref="rejectForm" class="form">
<el-form-item
prop="reason"
label="拒绝原因:"
:rules="[{ required: true, message: '请输入拒绝原因', trigger: 'blur' }]">
<el-input :rows="3" placeholder="请输入拒绝原因" type="textarea" v-model="rejectForm.reason"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="rejectShow = false"> </el-button>
<el-button type="primary" @click="toReject">拒绝</el-button>
</span>
</AiDialog>
</template>
</ai-list>
</template>
<script>
import { Message } from 'element-ui'
import {sendChromeAPIMessage} from '@/api/chromeApi'
import {timestampToTime} from '@/utils/date'
import JsonExcel from 'vue-json-excel'
export default {
name: 'PriceDown',
data () {
return {
reqData: {
pageInfo: {
pageSize: 100,
pageNo: 1
},
status: 1
},
colConfigs: [
{ slot: 'productName', label: '商品名称', width: '250px', align: 'left', fixed: 'left' },
{ prop: 'mallName', label: '店铺来源', width: '250px', align: 'left', fixed: 'left' },
{ prop: 'priceOrderSn', label: '调价单号', width: '140px', align: 'left', fixed: 'left' },
{ prop: 'skcId', label: 'SKC ID', width: '120px', align: 'left' },
{ prop: 'skcExtCode', label: 'SKC货号', width: '100px', align: 'left' },
{ prop: 'priceBeforeExchange', label: '原申报价格', width: '100px', align: 'left' },
{ prop: 'newSupplyPrice', label: '调整后申报价格', width: '100px', align: 'left' },
{ prop: 'source', label: '申请来源', width: '120px', align: 'left' },
{ prop: 'adjustReason', label: '调价原因', align: 'left' }
],
loadingText: '',
isLoading: false,
tableData: [],
currentIndex: 0,
rejectForm: {
reason: ''
},
rejectShow: false
}
},
components: {
JsonExcel
},
created () {
},
methods: {
beforeGetList() {
this.$userCheck().then(() => {
this.toLoad()
}).catch((err) => {
})
},
async toLoad() {
if (this.$store.state.mallList.length == 0) {
Message.error("请登录卖家中心,如已登录,请刷新助手")
return
}
this.reqData.pageInfo.pageNo = this.startPage
this.tableData = []
this.currentIndex = 0
this.isLoading = true
for (let i = 0; i < this.$store.state.mallList.length; i++) {
this.reqData.pageInfo.pageNo = 1
this.loadingText = `正在加载店铺【${this.$store.state.mallList[i].mallName}】的调价信息`
await this.load(this.$store.state.mallList[i])
}
this.isLoading = false
},
async load(mallObj) {
let res = await sendChromeAPIMessage({
url: 'marvel-mms/cn/api/kiana/magneto/price-adjust/page-query',
needMallId: true,
mallId: mallObj.mallId,
anti: true,
data: this.reqData})
if (res.errorCode == 1000000 && res.result.total > 0) {
for(let i = 0;i < res.result.list.length; i++) {
let item = res.result.list[i];
let data = {};
data.id = item.id
data.productName = item.productName
data.image = item.image
data.priceOrderSn = item.priceOrderSn
data.skcId = item.skcId
data.skcExtCode = item.skcExtCode
data.source = item.source
data.mallName = mallObj.mallName
data.mallId = mallObj.mallId
data.adjustReason = item.adjustReason
data.newSupplyPrice = item.newSupplyPrice / 100
data.num = item.skuInfoItemList.length
let skus = []
item.skuInfoItemList.map(item => {
skus.push(item.productSkuId)
})
data.skus = skus.join(',')
/*for(let k = 0; k < item.skuInfoItemList.length; k++) {
data = {...data,
productSkuId: item.skuInfoItemList[k].productSkuId,
priceBeforeExchange: item.skuInfoItemList[k].priceBeforeExchange / 100,
skuExtCode: item.skuInfoItemList[k].skuExtCode,
spec: item.skuInfoItemList[k].spec
}
this.tableData.push(data)
}*/
this.tableData.push(data)
}
if (res.result.list.length == this.reqData.pageInfo.pageSize) {
this.reqData.pageInfo.pageNo ++
await this.load(mallObj)
}
}
},
beforeRejct() {
if (this.tableData.length <= 0) {
Message.error('请先加载待拒绝调价');
return;
}
this.rejectShow = true
},
async toReject() {
this.$refs.rejectForm.validate(async (valid) => {
if (valid) {
this.loadingText = '正在拼命处理中~'
this.isLoading = true
this.rejectShow = false
await this.reject()
this.isLoading = false
}
})
},
async reject() {
let rejectIds = []
for (let i = 0; i < this.tableData.length; i++) {
rejectIds.push(this.tableData[i].id)
}
for (let j = 0; j < rejectIds.length; j++) {
let obj = this.tableData.filter(item => {
return item.id == rejectIds[j]
})
if (obj.length == 0) continue
obj = this.tableData.filter(item => {
return item.skus == obj[0].skus
})
let params = {}
if (obj.length > 1) {
params.adjustId = obj[0].id
params.adjustResultMap = {}
for (let k = 0; k < obj.length; k++) {
params.adjustResultMap[obj[k].id] = 2
}
params.result = 2
} else {
params = {
adjustId: obj[0].id,
reason: this.rejectForm.reason,
result: 2
}
}
// console.log(obj[0].mallName, params)
let res = await sendChromeAPIMessage({
url: 'gmp/bg/magneto/api/price/purchase-adjust/review',
needMallId: true,
mallId: obj[0].mallId,
anti: true,
data: params})
if (res.success) {
this.removeByRejectId(obj)
// this.remove(skuIds[j])
}
await this.$sleepSync(300)
}
},
removeByRejectId(objArr) {
for (let j = 0; j < objArr.length; j++) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].id == objArr[j].id) {
this.tableData.splice(i, 1)
break
}
}
}
}
}
}
</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>

View File

@@ -548,6 +548,7 @@ import { DualAxes } from '@antv/g2plot'
if (item.productSkcId == this.skcList[i].productSkcId) {
this.skcList[i].saleAmount = this.skcList[i].saleAmount + item.saleAmount
this.skcList[i].costAmount = this.skcList[i].costAmount + item.costAmount
this.skcList[i].saleCount = this.skcList[i].saleCount + item.saleCount
this.skcList[i].profitAmount = this.skcList[i].profitAmount + item.profitAmount
flag = true
break

View File

@@ -3,7 +3,7 @@
<ai-title
slot="title"
title="物流统计"
tips="数据来源于“履约服务账单->明细->缴费记录"
tips="数据来源于“履约服务账单->明细->缴费记录"
isShowBottomBorder>
</ai-title>
<template slot="content">
@@ -184,7 +184,7 @@ import {sendChromeAPIMessage } from '@/api/chromeApi'
let item = res.result.list[i]
this.totalLogisticFee += item.amount
this.transList.push(item.ptransId)
this.transList.push({ptransId: item.ptransId, chargeType: item.chargeType} )
}
if ((this.reqData.pageSize * this.reqData.pageNum) < res.result.total) {
this.reqData.pageNum ++
@@ -203,10 +203,10 @@ import {sendChromeAPIMessage } from '@/api/chromeApi'
needMallId: true,
mallId: this.$store.state.mallList[0].mallId,
data: {
chargeType: 0,
chargeType: this.transList[i].chargeType,
pageSize: 100,
pageNum: 1,
ptransId: this.transList[i]
ptransId: this.transList[i].ptransId
}})
if (res.errorCode == 1000000) {
for (let k = 0; k < res.result.list.length; k++) {

View File

@@ -0,0 +1,829 @@
<template>
<div>
<ai-list class="list" v-loading="isLoading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
<ai-title
slot="title"
title="发货(芯仓)"
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
isShowBottomBorder>
</ai-title>
<template slot="content">
<ai-search-bar>
<template #left>
<el-radio-group v-model="type">
<el-radio-button label="0">数据同步</el-radio-button>
<el-radio-button label="1">发货</el-radio-button>
</el-radio-group>
</template>
<template #right>
</template>
</ai-search-bar>
<ai-card :key="0" v-if="type == '0'" title="数据明细" style="padding-bottom: 40px;">
<template #right>
<el-dropdown @command="handleClick">
<el-button type="primary" :disabled="isBegin">添加待发货订单</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="byStore">按店铺添加</el-dropdown-item>
<el-dropdown-item command="loadAll">一键添加所有</el-dropdown-item>
</el-dropdown-menu>
<!--<el-button type="primary" :disabled="isBegin" @click="isShow = true">添加备货单</el-button>
<el-button type="primary" :disabled="isBegin" @click="loadAll">一键加载全部</el-button>-->
</el-dropdown>
<el-button type="button" :class="'el-button el-button--primary'" @click="beginCreate">订单同步</el-button>
</template>
<ai-table
:tableData="choosedList"
:col-configs="robColConfigs"
:total="total"
height="500"
:isShowPagination="false"
style="margin-top: 8px;">
<el-table-column slot="productName" width="480px" label="订单信息" align="center">
<template slot-scope="scope">
<div class="product">
<img :src="scope.row.productSkcPicture">
<div class="right">
<div>{{ scope.row.parentOrderMap.parentOrderSn }}</div>
<div>站点名: {{ scope.row.parentOrderMap.siteName }}</div>
<div>国家/地区: {{ scope.row.parentOrderMap.regionName1 }}</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column slot="purchaseTime" width="180px" label="订单创建时间" align="center">
<template slot-scope="scope">
{{ scope.row.parentOrderMap.parentOrderTimeStr }}
</template>
</el-table-column>
<el-table-column slot="className" label="子订单信息" width="440px" show-overflow-tooltip align="center">
<template slot-scope="scope">
<div class="order-manage_skuInfo__FW-Nd" v-for="(item, index) in scope.row.orderList" :key="index">
<div>
<div data-testid="beast-core-box" class="outerWrapper-1-3-1 outerWrapper-d18-1-3-20 index-module__image-preview___2fiZX">
<div class="index-module__img___p3B1N" :style="getStyle(item.thumbUrl)"></div>
</div>
</div>
<div class="order-manage_contentInfo__1Cjd6">
<div>子订单号{{ item.orderSn}}</div>
<div>SKU ID{{ item.productInfoList[0].productSkuId }}</div>
<div>SKC ID{{ item.productInfoList[0].productSkcId }}</div>
<div>SKU 货号 {{ item.extCodeList[0] }}</div>
<div>属性 {{ item.spec }}</div>
<div>库存扣减仓库 {{ item.warehouseName }}</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" width="80px" v-if="!isBegin" show-overflow-tooltip align="center" fixed="right">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="remove(row.parentOrderMap.parentOrderSn)">移除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</ai-card>
<ai-card :key="1" v-if="type == '1'" title="待发货列表" style="padding-bottom: 40px;">
<template #title>
<el-button type="button" v-if="form.status == '0'" :class="'el-button el-button--primary'" @click="sendGoods">发货</el-button>
<el-button type="button" v-if="form.status == '1'" :class="'el-button el-button--primary'" @click="getLogisticInfo">取号</el-button>
<el-button type="button" v-if="form.status == '1'" :class="'el-button el-button--primary'" @click="writeBack">回传</el-button>
</template>
<template #right>
<ai-search-bar>
<template #right>
<div>
<div class="search-item" style="margin-top: 20px" >
<ai-select clearable :selectList="$dict.getDict('order_info_status')" v-model="form.status" @change="getOrderList"></ai-select>
</div>
</div>
</template>
</ai-search-bar>
</template>
<ai-table
:tableData="orderDataList"
:col-configs="orderColConfig"
height="700"
:size="100"
:current.sync="form.current"
:size.sync="form.size"
:total="orderTotal"
@getList="getOrderList"
style="margin-top: 8px;">
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" v-if="form.status == '1'" @click="toSend(row)">重新发货</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</ai-card>
<AiDialog
title="添加待发货订单"
:visible.sync="isShow"
:close-on-click-modal="false"
customFooter
@confirm="onConfirm"
width="1290px">
<label style="width:90px">店铺</label>
<el-select v-model="mallId" placeholder="请选择" @change="mallChange">
<el-option
v-for="item in mallList"
:key="item.mallId"
:label="item.mallName"
:value="item.mallId">
{{ item.mallName }}
</el-option>
</el-select>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:isShowPagination="false"
style="margin-top: 8px;"
v-loading="isDlgLoading"
@selection-change="onChooseChange">
<el-table-column slot="productName" width="320px" label="订单信息" align="center">
<template slot-scope="scope">
<div class="product">
<img :src="scope.row.productSkcPicture">
<div class="right">
<div>{{ scope.row.parentOrderMap.parentOrderSn }}</div>
<div>站点名: {{ scope.row.parentOrderMap.siteName }}</div>
<div>国家/地区: {{ scope.row.parentOrderMap.regionName1 }}</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column slot="purchaseTime" width="180px" label="订单创建时间" align="center">
<template slot-scope="scope">
{{ scope.row.parentOrderMap.parentOrderTimeStr }}
</template>
</el-table-column>
<el-table-column slot="className" label="子订单信息" width="440px" show-overflow-tooltip align="center">
<template slot-scope="scope">
<div class="order-manage_skuInfo__FW-Nd" v-for="(item, index) in scope.row.orderList" :key="index">
<div>
<div data-testid="beast-core-box" class="outerWrapper-1-3-1 outerWrapper-d18-1-3-20 index-module__image-preview___2fiZX">
<div class="index-module__img___p3B1N" :style="getStyle(item.thumbUrl)"></div>
</div>
</div>
<div class="order-manage_contentInfo__1Cjd6">
<div>子订单号{{ item.orderSn}}</div>
<div>SKU ID{{ item.productInfoList[0].productSkuId }}</div>
<div>SKC ID{{ item.productInfoList[0].productSkcId }}</div>
<div>SKU 货号 {{ item.extCodeList[0] }}</div>
<div>属性 {{ item.spec }}</div>
<div>库存扣减仓库 {{ item.warehouseName }}</div>
</div>
</div>
</template>
</el-table-column>
</ai-table>
<span slot="footer" class="dialog-footer">
<el-button @click="isShow = false"> </el-button>
<el-button type="primary" @click="onConfirm">添加</el-button>
</span>
</AiDialog>
</template>
</ai-list>
</div>
</template>
<script>
import { mapState } from 'vuex'
import {sendChromeAPIMessage, sendTemuSellerAgentMessage, sendXcAPIMessage} from '@/api/chromeApi'
import { Message } from 'element-ui'
import {timestampToTime} from '@/utils/date'
export default {
name: 'SemiSendGoods_XC',
data () {
return {
isShow: false,
orderDataList: [],
orderTotal: 0,
colConfigs: [
{ type: "selection", width: '70px', align: 'left' },
{ slot: 'productName' },
{ slot: 'subWarehouseName'},
{ prop: 'mallName', label: '店铺来源', align: 'center' },
{ slot: 'className'},
{ slot: 'purchaseTime'}
],
robColConfigs: [
{ slot: 'productName' },
{ slot: 'subWarehouseName'},
{ prop: 'mallName', label: '店铺来源', align: 'center' },
{ slot: 'className'},
{ slot: 'purchaseTime'}
],
orderColConfig: [
{ prop: 'mallName', label: '店铺名称', align: 'center' },
{ prop: 'orderId', label: '订单号', width: '220px'},
{ prop: 'receiveName', label: '收货人'},
{ prop: 'receivePhone', label: '收货人手机号', width: '160px'},
{ prop: 'logisticId', label: '物流单号', width: '160px'},
{ prop: 'expressCompany', label: '物流方式', width: '120px'},
{ prop: 'expressId', label: '物流公司', width: '100px'},
{ prop: 'status', label: '状态', format: v => this.$dict.getLabel('order_info_status', v)},
{ prop: 'createTime', label: '下单时间'}
],
form: {
warehouseId: 'XinCang',
status: '',
current: 1,
size: 100
},
mallId: '',
mallName: '',
tableData: [],
total: 0,
isBegin: false,
choosedList: [],
choosedSnMallList: [],
arr: [],
createTotal: 0,
pageSize: 100,
currentPage: 1,
type: 0,
loadMallIndex: 0,
loadMode: 0, // 加载模式0表示单个店铺加载1表示一键加载
// 加载数据
isLoading: false,
isDlgLoading: false,
addressList: []
}
},
computed: {
...mapState(['mallList'])
},
created () {
this.$dict.load('order_info_status');
},
methods: {
onChooseChange (e) {
this.arr = e
},
mallChange() {
this.$userCheck(this.mallId).then(() => {
let mallInfo = this.mallList.filter(item => {
return item.mallId == this.mallId
})
this.mallName = mallInfo[0].mallName
// 下载数据
this.loadMode = 0
this.tableData = []
this.currentPage = 1
this.isDlgLoading = true
this.getList(this.tableData, this.mallId, this.mallName, 1)
}).catch((err) => {
this.mallId = ''
console.log(err)
})
},
onConfirm () {
if (this.arr.length == 0) {
Message.error("请选择待创建备货单")
return
}
this.arr.map(item => {
let temp = this.choosedList.filter(i => {
return i.parentOrderMap.parentOrderSn == item.parentOrderMap.parentOrderSn
})
if (temp.length == 0) {
this.choosedList.push(item)
}
})
Message.success("添加成功,可继续添加")
},
loadAll() {
this.$userCheck().then(() => {
this.choosedList = []
this.currentPage = 1
this.isLoading = true
if (this.$store.state.userInfo.type == 3) {
this.loadMode = 0
this.getList(this.choosedList, this.$store.state.mallId, this.$store.state.mallName, 1)
} else {
this.loadMallIndex = 0
this.loadMode = 1
this.getList(this.choosedList, this.mallList[this.loadMallIndex].mallId, this.mallList[this.loadMallIndex].mallName, 1)
}
});
},
getOrderList() {
this.orderDataList = []
let res = this.$http.post('/api/semi/semiOrder/pageWaitSend',null,{
params: {
...this.form
}
}).then(res => {
this.orderDataList = res.data.records
this.orderTotal = res.data.total
})
},
handleClick (e) {
if (e === 'byStore') {
this.isShow = true
} else if (e === 'loadAll') {
this.loadAll()
}
},
beforeBegin() {
if (this.choosedList.length <= 0) {
Message.error('请先添加待发货订单');
return;
}
this.beginCreate()
},
async getList (data, mallId, mallName, currentPage) {
let res = await sendTemuSellerAgentMessage({
url: 'kirogi/bg/mms/recentOrderList',
needMallId: true,
mallId: mallId,
data: {
fulfillmentMode: 0,
pageNumber: this.currentPage,
pageSize: this.pageSize,
queryType: 2,
sortType: 1,
timeZone: "UTC+8",
parentAfterSalesTag: 0,
needBuySignService: 0,
sellerNoteLabelList: []
}})
if (res.errorCode == 0) {
res.result.pageItems.map((item) => {
data.push({...item, mallId: mallId, mallName: mallName})
})
if (this.pageSize == res.result.pageItems.length) {
currentPage ++
await this.getList(data, mallId, mallName, currentPage)
} else {
if (this.loadMode == 1) {
this.loadMallIndex ++
if (this.loadMallIndex < this.mallList.length) {
await this.$sleepSync(500)
await this.getList(data, this.mallList[this.loadMallIndex].mallId, this.mallList[this.loadMallIndex].mallName, 1)
} else {
this.isLoading = false
this.isDlgLoading = false
Message.success("所有店铺待发货订单已加载完成")
}
} else {
this.isLoading = false
this.isDlgLoading = false
}
}
} else {
await this.getList(data, mallId, mallName, currentPage)
}
},
remove(parentOrderSn) {
for (let i = 0; i < this.choosedList.length; i++) {
if (this.choosedList[i].parentOrderMap.parentOrderSn == parentOrderSn) {
this.choosedList.splice(i, 1)
break
}
}
},
getStyle(url) {
return "background-image: url(" + url + "); width: 72px; height: 72px; cursor: pointer; border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.14);";
},
async beginCreate() {
let waitCreateList = []
this.choosedList.map(item => {
waitCreateList.push(item.parentOrderMap.parentOrderSn)
})
for (let j = 0; j < waitCreateList.length; j++) {
let obj = this.choosedList.filter(item => {
return item.parentOrderMap.parentOrderSn == waitCreateList[j]
})
let res = await sendTemuSellerAgentMessage({
url: 'mms/orchid/address/snapshot/order_shipping_address_query',
needMallId: true,
mallId: obj[0].mallId,
data: {
parent_order_sn: obj[0].parentOrderMap.parentOrderSn
}})
if (res.error_code == 1000000 && res.success) {
let data = {
source: 0,
receiveName: res.result.receipt_name,
receiveAddress1: res.result.address_line1,
receiveAddress2: res.result.address_line2,
receivePhone: res.result.mobile,
receiveEmail: res.result.mail,
receiveCity: res.result.region_name3,
receiveProvince: res.result.region_name2,
receiveZipcode: res.result.post_code,
mallId: obj[0].mallId,
mallName: obj[0].mallName,
orderId: obj[0].parentOrderMap.parentOrderSn,
status: 0,
type: 1,
details: [],
createTime: obj[0].parentOrderMap.parentOrderTimeStr
}
for (let k = 0; k < obj[0].orderList.length; k++) {
data.details.push({
temuWarehouseId: obj[0].orderList[k].warehouseId,
sku: obj[0].orderList[k].productInfoList[0].productSkuId,
num: obj[0].orderList[k].quantity,
createTime: obj[0].parentOrderMap.parentOrderTimeStr
})
}
let res1 = await this.$http.post(`/api/semi/semiOrder/addXc`, data)
if (res1.code == 0) {
this.remove(obj[0].parentOrderMap.parentOrderSn)
}
}
}
},
async sendGoods() {
for (let i = 0; i < this.orderDataList.length; i++) {
await this.toSend(this.orderDataList[i])
await this.$sleepSync(200)
}
this.getOrderList()
},
async toSend(obj) {
let params = {
warehouse_code: obj.details[0].warehouseCode,
name: obj.receiveName,
company: '',
address1: obj.receiveAddress1,
email: obj.receiveEmail,
address2: obj.receiveAddress2,
phone: obj.receivePhone,
address3: '',
consignee_phone_extension: '',
city: obj.receiveCity,
phone2: '',
province: obj.receiveProvince,
doorplate: '',
district: '',
license: '',
zipcode: obj.receiveZipcode,
country: 'US',
consignee_tax_type: '',
consignee_eori: '',
platform: '',
order_cod_price: '',
order_cod_currency: '',
shop: '',
refrence_no: obj.orderId,
courier: 'USPS-GALA',
calculation: 1,
is_discount: 1,
ignore_address: 0,
default_insurance_type: 1,
filter_sta_shipping: 1,
shipping_method_no: '',
is_insurance: '',
insurance_value: '',
insurance_value_currency: 'USD',
order_sale_amount: '',
order_sale_currency: '',
channel_code: '',
lifting_cabinet: '',
order_battery_type: '',
vat_tax_code: '',
is_platform_ebay: 0,
ebay_item_id: '',
ebay_transaction_id: '',
distribution_information: '',
IOSS: '',
insurance_type: '',
multiple_tracking_number: '',
is_allow_open: 0,
insurance_type_goods_value: '',
refrence_no_warehouse: '',
is_prime: '',
order_desc: '',
del_order_attached_ids: '',
order_type: 'sale',
order_business_type: 'b2c'
}
params['invoice[product_sku][]'] = ''
params['invoice[product_title_en][]'] = ''
params['invoice[product_title][]'] = ''
params['invoice[product_quantity][]'] = ''
params['invoice[unit_code][]'] = ''
params['invoice[product_declared_value][]'] = ''
params['invoice[product_weight][]'] = ''
if (obj.details[0].warehouseCode == 'UAXC002') {
params.courier = 'USPS'
}
for (let i = 0; i < obj.details.length; i++) {
params[`platform_barcode[${obj.details[i].productId}]`] = ''
params[`product_title_en[${obj.details[i].productId}]`] = obj.details[i].productTitleEn
params[`product_title[${obj.details[i].productId}]`] = obj.details[i].productTitle
params[`declared_value[${obj.details[i].productId}]`] = obj.details[i].declaredValue
params[`op_quantity[${obj.details[i].productId}]`] = obj.details[i].num
}
let res = await sendXcAPIMessage({
url: 'order/order/create/operation/0',
isFormData: true,
method: 'POST',
data: params})
if (res.ask == 1) {
let res1 = await this.$http.post(`/api/semi/semiOrder/updateStatus`, null, {params: {
id: obj.id,
status: 1
}})
if (res1.code != 0) {
Message.error(res1.msg)
}
} else {
Message.error(res.message)
}
},
async getLogisticInfo () {
for (let i = 0; i < this.orderDataList.length; i++) {
let params = {
warehouse_note: '',
is_vip: '',
allot_logistics_for_lg: '',
order_attachment: '',
is_cut_off: '',
large_order: '',
is_temu_warehouse: '',
'time-type': 'date_create',
'order-type': 'DESC',
ORDER_TRIAL_FEE_SHOW: 1,
type: 1,
code: this.orderDataList[i].orderId,
SKU: '',
channel_code: '',
platform_shop: '',
account_name: '',
deliveryFeeFor: '',
deliveryFeeTo: '',
serial_number: '',
create_type: '',
remark: '',
is_one_piece: '',
platform: '',
seller: '',
is_shared: '',
is_ques: '',
country: '',
warehouse_id: '',
shipping_method: '',
is_oda: '',
is_cod: '',
is_prime: '',
process_again: '',
ot_id: '',
abnormal_type: '',
sub_status: 0,
picking_status: '',
order_type: '',
longest_aging: '',
recipient_type: 'buyer_name',
recipient_info: '',
buyer_type: 'buyer_id',
buyer_info: '',
reference_no: '',
is_repeat: '',
is_return: '',
timeType: 'create',
DateFrom: '',
DateEnd: '',
E35: '',
insurance_status: '',
have_tracking_no: '',
keyword: '',
status: 3,
is_more: 0
}
let res = await sendXcAPIMessage({
url: 'order/order-list/list/a/a/page/1/pageSize/50',
isFormData: true,
method: 'POST',
data: params})
if (res.state == 1) {
let res1 = await this.$http.post(`/api/semi/semiOrder/updateLogistic`, null, {params: {
orderId: this.orderDataList[i].orderId,
logisticId: res.data[0].shipping_method_no,
expressCompany: res.data[0].shipping_method,
expressId: res.data[0].carrier_name
}})
if (res1.code != 0) {
Message.error(`${this.orderDataList[i].orderId}】订单取号失败`)
}
}
await this.$sleepSync(200)
}
this.getOrderList()
},
async writeBack() {
for (let i = 0; i < this.orderDataList.length; i++) {
let res = await sendTemuSellerAgentMessage({
url: 'mms/orchid/address/snapshot/order_shipping_address_query',
needMallId: true,
mallId: obj[0].mallId,
data: {
fulfillmentMode: 0,
pageNumber: 1,
pageSize: 20,
queryType: 2,
sortType: 1,
parentOrderSnList: [
this.orderDataList[i].orderId
],
timeZone: "UTC+8",
parentAfterSalesTag: 0,
needBuySignService: 0,
sellerNoteLabelList: []
}})
if (res.errorCode == 0) {
}
}
}
}
}
</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;
}
}
}
.product {
display: flex;
align-items: center;
justify-content: center;
.right {
flex: 1;
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
img {
width: 60px;
margin-right: 10px;
}
}
.tips {
position: relative;
width: 40px;
height: 40px;
border-radius: 50%;
background: rgba(243, 8, 8, .4);
@keyframes warn {
0% {
transform: translate(-50%, -50%) scale(0);
opacity: 1;
}
100% {
transform: translate(-50%, -50%) scale(1.1);
opacity: 0;
}
}
div {
position: absolute;
left: 50%;
top: 50%;
z-index: 11;
width: 100px;
height: 100px;
border-radius: 50%;
animation: warn 0.9s ease-out;
animation-iteration-count: infinite;
box-shadow: 1px 1px 30px #EF2D02;
transform: translate(-50%, -50%) scale(0.2);
transition: all ease-in-out 0.6s;
background: rgba(243, 8, 8, .6);
}
}
.order-manage_productInfo__1pD83>img {
width: 60px;
margin-right: 10px;
}
.order-manage_productInfo__1pD83 {
min-height: 60px;
padding-left: 70px;
position: relative;
}
.order-manage_productInfo__1pD83>div:nth-child(2) {
color: rgba(0,0,0,.8);
}
.outerWrapper {
margin: 4px 4px 0px 0px;
}
.dot-module__dot___M-RuH .dot-module__circle___2l2UV {
flex-shrink: 0;
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
}
.dot-module__dot___M-RuH {
display: inline-flex;
align-items: center;
}
.index-module__image-preview___2fiZX .index-module__img___p3B1N {
width: 60px;
height: 60px;
margin-right: 10px;
background-repeat: no-repeat;
background-size: cover;
background-color: #f5f5f5;
font-size: 12px;
display: flex;
justify-content: center;
align-items: center;
color: var(--bc-Table-emptyTextColor);
position: relative;
}
.textoverflow {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
.order-manage_skuInfo__FW-Nd {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 10px;
&:last-child {
margin-bottom: 0;
}
.order-manage_contentInfo__1Cjd6 {
display: flex;
flex-direction: column;
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 240px;
}
}
.order-manage_skuInfo__FW-Nd .order-manage_contentInfo__1Cjd6 .order-manage_title__1VTO5 {
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
color: rgba(0,0,0,.8);
}
</style>

View File

@@ -289,7 +289,7 @@
data.push({...item, mallId: mallId, mallName: mallName})
})
if (this.pageSize == length) {
if (this.pageSize == res.result.subOrderForSupplierList.length) {
currentPage ++
this.getList(data, mallId, mallName, currentPage)
} else {

10218
yarn.lock

File diff suppressed because it is too large Load Diff