feat 供应商添加拉取库存
This commit is contained in:
parent
1f836ffbed
commit
225446f201
@ -42,6 +42,14 @@ export const FetchProviderArticles = (providerId)=>{
|
||||
return provider.post(`/${providerId}/pull`)
|
||||
}
|
||||
|
||||
export const FetchProviderArticle = (providerArticle)=>{
|
||||
return provider.post(`/${providerArticle.providerId}/fetch/${providerArticle.id}`)
|
||||
export const FetchProviderArticlePrice = (providerArticle)=>{
|
||||
return provider.post(`/${providerArticle.providerId}/price/fetch/${providerArticle.id}`)
|
||||
}
|
||||
|
||||
export const FetchProviderArticleAts = (providerArticle)=>{
|
||||
return provider.post(`/${providerArticle.providerId}/ats/fetch/${providerArticle.skuID}`)
|
||||
}
|
||||
|
||||
export const FetchProviderArticleDetail = (pid)=>{
|
||||
return provider.post(`/${providerArticle.providerId}/detail/fetch/${pid}`)
|
||||
}
|
@ -8,7 +8,9 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #header>
|
||||
<span class="text-lg">{{header}}</span>
|
||||
<div>
|
||||
<span class="text-lg">{{header}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="flex flex-col space-y-8">
|
||||
<div class="flex space-x-4 ">
|
||||
@ -22,17 +24,25 @@
|
||||
</div>
|
||||
<div class="flex space-x-4 items-center">
|
||||
<div class="w-full">当前售价:$ {{provider.cost.originalPrice || '-'}}</div>
|
||||
<a-popover v-if="provider.cost.calMark" trigger="hover">
|
||||
<template #content>
|
||||
|
||||
<div v-if="provider.cost.calMark" class="w-full flex items-center space-x-4">
|
||||
<a-popover trigger="hover">
|
||||
<template #content>
|
||||
<span class="whitespace-pre">
|
||||
{{provider.cost.calMark}}
|
||||
</span>
|
||||
</template>
|
||||
<div class="w-full">当前到手价:¥ {{provider.cost.finalPrice || '-'}}</div>
|
||||
</a-popover>
|
||||
<div class="w-full" v-else>当前到手价:¥ {{provider.cost.finalPrice || '-'}}</div>
|
||||
<div class="w-full">
|
||||
<a-button type="primary" @click="fetchArticle(provider)" :loading="fetchLoading">立即拉取</a-button>
|
||||
</template>
|
||||
<div>当前到手价:¥ {{provider.cost.finalPrice || '-'}}</div>
|
||||
</a-popover>
|
||||
<a-button type="primary" @click="fetchArticle(provider)" :loading="fetchLoading">拉取价格</a-button>
|
||||
</div>
|
||||
<div class="w-full flex items-center space-x-4" v-else>
|
||||
<div>当前到手价:¥ {{provider.cost.finalPrice || '-'}}</div>
|
||||
<a-button type="primary" @click="fetchArticle(provider)" :loading="fetchLoading">拉取价格</a-button>
|
||||
</div>
|
||||
<div class="w-full flex items-center space-x-4">
|
||||
<div>库存:{{provider.ast }}</div>
|
||||
<a-button type="primary" @click="fetchArticleAts(provider)" :loading="fetchLoading">拉取库存</a-button>
|
||||
</div>
|
||||
</div>
|
||||
<v-chart class="h-400px w-full" :option="options" />
|
||||
@ -112,7 +122,7 @@ import { use } from 'echarts/core'
|
||||
import { LineChart } from 'echarts/charts'
|
||||
import { GridComponent, TitleComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import {FetchProviderArticle} from "@/api/provider.js";
|
||||
import {FetchProviderArticleAts, FetchProviderArticlePrice} from "@/api/provider.js";
|
||||
|
||||
use([GridComponent, LineChart, CanvasRenderer, TitleComponent , TooltipComponent, LegendComponent ])
|
||||
|
||||
@ -156,7 +166,7 @@ const fetchLoading = ref(false)
|
||||
// 拉取单个商品价格
|
||||
const fetchArticle = (pArticle) => {
|
||||
fetchLoading.value = true
|
||||
FetchProviderArticle(pArticle).then(res=>{
|
||||
FetchProviderArticlePrice(pArticle).then(res=>{
|
||||
if(res.code !== 200){
|
||||
message.error(`拉取失败:${res.msg}`)
|
||||
}else {
|
||||
@ -167,8 +177,28 @@ const fetchArticle = (pArticle) => {
|
||||
console.log(err)
|
||||
}).finally(()=>{
|
||||
fetchLoading.value = false
|
||||
emits('fetched')
|
||||
})
|
||||
}
|
||||
|
||||
const fetchArticleAts = (pArticle) => {
|
||||
fetchLoading.value = true
|
||||
FetchProviderArticleAts(pArticle).then(res=>{
|
||||
if(res.code !== 200){
|
||||
message.error(`拉取失败:${res.msg}`)
|
||||
}else {
|
||||
message.success('拉取成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
message.error('拉取失败')
|
||||
console.log(err)
|
||||
}).finally(()=>{
|
||||
fetchLoading.value = false
|
||||
emits('fetched')
|
||||
})
|
||||
}
|
||||
|
||||
const emits = defineEmits(['fetched'])
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -8,4 +8,8 @@ html,body,#app {
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ant-collapse-header{
|
||||
align-items: center !important;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { createApp } from 'vue'
|
||||
import './css/base.css'
|
||||
import App from './App.vue'
|
||||
import './css/base.css'
|
||||
import 'virtual:uno.css'
|
||||
import router from "@/routers/index.js";
|
||||
|
||||
|
@ -51,7 +51,10 @@
|
||||
|
||||
</seller-article-panel>
|
||||
<provider-article-panel v-else-if="activeTabKey === 'providers'" v-for="item in data.providers || []" :key="`${item.providerId}`"
|
||||
:provider="item" :provider-dict="dict.providers" :open="openTabKey.indexOf(item.providerId) > -1">
|
||||
:provider="item" :provider-dict="dict.providers"
|
||||
:open="openTabKey.indexOf(item.providerId) > -1"
|
||||
@fetched="load"
|
||||
>
|
||||
|
||||
</provider-article-panel>
|
||||
</a-collapse>
|
||||
|
@ -35,36 +35,36 @@ export default defineConfig({
|
||||
ws: true,
|
||||
},
|
||||
'/api/v2/sellers': {
|
||||
target: 'http://localhost:8081/',
|
||||
// target: 'http://192.168.31.55:2280/',
|
||||
// target: 'http://localhost:8081/',
|
||||
target: 'https://ht.timerzz.com:20443/',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v2/seller': {
|
||||
target: 'http://localhost:8083/',
|
||||
// target: 'http://192.168.31.55:2280/',
|
||||
// target: 'http://localhost:8083/',
|
||||
target: 'https://ht.timerzz.com:20443/',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v2/providers': {
|
||||
target: 'http://localhost:8080/',
|
||||
// target: 'http://192.168.31.55:2280/',
|
||||
// target: 'https://ht.timerzz.com:20443/',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v2/provider': {
|
||||
target: 'http://172.21.195.130:8082/',
|
||||
// target: 'http://192.168.31.55:2280/',
|
||||
// target: 'https://ht.timerzz.com:20443/',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v2/articles': {
|
||||
// target: 'https://ht.timerzz.com:20443/',
|
||||
target: 'http://localhost:8085/',
|
||||
// target: 'http://192.168.31.55:2280/',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
|
Loading…
Reference in New Issue
Block a user