优化注释

This commit is contained in:
lemon橪
2021-05-17 18:19:26 +08:00
parent 4545097a4a
commit 49eb30f265
69 changed files with 972 additions and 2622 deletions

View File

@@ -51,7 +51,7 @@ export default {
let res = await getGoodsMessage(this.goodsId);
if (res.data.success) {
this.goodsDetail = res.data.result;
console.log(this.goodsDetail);
}
},
};

View File

@@ -25,8 +25,8 @@
<view class="price-sales">
<div class="item-price" v-if="item.price != undefined">
<span>{{ Fixed(item.price)[0] }}</span>
.{{Fixed(item.price)[1]}}
<span>{{ formatPrice(item.price)[0] }}</span>
.{{formatPrice(item.price)[1]}}
<!-- <text v-if="item.point != undefined">+{{ item.point }}积分</text> -->
</div>
</view>
@@ -48,7 +48,7 @@ export default {
});
},
// 格式化金钱 1999 --> [1999,00]
Fixed(val) {
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}

View File

@@ -13,8 +13,8 @@
<view class="goods-price " v-if="goodsDetail.promotionPrice">
<span v-if="goodsDetail.promotionPrice && !pointDetail">
<span class="goods-price-promotionShow goods-price-bigshow" >{{ Fixed(goodsDetail.promotionPrice)[0] }}</span>
.{{ Fixed(goodsDetail.promotionPrice)[1] }}
<span class="goods-price-promotionShow goods-price-bigshow" >{{ formatPrice(goodsDetail.promotionPrice)[0] }}</span>
.{{ formatPrice(goodsDetail.promotionPrice)[1] }}
</span>
<span v-if="pointDetail.points">
@@ -24,9 +24,9 @@
<div class="promotion-box">
<span class="goods-price-bigshow">{{
Fixed(goodsDetail.price)[0]
formatPrice(goodsDetail.price)[0]
}}</span>
.{{ Fixed(goodsDetail.price)[1] }}
.{{ formatPrice(goodsDetail.price)[1] }}
</div>
</view>
@@ -35,9 +35,9 @@
<span>
<span class="goods-price-bigshow">{{
Fixed(goodsDetail.price)[0]
formatPrice(goodsDetail.price)[0]
}}</span>
.{{ Fixed(goodsDetail.price)[1] }}
.{{ formatPrice(goodsDetail.price)[1] }}
</span>
</view>
@@ -129,7 +129,7 @@ export default {
methods: {
// 格式化金钱 1999 --> [1999,00]
Fixed(val) {
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
@@ -301,7 +301,7 @@ export default {
},
mounted() {
console.log(this.pointDetail)
this.formatSku(this.goodsSpec);
},
};

View File

@@ -12,11 +12,11 @@
<view class="u-group-flex-left" v-if="promotion.__key == 'SECKILL' ">
<span class="u-group-flex-left-span" v-if="detail.promotionPrice!=undefined">
<span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.{{ Fixed(detail.promotionPrice)[1]}}</span>
<span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.{{ formatPrice(detail.promotionPrice)[1]}}</span>
</span>
<view class="u-group-flex" v-if="detail.price!=undefined">
<span class="old-price">{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
<span class="old-price">{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span>
<view class="promotion">限时抢购</view>
</view>
</view>
@@ -25,12 +25,12 @@
<view class="u-group-flex-left" v-if="promotion.__key == 'GROUPBUY' ">
<span class="u-group-flex-left-span">
<span class="flex-price"
v-if="promotion.groupbuy_goods_vo.price !=undefined">{{ Fixed(promotion.groupbuy_goods_vo.price )[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.price )[1]}}</span>
v-if="promotion.groupbuy_goods_vo.price !=undefined">{{ formatPrice(promotion.groupbuy_goods_vo.price )[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.price )[1]}}</span>
<!-- <span v-if="promotion.point">+{{promotion.point}}积分</span> -->
</span>
<view class="u-group-flex">
<span class="old-price"
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">{{ Fixed(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.original_price)[1]}}</span>
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[1]}}</span>
<view class="promotion">团购活动</view>
</view>
</view>
@@ -38,10 +38,10 @@
<view class="u-group-flex-left" v-if="promotion.__key == 'PINTUAN' ">
<span class="u-group-flex-left-span" v-if="detail.promotionPrice != undefined">
<span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.</span>{{ Fixed(detail.promotionPrice)[1]}}
<span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.</span>{{ formatPrice(detail.promotionPrice)[1]}}
</span>
<view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price">{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
<span class="old-price">{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span>
<view class="promotion">拼团活动</view>
</view>
</view>
@@ -98,7 +98,7 @@ export default {
mounted() {},
methods: {
// 格式化金钱 1999 --> [1999,00]
Fixed(val) {
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
@@ -106,14 +106,12 @@ export default {
},
getCountDownTime(val) {
let date = new Date(val.replace(/-/g, "/"))
let timeSimple = new Date(date).getTime() / 1000;
console.log(timeSimple , timeSimple - new Date().getTime() / 1000)
return timeSimple - new Date().getTime() / 1000;
},
getIsTimer(val) {
var timestamp = new Date().getTime();
// console.log(timestamp);
if (timestamp < val.start_time) {
this.startTimer = true;

View File

@@ -41,16 +41,15 @@ export default {
},
watch: {
res: {
handler(val) {
console.log(val);
// if (this.res && this.res.length != 0) {
// Object.keys(this.res).forEach((item) => {
// if (item != "COUPON") {
// let key = item.split("-")[0];
// this.res[item]._key = key;
// }
// });
// }
handler() {
if (this.res && this.res.length != 0) {
Object.keys(this.res).forEach((item) => {
if (item != "COUPON") {
let key = item.split("-")[0];
this.res[item]._key = key;
}
});
}
},
immediate: true,

View File

@@ -32,7 +32,7 @@
{{ item.goodsName }}
</view>
<view class="item-price" v-if="item.price != undefined">
<span class="item-price-blod">{{ Fixed(item.price)[0] }}</span>.{{ Fixed(item.price)[1] }}
<span class="item-price-blod">{{ formatPrice(item.price)[0] }}</span>.{{ formatPrice(item.price)[1] }}
</view>
</view>
</view>
@@ -49,7 +49,7 @@ export default {
mounted() {},
methods: {
// 格式化金钱 1999 --> [1999,00]
Fixed(val) {
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}