1.公告组建删除多余引入
parent
531ae71c1e
commit
e7b13bf8f6
|
|
@ -159,8 +159,9 @@
|
|||
</view>
|
||||
|
||||
<!-- 用户中心公告 -->
|
||||
<uni-notice-bar v-if="(common_user_center_notice || null) != null" class="padding-0" show-icon scrollable :text="common_user_center_notice" background-color="transparent" color="#666" />
|
||||
|
||||
<view v-if="(common_user_center_notice || null) != null" class="padding-horizontal-main">
|
||||
<uni-notice-bar class="padding-0 margin-0" show-icon scrollable :text="common_user_center_notice" background-color="transparent" color="#333" />
|
||||
</view>
|
||||
<!-- 在线客服 -->
|
||||
<component-online-service :propIsNav="true" :propIsBar="true"></component-online-service>
|
||||
|
||||
|
|
@ -178,332 +179,330 @@
|
|||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentQuickNav from "../../components/quick-nav/quick-nav";
|
||||
import componentBadge from "../../components/badge/badge";
|
||||
import componentCopyright from "../../components/copyright/copyright";
|
||||
import componentOnlineService from "../../components/online-service/online-service";
|
||||
import componentUserBase from "../../components/user-base/user-base";
|
||||
import componentNotice from "@/components/notice/notice";
|
||||
const app = getApp();
|
||||
import componentQuickNav from '../../components/quick-nav/quick-nav';
|
||||
import componentBadge from '../../components/badge/badge';
|
||||
import componentCopyright from '../../components/copyright/copyright';
|
||||
import componentOnlineService from '../../components/online-service/online-service';
|
||||
import componentUserBase from '../../components/user-base/user-base';
|
||||
|
||||
var common_static_url = app.globalData.get_static_url("common");
|
||||
var static_url = app.globalData.get_static_url("user");
|
||||
var client_value = app.globalData.application_client();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
common_static_url: common_static_url,
|
||||
static_url: static_url,
|
||||
avatar: app.globalData.data.default_user_head_src,
|
||||
user_id: "",
|
||||
nickname: "用户名",
|
||||
message_total: 0,
|
||||
nav_logout_data: {
|
||||
name: client_value == "mp" ? "清除缓存" : "退出账号",
|
||||
icon: client_value == "mp" ? "cache" : "logout",
|
||||
},
|
||||
head_nav_list: [
|
||||
{
|
||||
name: "订单总数",
|
||||
url: "user-order",
|
||||
count: 0,
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
var static_url = app.globalData.get_static_url('user');
|
||||
var client_value = app.globalData.application_client();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
common_static_url: common_static_url,
|
||||
static_url: static_url,
|
||||
avatar: app.globalData.data.default_user_head_src,
|
||||
user_id: '',
|
||||
nickname: '用户名',
|
||||
message_total: 0,
|
||||
nav_logout_data: {
|
||||
name: client_value == 'mp' ? '清除缓存' : '退出账号',
|
||||
icon: client_value == 'mp' ? 'cache' : 'logout',
|
||||
},
|
||||
{
|
||||
name: "商品收藏",
|
||||
url: "user-favor",
|
||||
count: 0,
|
||||
},
|
||||
{
|
||||
name: "我的足迹",
|
||||
url: "user-goods-browse",
|
||||
count: 0,
|
||||
},
|
||||
{
|
||||
name: "我的积分",
|
||||
url: "user-integral",
|
||||
count: 0,
|
||||
},
|
||||
],
|
||||
user_order_status_list: [
|
||||
{
|
||||
name: "待付款",
|
||||
status: 1,
|
||||
count: 0,
|
||||
url: "/pages/user-order/user-order?status=1",
|
||||
},
|
||||
{
|
||||
name: "待发货",
|
||||
status: 2,
|
||||
count: 0,
|
||||
url: "/pages/user-order/user-order?status=2",
|
||||
},
|
||||
{
|
||||
name: "待收货",
|
||||
status: 3,
|
||||
count: 0,
|
||||
url: "/pages/user-order/user-order?status=3",
|
||||
},
|
||||
{
|
||||
name: "退款/售后",
|
||||
status: 4,
|
||||
count: 0,
|
||||
url: "/pages/user-orderaftersale/user-orderaftersale",
|
||||
},
|
||||
],
|
||||
navigation_order: null,
|
||||
// 远程自定义导航
|
||||
navigation: [],
|
||||
// 基础配置
|
||||
common_app_customer_service_tel: null,
|
||||
common_user_center_notice: null,
|
||||
common_app_is_online_service: 0,
|
||||
common_app_is_head_vice_nav: 0,
|
||||
// 会员码地址
|
||||
membership_page_url: null,
|
||||
// 付款码地址
|
||||
payment_page_url: null,
|
||||
// 用户中心菜单展示模式
|
||||
nav_show_model_type: app.globalData.data.user_center_nav_show_model_type,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentQuickNav,
|
||||
componentBadge,
|
||||
componentCopyright,
|
||||
componentOnlineService,
|
||||
componentUserBase,
|
||||
componentNotice,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onShow() {
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(e) {
|
||||
this.init();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
// 会员码及付款码入口
|
||||
var membership_page_url = null;
|
||||
var payment_page_url = null;
|
||||
if (app.globalData.get_config("plugins_base.wallet", null) != null) {
|
||||
payment_page_url = "/pages/plugins/wallet/payment-code/payment-code";
|
||||
}
|
||||
if (app.globalData.get_config("plugins_base.membershiplevelvip", null) != null) {
|
||||
membership_page_url = "/pages/plugins/membershiplevelvip/member-code/member-code";
|
||||
}
|
||||
this.setData({
|
||||
common_app_customer_service_tel: app.globalData.get_config("config.common_app_customer_service_tel"),
|
||||
common_user_center_notice: app.globalData.get_config("config.common_user_center_notice"),
|
||||
common_app_is_online_service: app.globalData.get_config("config.common_app_is_online_service"),
|
||||
common_app_is_head_vice_nav: app.globalData.get_config("config.common_app_is_head_vice_nav"),
|
||||
membership_page_url: membership_page_url,
|
||||
payment_page_url: payment_page_url,
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, "init_config");
|
||||
}
|
||||
head_nav_list: [
|
||||
{
|
||||
name: '订单总数',
|
||||
url: 'user-order',
|
||||
count: 0,
|
||||
},
|
||||
{
|
||||
name: '商品收藏',
|
||||
url: 'user-favor',
|
||||
count: 0,
|
||||
},
|
||||
{
|
||||
name: '我的足迹',
|
||||
url: 'user-goods-browse',
|
||||
count: 0,
|
||||
},
|
||||
{
|
||||
name: '我的积分',
|
||||
url: 'user-integral',
|
||||
count: 0,
|
||||
},
|
||||
],
|
||||
user_order_status_list: [
|
||||
{
|
||||
name: '待付款',
|
||||
status: 1,
|
||||
count: 0,
|
||||
url: '/pages/user-order/user-order?status=1',
|
||||
},
|
||||
{
|
||||
name: '待发货',
|
||||
status: 2,
|
||||
count: 0,
|
||||
url: '/pages/user-order/user-order?status=2',
|
||||
},
|
||||
{
|
||||
name: '待收货',
|
||||
status: 3,
|
||||
count: 0,
|
||||
url: '/pages/user-order/user-order?status=3',
|
||||
},
|
||||
{
|
||||
name: '退款/售后',
|
||||
status: 4,
|
||||
count: 0,
|
||||
url: '/pages/user-orderaftersale/user-orderaftersale',
|
||||
},
|
||||
],
|
||||
navigation_order: null,
|
||||
// 远程自定义导航
|
||||
navigation: [],
|
||||
// 基础配置
|
||||
common_app_customer_service_tel: null,
|
||||
common_user_center_notice: null,
|
||||
common_app_is_online_service: 0,
|
||||
common_app_is_head_vice_nav: 0,
|
||||
// 会员码地址
|
||||
membership_page_url: null,
|
||||
// 付款码地址
|
||||
payment_page_url: null,
|
||||
// 用户中心菜单展示模式
|
||||
nav_show_model_type: app.globalData.data.user_center_nav_show_model_type,
|
||||
};
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
init(e) {
|
||||
var user = app.globalData.get_user_info(this, "init");
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.stopPullDownRefresh();
|
||||
uni.showModal({
|
||||
title: "温馨提示",
|
||||
content: "绑定手机号码",
|
||||
confirmText: "确认",
|
||||
cancelText: "暂不",
|
||||
success: (result) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (result.confirm) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login?event_callback=init",
|
||||
});
|
||||
}
|
||||
this.set_user_base(user);
|
||||
},
|
||||
components: {
|
||||
componentQuickNav,
|
||||
componentBadge,
|
||||
componentCopyright,
|
||||
componentOnlineService,
|
||||
componentUserBase,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onShow() {
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(e) {
|
||||
this.init();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
// 会员码及付款码入口
|
||||
var membership_page_url = null;
|
||||
var payment_page_url = null;
|
||||
if (app.globalData.get_config('plugins_base.wallet', null) != null) {
|
||||
payment_page_url = '/pages/plugins/wallet/payment-code/payment-code';
|
||||
}
|
||||
if (app.globalData.get_config('plugins_base.membershiplevelvip', null) != null) {
|
||||
membership_page_url = '/pages/plugins/membershiplevelvip/member-code/member-code';
|
||||
}
|
||||
this.setData({
|
||||
common_app_customer_service_tel: app.globalData.get_config('config.common_app_customer_service_tel'),
|
||||
common_user_center_notice: app.globalData.get_config('config.common_user_center_notice'),
|
||||
common_app_is_online_service: app.globalData.get_config('config.common_app_is_online_service'),
|
||||
common_app_is_head_vice_nav: app.globalData.get_config('config.common_app_is_head_vice_nav'),
|
||||
membership_page_url: membership_page_url,
|
||||
payment_page_url: payment_page_url,
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
init(e) {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.stopPullDownRefresh();
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: '绑定手机号码',
|
||||
confirmText: '确认',
|
||||
cancelText: '暂不',
|
||||
success: (result) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (result.confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login?event_callback=init',
|
||||
});
|
||||
}
|
||||
this.set_user_base(user);
|
||||
},
|
||||
});
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
} else {
|
||||
// 获取基础数据
|
||||
this.set_user_base(user);
|
||||
this.get_data();
|
||||
|
||||
// 用户头像和昵称设置提示
|
||||
if ((this.$refs.user_base || null) != null) {
|
||||
this.$refs.user_base.init('user');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uni.stopPullDownRefresh();
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
} else {
|
||||
// 获取基础数据
|
||||
this.set_user_base(user);
|
||||
this.get_data();
|
||||
|
||||
// 用户头像和昵称设置提示
|
||||
if ((this.$refs.user_base || null) != null) {
|
||||
this.$refs.user_base.init("user");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uni.stopPullDownRefresh();
|
||||
},
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
}
|
||||
},
|
||||
// 设置用户基础信息
|
||||
set_user_base(user) {
|
||||
if ((user.id || null) != null) {
|
||||
this.setData({
|
||||
user_id: user.number_code,
|
||||
});
|
||||
}
|
||||
if ((user.avatar || null) != null) {
|
||||
this.setData({
|
||||
avatar: user.avatar,
|
||||
});
|
||||
}
|
||||
if ((user.user_name_view || null) != null) {
|
||||
this.setData({
|
||||
nickname: user.user_name_view,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 设置用户基础信息
|
||||
set_user_base(user) {
|
||||
if ((user.id || null) != null) {
|
||||
this.setData({
|
||||
user_id: user.number_code,
|
||||
});
|
||||
}
|
||||
if ((user.avatar || null) != null) {
|
||||
this.setData({
|
||||
avatar: user.avatar,
|
||||
});
|
||||
}
|
||||
if ((user.user_name_view || null) != null) {
|
||||
this.setData({
|
||||
nickname: user.user_name_view,
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('center', 'user'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
// 订单状态
|
||||
var temp_user_order_status_list = this.user_order_status_list;
|
||||
if ((data.user_order_status || null) != null && data.user_order_status.length > 0) {
|
||||
for (var i in temp_user_order_status_list) {
|
||||
for (var t in data.user_order_status) {
|
||||
if (temp_user_order_status_list[i]['status'] == data.user_order_status[t]['status']) {
|
||||
temp_user_order_status_list[i]['count'] = data.user_order_status[t]['count'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("center", "user"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
// 订单状态
|
||||
var temp_user_order_status_list = this.user_order_status_list;
|
||||
if ((data.user_order_status || null) != null && data.user_order_status.length > 0) {
|
||||
for (var i in temp_user_order_status_list) {
|
||||
for (var t in data.user_order_status) {
|
||||
if (temp_user_order_status_list[i]["status"] == data.user_order_status[t]["status"]) {
|
||||
temp_user_order_status_list[i]["count"] = data.user_order_status[t]["count"];
|
||||
// 头部导航总数
|
||||
var temp_head_nav_list = this.head_nav_list;
|
||||
temp_head_nav_list[0]['count'] = (data.user_order_count || 0) == 0 ? 0 : data.user_order_count;
|
||||
temp_head_nav_list[1]['count'] = (data.user_goods_favor_count || 0) == 0 ? 0 : data.user_goods_favor_count;
|
||||
temp_head_nav_list[2]['count'] = (data.user_goods_browse_count || 0) == 0 ? 0 : data.user_goods_browse_count;
|
||||
temp_head_nav_list[3]['count'] = (data.integral || 0) == 0 ? 0 : data.integral;
|
||||
|
||||
// 数据设置
|
||||
var upd_data = {
|
||||
user_order_status_list: temp_user_order_status_list,
|
||||
message_total: parseInt(data.message_total || 0),
|
||||
head_nav_list: temp_head_nav_list,
|
||||
navigation: data.navigation || [],
|
||||
};
|
||||
// 是否存在配置订单导航
|
||||
var temp_nav_order = null;
|
||||
if (upd_data.navigation.length > 0) {
|
||||
for (var i in upd_data.navigation) {
|
||||
var url = app.globalData.get_url_main_part(upd_data.navigation[i]['event_value']);
|
||||
if (url == '/pages/user-order/user-order') {
|
||||
temp_nav_order = upd_data.navigation[i];
|
||||
upd_data.navigation.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
upd_data['navigation_order'] = temp_nav_order;
|
||||
|
||||
// 头部导航总数
|
||||
var temp_head_nav_list = this.head_nav_list;
|
||||
temp_head_nav_list[0]["count"] = (data.user_order_count || 0) == 0 ? 0 : data.user_order_count;
|
||||
temp_head_nav_list[1]["count"] = (data.user_goods_favor_count || 0) == 0 ? 0 : data.user_goods_favor_count;
|
||||
temp_head_nav_list[2]["count"] = (data.user_goods_browse_count || 0) == 0 ? 0 : data.user_goods_browse_count;
|
||||
temp_head_nav_list[3]["count"] = (data.integral || 0) == 0 ? 0 : data.integral;
|
||||
// 用户基础信息处理
|
||||
if ((data.avatar || null) != null) {
|
||||
upd_data['avatar'] = data.avatar;
|
||||
}
|
||||
if ((data.user_name_view || null) != null) {
|
||||
upd_data['nickname'] = data.user_name_view;
|
||||
}
|
||||
this.setData(upd_data);
|
||||
|
||||
// 数据设置
|
||||
var upd_data = {
|
||||
user_order_status_list: temp_user_order_status_list,
|
||||
message_total: parseInt(data.message_total || 0),
|
||||
head_nav_list: temp_head_nav_list,
|
||||
navigation: data.navigation || [],
|
||||
};
|
||||
// 是否存在配置订单导航
|
||||
var temp_nav_order = null;
|
||||
if (upd_data.navigation.length > 0) {
|
||||
for (var i in upd_data.navigation) {
|
||||
var url = app.globalData.get_url_main_part(upd_data.navigation[i]["event_value"]);
|
||||
if (url == "/pages/user-order/user-order") {
|
||||
temp_nav_order = upd_data.navigation[i];
|
||||
upd_data.navigation.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
// 导航购物车处理
|
||||
var cart_total = data.cart_total.buy_number || 0;
|
||||
if (cart_total <= 0) {
|
||||
app.globalData.set_tab_bar_badge(2, 0);
|
||||
} else {
|
||||
app.globalData.set_tab_bar_badge(2, 1, cart_total);
|
||||
}
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
upd_data["navigation_order"] = temp_nav_order;
|
||||
|
||||
// 用户基础信息处理
|
||||
if ((data.avatar || null) != null) {
|
||||
upd_data["avatar"] = data.avatar;
|
||||
}
|
||||
if ((data.user_name_view || null) != null) {
|
||||
upd_data["nickname"] = data.user_name_view;
|
||||
}
|
||||
this.setData(upd_data);
|
||||
// 分享菜单处理、延时执行,确保基础数据已加载完成
|
||||
setTimeout(function () {
|
||||
app.globalData.page_share_handle();
|
||||
}, 3000);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 导航购物车处理
|
||||
var cart_total = data.cart_total.buy_number || 0;
|
||||
if (cart_total <= 0) {
|
||||
app.globalData.set_tab_bar_badge(2, 0);
|
||||
} else {
|
||||
app.globalData.set_tab_bar_badge(2, 1, cart_total);
|
||||
}
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, this, "get_data")) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
// 清除缓存
|
||||
remove_user_cache_event(e) {
|
||||
app.globalData.remove_user_cache_event();
|
||||
},
|
||||
|
||||
// 分享菜单处理、延时执行,确保基础数据已加载完成
|
||||
setTimeout(function () {
|
||||
app.globalData.page_share_handle();
|
||||
}, 3000);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
},
|
||||
});
|
||||
// 客服电话
|
||||
call_event() {
|
||||
if (this.common_app_customer_service_tel == null) {
|
||||
app.globalData.showToast('客服电话有误');
|
||||
} else {
|
||||
app.globalData.call_tel(this.common_app_customer_service_tel);
|
||||
}
|
||||
},
|
||||
|
||||
// 头像加载错误
|
||||
user_avatar_error(e) {
|
||||
this.setData({
|
||||
avatar: app.globalData.data.default_user_head_src,
|
||||
});
|
||||
},
|
||||
|
||||
// 远程自定义导航事件
|
||||
navigation_event(e) {
|
||||
app.globalData.operation_event(e);
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 数据展示类型
|
||||
nav_show_type_event(e) {
|
||||
this.setData({
|
||||
nav_show_model_type: this.nav_show_model_type == 0 ? 1 : 0,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// 清除缓存
|
||||
remove_user_cache_event(e) {
|
||||
app.globalData.remove_user_cache_event();
|
||||
},
|
||||
|
||||
// 客服电话
|
||||
call_event() {
|
||||
if (this.common_app_customer_service_tel == null) {
|
||||
app.globalData.showToast("客服电话有误");
|
||||
} else {
|
||||
app.globalData.call_tel(this.common_app_customer_service_tel);
|
||||
}
|
||||
},
|
||||
|
||||
// 头像加载错误
|
||||
user_avatar_error(e) {
|
||||
this.setData({
|
||||
avatar: app.globalData.data.default_user_head_src,
|
||||
});
|
||||
},
|
||||
|
||||
// 远程自定义导航事件
|
||||
navigation_event(e) {
|
||||
app.globalData.operation_event(e);
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 数据展示类型
|
||||
nav_show_type_event(e) {
|
||||
this.setData({
|
||||
nav_show_model_type: this.nav_show_model_type == 0 ? 1 : 0,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import "./user.css";
|
||||
@import './user.css';
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue