123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <template>
- <div class="box" v-if="show && source !== 'KIP' && source !== 'ALIPAY' " :style="{ bottom: bottom, }" @touchmove.stop.prevent>
- <div class="box-text">
- <div class="box-text-left">
- 开通支付快速积分,积分秒到账!
- </div>
- <div class="box-text-right">
- <div class="box-text-right-btn" :style="{ background: background ? background : backgroundList[custTypeId] }" @click="toWxPointsAuth('handle')">
- 立即开通
- <k-icon name="arrows-right" :size="5" class="box-text-right-icon" color="#fff"></k-icon>
- </div>
- <k-icon name="close" :size="7" class="box-text-right-icon-close" @click="close()" color="#999"></k-icon>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapState } from "vuex"
- import {
- kipGetPointsConfig
- } from '@/utils/api-kip.js'
- import uni from '@/utils/uniHooks';
- const app = {}
- export default {
- props: {
- bottom: {
- type: String,
- default: '54px',
- },
- background: {
- type: String,
- default: '',
- },
- visibility: {
- type: String,
- default: 'hidden',
- }
- },
- created() {
- // this.handleGetPointsConfig()
- },
- watch: {
- },
- data() {
- return {
- pointsConfig: null,
- show: false,
- clickToWxPointsAuth: false,
- backgroundList:['#644A79','#143793','#2E663F']
- };
- },
- computed: {
- // custTypeId: 0 默认版本,1 上海静安 2 上海浦东
- ...mapState({
- // custTypeId: 0
- custTypeId: state => state.custTypeId,
- source: (state) => state.source,
- isLogin: (state) => state.isLogin,
- }),
- pointsModalFlag() {
- return this.$store.state.pointsModalFlag
- }
- },
- mounted() {
- // this.checkShowFlag()
- this.handleGetPointsConfig('init')
- },
- methods: {
- checkoutLogin() {
- this.toWxPointsAuth()
- },
- close() {
- this.show = false
- var arr_lbs_end_time = []
- if (uni.getStorageSync('lbs_end_time')) {
- arr_lbs_end_time = uni.getStorageSync('lbs_end_time')
- arr_lbs_end_time = arr_lbs_end_time.filter(item => item.lbsId !== this.$store.state?.lbsId);
- console.log('del_arr_lbs_end_time:::', arr_lbs_end_time)
- arr_lbs_end_time.push({
- lbsId: this.$store.state?.lbsId,
- time: new Date().getTime()
- })
- uni.setStorageSync("lbs_end_time", arr_lbs_end_time)
- uni.setStorageSync("ceshi", 4534534534534534534)
- } else {
- arr_lbs_end_time.push({
- lbsId: this.$store.state?.lbsId,
- time: new Date().getTime()
- })
- uni.setStorageSync("lbs_end_time", arr_lbs_end_time)
- }
- },
- checkShowFlag() {
- const nowTime = new Date()
- const nowTime00 = new Date(new Date().setHours(0, 0, 0, 0)).getTime()
- var arr_lbs_end_time = [];
- if (uni.getStorageSync('lbs_end_time')) {
- console.log(555)
- arr_lbs_end_time = uni.getStorageSync('lbs_end_time')
- console.log(666)
- console.log('arr_lbs_end_time::', uni.getStorageSync('lbs_end_time'))
- const arr_lbsId = arr_lbs_end_time.filter(element => {
- return element.lbsId === this.$store.state?.lbsId
- })
- if (arr_lbsId.length > 0) {
- console.log(777)
- if (arr_lbsId[arr_lbsId.length - 1].time < nowTime00) {
- this.show = true
- console.log(333)
- } else {
- console.log(444)
- this.show = false
- }
- } else {
- this.show = true
- }
- console.log('arr_lbsId:::', arr_lbsId, this.$store.state?.lbsId)
- // arr_lbs_end_time.forEach(element => {
- // if (this.$store.state?.lbsId === element.lbsId) {
- // console.log(777)
- // if (element.time < nowTime00) {
- // this.show = true
- // console.log(333)
- // } else {
- // console.log(444)
- // this.show = false
- // }
- // } else {
- // }
- // });
- } else {
- this.show = true
- }
- },
- handleGetPointsConfig(type) {
- // if(this.isLogin === 'loginDenied') return
- kipGetPointsConfig().then(resp => {
- const result = resp;
- // codes,wxAuth,aliAuth
- console.log(111222, resp)
- this.pointsConfig = result
- if (result) {
- if (result && result.codes) {
- // codes,wxAuth,aliAuth
- this.pointsConfig = result
- console.log(111)
- if (!this.pointsConfig.wxAuth && this.pointsConfig.codes.indexOf('wxpay') != -1) {
- console.log(222)
- this.checkShowFlag()
- }
- } else {
- // this.$store.commit('setPointsModalFlag', false);
- if (result.code && result.code === '300000') {
- // this.checkoutLogin()
- } else {
- // console.log(222222)
- // 非南昌办公楼展示自助积分功能接口请求出错
- if (this.$store.state?.lbsId !== '8a84834088f11119018949444636000c' && this.$store.state?.lbsId !== '8a88817a8a629b5f018a838a0f6e001f') {
- uni.showToast({
- icon: 'none',
- mask: true,
- duration: 2000,
- title: result.errorMessage || result.message || '出错了,请稍后再试'
- })
- }
-
- }
- }
- } else {
- // this.$store.commit('setPointsModalFlag', false);
- if (resp.code && resp.code === '300000') {
- // this.checkoutLogin()
- } else {
- uni.showToast({
- icon: 'none',
- mask: true,
- duration: 2000,
- title: resp.message
- })
- }
- }
- }).catch(e => {
- // this.$store.commit('setPointsModalFlag', false);
- })
- },
- async toWxPointsAuth(type) {
- if (!type) {
- return
- }
- if (window.__wxjs_environment === 'miniprogram') {
- wx.miniProgram.navigateTo({
- "url": "/pages/accumulatePoints/selfServicePoints?redirect=1&backUrl=pages/package-parkingFee/parkingFeeWebView" // 去 login 页面 1 去登录
- })
- }
- if (window.isAlipayClient) {
- my?.navigateTo({
- "url": "/pages/accumulatePoints/selfServicePoints?redirect=1" // 去 login 页面 1 去登录
- })
- }
- // // mini 跳转
- // wx.miniProgram.redirectTo({
- // "url": "/pages/accumulatePoints/selfServicePoints?redirect=1" // 去 login 页面 1 去登录
- // })
- },
- }
- }
- </script>
- <style scoped>
- .box {
- position: absolute;
- z-index: 1000;
- width: calc(100vw - 84px);
- padding: 8px 20px;
- height: 80px;
- left: 24px;
- border-radius: 6px;
- background: #000;
- }
- .box-text {
- color: #fff;
- display: flex;
- height: 100%;
- line-height: 80px;
- width: 100%;
- justify-content: space-between;
- }
- .box-text-left {
- font-size: 28px;
- line-height: 80px;
- height: 24px;
- }
- .box-text-right {
- display: flex;
- justify-content: center;
- font-size: 26px;
- line-height: 80px;
- height: 24px;
- }
- .box-text-right-icon {
- display: inline-block;
- margin-left: 5px;
- position: relative;
- top: -1px;
- }
- .box-text-right-icon-close {
- margin-left: 5px;
- }
- .box-text-right-btn {
- height: 46px;
- line-height: 46px;
- border-radius: 22px;
- padding: 0 18px;
- margin-top:17px;
- margin-right:10px;
- }
- </style>
|