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.
276 lines
8.3 KiB
276 lines
8.3 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"); |
|
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; |
|
}); |
|
}, |
|
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 _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 + _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__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__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", "e1e9c462-2,e1e9c462-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", "e1e9c462-4,e1e9c462-1"), |
|
k: common_vendor.p({ |
|
label: "家长电话", |
|
prop: "address.phone", |
|
borderBottom: true |
|
}), |
|
l: $data.address.info, |
|
m: common_vendor.o(($event) => $data.address.info = $event.detail.value), |
|
n: common_vendor.sr("item1", "e1e9c462-6,e1e9c462-1"), |
|
o: common_vendor.p({ |
|
label: "", |
|
prop: "address.info", |
|
borderBottom: false |
|
}), |
|
p: 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)) |
|
}; |
|
}), |
|
q: common_vendor.sr("item1", "e1e9c462-7,e1e9c462-1"), |
|
r: common_vendor.p({ |
|
label: "锁类型", |
|
prop: "address.lock_type", |
|
borderBottom: true, |
|
inputAlign: "right" |
|
}), |
|
s: 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)) |
|
}; |
|
}), |
|
t: common_vendor.sr("item1", "e1e9c462-8,e1e9c462-1"), |
|
v: common_vendor.p({ |
|
label: "是否默认", |
|
prop: "address.is_init", |
|
borderBottom: true, |
|
inputAlign: "right" |
|
}), |
|
w: common_vendor.o(($event) => $data.address.open_info = $event), |
|
x: common_vendor.p({ |
|
border: "none", |
|
inputAlign: "right", |
|
placeholder: "请填写" + ($data.address.lock_type === 1 ? "开锁密码" : "钥匙位置"), |
|
modelValue: $data.address.open_info |
|
}), |
|
y: common_vendor.sr("item1", "e1e9c462-9,e1e9c462-1"), |
|
z: common_vendor.p({ |
|
label: $data.address.lock_type === 1 ? "开锁密码" : "钥匙位置", |
|
prop: "address.open_info", |
|
borderBottom: true |
|
}), |
|
A: common_vendor.p({ |
|
["button-width"]: "317.2rpx", |
|
["button-color"]: "#4DC3B8", |
|
["font-color"]: "#FFFFFF", |
|
title: "保存地址" |
|
}), |
|
B: common_vendor.o(($event) => $options.submit()), |
|
C: common_vendor.sr("form1", "e1e9c462-1"), |
|
D: common_vendor.p({ |
|
labelWidth: "auto", |
|
labelPosition: "left", |
|
model: $data.address |
|
}), |
|
E: common_vendor.o(($event) => $data.showSex = false), |
|
F: common_vendor.o(_ctx.sexSelect), |
|
G: common_vendor.p({ |
|
show: $data.showSex, |
|
actions: $data.actions, |
|
title: "请选择性别", |
|
description: "如果选择保密会报错" |
|
}) |
|
}; |
|
} |
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/phpstudy_pro/WEB/pet_uni/pages/AddrDetail/index.vue"]]); |
|
_sfc_main.__runtimeHooks = 1; |
|
wx.createPage(MiniProgramPage);
|
|
|