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

997 lines
23 KiB
Vue
Raw Normal View History

2023-11-27 09:24:16 +08:00
<template>
<view class="content">
<view class="container">
<!--外层 -->
<!-- 顶部 -->
<view class="conttainer-top">
2023-12-23 18:17:19 +08:00
<!-- 轮播图 -->
2023-12-29 16:50:44 +08:00
<view style="width: 100%;height: 300px;">
2024-01-02 11:21:12 +08:00
<swiper class="swiper" style="width: 100%;height: 300px;" circular :indicator-dots="indicatorDots"
:autoplay="autoplay" :interval="interval" :duration="duration">
2023-12-29 16:50:44 +08:00
<swiper-item v-for="(item,index) in list1" :key="index" @click="goPage(item.routeUrl)">
2024-01-23 09:26:10 +08:00
<view class="swiper-item uni-bg-red">
2024-01-24 17:32:57 +08:00
2024-01-23 09:26:10 +08:00
<image style="width: 100%;" :src="item.bannerUrl"></image>
</view>
2024-01-22 18:05:19 +08:00
<!-- <image style="width: 100%;" :src="getBannerUrl(item.bannerUrl)"></image> -->
2023-12-23 18:17:19 +08:00
</swiper-item>
</swiper>
2023-12-29 16:50:44 +08:00
</view>
2024-01-02 11:21:12 +08:00
2023-11-27 09:24:16 +08:00
<!-- 标题 -->
<view class="top-title">
出行服务 优惠加油
</view>
<view class="lan-gang">
<view class="lsiez"> <uni-icons type="checkbox" color="#ffffff" size="10"></uni-icons> </view>
<view class="lsiez"> <uni-icons type="checkbox" color="#ffffff" size="10"></uni-icons> </view>
<view class="lsiez"> <uni-icons type="checkbox" color="#ffffff" size="10"></uni-icons> </view>
</view>
<!-- 金刚区 -->
<view class="conttainer-jg">
2023-12-01 17:43:20 +08:00
<view class="jg-box" @click="toQRcode">
2023-11-27 09:24:16 +08:00
<view class="jg-img">
2024-01-19 16:07:11 +08:00
<image src="../../static/imgs/viprwm.png" mode="aspectFit"></image>
2023-11-27 09:24:16 +08:00
</view>
2023-11-28 14:43:36 +08:00
<view class="jg-size">二维码</view>
2023-11-27 09:24:16 +08:00
</view>
<view class="jg-box" @click="goActivity()">
<view class="jg-img">
2024-01-19 16:07:11 +08:00
<image src="../../static/imgs/bzhd.png" mode="aspectFit"></image>
2023-11-27 09:24:16 +08:00
</view>
<view class="jg-size">本站活动</view>
</view>
2023-11-27 18:28:41 +08:00
<view class="jg-box" @click="goCard()">
2023-11-27 09:24:16 +08:00
<view class="jg-img">
2024-01-19 16:07:11 +08:00
<image src="../../static/imgs/ykcz.png" mode="aspectFit"></image>
2023-11-27 09:24:16 +08:00
</view>
<view class="jg-size">油卡充值</view>
</view>
2023-11-27 18:28:41 +08:00
<view class="jg-box" @click="goMall()">
2023-11-27 09:24:16 +08:00
<view class="jg-img">
2024-01-19 16:07:11 +08:00
<image src="../../static/imgs/jfsc.png" mode="aspectFit"></image>
2023-11-27 09:24:16 +08:00
</view>
<view class="jg-size">积分商城</view>
</view>
</view>
<!-- 金刚区结束 -->
</view>
<!-- 顶部结束 -->
<!-- centenr -->
<view class="conttainer-cetr">
<view class="conttainer-title">今日会员价</view>
2024-03-07 10:04:15 +08:00
<!-- <view class="conttainer-box" v-for="(item,index) in oilTypeList" :key="index">
2024-03-04 18:52:33 +08:00
<view class="c-box-box1">
<view class="">{{item.oilName||''}}</view>
2023-11-27 09:24:16 +08:00
</view>
<view class="c-box-box2">
<view class="xred">会员价</view>
2024-03-04 18:52:33 +08:00
<view class="dred"> <text class="xred"></text> {{item.oilPrice||0}}</view>
2023-11-27 09:24:16 +08:00
</view>
<view class="c-box-box3">
2024-01-09 12:02:40 +08:00
<view class="xblck">国标价</view>
2024-03-04 18:52:33 +08:00
<view class="dblck"> <text class="xblck"></text> {{item.gbPrice||0}}</view>
2023-11-27 09:24:16 +08:00
</view>
2024-03-07 10:04:15 +08:00
</view> -->
2024-03-07 10:36:05 +08:00
<swiper class="swiper" style="width: 100%;height: 70px;" circular
2024-03-07 10:04:15 +08:00
:autoplay="autoplay" :interval="interval" :vertical="true" :duration="duration">
<swiper-item class="conttainer-box" v-for="(item,index) in oilTypeList" :key="index">
<view class="c-box-box1">
<view class="">{{item.oilName||''}}</view>
</view>
<view class="c-box-box2">
<view class="xred">会员价</view>
<view class="dred"> <text class="xred"></text> {{item.oilPrice||0}}</view>
</view>
<view class="c-box-box3">
<view class="xblck">国标价</view>
<view class="dblck"> <text class="xblck"></text> {{item.gbPrice||0}}</view>
</view>
</swiper-item>
</swiper>
2023-11-27 09:24:16 +08:00
</view>
<!-- centenr结束 -->
<!-- 加油站卡片-->
<view class="station">
<view class="station-box">
2024-01-15 18:17:40 +08:00
<view class="station-title" style="display: flex;justify-content: space-between;">
2023-11-29 16:26:19 +08:00
{{store.name}}{{store.description ? "("+store.description+")" : ""}}
2024-03-11 09:53:30 +08:00
<!-- <view class="" @click="goChooseAddress" style="width: 22%;font-size: 14px;font-weight: 400;">
2024-03-04 18:52:33 +08:00
<view style="font-size: 12px;">切换位置 <uni-icons type="right" color="#304fff"
size="14"></uni-icons> </view>
2024-03-11 09:53:30 +08:00
</view> -->
2023-11-28 14:43:36 +08:00
</view><!--顺通石化加油站(工业南路站)-->
2023-11-27 18:28:41 +08:00
<view style="display: flex;">
2023-11-28 14:43:36 +08:00
<view class="bule-icon" v-if="welfare.length!=0" v-for="(item,index) in welfare" :key="index">
{{item}}
</view>
2023-11-27 18:28:41 +08:00
</view>
2023-11-27 09:24:16 +08:00
<view class="dis-bt">
<view class="">
2023-11-27 18:28:41 +08:00
<view class="hui1">{{ store.address }}</view>
2024-02-23 18:00:16 +08:00
<view class="hui2" v-if="distance">{{ distance }}km</view>
2023-11-29 16:26:19 +08:00
</view>
2023-12-01 16:20:02 +08:00
<view class="lananniu" @click="goGoGo" v-if="distance!=''">
<uni-icons type="paperplane-filled" color="#195ADA" size="16"></uni-icons>
{{ distance || "0" }}KM
2023-11-27 09:24:16 +08:00
</view>
</view>
<u-swiper :list="list3" previousMargin="30" nextMargin="30" circular :autoplay="false" radius="5"
bgColor="#ffffff"></u-swiper>
2023-11-27 18:28:41 +08:00
<view class="juanniu" @click="goOil()">
2023-11-27 09:24:16 +08:00
<view class="">一键加油</view>
</view>
</view>
<view style="height: 88px; width: 100%;"></view>
</view>
<!-- 加油站卡片结束-->
2024-03-04 18:52:33 +08:00
2023-12-01 16:20:02 +08:00
<u-picker :columns="columns" @confirm="confirm" :show="show" @cancel="show = false"
keyName="label"></u-picker>
2024-01-22 16:14:28 +08:00
<u-overlay :show="shows == true">
2023-12-19 09:31:53 +08:00
<image src="../../static/imgs/zzxryl.png"
style="width: 280px; height: 350px; margin: 20px auto; margin-top: 200px; ">
</image>
2023-12-21 17:48:13 +08:00
<view class="anniuprp" @click="drawDown()">
2023-12-19 09:31:53 +08:00
<text>立即领取</text>
</view>
</u-overlay>
2023-11-27 09:24:16 +08:00
<!--外层结束 -->
<tabbar :msg="msg"></tabbar>
</view>
</view>
</template>
<script>
import tabbar from "../../components/tabbar/tabbar.vue"
2023-11-30 14:28:12 +08:00
import config from '@/config'
import request from '../../utils/request'
2024-01-24 17:32:57 +08:00
import {
callWithErrorHandling
} from "vue"
2023-11-27 09:24:16 +08:00
export default {
data() {
return {
2024-01-24 15:22:16 +08:00
chainStoreId: '',
2023-12-23 18:17:19 +08:00
indicatorDots: true,
autoplay: true,
2024-03-11 13:29:22 +08:00
interval: 3000,
2023-12-23 18:17:19 +08:00
duration: 500,
2023-12-21 17:48:13 +08:00
joinmsg: '',
2023-11-27 09:24:16 +08:00
msg: "1",
show: false,
2023-12-21 17:48:13 +08:00
shows: '',
2023-11-27 09:24:16 +08:00
title: '',
2023-11-30 14:28:12 +08:00
oilTypeList: '',
2024-01-29 14:50:20 +08:00
columns: [],
2023-11-30 14:28:12 +08:00
oilInfo: {
2023-12-01 16:20:02 +08:00
oilName: '未添加',
oilPrice: '0',
gbPrice: '0'
2023-11-30 14:28:12 +08:00
},
2024-01-19 18:28:40 +08:00
AppToken: uni.getStorageSync("App-Token"),
2023-12-01 16:20:02 +08:00
2024-01-18 15:01:26 +08:00
list1: [],
2023-11-27 09:24:16 +08:00
list3: [
'http://47.95.206.185:83/topbj.png',
],
2023-11-27 18:28:41 +08:00
// 当前经度信息
2023-11-28 14:43:36 +08:00
longitude: "",
2024-01-27 10:51:32 +08:00
// 当前纬度信息
2023-11-28 14:43:36 +08:00
latitude: "",
2024-01-27 10:51:32 +08:00
// 店铺经度信息
lon: "",
// 店铺纬度信息
lat: "",
2023-11-27 18:28:41 +08:00
// 店铺信息
2023-12-01 16:26:25 +08:00
store: {
2023-12-05 10:37:36 +08:00
name: "测试油站",
description: "济南分店",
address: "济南槐荫区"
2023-12-01 16:26:25 +08:00
},
2023-11-27 18:28:41 +08:00
// 店铺福利信息
2023-11-28 14:43:36 +08:00
welfare: [],
2023-11-27 18:28:41 +08:00
distance: "",
2023-11-28 16:40:05 +08:00
storeId: "",
staffId: "",
2023-11-29 16:26:19 +08:00
baseUrl: this.$baseUrl,
2023-11-27 09:24:16 +08:00
}
},
2024-01-24 17:32:57 +08:00
async onLoad(query) {
2024-01-04 09:10:33 +08:00
if (query.storeId) {
2024-01-23 18:14:56 +08:00
// uni.setStorageSync("y_storeId", query.storeId)
uni.setStorageSync("storeId", query.storeId)
2024-01-04 09:10:33 +08:00
}
if (query.type) {
uni.setStorageSync("y_type", query.type)
}
if (query.userId) {
uni.setStorageSync("y_userId", query.userId)
}
2024-01-30 16:04:49 +08:00
if (uni.getStorageSync("appltType") == "WECHAT") {
2024-02-20 17:52:09 +08:00
const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容
2024-01-30 16:04:49 +08:00
if (query.q) {
let str = q.split("?")[1];
2024-03-12 15:52:45 +08:00
let storeId = "";
2024-01-30 16:04:49 +08:00
let staffId = "";
2024-03-12 15:52:45 +08:00
let userId = "";
let type = "";
2024-02-28 18:02:53 +08:00
console.log(111);
2024-01-30 16:04:49 +08:00
if (str.includes("&")) {
let arr = str.split("&");
arr.forEach(item => {
if (item.includes("storeId")) {
storeId = item.split("=")[1]
2024-03-12 15:52:45 +08:00
} else if (item.includes("staffId")) {
2024-01-30 16:04:49 +08:00
staffId = item.split("=")[1]
2024-03-12 15:52:45 +08:00
} else if (item.includes("userId")) {
userId = item.split("=")[1]
} else if (item.includes("type")) {
type = item.split("=")[1]
2024-01-30 16:04:49 +08:00
}
})
} else {
storeId = str.split("=")[1]
}
2024-01-05 18:27:59 +08:00
2024-01-08 10:07:07 +08:00
2024-01-30 16:04:49 +08:00
uni.setStorageSync("storeId", storeId)
2024-03-12 15:52:45 +08:00
uni.setStorageSync("y_type", type)
uni.setStorageSync("y_userId", userId)
2024-01-30 16:04:49 +08:00
uni.setStorageSync("inviteStaffId", staffId)
2024-01-02 17:13:25 +08:00
this.storeId = uni.getStorageSync("storeId")
2024-01-30 16:04:49 +08:00
this.chainStoreId = uni.getStorageSync("chainStoreId")
this.staffId = uni.getStorageSync("inviteStaffId")
await this.getUserAuthority();
2024-02-20 17:52:09 +08:00
// await this.getOilType();
2024-01-04 15:52:02 +08:00
} else {
2024-01-30 16:04:49 +08:00
if (uni.getStorageSync("storeId")) {
this.storeId = uni.getStorageSync("storeId")
} else {
let storeId = "34";
2024-01-30 16:04:49 +08:00
uni.setStorageSync("storeId", storeId)
}
2024-02-28 18:02:53 +08:00
await this.getUserAuthority();
// await this.getOilType();
2024-01-02 17:13:25 +08:00
}
2024-03-12 18:06:12 +08:00
2024-01-30 16:04:49 +08:00
await this.getTheJudgmentIsTheSame();
2024-03-04 18:52:33 +08:00
} else {
2024-01-30 16:04:49 +08:00
await this.getUserAuthority();
2024-02-20 17:52:09 +08:00
// await this.getOilType();
2024-01-30 16:04:49 +08:00
await this.getTheJudgmentIsTheSame();
2023-11-28 18:33:35 +08:00
}
2023-11-27 18:28:41 +08:00
},
onShow() {
2023-12-21 17:48:13 +08:00
this.isJoined()
2024-02-28 18:02:53 +08:00
// this.getIndexBanner()
2023-11-27 09:24:16 +08:00
},
components: {
tabbar
},
methods: {
2024-01-22 16:14:28 +08:00
// 返回图片路径
2024-01-24 17:32:57 +08:00
getBannerUrl(url) {
2024-01-22 16:14:28 +08:00
let imgurl = ""
2024-01-24 17:32:57 +08:00
if (url.includes("http")) {
2024-01-22 16:14:28 +08:00
imgurl = url
2024-01-24 17:32:57 +08:00
} else {
2024-01-22 16:14:28 +08:00
imgurl = this.baseUrl + url
}
return imgurl;
},
2023-12-29 16:50:44 +08:00
// 跳转banner图对应的页面
2024-01-02 11:21:12 +08:00
goPage(url) {
2023-12-29 16:50:44 +08:00
uni.navigateTo({
2024-01-02 11:21:12 +08:00
url: url,
2023-12-29 16:50:44 +08:00
})
},
// 获取首页轮播图信息
2024-01-02 11:21:12 +08:00
getIndexBanner() {
2024-01-22 18:05:19 +08:00
let _this = this
2024-01-02 11:21:12 +08:00
if (uni.getStorageSync("storeId")) {
2023-12-29 16:50:44 +08:00
request({
2024-01-02 11:21:12 +08:00
url: 'business/indexBanner/list/' + uni.getStorageSync("storeId"),
2023-12-29 16:50:44 +08:00
method: 'get',
}).then(res => {
2024-01-22 18:05:19 +08:00
_this.list1 = res.data
2024-03-04 18:52:33 +08:00
if (res.data.length > 0) {
2024-02-28 18:02:53 +08:00
for (let i = 0; i < res.data.length; i++) {
if (res.data[i].bannerUrl.includes("http")) {
_this.list1[i].bannerUrl = res.data[i].bannerUrl
} else {
_this.list1[i].bannerUrl = _this.baseUrl + res.data[i].bannerUrl
}
2024-01-22 18:05:19 +08:00
}
2024-02-28 18:02:53 +08:00
console.log(_this.list1);
2024-01-22 18:05:19 +08:00
}
2023-12-29 16:50:44 +08:00
})
}
},
2023-12-21 17:48:13 +08:00
//判断是否是新人
isJoined() {
2024-01-19 18:28:40 +08:00
// 判断是否登录
if (!this.AppToken) {
return;
}
2023-12-21 17:48:13 +08:00
request({
url: 'business/marketingActivity/activeNewlywedsRecords/applet',
method: 'get',
}).then(res => {
console.log("11111" + res)
if (res.code == 200 && res.data == 1) {
this.shows = true
} else {
this.shows = false
}
})
},
//立即领取
drawDown() {
/* this.shows = false */
request({
url: 'business/marketingActivity/activeNewlywedsRecords',
method: 'post',
data: {
2024-01-24 15:22:16 +08:00
storeId: this.storeId,
chainStoreId: this.chainStoreId,
2023-12-21 17:48:13 +08:00
}
}).then(res => {
console.log("11111" + res)
if (res.code == 200 && res.data == true) {
this.shows = false
uni.showToast({
title: '领取成功!'
})
} else {
this.shows = false
uni.showToast({
title: '领取失败!'
})
}
/* if (res.code == 200 && res.data == 1) {
this.shows = true
} else {
this.shows = false
} */
})
},
//查询新人有礼礼品
selectActiveNewlyweds() {
2024-01-19 18:28:40 +08:00
// 判断是否登录
if (!this.AppToken) {
return;
}
2023-12-21 17:48:13 +08:00
request({
url: 'business/marketingActivity/activeNewlyweds/applet',
method: 'get',
}).then(res => {
console.log("11111" + res)
})
},
2023-12-01 16:20:02 +08:00
isExistStoreId() {
2024-01-05 18:27:59 +08:00
if (uni.getStorageSync("storeId")) {
2023-12-18 18:44:02 +08:00
this.getStore(uni.getStorageSync("storeId"));
2023-12-01 16:20:02 +08:00
} else {
2024-01-13 18:01:23 +08:00
this.getAddress(uni.getStorageSync("storeId"));
2023-11-28 18:33:35 +08:00
}
},
2023-12-01 15:40:43 +08:00
// 获取定位信息
2023-12-01 16:20:02 +08:00
getUserAuthority() {
2023-12-01 15:40:43 +08:00
let _this = this;
2023-12-06 18:36:10 +08:00
// this.getAddress();
2023-12-29 15:27:06 +08:00
uni.getSetting({
2024-02-20 17:52:09 +08:00
async success(res) {
2023-12-01 16:20:02 +08:00
if (!res.authSetting['scope.userLocation']) {
2024-03-04 18:52:33 +08:00
// uni.authorize({
// scope: 'scope.userLocation',
// success() {
// // 用户同意获取位置信息
// // _this.isExistStoreId()
// },
// fail() {
// // 用户拒绝
// }
// })
await _this.getAddress(uni.getStorageSync("storeId"));
2023-12-01 16:20:02 +08:00
} else {
2024-03-04 18:52:33 +08:00
// 用户同意获取位置信息
// _this.isExistStoreId()
await _this.getAddress(uni.getStorageSync("storeId"));
2023-12-01 15:40:43 +08:00
}
2024-01-05 18:27:59 +08:00
},
fail(err) {
2024-01-08 10:07:07 +08:00
2023-12-01 15:40:43 +08:00
}
})
},
2024-01-24 17:32:57 +08:00
// 判断token是否与当前连锁店id相同
2024-01-26 10:48:51 +08:00
async getTheJudgmentIsTheSame() {
2024-03-04 18:52:33 +08:00
console.log(this.AppToken, 547);
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
// 判断当前登录的code是否相同
2024-03-04 18:52:33 +08:00
if (uni.getStorageSync("appltType") == "WECHAT") {
2024-02-20 17:52:09 +08:00
wx.login({
success(res) {
if (res.code) {
//发起网络请求
request({
url: 'clientApi/sign/mpWxLogin2',
method: "POST",
data: {
code: res.code
}
2024-02-28 18:02:53 +08:00
}).then(resp => {
if (!resp.data) {
2024-02-20 17:52:09 +08:00
uni.removeStorageSync("App-Token");
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
}
2024-03-04 18:52:33 +08:00
if (uni.getStorageSync("appltType") == "ALIPAY") {
2024-02-20 17:52:09 +08:00
my.getAuthCode({
scopes: 'auth_base',
success: res => {
const authCode = res.authCode;
console.log(res)
2024-01-26 10:48:51 +08:00
request({
2024-02-20 17:52:09 +08:00
url: "clientApi/sign/alipayLogin/getUserid2",
method: 'post',
2024-01-26 10:48:51 +08:00
data: {
2024-02-20 17:52:09 +08:00
authCode: authCode,
storeId: uni.getStorageSync("storeId"),
},
}).then((resp) => {
2024-03-04 18:52:33 +08:00
console.log(resp, 85412);
2024-02-28 18:02:53 +08:00
if (!resp.data) {
2024-01-26 10:48:51 +08:00
uni.removeStorageSync("App-Token");
}
})
2024-02-20 17:52:09 +08:00
},
fail: err => {
console.log('my.getAuthCode 调用失败', err)
2024-01-26 10:48:51 +08:00
}
2024-02-20 17:52:09 +08:00
});
}
2024-01-26 10:48:51 +08:00
2024-01-24 17:32:57 +08:00
},
2023-11-28 16:40:05 +08:00
// 获取门店信息
2023-12-01 16:20:02 +08:00
getStore(id) {
2023-11-28 18:33:35 +08:00
let _this = this;
2023-12-01 15:40:43 +08:00
request({
url: "business/storeInformation/store/queryStoreById",
method: 'post',
2023-12-01 16:20:02 +08:00
data: {
"storeId": id
},
}).then((response) => {
2023-12-01 15:40:43 +08:00
_this.store = response.data
let welfare = response.data.welfare
2023-12-08 16:16:52 +08:00
uni.setStorageSync("storeId", response.data.id)
uni.setStorageSync("chainStoreId", response.data.chainStoreId)
2024-01-05 18:27:59 +08:00
if (welfare) {
2023-12-01 15:40:43 +08:00
if (welfare.includes(",")) {
_this.welfare = response.data.welfare.split(",")
} else {
_this.welfare.push(response.data.welfare)
2023-11-29 16:26:19 +08:00
}
2023-11-28 18:33:35 +08:00
}
2024-01-05 18:27:59 +08:00
if (response.data.doorstepPhoto) {
2023-12-19 18:03:05 +08:00
let list = JSON.parse(response.data.doorstepPhoto)
_this.list3 = [];
list.forEach(item => {
_this.list3.push(_this.baseUrl + item)
})
}
2023-12-01 16:59:31 +08:00
}).catch((res) => {
2024-01-24 17:32:57 +08:00
2023-11-28 18:33:35 +08:00
})
2023-11-28 16:40:05 +08:00
},
2023-11-27 18:28:41 +08:00
// 获取当前位置
2024-01-13 18:01:23 +08:00
getAddress(storeId) {
2023-11-27 18:28:41 +08:00
let _this = this;
uni.getLocation({
// 谷歌使用wgs84 其他使用gcj02
2023-12-01 15:40:43 +08:00
type: 'gcj02', // 使用国测局坐标系
2023-11-27 18:28:41 +08:00
success: function(res) {
2024-01-19 18:28:40 +08:00
if (_this.longitude == "" && _this.latitude == "") {
2024-01-15 18:17:40 +08:00
_this.longitude = res.longitude;
_this.latitude = res.latitude
}
console.log('经度: ' + _this.longitude);
console.log('纬度: ' + _this.latitude);
2023-12-01 15:40:43 +08:00
request({
url: 'business/storeInformation/store/recentlyStore',
method: 'post',
2023-11-27 18:28:41 +08:00
data: {
2024-01-15 18:17:40 +08:00
"lon": _this.longitude,
"lat": _this.latitude,
2024-01-19 18:28:40 +08:00
"storeId": storeId,
"isLogin": _this.AppToken ? "0" : "1", // 0为登录
2023-11-27 18:28:41 +08:00
},
2023-12-01 16:20:02 +08:00
}).then((response) => {
2024-03-04 18:52:33 +08:00
console.log(response, "2154");
2024-02-28 18:02:53 +08:00
// uni.showToast({
// title:"121984:"+storeId
// })
2024-03-04 18:52:33 +08:00
if (response.data.store) {
2024-01-27 14:10:02 +08:00
_this.distance = (Math.ceil(response.data.distance))
.toFixed(1)
_this.store = response.data.store
uni.setStorageSync("storeId", response.data.store.id)
uni.setStorageSync("chainStoreId", response.data.store.chainStoreId)
2024-02-28 18:02:53 +08:00
console.log(uni.getStorageSync("chainStoreId"));
if (response.data.store.welfare) {
if (response.data.store.welfare.includes(",")) {
2024-01-27 14:10:02 +08:00
_this.welfare = response.data.store.welfare
.split(",")
} else {
_this.welfare.push(response.data.store.welfare)
}
2023-11-27 18:28:41 +08:00
}
2024-01-27 14:10:02 +08:00
if (response.data.store.doorstepPhoto) {
let list = JSON.parse(response.data.store.doorstepPhoto)
_this.list3 = [];
list.forEach(item => {
_this.list3.push(_this.baseUrl + item)
})
}
2024-01-29 14:50:20 +08:00
2024-01-27 14:10:02 +08:00
_this.lon = _this.store.longitude,
2024-03-04 18:52:33 +08:00
_this.lat = _this.store.latitude,
2024-01-29 14:50:20 +08:00
2024-03-04 18:52:33 +08:00
_this.getIndexBanner()
2024-02-20 17:52:09 +08:00
_this.getOilType();
2024-03-04 18:52:33 +08:00
} else {
2024-01-27 14:10:02 +08:00
uni.showToast({
2024-03-04 18:52:33 +08:00
title: "当前店铺已关闭!!!",
icon: "none"
2024-01-18 15:01:26 +08:00
})
}
2024-01-29 14:50:20 +08:00
2024-02-28 18:02:53 +08:00
}).catch(err => {})
2023-12-08 16:16:52 +08:00
2023-12-22 16:33:34 +08:00
// uni.showToast({
// title: "获取位置信息成功",
// icon: "none"
// })
2023-11-27 18:28:41 +08:00
},
fail: function(err) {
2023-12-06 18:36:10 +08:00
_this.getStore(2);
2023-12-22 16:33:34 +08:00
// uni.showToast({
// title: "获取位置信息失败"
// })
2023-11-27 18:28:41 +08:00
console.log('获取位置信息失败: ' + err.errMsg);
}
});
},
2023-12-01 16:20:02 +08:00
2023-11-30 14:28:12 +08:00
//获取油站的油号信息
getOilType() {
2023-12-05 10:37:36 +08:00
let params = {
storeId: uni.getStorageSync("storeId")
}
2024-02-23 18:00:16 +08:00
console.log(uni.getStorageSync("storeId"));
2023-11-30 14:28:12 +08:00
request({
url: 'business/petrolStationManagement/oilNumber/getList2',
method: 'get',
2023-12-05 10:37:36 +08:00
params: params
2023-12-01 16:20:02 +08:00
}).then((res) => {
if (res.code == 200) {
2023-11-30 14:28:12 +08:00
this.oilTypeList = res.data.records
2024-01-15 18:17:40 +08:00
// console.log("aaabbb", this.oilTypeList)
2023-11-30 14:28:12 +08:00
if (this.oilTypeList.length > 0) {
this.oilInfo.oilName = this.oilTypeList[0].oilName,
2023-12-01 16:20:02 +08:00
this.oilInfo.oilPrice = this.oilTypeList[0].oilPrice,
this.oilInfo.gbPrice = this.oilTypeList[0].gbPrice
2023-11-30 14:28:12 +08:00
}
let oilData = []
2024-03-04 18:52:33 +08:00
console.log(this.oilTypeList);
2023-11-30 14:28:12 +08:00
this.oilTypeList.forEach(res => {
let data = {
2023-12-01 16:20:02 +08:00
id: res.numberId,
label: res.oilName,
oilPrice: res.oilPrice,
gbPrice: res.gbPrice
2023-11-30 14:28:12 +08:00
}
oilData.push(data)
})
2023-12-01 16:20:02 +08:00
2023-11-30 14:28:12 +08:00
this.columns = [oilData]
2024-03-04 18:52:33 +08:00
2023-11-30 14:28:12 +08:00
}
})
},
2023-11-27 09:24:16 +08:00
confirm(e) {
console.log('选中的油号', e);
2023-11-30 14:28:12 +08:00
this.oilInfo.oilName = e.value[0].label,
2023-12-01 16:20:02 +08:00
this.oilInfo.oilPrice = e.value[0].oilPrice,
this.oilInfo.gbPrice = e.value[0].gbPrice
2023-11-27 09:24:16 +08:00
this.show = false
},
cancel() {
this.show = false
},
2023-12-21 17:48:13 +08:00
/* onOverlay() {
this.drawDown();
2023-12-19 09:31:53 +08:00
this.shows = false
uni.showToast({
title: '领取成功'
})
2023-12-21 17:48:13 +08:00
}, */
2023-11-27 09:24:16 +08:00
goActivity() {
// 去活动页
uni.navigateTo({
url: '/pagesHome/Activity/index'
})
},
2023-11-27 18:28:41 +08:00
goCard() {
2023-11-27 09:24:16 +08:00
uni.navigateTo({
url: '/pagesHome/MyCard/MyCard'
})
},
2023-11-27 18:28:41 +08:00
goOil() {
2023-11-27 09:24:16 +08:00
uni.navigateTo({
url: '/pages/refuel/refuel'
})
},
2024-01-15 18:17:40 +08:00
goChooseAddress() {
uni.chooseLocation({
success: ({
name,
address,
latitude,
longitude
2024-01-23 09:46:50 +08:00
}) => { // 选择位置完成后的处理
2024-01-15 18:17:40 +08:00
// this.addressName = address;
2024-01-19 18:28:40 +08:00
console.log(name, address, latitude, longitude);
2024-01-15 18:17:40 +08:00
this.longitude = longitude;
this.latitude = latitude;
this.getAddress()
},
});
},
2023-11-27 18:28:41 +08:00
goMall() {
2023-11-27 09:24:16 +08:00
uni.navigateTo({
url: '/pagesHome/PointsMall/PointsMall'
})
},
2023-12-05 10:37:36 +08:00
toQRcode() {
2023-12-01 17:43:20 +08:00
uni.navigateTo({
url: '/pagesHome/QRcode/QRcode'
})
},
2023-11-27 18:28:41 +08:00
goGoGo() {
2024-01-27 10:51:32 +08:00
let lat = Number(this.lat)
let lon = Number(this.lon)
2023-11-27 09:24:16 +08:00
uni.openLocation({
2024-01-27 10:51:32 +08:00
latitude: lat,
longitude: lon,
2024-03-04 18:52:33 +08:00
name: this.store.name,
address: this.store.address,
2024-01-29 14:50:20 +08:00
2023-11-27 09:24:16 +08:00
success: function() {
console.log('success');
},
complete: function(res) {
console.log(res);
}
});
},
}
}
</script>
<style scoped lang="scss">
.content {
background: #ebf5ff;
}
.container {
width: 100%;
height: 100vh;
}
.conttainer-top {
width: 100%;
height: 250px;
// background-color: #3da4df;
2023-12-29 16:50:44 +08:00
// background: url('http://47.95.206.185:83/topbj.png')center no-repeat;
2023-11-27 09:24:16 +08:00
background-size: 100% 100%;
position: relative;
margin-bottom: 60px;
}
.top-title {
font-size: 26px;
color: white;
font-weight: bold;
color: #FFFFFF;
line-height: 25px;
text-shadow: 0px 2px 0px #2F64CD;
position: absolute;
top: 120px;
left: 20px;
}
.lan-gang {
width: 200px;
height: 22px;
background: #2F43F7;
border-radius: 11px;
align-items: center;
display: flex;
justify-content: space-around;
position: absolute;
top: 155px;
left: 20px;
color: white;
}
.lsiez {
font-size: 10px;
display: flex;
}
.conttainer-jg {
width: 95%;
border-radius: 6px;
background: white;
box-sizing: border-box;
padding: 10px;
height: 90px;
margin: 0px auto;
position: absolute;
transform: translate(-50%, -50%);
left: 50%;
bottom: -90px;
display: flex;
}
.conttainer-cetr {
width: 95%;
border-radius: 6px;
background: white;
box-sizing: border-box;
padding: 10px;
margin: 10px auto;
}
.jg-box {
width: 25%;
text-align: center;
}
.jg-img {
width: 38px;
height: 38px;
image {
2024-01-19 16:07:11 +08:00
width: 38px;
height: 38px;
2023-11-27 09:24:16 +08:00
}
margin: 5px auto;
}
.jg-size {
font-size: 14px;
}
.conttainer-title {
font-size: 16px;
font-weight: bold;
}
.conttainer-box {
width: 100%;
box-sizing: border-box;
padding: 15px;
background: #F3F6F9;
display: flex;
align-items: center;
justify-content: space-between;
border-radius: 8px;
margin-top: 10px;
}
.c-box-box1 {
width: 33%;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.c-box-box2 {
width: 33%;
height: 44px;
text-align: center;
border-left: 1px solid #DDDDDD;
border-right: 1px solid #DDDDDD;
}
.c-box-box3 {
width: 33%;
height: 44px;
text-align: center;
}
.xblck {
font-size: 14px;
color: #333333;
}
.dblck {
font-size: 20px;
color: #333333;
font-weight: bold;
}
.xred {
font-size: 14px;
color: #ED2828;
}
.dred {
font-size: 20px;
color: #ED2828;
font-weight: bold;
}
.station {
width: 100%;
height: 120px;
background: url('http://47.95.206.185:83/centerbj.png')center no-repeat;
background-size: 100% 100%;
box-sizing: border-box;
padding-top: 30px;
}
.station-box {
width: 95%;
background-color: white;
border-radius: 8px;
box-sizing: border-box;
padding: 15px;
margin: 0px auto;
}
.station-title {
font-size: 16px;
font-weight: bold;
}
.bule-icon {
2023-11-29 16:26:19 +08:00
width: 85px;
2023-11-27 09:24:16 +08:00
font-size: 12px;
color: #195ADA;
box-sizing: border-box;
padding: 2px 5px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #195ADA;
border-radius: 4px;
2023-11-27 18:28:41 +08:00
margin: 5px 3px;
2023-11-27 09:24:16 +08:00
}
.dis-bt {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.hui1 {
color: #666666;
font-size: 12px;
margin: 5px auto;
}
.hui2 {
color: #999999;
font-size: 12px;
margin: 5px auto;
}
.lananniu {
2023-12-01 16:20:02 +08:00
box-sizing: border-box;
padding: 3px 10px;
2023-11-27 09:24:16 +08:00
background: #DBE9FF;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
color: #195ADA;
}
.tabs {
width: 100%;
display: flex;
height: 44px;
}
.scrollbox {
display: flex;
}
.scrollbox-imgs {
width: 195px;
height: 100px;
border-radius: 4px;
background-color: #195ADA;
margin: 0px 10px;
}
.juanniu {
height: 36px;
background: linear-gradient(90deg, #FF7302 0%, #FF5210 100%);
border-radius: 42px;
justify-content: center;
display: flex;
align-items: center;
color: white;
margin-top: 20px;
}
2023-12-19 09:31:53 +08:00
.anniuprp {
width: 130px;
height: 36px;
background: linear-gradient(180deg, #FF6D3A 0%, #FF327A 100%);
box-shadow: inset 0px 0px 6px 3px rgba(255, 255, 255, 0.25);
border-radius: 18px;
display: flex;
align-items: center;
justify-content: center;
color: white;
margin: 0 auto;
}
2024-03-04 18:52:33 +08:00
</style>