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({
url: "/guest-identity/unionAuth/verifyCodeLoginCheckAccountPersonal",
url: "/guest-identity/unionAuth/getVerifyCode",
method: "post",
data: params,
});
},
// 验证码登录
verifyCodeLoginPersonal(params) {
verifyCodeRegister(params) {
return request({
url: "/guest-identity/unionAuth/verifyCodeLoginPersonal",
url: "/guest-identity/unionAuth/verifyCodeRegister",
method: "post",
data: params,
});

View File

@@ -125,6 +125,13 @@ export default {
obtainCode() {
if (this.countdown.num != 60) 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(() => {
if (!this.countdown.num) {
@@ -134,15 +141,6 @@ export default {
}
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;
}
});
},
@@ -183,7 +181,12 @@ export default {
realLogin() {
if (!this.checkParams(["username", "verifyCode"])) return;
serve.verifyCodeLoginPersonal(this.params).then((res) => {
serve
.verifyCodeRegister({
unionId: uni.getStorageSync("unionid"),
...this.params,
})
.then((res) => {
if (res.code === 20000) {
this.callbackLogin(res);
}

View File

@@ -201,6 +201,34 @@ export default {
},
},
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 = () => {}) {
const appInstance = getApp();
let { hasLocationAuth } = appInstance.globalData;
@@ -225,35 +253,19 @@ export default {
}
return true;
},
serviceIllustrate() {
this.$refs.popupIllustrate.open("bottom");
},
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;
// 距离检测
async beyondDistance() {
let { juli, siteName, siteId, id } = this.siteInfo;
if (juli > 10000) {
let firstRes = await this.$utils.obtainLocationHandle();
let { latitude, longitude } = firstRes;
let secondRes = await serve.getById({
id: siteId || id,
latitude,
longitude,
});
if (secondRes.code !== 20000) return false;
if (secondRes.data.juli > 10000) {
uni.showModal({
title: siteName,
content: "您与加油站距离较远,请到达加油站与加油员确认金额后付款",
@@ -268,6 +280,8 @@ export default {
return false;
}
return true;
}
return true;
},
checkParams() {
if (!this.params.oilsBar) {
@@ -385,7 +399,7 @@ export default {
marketPrice: item.marketPrice,
sitePriceId: item.priceId,
});
// item.oilsBars数据结构为['','',''] 此处不适用 转化为[{},{},{}]
// item.oilsBars数据结构为['','',''] 此处不适用 转化为[{},{},{}]
spear[item.oilProductCode] = item.oilsBars.reduce((prev, item) => {
prev.push({
label: item,

View File

@@ -3,8 +3,8 @@ import axiosMiniprogramAdapter from "axios-miniprogram-adapter";
import utils from "@/utils/encode";
let env;
env = "test";
env = "production";
let testUrl = "http://192.168.110.77:38080";
// env = "production";
let testUrl = "http://192.168.110.230:38080";
let productUrl = "http://uat.xingoil.com/guest-api";
// let productUrl = "https://www.xingoil.com/adminapi";