新增formatNumber方法
This commit is contained in:
parent
73017b8019
commit
33f840ebf2
|
@ -168,6 +168,12 @@ function toast(title, options) {
|
|||
});
|
||||
}
|
||||
|
||||
function formatNumber(num, limit) {
|
||||
num = parseFloat(num);
|
||||
limit = limit ? limit : 2;
|
||||
return num > 0 ? num.toFixed(limit) : 0;
|
||||
}
|
||||
|
||||
function serviceActions() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['电话客服', '微信客服', '微信客服二'],
|
||||
|
@ -192,5 +198,6 @@ export default {
|
|||
rpx2px,
|
||||
toPage,
|
||||
toast,
|
||||
formatNumber,
|
||||
serviceActions,
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
<text class="input-desc"> 请填写您的心理价位,等待师傅接单 </text>
|
||||
<view class="custom-input-box" @click="editPrice = true">
|
||||
<text class="iconfont icon-bianji"></text>
|
||||
<text class="price">¥ {{ parsePrice(price) }}</text>
|
||||
<text class="price">¥ {{ utils.formatNumber(price, 2) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="insurance-box">
|
||||
|
@ -155,7 +155,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="common-bottom-components" :style="{ bottom: config.safeAreaInsets.bottom + 'px' }">
|
||||
<text class="price">¥ {{ parsePrice(total) }}</text>
|
||||
<text class="price">¥ {{ utils.formatNumber(total, 2) }}</text>
|
||||
<view v-if="type == 1" class="btn" @click="submit">
|
||||
<div class="text">立即发布</div>
|
||||
</view>
|
||||
|
@ -198,6 +198,7 @@ export default {
|
|||
name: "demand",
|
||||
data() {
|
||||
return {
|
||||
utils: this.$utils,
|
||||
customBtn: false,
|
||||
pageTitle: "发布需求",
|
||||
maxlength: 300,
|
||||
|
@ -303,10 +304,6 @@ export default {
|
|||
changeInsuranceState(state) {
|
||||
this.insurance = state;
|
||||
},
|
||||
parsePrice(data) {
|
||||
let num = parseFloat(data);
|
||||
return num > 0 ? num.toFixed(2) : 0;
|
||||
},
|
||||
submit() {
|
||||
uni.showToast({ title: "发布成功" });
|
||||
},
|
||||
|
@ -343,7 +340,7 @@ export default {
|
|||
margin: 0 auto;
|
||||
}
|
||||
.common-save-form-btn {
|
||||
margin-top: 70rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.demand-container {
|
||||
padding-bottom: 120rpx;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<view class="price">
|
||||
<view class="title-box">申请退款</view>
|
||||
<view class="price-box">
|
||||
<text class="number">¥{{ parsePrice(price) }}</text>
|
||||
<text class="number">¥{{ utils.formatNumber(price, 2) }}</text>
|
||||
<view v-if="type == 'apply'" class="modify-icon" @click="showEditModal = true">
|
||||
<text class="iconfont icon-bianji"></text>
|
||||
<text class="text">修改金额</text>
|
||||
|
@ -87,6 +87,7 @@ export default {
|
|||
name: "order-refund",
|
||||
data() {
|
||||
return {
|
||||
utils: this.$utils,
|
||||
type: "apply",
|
||||
pageTitle: "申请退款",
|
||||
showEditModal: false,
|
||||
|
@ -116,10 +117,6 @@ export default {
|
|||
onReachBottom() {},
|
||||
onPullDownRefresh() {},
|
||||
methods: {
|
||||
parsePrice(data) {
|
||||
let num = parseFloat(data);
|
||||
return num > 0 ? num.toFixed(2) : 0;
|
||||
},
|
||||
chooseImage() {
|
||||
uni.chooseImage({
|
||||
sizeType: ["compressed"],
|
||||
|
|
Loading…
Reference in New Issue