优化pdd店铺商品
This commit is contained in:
parent
f65e05f725
commit
6bd8e383ba
|
|
@ -1,6 +1,15 @@
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询列表
|
// 查询列表
|
||||||
|
export function listGoods(query) {
|
||||||
|
return request({
|
||||||
|
url: '/api/open-api/pdd/goods/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询sku列表
|
||||||
export function listGoodsSku(query) {
|
export function listGoodsSku(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/open-api/pdd/goods/skuList',
|
url: '/api/open-api/pdd/goods/skuList',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,274 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
|
||||||
|
<el-form-item label="平台SkuId" prop="skuId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.skuId"
|
||||||
|
placeholder="请输入平台SkuId"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商家sku编码" prop="outerId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.outerId"
|
||||||
|
placeholder="请输入商家sku编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="ERP skuId" prop="erpSkuId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.erpSkuId"
|
||||||
|
placeholder="请输入ERP skuId"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="店铺" prop="shopId">
|
||||||
|
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
|
||||||
|
<el-option
|
||||||
|
v-for="item in shopList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
:loading="pullLoading"
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handlePull"
|
||||||
|
>API拉取商品数据</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="goodsList">
|
||||||
|
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||||
|
<!-- <el-table-column label="ID" align="center" prop="id" />-->
|
||||||
|
<el-table-column label="商品ID" align="center" prop="goodsId" />
|
||||||
|
<el-table-column label="Sku Id" align="center" prop="skuId" />
|
||||||
|
<el-table-column label="商品名" align="center" prop="goodsName" />
|
||||||
|
<el-table-column label="规格" align="center" prop="spec" />
|
||||||
|
<el-table-column label="图片" align="center" prop="logo" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<image-preview :src="scope.row.thumbUrl" :width="50" :height="50"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="店铺" align="center" prop="shopId" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="small">{{shopList.find(x=>x.id === scope.row.shopId).name}}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="商家编码" align="center" prop="outerId" />
|
||||||
|
<el-table-column label="ERP SKU ID" align="center" prop="erpGoodsSkuId" />
|
||||||
|
<el-table-column label="状态" align="center" prop="isSkuOnsale" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="small" v-if="scope.row.isSkuOnsale === 1">上架中</el-tag>
|
||||||
|
<el-tag size="small" v-if="scope.row.isSkuOnsale === 0">已下架</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleLink(scope.row)"
|
||||||
|
>关联ERP</el-button>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 添加或修改商品管理对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<el-form-item label="ERP商品SkuId" prop="erpGoodsSkuId">
|
||||||
|
<el-input v-model.number="form.erpGoodsSkuId" placeholder="请输入ERP商品SkuId" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
|
||||||
|
import {listShop} from "@/api/shop/shop";
|
||||||
|
import {listGoods,pullGoodsList,getGoodsSku,linkErpGoodsSkuId} from "@/api/pdd/goods";
|
||||||
|
|
||||||
|
import {MessageBox} from "element-ui";
|
||||||
|
import {isRelogin} from "@/utils/request";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "GoodsListPdd",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
pullLoading: false,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 商品管理表格数据
|
||||||
|
goodsList: [],
|
||||||
|
shopList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
supplierList: [],
|
||||||
|
categoryList: [],
|
||||||
|
categoryTree: [],
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
erpGoodsSkuId: [
|
||||||
|
{ required: true, message: "不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
listShop({type:300}).then(response => {
|
||||||
|
this.shopList = response.rows;
|
||||||
|
if (this.shopList && this.shopList.length > 0) {
|
||||||
|
this.queryParams.shopId = this.shopList[0].id
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
// this.getList();
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询商品管理列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listGoods(this.queryParams).then(response => {
|
||||||
|
this.goodsList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
erpSkuId: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
handleLink(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getGoodsSku(id).then(response => {
|
||||||
|
console.log('=====00000000============',response)
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
linkErpGoodsSkuId(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("关联成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handlePull() {
|
||||||
|
if(this.queryParams.shopId){
|
||||||
|
this.pullLoading = true
|
||||||
|
pullGoodsList({shopId:this.queryParams.shopId}).then(response => {
|
||||||
|
console.log('拉取PDD商品接口返回=====',response)
|
||||||
|
if(response.code === 1401) {
|
||||||
|
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||||
|
this.$router.push({path:"/shop/shop_list",query:{platform:5}})
|
||||||
|
// isRelogin.show = false;
|
||||||
|
// store.dispatch('LogOut').then(() => {
|
||||||
|
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||||
|
// })
|
||||||
|
}).catch(() => {
|
||||||
|
isRelogin.show = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
|
}else{
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess(JSON.stringify(response));
|
||||||
|
}
|
||||||
|
this.pullLoading = false
|
||||||
|
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.$modal.msgSuccess("请先选择店铺");
|
||||||
|
}
|
||||||
|
|
||||||
|
// this.$modal.msgSuccess("请先配置API");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,274 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
|
||||||
|
<el-form-item label="平台SkuId" prop="skuId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.skuId"
|
||||||
|
placeholder="请输入平台SkuId"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商家sku编码" prop="outerId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.outerId"
|
||||||
|
placeholder="请输入商家sku编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="ERP skuId" prop="erpSkuId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.erpSkuId"
|
||||||
|
placeholder="请输入ERP skuId"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="店铺" prop="shopId">
|
||||||
|
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
|
||||||
|
<el-option
|
||||||
|
v-for="item in shopList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
:loading="pullLoading"
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handlePull"
|
||||||
|
>API拉取商品数据</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="goodsList">
|
||||||
|
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||||
|
<!-- <el-table-column label="ID" align="center" prop="id" />-->
|
||||||
|
<el-table-column label="商品ID" align="center" prop="goodsId" />
|
||||||
|
<el-table-column label="Sku Id" align="center" prop="skuId" />
|
||||||
|
<el-table-column label="商品名" align="center" prop="goodsName" />
|
||||||
|
<el-table-column label="规格" align="center" prop="spec" />
|
||||||
|
<el-table-column label="图片" align="center" prop="logo" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<image-preview :src="scope.row.thumbUrl" :width="50" :height="50"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="店铺" align="center" prop="shopId" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="small">{{shopList.find(x=>x.id === scope.row.shopId).name}}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="商家编码" align="center" prop="outerId" />
|
||||||
|
<el-table-column label="ERP SKU ID" align="center" prop="erpGoodsSkuId" />
|
||||||
|
<el-table-column label="状态" align="center" prop="isSkuOnsale" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="small" v-if="scope.row.isSkuOnsale === 1">上架中</el-tag>
|
||||||
|
<el-tag size="small" v-if="scope.row.isSkuOnsale === 0">已下架</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleLink(scope.row)"
|
||||||
|
>关联ERP</el-button>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 添加或修改商品管理对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<el-form-item label="ERP商品SkuId" prop="erpGoodsSkuId">
|
||||||
|
<el-input v-model.number="form.erpGoodsSkuId" placeholder="请输入ERP商品SkuId" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
|
||||||
|
import {listShop} from "@/api/shop/shop";
|
||||||
|
import {listGoodsSku,pullGoodsList,getGoodsSku,linkErpGoodsSkuId} from "@/api/pdd/goods";
|
||||||
|
|
||||||
|
import {MessageBox} from "element-ui";
|
||||||
|
import {isRelogin} from "@/utils/request";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "GoodsSkuPdd",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
pullLoading: false,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 商品管理表格数据
|
||||||
|
goodsList: [],
|
||||||
|
shopList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
supplierList: [],
|
||||||
|
categoryList: [],
|
||||||
|
categoryTree: [],
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
erpGoodsSkuId: [
|
||||||
|
{ required: true, message: "不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
listShop({type:300}).then(response => {
|
||||||
|
this.shopList = response.rows;
|
||||||
|
if (this.shopList && this.shopList.length > 0) {
|
||||||
|
this.queryParams.shopId = this.shopList[0].id
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
// this.getList();
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询商品管理列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listGoodsSku(this.queryParams).then(response => {
|
||||||
|
this.goodsList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
erpSkuId: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
handleLink(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getGoodsSku(id).then(response => {
|
||||||
|
console.log('=====00000000============',response)
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
linkErpGoodsSkuId(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("关联成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handlePull() {
|
||||||
|
if(this.queryParams.shopId){
|
||||||
|
this.pullLoading = true
|
||||||
|
pullGoodsList({shopId:this.queryParams.shopId}).then(response => {
|
||||||
|
console.log('拉取PDD商品接口返回=====',response)
|
||||||
|
if(response.code === 1401) {
|
||||||
|
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||||
|
this.$router.push({path:"/shop/shop_list",query:{platform:5}})
|
||||||
|
// isRelogin.show = false;
|
||||||
|
// store.dispatch('LogOut').then(() => {
|
||||||
|
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||||
|
// })
|
||||||
|
}).catch(() => {
|
||||||
|
isRelogin.show = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
|
}else{
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess(JSON.stringify(response));
|
||||||
|
}
|
||||||
|
this.pullLoading = false
|
||||||
|
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.$modal.msgSuccess("请先选择店铺");
|
||||||
|
}
|
||||||
|
|
||||||
|
// this.$modal.msgSuccess("请先配置API");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -1,273 +1,41 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
|
<el-tabs v-model="activeName" @tab-click="handleClick" type="border-card">
|
||||||
<el-form-item label="平台SkuId" prop="skuId">
|
<el-tab-pane label="店铺商品" name="LogisticsCompany" >
|
||||||
<el-input
|
<goods-list-pdd></goods-list-pdd>
|
||||||
v-model="queryParams.skuId"
|
</el-tab-pane>
|
||||||
placeholder="请输入平台SkuId"
|
<el-tab-pane label="店铺商品SKU" name="EwaybillAccount" lazy>
|
||||||
clearable
|
<goods-sku-pdd></goods-sku-pdd>
|
||||||
@keyup.enter.native="handleQuery"
|
</el-tab-pane>
|
||||||
/>
|
</el-tabs>
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="商家sku编码" prop="outerId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.outerId"
|
|
||||||
placeholder="请输入商家sku编码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="ERP skuId" prop="erpSkuId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.erpSkuId"
|
|
||||||
placeholder="请输入ERP skuId"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="店铺" prop="shopId">
|
|
||||||
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
|
|
||||||
<el-option
|
|
||||||
v-for="item in shopList"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
:loading="pullLoading"
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handlePull"
|
|
||||||
>API拉取商品数据</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="goodsList">
|
|
||||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
|
||||||
<!-- <el-table-column label="ID" align="center" prop="id" />-->
|
|
||||||
<el-table-column label="商品ID" align="center" prop="goodsId" />
|
|
||||||
<el-table-column label="Sku Id" align="center" prop="skuId" />
|
|
||||||
<el-table-column label="商品名" align="center" prop="goodsName" />
|
|
||||||
<el-table-column label="规格" align="center" prop="spec" />
|
|
||||||
<el-table-column label="图片" align="center" prop="logo" width="100">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<image-preview :src="scope.row.thumbUrl" :width="50" :height="50"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="店铺" align="center" prop="shopId" >
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag size="small">{{shopList.find(x=>x.id === scope.row.shopId).name}}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="商家编码" align="center" prop="outerId" />
|
|
||||||
<el-table-column label="ERP SKU ID" align="center" prop="erpGoodsSkuId" />
|
|
||||||
<el-table-column label="状态" align="center" prop="isSkuOnsale" >
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag size="small" v-if="scope.row.isSkuOnsale === 1">上架中</el-tag>
|
|
||||||
<el-tag size="small" v-if="scope.row.isSkuOnsale === 0">已下架</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
@click="handleLink(scope.row)"
|
|
||||||
>关联ERP</el-button>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 添加或修改商品管理对话框 -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
||||||
<el-form-item label="ERP商品SkuId" prop="erpGoodsSkuId">
|
|
||||||
<el-input v-model.number="form.erpGoodsSkuId" placeholder="请输入ERP商品SkuId" />
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
import GoodsListPdd from "@/views/pdd/goods/goods_list.vue";
|
||||||
|
import GoodsSkuPdd from "@/views/pdd/goods/goods_sku.vue";
|
||||||
import {listShop} from "@/api/shop/shop";
|
|
||||||
import {listGoodsSku,pullGoodsList,getGoodsSku,linkErpGoodsSkuId} from "@/api/pdd/goods";
|
|
||||||
|
|
||||||
import {MessageBox} from "element-ui";
|
|
||||||
import {isRelogin} from "@/utils/request";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsPdd",
|
name: "GoodsPdd",
|
||||||
|
components:{
|
||||||
|
GoodsListPdd,GoodsSkuPdd
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
activeName: 'LogisticsCompany',
|
||||||
loading: true,
|
typeList: [],
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非单个禁用
|
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
pullLoading: false,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 商品管理表格数据
|
|
||||||
goodsList: [],
|
|
||||||
shopList: [],
|
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
name: null
|
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
supplierList: [],
|
|
||||||
categoryList: [],
|
|
||||||
categoryTree: [],
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
id: [
|
|
||||||
{ required: true, message: "不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
erpGoodsSkuId: [
|
|
||||||
{ required: true, message: "不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
listShop({type:300}).then(response => {
|
|
||||||
this.shopList = response.rows;
|
},
|
||||||
if (this.shopList && this.shopList.length > 0) {
|
mounted() {
|
||||||
this.queryParams.shopId = this.shopList[0].id
|
|
||||||
}
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
// this.getList();
|
|
||||||
this.loading = false;
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询商品管理列表 */
|
handleClick(tab, event) {
|
||||||
getList() {
|
console.log(tab, event);
|
||||||
this.loading = true;
|
|
||||||
listGoodsSku(this.queryParams).then(response => {
|
|
||||||
this.goodsList = response.rows;
|
|
||||||
this.total = response.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: null,
|
|
||||||
erpSkuId: null
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
handleLink(row) {
|
|
||||||
this.reset();
|
|
||||||
const id = row.id || this.ids
|
|
||||||
getGoodsSku(id).then(response => {
|
|
||||||
console.log('=====00000000============',response)
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
linkErpGoodsSkuId(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("关联成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handlePull() {
|
|
||||||
if(this.queryParams.shopId){
|
|
||||||
this.pullLoading = true
|
|
||||||
pullGoodsList({shopId:this.queryParams.shopId}).then(response => {
|
|
||||||
console.log('拉取PDD商品接口返回=====',response)
|
|
||||||
if(response.code === 1401) {
|
|
||||||
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
|
||||||
this.$router.push({path:"/shop/shop_list",query:{platform:5}})
|
|
||||||
// isRelogin.show = false;
|
|
||||||
// store.dispatch('LogOut').then(() => {
|
|
||||||
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
|
||||||
// })
|
|
||||||
}).catch(() => {
|
|
||||||
isRelogin.show = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
|
||||||
}else{
|
|
||||||
this.getList()
|
|
||||||
this.$modal.msgSuccess(JSON.stringify(response));
|
|
||||||
}
|
|
||||||
this.pullLoading = false
|
|
||||||
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
this.$modal.msgSuccess("请先选择店铺");
|
|
||||||
}
|
|
||||||
|
|
||||||
// this.$modal.msgSuccess("请先配置API");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ import {getGoodsSku, linkErpGoodsSkuId, listGoods, pullGoodsList,pushToOms} from
|
||||||
import {amountFormatter, parseTime} from "@/utils/zhijian";
|
import {amountFormatter, parseTime} from "@/utils/zhijian";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsTaoIndex",
|
name: "GoodsListTao",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
|
|
|
||||||
|
|
@ -2,24 +2,23 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-tabs v-model="activeName" @tab-click="handleClick" type="border-card">
|
<el-tabs v-model="activeName" @tab-click="handleClick" type="border-card">
|
||||||
<el-tab-pane label="店铺商品" name="LogisticsCompany" >
|
<el-tab-pane label="店铺商品" name="LogisticsCompany" >
|
||||||
<goods-tao-index></goods-tao-index>
|
<goods-list-tao></goods-list-tao>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="店铺商品SKU" name="EwaybillAccount" lazy>
|
<el-tab-pane label="店铺商品SKU" name="EwaybillAccount" lazy>
|
||||||
<goods-tao-sku></goods-tao-sku>
|
<goods-sku-tao></goods-sku-tao>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import GoodsTaoIndex from "@/views/tao/goods/goods_list.vue";
|
import GoodsListTao from "@/views/tao/goods/goods_list.vue";
|
||||||
import GoodsTaoSku from "@/views/tao/goods/sku_list.vue";
|
import GoodsSkuTao from "@/views/tao/goods/sku_list.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsTao",
|
name: "GoodsTao",
|
||||||
components:{
|
components:{
|
||||||
GoodsTaoIndex,GoodsTaoSku
|
GoodsListTao,GoodsSkuTao
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ import {MessageBox} from "element-ui";
|
||||||
import {getGoodsSku, linkErpGoodsSkuId, listGoodsSku, pullGoodsList} from "@/api/tao/goods";
|
import {getGoodsSku, linkErpGoodsSkuId, listGoodsSku, pullGoodsList} from "@/api/tao/goods";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsTaoSku",
|
name: "GoodsSkuTao",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue