|
|
@@ -44,12 +44,10 @@
|
|
|
<view class="operate-wrap" style="margin-bottom:15upx;">
|
|
|
<view v-if="goodsItem.priceType == 1">
|
|
|
<!-- 当涨价开关开启时,显示涨价后价格和原价 -->
|
|
|
- <view v-if="riseSwitch" class="price-container">
|
|
|
- <text class="goods-price" style="font-size:26upx;">¥{{ risePrice(goodsItem) }}</text>
|
|
|
- <text class="original-price" style="font-size:22upx;">¥{{ goodsItem.price?parseFloat(goodsItem.price):0 }}</text>
|
|
|
+ <view class="price-container">
|
|
|
+ <text class="goods-price" style="font-size:26upx;">¥{{ goodsItem.price?parseFloat(goodsItem.price):0 }}</text>
|
|
|
+ <text class="original-price" style="font-size:22upx;" v-if="parseFloat(goodsItem.price)!=parseFloat(goodsItem.priceBeforeRise)">¥{{ goodsItem.priceBeforeRise?parseFloat(goodsItem.priceBeforeRise):0 }}</text>
|
|
|
</view>
|
|
|
- <!-- 当涨价开关关闭时,显示原价 -->
|
|
|
- <view v-else class="goods-price" style="font-size:26upx;">¥{{ goodsItem.price?parseFloat(goodsItem.price):0 }}</view>
|
|
|
</view>
|
|
|
<view class="goods-price" style="font-size:26upx;" v-else>---</view>
|
|
|
</view>
|
|
|
@@ -161,7 +159,6 @@ export default {
|
|
|
searchText:'',
|
|
|
lastSearchText:'', // 上次的搜索内容
|
|
|
searchTimer: null, // 搜索防抖定时器
|
|
|
- riseSwitch: false, // 价格上涨开关
|
|
|
riseData: {}, // 价格上涨配置
|
|
|
stockStatus:0, // 1:有库存 2:无库存
|
|
|
priceStatus:0, // 1:有价格 2:无价格
|
|
|
@@ -220,7 +217,6 @@ export default {
|
|
|
methods: {
|
|
|
init(){
|
|
|
this.getCategoryData()
|
|
|
- this.getRiseData()
|
|
|
},
|
|
|
|
|
|
// 新的筛选相关方法
|
|
|
@@ -374,35 +370,6 @@ export default {
|
|
|
this.resetList();
|
|
|
this.getGoodsList();
|
|
|
}
|
|
|
- },
|
|
|
- getRiseData() {
|
|
|
- getRise().then(res => {
|
|
|
- this.riseData = res.data;
|
|
|
- //console.log('riseData: ' , this.riseData)
|
|
|
- this.riseSwitch = this.riseData.riseSwitch == '1' ? true : false;
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 计算涨价后的价格
|
|
|
- risePrice(goodsItem) {
|
|
|
- if (!goodsItem.price || !this.riseData.riseAmount) {
|
|
|
- return parseFloat(goodsItem.price) || 0;
|
|
|
- }
|
|
|
-
|
|
|
- const originalPrice = parseFloat(goodsItem.price);
|
|
|
- let newPrice = 0;
|
|
|
-
|
|
|
- if (this.riseData.riseType == '0') {
|
|
|
- // 按比率上涨
|
|
|
- newPrice = originalPrice * (1 + this.riseData.riseAmount / 100);
|
|
|
- } else if (this.riseData.riseType == '1') {
|
|
|
- // 按金额数上涨
|
|
|
- newPrice = originalPrice + parseFloat(this.riseData.riseAmount);
|
|
|
- } else {
|
|
|
- newPrice = originalPrice;
|
|
|
- }
|
|
|
-
|
|
|
- return newPrice;
|
|
|
}
|
|
|
}
|
|
|
};
|