Compare commits

..

No commits in common. "e89dbd6fa53c5ba1dc78bad5ae89b479aa94f8ec" and "f4e4ed20a818a10c429e5664ca34973fb7a4a9e0" have entirely different histories.

3 changed files with 9 additions and 56 deletions

View File

@ -2,6 +2,4 @@ import {mande} from "mande";
const spider = mande('/api/v1/spider')
export const GetSpiderCfg = ()=> spider.get("cfg")
export const SetSpiderCfg = (cfg)=> spider.post("cfg",cfg)
export const GetSpiderCfg = ()=> spider.get("cfg")

View File

@ -1,11 +1,9 @@
<template>
<template>
<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 items-center space-x-16">
<div>当前汇率<span class="text-xl">{{spiderCfg.exchangeRate}}</span></div>
<div>当前默认运费<span class="text-xl">{{spiderCfg.freight}}</span></div>
<div>当前折扣<span class="text-xl">{{spiderCfg.discount}}% </span></div>
<FormOutlined class="cursor-pointer" @click="editSpiderCfg"/>
</div>
<div class="flex space-x-4">
<a-input placeholder="请输入关键词" v-model:value="query.keyword" @pressEnter="search"></a-input>
@ -119,22 +117,6 @@
</a-form-item>
</a-form>
</a-modal>
<a-modal v-model:open="spiderCfgModal.visible" @ok="updateSpiderCfg" centered>
<template #title>
编辑
</template>
<a-form :model="spiderCfgModal.data" :labelCol="{span: 6}">
<a-form-item label="汇率">
<a-input-number v-model:value="spiderCfgModal.data.exchangeRate" :min="1" />
</a-form-item>
<a-form-item label="运费">
<a-input-number v-model:value="spiderCfgModal.data.freight" :min="1"/>
</a-form-item>
<a-form-item label="折扣">
<a-input-number addon-after="%" v-model:value="spiderCfgModal.data.discount" :min="1" :max="100"/>
</a-form-item>
</a-form>
</a-modal>
</template>
<script setup>
@ -142,10 +124,10 @@ import {computed, h, onMounted, reactive, ref} from "vue";
import {GetProduct, ListProducts, UpdateProduct} from "@/api/product.js";
import moment from "moment/moment.js";
import { clone } from 'radash'
import {LoadingOutlined, SaveOutlined,SettingOutlined,CaretUpOutlined,CaretDownOutlined, FormOutlined} from "@ant-design/icons-vue";
import {LoadingOutlined, SaveOutlined,SettingOutlined,CaretUpOutlined,CaretDownOutlined} from "@ant-design/icons-vue";
import {message, Modal} from "ant-design-vue";
import {CreateWatcher} from "@/api/watcher.js";
import {GetSpiderCfg, SetSpiderCfg} from "@/api/spider.js";
import {GetSpiderCfg} from "@/api/spider.js";
onMounted(()=>{
list()
@ -353,10 +335,9 @@ const PRICE_STATUS = {
DOWN: 2
}
const spiderCfg = ref({
const spiderCfg = ref({
exchangeRate: 0,
freight: 0,
discount: 100
freight: 0
})
const loadSpiderCfg = ()=>{
@ -386,32 +367,6 @@ const expand = (expanded, record)=>{
})
}
}
const spiderCfgModal = reactive({
data: {
exchangeRate: 0,
freight: 0,
discount: 100
},
visible: false,
})
const editSpiderCfg = ()=>{
spiderCfgModal.data = clone(spiderCfg.value)
spiderCfgModal.visible = true
}
const updateSpiderCfg = ()=>{
SetSpiderCfg(spiderCfgModal.data).then(res=>{
message.success('修改成功')
}).catch(err=>{
message.error('修改失败')
console.log(err)
}).finally(()=>{
spiderCfgModal.visible = false
loadSpiderCfg()
})
}
</script>

View File

@ -25,8 +25,8 @@
<span>{{moment(record.updatedAt).format('YYYY-MM-DD HH:mm:ss')}}</span>
</template>
<template v-else-if="column.key === 'pushers'">
<template v-if="record.pushers.length>0" v-for="pusher in record.pushers">
<a-tag :bordered="false" color="processing" >{{pusher.name}}</a-tag>
<template v-if="record.pushers.length>0" v-for="id in record.pushers">
<a-tag :bordered="false" color="processing" v-for="pusher in record.pushers">{{pusher.name}}</a-tag>
</template>
<span v-else>-</span>
</template>
@ -235,7 +235,7 @@ const columns = [
},
{
title: '推送',
key: 'pushers',
key: 'pusherIds',
},
{
title: '备注',