我的地址开发+细节优化
parent
fc11313d72
commit
e00b4d21ea
|
|
@ -247,7 +247,8 @@ button[disabled]..button-main {
|
|||
left: 0;
|
||||
bottom: 0;
|
||||
border: none;
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@
|
|||
margin-bottom: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.form-container .form-gorup:last-child {
|
||||
.form-container .form-gorup-submit {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.form-container .form-gorup:not(:last-child) {
|
||||
.form-container .form-gorup:not(.form-gorup-submit) {
|
||||
background: #fff;
|
||||
}
|
||||
.form-container .form-gorup-title {
|
||||
|
|
|
|||
|
|
@ -75,23 +75,19 @@
|
|||
bottom: 0;
|
||||
}
|
||||
.buy-nav,
|
||||
.nav-base,
|
||||
.nav-submit button {
|
||||
height: 100rpx;
|
||||
}
|
||||
.nav-base,
|
||||
.nav-submit button {
|
||||
.nav-base {
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.nav-submit button {
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.nav-base {
|
||||
width: calc(60% - 20rpx);
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.nav-submit {
|
||||
width: 40%;
|
||||
}
|
||||
.nav-submit button {
|
||||
border-radius: 0;
|
||||
width: calc(40% - 40rpx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -120,13 +120,13 @@
|
|||
</view>
|
||||
|
||||
<!-- 导航 -->
|
||||
<view class="buy-nav oh wh-auto">
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<view class="buy-nav oh wh-auto bg-white br-t">
|
||||
<view class="nav-base fl single-text padding-left-main">
|
||||
<text>合计:</text>
|
||||
<text class="sales-price">{{currency_symbol}}{{total_price}}</text>
|
||||
</view>
|
||||
<view class="fr nav-submit">
|
||||
<button class="bg-main cr-white wh-auto" type="default" @tap="buy_submit_event" :disabled="buy_submit_disabled_status" hover-class="none">提交订单</button>
|
||||
<view class="fr nav-submit padding-top padding-bottom padding-horizontal-main">
|
||||
<button class="bg-main cr-white round text-size-lg" type="default" @tap="buy_submit_event" :disabled="buy_submit_disabled_status" hover-class="none">提交订单</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -100,20 +100,19 @@
|
|||
z-index: 2;
|
||||
}
|
||||
.buy-nav,
|
||||
.nav-base,
|
||||
.nav-submit button {
|
||||
height: 100rpx;
|
||||
}
|
||||
.nav-base,
|
||||
.nav-submit button {
|
||||
.nav-base {
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.nav-submit button {
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.nav-base {
|
||||
width: calc(75% - 20rpx);
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.nav-submit {
|
||||
width: 25%;
|
||||
width: calc(25% - 40rpx);
|
||||
}
|
||||
.nav-submit button {
|
||||
border-radius: 0;
|
||||
|
|
|
|||
|
|
@ -56,20 +56,18 @@
|
|||
<!-- 操作导航 -->
|
||||
<view v-if="data_list.length > 0" class="buy-nav oh wh-auto">
|
||||
<!-- 展示型 -->
|
||||
<block v-if="common_site_type == 1">
|
||||
<view class="exhibition-mode padding-horizontal-main">
|
||||
<button class="bg-main cr-white round wh-auto text-size" type="default" @tap="exhibition_submit_event" hover-class="none">
|
||||
<view class="dis-inline-block va-m margin-right-xl">
|
||||
<uni-icons type="phone" size="14" color="#fff" />
|
||||
</view>
|
||||
<text class="va-m">{{common_is_exhibition_mode_btn_text}}</text>
|
||||
</button>
|
||||
</view>
|
||||
</block>
|
||||
<view v-if="common_site_type == 1" class="exhibition-mode padding-horizontal-main">
|
||||
<button class="bg-main cr-white round wh-auto text-size" type="default" @tap="exhibition_submit_event" hover-class="none">
|
||||
<view class="dis-inline-block va-m margin-right-xl">
|
||||
<uni-icons type="phone" size="14" color="#fff" />
|
||||
</view>
|
||||
<text class="va-m">{{common_is_exhibition_mode_btn_text}}</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 销售,自提,虚拟销售 -->
|
||||
<block v-else>
|
||||
<view class="nav-base bg-white fl br-t single-text">
|
||||
<view v-else class="br-t bg-white wh-auto ht-auto">
|
||||
<view class="nav-base fl single-text padding-left">
|
||||
<view @tap="selected_event" data-type="all" class="fl selected">
|
||||
<image class="icon va-m" :src="common_static_url+'select' + (is_selected_all ? '-active' : '') + '-icon.png'" mode="widthFix"></image>
|
||||
<text v-if="!already_selected_status" class="va-m cr-base">全选</text>
|
||||
|
|
@ -80,10 +78,10 @@
|
|||
<view class="fr">合计:</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fr nav-submit">
|
||||
<button class="bg-main wh-auto cr-white" type="default" @tap="buy_submit_event" :disabled="!already_selected_status" hover-class="none">结算</button>
|
||||
<view class="fr nav-submit padding-top padding-bottom padding-horizontal-main">
|
||||
<button class="bg-main cr-white round text-size-lg" type="default" @tap="buy_submit_event" :disabled="!already_selected_status" hover-class="none">结算</button>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.operation button {
|
||||
font-size: 22rpx;
|
||||
padding: 5rpx 20rpx;
|
||||
line-height: 40rpx;
|
||||
padding: 0 35rpx;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
<text class="fr">{{item.tel}}</text>
|
||||
</view>
|
||||
<view class="address oh padding-top-sm">
|
||||
<image class="item-icon fl" :src="common_static_url+'map-icon.png'" mode="widthFix"></image>
|
||||
<image class="item-icon fl margin-top-xs" :src="common_static_url+'map-icon.png'" mode="widthFix"></image>
|
||||
<view class="text fr">
|
||||
{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}
|
||||
</view>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view v-if="((item.distance_value || null) != null && (item.distance_unit || null) != null) || ((item.lng || 0) != 0 && (item.lat || 0) != 0)" class="operation br-t oh padding-top-main margin-top-main">
|
||||
<view v-if="(item.distance_value || null) != null && (item.distance_unit || null) != null" class="fl margin-top-sm">
|
||||
<view v-if="(item.distance_value || null) != null && (item.distance_unit || null) != null" class="fl margin-top-lg">
|
||||
<text class="cr-gray">距离</text>
|
||||
<text class="cr-base">{{item.distance_value}}</text>
|
||||
<text class="cr-gray">{{item.distance_unit}}</text>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 表单
|
||||
*/
|
||||
.page {
|
||||
padding-bottom: 110rpx;
|
||||
}
|
||||
.submit-fixed {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* 三级联动
|
||||
*/
|
||||
.select-address {
|
||||
box-sizing: border-box;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.select-address .section {
|
||||
width: 33.33%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.select-address .section:not(:first-child) {
|
||||
padding: 0 5rpx;
|
||||
}
|
||||
|
||||
/*
|
||||
* 身份信息
|
||||
*/
|
||||
.idcard-container {
|
||||
background: #e6e6e6;
|
||||
}
|
||||
.idcard-container .form-upload-data .item image {
|
||||
width: 256rpx;
|
||||
height: 170rpx;
|
||||
border: 1px dashed #c2c2c2;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,28 @@
|
|||
.page {
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
.address .item-icon {
|
||||
width: 30rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address-alias {
|
||||
padding: 2rpx 10rpx;
|
||||
}
|
||||
.address .text {
|
||||
line-height: 44rpx;
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.operation .default image {
|
||||
width: 35rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.operation button {
|
||||
padding: 0 35rpx;
|
||||
display: inline-flex;
|
||||
}
|
||||
.operation .submit-items button:not(:first-child) {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.submit-list button {
|
||||
width: calc(50% - 10rpx);
|
||||
}
|
||||
|
|
@ -1,468 +1,398 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="page">
|
||||
<view v-if="data_list.length > 0">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="item bg-white spacing-mb">
|
||||
<view @tap="address_conent_event" :data-index="index">
|
||||
<view class="base oh">
|
||||
<text v-if="(item.alias || null) != null" class="address-alias">{{item.alias}}</text>
|
||||
<text>{{item.name}}</text>
|
||||
<text class="fr">{{item.tel}}</text>
|
||||
<template>
|
||||
<view>
|
||||
<view class="page padding-main">
|
||||
<view v-if="data_list.length > 0">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="item padding-horizontal-main border-radius-main bg-white spacing-mb">
|
||||
<view @tap="address_conent_event" :data-index="index">
|
||||
<view class="oh padding-vertical-main">
|
||||
<text v-if="(item.alias || null) != null" class="address-alias br-main cr-main round margin-right-sm">{{item.alias}}</text>
|
||||
<text>{{item.name}}</text>
|
||||
<text class="fr">{{item.tel}}</text>
|
||||
</view>
|
||||
<view class="address oh padding-bottom-lg">
|
||||
<image class="item-icon fl margin-top-xs" :src="common_static_url+'map-icon.png'" mode="widthFix"></image>
|
||||
<view class="text fr">
|
||||
{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh padding-vertical-main">
|
||||
<view class="default fl margin-top-sm" @tap="address_default_event" :data-value="item.id">
|
||||
<image class="va-m" :src="common_static_url+'select' + (is_default == item.id ? '-active' : '') + '-icon.png'" mode="widthFix"></image>
|
||||
<text class="va-m margin-left-sm">设为默认地址</text>
|
||||
</view>
|
||||
<view class="fr oh submit-items">
|
||||
<button v-if="(item.lng || 0) != 0 && (item.lat || 0) != 0" class="round bg-white cr-base br" type="default" size="mini" @tap="address_map_event" :data-index="index" hover-class="none">位置</button>
|
||||
<button class="round bg-white cr-green br-green" type="default" size="mini" @tap="address_edit_event" :data-index="index" hover-class="none">编辑</button>
|
||||
<button class="round bg-white cr-red br-red" type="default" size="mini" @tap="address_delete_event" :data-index="index" :data-value="item.id" hover-class="none">删除</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :prop-status="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :prop-status="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<view class="address oh">
|
||||
<image class="item-icon fl" src="/static/images/user-address.png" mode="widthFix"></image>
|
||||
<view class="text fr">{{item.province_name || ''}}{{item.city_name || ''}}{{item.county_name || ''}}{{item.address || ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation br-t oh">
|
||||
<view class="default fl" @tap="address_default_event" :data-value="item.id">
|
||||
<image v-if="is_default == item.id" class="item-icon" src="/static/images/default-select-active-icon.png" mode="widthFix"></image>
|
||||
<image v-else class="item-icon" src="/static/images/default-select-icon.png" mode="widthFix"></image>
|
||||
<text>设为默认地址</text>
|
||||
</view>
|
||||
<view class="fr oh submit-items">
|
||||
<button v-if="(item.lng || null) != null && (item.lat || null) != null && item.lng != 0 && item.lat != 0" class="cr-base br" type="default" size="mini" @tap="address_map_event" :data-index="index" hover-class="none">位置</button>
|
||||
<button class="cr-base br" type="default" size="mini" @tap="address_edit_event" :data-index="index" hover-class="none">编辑</button>
|
||||
<button class="cr-base br" type="default" size="mini" @tap="address_delete_event" :data-index="index" :data-value="item.id" hover-class="none">删除</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="data_list.length == 0">
|
||||
<!--<import src="/pages/common/nodata.wxml"></import>-->
|
||||
<block data-type="template" data-is="nodata" data-attr="status: data_list_loding_status">
|
||||
<!-- 1 加载中 -->
|
||||
<view v-if="0 == 1" class="no-data-loding tc">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<!-- 底部操作 -->
|
||||
<view class="submit-list submit-fixed padding-main">
|
||||
<button class="submit-bottom bg-main cr-white round dis-inline-block tc fl" type="default" hover-class="none" @tap="address_add_event">添加新地址</button>
|
||||
<button class="submit-bottom bg-green cr-white round dis-inline-block tc fr" type="default" hover-class="none" @tap="choose_system_address_event">导入微信地址</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from "../../components/no-data/no-data";
|
||||
import componentBottomLine from "../../components/bottom-line/bottom-line";
|
||||
|
||||
<!-- 2 处理错误 -->
|
||||
<view v-else-if="0 == 2" class="no-data-box tc">
|
||||
<image src="/static/images/error.png" mode="widthFix"></image>
|
||||
<view class="no-data-tips">{{msg || '处理错误'}}</view>
|
||||
</view>
|
||||
|
||||
<!-- 0 默认没有数据 -->
|
||||
<view v-else-if="0 == 0" class="no-data-box tc">
|
||||
<image src="/static/images/empty.png" mode="widthFix"></image>
|
||||
<view class="no-data-tips">{{msg || '没有相关数据'}}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!--<import src="/pages/common/bottom_line.wxml"></import>-->
|
||||
<block data-type="template" data-is="bottom_line" data-attr="status: data_bottom_line_status">
|
||||
<view v-if="(status || false)" class="data-bottom-line">
|
||||
<view class="left fl"></view>
|
||||
<view class="msg fl">我是有底线的</view>
|
||||
<view class="right fr"></view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="submit-list">
|
||||
<navigator url="/pages/user-address-save/user-address-save" open-type="navigate" hover-class="none">
|
||||
<button class="submit-fixed submit-bottom" type="default" hover-class="none">添加新地址</button>
|
||||
</navigator>
|
||||
<button class="submit-fixed submit-bottom import-system-address-submit" type="default" hover-class="none" @tap="choose_system_address_event">导入微信地址</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
params: null,
|
||||
is_default: 0
|
||||
};
|
||||
},
|
||||
|
||||
components: {},
|
||||
props: {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
uni.setNavigationBarTitle({
|
||||
title: app.globalData.data.common_pages_title.user_address
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, "init");
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list() {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
}); // 获取数据
|
||||
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("index", "useraddress"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
if (data.data.length > 0) {
|
||||
// 获取当前默认地址
|
||||
var is_default = 0;
|
||||
|
||||
for (var i in data.data) {
|
||||
if (data.data[i]['is_default'] == 1) {
|
||||
is_default = data.data[i]['id'];
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
common_static_url: common_static_url,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
params: null,
|
||||
is_default: 0
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list() {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("index", "useraddress"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if (data.data.length > 0) {
|
||||
// 获取当前默认地址
|
||||
var is_default = 0;
|
||||
|
||||
for (var i in data.data) {
|
||||
if (data.data[i]['is_default'] == 1) {
|
||||
is_default = data.data[i]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// 设置数据
|
||||
this.setData({
|
||||
data_list: data.data,
|
||||
is_default: is_default,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除地址
|
||||
address_delete_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if (value == null) {
|
||||
app.globalData.showToast("地址ID有误");
|
||||
return false;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
uni.showModal({
|
||||
title: "温馨提示",
|
||||
content: "删除后不可恢复,确定继续吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "不了",
|
||||
success: result => {
|
||||
if (result.confirm) {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("delete", "useraddress"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: value
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data = self.data_list;
|
||||
temp_data.splice(index, 1);
|
||||
self.setData({
|
||||
data_list: temp_data,
|
||||
data_list_loding_status: temp_data.length == 0 ? 0 : 3,
|
||||
data_bottom_line_status: temp_data.length == 0 ? false : true
|
||||
});
|
||||
app.globalData.showToast(res.data.msg, "success");
|
||||
|
||||
// 当前删除是否存在缓存中,存在则删除
|
||||
var cache_address = uni.getStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
if ((cache_address.data || null) != null) {
|
||||
if (cache_address.data.id == value) {
|
||||
// 删除地址缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 默认地址设置
|
||||
address_default_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if (value == null) {
|
||||
app.globalData.showToast("地址ID有误");
|
||||
return false;
|
||||
}
|
||||
var self = this;
|
||||
if (value == self.is_default) {
|
||||
app.globalData.showToast("设置成功", "success");
|
||||
return false;
|
||||
}
|
||||
} // 设置数据
|
||||
|
||||
|
||||
this.setData({
|
||||
data_list: data.data,
|
||||
is_default: is_default,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除地址
|
||||
address_delete_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
|
||||
if (value == null) {
|
||||
app.globalData.showToast("地址ID有误");
|
||||
return false;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
uni.showModal({
|
||||
title: "温馨提示",
|
||||
content: "删除后不可恢复,确定继续吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "不了",
|
||||
success: result => {
|
||||
if (result.confirm) {
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
}); // 获取数据
|
||||
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("delete", "useraddress"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: value
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var temp_data = self.data_list;
|
||||
temp_data.splice(index, 1);
|
||||
self.setData({
|
||||
data_list: temp_data,
|
||||
data_list_loding_status: temp_data.length == 0 ? 0 : 3,
|
||||
data_bottom_line_status: temp_data.length == 0 ? false : true
|
||||
});
|
||||
app.globalData.showToast(res.data.msg, "success"); // 当前删除是否存在缓存中,存在则删除
|
||||
|
||||
var cache_address = uni.getStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
|
||||
if ((cache_address.data || null) != null) {
|
||||
if (cache_address.data.id == value) {
|
||||
// 删除地址缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_buy_user_address_select_key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("setdefault", "useraddress"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: value
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
self.setData({
|
||||
is_default: value
|
||||
});
|
||||
app.globalData.showToast(res.data.msg, "success");
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 地址内容事件
|
||||
address_conent_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var is_back = this.params.is_back || 0;
|
||||
if (is_back == 1) {
|
||||
uni.setStorage({
|
||||
key: app.globalData.data.cache_buy_user_address_select_key,
|
||||
data: this.data_list[index]
|
||||
});
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
|
||||
// 获取系统地址事件
|
||||
choose_system_address_event(e) {
|
||||
var self = this;
|
||||
uni.authorize({
|
||||
scope: 'scope.address',
|
||||
success: function(res) {
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
var data = {
|
||||
"name": res.userName || '',
|
||||
"tel": res.telNumber || '',
|
||||
"province": res.provinceName || '',
|
||||
"city": res.cityName || '',
|
||||
"county": res.countyName || '',
|
||||
"address": res.detailInfo || ''
|
||||
};
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("outsystemadd", "useraddress"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
self.get_data_list();
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
app.globalData.showToast('取消选择');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 添加地址事件
|
||||
address_add_event(e) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user-address-save/user-address-save'
|
||||
});
|
||||
},
|
||||
|
||||
// 地址编辑
|
||||
address_edit_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.data_list[index] || null;
|
||||
if (data == null) {
|
||||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 默认地址设置
|
||||
address_default_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
|
||||
if (value == null) {
|
||||
app.globalData.showToast("地址ID有误");
|
||||
return false;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
if (value == self.is_default) {
|
||||
app.globalData.showToast("设置成功", "success");
|
||||
return false;
|
||||
} // 加载loding
|
||||
|
||||
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
}); // 获取数据
|
||||
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("setdefault", "useraddress"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: value
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
self.setData({
|
||||
is_default: value
|
||||
});
|
||||
app.globalData.showToast(res.data.msg, "success");
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 地址内容事件
|
||||
address_conent_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var is_back = this.params.is_back || 0;
|
||||
|
||||
if (is_back == 1) {
|
||||
uni.setStorage({
|
||||
key: app.globalData.data.cache_buy_user_address_select_key,
|
||||
data: this.data_list[index]
|
||||
});
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
|
||||
// 获取系统地址
|
||||
choose_system_address_event(e) {
|
||||
var self = this;
|
||||
uni.authorize({
|
||||
scope: 'scope.address',
|
||||
success: function (res) {
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
var data = {
|
||||
"name": res.userName || '',
|
||||
"tel": res.telNumber || '',
|
||||
"province": res.provinceName || '',
|
||||
"city": res.cityName || '',
|
||||
"county": res.countyName || '',
|
||||
"address": res.detailInfo || ''
|
||||
}; // 加载loding
|
||||
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
}); // 获取数据
|
||||
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("outsystemadd", "useraddress"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
self.get_data_list();
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
|
||||
// 进入编辑页面
|
||||
uni.navigateTo({
|
||||
url: '/pages/user-address-save/user-address-save?id=' + data.id
|
||||
});
|
||||
},
|
||||
|
||||
// 地图查看
|
||||
address_map_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.data_list[index] || null;
|
||||
if (data == null) {
|
||||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
fail: function (res) {
|
||||
app.globalData.showToast('取消选择');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 地址编辑
|
||||
address_edit_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.data_list[index] || null;
|
||||
|
||||
if (data == null) {
|
||||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
} // 进入编辑页面
|
||||
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/user-address-save/user-address-save?id=' + data.id
|
||||
});
|
||||
},
|
||||
|
||||
// 地图查看
|
||||
address_map_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var data = this.data_list[index] || null;
|
||||
|
||||
if (data == null) {
|
||||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
} // 打开地图
|
||||
|
||||
|
||||
var name = data.alias || data.name || '';
|
||||
var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '');
|
||||
app.globalData.open_location(data.lng, data.lat, name, address);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.item {
|
||||
padding: 10rpx 10rpx 0 10rpx;
|
||||
}
|
||||
.base, .address, .operation {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.address .item-icon {
|
||||
width: 30rpx;
|
||||
height: 35rpx !important;
|
||||
}
|
||||
.address-alias {
|
||||
border: 1px solid #d2364c;
|
||||
color: #d2364c;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.address .text {
|
||||
line-height: 44rpx;
|
||||
width: calc(100% - 40rpx);
|
||||
}
|
||||
.operation .default {
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
.operation .default .item-icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx !important;
|
||||
margin-right: 10rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.operation .submit-items button:not(:last-child) {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 85rpx;
|
||||
}
|
||||
.submit-list button {
|
||||
width: 50%;
|
||||
}
|
||||
.submit-list .import-system-address-submit {
|
||||
background: #07c160 !important;
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
// 打开地图
|
||||
var name = data.alias || data.name || '';
|
||||
var address = (data.province_name || '') + (data.city_name || '') + (data.county_name || '') + (data.address || '');
|
||||
app.globalData.open_location(data.lng, data.lat, name, address);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './user-address.css';
|
||||
</style>
|
||||
|
|
@ -37,8 +37,8 @@
|
|||
<text class="fr cr-gray margin-top-lg">{{anonymous_msg_list[anonymous_value]}}</text>
|
||||
</view>
|
||||
|
||||
<view class="form-gorup">
|
||||
<button form-type="submit" class="bg-main cr-white radius submit-bottom" type="default" hover-class="none" :disabled="form_button_disabled">提交</button>
|
||||
<view class="form-gorup form-gorup-submit">
|
||||
<button form-type="submit" class="bg-main cr-white round submit-bottom" type="default" hover-class="none" :disabled="form_button_disabled">提交</button>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@
|
|||
data() {
|
||||
return {
|
||||
common_static_url: common_static_url,
|
||||
data_list: [],
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
|
|
@ -121,8 +122,7 @@
|
|||
nav_status_index: 0,
|
||||
order_select_ids: [],
|
||||
// 基础配置
|
||||
home_is_enable_order_bulk_pay: 0,
|
||||
data_total: ""
|
||||
home_is_enable_order_bulk_pay: 0
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -135,8 +135,8 @@
|
|||
<image v-if="form_images_list.length < 3" class="upload-icon" src="/static/images/default-upload-icon.png" mode="aspectFill" @tap="file_upload_event"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-gorup">
|
||||
<button class="bg-main cr-white radius submit-bottom" type="default" @tap="form_submit_event" hover-class="none" :disabled="form_button_disabled">提交</button>
|
||||
<view class="form-gorup form-gorup-submit">
|
||||
<button class="bg-main cr-white round submit-bottom" type="default" @tap="form_submit_event" hover-class="none" :disabled="form_button_disabled">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -169,8 +169,8 @@
|
|||
<view class="form-gorup-title">快递单号<text class="form-group-tips-must">必填</text></view>
|
||||
<input type="text" @input="form_express_number_event" placeholder-class="cr-grey" class="cr-base" placeholder="请输入快递单号" :value="form_express_number">
|
||||
</view>
|
||||
<view class="form-gorup">
|
||||
<button class="bg-main cr-white radius submit-bottom" type="default" @tap="form_delivery_submit_event" hover-class="none" :disabled="form_button_disabled">提交</button>
|
||||
<view class="form-gorup form-gorup-submit">
|
||||
<button class="bg-main cr-white round submit-bottom" type="default" @tap="form_delivery_submit_event" hover-class="none" :disabled="form_button_disabled">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
Loading…
Reference in New Issue