Compare commits
1 Commits
master
...
d3c8010b61
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3c8010b61 |
@@ -5,9 +5,9 @@ export default {
|
|||||||
location: {
|
location: {
|
||||||
latitude: 39.5426,
|
latitude: 39.5426,
|
||||||
longitude: 116.23292,
|
longitude: 116.23292,
|
||||||
test: 1,
|
|
||||||
},
|
},
|
||||||
appId: "wxed3e2914d6aa4d52",
|
appId: "wxed3e2914d6aa4d52",
|
||||||
|
hasLocationAuth: true,
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
|
||||||
"path": "pages/index/index",
|
|
||||||
"style": { "enablePullDownRefresh": true }
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/startPage/index",
|
"path": "pages/startPage/index",
|
||||||
"style": {}
|
"style": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/index/index",
|
||||||
|
"style": { "enablePullDownRefresh": true }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default {
|
|||||||
params: {
|
params: {
|
||||||
sort: "juli",
|
sort: "juli",
|
||||||
oilProductCode: "0#",
|
oilProductCode: "0#",
|
||||||
distance: 5000,
|
distance: 15000,
|
||||||
siteBrand: "",
|
siteBrand: "",
|
||||||
},
|
},
|
||||||
list: [
|
list: [
|
||||||
@@ -83,6 +83,7 @@ export default {
|
|||||||
{ name: "5km", id: 5000 },
|
{ name: "5km", id: 5000 },
|
||||||
{ name: "15km", id: 15000 },
|
{ name: "15km", id: 15000 },
|
||||||
{ name: "30km", id: 30000 },
|
{ name: "30km", id: 30000 },
|
||||||
|
{ name: "50km", id: 50000 },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
this.list.forEach((item) => {
|
this.list.forEach((item) => {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<view style="opacity: 1"
|
<view style="opacity: 1"
|
||||||
>加100升约省{{
|
>加100升约省{{
|
||||||
item.oilSitePrice | conserveFilter(item.sitePrice)
|
item.oilSitePrice | conserveFilter(item.sitePrice)
|
||||||
}}</view
|
}}元</view
|
||||||
>
|
>
|
||||||
<view @click.stop="openMap(item)">
|
<view @click.stop="openMap(item)">
|
||||||
<image src="/static/index/home/nav.png" mode="" />
|
<image src="/static/index/home/nav.png" mode="" />
|
||||||
@@ -82,7 +82,7 @@ export default {
|
|||||||
params: {
|
params: {
|
||||||
sort: "juli",
|
sort: "juli",
|
||||||
oilProductCode: "0#",
|
oilProductCode: "0#",
|
||||||
distance: 5000,
|
distance: 15000,
|
||||||
siteBrand: "",
|
siteBrand: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -112,13 +112,7 @@ export default {
|
|||||||
this.paramter.currentPage = 1;
|
this.paramter.currentPage = 1;
|
||||||
this.isReachBottom = false;
|
this.isReachBottom = false;
|
||||||
|
|
||||||
wx.getSetting({
|
this.obtainLocation();
|
||||||
success: (res) => {
|
|
||||||
if (res.authSetting["scope.userLocation"]) {
|
|
||||||
this.findBSiteInfoByPage();
|
|
||||||
} else this.obtainLocation();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -136,49 +130,17 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
obtainLocation() {
|
obtainLocation() {
|
||||||
uni.getLocation({
|
let appInstance = getApp();
|
||||||
type: "wgs84",
|
this.$utils
|
||||||
success: (res) => {
|
.obtainLocationHandle(appInstance)
|
||||||
console.log(res);
|
.then((res) => {
|
||||||
if (res.errMsg === "getLocation:ok") {
|
|
||||||
let { latitude, longitude } = res;
|
let { latitude, longitude } = res;
|
||||||
this.paramter.params.latitude = latitude;
|
this.paramter.params.latitude = latitude;
|
||||||
this.paramter.params.longitude = longitude;
|
this.paramter.params.longitude = longitude;
|
||||||
|
|
||||||
let appInstance = getApp();
|
|
||||||
appInstance.globalData.location.latitude = latitude;
|
|
||||||
appInstance.globalData.location.longitude = longitude;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
if (err.errMsg === "getLocation:fail auth deny") {
|
|
||||||
uni.showModal({
|
|
||||||
title: "提示",
|
|
||||||
content: "您已拒绝获取位置信息,请重新授权",
|
|
||||||
confirmText: "开启定位",
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.openSetting({
|
|
||||||
success: (res) => {
|
|
||||||
if (res.authSetting["scope.userLocation"])
|
|
||||||
this.obtainLocation();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title:
|
|
||||||
"因您拒绝获取位置信息,默认为您查询北京天安门附近油站",
|
|
||||||
icon: "none",
|
|
||||||
duration: 2000,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
complete: () => {
|
|
||||||
this.findBSiteInfoByPage();
|
this.findBSiteInfoByPage();
|
||||||
},
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.findBSiteInfoByPage();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
findBSiteInfoByPage() {
|
findBSiteInfoByPage() {
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ export default {
|
|||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
if (this.currentTab === "home") {
|
if (this.currentTab === "home") {
|
||||||
this.$bus.$emit("pullDownRefresh");
|
this.$bus.$emit("pullDownRefresh");
|
||||||
} else {
|
}
|
||||||
|
if (this.currentTab === "user") {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|||||||
@@ -38,10 +38,11 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
initFn() {
|
initFn() {
|
||||||
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: "/pages/index/index",
|
url: "/pages/index/index",
|
||||||
});
|
});
|
||||||
setTimeout(() => {}, 500);
|
}, 1000);
|
||||||
return;
|
return;
|
||||||
let interstitialAd = null;
|
let interstitialAd = null;
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,7 @@
|
|||||||
}}</text
|
}}</text
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view>本单优惠¥{{ orderInfo.discountAmount }}</view>
|
||||||
>本单优惠¥{{
|
|
||||||
orderInfo.discountAmount | preferential(orderInfo.serviceCharge)
|
|
||||||
}}</view
|
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info">
|
<view class="info">
|
||||||
@@ -81,11 +77,16 @@
|
|||||||
<view class="term">
|
<view class="term">
|
||||||
<view>
|
<view>
|
||||||
<text>直降优惠:</text>
|
<text>直降优惠:</text>
|
||||||
<text>{{ orderInfo.discountAmount }}</text>
|
<text
|
||||||
|
>-¥{{
|
||||||
|
orderInfo.discountAmount
|
||||||
|
| preferential(orderInfo.platformCommission)
|
||||||
|
}}</text
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<text>服务费:</text>
|
<text>服务费:</text>
|
||||||
<text>{{ orderInfo.serviceCharge }}</text>
|
<text>+¥{{ orderInfo.platformCommission }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="total">
|
<view class="total">
|
||||||
@@ -111,9 +112,9 @@ export default {
|
|||||||
this.orderInfo = JSON.parse(orderInfo);
|
this.orderInfo = JSON.parse(orderInfo);
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
preferential(discountAmount, serviceCharge) {
|
preferential(discountAmount, platformCommission) {
|
||||||
if (!discountAmount || !serviceCharge) return "0.00";
|
if (!discountAmount || !platformCommission) return "0.00";
|
||||||
return (discountAmount * 10000 - serviceCharge * 10000) / 10000;
|
return (discountAmount * 10000 + platformCommission * 10000) / 10000;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {},
|
methods: {},
|
||||||
|
|||||||
@@ -8,7 +8,12 @@
|
|||||||
<view class="tip"
|
<view class="tip"
|
||||||
>请告知加油员,已成功支付,如需发票,请联系加油站开票</view
|
>请告知加油员,已成功支付,如需发票,请联系加油站开票</view
|
||||||
>
|
>
|
||||||
<view class="button details" @click="jumpDetails">订单详情</view>
|
<view
|
||||||
|
v-if="orderInfo.orderSerialNumber"
|
||||||
|
class="button details"
|
||||||
|
@click="jumpDetails"
|
||||||
|
>订单详情</view
|
||||||
|
>
|
||||||
<view class="button home" @click="jumpHome">返回首页</view>
|
<view class="button home" @click="jumpHome">返回首页</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>{{ siteInfo.address }}</view>
|
<view>{{ siteInfo.address }}</view>
|
||||||
<view>距您{{ siteInfo.juli }}km</view>
|
<view>距您{{ siteInfo.juli | distanceFilter }}km</view>
|
||||||
<view class="nav" @click="openMap">
|
<view class="nav" @click="openMap">
|
||||||
<image src="../static/details/nav.png" mode="" />
|
<image src="../static/details/nav.png" mode="" />
|
||||||
<view>导航</view>
|
<view>导航</view>
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
>/L
|
>/L
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>油站价 ¥{{ params.oilSitePrice }}/L</view>
|
<view>油站价 ¥{{ params.oilSitePrice || "--" }}/L</view>
|
||||||
<view>指导价 ¥{{ params.marketPrice }}/L</view>
|
<view>指导价 ¥{{ params.marketPrice || "--" }}/L</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
>享油站价<text>直降¥{{ priceDiff }}/L</text></view
|
>享油站价<text>直降¥{{ priceDiff }}/L</text></view
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
<text>¥</text>
|
<text>¥</text>
|
||||||
<input
|
<input
|
||||||
v-model="params.sitePriceAmount"
|
v-model="params.sitePriceAmount"
|
||||||
type="numeric"
|
type="number"
|
||||||
maxlength="4"
|
maxlength="4"
|
||||||
placeholder="输入金额,实时计算优惠"
|
placeholder="输入金额,实时计算优惠"
|
||||||
placeholder-class="placeholder-class"
|
placeholder-class="placeholder-class"
|
||||||
@@ -170,11 +170,25 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.getById(JSON.parse(siteInfo));
|
this.getById(JSON.parse(siteInfo));
|
||||||
|
this.hasLocationAuthHandle(() => {
|
||||||
|
this.$utils.obtainLocationHandle(appInstance).then(() => {
|
||||||
|
this.getById(JSON.parse(siteInfo));
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
preferential(discountAmount, serviceCharge) {
|
preferential(discountAmount, serviceCharge) {
|
||||||
if (!discountAmount) return "0.00";
|
if (!discountAmount) return "0.00";
|
||||||
return (discountAmount * 10000 - serviceCharge * 10000) / 10000;
|
return (
|
||||||
|
(discountAmount * 100000 - serviceCharge * 100000) /
|
||||||
|
100000
|
||||||
|
).toFixed(2);
|
||||||
|
},
|
||||||
|
distanceFilter(value) {
|
||||||
|
if (value) {
|
||||||
|
return (value / 1000).toFixed(2);
|
||||||
|
}
|
||||||
|
return "0.00";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -183,14 +197,43 @@ export default {
|
|||||||
if (oilSitePrice && sitePrice) {
|
if (oilSitePrice && sitePrice) {
|
||||||
return (oilSitePrice - sitePrice).toFixed(2);
|
return (oilSitePrice - sitePrice).toFixed(2);
|
||||||
}
|
}
|
||||||
return "0.00";
|
return "--";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
hasLocationAuthHandle(callback = () => {}) {
|
||||||
|
const appInstance = getApp();
|
||||||
|
let { hasLocationAuth } = appInstance.globalData;
|
||||||
|
if (!hasLocationAuth) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "未打开小程序定位",
|
||||||
|
content: "需获取您的地理位置才可以继续加油",
|
||||||
|
confirmText: "开启定位",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.openSetting({
|
||||||
|
success: (res) => {
|
||||||
|
if (res.authSetting["scope.userLocation"]) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
serviceIllustrate() {
|
serviceIllustrate() {
|
||||||
this.$refs.popupIllustrate.open("bottom");
|
this.$refs.popupIllustrate.open("bottom");
|
||||||
},
|
},
|
||||||
createCOrder() {
|
createCOrder() {
|
||||||
|
let isHas = this.hasLocationAuthHandle(() => {
|
||||||
|
this.getById(this.siteInfo);
|
||||||
|
});
|
||||||
|
if (!isHas) return;
|
||||||
|
if (!this.beyondDistance()) return;
|
||||||
if (!this.checkParams()) return;
|
if (!this.checkParams()) return;
|
||||||
serve
|
serve
|
||||||
.createCOrder({
|
.createCOrder({
|
||||||
@@ -208,6 +251,24 @@ export default {
|
|||||||
this.wxPay(res.data);
|
this.wxPay(res.data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
beyondDistance() {
|
||||||
|
let { juli, siteName } = this.siteInfo;
|
||||||
|
if (juli > 10000) {
|
||||||
|
uni.showModal({
|
||||||
|
title: siteName,
|
||||||
|
content: "您与加油站距离较远,请到达加油站与加油员确认金额后付款",
|
||||||
|
confirmText: "导航到站",
|
||||||
|
cancelText: "我知道了",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.openMap();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
checkParams() {
|
checkParams() {
|
||||||
if (!this.params.oilsBar) {
|
if (!this.params.oilsBar) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -297,10 +358,12 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
getById(siteInfo) {
|
getById(siteInfo) {
|
||||||
|
const appInstance = getApp();
|
||||||
|
let { latitude, longitude } = appInstance.globalData.location;
|
||||||
let params = {
|
let params = {
|
||||||
id: siteInfo.siteId,
|
id: siteInfo.siteId || siteInfo.id,
|
||||||
latitude: siteInfo.latitude,
|
latitude: latitude,
|
||||||
longitude: siteInfo.longitude,
|
longitude: longitude,
|
||||||
};
|
};
|
||||||
serve.getById(params).then((res) => {
|
serve.getById(params).then((res) => {
|
||||||
if (res.code !== 20000) return;
|
if (res.code !== 20000) return;
|
||||||
@@ -585,7 +648,7 @@ export default {
|
|||||||
// line-height: 100rpx;
|
// line-height: 100rpx;
|
||||||
}
|
}
|
||||||
> view {
|
> view {
|
||||||
width: 170rpx;
|
width: 200rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// 类型校验
|
||||||
export function typeJudgment(object) {
|
export function typeJudgment(object) {
|
||||||
try {
|
try {
|
||||||
let res = {}.__proto__.toString.call(object);
|
let res = {}.__proto__.toString.call(object);
|
||||||
@@ -7,10 +8,10 @@ export function typeJudgment(object) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 时间处理
|
||||||
function padZero(value, length = 2) {
|
function padZero(value, length = 2) {
|
||||||
return value.toString().padStart(length, "0");
|
return value.toString().padStart(length, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dateTimeHandle(date) {
|
export function dateTimeHandle(date) {
|
||||||
let dateTime;
|
let dateTime;
|
||||||
|
|
||||||
@@ -53,3 +54,57 @@ export function dateTimeHandle(date) {
|
|||||||
weekDay, // 0-6, with 0 being Sunday
|
weekDay, // 0-6, with 0 being Sunday
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// uni.getLocation
|
||||||
|
export function obtainLocationHandle(
|
||||||
|
appInstance = { globalData: { location: {} } }
|
||||||
|
) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.getLocation({
|
||||||
|
type: "wgs84",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.errMsg === "getLocation:ok") {
|
||||||
|
appInstance.globalData.hasLocationAuth = true;
|
||||||
|
let { latitude, longitude } = res;
|
||||||
|
appInstance.globalData.location.latitude = latitude;
|
||||||
|
appInstance.globalData.location.longitude = longitude;
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
appInstance.globalData.hasLocationAuth = false;
|
||||||
|
|
||||||
|
if (err.errMsg === "getLocation:fail auth deny") {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "您已拒绝获取位置信息,请重新授权",
|
||||||
|
confirmText: "开启定位",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.openSetting({
|
||||||
|
success: (res) => {
|
||||||
|
if (res.authSetting["scope.userLocation"])
|
||||||
|
obtainLocationHandle(appInstance).then((_res) =>
|
||||||
|
resolve(_res)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "因您拒绝获取位置信息,默认为您查询北京天安门附近油站",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
let i = setTimeout(() => {
|
||||||
|
clearTimeout(i);
|
||||||
|
reject();
|
||||||
|
}, 2000);
|
||||||
|
// ();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import axiosMiniprogramAdapter from "axios-miniprogram-adapter";
|
import axiosMiniprogramAdapter from "axios-miniprogram-adapter";
|
||||||
import utils from "@/utils/encode";
|
import utils from "@/utils/encode";
|
||||||
|
let env;
|
||||||
let env = "test";
|
env = "test";
|
||||||
// let env = "production";
|
env = "production";
|
||||||
let testUrl = "http://192.168.110.230:38080";
|
let testUrl = "http://192.168.110.77:38080";
|
||||||
|
|
||||||
let productUrl = "http://uat.xingoil.com/guest-api";
|
let productUrl = "http://uat.xingoil.com/guest-api";
|
||||||
// let productUrl = "https://www.xingoil.com/adminapi";
|
// let productUrl = "https://www.xingoil.com/adminapi";
|
||||||
|
|||||||
Reference in New Issue
Block a user