1.修改团油输入小数点

yj-dev
杨杰 3 years ago
parent 4adbb012bf
commit f4de516383
  1. 2
      pages/goods/refuel-confirm/refuel-confirm.vue
  2. 78
      pages/goods/refuel-details/refuel-details.vue
  3. 2
      pages/tabBar/home/home.vue

@ -6,7 +6,7 @@
<view class="conCont paddtop15"> <view class="conCont paddtop15">
<view class="font20 fontwig6 fcor333 text1 paddtright10">{{orderList.goodsName}}</view> <view class="font20 fontwig6 fcor333 text1 paddtright10">{{orderList.goodsName}}</view>
<view class="font14 fcor999 text2 paddtop5 paddtright10">{{refulAdress}}</view> <view class="font14 fcor999 text2 paddtop5 paddtright10">{{refulAdress}}</view>
<view class="font20 fontwig6 fcoreb5 paddtop5">{{orderList.gasPriceVip}} <view class="font20 fontwig6 fcoreb5 paddtop5">{{orderList.ext1}}
<text class="margle10 slogan font14">{{orderList.gasPriceGun}}</text> <text class="margle10 slogan font14">{{orderList.gasPriceGun}}</text>
</view> </view>
</view> </view>

@ -65,7 +65,7 @@
<view class="width90 mart15 font16 fcor666">加油金额</view> <view class="width90 mart15 font16 fcor666">加油金额</view>
<view class="width90 height40 mart10" style="border: 1px solid #f2f2f2;"> <view class="width90 height40 mart10" style="border: 1px solid #f2f2f2;">
<view class="width8 flleft"></view> <view class="width8 flleft"></view>
<input type="digit" class="font16 width60 flleft height40" placeholder="输入金额(保留1位小数)" v-model="inputMoney" <input type="digit" class="font16 width60 flleft height40" placeholder="输入金额(保留2位小数)" v-model="inputMoney"
@blur="Listeningfocus" /> @blur="Listeningfocus" />
<view class="width30 height40 flright font14 fcor999 fotct" <view class="width30 height40 flright font14 fcor999 fotct"
style="border-left: 1px solid #f2f2f2;line-height: 40px;"> style="border-left: 1px solid #f2f2f2;line-height: 40px;">
@ -183,7 +183,7 @@
}, },
onLoad(options) { onLoad(options) {
this.store_key = options.id; this.store_key = options.id;
this.counId = options.desId; this.counId = options.desId;
if (app.globalData.accountId) { if (app.globalData.accountId) {
this.isTyAgent = true; this.isTyAgent = true;
} }
@ -217,28 +217,28 @@
let params = { let params = {
storeKey: this.store_key, storeKey: this.store_key,
latitude: app.globalData.latitude, latitude: app.globalData.latitude,
longitude: app.globalData.longitude, longitude: app.globalData.longitude,
isTyAgent: this.isTyAgent isTyAgent: this.isTyAgent
} }
getGasDetailByStoreKey(params).then(res => { getGasDetailByStoreKey(params).then(res => {
uni.hideLoading(); uni.hideLoading();
if (res.return_code == '000000') { if (res.return_code == '000000') {
this.storeList = res.return_data; this.storeList = res.return_data;
if(!this.oilNo){ if (!this.oilNo) {
this.oilNo = res.return_data.oilPriceList[0].oilNoName; this.oilNo = res.return_data.oilPriceList[0].oilNoName;
this.priceVip = res.return_data.oilPriceList[0].priceVip; this.priceVip = res.return_data.oilPriceList[0].priceVip;
this.priceGun = res.return_data.oilPriceList[0].priceGun; this.priceGun = res.return_data.oilPriceList[0].priceGun;
this.priceOfficial = res.return_data.oilPriceList[0].priceOfficial; this.priceOfficial = res.return_data.oilPriceList[0].priceOfficial;
this.detailList = res.return_data.oilPriceList; this.detailList = res.return_data.oilPriceList;
this.oilType = res.return_data.oilPriceList[0].oilType; this.oilType = res.return_data.oilPriceList[0].oilType;
this.gasGunList = res.return_data.gasGunList; this.gasGunList = res.return_data.gasGunList;
for (var i = 0; i < res.return_data.gasGunList.length; i++) { for (var i = 0; i < res.return_data.gasGunList.length; i++) {
if (this.oilNo == res.return_data.gasGunList[i].oilNoName) { if (this.oilNo == res.return_data.gasGunList[i].oilNoName) {
this.gunnumber.push(res.return_data.gasGunList[i]) this.gunnumber.push(res.return_data.gasGunList[i])
this.gunNo = res.return_data.gasGunList[i].gunNo; this.gunNo = res.return_data.gasGunList[i].gunNo;
this.gasOilNo = res.return_data.gasGunList[i].oilNo; this.gasOilNo = res.return_data.gasGunList[i].oilNo;
} }
} }
} }
} else { } else {
uni.showToast({ uni.showToast({
@ -302,7 +302,7 @@
select(amount) { select(amount) {
this.inputMoney = amount.price; this.inputMoney = amount.price;
this.litre = parseFloat(amount.price / this.priceGun).toFixed(2); this.litre = parseFloat(amount.price / this.priceGun).toFixed(2);
this.totalPrice = parseFloat(amount.price / this.priceGun * this.priceVip).toFixed(1); this.totalPrice = parseFloat(amount.price / this.priceGun * this.priceVip).toFixed(2);
if (this.priceVip != this.priceGun) { if (this.priceVip != this.priceGun) {
let gbprice = parseFloat(this.litre * this.priceOfficial).toFixed(2); let gbprice = parseFloat(this.litre * this.priceOfficial).toFixed(2);
this.discountPrice = parseFloat(gbprice - this.inputMoney).toFixed(2); this.discountPrice = parseFloat(gbprice - this.inputMoney).toFixed(2);
@ -318,8 +318,8 @@
Listeningfocus() { Listeningfocus() {
var a = /^[0-9]+(\.[0-9]{1})?$/; var a = /^[0-9]+(\.[0-9]{1})?$/;
var b = /^[0-9]+(.[0-9]{1})?$/; var b = /^[0-9]+(.[0-9]{1})?$/;
if (this.inputMoney == '' || this.inputMoney < 10 || !(b.test(this.inputMoney)) || !(a.test(this var c = /^([1-9][0-9]*)+(\.[0-9]{1,2})?$/;
.inputMoney))) { if (this.inputMoney == '' || this.inputMoney < 10 || !(c.test(this.inputMoney))) {
uni.showToast({ uni.showToast({
title: '请输入正确加油金额', title: '请输入正确加油金额',
icon: "none", icon: "none",
@ -327,7 +327,8 @@
}); });
this.totalPrice = '0.00'; this.totalPrice = '0.00';
this.discountPrice = '0.00'; this.discountPrice = '0.00';
this.litre = ''; this.litre = '';
this.inputMoney = '';
return; return;
} }
@ -339,25 +340,25 @@
// duration:2000 // duration:2000
// }); // });
// return; // return;
// } // }
if (parseInt(this.inputMoney) > parseInt(this.xzMoney)) {
if (this.inputMoney > this.xzMoney) {
uni.showToast({ uni.showToast({
title: '加油金额不能超过' + this.xzMoney + '元', title: '加油金额不能超过' + this.xzMoney + '元',
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
this.inputMoney = this.xzMoney; this.inputMoney = this.xzMoney;
} return;
}
// //
this.litre = parseFloat(this.inputMoney / this.priceOfficial).toFixed(2); this.litre = parseFloat(this.inputMoney / this.priceOfficial).toFixed(2);
this.totalPrice = parseFloat(this.inputMoney / this.priceOfficial * this.priceVip).toFixed(1); var arr1 = parseFloat(this.inputMoney / this.priceOfficial * this.priceVip).toFixed(4);
this.totalPrice = this.numFilter(arr1);
if (this.priceVip != this.priceOfficial) { if (this.priceVip != this.priceOfficial) {
let gbprice = parseFloat(this.litre * this.priceOfficial).toFixed(2); // let gbprice = parseFloat(this.litre * this.priceOfficial).toFixed(2);
this.discountPrice = parseFloat(gbprice - this.totalPrice).toFixed(1); // this.discountPrice = parseFloat(gbprice - this.totalPrice).toFixed(2);
this.discountPrice = parseFloat(this.inputMoney - this.totalPrice).toFixed(2);
} }
// //
// this.litre = parseFloat(this.inputMoney / this.priceGun).toFixed(2); // this.litre = parseFloat(this.inputMoney / this.priceGun).toFixed(2);
@ -373,6 +374,13 @@
url: '../../userLogin/userLogin' url: '../../userLogin/userLogin'
}) })
}, },
//
numFilter(tempVal) {
//
// let tempVal = parseFloat(value).toFixed(3)
let realVal = tempVal.substring(0, tempVal.length - 2)
return realVal
},
/** /**
* 定位 * 定位
*/ */
@ -441,7 +449,7 @@
"gasPriceVip": this.priceVip "gasPriceVip": this.priceVip
}] }]
} }
addOrder(goods).then(res => { addOrder(goods).then(res => {
uni.hideLoading(); uni.hideLoading();
if (res.return_code == '000000') { if (res.return_code == '000000') {

@ -244,7 +244,7 @@
methods: { methods: {
jumpcdx() { jumpcdx() {
location.href = location.href =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsg.dctpay.com%2FhsgH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect'; 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FhsgH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect';
}, },
// //
getCmsContentcmsContent() { getCmsContentcmsContent() {

Loading…
Cancel
Save