123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view>
- <block v-if="systemInfo.is_vip == 1">
- <!-- #ifdef MP-WEIXIN -->
- <block v-if="userInfo.mobile">
- <view hover-class="none" class="home-btn" @click="onGetphone">
- <image src="https://zxzhdc.zx-xcx.com/dining/home6.png"></image>
- </view>
- </block>
- <block v-else>
- <button hover-class="none" class="home-btn" open-type="getPhoneNumber"
- @getphonenumber="onGetphoneNumber">
- <image src="https://zxzhdc.zx-xcx.com/dining/home6.png"></image>
- </button>
- </block>
- <!-- #endif -->
- <!-- #ifdef MP-ALIPAY -->
- <view @click="onGetphone" class="home-btn">
- <image src="https://zxzhdc.zx-xcx.com/dining/home6.png"></image>
- </view>
- <!-- #endif -->
- </block>
- <Vphone :getPhonePop="getPhonePop" @close="setClose"></Vphone>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
- let hideLoading = true;
- import Vphone from '@/components/v-phone/v-phone.vue';
-
- // #ifdef MP-ALIPAY
- // const {
- // requestSubscribeMessage
- // } = requirePlugin('subscribeMsg');
- // #endif
-
- export default {
- data() {
- return {
- getPhonePop: false
- }
- },
- components: {
- Vphone
- },
- computed: {
- ...mapState(['systemInfo', 'setColor', 'store_id', 'userInfo', 'teen_index', 'address'])
- },
- methods: {
- onGetphoneNumber(e) {
- if (this.userInfo.mobile) {
- uni.showToast({
- title: "您已经完善过会员信息了,无需重复操作!",
- icon: 'none'
- })
- return
- }
- // #ifdef MP-WEIXIN
- if (e.detail.errMsg == "getPhoneNumber:ok") {
- this.$http.request('xcx/Jiemi', {
- id: this.userInfo.id,
- data: e.detail.encryptedData,
- iv: e.detail.iv,
- sessionKey: uni.getStorageSync('user_xcx_info').session_key,
- store_id: this.store_id,
- }, "", "", hideLoading).then(res => {
- this.phoneNumber = res.data.phoneNumber;
- uni.setStorageSync('phone', res.data.phoneNumber);
- uni.showModal({
- title: '授权成功',
- content: '享受更多优惠!',
- showCancel: false,
- cancelText: '',
- confirmText: '确定',
- success: res => {
- let subscribe = uni.getStorageSync('balance_subscribe');
- uni.requestSubscribeMessage({
- tmplIds: [subscribe.member_tid],
- success: (r) => {},
- complete: (r) => {
- var pages = getCurrentPages();
- this.$http.request('xcx/userinfo', {
- id: this.userInfo.id,
- }, "", "", hideLoading).then(res => {
- if (res.code == "200") {
- this.$store.commit('SET_USER_INFO',
- res.data)
- if (pages[pages.length-1].route ==
- "pages/creatOrder/creatOrder"
- ) {
- uni.redirectTo({
- url: '/pages/creatOrder/creatOrder'
- })
- }
- }
- }).catch((res) => {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- });
- }
- })
- },
- fail: () => {},
- complete: () => {}
- });
- })
- } else {
- uni.showToast({
- title: "授权失败,请重新授权",
- icon: 'none'
- })
- }
- // #endif
- },
- // 子组件传参
- setClose(e) {
- this.getPhonePop = e;
- },
- // 开启会员弹窗
- onGetphone(e) {
- if (this.userInfo.mobile) {
- uni.showToast({
- title: "您已经完善过会员信息了,无需重复操作!",
- icon: 'none'
- })
- return
- }
- this.getPhonePop = true;
- },
- }
- }
- </script>
- <style>
- </style>
|