feat: 🎨 在config中新增5个便捷功能选项,更加简单便捷配置以及使用代码。优化部分冗余的代码

master
学习很差啦 2022-10-10 18:53:14 +08:00
parent 1225a41de4
commit 7179ca41de
19 changed files with 100 additions and 168 deletions

View File

@ -88,7 +88,9 @@
onShow() { onShow() {
// #ifndef H5 // #ifndef H5
this.getClipboard(); if(this.config.enableGetClipboard){
this.getClipboard();
}
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS

View File

@ -16,9 +16,9 @@
<span v-if="goodsDetail.promotionPrice && !pointDetail"> <span v-if="goodsDetail.promotionPrice && !pointDetail">
<span class="goods-price-promotionShow goods-price-bigshow">{{ <span class="goods-price-promotionShow goods-price-bigshow">{{
formatPrice(goodsDetail.promotionPrice)[0] $options.filters.goodsFormatPrice(goodsDetail.promotionPrice)[0]
}}</span> }}</span>
.{{ formatPrice(goodsDetail.promotionPrice)[1] }} .{{ $options.filters.goodsFormatPrice(goodsDetail.promotionPrice)[1] }}
</span> </span>
<span v-if="pointDetail.points"> <span v-if="pointDetail.points">
<span class="goods-price-promotionShow goods-price-bigshow">{{ <span class="goods-price-promotionShow goods-price-bigshow">{{
@ -29,9 +29,9 @@
<div class="promotion-box"> <div class="promotion-box">
<span class="goods-price-bigshow">{{ <span class="goods-price-bigshow">{{
formatPrice(goodsDetail.price)[0] $options.filters.goodsFormatPrice(goodsDetail.price)[0]
}}</span> }}</span>
.{{ formatPrice(goodsDetail.price)[1] }} .{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
</div> </div>
</view> </view>
<!-- 正常商品的价格 --> <!-- 正常商品的价格 -->
@ -43,9 +43,9 @@
<span> <span>
<span class="goods-price-bigshow">{{ <span class="goods-price-bigshow">{{
formatPrice(item.price)[0] $options.filters.goodsFormatPrice(item.price)[0]
}}</span> }}</span>
.{{ formatPrice(item.price)[1] }} .{{ $options.filters.goodsFormatPrice(item.price)[1] }}
</span> </span>
<span class='wholesale-item'> <span class='wholesale-item'>
{{item.num}}{{goodsDetail.goodsUnit}} {{item.num}}{{goodsDetail.goodsUnit}}
@ -56,9 +56,9 @@
<span> <span>
<span class="goods-price-bigshow">{{ <span class="goods-price-bigshow">{{
formatPrice(goodsDetail.price)[0] $options.filters.goodsFormatPrice(goodsDetail.price)[0]
}}</span> }}</span>
.{{ formatPrice(goodsDetail.price)[1] }} .{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
</span> </span>
</div> </div>
</view> </view>
@ -204,14 +204,6 @@
}, },
methods: { methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
closeMask() { closeMask() {
this.$emit("closeBuy", false); this.$emit("closeBuy", false);
}, },

View File

@ -11,8 +11,8 @@
<div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.goodsName }}</div> <div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.goodsName }}</div>
<view class="price-box" @click="navigateToDetailPage(item)"> <view class="price-box" @click="navigateToDetailPage(item)">
<div class="price" v-if="item.price!=undefined"> <div class="price" v-if="item.price!=undefined">
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{ ¥<span>{{ $options.filters.goodsFormatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1] $options.filters.goodsFormatPrice(item.price )[1]
}} }}
</div> </div>
</view> </view>
@ -135,7 +135,7 @@
font-size: $font-base; font-size: $font-base;
color: $font-color-dark; color: $font-color-dark;
line-height: 1.5; line-height: 1.5;
height: 84rpx; height: 86rpx;
padding: 10rpx 0 0; padding: 10rpx 0 0;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;

View File

@ -36,17 +36,6 @@
} }
return str; return str;
}, },
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
// //
getPromotion(item) { getPromotion(item) {
if (item.promotionMap) { if (item.promotionMap) {

View File

@ -15,8 +15,8 @@
</div> </div>
<view class="price-box" @click="navigateToDetailPage(item)"> <view class="price-box" @click="navigateToDetailPage(item)">
<div class="price" v-if="item.content.price!=undefined"> <div class="price" v-if="item.content.price!=undefined">
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{ ¥<span>{{ $options.filters.goodsFormatPrice(item.content.price )[0] }} </span>.{{
formatPrice(item.content.price )[1] $options.filters.goodsFormatPrice(item.content.price )[1]
}} }}
</div> </div>
</view> </view>
@ -60,8 +60,8 @@
<div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.content.goodsName }}</div> <div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.content.goodsName }}</div>
<view class="price-box" @click="navigateToDetailPage(item)"> <view class="price-box" @click="navigateToDetailPage(item)">
<div class="price" v-if="item.content.price!=undefined"> <div class="price" v-if="item.content.price!=undefined">
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{ ¥<span>{{ $options.filters.goodsFormatPrice(item.content.price )[0] }} </span>.{{
formatPrice(item.content.price )[1] $options.filters.goodsFormatPrice(item.content.price )[1]
}} }}
</div> </div>
</view> </view>
@ -177,16 +177,6 @@
} }
return str; return str;
}, },
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
// //
getPromotion(item) { getPromotion(item) {
if (item.promotionMap) { if (item.promotionMap) {
@ -284,7 +274,7 @@
font-size: $font-base; font-size: $font-base;
color: $font-color-dark; color: $font-color-dark;
line-height: 1.5; line-height: 1.5;
height: 84rpx; height: 86rpx;
padding: 10rpx 0 0; padding: 10rpx 0 0;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;

View File

@ -13,15 +13,15 @@
<view class="price-box"> <view class="price-box">
<!-- 秒杀 / 拼团 --> <!-- 秒杀 / 拼团 -->
<div class="price" v-if="!type && item.price!=undefined"> <div class="price" v-if="!type && item.price!=undefined">
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{ ¥<span>{{ $options.filters.goodsFormatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1] $options.filters.goodsFormatPrice(item.price )[1]
}} }}
</div> </div>
<!-- 砍价 --> <!-- 砍价 -->
<div class="price" v-if="type && item.purchasePrice!=undefined"> <div class="price" v-if="type && item.purchasePrice!=undefined">
最低 最低
¥<span>{{ formatPrice(item.purchasePrice )[0] }} </span>.{{ ¥<span>{{ $options.filters.goodsFormatPrice(item.purchasePrice )[0] }} </span>.{{
formatPrice(item.purchasePrice )[1] $options.filters.goodsFormatPrice(item.purchasePrice )[1]
}} }}
</div> </div>
</view> </view>
@ -107,7 +107,7 @@
font-size: $font-base; font-size: $font-base;
color: $font-color-dark; color: $font-color-dark;
line-height: 1.5; line-height: 1.5;
height: 84rpx; height: 86rpx;
padding: 10rpx 0 0; padding: 10rpx 0 0;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;

View File

@ -1,5 +1,5 @@
const name = "lilishop"; //全局商城name const name = "lilishop"; //全局商城name
const schemeName = 'lilishop' //唤醒app需要的schemeName const schemeName = "lilishop"; //唤醒app需要的schemeName
export default { export default {
name: name, name: name,
schemeLink: `${schemeName}://`, //唤起app地址 schemeLink: `${schemeName}://`, //唤起app地址
@ -7,10 +7,18 @@ export default {
shareLink: "https://m-b2b2c.pickmall.cn", //分享地址也就是在h5中默认的复制地址 shareLink: "https://m-b2b2c.pickmall.cn", //分享地址也就是在h5中默认的复制地址
appid: "wx6f10f29075dc1b0b", //小程序唯一凭证,即 AppID可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态) appid: "wx6f10f29075dc1b0b", //小程序唯一凭证,即 AppID可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态)
aMapKey: "d649892b3937a5ad20b76dacb2bcb5bd", //在高德中申请Web服务key aMapKey: "d649892b3937a5ad20b76dacb2bcb5bd", //在高德中申请Web服务key
scanAuthNavigation:['https://m-b2b2c.pickmall.cn/'], //扫码认证跳转域名配置 会根据此处配置的路由进行跳转 scanAuthNavigation: ["https://m-b2b2c.pickmall.cn/"], //扫码认证跳转域名配置 会根据此处配置的路由进行跳转
iosAppId:"id1564638363", //AppStore的应用地址id 具体在分享->拷贝链接中查看 iosAppId: "id1564638363", //AppStore的应用地址id 具体在分享->拷贝链接中查看
logo:"https://lilishop-oss.oss-cn-beijing.aliyuncs.com/4c864e133c2944efad1f7282ac8a3b9e.png", //logo地址 logo: "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/4c864e133c2944efad1f7282ac8a3b9e.png", //logo地址
customerServiceMobile:"13161366885", //客服电话 customerServiceMobile: "13161366885", //客服电话
customerServiceEmail:"lili@lili.com", //客服邮箱 customerServiceEmail: "lili@lili.com", //客服邮箱
imWebSrc:"https://im.pickmall.cn" //IM地址 imWebSrc: "https://im.pickmall.cn", //IM地址
}; enableGetClipboard: true, //是否启用粘贴板获取 scanAuthNavigation 中的链接,如果匹配则会跳转到对应页面
enableMiniBarStartUpApp: true, //是否在h5中右侧浮空按钮点击启动app
/**
* 如需更换主题请修改此处以及uni.scss中的全局颜色
*/
mainColor: "#ff3c2a", // 主题色
lightColor: "#ff6b35", // 高亮主题色
aiderLightColor: "#ff9f28", // 辅助高亮颜色
};

19
main.js
View File

@ -3,17 +3,18 @@ import App from "./App";
import * as filters from "./utils/filters.js"; // global filter import * as filters from "./utils/filters.js"; // global filter
import uView from "uview-ui"; import uView from "uview-ui";
import store from "./store"; import store from "./store";
import config from '@/config/config';
import airBtn from "@/components/m-airbtn/index.vue";
/** /**
* 仅在h5中显示唤醒app功能 * 仅在h5中显示唤醒app功能
* 在h5页面手动挂载 * 在h5页面手动挂载
* *
*/ */
// #ifdef H5 // #ifdef H5
import airBtn from "@/components/m-airbtn/index.vue"; if(config.enableMiniBarStartUpApp){
let btn = Vue.component("airBtn", airBtn); //全局注册 let btn = Vue.component("airBtn", airBtn); //全局注册
document.body.appendChild(new btn().$mount().$el); document.body.appendChild(new btn().$mount().$el);
}
// #endif // #endif
// 引入uView对小程序分享的mixin封装 // 引入uView对小程序分享的mixin封装
@ -30,8 +31,6 @@ Object.keys(filters).forEach((key) => {
// 引入Vuex // 引入Vuex
Vue.prototype.$store = store; Vue.prototype.$store = store;
Vue.use(uView); Vue.use(uView);
Vue.config.productionTip = false; Vue.config.productionTip = false;
@ -43,11 +42,11 @@ Vue.config.productionTip = false;
* 如需更换主题请修改此处以及uni.scss中的全局颜色 * 如需更换主题请修改此处以及uni.scss中的全局颜色
*/ */
// 主题色 // 主题色
Vue.prototype.$mainColor = "#ff3c2a"; Vue.prototype.$mainColor = config.mainColor;
// 高亮主题色 // 高亮主题色
Vue.prototype.$lightColor = "#ff6b35"; Vue.prototype.$lightColor = config.lightColor;
// 辅助高亮颜色 // 辅助高亮颜色
Vue.prototype.$aiderLightColor = "#ff9f28"; Vue.prototype.$aiderLightColor = config.aiderLightColor;
App.mpType = "app"; App.mpType = "app";

View File

@ -370,15 +370,6 @@ export default {
return array; return array;
} }
}, },
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
// //
showMore() { showMore() {
this.loadOldKeyword(this.oldKeywordIndex); this.loadOldKeyword(this.oldKeywordIndex);

View File

@ -147,9 +147,9 @@
<p class="goods-prices"> <p class="goods-prices">
<span></span> <span></span>
<span class="goods-price">{{ <span class="goods-price">{{
formatPrice(val.goodsSku.price)[0] $options.filters.goodsFormatPrice(val.goodsSku.price)[0]
}}</span> }}</span>
<span>.{{ formatPrice(val.goodsSku.price)[1] }}</span> <span>.{{ $options.filters.goodsFormatPrice(val.goodsSku.price)[1] }}</span>
</p> </p>
</div> </div>
</div> </div>
@ -315,10 +315,10 @@
<div v-if="!orderMessage.priceDetailDTO.payPoint" class="number"> <div v-if="!orderMessage.priceDetailDTO.payPoint" class="number">
<span>¥</span> <span>¥</span>
<span class="price">{{ <span class="price">{{
formatPrice(orderMessage.priceDetailDTO.flowPrice)[0] $options.filters.goodsFormatPrice(orderMessage.priceDetailDTO.flowPrice)[0]
}}</span> }}</span>
<span <span
>.{{ formatPrice(orderMessage.priceDetailDTO.flowPrice)[1] }} >.{{ $options.filters.goodsFormatPrice(orderMessage.priceDetailDTO.flowPrice)[1] }}
</span> </span>
</div> </div>
<span v-else class="number" <span v-else class="number"
@ -455,13 +455,6 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
// //
async callbackInvoice(val) { async callbackInvoice(val) {
this.invoiceFlag = false; this.invoiceFlag = false;

View File

@ -151,12 +151,12 @@
<span v-else> <span v-else>
<span v-if="wholesaleList.length"> <span v-if="wholesaleList.length">
<span>¥</span><span class="price">{{ formatPrice(wholesaleList[wholesaleList.length-1].price)[0] }}</span>.{{ formatPrice(wholesaleList[wholesaleList.length-1].price)[1] }} <span>¥</span><span class="price">{{ $options.filters.goodsFormatPrice(wholesaleList[wholesaleList.length-1].price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(wholesaleList[wholesaleList.length-1].price)[1] }}
~ ~
<span>¥</span><span class="price">{{ formatPrice(wholesaleList[0].price)[0] }}</span>.{{ formatPrice(wholesaleList[0].price)[1] }} <span>¥</span><span class="price">{{ $options.filters.goodsFormatPrice(wholesaleList[0].price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(wholesaleList[0].price)[1] }}
</span> </span>
<span v-else> <span v-else>
<span>¥</span><span class="price">{{ formatPrice(goodsDetail.price)[0] }}</span>.{{ formatPrice(goodsDetail.price)[1] }} <span>¥</span><span class="price">{{ $options.filters.goodsFormatPrice(goodsDetail.price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
</span> </span>
</span> </span>
</view> </view>
@ -752,14 +752,6 @@ export default {
// // #endif // // #endif
}, },
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
/**选择商品 */ /**选择商品 */
changedGoods(val) { changedGoods(val) {
this.selectedGoods = val; this.selectedGoods = val;

View File

@ -21,15 +21,15 @@
> >
<span class="flex-price"> <span class="flex-price">
{{ formatPrice(detail.promotionPrice)[0] }}.{{ {{ $options.filters.goodsFormatPrice(detail.promotionPrice)[0] }}.{{
formatPrice(detail.promotionPrice)[1] $options.filters.goodsFormatPrice(detail.promotionPrice)[1]
}}</span }}</span
> >
</span> </span>
<view class="u-group-flex" v-if="detail.price != undefined"> <view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price" <span class="old-price"
>{{ formatPrice(detail.price)[0] }}.{{ >{{ $options.filters.goodsFormatPrice(detail.price)[0] }}.{{
formatPrice(detail.price)[1] $options.filters.goodsFormatPrice(detail.price)[1]
}}</span }}</span
> >
<view class="promotion">限时抢购</view> <view class="promotion">限时抢购</view>
@ -42,8 +42,8 @@
<span <span
class="flex-price" class="flex-price"
v-if="promotion.groupbuy_goods_vo.price != undefined" v-if="promotion.groupbuy_goods_vo.price != undefined"
>{{ formatPrice(promotion.groupbuy_goods_vo.price)[0] }}.{{ >{{ $options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.price)[0] }}.{{
formatPrice(promotion.groupbuy_goods_vo.price)[1] $options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.price)[1]
}}</span }}</span
> >
<!-- <span v-if="promotion.point">+{{promotion.point}}</span> --> <!-- <span v-if="promotion.point">+{{promotion.point}}</span> -->
@ -53,9 +53,9 @@
class="old-price" class="old-price"
v-if="promotion.groupbuy_goods_vo.original_price != undefined" v-if="promotion.groupbuy_goods_vo.original_price != undefined"
>{{ >{{
formatPrice(promotion.groupbuy_goods_vo.original_price)[0] $options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.original_price)[0]
}}.{{ }}.{{
formatPrice(promotion.groupbuy_goods_vo.original_price)[1] $options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.original_price)[1]
}}</span }}</span
> >
<view class="promotion">团购活动</view> <view class="promotion">团购活动</view>
@ -68,13 +68,13 @@
v-if="detail.promotionPrice != undefined" v-if="detail.promotionPrice != undefined"
> >
<span class="flex-price"> <span class="flex-price">
{{ formatPrice(detail.promotionPrice)[0] }}.</span {{ $options.filters.goodsFormatPrice(detail.promotionPrice)[0] }}.</span
>{{ formatPrice(detail.promotionPrice)[1] }} >{{ $options.filters.goodsFormatPrice(detail.promotionPrice)[1] }}
</span> </span>
<view class="u-group-flex" v-if="detail.price != undefined"> <view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price" <span class="old-price"
>{{ formatPrice(detail.price)[0] }}.{{ >{{ $options.filters.goodsFormatPrice(detail.price)[0] }}.{{
formatPrice(detail.price)[1] $options.filters.goodsFormatPrice(detail.price)[1]
}}</span }}</span
> >
<view class="promotion">拼团活动</view> <view class="promotion">拼团活动</view>
@ -141,13 +141,6 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
getCountDownTime(val) { getCountDownTime(val) {
let date = new Date(val); let date = new Date(val);
let timeSimple = new Date(date).getTime() / 1000; let timeSimple = new Date(date).getTime() / 1000;

View File

@ -32,7 +32,7 @@
{{ item.content.goodsName }} {{ item.content.goodsName }}
</view> </view>
<view class="item-price" v-if="item.price != undefined"> <view class="item-price" v-if="item.price != undefined">
<span class="item-price-blod">{{ formatPrice(item.content.price)[0] }}</span>.{{ formatPrice(item.content.price)[1] }} <span class="item-price-blod">{{ $options.filters.goodsFormatPrice(item.content.price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(item.content.price)[1] }}
</view> </view>
</view> </view>
</view> </view>
@ -48,13 +48,6 @@ export default {
props: ["res", "goodsDetail", "storeDetail"], props: ["res", "goodsDetail", "storeDetail"],
mounted() {}, mounted() {},
methods: { methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
// //
clickGoods(val) { clickGoods(val) {
uni.navigateTo({ uni.navigateTo({

View File

@ -82,13 +82,7 @@ export default {
this.storeList = []; this.storeList = [];
this.init(); this.init();
}, },
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
async init() { async init() {
let res = await getStoreList(this.params); let res = await getStoreList(this.params);
if (res.data.success) { if (res.data.success) {

View File

@ -58,7 +58,7 @@
<!-- menu --> <!-- menu -->
<!-- 商品 --> <!-- 商品 -->
<div class="contant" v-if="current == 0"> <div class="content" v-if="current == 0">
<u-empty style='margin-top:100rpx' v-if="goodsList.length == 0" class="empty" text='暂无商品信息'></u-empty> <u-empty style='margin-top:100rpx' v-if="goodsList.length == 0" class="empty" text='暂无商品信息'></u-empty>
<goodsTemplate v-else :res="goodsList" :storeName="false" /> <goodsTemplate v-else :res="goodsList" :storeName="false" />
@ -382,11 +382,11 @@ export default {
color: #999; color: #999;
} }
.contant { .content {
margin-top: 20rpx; margin-top: 20rpx;
display: flex; // display: flex;
flex-wrap: wrap; // flex-wrap: wrap;
justify-content: space-between; // justify-content: space-between;
> .empty { > .empty {
width: 100%; width: 100%;
display: flex; display: flex;

View File

@ -79,8 +79,8 @@
<view class="sp-price"> <view class="sp-price">
<div class="default-color" :class="{'main-color':Object.keys(skuItem.promotionMap).length ==0 }"> <div class="default-color" :class="{'main-color':Object.keys(skuItem.promotionMap).length ==0 }">
<span>{{ formatPrice(skuItem.goodsSku.price)[0] }}</span> <span>{{ $options.filters.goodsFormatPrice(skuItem.goodsSku.price)[0] }}</span>
<span>.{{ formatPrice(skuItem.goodsSku.price)[1] }}</span> <span>.{{ $options.filters.goodsFormatPrice(skuItem.goodsSku.price)[1] }}</span>
</div> </div>
</view> </view>
<view> <view>
@ -108,8 +108,8 @@
<!-- 如果有活动 并且是选中的状态,显示预估到手价格 --> <!-- 如果有活动 并且是选中的状态,显示预估到手价格 -->
<div class="priceDetail-flowPrice" :class="{'main-color':skuItem.priceDetailDTO}" <div class="priceDetail-flowPrice" :class="{'main-color':skuItem.priceDetailDTO}"
v-if="skuItem.priceDetailDTO && skuItem.invalid == 0 && Object.keys(skuItem.promotionMap).length != 0 && skuItem.checked && skuItem.checked"> v-if="skuItem.priceDetailDTO && skuItem.invalid == 0 && Object.keys(skuItem.promotionMap).length != 0 && skuItem.checked && skuItem.checked">
预估到手价 <span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span> 预估到手价 <span>{{ $options.filters.goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
<span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span> <span>.{{ $options.filters.goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
</div> </div>
<div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage"> <div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage">
{{skuItem.errorMessage}} {{skuItem.errorMessage}}
@ -131,7 +131,7 @@
<div class="fullPrice"> <div class="fullPrice">
<span class="number" v-if="cartDetail && cartDetail.priceDetailDTO"> <span class="number" v-if="cartDetail && cartDetail.priceDetailDTO">
总计: 总计:
<span>¥{{ formatPrice(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ formatPrice(cartDetail.priceDetailDTO.flowPrice)[1] }}</span> <span>¥{{ $options.filters.goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ $options.filters.goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[1] }}</span>
</span> </span>
<span class="number" v-else>:0.00</span> <span class="number" v-else>:0.00</span>
</div> </div>
@ -256,17 +256,6 @@ export default {
discountDetails() { discountDetails() {
this.discountDetailsFlag = true; this.discountDetailsFlag = true;
}, },
/**
* 格式化金钱 1999 --> [1999,00]
*/
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
/** /**
* 左滑打开删除 * 左滑打开删除
*/ */

View File

@ -24,8 +24,8 @@
{{ item.title }} {{ item.title }}
</div> </div>
<div class="goods-bottom"> <div class="goods-bottom">
<div class="goods-price"> ¥<span>{{ formatPrice(item.price )[0] }} </span>.{{ <div class="goods-price"> ¥<span>{{ $options.filters.goodsFormatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1] $options.filters.goodsFormatPrice(item.price)[1]
}}</div> }}</div>
</div> </div>
</div> </div>
@ -58,13 +58,6 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return parseInt(val).toFixed(2).split(".");
},
handleClick(item) { handleClick(item) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,

View File

@ -149,9 +149,9 @@ $font-weight: 400;
} }
.flex-a-c{ .flex-a-c{
align-items: center; align-items: center;
} }
.flex-j-sb{ .flex-j-sb{
justify-content: space-between; justify-content: space-between;
} }
.relative { .relative {
position: relative; position: relative;
@ -171,7 +171,7 @@ $font-weight: 400;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
overflow: hidden; overflow: hidden;
} }
.wes-3 { .wes-3 {
/* 适用于webkit内核和移动端 */ /* 适用于webkit内核和移动端 */

View File

@ -21,6 +21,20 @@ export function unitPrice(val, unit, location) {
return (unit || "") + price; return (unit || "") + price;
} }
/**
* 格式化价格 1999 --> [1999,00]
* @param {*} val
* @returns
*/
export function goodsFormatPrice(val) {
if (typeof val == "undefined") {
return val;
}
let valNum = new Number(val);
return valNum.toFixed(2).split(".");
}
/** /**
* 脱敏姓名 * 脱敏姓名
*/ */