123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <template>
- <view class="scroll-box bg-white">
- <!-- 主体内容 -->
- <block v-if="data_list_loding_status == 3">
- <!-- 条码 -->
- <view class="brcode auto">
- <w-barcode :options="barcode"></w-barcode>
- <view class="fw-b tc margin-top text-size-lg">{{member_code}}</view>
- </view>
- <!-- 二维码 -->
- <view class="qrcode auto br radius">
- <w-qrcode :options="qrcode"></w-qrcode>
- </view>
- <!-- 提示信息 -->
- <view class="cr-grey tc margin-top-xxxl">如遇到扫码失败请将屏幕调至最亮重新扫码</view>
-
- <!-- 导航 -->
- <view v-if="(plugins_wallet || null) != null" class="bottom-fixed padding-main">
- <view class="bottom-line-exclude oh">
- <view class="bg-gray round oh">
- <button type="default" class="bg-main br-main cr-white round text-size fl" size="mini">会员码</button>
- <button type="default" class="bg-gray br-gray cr-base round text-size fr" size="mini" :data-value="'/pages/plugins/wallet/payment-code/payment-code?screen_brightness_value='+screen_brightness_value" data-redirect="1" @tap="url_event">钱包付款码</button>
- </view>
- </view>
- </view>
- </block>
- <!-- 错误提示 -->
- <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
- <view v-if="is_to_login == 1" class="margin-top-lg tc">
- <button type="default" class="bg-main br-main cr-white" size="mini" data-value="/pages/login/login" @tap="url_event">去登录</button>
- </view>
- </view>
- </template>
- <script>
- const app = getApp();
- import componentNoData from "../../../../components/no-data/no-data";
- export default {
- data() {
- return {
- data_list_loding_status: 1,
- data_list_loding_msg: '',
- is_to_login: 0,
- screen_brightness_value: 0,
- plugins_wallet: null,
- user: null,
- member_code: '',
- barcode:{
- width: 660,
- height: 120,
- code: ''
- },
- qrcode:{
- code: '',
- size: 450,
- }
- }
- },
- components: {
- componentNoData
- },
- // 页面加载初始化
- onLoad(params) {
- // 获取屏幕亮度
- // #ifndef H5
- var self = this;
- if((params || null) != null && (params.screen_brightness_value || null) == null) {
- uni.getScreenBrightness({
- success: function (res) {
- self.setData({
- screen_brightness_value: res.value
- });
- }
- });
- } else {
- self.setData({
- screen_brightness_value: params.screen_brightness_value
- });
- }
- // #endif
- },
- onShow() {
- // 数据加载
- this.init();
-
- // 初始化配置
- this.init_config();
- },
- methods: {
- // 初始化配置
- init_config(status) {
- if ((status || false) == true) {
- this.setData({
- plugins_wallet: app.globalData.get_config('plugins_base.wallet', null)
- });
- } else {
- app.globalData.is_config(this, 'init_config');
- }
- },
- // 获取数据
- 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"
- });
- this.setData({
- data_list_loding_status: 0,
- data_list_loding_msg: '请先绑定手机',
- is_to_login: 1
- });
- return false;
- } else {
- if((user.number_code || null) != null) {
- // 会员码数据
- var barcode = this.barcode;
- var qrcode = this.qrcode;
- barcode['code'] = user.number_code;
- qrcode['code'] = user.number_code;
- this.setData({
- data_list_loding_status: 3,
- is_to_login: 0,
- user: user,
- barcode: barcode,
- qrcode: qrcode,
- member_code: user.number_code,
- });
- // #ifndef H5
- // 设置屏幕亮度
- uni.setScreenBrightness({
- value: 1
- });
- // #endif
- } else {
- this.setData({
- data_list_loding_status: 0,
- data_list_loding_msg: '会员码为空',
- is_to_login: 0
- });
- }
- }
- } else {
- this.setData({
- data_list_loding_status: 0,
- data_list_loding_msg: '请先登录',
- is_to_login: 1
- });
- }
- },
- // url事件
- url_event(e) {
- app.globalData.url_event(e);
- }
- },
- // 页面销毁时执行
- onUnload: function() {
- // #ifndef H5
- // 恢复屏幕原始亮度
- if(this.screen_brightness_value > 0) {
- uni.setScreenBrightness({
- value: this.screen_brightness_value
- });
- }
- // #endif
- }
- }
- </script>
- <style>
- @import './member-code.css';
- </style>
|