Skip to content

Commit

Permalink
feat: 下线红茶战争特殊逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximu-Luya committed Apr 17, 2024
1 parent e7331cb commit bde3e55
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion components/City.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const sortCitesByProfit = (
<TableCell>
<div class="flex flex-col items-start">
<NuxtLink :to="`/product/${city.name}/${product.name}`">{{ product.name }}</NuxtLink>
<span v-if="product.name=='红茶'" class="px-2 py-1 text-xs bg-rose-800 font-bold rounded-md mt-1 text-white">红茶战争</span>
<!-- <span v-if="product.name=='红茶'" class="px-2 py-1 text-xs bg-rose-800 font-bold rounded-md mt-1 text-white">红茶战争</span> -->
</div>
</TableCell>
<TableCell class="border-r">
Expand Down
4 changes: 2 additions & 2 deletions components/Price.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ const shortTime = computed(() => {
<p v-if="log.type === 'buy' && product.baseVolume">
<span class="font-bold mr-2">基础货量</span>
<span>{{ product.baseVolume }}</span>
<span v-if="product.name == '红茶'">
<!-- <span v-if="product.name == '红茶'">
(30 + <span class="text-rose-600">15</span>)
</span>
</span> -->
</p>
<p v-if="log.type === 'buy' && product.basePrice">
<span class="font-bold mr-2">基准价格</span>
Expand Down
10 changes: 5 additions & 5 deletions stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export const useSettingStore = defineStore('setting', () => {
// 买入价格不存在时,返回-9999
if (!sourceCityPrice) return -9999;
// 红茶战争活动临时特殊逻辑
if (productName === '红茶') {
const finalSourceCityPrice = sourceCityPrice * (1 - priceChangeRate.value) * (1 + taxRate.value - 0.05);
const finalTargetCityPrice = targetCityPrice * (1 + priceChangeRate.value) * (1 - taxRate.value + 0.05);
return Math.round(finalTargetCityPrice - finalSourceCityPrice);
}
// if (productName === '红茶') {
// const finalSourceCityPrice = sourceCityPrice * (1 - priceChangeRate.value) * (1 + taxRate.value - 0.05);
// const finalTargetCityPrice = targetCityPrice * (1 + priceChangeRate.value) * (1 - taxRate.value + 0.05);
// return Math.round(finalTargetCityPrice - finalSourceCityPrice);
// }
const finalSourceCityPrice = sourceCityPrice * (1 - priceChangeRate.value) * (1 + taxRate.value);
const finalTargetCityPrice = targetCityPrice * (1 + priceChangeRate.value) * (1 - taxRate.value);
return Math.round(finalTargetCityPrice - finalSourceCityPrice);
Expand Down
16 changes: 8 additions & 8 deletions utils/cities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export const cities: CityInfo[] = [...citiesMap]
.filter((city) => city.products.find((product) => product.valuable));

export function getProductInfo(city: string, name: string) {
const productInfo = citiesMap.get(city)?.find((p) => p.name === name);
// 红茶战争活动临时特殊逻辑
if (name === '红茶' && productInfo) {
return {
...productInfo,
baseVolume: Math.round((productInfo.baseVolume || 0) * (1 + 0.5)) // 临时加成50%
};
}
// const productInfo = citiesMap.get(city)?.find((p) => p.name === name);
// // 红茶战争活动临时特殊逻辑
// if (name === '红茶' && productInfo) {
// return {
// ...productInfo,
// baseVolume: Math.round((productInfo.baseVolume || 0) * (1 + 0.5)) // 临时加成50%
// };
// }
return citiesMap.get(city)?.find((p) => p.name === name);
}

Expand Down

0 comments on commit bde3e55

Please sign in to comment.