Browse Source

优化优惠券,用户登录

喻文俊 3 năm trước cách đây
mục cha
commit
b989fb1cde

+ 23 - 6
common/couponUtil.js

@@ -8,8 +8,9 @@ export function fetchSelectedProducts(goodsList) {
 }
 
 // 根据选中商品筛选可用优惠券并排序
-export function findCouponBySelected(ids, couponList) {
-    const list = couponList.filter(coupon => coupon.productType === 1 || isIntersect(ids, coupon.productIds.split(',')))
+export function findCouponBySelected(productIds, couponList) {
+    const list = couponList.filter(coupon => coupon.productType === 1 || isIntersect(productIds, coupon.productIds
+        .split(',')))
     return couponSort(list)
 }
 
@@ -23,7 +24,7 @@ export function findCouponBySelected(ids, couponList) {
  *          当前优惠券可用的商品的价格总计 >= 当前优惠券的触发金额
  * */
 
-// 判断可用优惠券是否满足使用条件
+// 判断可用优惠券是否满足使用条件 返回抵扣金额最高的优惠券索引 -1:无可用优惠券
 export function canUseCoupon(current, productIds, canUseCouponList, selectedPoducts) {
     if (productIds.length <= 0 || canUseCouponList.length <= 0) return -1
     const len = canUseCouponList.length
@@ -56,7 +57,7 @@ export function someProductUseCheck(productList, coupon) {
     return countPrice >= coupon.touchPrice
 }
 
-// 计当前优惠券商品可用的价
+// 计当前优惠券可使用的商品的总
 export function getCountPrice(productList, coupon) {
     let countPrice = 0
     // 针对全部商品
@@ -74,8 +75,24 @@ export function getCountPrice(productList, coupon) {
     return countPrice
 }
 
-
-// 将优惠券按金额从大到小排序
+// 将优惠券按抵扣金额从大到小排序
 export function couponSort(couponList) {
     return couponList.sort((a, b) => b.couponAmount - a.couponAmount)
 }
+
+// 对优惠券去重 过滤掉相同id的优惠券
+export function couponFilterRepeat(couponList) {
+    const list = []
+    couponList.forEach(coupon => {
+        if (list.findIndex(v => v.couponId === coupon.couponId) === -1) list.push(coupon)
+    })
+    return list
+}
+
+// 为优惠券设置唯一ID
+export function setCouponUniqueId(couponList = []) {
+    return couponList.map((coupon, index) => {
+        coupon.uniqueId = index
+        return coupon
+    }) 
+}

+ 2 - 2
components/cm-module/cm-coupon-list/cm-coupon-list.vue

@@ -52,11 +52,11 @@
                             :image="baseUrl + 'icon-coupon-empty.png'"
                             :offset="-12"
                         ></cm-empty>
-                        <!-- IPhoneX 以上版本适配 -->
-                        <view :style="{ height: isIphoneX ? '44rpx' : 0 }"></view>
                     </view>
                     <!-- 使用优惠券按钮 -->
                     <view class="btn" @click="confirm" v-if="listType === 'use'">确定</view>
+                    <!-- IPhoneX 以上版本适配 -->
+                    <view :style="{ height: isIphoneX ? '44rpx' : 0 }"></view>
                 </view>
             </uni-transition>
         </view>

+ 7 - 5
components/cm-module/cm-coupon/cm-coupon.vue

@@ -24,7 +24,9 @@
                 <view class="end-time" v-if="couponData.useStatus === 0">
                     截止日期:
                     <template v-if="couponData.receivePeriod">{{ couponData.receivePeriod | formatDate }}</template>
-                    <template v-else>永久</template>
+                    <template v-else
+                        >永久</template
+                    >
                 </view>
                 <view class="end-time" v-else>有效期至:{{ couponData.usePeriod | formatDate }}</view>
             </view>
@@ -43,7 +45,7 @@
             <template v-if="chooseAble">
                 <text
                     class="radio-flag iconfont "
-                    :class="currentId === couponData.couponId ? 'icon-xuanze' : 'icon-weixuanze'"
+                    :class="currentId === couponData.uniqueId ? 'icon-xuanze' : 'icon-weixuanze'"
                     v-if="couponData.canSelect"
                 ></text>
             </template>
@@ -139,13 +141,13 @@ export default {
                 1: this.useCoupon // 使用优惠券
             }
             // 将优惠券id作为参数传递进去
-            clickFns[this.couponData.useStatus](this.couponData.couponId).then(res => {
+            clickFns[this.couponData.useStatus](this.couponData).then(res => {
                 // 向父组件发送领取优惠券事件
                 this.$emit('btnClick', this.couponData)
             })
         },
         // 使用优惠券
-        useCoupon(couponId) {
+        useCoupon(couponData) {
             const type = this.couponData.productType
             if (type === 1) {
                 console.log('全部商品可用')
@@ -153,7 +155,7 @@ export default {
                 // this.$api.switchTabTo('/pages/tabBar/index/index')
             } else {
                 console.log('部分商品可用')
-                uni.navigateTo({ url: `/pages/goods/goods-coupon-list?couponId=${couponId}` })
+                uni.navigateTo({ url: `/pages/goods/goods-coupon-list?couponId=${couponData.couponId}` })
             }
             return Promise.resolve()
         }

+ 0 - 1
main.js

@@ -27,7 +27,6 @@ Vue.use(Common)
 // ServiceApi接口方法
 Vue.use(ServiceApi)
 
-
 const app = new Vue({
     store,
     ...App

+ 157 - 151
pages.json

@@ -37,162 +37,168 @@
             "style": {
                 "navigationBarTitleText": "登录"
             }
-        },
-        {
-            "path": "pages/goods/list",
-            "style": {
-                "navigationBarTitleText": "立即下单"
-            }
-        },
-        {
-            "path": "pages/goods/cart",
-            "style": {
-                "navigationBarTitleText": "购物车",
-                "enablePullDownRefresh": true,
-                "navigationStyle": "custom"
-            }
-        },
-        {
-            "path": "pages/goods/search",
-            "style": {
-                "navigationBarTitleText": "搜索"
-            }
-        },
-        {
-            "path": "pages/goods/product-detail",
-            "style": {
-                "navigationBarTitleText": "商品详情"
-            }
-        },
-        {
-            "path": "pages/goods/goods-floorMore",
-            "style": {
-                "navigationBarTitleText": "商品列表",
-                "enablePullDownRefresh": true
-            }
-        },
-        {
-            "path": "pages/goods/goods-coupon-list",
-            "style": {
-                "navigationBarTitleText": "优惠券商品列表",
-                "enablePullDownRefresh": true
-            }
-        },
-        {
-            "path": "pages/goods/goods-coupon-list-search",
-            "style": {
-                "navigationBarTitleText": "搜索"
-            }
         }
     ],
     "subPackages": [{
-        "root": "pages/user/", //个人中心模块
-        "pages": [{
-                "path": "address/addressManage",
-                "style": {
-                    "navigationBarTitleText": "添加新地址"
-                }
-            },
-            {
-                "path": "address/address",
-                "style": {
-                    "navigationBarTitleText": "地址列表",
-                    "enablePullDownRefresh": true,
-                    "onReachBottomDistance": 50
-                }
-            },
-            {
-                "path": "order/create-order",
-                "style": {
-                    "navigationBarTitleText": "确认订单"
-                }
-            },
-            {
-                "path": "order/success",
-                "style": {
-                    "navigationBarTitleText": "支付结果",
-                    "navigationStyle": "custom"
-                }
-            },
-            {
-                "path": "order/error",
-                "style": {
-                    "navigationBarTitleText": "支付结果",
-                    "navigationStyle": "custom"
-                }
-            },
-            {
-                "path": "order/order-list",
-                "style": {
-                    "navigationBarTitleText": "我的订单",
-                    "navigationStyle": "custom"
-                }
-            },
-            {
-                "path": "order/order-list-retail",
-                "style": {
-                    "navigationBarTitleText": "我的订单",
-                    "navigationStyle": "custom"
-                }
-            },
-            {
-                "path": "order/order-details",
-                "style": {
-                    "navigationBarTitleText": "订单详情",
-                    "navigationStyle": "custom"
-                }
-            },
-            {
-                "path": "order/order-payment",
-                "style": {
-                    "navigationBarTitleText": "收银台",
-                    "navigationStyle": "custom"
-                }
-            },
-            {
-                "path": "order/search-order",
-                "style": {
-                    "navigationBarTitleText": "订单搜索"
-                }
-            },
-            {
-                "path": "order/order-logistics",
-                "style": {
-                    "navigationBarTitleText": "物流信息"
-                }
-            },
-            {
-                "path": "activity/activity",
-                "style": {
-                    "navigationBarTitleText": "活动详情",
-                    "enablePullDownRefresh": true,
-                    "backgroundColor": "#ff457b",
-                    "backgroundTextStyle": "light",
-                    "onReachBottomDistance": 50
-                }
-            },
-            {
-                "path": "activity/activity-list",
-                "style": {
-                    "navigationBarTitleText": "活动专区",
-                    "enablePullDownRefresh": true,
-                    "onReachBottomDistance": 50
-                }
-            },
-            {
-                "path": "activity/coupon-find-list",
-                "style": {
-                    "navigationBarTitleText": "领券中心"
+            "root": "pages/goods/",
+            "pages": [{
+                    "path": "list",
+                    "style": {
+                        "navigationBarTitleText": "立即下单"
+                    }
+                },
+                {
+                    "path": "cart",
+                    "style": {
+                        "navigationBarTitleText": "购物车",
+                        "enablePullDownRefresh": true,
+                        "navigationStyle": "custom"
+                    }
+                },
+                {
+                    "path": "search",
+                    "style": {
+                        "navigationBarTitleText": "搜索"
+                    }
+                },
+                {
+                    "path": "product-detail",
+                    "style": {
+                        "navigationBarTitleText": "商品详情"
+                    }
+                },
+                {
+                    "path": "goods-floorMore",
+                    "style": {
+                        "navigationBarTitleText": "商品列表",
+                        "enablePullDownRefresh": true
+                    }
+                },
+                {
+                    "path": "goods-coupon-list",
+                    "style": {
+                        "navigationBarTitleText": "优惠券商品列表",
+                        "enablePullDownRefresh": true
+                    }
+                },
+                {
+                    "path": "goods-coupon-list-search",
+                    "style": {
+                        "navigationBarTitleText": "搜索"
+                    }
                 }
-            },
-            {
-                "path": "activity/coupon-list",
-                "style": {
-                    "navigationBarTitleText": "优惠券"
+            ]
+        },
+        {
+            "root": "pages/user/", //个人中心模块
+            "pages": [{
+                    "path": "address/addressManage",
+                    "style": {
+                        "navigationBarTitleText": "添加新地址"
+                    }
+                },
+                {
+                    "path": "address/address",
+                    "style": {
+                        "navigationBarTitleText": "地址列表",
+                        "enablePullDownRefresh": true,
+                        "onReachBottomDistance": 50
+                    }
+                },
+                {
+                    "path": "order/create-order",
+                    "style": {
+                        "navigationBarTitleText": "确认订单"
+                    }
+                },
+                {
+                    "path": "order/success",
+                    "style": {
+                        "navigationBarTitleText": "支付结果",
+                        "navigationStyle": "custom"
+                    }
+                },
+                {
+                    "path": "order/error",
+                    "style": {
+                        "navigationBarTitleText": "支付结果",
+                        "navigationStyle": "custom"
+                    }
+                },
+                {
+                    "path": "order/order-list",
+                    "style": {
+                        "navigationBarTitleText": "我的订单",
+                        "navigationStyle": "custom"
+                    }
+                },
+                {
+                    "path": "order/order-list-retail",
+                    "style": {
+                        "navigationBarTitleText": "我的订单",
+                        "navigationStyle": "custom"
+                    }
+                },
+                {
+                    "path": "order/order-details",
+                    "style": {
+                        "navigationBarTitleText": "订单详情",
+                        "navigationStyle": "custom"
+
+                    }
+                },
+                {
+                    "path": "order/order-payment",
+                    "style": {
+                        "navigationBarTitleText": "收银台",
+                        "navigationStyle": "custom"
+                    }
+                },
+                {
+                    "path": "order/search-order",
+                    "style": {
+                        "navigationBarTitleText": "订单搜索"
+                    }
+                },
+                {
+                    "path": "order/order-logistics",
+                    "style": {
+                        "navigationBarTitleText": "物流信息"
+                    }
+                },
+                {
+                    "path": "activity/activity",
+                    "style": {
+                        "navigationBarTitleText": "活动详情",
+                        "enablePullDownRefresh": true,
+                        "backgroundColor": "#ff457b",
+                        "backgroundTextStyle": "light",
+                        "onReachBottomDistance": 50
+                    }
+                },
+                {
+                    "path": "activity/activity-list",
+                    "style": {
+                        "navigationBarTitleText": "活动专区",
+                        "enablePullDownRefresh": true,
+                        "onReachBottomDistance": 50
+                    }
+                },
+                {
+                    "path": "activity/coupon-find-list",
+                    "style": {
+                        "navigationBarTitleText": "领券中心"
+                    }
+                },
+                {
+                    "path": "activity/coupon-list",
+                    "style": {
+                        "navigationBarTitleText": "优惠券"
+                    }
                 }
-            }
-        ]
-    }],
+            ]
+        }
+    ],
 
     "tabBar": {
         "height": "80",

+ 2 - 2
pages/goods/cart.vue

@@ -140,7 +140,7 @@ import {
     findCouponBySelected,
     canUseCoupon,
     getCountPrice,
-    couponSort
+    couponSort,
 } from '@/common/couponUtil.js'
 
 import { mapGetters, mapActions, mapMutations } from 'vuex'
@@ -362,7 +362,7 @@ export default {
             this.goodsList.forEach(shop => shop.productList.forEach(product => productIds.push(product.productId)))
             this.CouponService.GetCouponByProductIds({ userId: this.userId, productIds: productIds.join(',') }).then(
                 res => {
-                    this.receiveCouponList = res.data.receiveCouponList
+                    this.receiveCouponList = res.data.receiveCouponList // 去掉重复的已领取优惠券
                     this.ableCouponList = res.data.ableCouponList
                     this.resetCouponUtil()
                 }

+ 59 - 23
pages/login/login.vue

@@ -44,13 +44,18 @@
         >
             登录
         </button>
+        <cm-loading text="登录中..." :visible="isLogin"></cm-loading>
     </view>
 </template>
 
 <script>
 import authorize from '@/common/authorize.js'
-import { mapGetters, mapActions  } from 'vuex'
+import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
+import { mapGetters, mapActions } from 'vuex'
 export default {
+    components: {
+        CmLoading
+    },
     data() {
         return {
             invitationCode: '', //获取用户登录的邀请码
@@ -68,22 +73,34 @@ export default {
             isMobileDisabled: true, //获取手机短信按钮
             mobileCodeText: '获取验证码',
             codeTime: null,
-            isLoginStatus: false
+            isLogin: false,
+            hasProfile: false
         }
     },
     onLoad() {
-        if(this.hasLogin) return this.$api.switchTabTo('/pages/tabBar/index/index')
+        if (this.hasLogin) return this.$api.switchTabTo('/pages/tabBar/index/index')
+    },
+    created() {
+        this.loginInit()
     },
-    computed:{
+    computed: {
         ...mapGetters(['hasLogin'])
     },
     methods: {
         ...mapActions('user', ['customLogin']),
+        // 初始化登录状态
+        loginInit() {
+            const userInfo = uni.getStorageSync('userInfo')
+            if (userInfo) {
+                this.hasProfile = true
+                this.params.nickName = userInfo.nickName
+                this.params.headImgUrl = userInfo.avatarUrl
+            } else {
+                this.hasProfile = false
+            }
+        },
         // 登录
         SubMitLogins() {
-            if (this.isLoginStatus) {
-                return
-            }
             if (!this.params.mobile) {
                 this.$util.msg('请输入手机号', 2000)
                 return
@@ -97,26 +114,45 @@ export default {
                 return
             }
             this.params.openId = uni.getStorageSync('openId')
-            this.GetUserProfile()
+            // 直接登录  /  授权再登录
+            this.hasProfile ? this.LoginGetUser() : this.ProfileAndLogin()
         },
+        // 获取用户信息
         GetUserProfile() {
-            const self = this
-            wx.getUserProfile({
-                desc: '呵呵商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
-                success(res) {
-                    self.params.nickName = res.userInfo.nickName
-                    self.params.headImgUrl = res.userInfo.avatarUrl
-                    self.isLoginStatus = true
-                    self.LoginGetUser()
-                },
-                fail() {
-                    self.$util.msg('授权失败', 2000)
-                }
+            return new Promise((resolve, reject) => {
+                wx.getUserProfile({
+                    desc: '呵呵商城小程序获取您的信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+                    success: res => {
+                        this.params.nickName = res.userInfo.nickName
+                        this.params.headImgUrl = res.userInfo.avatarUrl
+                        this.hasProfile = true
+                        // 缓存用户信息
+                        uni.setStorageSync('userInfo', res.userInfo)
+                        resolve()
+                    },
+                    fail: () => {
+                        this.$util.msg('授权失败', 2000)
+                        this.hasProfile = false
+                        reject()
+                    }
+                })
             })
         },
-        LoginGetUser() {
-            this.customLogin(this.params)
-            this.isLoginStatus = false
+        // 授权并且登录
+        ProfileAndLogin() {
+            this.GetUserProfile().then(() => {
+                this.LoginGetUser()
+            })
+        },
+        // 登录
+        async LoginGetUser() {
+            try {
+                this.isLogin = true
+                await this.customLogin(this.params)
+                this.isLogin = false
+            } catch (e) {
+                this.isLogin = false
+            }
         },
         GetMobileCodeFn() {
             //获取手机验证码

+ 7 - 6
pages/tabBar/index/index.vue

@@ -94,7 +94,13 @@ export default {
         setTimeout(() => {
             this.init()
         }, 1000)
-    }, 
+    },
+    onShow() {
+        if (this.hasLogin) {
+            this.getCartNumber()
+            this.getCouponActivity()
+        }
+    },
     computed: {
         ...mapGetters(['hasLogin', 'activePopupType', 'userId', 'otherCouponFlag', 'showCouponPopup']),
         couponActivityIcon() {
@@ -194,11 +200,6 @@ export default {
             path: `pages/tabBar/index/index?state_str=${state_str}`,
             imageUrl: 'https://static.caimei365.com/app/mini-hehe/icon/icon-index-share.jpg'
         }
-    },
-    onShow() {
-        if (this.hasLogin) {
-            this.getCartNumber()
-        }
     }
 }
 </script>

+ 2 - 0
pages/user/activity/coupon-find-list.vue

@@ -113,6 +113,7 @@ export default {
         },
         // 操作优惠券
         couponClick() {
+            this.listQuery.pageNum = 1
             this.getCouponList()
         }
     },
@@ -138,6 +139,7 @@ $grid: 24rpx;
     box-sizing: border-box;
     padding-top: $tip-height;
     background: #f7f7f7;
+    overflow: hidden;
 }
 .top-tip {
     position: fixed;

+ 8 - 7
pages/user/order/create-order.vue

@@ -60,7 +60,7 @@ import goodsList from '@/components/cm-module/createOrder/goodsList'
 import sellerFreight from '@/components/cm-module/createOrder/sellerFreight'
 import CmCouponList from '@/components/cm-module/cm-coupon-list/cm-coupon-list'
 import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
-import { allProdoceUseCheck, someProductUseCheck, couponSort } from '@/common/couponUtil.js'
+import { allProdoceUseCheck, someProductUseCheck, couponSort, setCouponUniqueId } from '@/common/couponUtil.js'
 import { mapGetters } from 'vuex'
 import wechatPay from '@/mixins/wechatPay.js'
 export default {
@@ -159,7 +159,7 @@ export default {
         // 获取可用优惠券
         fetchCouponList() {
             this.CouponService.GetCouponByProductIds({ userId: this.userId, productIds: this.productIds }).then(res => {
-                this.receiveCouponList = res.data.receiveCouponList
+                this.receiveCouponList = setCouponUniqueId(res.data.receiveCouponList) // 去掉重复的优惠券
                 this.filterCouponList()
             })
         },
@@ -185,7 +185,7 @@ export default {
             this.receiveCouponList = [...couponSort(this.canUseCouponList), ...couponSort(this.notUseCouponList)]
             // 当有可用优惠券时 默认选取第一个最优惠的
             if (this.canUseCouponList.length > 0) {
-                this.currentCouponId = this.receiveCouponList[0].couponId
+                this.currentCouponId = this.receiveCouponList[0].uniqueId
                 this.currentCoupon = this.receiveCouponList[0]
             }
             // 显示界面
@@ -197,7 +197,7 @@ export default {
             // 3将当前选中的优惠券放入最前面
             // 4返回最新的优惠券列表
             // 查找选中优惠券的索引
-            const index = this.canUseCouponList.findIndex(coupon => coupon.couponId === this.currentCouponId)
+            const index = this.canUseCouponList.findIndex(coupon => coupon.uniqueId === this.currentCouponId)
             // 从列表中删除
             const currentCoupon = this.canUseCouponList.splice(index, 1)
             // 重新排序 将选中的优惠券放到最前面
@@ -214,7 +214,7 @@ export default {
         chooseCoupon(coupon) {
             if (coupon.couponId > -1) {
                 this.currentCoupon = coupon
-                this.currentCouponId = coupon.couponId
+                this.currentCouponId = coupon.uniqueId
             } else {
                 this.currentCoupon = null
                 this.currentCouponId = -1
@@ -258,7 +258,8 @@ export default {
             if (this.isSubLoading) return
             if (this.subParams.addressId == '') return this.$util.msg('请先添加收货地址~', 2000)
             // 选中的优惠券id
-            this.subParams.couponId = this.currentCouponId === -1 ? '' : this.currentCouponId
+            this.subParams.couponId = this.currentCouponId === -1 ? '' : this.currentCoupon.couponId
+            this.subParams.couponShareId = this.currentCoupon ? this.currentCoupon.couponShareId : null
             this.subParams.payInfo.orderShouldPayFee = this.payAllPrice
             // 处理商品信息及留言
             this.subParams.orderInfo = this.goodsData.map(el => {
@@ -278,7 +279,7 @@ export default {
                 .then(response => {
                     const data = response.data
                     this.orderInfo = response.data
-                    if (data.payableAmount === '0') {
+                    if (parseFloat(data.payableAmount) === 0) {
                         uni.setStorageSync('orderInfo', this.hanldOrder.order)
                         uni.redirectTo({ url: '/pages/user/order/success' })
                     } else {

+ 1 - 1
services/config.env.js

@@ -4,7 +4,7 @@ if (process.env.NODE_ENV === 'development') {
     // URL_CONFIG = 'http://192.168.2.75:8011'	 //采美测试地址
     // URL_CONFIG = 'http://192.168.2.67:8011'	 //裴裴联调地址
     // URL_CONFIG = 'http://192.168.2.68:8011'	 //涛涛联调地址
-    // URL_CONFIG = 'http://127.0.0.1:8011'	 //涛涛联调地址
+    // URL_CONFIG = 'http://127.0.0.1:8011'	 //本地联调地址
     URL_CONFIG = 'https://mall2c-b.caimei365.com'
     // URL_CONFIG = 'https://mall2c.caimei365.com'
 } else {

+ 11 - 8
store/modules/coupon.js

@@ -3,6 +3,7 @@
  */
 import { couponService } from '@/services/index.js'
 import { msg as showMsg } from '@/common/util.js'
+let timer = null
 
 const state = {
     showCouponPopup: true, // 是否显示优惠券入口弹窗
@@ -34,8 +35,8 @@ const mutations = {
 }
 const actions = {
     // 领取优惠券
-    receiveCoupon({ rootGetters, dispatch }, couponId) {
-        return couponService.ReceiveCoupon({ couponId, userId: rootGetters.userId }).then(res => {
+    receiveCoupon({ rootGetters, dispatch }, { couponId, couponShareId }) {
+        return couponService.ReceiveCoupon({ couponId, couponShareId, userId: rootGetters.userId }).then(res => {
             dispatch('initReceiveCouponCount')
             showMsg('领取成功', 1500, false, 'success')
         }).catch(error => {
@@ -50,10 +51,12 @@ const actions = {
     },
     // 优惠券活动弹窗信息
     getCouponActivity({ commit, rootGetters, state, dispatch }) {
+        // clearTimeout(timer)
         couponService.CouponActivityPopup({
             userId: rootGetters.userId
         }).then(response => {
             const { newUserCouponFlag, actCouponFlag, otherCouponFlag } = response.data
+            // debugger
             // 全部用户弹窗
             if (actCouponFlag !== 0) {
                 commit('updatePopupType', 1)
@@ -67,12 +70,12 @@ const actions = {
             setTimeout(() => {
                 commit('setOtherCouponFlag', false)
             }, 5000)
-            // 每次10分钟刷新一次 
-            if (rootGetters.hasLogin) {
-                setTimeout(() => {
-                    dispatch('getCouponActivity')
-                }, 5 * 60 * 1000)
-            }
+            // 每次5分钟刷新一次  10 * 1000 5 * 60 * 1000
+            // if (rootGetters.hasLogin) {
+            //     timer = setTimeout(() => {
+            //         dispatch('getCouponActivity')
+            //     }, 5 * 60 * 1000)
+            // }
         })
     }
 }

+ 1 - 1
store/modules/user.js

@@ -59,7 +59,7 @@ const actions = {
     // 手机号注册登录
     customLogin({ commit, state, dispatch }, params) {
         params.shareUserId = state.inviteUserId
-        userService.UserMobileLogin(params)
+        return userService.UserMobileLogin(params)
             .then(response => {
                 // 保存用户信息
                 commit('LOGIN', response.data)