源文件
This commit is contained in:
85
pages/plugins/points/index/index.css
Normal file
85
pages/plugins/points/index/index.css
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* 顶部
|
||||
*/
|
||||
.points-content {
|
||||
padding-top: 350rpx;
|
||||
}
|
||||
|
||||
.points-user {
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.points-user .avatar {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.points-user .share-submit {
|
||||
width: 112rpx;
|
||||
height: 52rpx;
|
||||
line-height: 52rpx;
|
||||
padding: 0;
|
||||
background: #D8D8D8 linear-gradient(93deg, #FF9747 0%, #FF6E01 100%);
|
||||
border-radius: 200rpx 0 0 200rpx;
|
||||
top: 54rpx;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.points-integral {
|
||||
padding: 28rpx 28rpx 0 28rpx;
|
||||
}
|
||||
|
||||
.points-integral .item .list {
|
||||
border-bottom: 2rpx solid #eee;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.points-integral .item .list:last-of-type {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 积分规则
|
||||
*/
|
||||
.rule-btn {
|
||||
top: 140rpx;
|
||||
width: 148rpx;
|
||||
height: 52rpx;
|
||||
padding: 0;
|
||||
line-height: 52rpx;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 200rpx 0 0 200rpx;
|
||||
}
|
||||
|
||||
.rule {
|
||||
padding: 56rpx 24rpx;
|
||||
max-height: 50vh;
|
||||
}
|
||||
|
||||
.rule .item {
|
||||
padding-bottom: 100rpx;
|
||||
max-height: calc(50vh - 164rpx);
|
||||
}
|
||||
|
||||
.rule button {
|
||||
margin: 20rpx 70rpx 42rpx 70rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 媒体查询
|
||||
*/
|
||||
@media only screen and (min-width:960px) {
|
||||
.points-content {
|
||||
/* #ifdef H5 */
|
||||
padding-top: 51%;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.rule-btn {
|
||||
/* #ifdef H5 */
|
||||
top: 11%;
|
||||
/* #endif */
|
||||
}
|
||||
}
|
||||
363
pages/plugins/points/index/index.vue
Normal file
363
pages/plugins/points/index/index.vue
Normal file
@@ -0,0 +1,363 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<component-nav-back :propName="$t('index.index.t26j9z')"></component-nav-back>
|
||||
<view v-if="(data_base || null) != null" class="weixin-nav-padding-top">
|
||||
<view class="padding-top-xxxl">
|
||||
<!-- 广告图片 -->
|
||||
<view class="pa top-0 bg-img wh-auto">
|
||||
<block v-if="(data_base.right_images || null) != null">
|
||||
<image class="wh-auto advertisement" :src="points_static_url + 'integral-bg.png'" mode="widthFix" :data-value="data_base.right_images_url || ''" @tap="url_event"></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image class="wh-auto advertisement" :src="points_static_url + 'integral-bg.png'" mode="widthFix" :data-value="data_base.right_images_url || ''" @tap="url_event"></image>
|
||||
</block>
|
||||
</view>
|
||||
<view class="pr padding-top-main">
|
||||
<view class="padding-horizontal-main points-content pr">
|
||||
<!-- 顶部 -->
|
||||
<view class="border-radius-main bg-white pr spacing-mb">
|
||||
<view class="points-user">
|
||||
<view class="flex-row">
|
||||
<block v-if="(user || null) == null">
|
||||
<image class="avatar dis-block circle" @tap="preview_event" :src="avatar_default" mode="widthFix"></image>
|
||||
<view class="padding-left-main">
|
||||
<view class="login-submit text-size fw-b" type="default" size="mini" @tap="login_event">{{$t('login.login.zy8tc4')}}</view>
|
||||
<view class="desc margin-top-sm cr-grey-9">{{$t('index.index.z88r5s')}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image class="avatar dis-block circle" @tap="preview_event" :src="user.avatar || avatar_default" mode="widthFix"></image>
|
||||
<view class="padding-left-main">
|
||||
<view class="text-size fw-b">{{ user.user_name_view }}</view>
|
||||
<view class="desc margin-top-sm cr-grey">
|
||||
<text>{{$t('index.index.b46kge')}}</text>
|
||||
<text class="cr-black fw-b padding-horizontal-xs">{{ user_integral.integral || 0 }}</text>
|
||||
<text>{{$t('index.index.t26j9z')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 分享 -->
|
||||
<button class="share-submit pa tc cr-white text-size-md" type="default" size="mini" @tap="share_event">{{$t('common.share')}}</button>
|
||||
</view>
|
||||
<block v-if="(data_base.is_home_points_record || 0) == 1 && (user || null) !== null">
|
||||
<view v-if="integral_list.length > 0" class="points-integral br-t-dashed">
|
||||
<component-title :propTitle="$t('index.index.i73nwk')" propMoreUrl="/pages/user-integral/user-integral"></component-title>
|
||||
<view class="item">
|
||||
<view v-for="(item, index) in integral_list" class="list" :key="index">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="cr-grey-9">{{$t('index.index.srd2ch')}}<text class="cr-black fw-b padding-left-sm">{{ item.original_integral }}</text>
|
||||
<text class="padding-horizontal-sm">/</text>{{$t('goods-category.goods-category.5p4ksj')}}<text class="cr-black fw-b padding-left-sm">{{ item.new_integral }}</text>
|
||||
</view>
|
||||
<view class="cr-grey-9">{{ item.add_time_time }}</view>
|
||||
</view>
|
||||
<view class="flex-row jc-sb align-c margin-top-main">
|
||||
<view>{{ item.msg }}</view>
|
||||
<view class="cr-main text-size fw-b" :class="item.type == 1 ? 'cr-green' : 'cr-red'">{{ item.type == 1 ? '+' : '-' }} {{ item.operation_integral }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg" propLoadingLogoTop="26%"></component-no-data>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 公告信息 -->
|
||||
<button v-if="(data_base.points_desc || null) != null && data_base.points_desc.length > 0" class="rule-btn pa right-0 tc cr-white text-size-md" @tap="quick_open_event">{{$t('index.index.u5642g')}}</button>
|
||||
|
||||
<!-- 商品兑换 -->
|
||||
<view v-if="(data_base.goods_exchange_data || null) != null && data_base.goods_exchange_data.length > 0">
|
||||
<component-goods-list :propData="{ style_type: 1, title: $t('index.index.f3l1xt'), url: '/pages/goods-search/goods-search', goods_list: data_base.goods_exchange_data }" propMoreUrlKey="url" :propCurrencySymbol="currency_symbol" :propGridBtnConfig="gridBtnConfig" :propIsOpenGridBtnSet="isOpenGridBtnSet"></component-goods-list>
|
||||
</view>
|
||||
|
||||
<!-- 积分明细和商品兑换都没有的时候展示无数据提示 -->
|
||||
<block v-if="integral_list.length == 0 && (data_base.is_home_points_record || 0) != 1 && ((data_base.goods_exchange_data || null) === null || data_base.goods_exchange_data.length == 0)">
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="0"></component-no-data>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 积分规则弹窗 -->
|
||||
<component-popup v-if="(data_base.points_desc || null) != null && data_base.points_desc.length > 0" :propShow="popup_status" :propIsBar="propIsBar" propPosition="bottom" @onclose="quick_close_event">
|
||||
<view class="rule">
|
||||
<view class="cr-black text-size-md fw-b margin-bottom-main tc">{{$t('index.index.u5642g')}}</view>
|
||||
<scroll-view :scroll-y="true" class="item">
|
||||
<view v-for="(item, index) in data_base.points_desc" :key="index" class="cr-grey text-size-md">{{ item }}</view>
|
||||
</scroll-view>
|
||||
<button type="default" class="bg-main cr-white round text-size-md pa bottom-0 left-0 right-0" @tap="quick_close_event">{{$t('index.index.qbi72m')}}</button>
|
||||
</view>
|
||||
</component-popup>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分享 -->
|
||||
<component-share-popup ref="share"></component-share-popup>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNavBack from '@/components/nav-back/nav-back';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentGoodsList from '@/components/goods-list/goods-list';
|
||||
import componentPopup from '@/components/popup/popup';
|
||||
import componentTitle from '@/components/title/title';
|
||||
import componentSharePopup from '@/components/share-popup/share-popup';
|
||||
var points_static_url = app.globalData.get_static_url('points', true);
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
points_static_url: points_static_url,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
params: null,
|
||||
user: null,
|
||||
data_base: null,
|
||||
user_integral: null,
|
||||
avatar_default: app.globalData.data.default_user_head_src,
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
// 配置商品列表按钮
|
||||
isOpenGridBtnSet: true,
|
||||
gridBtnConfig: {
|
||||
name: this.$t('index.index.4v5nq5'),
|
||||
bg_color: app.globalData.get_theme_color(),
|
||||
padding: '8rpx 16rpx',
|
||||
border_radius: '8rpx',
|
||||
},
|
||||
// 规则弹窗
|
||||
popup_status: false,
|
||||
propIsBar: false,
|
||||
// 积分明细
|
||||
integral_list: [],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNavBack,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentGoodsList,
|
||||
componentPopup,
|
||||
componentTitle,
|
||||
componentSharePopup
|
||||
},
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 用户信息
|
||||
this.setData({
|
||||
user: app.globalData.get_user_cache_info(),
|
||||
});
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 获取数据
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol'),
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index', 'points'),
|
||||
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,
|
||||
user_integral: data.user_integral || null,
|
||||
});
|
||||
if ((this.data_base || null) != null) {
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: this.data_base.seo_title || this.data_base.application_name,
|
||||
desc: this.data_base.seo_desc,
|
||||
path: '/pages/plugins/points/index/index',
|
||||
img: this.data_base.right_images,
|
||||
},
|
||||
});
|
||||
|
||||
// #ifndef MP-ALIPAY
|
||||
// 导航名称
|
||||
if ((this.data_base.application_name || null) != null) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.data_base.application_name,
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 已登录则获取积分明细
|
||||
if(this.user != null && (this.data_base || null) != null && parseInt(this.data_base.is_home_points_record || 0) == 1) {
|
||||
this.get_integral_data_list();
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
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'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 立即登录
|
||||
login_event() {
|
||||
// 获取用户信息
|
||||
this.setData({
|
||||
user: app.globalData.get_user_info(this, 'login_event') || null,
|
||||
});
|
||||
// 获取积分明细
|
||||
if(this.user != null) {
|
||||
this.get_integral_data_list();
|
||||
}
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 头像查看
|
||||
preview_event() {
|
||||
if (app.globalData.data.default_user_head_src != this.user.avatar) {
|
||||
uni.previewImage({
|
||||
current: this.user.avatar,
|
||||
urls: [this.user.avatar],
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取积分数据
|
||||
get_integral_data_list(is_mandatory) {
|
||||
if((this.data_base || null) != null && parseInt(this.data_base.is_home_points_record || 0) == 1) {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'userintegral'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
var integral_list = (res.data.code == 0 && res.data.data.data.length > 0) ? (res.data.data.data.length > 4 ? res.data.data.data.splice(0, 4) : res.data.data.data) : [];
|
||||
this.setData({
|
||||
integral_list: integral_list,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 弹层开启
|
||||
quick_open_event(e) {
|
||||
this.setData({
|
||||
popup_status: true,
|
||||
});
|
||||
},
|
||||
|
||||
// 弹层关闭
|
||||
quick_close_event(e) {
|
||||
this.setData({
|
||||
popup_status: false,
|
||||
});
|
||||
},
|
||||
|
||||
// 页面滚动监听
|
||||
onPageScroll(res) {
|
||||
uni.$emit('onPageScroll', res);
|
||||
},
|
||||
|
||||
// 分享开启弹层
|
||||
share_event(e) {
|
||||
if ((this.$refs.share || null) != null) {
|
||||
this.$refs.share.init({
|
||||
share_info: this.share_info
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './index.css';
|
||||
</style>
|
||||
25
pages/plugins/points/scan/scan.css
Normal file
25
pages/plugins/points/scan/scan.css
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 基础
|
||||
*/
|
||||
.page-content {
|
||||
background: #fff;
|
||||
}
|
||||
.scan-button {
|
||||
background: linear-gradient( 270deg, #F1E6C1 0%, #DBC583 100%);
|
||||
max-width: 300rpx;
|
||||
}
|
||||
.scan-button text {
|
||||
color: #CC2121;
|
||||
}
|
||||
/**
|
||||
* 扫码提示页面则使用黄色背景
|
||||
*/
|
||||
.page-content.page-bottom-fixed {
|
||||
background: #FEEEC8;
|
||||
}
|
||||
/**
|
||||
* 登录和扫码按钮增加页面底部间距
|
||||
*/
|
||||
.page-bottom-fixed {
|
||||
padding-bottom: 100rpx !important;
|
||||
}
|
||||
195
pages/plugins/points/scan/scan.vue
Normal file
195
pages/plugins/points/scan/scan.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(data || null) != null" :class="'page-content min-ht '+((user == null || data.status == -10000) ? 'page-bottom-fixed' : '')">
|
||||
<block v-if="data.status == -10000">
|
||||
<!-- 顶部banner -->
|
||||
<image v-if="(data_base.scan_top_banner || null) != null" :src="data_base.scan_top_banner" mode="widthFix" class="dis-block wh-auto auto"></image>
|
||||
<!-- 底部图片 -->
|
||||
<image v-if="(data_base.scan_bottom_images || null) != null" :src="data_base.scan_bottom_images" mode="widthFix" class="dis-block wh-auto auto"></image>
|
||||
<!-- 扫码 -->
|
||||
<!-- #ifndef H5 -->
|
||||
<view v-if="user != null" class="pf left-0 bottom-xxxxl wh-auto tc padding-horizontal-main bs-bb">
|
||||
<view class="bottom-line-exclude">
|
||||
<button type="default" class="scan-button text-size-sm round" @tap="scan_event">
|
||||
<view class="va-m dis-inline-block margin-right-xs">
|
||||
<iconfont name="icon-scan" size="28rpx" propClass="lh-il va-m" color="#CC2121"></iconfont>
|
||||
</view>
|
||||
<text class="va-m">{{$t('common.scan_name')}}</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 领取成功 -->
|
||||
<block v-if="data.status == 0">
|
||||
<image v-if="(data_base.scan_success_images || null) != null" :src="data_base.scan_success_images" mode="widthFix" class="dis-block wh-auto auto"></image>
|
||||
<view class="margin-vertical-xxxl tc">{{data.msg}}</view>
|
||||
</block>
|
||||
<!-- 领取失败 -->
|
||||
<block v-else-if="data.status == -100">
|
||||
<image v-if="(data_base.scan_fail_images || null) != null" :src="data_base.scan_fail_images" mode="widthFix" class="dis-block wh-auto auto"></image>
|
||||
<view class="margin-vertical-xxxl tc">{{data.msg}}</view>
|
||||
</block>
|
||||
<!-- 其他错误 -->
|
||||
<block v-else>
|
||||
<component-no-data propStatus="0" :propMsg="data.msg"></component-no-data>
|
||||
</block>
|
||||
</block>
|
||||
<!-- 未登录 -->
|
||||
<view v-if="user == null" class="pf left-0 bottom-xxxxl wh-auto tc padding-horizontal-main bs-bb">
|
||||
<view class="bottom-line-exclude">
|
||||
<button type="default" class="bg-main br-main cr-white text-size-sm round" @tap="login_event">{{$t('pages.login')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 公共 -->
|
||||
<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';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
user: null,
|
||||
data_base: null,
|
||||
data: null,
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: app.globalData.launch_params_handle(params),
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 用户信息
|
||||
this.setData({
|
||||
user: app.globalData.get_user_cache_info(),
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'scan', 'points'),
|
||||
method: 'POST',
|
||||
data: this.params,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
data: data.data || null,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: (data.data || null) != null,
|
||||
});
|
||||
|
||||
if ((this.data_base || null) != null) {
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: this.$t('pages.plugins-points-scan'),
|
||||
path: '/pages/plugins/points/scan/scan'
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 登录事件
|
||||
login_event() {
|
||||
var user = app.globalData.get_user_info(this, 'login_event');
|
||||
this.setData({
|
||||
user: user || null,
|
||||
});
|
||||
},
|
||||
|
||||
// 扫码事件
|
||||
scan_event() {
|
||||
var self = this;
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
if (res.result !== '') {
|
||||
var arr = ['/points-scan-index-id-', 'plugins/index/pluginsname/points/pluginscontrol/scan/pluginsaction/index/id/'];
|
||||
var ret = app.globalData.web_url_value_mate(res.result, arr);
|
||||
if (ret.status == 1 && ret.value != null) {
|
||||
var temp = self.params;
|
||||
temp['id'] = ret.value;
|
||||
self.setData({
|
||||
params: temp
|
||||
});
|
||||
self.get_data();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './scan.css';
|
||||
</style>
|
||||
Reference in New Issue
Block a user