111111
This commit is contained in:
@@ -16,7 +16,10 @@ Page({
|
|||||||
tabStatus: {
|
tabStatus: {
|
||||||
coupon: !1,
|
coupon: !1,
|
||||||
shop: !1
|
shop: !1
|
||||||
}
|
},
|
||||||
|
showOneTimeOptions: !1,
|
||||||
|
oneTimeOptions: [],
|
||||||
|
oneTimeLoading: !1
|
||||||
},
|
},
|
||||||
bindViewTap: function () {
|
bindViewTap: function () {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
@@ -90,16 +93,18 @@ Page({
|
|||||||
getData: function () {
|
getData: function () {
|
||||||
var a = this;
|
var a = this;
|
||||||
// 获取首页数据
|
// 获取首页数据
|
||||||
t.request('/miniprogram/index/balance', {}, !0).then(function (e) {
|
t.request('/miniprogram/index/balance', e.globalData.deviceData, !0).then(function (e) {
|
||||||
a.setData({
|
a.setData({
|
||||||
user: e.data || [],
|
user: e.data || [],
|
||||||
});
|
});
|
||||||
|
// 存储进度订单
|
||||||
|
wx.setStorageSync('progressorder', e.data.progressorder || []);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
load: function (e) {
|
load: function (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
},
|
},
|
||||||
openLocation: function(e) {
|
openLocation: function (e) {
|
||||||
var latitude = Number(e.currentTarget.dataset.latitude);
|
var latitude = Number(e.currentTarget.dataset.latitude);
|
||||||
var longitude = Number(e.currentTarget.dataset.longitude);
|
var longitude = Number(e.currentTarget.dataset.longitude);
|
||||||
var name = e.currentTarget.dataset.name;
|
var name = e.currentTarget.dataset.name;
|
||||||
@@ -123,16 +128,21 @@ Page({
|
|||||||
}), (this.getData(), this.isneedUpload = !1);
|
}), (this.getData(), this.isneedUpload = !1);
|
||||||
},
|
},
|
||||||
toPage: function (t) {
|
toPage: function (t) {
|
||||||
console.info(t);
|
|
||||||
|
|
||||||
// 有phone字段 但允许为空
|
if (t.currentTarget.dataset.phone) {
|
||||||
if (t.currentTarget.dataset.phone || t.currentTarget.dataset.name=='联系客服') {
|
|
||||||
// 打开客服聊天窗口
|
// 打开客服聊天窗口
|
||||||
return wx.openCustomerServiceChat();
|
return wx.openCustomerServiceChat();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
// 增加打电话
|
||||||
|
wx.makePhoneCall({
|
||||||
|
phoneNumber: "" + t.currentTarget.dataset.phone
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
var a = t.currentTarget.dataset, i = a.url, o = a.needlogin, n = a.showimg;
|
var a = t.currentTarget.dataset, i = a.url, o = a.needlogin, n = a.showimg;
|
||||||
if (console.log("showImg", a), i) {
|
if (console.log("showImg", n), i) {
|
||||||
this.isneedUpload = !0;
|
this.isneedUpload = !0;
|
||||||
if (o && !e.globalData.user.session) return this.isneedUpload = !0, wx.navigateTo({
|
if (o && !e.globalData.user.session) return this.isneedUpload = !0, wx.navigateTo({
|
||||||
url: "/pages/login/login"
|
url: "/pages/login/login"
|
||||||
@@ -154,11 +164,13 @@ Page({
|
|||||||
success: function (i) {
|
success: function (i) {
|
||||||
console.log(i), wx.showLoading({
|
console.log(i), wx.showLoading({
|
||||||
title: ""
|
title: ""
|
||||||
}), e.globalData.qrcode = i.result, t.request("/miniprogram/identify", i, !0).then(function (t) {
|
}), e.globalData.qrcode = i.result, t.request("/miniprogram/identify/index", i, !0).then(function (t) {
|
||||||
console.log("data", t), wx.hideLoading(), e.globalData.devicecode = t.data.devicecode || e.globalData.devicecode,
|
console.log("data", t), wx.hideLoading(),
|
||||||
a.setData({
|
e.globalData.deviceData = t.data || e.globalData.deviceData || {};
|
||||||
isScan: !!t.data.devicecode
|
e.globalData.devicecode = t.data.devicecode || e.globalData.devicecode;
|
||||||
});
|
a.setData({
|
||||||
|
isScan: !!t.data.devicecode
|
||||||
|
});
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
});
|
});
|
||||||
@@ -175,41 +187,132 @@ Page({
|
|||||||
e.globalData.needJumpUrl = !1, this.isneedUpload = !0;
|
e.globalData.needJumpUrl = !1, this.isneedUpload = !0;
|
||||||
var t = this;
|
var t = this;
|
||||||
if (console.log("this.isSubmit", this.isSubmit), this.isSubmit) return !1;
|
if (console.log("this.isSubmit", this.isSubmit), this.isSubmit) return !1;
|
||||||
if (t.data.user.money <= 0) return t.startup(), !1;
|
|
||||||
if (t.data.user.money < 10) {
|
if (t.data.user.money == 0) {
|
||||||
if (this.isshowModal) return t.startup(), !1;
|
wx.showModal({
|
||||||
this.isshowModal = !0, wx.showModal({
|
|
||||||
title: "提示",
|
title: "提示",
|
||||||
content: "账户余额小于10元,是否立即充值?",
|
content: "您的洗车金额为0元,是否需要购买洗车金额?",
|
||||||
confirmText: "去充值",
|
confirmText: "去购买",
|
||||||
cancelText: "立即启动",
|
cancelText: "取消",
|
||||||
success: function (e) {
|
success: function (m) {
|
||||||
e.confirm ? (wx.navigateTo({
|
if (m.confirm) {
|
||||||
url: "/pages/voucher/voucher"
|
wx.navigateTo({
|
||||||
}), t.isneedUpload = !0) : t.startup();
|
url: "/pages/voucher/voucher"
|
||||||
},
|
}), t.isneedUpload = !0;
|
||||||
fail: function (e) {
|
}
|
||||||
console.log("fail:", e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else t.startup();
|
return;
|
||||||
|
}
|
||||||
|
else if (t.data.user.money < 10) {
|
||||||
|
wx.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "洗车金额不足10元,是否需要购买洗车金额还是直接开机?",
|
||||||
|
confirmText: "去购买",
|
||||||
|
cancelText: "直接开机",
|
||||||
|
success: function (m) {
|
||||||
|
if (m.confirm) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: "/pages/voucher/voucher"
|
||||||
|
}), t.isneedUpload = !0;
|
||||||
|
} else {
|
||||||
|
t.startup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t.startup();
|
||||||
|
},
|
||||||
|
openOneTimeOptions: function () {
|
||||||
|
var a = this;
|
||||||
|
if (a.data.oneTimeLoading) return !1;
|
||||||
|
a.setData({ oneTimeLoading: !0 });
|
||||||
|
|
||||||
|
// 获取单次洗车配置
|
||||||
|
t.request('/miniprogram/single/getAgentConfig', e.globalData.deviceData || {}, !0).then(function (res) {
|
||||||
|
a.setData({
|
||||||
|
oneTimeOptions: (res.data && Array.isArray(res.data)) ? res.data : (res.data && res.data.list ? res.data.list : []),
|
||||||
|
showOneTimeOptions: !0,
|
||||||
|
oneTimeLoading: !1
|
||||||
|
});
|
||||||
|
}).catch(function () {
|
||||||
|
a.setData({ oneTimeLoading: !1 });
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closeOneTimeOptions: function () {
|
||||||
|
this.setData({ showOneTimeOptions: !1 });
|
||||||
|
},
|
||||||
|
payOneTime: function (evt) {
|
||||||
|
var a = this, i = evt.currentTarget.dataset.token;
|
||||||
|
if (!i) return !1;
|
||||||
|
wx.showLoading({ title: "" });
|
||||||
|
t.request('/miniprogram/single/create', {
|
||||||
|
token: i
|
||||||
|
}, !0).then(function (res) {
|
||||||
|
if (wx.hideLoading(), 200 != res.code) return wx.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: res.message || ""
|
||||||
|
}), !1;
|
||||||
|
var r = res.data.result;
|
||||||
|
var orderid = res.data.orderid;
|
||||||
|
wx.requestPayment({
|
||||||
|
timeStamp: r.timeStamp,
|
||||||
|
nonceStr: r.nonceStr,
|
||||||
|
package: r.package,
|
||||||
|
signType: r.signType,
|
||||||
|
paySign: r.paySign,
|
||||||
|
success: function () {
|
||||||
|
a.setData({ showOneTimeOptions: !1 });
|
||||||
|
var poll = function () {
|
||||||
|
t.request('/miniprogram/single/notify', {
|
||||||
|
orderid: orderid
|
||||||
|
}, !0).then(function (res) {
|
||||||
|
if (200 == res.code) {
|
||||||
|
wx.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "支付成功"
|
||||||
|
});
|
||||||
|
wx.navigateTo({
|
||||||
|
url: "/pages/voucher/voucher"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}).catch(function (err) {
|
||||||
|
if (err && err.code == 202) {
|
||||||
|
setTimeout(poll, 1500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err && err.code == 201) {
|
||||||
|
wx.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: err.message || ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
poll();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).catch(function () {
|
||||||
|
wx.hideLoading();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
startup: function () {
|
startup: function () {
|
||||||
var a = this;
|
var a = this;
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: "提示",
|
title: "提示",
|
||||||
content: "你当前将要使用的机器编号是:".concat(e.globalData.devicecode, ",确认开机吗?"),
|
content: "你当前将要使用的机器编号是:".concat(e.globalData.deviceData.title || e.globalData.deviceData.devicecode, ",确认开机吗?"),
|
||||||
success: function (i) {
|
success: function (i) {
|
||||||
i.confirm && (a.isSubmit = !0, wx.showLoading({
|
i.confirm && (a.isSubmit = !0, wx.showLoading({
|
||||||
title: "正在启动"
|
title: "正在启动"
|
||||||
}), t.request(e.globalData.config.machine.startup, {
|
}), t.request('/miniprogram/' + e.globalData.deviceData.type + '/startup', e.globalData.deviceData || {}, !0).then(function (e) {
|
||||||
washcode: a.data.selectID
|
|
||||||
}, !0).then(function (e) {
|
|
||||||
a.isSubmit = !1, wx.hideLoading(), 200 == e.code && (wx.showModal({
|
a.isSubmit = !1, wx.hideLoading(), 200 == e.code && (wx.showModal({
|
||||||
title: "",
|
title: "",
|
||||||
content: e.message
|
content: e.message
|
||||||
}), a.data.tmplIds.length > 0 && a.requestSubscribeMessage(), wx.redirectTo({
|
}), a.data.tmplIds.length > 0 && a.requestSubscribeMessage(), wx.redirectTo({
|
||||||
url: "/pages/user/user"
|
// url: "/pages/washing/washing"
|
||||||
|
url: "/pages/index/index"
|
||||||
}), a.isneedUpload = !0), 888 == e.code && (wx.navigateTo({
|
}), a.isneedUpload = !0), 888 == e.code && (wx.navigateTo({
|
||||||
url: "/pages/voucher/voucher"
|
url: "/pages/voucher/voucher"
|
||||||
}), a.isneedUpload = !0);
|
}), a.isneedUpload = !0);
|
||||||
|
|||||||
Reference in New Issue
Block a user