You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

332 lines
10 KiB

"use strict";
const common_vendor = require("../../common/vendor.js");
const config_host = require("../../config/host.js");
const utils_log = require("../../utils/log.js");
const api_address = require("../../api/address.js");
const utils_functions = require("../../utils/functions.js");
require("../../utils/request.js");
require("../../utils/qqmap-wx-jssdk.min.js");
require("../../api/other.js");
const HeaderNav = () => "../../components/HeaderNav/Index.js";
const FooterNav = () => "../../components/FooterNav/Index.js";
const RightNav = () => "../../components/RightNav/Index.js";
const MzButton = () => "../../components/MzButton/Index.js";
const _sfc_main = {
components: {
HeaderNav,
FooterNav,
RightNav,
MzButton
},
data() {
return {
staticImage: {
orderCardBackground: config_host.imghost + "/static/image/order-card-background.png",
wallpaperBgImage: config_host.imghost + "/static/image/background.png",
addrDetailTitle: config_host.imghost + "/static/image/addr-detail-title.png"
},
radiolist1: [
{
name: "普通锁",
value: 2,
disabled: true
},
{
name: "密码锁",
value: 1,
disabled: false
}
],
radiolist2: [
{
name: "否",
value: 0,
disabled: true
},
{
name: "是",
value: 1,
disabled: false
}
],
showSex: false,
model1: {
userInfo: {
name: "uview-plus UI",
sex: ""
}
},
actions: [
{
name: "男"
},
{
name: "女"
},
{
name: "保密"
}
],
rules: {
"userInfo.name": {
type: "string",
required: true,
message: "请填写姓名",
trigger: ["blur", "change"]
},
"userInfo.sex": {
type: "string",
max: 1,
required: true,
message: "请选择男或女",
trigger: ["blur", "change"]
}
},
radio: "",
switchVal: false,
address: {
phone: "",
name: "",
province: "四川省",
city: "成都市",
district: "武侯区",
info: "",
is_init: 0,
lock_type: 2,
open_info: "",
lng: "80",
lat: "80"
}
};
},
onLoad(options) {
utils_log.log(options);
if (options.hasOwnProperty("id")) {
this.getDetail(options.id);
}
},
methods: {
checkLock(index, item) {
this.address.lock_type = item.value;
this.radiolist1.forEach((item2, num) => {
if (index === num) {
this.radiolist1[num].disabled = true;
} else {
this.radiolist1[num].disabled = false;
}
});
},
checkDefault(index, item) {
this.address.is_init = item.value;
this.radiolist2.forEach((item2, num) => {
if (index === num) {
this.radiolist2[num].disabled = true;
} else {
this.radiolist2[num].disabled = false;
}
});
},
getDetail(id) {
api_address.getDetail(id).then((data) => {
this.address = data.data;
this.address.position = data.data.province + data.data.city + data.data.district;
});
},
selectAddress() {
let that = this;
common_vendor.index.getLocation({
type: "gcj02",
success: function(res1) {
common_vendor.index.chooseLocation({
latitude: res1.latitude || "",
longitude: res1.longitude || "",
success: (res) => {
utils_functions.api.getloction({ activedeta: {
city: "",
address: res.address
} }).then((data) => {
let address = data.address_components;
console.log("address", address);
that.address.province = address.province;
that.address.city = address.city;
that.address.district = address.district;
that.address.position = address.province + address.city + address.district;
that.address.info = res.name;
that.address.lat = res.latitude;
that.address.lng = res.longitude;
});
},
fail: (err) => {
console.log(err);
}
});
},
fail: (err) => {
console.log(err);
}
});
},
submit() {
utils_log.log(this.address);
api_address.saveAddress(this.address).then(() => {
utils_functions.api.success("成功").then(() => {
common_vendor.index.navigateBack();
});
});
}
},
onPageScroll(res) {
if (res.scrollTop <= 20) {
common_vendor.index.$emit("isTop", true);
} else {
common_vendor.index.$emit("isTop", false);
}
},
created() {
}
};
if (!Array) {
const _component_HeaderNav = common_vendor.resolveComponent("HeaderNav");
const _easycom_u_input2 = common_vendor.resolveComponent("u-input");
const _easycom_u_form_item2 = common_vendor.resolveComponent("u-form-item");
const _easycom_u_text2 = common_vendor.resolveComponent("u-text");
const _easycom_u__input2 = common_vendor.resolveComponent("u--input");
const _component_MzButton = common_vendor.resolveComponent("MzButton");
const _easycom_u_form2 = common_vendor.resolveComponent("u-form");
const _easycom_u_action_sheet2 = common_vendor.resolveComponent("u-action-sheet");
(_component_HeaderNav + _easycom_u_input2 + _easycom_u_form_item2 + _easycom_u_text2 + _easycom_u__input2 + _component_MzButton + _easycom_u_form2 + _easycom_u_action_sheet2)();
}
const _easycom_u_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_u_form_item = () => "../../uni_modules/uview-plus/components/u-form-item/u-form-item.js";
const _easycom_u_text = () => "../../uni_modules/uview-plus/components/u-text/u-text.js";
const _easycom_u__input = () => "../../uni_modules/uview-plus/components/u--input/u--input.js";
const _easycom_u_form = () => "../../uni_modules/uview-plus/components/u-form/u-form.js";
const _easycom_u_action_sheet = () => "../../uni_modules/uview-plus/components/u-action-sheet/u-action-sheet.js";
if (!Math) {
(_easycom_u_input + _easycom_u_form_item + _easycom_u_text + _easycom_u__input + _easycom_u_form + _easycom_u_action_sheet)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: "url(" + $data.staticImage.wallpaperBgImage + ")",
b: common_vendor.p({
title: "新增地址",
["is-back"]: true
}),
c: $data.staticImage.addrDetailTitle,
d: common_vendor.o(($event) => $data.address.name = $event),
e: common_vendor.p({
border: "none",
inputAlign: "right",
placeholder: "请填写家长姓名",
modelValue: $data.address.name
}),
f: common_vendor.sr("item1", "bf76247e-2,bf76247e-1"),
g: common_vendor.p({
label: "家长姓名",
prop: "address.name",
borderBottom: true
}),
h: common_vendor.o(($event) => $data.address.phone = $event),
i: common_vendor.p({
border: "none",
inputAlign: "right",
placeholder: "请填写联系电话",
modelValue: $data.address.phone
}),
j: common_vendor.sr("item1", "bf76247e-4,bf76247e-1"),
k: common_vendor.p({
label: "家长电话",
prop: "address.phone",
borderBottom: true
}),
l: common_vendor.o($options.selectAddress),
m: common_vendor.p({
["suffix-icon"]: "arrow-right",
["icon-style"]: "align-items:center;font-size:28rpx;",
["line-height"]: "28",
text: $data.address.position || "请选择位置",
size: "28",
color: $data.address.position ? "#636363" : "#636363",
align: "right"
}),
n: common_vendor.sr("item1", "bf76247e-6,bf76247e-1"),
o: common_vendor.p({
label: "所在位置",
prop: "address.position",
borderBottom: true
}),
p: $data.address.info,
q: common_vendor.o(($event) => $data.address.info = $event.detail.value),
r: common_vendor.sr("item1", "bf76247e-8,bf76247e-1"),
s: common_vendor.p({
label: "",
prop: "address.info",
borderBottom: false
}),
t: common_vendor.f($data.radiolist1, (item, index, i0) => {
return {
a: common_vendor.t(item.name),
b: item.disabled ? 1 : "",
c: common_vendor.o(($event) => $options.checkLock(index, item))
};
}),
v: common_vendor.sr("item1", "bf76247e-9,bf76247e-1"),
w: common_vendor.p({
label: "锁类型",
prop: "address.lock_type",
borderBottom: true,
inputAlign: "right"
}),
x: common_vendor.f($data.radiolist2, (item, index, i0) => {
return {
a: common_vendor.t(item.name),
b: item.disabled ? 1 : "",
c: common_vendor.o(($event) => $options.checkDefault(index, item))
};
}),
y: common_vendor.sr("item1", "bf76247e-10,bf76247e-1"),
z: common_vendor.p({
label: "是否默认",
prop: "address.is_init",
borderBottom: true,
inputAlign: "right"
}),
A: common_vendor.o(($event) => $data.address.open_info = $event),
B: common_vendor.p({
border: "none",
inputAlign: "right",
placeholder: "请填写" + ($data.address.lock_type === 1 ? "开锁密码" : "钥匙位置"),
modelValue: $data.address.open_info
}),
C: common_vendor.sr("item1", "bf76247e-11,bf76247e-1"),
D: common_vendor.p({
label: $data.address.lock_type === 1 ? "开锁密码" : "钥匙位置",
prop: "address.open_info",
borderBottom: true
}),
E: common_vendor.p({
["button-width"]: "317.2rpx",
["button-color"]: "#4DC3B8",
["font-color"]: "#FFFFFF",
title: "保存地址"
}),
F: common_vendor.o(($event) => $options.submit()),
G: common_vendor.sr("form1", "bf76247e-1"),
H: common_vendor.p({
labelWidth: "auto",
labelPosition: "left",
model: $data.address
}),
I: common_vendor.o(($event) => $data.showSex = false),
J: common_vendor.o(_ctx.sexSelect),
K: common_vendor.p({
show: $data.showSex,
actions: $data.actions,
title: "请选择性别",
description: "如果选择保密会报错"
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/pet_uni/pages/AddrDetail/index.vue"]]);
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);