yuwenjun1997 3 år sedan
förälder
incheckning
9d384a219b

+ 374 - 364
components/cm-module/cm-cart-product/cm-cart-product.vue

@@ -1,394 +1,404 @@
 <template>
-    <view class="cm-cart-product">
-        <template v-if="productList.length > 0">
-            <!-- 供应商名称 -->
-            <view class="shop-info">
-                <template v-if="isExpired">
-                    <view class="expired">失效商品{{ productList.length }}件</view>
-                    <view class="clear" @click="deletefailureList">清空失效商品</view>
-                </template>
-                <template v-else>
-                    <view
-                        class="radio iconfont"
-                        :class="data.checked ? 'icon-xuanze' : 'icon-weixuanze'"
-                        @click="chooseAll"
-                    ></view>
-                    <view class="name">{{ data.name }}</view>
-                </template>
-            </view>
-            <!-- 商品列表 -->
-            <view class="product-list">
-                <view
-                    class="row"
-                    v-for="(item, index) in productList"
-                    :key="index"
-                    :class="{ 'no-border': index === 0 }"
-                >
-                    <view
-                        class="radio iconfont"
-                        :class="item.productsChecked ? 'icon-xuanze' : 'icon-weixuanze'"
-                        @click="chooseOne(item)"
-                        v-if="isNormal || isDelete"
-                    ></view>
-                    <view class="expired" v-else>失效</view>
-                    <view class="product">
-                        <image class="cover" :src="item.mainImage"></image>
-                        <view class="content">
-                            <view class="title">{{ item.productName }}</view>
-                            <!-- 普通列表 -->
-                            <template v-if="isNormal">
-                                <view class="params">规格:{{ item.unit || '' }}</view>
-                                <view class="tags">
-                                    <view class="tag type1">{{ item.heUserId ? '促销' : '自营' }}</view>
-                                    <view
-                                        class="tag type2"
-                                        v-if="item.activeStatus == 1"
-                                        @click="clickPopupShow(item, 2)"
-                                        >活动价
-                                    </view>
-                                </view>
-                                <view class="footer">
-                                    <view class="price">¥{{ item.price | formatPrice }}</view>
-                                    <view>
-                                        <number-box
+	<view class="cm-cart-product">
+		<template v-if="productList.length > 0">
+			<!-- 供应商名称 -->
+			<view class="shop-info">
+				<template v-if="isExpired">
+					<view class="expired">失效商品{{ productList.length }}件</view>
+					<view class="clear" @click="deletefailureList">清空失效商品</view>
+				</template>
+				<template v-else>
+					<view
+						class="radio iconfont"
+						:class="data.checked ? 'icon-xuanze' : 'icon-weixuanze'"
+						@click="chooseAll"
+					></view>
+					<view class="name">{{ data.name }}</view>
+				</template>
+			</view>
+			<!-- 商品列表 -->
+			<view class="product-list">
+				<view
+					class="row"
+					v-for="(item, index) in productList"
+					:key="index"
+					:class="{ 'no-border': index === 0 }"
+				>
+					<view
+						class="radio iconfont"
+						:class="item.productsChecked ? 'icon-xuanze' : 'icon-weixuanze'"
+						@click="chooseOne(item)"
+						v-if="isNormal || isDelete"
+					></view>
+					<view class="expired" v-else>失效</view>
+					<view class="product">
+						<image class="cover" :src="item.mainImage"></image>
+						<view class="content">
+							<view class="title">{{ item.productName }}</view>
+							<!-- 普通列表 -->
+							<template v-if="isNormal">
+								<view class="params">规格:{{ item.unit || '' }}</view>
+								<view class="tags">
+									<view class="tag type1">{{ item.heUserId ? '促销' : '自营' }}</view>
+									<view
+										class="tag type2"
+										v-if="item.activeStatus == 1"
+										@click="clickPopupShow(item, 2)"
+									>
+										活动价
+									</view>
+								</view>
+								<view class="footer">
+									<view class="price">¥{{ item.price | formatPrice }}</view>
+									<view>
+										<cm-number-box
+											v-model="item.productCount"
+											:defaultVal="item.productCount"
+											:min="1"
+											max="1000"
+											@change="numberChange(item, $event)"
+										></cm-number-box>
+										<!-- <number-box
                                             @change="numberChange(item, $event)"
                                             v-if="!isDelete"
                                             :value="item.productCount"
-                                        ></number-box>
-                                    </view>
-                                </view>
-                            </template>
-                            <template v-if="isExpired">
-                                <view class="tip">商品已下架</view>
-                            </template>
-                        </view>
-                    </view>
-                </view>
-            </view>
-            <!-- 合计价格 -->
-            <!-- <view class="total" v-if="isNormal && !isDelete">
+                                        ></number-box> -->
+									</view>
+								</view>
+							</template>
+							<template v-if="isExpired">
+								<view class="tip">商品已下架</view>
+							</template>
+						</view>
+					</view>
+				</view>
+			</view>
+			<!-- 合计价格 -->
+			<!-- <view class="total" v-if="isNormal && !isDelete">
                 <text class="title">合计:</text> <text class="price">¥{{ data.totalPrice | formatPrice }}</text>
             </view> -->
-        </template>
-        <!-- 促销活动弹窗 -->
-        <activi-popup :product="handlerPros" :popupShow="popupShow"></activi-popup>
-        <!-- 操作弹窗 -->
-        <tui-modal
-            :show="modal"
-            @click="confirm"
-            @cancel="modal = false"
-            :content="contentModalText"
-            color="#333"
-            :size="32"
-            shape="circle"
-            :maskClosable="false"
-        ></tui-modal>
-        <cm-loading :visible="showLoading" text="加载中..."></cm-loading>
-    </view>
+		</template>
+		<!-- 促销活动弹窗 -->
+		<activi-popup :product="handlerPros" :popupShow="popupShow"></activi-popup>
+		<!-- 操作弹窗 -->
+		<tui-modal
+			:show="modal"
+			@click="confirm"
+			@cancel="modal = false"
+			:content="contentModalText"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		></tui-modal>
+		<cm-loading :visible="showLoading" text="加载中..."></cm-loading>
+	</view>
 </template>
 
 <script>
 import NumberBox from './number-box.vue'
 import activiPopup from '@/components/cm-module/productDetails/cm-activipopu'
 import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
+import CmNumberBox from '@/components/cm-module/cm-number-box/cm-number-box.vue'
 import { mapGetters, mapActions, mapMutations } from 'vuex'
 export default {
-    name: 'cm-cart-product',
-    components: {
-        NumberBox,
-        activiPopup,
-        CmLoading
-    },
-    data() {
-        return {
-            modal: false,
-            contentModalText: '',
-            popupShow: false,
-            handlerPros: {},
-            showLoading: false
-        }
-    },
-    props: {
-        // 列表类型 list普通列表  delete删除列表  expired失效列表
-        listType: {
-            type: String,
-            default: 'list'
-        },
-        // 数据
-        data: {
-            type: [Array, Object],
-            default: () => {}
-        },
-        vkey: {
-            type: String,
-            default: ''
-        }
-    },
-    computed: {
-        // 是普通商品列表
-        isNormal() {
-            return this.listType.indexOf('normal') !== -1
-        },
-        // 是失效商品列表
-        isExpired() {
-            return this.listType.indexOf('expired') !== -1
-        },
-        // 当前状态为删除状态
-        isDelete() {
-            return this.listType.indexOf('delete') !== -1
-        },
-        productList() {
-            if (this.isExpired) {
-                return this.data
-            } else {
-                return this.data[this.vkey]
-            }
-        }
-    },
-    methods: {
-        ...mapActions('cart', ['updateShoppogCount', 'removeFailureFromCart']),
-        ...mapMutations('cart', ['selectProduct', 'selectAllShopProduct', 'selectFailure']),
-        // 商品数量变化
-        numberChange(product, count) {
-            this.$emit('countChange')
-            this.countChange(product, count)
-        },
-        // 勾选 / 取消勾选 供应商下所有商品
-        chooseAll() {
-            this.selectAllShopProduct({
-                shopId: this.data.shopId,
-                checked: !this.data.checked
-            })
-            this.$emit('chooseAll')
-        },
-        // 勾选到单个商品
-        chooseOne(product) {
-            if (this.isNormal) {
-                this.selectProduct({
-                    shopId: this.data.shopId,
-                    productId: product.productId,
-                    checked: !product.productsChecked
-                })
-            } else {
-                this.selectFailure({
-                    productId: product.productId,
-                    checked: !product.productsChecked
-                })
-            }
-            this.$emit('chooseOne')
-        },
-        //商品数量加加
-        countChange(product, count) {
-            this.showLoading = true
-            this.updateShoppogCount({
-                cartId: product.cartId,
-                productCount: count
-            }).finally(() => {
-                this.showLoading = false
-            })
-        },
-        // 促销活动弹窗
-        clickPopupShow(pros, type) {
-            if (pros.ladderList.length > 0) {
-                this.popupShow = true
-                this.handlerPros = pros
-            }
-        },
-        // 清空失效商品
-        deletefailureList() {
-            this.modal = true
-            this.contentModalText = '确定清除所有失效商品吗?'
-        },
-        // 确认清空
-        confirm(e) {
-            if (e.index !== 1) return (this.modal = false)
-            this.showLoading = true
-            this.removeFailureFromCart().finally(() => {
-                this.modal = false
-                this.showLoading = false
-            })
-        }
-    }
+	name: 'cm-cart-product',
+	components: {
+		NumberBox,
+		activiPopup,
+		CmLoading,
+		CmNumberBox
+	},
+	data() {
+		return {
+			modal: false,
+			contentModalText: '',
+			popupShow: false,
+			handlerPros: {},
+			showLoading: false
+		}
+	},
+	props: {
+		// 列表类型 list普通列表  delete删除列表  expired失效列表
+		listType: {
+			type: String,
+			default: 'list'
+		},
+		// 数据
+		data: {
+			type: [Array, Object],
+			default: () => {}
+		},
+		vkey: {
+			type: String,
+			default: ''
+		}
+	},
+	computed: {
+		// 是普通商品列表
+		isNormal() {
+			return this.listType.indexOf('normal') !== -1
+		},
+		// 是失效商品列表
+		isExpired() {
+			return this.listType.indexOf('expired') !== -1
+		},
+		// 当前状态为删除状态
+		isDelete() {
+			return this.listType.indexOf('delete') !== -1
+		},
+		productList() {
+			if (this.isExpired) {
+				return this.data
+			} else {
+				return this.data[this.vkey]
+			}
+		}
+	},
+	methods: {
+		...mapActions('cart', ['updateShoppogCount', 'removeFailureFromCart']),
+		...mapMutations('cart', ['selectProduct', 'selectAllShopProduct', 'selectFailure']),
+		// 商品数量变化
+		numberChange(product, count) {
+			this.$emit('countChange')
+			this.countChange(product, count)
+		},
+		// 勾选 / 取消勾选 供应商下所有商品
+		chooseAll() {
+			this.selectAllShopProduct({
+				shopId: this.data.shopId,
+				checked: !this.data.checked
+			})
+			this.$emit('chooseAll')
+		},
+		// 勾选到单个商品
+		chooseOne(product) {
+			if (this.isNormal) {
+				this.selectProduct({
+					shopId: this.data.shopId,
+					productId: product.productId,
+					checked: !product.productsChecked
+				})
+			} else {
+				this.selectFailure({
+					productId: product.productId,
+					checked: !product.productsChecked
+				})
+			}
+			this.$emit('chooseOne')
+		},
+		//商品数量加加
+		countChange(product, count) {
+			this.showLoading = true
+			this.updateShoppogCount({
+				cartId: product.cartId,
+				productCount: count
+			}).finally(() => {
+				this.showLoading = false
+			})
+		},
+		// 促销活动弹窗
+		clickPopupShow(pros, type) {
+			if (pros.ladderList.length > 0) {
+				this.popupShow = true
+				this.handlerPros = pros
+			}
+		},
+		// 清空失效商品
+		deletefailureList() {
+			this.modal = true
+			this.contentModalText = '确定清除所有失效商品吗?'
+		},
+		// 确认清空
+		confirm(e) {
+			if (e.index !== 1) return (this.modal = false)
+			this.showLoading = true
+			this.removeFailureFromCart().finally(() => {
+				this.modal = false
+				this.showLoading = false
+			})
+		}
+	}
 }
 </script>
 
 <style lang="scss" scoped>
 $grid: 24rpx;
 .cm-cart-product {
-    overflow: hidden;
-    background: #fff;
-    margin-bottom: $grid;
+	overflow: hidden;
+	background: #fff;
+	margin-bottom: $grid;
 }
 .shop-info {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    padding: $grid $grid 0;
-    .name {
-        width: 622rpx;
-        font-size: 30rpx;
-        font-weight: bold;
-        color: #333333;
-    }
-    .expired {
-        font-size: 30rpx;
-        color: #333333;
-    }
-    .clear {
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        width: 184rpx;
-        height: 42rpx;
-        background: #fff8fd;
-        border: 1rpx solid #ff457b;
-        border-radius: 28rpx;
-        font-size: 26rpx;
-        color: #ff457b;
-    }
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+	padding: $grid $grid 0;
+	.name {
+		width: 622rpx;
+		font-size: 30rpx;
+		font-weight: bold;
+		color: #333333;
+	}
+	.expired {
+		font-size: 30rpx;
+		color: #333333;
+	}
+	.clear {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		width: 184rpx;
+		height: 42rpx;
+		background: #fff8fd;
+		border: 1rpx solid #ff457b;
+		border-radius: 28rpx;
+		font-size: 26rpx;
+		color: #ff457b;
+	}
 }
 .radio {
-    font-size: 36rpx;
-    color: #b2b2b2;
-    &.icon-xuanze {
-        color: #f83c6c;
-    }
+	font-size: 36rpx;
+	color: #b2b2b2;
+	&.icon-xuanze {
+		color: #f83c6c;
+	}
 }
 .product-list {
-    .row {
-        display: flex;
-        justify-content: space-between;
-        align-items: center;
-        margin: 0 $grid;
-        padding: 30rpx 0;
-        border-top: 1px solid #e1e1e1;
-        &.no-border {
-            border-top: 0;
-        }
-        &:last-child {
-            margin-bottom: 0;
-        }
-        .expired {
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            width: 72rpx;
-            height: 36rpx;
-            background: rgba(51, 51, 51, 0.3);
-            border-radius: 24rpx;
-            font-size: 24rpx;
-            color: #ffffff;
-        }
-    }
-    .product {
-        width: 622rpx;
-        display: flex;
-        justify-content: space-between;
-        align-items: center;
-        .cover {
-            width: 180rpx;
-            height: 180rpx;
-            box-sizing: border-box;
-            border: 1rpx dashed #e1e1e1;
-        }
-        .content {
-            width: 442rpx;
-            .title,
-            .tags,
-            .params,
-            .footer,
-            .tip {
-                padding-left: $grid;
-            }
-            .tags,
-            .params {
-                margin-top: 10rpx;
-            }
-            .tip {
-                margin-top: 80rpx;
-                margin-bottom: 0;
-                font-size: 26rpx;
-                color: #f83c6c;
-            }
-            .title {
-                height: 66rpx;
-                font-size: 26rpx;
-                color: #333333;
-                overflow: hidden;
-                text-overflow: ellipsis;
-                display: -webkit-box;
-                -webkit-line-clamp: 2; // 这里控制几行显示省略号
-                -webkit-box-orient: vertical;
-            }
-            .tags {
-                display: flex;
-                justify-content: flex-start;
-                align-items: center;
-                height: 24rpx;
-                .tag {
-                    display: flex;
-                    justify-content: center;
-                    align-items: center;
-                    height: 30rpx;
-                    margin-right: 8rpx;
-                    font-size: 22rpx;
-                    &.type1 {
-                        width: 56rpx;
-                        background: #ff457b;
-                        border-radius: 4rpx;
-                        color: #ffffff;
-                    }
-                    &.type2 {
-                        width: 80rpx;
-                        background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center
-                            no-repeat;
-                        background-size: 80rpx 30rpx;
-                        color: #f83c6c;
-                    }
-                }
-            }
-            .params {
-                font-size: 20rpx;
-                color: #999999;
-            }
-            .footer {
-                display: flex;
-                justify-content: space-between;
-                align-items: flex-end;
-                margin-top: 4rpx;
-                height: 48rpx;
-                .add-cart {
-                    display: flex;
-                    justify-content: center;
-                    align-items: center;
-                    width: 44rpx;
-                    height: 44rpx;
-                    background: #ff457b;
-                    color: #fff;
-                    border-radius: 50%;
-                }
-                .price {
-                    flex: 1;
-                    font-size: 26rpx;
-                    font-weight: 600;
-                    color: #f83c6c;
-                }
-            }
-        }
-    }
+	.row {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		margin: 0 $grid;
+		padding: 30rpx 0;
+		border-top: 1px solid #e1e1e1;
+		&.no-border {
+			border-top: 0;
+		}
+		&:last-child {
+			margin-bottom: 0;
+		}
+		.expired {
+			display: flex;
+			justify-content: center;
+			align-items: center;
+			width: 72rpx;
+			height: 36rpx;
+			background: rgba(51, 51, 51, 0.3);
+			border-radius: 24rpx;
+			font-size: 24rpx;
+			color: #ffffff;
+		}
+	}
+	.product {
+		width: 622rpx;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		.cover {
+			width: 180rpx;
+			height: 180rpx;
+			box-sizing: border-box;
+			border: 1rpx dashed #e1e1e1;
+		}
+		.content {
+			width: 442rpx;
+			.title,
+			.tags,
+			.params,
+			.footer,
+			.tip {
+				padding-left: $grid;
+			}
+			.tags,
+			.params {
+				margin-top: 10rpx;
+			}
+			.tip {
+				margin-top: 80rpx;
+				margin-bottom: 0;
+				font-size: 26rpx;
+				color: #f83c6c;
+			}
+			.title {
+				height: 66rpx;
+				font-size: 26rpx;
+				color: #333333;
+				overflow: hidden;
+				text-overflow: ellipsis;
+				display: -webkit-box;
+				-webkit-line-clamp: 2; // 这里控制几行显示省略号
+				-webkit-box-orient: vertical;
+			}
+			.tags {
+				display: flex;
+				justify-content: flex-start;
+				align-items: center;
+				height: 24rpx;
+				.tag {
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					height: 30rpx;
+					margin-right: 8rpx;
+					font-size: 22rpx;
+					&.type1 {
+						width: 56rpx;
+						background: #ff457b;
+						border-radius: 4rpx;
+						color: #ffffff;
+					}
+					&.type2 {
+						width: 80rpx;
+						background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center
+							no-repeat;
+						background-size: 80rpx 30rpx;
+						color: #f83c6c;
+					}
+				}
+			}
+			.params {
+				font-size: 20rpx;
+				color: #999999;
+			}
+			.footer {
+				display: flex;
+				justify-content: space-between;
+				align-items: flex-end;
+				margin-top: 4rpx;
+				height: 48rpx;
+				.add-cart {
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					width: 44rpx;
+					height: 44rpx;
+					background: #ff457b;
+					color: #fff;
+					border-radius: 50%;
+				}
+				.price {
+					flex: 1;
+					font-size: 26rpx;
+					font-weight: 600;
+					color: #f83c6c;
+				}
+			}
+		}
+	}
 }
 .total {
-    display: flex;
-    justify-content: flex-end;
-    align-items: center;
-    padding: 30rpx $grid;
-    font-size: 26rpx;
-    font-weight: bold;
-    .title {
-        color: #333333;
-    }
-    .price {
-        color: #ff457b;
-    }
+	display: flex;
+	justify-content: flex-end;
+	align-items: center;
+	padding: 30rpx $grid;
+	font-size: 26rpx;
+	font-weight: bold;
+	.title {
+		color: #333333;
+	}
+	.price {
+		color: #ff457b;
+	}
 }
 </style>

+ 1 - 1
components/cm-module/cm-goods-nav/cm-goods-nav.vue

@@ -18,7 +18,7 @@
                     <view class="right">
                         <view class="number">
                             <text>数量:</text>
-                            <cm-number-box v-model="count" :min="1" :max="maxCount"></cm-number-box>        
+                            <cm-number-box v-model="count" :min="1" :max="maxCount" :defaultVal="count"></cm-number-box>        
                         </view>
                         <view class="single-price">
                             <text>单价:¥</text> <text class="price">{{ buyRetailPrice | formatPrice }}</text>

+ 17 - 9
components/cm-module/cm-number-box/cm-number-box.vue

@@ -23,6 +23,10 @@ export default {
             type: Number,
             default: 0
         },
+		defaultVal: {
+			type:Number,
+			default: 0
+		},
         max: {
             type: Number,
             default: 99999999
@@ -34,39 +38,43 @@ export default {
     },
     watch: {
         count(nVal){
-            this.count = parseInt(nVal)
-        }
+			this.count = parseInt(nVal)
+        },
+		defaultVal(nVal){
+			this.count = nVal
+		}
     },
     created() {
-      this.count = this.value  
+      this.count = this.defaultVal  
     },
     methods: {
         add() {
             if (this.count === this.max) {
-                this.$util.msg(`购买数量不能大于${this.max}`, 2000)
-                return
+                return this.$util.msg(`购买数量不能大于${this.max}`, 2000)
             }
             this.count++
             this.$emit('input', this.count)
+			this.$emit('change', this.count)
         },
         sub() {
             if (this.count === this.min) {
-                this.$util.msg(`购买数量不能少于${this.min}`, 2000)
-                return
+                return this.$util.msg(`购买数量不能少于${this.min}`, 2000)
             }
             this.count--
             this.$emit('input', this.count)
+			this.$emit('change', this.count)
         },
         blur() {
             if (this.count > this.max) {
                 this.count = this.max
-                this.$util.msg(`购买数量不能大于${this.max}`, 2000)
+                return this.$util.msg(`购买数量不能大于${this.max}`, 2000)
             }
             if (this.count < this.min) {
                 this.count = this.min
-                this.$util.msg(`购买数量不能少于${this.min}`, 2000)
+                return this.$util.msg(`购买数量不能少于${this.min}`, 2000)
             }
             this.$emit('input', this.count)
+			this.$emit('change', this.count)
         }
     }
 }

+ 0 - 3
pages/fight-order/fight-share-entry.vue

@@ -124,8 +124,6 @@ export default {
     onLoad(options) {
         this.collageId = options.collageId
         this.initiatorId = options.initiatorId
-        // 用户登录 获取拼团信息
-        // await this.wechatlogin()
         setTimeout(()=>{
             this.fetchOrderDetails()
         }, 2000)
@@ -134,7 +132,6 @@ export default {
       !this.isRequest && this.countDown()  
     },
     methods: {
-        ...mapActions('user', ['wechatlogin']),
         handleClick(type) {
             if (!this.hasLogin) {
                 // 保存当前页面链接参数

+ 4 - 4
pages/goods/cart.vue

@@ -54,7 +54,7 @@
                     <view class="center">
                         <view class="row">
                             <text>总价:</text> <text class="total-price">
-                                <text>¥{{ allPrice | formatPrice }}</text>
+                                <text>¥{{ finallyPrice | formatPrice }}</text>
                                 <text class="delete" v-if="allPrice > finallyPrice">¥{{ allPrice | formatPrice }}</text>
                             </text>
                         </view>
@@ -97,7 +97,7 @@
             title="优惠明细"
             :visible="showDitail"
             position="bottom"
-            :offset="100"
+            :offset="120"
             @close="showDitail = false"
             zIndex="99"
         >
@@ -115,7 +115,7 @@
                     <view class="row total">
                         <text>总计</text> 
                         <text>¥{{ finallyPrice | formatPrice }}</text>
-                        <text class="delete">9999.99</text>
+                        <!-- <text class="delete">9999.99</text> -->
                     </view>
                     <view class="tip"> 实际订单金额以结算页为准 </view>
                 </view>
@@ -341,7 +341,7 @@ export default {
         this.initCart().finally(() => {
             setTimeout(() => {
                 uni.stopPullDownRefresh()
-            }, 2000)
+            }, 500)
         })
     },
     onShow() {

+ 142 - 144
pages/login/login.vue

@@ -1,51 +1,51 @@
 <template>
-    <view class="container login">
-        <!-- logo区域 -->
-        <view class="login-main">
-            <image class="logo" :src="StaticUrl + 'icon-logo@2x.png'" mode="widthFix"></image>
-        </view>
-        <!-- 邀请码 -->
-        <view class="login-input">
-            <input
-                class="input"
-                type="number"
-                v-model="params.mobile"
-                @blur="handBlurInput"
-                placeholder="请输入手机号"
-                maxlength="11"
-            />
-        </view>
-        <view class="login-input">
-            <input
-                class="input_code"
-                type="number"
-                v-model="params.verificationCode"
-                placeholder="请输入短信验证码"
-                maxlength="6"
-            />
-            <view class="code-btn" :class="[isMobileDisabled ? 'disabled' : '']">
-                <button type="button" @click.stop="GetMobileCodeFn" :disabled="isMobileDisabled" class="button">
-                    {{ mobileCodeText }}
-                </button>
-            </view>
-        </view>
-        <!-- 提示信息 -->
-        <view class="logo-message"
-            ><text>{{ loginMessage }}</text></view
-        >
-        <button
-            class="login-btn"
-            :class="[isLoginStatus ? 'disabled' : '']"
-            type="primary"
-            open-type="getUserInfo"
-            size="small"
-            @click="SubMitLogins"
-            lang="zh_CN"
-        >
-            登录
-        </button>
-        <cm-loading text="登录中..." :visible="isLogin"></cm-loading>
-    </view>
+	<view class="container login">
+		<!-- logo区域 -->
+		<view class="login-main">
+			<image class="logo" :src="StaticUrl + 'icon-logo@2x.png'" mode="widthFix"></image>
+		</view>
+		<!-- 邀请码 -->
+		<view class="login-input">
+			<input
+				class="input"
+				type="number"
+				v-model="params.mobile"
+				@blur="handBlurInput"
+				placeholder="请输入手机号"
+				maxlength="11"
+			/>
+		</view>
+		<view class="login-input">
+			<input
+				class="input_code"
+				type="number"
+				v-model="params.verificationCode"
+				placeholder="请输入短信验证码"
+				maxlength="6"
+			/>
+			<view class="code-btn" :class="[isMobileDisabled ? 'disabled' : '']">
+				<button type="button" @click.stop="GetMobileCodeFn" :disabled="isMobileDisabled" class="button">
+					{{ mobileCodeText }}
+				</button>
+			</view>
+		</view>
+		<!-- 提示信息 -->
+		<view class="logo-message">
+			<text>{{ loginMessage }}</text>
+		</view>
+		<button
+			class="login-btn"
+			:class="[isLoginStatus ? 'disabled' : '']"
+			type="primary"
+			open-type="getUserInfo"
+			size="small"
+			@click="SubMitLogins"
+			lang="zh_CN"
+		>
+			登录
+		</button>
+		<cm-loading text="登录中..." :visible="isLogin"></cm-loading>
+	</view>
 </template>
 
 <script>
@@ -148,15 +148,13 @@ export default {
         },
         // 登录
         async LoginGetUser() {
+			this.isLogin = true
             try {
-                this.isLogin = true
                 await this.customLogin(this.params)
-                this.isLogin = false
                 this.hasProfile = false
-            } catch (e) {
-                this.isLogin = false
-                this.hasProfile = false
-            }
+            } finally {
+				this.isLogin = false
+			}
         },
         //获取手机验证码
         GetMobileCodeFn() {
@@ -210,96 +208,96 @@ export default {
 
 <style lang="scss">
 .login {
-    display: flex;
-    align-items: center;
-    flex-direction: column;
-    .login-main,
-    .login-title,
-    .logo-message {
-        width: 590rpx;
-    }
-    .login-main {
-        display: flex;
-        justify-content: center;
-        margin: 180rpx 0 60rpx;
-        .logo {
-            width: 200rpx;
-            height: 200rpx;
-            display: block;
-        }
-    }
-    .login-title {
-        display: flex;
-        justify-content: flex-start;
-        image {
-            width: 40rpx;
-            height: 40rpx;
-            margin-right: 6rpx;
-        }
-    }
-    .login-btn {
-        width: 600rpx;
-        height: 90rpx;
-        text-align: center;
-        line-height: 90rpx;
-        background: $btn-confirm;
-        border-radius: 45rpx;
-        color: #fff !important;
-        margin-top: 40rpx;
-        &.disabled {
-            background: #e1e1e1;
-            color: #999999;
-        }
-    }
-    .login-input {
-        margin: 10rpx 0;
-        width: 600rpx;
-        height: 90rpx;
-        box-sizing: border-box;
-        padding: 25rpx 0;
-        border-bottom: 1px solid #e1e1e1;
-        .input {
-            width: 100%;
-            height: 40rpx;
-            left: 40rpx;
-            font-size: $font-size-28;
-            color: #333333;
-        }
-        .input_code {
-            width: 420rpx;
-            height: 40rpx;
-            left: 40rpx;
-            font-size: $font-size-28;
-            color: #333333;
-            float: left;
-        }
-        .code-btn {
-            width: 180rpx;
-            height: 40rpx;
-            line-height: 40rpx;
-            font-size: $font-size-28;
-            color: #333333;
-            float: right;
-            text-align: center;
-            .button {
-                width: 180rpx;
-                height: 40rpx;
-                line-height: 40rpx;
-                padding: 0;
-                color: $color-system;
-            }
-            &.disabled {
-                .button {
-                    color: #b2b2b2;
-                }
-            }
-        }
-    }
-    .logo-message {
-        font-size: 24rpx;
-        line-height: 44rpx;
-        color: #fc464c;
-        text-align: left;
-    }
+	display: flex;
+	align-items: center;
+	flex-direction: column;
+	.login-main,
+	.login-title,
+	.logo-message {
+		width: 590rpx;
+	}
+	.login-main {
+		display: flex;
+		justify-content: center;
+		margin: 180rpx 0 60rpx;
+		.logo {
+			width: 200rpx;
+			height: 200rpx;
+			display: block;
+		}
+	}
+	.login-title {
+		display: flex;
+		justify-content: flex-start;
+		image {
+			width: 40rpx;
+			height: 40rpx;
+			margin-right: 6rpx;
+		}
+	}
+	.login-btn {
+		width: 600rpx;
+		height: 90rpx;
+		text-align: center;
+		line-height: 90rpx;
+		background: $btn-confirm;
+		border-radius: 45rpx;
+		color: #fff !important;
+		margin-top: 40rpx;
+		&.disabled {
+			background: #e1e1e1;
+			color: #999999;
+		}
+	}
+	.login-input {
+		margin: 10rpx 0;
+		width: 600rpx;
+		height: 90rpx;
+		box-sizing: border-box;
+		padding: 25rpx 0;
+		border-bottom: 1px solid #e1e1e1;
+		.input {
+			width: 100%;
+			height: 40rpx;
+			left: 40rpx;
+			font-size: $font-size-28;
+			color: #333333;
+		}
+		.input_code {
+			width: 420rpx;
+			height: 40rpx;
+			left: 40rpx;
+			font-size: $font-size-28;
+			color: #333333;
+			float: left;
+		}
+		.code-btn {
+			width: 180rpx;
+			height: 40rpx;
+			line-height: 40rpx;
+			font-size: $font-size-28;
+			color: #333333;
+			float: right;
+			text-align: center;
+			.button {
+				width: 180rpx;
+				height: 40rpx;
+				line-height: 40rpx;
+				padding: 0;
+				color: $color-system;
+			}
+			&.disabled {
+				.button {
+					color: #b2b2b2;
+				}
+			}
+		}
+	}
+	.logo-message {
+		font-size: 24rpx;
+		line-height: 44rpx;
+		color: #fc464c;
+		text-align: left;
+	}
 }
 </style>

+ 22 - 21
pages/order/create-order.vue

@@ -59,7 +59,7 @@
             :couponList="receiveCouponList"
             @chooseCoupon="chooseCoupon"
             @confirm="closeCouponList"
-            :currentId="currentCouponId"
+            :currentId="currentCouponUniqueId"
         ></cm-coupon-list>
         <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
         <view class="reserved" v-if="isIphoneX"></view>
@@ -122,11 +122,11 @@ export default {
 
             // 优惠券
             couponVisible: false,
-            receiveCouponList: [],
-            currentCouponId: -1,
-            currentCoupon: {},
-            canUseCouponList: [],
-            notUseCouponList: [],
+            receiveCouponList: [], // 已领取优惠券列表
+            currentCouponUniqueId: -1, // 选中的优惠券唯一id 注意:非优惠券id,选中优惠券id通过currentCoupon.couponId获取
+            currentCoupon: {}, // 选中的优惠券信息
+            canUseCouponList: [], // 能够使用的优惠券列表
+            notUseCouponList: [], // 暂未满足条件的优惠券列表
 
             // 拼团
             collageFlag: 0, //拼团标识:0不参与拼团,1参与拼团
@@ -145,17 +145,18 @@ export default {
         ...mapGetters(['userId', 'isIphoneX']),
         // 选中的优惠券的金额
         couponAmount() {
-            return this.currentCouponId > -1 ? this.currentCoupon.couponAmount : 0
+            return this.currentCoupon.couponAmount || 0
         },
-        // 优惠价格
-        discountedPrice() {
-            return this.couponAmount + this.shareReducedAmount
-        },
-        // 支付金额
+        // 最终支付金额
         payAllPrice() {
             const payAllPrice = this.allPrice - this.couponAmount - this.shareReducedAmount
             return payAllPrice <= 0 ? 0 : payAllPrice
         },
+		// 总优惠价格
+		discountedPrice() {
+		    return this.couponAmount + this.shareReducedAmount
+		},
+		// 提交组件状态信息
         submitOrderInfo() {
             return {
                 allCount: this.allCount,
@@ -167,7 +168,7 @@ export default {
         discountInfo() {
             return {
                 //优惠券ID
-                couponId: this.currentCouponId === -1 ? 0 : this.currentCoupon.couponId,
+                couponId: this.currentCoupon.couponId || 0,
                 //优惠券分享ID
                 couponShareId: this.currentCoupon.couponShareId || 0,
                 //拼团标识:0不参与拼团,1参与拼团
@@ -182,7 +183,7 @@ export default {
         shareReducedAmount(){
             return (this.reduction && this.shareReductStatus) ? this.reduction.reducedAmount : 0
         },
-        // 分享减免状态信息
+        // 分享减免组件状态信息
         shareReductionData(){
             return {
                 status: this.shareReductStatus,
@@ -313,8 +314,8 @@ export default {
             this.receiveCouponList = [...couponSort(this.canUseCouponList), ...couponSort(this.notUseCouponList)]
             // 当有可用优惠券时 默认选取第一个最优惠的
             if (this.canUseCouponList.length > 0) {
-                this.currentCouponId = this.receiveCouponList[0].uniqueId
-                this.currentCoupon = this.receiveCouponList[0]
+                this.currentCouponUniqueId = this.receiveCouponList[0].uniqueId
+                this.currentCoupon = this.receiveCouponList[0] || {}
             }
             // 显示界面
             this.isRequest = false
@@ -326,7 +327,7 @@ export default {
             // 2将当前选中的优惠券放入最前面
             // 3返回最新的优惠券列表
             // 4查找选中优惠券的索引
-            const index = this.canUseCouponList.findIndex(coupon => coupon.uniqueId === this.currentCouponId)
+            const index = this.canUseCouponList.findIndex(coupon => coupon.uniqueId === this.currentCouponUniqueId)
             // 从列表中删除
             const currentCoupon = this.canUseCouponList.splice(index, 1)
             // 重新排序 将选中的优惠券放到最前面
@@ -345,10 +346,10 @@ export default {
         chooseCoupon(coupon) {
             if (coupon.couponId > -1) {
                 this.currentCoupon = coupon
-                this.currentCouponId = coupon.uniqueId
+                this.currentCouponUniqueId = coupon.uniqueId
             } else {
-                this.currentCoupon = null
-                this.currentCouponId = -1
+                this.currentCoupon = {}
+                this.currentCouponUniqueId = -1
             }
             // this.couponVisible = false
         },
@@ -405,7 +406,7 @@ export default {
 
             // 调试提交参数
             console.log(this.subParams)
-            // return
+            return
 
             this.isSubLoading = true
             this.loadingText = '正在创建订单...'

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

@@ -287,7 +287,7 @@ export default {
         this.initCart().finally(() => {
             setTimeout(() => {
                 uni.stopPullDownRefresh()
-            }, 2000)
+            }, 500)
         })
     },
     onPageScroll(e) {

+ 2 - 2
store/modules/user.js

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