公共业务弹窗分离

This commit is contained in:
gongfuxiang
2025-04-02 18:43:45 +08:00
parent 032cdb2525
commit 9e3ec6259c
13 changed files with 667 additions and 172 deletions

View File

@ -7,10 +7,10 @@
data: {
// 基础配置
// 数据接口请求地址
request_url:'https://new.shopxo.vip/',
request_url:'http://shopxo.com/',
// 静态资源地址如系统根目录不在public目录下面请在静态地址后面加public目录、如https://d1.shopxo.vip/public/
static_url:'https://new.shopxo.vip/',
static_url:'http://shopxo.com/',
// 系统类型默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立
system_type: 'default',

View File

@ -1008,7 +1008,7 @@
// 预下单计算开关 0
if (this.is_cart_show_discount === 0) {
this.setData({
total_price: total_price.toFixed(2),
total_price: isNaN(total_price) ? '0.00' : total_price.toFixed(2),
total_num: total_num,
});
} else {

View File

@ -1,14 +1,23 @@
<template>
<view :class="theme_view">
<component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
<component-popup :propShow="popup_status" propPosition="bottom" :propMaskTap="(config.is_user_force_select || 0) == 0" @onclose="popup_close_event">
<view :class="'certificate-popup bg-white ' + (propIsGrayscale ? 'grayscale' : '')">
<view class="close fr oh">
<view v-if="(config.is_user_force_select || 0) == 0" class="close fr oh">
<view class="fr" @tap.stop="popup_close_event">
<iconfont name="icon-close-o" size="24rpx" color="#999"></iconfont>
</view>
</view>
<view class="padding-main">
hello
<view class="certificate-content">
<view>{{config.user_auth_business_data.business_title}}</view>
<view class="business-type-data">
<block v-for="(item, index) in config.business_type_data">
<view v-if="item.status == 1" class="item padding-main tc br radius margin-top-lg" :data-value="item.url" @tap="url_event">
<image v-if="(item.icon || null) != null" :src="item.icon" mode="aspectFit" class="icon radius margin-bottom-sm"></image>
<view>{{item.name || item.name_old}}</view>
<view v-if="(item.desc || null) != null" class="cr-grey margin-top-sm">{{item.desc}}</view>
</view>
</block>
</view>
</view>
</view>
</component-popup>
@ -59,13 +68,16 @@
this.init_config(true);
// 公共接口已初始化完成
if(app.globalData.data.common_data_init_status == 1) {
// 当前缓存用户
var user = app.globalData.get_user_cache_info() || null;
// 业务数据
if((this.config || null) != null && (this.config.business_type_data || null) != null) {
if(user != null && (this.config || null) != null && (this.config.user_auth_business_data || null) != null && (this.config.business_type_data || null) != null) {
this.setData({
popup_status: true,
});
}
}
return this.popup_status;
},
// 弹层关闭
@ -74,6 +86,12 @@
popup_status: false,
});
},
// url事件
url_event(e) {
this.popup_close_event();
app.globalData.url_event(e);
}
}
};
</script>
@ -88,4 +106,8 @@
right: 36rpx;
z-index: 2;
}
.business-type-data .item .icon {
height: 80rpx !important;
max-width: 100%;
}
</style>

View File

@ -6,60 +6,25 @@
<view v-if="propIsFooterSeat && footer_height_value > 0" :style="'height:'+footer_height_value+'rpx;'"></view>
</block>
<!-- 微信隐私提示弹窗 -->
<view v-if="is_show_privacy" class="agreement-page bs-bb pf wh-auto ht-auto left-0 top-0 z-i-deep-must">
<view class="agreement-content border-radius-main bg-white">
<view class="tc">
<image class="logo circle auto dis-block margin-bottom-lg br" :src="logo" mode="widthFix"></image>
<view class="cr-base fw-b text-size-lg">{{ title }}{{$t('common.warm_tips')}}</view>
</view>
<view class="margin-top-lg text-size-sm cr-base content-desc">
<block v-if="(privacy_content || null) == null">{{$t('agreement.agreement.w38e3v')}}{{ title }}{{$t('agreement.agreement.hjn568')}}</block>
<block v-else>{{ privacy_content }}</block>
</view>
<view class="cr-blue margin-top-lg">
<view>
<text @tap="agreement_event" data-value="userregister">{{ title }}{{$t('agreement.agreement.iy7863')}}</text>
</view>
<view class="margin-top-sm">
<text @tap="agreement_event" data-value="userprivacy">{{ title }}{{$t('agreement.agreement.jwi8n1')}}</text>
</view>
</view>
<view class="buttom tc margin-top-xxxl padding-top-lg">
<button type="default" size="mini" class="btn br-grey cr-base bg-white text-size-sm round margin-right-xxxl" @tap="exit_event">{{$t('agreement.agreement.062co8')}}</button>
<button type="default" size="mini" class="btn br-main cr-white bg-main text-size-sm round margin-left-xxxl" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="agree_privacy_auth_event">{{$t('agreement.agreement.60t34e')}}</button>
</view>
</view>
</view>
<!-- app管理 -->
<component-app-admin ref="app_admin" :propIsHideStar="true"></component-app-admin>
<!-- 用户基础 -->
<component-user-base ref="user_base" :propIsGrayscale="propIsGrayscale"></component-user-base>
<!-- 弹屏广告 -->
<component-popupscreen ref="popupscreen" :propIsGrayscale="propIsGrayscale"></component-popupscreen>
<!-- 资质认证 -->
<component-certificate ref="certificate" :propIsGrayscale="propIsGrayscale"></component-certificate>
<!-- 弹窗业务 -->
<component-modal-business ref="modal_business"
:propIsGrayscale="propIsGrayscale"
:propIsFooterSeat="propIsFooterSeat"
:propIsAppAdmin="propIsAppAdmin"
:propIsUserBase="propIsUserBase"
:propIsPopupscreen="propIsPopupscreen"
:propIsCertificate="propIsCertificate"
></component-modal-business>
</view>
</template>
<script>
const app = getApp();
import componentDiyFooter from '@/components/diy/footer';
import componentAppAdmin from '@/components/app-admin/app-admin';
import componentUserBase from '@/components/user-base/user-base';
import componentPopupscreen from '@/components/popupscreen/popupscreen';
import componentCertificate from '@/components/certificate/certificate';
import componentModalBusiness from '@/components/modal-business/modal-business';
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
logo: app.globalData.get_application_logo_square(),
title: app.globalData.get_application_title(),
is_show_privacy: false,
privacy_content: null,
key: '',
is_tabbar: false,
app_tabbar: null,
@ -92,13 +57,15 @@
type: Boolean,
default: true,
},
// 是否用户认证提示
propIsCertificate: {
type: Boolean,
default: true,
},
},
components: {
componentDiyFooter,
componentAppAdmin,
componentUserBase,
componentPopupscreen,
componentCertificate
componentModalBusiness
},
// 页面被展示
created: function () {
@ -135,41 +102,10 @@
// 系统底部菜单
this.footer_init();
// app管理
if (this.propIsAppAdmin && (this.$refs.app_admin || null) != null) {
this.$refs.app_admin.init(params);
// 业务弹窗
if ((this.$refs.modal_business || null) != null) {
this.$refs.modal_business.init(params);
}
// 用户头像和昵称设置提示
if (this.propIsUserBase && (this.$refs.user_base || null) != null) {
this.$refs.user_base.init(params);
}
// 弹屏广告
if (this.propIsPopupscreen && (this.$refs.popupscreen || null) != null) {
this.$refs.popupscreen.init(params);
}
// 资质认证
if (this.propIsPopupscreen && (this.$refs.certificate || null) != null) {
this.$refs.certificate.init(params);
}
// #ifdef MP-WEIXIN
// 微信协议验证
if (app.globalData.data.is_weixin_privacy_setting == 1) {
uni.getPrivacySetting({
success: (res) => {
if (res.needAuthorization) {
this.setData({
is_show_privacy: true,
privacy_content: app.globalData.get_config('config.common_app_mini_weixin_privacy_content', null),
});
}
}
});
}
// #endif
},
// 底部菜单初始化
@ -199,62 +135,9 @@
// 存储底部菜单高度
app.globalData.app_system_tabbar_height_save(value);
},
// 协议事件
agreement_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value == null) {
app.globalData.showToast(this.$t('login.login.4wc3hr'));
return false;
}
// 是否存在协议 url 地址
var key = 'agreement_' + value + '_url';
var url = app.globalData.get_config('config.' + key) || null;
if (url == null) {
app.globalData.showToast(this.$t('login.login.x0nxxf'));
return false;
}
// 打开 webview
app.globalData.open_web_view(url);
},
// 授权回调
agree_privacy_auth_event() {
this.setData({
is_show_privacy: false
});
},
// 退出小程序
exit_event(e) {
uni.exitMiniProgram();
},
}
}
};
</script>
<style scoped>
.agreement-page {
background-color: rgba(0, 0, 0, 0.6);
height: 100vh;
padding: 40rpx;
}
.agreement-content {
padding: 40rpx;
position: absolute;
top: 15%;
width: calc(100% - 160rpx);
}
.agreement-content .logo {
width: 160rpx;
height: 160rpx;
}
.agreement-content .content-desc {
line-height: 46rpx;
max-height: calc(30vh);
overflow-y: auto;
}
.agreement-content .buttom .btn {
min-width: 200rpx;
}
</style>

View File

@ -0,0 +1,204 @@
<template>
<view :class="theme_view">
<!-- 微信隐私提示弹窗 -->
<view v-if="is_show_privacy" class="agreement-page bs-bb pf wh-auto ht-auto left-0 top-0 z-i-deep-must">
<view class="agreement-content border-radius-main bg-white">
<view class="tc">
<image class="logo circle auto dis-block margin-bottom-lg br" :src="logo" mode="widthFix"></image>
<view class="cr-base fw-b text-size-lg">{{ title }}{{$t('common.warm_tips')}}</view>
</view>
<view class="margin-top-lg text-size-sm cr-base content-desc">
<block v-if="(privacy_content || null) == null">{{$t('agreement.agreement.w38e3v')}}{{ title }}{{$t('agreement.agreement.hjn568')}}</block>
<block v-else>{{ privacy_content }}</block>
</view>
<view class="cr-blue margin-top-lg">
<view>
<text @tap="agreement_event" data-value="userregister">{{ title }}{{$t('agreement.agreement.iy7863')}}</text>
</view>
<view class="margin-top-sm">
<text @tap="agreement_event" data-value="userprivacy">{{ title }}{{$t('agreement.agreement.jwi8n1')}}</text>
</view>
</view>
<view class="buttom tc margin-top-xxxl padding-top-lg">
<button type="default" size="mini" class="btn br-grey cr-base bg-white text-size-sm round margin-right-xxxl" @tap="exit_event">{{$t('agreement.agreement.062co8')}}</button>
<button type="default" size="mini" class="btn br-main cr-white bg-main text-size-sm round margin-left-xxxl" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="agree_privacy_auth_event">{{$t('agreement.agreement.60t34e')}}</button>
</view>
</view>
</view>
<!-- app管理 -->
<component-app-admin ref="app_admin" :propIsHideStar="true"></component-app-admin>
<!-- 用户基础 -->
<component-user-base ref="user_base" :propIsGrayscale="propIsGrayscale"></component-user-base>
<!-- 弹屏广告 -->
<component-popupscreen ref="popupscreen" :propIsGrayscale="propIsGrayscale"></component-popupscreen>
<!-- 资质认证 -->
<component-certificate ref="certificate" :propIsGrayscale="propIsGrayscale"></component-certificate>
</view>
</template>
<script>
const app = getApp();
import componentAppAdmin from '@/components/app-admin/app-admin';
import componentUserBase from '@/components/user-base/user-base';
import componentPopupscreen from '@/components/popupscreen/popupscreen';
import componentCertificate from '@/components/certificate/certificate';
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
logo: app.globalData.get_application_logo_square(),
title: app.globalData.get_application_title(),
is_show_privacy: false,
privacy_content: null,
};
},
props: {
// 是否灰度
propIsGrayscale: {
type: Boolean,
default: false,
},
// 是否显示底部菜单占位
propIsFooterSeat: {
type: Boolean,
default: true,
},
// 是否引入app管理
propIsAppAdmin: {
type: Boolean,
default: true,
},
// 是否引入用户基础信息提示
propIsUserBase: {
type: Boolean,
default: true,
},
// 是否引入弹屏广告
propIsPopupscreen: {
type: Boolean,
default: true,
},
// 是否用户认证提示
propIsCertificate: {
type: Boolean,
default: true,
},
},
components: {
componentAppAdmin,
componentUserBase,
componentPopupscreen,
componentCertificate
},
methods: {
// 初始化数据
init(params = {}) {
// #ifdef MP-WEIXIN
// 微信协议验证
if (app.globalData.data.is_weixin_privacy_setting == 1) {
uni.getPrivacySetting({
success: (res) => {
if (res.needAuthorization) {
this.setData({
is_show_privacy: true,
privacy_content: app.globalData.get_config('config.common_app_mini_weixin_privacy_content', null),
});
}
this.init_business_handle(params);
},
fail: () => {
this.init_business_handle(params);
}
});
}
// #endif
// #ifndef MP-WEIXIN
this.init_business_handle(params);
// #endif
},
// 初始化业务处理
init_business_handle(params) {
// 弹屏广告
if (this.propIsPopupscreen && (this.$refs.popupscreen || null) != null) {
this.$refs.popupscreen.init(params);
}
// 弹窗状态
var modal_status = this.is_show_privacy;
// 用户头像和昵称设置提示
if (!modal_status && this.propIsUserBase && (this.$refs.user_base || null) != null) {
modal_status = this.$refs.user_base.init(params);
}
// 资质认证
if (!modal_status && this.propIsCertificate && (this.$refs.certificate || null) != null) {
modal_status = this.$refs.certificate.init(params);
}
// app管理
if (!modal_status && this.propIsAppAdmin && (this.$refs.app_admin || null) != null) {
this.$refs.app_admin.init(params);
}
},
// 协议事件
agreement_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value == null) {
app.globalData.showToast(this.$t('login.login.4wc3hr'));
return false;
}
// 是否存在协议 url 地址
var key = 'agreement_' + value + '_url';
var url = app.globalData.get_config('config.' + key) || null;
if (url == null) {
app.globalData.showToast(this.$t('login.login.x0nxxf'));
return false;
}
// 打开 webview
app.globalData.open_web_view(url);
},
// 授权回调
agree_privacy_auth_event() {
this.setData({
is_show_privacy: false
});
},
// 退出小程序
exit_event(e) {
uni.exitMiniProgram();
},
}
};
</script>
<style scoped>
.agreement-page {
background-color: rgba(0, 0, 0, 0.6);
height: 100vh;
padding: 40rpx;
}
.agreement-content {
padding: 40rpx;
position: absolute;
top: 15%;
width: calc(100% - 160rpx);
}
.agreement-content .logo {
width: 160rpx;
height: 160rpx;
}
.agreement-content .content-desc {
line-height: 46rpx;
max-height: calc(30vh);
overflow-y: auto;
}
.agreement-content .buttom .btn {
min-width: 200rpx;
}
</style>

View File

@ -40,6 +40,10 @@
propMask: {
type: Boolean,
default: true,
},
propMaskTap: {
type: Boolean,
default: true,
},
propAnimation: {
type: Boolean,
@ -89,14 +93,16 @@
},
methods: {
// 事件处理
on_mask_tap: function on_mask_tap() {
this.$emit(
'onclose',
{
detail: {},
},
{}
);
on_mask_tap: function on_mask_tap() {
if(this.propMaskTap) {
this.$emit(
'onclose',
{
detail: {},
},
{}
);
}
},
// 初初始化处理
init_handle() {

View File

@ -37,7 +37,6 @@
this.setData({
data: app.globalData.get_config('plugins_base.popupscreen.data') || null,
});
this.init();
} else {
app.globalData.is_config(this, 'init_config');
}
@ -83,6 +82,7 @@
}
}
}
return this.status == 1;
},
// 关闭事件

View File

@ -147,26 +147,18 @@
result['popup_status'] = false;
}
}
// 1秒后再提示用户填写信息
clearTimeout(this.timer);
var self = this;
var timer = setTimeout(function () {
self.setData({
...result,
...{
back_object: params.object || null,
back_method: params.method || null,
back_params: params.params || params,
}
});
}, 500);
this.setData({
timer: timer
...result,
...{
back_object: params.object || null,
back_method: params.method || null,
back_params: params.params || params,
}
});
}
}
}
return this.popup_status;
},
// 表单需要填写的验证数据
@ -213,7 +205,6 @@
// 基础信息填写打开
user_base_open(object, method, params) {
clearTimeout(this.timer);
this.setData({
popup_status: true,
back_object: object,

View File

@ -264,7 +264,9 @@
"plugins-orderresources-orderannex": "Order Resources",
"plugins-hospital-patient": "Add/Edit Patient",
"plugins-hospital-patient-list": "Patient List",
"plugins-hospital-prescription": "Consultation and prescription"
"plugins-hospital-prescription": "Consultation and prescription",
"plugins-certificate-userauth": "User auth",
"plugins-certificate-userauth-form": "User auth editor"
},
"login": {
"login": {

View File

@ -262,7 +262,9 @@
"plugins-orderresources-orderannex": "订单资源",
"plugins-hospital-patient": "就诊人添加/编辑",
"plugins-hospital-patient-list": "就诊人列表",
"plugins-hospital-prescription": "问诊开方"
"plugins-hospital-prescription": "问诊开方",
"plugins-certificate-userauth": "用户认证",
"plugins-certificate-userauth-form": "用户认证编辑"
},
"login": {
"login": {

View File

@ -1755,6 +1755,25 @@
}
}
]
},
{
"root": "pages/plugins/certificate",
"pages": [
{
"path": "userauth/userauth",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": ""
}
},
{
"path": "userauth-form/userauth-form",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": ""
}
}
]
}
],
"preloadRule": {

View File

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -0,0 +1,358 @@
<template>
<view :class="theme_view">
<!-- 公告 -->
<view v-if="(data_base || null) != null && (data_base.invoice_desc || null) != null && data_base.invoice_desc.length > 0" class="padding-horizontal-main padding-vertical-sm bg-white">
<uni-notice-bar class="padding-0 margin-0" show-icon scrollable :text="data_base.invoice_desc.join('')" background-color="transparent" color="#666" />
</view>
<!-- 导航 -->
<view v-if="nav_status_list.length > 0" class="nav-base bg-white flex-row jc-sa align-c">
<block v-for="(item, index) in nav_status_list" :key="index">
<view :class="'item tc ' + (nav_status_index == index ? 'cr-main nav-active-line' : '')" :data-index="index" @tap="nav_event">{{ item.name }}</view>
</block>
</view>
<!-- 列表 -->
<scroll-view :scroll-y="true" :class="'scroll-box-ece-nav '+((data_base || null) != null && (data_base.invoice_desc || null) != null && data_base.invoice_desc.length > 0 ? 'top-notice' : '')" @scrolltolower="scroll_lower" lower-threshold="60">
<view class="page-bottom-fixed">
<view v-if="data_list.length > 0" class="data-list padding-horizontal-main padding-top-main">
<view v-for="(item, index) in data_list" :key="index" class="item padding-main border-radius-main oh bg-white spacing-mb">
<view class="base oh br-b-dashed padding-bottom-main flex-row jc-sb align-c">
<text class="cr-grey-9">{{ item.add_time }}</text>
<text class="cr-black" :class="item.status == 0 || item.status == 1 ? 'cr-black' : item.status == 2 ? 'cr-grey-c' : 'cr-red'">{{ item.status_name }}</text>
</view>
<view :data-value="'/pages/plugins/invoice/invoice-detail/invoice-detail?id=' + item.id" @tap="url_event" class="content margin-top-main cp">
<component-panel-content :propData="item" :propDataField="field_list" propIsItemShowMax="6" propExcludeField="add_time,status_name" :propIsTerse="true"></component-panel-content>
</view>
<!-- 0待审核、1待开票、2已开票、3已拒绝, 4已关闭 -->
<view v-if="item.status == 0 || item.status == 3 || item.status == 4" class="item-operation tr margin-top-main">
<button class="btn round br-grey-9 bg-white text-size-md" type="default" size="mini" @tap="delete_event" :data-value="item.id" :data-index="index" hover-class="none">{{$t('common.del')}}</button>
<button v-if="item.status == 0 || item.status == 3" class="btn round cr-main br-main bg-white text-size-md" type="default" size="mini" :data-value="'/pages/plugins/invoice/invoice-saveinfo/invoice-saveinfo?id='+item.id" @tap="url_event" hover-class="none">{{$t('common.edit')}}</button>
</view>
</view>
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
</view>
<view v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</view>
<!-- 添加发票 -->
<view v-if="(data_base.is_invoice_order || 0) == 1 || (data_base.is_invoice_recharge || 0) == 1" class="bottom-fixed" :style="bottom_fixed_style">
<view class="bottom-line-exclude flex-row gap-10">
<button v-if="(data_base.is_invoice_order || 0) == 1" class="item round cr-main bg-white br-main text-size wh-auto" type="default" hover-class="none" data-value="/pages/plugins/invoice/order/order" @tap="url_event">{{$t('invoice.invoice.p3dmd2')}}</button>
<button v-if="(data_base.is_invoice_recharge || 0) == 1" class="item round cr-main bg-white br-main text-size wh-auto" type="default" hover-class="none" data-value="/pages/plugins/invoice/recharge/recharge" @tap="url_event">{{$t('invoice.invoice.bh8yt3')}}</button>
</view>
</view>
</view>
</scroll-view>
<!-- 公共 -->
<component-common ref="common"></component-common>
</view>
</template>
<script>
const app = getApp();
import componentCommon from '@/components/common/common';
import componentNoData from '@/components/no-data/no-data';
import componentBottomLine from '@/components/bottom-line/bottom-line';
import componentPanelContent from "@/components/panel-content/panel-content";
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
field_list: [],
data_base: null,
data_list: [],
data_total: 0,
data_page_total: 0,
data_page: 1,
data_list_loding_status: 1,
data_list_loding_msg: '',
data_bottom_line_status: false,
data_is_loading: 0,
bottom_fixed_style: '',
params: null,
nav_status_list: [],
nav_status_index: 0,
};
},
components: {
componentCommon,
componentNoData,
componentBottomLine,
componentPanelContent
},
onLoad(params) {
// 调用公共事件方法
app.globalData.page_event_onload_handle(params);
// 是否指定状态
var nav_status_index = 0;
if ((params.status || null) != null) {
for (var i in this.nav_status_list) {
if (this.nav_status_list[i]['id'] == params.status) {
nav_status_index = i;
break;
}
}
}
this.setData({
params: params,
nav_status_index: nav_status_index,
});
},
onShow() {
// 调用公共事件方法
app.globalData.page_event_onshow_handle();
// 初始化配置
this.init();
// 公共onshow事件
if ((this.$refs.common || null) != null) {
this.$refs.common.on_show();
}
// 分享菜单处理
app.globalData.page_share_handle();
},
// 下拉刷新
onPullDownRefresh() {
this.setData({
data_page: 1,
});
this.get_data_list(1);
},
methods: {
// 初始化
init(e) {
var user = app.globalData.get_user_info(this, 'init');
if (user != false) {
this.get_data_base();
}
},
// 获取公共数据
get_data_base() {
uni.request({
url: app.globalData.get_request_url('center', 'userauth', 'certificate'),
method: 'POST',
data: {},
dataType: 'json',
success: (res) => {
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
this.setData({
data_base: data.base || null,
nav_status_list: data.nav || [],
data_list_loding_status: 0,
data_bottom_line_status: false,
data_page: 1,
});
this.get_data_list();
} else {
this.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.globalData.is_login_check(res.data, this, 'get_data_base')) {
app.globalData.showToast(res.data.msg);
}
}
},
fail: () => {
uni.stopPullDownRefresh();
this.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: this.$t('common.internet_error_tips'),
});
},
});
},
// 获取数据
get_data_list(is_mandatory) {
// 分页是否还有数据
if ((is_mandatory || 0) == 0) {
if (this.data_bottom_line_status == true) {
uni.stopPullDownRefresh();
return false;
}
}
// 是否加载中
if (this.data_is_loading == 1) {
return false;
}
this.setData({
data_is_loading: 1,
data_list_loding_status: 1,
});
// 加载loding
if(this.data_page > 1) {
uni.showLoading({
title: this.$t('common.loading_in_text'),
});
}
// 请求数据
var data = {
page: this.data_page,
};
// 状态
var status = (this.nav_status_list[this.nav_status_index] || null) == null ? -1 : this.nav_status_list[this.nav_status_index]['id'];
if (status != -1) {
data['status'] = status;
}
// 获取数据
uni.request({
url: app.globalData.get_request_url('index', 'userauth', 'certificate'),
method: 'POST',
data: data,
dataType: 'json',
success: (res) => {
if (this.data_page > 1) {
uni.hideLoading();
}
uni.stopPullDownRefresh();
if (res.data.code == 0) {
// 数据列表
var data = res.data.data;
if (this.data_page <= 1) {
var temp_data_list = data.data_list || [];
} else {
var temp_data_list = this.data_list || [];
var temp_data = data.data_list;
for (var i in temp_data) {
temp_data_list.push(temp_data[i]);
}
}
this.setData({
field_list: data.field_list || [],
data_list: temp_data_list,
data_total: data.total,
data_page_total: data.page_total,
data_list_loding_status: temp_data_list.length > 0 ? 3 : 0,
data_list_loding_msg: '',
data_page: this.data_page + 1,
data_is_loading: 0,
});
// 是否还有数据
this.setData({
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
});
} else {
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
}
},
fail: () => {
if (this.data_page > 1) {
uni.hideLoading();
}
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
data_is_loading: 0,
data_list_loding_msg: this.$t('common.internet_error_tips'),
});
},
});
},
// 删除
delete_event(e) {
uni.showModal({
title: this.$t('common.warm_tips'),
content: this.$t('recommend-list.recommend-list.54d418'),
confirmText: this.$t('common.confirm'),
cancelText: this.$t('recommend-list.recommend-list.w9460o'),
success: (result) => {
if (result.confirm) {
// 参数
var value = e.currentTarget.dataset.value;
var index = e.currentTarget.dataset.index;
// 加载loding
uni.showLoading({
title: this.$t('common.processing_in_text'),
});
uni.request({
url: app.globalData.get_request_url('delete', 'user', 'invoice'),
method: 'POST',
data: {
ids: value,
},
dataType: 'json',
success: (res) => {
uni.hideLoading();
if (res.data.code == 0) {
var temp_data_list = this.data_list;
temp_data_list.splice(index, 1);
this.setData({
data_list: temp_data_list,
});
if (temp_data_list.length == 0) {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: false,
});
}
app.globalData.showToast(res.data.msg, 'success');
} else {
app.globalData.showToast(res.data.msg);
}
},
fail: () => {
uni.hideLoading();
app.globalData.showToast(this.$t('common.internet_error_tips'));
},
});
}
},
});
},
// 滚动加载
scroll_lower(e) {
this.get_data_list();
},
// 导航事件
nav_event(e) {
this.setData({
nav_status_index: e.currentTarget.dataset.index || 0,
data_page: 1,
data_list: [],
data_list_loding_status: 1,
data_bottom_line_status: false
});
this.get_data_list(1);
},
// url事件
url_event(e) {
app.globalData.url_event(e);
}
},
};
</script>
<style>
</style>