oil-station/gasStation-uni/pages/refuel/refuel.vue

815 lines
20 KiB
Vue
Raw Normal View History

2023-11-27 09:24:16 +08:00
<template>
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-text">一键加油</view>
</view>
<view class="top">
<view class="top-box">
2024-01-03 18:40:21 +08:00
<view class="dis" style="width: 78%;">
2023-11-27 09:24:16 +08:00
<view class="top-img">
2024-01-24 17:32:57 +08:00
<image v-if="!store.logo" src="../../static/logo.png" mode="aspectFit"></image>
<image v-else :src="baseUrl+store.logo" mode="aspectFit"></image>
2023-11-27 09:24:16 +08:00
</view>
2023-12-01 16:04:45 +08:00
<view style="width: 80%;">
<view class="top-title">{{store.name}}{{store.description ? "("+store.description+")" : ""}}
</view><!--九州加油站总站-->
2023-11-28 18:33:35 +08:00
<view class="top-hui">{{store.address}}</view><!--平安大道东200米-->
2024-01-03 18:40:21 +08:00
<view class="top-hong">{{oilPrice}}/{{oilUnit ? oilUnit : "L"}}</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
2024-01-03 18:40:21 +08:00
<view class="" @click="goRefuel" style="width: 22%;font-size: 14px;">
2023-11-27 09:24:16 +08:00
<view class="bulu">切换站点 <uni-icons type="right" color="#304fff" size="16"></uni-icons> </view>
</view>
<!-- <view class="bulu-icon">
<view class=""></view>
<view class="">比国标降 0.22 </view>
</view> -->
</view>
2024-01-30 16:04:49 +08:00
2024-01-31 17:05:12 +08:00
<view v-if="appltType == 'ALIPAY'" style="height: 400px;overflow-y: scroll;">
<view class="fa-box">
<view class="fa-title">选择油号 <text class="top-hui"> 请务必与员工确认类型</text> </view>
<view class="wrap-box">
<!-- <view class="box-oil" :class=" {'xz' :hindex == index }" @click="getHIndex(index)"
v-for="(item,index) in 4" :key="index">
<text>92#</text>
</view> -->
<view class="box-oil" v-for="(item,index) in oilNumberList" :key="index"
:class=" {'xz' :hindex == index }" @click="getHIndex(index,item)">
<text>{{item.oilName}}</text>
</view>
</view>
</view>
<view class="fa-box">
<view class="fa-title">选择油枪 <text class="top-hui"> 请务必与员工确认枪号</text> </view>
<view class="wrap-box">
<!-- <view class="box-oil" :class=" {'xz' :qindex == index }" @click="getQIndex(index)"
v-for="(item,index) in 8" :key="index">
<text>{{index}}号枪</text>
</view> -->
<view class="box-oil" :class=" {'xz' :qindex == index }" v-for="(item,index) in oilGunList"
:key="index" @click="getQIndex(index,item)">
<text>{{item.gunName}}</text>
</view>
</view>
</view>
<view class="fa-box">
<view class="fa-title">请输入加油金额</view>
<view class="inputkuang" @click="openKey">
<view class="sbox"></view>
<view class="sbox" style="text-align: center;font-weight: bold;">{{value}}</view>
<view class="sbox-hui">{{liters}}L</view>
</view>
<view class="wrap-box">
<view class="box-oil1" :class=" {'xz' :aindex == index }" @click="getAIndex(index,item)"
v-for="(item,index) in amountList" :key="index">
<text>{{item}}</text>
</view>
</view>
</view>
<view class="anniu" @click="submitAmount">
<text>立即加油</text>
</view>
</view>
<view v-if="appltType == 'WECHAT'" style="height: 500px;overflow-y: scroll;">
2024-01-30 16:04:49 +08:00
<view class="fa-box">
<view class="fa-title">选择油号 <text class="top-hui"> 请务必与员工确认类型</text> </view>
<view class="wrap-box">
<!-- <view class="box-oil" :class=" {'xz' :hindex == index }" @click="getHIndex(index)"
v-for="(item,index) in 4" :key="index">
<text>92#</text>
</view> -->
<view class="box-oil" v-for="(item,index) in oilNumberList" :key="index"
:class=" {'xz' :hindex == index }" @click="getHIndex(index,item)">
<text>{{item.oilName}}</text>
</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
2024-01-30 16:04:49 +08:00
<view class="fa-box">
<view class="fa-title">选择油枪 <text class="top-hui"> 请务必与员工确认枪号</text> </view>
<view class="wrap-box">
<!-- <view class="box-oil" :class=" {'xz' :qindex == index }" @click="getQIndex(index)"
v-for="(item,index) in 8" :key="index">
<text>{{index}}号枪</text>
</view> -->
<view class="box-oil" :class=" {'xz' :qindex == index }" v-for="(item,index) in oilGunList"
:key="index" @click="getQIndex(index,item)">
<text>{{item.gunName}}</text>
</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
2024-01-30 16:04:49 +08:00
<view class="fa-box">
<view class="fa-title">请输入加油金额</view>
<view class="inputkuang" @click="openKey">
<view class="sbox"></view>
<view class="sbox" style="text-align: center;font-weight: bold;">{{value}}</view>
<view class="sbox-hui">{{liters}}L</view>
</view>
<view class="wrap-box">
<view class="box-oil1" :class=" {'xz' :aindex == index }" @click="getAIndex(index,item)"
v-for="(item,index) in amountList" :key="index">
<text>{{item}}</text>
</view>
2023-11-28 18:33:35 +08:00
</view>
</view>
2024-01-30 16:04:49 +08:00
<view class="anniu" @click="submitAmount">
<text>立即加油</text>
</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
2024-01-06 15:47:07 +08:00
<!-- <u-keyboard ref="uKeyboard" :tips="value" mode="number" @cancel="show = false" @confirm="submitAmount"
@change="valChange" @backspace="backspace" v-model="pic" :show="show"></u-keyboard> -->
<view style="margin-top: 50px;">
<uni-popup ref="popup1" type="bottom" background-color="white" mask-background-color="rgba(0,0,0,0.0)">
<keyboard :pApplt="appltType" @isPay="submitAmount" @amount="changeVal" @backVal="backspaceVal">
</keyboard>
</uni-popup>
</view>
2023-12-01 16:04:45 +08:00
2023-11-28 18:33:35 +08:00
<view>
<uni-popup ref="popup" type="bottom">
<view style="background-color: #f4f5f6;width: 100%;height: 55vh;">
<view style="display: flex;justify-content: space-between;height: 50px;line-height: 50px">
<view style="font-size: 18px;margin-left: 40%;">请选择员工</view>
<uni-icons type="closeempty" size="30" @click="closeStaff"></uni-icons>
</view>
<view class="wrap-box1" style="margin-left: 5%;">
2023-11-30 18:30:46 +08:00
<!-- <view class="box-oil2" :class=" {'xz' :sindex == index }" @click="getSIndex(index)"
2023-11-28 18:33:35 +08:00
v-for="(item,index) in 19" :key="index">
<text>{{index}}员工</text>
2023-11-30 18:30:46 +08:00
</view> -->
2024-01-24 17:32:57 +08:00
<view class="box-oil2" :class=" {'xz' :sindex == index }" v-for="(item,index) in staffList"
:key="index" @click="getSIndex(index,item.id)">
2023-12-27 18:44:56 +08:00
<text>{{item.realName}}</text>
2023-11-28 18:33:35 +08:00
</view>
</view>
<tabbar></tabbar>
</view>
</uni-popup>
</view>
2023-12-01 16:04:45 +08:00
2023-11-27 09:24:16 +08:00
<tabbar></tabbar>
</view>
</view>
</template>
<script>
import tabbar from "../../components/tabbar/tabbar.vue"
2023-11-30 18:30:46 +08:00
import config from '@/config'
import request from '../../utils/request'
2023-11-27 09:24:16 +08:00
export default {
data() {
return {
2024-01-24 17:32:57 +08:00
appltType: uni.getStorageSync("appltType"),
2023-11-27 09:24:16 +08:00
value: '',
2024-01-24 17:32:57 +08:00
liters: 0,
2023-11-27 09:24:16 +08:00
show: false,
pic: 0,
hindex: 0,
2024-01-04 18:44:52 +08:00
qindex: 0,
2023-12-01 15:40:43 +08:00
aindex: null,
sindex: null,
2023-11-28 18:33:35 +08:00
// 店铺信息
2024-01-24 17:32:57 +08:00
store: {
name: "测试油站",
description: "济南分店",
address: "济南槐荫区"
2023-12-01 16:59:31 +08:00
},
2023-11-28 18:33:35 +08:00
// 店铺福利信息
2024-01-24 17:32:57 +08:00
welfare: [],
2023-11-28 18:33:35 +08:00
// 距离信息
distance: "",
// 当前店铺id
2024-01-24 17:32:57 +08:00
storeId: "",
2023-11-28 18:33:35 +08:00
// 油号列表信息
2024-01-24 17:32:57 +08:00
oilNumberList: [],
2023-11-28 18:33:35 +08:00
// 油枪列表信息
2024-01-24 17:32:57 +08:00
oilGunList: [],
2023-11-29 16:26:19 +08:00
// 员工列表信息
staffList: [],
// 加油金额列表
2024-01-24 17:32:57 +08:00
amountList: [100, 200, 300],
2023-11-29 16:26:19 +08:00
// url信息
baseUrl: this.$baseUrl,
2023-11-30 18:30:46 +08:00
// 油价
2024-01-24 17:32:57 +08:00
oilPrice: 0,
2023-11-30 18:30:46 +08:00
// 油品单位
2024-01-24 17:32:57 +08:00
oilUnit: "",
AppToken: uni.getStorageSync("App-Token"),
2023-11-30 18:30:46 +08:00
// 油品订单信息
2024-01-24 17:32:57 +08:00
oilOrder: {
storeId: "",
couponId: "",
commissionAmount: 0,
staffId: "",
terminal: "applet",
oils: "",
oilGunNum: "",
oilNum: "",
orderAmount: 0,
discountAmount: 0,
payAmount: 0,
payType: uni.getStorageSync("appltType"),
2023-11-30 18:30:46 +08:00
},
2023-11-27 09:24:16 +08:00
}
},
components: {
tabbar
},
2023-12-18 18:44:02 +08:00
onLoad(query) {
2024-01-24 17:32:57 +08:00
if (uni.getStorageSync("appltType") == "WECHAT") {
2024-01-22 14:25:45 +08:00
const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容
if (query.q) {
let str = q.split("?")[1];
let storeId = "19";
2024-01-24 17:32:57 +08:00
2024-01-22 14:25:45 +08:00
let staffId = "";
2024-01-24 17:32:57 +08:00
if (str.includes("&")) {
2024-01-22 14:25:45 +08:00
let arr = str.split("&");
arr.forEach(item => {
if (item.includes("storeId")) {
storeId = item.split("=")[1]
} else {
staffId = item.split("=")[1]
}
})
2024-01-24 17:32:57 +08:00
} else {
2024-01-22 14:25:45 +08:00
storeId = str.split("=")[1]
}
uni.setStorageSync("storeId", storeId)
uni.setStorageSync("inviteStaffId", staffId)
this.storeId = uni.getStorageSync("storeId")
this.staffId = uni.getStorageSync("inviteStaffId")
this.getStore(uni.getStorageSync("storeId"));
}
2024-01-24 17:32:57 +08:00
} else {
if (uni.getStorageSync("storeId")) {
2024-01-22 14:25:45 +08:00
this.getStore(uni.getStorageSync("storeId"));
2024-01-05 18:27:59 +08:00
}
2024-01-22 14:25:45 +08:00
}
2024-01-24 17:32:57 +08:00
2023-12-18 18:44:02 +08:00
},
2023-11-28 18:33:35 +08:00
onShow() {
2023-12-01 15:40:43 +08:00
// this.isExistStoreId();
2023-12-29 16:52:08 +08:00
this.getStore(uni.getStorageSync("storeId"));
// this.getStore(0);
2024-01-24 17:32:57 +08:00
this.getTheJudgmentIsTheSame()
2023-11-28 18:33:35 +08:00
},
2023-11-27 09:24:16 +08:00
methods: {
2024-01-06 15:47:07 +08:00
// 打开数字键盘
openKey() {
this.show = true
this.$refs.popup1.open('bottom')
},
2024-01-24 17:32:57 +08:00
isExistStoreId() {
if (uni.getStorageSync("storeId") != "") {
2023-12-01 15:40:43 +08:00
this.getStore(uni.getStorageSync("storeId"));
2024-01-24 17:32:57 +08:00
} else {
2023-11-29 16:26:19 +08:00
this.getAddress();
}
},
// 获取门店信息
2024-01-24 17:32:57 +08:00
getStore(id) {
2024-01-06 10:02:09 +08:00
// uni.showToast({
// title:333
// })
2023-11-29 16:26:19 +08:00
let _this = this;
2023-11-30 18:30:46 +08:00
request({
url: "business/storeInformation/store/queryStoreById",
method: 'post',
2024-01-24 17:32:57 +08:00
data: {
"storeId": id
},
}).then((res) => {
2023-11-30 18:30:46 +08:00
_this.getOilNumber(id);
_this.getStaffList(id)
_this.store = res.data
2023-12-01 15:40:43 +08:00
_this.storeId = res.data.id;
2024-01-24 15:14:48 +08:00
uni.setStorageSync("storeId", _this.store.id)
uni.setStorageSync("chainStoreId", _this.store.chainStoreId)
2023-11-30 18:30:46 +08:00
let welfare = res.data.welfare
2024-01-05 18:27:59 +08:00
if (welfare) {
2023-11-30 18:30:46 +08:00
if (welfare.includes(",")) {
_this.welfare = res.data.welfare.split(",")
} else {
_this.welfare.push(res.data.welfare)
2023-11-29 16:26:19 +08:00
}
}
2024-01-05 18:27:59 +08:00
}).catch(err => {
uni.showLoading({
2024-01-24 17:32:57 +08:00
title: JSON.stringify(err) + 222
2024-01-05 18:27:59 +08:00
})
2023-11-29 16:26:19 +08:00
})
},
2023-11-28 18:33:35 +08:00
// 获取当前位置
2024-01-24 17:32:57 +08:00
getAddress() {
2023-11-28 18:33:35 +08:00
let _this = this;
uni.getLocation({
// 谷歌使用wgs84 其他使用gcj02
2024-01-24 17:32:57 +08:00
type: 'gcj02', // 使用国测局坐标系
2023-11-28 18:33:35 +08:00
success: function(res) {
// console.log('经度: ' + res.longitude);
// console.log('纬度: ' + res.latitude);
2023-11-30 18:30:46 +08:00
request({
url: "business/storeInformation/store/recentlyStore",
method: 'post',
2023-11-28 18:33:35 +08:00
data: {
"lon": res.longitude,
"lat": res.latitude
},
2024-01-24 17:32:57 +08:00
}).then((response) => {
2023-11-30 18:30:46 +08:00
_this.distance = (response.data.distance).toFixed(1);
_this.store = response.data.store;
_this.storeId = response.data.store.id;
_this.getOilNumber(_this.storeId);
_this.getStaffList(_this.storeId)
let welfare = response.data.store.welfare;
2024-01-24 17:32:57 +08:00
if (welfare != undefined && welfare != null && welfare != "") {
if (welfare.includes(",")) {
_this.welfare = response.data.store.welfare.split(",");
} else {
_this.welfare.push(response.data.store.welfare);
}
2023-11-28 18:33:35 +08:00
}
})
},
fail: function(err) {
2023-11-30 18:30:46 +08:00
_this.getStore(0);
2023-11-28 18:33:35 +08:00
}
});
},
// 获取当前店铺油号信息
2024-01-24 17:32:57 +08:00
getOilNumber(storeId) {
2023-11-28 18:33:35 +08:00
let _this = this;
2023-11-30 18:30:46 +08:00
request({
2024-01-18 15:01:26 +08:00
// url: "business/petrolStationManagement/oilNumber/getOilNumberName/" + storeId,
url: "business/petrolStationManagement/oilGun/selectByNumber/" + storeId,
2023-11-30 18:30:46 +08:00
method: 'get',
2024-01-24 17:32:57 +08:00
}).then((res) => {
2023-11-30 18:30:46 +08:00
_this.oilNumberList = res.data;
2024-01-24 17:32:57 +08:00
if (res.data) {
2024-01-18 15:01:26 +08:00
// _this.getOilGun(res.data[0].numberId);
2024-01-18 18:15:24 +08:00
_this.oilPrice = res.data[0].oilPrice
2023-12-01 15:40:43 +08:00
_this.oilUnit = res.data[0].unit
2024-01-18 15:01:26 +08:00
_this.oilOrder.oils = res.data[0].oilNameId
2024-01-24 17:32:57 +08:00
if (res.data[0].oilGunList) {
2024-01-18 15:01:26 +08:00
_this.oilGunList = res.data[0].oilGunList
_this.oilOrder.oilGunNum = res.data[0].oilGunList[0].id
2024-01-24 17:32:57 +08:00
uni.setStorageSync("tankId", res.data[0].oilGunList[0].tankId)
2024-01-18 15:01:26 +08:00
}
2023-12-01 15:40:43 +08:00
}
2023-11-28 18:33:35 +08:00
})
},
// 获取当前店铺油号对应的油枪信息
2024-01-24 17:32:57 +08:00
getOilGun(numberId) {
2023-11-29 16:26:19 +08:00
let _this = this;
2023-11-30 18:30:46 +08:00
request({
url: "business/petrolStationManagement/oilGun/queryGunList/" + numberId,
method: 'get',
2024-01-24 17:32:57 +08:00
}).then((res) => {
2023-11-30 18:30:46 +08:00
_this.oilGunList = res.data
2024-01-13 18:01:23 +08:00
_this.oilOrder.oilGunNum = res.data[0].id
2023-11-29 16:26:19 +08:00
})
},
2023-12-01 15:40:43 +08:00
// 获取当前店铺员工信息列表
2024-01-24 17:32:57 +08:00
getStaffList(storeId) {
2023-11-29 16:26:19 +08:00
let _this = this;
2023-11-30 18:30:46 +08:00
request({
2024-01-31 17:05:12 +08:00
url: "business/member/staff/queryList",
method: 'post',
data:{storeId:storeId}
2024-01-24 17:32:57 +08:00
}).then((res) => {
2023-11-30 18:30:46 +08:00
_this.staffList = res.data
2023-11-28 18:33:35 +08:00
})
},
2023-12-01 15:40:43 +08:00
// 跳转订单详情页,并支付
2024-01-24 17:32:57 +08:00
getSIndex(index, id) {
2023-11-28 18:33:35 +08:00
this.sindex = index
2024-01-22 14:25:45 +08:00
// 校验油罐内油量是否足够
request({
url: "business/petrolStationManagement/oilTank/" + uni.getStorageSync('tankId'),
method: 'get',
2024-01-24 17:32:57 +08:00
}).then((res) => {
if (res.data.storedQuantity - this.liters < 0) {
2024-01-22 14:25:45 +08:00
uni.showToast({
2024-01-24 17:32:57 +08:00
title: "所加油的升数大于油罐内的升数,请重新选择加油升数",
icon: "none"
2024-01-22 14:25:45 +08:00
})
return;
2024-01-24 17:32:57 +08:00
} else {
2024-01-22 14:25:45 +08:00
this.toPayment(id)
}
2024-01-24 17:32:57 +08:00
2024-01-22 14:25:45 +08:00
})
2023-12-18 18:44:02 +08:00
},
2024-01-24 17:32:57 +08:00
toPayment(id) {
2023-12-01 15:40:43 +08:00
this.oilOrder.orderAmount = this.value
this.oilOrder.storeId = this.storeId
this.oilOrder.staffId = id
2024-01-24 17:32:57 +08:00
this.oilOrder.oilNum = (this.value / this.oilPrice).toFixed(2)
2024-01-17 14:14:19 +08:00
this.oilOrder.tankId = uni.getStorageSync("tankId")
2023-12-01 15:40:43 +08:00
let _this = this;
2023-11-30 18:30:46 +08:00
// 添加油品订单信息
2023-12-01 15:40:43 +08:00
request({
url: "business/oilOrder/addOilOrder",
method: 'post',
data: _this.oilOrder,
2024-01-24 17:32:57 +08:00
}).then((res) => {
2023-12-01 15:40:43 +08:00
uni.navigateTo({
url: '/pagesRefuel/orderDetail/index?orderNo=' + res.data,
})
2023-11-30 18:30:46 +08:00
})
2023-11-28 18:33:35 +08:00
},
2023-12-01 15:40:43 +08:00
// 选择加油金额
2024-01-24 17:32:57 +08:00
getAIndex(index, amount) {
this.value = amount + ""
2023-11-28 18:33:35 +08:00
this.aindex = index
2024-01-24 17:32:57 +08:00
this.liters = (amount / this.oilPrice).toFixed(2)
2023-11-28 18:33:35 +08:00
},
2023-12-01 15:40:43 +08:00
// 选择油品信息
2024-01-24 17:32:57 +08:00
getHIndex(index, data) {
2023-11-27 09:24:16 +08:00
this.hindex = index
2024-01-06 15:47:07 +08:00
// console.log(data)
2024-01-18 15:01:26 +08:00
// this.getOilGun(data.numberId)
this.oilGunList = data.oilGunList
this.oilOrder.oilGunNum = data.oilGunList[0].id
2024-01-18 18:15:24 +08:00
this.oilPrice = data.oilPrice
2023-11-30 18:30:46 +08:00
this.oilUnit = data.unit
2024-01-18 15:01:26 +08:00
this.oilOrder.oils = data.oilNameId
2024-01-24 17:32:57 +08:00
uni.setStorageSync("tankId", data.oilGunList[0].tankId)
2023-11-27 09:24:16 +08:00
},
2023-12-01 15:40:43 +08:00
// 选择油枪信息
2024-01-24 17:32:57 +08:00
getQIndex(index, data) {
2023-11-27 09:24:16 +08:00
this.qindex = index
2024-01-13 18:01:23 +08:00
this.oilOrder.oilGunNum = data.id
2024-01-24 17:32:57 +08:00
uni.setStorageSync("tankId", data.tankId)
2023-11-27 09:24:16 +08:00
},
2023-11-28 18:33:35 +08:00
goRefuel() {
2023-11-27 09:24:16 +08:00
uni.navigateTo({
url: '/pagesRefuel/pagesRefuel/index'
})
},
2024-01-24 17:32:57 +08:00
change() {
2023-12-01 16:04:45 +08:00
2023-11-28 18:33:35 +08:00
},
// 关闭弹窗
2024-01-24 17:32:57 +08:00
closeStaff() {
2023-11-28 18:33:35 +08:00
this.$refs.popup.close()
},
// 数字键盘确定按钮
2024-01-24 17:32:57 +08:00
submitAmount() {
2024-01-22 09:08:20 +08:00
// 校验油罐内油量是否足够
request({
url: "business/petrolStationManagement/oilTank/" + uni.getStorageSync('tankId'),
method: 'get',
2024-01-24 17:32:57 +08:00
}).then((res) => {
if (res.data.storedQuantity - this.liters < 0) {
2023-12-01 16:26:25 +08:00
uni.showToast({
2024-01-24 17:32:57 +08:00
title: "所加油的升数大于油罐内的升数,请重新选择加油升数",
icon: "none"
2023-12-01 16:26:25 +08:00
})
2024-01-22 09:08:20 +08:00
return;
2024-01-24 17:32:57 +08:00
} else {
if (this.value != "" && this.qindex != null) {
2024-01-22 09:08:20 +08:00
this.show = false
2024-01-31 17:05:12 +08:00
if (uni.getStorageSync("inviteStaffId") || this.staffList.length==0) {
2024-01-22 09:08:20 +08:00
this.toPayment(uni.getStorageSync("inviteStaffId"))
2024-01-24 17:32:57 +08:00
} else {
2024-01-22 09:08:20 +08:00
this.$refs.popup.open('bottom')
}
2024-01-24 17:32:57 +08:00
} else {
if (this.value == "") {
2024-01-22 09:08:20 +08:00
uni.showToast({
2024-01-24 17:32:57 +08:00
title: "请输入加油金额",
icon: "error"
2024-01-22 09:08:20 +08:00
})
2024-01-24 17:32:57 +08:00
} else {
2024-01-22 09:08:20 +08:00
uni.showToast({
2024-01-24 17:32:57 +08:00
title: "请选择油枪号",
icon: "error"
2024-01-22 09:08:20 +08:00
})
}
}
2023-12-01 16:26:25 +08:00
}
2024-01-22 09:08:20 +08:00
})
2024-01-24 17:32:57 +08:00
2023-11-28 18:33:35 +08:00
},
2024-01-06 15:47:07 +08:00
changeVal(val) {
this.value = val;
2024-01-24 17:32:57 +08:00
this.liters = (this.value / this.oilPrice).toFixed(2)
2024-01-06 15:47:07 +08:00
},
backspaceVal(val) {
this.value = val;
if (val == "") {
this.amount = 0
this.liters = 0
} else {
this.amount = val;
2024-01-24 17:32:57 +08:00
this.liters = (this.value / this.oilPrice).toFixed(2)
2024-01-06 15:47:07 +08:00
}
},
2023-11-27 09:24:16 +08:00
valChange(val) {
// 将每次按键的值拼接到value变量中注意+=写法
2023-12-18 18:44:02 +08:00
uni.vibrateShort({
2024-01-24 17:32:57 +08:00
success: function() {}
2023-12-18 18:44:02 +08:00
});
let index = this.value.indexOf(".")
2024-01-24 17:32:57 +08:00
if (index != -1) {
if ((this.value.length - index) >= 3) {
2023-12-18 18:44:02 +08:00
return;
}
2024-01-24 17:32:57 +08:00
} else {
if (this.value.length >= 7 && val != ".") {
2023-12-18 18:44:02 +08:00
return;
}
}
this.value += val;
2024-01-24 17:32:57 +08:00
this.liters = (this.value / this.oilPrice).toFixed(2)
2023-12-18 18:44:02 +08:00
// console.log(this.value);
2023-11-27 09:24:16 +08:00
},
2024-01-24 17:32:57 +08:00
// 判断token是否与当前连锁店id相同
2024-01-26 10:48:51 +08:00
async getTheJudgmentIsTheSame() {
2024-01-24 17:32:57 +08:00
// 判断是否登录
if (!this.AppToken) {
return;
}
2024-01-26 10:48:51 +08:00
await request({
2024-01-24 17:32:57 +08:00
url: 'chainStoreInfo/theJudgmentIsTheSame',
method: 'get',
data: {
"chainStoreId": uni.getStorageSync("chainStoreId")
}
}).then(res => {
if (!res.data) {
uni.removeStorageSync("App-Token");
}
})
2024-01-26 10:48:51 +08:00
2024-01-29 11:51:24 +08:00
if (uni.getStorageSync("appltType")== "WECHAT") {
// 判断当前登录的code是否相同
wx.login({
success(res) {
if (res.code) {
//发起网络请求
request({
url: 'clientApi/sign/mpWxLogin2',
method: "POST",
data: {
code: res.code
}
}).then(res => {
if (!res.data) {
uni.removeStorageSync("App-Token");
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
2024-01-26 10:48:51 +08:00
}
2024-01-29 11:51:24 +08:00
})
}
2024-01-24 17:32:57 +08:00
},
2023-11-27 09:24:16 +08:00
// 退格键被点击
backspace() {
2023-12-18 18:44:02 +08:00
uni.vibrateShort({
2024-01-24 17:32:57 +08:00
success: function() {}
2023-12-18 18:44:02 +08:00
});
2023-11-27 09:24:16 +08:00
// 删除value的最后一个字符
2023-12-18 18:44:02 +08:00
if (this.value.length) {
this.value = this.value.substr(0, this.value.length - 1);
2024-01-24 17:32:57 +08:00
this.liters = (this.value / this.oilPrice).toFixed(2)
2023-12-18 18:44:02 +08:00
}
// console.log(this.value);
2023-11-27 09:24:16 +08:00
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #ffffff;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 88px;
}
.my-header {
width: 100%;
height: 88px;
background: #304fff;
display: flex;
align-items: center;
justify-content: center;
color: white;
.my-text {
margin-top: 40px
}
position: fixed;
top: 0px;
}
.top {
width: 100%;
height: 200px;
background-image: linear-gradient(180deg, #304fff, #ffffff);
box-sizing: border-box;
padding: 1px;
}
.top-box {
width: 90%;
2023-11-30 18:30:46 +08:00
height: 110px;
2023-11-27 09:24:16 +08:00
background-color: #ffffff;
border-radius: 8px;
margin: 20px auto;
box-sizing: border-box;
padding: 10px;
display: flex;
justify-content: space-between;
margin-top: 60px;
}
.top-title {
font-size: 16px;
}
.top-img {
width: 46px;
height: 46px;
background-color: #304fff;
border-radius: 6px;
overflow: hidden;
margin-right: 10px;
image {
width: 100%;
height: 100%;
}
}
.top-hui {
font-size: 14px;
margin: 5px 0px;
color: #999999;
2023-12-01 16:04:45 +08:00
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
2023-11-27 09:24:16 +08:00
}
.top-hong {
font-size: 16px;
font-weight: bold;
color: #ff0000;
}
.dis {
display: flex;
}
.bulu {
color: #304fff;
}
.bulu-icon {
width: 120px;
height: 20px;
font-size: 12px;
color: #304fff;
border: 1px solid #304fff;
display: flex;
justify-content: center;
align-items: center;
}
.wrap-box {
width: 100%;
display: flex;
flex-wrap: wrap;
}
2024-01-24 17:32:57 +08:00
2023-11-28 18:33:35 +08:00
.wrap-box1 {
width: 100%;
display: flex;
flex-wrap: wrap;
2024-01-29 14:50:20 +08:00
2023-11-28 18:33:35 +08:00
overflow-y: scroll;
}
2023-11-27 09:24:16 +08:00
.box-oil {
width: 23%;
display: flex;
align-items: center;
justify-content: center;
color: #666666;
background: #f7f7f7;
margin-right: 5px;
margin-top: 5px;
padding: 12px 0px;
border-radius: 6px;
}
2024-01-24 17:32:57 +08:00
2023-11-28 18:33:35 +08:00
.box-oil1 {
width: 29%;
display: flex;
align-items: center;
justify-content: center;
color: #666666;
background: #f7f7f7;
margin-right: 13px;
margin-top: 5px;
padding: 12px 0px;
border-radius: 6px;
2024-01-29 14:50:20 +08:00
margin-bottom: 10px;
2023-11-28 18:33:35 +08:00
}
2024-01-24 17:32:57 +08:00
2023-11-28 18:33:35 +08:00
.box-oil2 {
width: 28%;
2023-12-27 18:44:56 +08:00
height: 25px;
line-height: 25px;
2023-11-28 18:33:35 +08:00
display: flex;
align-items: center;
justify-content: center;
color: #666666;
background: white;
margin-right: 13px;
2024-01-29 14:50:20 +08:00
2023-11-28 18:33:35 +08:00
padding: 12px 0px;
border-radius: 6px;
}
2023-11-27 09:24:16 +08:00
.fa-box {
width: 90%;
margin: 20px auto;
}
.fa-title {
font-size: 18px;
margin: 10px 0px;
}
.xz {
color: #ffffff;
background: #1678ff;
}
.anniu {
width: 90%;
margin: 10px auto;
height: 40px;
background: #1678ff;
color: white;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
}
.inputkuang {
width: 100%;
height: 40px;
border: 1px solid #304fff;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0px 10px;
}
.sbox {
width: 33%;
}
.sbox-hui {
width: 33%;
text-align: right;
color: #999999;
}
2024-01-29 14:50:20 +08:00
</style>