|
|
|
"use strict";
|
|
|
|
const common_vendor = require("../../common/vendor.js");
|
|
|
|
const config_host = require("../../config/host.js");
|
|
|
|
const api_address = require("../../api/address.js");
|
|
|
|
const utils_functions = require("../../utils/functions.js");
|
|
|
|
require("../../utils/request.js");
|
|
|
|
require("../../utils/log.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 {
|
|
|
|
options1: [{
|
|
|
|
text: "删除"
|
|
|
|
}],
|
|
|
|
title: "Hello",
|
|
|
|
loading: true,
|
|
|
|
staticImage: {
|
|
|
|
screenActiveImg: config_host.imghost + "/static/image/order-screen-active.png",
|
|
|
|
orderCardBackground: config_host.imghost + "/static/image/order-card-background.png",
|
|
|
|
wallpaperBgImage: config_host.imghost + "/static/image/background.png",
|
|
|
|
couponsBackground: config_host.imghost + "/static/image/coupons-bg.png",
|
|
|
|
couponsGrayBackground: config_host.imghost + "/static/image/coupons-gray-bg.png",
|
|
|
|
couponsGQ: config_host.imghost + "/static/image/coupons-gq.png",
|
|
|
|
addrDel: config_host.imghost + "/static/image/addr-del.png",
|
|
|
|
addrBg: config_host.imghost + "/static/image/addr-bg.png",
|
|
|
|
addrIcon: config_host.imghost + "/static/image/addr-icon.png",
|
|
|
|
addrEdit: config_host.imghost + "/static/image/addr-edit.png"
|
|
|
|
},
|
|
|
|
indexBanner: [{
|
|
|
|
image: config_host.imghost + "/static/image/banner.png",
|
|
|
|
url: ""
|
|
|
|
}],
|
|
|
|
user: {
|
|
|
|
avatar: config_host.imghost + "/static/image/banner.png",
|
|
|
|
nickname: "清晨的风",
|
|
|
|
coupons: 221,
|
|
|
|
id: 88685
|
|
|
|
},
|
|
|
|
isTop: false,
|
|
|
|
pagePadding: 100,
|
|
|
|
petImage: config_host.imghost + "/static/image/pet_avatar1.jpeg",
|
|
|
|
addrList: [],
|
|
|
|
type: "",
|
|
|
|
pages: {
|
|
|
|
page: 1,
|
|
|
|
limit: 6
|
|
|
|
},
|
|
|
|
status: "loadmore"
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onLoad(option) {
|
|
|
|
this.type = option.type || "lists";
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.getAddressList();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
navBack(item) {
|
|
|
|
item.select = true;
|
|
|
|
common_vendor.index.setStorageSync("address", item);
|
|
|
|
common_vendor.index.navigateBack();
|
|
|
|
},
|
|
|
|
touchstart(e) {
|
|
|
|
console.log(e);
|
|
|
|
},
|
|
|
|
touchend(event, ownerInstance) {
|
|
|
|
},
|
|
|
|
touchmove(event, ownerInstance) {
|
|
|
|
var instance = event.instance;
|
|
|
|
var state = instance.getState();
|
|
|
|
if (state.disabled || !state.moving)
|
|
|
|
return;
|
|
|
|
var touches = event.touches;
|
|
|
|
var pageX = touches[0].pageX;
|
|
|
|
var pageY = touches[0].pageY;
|
|
|
|
var moveX = pageX - state.startX;
|
|
|
|
var moveY = pageY - state.startY;
|
|
|
|
var buttonsWidth = state.buttonsWidth;
|
|
|
|
if (Math.abs(moveX) > Math.abs(moveY) || Math.abs(moveX) > state.threshold) {
|
|
|
|
event.preventDefault && event.preventDefault();
|
|
|
|
event.stopPropagation && event.stopPropagation();
|
|
|
|
}
|
|
|
|
if (Math.abs(moveX) < Math.abs(moveY))
|
|
|
|
return;
|
|
|
|
if (state.status === "open") {
|
|
|
|
if (moveX < 0)
|
|
|
|
moveX = 0;
|
|
|
|
if (moveX > buttonsWidth)
|
|
|
|
moveX = buttonsWidth;
|
|
|
|
this.moveSwipeAction(-buttonsWidth + moveX, instance, ownerInstance);
|
|
|
|
} else {
|
|
|
|
if (moveX > 0)
|
|
|
|
moveX = 0;
|
|
|
|
if (Math.abs(moveX) > buttonsWidth)
|
|
|
|
moveX = -buttonsWidth;
|
|
|
|
this.moveSwipeAction(moveX, instance, ownerInstance);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
moveSwipeAction(moveX, instance, ownerInstance) {
|
|
|
|
instance.getState();
|
|
|
|
ownerInstance.selectAllComponents(".u-swipe-action-item__right__button");
|
|
|
|
instance.requestAnimationFrame(function() {
|
|
|
|
instance.setStyle({
|
|
|
|
// 设置translateX的值
|
|
|
|
"transition": "none",
|
|
|
|
transform: "translateX(" + moveX + "px)",
|
|
|
|
"-webkit-transform": "translateX(" + moveX + "px)"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
delAddr(item) {
|
|
|
|
common_vendor.index.showModal({
|
|
|
|
content: "123123",
|
|
|
|
showCancel: false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
navTo(url) {
|
|
|
|
common_vendor.index.navigateTo({
|
|
|
|
url
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getAddressList() {
|
|
|
|
if (this.status === "nomore") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
this.status = "loading";
|
|
|
|
api_address.getAddressList(this.pages).then((res) => {
|
|
|
|
this.addrList.push.apply(this.addrList, res.data);
|
|
|
|
this.pages.page++;
|
|
|
|
if (res.data.length === 0) {
|
|
|
|
this.status = "nomore";
|
|
|
|
} else {
|
|
|
|
this.status = "loadmore";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
delAddress(id) {
|
|
|
|
utils_functions.api.confirm("确认删除吗?").then(() => {
|
|
|
|
api_address.delAddress(id).then((data) => {
|
|
|
|
utils_functions.api.success("删除成功");
|
|
|
|
this.getAddressList();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onReachBottom() {
|
|
|
|
this.getAddressList();
|
|
|
|
},
|
|
|
|
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_uni_swipe_action_item2 = common_vendor.resolveComponent("uni-swipe-action-item");
|
|
|
|
const _easycom_uni_swipe_action2 = common_vendor.resolveComponent("uni-swipe-action");
|
|
|
|
const _easycom_u_loadmore2 = common_vendor.resolveComponent("u-loadmore");
|
|
|
|
const _component_MzButton = common_vendor.resolveComponent("MzButton");
|
|
|
|
(_component_HeaderNav + _easycom_uni_swipe_action_item2 + _easycom_uni_swipe_action2 + _easycom_u_loadmore2 + _component_MzButton)();
|
|
|
|
}
|
|
|
|
const _easycom_uni_swipe_action_item = () => "../../uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.js";
|
|
|
|
const _easycom_uni_swipe_action = () => "../../uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.js";
|
|
|
|
const _easycom_u_loadmore = () => "../../uni_modules/uview-plus/components/u-loadmore/u-loadmore.js";
|
|
|
|
if (!Math) {
|
|
|
|
(_easycom_uni_swipe_action_item + _easycom_uni_swipe_action + _easycom_u_loadmore)();
|
|
|
|
}
|
|
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
|
return {
|
|
|
|
a: "url(" + $data.staticImage.wallpaperBgImage + ")",
|
|
|
|
b: common_vendor.p({
|
|
|
|
title: "地址簿",
|
|
|
|
["is-back"]: true
|
|
|
|
}),
|
|
|
|
c: common_vendor.f($data.addrList, (item, index, i0) => {
|
|
|
|
return {
|
|
|
|
a: common_vendor.t(item.name),
|
|
|
|
b: common_vendor.t(item.phone),
|
|
|
|
c: common_vendor.o(($event) => $options.navTo("/pages/AddrDetail/index?id=" + item.id)),
|
|
|
|
d: common_vendor.t(item.province),
|
|
|
|
e: common_vendor.t(item.city),
|
|
|
|
f: common_vendor.t(item.district),
|
|
|
|
g: common_vendor.t(item.info),
|
|
|
|
h: common_vendor.o(($event) => $data.type === "select" ? $options.navBack(item) : ""),
|
|
|
|
i: common_vendor.o(($event) => $options.delAddress(item)),
|
|
|
|
j: "3bfafe50-2-" + i0 + "," + ("3bfafe50-1-" + i0),
|
|
|
|
k: "3bfafe50-1-" + i0
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
d: $data.staticImage.addrEdit,
|
|
|
|
e: $data.staticImage.addrIcon,
|
|
|
|
f: "url(" + $data.staticImage.addrBg + ")",
|
|
|
|
g: $data.staticImage.addrDel,
|
|
|
|
h: common_vendor.p({
|
|
|
|
["right-options"]: $data.options1
|
|
|
|
}),
|
|
|
|
i: common_vendor.p({
|
|
|
|
["wx:key"]: "index"
|
|
|
|
}),
|
|
|
|
j: common_vendor.o(($event) => $options.getAddressList()),
|
|
|
|
k: common_vendor.p({
|
|
|
|
status: $data.status,
|
|
|
|
fontSize: "28",
|
|
|
|
color: "#ACB4B6",
|
|
|
|
line: true,
|
|
|
|
["line-color"]: "#ACB4B6",
|
|
|
|
marginBottom: "30",
|
|
|
|
marginTop: "30"
|
|
|
|
}),
|
|
|
|
l: common_vendor.p({
|
|
|
|
title: "新增地址",
|
|
|
|
["button-color"]: "#4DC3B8",
|
|
|
|
["font-color"]: "#FFFFFF",
|
|
|
|
["button-width"]: "100%"
|
|
|
|
}),
|
|
|
|
m: common_vendor.o(($event) => $options.navTo("/pages/AddrDetail/index"))
|
|
|
|
};
|
|
|
|
}
|
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/pet_uni/pages/Addr/index.vue"]]);
|
|
|
|
_sfc_main.__runtimeHooks = 1;
|
|
|
|
wx.createPage(MiniProgramPage);
|