feat 区分中国coach和coach outlet
This commit is contained in:
parent
1bf55e3308
commit
4561319933
9
src/api/cn-coach-spider.js
Normal file
9
src/api/cn-coach-spider.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import {mande} from "mande";
|
||||||
|
|
||||||
|
const cnCoachSpider = mande('/api/v1/spider/cn/coach')
|
||||||
|
|
||||||
|
export const GetCNCoachSpiderGlobalCalculate = ()=> cnCoachSpider.get("global/calculate")
|
||||||
|
export const DeleteCNCoachSpiderGlobalCalculate = (id)=> cnCoachSpider.delete(`global/calculate/u/${id}`)
|
||||||
|
export const SaveCNCoachSpiderGlobalCalculate = (data)=> cnCoachSpider.post("global/calculate",data)
|
||||||
|
export const DeleteCNCoachSpiderCalculate = (id)=> cnCoachSpider.delete(`calculate/u/${id}`)
|
||||||
|
export const SaveCNCoachSpiderCalculate = (data)=> cnCoachSpider.post("calculate",data)
|
@ -1,7 +1,8 @@
|
|||||||
export const WEBSITES = {
|
export const WEBSITES = {
|
||||||
UNKNOWN: 0,
|
UNKNOWN: 0,
|
||||||
US_COACH_OUTLET: 1,
|
US_COACH_OUTLET: 1,
|
||||||
CN_COACH: 2
|
CN_COACH_OUTLET: 2,
|
||||||
|
CN_COACH: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WEBSITE_OPTIONS = [
|
export const WEBSITE_OPTIONS = [
|
||||||
@ -16,5 +17,9 @@ export const WEBSITE_OPTIONS = [
|
|||||||
{
|
{
|
||||||
label: '中国coach',
|
label: '中国coach',
|
||||||
value: WEBSITES.CN_COACH
|
value: WEBSITES.CN_COACH
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '中国coach outlet',
|
||||||
|
value: WEBSITES.CN_COACH_OUTLET
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -20,6 +20,11 @@ const routes = [
|
|||||||
name: 'cn-coach',
|
name: 'cn-coach',
|
||||||
component: ()=>import('@/views/Product/CNCoachOutlet.vue')
|
component: ()=>import('@/views/Product/CNCoachOutlet.vue')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/cn-coach-outlet',
|
||||||
|
name: 'cn-coach-outlet',
|
||||||
|
component: ()=>import('@/views/Product/CNCoachOutlet.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/pusher',
|
path: '/pusher',
|
||||||
name: 'pusher',
|
name: 'pusher',
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<div class="h-full m-4 bg-white rounded-2 shadow-lg p-8 flex flex-col justify-between space-y-4 overscroll-auto">
|
<div class="h-full m-4 bg-white rounded-2 shadow-lg p-8 flex flex-col justify-between space-y-4 overscroll-auto">
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<div class="flex items-center space-x-16">
|
<div class="flex items-center space-x-16">
|
||||||
|
<a-button type="primary" @click="globalCalculateVisible=true">查看优惠设置</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex space-x-4">
|
<div class="flex space-x-4">
|
||||||
<a-input placeholder="请输入关键词" v-model:value="query.keyword" @pressEnter="search"></a-input>
|
<a-input placeholder="请输入关键词" v-model:value="query.keyword" @pressEnter="search"></a-input>
|
||||||
@ -19,9 +20,9 @@
|
|||||||
<template v-else-if="column.key === 'updatedAt'">
|
<template v-else-if="column.key === 'updatedAt'">
|
||||||
<span>{{moment(record.updatedAt).format('YYYY-MM-DD HH:mm:ss')}}</span>
|
<span>{{moment(record.updatedAt).format('YYYY-MM-DD HH:mm:ss')}}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'cnyPrice'">
|
<template v-else-if="column.key === 'originalPrice'">
|
||||||
<div class="flex space items-center">
|
<div class="flex space items-center">
|
||||||
<span >{{record.cnyPrice}}</span>
|
<span >{{record.originalPrice}}</span>
|
||||||
<CaretUpOutlined class="text-red" v-if="record.priceStatus === PRICE_STATUS.UP"/>
|
<CaretUpOutlined class="text-red" v-if="record.priceStatus === PRICE_STATUS.UP"/>
|
||||||
<CaretDownOutlined class="text-green" v-if="record.priceStatus === PRICE_STATUS.DOWN"/>
|
<CaretDownOutlined class="text-green" v-if="record.priceStatus === PRICE_STATUS.DOWN"/>
|
||||||
</div>
|
</div>
|
||||||
@ -43,6 +44,14 @@
|
|||||||
:src="record.image"
|
:src="record.image"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="column.key === 'cnyPrice'">
|
||||||
|
<a-popover >
|
||||||
|
<template #content>
|
||||||
|
<div class="whitespace-pre">{{record.calMark}}</div>
|
||||||
|
</template>
|
||||||
|
<span class="cursor-pointer">{{parseFloat(record.cnyPrice).toFixed(2)}}</span>
|
||||||
|
</a-popover>
|
||||||
|
</template>
|
||||||
<template v-else-if="column.key === 'orderable'">
|
<template v-else-if="column.key === 'orderable'">
|
||||||
<span :class="[record.orderable ? '':'text-red']">{{record.orderable?'是':'否'}}</span>
|
<span :class="[record.orderable ? '':'text-red']">{{record.orderable?'是':'否'}}</span>
|
||||||
</template>
|
</template>
|
||||||
@ -54,8 +63,13 @@
|
|||||||
<!-- <FormOutlined v-else class="cursor-pointer" @click="onEdit(record, 'dwPrice')"/>-->
|
<!-- <FormOutlined v-else class="cursor-pointer" @click="onEdit(record, 'dwPrice')"/>-->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'link'">
|
<template v-else-if="column.key === 'opt'">
|
||||||
<a :href="`https://www.coach.com.cn/products/${record.pid}`" target="_blank">跳转</a>
|
<a-popover title="" placement="bottom">
|
||||||
|
<template #content>
|
||||||
|
<a-button type="text" block @click="showCalculateModal(record)">查看优惠</a-button>
|
||||||
|
</template>
|
||||||
|
<SettingOutlined class="cursor-pointer" />
|
||||||
|
</a-popover>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -65,7 +79,7 @@
|
|||||||
<div class="text-xl">历史价格</div>
|
<div class="text-xl">历史价格</div>
|
||||||
<div class="flex space-x-16 my-2 text-lg" v-for="h in record.historyPrices">
|
<div class="flex space-x-16 my-2 text-lg" v-for="h in record.historyPrices">
|
||||||
<div>{{moment(h.createdAt).format('YYYY-MM-DD HH:mm:ss')}}</div>
|
<div>{{moment(h.createdAt).format('YYYY-MM-DD HH:mm:ss')}}</div>
|
||||||
<div>¥{{h.usPrice}}</div>
|
<div>¥{{h.originalPrice}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xl mt-4">得物价格(CNY)</div>
|
<div class="text-xl mt-4">得物价格(CNY)</div>
|
||||||
<div v-if="record.dwHistoryPrices?.length>0" class="flex space-x-16 my-2 text-lg" v-for="h in record.dwHistoryPrices">
|
<div v-if="record.dwHistoryPrices?.length>0" class="flex space-x-16 my-2 text-lg" v-for="h in record.dwHistoryPrices">
|
||||||
@ -81,19 +95,61 @@
|
|||||||
</div>
|
</div>
|
||||||
<a-pagination :disabled="loading" class="text-right" v-model:current="query.page" v-model:page-size="query.size" :total="data.total" show-less-items @change="list"/>
|
<a-pagination :disabled="loading" class="text-right" v-model:current="query.page" v-model:page-size="query.size" :total="data.total" show-less-items @change="list"/>
|
||||||
</div>
|
</div>
|
||||||
|
<Calculate v-model:visible="globalCalculateVisible"
|
||||||
|
:getter="route.name === 'cn-coach' ? GetCNCoachSpiderGlobalCalculate:GetCNCoachOutletSpiderGlobalCalculate"
|
||||||
|
:add="()=>{return {Condition:'', Name:'',Pid: route.name === 'cn-coach'?'cn-coach':'cn-coach-outlet',Process:'' }}"
|
||||||
|
:del="route.name === 'cn-coach' ? DeleteCNCoachSpiderGlobalCalculate:DeleteCNCoachOutletSpiderGlobalCalculate"
|
||||||
|
:save="route.name === 'cn-coach' ? SaveCNCoachSpiderGlobalCalculate: SaveCNCoachOutletSpiderGlobalCalculate"
|
||||||
|
@ok="list"
|
||||||
|
></Calculate>
|
||||||
|
<Calculate v-model:visible="calculateModal.visible"
|
||||||
|
:getter="calculateModal.getter"
|
||||||
|
:add="calculateModal.add"
|
||||||
|
:del="calculateModal.del"
|
||||||
|
:save="calculateModal.save"
|
||||||
|
@ok="list"
|
||||||
|
></Calculate>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
import {computed, h, onMounted, reactive, ref} from "vue";
|
import {computed, h, onMounted, reactive, ref, watch} from "vue";
|
||||||
import {GetProduct, ListProducts, UpdateProduct} from "@/api/product.js";
|
import {GetProduct, ListProducts, UpdateProduct} from "@/api/product.js";
|
||||||
import moment from "moment/moment.js";
|
import moment from "moment/moment.js";
|
||||||
import { clone } from 'radash'
|
import { clone } from 'radash'
|
||||||
import {LoadingOutlined, SaveOutlined,CaretUpOutlined,CaretDownOutlined} from "@ant-design/icons-vue";
|
import {
|
||||||
|
LoadingOutlined,
|
||||||
|
SaveOutlined,
|
||||||
|
CaretUpOutlined,
|
||||||
|
CaretDownOutlined,
|
||||||
|
FormOutlined,
|
||||||
|
SettingOutlined
|
||||||
|
} from "@ant-design/icons-vue";
|
||||||
import {message} from "ant-design-vue";
|
import {message} from "ant-design-vue";
|
||||||
import {WEBSITES} from "@/constants/website.js";
|
import {WEBSITES} from "@/constants/website.js";
|
||||||
|
import {useRoute} from "vue-router";
|
||||||
|
import {
|
||||||
|
DeleteUSCoachOutletSpiderCalculate,
|
||||||
|
DeleteUSCoachOutletSpiderGlobalCalculate,
|
||||||
|
GetUSCoachOutletSpiderGlobalCalculate, SaveUSCoachOutletSpiderCalculate, SaveUSCoachOutletSpiderGlobalCalculate
|
||||||
|
} from "@/api/us-coach-outlet-spider.js";
|
||||||
|
import Calculate from "@/views/Product/Calculate.vue";
|
||||||
|
import {
|
||||||
|
DeleteCNCoachSpiderCalculate, DeleteCNCoachSpiderGlobalCalculate,
|
||||||
|
GetCNCoachSpiderGlobalCalculate,
|
||||||
|
SaveCNCoachSpiderCalculate, SaveCNCoachSpiderGlobalCalculate
|
||||||
|
} from "@/api/cn-coach-spider.js";
|
||||||
|
import {
|
||||||
|
DeleteCNCoachOutletSpiderCalculate, DeleteCNCoachOutletSpiderGlobalCalculate,
|
||||||
|
GetCNCoachOutletSpiderGlobalCalculate,
|
||||||
|
SaveCNCoachOutletSpiderCalculate, SaveCNCoachOutletSpiderGlobalCalculate
|
||||||
|
} from "@/api/cn-coach-outlet-spider.js";
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
list()
|
list()
|
||||||
|
watch(()=>route.name,loadShopType)
|
||||||
})
|
})
|
||||||
|
|
||||||
const query = reactive({
|
const query = reactive({
|
||||||
@ -106,6 +162,15 @@ const query = reactive({
|
|||||||
website: WEBSITES.CN_COACH
|
website: WEBSITES.CN_COACH
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const loadShopType = ()=>{
|
||||||
|
if (route.name === 'cn-coach'){
|
||||||
|
query.website = WEBSITES.CN_COACH
|
||||||
|
}else{
|
||||||
|
query.website = WEBSITES.CN_COACH_OUTLET
|
||||||
|
}
|
||||||
|
list()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
@ -147,6 +212,11 @@ const columns = computed(()=>[
|
|||||||
dataIndex: 'image',
|
dataIndex: 'image',
|
||||||
key: 'image',
|
key: 'image',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '价格(CNY)',
|
||||||
|
dataIndex: 'originalPrice',
|
||||||
|
key: 'originalPrice',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '成本(CNY)',
|
title: '成本(CNY)',
|
||||||
dataIndex: 'cnyPrice',
|
dataIndex: 'cnyPrice',
|
||||||
@ -200,9 +270,8 @@ const columns = computed(()=>[
|
|||||||
key: 'remark',
|
key: 'remark',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'coach链接',
|
title: '操作',
|
||||||
dataIndex: 'link',
|
key: 'opt',
|
||||||
key: 'link',
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -288,6 +357,33 @@ const expand = (expanded, record)=>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const globalCalculateVisible = ref(false)
|
||||||
|
const calculateModal = reactive({
|
||||||
|
visible : false,
|
||||||
|
getter: ()=>{},
|
||||||
|
add: ()=>{},
|
||||||
|
del: ()=>{},
|
||||||
|
save: ()=>{}
|
||||||
|
})
|
||||||
|
|
||||||
|
const showCalculateModal = (record)=>{
|
||||||
|
calculateModal.getter = ()=>{
|
||||||
|
return GetProduct(record.pid).then(res=>res.calculateProcess)
|
||||||
|
}
|
||||||
|
calculateModal.add = ()=>{
|
||||||
|
return {
|
||||||
|
Pid: record.pid,
|
||||||
|
website: route.name === 'cn-coach'?WEBSITES.CN_COACH:WEBSITES.CN_COACH_OUTLET,
|
||||||
|
Condition:'',
|
||||||
|
Name:'',
|
||||||
|
Process:''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
calculateModal.del = route.name === 'cn-coach'? DeleteCNCoachSpiderCalculate:DeleteCNCoachOutletSpiderCalculate
|
||||||
|
calculateModal.save = route.name === 'cn-coach' ? SaveCNCoachSpiderCalculate: SaveCNCoachOutletSpiderCalculate
|
||||||
|
calculateModal.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ const props = defineProps({
|
|||||||
default: ()=>{}
|
default: ()=>{}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['update:visible'])
|
const emit = defineEmits(['update:visible', 'ok'])
|
||||||
const open = computed({
|
const open = computed({
|
||||||
get() {
|
get() {
|
||||||
if(props.visible){
|
if(props.visible){
|
||||||
@ -107,6 +107,7 @@ const save = ()=>{
|
|||||||
props.save(modal.data.calculate).then(res=>{
|
props.save(modal.data.calculate).then(res=>{
|
||||||
open.value = false
|
open.value = false
|
||||||
message.success('保存成功')
|
message.success('保存成功')
|
||||||
|
emit('ok')
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
console.log(err)
|
console.log(err)
|
||||||
message.error('保存失败')
|
message.error('保存失败')
|
||||||
|
@ -139,14 +139,16 @@
|
|||||||
<Calculate v-model:visible="globalCalculateVisible"
|
<Calculate v-model:visible="globalCalculateVisible"
|
||||||
:getter="GetUSCoachOutletSpiderGlobalCalculate"
|
:getter="GetUSCoachOutletSpiderGlobalCalculate"
|
||||||
:add="()=>{return {Condition:'', Name:'',Pid:'us-coach-outlet',Process:'' }}"
|
:add="()=>{return {Condition:'', Name:'',Pid:'us-coach-outlet',Process:'' }}"
|
||||||
:del="DeleteCnCoachOutletSpiderGlobalCalculate"
|
:del="DeleteUSCoachOutletSpiderGlobalCalculate"
|
||||||
:save="SaveUSCoachOutletSpiderGlobalCalculate"
|
:save="SaveUSCoachOutletSpiderGlobalCalculate"
|
||||||
|
@ok="list"
|
||||||
></Calculate>
|
></Calculate>
|
||||||
<Calculate v-model:visible="calculateModal.visible"
|
<Calculate v-model:visible="calculateModal.visible"
|
||||||
:getter="calculateModal.getter"
|
:getter="calculateModal.getter"
|
||||||
:add="calculateModal.add"
|
:add="calculateModal.add"
|
||||||
:del="calculateModal.del"
|
:del="calculateModal.del"
|
||||||
:save="calculateModal.save"
|
:save="calculateModal.save"
|
||||||
|
@ok="list"
|
||||||
></Calculate>
|
></Calculate>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -159,12 +161,12 @@ import {LoadingOutlined, SaveOutlined,SettingOutlined,CaretUpOutlined,CaretDownO
|
|||||||
import {message, Modal} from "ant-design-vue";
|
import {message, Modal} from "ant-design-vue";
|
||||||
import {CreateWatcher} from "@/api/watcher.js";
|
import {CreateWatcher} from "@/api/watcher.js";
|
||||||
import {
|
import {
|
||||||
DeleteCnCoachOutletSpiderCalculate,
|
DeleteUSCoachOutletSpiderCalculate,
|
||||||
DeleteCnCoachOutletSpiderGlobalCalculate,
|
DeleteUSCoachOutletSpiderGlobalCalculate,
|
||||||
GetUSCoachOutletSpiderCfg,
|
GetUSCoachOutletSpiderCfg,
|
||||||
GetUSCoachOutletSpiderGlobalCalculate, SaveUSCoachOutletSpiderCalculate, SaveUSCoachOutletSpiderGlobalCalculate,
|
GetUSCoachOutletSpiderGlobalCalculate, SaveUSCoachOutletSpiderCalculate, SaveUSCoachOutletSpiderGlobalCalculate,
|
||||||
SetUSCoachOutletSpiderCfg
|
SetUSCoachOutletSpiderCfg
|
||||||
} from "@/api/cn-coach-outlet-spider.js";
|
} from "@/api/us-coach-outlet-spider.js";
|
||||||
import {WEBSITES} from "@/constants/website.js";
|
import {WEBSITES} from "@/constants/website.js";
|
||||||
import Calculate from "@/views/Product/Calculate.vue";
|
import Calculate from "@/views/Product/Calculate.vue";
|
||||||
|
|
||||||
@ -455,7 +457,7 @@ const showCalculateModal = (record)=>{
|
|||||||
Process:''
|
Process:''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
calculateModal.del = DeleteCnCoachOutletSpiderCalculate
|
calculateModal.del = DeleteUSCoachOutletSpiderCalculate
|
||||||
calculateModal.save = SaveUSCoachOutletSpiderCalculate
|
calculateModal.save = SaveUSCoachOutletSpiderCalculate
|
||||||
calculateModal.visible = true
|
calculateModal.visible = true
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,11 @@ const items = [
|
|||||||
label: '美国coach outlet',
|
label: '美国coach outlet',
|
||||||
title: '美国coach outlet',
|
title: '美国coach outlet',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'cn-coach-outlet',
|
||||||
|
label: '中国coach outlet',
|
||||||
|
title: '中国coach outlet',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'cn-coach',
|
key: 'cn-coach',
|
||||||
label: '中国coach',
|
label: '中国coach',
|
||||||
|
Loading…
Reference in New Issue
Block a user