Parcourir la source

颜选美学v1.3版本bug修改

yuwenjun1997 il y a 2 ans
Parent
commit
01a21dcc89
31 fichiers modifiés avec 168 ajouts et 113 suppressions
  1. 1 0
      App.vue
  2. 0 1
      common/uniapp.api.js
  3. 2 2
      components/thorui/tui-scroll-top/tui-scroll-top.vue
  4. 1 1
      components/views/cm-banner/cm-banner.vue
  5. 1 1
      components/views/cm-coupon-area/cm-coupon-area.vue
  6. 1 0
      components/views/cm-floor-template/cm-floor-template.vue
  7. 1 0
      components/views/cm-product/cm-product.vue
  8. 2 2
      components/views/cm-search/cm-search.vue
  9. 5 1
      components/views/cm-share-popup/cm-share-popup.vue
  10. 8 26
      pages/index/index.vue
  11. 3 1
      pages/tabBar/cart/cart.vue
  12. 2 1
      pages/tabBar/category/category.vue
  13. 51 17
      pages/tabBar/home/home.vue
  14. 1 0
      pages/views/coupon/components/coupon-desc-entry/coupon-desc-entry.vue
  15. 5 2
      pages/views/coupon/coupon-description.vue
  16. 2 2
      pages/views/coupon/coupon-receive.vue
  17. 11 3
      pages/views/goods/components/goods-price/goods-price.vue
  18. 6 2
      pages/views/goods/components/goods-receive-buy-popup/goods-receive-buy-popup.vue
  19. 30 18
      pages/views/goods/goods-detail.vue
  20. 5 0
      pages/views/goods/goods-list.vue
  21. 2 2
      pages/views/order/mixins/orderList.js
  22. 2 2
      pages/views/order/order-logistics.vue
  23. 0 1
      pages/views/order/pay-faild.vue
  24. 8 4
      pages/views/order/pay-success.vue
  25. 1 0
      services/config.env.js
  26. BIN
      static/components/scroll-top/icon_share_3x.png
  27. BIN
      static/components/scroll-top/icon_top_3x.png
  28. 4 4
      store/modules/cart.js
  29. 4 1
      store/modules/coupon.js
  30. 0 12
      store/modules/notify.js
  31. 9 7
      store/modules/user.js

+ 1 - 0
App.vue

@@ -16,6 +16,7 @@ export default {
                 }
             })
         })
+        
         this.$store.dispatch('app/initDevice')
     }
 }

+ 0 - 1
common/uniapp.api.js

@@ -8,7 +8,6 @@ export function toast(options) {
 toast.prototype.success = (message) => toast({ icon: 'success', title: message })
 toast.prototype.error = (message) => toast({ icon: 'error', title: message })
 
-
 const install = (Vue, options = {}) => {
 
     const prefix = options.prefix || '/pages/views/'

+ 2 - 2
components/thorui/tui-scroll-top/tui-scroll-top.vue

@@ -12,7 +12,7 @@
 		</view>
 		<view class="tui-scroll-top_item" :class="{ 'tui-scroll-item_top': isIndex || isShare }" v-show="visible && toggle" @tap.stop="goTop">
 			<image class="tui-scroll-top_img" :src="topIcon"></image>
-			<view class="tui-scroll-top_text tui-color-white">顶部</view>
+			<view class="tui-scroll-top_text tui-color-white"></view>
 		</view>
 	</view>
 </template>
@@ -142,7 +142,7 @@ export default {
 }
 
 .tui-scroll-item_top {
-	margin-top: 30rpx;
+	margin-top: 20rpx;
 }
 
 .tui-scroll-top_img {

+ 1 - 1
components/views/cm-banner/cm-banner.vue

@@ -1,5 +1,5 @@
 <template>
-    <view class="banner">
+    <view class="banner" v-if="list.length > 0">
         <uni-swiper-dot :info="list" :current="current" mode="dot" :dotsStyles="dotsStyles">
             <swiper
                 :indicator-dots="false"

+ 1 - 1
components/views/cm-coupon-area/cm-coupon-area.vue

@@ -60,7 +60,7 @@ export default {
             this.$emit('click', coupon)
         },
         onCouponTipClick(item) {
-            this.$router.navigateTo('coupon/coupon-description?entryType=' + item.id)
+            this.$router.navigateTo(`coupon/coupon-description?entryType=${item.id}&title=${item.name}`)
         }
     }
 }

+ 1 - 0
components/views/cm-floor-template/cm-floor-template.vue

@@ -25,6 +25,7 @@
                     :rows="swiperRows"
                     :gapX="16"
                     :gapY="16"
+                    :autoFill="true"
                     padding="0 8rpx"
                     :autoplay="false"
                 >

+ 1 - 0
components/views/cm-product/cm-product.vue

@@ -108,6 +108,7 @@ $grid: 16rpx;
         font-size: 26rpx;
         line-height: 35rpx;
         text-align: justify;
+        word-break: break-all;
         color: #333333;
         @include ellipsis(2);
     }

+ 2 - 2
components/views/cm-search/cm-search.vue

@@ -8,9 +8,9 @@
                     confirm-type="search"
                     :placeholder="placeholder"
                     :value="value"
-                    @input="e => $emit('input', e.target.value)"
+                    @input="$emit('input', $event.target.value)"
                     @focus="$emit('focus')"
-                    @confirm="handleSearch"
+                    @confirm="handleSearch(value)"
                 />
                 <text v-if="clearable && value" class="clearable iconfont icon-quxiao" @click="clearValue"></text>
             </view>

+ 5 - 1
components/views/cm-share-popup/cm-share-popup.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="share-popup">
         <!-- 弹窗 -->
-        <uni-popup ref="sharePopup" type="bottom" @change="popupChange">
+        <uni-popup ref="sharePopup" type="bottom" @change="popupChange" :safe-area="safeArea">
             <view class="popup-content">
                 <view class="title" v-if="title" v-text="title"></view>
                 <view class="content">
@@ -55,6 +55,10 @@ export default {
             validator: value => {
                 return ['product', 'normal', 'activity'].indexOf(value) > -1
             }
+        },
+        safeArea: {
+            type: Boolean,
+            default: true
         }
     },
     data() {

+ 8 - 26
pages/index/index.vue

@@ -3,7 +3,7 @@
 </template>
 
 <script>
-import { mapActions, mapMutations } from 'vuex'
+import { mapActions } from 'vuex'
 import shareEntry from './mixins/share-entry.js'
 
 // 页面初始化
@@ -18,38 +18,20 @@ export default {
     onLoad(options) {
         this.scene = options.scene
         this.state_str = options.state_str
-        this.initUserInfo()
+    },
+    onShow() {
+        this.init()
     },
     methods: {
-        // ...mapMutations('user', ['SET_USER_INFO']),
-        ...mapActions('user', ['wxAutoLogin', 'getAccessToken']),
-        ...mapActions('coupon', ['initCouponCount']),
-        ...mapActions('cart', ['fetchCartKindCount']),
+        ...mapActions('user', ['wxAutoLogin']),
 
         // 初始化页面数据
-        initPageData() {
-            this.getAccessToken()
-            this.initCouponCount()
-            this.fetchCartKindCount()
-        },
-
-        // 初始化用户信息
-        async initUserInfo() {
+        async init() {
             try {
-                // const user = this.$getStorage('USER_INFO')
-                // if (user) {
-                //     // 用户已登录
-                //     this.SET_USER_INFO(user)
-                // } else {
-                //     // 微信登录
-                //     await this.wxAutoLogin()
-                // }
                 await this.wxAutoLogin()
             } catch (e) {
                 console.log('初始化用户信息时出现了错误')
-                console.log(e)
             } finally {
-                this.initPageData()
                 this.redirectToEntry()
             }
         },
@@ -57,12 +39,12 @@ export default {
         // 跳转入口页面
         redirectToEntry() {
             if (this.scene) {
-                // 处理分享信息
+                // 处理分享信息 二维码
                 this.shareHandle(this.scene, 'scene')
             } else if (this.state_str) {
                 this.shareHandle(this.state_str, 'state_str')
             } else {
-                // 默认调整首页
+                // 默认跳转首页
                 this.$router.switchTab('home')
             }
         }

+ 3 - 1
pages/tabBar/cart/cart.vue

@@ -106,6 +106,7 @@ import {
 
 const resetData = () => ({
     isRequest: true,
+    tabLoading: false,
     isDeleted: false,
     expiredProducts: [], // 失效商品列表
     shopList: [], // 供应商&&商品列表
@@ -166,6 +167,7 @@ export default {
         this.resetData()
         this.fetchCartInfo()
     },
+    
     onShow() {
         this.resetData()
         this.fetchCartInfo()
@@ -173,7 +175,7 @@ export default {
     },
     methods: {
         ...mapActions('cart', ['removeFromCart', 'fetchCartKindCount']),
-
+        
         // 初始化数据
         resetData() {
             const data = resetData()

+ 2 - 1
pages/tabBar/category/category.vue

@@ -80,7 +80,8 @@ export default {
         toGoodsFloor(item) {
             this.$setStorage('NAVBAR', {
                 type: 'second',
-                id: item.smallTypeId
+                id: item.smallTypeId,
+                title: item.name
             })
             this.$router.navigateTo('goods/goods-list')
         }

+ 51 - 17
pages/tabBar/home/home.vue

@@ -48,6 +48,18 @@
 
         <!-- 优惠券活动弹窗 -->
         <cm-active-alert></cm-active-alert>
+
+        <!-- 返回顶部 -->
+        <tui-scroll-top
+            :scrollTop="scrollTop"
+            :isShare="true"
+            :bottom="60"
+            :customShare="true"
+            @share="onShare"
+        ></tui-scroll-top>
+
+        <!-- 分享弹窗 -->
+        <cm-share-popup ref="sharePopup" :data="posterData" type="normal" :safeArea="false"></cm-share-popup>
     </view>
 </template>
 
@@ -57,6 +69,7 @@ import { fetchCouponDisplay } from '@/services/api/coupon.js'
 import { fetchProductFloorList } from '@/services/api/goods.js'
 import { shareDataResult } from '@/common/share.helper.js'
 import { mapActions, mapGetters } from 'vuex'
+import { queryStringify } from '@/common/utils.js'
 
 export default {
     data() {
@@ -67,27 +80,39 @@ export default {
             floorInfo: {},
             floorList: [],
             couponList: [],
+            hasCouponWillReceive: false,
             current: 0,
             isRefresh: false,
-            couponTipStr: ''
+            couponTipStr: '',
+            scrollTop: 0,
+            posterData: {}
         }
     },
     computed: {
-        ...mapGetters(['userId', 'accessToken']),
+        ...mapGetters(['userId']),
         bannerList() {
             return this.bannerData.map(item => item.image)
         }
     },
+    onPageScroll(e) {
+        this.scrollTop = e.scrollTop
+    },
     onPullDownRefresh() {
         this.initHomeInfo()
     },
     onShareAppMessage() {
-        const shareData = { type: 0, inviteUserId: this.userId }
-        return shareDataResult(shareData)
+        // 加密
+        const state_str = encodeURIComponent(this.$crypto.encrypt({ type: 0 }))
+        return {
+            title: '护肤上颜选,正品有好货~',
+            path: `/pages/index/index?state_str=${state_str}`,
+            imageUrl: this.staticUrl + 'icon-share.png'
+        }
     },
     onShow() {
+        this.checkCouponAlert()
         this.fetchCartKindCount() // 购物车商品数量
-        this.checkCouponAlert() // 优惠券弹窗
+        this.fetchCouponList()
     },
     onLoad() {
         this.initHomeInfo()
@@ -96,6 +121,14 @@ export default {
         ...mapActions('cart', ['fetchCartKindCount']),
         ...mapActions('coupon', ['checkCouponAlert']),
 
+        // 初始化首页信息
+        initHomeInfo() {
+            this.fetchCarousel()
+            this.fetchNavbar()
+            this.fetchFloorData()
+            this.fetchCouponList()
+        },
+
         // 搜索
         handleToSearch() {
             this.$router.navigateTo('goods/goods-search')
@@ -103,7 +136,7 @@ export default {
 
         // 金刚区菜单导航
         onNavbarClick(navbar) {
-            this.$setStorage('NAVBAR', { type: 'navbar', id: navbar.id })
+            this.$setStorage('NAVBAR', { type: 'navbar', id: navbar.id, title: navbar.name })
             this.$router.navigateTo('goods/goods-list')
         },
 
@@ -131,7 +164,7 @@ export default {
 
         // 更多商品
         onMoreProduct(floor) {
-            this.$setStorage('NAVBAR', { type: 'floor', id: floor.id })
+            this.$setStorage('NAVBAR', { type: 'floor', id: floor.id, title: floor.title })
             this.$router.navigateTo('goods/goods-list')
         },
 
@@ -140,14 +173,6 @@ export default {
             this.$router.navigateTo('others/join-us')
         },
 
-        // 初始化首页信息
-        initHomeInfo() {
-            this.fetchCarousel()
-            this.fetchNavbar()
-            this.fetchFloorData()
-            this.fetchCouponList()
-        },
-
         // 轮播图跳转
         onSwiperClick(index) {
             const link = this.bannerData[index].link
@@ -193,8 +218,9 @@ export default {
         // 获取优惠券列表
         async fetchCouponList() {
             try {
-                this.fetchCouponDisplay() // 获取可领取优惠券类型
+                await this.fetchCouponDisplay() // 获取可领取优惠券类型
                 const resultCouponData = await fetchHomeCouponList({ userId: this.userId })
+                this.hasCouponWillReceive = resultCouponData.data && resultCouponData.data.length > 0
                 this.couponList = [
                     ...resultCouponData.data.map(item => {
                         item.controlType = 'receive'
@@ -212,8 +238,10 @@ export default {
             try {
                 const res = await fetchCouponDisplay({ userId: this.userId })
                 this.couponTipStr = res.data
+                return res
             } catch (e) {
                 console.log('获取优惠券类型失败')
+                return e
             }
         },
 
@@ -236,7 +264,13 @@ export default {
                     name: '分享券福利'
                 }
             ]
-            return result.filter(item => this.couponTipStr.indexOf(item.id.toString()) > -1)
+            return result.filter(item => this.userId > 0 && this.couponTipStr.indexOf(item.id.toString()) > -1)
+        },
+
+        // 分享
+        onShare() {
+            this.posterData = { query: queryStringify({ type: 0 }) }
+            this.$refs.sharePopup.open()
         }
     }
 }

+ 1 - 0
pages/views/coupon/components/coupon-desc-entry/coupon-desc-entry.vue

@@ -22,6 +22,7 @@ export default {
             default: ''
         }
     },
+
     computed: {
         entryList() {
             const result = [

+ 5 - 2
pages/views/coupon/coupon-description.vue

@@ -24,6 +24,9 @@ export default {
     },
     onLoad(options) {
         this.entryType = options.entryType
+        uni.setNavigationBarTitle({
+            title: options.title
+        })
     }
 }
 </script>
@@ -127,13 +130,13 @@ $bg-coupon-desc-03: url('https://static.caimei365.com/app/mini-hehe/icon/bg-coup
         background: linear-gradient(180deg, #ffd1d1 0%, rgba(255, 255, 255, 0) 100%) no-repeat;
 
         .title {
-            color: #FF445E;
+            color: #ff445e;
         }
 
         .description {
             height: 611rpx;
             background-image: $bg-coupon-desc-03;
-            
+
             .tip {
                 margin-top: 126rpx;
                 color: #765334;

+ 2 - 2
pages/views/coupon/coupon-receive.vue

@@ -20,7 +20,7 @@
         <!-- 占位 -->
         <view style="height: 140rpx;"></view>
         <!-- 我的优惠券 -->
-        <view class="control">
+        <view class="control" v-if="userId > 0">
             <tui-button
                 class="create"
                 type="base"
@@ -114,7 +114,7 @@ export default {
 
         // 查看描述详情
         toDescDetail(entry) {
-            this.$router.navigateTo('coupon/coupon-description?entryType=' + entry.id)
+            this.$router.navigateTo(`coupon/coupon-description?entryType=${entry.id}&title=${entry.name}`)
         },
         // 我的优惠券
         userCouponCenter() {

+ 11 - 3
pages/views/goods/components/goods-price/goods-price.vue

@@ -3,11 +3,15 @@
         <view class="row">
             <view class="price">
                 <text class="amount">{{ productData.price | priceFormat }}</text>
-                <text class="delete" v-if="priceType !== 'normal' && productData.normalPrice">{{ productData.normalPrice | priceFormat }}</text>
+                <text class="delete" v-if="priceType !== 'normal' && productData.normalPrice">
+                    {{ productData.normalPrice | priceFormat }}
+                </text>
             </view>
             <view class="price-tags">
                 <template v-if="priceType !== 'normal'">
-                    <view class="tag-pt" v-if="priceType === 'group'">拼团价</view>
+                    <view class="tag-pt" v-if="priceType === 'group'">
+                        <text v-if="collageInfo">{{ collageInfo.memberNum }}人拼团</text>
+                    </view>
                     <view class="tag-hd" v-else-if="priceType === 'activity'">活动价</view>
                     <view class="tag-xs" v-else>限时特价</view>
                 </template>
@@ -72,7 +76,11 @@ export default {
         },
         // 有可使用优惠券
         hasCouponPrice() {
-            return this.productData.couponStatus > 0
+            return this.productData.couponStatus === 1
+        },
+        // 商品拼团信息
+        collageInfo() {
+            return this.productData?.collageProduct
         }
     },
     watch: {

+ 6 - 2
pages/views/goods/components/goods-receive-buy-popup/goods-receive-buy-popup.vue

@@ -27,7 +27,7 @@
                             <view class="amount">{{ productPrice | priceFormat }}</view>
                         </view>
                         <!-- 券后价 -->
-                        <view class="row" v-if="productData.couponStatus > 0">
+                        <view class="row" v-if="productData.couponStatus === 1">
                             <view class="tag-qh">券后价¥{{ productData.couponPrice | priceFormat }}</view>
                         </view>
                     </view>
@@ -35,7 +35,7 @@
                 <view class="tip">
                     <template v-if="productData.couponStatus > 0">
                         当前商品可使用
-                        <text v-text="currentCoupon.couponTitle"></text>
+                        <text v-text="couponTip"></text>
                         优惠券
                     </template>
                 </view>
@@ -61,6 +61,10 @@ export default {
             type: Object,
             default: () => null
         },
+        couponTip: {
+            type: String,
+            default: ''
+        },
         navbarType: {
             type: String,
             default: 'buy'

+ 30 - 18
pages/views/goods/goods-detail.vue

@@ -9,7 +9,12 @@
         <view id="anchor-0" class="anchor"></view>
 
         <!-- 轮播 -->
-        <goods-image-swiper :list="imageList" @click="onSwiperClick" @change="onSwiperChange"></goods-image-swiper>
+        <goods-image-swiper
+            :list="imageList"
+            @click="onSwiperClick"
+            @change="onSwiperChange"
+            :current="current"
+        ></goods-image-swiper>
         <!-- 价格 -->
         <goods-price :productData="productInfo"></goods-price>
 
@@ -89,7 +94,7 @@
         <goods-receive-buy-popup
             ref="receiveBuyPopup"
             :productData="productInfo"
-            :currentCoupon="currentCoupon"
+            :couponTip="couponTip"
             :navbarType="navbarTypeFlag"
             @detail="$refs.activitypPopup.open()"
             @submit="onSubmit"
@@ -128,6 +133,7 @@ export default {
             productId: '',
             // 轮播图
             currentTab: 0,
+            current: 0,
             leftButton: {},
             rightButton: {},
             // 锚点列表
@@ -161,8 +167,8 @@ export default {
             return this.generateNavbarType()
         },
         // 当前商品默认可以使的优惠券
-        currentCoupon() {
-            return this.couponList.find(coupon => coupon.couponId === this.productInfo.couponId)
+        couponTip() {
+            return this.productInfo?.couponInfo?.split('|')[1]
         }
     },
     onPageScroll(e) {
@@ -364,23 +370,29 @@ export default {
         // 生成导航菜单类型
         generateNavbarType() {
             const { couponStatus = 0, collageStatus = 0, activeStatus = 0, discountStatus = 0 } = this.productInfo
-            if ((activeStatus > 0 || discountStatus > 0) && couponStatus > 0) {
-                // (限时活动 / 活动价) + 优惠券
-                return 'activityWithCoupon'
-            } else if (collageStatus > 0) {
-                if (couponStatus > 0) {
-                    // 拼团 + 优惠券
-                    return 'groupWithCoupon'
+
+            // 拼团价
+            if (collageStatus > 0) {
+                if (couponStatus === 1) {
+                    return 'groupWithCoupon' // 拼团券后价
                 } else {
-                    // 仅拼团
-                    return 'group'
+                    return 'group' // 拼团价
                 }
-            } else {
-                if (couponStatus > 0) {
-                    return 'normalWithCoupon'
+            }
+            // 限时活动
+            else if (discountStatus > 0 || activeStatus > 0) {
+                if (couponStatus === 1) {
+                    return 'activityWithCoupon' // 券后价
+                } else {
+                    return 'normal' // 限时活动价格
+                }
+            }
+            // 无活动价
+            else {
+                if (couponStatus === 1) {
+                    return 'normalWithCoupon' // 普通券后价
                 } else {
-                    // 无优惠券
-                    return 'normal'
+                    return 'normal' // 普通价
                 }
             }
         },

+ 5 - 0
pages/views/goods/goods-list.vue

@@ -93,6 +93,11 @@ export default {
         initQueryList() {
             this.listQuery.userId = this.userId
             this.navInfo = this.$getStorage('NAVBAR')
+
+            if (this.navInfo.title) {
+                uni.setNavigationBarTitle({ title: this.navInfo.title })
+            }
+
             if (this.navInfo.type === 'navbar') {
                 // 从金刚区菜单进入
                 this.listQuery.homeTypeId = this.navInfo.id

+ 2 - 2
pages/views/order/mixins/orderList.js

@@ -27,8 +27,8 @@ const orderList = {
                     this.handleShare()
                     break
                 case 'query':
-                    console.log('订单详情')
-                    this.$router.navigateTo('order/order-detail?orderId=' + order.orderId)
+                    console.log('查看物流')
+                    this.$router.navigateTo('order/order-logistics?orderId=' + order.orderId)
                     break
                 case 'fightDetail':
                     this.$router.navigateTo('share-buy/share-buy-detail?collageId=' + order.collageId)

+ 2 - 2
pages/views/order/order-logistics.vue

@@ -90,7 +90,7 @@
 </template>
 
 <script>
-import thorui from '@/components/common/tui-clipboard/clipboard.min.js'
+import thorui from '@/components/common/tui-clipboard/tui-clipboard.js'
 import { fetchLogisticsDetail } from '@/services/api/order.js'
 export default {
     data() {
@@ -125,7 +125,7 @@ export default {
         },
         async getData() {
             try {
-                const { data: resData } = fetchLogisticsDetail({ orderId: this.orderId })
+                const { data: resData } = await fetchLogisticsDetail({ orderId: this.orderId })
                 // 添加订单列表信息
                 let orderListArr = []
                 resData.forEach((item, index) => {

+ 0 - 1
pages/views/order/pay-faild.vue

@@ -47,7 +47,6 @@ export default {
         }
     },
     beforeDestroy() {
-        uni.removeStorageSync('PAY_ORDER_INFO')
         this.$off('orderPaySuccess')
     },
     onLoad() {

+ 8 - 4
pages/views/order/pay-success.vue

@@ -37,8 +37,8 @@
             >
                 查看订单
             </tui-button>
-            <view class="share" v-if="canShare" @click="onShare">
-                <text class="btn-tip">分享后可获得优惠券领取资格</text>
+            <view class="share">
+                <view v-if="canShare" @click="onShare"><text class="btn-tip">分享后可获得优惠券领取资格</text></view>
             </view>
         </view>
 
@@ -49,7 +49,7 @@
 
 <script>
 import { fetchCouponDisplay } from '@/services/api/coupon.js'
-import { orderShare } from '@/services/api/order.js'
+import { orderShare, fetchOrderDetail } from '@/services/api/order.js'
 import { queryStringify } from '@/common/utils.js'
 import { mapGetters } from 'vuex'
 export default {
@@ -77,6 +77,7 @@ export default {
     onLoad() {
         this.orderInfo = uni.getStorageSync('PAY_ORDER_INFO')
         this.getOrderDetail()
+        this.fetchCouponDisplay()
     },
     onShareAppMessage() {
         // 加密
@@ -176,10 +177,13 @@ export default {
     .control {
         @extend .cm-flex-between;
         flex-direction: column;
-        height: 280rpx;
+        height: 310rpx;
         margin-top: 150rpx;
 
         .share {
+            height: 90rpx;
+            line-height: 90rpx;
+            text-align: center;
             color: #ff457b;
             .btn-tip {
                 font-size: 24rpx;

+ 1 - 0
services/config.env.js

@@ -7,4 +7,5 @@ if (process.env.NODE_ENV === 'development') {
 } else {
     // 生产环境
     APP_API_URI = 'https://mall2c.caimei365.com'
+    // APP_API_URI = 'https://mall2c-b.caimei365.com'
 }

BIN
static/components/scroll-top/icon_share_3x.png


BIN
static/components/scroll-top/icon_top_3x.png


+ 4 - 4
store/modules/cart.js

@@ -44,7 +44,7 @@ const actions = {
             dispatch('fetchCartKindCount')
             return res
         } catch (e) {
-            console.log(e)
+            return Promise.reject(e)
         }
     },
     // 获取购物车商品数量
@@ -55,7 +55,7 @@ const actions = {
             commit('SET_TABBAR_BADGE', res.data)
             return res
         } catch (e) {
-            console.log(e)
+            return Promise.reject(e)
         }
     },
     // 从购物车移除
@@ -66,7 +66,7 @@ const actions = {
             uni.showToast({ icon: 'success', title: '删除成功' })
             return res
         } catch (e) {
-            console.log(e)
+            return Promise.reject(e)
         }
     },
     // 加减购物车商品更新到后台
@@ -74,7 +74,7 @@ const actions = {
         try {
             return updateProductCount({ cartId, productCount })
         } catch (e) {
-            console.log(e)
+            return Promise.reject(e)
         }
     }
 }

+ 4 - 1
store/modules/coupon.js

@@ -49,6 +49,7 @@ const actions = {
             return res
         } catch (e) {
             console.log('领取优惠券失败')
+            return Promise.reject(e)
         }
     },
 
@@ -60,6 +61,7 @@ const actions = {
             return res
         } catch (e) {
             console.log('初始化已领取优惠券数量失败')
+            return Promise.reject(e)
         }
     },
 
@@ -84,7 +86,8 @@ const actions = {
                 }, 5000)
             }
         } catch (e) {
-            console.log('优惠券弹窗校验失败');
+            console.log('优惠券弹窗校验失败')
+            return Promise.reject(e)
         }
     }
 }

+ 0 - 12
store/modules/notify.js

@@ -1,12 +0,0 @@
-const state = {}
-
-const mutations = {}
-
-const actions = {}
-
-export default{
-	namespaced:true,
-	state,
-	mutations,
-	actions
-}

+ 9 - 7
store/modules/user.js

@@ -12,7 +12,7 @@ const state = {
     userId: 0,
     userIdentity: -1, // 用户类型
     inviteUserId: '', // 分享者用户ID
-    accessToken: '' // token
+    accessToken: '', // token
 }
 
 const mutations = {
@@ -29,15 +29,17 @@ const mutations = {
 
 const actions = {
     // 微信自动登录
-    async wxAutoLogin({ commit }) {
+    async wxAutoLogin({ commit, state, dispatch }) {
         try {
             const code = await wxLogin() // 获取微信code
             const res = await wechatAuthLogin({ code }) // 微信自动登录
             const data = JSON.parse(res.data)
             commit('SET_USER_INFO', data)
             setStorage('USER_INFO', data)
-            return Promise.resolve(data)
+            dispatch('getAccessToken') // 获取token
+            return res
         } catch (e) {
+            commit('SET_LOGIN_FLAG', false)
             return Promise.reject(e)
         }
     },
@@ -48,7 +50,7 @@ const actions = {
             const data = JSON.parse(res.data)
             commit('SET_USER_INFO', data)
             setStorage('USER_INFO', data)
-            return Promise.resolve(data)
+            return res
         } catch (e) {
             return Promise.reject(e)
         }
@@ -56,9 +58,9 @@ const actions = {
     // 获取accessToken
     async getAccessToken({ commit }) {
         try {
-            const { data } = await getAccessToken()
-            commit('SET_ACCESS_TOKEN', data)
-            return Promise.resolve(data)
+            const res = await getAccessToken()
+            commit('SET_ACCESS_TOKEN', res.data)
+            return res
         } catch (e) {
             return Promise.reject(e)
         }