no message
This commit is contained in:
386
unpackage/dist/dev/mp-weixin/pages/home/star.js
vendored
Normal file
386
unpackage/dist/dev/mp-weixin/pages/home/star.js
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const api_api = require("../../api/api.js");
|
||||
const store_index = require("../../store/index.js");
|
||||
const utils_fun = require("../../utils/fun.js");
|
||||
const hooks_useNav = require("../../hooks/useNav.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_tag2 = common_vendor.resolveComponent("up-tag");
|
||||
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
|
||||
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
||||
const _easycom_uni_popup_dialog2 = common_vendor.resolveComponent("uni-popup-dialog");
|
||||
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
||||
(_easycom_up_tag2 + _easycom_up_button2 + _easycom_up_icon2 + _easycom_uni_popup_dialog2 + _easycom_uni_popup2)();
|
||||
}
|
||||
const _easycom_up_tag = () => "../../uni_modules/uview-plus/components/u-tag/u-tag.js";
|
||||
const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
|
||||
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
||||
const _easycom_uni_popup_dialog = () => "../../uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.js";
|
||||
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_tag + _easycom_up_button + _easycom_up_icon + _easycom_uni_popup_dialog + _easycom_uni_popup)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "star",
|
||||
setup(__props) {
|
||||
const { navTo } = hooks_useNav.useNav();
|
||||
const inputDialog = common_vendor.ref(null);
|
||||
let info = common_vendor.reactive({});
|
||||
let infoUser = common_vendor.reactive({});
|
||||
let inputBorder = common_vendor.ref(false);
|
||||
let currentPrice = common_vendor.ref({});
|
||||
let id = common_vendor.ref("");
|
||||
let userCard = common_vendor.ref([]);
|
||||
let userCardId = common_vendor.ref(null);
|
||||
let payType = common_vendor.ref(1);
|
||||
let dataForm = common_vendor.reactive({
|
||||
money: 30
|
||||
});
|
||||
let payList = common_vendor.reactive([
|
||||
{
|
||||
id: 1,
|
||||
name: "余额支付"
|
||||
}
|
||||
]);
|
||||
common_vendor.onLoad((options) => {
|
||||
if (options.q) {
|
||||
let search = decodeURIComponent(options.q);
|
||||
search = search.split("?")[1];
|
||||
const pairs = search ? search.split("&") : [];
|
||||
const query = {};
|
||||
for (let i = 0; i < pairs.length; ++i) {
|
||||
const [key, value] = pairs[i].split("=");
|
||||
query[key] = query[key] || decodeURIComponent(value);
|
||||
}
|
||||
if (query.num) {
|
||||
id.value = query.num;
|
||||
infoDate(query.num);
|
||||
}
|
||||
}
|
||||
if (options.id) {
|
||||
id.value = options.id;
|
||||
infoDate(options.id);
|
||||
}
|
||||
});
|
||||
common_vendor.onShow(async () => {
|
||||
if (common_vendor.index.getStorageSync("token") && id.value) {
|
||||
infoDate(id.value);
|
||||
let _res = await api_api.userInfo();
|
||||
infoUser.value = _res;
|
||||
}
|
||||
});
|
||||
let getUserCard = async (e) => {
|
||||
let _res = await api_api.userCardUsableList({ stationId: e });
|
||||
userCard.value = _res;
|
||||
if (_res.length == 0) {
|
||||
payType.value = 1;
|
||||
} else {
|
||||
payType.value = 2;
|
||||
userCardId.value = _res[0].id;
|
||||
if (!payList.find((val) => val.name == "电卡支付")) {
|
||||
payList.push({
|
||||
id: 2,
|
||||
name: "电卡支付"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
let inputClik = () => {
|
||||
inputBorder.value = true;
|
||||
dataForm.money = dataForm.money == 30 || dataForm.money == 50 || dataForm.money == 100 ? "" : dataForm.money;
|
||||
};
|
||||
let infoDate = async (e) => {
|
||||
let _res = await api_api.gunInfo({ deviceNo: e });
|
||||
info = _res;
|
||||
getUserCard(_res.stationId);
|
||||
currentPrice.value = _res.currentPrice;
|
||||
common_vendor.index.__f__("log", "at pages/home/star.vue:275", _res.deviceNo, "_res.deviceNo");
|
||||
common_vendor.index.__f__("log", "at pages/home/star.vue:276", _res.gunNo, "_res.gunNo");
|
||||
store_index.store.commit("setInsertStatus", _res.insertStatus);
|
||||
common_vendor.index.sendSocketMessage({
|
||||
data: JSON.stringify({
|
||||
command: "sub",
|
||||
deviceNo: _res.deviceNo,
|
||||
gunNo: _res.gunNo
|
||||
}),
|
||||
success: (res) => {
|
||||
common_vendor.index.__f__("log", "at pages/home/star.vue:286", "发送成功");
|
||||
},
|
||||
fail: (err) => {
|
||||
common_vendor.index.__f__("log", "at pages/home/star.vue:289", err);
|
||||
common_vendor.index.__f__("log", "at pages/home/star.vue:290", "发送失败");
|
||||
}
|
||||
});
|
||||
};
|
||||
let dialogInputConfirm = (e) => {
|
||||
dataForm.money = e;
|
||||
};
|
||||
let toRechargeCard = async () => {
|
||||
common_vendor.index.showLoading({
|
||||
title: "启动充电中...",
|
||||
mask: true
|
||||
});
|
||||
await api_api.startChargingByCard({
|
||||
deviceNo: info.deviceNo,
|
||||
gunNo: info.gunNo,
|
||||
amount: dataForm.money,
|
||||
userCardId: userCardId.value
|
||||
});
|
||||
};
|
||||
let toRechargeYuFu = async () => {
|
||||
common_vendor.index.showLoading({
|
||||
title: "启动充电中...",
|
||||
mask: true
|
||||
});
|
||||
let _res = await api_api.startChargingByAdaPay({
|
||||
deviceNo: info.deviceNo,
|
||||
gunNo: info.gunNo,
|
||||
amount: dataForm.money
|
||||
});
|
||||
let data = _res.payInfo;
|
||||
common_vendor.index.requestPayment({
|
||||
provider: "wxpay",
|
||||
timeStamp: data.timeStamp,
|
||||
nonceStr: data.nonceStr,
|
||||
package: data.package,
|
||||
signType: data.signType,
|
||||
paySign: data.paySign,
|
||||
success: function(r) {
|
||||
store_index.store.commit("setTransactionNo", _res.transactionNo);
|
||||
store_index.store.commit("setSokStatus", 0);
|
||||
timeMap(_res);
|
||||
},
|
||||
fail: function(err) {
|
||||
common_vendor.index.showToast({
|
||||
title: "已取消支付",
|
||||
icon: "none"
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/home/star.vue:345", "fail:" + JSON.stringify(err));
|
||||
}
|
||||
});
|
||||
};
|
||||
let toRecharge = async () => {
|
||||
common_vendor.index.showLoading({
|
||||
title: "启动充电中...",
|
||||
mask: true
|
||||
});
|
||||
let _res = await api_api.startChargingByWallet({
|
||||
deviceNo: info.deviceNo,
|
||||
gunNo: info.gunNo,
|
||||
amount: dataForm.money
|
||||
});
|
||||
store_index.store.commit("setTransactionNo", _res.transactionNo);
|
||||
store_index.store.commit("setSokStatus", 0);
|
||||
timeMap(_res);
|
||||
};
|
||||
const timeMap = (_res) => {
|
||||
var time = setInterval(async () => {
|
||||
if (store_index.store.state.sokStatus != 1) {
|
||||
let _data = await api_api.ordersInfo({
|
||||
transactionNo: _res.transactionNo
|
||||
});
|
||||
store_index.store.commit("setDataObj", _data);
|
||||
if (_data.status == 3) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pageOrder/recharge/recharge?transactionNo=${_res.transactionNo}&type=order`
|
||||
});
|
||||
clearTimeout(time);
|
||||
store_index.store.commit("setSokStatus", 0);
|
||||
}
|
||||
if (_data.status == -1) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: "启动失败,请重试",
|
||||
showCancel: false,
|
||||
confirmText: "确认",
|
||||
success: () => {
|
||||
}
|
||||
});
|
||||
clearTimeout(time);
|
||||
store_index.store.commit("setSokStatus", 0);
|
||||
}
|
||||
if (_data.status == -2) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: "启动超时,请重试",
|
||||
showCancel: false,
|
||||
confirmText: "确认",
|
||||
success: () => {
|
||||
}
|
||||
});
|
||||
clearTimeout(time);
|
||||
store_index.store.commit("setSokStatus", 0);
|
||||
}
|
||||
}
|
||||
}, 5e3);
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(common_vendor.unref(info).stationName),
|
||||
b: common_vendor.t(common_vendor.unref(info).gunName),
|
||||
c: common_assets._imports_0$6,
|
||||
d: common_vendor.o(($event) => common_vendor.unref(utils_fun.copy)(common_vendor.unref(info).gunName)),
|
||||
e: common_vendor.t(common_vendor.unref(info).occupyCostInfo),
|
||||
f: common_vendor.t(common_vendor.unref(info).parkCostInfo),
|
||||
g: common_vendor.p({
|
||||
size: "mini",
|
||||
text: `当前计费时间段:${common_vendor.unref(currentPrice).startTime}-${common_vendor.unref(currentPrice).endTime}`,
|
||||
plain: true,
|
||||
plainFill: true
|
||||
}),
|
||||
h: common_vendor.t(common_vendor.unref(currentPrice).totalAmount),
|
||||
i: common_vendor.unref(store_index.store).state.insertStatus == 1
|
||||
}, common_vendor.unref(store_index.store).state.insertStatus == 1 ? {
|
||||
j: common_vendor.p({
|
||||
size: "mini",
|
||||
text: "已插枪",
|
||||
plain: true,
|
||||
plainFill: true
|
||||
})
|
||||
} : {}, {
|
||||
k: common_vendor.o(($event) => common_vendor.unref(navTo)("/pages/money/recharge")),
|
||||
l: common_vendor.p({
|
||||
type: "primary",
|
||||
size: "small",
|
||||
plain: true,
|
||||
text: "余额充值"
|
||||
}),
|
||||
m: common_vendor.f(common_vendor.unref(payList), (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: `/static/icon/lie${item.id}.png`,
|
||||
b: common_vendor.t(item.name),
|
||||
c: item.id == 1
|
||||
}, item.id == 1 ? {
|
||||
d: common_vendor.t(common_vendor.unref(infoUser).balance || 0)
|
||||
} : {}, {
|
||||
e: index,
|
||||
f: item.id == common_vendor.unref(payType) ? "1rpx solid #4879e6" : "",
|
||||
g: common_vendor.o(($event) => common_vendor.isRef(payType) ? payType.value = item.id : payType = item.id, index)
|
||||
});
|
||||
}),
|
||||
n: common_vendor.p({
|
||||
size: "mini",
|
||||
text: `余额原路退款`,
|
||||
plain: true,
|
||||
plainFill: true
|
||||
}),
|
||||
o: common_vendor.o(($event) => {
|
||||
common_vendor.unref(dataForm).money = 30;
|
||||
common_vendor.isRef(inputBorder) ? inputBorder.value = false : inputBorder = false;
|
||||
}),
|
||||
p: `1rpx solid ${common_vendor.unref(dataForm).money == 30 && !common_vendor.unref(inputBorder) ? "#4879e6" : "#c5c5c5"}`,
|
||||
q: common_vendor.o(($event) => {
|
||||
common_vendor.unref(dataForm).money = 50;
|
||||
common_vendor.isRef(inputBorder) ? inputBorder.value = false : inputBorder = false;
|
||||
}),
|
||||
r: `1rpx solid ${common_vendor.unref(dataForm).money == 50 && !common_vendor.unref(inputBorder) ? "#4879e6" : "#c5c5c5"}`,
|
||||
s: common_vendor.o(($event) => {
|
||||
common_vendor.unref(dataForm).money = 100;
|
||||
common_vendor.isRef(inputBorder) ? inputBorder.value = false : inputBorder = false;
|
||||
}),
|
||||
t: `1rpx solid ${common_vendor.unref(dataForm).money == 100 && !common_vendor.unref(inputBorder) ? "#4879e6" : "#c5c5c5"}`,
|
||||
v: common_vendor.unref(inputBorder)
|
||||
}, common_vendor.unref(inputBorder) ? {
|
||||
w: common_vendor.unref(dataForm).money,
|
||||
x: common_vendor.o(($event) => common_vendor.unref(dataForm).money = $event.detail.value)
|
||||
} : {}, {
|
||||
y: common_vendor.o((...args) => common_vendor.unref(inputClik) && common_vendor.unref(inputClik)(...args)),
|
||||
z: `1rpx solid ${common_vendor.unref(inputBorder) ? "#4879e6" : "#c5c5c5"}`,
|
||||
A: common_vendor.unref(payType) == 2
|
||||
}, common_vendor.unref(payType) == 2 ? {
|
||||
B: common_vendor.f(common_vendor.unref(userCard), (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.unref(userCardId) == item.id
|
||||
}, common_vendor.unref(userCardId) == item.id ? {
|
||||
b: "2dd6a3c8-4-" + i0,
|
||||
c: common_vendor.p({
|
||||
name: "checkbox-mark",
|
||||
color: "#fff"
|
||||
})
|
||||
} : {}, {
|
||||
d: common_vendor.t(item.name),
|
||||
e: common_vendor.t(item.cardNo),
|
||||
f: common_vendor.t(item.balance),
|
||||
g: common_vendor.o(($event) => common_vendor.isRef(userCardId) ? userCardId.value = item.id : userCardId = item.id, index),
|
||||
h: index
|
||||
});
|
||||
})
|
||||
} : {}, {
|
||||
C: common_vendor.t(common_vendor.unref(currentPrice).totalAmount),
|
||||
D: !common_vendor.unref(payType)
|
||||
}, !common_vendor.unref(payType) ? {
|
||||
E: common_vendor.p({
|
||||
customStyle: {
|
||||
height: "80rpx",
|
||||
width: "230rpx"
|
||||
},
|
||||
disabled: true,
|
||||
color: "#4879e6",
|
||||
text: "请选择支付方式",
|
||||
shape: "circle"
|
||||
})
|
||||
} : {}, {
|
||||
F: common_vendor.unref(payType) == 1
|
||||
}, common_vendor.unref(payType) == 1 ? {
|
||||
G: common_vendor.o(common_vendor.unref(toRecharge)),
|
||||
H: common_vendor.p({
|
||||
customStyle: {
|
||||
height: "80rpx",
|
||||
width: "280rpx"
|
||||
},
|
||||
color: "#4879e6",
|
||||
shape: "circle",
|
||||
text: "启动充电"
|
||||
})
|
||||
} : {}, {
|
||||
I: common_vendor.unref(payType) == 3
|
||||
}, common_vendor.unref(payType) == 3 ? {
|
||||
J: common_vendor.o(common_vendor.unref(toRechargeYuFu)),
|
||||
K: common_vendor.p({
|
||||
customStyle: {
|
||||
height: "80rpx",
|
||||
width: "280rpx"
|
||||
},
|
||||
color: "#4879e6",
|
||||
shape: "circle",
|
||||
text: `预付${common_vendor.unref(dataForm).money}元,启动充电`
|
||||
})
|
||||
} : {}, {
|
||||
L: common_vendor.unref(payType) == 2
|
||||
}, common_vendor.unref(payType) == 2 ? {
|
||||
M: common_vendor.o(common_vendor.unref(toRechargeCard)),
|
||||
N: common_vendor.p({
|
||||
customStyle: {
|
||||
height: "80rpx",
|
||||
width: "280rpx"
|
||||
},
|
||||
disabled: !common_vendor.unref(userCardId),
|
||||
color: "#4879e6",
|
||||
text: common_vendor.unref(userCardId) ? "启动充电" : "请选择电卡",
|
||||
shape: "circle"
|
||||
})
|
||||
} : {}, {
|
||||
O: common_vendor.sr("inputClose", "2dd6a3c8-10,2dd6a3c8-9"),
|
||||
P: common_vendor.o(common_vendor.unref(dialogInputConfirm)),
|
||||
Q: common_vendor.p({
|
||||
mode: "input",
|
||||
title: "请输入预付金额",
|
||||
value: common_vendor.unref(dataForm).money,
|
||||
placeholder: "请输入内容"
|
||||
}),
|
||||
R: common_vendor.sr(inputDialog, "2dd6a3c8-9", {
|
||||
"k": "inputDialog"
|
||||
}),
|
||||
S: common_vendor.p({
|
||||
type: "dialog"
|
||||
})
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
wx.createPage(_sfc_main);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/home/star.js.map
|
||||
Reference in New Issue
Block a user