喻文俊 hace 3 años
padre
commit
54c2c603ec

+ 4 - 2
App.vue

@@ -6,10 +6,12 @@ import Vue from 'vue'
 import { mapActions, mapMutations } from 'vuex'
 import { mapActions, mapMutations } from 'vuex'
 export default {
 export default {
     onLaunch: function() {
     onLaunch: function() {
+        console.log('清空本地缓存')
+        uni.clearStorageSync()
         this.initSystemInfo()
         this.initSystemInfo()
-        // 判断优惠券弹窗是否显示
-        this.checkShowCouponPopup()
         this.wechatlogin()
         this.wechatlogin()
+        // 判断优惠券弹窗是否显示
+        // this.checkShowCouponPopup()
     },
     },
     methods: {
     methods: {
         ...mapActions('app', ['setWindowHeight', 'setVariableFun']),
         ...mapActions('app', ['setWindowHeight', 'setVariableFun']),

+ 1 - 1
common/couponUtil.js

@@ -25,7 +25,7 @@ export function findCouponBySelected(ids, couponList) {
 
 
 // 判断可用优惠券是否满足使用条件
 // 判断可用优惠券是否满足使用条件
 export function canUseCoupon(current, productIds, canUseCouponList, selectedPoducts) {
 export function canUseCoupon(current, productIds, canUseCouponList, selectedPoducts) {
-    if (productIds.length <= 0) return -1
+    if (productIds.length <= 0 || canUseCouponList.length <= 0) return -1
     const len = canUseCouponList.length
     const len = canUseCouponList.length
     if (current >= len) return len
     if (current >= len) return len
     const currentCoupon = canUseCouponList[current]
     const currentCoupon = canUseCouponList[current]

+ 1 - 1
components/cm-module/cm-activity-info/cm-activity-info.vue

@@ -7,7 +7,7 @@
                 </view>
                 </view>
                 <view class="ladder-item" v-for="(ladd, index) in productInfo.ladderList" :key="index">
                 <view class="ladder-item" v-for="(ladd, index) in productInfo.ladderList" :key="index">
                     <view class="ladder-item-td">{{ ladd.buyNum }}</view>
                     <view class="ladder-item-td">{{ ladd.buyNum }}</view>
-                    <view class="ladder-item-td">{{ ladd.buyPrice | NumFormat }}</view>
+                    <view class="ladder-item-td">{{ ladd.buyPrice | priceFormat }}</view>
                 </view>
                 </view>
             </view>
             </view>
         </template>
         </template>

+ 3 - 3
components/cm-module/cm-cart-product/cm-cart-product.vue

@@ -44,11 +44,11 @@
                                         class="tag type2"
                                         class="tag type2"
                                         v-if="item.activeStatus == 1"
                                         v-if="item.activeStatus == 1"
                                         @click="clickPopupShow(item, 2)"
                                         @click="clickPopupShow(item, 2)"
-                                        >活动价</view
-                                    >
+                                        >活动价
+                                    </view>
                                 </view>
                                 </view>
                                 <view class="footer">
                                 <view class="footer">
-                                    <view class="price">¥{{ item.price }}</view>
+                                    <view class="price">¥{{ item.price | formatPrice }}</view>
                                     <view>
                                     <view>
                                         <number-box
                                         <number-box
                                             @change="numberChange(item, $event)"
                                             @change="numberChange(item, $event)"

+ 11 - 9
components/cm-module/cm-coupon/cm-coupon.vue

@@ -20,11 +20,13 @@
                 <view class="row bold">{{ couponData.couponName }}</view>
                 <view class="row bold">{{ couponData.couponName }}</view>
                 <!-- 适用范围 -->
                 <!-- 适用范围 -->
                 <view class="row">{{ couponData.productType | formatUseType }}</view>
                 <view class="row">{{ couponData.productType | formatUseType }}</view>
-                <!-- 截止日期 receivePeriod usePeriod-->
-                <view class="end-time" v-if="couponData.useStatus === 0"
-                    >截止日期:{{ couponData.receivePeriod | formatDate }}</view
-                >
-                <view class="end-time" v-else>截止日期:{{ couponData.usePeriod | formatDate }}</view>
+                <!-- 截止日期 receivePeriod(领取) usePeriod(使用)-->
+                <view class="end-time" v-if="couponData.useStatus === 0">
+                    截止日期:
+                    <template v-if="couponData.receivePeriod">{{ couponData.receivePeriod | formatDate }}</template>
+                    <template v-else>永久</template>
+                </view>
+                <view class="end-time" v-else>有效期至:{{ couponData.usePeriod | formatDate }}</view>
             </view>
             </view>
             <view class="footer">
             <view class="footer">
                 <template v-if="!chooseAble">
                 <template v-if="!chooseAble">
@@ -38,7 +40,6 @@
                     <view class="btn" @click="handleBtnClick" v-if="!couponData.canSelect">去凑单</view>
                     <view class="btn" @click="handleBtnClick" v-if="!couponData.canSelect">去凑单</view>
                 </template>
                 </template>
             </view>
             </view>
-            <!-- <text class="radio-flag iconfont icon-weixuanze"></text> canSelect-->
             <template v-if="chooseAble">
             <template v-if="chooseAble">
                 <text
                 <text
                     class="radio-flag iconfont "
                     class="radio-flag iconfont "
@@ -127,7 +128,7 @@ export default {
         ...mapActions('coupon', ['receiveCoupon']),
         ...mapActions('coupon', ['receiveCoupon']),
         // 点击勾选按钮
         // 点击勾选按钮
         choose() {
         choose() {
-            if(!this.chooseAble) return
+            if (!this.chooseAble || !this.couponData.canSelect) return
             this.$emit('choose', this.couponData)
             this.$emit('choose', this.couponData)
         },
         },
         // 按钮点击
         // 按钮点击
@@ -148,10 +149,11 @@ export default {
             const type = this.couponData.productType
             const type = this.couponData.productType
             if (type === 1) {
             if (type === 1) {
                 console.log('全部商品可用')
                 console.log('全部商品可用')
-                this.$api.switchTabTo('/pages/tabBar/index/index')
+                uni.reLaunch({ url: '/pages/tabBar/index/index' })
+                // this.$api.switchTabTo('/pages/tabBar/index/index')
             } else {
             } else {
                 console.log('部分商品可用')
                 console.log('部分商品可用')
-                this.$api.navigateTo(`/pages/goods/good-coupon-list?couponId=${couponId}`)
+                uni.navigateTo({ url: `/pages/goods/goods-coupon-list?couponId=${couponId}` })
             }
             }
             return Promise.resolve()
             return Promise.resolve()
         }
         }

+ 14 - 7
components/cm-module/cm-goods-nav/cm-goods-nav.vue

@@ -13,7 +13,7 @@
         <cm-drawer :visible="countVisible" @close="drawerClose" position="bottom">
         <cm-drawer :visible="countVisible" @close="drawerClose" position="bottom">
             <view class="count">
             <view class="count">
                 <view class="top">
                 <view class="top">
-                    <image :src="productInfo.mainImage" mode="center" class="cover"></image>
+                    <image :src="productInfo.mainImage" class="cover"></image>
                     <view class="right">
                     <view class="right">
                         <view class="number">
                         <view class="number">
                             <text>数量:</text>
                             <text>数量:</text>
@@ -105,6 +105,7 @@ export default {
     },
     },
     created() {
     created() {
         this.options[2].info = this.kindCount
         this.options[2].info = this.kindCount
+        // this.initBuyPrice()
     },
     },
     methods: {
     methods: {
         ...mapActions('cart', ['addToCart', 'getCartNumber']),
         ...mapActions('cart', ['addToCart', 'getCartNumber']),
@@ -115,6 +116,12 @@ export default {
             this.countVisible = false
             this.countVisible = false
             this.count = 1
             this.count = 1
         },
         },
+        // 初始化购买价格
+        initBuyPrice() {
+            if (this.productInfo.activeStatus === 1 && this.productInfo.ladderList && this.productInfo.length > 0) {
+                this.count = this.productInfo.ladderList[0].buyNum
+            }
+        },
         // 左边按钮
         // 左边按钮
         onClick(e) {
         onClick(e) {
             const clickFns = {
             const clickFns = {
@@ -129,6 +136,7 @@ export default {
         buttonClick(e) {
         buttonClick(e) {
             this.countVisible = true
             this.countVisible = true
             this.btnClickType = e.index
             this.btnClickType = e.index
+            this.processActivityPrice()
         },
         },
         // 确认
         // 确认
         confirm() {
         confirm() {
@@ -148,17 +156,17 @@ export default {
             console.log(this)
             console.log(this)
         },
         },
         // 去登陆
         // 去登陆
-        toLogin(){
+        toLogin() {
             uni.navigateTo({ url: '/pages/login/login' })
             uni.navigateTo({ url: '/pages/login/login' })
         },
         },
         // 去购物车
         // 去购物车
         toCart() {
         toCart() {
-            if(!this.hasLogin) return this.toLogin()
+            if (!this.hasLogin) return this.toLogin()
             uni.navigateTo({ url: '/pages/goods/cart' })
             uni.navigateTo({ url: '/pages/goods/cart' })
         },
         },
         // 加入购物车
         // 加入购物车
         joinCart() {
         joinCart() {
-            if(!this.hasLogin) return this.toLogin()
+            if (!this.hasLogin) return this.toLogin()
             this.addToCart({
             this.addToCart({
                 productId: this.productInfo.productId,
                 productId: this.productInfo.productId,
                 productCount: this.count
                 productCount: this.count
@@ -168,7 +176,7 @@ export default {
         },
         },
         // 立即购买
         // 立即购买
         buyNow() {
         buyNow() {
-            if(!this.hasLogin) return this.toLogin()
+            if (!this.hasLogin) return this.toLogin()
             let productStp = {
             let productStp = {
                 allPrice: this.count * this.buyRetailPrice,
                 allPrice: this.count * this.buyRetailPrice,
                 allCount: this.count,
                 allCount: this.count,
@@ -183,14 +191,13 @@ export default {
         },
         },
         //单独处理活动价格和阶梯价格
         //单独处理活动价格和阶梯价格
         processActivityPrice() {
         processActivityPrice() {
+            this.buyRetailPrice = this.productInfo.price
             if (this.productInfo.activeStatus === 1 && this.productInfo.ladderList) {
             if (this.productInfo.activeStatus === 1 && this.productInfo.ladderList) {
                 this.productInfo.ladderList.forEach((item, index) => {
                 this.productInfo.ladderList.forEach((item, index) => {
                     if (this.count >= item.buyNum) {
                     if (this.count >= item.buyNum) {
                         this.buyRetailPrice = item.buyPrice
                         this.buyRetailPrice = item.buyPrice
                     }
                     }
                 })
                 })
-            } else {
-                this.buyRetailPrice = this.productInfo.price
             }
             }
         }
         }
     }
     }

+ 25 - 23
components/cm-module/cm-product-params/cm-product-params.vue

@@ -1,27 +1,29 @@
 <template>
 <template>
     <cm-drawer title="商品参数" :visible="visible" @close="$emit('close')" position="bottom">
     <cm-drawer title="商品参数" :visible="visible" @close="$emit('close')" position="bottom">
-        <scroll-view scroll-y="true" class="cm-product-params">
-            <view class="content-tr">
-                <view class="content-td">品牌:</view>
-                <view class="content-th">{{ productInfo.brandName == null ? '其他' : productInfo.brandName }}</view>
-            </view>
-            <view class="content-tr">
-                <view class="content-td">包装规格:</view> <view class="content-th">{{ productInfo.unit }}</view>
-            </view>
-            <view class="content-tr">
-                <view class="content-td">库存:</view> <view class="content-th">{{ productInfo.stock }}</view>
-            </view>
-            <view
-                class="content-tr"
-                v-if="productInfo.parametersList.length > 0"
-                v-for="(item, index) in productInfo.parametersList"
-                :key="index"
-            >
-                <view class="content-td">{{ item.paramsName }}:</view>
-                <view class="content-th">{{ item.paramsContent }}</view>
-            </view>
+        <template>
+            <scroll-view scroll-y="true" class="cm-product-params">
+                <view class="content-tr">
+                    <view class="content-td">品牌:</view>
+                    <view class="content-th">{{ productInfo.brandName == null ? '其他' : productInfo.brandName }}</view>
+                </view>
+                <view class="content-tr">
+                    <view class="content-td">包装规格:</view> <view class="content-th">{{ productInfo.unit }}</view>
+                </view>
+                <view class="content-tr">
+                    <view class="content-td">库存:</view> <view class="content-th">{{ productInfo.stock }}</view>
+                </view>
+                <view
+                    class="content-tr"
+                    v-if="productInfo.parametersList.length > 0"
+                    v-for="(item, index) in productInfo.parametersList"
+                    :key="index"
+                >
+                    <view class="content-td">{{ item.paramsName }}:</view>
+                    <view class="content-th">{{ item.paramsContent }}</view>
+                </view>
+            </scroll-view>
             <view class="btn" @click="$emit('close')">了解</view>
             <view class="btn" @click="$emit('close')">了解</view>
-        </scroll-view>
+        </template>
     </cm-drawer>
     </cm-drawer>
 </template>
 </template>
 
 
@@ -48,7 +50,6 @@ export default {
 .cm-product-params {
 .cm-product-params {
     width: 100%;
     width: 100%;
     padding-top: 24rpx;
     padding-top: 24rpx;
-    height: 320rpx;
     .content-tr {
     .content-tr {
         width: 100%;
         width: 100%;
         min-height: 58rpx;
         min-height: 58rpx;
@@ -76,7 +77,8 @@ export default {
 .btn {
 .btn {
     width: 100%;
     width: 100%;
     height: 88rpx;
     height: 88rpx;
-    margin-top: 32px;
+    margin-top: 32rpx;
+    margin-bottom: 24rpx;
     background: #ff457b;
     background: #ff457b;
     line-height: 88rpx;
     line-height: 88rpx;
     text-align: center;
     text-align: center;

+ 19 - 16
components/cm-module/cm-product-price/cm-product-price.vue

@@ -13,10 +13,12 @@
         </view>
         </view>
 
 
         <cm-drawer :visible="drawerVisible" position="bottom" @close="drawerClose">
         <cm-drawer :visible="drawerVisible" position="bottom" @close="drawerClose">
-            <scroll-view scroll-y="true" class="scroll-box">
-                <cm-activity-info :productInfo="productInfo"></cm-activity-info>
+            <template>
+                <scroll-view scroll-y="true" class="scroll-box">
+                    <cm-activity-info :productInfo="productInfo"></cm-activity-info>
+                </scroll-view>
                 <view class="btn" @click="drawerVisible = false">了解</view>
                 <view class="btn" @click="drawerVisible = false">了解</view>
-            </scroll-view>
+            </template>
         </cm-drawer>
         </cm-drawer>
     </view>
     </view>
 </template>
 </template>
@@ -104,19 +106,20 @@ export default {
     }
     }
 }
 }
 .scroll-box {
 .scroll-box {
-    height: 500rpx;
+    height: 430rpx;
     box-sizing: border-box;
     box-sizing: border-box;
-    padding: 70rpx 0 24rpx;
-    .btn {
-        width: 100%;
-        height: 88rpx;
-        margin-top: 24rpx;
-        background: #ff457b;
-        line-height: 88rpx;
-        text-align: center;
-        color: #ffffff;
-        font-size: 28rpx;
-        border-radius: 44rpx;
-    }
+    padding-top: 70rpx;
+}
+.btn {
+    width: 100%;
+    height: 88rpx;
+    margin-top: 24rpx;
+    margin-bottom: 24rpx;
+    background: #ff457b;
+    line-height: 88rpx;
+    text-align: center;
+    color: #ffffff;
+    font-size: 28rpx;
+    border-radius: 44rpx;
 }
 }
 </style>
 </style>

+ 2 - 1
components/cm-module/cm-product/cm-product.vue

@@ -85,8 +85,9 @@ $grid: 24rpx;
         margin: 12rpx 0;
         margin: 12rpx 0;
     }
     }
     .title {
     .title {
-        height: 66rpx;
+        height: 70rpx;
         font-size: 26rpx;
         font-size: 26rpx;
+        line-height: 35rpx;
         color: #333333;
         color: #333333;
         overflow: hidden;
         overflow: hidden;
         text-overflow: ellipsis;
         text-overflow: ellipsis;

+ 2 - 1
components/sui-search/sui-search.vue

@@ -11,10 +11,11 @@
                 :disabled="disabled"
                 :disabled="disabled"
                 v-model="keyword"
                 v-model="keyword"
                 @blur="search"
                 @blur="search"
+                @focus="$emit('onFocus')"
                 :focus="focus"
                 :focus="focus"
                 :placeholder="placeholder"
                 :placeholder="placeholder"
                 :placeholderStyle="placeStyle"
                 :placeholderStyle="placeStyle"
-                type="text"
+                type="search"
             />
             />
             <text class="iconfont icon-iconfontguanbi clear" v-if="showClose" @click="clearKeyword"></text>
             <text class="iconfont icon-iconfontguanbi clear" v-if="showClose" @click="clearKeyword"></text>
             <slot name="right"></slot>
             <slot name="right"></slot>

+ 1 - 0
mixins/shareEntry.js

@@ -4,6 +4,7 @@ import { mapMutations } from 'vuex'
 const shareEntry = {
 const shareEntry = {
     data() {
     data() {
         return {
         return {
+            // 分享链接携带的数据
             shareData: {
             shareData: {
                 type: '',
                 type: '',
                 inviteUserId: '',
                 inviteUserId: '',

+ 11 - 12
mixins/wechatPay.js

@@ -19,14 +19,6 @@ function wxRequestPayment(payment) {
     })
     })
 }
 }
 
 
-// 支付信息提示页面重定向
-function payFaildRedirect(orderInfo) {
-    setTimeout(() => {
-        uni.setStorageSync('orderInfo', orderInfo)
-        uni.redirectTo({ url: '/pages/user/order/success' })
-    }, 2000)
-}
-
 // 微信支付
 // 微信支付
 const wechatPay = {
 const wechatPay = {
     data() {
     data() {
@@ -64,12 +56,19 @@ const wechatPay = {
                 // 处理支付信息 调用微信支付
                 // 处理支付信息 调用微信支付
                 const payment = JSON.parse(response.data.data.payInfo)
                 const payment = JSON.parse(response.data.data.payInfo)
                 const payFlag = await wxRequestPayment(payment)
                 const payFlag = await wxRequestPayment(payment)
-                // 支付重定向
-                uni.reLaunch({ url: '/pages/tabBar/index/index' })
+                // 支付成功重定向
+                uni.setStorageSync('orderInfo', this.hanldOrder.order)
+                if (payFlag) {
+                    uni.redirectTo({ url: '/pages/user/order/success' })
+                } else {
+                    uni.redirectTo({ url: '/pages/user/order/error' })
+                }
             } catch (error) {
             } catch (error) {
                 // 微信支付失败
                 // 微信支付失败
-                if (error.msg === 'error') payFaildRedirect(this.hanldOrder.order)
-                else this.$util.msg(error.msg, 2000)
+                if (error.msg === 'error') {
+                    uni.setStorageSync('orderInfo', this.hanldOrder.order)
+                    uni.redirectTo({ url: '/pages/user/order/error' })
+                } else this.$util.msg(error.msg, 2000)
             } finally {
             } finally {
                 this.isSubLoading = false
                 this.isSubLoading = false
             }
             }

+ 15 - 2
pages.json

@@ -65,18 +65,24 @@
             }
             }
         },
         },
         {
         {
-            "path": "pages/goods/good-floorMore",
+            "path": "pages/goods/goods-floorMore",
             "style": {
             "style": {
                 "navigationBarTitleText": "商品列表",
                 "navigationBarTitleText": "商品列表",
                 "enablePullDownRefresh": true
                 "enablePullDownRefresh": true
             }
             }
         },
         },
         {
         {
-            "path": "pages/goods/good-coupon-list",
+            "path": "pages/goods/goods-coupon-list",
             "style": {
             "style": {
                 "navigationBarTitleText": "优惠券商品列表",
                 "navigationBarTitleText": "优惠券商品列表",
                 "enablePullDownRefresh": true
                 "enablePullDownRefresh": true
             }
             }
+        },
+        {
+            "path": "pages/goods/goods-coupon-list-search",
+            "style": {
+                "navigationBarTitleText": "搜索"
+            }
         }
         }
     ],
     ],
     "subPackages": [{
     "subPackages": [{
@@ -108,6 +114,13 @@
                     "navigationStyle": "custom"
                     "navigationStyle": "custom"
                 }
                 }
             },
             },
+            {
+                "path": "order/error",
+                "style": {
+                    "navigationBarTitleText": "支付结果",
+                    "navigationStyle": "custom"
+                }
+            },
             {
             {
                 "path": "order/order-list",
                 "path": "order/order-list",
                 "style": {
                 "style": {

+ 14 - 9
pages/goods/cart.vue

@@ -54,7 +54,7 @@
                             <text>总价:</text> <text class="total-price">¥{{ allPrice | NumFormat }}</text>
                             <text>总价:</text> <text class="total-price">¥{{ allPrice | NumFormat }}</text>
                         </view>
                         </view>
                         <!-- TODO -->
                         <!-- TODO -->
-                        <view class="row" v-if="currentCouponIndex > -1">
+                        <view class="row" v-if="currentCouponIndex > -1 && currentCoupon">
                             <text>共减</text>
                             <text>共减</text>
                             <text class="discounted-price">¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                             <text class="discounted-price">¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                             <text @click="showDiscountedDetail">优惠明细</text>
                             <text @click="showDiscountedDetail">优惠明细</text>
@@ -104,7 +104,7 @@
                     <view class="row">
                     <view class="row">
                         <text>促销满减</text> <text class="red">-¥{{ discountedPrice | NumFormat }}</text>
                         <text>促销满减</text> <text class="red">-¥{{ discountedPrice | NumFormat }}</text>
                     </view>
                     </view>
-                    <view class="row" v-if="currentCouponIndex > -1">
+                    <view class="row" v-if="currentCouponIndex > -1 && currentCoupon">
                         <text>优惠券</text> <text class="red">-¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                         <text>优惠券</text> <text class="red">-¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                     </view>
                     </view>
                     <view class="row total">
                     <view class="row total">
@@ -135,7 +135,13 @@ import CmDrawer from '@/components/cm-module/cm-drawer/cm-drawer.vue'
 import CmCartProduct from '@/components/cm-module/cm-cart-product/cm-cart-product.vue'
 import CmCartProduct from '@/components/cm-module/cm-cart-product/cm-cart-product.vue'
 import HeaderCart from '@/components/cm-module/headerNavbar/header-cart.vue'
 import HeaderCart from '@/components/cm-module/headerNavbar/header-cart.vue'
 import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
 import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
-import { fetchSelectedProducts, findCouponBySelected, canUseCoupon, getCountPrice, couponSort } from '@/common/couponUtil.js'
+import {
+    fetchSelectedProducts,
+    findCouponBySelected,
+    canUseCoupon,
+    getCountPrice,
+    couponSort
+} from '@/common/couponUtil.js'
 
 
 import { mapGetters, mapActions, mapMutations } from 'vuex'
 import { mapGetters, mapActions, mapMutations } from 'vuex'
 
 
@@ -235,7 +241,7 @@ export default {
             }
             }
         },
         },
         currentCoupon() {
         currentCoupon() {
-            return this.canUseCouponList[this.currentCouponIndex]
+            return this.canUseCouponList[this.currentCouponIndex] || null
         },
         },
         nextCoupon() {
         nextCoupon() {
             if (this.currentCouponIndex <= 0) {
             if (this.currentCouponIndex <= 0) {
@@ -255,21 +261,20 @@ export default {
             return this.allPrice - this.discountedPrice
             return this.allPrice - this.discountedPrice
         },
         },
         couponTipText() {
         couponTipText() {
-            if (this.currentCouponIndex === -1) return ''
+            if (this.currentCouponIndex <= -1) return ''
             if (this.currentCoupon === this.nextCoupon) {
             if (this.currentCoupon === this.nextCoupon) {
                 if (this.nextCoupon.noThresholdFlag === 1) {
                 if (this.nextCoupon.noThresholdFlag === 1) {
                     return `已享“减${this.currentCoupon.couponAmount}元”优惠券`
                     return `已享“减${this.currentCoupon.couponAmount}元”优惠券`
                 }
                 }
                 return `已享“满${this.currentCoupon.touchPrice}元减${this.currentCoupon.couponAmount}元”优惠券`
                 return `已享“满${this.currentCoupon.touchPrice}元减${this.currentCoupon.couponAmount}元”优惠券`
             }
             }
-            return `还差¥${this.nextCoupon.touchPrice - getCountPrice(this.selectedPoducts, this.nextCoupon)}元可用“满${this.nextCoupon.touchPrice}元减${
-                this.nextCoupon.couponAmount
-            }元”优惠券`
+            return `还差¥
+                ${(this.nextCoupon.touchPrice - getCountPrice(this.selectedPoducts, this.nextCoupon)).toFixed(2)}
+                元可用“满${this.nextCoupon.touchPrice}元减${this.nextCoupon.couponAmount}元”优惠券`
         },
         },
         couponList() {
         couponList() {
             if (this.currentTabIndex === 0) {
             if (this.currentTabIndex === 0) {
                 return couponSort(this.receiveCouponList)
                 return couponSort(this.receiveCouponList)
-
             } else {
             } else {
                 return couponSort(this.ableCouponList)
                 return couponSort(this.ableCouponList)
             }
             }

+ 409 - 0
pages/goods/goods-coupon-list-search.vue

@@ -0,0 +1,409 @@
+<template>
+    <view class="good-coupon-list-search">
+        <!-- 搜索 -->
+        <view class="search">
+            <sui-search
+                placeholder="请输入商品关键词"
+                :radius="30"
+                :focus="true"
+                class="sui-search"
+                :value="inputValue"
+                @search="searchBlur"
+                @onFocus="searchFocus"
+                @clear="searchClear"
+            ></sui-search>
+            <view class="search-btn" @click="handleSearch">搜索</view>
+        </view>
+        <!-- 历史关键词 -->
+        <template v-if="serachRecordList.length > 0">
+            <view class="history-keywords" v-show="resetType">
+                <view class="line"></view>
+                <view class="row history-title">
+                    <view class="title">搜索历史</view>
+                    <view class="iconfont icon-shanchu delete" @click="handleDetele"></view>
+                </view>
+                <view class="row keyword-list">
+                    <view
+                        class="keyword"
+                        v-for="(keyword, index) in serachRecordList"
+                        :key="index"
+                        @click="keywordsClick(keyword)"
+                        >{{ keyword }}
+                    </view>
+                </view>
+            </view>
+        </template>
+        <!-- 列表为空 -->
+        <cm-empty
+            v-if="productList.length <= 0 && !resetType"
+            message="暂无搜索结果~"
+            :image="baseUrl + 'icon-empty-search.png'"
+            :offset="90"
+        ></cm-empty>
+        <!-- 商品列表 -->
+        <view class="product-list" v-show="!resetType">
+            <view class="product" v-for="(product, index) in productList" :key="index">
+                <image class="product-image" :src="product.mainImage"></image>
+                <view class="product-info">
+                    <view class="name tui-ellipsis-2">{{ product.name }}</view>
+                    <view class="unit">规格:{{ product.unit }}</view>
+                    <view class="tags">
+                        <text class="tag type2" v-if="product.activeStatus === 1">活动价</text>
+                        <text class="tag type2" v-if="product.couponsLogo">优惠券</text>
+                    </view>
+                    <view class="footer">
+                        <view class="price">¥{{ product.price | priceFormat }}</view>
+                        <text class="carts-add iconfont icon-gouwuche" @click.stop="handAddCarts(product)"></text>
+                    </view>
+                </view>
+            </view>
+            <!-- 加载更多 -->
+            <template v-if="productList.length > 6">
+                <tui-loadmore :index="2" :visible="isRequest"></tui-loadmore>
+                <tui-nomore :text="loadingText" :visible="!isRequest" backgroundColor="#fff"></tui-nomore>
+            </template>
+        </view>
+        <!-- 侧边 -->
+        <scroll-top :isScrollTop="isScrollTop" :bottom="160"></scroll-top>
+        <!-- 可拖动悬浮按钮 -->
+        <cm-drag :cartNum="kindCount" :isDock="true" :existTabBar="true" @btnClick="btnClick"> </cm-drag>
+        <!-- 操作弹窗 -->
+        <tui-modal
+            :show="showModal"
+            @click="handleConfirm"
+            @cancel="showModal = false"
+            :content="contentModalText"
+            color="#333"
+            :size="32"
+            shape="circle"
+            :maskClosable="false"
+        ></tui-modal>
+    </view>
+</template>
+
+<script>
+import SuiSearch from '@/components/sui-search/sui-search.vue'
+import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
+import CmDrag from '@/components/cm-module/cm-drag/cm-drag'
+import { mapGetters, mapActions } from 'vuex'
+export default {
+    components: {
+        SuiSearch,
+        CmEmpty,
+        CmDrag
+    },
+    data() {
+        return {
+            baseUrl: this.$Static,
+            showModal: false,
+            productList: [], //商品列表
+            serachRecordList: [],
+            listQuery: {
+                userId: '',
+                couponId: 48,
+                pageNum: 1,
+                pageSize: 10,
+                productName: ''
+            },
+            inputValue: '',
+            hasNextPage: false,
+            isScrollTop: false,
+            isRequest: true,
+            timer: null,
+            isSticky: false,
+            isFocus: true,
+            resetType: true, // true 重新搜索  false 上拉加载
+            contentModalText: '确定删除历史记录?'
+        }
+    },
+    filters: {
+        priceFormat: function(price) {
+            //处理金额
+            return Number(price).toFixed(2)
+        }
+    },
+    computed: {
+        ...mapGetters(['hasLogin', 'userInfo', 'userId', 'kindCount']),
+        loadingText() {
+            return this.hasNextPage ? '上拉加载' : '没有更多了'
+        }
+    },
+    // 监听页面滚动事件
+    onPageScroll(e) {
+        this.isSticky = e.scrollTop > 0
+        this.isScrollTop = e.scrollTop > 400
+    },
+    onReachBottom() {
+        if (!this.hasNextPage) return
+        clearTimeout(this.timer)
+        this.timer = setTimeout(() => {
+            console.log('触底了')
+            this.fetchProductList()
+        }, 200)
+    },
+    onReady() {
+        this.getetSerachRecord()
+    },
+    methods: {
+        ...mapActions('cart', ['addToCart']),
+        // 获取商品列表
+        fetchProductList() {
+            this.listQuery.userId = this.userId
+            this.CouponService.ProductInfoByCoupon(this.listQuery)
+                .then(response => {
+                    let data = response.data
+                    if (this.resetType) {
+                        this.productList = data.list
+                    } else {
+                        this.productList = [...this.productList, ...data.list]
+                    }
+                    this.hasNextPage = data.hasNextPage
+                    this.listQuery.pageNum++
+                    this.resetType = false
+                    this.isRequest = false
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        },
+        //查询搜索历史记录
+        getetSerachRecord() {
+            this.ProductService.GetProductSearchHistory({ userId: this.userId }).then(response => {
+                if (response.code == 0) {
+                    this.serachRecordList = response.data
+                }
+            })
+        },
+        // 搜索按钮事件
+        handleSearch() {
+            if (!this.listQuery.productName) return this.$util.msg('商品名称不能为空', 2000)
+            this.listQuery.pageNum = 1
+            this.productList = []
+            this.fetchProductList()
+        },
+        // 点击关键词
+        keywordsClick(keyword) {
+            this.listQuery.productName = keyword
+            this.inputValue = keyword
+            this.handleSearch()
+        },
+        // 加入购物车
+        handAddCarts(product) {
+            this.addToCart({ productId: product.productId })
+        },
+        // 跳转购物车
+        btnClick() {
+            this.$api.navigateTo('/pages/goods/cart')
+        },
+        // 搜索框失去焦点
+        searchBlur(val) {
+            console.log('失去焦点')
+            this.listQuery.productName = val
+            this.isFocus = false
+        },
+        // 搜索框获取焦点
+        searchFocus() {
+            console.log('获取焦点')
+            this.getetSerachRecord()
+            this.resetType = true // 重新搜索
+            this.isFocus = true
+        },
+        // 清空搜索
+        searchClear() {
+            this.inputValue = ''
+            this.resetType = true // 重新搜索
+            this.isFocus = true
+            this.getetSerachRecord()
+        },
+        //清空历史记录
+        handleDetele() {
+            this.showModal = true
+        },
+        // 确认事件
+        handleConfirm(e) {
+            if (e.index === 1) this.removeAllKeywords()
+            this.showModal = false
+        },
+        // 清空关键词
+        removeAllKeywords() {
+            this.ProductService.GetDeleteProductSearchHistory({ userId: this.userId })
+                .then(response => {
+                    this.$util.msg('删除成功', 2000, true, 'success')
+                    this.serachRecordList = []
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.good-coupon-list-search {
+    min-height: 100vh;
+    padding-top: 124rpx;
+    background: #f7f7f7;
+    overflow: hidden;
+    box-sizing: border-box;
+}
+.search {
+    display: flex;
+    position: fixed;
+    justify-content: space-between;
+    align-items: center;
+    width: 100%;
+    top: 0;
+    left: 0;
+    z-index: 999;
+    padding-right: 24rpx;
+    box-sizing: border-box;
+    background: #fff;
+    // &.fixed {
+    //     position: fixed;
+    // }
+    .sui-search {
+        flex: 1;
+    }
+    .search-btn {
+        font-size: 26rpx;
+        color: #666;
+    }
+}
+.history-keywords {
+    background: #fff;
+    // padding: 0 24rpx;
+    .line {
+        height: 1rpx;
+        margin: 0 24rpx;
+        background: #e1e1e1;
+    }
+    .history-title {
+        margin: 48rpx 24rpx 24rpx;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        .title {
+            height: 42rpx;
+            line-height: 42rpx;
+            font-size: 30rpx;
+            font-weight: bold;
+            color: #333333;
+        }
+        .delete {
+            width: 32rpx;
+            height: 32rpx;
+            font-size: 32rpx;
+            color: #999999;
+        }
+    }
+    .keyword-list {
+        display: flex;
+        flex-wrap: wrap;
+        align-items: center;
+        padding: 0 12rpx;
+        .keyword {
+            height: 44rpx;
+            padding: 0 12rpx;
+            margin: 24rpx 12rpx;
+            font-size: 26rpx;
+            line-height: 44rpx;
+            border-radius: 22rpx;
+            color: #999999;
+            text-align: center;
+            background: #f7f7f7;
+        }
+    }
+}
+.product-list {
+    padding: 0 24rpx;
+    background: #fff;
+    overflow: hidden;
+    .product {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        padding: 32rpx 0;
+        border-bottom: 1px solid #e1e1e1;
+        overflow: hidden;
+        &:last-child {
+            border-bottom: 0;
+        }
+        .product-image {
+            display: block;
+            width: 180rpx;
+            height: 180rpx;
+            border-radius: 8rpx;
+            border: 1px solid #e1e1e1;
+            border-radius: 8rpx;
+            box-sizing: border-box;
+        }
+        .product-info {
+            width: 495rpx;
+            .name {
+                height: 72rpx;
+                line-height: 36rpx;
+                font-size: $font-size-26;
+                color: #333333;
+                text-align: justify;
+            }
+            .unit,
+            .tags,
+            .footer {
+                margin-top: 8rpx;
+            }
+            .unit {
+                width: 100%;
+                height: 28rpx;
+                text-align: left;
+                line-height: 28rpx;
+                font-size: $font-size-20;
+                color: #999999;
+            }
+            .tags {
+                display: flex;
+                justify-content: flex-start;
+                align-items: center;
+                width: 100%;
+                height: 30rpx;
+                .tag {
+                    margin-right: 8rpx;
+                    font-size: 22rpx;
+                    height: 30rpx;
+                    line-height: 30rpx;
+                    text-align: center;
+                    &.type2 {
+                        width: 80rpx;
+                        color: #f83c6c;
+                        background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center
+                            no-repeat;
+                        background-size: contain;
+                    }
+                }
+            }
+            .footer {
+                display: flex;
+                justify-content: space-between;
+                align-items: flex-end;
+                height: $font-size-26;
+                .price {
+                    font-size: $font-size-26;
+                    color: #f83c6c;
+                    font-weight: bold;
+                    line-height: $font-size-26;
+                }
+                .carts-add {
+                    width: 44rpx;
+                    height: 44rpx;
+                    line-height: 44rpx;
+                    border-radius: 50%;
+                    text-align: center;
+                    font-size: 32rpx;
+                    color: #ffffff;
+                    background-color: #ff457b;
+                }
+            }
+        }
+    }
+}
+</style>

+ 34 - 25
pages/goods/good-coupon-list.vue → pages/goods/goods-coupon-list.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
-    <view class="good-coupon-list">
+    <view class="good-coupon-list" :class="{ top: isSticky }">
         <!-- 骨架 -->
         <!-- 骨架 -->
-        <tui-skeleton v-if="skeletonShow" :isLoading="true" loadingType="2"></tui-skeleton>
+        <tui-skeleton v-if="isRequest" :isLoading="true" loadingType="2"></tui-skeleton>
         <template v-else>
         <template v-else>
             <!-- 列表为空 -->
             <!-- 列表为空 -->
             <cm-empty
             <cm-empty
@@ -15,9 +15,10 @@
                 <sui-search
                 <sui-search
                     placeholder="请输入商品关键词"
                     placeholder="请输入商品关键词"
                     :radius="30"
                     :radius="30"
-                    @search="searchBlur"
-                    @clear="searchClear"
                     class="sui-search"
                     class="sui-search"
+                    :class="{ fixed: isSticky }"
+                    disabled
+                    @gosearch="goSearch"
                 ></sui-search>
                 ></sui-search>
                 <!-- 商品列表 -->
                 <!-- 商品列表 -->
                 <view class="product-list">
                 <view class="product-list">
@@ -28,12 +29,14 @@
                 <!-- 加载更多 -->
                 <!-- 加载更多 -->
                 <template v-if="productList.length > 6">
                 <template v-if="productList.length > 6">
                     <tui-loadmore :index="2" :visible="isRequest"></tui-loadmore>
                     <tui-loadmore :index="2" :visible="isRequest"></tui-loadmore>
-                    <tui-nomore :text="loadingText" :visible="!isRequest" backgroundColor="#fff"></tui-nomore>
+                    <tui-nomore :text="loadingText" :visible="!isRequest" backgroundColor="#f7f7f7"></tui-nomore>
                 </template>
                 </template>
             </template>
             </template>
         </template>
         </template>
         <!-- 侧边 -->
         <!-- 侧边 -->
         <scroll-top :isScrollTop="isScrollTop" :bottom="160"></scroll-top>
         <scroll-top :isScrollTop="isScrollTop" :bottom="160"></scroll-top>
+        <!-- 可拖动悬浮按钮 -->
+        <cm-drag :cartNum="kindCount" :isDock="true" :existTabBar="true" @btnClick="btnClick"> </cm-drag>
     </view>
     </view>
 </template>
 </template>
 
 
@@ -41,12 +44,14 @@
 import CmProduct from '@/components/cm-module/cm-product/cm-product.vue'
 import CmProduct from '@/components/cm-module/cm-product/cm-product.vue'
 import SuiSearch from '@/components/sui-search/sui-search.vue'
 import SuiSearch from '@/components/sui-search/sui-search.vue'
 import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
 import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
+import CmDrag from '@/components/cm-module/cm-drag/cm-drag'
 import { mapGetters, mapActions } from 'vuex'
 import { mapGetters, mapActions } from 'vuex'
 export default {
 export default {
     components: {
     components: {
         CmEmpty,
         CmEmpty,
         SuiSearch,
         SuiSearch,
-        CmProduct
+        CmProduct,
+        CmDrag
     },
     },
     data() {
     data() {
         return {
         return {
@@ -63,7 +68,8 @@ export default {
             isScrollTop: false,
             isScrollTop: false,
             isRequest: true,
             isRequest: true,
             isRefresh: false,
             isRefresh: false,
-            timer: null
+            timer: null,
+            isSticky: false
         }
         }
     },
     },
     filters: {
     filters: {
@@ -78,7 +84,7 @@ export default {
         this.fetchProductList()
         this.fetchProductList()
     },
     },
     computed: {
     computed: {
-        ...mapGetters(['hasLogin', 'userInfo', 'userId']),
+        ...mapGetters(['hasLogin', 'userInfo', 'userId', 'kindCount']),
         loadingText() {
         loadingText() {
             return this.hasNextPage ? '上拉加载' : '没有更多了'
             return this.hasNextPage ? '上拉加载' : '没有更多了'
         }
         }
@@ -111,24 +117,22 @@ export default {
                     }
                     }
                 })
                 })
         },
         },
-        // 搜索框失去焦点
-        searchBlur(val) {
-            this.listQuery.productName = val
-            this.listQuery.pageNum = 1
-            this.fetchProductList()
+        // 跳转到搜索页面
+        goSearch() {
+            uni.navigateTo({ url: '/pages/goods/goods-coupon-list-search' })
         },
         },
-        // 搜索框清空
-        searchClear() {
-            this.listQuery.productName = ''
+        btnClick() {
+            this.$api.navigateTo('/pages/goods/cart')
         }
         }
     },
     },
     // 监听页面滚动事件
     // 监听页面滚动事件
     onPageScroll(e) {
     onPageScroll(e) {
+        this.isSticky = e.scrollTop > 0
         this.isScrollTop = e.scrollTop > 400
         this.isScrollTop = e.scrollTop > 400
     },
     },
     onPullDownRefresh() {
     onPullDownRefresh() {
         //下拉刷新
         //下拉刷新
-        this.pageNum = 1
+        this.listQuery.pageNum = 1
         this.isRefresh = true
         this.isRefresh = true
         this.fetchProductList()
         this.fetchProductList()
     },
     },
@@ -144,23 +148,28 @@ export default {
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
+.sui-search {
+    width: 100%;
+    top: 0;
+    left: 0;
+    z-index: 999;
+    &.fixed {
+        position: fixed;
+    }
+}
 .good-coupon-list {
 .good-coupon-list {
-    padding-top: 124rpx;
     min-height: 100%;
     min-height: 100%;
     background: #f7f7f7;
     background: #f7f7f7;
     box-sizing: border-box;
     box-sizing: border-box;
-    .sui-search {
-        position: fixed;
-        width: 100%;
-        top: 0;
-        left: 0;
-        z-index: 999;
+    overflow: hidden;
+    &.top {
+        padding-top: 124rpx;
     }
     }
     .product-list {
     .product-list {
         display: flex;
         display: flex;
         justify-content: space-between;
         justify-content: space-between;
         flex-wrap: wrap;
         flex-wrap: wrap;
-        padding: 0 24rpx 12rpx;
+        padding: 12rpx 24rpx 12rpx;
         background-color: #f7f7f7;
         background-color: #f7f7f7;
         box-sizing: border-box;
         box-sizing: border-box;
         .product {
         .product {

+ 1 - 0
pages/goods/good-floorMore.vue → pages/goods/goods-floorMore.vue

@@ -102,6 +102,7 @@ export default {
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 .good-floor-more {
 .good-floor-more {
     background: $uni-floor-bg-color;
     background: $uni-floor-bg-color;
+    overflow: hidden;
 }
 }
 .product-list {
 .product-list {
     display: flex;
     display: flex;

+ 8 - 9
pages/goods/product-detail.vue

@@ -19,7 +19,7 @@
                 <uni-swiper-dot :info="imageList" :current="swiperCurrent" mode="left" class="swiper-box">
                 <uni-swiper-dot :info="imageList" :current="swiperCurrent" mode="left" class="swiper-box">
                     <swiper @change="swiperChange" class="swiper">
                     <swiper @change="swiperChange" class="swiper">
                         <swiper-item v-for="(image, index) in imageList" :key="index">
                         <swiper-item v-for="(image, index) in imageList" :key="index">
-                            <image :src="image" class="image" mode="center" @click="previewImage(index)"></image>
+                            <image :src="image" class="image" @click="previewImage(index)"></image>
                         </swiper-item>
                         </swiper-item>
                     </swiper>
                     </swiper>
                 </uni-swiper-dot>
                 </uni-swiper-dot>
@@ -125,8 +125,8 @@ export default {
             paramsVisible: false,
             paramsVisible: false,
             jumpState: 1,
             jumpState: 1,
             selectorTimer: null,
             selectorTimer: null,
-            anchorList: [],
-            anchorStatus: [0, 0, 0]
+            anchorList: [], // 锚点元素节点信息
+            anchorStatus: [0, 0, 0] // 分别代表三个锚点区域的开关 0:关  1:开
         }
         }
     },
     },
     computed: {
     computed: {
@@ -224,7 +224,8 @@ export default {
         },
         },
         // 优惠券列表按钮点击事件
         // 优惠券列表按钮点击事件
         couponClick() {
         couponClick() {
-            this.couponVisible = false
+            this.getCouponByProduct()
+            // this.couponVisible = false
         },
         },
         // 轮播图切换
         // 轮播图切换
         swiperChange(e) {
         swiperChange(e) {
@@ -243,9 +244,7 @@ export default {
             query
             query
                 .selectAll('.anchor')
                 .selectAll('.anchor')
                 .boundingClientRect(data => {
                 .boundingClientRect(data => {
-                    console.log(data)
                     if (data.length > 0) {
                     if (data.length > 0) {
-                        console.log(data)
                         this.anchorList = data
                         this.anchorList = data
                         clearInterval(this.selectorTimer)
                         clearInterval(this.selectorTimer)
                         this.observerAnchor(data)
                         this.observerAnchor(data)
@@ -260,7 +259,7 @@ export default {
                 scrollTop: this.anchorList[this.currentTab].top - 40
                 scrollTop: this.anchorList[this.currentTab].top - 40
             })
             })
         },
         },
-        // 创建观测者
+        // 为需要观测的区域创建观测者
         observerAnchor(selectorList = []) {
         observerAnchor(selectorList = []) {
             const height = uni.getSystemInfoSync().windowHeight - 50
             const height = uni.getSystemInfoSync().windowHeight - 50
             selectorList.forEach((selector, index) => {
             selectorList.forEach((selector, index) => {
@@ -268,10 +267,10 @@ export default {
                 observers[selector.id].relativeToViewport({ bottom: -height }).observe(`#${selector.id}`, res => {
                 observers[selector.id].relativeToViewport({ bottom: -height }).observe(`#${selector.id}`, res => {
                     if (res.intersectionRatio > 0) {
                     if (res.intersectionRatio > 0) {
                         this.anchorStatus[index] = 1
                         this.anchorStatus[index] = 1
-                        console.log(index, `当前区域为${selector.id}标签选择器的区域...`)
+                        // console.log(index, `当前区域为${selector.id}标签选择器的区域...`)
                     } else {
                     } else {
                         this.anchorStatus[index] = 0
                         this.anchorStatus[index] = 0
-                        console.log(index, `离开区域为${selector.id}标签选择器的区域...`)
+                        // console.log(index, `离开区域为${selector.id}标签选择器的区域...`)
                     }
                     }
                 })
                 })
             })
             })

+ 1 - 1
pages/goods/search.vue

@@ -189,7 +189,7 @@ export default {
                 this.getListFromServer(true)
                 this.getListFromServer(true)
             }
             }
         },
         },
-        //搜索商品
+        //搜索普通商品商品
         getListFromServer(loadMore) {
         getListFromServer(loadMore) {
             this.showLoading = true
             this.showLoading = true
             this.loadingNow = true
             this.loadingNow = true

+ 17 - 11
pages/tabBar/cart/index.vue

@@ -47,7 +47,7 @@
                             <text>总价:</text> <text class="total-price">¥{{ allPrice | NumFormat }}</text>
                             <text>总价:</text> <text class="total-price">¥{{ allPrice | NumFormat }}</text>
                         </view>
                         </view>
                         <!-- TODO -->
                         <!-- TODO -->
-                        <view class="row" v-if="currentCouponIndex > -1">
+                        <view class="row" v-if="currentCouponIndex > -1 && currentCoupon">
                             <text>共减</text>
                             <text>共减</text>
                             <text class="discounted-price">¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                             <text class="discounted-price">¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                             <text @click="showDiscountedDetail">优惠明细</text>
                             <text @click="showDiscountedDetail">优惠明细</text>
@@ -97,7 +97,7 @@
                     <view class="row">
                     <view class="row">
                         <text>促销满减</text> <text class="red">-¥{{ discountedPrice | NumFormat }}</text>
                         <text>促销满减</text> <text class="red">-¥{{ discountedPrice | NumFormat }}</text>
                     </view>
                     </view>
-                    <view class="row" v-if="currentCouponIndex > -1">
+                    <view class="row" v-if="currentCouponIndex > -1 && currentCoupon">
                         <text>优惠券</text> <text class="red">-¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                         <text>优惠券</text> <text class="red">-¥{{ currentCoupon.couponAmount | NumFormat }}</text>
                     </view>
                     </view>
                     <view class="row total">
                     <view class="row total">
@@ -128,7 +128,13 @@ import CmDrawer from '@/components/cm-module/cm-drawer/cm-drawer.vue'
 import CmCartProduct from '@/components/cm-module/cm-cart-product/cm-cart-product.vue'
 import CmCartProduct from '@/components/cm-module/cm-cart-product/cm-cart-product.vue'
 import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
 import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
 import { mapGetters, mapActions, mapMutations } from 'vuex'
 import { mapGetters, mapActions, mapMutations } from 'vuex'
-import { fetchSelectedProducts, findCouponBySelected, canUseCoupon, getCountPrice, couponSort } from '@/common/couponUtil.js'
+import {
+    fetchSelectedProducts,
+    findCouponBySelected,
+    canUseCoupon,
+    getCountPrice,
+    couponSort
+} from '@/common/couponUtil.js'
 
 
 export default {
 export default {
     components: {
     components: {
@@ -187,7 +193,7 @@ export default {
             return this.scrollTop > 0 && !this.isshowDelbtn
             return this.scrollTop > 0 && !this.isshowDelbtn
         },
         },
         currentCoupon() {
         currentCoupon() {
-            return this.canUseCouponList[this.currentCouponIndex]
+            return this.canUseCouponList[this.currentCouponIndex] || null
         },
         },
         nextCoupon() {
         nextCoupon() {
             if (this.currentCouponIndex <= 0) {
             if (this.currentCouponIndex <= 0) {
@@ -207,16 +213,16 @@ export default {
             return this.allPrice - this.discountedPrice
             return this.allPrice - this.discountedPrice
         },
         },
         couponTipText() {
         couponTipText() {
-            if (this.currentCouponIndex === -1) return ''
+            if (this.currentCouponIndex <= -1) return ''
             if (this.currentCoupon === this.nextCoupon) {
             if (this.currentCoupon === this.nextCoupon) {
                 if (this.nextCoupon.noThresholdFlag === 1) {
                 if (this.nextCoupon.noThresholdFlag === 1) {
                     return `已享“减${this.currentCoupon.couponAmount}元”优惠券`
                     return `已享“减${this.currentCoupon.couponAmount}元”优惠券`
                 }
                 }
                 return `已享“满${this.currentCoupon.touchPrice}元减${this.currentCoupon.couponAmount}元”优惠券`
                 return `已享“满${this.currentCoupon.touchPrice}元减${this.currentCoupon.couponAmount}元”优惠券`
             }
             }
-            return `还差¥${this.nextCoupon.touchPrice - getCountPrice(this.selectedPoducts, this.nextCoupon)}元可用“满${this.nextCoupon.touchPrice}元减${
-                this.nextCoupon.couponAmount
-            }元”优惠券`
+            return `还差¥
+                ${(this.nextCoupon.touchPrice - getCountPrice(this.selectedPoducts, this.nextCoupon)).toFixed(2)}
+                元可用“满${this.nextCoupon.touchPrice}元减${this.nextCoupon.couponAmount}元”优惠券`
         },
         },
         couponList() {
         couponList() {
             if (this.currentTabIndex === 0) {
             if (this.currentTabIndex === 0) {
@@ -323,7 +329,7 @@ export default {
             )
             )
         },
         },
         resetCouponUtil() {
         resetCouponUtil() {
-            if(this.receiveCouponList.length <= 0) return
+            if (this.receiveCouponList.length <= 0) return
             this.selectedPoducts = fetchSelectedProducts(this.goodsList)
             this.selectedPoducts = fetchSelectedProducts(this.goodsList)
             this.canUseCouponList = findCouponBySelected(this.productIds, this.receiveCouponList)
             this.canUseCouponList = findCouponBySelected(this.productIds, this.receiveCouponList)
             this.currentCouponIndex = canUseCoupon(0, this.productIds, this.canUseCouponList, this.selectedPoducts)
             this.currentCouponIndex = canUseCoupon(0, this.productIds, this.canUseCouponList, this.selectedPoducts)
@@ -335,12 +341,12 @@ export default {
             // 领取优惠券
             // 领取优惠券
             if (this.currentTabIndex === 1) {
             if (this.currentTabIndex === 1) {
                 this.getCouponList()
                 this.getCouponList()
-            }else{
+            } else {
                 this.couponVisible = false
                 this.couponVisible = false
             }
             }
         },
         },
         // 领取优惠券弹窗
         // 领取优惠券弹窗
-        receiveCoupon(){
+        receiveCoupon() {
             this.couponVisible = true
             this.couponVisible = true
             this.getCouponList()
             this.getCouponList()
         },
         },

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

@@ -47,7 +47,7 @@
             ></cm-active-popup>
             ></cm-active-popup>
             <!-- 领取优惠券提醒 -->
             <!-- 领取优惠券提醒 -->
             <cm-selector-coupons
             <cm-selector-coupons
-                :visible="tipVisible"
+                :visible="otherCouponFlag"
                 title="呵呵商城"
                 title="呵呵商城"
                 subTitle="您已获得优惠券奖励,赶紧去领取吧!"
                 subTitle="您已获得优惠券奖励,赶紧去领取吧!"
                 :image="StaticUrl + 'logo.png'"
                 :image="StaticUrl + 'logo.png'"
@@ -91,8 +91,10 @@ export default {
     onLoad(option) {
     onLoad(option) {
         // 处理分享链接
         // 处理分享链接
         this.shareHandle(option)
         this.shareHandle(option)
-        this.init()
-    },
+        setTimeout(() => {
+            this.init()
+        }, 1000)
+    }, 
     computed: {
     computed: {
         ...mapGetters(['hasLogin', 'activePopupType', 'userId', 'otherCouponFlag', 'showCouponPopup']),
         ...mapGetters(['hasLogin', 'activePopupType', 'userId', 'otherCouponFlag', 'showCouponPopup']),
         couponActivityIcon() {
         couponActivityIcon() {
@@ -121,21 +123,16 @@ export default {
         ...mapMutations('coupon', ['updatePopupType']),
         ...mapMutations('coupon', ['updatePopupType']),
         ...mapMutations('user', ['setInviteUserId']),
         ...mapMutations('user', ['setInviteUserId']),
         ...mapActions('cart', ['getCartNumber']),
         ...mapActions('cart', ['getCartNumber']),
+        ...mapActions('coupon', ['getCouponActivity']),
         // 首页初始化
         // 首页初始化
         async init() {
         async init() {
             try {
             try {
                 await this.GetHomeBanner() // 轮播图
                 await this.GetHomeBanner() // 轮播图
                 await this.GetHomeProductList() // 楼层
                 await this.GetHomeProductList() // 楼层
                 this.isRequest = false
                 this.isRequest = false
-                this.tipVisible = this.otherCouponFlag
             } catch (e) {
             } catch (e) {
                 this.$util.msg(e.msg, 2000)
                 this.$util.msg(e.msg, 2000)
             }
             }
-            if (this.tipVisible) {
-                setTimeout(() => {
-                    this.tipVisible = false
-                }, 5000)
-            }
         },
         },
         //初始化首页数据
         //初始化首页数据
         GetHomeBanner() {
         GetHomeBanner() {
@@ -155,7 +152,7 @@ export default {
         },
         },
         //跳转楼层
         //跳转楼层
         navToDetailPage(floor) {
         navToDetailPage(floor) {
-            this.$api.navigateTo(`/pages/goods/good-floorMore?floorId=${floor.floorId}&title=${floor.title}`)
+            this.$api.navigateTo(`/pages/goods/goods-floorMore?floorId=${floor.floorId}&title=${floor.title}`)
         },
         },
         // 点击了活动弹窗
         // 点击了活动弹窗
         activeClick() {
         activeClick() {

+ 3 - 6
pages/user/activity/coupon-list.vue

@@ -29,7 +29,7 @@
                         :image="baseUrl + 'icon-coupon-empty.png'"
                         :image="baseUrl + 'icon-coupon-empty.png'"
                         :offset="-12"
                         :offset="-12"
                     ></cm-empty>
                     ></cm-empty>
-                    <scroll-view scroll-y="true" class="coupon-scorll" @scrolltolower="scorllBottom" v-else>
+                    <scroll-view :scroll-y="item.couponList.length >= 5" class="coupon-scorll" @scrolltolower="scorllBottom" v-else>
                         <template v-for="(coupon, index) in item.couponList">
                         <template v-for="(coupon, index) in item.couponList">
                             <cm-coupon
                             <cm-coupon
                                 :key="index"
                                 :key="index"
@@ -69,7 +69,7 @@ export default {
             isRequest: true,
             isRequest: true,
             loadmore: false, // 正在加载更多
             loadmore: false, // 正在加载更多
             currentTab: 0,
             currentTab: 0,
-            pageSize: 6,
+            pageSize: 10,
             timer: null,
             timer: null,
             couponData: null
             couponData: null
         }
         }
@@ -108,9 +108,7 @@ export default {
         }
         }
     },
     },
     onLoad() {
     onLoad() {
-        this.couponData = this.resetCouponData()
         this.getWindowHeight()
         this.getWindowHeight()
-        this.initCouponList()
     },
     },
     onShow() {
     onShow() {
         this.couponData = this.resetCouponData()
         this.couponData = this.resetCouponData()
@@ -120,7 +118,7 @@ export default {
         // tab文字提示
         // tab文字提示
         makeTabText(number, text) {
         makeTabText(number, text) {
             if (number <= 0) return text
             if (number <= 0) return text
-            return number > 99 ? `${text} 99+` : `${text} ${number}`
+            return number > 99 ? `${text} (99+)` : `${text} (${number})`
         },
         },
         // 初始化列表
         // 初始化列表
         async initCouponList() {
         async initCouponList() {
@@ -232,7 +230,6 @@ export default {
     background: #f7f7f7;
     background: #f7f7f7;
     .coupon-list {
     .coupon-list {
         height: 100%;
         height: 100%;
-        overflow-y: scroll;
         .coupon-scorll {
         .coupon-scorll {
             height: 100%;
             height: 100%;
         }
         }

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

@@ -105,8 +105,8 @@ export default {
             currentCouponId: -1,
             currentCouponId: -1,
             currentCoupon: null,
             currentCoupon: null,
             loadingText: '正在创建订单',
             loadingText: '正在创建订单',
-            canUseCouponList:[],
-            notUseCouponList:[],
+            canUseCouponList: [],
+            notUseCouponList: []
         }
         }
     },
     },
     onLoad(option) {
     onLoad(option) {
@@ -147,7 +147,7 @@ export default {
             return {
             return {
                 order: this.orderInfo
                 order: this.orderInfo
             }
             }
-        },
+        }
     },
     },
     filters: {
     filters: {
         NumFormat(value) {
         NumFormat(value) {
@@ -192,12 +192,12 @@ export default {
             this.isRequest = false
             this.isRequest = false
         },
         },
         // 处理优惠券列表
         // 处理优惠券列表
-        resetCouponList(){
+        resetCouponList() {
             // 2将当前选中的优惠券从列表中删除
             // 2将当前选中的优惠券从列表中删除
             // 3将当前选中的优惠券放入最前面
             // 3将当前选中的优惠券放入最前面
             // 4返回最新的优惠券列表
             // 4返回最新的优惠券列表
             // 查找选中优惠券的索引
             // 查找选中优惠券的索引
-            const index = this.canUseCouponList.findIndex(coupon=>coupon.couponId === this.currentCouponId)
+            const index = this.canUseCouponList.findIndex(coupon => coupon.couponId === this.currentCouponId)
             // 从列表中删除
             // 从列表中删除
             const currentCoupon = this.canUseCouponList.splice(index, 1)
             const currentCoupon = this.canUseCouponList.splice(index, 1)
             // 重新排序 将选中的优惠券放到最前面
             // 重新排序 将选中的优惠券放到最前面
@@ -206,7 +206,7 @@ export default {
             this.receiveCouponList = [...this.canUseCouponList, ...this.notUseCouponList]
             this.receiveCouponList = [...this.canUseCouponList, ...this.notUseCouponList]
         },
         },
         // 确认选中
         // 确认选中
-        closeCouponList(){
+        closeCouponList() {
             this.couponVisible = false
             this.couponVisible = false
             this.resetCouponList()
             this.resetCouponList()
         },
         },
@@ -228,7 +228,7 @@ export default {
                     let data = response.data
                     let data = response.data
                     this.goodsData = data.shopList
                     this.goodsData = data.shopList
                     this.allPrice = data.totalPrice
                     this.allPrice = data.totalPrice
-                    
+
                     this.fetchCouponList()
                     this.fetchCouponList()
                 })
                 })
                 .catch(error => {
                 .catch(error => {
@@ -278,7 +278,12 @@ export default {
                 .then(response => {
                 .then(response => {
                     const data = response.data
                     const data = response.data
                     this.orderInfo = response.data
                     this.orderInfo = response.data
-                    this.miniWxPayFor(data)
+                    if (data.payableAmount === '0') {
+                        uni.setStorageSync('orderInfo', this.hanldOrder.order)
+                        uni.redirectTo({ url: '/pages/user/order/success' })
+                    } else {
+                        this.miniWxPayFor(data)
+                    }
                 })
                 })
                 .catch(error => {
                 .catch(error => {
                     this.isSubLoading = false
                     this.isSubLoading = false

+ 187 - 0
pages/user/order/error.vue

@@ -0,0 +1,187 @@
+<template>
+    <view class="container cashier">
+        <header-pay
+            :systeminfo="systeminfo"
+            :navbar-data="nvabarData"
+            :headerBtnPosi="headerBtnPosi"
+            :isBackType="true"
+            :path="'/pages/user/cart/cart'"
+        >
+        </header-pay>
+        <view class="container-cash clearfix" :style="{ marginTop: CustomBar + 'px' }">
+            <view class="container-wrapper">
+                <view class="cash-icon"> <image :src="StaticUrl + 'icon-pay-fail.png'" mode=""></image> </view>
+                <view class="cash-text">
+                    <text>{{ successText }}</text>
+                </view>
+            </view>
+            <view class="container-money">
+                <view class="label">支付金额</view>
+                <view class="money">¥{{ orderInfo.payableAmount | NumFormat }}</view>
+            </view>
+            <view class="container-button">
+                <view class="btn btn-pay" @click="miniWxPayFor(orderInfo)">重新支付</view>
+                <view class="btn btn-open" @click="searchOrder">查看订单</view>
+            </view>
+        </view>
+        <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
+    </view>
+</template>
+
+<script>
+import HeaderPay from '@/components/cm-module/headerNavbar/header-pay'
+import authorize from '@/common/authorize.js'
+import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
+import wechatPay from '@/mixins/wechatPay.js'
+import { mapGetters } from 'vuex'
+export default {
+    components: {
+        HeaderPay,
+        CmLoading
+    },
+    // 混入支付
+    mixins: [wechatPay],
+    data() {
+        return {
+            StaticUrl: this.$Static,
+            CustomBar: this.CustomBar, // 顶部导航栏高度
+            orderId: '',
+            nvabarData: {
+                //顶部自定义导航
+                haveBack: false,
+                showCapsule: 1, // 是否显示左上角图标  1表示显示  0表示不显示,
+                showSearch: 0,
+                title: '支付结果', // 导航栏 中间的标题
+                textLeft: this.$store.getters.isIphone
+            },
+            headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
+            systeminfo: this.setSysteminfo(), //获取设备信息
+            successText: '订单支付失败',
+            orderInfo: {}
+        }
+    },
+    onLoad() {
+        this.initOrderInfo()
+    },
+    filters: {
+        NumFormat(value) {
+            //处理金额
+            return Number(value).toFixed(2)
+        }
+    },
+    computed: {
+        ...mapGetters(['isIphoneX']),
+        hanldOrder() {
+            return {
+                order: this.orderInfo
+            }
+        }
+    },
+    methods: {
+        initOrderInfo() {
+            this.orderInfo = uni.getStorageSync('orderInfo')
+            uni.removeStorageSync('orderInfo')
+        },
+        setHeaderBtnPosi() {
+            // 获得胶囊按钮位置信息
+            let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
+            return headerBtnPosi
+        },
+        setSysteminfo() {
+            let systeminfo
+            uni.getSystemInfo({
+                // 获取设备信息
+                success: res => {
+                    systeminfo = res
+                }
+            })
+            return systeminfo
+        },
+        // 查看订单
+        searchOrder() {
+            this.$api.redirectTo('/pages/user/order/order-details?type=confim&orderId=' + this.orderInfo.orderId)
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+page {
+    background-color: #f7f7f7;
+    height: auto !important;
+}
+.container-cash {
+    width: 100%;
+    .container-wrapper {
+        width: 100%;
+        margin: 0 auto;
+        margin-top: 120rpx;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        background-color: #ffffff;
+        .cash-icon {
+            width: 210rpx;
+            height: 210rpx;
+            margin-top: 112rpx;
+            image {
+                width: 210rpx;
+                height: 210rpx;
+            }
+        }
+        .cash-text {
+            font-size: $font-size-28;
+            color: #666666;
+            line-height: 104rpx;
+            font-weight: bold;
+        }
+    }
+    .container-money {
+        width: 100%;
+        height: 90rpx;
+        float: left;
+        line-height: 90rpx;
+        font-size: $font-size-28;
+        box-sizing: border-box;
+        padding: 0 24rpx;
+        margin-top: 20rpx;
+        background-color: #ffffff;
+        .label {
+            float: left;
+            color: #333333;
+        }
+        .money {
+            float: right;
+            color: #666666;
+        }
+    }
+    .container-button {
+        width: 100%;
+        height: auto;
+        float: left;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        margin-top: 160rpx;
+        .btn {
+            width: 600rpx;
+            height: 90rpx;
+            border-radius: 45rpx;
+            line-height: 90rpx;
+            text-align: center;
+            font-size: $font-size-26;
+            color: #ffffff;
+            box-sizing: border-box;
+            border: 1px solid $color-system;
+            margin-bottom: 24rpx;
+            &.btn-open {
+                color: $color-system;
+            }
+            &.btn-pay {
+                border-color: $color-system;
+                background: $btn-confirm;
+            }
+        }
+    }
+}
+</style>

+ 12 - 10
pages/user/order/success.vue

@@ -10,7 +10,7 @@
         </header-pay>
         </header-pay>
         <view class="container-cash clearfix" :style="{ marginTop: CustomBar + 'px' }">
         <view class="container-cash clearfix" :style="{ marginTop: CustomBar + 'px' }">
             <view class="container-wrapper">
             <view class="container-wrapper">
-                <view class="cash-icon"> <image :src="StaticUrl + 'icon-pay-fail.png'" mode=""></image> </view>
+                <view class="cash-icon"> <image :src="StaticUrl + 'icon-pay-success.png'" mode=""></image> </view>
                 <view class="cash-text">
                 <view class="cash-text">
                     <text>{{ successText }}</text>
                     <text>{{ successText }}</text>
                 </view>
                 </view>
@@ -20,14 +20,8 @@
                 <view class="money">¥{{ orderInfo.payableAmount | NumFormat }}</view>
                 <view class="money">¥{{ orderInfo.payableAmount | NumFormat }}</view>
             </view>
             </view>
             <view class="container-button">
             <view class="container-button">
-                <view class="btn btn-pay" @click="miniWxPayFor(orderInfo)">重新支付</view>
-                <view
-                    class="btn btn-open"
-                    @click="
-                        this.$api.redirectTo('/pages/user/order/order-details?type=confim&orderId=' + orderInfo.orderId)
-                    "
-                    >查看订单</view
-                >
+                <view class="btn btn-pay" @click="goHome">继续购买</view>
+                <view class="btn btn-open" @click="searchOrder">查看订单</view>
             </view>
             </view>
         </view>
         </view>
         <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
         <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
@@ -62,7 +56,7 @@ export default {
             },
             },
             headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
             headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
             systeminfo: this.setSysteminfo(), //获取设备信息
             systeminfo: this.setSysteminfo(), //获取设备信息
-            successText: '订单支付失败',
+            successText: '订单支付成功',
             orderInfo: {}
             orderInfo: {}
         }
         }
     },
     },
@@ -102,6 +96,14 @@ export default {
                 }
                 }
             })
             })
             return systeminfo
             return systeminfo
+        },
+        // 回到首页
+        goHome() {
+            uni.reLaunch({ url: '/pages/tabBar/index/index' })
+        },
+        // 查看订单
+        searchOrder() {
+            this.$api.redirectTo('/pages/user/order/order-details?type=confim&orderId=' + this.orderInfo.orderId)
         }
         }
     }
     }
 }
 }

+ 5 - 2
store/modules/coupon.js

@@ -7,7 +7,7 @@ import { msg as showMsg } from '@/common/util.js'
 const state = {
 const state = {
     showCouponPopup: true, // 是否显示优惠券入口弹窗
     showCouponPopup: true, // 是否显示优惠券入口弹窗
     activePopupType: 0, // 0 禁用 1 老用户 2 新用户
     activePopupType: 0, // 0 禁用 1 老用户 2 新用户
-    otherCouponFlag: false,
+    otherCouponFlag: false, // 有待领取优惠券弹窗
     expiredNum: 0,
     expiredNum: 0,
     unusedNum: 0,
     unusedNum: 0,
     usedNum: 0
     usedNum: 0
@@ -64,11 +64,14 @@ const actions = {
             }
             }
             // 是否有新的优惠券可领取
             // 是否有新的优惠券可领取
             commit('setOtherCouponFlag', otherCouponFlag)
             commit('setOtherCouponFlag', otherCouponFlag)
+            setTimeout(() => {
+                commit('setOtherCouponFlag', false)
+            }, 5000)
             // 每次10分钟刷新一次 
             // 每次10分钟刷新一次 
             if (rootGetters.hasLogin) {
             if (rootGetters.hasLogin) {
                 setTimeout(() => {
                 setTimeout(() => {
                     dispatch('getCouponActivity')
                     dispatch('getCouponActivity')
-                }, 10 * 60 * 1000)
+                }, 5 * 60 * 1000)
             }
             }
         })
         })
     }
     }