增加新模块
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_address = require("../../api/address.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
addressList: []
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getAddressList();
|
||||
},
|
||||
methods: {
|
||||
// 添加地址
|
||||
jumpAddAddress() {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/mine_address_add/mine_address_add"
|
||||
});
|
||||
},
|
||||
// 查询地址
|
||||
async getAddressList() {
|
||||
const res = await api_address.getAddress();
|
||||
if (res && res.bizcode === 100) {
|
||||
this.addressList = res.data;
|
||||
}
|
||||
},
|
||||
// 设为默认地址
|
||||
async isDefaultChange(item) {
|
||||
const params = {
|
||||
id: item.id
|
||||
};
|
||||
const res = await api_address.setAddressDefault(params);
|
||||
if (res && res.bizcode === 100) {
|
||||
this.getAddressList();
|
||||
}
|
||||
},
|
||||
// 删除地址
|
||||
deleteAddressFun(item) {
|
||||
common_vendor.index.__f__("log", "at pages/mine_address/mine_address.vue:79", "item", item);
|
||||
const then = this;
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: "是否要删除该地址?",
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
then.deleteAddress(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除的方法
|
||||
async deleteAddress(item) {
|
||||
const params = {
|
||||
id: item.id
|
||||
};
|
||||
const respon = await api_address.deleteAddress(params);
|
||||
if (respon && respon.bizcode === 100) {
|
||||
this.getAddressList();
|
||||
}
|
||||
},
|
||||
// 修改地址
|
||||
updateAddress(item) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/mine_address_add/mine_address_add?id=" + item.id
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_up_checkbox2 = common_vendor.resolveComponent("up-checkbox");
|
||||
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
||||
(_easycom_up_checkbox2 + _easycom_up_image2)();
|
||||
}
|
||||
const _easycom_up_checkbox = () => "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox.js";
|
||||
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_checkbox + _easycom_up_image)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.addressList && $data.addressList.length !== 0
|
||||
}, $data.addressList && $data.addressList.length !== 0 ? {
|
||||
b: common_vendor.f($data.addressList, (item, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: common_vendor.t(item.phone),
|
||||
c: common_vendor.t(item.countryName),
|
||||
d: common_vendor.t(item.provinceName),
|
||||
e: common_vendor.t(item.cityName),
|
||||
f: common_vendor.t(item.areaName),
|
||||
g: common_vendor.t(item.address),
|
||||
h: common_vendor.o(($event) => $options.isDefaultChange(item), item.id),
|
||||
i: "1172d71f-0-" + i0,
|
||||
j: common_vendor.p({
|
||||
customStyle: {},
|
||||
label: "已默认",
|
||||
name: "agree",
|
||||
usedAlone: true,
|
||||
checked: item.isDefault,
|
||||
shape: "circle",
|
||||
activeColor: "#FF7C41"
|
||||
}),
|
||||
k: common_vendor.o(($event) => $options.deleteAddressFun(item), item.id),
|
||||
l: common_vendor.o(($event) => $options.updateAddress(item), item.id),
|
||||
m: item.id
|
||||
};
|
||||
})
|
||||
} : {
|
||||
c: common_vendor.p({
|
||||
src: "/static/common/not_search.png",
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00"
|
||||
})
|
||||
}, {
|
||||
d: common_vendor.o((...args) => $options.jumpAddAddress && $options.jumpAddAddress(...args))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1172d71f"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine_address/mine_address.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"navigationBarTitleText": "地址管理",
|
||||
"navigationBarBackgroundColor": "#FFFFFF",
|
||||
"navigationBarTextStyle": "black",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "default",
|
||||
"usingComponents": {
|
||||
"up-checkbox": "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox",
|
||||
"up-image": "../../uni_modules/uview-plus/components/u-image/u-image"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="mine_address_warp data-v-1172d71f"><block wx:if="{{a}}"><view wx:for="{{b}}" wx:for-item="item" wx:key="m" class="address_item data-v-1172d71f"><view class="address_item_info data-v-1172d71f"><view class="data-v-1172d71f">{{item.a}}</view><view class="data-v-1172d71f" style="margin-left:20rpx">{{item.b}}</view></view><view class="address_item_address data-v-1172d71f">{{item.c}} {{item.d}} {{item.e}} {{item.f}} {{item.g}}</view><view class="address_operate data-v-1172d71f"><up-checkbox wx:if="{{item.j}}" class="data-v-1172d71f" bindchange="{{item.h}}" u-i="{{item.i}}" bind:__l="__l" u-p="{{item.j}}"></up-checkbox><view class="operate_item data-v-1172d71f"><view class="operate_ data-v-1172d71f" bindtap="{{item.k}}">删除</view><view class="operate_ data-v-1172d71f" bindtap="{{item.l}}">修改</view></view></view></view></block><view wx:else class="not_order_warp data-v-1172d71f"><view class="not_order_warp_img data-v-1172d71f"><up-image wx:if="{{c}}" class="data-v-1172d71f" u-i="1172d71f-1" bind:__l="__l" u-p="{{c}}"></up-image></view><view class="not_order_msg_warp data-v-1172d71f">暂时地址,快去添加吧~</view></view><view class="add_but data-v-1172d71f" bindtap="{{d}}"> 新增地址 </view></view>
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/* uni.scss */
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
.mine_address_warp.data-v-1172d71f {
|
||||
height: calc(100vh - 188rpx);
|
||||
overflow-y: auto;
|
||||
background-color: #F5F5F5;
|
||||
padding: 30rpx;
|
||||
}
|
||||
.address_item.data-v-1172d71f {
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.address_item_info.data-v-1172d71f {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #222222;
|
||||
display: flex;
|
||||
}
|
||||
.address_item_address.data-v-1172d71f {
|
||||
font-weight: 500;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.address_operate.data-v-1172d71f {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.operate_item.data-v-1172d71f {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.operate_.data-v-1172d71f {
|
||||
padding: 10rpx 30rpx;
|
||||
background: #F3F3F3;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
color: #222222;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user