12.01前端 index

This commit is contained in:
@QQNZX 2023-12-01 16:20:02 +08:00
parent 2da1c46915
commit 74efa27e2a

View File

@ -83,9 +83,9 @@
<view class="hui1">{{ store.address }}</view> <view class="hui1">{{ store.address }}</view>
<view class="hui2" v-if="distance!=''">{{ distance }}km</view> <view class="hui2" v-if="distance!=''">{{ distance }}km</view>
</view> </view>
<view class="lananniu" @click="goGoGo" v-if="distance!=''"> <view class="lananniu" @click="goGoGo" v-if="distance!=''">
<uni-icons type="paperplane-filled" color="#195ADA" <uni-icons type="paperplane-filled" color="#195ADA" size="16"></uni-icons>
size="16"></uni-icons> {{ distance*1000 }} {{ distance || "0" }}KM
</view> </view>
</view> </view>
<!-- <scroll-view scroll-x="true"> <!-- <scroll-view scroll-x="true">
@ -106,7 +106,8 @@
</view> </view>
<!-- 加油站卡片结束--> <!-- 加油站卡片结束-->
<!-- <u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker> --> <!-- <u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker> -->
<u-picker :columns="columns" @confirm="confirm" :show="show" @cancel="show = false" keyName="label"></u-picker> <u-picker :columns="columns" @confirm="confirm" :show="show" @cancel="show = false"
keyName="label"></u-picker>
<!--外层结束 --> <!--外层结束 -->
<tabbar :msg="msg"></tabbar> <tabbar :msg="msg"></tabbar>
@ -127,14 +128,14 @@
title: '', title: '',
oilTypeList: '', oilTypeList: '',
columns: [ columns: [
], ],
oilInfo: { oilInfo: {
oilName:'未添加', oilName: '未添加',
oilPrice:'0', oilPrice: '0',
gbPrice:'0' gbPrice: '0'
}, },
list3: [ list3: [
'http://47.95.206.185:83/topbj.png', 'http://47.95.206.185:83/topbj.png',
'http://47.95.206.185:83/centerbj.png', 'http://47.95.206.185:83/centerbj.png',
@ -156,20 +157,20 @@
}, },
onLoad(query) { onLoad(query) {
const q = decodeURIComponent(query.q) // const q = decodeURIComponent(query.q) //
if (q == undefined){ if (q == undefined) {
let str = q.split("?")[1]; let str = q.split("?")[1];
let arr = str.split("&"); let arr = str.split("&");
let storeId = ""; let storeId = "";
let staffId = ""; let staffId = "";
arr.forEach(item => { arr.forEach(item => {
if (item.includes("storeId")){ if (item.includes("storeId")) {
storeId = item.split("=")[1] storeId = item.split("=")[1]
}else{ } else {
staffId = item.split("=")[1] staffId = item.split("=")[1]
} }
}) })
uni.setStorageSync("inviteStoreId",storeId) uni.setStorageSync("inviteStoreId", storeId)
uni.setStorageSync("inviteStaffId",staffId) uni.setStorageSync("inviteStaffId", staffId)
this.storeId = uni.getStorageSync("inviteStoreId") this.storeId = uni.getStorageSync("inviteStoreId")
this.staffId = uni.getStorageSync("inviteStaffId") this.staffId = uni.getStorageSync("inviteStaffId")
} }
@ -184,22 +185,22 @@
tabbar tabbar
}, },
methods: { methods: {
isExistStoreId(){ isExistStoreId() {
if (uni.getStorageSync("inviteStoreId") != ""){ if (uni.getStorageSync("inviteStoreId") != "") {
this.getStore(uni.getStorageSync("inviteStoreId")); this.getStore(uni.getStorageSync("inviteStoreId"));
}else{ } else {
this.getAddress(); this.getAddress();
} }
}, },
// //
getUserAuthority(){ getUserAuthority() {
let _this = this; let _this = this;
wx.getSetting({ wx.getSetting({
success(res){ success(res) {
if (!res.authSetting['scope.userLocation']){ if (!res.authSetting['scope.userLocation']) {
wx.authorize({ wx.authorize({
scope:'scope.userLocation', scope: 'scope.userLocation',
success(){ success() {
// //
_this.isExistStoreId() _this.isExistStoreId()
}, },
@ -207,7 +208,7 @@
// //
} }
}) })
}else{ } else {
// //
_this.isExistStoreId() _this.isExistStoreId()
} }
@ -215,13 +216,15 @@
}) })
}, },
// //
getStore(id){ getStore(id) {
let _this = this; let _this = this;
request({ request({
url: "business/storeInformation/store/queryStoreById", url: "business/storeInformation/store/queryStoreById",
method: 'post', method: 'post',
data:{"storeId":id}, data: {
}).then((response)=>{ "storeId": id
},
}).then((response) => {
_this.store = response.data _this.store = response.data
let welfare = response.data.welfare let welfare = response.data.welfare
if (welfare != undefined && welfare != null && welfare != "") { if (welfare != undefined && welfare != null && welfare != "") {
@ -251,10 +254,10 @@
"lon": res.longitude, "lon": res.longitude,
"lat": res.latitude "lat": res.latitude
}, },
}).then((response)=>{ }).then((response) => {
_this.distance = (Math.ceil(response.data.distance)).toFixed(1) _this.distance = (Math.ceil(response.data.distance)).toFixed(1)
_this.store = response.data.store _this.store = response.data.store
uni.setStorageSync("storeId",response.data.store.id) uni.setStorageSync("storeId", response.data.store.id)
let welfare = response.data.store.welfare let welfare = response.data.store.welfare
if (welfare != undefined && welfare != null && welfare != "") { if (welfare != undefined && welfare != null && welfare != "") {
if (welfare.includes(",")) { if (welfare.includes(",")) {
@ -271,44 +274,44 @@
} }
}); });
}, },
// //
getOilType() { getOilType() {
request({ request({
url: 'business/petrolStationManagement/oilNumber/getList2', url: 'business/petrolStationManagement/oilNumber/getList2',
method: 'get', method: 'get',
// params:{} // params:{}
}).then((res)=>{ }).then((res) => {
if(res.code == 200){ if (res.code == 200) {
this.oilTypeList = res.data.records this.oilTypeList = res.data.records
console.log("aaabbb",this.oilTypeList) console.log("aaabbb", this.oilTypeList)
if (this.oilTypeList.length > 0) { if (this.oilTypeList.length > 0) {
this.oilInfo.oilName = this.oilTypeList[0].oilName, this.oilInfo.oilName = this.oilTypeList[0].oilName,
this.oilInfo.oilPrice = this.oilTypeList[0].oilPrice, this.oilInfo.oilPrice = this.oilTypeList[0].oilPrice,
this.oilInfo.gbPrice = this.oilTypeList[0].gbPrice this.oilInfo.gbPrice = this.oilTypeList[0].gbPrice
} }
let oilData = [] let oilData = []
this.oilTypeList.forEach(res => { this.oilTypeList.forEach(res => {
let data = { let data = {
id:res.numberId, id: res.numberId,
label:res.oilName, label: res.oilName,
oilPrice:res.oilPrice, oilPrice: res.oilPrice,
gbPrice:res.gbPrice gbPrice: res.gbPrice
} }
oilData.push(data) oilData.push(data)
}) })
this.columns = [oilData] this.columns = [oilData]
console.log("aaa",this.columns) console.log("aaa", this.columns)
} }
}) })
}, },
confirm(e) { confirm(e) {
console.log('选中的油号', e); console.log('选中的油号', e);
this.oilInfo.oilName = e.value[0].label, this.oilInfo.oilName = e.value[0].label,
this.oilInfo.oilPrice = e.value[0].oilPrice, this.oilInfo.oilPrice = e.value[0].oilPrice,
this.oilInfo.gbPrice = e.value[0].gbPrice this.oilInfo.gbPrice = e.value[0].gbPrice
this.show = false this.show = false
}, },
cancel() { cancel() {
@ -571,8 +574,8 @@
} }
.lananniu { .lananniu {
width: 78px; box-sizing: border-box;
height: 24px; padding: 3px 10px;
background: #DBE9FF; background: #DBE9FF;
border-radius: 12px; border-radius: 12px;
display: flex; display: flex;