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