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.
 
 
 

201 lines
7.0 KiB

"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");
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: []
};
},
onLoad() {
},
onShow() {
this.getAddressList();
},
methods: {
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.wx$1.navigateTo({
url
});
},
getAddressList(page = 1) {
api_address.getAddressList(page).then((data) => {
page === 1 ? this.addrList = data.data : this.addrList.push(data.data);
});
},
delAddress(id) {
utils_functions.api.confirm("确认删除吗?").then(() => {
api_address.delAddress(id).then((data) => {
utils_functions.api.success("删除成功");
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 _component_MzButton = common_vendor.resolveComponent("MzButton");
(_component_HeaderNav + _easycom_uni_swipe_action_item2 + _easycom_uni_swipe_action2 + _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";
if (!Math) {
(_easycom_uni_swipe_action_item + _easycom_uni_swipe_action)();
}
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, k0, 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) => $options.delAddress(item)),
i: "f21c5e44-2-" + i0 + "," + ("f21c5e44-1-" + i0),
j: "f21c5e44-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({
title: "管理",
["button-color"]: "#ffffff",
["font-color"]: "##262626",
["button-width"]: "250rpx"
}),
j: common_vendor.p({
title: "新增地址",
["button-color"]: "#4DC3B8",
["font-color"]: "#FFFFFF",
["button-width"]: "250rpx"
}),
k: common_vendor.o(($event) => $options.navTo("/pages/AddrDetail/index"))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/phpstudy_pro/WEB/pet_uni/pages/Addr/index.vue"]]);
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);