This commit is contained in:
parent
8fca5e55b3
commit
74bc0df089
|
@ -1,10 +1,10 @@
|
|||
VITE_MODE = 'development'
|
||||
|
||||
VITE_APP_BASE_API = 'http://d1-api.erp.xtkj99.com:88'
|
||||
VITE_APP_BASE_API = 'https://122.228.26.226:12025'
|
||||
# VITE_APP_BASE_API = 'https://pre-api.aiguoerp.com'
|
||||
# VITE_APP_BASE_API = 'http://localhost:80'
|
||||
|
||||
|
||||
VITE_APP_BASE_SITE = 'http://localhost:80'
|
||||
|
||||
VITE_APP_BASE_URL = 'http://192.168.2.5:9986'
|
||||
VITE_APP_BASE_URL = 'http://d1-api.erp.xtkj99.com:88'
|
|
@ -88,7 +88,7 @@ onMounted(() => {
|
|||
overflow: hidden;
|
||||
}
|
||||
.routeview {
|
||||
height: calc(100vh - 38px);
|
||||
height: calc(100vh - 40px);
|
||||
overflow-y: auto;
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
import request from '@axioshooks'
|
||||
// 获取商品分类
|
||||
export function getGoodsType(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/publish/getGoodsType',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//获取商品属性
|
||||
export function getGoodsInfo(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/publish/getGoodsInfo',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
//获取闲鱼店铺
|
||||
export function getshopInfo(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/publish/shop/info',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
//上传图片
|
||||
export function uploadImage(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/publish/uploadImage',
|
||||
method: 'file',
|
||||
data
|
||||
})
|
||||
}
|
||||
//获取发货地
|
||||
export function region(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/region',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
|
@ -32,11 +32,11 @@ export function get_user_menu(token) {
|
|||
})
|
||||
}
|
||||
/*获取用户信息*/
|
||||
export function getInfo(token) {
|
||||
export function getInfo(data) {
|
||||
return request({
|
||||
url: 'menu/get_userinfo',
|
||||
method: 'post',
|
||||
params: { token }
|
||||
url: 'auth/getUserInfo',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
/*判断是否绑定拍机堂账号*/
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
import request from '@axioshooks';
|
||||
/* 店铺列表*/
|
||||
export function xy_shop_list(data) {
|
||||
return request({
|
||||
url: 'xy_shop/xy_shop_list',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//获取授权地址
|
||||
export function get_auth_address(data) {
|
||||
return request({
|
||||
url: 'xy_shop/get_auth_address',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//授权完的确认是否授权成功
|
||||
export function affirm_auth_success(data) {
|
||||
return request({
|
||||
url: 'xy_shop/affirm_auth_success',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//创建账号
|
||||
export function account_config_create(data) {
|
||||
return request({
|
||||
url: 'base_config/account_config_create',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//创建账号新
|
||||
export function xy_account_config_create(data) {
|
||||
return request({
|
||||
url: 'base_config/xy_account_config_create',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//删除店铺
|
||||
export function account_config_delete(data) {
|
||||
return request({
|
||||
url: 'base_config/account_config_delete',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 第三方账号配置编辑||店铺修改
|
||||
export function account_config_edit(data) {
|
||||
return request({
|
||||
url: 'base_config/account_config_edit',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//获取行政区id
|
||||
export function get_division_id(data) {
|
||||
return request({
|
||||
url: 'xy_shop/get_division_id',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//获取站点拥有的闲鱼商品业务模式
|
||||
export function site_business_model(data) {
|
||||
return request({
|
||||
url: 'xy_shop/site_business_model',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import request from '@axioshooks';
|
||||
//创建闲鱼店铺
|
||||
export function save_shop(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/auth/save_shop',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//编辑闲鱼店铺
|
||||
export function update_shop(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/auth/update_shop',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//删除闲鱼店铺
|
||||
export function delById(data) {
|
||||
return request({
|
||||
url: `xy_openapi/auth/delById/${data}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
//查询店铺列表
|
||||
export function list_shop(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/auth/list_shop',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
//上传图片
|
||||
export function upload(data) {
|
||||
return request({
|
||||
url: 'xy_openapi/upload',
|
||||
method: 'file',
|
||||
data
|
||||
})
|
||||
}
|
|
@ -97,7 +97,7 @@ const onNavTo=(path)=>{
|
|||
.breadcrumbbox{
|
||||
color: #000;
|
||||
flex:1;
|
||||
height:100%;
|
||||
height:40px;
|
||||
width:100%;
|
||||
&::-webkit-scrollbar{
|
||||
display: none;
|
||||
|
|
|
@ -6,17 +6,38 @@
|
|||
placement="bottom"
|
||||
width="290"
|
||||
trigger="hover"
|
||||
v-model="store.infovisible">
|
||||
v-model="store.infovisible"
|
||||
>
|
||||
<template #reference>
|
||||
<div
|
||||
style="font-size:15px;font-weight:bold; cursor: pointer;max-width:156px;white-space: nowrap;text-overflow:ellipsis;overflow:hidden;padding:0 16px;color:#101010;">
|
||||
<span> {{ userinfo.truename.slice(0,7) }}</span>
|
||||
<el-icon @click="store.infovisible=!store.infovisible"><CaretTop v-if="store.infovisible"/><CaretBottom v-if="!store.infovisible"/></el-icon>
|
||||
style="
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
max-width: 156px;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
padding: 0 16px;
|
||||
color: #101010;
|
||||
"
|
||||
>
|
||||
<span> {{ userinfo ? userinfo.nick_name : "退出登录" }}</span>
|
||||
<el-icon @click="store.infovisible = !store.infovisible"
|
||||
><CaretTop v-if="store.infovisible" /><CaretBottom
|
||||
v-if="!store.infovisible"
|
||||
/></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
<ul class="infopopverbox">
|
||||
<li @click.stop="onCopy(userinfo.username)" class="font14 bold">{{userinfo.username}}<img src="@assets/copy.png"/></li>
|
||||
<li @click.stop="onCopy(userinfo.company_unique_id)" class="font12 "><span class="gay">公司 ID</span><span style="margin-left:10px">{{userinfo.company_unique_id}}</span>
|
||||
<ul class="infopopverbox" v-if="userinfo">
|
||||
<li @click.stop="onCopy(userinfo.username)" class="font14 bold">
|
||||
{{ userinfo.username }}<img src="@assets/copy.png" />
|
||||
</li>
|
||||
<li @click.stop="onCopy(userinfo.businesses_code)" class="font12">
|
||||
<span class="gay">公司 ID</span
|
||||
><span style="margin-left: 10px">{{
|
||||
userinfo.businesses_code
|
||||
}}</span>
|
||||
<img src="@assets/copy.png" />
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -27,33 +48,28 @@
|
|||
<div class="outloginbtnbox">
|
||||
<el-button class="outloginbtn" @click="logout">退出登录</el-button>
|
||||
</div>
|
||||
|
||||
</el-popover>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Breadcrumb from './Breadcrumb.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ref, watch,reactive,onMounted} from 'vue';
|
||||
import axioshooks from "@axioshooks";
|
||||
import Breadcrumb from "./Breadcrumb.vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { ref, watch, reactive, onMounted } from "vue";
|
||||
import { copytext, delAllStorage } from "@services/commont";
|
||||
import {
|
||||
CaretTop,
|
||||
CaretBottom,
|
||||
} from '@element-plus/icons-vue';
|
||||
import { getInfo } from "@/api/user.js";
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const store = reactive({
|
||||
infovisible:false
|
||||
infovisible: false,
|
||||
});
|
||||
const infovisible = ref(true);
|
||||
const showslider = ref(true);
|
||||
|
||||
watch(router.currentRoute, async (newpath, oldpath) => {
|
||||
if(newpath.path=='/qualityreport'){
|
||||
if (newpath.path == "/qualityreport") {
|
||||
showslider.value = false;
|
||||
} else {
|
||||
showslider.value = true;
|
||||
|
@ -61,28 +77,38 @@
|
|||
});
|
||||
|
||||
onMounted(() => {
|
||||
if(router.currentRoute.path=='/qualityreport'){
|
||||
if (router.currentRoute.path == "/qualityreport") {
|
||||
showslider.value = false;
|
||||
} else {
|
||||
showslider.value = true;
|
||||
}
|
||||
});
|
||||
|
||||
const userinfo=ref({username:"",company_unique_id:"",truename:""});
|
||||
axioshooks({
|
||||
url:"menu/get_userinfo",
|
||||
customHandler:(err,e)=>{
|
||||
if(!err&&e){
|
||||
if(e.errcode==0){
|
||||
userinfo.value=e.datas
|
||||
}
|
||||
}
|
||||
const userinfo = ref({
|
||||
username: "",
|
||||
company_unique_id: "",
|
||||
businesses_code: "",
|
||||
});
|
||||
getInfo().then((res) => {
|
||||
console.log(res, "res++++++++++++++++++++");
|
||||
if (res.code === "200") {
|
||||
userinfo.value = res.data;
|
||||
}
|
||||
});
|
||||
// axioshooks({
|
||||
// url: "menu/get_userinfo",
|
||||
// customHandler: (err, e) => {
|
||||
// if (!err && e) {
|
||||
// if (e.errcode == 0) {
|
||||
// userinfo.value = e.datas;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
|
||||
const onCopy = (str) => {
|
||||
copytext(str);
|
||||
}
|
||||
};
|
||||
|
||||
const logout = () => {
|
||||
location.href = "/";
|
||||
|
@ -90,8 +116,7 @@ axioshooks({
|
|||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -107,7 +132,7 @@ axioshooks({
|
|||
|
||||
.infopopverbox {
|
||||
padding: 16px;
|
||||
background:#FAFAFA;
|
||||
background: #fafafa;
|
||||
box-sizing: border-box;
|
||||
li {
|
||||
display: flex;
|
||||
|
@ -130,8 +155,8 @@ axioshooks({
|
|||
box-sizing: border-box;
|
||||
}
|
||||
.btnStyle {
|
||||
border:1px solid #4091FF;
|
||||
color:#4091FF;
|
||||
border: 1px solid #4091ff;
|
||||
color: #4091ff;
|
||||
background: #fff;
|
||||
border-radius: 20px;
|
||||
height: 20px;
|
||||
|
@ -197,11 +222,10 @@ axioshooks({
|
|||
width: 100%;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color:#6F6D6D;
|
||||
color: #6f6d6d;
|
||||
height: 30px;
|
||||
line-height: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
|
|
@ -0,0 +1,247 @@
|
|||
<template>
|
||||
<div class="text-msg-pic-upload">
|
||||
<div class="uploadcontainer">
|
||||
<div v-for="(item, index) in tempFileList" :key="index" class="prewimg">
|
||||
<img :src="item.base64" />
|
||||
<div></div>
|
||||
</div>
|
||||
<label for="uploadinput" class="inputlabel"> 上传 </label>
|
||||
<input
|
||||
type="file"
|
||||
id="uploadinput"
|
||||
class="fileinput"
|
||||
multiple
|
||||
accept="image/jpeg,image/png,image/gif,image/jpg"
|
||||
:onChange="onUpload"
|
||||
/>
|
||||
</div>
|
||||
<!-- <el-upload
|
||||
ref="upload"
|
||||
id="upload"
|
||||
list-type="picture-card"
|
||||
:class="{ display: data.uploadDisabled }"
|
||||
v-model:file-list="tempFileList"
|
||||
:multiple="props.multiple"
|
||||
:auto-upload="props.autoUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:on-change="onChange"
|
||||
accept="jpeg"
|
||||
:show-file-list="props.limit > 1 || !props.limit"
|
||||
>
|
||||
<el-icon v-if="props.limit > 1 || tempFileList.length == 0"
|
||||
><Plus
|
||||
/></el-icon>
|
||||
<img
|
||||
:src="tempFileList[0].url"
|
||||
v-if="props.limit == 1 && tempFileList.length > 0"
|
||||
class="showimg"
|
||||
/>
|
||||
<template #file="{ file }">
|
||||
<div>
|
||||
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
|
||||
<span class="el-upload-list__item-actions">
|
||||
<span
|
||||
class="el-upload-list__item-preview"
|
||||
@click="hImgPreview(file)"
|
||||
>
|
||||
<el-icon><zoom-in /></el-icon>
|
||||
</span>
|
||||
<span
|
||||
class="el-upload-list__item-delete"
|
||||
@click="handleRemove(file)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload> -->
|
||||
<el-dialog v-model="data.dialogVisible" append-to-body>
|
||||
<img width="100%" :src="data.dialogImageUrl" alt="" />
|
||||
</el-dialog>
|
||||
<!-- <div class="Upload_pictures">
|
||||
<ul class="el-upload__tip cBBBDBF" style="color: #bbbdbf">
|
||||
<li>支持PNG、JEPG格式 ,不超过2MB。</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, watch, computed, onMounted } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { Delete, Download, Plus, ZoomIn } from "@element-plus/icons-vue";
|
||||
const $emit = defineEmits(["onSuccessFiles"]);
|
||||
|
||||
const props = defineProps({
|
||||
limitType: {
|
||||
type: Array,
|
||||
default: ["jpeg", "jpg", "gif", "png"],
|
||||
}, //限制图片格式
|
||||
autoUpload: Boolean,
|
||||
limit: Number, //最大上传数
|
||||
imgList: Array, //图片列表
|
||||
multiple: Boolean, //是否多传
|
||||
});
|
||||
const data = reactive({
|
||||
// 上传文件列表,el-upload使用,临时保存数据。
|
||||
uploadDisabled: false,
|
||||
dialogImageUrl: "",
|
||||
dialogVisible: false,
|
||||
});
|
||||
const tempFileList = ref([]);
|
||||
const onUpload = (e) => {
|
||||
const ImgList = [];
|
||||
for (let i = 0; i < e.target.files.length; i++) {
|
||||
if (isPngImage(e.target.files[i])) {
|
||||
let file = isPngImage(e.target.files[i]);
|
||||
const render = new FileReader();
|
||||
render.onload = (re) => {
|
||||
ImgList.push({ file: file, base64: re.target.result });
|
||||
if (e.target.files.length - 1 == i) {
|
||||
if (!handleExceed(ImgList, tempFileList.value)) return;
|
||||
tempFileList.value.push(...ImgList);
|
||||
$emit("onSuccessFiles", tempFileList.value);
|
||||
}
|
||||
};
|
||||
render.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const isPngImage = (file) => {
|
||||
if (!file.type.startsWith("image/")) {
|
||||
console.error("这不是一个图片文件");
|
||||
return false;
|
||||
}
|
||||
const fileName = file.name || "";
|
||||
const extension = fileName.split(".").pop().toLowerCase();
|
||||
if (props.limitType.includes(extension)) return file;
|
||||
};
|
||||
watch(
|
||||
props,
|
||||
(newval) => {
|
||||
// if (Array.isArray(props.imgList)) {
|
||||
// console.log(
|
||||
// props.imgList,
|
||||
// "props.imgListprops.imgListprops.imgListprops.imgListprops.imgListprops.imgListprops.imgListprops.imgListprops.imgListprops.imgListprops.imgList"
|
||||
// );
|
||||
// tempFileList.value = props.imgList||[];
|
||||
// }
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
//查看图片
|
||||
const hImgPreview = (file) => {
|
||||
data.dialogImageUrl = file.url;
|
||||
data.dialogVisible = true;
|
||||
};
|
||||
// 监听移除文件列表
|
||||
const handleRemove = (file) => {
|
||||
if (tempFileList.value) {
|
||||
const list = tempFileList.value.filter((f) => f.url != file.url);
|
||||
$emit("onSuccessFiles", list);
|
||||
} else {
|
||||
$emit("onSuccessFiles", []);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const onChange = (file) => {
|
||||
// if (!file || !file.raw) {
|
||||
// return;
|
||||
// }
|
||||
// let types = props.limitType;
|
||||
// const isImage = types.find((f) => file.raw.type.includes(f));
|
||||
// const isLt20M = file.raw.size / 1024 / 1024 < 2;
|
||||
// if (!isImage && props.limit > 1) {
|
||||
// ElMessage(
|
||||
// types.length == 0
|
||||
// ? "上传图片只能是 PNG 格式!"
|
||||
// : "上传图片只能是 JPG、PNG 格式!"
|
||||
// );
|
||||
// return false;
|
||||
// }
|
||||
// if (!isLt20M) {
|
||||
// ElMessage("上传图片大小不能超过 2MB!");
|
||||
// return false;
|
||||
// }
|
||||
// isPngImage(file.raw);
|
||||
// $emit("onSuccessFiles", tempFileList.value);
|
||||
// return false;
|
||||
};
|
||||
|
||||
// 自定义上传操作
|
||||
const handleUpload = (op, filelist) => {};
|
||||
|
||||
const handleExceed = (files, fileList) => {
|
||||
console.log(files.length + fileList.length, "files.length + fileList.length");
|
||||
if (files.length + fileList.length > props.limit) {
|
||||
ElMessage(
|
||||
`当前限制选择 ${props.limit} 个文件,本次选择了 ${
|
||||
files.length
|
||||
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.text-msg-pic-upload .el-upload--picture-card,
|
||||
.text-msg-pic-upload .el-upload-list--picture-card .el-upload-list__item {
|
||||
width: 62px;
|
||||
height: 62px;
|
||||
line-height: 72px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
.showimg {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
.display .el-upload--picture-card {
|
||||
display: none;
|
||||
}
|
||||
.el-upload-list__item-delete {
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
.inputlabel {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border: 1px dashed #e5e5e5;
|
||||
border-radius: 6px;
|
||||
&:hover {
|
||||
border: 1px dashed #409eff;
|
||||
}
|
||||
}
|
||||
.uploadcontainer {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 10px;
|
||||
}
|
||||
.fileinput {
|
||||
display: none;
|
||||
}
|
||||
.prewimg {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border: 1px solid #e5e5e5;
|
||||
border-radius: 6px;
|
||||
display: block;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,24 +1,23 @@
|
|||
<template>
|
||||
<div class="text-msg-pic-upload">
|
||||
<el-upload
|
||||
:class="{ display: data.uploadDisabled }"
|
||||
action=""
|
||||
list-type="picture-card"
|
||||
ref="upload"
|
||||
list-type="picture-card"
|
||||
:class="{ display: data.uploadDisabled }"
|
||||
v-model:file-list="tempFileList"
|
||||
:multiple="props.multiple"
|
||||
:auto-upload="props.autoUpload"
|
||||
v-model:file-list="data.tempFileList"
|
||||
:on-exceed="handleExceed"
|
||||
:on-success="handleSuccess"
|
||||
accept="jpg,.jpeg,.png,.JPG,.JPEG"
|
||||
:on-change="beforeUpload"
|
||||
:on-change="onChange"
|
||||
:show-file-list="props.limit > 1 || !props.limit"
|
||||
accept="image/jpeg,image/png,image/gif,image/jpg"
|
||||
>
|
||||
<el-icon v-if="props.limit > 1 || data.tempFileList.length == 0"
|
||||
<el-icon v-if="props.limit > 1 || tempFileList.length == 0"
|
||||
><Plus
|
||||
/></el-icon>
|
||||
<img
|
||||
:src="data.tempFileList[0].url"
|
||||
v-if="props.limit == 1 && data.tempFileList.length > 0"
|
||||
:src="tempFileList[0].url"
|
||||
v-if="props.limit == 1 && tempFileList.length > 0"
|
||||
class="showimg"
|
||||
/>
|
||||
<template #file="{ file }">
|
||||
|
@ -27,12 +26,11 @@
|
|||
<span class="el-upload-list__item-actions">
|
||||
<span
|
||||
class="el-upload-list__item-preview"
|
||||
@click="handlePictureCardPreview(file)"
|
||||
@click="hImgPreview(file)"
|
||||
>
|
||||
<el-icon><zoom-in /></el-icon>
|
||||
</span>
|
||||
<span
|
||||
v-if="!data.uploadDisabled"
|
||||
class="el-upload-list__item-delete"
|
||||
@click="handleRemove(file)"
|
||||
>
|
||||
|
@ -41,7 +39,6 @@
|
|||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="el-upload__tip" v-if="props.tipsFlag">{{ props.tips }}</div>
|
||||
</el-upload>
|
||||
<el-dialog v-model="data.dialogVisible" append-to-body>
|
||||
<img width="100%" :src="data.dialogImageUrl" alt="" />
|
||||
|
@ -57,54 +54,61 @@
|
|||
<script setup>
|
||||
import { ref, reactive, watch, computed } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { initOss } from "@services/commont";
|
||||
import { Delete, Download, Plus, ZoomIn } from "@element-plus/icons-vue";
|
||||
const $emit = defineEmits(["onSuccessFiles"]);
|
||||
|
||||
const props = defineProps({
|
||||
width: String,
|
||||
limitType: {
|
||||
type: Array,
|
||||
default: ["jpeg", "jpg", "gif", "png"],
|
||||
}, //限制图片格式
|
||||
autoUpload: Boolean,
|
||||
limit: Number,
|
||||
limitType: Array,
|
||||
disabled: Boolean,
|
||||
imgList: Array,
|
||||
tipsFlag: Boolean,
|
||||
tips: String,
|
||||
limit: Number, //最大上传数
|
||||
imgList: Array, //图片列表
|
||||
multiple: Boolean, //是否多传
|
||||
});
|
||||
const data = reactive({
|
||||
// 上传文件列表,el-upload使用,临时保存数据。
|
||||
tempFileList: [],
|
||||
host: "", // 阿里云上传服务器地址根路径
|
||||
uploadDisabled: false,
|
||||
dialogImageUrl: "",
|
||||
dialogVisible: false,
|
||||
});
|
||||
|
||||
const tempFileList = ref([]);
|
||||
|
||||
watch(
|
||||
props,
|
||||
(newval) => {
|
||||
console.log(newval, "newval");
|
||||
if (Array.isArray(props.imgList)) {
|
||||
console.log(props.imgList, "props.imgList");
|
||||
data.tempFileList = props.imgList;
|
||||
tempFileList.value = props.imgList;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
const upText = computed(() => {
|
||||
computed(() => {
|
||||
return props.autoUpload ? "上传文件" : "选择文件";
|
||||
});
|
||||
const handlePictureCardPreview = (file) => {
|
||||
//查看图片
|
||||
const hImgPreview = (file) => {
|
||||
data.dialogImageUrl = file.url;
|
||||
data.dialogVisible = true;
|
||||
};
|
||||
const beforeUpload = (file) => {
|
||||
// 监听移除文件列表
|
||||
const handleRemove = (file) => {
|
||||
if (tempFileList.value) {
|
||||
const list = tempFileList.value.filter((f) => f.url != file.url);
|
||||
$emit("onSuccessFiles", list);
|
||||
} else {
|
||||
$emit("onSuccessFiles", []);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const onChange = (file) => {
|
||||
if (!file || !file.raw) {
|
||||
return;
|
||||
}
|
||||
// console.log('beforeUpload', file)
|
||||
let types = props.limitType || ["jpeg", "jpg", "gif", "png"];
|
||||
let types = props.limitType;
|
||||
const isImage = types.find((f) => file.raw.type.includes(f));
|
||||
const isLt20M = file.raw.size / 1024 / 1024 < 2;
|
||||
|
||||
|
@ -120,58 +124,23 @@ const beforeUpload = (file) => {
|
|||
ElMessage("上传图片大小不能超过 2MB!");
|
||||
return false;
|
||||
}
|
||||
if (props.limit == 1) {
|
||||
tempFileList.value = [];
|
||||
}
|
||||
handleUpload({ file: file });
|
||||
return false;
|
||||
};
|
||||
// 自定义上传操作
|
||||
const handleUpload = (op) => {
|
||||
console.log(op.file, "handleUpload");
|
||||
initOss(op.file.raw)
|
||||
.then((link) => {
|
||||
console.log(link, "link");
|
||||
let tempFileList = [];
|
||||
const handleUpload = (op, filelist) => {
|
||||
if (props.limit == 1) {
|
||||
tempFileList = [op.file];
|
||||
} else {
|
||||
tempFileList.push(...data.tempFileList, op.file);
|
||||
tempFileList.value = [];
|
||||
setTimeout(() => {
|
||||
tempFileList.value = [op.file];
|
||||
}, 100);
|
||||
}
|
||||
$emit("onSuccessFiles", link, tempFileList);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err, "err");
|
||||
$emit("onSuccessFiles", "", []);
|
||||
});
|
||||
$emit("onSuccessFiles", op.file);
|
||||
};
|
||||
|
||||
// 上传成功后触发
|
||||
const handleSuccess = (response, file, fileList) => {
|
||||
// this.filterFileFn(fileList)
|
||||
};
|
||||
// 返回给接口要用的格式
|
||||
const filterFileFn = (fileList) => {
|
||||
// let filterArr = fileList
|
||||
// .filter(item => !item.status || item.status !== 'ready') // 过滤未上传的文件
|
||||
// .map(item => {
|
||||
// let url = item.response ? item.response.url : item.url
|
||||
// return {
|
||||
// url: url, // item.url || item.response.url
|
||||
// name: item.name
|
||||
// }
|
||||
// })
|
||||
// // console.log('fileList', fileList)
|
||||
// this.$emit('onSuccessFiles', filterArr)
|
||||
};
|
||||
// 监听移除文件列表
|
||||
const handleRemove = (file, fileList) => {
|
||||
if (data.tempFileList) {
|
||||
const list = data.tempFileList.filter((f) => f.url != file.url);
|
||||
$emit("onSuccessFiles", "", list);
|
||||
} else {
|
||||
$emit("onSuccessFiles", "", []);
|
||||
$emit("onSuccessFiles", "", []);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const handleExceed = (files, fileList) => {
|
||||
ElMessage(
|
||||
`当前限制选择 ${props.limit} 个文件,本次选择了 ${
|
||||
|
@ -179,9 +148,6 @@ const handleExceed = (files, fileList) => {
|
|||
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
||||
);
|
||||
};
|
||||
const beforeRemove = () => {
|
||||
// return this.$confirm(`确定移除 ${file.name}?`)
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -193,6 +159,7 @@ const beforeRemove = () => {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
.showimg {
|
||||
width: 60px;
|
||||
|
@ -201,5 +168,8 @@ const beforeRemove = () => {
|
|||
.display .el-upload--picture-card {
|
||||
display: none;
|
||||
}
|
||||
.el-upload-list__item-delete {
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import axios, * as defaultAxios from 'axios';
|
||||
import { getStorage, deloneStorage } from "./commont";
|
||||
import { getStorage, deloneStorage, jsonurldata } from "./commont";
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@ let _window = window;
|
|||
let cancelTokenSource = null;
|
||||
let lasturl = [];
|
||||
|
||||
|
||||
export default ({
|
||||
url,
|
||||
method = 'post',
|
||||
|
@ -66,27 +67,44 @@ export default ({
|
|||
};
|
||||
let axioshooks = axios.create();
|
||||
|
||||
let config = {
|
||||
headers: Object.assign({}, headers)
|
||||
};
|
||||
|
||||
var axiosfn = {
|
||||
"delete": (url, paramdata, config) => {
|
||||
let newurl = url
|
||||
let str = data && Object.keys(data).length > 0 ? "/" + jsonurldata(data) : ""
|
||||
newurl = url + str
|
||||
return axios.delete(newurl, config)
|
||||
}, "post": axios.post, "get": (url, paramdata, config) => {
|
||||
let newurl = url
|
||||
let str = data && Object.keys(data).length > 0 ? "/" + jsonurldata(data) : ""
|
||||
newurl = url + str
|
||||
return axios.get(newurl, config)
|
||||
}, "put": axios.put
|
||||
}
|
||||
const token = getStorage('token');
|
||||
const virtoken = getStorage('virtoken');
|
||||
const baseApi = import.meta.env.VITE_APP_BASE_API;
|
||||
|
||||
let newurl = '';
|
||||
if (/http/.test(url)) {
|
||||
newurl = url;
|
||||
} else {
|
||||
const baseApi = import.meta.env.VITE_APP_BASE_API;
|
||||
newurl = baseApi + '/api/' + url;
|
||||
}
|
||||
|
||||
let newtoken = newurl.indexOf(baseApi) > -1 ? "Bearer " + virtoken : token;
|
||||
|
||||
let config = {
|
||||
headers: Object.assign({}, headers, {
|
||||
token: newtoken
|
||||
})
|
||||
};
|
||||
cancelTokenSource = CancelToken.source();
|
||||
|
||||
if (token) {
|
||||
config = {
|
||||
headers: Object.assign({}, {
|
||||
token: token,
|
||||
token: newtoken,
|
||||
'Content-Type': 'application/json;'
|
||||
}, headers),
|
||||
cancelToken: cancelTokenSource.token,
|
||||
|
@ -101,22 +119,17 @@ export default ({
|
|||
}//添加请求头
|
||||
}
|
||||
if (method && method == 'get') {
|
||||
config.headers = Object.assign({}, {
|
||||
token: token,
|
||||
cancelToken: cancelTokenSource.token,
|
||||
}, headers);
|
||||
axioshooks = axios.get;
|
||||
config.headers = Object.assign({}, config.headers || {}, headers);
|
||||
} else if (method && method == 'file') {
|
||||
config.headers = Object.assign({}, {
|
||||
token: token,
|
||||
|
||||
config.headers = Object.assign({}, config.headers || {}, {
|
||||
token: newtoken,
|
||||
'Content-Type': 'multipart/form-data',
|
||||
Accept: '*/*',
|
||||
}, headers);
|
||||
axioshooks = axios.post;
|
||||
} else {
|
||||
axioshooks = axios.post;
|
||||
}
|
||||
console.log(config,"config")
|
||||
axioshooks = axiosfn[method] ? axiosfn[method] : axios.post
|
||||
// console.log(config,"config")
|
||||
|
||||
if (!url || !dispatchEffect()) return;
|
||||
// ONLY trigger by query
|
||||
|
@ -131,9 +144,12 @@ console.log(config,"config")
|
|||
_Object.values(data).map((d, index) => {
|
||||
if ((d && d != '') || typeof d == 'number') {
|
||||
if (Object.keys(data)[index] == 'file') {
|
||||
params.append('file', d, d.name);
|
||||
d.map((h)=>{
|
||||
params.append('file', h, h.name);
|
||||
})
|
||||
|
||||
} else if (Object.keys(data)[index] == 'filekey') {
|
||||
params.append(d, data[d], data[d].name);
|
||||
params.append(d, data[d]);
|
||||
} else {
|
||||
params.append(Object.keys(data)[index], d);
|
||||
}
|
||||
|
@ -165,10 +181,8 @@ console.log(config,"config")
|
|||
paramsdata = params;
|
||||
}
|
||||
}
|
||||
|
||||
axioshooks(newurl, paramsdata, config)
|
||||
.then(response => {
|
||||
console.log(response,"response")
|
||||
if (response.data && response.data.errcode && response.data.errcode == 1002) {
|
||||
deloneStorage("token");
|
||||
location.href = "/";
|
||||
|
@ -187,7 +201,7 @@ console.log(config,"config")
|
|||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error,"error")
|
||||
// console.log(error,"error")
|
||||
if (!isCancel(error.message)) {
|
||||
handler(error.message, error, null);
|
||||
reject(error.message);
|
||||
|
|
|
@ -9,12 +9,10 @@ export async function getFileMenu() {
|
|||
let defaultmenu = filemoduleMap[k];
|
||||
const matches = k.match(/[^\.\/]+/g).slice(1, -1);
|
||||
let path = "";
|
||||
console.log(matches,'matches');
|
||||
matches.map((h) => {
|
||||
path += h + '/';
|
||||
});
|
||||
path = path.slice(0, path.length - 1);
|
||||
console.log(path,'path')
|
||||
let data = { path: '/' + path, module: defaultmenu, url: k }
|
||||
results.push(data);
|
||||
});
|
||||
|
@ -42,7 +40,8 @@ export function maskData(input, type = 'phone') {
|
|||
const [localPart, domain] = input.split('@')
|
||||
if (localPart.length > 2) {
|
||||
start = 2
|
||||
end = domain.length + 1 }
|
||||
end = domain.length + 1
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'bankCard': {
|
||||
|
@ -79,7 +78,6 @@ export function maskData(input, type = 'phone') {
|
|||
if (telRegExp.test(input)) {
|
||||
let matchRes = input.match(telRegExp);
|
||||
if (matchRes) {
|
||||
console.log(matchRes,"matchRes")
|
||||
if (matchRes[1] && matchRes[1].length) {
|
||||
start = matchRes[1].length
|
||||
} else {
|
||||
|
@ -179,7 +177,6 @@ export function getQueryString(e) {
|
|||
|
||||
// 添加本地存储
|
||||
export function addSessionStorage(key, value) {
|
||||
console.log(key,value,"9888978787");
|
||||
try {
|
||||
sessionStorage.setItem(key, JSON.stringify(value));
|
||||
} catch (err) {
|
||||
|
@ -222,6 +219,7 @@ export function delAllStorage(key) {
|
|||
}
|
||||
// JSON数据转换 url后的参数格式
|
||||
export function jsonurldata(datas) {
|
||||
if (typeof datas !== "object") return datas
|
||||
const dataarray = [];
|
||||
const datakeys = Array.from(Object.keys(datas));
|
||||
const datavalue = Array.from(Object.values(datas));
|
||||
|
@ -375,7 +373,6 @@ export function copytext(text){
|
|||
export const initOss = (file) => {
|
||||
return new Promise((r, j) => {
|
||||
let oss = getSessionStorage("oss");
|
||||
console.log(oss,"oss");
|
||||
if (oss) {
|
||||
const key = oss.dir + new Date().getTime() + (99999) * Math.random() + '.png';
|
||||
if (oss.expire > Number(new Date().getTime().toString().slice(0, 10))) {
|
||||
|
@ -388,8 +385,9 @@ export const initOss=(file)=>{
|
|||
getSign();
|
||||
}
|
||||
function getSign() {
|
||||
const baseApi = import.meta.env.VITE_APP_BASE_URL;
|
||||
axioshooks({
|
||||
url:"base_config/get_oss_sign_aliyun_v3",
|
||||
url: baseApi+"/api/base_config/get_oss_sign_aliyun_v3",
|
||||
data: { bussiness_type: "xy_shop_qc_avatar" },
|
||||
customHandler: (err, res) => {
|
||||
if (!err && res) {
|
||||
|
@ -432,7 +430,6 @@ export const initOss=(file)=>{
|
|||
method: 'POST', // 或者 'PUT'
|
||||
body: formData,
|
||||
}).then((res) => {
|
||||
console.log(res,"rrr",resulturl)
|
||||
if (res.status == 201) {
|
||||
r(resulturl);
|
||||
} else {
|
||||
|
@ -440,7 +437,6 @@ export const initOss=(file)=>{
|
|||
j();
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err.message,"err1")
|
||||
if (err.message == "Failed to fetch") {
|
||||
ElMessage("上传失败");
|
||||
delSessionStorage("oss");
|
||||
|
|
|
@ -126,7 +126,6 @@ import { ElMessage } from "element-plus";
|
|||
import axioshooks from "@axioshooks";
|
||||
import { getStorage, addStorage } from "@services/commont";
|
||||
import { Loading } from "@element-plus/icons-vue";
|
||||
import Header from "../components/Layout/Header.vue";
|
||||
|
||||
const props = defineProps(["callback"]);
|
||||
const ruleForm = reactive({
|
||||
|
@ -158,9 +157,11 @@ const rules = ref({
|
|||
});
|
||||
|
||||
const getCatchImage = () => {
|
||||
const baseApi = import.meta.env.VITE_APP_BASE_URL;
|
||||
checkloading.value = true;
|
||||
|
||||
axioshooks({
|
||||
url: "login/get_brand_img_tncode",
|
||||
url: baseApi + "/api/login/get_brand_img_tncode",
|
||||
data: { username: ruleForm.username, password: ruleForm.password },
|
||||
customHandler: (err, e) => {
|
||||
if (!err && e) {
|
||||
|
@ -191,8 +192,9 @@ const onCheckImg = () => {
|
|||
const find = checkimages?.value?.model?.find(
|
||||
(f) => f.cate_map_id == checkvalue.value
|
||||
);
|
||||
const baseApi = import.meta.env.VITE_APP_BASE_URL;
|
||||
axioshooks({
|
||||
url: "login/xy_hosted_login",
|
||||
url: baseApi + "/api/login/xy_hosted_login",
|
||||
data: {
|
||||
username: ruleForm.username,
|
||||
password: ruleForm.password,
|
||||
|
@ -207,9 +209,8 @@ const onCheckImg = () => {
|
|||
checkimages.value = false;
|
||||
let token = e.datas.token;
|
||||
if (e.datas.token) {
|
||||
const baseApi = import.meta.env.VITE_APP_BASE_URL;
|
||||
axioshooks({
|
||||
url: baseApi + "/api/auth/login3rd",
|
||||
url: "auth/login3rd",
|
||||
headers: {
|
||||
loginType: "erpLogin",
|
||||
token: e.datas.token,
|
||||
|
@ -219,7 +220,11 @@ const onCheckImg = () => {
|
|||
console.log(e, "eee");
|
||||
if (e.code == "200") {
|
||||
addStorage("token", token);
|
||||
addStorage("virtoken", e.data);
|
||||
// addStorage("virtoken", e.data);
|
||||
addStorage(
|
||||
"virtoken",
|
||||
"9wEUErM0vX7OGuPq7byzZA0KdSMhROI8cCWvQAK5bH8TyOwHhekuHF0vwF9cMg5h92fVFtoZssQv9Oo36CYbZmXjrWa56NWWLNppUGRiTFEHYNzPhn7NYBP7SqvPPI6z"
|
||||
);
|
||||
if (props.callback) {
|
||||
props.callback();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,221 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="props.specificationTitle"
|
||||
v-model="props.specificationDialogVisible"
|
||||
width="40%"
|
||||
top="23vh"
|
||||
:close-on-click-modal="false"
|
||||
:before-close="specificationClose"
|
||||
>
|
||||
<div>
|
||||
<div style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<span style="font-size: 18px; display: flex; align-items: center"
|
||||
><Warning style="width: 1em; height: 1em; margin-right: 8px" /></span
|
||||
>最多添加两个商品规格,单个规格最多添加50个属性值;两个属性时相乘不得超过400个
|
||||
</div>
|
||||
<el-form
|
||||
ref="ruleFormRef"
|
||||
:model="ruleForm"
|
||||
label-width="auto"
|
||||
class="demo-ruleForm"
|
||||
:rules="rules"
|
||||
>
|
||||
<el-form-item prop="name">
|
||||
<el-input
|
||||
v-model="ruleForm.name"
|
||||
style="width: 280px"
|
||||
placeholder="请输入商品规格,字数限制4"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click.stop="submit_specification(ruleFormRef)"
|
||||
>确定</el-button
|
||||
>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<div v-for="(item, index) in specification_list" :key="index">
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<div>
|
||||
<el-input
|
||||
v-if="item.disabled"
|
||||
class="title"
|
||||
v-model="item.label"
|
||||
size="small"
|
||||
@keydown="item.keydown($event, item, index)"
|
||||
>
|
||||
<template #suffix>
|
||||
<span>{{ `(${item.num})` }}</span>
|
||||
</template>
|
||||
</el-input>
|
||||
<span v-else>{{ item.label }}{{ `(${item.num})` }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-button
|
||||
style="margin-left: 0"
|
||||
v-for="el in item.buttonGroup"
|
||||
:key="el.label"
|
||||
:type="el.type"
|
||||
text
|
||||
size="small"
|
||||
@click="el.handler(item, index)"
|
||||
>{{ el.label }}</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<el-input
|
||||
style="margin: 5px 0"
|
||||
v-model="item.inputGroup.valueName"
|
||||
:placeholder="item.inputGroup.placeholder"
|
||||
@keydown="
|
||||
item.inputGroup.keydown($event, item.inputGroup.valueName, index)
|
||||
"
|
||||
>
|
||||
</el-input>
|
||||
<div>
|
||||
<el-button
|
||||
style="margin: 2px 5px 2px 0px"
|
||||
v-for="(el, ind) in item.valueGrop"
|
||||
:key="ind"
|
||||
:type="el.type"
|
||||
round
|
||||
size="small"
|
||||
@click="el.delete(item, ind)"
|
||||
>
|
||||
{{ el.label }}<el-icon class="el-icon--right"><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="specificationClose">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">{{ editText }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineEmits, defineProps, reactive } from "vue";
|
||||
import { Warning, Delete } from "@element-plus/icons-vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
const $emit = defineEmits(["specificationClose"]);
|
||||
const props = defineProps({
|
||||
specificationDialogVisible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
specificationTitle: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
editText: {
|
||||
type: String,
|
||||
default: "确定",
|
||||
},
|
||||
specification_arr: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
});
|
||||
const ruleFormRef = ref(null);
|
||||
const ruleForm = reactive({
|
||||
name: "",
|
||||
});
|
||||
const rules = reactive({
|
||||
name: [
|
||||
{ min: 1, max: 4, message: "字数限制,最多输入4个字符", trigger: "blur" },
|
||||
],
|
||||
});
|
||||
|
||||
const specification_list = ref(props.specification_arr);
|
||||
const specification_list_index = ref(0);
|
||||
|
||||
const submit_specification = (formEl) => {
|
||||
formEl.validate((valid) => {
|
||||
if (!valid || !ruleForm.name) return;
|
||||
if (specification_list.value.length >= 2)
|
||||
return ElMessage.warning("超过输入限制!");
|
||||
specification_list_index.value++;
|
||||
specification_list.value.push({
|
||||
label: ruleForm.name,
|
||||
num: 0,
|
||||
index: specification_list_index.value,
|
||||
disabled: false,
|
||||
keydown: (e, item, index) => {
|
||||
if (e.key !== "Enter") return;
|
||||
if (item.label.length <= 4) {
|
||||
item.disabled = false;
|
||||
} else {
|
||||
ElMessage.warning("字数限制4个字符!");
|
||||
}
|
||||
},
|
||||
buttonGroup: [
|
||||
{
|
||||
type: "primary",
|
||||
label: "编辑",
|
||||
handler: (item) => {
|
||||
item.disabled = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "danger",
|
||||
label: "删除",
|
||||
handler: (item, index) => {
|
||||
specification_list.value.splice(index, 1);
|
||||
},
|
||||
},
|
||||
],
|
||||
inputGroup: {
|
||||
valueName: "",
|
||||
placeholder: "请输入规格属性,按回车健确认",
|
||||
keydown: (e, name, index) => {
|
||||
if (e.key !== "Enter" || !name) return;
|
||||
if (specification_list.value.length <= 1) {
|
||||
if (specification_list.value[index].valueGrop.length >= 10) return;
|
||||
} else {
|
||||
if (
|
||||
specification_list.value[0].valueGrop.length *
|
||||
specification_list.value[1].valueGrop.length >=
|
||||
100
|
||||
)
|
||||
return;
|
||||
}
|
||||
specification_list.value[index].valueGrop.push({
|
||||
type: "danger",
|
||||
label: specification_list.value[index].inputGroup.valueName,
|
||||
delete: (item, ind) => {
|
||||
specification_list.value[index].valueGrop.splice(ind, 1);
|
||||
},
|
||||
});
|
||||
specification_list.value[index].num =
|
||||
specification_list.value[index].valueGrop.length;
|
||||
specification_list.value[index].inputGroup.valueName = "";
|
||||
},
|
||||
},
|
||||
valueGrop: [],
|
||||
});
|
||||
ruleForm.name = "";
|
||||
});
|
||||
};
|
||||
const submitForm = () => {
|
||||
$emit("specificationSubmit", specification_list);
|
||||
specificationClose();
|
||||
};
|
||||
const specificationClose = () => {
|
||||
$emit("specificationClose");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -59,8 +59,8 @@
|
|||
<UploadImage
|
||||
:limit="item.limit"
|
||||
:imgList="item.fileImgList"
|
||||
:autoUpload="false"
|
||||
@onSuccessFiles="item.handler"
|
||||
:multiple="item.multiple"
|
||||
@onSuccessFiles="item.onSuccessFiles"
|
||||
/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
@ -81,7 +81,7 @@
|
|||
import UploadImage from "@components/Upload/newfileupload.vue";
|
||||
import { ref, defineEmits, defineProps } from "vue";
|
||||
const ruleFormRef = ref(null);
|
||||
const $emit = defineEmits(["submitForm"]);
|
||||
const $emit = defineEmits(["submitForm", "CreateStoreClose"]);
|
||||
const props = defineProps({
|
||||
CreateStoreDialogVisible: {
|
||||
type: Boolean,
|
||||
|
@ -116,6 +116,7 @@ const submitForm = (form) => {
|
|||
};
|
||||
const CreateStoreClose = () => {
|
||||
$emit("CreateStoreClose");
|
||||
ruleFormRef.value.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
@click="operation('create')"
|
||||
>创建闲鱼店铺</el-button
|
||||
>
|
||||
<el-button class="btn" size="small" @click="operation()"
|
||||
<el-button class="btn" size="small" @click="operation('publish')"
|
||||
>发布商品</el-button
|
||||
>
|
||||
</div>
|
||||
|
@ -21,20 +21,20 @@
|
|||
:sm="10"
|
||||
:md="8"
|
||||
:lg="6"
|
||||
:xl="4"
|
||||
v-for="(item, index) in 88"
|
||||
:xl="get_win_width"
|
||||
v-for="(item, index) in store_list"
|
||||
:key="index"
|
||||
>
|
||||
<div class="card">
|
||||
<div class="card-top">
|
||||
<div class="top-left">
|
||||
<div class="block">
|
||||
<el-avatar shape="square" :size="50" :src="squareUrl" />
|
||||
<el-avatar shape="square" :size="50" :src="item.lcon" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="top-right">
|
||||
<div class="info">
|
||||
<div class="username">账号名称</div>
|
||||
<!-- <div class="username">{{ item.xyName }}</div> -->
|
||||
<div>
|
||||
<el-button
|
||||
v-for="el in buttonGroup"
|
||||
|
@ -49,22 +49,22 @@
|
|||
</div>
|
||||
</div>
|
||||
<el-tag
|
||||
v-for="el in tags"
|
||||
:key="el.label"
|
||||
:type="el.type"
|
||||
v-for="(el, ind) in item.storeType"
|
||||
:key="ind"
|
||||
:type="el"
|
||||
size="small"
|
||||
>{{ el.label }}</el-tag
|
||||
>{{ el == 1 ? "特卖" : el == 2 ? "鱼小铺" : "普通" }}</el-tag
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<el-descriptions :column="1" :size="size" :style="blockMargin">
|
||||
<el-descriptions-item
|
||||
v-for="(el, index) in descriptions"
|
||||
v-for="(el, index) in item.descriptions"
|
||||
:key="index"
|
||||
:label="el.label"
|
||||
:class-name="el.cssName"
|
||||
:label-class-name="el.cssName"
|
||||
>kooriookami</el-descriptions-item
|
||||
>{{ el.value }}</el-descriptions-item
|
||||
>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
@ -82,6 +82,7 @@
|
|||
:ruleForm="CreateStore.ruleForm"
|
||||
:ruleFormList="CreateStore.ruleFormList"
|
||||
:rules="CreateStore.rules"
|
||||
:editText="CreateStore.editText"
|
||||
@CreateStoreClose="CreateStoreClose"
|
||||
@submitForm="submitForm"
|
||||
></CreateStoreDialog>
|
||||
|
@ -89,23 +90,42 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from "vue";
|
||||
import { router } from "@/router.js";
|
||||
import { ref, reactive, onMounted, watch, computed } from "vue";
|
||||
import { Delete, Edit, Search, Share, Upload } from "@element-plus/icons-vue";
|
||||
import CreateStoreDialog from "./CreateStoreDialog/CreateStoreDialog.vue";
|
||||
import axioshooks from '@services/axioshooks.js'
|
||||
|
||||
const tags = ref([
|
||||
{ type: "primary", label: "Tag 1" },
|
||||
{ type: "primary", label: "Tag 1" },
|
||||
{ type: "primary", label: "Tag 1" },
|
||||
]);
|
||||
import {
|
||||
save_shop,
|
||||
list_shop,
|
||||
upload,
|
||||
update_shop,
|
||||
delById,
|
||||
} from "@/api/xyshop";
|
||||
import { useRoute } from "vue-router";
|
||||
import { ElMessage } from "element-plus";
|
||||
const route = useRoute();
|
||||
const CreateStoreDialogVisible = ref(route.query.CreateStoreDialogVisible);
|
||||
const get_win_width = computed(() => {
|
||||
const xl = window.innerWidth > 1920 ? 4 : 6;
|
||||
return xl;
|
||||
});
|
||||
const buttonGroup = ref([
|
||||
{
|
||||
type: "primary",
|
||||
label: "编辑",
|
||||
icon: Edit,
|
||||
handler: (item) => {
|
||||
operation("edit", item);
|
||||
CreateStore.CreateStoreTitle = "编辑店铺";
|
||||
CreateStore.editText = "编辑";
|
||||
CreateStore.CreateStoreDialogVisible = true;
|
||||
CreateStore.ruleForm = {
|
||||
id: item.id,
|
||||
xyName: item.xyName,
|
||||
shopDescr: item.shopDescr,
|
||||
};
|
||||
CreateStore.ruleFormList.find(
|
||||
(e) => e.type == "UploadImage"
|
||||
).fileImgList = [{ url: item.lcon }];
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -113,164 +133,138 @@ const buttonGroup = ref([
|
|||
label: "删除",
|
||||
icon: Delete,
|
||||
handler: (item) => {
|
||||
operation("delete", item);
|
||||
delById(item.id).then((res) => {
|
||||
if (res.code == "200") {
|
||||
get_list_shop();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
]);
|
||||
const descriptions = ref([
|
||||
{ label: "闲鱼号:" },
|
||||
{ label: "昵称:" },
|
||||
{ label: "授权:", cssName: "active" },
|
||||
{ label: "备注:" },
|
||||
]);
|
||||
|
||||
const CreateStore = reactive({
|
||||
ruleForm: {
|
||||
class_id: "23",
|
||||
business_line: [
|
||||
{
|
||||
abl_id: "",
|
||||
customer_id: "",
|
||||
},
|
||||
],
|
||||
account: "",
|
||||
quality_inspector: "",
|
||||
contact_name: "",
|
||||
inspection_signature: "",
|
||||
inspection_avatar: "",
|
||||
inspection_position: "",
|
||||
inspection_positions: [],
|
||||
xyName: "",
|
||||
shopDescr: "",
|
||||
lcon: "",
|
||||
},
|
||||
ruleFormList: [
|
||||
{
|
||||
type: "el-input",
|
||||
label: "账号名称",
|
||||
params: "account",
|
||||
prop: "account",
|
||||
label: "店铺名称",
|
||||
params: "xyName",
|
||||
prop: "xyName",
|
||||
clearable: true,
|
||||
placeholder: "请输入账号名称",
|
||||
},
|
||||
{
|
||||
type: "el-input",
|
||||
label: "质检师签名",
|
||||
params: "inspection_signature",
|
||||
prop: "inspection_signature",
|
||||
clearable: true,
|
||||
placeholder: "请输入质检师签名",
|
||||
},
|
||||
{
|
||||
type: "el-input",
|
||||
label: "质检师职位",
|
||||
params: "inspection_position",
|
||||
prop: "inspection_position",
|
||||
clearable: true,
|
||||
placeholder: "请输入质检师职位",
|
||||
placeholder: "请输入店铺名称",
|
||||
},
|
||||
{
|
||||
type: "UploadImage",
|
||||
label: "质检师头像",
|
||||
label: "店铺图片",
|
||||
params: "inspection_avatar",
|
||||
// prop: "inspection_avatar",
|
||||
limit: 1,
|
||||
multiple: true,
|
||||
fileImgList: [],
|
||||
handler: (file,filelist) => {
|
||||
console.log(file,filelist,"file,filelist");
|
||||
return
|
||||
CreateStore.ruleFormList.find(
|
||||
(e) => e.label === "质检师头像"
|
||||
).fileImgList = files;
|
||||
CreateStore.ruleForm.inspection_avatar = files;
|
||||
onSuccessFiles: (files) => {
|
||||
upload({ file: files.raw }).then((res) => {
|
||||
if (res.code === "200") {
|
||||
CreateStore.ruleForm.lcon = res.data;
|
||||
ElMessage.success("上传成功");
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "el-select",
|
||||
label: "城市",
|
||||
params: "",
|
||||
prop: "",
|
||||
clearable: true,
|
||||
placeholder: "请选择城市",
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
type: "el-select",
|
||||
label: "商品业务模式",
|
||||
params: "",
|
||||
prop: "",
|
||||
clearable: true,
|
||||
placeholder: "请选择闲鱼商品业务模式",
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
type: "el-checkbox-group",
|
||||
label: "保障服务",
|
||||
params: "inspection_positions",
|
||||
prop: "",
|
||||
clearable: true,
|
||||
placeholder: "请选择保障服务",
|
||||
options: [
|
||||
{
|
||||
label: "闲鱼-是否支持七天无理由",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
label: "闲鱼-是否支持描述不符包邮退",
|
||||
value: "2",
|
||||
},
|
||||
{
|
||||
label: "闲鱼-是否支持 极速发货-24小时",
|
||||
value: "3",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "el-input",
|
||||
label: "备注",
|
||||
params: "",
|
||||
prop: "",
|
||||
params: "shopDescr",
|
||||
prop: "shopDescr",
|
||||
clearable: true,
|
||||
placeholder: "请输入备注",
|
||||
},
|
||||
],
|
||||
rules: {
|
||||
account: [{ trigger: "blur", required: true, message: "请输入内容" }],
|
||||
|
||||
inspection_signature: [
|
||||
{ trigger: "change", required: true, message: "请输入质检师签名" },
|
||||
],
|
||||
inspection_avatar: [
|
||||
{
|
||||
validator: "",
|
||||
required: true,
|
||||
message: "请上传质检师头像",
|
||||
},
|
||||
],
|
||||
inspection_position: [
|
||||
{ trigger: "change", required: true, message: "请输入质检师职位" },
|
||||
],
|
||||
account: [{ trigger: "change", required: true, message: "请输入95分账号" }],
|
||||
contact_name: [
|
||||
{ trigger: "change", required: true, message: "请输入联系人" },
|
||||
],
|
||||
xyName: [{ trigger: "blur", required: true, message: "请输入店铺名称" }],
|
||||
},
|
||||
CreateStoreDialogVisible: false,
|
||||
CreateStoreTitle: "",
|
||||
editText: "",
|
||||
});
|
||||
|
||||
const operation = (status, item) => {
|
||||
if (status === "create") {
|
||||
CreateStore.CreateStoreTitle = "创建店铺";
|
||||
CreateStore.editText = "授权店铺";
|
||||
CreateStore.ruleForm = {
|
||||
xyName: "",
|
||||
shopDescr: "",
|
||||
lcon: "",
|
||||
};
|
||||
CreateStore.ruleFormList.find((e) => e.type == "UploadImage").fileImgList =
|
||||
[];
|
||||
CreateStore.CreateStoreDialogVisible = true;
|
||||
} else if (status === "edit") {
|
||||
console.log(status, item, "pkpkpkppkp");
|
||||
} else {
|
||||
console.log("删除", item, "pkpkpkppkp");
|
||||
} else if (status === "publish") {
|
||||
router.push({
|
||||
path: "/NewlyBuiltGoods",
|
||||
});
|
||||
}
|
||||
};
|
||||
const CreateStoreClose = () => {
|
||||
CreateStore.CreateStoreDialogVisible = false;
|
||||
};
|
||||
const submitForm = () => {
|
||||
console.log(CreateStore.ruleForm.account, "ruleFormruleForm");
|
||||
if (CreateStore.editText == "授权店铺") {
|
||||
save_shop(CreateStore.ruleForm).then((res) => {
|
||||
if (res.code === "200") {
|
||||
window.open(res.data);
|
||||
get_list_shop();
|
||||
CreateStoreClose();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
update_shop(CreateStore.ruleForm).then((res) => {
|
||||
if (res.code === "200") {
|
||||
get_list_shop();
|
||||
CreateStoreClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const store_list = ref({});
|
||||
//获取店铺列表
|
||||
const get_list_shop = () => {
|
||||
list_shop().then((res) => {
|
||||
if (res.code === "200") {
|
||||
store_list.value = res.data;
|
||||
res.data.forEach((item) => {
|
||||
item.descriptions = [
|
||||
{ label: "闲鱼号:", value: item.xyAccount },
|
||||
{ label: "昵称:", value: item.xyName },
|
||||
{
|
||||
label: "授权:",
|
||||
cssName: "active",
|
||||
value:
|
||||
Math.ceil(
|
||||
(new Date(item.expireTime) - new Date()) / (1000 * 60 * 60 * 24)
|
||||
) + "天",
|
||||
},
|
||||
{ label: "备注:", value: item.shopDescr },
|
||||
];
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
CreateStore.CreateStoreDialogVisible = route.query.CreateStoreDialogVisible;
|
||||
get_list_shop();
|
||||
});
|
||||
watch(
|
||||
() => route.query.CreateStoreDialogVisible,
|
||||
(val) => {
|
||||
if (val) {
|
||||
CreateStore.CreateStoreDialogVisible = CreateStoreDialogVisible;
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
|
|
|
@ -50,21 +50,21 @@ export default defineConfig((command, mode) => {
|
|||
errors: true,
|
||||
},
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
//这里是公共部分,在调用接口时后面接不相同的部分
|
||||
target: process.env.VUE_APP_BASE_API, //修改后台接口地址
|
||||
changeOrigin: true, //开启跨域
|
||||
pathRewrite: {
|
||||
//重命名
|
||||
["^" + process.env.VUE_APP_BASE_API]: "",
|
||||
},
|
||||
},
|
||||
'^/api': {
|
||||
target: 'http://dev-erp-api.xtkj99.com:7890',
|
||||
changeOrigin: true
|
||||
}
|
||||
},
|
||||
// proxy: {
|
||||
// [process.env.VUE_APP_BASE_API]: {
|
||||
// //这里是公共部分,在调用接口时后面接不相同的部分
|
||||
// target: process.env.VUE_APP_BASE_API, //修改后台接口地址
|
||||
// // changeOrigin: true, //开启跨域
|
||||
// pathRewrite: {
|
||||
// //重命名
|
||||
// ["^" + process.env.VUE_APP_BASE_API]: "",
|
||||
// },
|
||||
// },
|
||||
// '^/api': {
|
||||
// target: 'http://dev-erp-api.xtkj99.com:7890',
|
||||
// changeOrigin: true
|
||||
// }
|
||||
// },
|
||||
disableHostCheck: true,
|
||||
},
|
||||
resolve: {
|
||||
|
|
Loading…
Reference in New Issue