Compare commits

...

2 Commits

Author SHA1 Message Date
xiaozhiyong
8afc6deaf8 更新 2024-05-22 14:01:54 +08:00
xiaozhiyong
4fd0b3eed1 更新 2024-05-22 11:32:43 +08:00
4 changed files with 86 additions and 69 deletions

View File

@@ -25,17 +25,17 @@ export default {
}); });
}, },
// 获取短信验证码 // 获取短信验证码
verifyCodeLoginCheckAccountPersonal(params) { getVerifyCode(params) {
return request({ return request({
url: "/guest-identity/unionAuth/verifyCodeLoginCheckAccountPersonal", url: "/guest-identity/unionAuth/getVerifyCode",
method: "post", method: "post",
data: params, data: params,
}); });
}, },
// 验证码登录 // 验证码登录
verifyCodeLoginPersonal(params) { verifyCodeRegister(params) {
return request({ return request({
url: "/guest-identity/unionAuth/verifyCodeLoginPersonal", url: "/guest-identity/unionAuth/verifyCodeRegister",
method: "post", method: "post",
data: params, data: params,
}); });

View File

@@ -125,26 +125,24 @@ export default {
obtainCode() { obtainCode() {
if (this.countdown.num != 60) return; if (this.countdown.num != 60) return;
if (!this.checkParams(["username"])) return; if (!this.checkParams(["username"])) return;
serve.getVerifyCode({ username: this.params.username }).then((res) => {
if (res.code == 20000) {
uni.showToast({
title: res.msg,
icon: "none",
});
this.params.verifyCodeToken = res.data.verifyCodeToken;
let instance = setInterval(() => { let instance = setInterval(() => {
if (!this.countdown.num) { if (!this.countdown.num) {
clearInterval(instance); clearInterval(instance);
this.countdown.num = 60; this.countdown.num = 60;
return; return;
}
this.countdown.num -= 1;
}, 1000);
} }
this.countdown.num -= 1; });
}, 1000);
serve
.verifyCodeLoginCheckAccountPersonal({ username: this.params.username })
.then((res) => {
if (res.code == 20000) {
uni.showToast({
title: res.msg,
});
this.params.verifyCodeToken = res.data.verifyCodeToken;
}
});
}, },
// 自动登录 // 自动登录
loginPersonal() { loginPersonal() {
@@ -183,11 +181,16 @@ export default {
realLogin() { realLogin() {
if (!this.checkParams(["username", "verifyCode"])) return; if (!this.checkParams(["username", "verifyCode"])) return;
serve.verifyCodeLoginPersonal(this.params).then((res) => { serve
if (res.code === 20000) { .verifyCodeRegister({
this.callbackLogin(res); unionId: uni.getStorageSync("unionid"),
} ...this.params,
}); })
.then((res) => {
if (res.code === 20000) {
this.callbackLogin(res);
}
});
}, },
bindLoginByPhonePersonal(detail) { bindLoginByPhonePersonal(detail) {
const params = { const params = {

View File

@@ -201,6 +201,34 @@ export default {
}, },
}, },
methods: { methods: {
serviceIllustrate() {
this.$refs.popupIllustrate.open("bottom");
},
async createCOrder() {
let isHas = this.hasLocationAuthHandle(() => {
this.getById(this.siteInfo);
});
if (!isHas) return;
let isBeyond = await this.beyondDistance();
if (!isBeyond) return;
if (!this.checkParams()) return;
serve
.createCOrder({
targetApp: "SAAS",
orderType: "REAL_ORDER",
orderSource: "WECHAT_MINIAPPS",
orderMethod: "SITE_SCAN",
suppleMark: 0,
version: 1,
createSource: "XOIL_DRIVER_WECHAT_APPLET",
...this.params,
})
.then((res) => {
if (res.code !== 20000) return;
this.wxPay(res.data);
});
},
// 定位权限是否开启检测
hasLocationAuthHandle(callback = () => {}) { hasLocationAuthHandle(callback = () => {}) {
const appInstance = getApp(); const appInstance = getApp();
let { hasLocationAuth } = appInstance.globalData; let { hasLocationAuth } = appInstance.globalData;
@@ -225,47 +253,33 @@ export default {
} }
return true; return true;
}, },
serviceIllustrate() { // 距离检测
this.$refs.popupIllustrate.open("bottom"); async beyondDistance() {
}, let { juli, siteName, siteId, id } = this.siteInfo;
createCOrder() {
let isHas = this.hasLocationAuthHandle(() => {
this.getById(this.siteInfo);
});
if (!isHas) return;
if (!this.beyondDistance()) return;
if (!this.checkParams()) return;
serve
.createCOrder({
targetApp: "SAAS",
orderType: "REAL_ORDER",
orderSource: "WECHAT_MINIAPPS",
orderMethod: "SITE_SCAN",
suppleMark: 0,
version: 1,
createSource: "XOIL_DRIVER_WECHAT_APPLET",
...this.params,
})
.then((res) => {
if (res.code !== 20000) return;
this.wxPay(res.data);
});
},
beyondDistance() {
let { juli, siteName } = this.siteInfo;
if (juli > 10000) { if (juli > 10000) {
uni.showModal({ let firstRes = await this.$utils.obtainLocationHandle();
title: siteName, let { latitude, longitude } = firstRes;
content: "您与加油站距离较远,请到达加油站与加油员确认金额后付款", let secondRes = await serve.getById({
confirmText: "导航到站", id: siteId || id,
cancelText: "我知道了", latitude,
success: (res) => { longitude,
if (res.confirm) {
this.openMap();
}
},
}); });
return false; if (secondRes.code !== 20000) return false;
if (secondRes.data.juli > 10000) {
uni.showModal({
title: siteName,
content: "您与加油站距离较远,请到达加油站与加油员确认金额后付款",
confirmText: "导航到站",
cancelText: "我知道了",
success: (res) => {
if (res.confirm) {
this.openMap();
}
},
});
return false;
}
return true;
} }
return true; return true;
}, },
@@ -385,7 +399,7 @@ export default {
marketPrice: item.marketPrice, marketPrice: item.marketPrice,
sitePriceId: item.priceId, sitePriceId: item.priceId,
}); });
// item.oilsBars数据结构为['','',''] 此处不适用 转化为[{},{},{}] // item.oilsBars数据结构为['','',''] 此处不适用 转化为[{},{},{}]
spear[item.oilProductCode] = item.oilsBars.reduce((prev, item) => { spear[item.oilProductCode] = item.oilsBars.reduce((prev, item) => {
prev.push({ prev.push({
label: item, label: item,

View File

@@ -3,8 +3,8 @@ import axiosMiniprogramAdapter from "axios-miniprogram-adapter";
import utils from "@/utils/encode"; import utils from "@/utils/encode";
let env; let env;
env = "test"; env = "test";
env = "production"; // env = "production";
let testUrl = "http://192.168.110.77:38080"; let testUrl = "http://192.168.110.230: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";