261 lines
8.2 KiB
JavaScript
261 lines
8.2 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const store_modules_user = require("../../store/modules/user.js");
|
|
const api_booking_emergency_index = require("../../api/booking/emergency/index.js");
|
|
require("../../utils/request.js");
|
|
const utils_common = require("../../utils/common.js");
|
|
const store_modules_tenant = require("../../store/modules/tenant.js");
|
|
store_modules_tenant.useTenantStore();
|
|
const userStore = store_modules_user.useUserStore();
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
list: [],
|
|
statusBarHeight: 104,
|
|
isLogin: false,
|
|
form: {
|
|
name: "",
|
|
phone: ""
|
|
},
|
|
rules: {
|
|
// 对name字段进行必填验证
|
|
name: {
|
|
rules: [
|
|
{
|
|
required: true,
|
|
errorMessage: "请输入姓名"
|
|
},
|
|
{
|
|
minLength: 2,
|
|
maxLength: 10,
|
|
errorMessage: "输入的姓名不正确"
|
|
}
|
|
]
|
|
},
|
|
// 对email字段进行必填验证
|
|
phone: {
|
|
rules: [
|
|
{
|
|
required: true,
|
|
errorMessage: "请输入手机号码"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
fields: {},
|
|
logo: "",
|
|
bookingUser: {},
|
|
server: [],
|
|
order: []
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.reload();
|
|
},
|
|
methods: {
|
|
async reload(e) {
|
|
const app = this;
|
|
const userInfo = await userStore.fetchUserInfo();
|
|
if (Object.keys(userInfo).length > 0) {
|
|
app.isLogin = true;
|
|
app.userInfo = userInfo;
|
|
} else {
|
|
app.isLogin = false;
|
|
}
|
|
api_booking_emergency_index.pageEmergency({
|
|
userId: userInfo.userId
|
|
}).then((res) => {
|
|
app.list = res.list;
|
|
});
|
|
},
|
|
navTo(item) {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
utils_common.openUrl(item);
|
|
},
|
|
// 弹出登录提示框
|
|
openLogin() {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
},
|
|
add() {
|
|
this.$refs.addForm.open("center");
|
|
},
|
|
onDel(item) {
|
|
const app = this;
|
|
common_vendor.index.showModal({
|
|
title: "确定要删除吗?",
|
|
success(o) {
|
|
if (o.confirm) {
|
|
common_vendor.index.showLoading({
|
|
title: "请求中."
|
|
});
|
|
api_booking_emergency_index.removeEmergency(item.emergencyId).then((res) => {
|
|
common_vendor.index.showToast({
|
|
title: "操作成功",
|
|
icon: "none"
|
|
});
|
|
});
|
|
app.reload();
|
|
}
|
|
}
|
|
});
|
|
},
|
|
// 触发提交表单
|
|
submit() {
|
|
this.$refs.form.validate().then((res) => {
|
|
api_booking_emergency_index.addEmergency(this.form).then((msg) => {
|
|
common_vendor.index.showToast({
|
|
title: msg,
|
|
icon: "none"
|
|
});
|
|
this.$refs.addForm.close();
|
|
this.reload();
|
|
}).catch(() => {
|
|
common_vendor.index.showToast({
|
|
title: "请检查您的网络.",
|
|
icon: "none"
|
|
});
|
|
common_vendor.index.hideLoading();
|
|
this.$refs.addForm.close();
|
|
this.reload();
|
|
});
|
|
}).catch((err) => {
|
|
console.log("表单错误信息:", err);
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
|
|
const _easycom_uv_cell2 = common_vendor.resolveComponent("uv-cell");
|
|
const _easycom_uv_cell_group2 = common_vendor.resolveComponent("uv-cell-group");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
|
|
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
|
const _easycom_uv_input2 = common_vendor.resolveComponent("uv-input");
|
|
const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item");
|
|
const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
(_easycom_uv_icon2 + _easycom_uv_cell2 + _easycom_uv_cell_group2 + _easycom_uni_card2 + _easycom_uv_button2 + _easycom_ws_login2 + _easycom_uv_input2 + _easycom_uni_forms_item2 + _easycom_uni_forms2 + _easycom_uni_popup2)();
|
|
}
|
|
const _easycom_uv_icon = () => "../../uni_modules/uv-icon/components/uv-icon/uv-icon.js";
|
|
const _easycom_uv_cell = () => "../../uni_modules/uv-cell/components/uv-cell/uv-cell.js";
|
|
const _easycom_uv_cell_group = () => "../../uni_modules/uv-cell/components/uv-cell-group/uv-cell-group.js";
|
|
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
|
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
|
|
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
|
const _easycom_uv_input = () => "../../uni_modules/uv-input/components/uv-input/uv-input.js";
|
|
const _easycom_uni_forms_item = () => "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js";
|
|
const _easycom_uni_forms = () => "../../uni_modules/uni-forms/components/uni-forms/uni-forms.js";
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
(_easycom_uv_icon + _easycom_uv_cell + _easycom_uv_cell_group + _easycom_uni_card + _easycom_uv_button + _easycom_ws_login + _easycom_uv_input + _easycom_uni_forms_item + _easycom_uni_forms + _easycom_uni_popup)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.f($data.list, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.o(($event) => $options.onDel(item), index),
|
|
b: "1eb32f4a-3-" + i0 + "," + ("1eb32f4a-2-" + i0),
|
|
c: "1eb32f4a-2-" + i0 + ",1eb32f4a-1",
|
|
d: common_vendor.p({
|
|
cellStyle: {
|
|
padding: "10px 0"
|
|
},
|
|
title: item.name,
|
|
label: item.phone
|
|
}),
|
|
e: index
|
|
};
|
|
}),
|
|
b: common_vendor.p({
|
|
size: "40rpx",
|
|
name: "trash"
|
|
}),
|
|
c: common_vendor.p({
|
|
customStyle: {
|
|
backgroundColor: "#ffffff"
|
|
},
|
|
border: false
|
|
}),
|
|
d: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: 0
|
|
}),
|
|
e: common_vendor.o($options.add),
|
|
f: common_vendor.p({
|
|
customStyle: {
|
|
background: "linear-gradient(to right, #70b915, #008e04)",
|
|
borderRadius: "30px",
|
|
color: "#ffffff"
|
|
},
|
|
text: "添加"
|
|
}),
|
|
g: common_vendor.sr("login", "1eb32f4a-5"),
|
|
h: common_vendor.o($options.reload),
|
|
i: common_vendor.p({
|
|
logo: $data.logo
|
|
}),
|
|
j: common_vendor.o(($event) => $data.form.name = $event),
|
|
k: common_vendor.p({
|
|
placeholder: "请输入姓名",
|
|
maxlength: "11",
|
|
customStyle: {
|
|
margin: "10px 0"
|
|
},
|
|
modelValue: $data.form.name
|
|
}),
|
|
l: common_vendor.p({
|
|
label: "姓名",
|
|
name: "name"
|
|
}),
|
|
m: common_vendor.o(($event) => $data.form.phone = $event),
|
|
n: common_vendor.p({
|
|
placeholder: "请输入手机号码",
|
|
maxlength: "11",
|
|
customStyle: {
|
|
margin: "10px 0"
|
|
},
|
|
modelValue: $data.form.phone
|
|
}),
|
|
o: common_vendor.p({
|
|
label: "手机号码",
|
|
name: "phone"
|
|
}),
|
|
p: common_vendor.o($options.submit),
|
|
q: common_vendor.p({
|
|
customStyle: {
|
|
background: "linear-gradient(to right, #70b915, #008e04)",
|
|
borderRadius: "30px",
|
|
color: "#ffffff"
|
|
},
|
|
text: "保存"
|
|
}),
|
|
r: common_vendor.sr("form", "1eb32f4a-8,1eb32f4a-7"),
|
|
s: common_vendor.p({
|
|
modelValue: $data.form,
|
|
rules: $data.rules,
|
|
["label-width"]: 80
|
|
}),
|
|
t: common_vendor.p({
|
|
title: "添加紧急联系人",
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: "10px 6px"
|
|
}),
|
|
v: common_vendor.sr("addForm", "1eb32f4a-6"),
|
|
w: common_vendor.p({
|
|
type: "center",
|
|
["border-radius"]: "10px 10px 0 0"
|
|
})
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/user/emergency.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|