Selaa lähdekoodia

commit - sku版本需要

zhengjinyi 2 vuotta sitten
vanhempi
commit
972f59b902

+ 83 - 192
components/cm-module/cart-components/cm-unit-popup.vue

@@ -4,45 +4,45 @@
 		<view class="tui-popup-box clearfix">
 			<view class="tui-shopping-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 				<view class="tui-sku-title">
-					<view class="tui-sku-image"> <image :src="product.image" mode=""></image> </view>
+					<view class="tui-sku-image"> <image :src="skuProduct.image" mode=""></image> </view>
 					<view class="tui-sku-price">
 						<view class="sku-price-viw">
 							<view class="sku-price-text"
-								  :class="PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''"
+								  :class="PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1 ? 'none' : ''"
 							>
 								¥{{
-									(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-										? product.originalPrice
-										: product.price) | NumFormat
+									(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+										? skuProduct.originalPrice
+										: skuProduct.price) | NumFormat
 								}}
 							</view>
 						</view>
 						<view class="sku-price-vip">
 							<view class="floor-item-act">
-								<view class="coupon-tags" v-if="product.couponsLogo">优惠券</view>
-								<template v-if="product.actStatus == 1 && product.promotions">
-									<view v-if="PromotionsFormat(product.promotions)" class="floor-tags">
-										{{ product.promotions.name }}
-										<text v-if="product.promotions != null && product.promotions.type != 3">
+								<view class="coupon-tags" v-if="skuProduct.couponsLogo">优惠券</view>
+								<template v-if="skuProduct.actStatus == 1 && skuProduct.promotions">
+									<view v-if="PromotionsFormat(skuProduct.promotions)" class="floor-tags">
+										{{ skuProduct.promotions.name }}
+										<text v-if="skuProduct.promotions != null && skuProduct.promotions.type != 3">
 											:¥{{
-												product.promotions == null
+												skuProduct.promotions == null
 													? '0.00'
-													: product.promotions.touchPrice | NumFormat
+													: skuProduct.promotions.touchPrice | NumFormat
 											}}
 										</text>
 									</view>
-									<view v-else-if="product.promotions.type != 3" class="floor-tags">
-										{{ product.promotions.name }}
+									<view v-else-if="skuProduct.promotions.type != 3" class="floor-tags">
+										{{ skuProduct.promotions.name }}
 									</view>
 								</template>
-								<template v-if="product.actStatus == null && product.ladderFlag == 1">
+								<template v-if="skuProduct.actStatus == null && skuProduct.ladderFlag == 1">
 									<view class="floor-tags">阶梯价格</view>
 								</template>
-								<template v-if="product.svipProductFlag == 1">
+								<template v-if="skuProduct.svipProductFlag == 1">
 									<view class="svip-tags">
 										<view class="tags" :class="{ none: vipFlag != 1 }">SVIP</view>
-										<view class="price" v-if="isShowVipFlag(product)">{{
-											product.svipPriceTag
+										<view class="price" v-if="isShowVipFlag(skuProduct)">{{
+											skuProduct.svipPriceTag
 										}}</view>
 									</view>
 								</template>
@@ -60,12 +60,12 @@
 							:key="index"
 							:class="skuIndex === index ? 'active' : ''"
 						>
-							{{ sku.unit }} <text class="tips">缺货</text>
+							{{ sku.unit }} <text class="tips" v-if="sku.stock === 0">缺货</text>
 						</view>
 					</view>
 				</view>
 				<view class="sku-unit-nunbox">
-					<view class="sku-unit-nunbox" v-if="product.step === 2">
+					<view class="sku-unit-nunbox" v-if="skuProduct.step === 2">
 						<view class="text">*该商品只能以起订量的整数倍购买</view>
 					</view>
 					<view class="sku-unit-nunbox-t">
@@ -74,18 +74,18 @@
 							<view class="number-box">
 								<view
 									class="iconfont icon-jianhao"
-									@click="changeCountSub"
+									@click="skuChangNumberSub"
 								></view>
 								<input
 									class="btn-input"
 									type="number"
-									v-model="product.number"
+									v-model="addParams.count"
 									maxlength="4"
-									@blur="changeNumber($event)"
+									@blur="skuChangNumberChange($event)"
 								/>
 								<view
 									class="iconfont icon-jiahao"
-									@click="changeCountAdd"
+									@click="skuChangNumberAdd"
 								></view>
 							</view>
 						</view>
@@ -95,7 +95,7 @@
 			<view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 				<view class="tui-modal-flex">
 					<view class="tui-modal-button cancel" @click="hidePopup">取消</view>
-					<view class="tui-modal-button confirm" @click="handleConfirm">确定</view>
+					<view class="tui-modal-button confirm" :class="isBtnDisable ? 'disabled' :''" @click="handleConfirm">确定</view>
 				</view>
 			</view>
 		</view>
@@ -111,7 +111,7 @@ export default {
 		uniGrader
 	},
 	props: {
-		product: {
+		skuProduct: {
 			type: Object
 		},
 		popupShow: {
@@ -125,155 +125,23 @@ export default {
 	},
 	data() {
 		return {
-			isBtnDisabled:false,
+			isBtnDisable:false,
 			vipFlag: 0, // 是否是超级会员 0否 1是
 			skuIndex: 0,
 			number: 0,
-			buyRetailPrice: 0,
 			ladderPriceList: [],
 			isQuantity: false,
-			skuList: [
-				{
-					unit: '135ml70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: ' 精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【70ml】2瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【35ml】4瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				}
-			]
+			skuList: [],
+			handleStock:0,// 规格库存
+			handleMinNumber:1, // 规格起订量
+			addParams:{
+				oldSkuId:0,
+				newSkuId:0,
+				count:0,
+				productId:0,
+				userId:0,
+				source:1
+			},
 		}
 	},
 	filters: {
@@ -283,9 +151,12 @@ export default {
 		}
 	},	
 	created() {
-		this.number = this.product.minBuyNumber
-		this.buyRetailPrice = this.product.price
-		this.ladderPriceList = this.product.ladderPriceList ? this.product.ladderPriceList : null
+		this.skuList = this.skuProduct.skus
+		this.addParams.productId = this.skuProduct.productId
+		this.addParams.oldSkuId = this.skuProduct.skuId
+		this.addParams.count = this.skuList[0].minBuyNumber
+		this.handleMinNumber = this.skuList[0].minBuyNumber
+		this.handleStock = this.skuList[0].stock
 		this.initData()
 	},
 	computed: {
@@ -295,25 +166,8 @@ export default {
 		async initData(data) {
 			const userInfo = await this.$api.getStorage()
 			this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
+			this.addParams.userId = userInfo.userId ? userInfo.userId : 0
 			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
-			//处理禁用按钮商品
-			this.isBtnDisabled = this.isDisabledFlag(this.product)
-		},
-		isDisabledFlag(pros){
-			// 非会员
-			if (!this.vipFlag === 1) return true
-			// 商品已下架 || 库存为0 
-			if (pros.validFlag == 3 || pros.stock == 0) return true
-			// 商品价格不公开
-			if (pros.priceFlag === 1) return true
-			// 商品价格仅资质机构可见 && 机构为普通机构
-			if (pros.priceFlag === 2 && this.userIdentity === 4 ) return true
-			// 商品价格仅医美机构可见 && 机构为普通机构 
-			if (pros.priceFlag === 3 && this.userIdentity === 4 ) return true
-			// 商品价格仅医美机构可见 && 机构为资质机构 && 不是医美机构
-			if (pros.priceFlag === 3 && this.userIdentity === 2 && this.firstClubType != 1) return true
-			//其他
-			return false
 		},
 		PromotionsFormat(promo) {
 			//促销活动类型数据处理
@@ -338,13 +192,47 @@ export default {
 			// 其它
 			return false
 		}, 
+		skuChangNumberSub() {// 减数
+			if ( this.addParams.count <= this.handleMinNumber) {
+				this.addParams.count = this.handleMinNumber
+			} else {
+				if (this.skuProduct.step == 2) {
+					this.addParams.count -= this.handleMinNumber
+				} else {
+					this.addParams.count--
+				}
+			}
+		},
+		skuChangNumberAdd() {// 加数
+			if(this.addParams.count === this.handleStock){ return }
+			if (this.skuProduct.step === 2) {
+				this.addParams.count += this.handleMinNumber;
+			} else {
+				this.addParams.count++;
+			}
+		},
+		skuChangNumberChange() {// 修改
+			if (this.addParams.count < this.handleMinNumber || this.addParams.count % this.handleMinNumber != 0) {
+				this.addParams.count = this.handleMinNumber;
+			}else if(this.addParams.count > this.handleStock) {
+				this.addParams.count = this.handleStock;
+			}
+		},
 		handleConfirm() {
-			this.$emit('buyConfirm', data)
+			if(this.isBtnDisable){ return }
+			this.$emit('skuBtnConfirm', this.addParams)
 			this.$parent.popupShow2 = false
 		},
 		handleChoisSku(sku, index) {
 			// 选择SKU
 			this.skuIndex = index
+			this.addParams.newSkuId = sku.skuId;
+			this.addParams.count = sku.minBuyNumber;
+			this.handleStock = sku.stock;
+			this.handleMinNumber = sku.minBuyNumber;
+			this.skuProduct.price = sku.price;
+			this.skuProduct.originalPrice = sku.originalPrice;
+			this.isBtnDisable = sku.stock === 0;
 		},
 		hidePopup() {
 			this.$parent.popupShow2 = false
@@ -545,6 +433,9 @@ export default {
 			&.confirm {
 				background: $btn-confirm;
 				color: #ffffff;
+				&.disabled {
+					background: linear-gradient(135deg, rgba(242, 143, 49, 0.5) 0%, rgba(225, 86, 22, 0.5) 100%);
+				}
 			}
 		}
 	}

+ 79 - 284
components/cm-module/cart-components/index.vue

@@ -36,7 +36,7 @@
 						<view v-for="(item, index) in goodsList" :key="index" class="goods-item clearfix">
 							<view class="shoptitle">
 								<!--选择商店的全部商品"-->
-								<view class="checkbox-box" @click.stop="checkShop(item)">
+								<view class="checkbox-box" @click.stop="handleCheckShop(item)">
 									<view
 										class="checkbox iconfont"
 										:class="[item.isChecked ? 'icon-yixuanze' : 'icon-weixuanze']"
@@ -56,7 +56,7 @@
 								<view class="goods-pros" v-for="(pros, idx) in item.cartList" :key="idx">
 									<view class="goods-pros-t">
 										<!--选择商品-->
-										<view class="checkbox-box" @click.stop="ischeck(item, pros)">
+										<view class="checkbox-box" @click.stop="handlsCkecdPros(item, pros)">
 											<view
 												class="checkbox iconfont"
 												:class="[pros.isChecked ? 'icon-yixuanze' : 'icon-weixuanze']"
@@ -74,7 +74,7 @@
 												pros.name
 											}}</view>
 											<view class="productspec">规格:{{ pros.unit ? pros.unit : '' }}</view>
-											<template v-if="pros.stock> 0">
+											<template v-if="pros.number > pros.stock || pros.stock === 0">
 												<view class="cart-sku-temp" @click.stop="handleShouUnitPopup(pros)">
 													<view class="cart-sku-text">重新选择商品规格</view>
 													<view class="cart-sku-btn">重选</view>
@@ -196,7 +196,7 @@
 							<view class="title-txt"
 								>失效商品<text>{{ failureList.length }}件</text></view
 							>
-							<view class="title-btn" @click.stop="deletefailureList"
+							<view class="title-btn" @click.stop="handleDeletefailures"
 								><text class="butto">清空失效商品</text></view
 							>
 						</view>
@@ -206,7 +206,7 @@
 									<!--选择商品-->
 									<view
 										class="checkbox-box"
-										@click.stop="ischeckFailure(failure)"
+										@click.stop="handleCheckFailure(failure)"
 										v-if="isshowDelbtn"
 									>
 										<button
@@ -258,18 +258,18 @@
 							</view>
 						</view>
 						<view v-if="!isshowDelbtn" class="footer-ri">
-							<view class="btn hanld-btn" @tap="toConfirmation">去结算({{ allCount }})</view>
+							<view class="btn hanld-btn" @tap="hanldlerToConfirm">去结算({{ allCount }})</view>
 						</view>
 						<view v-else class="footer-del">
 							<view class="btn btn-cancel" @tap.stop="hideDelManage">取消</view>
-							<view class="btn btn-confirm" @tap.stop="deleteList">删除</view>
+							<view class="btn btn-confirm" @tap.stop="handleDeleteCart">删除</view>
 						</view>
 					</view>
 				</template>
 				<template v-else>
 					<view class="footer" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
 						<view class="footer-le">
-							<view class="foot-check checkbox-box" @tap.stop="checkAll()">
+							<view class="foot-check checkbox-box" @tap.stop="handleCheckAll">
 								<button
 									class="checkbox iconfont"
 									:class="[isCheckAll ? 'icon-yixuanze' : 'icon-weixuanze']"
@@ -292,11 +292,11 @@
 							</view>
 						</view>
 						<view v-if="!isshowDelbtn" class="footer-ri">
-							<view class="btn hanld-btn" @tap="toConfirmation">去结算({{ allCount }})</view>
+							<view class="btn hanld-btn" @tap="hanldlerToConfirm">去结算({{ allCount }})</view>
 						</view>
 						<view v-else class="footer-del">
 							<view class="btn btn-cancel" @tap.stop="hideDelManage">取消</view>
-							<view class="btn btn-confirm" @tap.stop="deleteList">删除</view>
+							<view class="btn btn-confirm" @tap.stop="handleDeleteCart">删除</view>
 						</view>
 					</view>
 				</template>
@@ -317,8 +317,8 @@
 		<cm-unit-popup
 			v-if="popupShow2"
 			:popupShow="popupShow2"
-			:product="handlePros"
-			@btnConfirm="handleBtnConfirm"
+			:skuProduct="handlePros"
+			@skuBtnConfirm="handleBtnConfirm"
 		></cm-unit-popup>
 		<!-- 促销活动弹窗 -->
 		<activi-popup :product="handlerPros" :popupShow="popupShow"></activi-popup>
@@ -415,13 +415,13 @@
 														>
 														<view
 															class="icon-used-btn receive"
-															@click="toDeductCoupon(coupon)"
+															@click="handleToDeductCoupon(coupon)"
 															>抵扣</view
 														>
 													</template>
 													<template v-else-if="coupon.couponPayWay == 1">
 														<view class="icon-used-text">购买</view>
-														<view class="icon-used-btn receive" @click="toPayCoupon(coupon)"
+														<view class="icon-used-btn receive" @click="handlePayCoupon(coupon)"
 															>¥{{ coupon.moneyCouponPrice }}</view
 														>
 													</template>
@@ -511,10 +511,12 @@ import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
 import cmUnitPopup from './cm-unit-popup.vue'
 import modalLayer from '@/components/modal-layer'
 import payMixins from '@/mixins/payMixins.js'
+import cartMixins from './mixins/cartMixins.js'
+import apisMixins from './mixins/apisMixins.js'
 import { mapState, mapMutations } from 'vuex'
 export default {
 	name: 'cartComponents',
-	mixins: [payMixins],
+	mixins: [payMixins,apisMixins,cartMixins],
 	props: {
 		pathType: {
 			type: Number
@@ -543,7 +545,6 @@ export default {
 			promotionsList: [], // 促销列表
 			totalCouponList: [], // 优惠券算列表
 			eligibleCoupons: [], // 最终需要用到优惠券
-			delGoodsList: '', // 要删除的商品
 			setGoodData: '', // 确认订单的商品
 			isCheckAll: false, // 是否全选
 			kindCount: 0, // 购物车宝贝数量
@@ -718,10 +719,16 @@ export default {
 					}
 					if (data.list && data.list.length > 0) {
 						this.goodsList = data.list
-						this.goodsList.forEach((item, index) => {
-							item.cartList.forEach(pros => {
-								pros.shopId = item.shopId
+						this.goodsList.forEach((supplier, index) => {
+							supplier.cartList.forEach(pros => {
+								pros.shopId = supplier.shopId
 								pros.isStep = false
+								if(pros.stock === 0 || pros.number > pros.stock ){
+								    supplier.isDisable = true
+								    pros.isDisable = true
+								}else{
+								    pros.isDisable = false
+								}
 								if (pros.step === 2) {
 									if (pros.number % pros.min != 0) {
 										pros.number = pros.min
@@ -755,20 +762,21 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
-		ischeckFailure(failure) {
+		handleCheckFailure(failure) {//  选择失效商品
 			failure.isChecked = !failure.isChecked
 			this.updateCheckAllBtn()
 		},
-		ischeck(item, pro) {
+		handlsCkecdPros(item, pro) {
 			//为未选中的时候改变为true,反之为true
+			if(pro.isDisable){ return }
 			pro.isChecked = !pro.isChecked
 			if (pro.isChecked) {
-				if (!this.submitIds.includes(pro.productId * 1)) {
-					this.submitIds.push(pro.productId)
+				if (!this.submitIds.includes(pro.skuId * 1)) {
+					this.submitIds.push(pro.skuId)
 					this.checkenProsList.push(pro)
 				}
 			} else {
-				var lent = this.submitIds.indexOf(pro.productId * 1)
+				var lent = this.submitIds.indexOf(pro.skuId * 1)
 				if (lent >= 0) {
 					this.submitIds.splice(lent, 1)
 					this.checkenProsList.splice(lent, 1)
@@ -818,23 +826,24 @@ export default {
 				this.isCheckAll = goodsCheckedLength === goodsList.length
 			}
 		},
-		checkShop(item) {
+		handleCheckShop(supplier) {
 			//与单选商品类似
-			item.isChecked = !item.isChecked
-			this.setProductChecked(item)
+			if(supplier.isDisable){ return }
+			supplier.isChecked = !supplier.isChecked
+			this.setProductChecked(supplier)
 			this.updateCheckAllBtn()
 		},
-		setProductChecked(item) {
-			item.cartList.forEach(pros => {
-				if (item.isChecked) {
+		setProductChecked(supplier) {
+			supplier.cartList.forEach(pros => {
+				if (supplier.isChecked && (pros.stock !== 0 || pros.number < pros.stock)) {
 					pros.isChecked = true
-					if (!this.submitIds.includes(pros.productId * 1)) {
-						this.submitIds.push(pros.productId)
+					if (!this.submitIds.includes(pros.skuId * 1)) {
+						this.submitIds.push(pros.skuId)
 						this.checkenProsList.push(pros)
 					}
 				} else {
 					pros.isChecked = false
-					var lent = this.submitIds.indexOf(pros.productId * 1)
+					let lent = this.submitIds.indexOf(pros.skuId * 1)
 					if (lent >= 0) {
 						this.submitIds.splice(lent, 1)
 						this.checkenProsList.splice(lent, 1)
@@ -845,22 +854,22 @@ export default {
 		updateBothCheckBtn() {
 			if (this.isshowDelbtn) {
 				// 当管理删除按钮出现时,失效的商品可被选择
-				this.goodsList.forEach(item => {
-					item.isChecked = this.isCheckAll
-					this.setProductChecked(item)
+				this.goodsList.forEach(supplier => {
+					supplier.isChecked = this.isCheckAll
+					this.setProductChecked(supplier)
 				})
 				//删除按钮 全选包括失效商品勾选
 				this.failureList.forEach(failureItem => {
 					failureItem.isChecked = this.isCheckAll
 				})
 			} else {
-				this.goodsList.forEach(item => {
-					item.isChecked = this.isCheckAll && !item.isDisabled
-					this.setProductChecked(item)
+				this.goodsList.forEach(supplier => {
+					supplier.isChecked = this.isCheckAll && !supplier.isDisabled
+					this.setProductChecked(supplier)
 				})
 			}
 		},
-		checkAll() {
+		handleCheckAll() {
 			//全选方法内调用方法
 			this.isCheckAll = !this.isCheckAll
 			if (!this.isCheckAll) {
@@ -1074,7 +1083,7 @@ export default {
 			// 凑单满减计算勾选的凑单商品总价
 			let price
 			this.checkenProsList.find(el => {
-				if (pros.productId == el.productId) {
+				if (pros.skuId == el.skuId) {
 					price = el.number * el.price
 				}
 			})
@@ -1224,100 +1233,28 @@ export default {
 				})
 			}
 		},
-		updateShoppogNum(pros) {
-			//加减购物车商品更新到后台
-			this.ProductService.ShoppingCartUpdate({
-				userId: this.userId,
-				productId: pros.productId,
-				productCount: pros.number,
-				source: 2
-			})
-				.then(response => {
-					this.isshowDelbtn = false
-					// this.initGetCartGoodsList()
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
-		},
-		toConfirmation() {
-			//跳转确认订单页面
-			let setGoodsList = []
-			this.goodsList.forEach(res => {
-				let products = res.cartList
-				products.forEach(pros => {
-					if (pros.isChecked) {
-						setGoodsList.push(pros.productId)
-					}
-				})
-			})
-			if (setGoodsList == '') {
-				this.$util.msg('请先选择结算商品~', 2000)
-				return
-			} else {
-				this.isNoConfim = false
-				this.goodsList.forEach(el => {
-					el.cartList.forEach(pros => {
-						if (pros.isChecked) {
-							if (pros.number < pros.min) {
-								this.isNoConfim = true
-							}
-						}
-					})
-				})
-				if (this.isNoConfim) {
-					this.$util.modal(
-						'',
-						'有商品的购买量没达到最小起订量,请修改数量后再次提交结算',
-						'去修改',
-						'',
-						false,
-						() => {}
-					)
-					return
-				}
-				let productIds = ''
-				this.goodsList.forEach(el => {
-					//获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
-					el.cartList.forEach(pros => {
-						if (pros.isChecked) {
-							productIds += pros.productId + ','
-						}
-					})
-				})
-				let cartPramsData = { productIds: productIds.substring(0, productIds.lastIndexOf(',')) }
-				// 友盟埋点购物车去结算点击事件
-				if (process.env.NODE_ENV != 'development') {
-					this.$uma.trackEvent('Um_Event_shoppingCartConfirmOrder', {
-						Um_Key_PageName: '去结算',
-						Um_Key_SourcePage: '底部菜单购物车'
-					})
-				}
-				this.$api.navigateTo(
-					`/pages/user/order/create-order?type=2&data=${JSON.stringify({ data: cartPramsData })}`
-				)
-			}
-		},
 		showDelManager() {
 			//显示删除商品管理
 			this.isshowDelbtn = true
 			if (this.isCheckAll) {
 				this.updateBothCheckBtn()
 			} else {
-				this.goodsList.forEach(item => {
-					if (item.isChecked) {
-						item.cartList.forEach(pros => {
+				this.goodsList = this.goodsList.map(suppler=>{
+					if (suppler.isChecked) {
+						suppler.cartList.forEach(pros => {
 							pros.isChecked = true
 						})
 					}
+					return suppler
 				})
 				this.updateCheckAllBtn()
 			}
 			// 失效也被勾选
-			this.failureList.forEach(failureItem => {
-				if (failureItem.isFailureLayer) {
-					failureItem.isFailureLayer = false
+			this.failureList = this.failureList.map(el=>{
+				if (el.isFailureLayer) {
+					el.isFailureLayer = false
 				}
+				return el
 			})
 		},
 		hideDelManage() {
@@ -1329,87 +1266,29 @@ export default {
 				this.updateBothCheckBtn()
 			} else {
 				// 失效商品取消勾选
-				this.goodsList.forEach(item => {
-					if (item.isDisabled) {
-						item.isChecked = false
+				this.goodsList = this.goodsList.map(suppler=>{
+					if (suppler.isDisabled) {
+						suppler.isChecked = false
 					}
-					item.cartList.forEach(pros => {
+					suppler.cartList.forEach(pros => {
 						if (pros.validFlag == 3) {
 							pros.isChecked = false
 						}
 					})
+					return suppler
 				})
 				this.updateCheckAllBtn()
 			}
-			this.failureList.forEach((failure, index) => {
-				if (failure.failureState == 1 || failure.failureState == 2) {
-					isFailureLayer = true
+			this.failureList = this.failureList.map(el=>{
+				if (el.failureState == 1 || el.failureState == 2) {
+					el.isFailureLayer = true
 				} else {
-					isFailureLayer = false
-				}
-				newFailureList.push(Object.assign({}, failure, { isFailureLayer: isFailureLayer }))
-			})
-			this.failureList = newFailureList
-		},
-		deleteList() {
-			//删除购物车商品
-			this.delGoodsList = []
-			this.goodsList.forEach(delitem => {
-				let products = delitem.cartList
-				products.forEach(pros => {
-					if (pros.isChecked) {
-						this.delGoodsList += pros.productId + ','
-					}
-				})
-			})
-			this.failureList.forEach(failure => {
-				if (failure.isChecked) {
-					this.delGoodsList += failure.productId + ','
+					el.isFailureLayer = false
 				}
-			})
-			if (this.delGoodsList.length == 0) {
-				this.$util.msg('请选择要删除的商品~', 2000)
-				return
-			} else {
-				this.$util.modal('', '确定删除选中的商品吗?', '确定', '取消', true, () => {
-					this.ProductService.ShoppingCartDelete({
-						userId: this.userId,
-						productIds: this.delGoodsList
-					})
-						.then(response => {
-							this.$util.msg('删除成功', 2000)
-							setTimeout(() => {
-								this.isshowDelbtn = false
-								this.initGetCartGoodsList()
-							}, 2000)
-						})
-						.catch(error => {
-							this.$util.msg(error.msg, 2000)
-						})
-				})
-			}
-		},
-		deletefailureList() {
-			this.failureList.forEach(failure => {
-				this.delGoodsList += failure.productId + ','
-			})
-			this.$util.modal('', '确定清空全部失效商品吗?', '确定', '取消', true, () => {
-				this.ProductService.ShoppingCartDelete({
-					userId: this.userId,
-					productIds: this.delGoodsList
-				})
-					.then(response => {
-						this.$util.msg('删除成功', 2000)
-						setTimeout(() => {
-							this.isshowDelbtn = false
-							this.initGetCartGoodsList()
-						}, 2000)
-					})
-					.catch(error => {
-						this.$util.msg(error.msg, 2000)
-					})
+				return el
 			})
 		},
+		
 		goIndex() {
 			uni.switchTab({
 				url: '/pages/tabBar/home/index'
@@ -1489,22 +1368,8 @@ export default {
 			return false
 		},
 		queryPopupCoupons() {
-			// 获取弹窗优惠券列表
-			this.ProductService.ShoppingCartGetCoupon(this.couponParam)
-				.then(response => {
-					let data = response.data
-					this.navbar[0].num = data.notCouponNum
-					this.navbar[1].num = data.couponNum
-					if (data.couponList && data.couponList.length > 0) {
-						this.productCouponList = data.couponList
-						this.isCouponEmpty = false
-					} else {
-						this.isCouponEmpty = true
-					}
-				})
-				.catch(error => {
-					console.log('获取优惠券列表失败')
-				})
+			// 获取优惠券列表调用 apisMixins -> apiShoppingCartGetCoupon
+			this.apiShoppingCartGetCoupon(this.couponParam)
 		},
 		receiveCoupon(coupon) {
 			// 点击优惠券领取按钮,友盟埋点收集领取优惠券
@@ -1515,24 +1380,10 @@ export default {
 					Um_Key_CouponId: `${coupon.couponId}`
 				})
 			}
-			this.ProductService.ReceiveCoupon({
-				userId: this.couponParam.userId,
-				couponId: coupon.couponId,
-				source: 1
-			})
-				.then(response => {
-					this.$util.msg('领取成功', 1500, true, 'success')
-					setTimeout(() => {
-						this.currentTab = 1
-						this.couponParam.status = 2
-						this.queryPopupCoupons()
-					}, 1500)
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
+			// 领取优惠券调用 apisMixins -> apiReceiveCoupon
+			this.apiReceiveCoupon({userId: this.couponParam.userId,couponId: coupon.couponId,source: 1})
 		},
-		toDeductCoupon(coupon) {
+		handleToDeductCoupon(coupon) {
 			// 点击采美豆抵扣优惠券
 			if (process.env.NODE_ENV != 'development') {
 				this.$uma.trackEvent('Um_Event_userCouponCollectionBuy', {
@@ -1546,31 +1397,13 @@ export default {
 					this.$util.msg('您的身份暂不支持领取优惠券', 2000)
 					return
 				}
-				this.WeChatPayCouponBeans(coupon)
+				// 调用 apisMixins -> apiWeChatPayCouponBeans
+				this.apiWeChatPayCouponBeans({ source: 1, userId: this.couponParam.userId,couponId: coupon.couponId })
 			} else {
 				this.$api.navigateTo('/pages/login/login')
 			}
 		},
-		WeChatPayCouponBeans(coupon) {
-			// 采美豆抵扣优惠券
-			this.PayService.WeChatPayCouponBeans({
-				source: 1, //领取渠道 1 小程序  2 网站
-				userId: this.couponParam.userId,
-				couponId: coupon.couponId
-			})
-				.then(response => {
-					this.$util.msg('抵扣成功', 1500)
-					setTimeout(() => {
-						this.currentTab = 1
-						this.couponParam.status = 2
-						this.queryPopupCoupons()
-					}, 1500)
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
-		},
-		toPayCoupon(coupon) {
+		handlePayCoupon(coupon) {
 			// 点击购买优惠券,友盟埋点收集购买优惠券
 			if (process.env.NODE_ENV != 'development') {
 				this.$uma.trackEvent('Um_Event_cartCouponBuy', {
@@ -1579,46 +1412,8 @@ export default {
 					Um_Key_CouponId: `${coupon.couponId}`
 				})
 			}
-			this.createCouponRecord(coupon)
-		},
-		createCouponRecord(coupon) {
-			// 生成购买优惠券记录Id
-			this.PayService.WeChatCouponRecord({
-				userId: this.userId,
-				couponId: coupon.couponId
-			})
-				.then(response => {
-					this.MiniWxPayFor(coupon, response.data.couponRecordId)
-				})
-				.catch(error => {
-					if (error.code == -1) {
-						//个人机构不能购买
-						this.contentModalText = '该优惠券仅限医美机构购买,请升级为医美机构后再次购买。'
-						this.modal = true
-					} else if (error.code == -2) {
-						//会员机构不是医美机构不能购买
-						this.$util.msg('该优惠券仅限医美机构购买', 2000)
-					}
-				})
-		},
-		async MiniWxPayFor(coupon, couponRecordId) {
-			const wechatcode = await authorize.getCode('weixin')
-			const params = {
-				userId: this.userId,
-				couponId: coupon.couponId,
-				couponRecordId: couponRecordId,
-				payType: 'XCX',
-				code: wechatcode,
-				source: 1 //支付来源 1 小程序 2 WWW
-			}
-			this.weChatMiniCouponWxPay(
-				params,
-				'Um_Event_cartCouponPay',
-				'机构购物车',
-				'线上支付优惠券',
-				coupon.couponId,
-				this.userId
-			)
+			// 生成购买优惠券记录Id调用 apisMixins -> apiReceiveCoupon
+			this.apiWeChatCouponRecord({ userId: this.userId,couponId: coupon.couponId },coupon)
 		},
 		hideMobel() {
 			this.modal = false

+ 128 - 0
components/cm-module/cart-components/mixins/apisMixins.js

@@ -0,0 +1,128 @@
+import Vue from 'vue'
+const apisMixins = {
+    methods: {
+        apiUserClubCheckSku(params){
+            this.ProductService.ShoppingCheckSku(params)
+			    .then(response => {
+			        setTimeout(() => {
+			           this.initGetCartGoodsList()
+			        }, 1500)
+			    })
+			    .catch(error => {
+			        this.$util.msg(error.msg, 2000)
+			    })
+        },
+        apiWeChatCouponRecord(params,coupon){
+            //调用购买优惠券
+            this.PayService.WeChatCouponRecord(params)
+                .then(response => {
+                    this.MiniWxPayFor(coupon, response.data.couponRecordId)
+                })
+                .catch(error => {
+                    if (error.code == -1) {
+                        //个人机构不能购买
+                        this.contentModalText = '该优惠券仅限医美机构购买,请升级为医美机构后再次购买。'
+                        this.modal = true
+                    } else if (error.code == -2) {
+                        //会员机构不是医美机构不能购买
+                        this.$util.msg('该优惠券仅限医美机构购买', 2000)
+                    }
+                })
+			
+        },
+        async MiniWxPayFor(coupon, couponRecordId) {
+            // 微信支付
+		    const wechatcode = await authorize.getCode('weixin')
+		    const params = {
+		        userId: this.userId,
+		        couponId: coupon.couponId,
+		        couponRecordId: couponRecordId,
+		        payType: 'XCX',
+		        code: wechatcode,
+		        source: 1 //支付来源 1 小程序 2 WWW
+		    }
+		    this.weChatMiniCouponWxPay(
+		        params,
+		        'Um_Event_cartCouponPay',
+		        '机构购物车',
+		        '线上支付优惠券',
+		        coupon.couponId,
+		        this.userId
+		    )
+        },
+        apiWeChatPayCouponBeans(params){
+            //调用采美豆抵扣优惠券
+            this.PayService.WeChatPayCouponBeans(params)
+                .then(response => {
+                    this.$util.msg('抵扣成功', 1500)
+                    setTimeout(() => {
+                        this.currentTab = 1
+                        this.couponParam.status = 2
+                        this.queryPopupCoupons()
+                    }, 1500)
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        },
+        apiReceiveCoupon(params){
+            //领取优惠券
+            this.ProductService.ReceiveCoupon(params)
+                .then(response => {
+                    this.$util.msg('领取成功', 1500, true, 'success')
+                    setTimeout(() => {
+                        this.currentTab = 1
+                        this.couponParam.status = 2
+                        this.queryPopupCoupons()
+                    }, 1500)
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        },
+        apiShoppingCartGetCoupon(params){
+            // 获取弹窗优惠券列表
+            this.ProductService.ShoppingCartGetCoupon(params)
+                .then(response => {
+                    let data = response.data
+                    this.navbar[0].num = data.notCouponNum
+                    this.navbar[1].num = data.couponNum
+                    if (data.couponList && data.couponList.length > 0) {
+                        this.productCouponList = data.couponList
+                        this.isCouponEmpty = false
+                    } else {
+                        this.isCouponEmpty = true
+                    }
+                })
+                .catch(error => {
+                    console.log('获取优惠券列表失败')
+                })
+        },
+        apiShoppingCartUpdate(params) {
+            //更新购物车商品
+            this.ProductService.ShoppingCartUpdate(params)
+                .then(response => {
+                    this.isshowDelbtn = false
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        },
+        shoppingCartDelete(params) { 
+            // 删除购物车商品
+            this.ProductService.ShoppingCartDelete(params)
+                .then(response => {
+                    this.$util.msg('删除成功', 2000)
+                    setTimeout(() => {
+                        this.isshowDelbtn = false
+                        this.initGetCartGoodsList()
+                    }, 2000)
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        }
+    }
+}
+
+export default apisMixins

+ 103 - 0
components/cm-module/cart-components/mixins/cartMixins.js

@@ -0,0 +1,103 @@
+// 统计数据
+// 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
+import Vue from 'vue'
+const cartMixins = {
+    data() {
+        return {
+			
+        }
+    },
+    methods: {
+        hanldlerToConfirm() {
+            //跳转确认订单页面
+            let skuIds = ''
+            this.isNoConfim = false
+            this.goodsList.forEach(supper => {
+                supper.cartList.forEach(pros => {
+                    if (pros.isChecked) {
+                        // 获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
+                        skuIds += pros.skuId + ','
+                        // 有商品的购买量没达到最小起订量
+                        if (pros.number < pros.min) {
+                            this.isNoConfim = true
+                        }
+                    }
+                })
+            })
+            if (skuIds === '') {
+                this.$util.msg('请先选择结算商品~', 2000)
+                return
+            }
+            if (this.isNoConfim) {
+                this.$util.modal(
+                    '',
+                    '有商品的购买量没达到最小起订量,请修改数量后再次提交结算',
+                    '去修改',
+                    '',
+                    false,
+                    () => {}
+                )
+                return
+            }
+            // 友盟埋点购物车去结算点击事件
+            if (process.env.NODE_ENV != 'development') {
+                this.$uma.trackEvent('Um_Event_shoppingCartConfirmOrder', {
+                    Um_Key_PageName: '去结算',
+                    Um_Key_SourcePage: '底部菜单购物车'
+                })
+            }
+            let cartSkuIds = { skuIds: skuIds.substring(0, skuIds.lastIndexOf(',')) }
+            this.$api.navigateTo(
+                `/pages/user/order/create-order?type=2&data=${JSON.stringify({ data: cartSkuIds })}`
+            )
+        },
+        handleBtnConfirm(data) {
+            console.log('data', data)
+            // 确认重选规格调用 apisMixins -> apiQueryShoppingCartList
+            this.apiUserClubCheckSku(data)
+        },
+        updateShoppogNum(pros) {
+            const params = {
+                userId: this.userId,
+                skuId: pros.skuId,
+                productCount: pros.number,
+                source: 2
+            }
+            // 更新购物车调用 apisMixins -> apiQueryShoppingCartList
+            this.apiShoppingCartUpdate(params)
+        },
+        handleDeleteCart() { //删除购物车商品
+            let delSkuIds = ''
+            this.goodsList.forEach(delitem => {
+                delitem.cartList.forEach(pros => {
+                    if (pros.isChecked) {
+                        delSkuIds += pros.skuId + ','
+                    }
+                })
+            })
+            this.failureList.forEach(failure => {
+                if (failure.isChecked) {
+                    delSkuIds += failure.skuId + ','
+                }
+            })
+            if (delSkuIds.length == 0) {
+                this.$util.msg('请选择要删除的商品~', 2000)
+                return
+            }
+            this.$util.modal('', '确定删除选中的商品吗?', '确定', '取消', true, () => {
+                this.shoppingCartDelete({ userId: this.userId, skuIds: delSkuIds })
+            })
+        },
+        handleDeletefailures() { // 一键清楚所有失效商品
+            let delSkuIds = ''
+            this.failureList.forEach(failure => {
+                delSkuIds += failure.skuId + ','
+            })
+            this.$util.modal('', '确定清空全部失效商品吗?', '确定', '取消', true, () => {
+                this.shoppingCartDelete({ userId: this.userId, skuIds: delSkuIds })
+            })
+        }
+    }
+}
+
+export default cartMixins

+ 161 - 248
components/cm-module/productDetails/cm-unit-popup.vue

@@ -4,45 +4,50 @@
 		<view class="tui-popup-box clearfix">
 			<view class="tui-shopping-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 				<view class="tui-sku-title">
-					<view class="tui-sku-image"> <image :src="product.image" mode=""></image> </view>
+					<view class="tui-sku-image"> <image :src="skuProduct.image" mode=""></image> </view>
 					<view class="tui-sku-price">
 						<view class="sku-price-viw">
-							<view class="sku-price-text"
-								  :class="PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''"
+							<view
+								class="sku-price-text"
+								:class="
+									PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+										? 'none'
+										: ''
+								"
 							>
 								¥{{
-									(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-										? product.originalPrice
-										: product.price) | NumFormat
+									(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+										? skuProduct.originalPrice
+										: skuProduct.price) | NumFormat
 								}}
 							</view>
 						</view>
 						<view class="sku-price-vip">
 							<view class="floor-item-act">
-								<view class="coupon-tags" v-if="product.couponsLogo">优惠券</view>
-								<template v-if="product.actStatus == 1 && product.promotions">
-									<view v-if="PromotionsFormat(product.promotions)" class="floor-tags">
-										{{ product.promotions.name }}
-										<text v-if="product.promotions != null && product.promotions.type != 3">
+								<view class="coupon-tags" v-if="skuProduct.couponsLogo">优惠券</view>
+								<template v-if="skuProduct.actStatus == 1 && skuProduct.promotions">
+									<view v-if="PromotionsFormat(skuProduct.promotions)" class="floor-tags">
+										{{ skuProduct.promotions.name }}
+										<text v-if="skuProduct.promotions != null && skuProduct.promotions.type != 3">
 											:¥{{
-												product.promotions == null
+												skuProduct.promotions == null
 													? '0.00'
-													: product.promotions.touchPrice | NumFormat
+													: skuProduct.promotions.touchPrice | NumFormat
 											}}
 										</text>
 									</view>
-									<view v-else-if="product.promotions.type != 3" class="floor-tags">
-										{{ product.promotions.name }}
+									<view v-else-if="skuProduct.promotions.type != 3" class="floor-tags">
+										{{ skuProduct.promotions.name }}
 									</view>
 								</template>
-								<template v-if="product.actStatus == null && product.ladderFlag == 1">
+								<template v-if="skuProduct.actStatus == null && skuProduct.ladderFlag == 1">
 									<view class="floor-tags">阶梯价格</view>
 								</template>
-								<template v-if="product.svipProductFlag == 1">
+								<template v-if="skuProduct.svipProductFlag == 1">
 									<view class="svip-tags">
 										<view class="tags" :class="{ none: vipFlag != 1 }">SVIP</view>
-										<view class="price" v-if="isShowVipFlag(product)">{{
-											product.svipPriceTag
+										<view class="price" v-if="isShowVipFlag(skuProduct)">{{
+											skuProduct.svipPriceTag
 										}}</view>
 									</view>
 								</template>
@@ -60,12 +65,12 @@
 							:key="index"
 							:class="skuIndex === index ? 'active' : ''"
 						>
-							{{ sku.unit }} <text class="tips">缺货</text>
+							{{ sku.unit }} <text class="tips" v-if="sku.stock === 0">缺货</text>
 						</view>
 					</view>
 				</view>
 				<view class="sku-unit-nunbox">
-					<view class="sku-unit-nunbox" v-if="product.step === 2">
+					<view class="sku-unit-nunbox" v-if="skuProduct.step === 2">
 						<view class="text">*该商品只能以起订量的整数倍购买</view>
 					</view>
 					<view class="sku-unit-nunbox-t">
@@ -75,17 +80,19 @@
 								<view
 									class="iconfont icon-jianhao"
 									@click="changeCountSub"
+									:class="[isQuantity == true ? 'disabled' : '']"
 								></view>
 								<input
 									class="btn-input"
 									type="number"
-									v-model="number"
+									v-model="productCount"
 									maxlength="4"
 									@blur="changeNumber($event)"
 								/>
 								<view
 									class="iconfont icon-jiahao"
 									@click="changeCountAdd"
+									:class="[isStock == true ? 'disabled' : '']"
 								></view>
 							</view>
 						</view>
@@ -94,8 +101,22 @@
 			</view>
 			<view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 				<view class="tui-modal-flex">
-					<view class="tui-modal-button cancel" @click="handleConfirm">加入购物车</view>
-					<view class="tui-modal-button confirm" @click="toConfirmation">立即购买</view>
+					<button
+						class="tui-modal-button cancel"
+						@click="handleBuyConfirm('add')"
+						:disabled="isBtnDisabled"
+						:class="[isBtnDisabled ? 'disabled' : '']"
+					>
+						加入购物车
+					</button>
+					<button
+						class="tui-modal-button confirm"
+						@click="handleBuyConfirm('buy')"
+						:disabled="isBtnDisabled"
+						:class="[isBtnDisabled ? 'disabled' : '']"
+					>
+						立即购买
+					</button>
 				</view>
 			</view>
 		</view>
@@ -111,7 +132,7 @@ export default {
 		uniGrader
 	},
 	props: {
-		product: {
+		skuProduct: {
 			type: Object
 		},
 		popupShow: {
@@ -125,156 +146,22 @@ export default {
 	},
 	data() {
 		return {
-			userId:0,// 用户Id
 			vipFlag: 0, // 是否是超级会员 0否 1是
 			skuIndex: 0,
-			number: 0,
-			buyRetailPriceStep: 1,
-			buyRetailPrice: 0,
-			ladderPriceList: [],
-			isQuantity: false,
-			skuList: [
-				{
-					unit: '135ml70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: ' 精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【70ml】2瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【35ml】4瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				}
-			]
+			isStock: false, //
+			isQuantity: false, 
+			handleStock: 0, // 规格库存
+			handleMinNumber: 1, // 规格起订量
+			productCount: 0,
+			skuList: [],
+			addParams: {
+				skuId: 0,
+				productCount: 0,
+				productId: 0,
+				userId: 0,
+				source: 1
+			},
+			isBtnDisabled: false
 		}
 	},
 	filters: {
@@ -282,39 +169,41 @@ export default {
 			//处理金额
 			return Number(value).toFixed(2)
 		}
-	},	
+	},
 	created() {
 		this.initData()
-		
-		
 	},
 	computed: {
 		...mapState(['hasLogin'])
 	},
 	methods: {
-		async initData(data) {
+		async initData() {
 			const userInfo = await this.$api.getStorage()
 			this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
-			this.userId = userInfo.userId ? userInfo.userId : 0
-			this.number = this.product.minBuyNumber
-			this.buyRetailPrice = this.product.price
-			this.ladderPriceList = this.product.ladderPriceList ? this.product.ladderPriceList : null
-			this.buyRetailPriceStep = this.handleData.step
-			if (this.handleData.ladderPriceFlag == 1) {
-				this.number = this.handleData.maxBuyNumber ? this.handleData.maxBuyNumber : 1
-			} else {
-				this.number = this.handleData.minBuyNumber
-			}
+			this.addParams.userId = userInfo.userId ? userInfo.userId : 0
+			this.addParams.productId = this.skuProduct.productId
+			this.skuList = this.skuProduct.skus
+			this.productCount = this.skuList[0].minBuyNumber
+			this.addParams.skuId = this.skuList[0].skuId
+			this.handleMinNumber = this.skuList[0].minBuyNumber
+			this.handleStock = this.skuList[0].stock
+			//处理禁用按钮商品
+			this.isBtnDisabled = this.isDisabledFlag(this.skuProduct)
 		},
-		PromotionsFormat(promo) {
-			//促销活动类型数据处理
-			if (promo != null) {
-				if (promo.type == 1 && promo.mode == 1) {
-					return true
-				} else {
-					return false
-				}
-			}
+		isDisabledFlag(pros) {
+			// 非会员
+			if (!this.vipFlag === 1) return true
+			// 商品已下架 || 库存为0
+			if (pros.validFlag == 3 || pros.stock == 0) return true
+			// 商品价格不公开
+			if (pros.priceFlag === 1) return true
+			// 商品价格仅资质机构可见 && 机构为普通机构
+			if (pros.priceFlag === 2 && this.userIdentity === 4) return true
+			// 商品价格仅医美机构可见 && 机构为普通机构
+			if (pros.priceFlag === 3 && this.userIdentity === 4) return true
+			// 商品价格仅医美机构可见 && 机构为资质机构 && 不是医美机构
+			if (pros.priceFlag === 3 && this.userIdentity === 2 && this.firstClubType != 1) return true
+			//其他
 			return false
 		},
 		isShowVipFlag(pros) {
@@ -328,89 +217,100 @@ export default {
 			if (pros.priceFlag === 3 && this.userIdentity === 2 && this.firstClubType == 1) return true
 			// 其它
 			return false
-		}, 
+		},
+		PromotionsFormat(promo) {
+			//促销活动类型数据处理
+			if (promo != null) {
+				if (promo.type == 1 && promo.mode == 1) {
+					return true
+				} else {
+					return false
+				}
+			}
+			return false
+		},
+		//popup弹窗数量增加按钮
 		changeCountAdd() {
-			//popup弹窗数量增加按钮
-			if (this.buyRetailPriceStep == 2) {
-				this.number += this.product.minBuyNumber
+			if (this.productCount === this.handleStock) {
+				this.isStock = true
+				return
+			}
+			if (this.skuProduct.step == 2) {
+				this.productCount += this.handleMinNumber
 			} else {
-				this.number++
+				this.productCount++
 			}
-			this.calculatPerice()
 		},
+		//popup弹窗数量减按钮
 		changeCountSub() {
-			//popup弹窗数量减按钮
-			if (this.number <= this.product.minBuyNumber) {
-				this.number = this.product.minBuyNumber
+			if (this.productCount <= this.handleMinNumber) {
+				this.productCount = this.handleMinNumber
 				this.isQuantity = true
-				this.$util.msg(`该商品最小起订量为${this.product.minBuyNumber}`, 2000)
+				this.$util.msg(`该商品最小起订量为${this.handleMinNumber}`, 2000)
 				return
 			} else {
-				if (this.buyRetailPriceStep == 2) {
-					this.number -= this.product.minBuyNumber
+				if (this.skuProduct.step == 2) {
+					this.productCount -= this.handleMinNumber
 				} else {
-					this.number--
+					this.productCount--
 				}
-				this.calculatPerice()
 				this.isQuantity = false
 			}
 		},
 		changeNumber(e) {
 			let _value = e.detail.value
 			if (!this.$api.isNumber(_value)) {
-				this.number = this.product.minBuyNumber
-			} else if (_value < this.product.minBuyNumber) {
-				this.$util.msg(`该商品最小起订量为${this.product.minBuyNumber}`, 2000)
-				this.number = this.product.minBuyNumber
-			} else if (_value % this.product.minBuyNumber != 0) {
+				this.productCount = this.handleMinNumber
+			} else if (_value < this.handleMinNumber) {
+				this.$util.msg(`该商品最小起订量为${this.handleMinNumber}`, 2000)
+				this.productCount = this.handleMinNumber
+			} else if (_value % this.handleMinNumber != 0) {
 				this.$util.msg('购买量必须为起订量的整数倍', 2000)
-				this.number = this.product.minBuyNumber
+				this.productCount = this.handleMinNumber
+			} else if (_value > this.handleStock) {
+				this.productCount = this.handleStock
 			} else {
-				this.number = e.detail.value
-				this.calculatPerice()
+				this.productCount = e.detail.value
 			}
 		},
-		calculatPerice() {
-			//判断是否为阶梯价然后做计算价格处理
-			if (this.product.ladderPriceFlag == 1) {
-				this.product.ladderPrices.forEach((item, index) => {
-					if (this.number >= item.buyNum) {
-						this.buyRetailPrice = item.buyPrice
-					}
+		handleBuyConfirm(type) {
+			// 监听确定选择规格
+			if (type == 'buy') {
+				this.handleToConfirm({
+					productIds: this.addParams.productId,
+					skuId: this.addParams.skuId,
+					productCount: this.productCount
 				})
+			} else {
+				this.addParams.productCount = this.productCount
+				this.handleAddClubCart(this.addParams)
 			}
 		},
-		toConfirmation() {
+		handleToConfirm(data) {
 			//跳转确认订单页面
-			this.$parent.popupShow1 = false
-			let productStp = {
-				productIds: this.product.productId,
-				productCount: this.number
-			}
-			console.log('productStp',productStp)
-			this.$api.navigateTo(
-				`/pages/user/order/create-order?type=1&data=${JSON.stringify({ data: productStp })}`
-			)
+			this.$api.navigateTo(`/pages/user/order/create-order?type=1&data=${JSON.stringify({ data: data })}`)
+			this.hidePopup()
 		},
-		handleConfirm() {
+		handleAddClubCart(params) {
 			//增加购物车成功和toast弹窗提示成功
-			this.ProductService.shoppingAddCart({
-				productId: this.product.productId,
-				userId: this.userId,
-				productCount: this.number
-			})
+			this.ProductService.shoppingAddCart(params)
 				.then(response => {
-					this.$parent.popupShow1 = false
 					this.$util.msg('加入购物车成功', 1500, true, 'success')
-					this.$parent.ProductCartNumber()
+					this.$parent.GetUserCartNumber()
+					this.hidePopup()
 				})
 				.catch(error => {
-					this.$util.msg(error.msg, 2000)
+					console.log('error', error.msg)
 				})
 		},
 		handleChoisSku(sku, index) {
 			// 选择SKU
 			this.skuIndex = index
+			this.addParams.productCount = this.handleMinNumber = sku.minBuyNumber
+			this.addParams.skuId = sku.skuId
+			this.handleStock = sku.stock
+			this.isBtnDisabled = sku.stock === 0
+			this.$emit('skuClick', sku)
 		},
 		hidePopup() {
 			this.$parent.popupShow1 = false
@@ -456,7 +356,7 @@ export default {
 					line-height: 40rpx;
 					color: #f94b4b;
 					font-weight: bold;
-					.sku-price-l{
+					.sku-price-l {
 						float: left;
 						font-weight: normal;
 					}
@@ -531,7 +431,7 @@ export default {
 		width: 100%;
 		height: auto;
 		float: left;
-		margin-top: 30rpx; 
+		margin-top: 30rpx;
 		.sku-unit-nunbox-t {
 			width: 100%;
 			height: 44rpx;
@@ -548,7 +448,7 @@ export default {
 				float: left;
 				font-weight: bold;
 			}
-			.sku-unit-nunbox-num{
+			.sku-unit-nunbox-num {
 				float: right;
 				.number-box {
 					display: flex;
@@ -568,9 +468,15 @@ export default {
 						background: #fef6f3;
 						&.icon-jianhao {
 							border-radius: 30rpx 0 0 30rpx;
+							&.disabled {
+								background: #f5f5f5;
+							}
 						}
 						&.icon-jiahao {
 							border-radius: 0 30rpx 30rpx 0;
+							&.disabled {
+								background: #f5f5f5;
+							}
 						}
 					}
 					.btn-input {
@@ -587,7 +493,7 @@ export default {
 		}
 	}
 }
-.tui-popup-btn{
+.tui-popup-btn {
 	width: 100%;
 	float: left;
 	.tui-modal-flex {
@@ -607,10 +513,17 @@ export default {
 			&.cancel {
 				background: #ffe6dc;
 				color: #e15616;
+				&.disabled {
+					background-color: #e1e1e1;
+					color: #ffffff;
+				}
 			}
 			&.confirm {
 				background: $btn-confirm;
 				color: #ffffff;
+				&.disabled {
+					background: linear-gradient(135deg, rgba(242, 143, 49, 0.5) 0%, rgba(225, 86, 22, 0.5) 100%);
+				}
 			}
 		}
 	}

+ 58 - 174
pages/goods/components/cm-unit-popup.vue

@@ -5,8 +5,8 @@
 			<view class="tui-popup-box clearfix">
 				<view class="tui-shopping-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 					<view class="tui-sku-title">
-						<view class="tui-sku-image"> <image :src="product.mainImage" mode=""></image> </view>
-						<view class="tui-sku-price"> <cmUnitPrice :product="product"></cmUnitPrice> </view>
+						<view class="tui-sku-image"> <image :src="skuProduct.mainImage" mode=""></image> </view>
+						<view class="tui-sku-price"> <cmUnitPrice :skuProduct="skuProduct"></cmUnitPrice> </view>
 					</view>
 					<view class="tui-sku-unit">
 						<view class="sku-unit-h1">规格:</view>
@@ -18,12 +18,12 @@
 								:key="index"
 								:class="skuIndex === index ? 'active' : ''"
 							>
-								{{ sku.unit }} <text class="tips">缺货</text>
+								{{ sku.unit }} <text class="tips" v-if="sku.stock === 0">缺货</text>
 							</view>
 						</view>
 					</view>
 					<view class="sku-unit-nunbox">
-						<view class="sku-unit-nunbox" v-if="product.step === 2">
+						<view class="sku-unit-nunbox" v-if="skuProduct.step === 2">
 							<view class="text">*该商品只能以起订量的整数倍购买</view>
 						</view>
 						<view class="sku-unit-nunbox-t">
@@ -38,7 +38,7 @@
 									<input
 										class="btn-input"
 										type="number"
-										v-model="number"
+										v-model="productCount"
 										maxlength="4"
 										@blur="changeNumber($event)"
 									/>
@@ -59,13 +59,13 @@
 					:style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }"
 				>
 					<view class="tui-flex-1" v-if="type === 1">
-						<view class="tui-button" @click="btnConfirm">确定</view>
+						<view class="tui-button" :class="[goodsData.disabled ? 'disabled' : '',isBtnDisable ? 'disabled' :'']" @click="handleBtnConfirm">确定</view>
 					</view>
 					<view class="tui-modal-flex" v-else>
 						<button
 							class="tui-modal-button cancel"
 							:disabled="goodsData.disabled"
-							:class="[goodsData.disabled ? 'disabled' : '']"
+							:class="[goodsData.disabled ? 'disabled' : '',isBtnDisable ? 'disabled' :'']"
 							@click="handleConfirm('add')"
 						>
 							加入购物车
@@ -73,7 +73,7 @@
 						<button
 							class="tui-modal-button confirm"
 							:disabled="goodsData.disabled"
-							:class="[goodsData.disabled ? 'disabled' : '']"
+							:class="[goodsData.disabled ? 'disabled' : '',isBtnDisable ? 'disabled' :'']"
 							@click="handleConfirm('buy')"
 						>
 							立即购买
@@ -100,7 +100,7 @@ export default {
 		cmLadderPopup
 	},
 	props: {
-		product: {
+		skuProduct: {
 			type: Object
 		},
 		goodsData: {
@@ -113,124 +113,32 @@ export default {
 		type: {
 			type: Number,
 			default: 1
+		},
+		btnType: {
+			type: String
 		}
 	},
 	data() {
 		return {
 			skuIndex: 0,
-			number: 0,
-			buyRetailPrice: 0,
+			productCount: 0,
 			ladderPriceList: [],
 			isStock:false,// 
 			isQuantity: false,
 			isShowButton: false,
-			skuList: [
-				{
-					unit: '135ml70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					minBuyNumber:1,//起订量
-					ladderPriceList:[
-						{
-							numRange:'1-10',
-							buyPrice:500
-						},
-						{
-							numRange:'10-100',
-							buyPrice:5000
-						},
-						{
-							numRange:'100-1000',
-							buyPrice:50000
-						},
-					]
-				},
-				{
-					unit: ' 精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					minBuyNumber:1,//起订量
-					ladderPriceList:null
-				},
-				{
-					unit: '精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					minBuyNumber:1,//起订量
-					ladderPriceList:null
-				},
-				{
-					unit: '【70ml】2瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					minBuyNumber:1,//起订量
-					ladderPriceList:[
-						{
-							numRange:'1-10',
-							buyPrice:500
-						},
-						{
-							numRange:'10-100',
-							buyPrice:5000
-						},
-						{
-							numRange:'100-1000',
-							buyPrice:50000
-						},
-					]
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					minBuyNumber:1,//起订量
-					ladderPriceList:null
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					minBuyNumber:1,//起订量
-					ladderPriceList:[
-						{
-							numRange:'1-10',
-							buyPrice:500
-						},
-						{
-							numRange:'10-100',
-							buyPrice:5000
-						},
-						{
-							numRange:'100-1000',
-							buyPrice:50000
-						},
-					]
-				}
-			],
+			skuList: [],
 			handleStock:0,// 规格库存
 			handleMinNumber:1, // 规格起订量
 			isShowLadder:false,
 			laddePopupShow:false,
+			isBtnDisable:false
 		}
 	},
 	created() {
-		console.log('product', this.product)
-		this.number = this.skuList[0].minBuyNumber
+		this.skuList = this.skuProduct.skus
+		this.productCount = this.skuList[0].minBuyNumber
 		this.handleMinNumber = this.skuList[0].minBuyNumber
 		this.handleStock = this.skuList[0].stock
-		this.buyRetailPrice = this.product.price
 		this.initData()
 	},
 	computed: {
@@ -244,123 +152,92 @@ export default {
 			} else {
 				this.isShowButton = false
 			}
-			if(this.product.skuList[0].ladderPriceList){ this.isShowLadder = true }
+			if(this.skuProduct.skuList[0].ladderPriceList){ this.isShowLadder = true }
 		},
 		//popup弹窗数量增加按钮
 		changeCountAdd() {
-			if(this.number === this.handleStock){ 
+			if(this.productCount === this.handleStock){ 
 				this.isStock = true 
 				return 
 			}
-			if (this.product.step == 2) {
-				this.number += this.handleMinNumber
+			if (this.skuProduct.step == 2) {
+				this.productCount += this.handleMinNumber
 			} else {
-				this.number++
+				this.productCount++
 			}
-			this.processActivityPrice()
 		},
 		//popup弹窗数量减按钮
 		changeCountSub() {
-			if (this.number <= this.handleMinNumber) {
-				this.number = this.handleMinNumber
+			if (this.productCount <= this.handleMinNumber) {
+				this.productCount = this.handleMinNumber
 				this.isQuantity = true
 				this.$util.msg(`该商品最小起订量为${this.handleMinNumber}`, 2000)
 				return
 			} else {
-				if (this.product.step == 2) {
-					this.number -= this.handleMinNumber
+				if (this.skuProduct.step == 2) {
+					this.productCount -= this.handleMinNumber
 				} else {
-					this.number--
+					this.productCount--
 				}
-				this.processActivityPrice()
 				this.isQuantity = false
 			}
 		},
 		changeNumber(e) {
 			let _value = e.detail.value
 			if (!this.$api.isNumber(_value)) {
-				this.number = this.handleMinNumber
+				this.productCount = this.handleMinNumber
 			} else if (_value < this.handleMinNumber) {
 				this.$util.msg(`该商品最小起订量为${this.handleMinNumber}`, 2000)
-				this.number = this.handleMinNumber
+				this.productCount = this.handleMinNumber
 			} else if (_value % this.handleMinNumber != 0) {
 				this.$util.msg('购买量必须为起订量的整数倍', 2000)
-				this.number = this.handleMinNumber
+				this.productCount = this.handleMinNumber
 			} else if(_value > this.handleStock) {
-				this.number = this.handleStock
+				this.productCount = this.handleStock
 			}else{
-				this.number = e.detail.value
-			}
-			this.processActivityPrice()
-		},
-		processActivityPrice() {
-			//单独处理活动价格和阶梯价格
-			if ((this.product.ladderPriceFlag == '0' && this.product.actStatus == 0) || this.product.actStatus == 1) {
-				this.buyRetailPrice = this.product.price
-			} else {
-				this.ladderPriceList.forEach((item, index) => {
-					if (this.number >= item.buyNum) {
-						this.buyRetailPrice = item.buyPrice
-					}
-				})
+				this.productCount = e.detail.value
 			}
 		},
 		handleConfirm(type) {
 			if (this.hasLogin) {
-				switch (type) {
-					case 'add':
-						// 友盟埋点商品详情加入购物车点击事件
-						if (process.env.NODE_ENV != 'development') {
-							this.$uma.trackEvent('Um_Event_ProductAddCart', {
-								Um_Key_PageName: '加入购物车',
-								Um_Key_SourcePage: '商品详情',
-								Um_Key_ProductID: `${this.product.productId}`
-							})
-						}
-						if (this.ladderPriceFlag) {
-							this.processActivityPrice()
-						}
-						break
-					case 'buy':
-						// 友盟埋点商品详情立即购买点击事件
-						if (process.env.NODE_ENV != 'development') {
-							this.$uma.trackEvent('Um_Event_ProductBuyConfirm', {
-								Um_Key_PageName: '立即购买',
-								Um_Key_SourcePage: '商品详情',
-								Um_Key_ProductID: `${this.product.productId}`
-							})
-						}
-						break
+				if(this.isBtnDisable || this.goodsData.disabled){ return }
+				if (process.env.NODE_ENV != 'development') {
+					this.$uma.trackEvent(UmTrackEvent, {
+						Um_Key_PageName: UmKeyPageName,
+						Um_Key_SourcePage: '商品详情',
+						Um_Key_ProductID: `${this.skuProduct.productId}`
+					})
 				}
-				let data = { type: type }
-				this.$emit('buyConfirm', data)
+				const UmKeyPageName = type === 'add' ? '加入购物车' : '立即购买' 
+				const UmTrackEvent = type === 'add' ? 'Um_Event_ProductAddCart' : 'Um_Event_ProductBuyConfirm' 
+				this.$emit('buyConfirm', { type: type ,productCount : this.productCount } )
 				this.$parent.popupShow3 = false
 			} else {
 				this.$api.navigateTo('/pages/login/login')
 			}
 		},
-		btnConfirm() {
-			//加入购物车&&立即购买跳转订单页并关闭弹窗
-			// 友盟埋点商品详情确认购买商品点击事件
-			if (process.env.NODE_ENV != 'development') {
+		handleBtnConfirm() {
+			//确定加入购物车或立即购买
+			if(this.isBtnDisable || this.goodsData.disabled){ return }
+			if (process.env.NODE_ENV != 'development') {// 友盟埋点商品详情确认购买商品点击事件
 				this.$uma.trackEvent('Um_Event_ProductShoppingConfirm', {
 					Um_Key_PageName: '商品购买确认',
 					Um_Key_SourcePage: '商品详情',
-					Um_Key_ProductID: `${this.product.productId}`
+					Um_Key_ProductID: `${this.skuProduct.productId}`
 				})
 			}
-			let data = { type: type }
-			this.$emit('buyConfirm', data)
+			this.$emit('buyConfirm', { type: this.btnType ,productCount : this.productCount})
 			this.$parent.popupShow3 = false
 		},
 		handleChoisSku(sku, index) {
 			// 选择SKU
 			this.skuIndex = index
-			this.number = this.handleMinNumber = sku.minBuyNumber
+			this.productCount = this.handleMinNumber = sku.minBuyNumber
 			this.handleStock = sku.stock
-			console.log('handleStock',this.handleStock)
+			this.isBtnDisable = sku.stock === 0;
 			this.ladderPriceList = sku.ladderPriceList
 			this.isShowLadder = sku.ladderPriceList ? true : false
+			this.$emit('skuClick', sku)
 		},
 		showLaddePopup(){
 			// 点击显示阶梯价
@@ -529,6 +406,13 @@ export default {
 		color: #e15616;
 	}
 }
+.tui-flex-1{
+	.tui-button{
+		&.disabled {
+			background: linear-gradient(135deg, rgba(242, 143, 49, 0.5) 0%, rgba(225, 86, 22, 0.5) 100%);
+		}
+	}
+}
 .tui-modal-flex {
 	width: 100%;
 	height: 84rpx;

+ 65 - 65
pages/goods/components/cm-unit-price.vue

@@ -7,77 +7,77 @@
 				<!-- 游客 -->
 				<view class="sku-price-text">
 					<text class="sku-price-l">¥</text>
-					<uni-grader :grade="Number(product.priceGrade)"></uni-grader>
+					<uni-grader :grade="Number(skuProduct.priceGrade)"></uni-grader>
 				</view>
 			</template>
 			<template v-else-if="userIdentity == 1">
 				<!-- 协销 -->
 				<view
 					class="sku-price-text"
-					:class="PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''"
+					:class="PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1 ? 'none' : ''"
 				>
 					¥{{
-						(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-							? product.originalPrice
-							: product.price) | NumFormat
+						(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+							? skuProduct.originalPrice
+							: skuProduct.price) | NumFormat
 					}}
 				</view>
 			</template>
 			<template v-else-if="userIdentity == 2 || (userIdentity == 4 && vipFlag == 1)">
 				<!-- 资质机构 -->
-				<view class="sku-price-text" v-if="product.priceFlag == 1">¥未公开价格</view>
-				<view class="sku-price-text" v-else-if="product.priceFlag == 3 && firstClubType != 1"
+				<view class="sku-price-text" v-if="skuProduct.priceFlag == 1">¥未公开价格</view>
+				<view class="sku-price-text" v-else-if="skuProduct.priceFlag == 3 && firstClubType != 1"
 					>¥仅医美机构可见</view
 				>
 				<view
 					v-else
 					class="sku-price-text"
-					:class="PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''"
+					:class="PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1 ? 'none' : ''"
 				>
 					¥{{
-						(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-							? product.originalPrice
-							: product.price) | NumFormat
+						(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+							? skuProduct.originalPrice
+							: skuProduct.price) | NumFormat
 					}}
 				</view>
 			</template>
 			<template v-else-if="userIdentity == 3">
 				<!-- 供应商 -->
-				<template v-if="product.shopId === shopID">
-					<view class="sku-price-text" v-if="product.priceFlag == 1">¥未公开价格</view>
+				<template v-if="skuProduct.shopId === shopID">
+					<view class="sku-price-text" v-if="skuProduct.priceFlag == 1">¥未公开价格</view>
 					<view
 						v-else
 						class="sku-price-text"
-						:class="PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''"
+						:class="PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1 ? 'none' : ''"
 					>
 						¥{{
-							(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-								? product.originalPrice
-								: product.price) | NumFormat
+							(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+								? skuProduct.originalPrice
+								: skuProduct.price) | NumFormat
 						}}
 					</view>
 				</template>
 				<template v-else>
 					<view class="sku-price-text">
 						<text class="sku-price-l">¥</text>
-						<uni-grader :grade="Number(product.priceGrade)"></uni-grader>
+						<uni-grader :grade="Number(skuProduct.priceGrade)"></uni-grader>
 					</view>
 				</template>
 			</template>
 			<template v-else-if="userIdentity == 4 && vipFlag != 1">
 				<!-- 普通机构 -->
-				<text class="sku-price-text" v-if="product.priceFlag == 1">¥未公开价格</text>
-				<text class="sku-price-text" v-else-if="product.priceFlag == 2">¥价格仅会员可见</text>
-				<text class="sku-price-text" v-else-if="product.priceFlag == 3">¥仅医美机构可见</text>
+				<text class="sku-price-text" v-if="skuProduct.priceFlag == 1">¥未公开价格</text>
+				<text class="sku-price-text" v-else-if="skuProduct.priceFlag == 2">¥价格仅会员可见</text>
+				<text class="sku-price-text" v-else-if="skuProduct.priceFlag == 3">¥仅医美机构可见</text>
 				<view
 					v-else
 					class="sku-price-text"
-					:class="PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''"
+					:class="PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1 ? 'none' : ''"
 				>
 					¥{{
-						(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-							? product.originalPrice
-							: product.price) | NumFormat
+						(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+							? skuProduct.originalPrice
+							: skuProduct.price) | NumFormat
 					}}
 				</view>
 			</template>
@@ -88,13 +88,13 @@
 				<!-- 游客 -->
 				<view class="floor-item-act">
 					<view class="coupon-tags" v-if="this.$parent.productCoupon.length > 0">优惠券</view>
-					<template v-if="product.actStatus == 1">
-						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1" class="floor-tags">
-							{{ product.promotions.name }}<text v-if="hasLogin">:¥{{ product.price | NumFormat }}</text>
+					<template v-if="skuProduct.actStatus == 1">
+						<view v-if="skuProduct.promotions.type == 1 && skuProduct.promotions.mode == 1" class="floor-tags">
+							{{ skuProduct.promotions.name }}<text v-if="hasLogin">:¥{{ skuProduct.price | NumFormat }}</text>
 						</view>
-						<view v-else class="floor-tags">{{ product.promotions.name }}</view>
+						<view v-else class="floor-tags">{{ skuProduct.promotions.name }}</view>
 					</template>
-					<template v-if="product.svipProductFlag == 1">
+					<template v-if="skuProduct.svipProductFlag == 1">
 						<view class="svip-tags"> <view class="tags none">SVIP</view> </view>
 					</template>
 				</view>
@@ -103,20 +103,20 @@
 				<!-- 协销 -->
 				<view class="floor-item-act">
 					<view class="coupon-tags" v-if="this.$parent.productCoupon.length > 0">优惠券</view>
-					<template v-if="product.actStatus == 1">
-						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1" class="floor-tags">
-							{{ product.promotions.name
+					<template v-if="skuProduct.actStatus == 1">
+						<view v-if="skuProduct.promotions.type == 1 && skuProduct.promotions.mode == 1" class="floor-tags">
+							{{ skuProduct.promotions.name
 							}}<text v-if="hasLogin"
 								>:¥{{
-									product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
+									skuProduct.promotions == null ? '0.00' : skuProduct.promotions.touchPrice | NumFormat
 								}}</text
 							>
 						</view>
-						<view v-else class="floor-tags">{{ product.promotions.name }}</view>
+						<view v-else class="floor-tags">{{ skuProduct.promotions.name }}</view>
 					</template>
-					<template v-if="product.svipProductFlag == 1">
+					<template v-if="skuProduct.svipProductFlag == 1">
 						<view class="svip-tags">
-							<view class="tags none">SVIP</view> <view class="price">{{ product.svipPriceTag }}</view>
+							<view class="tags none">SVIP</view> <view class="price">{{ skuProduct.svipPriceTag }}</view>
 						</view>
 					</template>
 				</view>
@@ -125,21 +125,21 @@
 				<!-- 资质机构 -->
 				<view class="floor-item-act">
 					<view class="coupon-tags" v-if="this.$parent.productCoupon.length > 0">优惠券</view>
-					<template v-if="product.actStatus == 1">
-						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1" class="floor-tags">
-							{{ product.promotions.name
-							}}<text v-if="hasLogin && product.priceFlag != 1"
+					<template v-if="skuProduct.actStatus == 1">
+						<view v-if="skuProduct.promotions.type == 1 && skuProduct.promotions.mode == 1" class="floor-tags">
+							{{ skuProduct.promotions.name
+							}}<text v-if="hasLogin && skuProduct.priceFlag != 1"
 								>:¥{{
-									product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
+									skuProduct.promotions == null ? '0.00' : skuProduct.promotions.touchPrice | NumFormat
 								}}</text
 							>
 						</view>
-						<view v-else class="floor-tags">{{ product.promotions.name }}</view>
+						<view v-else class="floor-tags">{{ skuProduct.promotions.name }}</view>
 					</template>
-					<template v-if="product.svipProductFlag == 1">
+					<template v-if="skuProduct.svipProductFlag == 1">
 						<view class="svip-tags">
-							<view class="tags" :class="{ none: !isShowVipFlag(product) }">SVIP</view>
-							<view class="price" v-if="isShowVipFlag(product)">{{ product.svipPriceTag }}</view>
+							<view class="tags" :class="{ none: !isShowVipFlag(skuProduct) }">SVIP</view>
+							<view class="price" v-if="isShowVipFlag(skuProduct)">{{ skuProduct.svipPriceTag }}</view>
 						</view>
 					</template>
 				</view>
@@ -148,22 +148,22 @@
 				<!-- 供应商 -->
 				<view class="floor-item-act">
 					<view class="coupon-tags" v-if="this.$parent.productCoupon.length > 0">优惠券</view>
-					<template v-if="product.actStatus == 1">
-						<view v-if="product.promotions.type == 1 && product.promotions.mode == 1" class="floor-tags">
-							{{ product.promotions.name
-							}}<text v-if="hasLogin && product.priceFlag != 1"
+					<template v-if="skuProduct.actStatus == 1">
+						<view v-if="skuProduct.promotions.type == 1 && skuProduct.promotions.mode == 1" class="floor-tags">
+							{{ skuProduct.promotions.name
+							}}<text v-if="hasLogin && skuProduct.priceFlag != 1"
 								>:¥{{
-									product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
+									skuProduct.promotions == null ? '0.00' : skuProduct.promotions.touchPrice | NumFormat
 								}}</text
 							>
 						</view>
-						<view v-else class="floor-tags">{{ product.promotions.name }}</view>
+						<view v-else class="floor-tags">{{ skuProduct.promotions.name }}</view>
 					</template>
-					<template v-if="product.svipProductFlag == 1">
+					<template v-if="skuProduct.svipProductFlag == 1">
 						<view class="svip-tags">
 							<view class="tags" :class="{ none: vipFlag != 1 }">SVIP</view>
-							<view class="price" v-if="product.priceFlag != 1 && vipFlag == 1">{{
-								product.svipPriceTag
+							<view class="price" v-if="skuProduct.priceFlag != 1 && vipFlag == 1">{{
+								skuProduct.svipPriceTag
 							}}</view>
 						</view>
 					</template>
@@ -173,21 +173,21 @@
 				<!-- 普通机构 -->
 				<view class="floor-item-act">
 					<view class="coupon-tags" v-if="this.$parent.productCoupon.length > 0">优惠券</view>
-					<template v-if="product.actStatus == 1">
-						<view v-if="PromotionsFormat(product.promotions)" class="floor-tags">
-							{{ product.promotions.name
-							}}<text v-if="hasLogin && product.priceFlag != 1"
+					<template v-if="skuProduct.actStatus == 1">
+						<view v-if="PromotionsFormat(skuProduct.promotions)" class="floor-tags">
+							{{ skuProduct.promotions.name
+							}}<text v-if="hasLogin && skuProduct.priceFlag != 1"
 								>:¥{{
-									product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
+									skuProduct.promotions == null ? '0.00' : skuProduct.promotions.touchPrice | NumFormat
 								}}</text
 							>
 						</view>
-						<view v-else class="floor-tags">{{ product.promotions.name }}</view>
+						<view v-else class="floor-tags">{{ skuProduct.promotions.name }}</view>
 					</template>
-					<template v-if="product.svipProductFlag == 1">
+					<template v-if="skuProduct.svipProductFlag == 1">
 						<view class="svip-tags">
-							<view class="tags" :class="{ none: !isShowVipFlag(product) }">SVIP</view>
-							<view class="price" v-if="isShowVipFlag(product)">{{ product.svipPriceTag }}</view>
+							<view class="tags" :class="{ none: !isShowVipFlag(skuProduct) }">SVIP</view>
+							<view class="price" v-if="isShowVipFlag(product)">{{ skuProduct.svipPriceTag }}</view>
 						</view>
 					</template>
 				</view>
@@ -205,7 +205,7 @@ export default {
 		uniGrader
 	},
 	props: {
-		product: {
+		skuProduct: {
 			type: Object
 		}
 	},

+ 15 - 151
pages/goods/components/cm-unit-suppor-popup.vue

@@ -4,8 +4,8 @@
 		<view class="tui-popup-box clearfix">
 			<view class="tui-shopping-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 				<view class="tui-sku-title">
-					<view class="tui-sku-image"> <image :src="product.image" mode=""></image> </view>
-					<view class="tui-sku-price"> <cmUnitPrice :product="product"></cmUnitPrice> </view>
+					<view class="tui-sku-image"> <image :src="skuProduct.image" mode=""></image> </view>
+					<view class="tui-sku-price"> <cmUnitPrice :skuProduct="skuProduct"></cmUnitPrice> </view>
 				</view>
 				<view class="tui-sku-unit">
 					<view class="sku-unit-h1">规格:</view>
@@ -17,7 +17,7 @@
 							:key="index"
 							:class="skuIndex === index ? 'active' : ''"
 						>
-							{{ sku.unit }} <text class="tips">缺货</text>
+							{{ sku.unit }} <text class="tips" v-if="sku.stock === 0">缺货</text>
 						</view>
 					</view>
 				</view>
@@ -50,7 +50,7 @@ export default {
 		cmUnitPrice
 	},
 	props: {
-		product: {
+		skuProduct: {
 			type: Object
 		},
 		popupShow: {
@@ -71,150 +71,10 @@ export default {
 			number: 0,
 			buyRetailPrice: 0,
 			ladderPriceList: [],
-			isQuantity: false,
 			handleUnit:'',
-			skuList: [
-				{
-					unit: '135ml70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: ' 精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【70ml】2瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				},
-				{
-					unit: '【35ml】4瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 // 库存
-				}
-			]
+			handleMinNumber:0,
+			handleStock:0,
+			skuList: []
 		}
 	},
 	filters: {
@@ -224,8 +84,10 @@ export default {
 		}
 	},	
 	created() {
-		this.number = this.product.minBuyNumber
-		this.buyRetailPrice = this.product.price
+		this.skuList = this.skuProduct.skus
+		this.productCount = this.skuList[0].minBuyNumber
+		this.handleMinNumber = this.skuList[0].minBuyNumber
+		this.handleStock = this.skuList[0].stock
 		this.initData()
 	},
 	computed: {
@@ -236,7 +98,7 @@ export default {
 			const userInfo = await this.$api.getStorage()
 			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
 			//处理禁用按钮商品
-			this.isBtnDisabled = this.isDisabledFlag(this.product)
+			this.isBtnDisabled = this.isDisabledFlag(this.skuProduct)
 			if(this.product.skuList[0].ladderPriceList){ this.isShowLadder = true }
 		},
 		isDisabledFlag(pros){
@@ -256,7 +118,7 @@ export default {
 			return false
 		},
 		handleConfirm() {
-			const data = { unit : this.handleUnit} 
+			const data = { unit : this.handleUnit,number:this.handleMinNumber} 
 			this.$emit('btnConfirm', data)
 			this.$parent.popupShow1 = false
 		},
@@ -266,6 +128,8 @@ export default {
 			this.handleUnit = sku.unit
 			this.ladderPriceList = sku.ladderPriceList
 			this.isShowLadder = sku.ladderPriceList ? true : false
+			this.isBtnDisabled = sku.stock === 0
+			this.$emit('skuClick', sku)
 		},
 		showLaddePopup(){
 			// 点击显示阶梯价

+ 54 - 34
pages/goods/goods-supporting.vue

@@ -28,16 +28,16 @@
 								<view class="tui-goods-type" v-if="pros.productType == 2">医疗器械</view>
 							</view>
 							<view class="tui-goods-info">
-								<text class="list-details-title" @click.stop="navToDetailPage(pros.productId)">{{
+								<view class="list-details-title" @click.stop="navToDetailPage(pros.productId)">{{
 									pros.name
-								}}</text>
-								<text class="list-details-specs" @click.stop="handlerUnit(pros)"
+								}}</view>
+								<view class="list-details-specs" @click.stop="handlerUnit(pros)"
 									>规格:
-									<text class="list-unit">
-										{{ pros.unit }}
+									<view class="list-unit">
+										<text class="list-unit-text">{{ pros.unit }}</text>
 										<text class="iconfont icon-xiangxiajiantou"></text>
-									</text>
-								</text>
+									</view>
+								</view>
 								<template v-if="hasLogin">
 									<template v-if="userIdentity == 4 && vipFlag != 1">
 										<view class="list-details-price" v-if="pros.priceFlag == 1">
@@ -273,8 +273,9 @@
 		<cm-unit-suppor-popup
 			v-if="popupShow1"
 			:popupShow="popupShow1"
-			:product="handlePros"
+			:skuProduct="handlePros"
 			@btnConfirm="handleBtnConfirm"
+			@skuClick="handleSkuClick"
 		></cm-unit-suppor-popup>
 		<!-- 取消收藏操作 -->
 		<view class="fiexd-popup-box clearfix">
@@ -444,19 +445,17 @@ export default {
 			if (this.hasLogin) {
 				switch (type) {
 					case 'buy':
-						console.log('立即购买')
-						this.toConfirmation()
+						this.handleToConfirm()
 						break
 					case 'add':
-						console.log('加入购物车')
-						this.getAddProductCart()
+						this.handleAddClubCart()
 						break
 				}
 			} else {
 				this.$api.navigateTo('/pages/login/login')
 			}
 		},
-		getAddProductCart() {
+		handleAddClubCart() {
 			//增加购物车成功和toast弹窗提示成功
 			let list = []
 			if (!this.isProductChecked) {
@@ -465,7 +464,7 @@ export default {
 			}
 			this.productList.forEach(el => {
 				if (el.isChecked) {
-					list.push({ productId: el.productId, productCount: el.number })
+					list.push({ productId:el.productId , productCount: el.number ,skuId:el.skuId })
 				}
 			})
 			this.ProductService.ShoppingAddCarts({
@@ -479,7 +478,7 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
-		toConfirmation() {
+		handleToConfirm() {
 			//跳转确认订单页面
 			let list = []
 			if (!this.isProductChecked) {
@@ -488,7 +487,7 @@ export default {
 			}
 			this.productList.map((el, index) => {
 				if (el.isChecked) {
-					list.push({ id: el.productId, count: el.number })
+					list.push({ id:el.productId , count: el.number ,skuId:el.skuId })
 				}
 			})
 			console.log('勾选商品', list)
@@ -518,20 +517,20 @@ export default {
 			})
 		},
 		disabledChecked(pros) {
-			if (pros.priceFlag == 1) {
-				// 为公开价格返回 true 禁用按钮
-				return true
-			} else if (this.userIdentity == 4) {
-				// 普通机构且商品价格仅会员可见 || 商品价格仅医美机构可见  禁用按钮
-				if (pros.priceFlag == 2 || pros.priceFlag == 3) {
-					return true
-				}
-			} else if (this.userIdentity == 2) {
-				// 资质机构下 商品价格仅医美机构可见 且本机构不为医美机构  禁用按钮
-				if (pros.priceFlag == 3 && this.firstClubType != 1) {
-					return true
-				}
-			}
+			// 非会员
+			if (!this.vipFlag === 1) return true
+			// 商品已下架 || 库存为0 
+			if (pros.validFlag === 3) return true
+			// 商品价格不公开
+			if (pros.priceFlag === 1) return true
+			// 商品价格仅资质机构可见 && 机构为普通机构
+			if (pros.priceFlag === 2 && this.userIdentity === 4 && this.vipFlag != 1) return true
+			// 商品价格仅医美机构可见 && 机构为普通机构 
+			if (pros.priceFlag === 3 && this.userIdentity === 4 ) return true
+			// 商品价格仅医美机构可见 && 机构为资质机构 && 不是医美机构
+			if (pros.priceFlag === 3 && this.userIdentity === 2 && this.firstClubType != 1) return true
+			//其他
+			return false
 		},
 		isCheckedAll() {
 			//全选
@@ -641,6 +640,14 @@ export default {
 		},
 		handleBtnConfirm(data){
 			this.handlePros.unit = data.unit
+			this.handlePros.number = data.number
+			console.log('handlePros',this.handlePros)
+		},
+		handleSkuClick(sku){
+			this.handlePros.unit = sku.unit
+			this.handlePros.number = sku.minBuyNumber
+			this.handlePros.price = sku.price
+			this.handlePros.originalPrice = sku.originalPrice
 		},
 		handlerUnit(pros){
 			this.popupShow1 = true
@@ -819,26 +826,39 @@ page {
 		color: #999999;
 		font-size: 24rpx;
 		.list-unit{
+			width: 136rpx;
 			line-height: 40rpx;
 			display: inline-block;
 			text-align: center;
-			padding: 0 60rpx 0 16rpx;
-			font-size: 22rpx;
+			padding: 0 40rpx 0 16rpx;
 			box-sizing: border-box;
 			border: 1px solid #CCC;
 			color: #999999;
 			position: relative;
 			border-radius: 6rpx;
+			.list-unit-text{
+				width: 80rpx;
+				line-height: 40rpx;
+				display: inline-block;
+				text-align: left;
+				font-size: 22rpx;
+				text-overflow: ellipsis;
+				overflow: hidden;
+				display: -webkit-box;
+				-webkit-line-clamp:1;
+				line-clamp: 1;
+				-webkit-box-orient: vertical;
+			}
 			.icon-xiangxiajiantou{
 				display: block;
-				width: 60rpx;
+				width: 40rpx;
 				height: 40rpx;
 				line-height: 40rpx;
 				color: #999999;
 				position: absolute;
 				right: 0;
 				top: 0;
-				font-size: 32rpx;
+				font-size: 28rpx;
 			}
 		}
 	}

+ 71 - 16
pages/goods/mixins/proMixins.js

@@ -2,28 +2,83 @@
 // 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
 import Vue from 'vue'
 const proMixins = {
-    computed: {
-		
+    data() {
+        return {
+            btnType:'',
+            skuProduct: {},
+            addParams: {
+                skuId: 0,
+                productCount: 0,
+                productId: 0,
+                userId: 0,
+                source: 1
+            }
+        }
     },
     methods: {
-        cmsSysStatistics(cmsSysType,productId) {
-            this.ProductService.sYsStatisticsTypesSatisticsNumber({typeId:cmsSysType,productId:productId})
+        buyProductCart() {
+		    //底部购物车按钮点击
+		    if (this.hasLogin) {
+		        // 友盟埋点商品详情购物车入口点击事件
+		        if (process.env.NODE_ENV != 'development') {
+		            this.$uma.trackEvent('Um_Event_ProductShoppingCart', {
+		                Um_Key_PageName: '去购物车',
+		                Um_Key_SourcePage: '商品详情购物车入口'
+		            })
+		        }
+		        this.$api.navigateTo('/pages/goods/cart')
+		    } else {
+		        this.$api.navigateTo('/pages/login/login?type=1')
+		    }
+        },
+        btnGetConfirm(type) {
+		    //加入购物车&&立即购买点击
+		    if (this.hasLogin) {
+                this.btnType = type
+		        this.popupShow3 = true
+		        this.unitPopupType = 1
+		    } else {
+		        this.$api.navigateTo('/pages/login/login?type=1')
+		    }
+        },
+        handleSkuClick(sku) {  //sku修改选择
+            this.addParams.skuId = sku.skuId
+            this.skuProduct.originalPrice = sku.originalPrice
+            this.skuProduct.price = sku.price
+        },
+        handleBuyConfirm(data) {
+            // 监听确定选择规格
+            console.log('data', data)
+            if (data.type == 'buy') {
+                this.handleToConfirm({ productIds: this.product.productId, skuId: this.addParams.skuId, productCount: data.productCount })
+            } else {
+                this.addParams.productCount = data.productCount
+                this.handleAddClubCart(this.addParams)
+            }
+        },
+        handleToConfirm(data) {
+            //跳转确认订单页面
+            this.$api.navigateTo(`/pages/user/order/create-order?type=1&data=${JSON.stringify({ data: data })}`)
+        },
+        handleAddClubCart(params) {
+            //增加购物车成功和toast弹窗提示成功
+            this.ProductService.shoppingAddCart(params)
                 .then(response => {
-                    const map = {
-					    1: '首页轮播',
-					    2: '直播模块',
-					    3: '最新活动',
-					    4: '热门文章',
-					    5: '新品橱窗',
-					    6: '活动列表'
-                    }
-                    const sYsText = map[cmsSysType]
-                    console.log(`<-------${sYsText}统计数据成功------>`)
+                    this.specClass = 'hide'
+                    this.$util.msg('加入购物车成功', 1500, true, 'success')
+                    this.isAnimation = true
+                    setTimeout(() => {
+                        this.specClass = 'none'
+                    }, 200)
+                    setTimeout(() => {
+                        this.isAnimation = false
+                    }, 2000)
+                    this.bottomCartNumber = response.data
                 })
                 .catch(error => {
-                    console.log(`<-------统计${sYsText}数据异常------>`)
+                    console.log('error', error.msg)
                 })
-        },
+        }
     }
 }
 

+ 26 - 85
pages/goods/product.vue

@@ -178,7 +178,7 @@
 					</view>
 					<!-- 选择规格 -->
 					<view class="product-parameter" v-if="isShowButton" @click="showPopup(3)">
-						<text class="title">选择:</text> <text class="name">共10种规格可选</text>
+						<text class="title">选择:</text> <text class="name">共{{ skusCount }}种规格可选</text>
 						<text class="iconfont icon-xiayibu"></text>
 					</view>
 					<!-- 参数 -->
@@ -530,7 +530,7 @@
 								:disabled="goodsData.disabled"
 								class="btn btn-cart"
 								:class="[goodsData.disabled ? 'disabled' : '']"
-								@tap.stop="btnGetConfirm"
+								@tap.stop="btnGetConfirm('add')"
 							>
 								加入购物车
 							</button>
@@ -538,7 +538,7 @@
 								:disabled="goodsData.disabled"
 								class="btn btn-bay"
 								:class="[goodsData.disabled ? 'disabled' : '']"
-								@tap.stop="btnGetConfirm"
+								@tap.stop="btnGetConfirm('buy')"
 							>
 								立即购买
 							</button>
@@ -552,7 +552,16 @@
 		<!-- 商品参数 -->
 		<cm-prams-popup v-if="popupShow0" :popupShow="popupShow0" :product="product"></cm-prams-popup>
 		<!-- 选择规格弹窗 -->
-		<cm-unit-popup v-if="popupShow3" :popupShow="popupShow3" :product="product" :type="unitPopupType" :goodsData="goodsData" @buyConfirm="handleBuyConfirm"></cm-unit-popup>
+		<cm-unit-popup
+			v-if="popupShow3"
+			:popupShow="popupShow3"
+			:skuProduct="skuProduct"
+			:type="unitPopupType"
+			:btnType="btnType"
+			:goodsData="goodsData"
+			@buyConfirm="handleBuyConfirm"
+			@skuClick="handleSkuClick"
+		></cm-unit-popup>
 		<!-- 弹窗提示 -->
 		<tui-modal
 			:show="modal"
@@ -596,10 +605,11 @@ import authorize from '@/common/config/authorize.js'
 import wxLogin from '@/common/config/wxLogin.js'
 import { debounce } from '@/common/config/common.js'
 import payMixins from '@/mixins/payMixins.js'
+import proMixins from './mixins/proMixins.js'
 import thorui from '@/components/clipboard/clipboard.thorui.js'
 var isPreviewImg
 export default {
-	mixins: [payMixins],
+	mixins: [payMixins,proMixins],
 	components: {
 		customP,
 		parser,
@@ -649,6 +659,7 @@ export default {
 			vipFlag: 0,
 			firstClubType: 0,
 			productId: 0,
+			skusCount: 0, // 规格种类
 			userIdentity: 0, // 用户类型
 			goodsData: {}, // 自定义数据
 			shop: {}, //供应商信息
@@ -719,7 +730,7 @@ export default {
 			],
 			showModal: false,
 			isShowCaimeiShop: false,
-			unitPopupType:0, // 选择类型 1 点击加入购物车  立即购买  2:点击规格选择
+			unitPopupType: 0 // 选择类型 1 点击加入购物车  立即购买  2:点击规格选择
 		}
 	},
 	computed: {
@@ -758,7 +769,7 @@ export default {
 		}
 	},
 	onLoad(option) {
-		this.productId = this.couponParam.productId = option.id //获取商品ID
+		this.productId = this.couponParam.productId = this.addParams.productId = option.id //获取商品ID
 		if (option.typeId) {
 			this.typeId = option.typeId
 		}
@@ -789,7 +800,7 @@ export default {
 		async initGetStotage() {
 			// 初始化
 			const userInfo = await this.$api.getStorage()
-			this.userId = this.couponParam.userId = userInfo.userId ? userInfo.userId : 0
+			this.userId = this.couponParam.userId = this.addParams.userId = userInfo.userId ? userInfo.userId : 0
 			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
 			this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
 			this.shopID = userInfo.shopId ? userInfo.shopId : 0
@@ -819,20 +830,20 @@ export default {
 					this.productImage = []
 					this.shop = response.data.shop
 					this.shopId = response.data.shopId
-					this.product = response.data
-					if(this.product.tinyTypeName){
+					this.product = this.skuProduct = response.data
+					this.skusCount = this.product.skus.length
+					this.addParams.skuId = this.product.skuId
+					if (this.product.tinyTypeName) {
 						productLabel = this.product.tinyTypeName
-					}else if(!this.product.tinyTypeName && this.product.smallTypeName){
+					} else if (!this.product.tinyTypeName && this.product.smallTypeName) {
 						productLabel = this.product.smallTypeName
-					}else{
+					} else {
 						productLabel = this.product.bigTypeName
 					}
 					//设置统计数据标签
 					uni.setStorageSync(
 						'productLabel',
-						`${productLabel}-${
-							this.product.brandName ? this.product.brandName : ''
-						}`
+						`${productLabel}-${this.product.brandName ? this.product.brandName : ''}`
 					)
 					//判断是否可以跳转供应商主页
 					if (this.product.shopType === 2) {
@@ -1232,71 +1243,6 @@ export default {
 			console.log(e.detail.path)
 			console.log(e.detail.query)
 		},
-		buyProductCart() {
-			//底部购物车按钮点击
-			if (this.hasLogin) {
-				// 友盟埋点商品详情购物车入口点击事件
-				if (process.env.NODE_ENV != 'development') {
-					this.$uma.trackEvent('Um_Event_ProductShoppingCart', {
-						Um_Key_PageName: '去购物车',
-						Um_Key_SourcePage: '商品详情购物车入口'
-					})
-				}
-				this.$api.navigateTo('/pages/goods/cart')
-			} else {
-				this.$api.navigateTo('/pages/login/login?type=1')
-			}
-		},
-		btnGetConfirm() {
-			//加入购物车&&立即购买点击
-			if (this.hasLogin) {
-				this.popupShow3 = true
-				this.unitPopupType = 1
-			} else {
-				this.$api.navigateTo('/pages/login/login?type=1')
-			}
-		},
-		handleBuyConfirm(data){// 监听确定选择规格
-			console.log('data',data)
-			if (data.type == 'buy') {
-				this.toConfirmation()
-			} else {
-				this.getAddProductCart()
-			}
-		},
-		toConfirmation() {
-			//跳转确认订单页面
-			let productStp = {
-				productIds: this.product.productId,
-				productCount: this.number
-			}
-			this.$api.navigateTo(`/pages/user/order/create-order?type=1&data=${JSON.stringify({ data: productStp })}`)
-			this.popupShow3 = false
-		},
-		getAddProductCart() {
-			//增加购物车成功和toast弹窗提示成功
-			this.ProductService.shoppingAddCart({
-				productId: this.productId,
-				userId: this.userId,
-				productCount: this.number,
-				source: 2
-			})
-				.then(response => {
-					this.specClass = 'hide'
-					this.$util.msg('加入购物车成功', 1500, true, 'success')
-					this.isAnimation = true
-					setTimeout(() => {
-						this.specClass = 'none'
-					}, 200)
-					setTimeout(() => {
-						this.isAnimation = false
-					}, 2000)
-					this.bottomCartNumber = response.data
-				})
-				.catch(error => {
-					console.log('error', error.msg)
-				})
-		},
 		setHeaderBtnPosi() {
 			// 获得胶囊按钮位置信息
 			let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
@@ -1324,9 +1270,6 @@ export default {
 				this.$api.navigateTo('/pages/supplier/user/my-shop?shopId=' + this.shopId)
 			}
 		},
-		discard() {
-			//丢弃
-		},
 		onShare(res) {
 			//分享转发
 			if (res.from === 'button') {
@@ -1360,7 +1303,6 @@ export default {
 			switch (index) {
 				case 0:
 					this.popupShow0 = true
-					console.log('popupShow0',this.popupShow0)
 					break
 				case 1:
 					this.popupShow1 = true
@@ -1377,7 +1319,6 @@ export default {
 					this.popupShow3 = true
 					this.unitPopupType = 2
 					break
-					
 			}
 		},
 		hidePopup(index) {

+ 35 - 168
pages/seller/cart/buyagain.vue

@@ -1,201 +1,68 @@
 <template>
 	<view class="container all-type-list-wrapper">
-		<buyagain-list ref="productList" @operationConfim="hanldOperationConfim" @goCartPage="hanldToCartPage">
-		</buyagain-list>
-		<!--底部选择模态层弹窗组件 -->
-		<view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
-			<!-- 遮罩层 -->
-			<view class="mask"></view>
-			<view
-				class="layer"
-				@tap.stop="discard"
-				:style="{ paddingBottom: isIphoneX ? '68rpx' : '36rpx', bottom: isIphoneX ? '-352rpx' : '-320rpx' }"
-			>
-				<view class="content">
-					<view class="layer-smimg"> <image :src="handleData.image" mode=""></image> </view>
-					<view class="layer-nunbox">
-						<view class="layer-nunbox-t">
-							<view class="layer-nunbox-text">数量:</view>
-							<view class="number-box">
-								<view
-									class="iconfont icon-jianhao"
-									:class="[isQuantity == true ? 'disabled' : '']"
-									@click="changeCountSub()"
-								></view>
-								<input
-									class="btn-input"
-									type="number"
-									v-model="number"
-									maxlength="4"
-									@blur="changeNumber($event)"
-								/>
-								<view
-									class="iconfont icon-jiahao"
-									:class="[isStock == true ? 'disabled' : '']"
-									@click="changeCountAdd()"
-								></view>
-							</view>
-						</view>
-						<view class="layer-nunbox-b">
-							<view class="text"
-								>单价: <text class="p sm">¥</text>
-								<text class="p bg">{{ buyRetailPrice.toFixed(2) }}</text>
-							</view>
-						</view>
-					</view>
-				</view>
-				<view class="btn"> <view class="button add" @click="getAddProductCart">加入购物车</view> </view>
-			</view>
-		</view>
+		<buyagain-list
+			ref="productList"
+			@operationConfim="hanldOperationConfim"
+			@goCartPage="hanldToCartPage"
+		></buyagain-list>
+		<!-- 选择规格弹窗 -->
+		<cm-unit-popup
+			v-if="popupShow"
+			:popupShow="popupShow"
+			:skuProduct="handleData"
+			@skuClick="handleSkuClick"
+		></cm-unit-popup>
 	</view>
 </template>
 
 <script>
 import buyagainList from './components/buyagainList'
+import cmUnitPopup from './components/cm-unit-popup.vue'
 export default {
 	components: {
-		buyagainList
+		buyagainList,
+		cmUnitPopup
 	},
 	data() {
 		return {
 			isIphoneX: this.$store.state.isIphoneX,
-			clubID: '', //机构ID
-			serviceProviderId: '', //协销ID
-			serverUrl: '',
-			emptyText: '',
-			lastPageType: '',
-			lastPageVal: '',
-			specClass: '', //规格弹窗css类,控制开关动画
 			handleData: {},
-			isQuantity: false,
-			isStock: false,
-			minBuyNumber: 0,
-			number: 1,
-			buyRetailPrice: 0,
-			buyRetailPriceStep: 1
+			serviceProviderId: 0,
+			clubId: 0,
+			popupShow:false
 		}
 	},
 	onLoad() {},
 	methods: {
-		getClubProductNum() {
-			this.SellerService.GetSellerProductNum({
-				clubId: this.clubID,
-				serviceProviderId: this.serviceProviderId
-			}).then(response => {
-				this.$refs.productList.cartQuantity = response.data
-			})
+		async initData(data) {
+			const clubInfo = await this.$api.getComStorage('orderUserInfo')
+			const userInfo = await this.$api.getStorage()
+			this.clubId = clubInfo.clubId
+			this.serviceProviderId = userInfo.serviceProviderId
+			this.getClubProductNum()
 		},
 		hanldOperationConfim(data) {
 			//显示选择数量确认弹窗
-			console.log(data)
-			this.specClass = 'show'
 			this.handleData = data
-			this.minBuyNumber = data.minBuyNumber
-			this.buyRetailPrice = data.price
-			this.buyRetailPriceStep = data.step
-			if (this.handleData.ladderPriceFlag == 1) {
-				this.number = data.maxBuyNumber ? data.maxBuyNumber : 1
-			} else {
-				this.number = data.minBuyNumber ? data.minBuyNumber : 1
-			}
-		},
-		hideSpec() {
-			//关闭选择数量确认弹窗
-			this.specClass = 'hide'
-			setTimeout(() => {
-				this.specClass = 'none'
-			}, 200)
+			this.popupShow = true
 		},
-		changeCountAdd() {
-			//popup弹窗数量增加按钮
-			if (this.buyRetailPriceStep == 2) {
-				this.number += this.minBuyNumber
-			} else {
-				this.number++
-			}
-			this.calculatPerice()
-		},
-		changeCountSub() {
-			//popup弹窗数量减按钮
-			if (this.number <= this.minBuyNumber) {
-				this.number = this.minBuyNumber
-				this.isQuantity = true
-				this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`, 2000)
-				return
-			} else {
-				if (this.buyRetailPriceStep == 2) {
-					this.number -= this.minBuyNumber
-				} else {
-					this.number--
-				}
-				this.calculatPerice()
-				this.isQuantity = false
-			}
-		},
-		changeNumber(e) {
-			let _value = e.detail.value
-			if (!this.$api.isNumber(_value)) {
-				this.number = this.minBuyNumber
-			} else if (_value < this.minBuyNumber) {
-				this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`, 2000)
-				this.number = this.minBuyNumber
-			} else if (_value % this.minBuyNumber != 0) {
-				this.$util.msg('购买量必须为起订量的整数倍', 2000)
-				this.number = this.minBuyNumber
-			} else {
-				this.number = e.detail.value
-				this.calculatPerice()
-			}
-		},
-		calculatPerice() {
-			//判断是否为阶梯价然后做计算价格处理
-			if (this.handleData.ladderPriceFlag == 1) {
-				this.handleData.ladderPrices.forEach((item, index) => {
-					if (this.number >= item.buyNum) {
-						this.buyRetailPrice = item.buyPrice
-					}
-				})
-			} else {
-				this.buyRetailPrice = this.handleData.retailPrice
-			}
-		},
-		getAddProductCart() {
-			//增加购物车成功和toast弹窗提示成功
-			let params = {
-				productId: this.handleData.productId,
-				clubId: this.clubID,
-				serviceProviderId: this.serviceProviderId,
-				productCount: this.number,
-				type:1
-			}
-			this.SellerService.ShoppingCartAddCart(params)
-				.then(response => {
-					this.specClass = 'hide'
-					this.$util.msg('加入购物车成功', 1500, true, 'success')
-					this.getClubProductNum()
-					setTimeout(() => {
-						this.specClass = 'none'
-					}, 200)
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
+		handleSkuClick(sku) {
+			this.handleData.price = sku.price
 		},
 		hanldToCartPage() {
 			this.$api.navigateTo('/pages/seller/cart/cart')
 		},
-		discard() {
-			//丢弃
+		getClubProductNum() {
+			this.SellerService.GetSellerProductNum({
+				clubId: this.clubId,
+				serviceProviderId: this.serviceProviderId
+			}).then(response => {
+				this.$refs.productList.cartQuantity = response.data
+			})
 		}
 	},
 	onShow() {
-		this.$api.getComStorage('orderUserInfo').then(resolve => {
-			this.clubID = resolve.clubId
-		})
-		this.$api.getStorage().then(resolve => {
-			this.serviceProviderId = resolve.serviceProviderId
-			this.getClubProductNum()
-		})
+		this.initData()
 	}
 }
 </script>

+ 151 - 244
pages/seller/cart/cart.vue

@@ -21,7 +21,7 @@
 						<view v-for="(item, index) in goodsList" :key="index" class="goods-item">
 							<view class="shoptitle">
 								<!--选择商店的全部商品 :disabled="isNnder"-->
-								<view class="checkbox-box" @click.stop="checkShop(item)">
+								<view class="checkbox-box" @click.stop="handleCheckShop(item)">
 									<view
 										class="checkbox iconfont"
 										:class="[item.isChecked ? 'icon-yixuanze' : 'icon-weixuanze']"
@@ -38,7 +38,7 @@
 								<view class="goods-pros" v-for="(pros, idx) in item.cartList" :key="idx">
 									<view class="goods-pros-t">
 										<!--选择商品-->
-										<view class="checkbox-box" @click.stop="ischeck(item, pros, idx)">
+										<view class="checkbox-box" @click.stop="handlsCkecdPros(item, pros, idx)">
 											<view
 												class="checkbox iconfont"
 												:class="[pros.isChecked ? 'icon-yixuanze' : 'icon-weixuanze']"
@@ -59,90 +59,98 @@
 											>
 												<view bgcolor="#666666">商品编码:{{ pros.productCode }}</view>
 											</view>
-											<view class="productprice">
-												<!--使用过滤器对总价改变-->
-												<view
-													class="price"
-													:class="
-														PromotionsFormat(pros.promotions) ||
-														(pros.svipProductFlag == 1 && vipFlag == 1)
-															? 'disabled'
-															: ''
-													"
-												>
-													<text>¥</text>
-													{{
-														(PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
-															? pros.originalPrice
-															: pros.price) | NumFormat
-													}}
-												</view>
-												<view class="count" :class="[isshowDelbtn ? 'none' : 'show']">
-													<text class="count-tips" v-if="pros.number < pros.min"
-														>起订量:{{ pros.min }}</text
-													>
-													<text class="count-tips step" v-if="pros.isStep"
-														>购买量必须为起订量的整数倍</text
-													>
-													<view class="number-box">
-														<view
-															class="iconfont icon-jianhao"
-															@click="changeCountSub(item, pros)"
-														></view>
-														<input
-															class="btn-input"
-															type="number"
-															maxlength="6"
-															v-model="pros.number"
-															@blur="changeNnmber($event, item, pros)"
-														/>
-														<view
-															class="iconfont icon-jiahao"
-															@click="changeCountAdd(item, pros)"
-														></view>
-													</view>
-												</view>
-											</view>
-											<view class="floor-item-act">
-												<template v-if="pros.actStatus == 1 && pros.promotions">
+											<template v-if="pros.number > pros.stock || pros.stock === 0">
+												<view class="cart-sku-temp" @click.stop="handleShouUnitPopup(pros)">
+													<view class="cart-sku-text">重新选择商品规格</view>
+													<view class="cart-sku-btn">重选</view>
+												</view>	
+											</template>
+											<template v-else>
+												<view class="productprice">
+													<!--使用过滤器对总价改变-->
 													<view
-														v-if="PromotionsFormat(pros.promotions)"
-														class="floor-tags"
-														@click.stop="clickPopupShow(pros, 1)"
+														class="price"
+														:class="
+															PromotionsFormat(pros.promotions) ||
+															(pros.svipProductFlag == 1 && vipFlag == 1)
+																? 'disabled'
+																: ''
+														"
 													>
-														{{ pros.promotions.name }}
-														<text
-															v-if="pros.promotions != null && pros.promotions.type != 3"
-														>
-															:¥{{
-																pros.promotions == null
-																	? '0.00'
-																	: pros.promotions.touchPrice | NumFormat
-															}}
-														</text>
+														<text>¥</text>
+														{{
+															(PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
+																? pros.originalPrice
+																: pros.price) | NumFormat
+														}}
 													</view>
-													<view
-														v-else-if="pros.promotions.type != 3"
-														class="floor-tags"
-														@click.stop="clickPopupShow(pros, 2)"
-													>
-														{{ pros.promotions.name }}
-													</view>
-												</template>
-												<template v-if="pros.actStatus == null && pros.ladderFlag == 1">
-													<view class="floor-tags" @click.stop="clickPopupShow(pros, 2)"
-														>阶梯价格</view
-													>
-												</template>
-												<template v-if="pros.svipProductFlag == 1">
-													<view class="svip-tags">
-														<view class="tags" :class="{ none: vipFlag != 1 }">SVIP</view>
-														<view class="price" v-if="isShowVipFlag(pros)">{{
-															pros.svipPriceTag
-														}}</view>
+													<view class="count" :class="[isshowDelbtn ? 'none' : 'show']">
+														<text class="count-tips" v-if="pros.number < pros.min"
+															>起订量:{{ pros.min }}</text
+														>
+														<text class="count-tips step" v-if="pros.isStep"
+															>购买量必须为起订量的整数倍</text
+														>
+														<view class="number-box">
+															<view
+																class="iconfont icon-jianhao"
+																@click="changeCountSub(item, pros)"
+															></view>
+															<input
+																class="btn-input"
+																type="number"
+																maxlength="6"
+																v-model="pros.number"
+																@blur="changeNnmber($event, item, pros)"
+															/>
+															<view
+																class="iconfont icon-jiahao"
+																@click="changeCountAdd(item, pros)"
+															></view>
+														</view>
 													</view>
-												</template>
-											</view>
+												</view>
+												<view class="floor-item-act">
+													<template v-if="pros.actStatus == 1 && pros.promotions">
+														<view
+															v-if="PromotionsFormat(pros.promotions)"
+															class="floor-tags"
+															@click.stop="clickPopupShow(pros, 1)"
+														>
+															{{ pros.promotions.name }}
+															<text
+																v-if="pros.promotions != null && pros.promotions.type != 3"
+															>
+																:¥{{
+																	pros.promotions == null
+																		? '0.00'
+																		: pros.promotions.touchPrice | NumFormat
+																}}
+															</text>
+														</view>
+														<view
+															v-else-if="pros.promotions.type != 3"
+															class="floor-tags"
+															@click.stop="clickPopupShow(pros, 2)"
+														>
+															{{ pros.promotions.name }}
+														</view>
+													</template>
+													<template v-if="pros.actStatus == null && pros.ladderFlag == 1">
+														<view class="floor-tags" @click.stop="clickPopupShow(pros, 2)"
+															>阶梯价格</view
+														>
+													</template>
+													<template v-if="pros.svipProductFlag == 1">
+														<view class="svip-tags">
+															<view class="tags" :class="{ none: vipFlag != 1 }">SVIP</view>
+															<view class="price" v-if="isShowVipFlag(pros)">{{
+																pros.svipPriceTag
+															}}</view>
+														</view>
+													</template>
+												</view>
+											</template>
 										</view>
 									</view>
 								</view>
@@ -168,7 +176,7 @@
 							<view class="title-txt"
 								>失效商品<text>{{ failureList.length }}件</text></view
 							>
-							<view class="title-btn" @click.stop="deletefailureList"
+							<view class="title-btn" @click.stop="handleDeletefailures"
 								><text class="butto">清空失效商品</text></view
 							>
 						</view>
@@ -178,7 +186,7 @@
 									<!--选择商品-->
 									<view
 										class="checkbox-box"
-										@click.stop="ischeckFailure(failure)"
+										@click.stop="handleCheckFailure(failure)"
 										v-if="isshowDelbtn"
 									>
 										<button
@@ -211,7 +219,7 @@
 				<!-- 脚部菜单 -->
 				<view class="footer" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
 					<view class="footer-le">
-						<view class="foot-check checkbox-box" @tap.stop="checkAll()">
+						<view class="foot-check checkbox-box" @tap.stop="handleCheckAll">
 							<button
 								class="checkbox iconfont"
 								:class="[isCheckAll ? 'icon-yixuanze' : 'icon-weixuanze']"
@@ -233,11 +241,11 @@
 						</view>
 					</view>
 					<view v-if="!isshowDelbtn" class="footer-ri">
-						<view class="btn hanld-btn" @tap="toConfirmation">去结算({{ allCount }})</view>
+						<view class="btn hanld-btn" @tap="hanldlerToConfirm">去结算({{ allCount }})</view>
 					</view>
 					<view v-else class="footer-del">
 						<view class="btn btn-cancel" @tap.stop="hideDelManage">取消</view>
-						<view class="btn btn-confirm" @tap.stop="deleteList">删除</view>
+						<view class="btn btn-confirm" @tap.stop="handleDeleteCart">删除</view>
 					</view>
 				</view>
 			</view>
@@ -252,10 +260,18 @@
 				</view>
 			</view>
 		</view>
+		<!-- 选择规格弹窗 -->
+		<cm-unit-popup
+			v-if="popupShow1"
+			:popupShow="popupShow1"
+			:skuProduct="handlePros"
+			@skuBtnConfirm="handleBtnConfirm"
+		></cm-unit-popup>
 		<!-- 促销活动弹窗 -->
 		<activi-popup :product="handlerPros" :popupShow="popupShow"></activi-popup>
 		<!-- 透明模态层 -->
 		<modal-layer v-if="modallayer"></modal-layer>
+		
 	</view>
 </template>
 <script>
@@ -263,6 +279,9 @@ import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
 import tuiNomore from '@/components/tui-components/nomore/nomore'
 import activiPopup from '@/components/cm-module/productDetails/cm-activipopu'
 import modalLayer from '@/components/modal-layer'
+import cmUnitPopup from './components/cm-unit-popup.vue'
+import cartMixins from './mixins/cartMixins.js'
+import apisMixins from './mixins/apisMixins.js'
 import { mapState, mapMutations } from 'vuex'
 const defaultListQuery = {
 	clubId: 0, // 机构Id
@@ -272,10 +291,12 @@ const defaultListQuery = {
 	pageSize: 10 // 条数
 }
 export default {
+	mixins: [apisMixins,cartMixins],
 	components: {
 		tuiLoadmore,
 		tuiNomore,
 		activiPopup,
+		cmUnitPopup,
 		modalLayer
 	},
 	data() {
@@ -283,6 +304,8 @@ export default {
 			kindCount: 0,
 			isStock: '',
 			popupShow: false,
+			popupShow1: false,
+			handlePros:{},
 			listQuery: Object.assign({}, defaultListQuery), // 购物车立即结算确认订单参数
 			handlerPros: {}, //监听单挑促销商品
 			promotionsList: [], //促销活动列表
@@ -393,26 +416,6 @@ export default {
 			})
 			return stateText
 		},
-		deletefailureList() {
-			this.failureList.forEach(failure => {
-				this.delGoodsList += failure.sellerCartId + ','
-			})
-			this.$util.modal('', '确定清空全部失效商品吗?', '确定', '取消', true, () => {
-				console.log(this.delGoodsList)
-				this.SellerService.SellerCartdelete({ sellerCartIds: this.delGoodsList })
-					.then(response => {
-						console.log(response)
-						this.$util.msg('删除成功', 2000)
-						setTimeout(() => {
-							this.isshowDelbtn = false
-							this.initGetCartGoodsList()
-						}, 2000)
-					})
-					.catch(error => {
-						this.$util.msg(error.msg, 2000)
-					})
-			})
-		},
 		setScrollHeight() {
 			// 窗口高度-footer高度
 			const { windowHeight, pixelRatio } = uni.getSystemInfoSync()
@@ -507,12 +510,18 @@ export default {
 					this.promotionsList = response.data.promotionsList
 					this.hasNextPage = resultsData.hasNextPage
 					this.goodsList = this.goodsList.concat(resultsData.results)
-					this.goodsList.forEach((item, index) => {
-						let productsListLength = item.cartList.length,
+					this.goodsList.forEach((supplier, index) => {
+						let productsListLength = supplier.cartList.length,
 							invalidLength = 0
-						item.cartList.forEach(pros => {
-							pros.shopId = item.shopId
+						supplier.cartList.forEach(pros => {
+							pros.shopId = supplier.shopId
 							pros.isStep = false
+							if(pros.stock === 0 || pros.number > pros.stock ){
+							    supplier.isDisable = true
+							    pros.isDisable = true
+							}else{
+							    pros.isDisable = false
+							}
 							if (pros.step === 2) {
 								if (pros.number % pros.min != 0) {
 									pros.number = pros.min
@@ -549,17 +558,22 @@ export default {
 				this.kindCount = response.data
 			})
 		},
-		ischeck(item, pro) {
+		handleCheckFailure(failure) {//  选择失效商品
+			failure.isChecked = !failure.isChecked
+			this.updateCheckAllBtn()
+		},
+		handlsCkecdPros(item, pro) {
 			//为未选中的时候改变为true,反之为true
+			if(pro.isDisable){ return }
 			pro.isChecked = !pro.isChecked
 			if (pro.isChecked) {
-				if (!this.submitIds.includes(pro.productId * 1)) {
-					this.submitIds.push(pro.productId)
+				if (!this.submitIds.includes(pro.skuId * 1)) {
+					this.submitIds.push(pro.skuId)
 					this.checkenProsList.push(pro)
 				}
 				this.isCheckedProductStatus = true
 			} else {
-				var lent = this.submitIds.indexOf(pro.productId * 1)
+				var lent = this.submitIds.indexOf(pro.skuId * 1)
 				if (lent >= 0) {
 					this.submitIds.splice(lent, 1)
 					this.checkenProsList.splice(lent, 1)
@@ -600,24 +614,24 @@ export default {
 			})
 			this.isCheckAll = goodsCheckedLength === goodsList.length - disabledListLength
 		},
-		checkShop(item) {
+		handleCheckShop(supplier) {
 			//与单选商品类似
-			item.isChecked = !item.isChecked
-			this.setProductChecked(item)
+			if(supplier.isDisable){ return }
+			supplier.isChecked = !supplier.isChecked
+			this.setProductChecked(supplier)
 			this.updateCheckAllBtn()
 		},
-		setProductChecked(item) {
-			item.cartList.forEach(pros => {
-				if (item.isChecked) {
+		setProductChecked(supplier) {
+			supplier.cartList.forEach(pros => {
+				if (supplier.isChecked && (pros.stock !== 0 || pros.number < pros.stock)) {
 					pros.isChecked = true
-					if (!this.submitIds.includes(pros.productId * 1)) {
-						this.submitIds.push(pros.productId)
+					if (!this.submitIds.includes(pros.skuId * 1)) {
+						this.submitIds.push(pros.skuId)
 						this.checkenProsList.push(pros)
 					}
-					this.isCheckedProductStatus = true
 				} else {
 					pros.isChecked = false
-					var lent = this.submitIds.indexOf(pros.productId * 1)
+					let lent = this.submitIds.indexOf(pros.skuId * 1)
 					if (lent >= 0) {
 						this.submitIds.splice(lent, 1)
 						this.checkenProsList.splice(lent, 1)
@@ -628,18 +642,18 @@ export default {
 		updateBothCheckBtn() {
 			if (this.isshowDelbtn) {
 				// 当管理删除按钮出现时,失效的商品可被选择
-				this.goodsList.forEach(item => {
-					item.isChecked = this.isCheckAll
-					this.setProductChecked(item)
+				this.goodsList.forEach(supplier => {
+					supplier.isChecked = this.isCheckAll
+					this.setProductChecked(supplier)
 				})
 			} else {
-				this.goodsList.forEach(item => {
-					item.isChecked = this.isCheckAll
-					this.setProductChecked(item)
+				this.goodsList.forEach(supplier => {
+					supplier.isChecked = this.isCheckAll
+					this.setProductChecked(supplier)
 				})
 			}
 		},
-		checkAll() {
+		handleCheckAll() {
 			//全选方法内调用方法
 			this.isCheckAll = !this.isCheckAll
 			this.updateBothCheckBtn()
@@ -908,79 +922,6 @@ export default {
 				})
 			}
 		},
-		updateShoppogNum(pros) {
-			//加减购物车商品更新到后台
-			this.SellerService.SellerAddProductNum({
-				id: pros.id,
-				productCount: pros.number,
-				serviceProviderId: this.listQuery.serviceProviderId
-			})
-				.then(response => {
-					this.isshowDelbtn = false
-					// this.isCheckAll = false
-					// this.initGetCartGoodsList()
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
-		},
-		toConfirmation() {
-			//跳转确认订单页面
-			let setGoodsList = []
-			let productIdList = []
-			let productIds = ''
-			this.goodsList.forEach(res => {
-				let products = res.cartList
-				products.forEach(pros => {
-					if (pros.isChecked) {
-						setGoodsList.push(pros.productId)
-					}
-				})
-			})
-			if (setGoodsList == '') {
-				this.$util.msg('请先选择结算商品~', 2000)
-				return
-			} else {
-				/**
-				 * @获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
-				 * @获取勾选的商品分类ID拼接字符串格式逗号隔开,最后一个逗号去掉
-				 */
-				this.goodsList.forEach(el => {
-					el.cartList.forEach(pros => {
-						if (pros.isChecked) {
-							productIdList.push(pros.productId)
-						}
-					})
-				})
-				//判断勾选的商品是否为充值商品或者为定金商品的一些处理逻辑
-				const isHasDepositlds = productIdList.filter(item => this.depositIds.includes(item))
-				const isHasRechargeIds = productIdList.filter(item => this.rechargeIds.includes(item))
-				const isGoods = productIdList.every(item => {
-					;[...this.depositIds, ...this.rechargeIds].includes(item)
-				})
-				if (productIdList.length == 1 && isHasDepositlds.length === 1 && isHasRechargeIds.length === 0) {
-					console.log('定金商品')
-					productIdList.forEach(item => {
-						productIds += item + ','
-					})
-				} else if (productIdList.length == 1 && isHasRechargeIds.length === 1 && isHasDepositlds.length === 0) {
-					console.log('充值余额商品')
-					productIdList.forEach(item => {
-						productIds += item + ','
-					})
-				} else if (!isGoods && isHasRechargeIds.length === 0 && isHasDepositlds.length === 0) {
-					console.log('正常商品')
-					productIdList.forEach(item => {
-						productIds += item + ','
-					})
-				} else {
-					this.$util.modal('提示', '缴纳订金商品或余额充值商品请单独下单!', '确定', '', false, () => {})
-					return
-				}
-				let cartPramsData = { productIds: productIds.substring(0, productIds.lastIndexOf(',')) }
-				this.$api.navigateTo(`/pages/seller/order/create-order?data=${JSON.stringify({ data: cartPramsData })}`)
-			}
-		},
 		showDelManager() {
 			//显示删除商品管理
 			this.isshowDelbtn = true
@@ -999,44 +940,6 @@ export default {
 				this.updateCheckAllBtn()
 			}
 		},
-		deleteList() {
-			//删除购物车商品
-			this.delGoodsList = []
-			this.goodsList.forEach(delitem => {
-				let products = delitem.cartList
-				products.forEach(pros => {
-					if (pros.isChecked) {
-						this.delGoodsList += pros.id + ','
-					}
-				})
-			})
-			this.failureList.forEach(failure => {
-				if (failure.isChecked) {
-					this.delGoodsList += failure.id + ','
-				}
-			})
-			if (this.delGoodsList.length == 0) {
-				this.$util.msg('请选择要删除的商品~', 2000)
-				return
-			} else {
-				this.$util.modal('', '确定删除选中的商品吗?', '确定', '取消', true, () => {
-					this.SellerService.DeleteSellerCart({
-						cartIds: this.delGoodsList,
-						serviceProviderId: this.listQuery.serviceProviderId
-					})
-						.then(response => {
-							this.$util.msg('删除成功', 2000)
-							setTimeout(() => {
-								this.isshowDelbtn = false
-								this.initGetCartGoodsList()
-							}, 2000)
-						})
-						.catch(error => {
-							this.$util.msg(error.msg, 2000)
-						})
-				})
-			}
-		},
 		goNavto(url) {
 			uni.navigateTo({
 				url
@@ -1065,7 +968,11 @@ export default {
 					return true
 				}
 			}
-		}
+		},
+		handleShouUnitPopup(pros){// 规格弹窗
+			this.popupShow1 = true
+			this.handlePros = pros
+		},
 	},
 	onReachBottom() {
 		if (this.hasNextPage) {

+ 111 - 168
pages/seller/cart/components/cm-unit-popup.vue

@@ -4,44 +4,49 @@
 		<view class="tui-popup-box clearfix">
 			<view class="tui-shopping-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 				<view class="tui-sku-title">
-					<view class="tui-sku-image"> <image :src="product.image" mode=""></image> </view>
+					<view class="tui-sku-image"> <image :src="skuProduct.image" mode=""></image> </view>
 					<view class="tui-sku-price">
 						<view class="sku-price-viw">
-							<view class="sku-price-text"
-								  :class="PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''"
+							<view
+								class="sku-price-text"
+								:class="
+									PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+										? 'none'
+										: ''
+								"
 							>
 								¥{{
-									(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-										? product.originalPrice
-										: product.price) | NumFormat
+									(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+										? skuProduct.originalPrice
+										: skuProduct.price) | NumFormat
 								}}
 							</view>
 						</view>
 						<view class="sku-price-vip">
 							<view class="floor-item-act">
-								<view class="coupon-tags" v-if="product.couponsLogo">优惠券</view>
-								<template v-if="product.actStatus == 1 && product.promotions">
-									<view v-if="PromotionsFormat(product.promotions)" class="floor-tags">
-										{{ product.promotions.name }}
-										<text v-if="product.promotions != null && product.promotions.type != 3">
+								<view class="coupon-tags" v-if="skuProduct.couponsLogo">优惠券</view>
+								<template v-if="skuProduct.actStatus == 1 && skuProduct.promotions">
+									<view v-if="PromotionsFormat(skuProduct.promotions)" class="floor-tags">
+										{{ skuProduct.promotions.name }}
+										<text v-if="skuProduct.promotions != null && skuProduct.promotions.type != 3">
 											:¥{{
-												product.promotions == null
+												skuProduct.promotions == null
 													? '0.00'
-													: product.promotions.touchPrice | NumFormat
+													: skuProduct.promotions.touchPrice | NumFormat
 											}}
 										</text>
 									</view>
-									<view v-else-if="product.promotions.type != 3" class="floor-tags">
-										{{ product.promotions.name }}
+									<view v-else-if="skuProduct.promotions.type != 3" class="floor-tags">
+										{{ skuProduct.promotions.name }}
 									</view>
 								</template>
-								<template v-if="product.actStatus == null && product.ladderFlag == 1">
+								<template v-if="skuProduct.actStatus == null && skuProduct.ladderFlag == 1">
 									<view class="floor-tags">阶梯价格</view>
 								</template>
-								<template v-if="product.svipProductFlag == 1">
+								<template v-if="skuProduct.svipProductFlag == 1">
 									<view class="svip-tags">
 										<view class="tags">SVIP</view>
-										<view class="price">{{product.svipPriceTag}}</view>
+										<view class="price">{{ skuProduct.svipPriceTag }}</view>
 									</view>
 								</template>
 							</view>
@@ -58,12 +63,12 @@
 							:key="index"
 							:class="skuIndex === index ? 'active' : ''"
 						>
-							{{ sku.unit }} <text class="tips">缺货</text>
+							{{ sku.unit }} <text class="tips" v-if="sku.stock === 0">缺货</text>
 						</view>
 					</view>
 				</view>
 				<view class="sku-unit-nunbox">
-					<view class="sku-unit-nunbox" v-if="product.step === 2">
+					<view class="sku-unit-nunbox" v-if="skuProduct.step === 2">
 						<view class="text">*该商品只能以起订量的整数倍购买</view>
 					</view>
 					<view class="sku-unit-nunbox-t">
@@ -73,17 +78,19 @@
 								<view
 									class="iconfont icon-jianhao"
 									@click="changeCountSub"
+									:class="[isQuantity == true ? 'disabled' : '']"
 								></view>
 								<input
 									class="btn-input"
 									type="number"
-									v-model="params.productCount"
+									v-model="productCount"
 									maxlength="4"
 									@blur="changeNumber($event)"
 								/>
 								<view
 									class="iconfont icon-jiahao"
 									@click="changeCountAdd"
+									:class="[isStock == true ? 'disabled' : '']"
 								></view>
 							</view>
 						</view>
@@ -92,7 +99,13 @@
 			</view>
 			<view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 				<view class="tui-modal-flex">
-					<view class="tui-modal-button confirm" @click="handleConfirm">加入购物车</view>
+					<button
+						class="tui-modal-button confirm"
+						:class="[isBtnDisabled ? 'disabled' : '']"
+						@click="handleBuyConfirm"
+					>
+						加入购物车
+					</button>
 				</view>
 			</view>
 		</view>
@@ -104,7 +117,7 @@ import { mapState, mapMutations } from 'vuex'
 export default {
 	name: 'cm-unit-popup',
 	props: {
-		product: {
+		skuProduct: {
 			type: Object
 		},
 		popupShow: {
@@ -119,109 +132,22 @@ export default {
 	data() {
 		return {
 			skuIndex: 0,
-			userIdentity:0,
-			params:{
-				serviceProviderId:0,//协销Id
-				productId:0,
-				clubId:0,
-				serviceProviderId:0,
-				productCount:1,
-				type:1
-			},
-			number: 0,
+			userIdentity: 0,
+			productCount: 0,
 			buyRetailPriceStep: 1,
-			buyRetailPrice: 0,
-			ladderPriceList: [],
+			isStock: false, //
 			isQuantity: false,
-			skuList: [
-				{
-					unit: '135ml70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					ladderPriceList:[
-						{
-							numRange:'1-10',
-							buyPrice:500
-						},
-						{
-							numRange:'10-100',
-							buyPrice:5000
-						},
-						{
-							numRange:'100-1000',
-							buyPrice:50000
-						},
-					]
-				},
-				{
-					unit: ' 精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					ladderPriceList:null
-				},
-				{
-					unit: '精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					ladderPriceList:null
-				},
-				{
-					unit: '【70ml】2瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					ladderPriceList:[
-						{
-							numRange:'1-10',
-							buyPrice:500
-						},
-						{
-							numRange:'10-100',
-							buyPrice:5000
-						},
-						{
-							numRange:'100-1000',
-							buyPrice:50000
-						},
-					]
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					ladderPriceList:null
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100 ,// 库存
-					ladderPriceList:[
-						{
-							numRange:'1-10',
-							buyPrice:500
-						},
-						{
-							numRange:'10-100',
-							buyPrice:5000
-						},
-						{
-							numRange:'100-1000',
-							buyPrice:50000
-						},
-					]
-				}
-			],
+			handleStock: 0, // 规格库存
+			handleMinNumber: 1, // 规格起订量
+			skuList: [],
+			addParams: {
+				serviceProviderId: 0, //协销Id
+				skuId: 0,
+				clubId: 0,
+				productCount: 1,
+				type: 1
+			},
+			isBtnDisabled: false
 		}
 	},
 	filters: {
@@ -229,7 +155,7 @@ export default {
 			//处理金额
 			return Number(value).toFixed(2)
 		}
-	},	
+	},
 	created() {
 		this.initData()
 	},
@@ -241,16 +167,17 @@ export default {
 			const clubInfo = await this.$api.getComStorage('orderUserInfo')
 			const userInfo = await this.$api.getStorage()
 			this.userIdentity = userInfo.userIdentity
-			this.params.clubId = clubInfo.clubId ? clubInfo.clubId : 0
-			this.params.serviceProviderId = userInfo.serviceProviderId
-			this.params.productId = this.product.productId
-			this.params.productCount = this.product.minBuyNumber
-			this.buyRetailPrice = this.product.price
-			this.buyRetailPriceStep = this.handleData.step
-			if (this.handleData.ladderPriceFlag == 1) {
-				this.params.productCount = this.handleData.maxBuyNumber ? this.handleData.maxBuyNumber : 1
+			this.skuList = this.skuProduct.skus
+			this.isBtnDisabled = this.skuList[0].stock === 0
+			this.addParams.clubId = clubInfo.clubId ? clubInfo.clubId : 0
+			this.addParams.serviceProviderId = userInfo.serviceProviderId
+			this.addParams.skuId = this.skuProduct.skuId
+			this.productCount = this.skuProduct.minBuyNumber
+			this.buyRetailPriceStep = this.skuProduct.step
+			if (this.skuProduct.ladderPriceFlag == 1) {
+				this.addParams.productCount = this.skuProduct.maxBuyNumber ? this.skuProduct.maxBuyNumber : 1
 			} else {
-				this.params.productCount = this.handleData.minBuyNumber
+				this.addParams.productCount = this.skuProduct.minBuyNumber
 			}
 		},
 		PromotionsFormat(promo) {
@@ -264,26 +191,30 @@ export default {
 			}
 			return false
 		},
+		//popup弹窗数量增加按钮
 		changeCountAdd() {
-			//popup弹窗数量增加按钮
-			if (this.buyRetailPriceStep == 2) {
-				this.params.productCount += this.product.minBuyNumber
+			if (this.productCount === this.handleStock) {
+				this.isStock = true
+				return
+			}
+			if (this.skuProduct.step == 2) {
+				this.productCount += this.handleMinNumber
 			} else {
-				this.params.productCount++
+				this.productCount++
 			}
 		},
+		//popup弹窗数量减按钮
 		changeCountSub() {
-			//popup弹窗数量减按钮
-			if (this.params.productCount <= this.product.minBuyNumber) {
-				this.params.productCount = this.product.minBuyNumber
+			if (this.productCount <= this.handleMinNumber) {
+				this.productCount = this.handleMinNumber
 				this.isQuantity = true
-				this.$util.msg(`该商品最小起订量为${this.product.minBuyNumber}`, 2000)
+				this.$util.msg(`该商品最小起订量为${this.handleMinNumber}`, 2000)
 				return
 			} else {
-				if (this.buyRetailPriceStep == 2) {
-					this.params.productCount -= this.product.minBuyNumber
+				if (this.skuProduct.step == 2) {
+					this.productCount -= this.handleMinNumber
 				} else {
-					this.params.productCount--
+					this.productCount--
 				}
 				this.isQuantity = false
 			}
@@ -291,30 +222,43 @@ export default {
 		changeNumber(e) {
 			let _value = e.detail.value
 			if (!this.$api.isNumber(_value)) {
-				this.params.productCount = this.product.minBuyNumber
-			} else if (_value < this.product.minBuyNumber) {
-				this.$util.msg(`该商品最小起订量为${this.product.minBuyNumber}`, 2000)
-				this.params.productCount = this.product.minBuyNumber
-			} else if (_value % this.product.minBuyNumber != 0) {
+				this.productCount = this.handleMinNumber
+			} else if (_value < this.handleMinNumber) {
+				this.$util.msg(`该商品最小起订量为${this.handleMinNumber}`, 2000)
+				this.productCount = this.handleMinNumber
+			} else if (_value % this.handleMinNumber != 0) {
 				this.$util.msg('购买量必须为起订量的整数倍', 2000)
-				this.params.productCount = this.product.minBuyNumber
+				this.productCount = this.handleMinNumber
+			} else if (_value > this.handleStock) {
+				this.productCount = this.handleStock
 			} else {
-				this.params.productCount = e.detail.value
+				this.productCount = e.detail.value
 			}
 		},
-		handleConfirm() {
+		handleBuyConfirm() {
+			this.addParams.productCount = this.productCount
+			this.handleAddClubCart(this.addParams)
+		},
+		handleAddClubCart(params) {
 			//增加购物车成功和toast弹窗提示成功
-			this.SellerService.ShoppingCartAddCart(this.params).then(response => {
-				this.$parent.popupShow = false
-				this.$util.msg('加入购物车成功',1500,true,'success')
-				this.$parent.getClubProductNum();
-			}).catch(error =>{
-				this.$util.msg(error.msg,2000);
-			})
+			this.SellerService.ShoppingCartAddCart(params)
+				.then(response => {
+					this.$parent.popupShow = false
+					this.$util.msg('加入购物车成功', 1500, true, 'success')
+					this.$parent.getClubProductNum()
+				})
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
+				})
 		},
 		handleChoisSku(sku, index) {
 			// 选择SKU
 			this.skuIndex = index
+			this.addParams.productCount = this.handleMinNumber = sku.minBuyNumber
+			this.addParams.skuId = sku.skuId
+			this.handleStock = sku.stock
+			this.isBtnDisabled = sku.stock === 0
+			this.$emit('skuClick', sku)
 		},
 		hidePopup() {
 			this.$parent.popupShow = false
@@ -360,7 +304,7 @@ export default {
 					line-height: 40rpx;
 					color: #f94b4b;
 					font-weight: bold;
-					.sku-price-l{
+					.sku-price-l {
 						float: left;
 						font-weight: normal;
 					}
@@ -435,7 +379,7 @@ export default {
 		width: 100%;
 		height: auto;
 		float: left;
-		margin-top: 30rpx; 
+		margin-top: 30rpx;
 		.sku-unit-nunbox-t {
 			width: 100%;
 			height: 44rpx;
@@ -452,7 +396,7 @@ export default {
 				float: left;
 				font-weight: bold;
 			}
-			.sku-unit-nunbox-num{
+			.sku-unit-nunbox-num {
 				float: right;
 				.number-box {
 					display: flex;
@@ -491,7 +435,7 @@ export default {
 		}
 	}
 }
-.tui-popup-btn{
+.tui-popup-btn {
 	width: 100%;
 	float: left;
 	.tui-modal-flex {
@@ -508,13 +452,12 @@ export default {
 			padding: 0;
 			margin: 0 15rpx;
 			box-sizing: border-box;
-			&.cancel {
-				background: #ffe6dc;
-				color: #e15616;
-			}
 			&.confirm {
 				background: $btn-confirm;
 				color: #ffffff;
+				&.disabled {
+					background: linear-gradient(135deg, rgba(242, 143, 49, 0.5) 0%, rgba(225, 86, 22, 0.5) 100%);
+				}
 			}
 		}
 	}

+ 50 - 125
pages/seller/cart/components/cm-unit-suppor-popup.vue

@@ -5,47 +5,51 @@
 			<view class="tui-popup-box clearfix">
 				<view class="tui-shopping-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 					<view class="tui-sku-title">
-						<view class="tui-sku-image"> <image :src="product.image" mode=""></image> </view>
+						<view class="tui-sku-image"> <image :src="skuProduct.image" mode=""></image> </view>
 						<view class="tui-sku-price">
 							<view class="sku-price-viw">
 								<view
 									class="sku-price-text"
 									:class="
-										PromotionsFormat(product.promotions) || product.svipProductFlag == 1 ? 'none' : ''
+										PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+											? 'none'
+											: ''
 									"
 								>
 									¥{{
-										(PromotionsFormat(product.promotions) || product.svipProductFlag == 1
-											? product.originalPrice
-											: product.price) | NumFormat
+										(PromotionsFormat(skuProduct.promotions) || skuProduct.svipProductFlag == 1
+											? skuProduct.originalPrice
+											: skuProduct.price) | NumFormat
 									}}
 								</view>
 							</view>
 							<view class="sku-price-vip">
 								<view class="floor-item-act">
-									<view class="coupon-tags" v-if="product.couponsLogo">优惠券</view>
-									<template v-if="product.actStatus == 1 && product.promotions">
-										<view v-if="PromotionsFormat(product.promotions)" class="floor-tags">
-											{{ product.promotions.name }}
-											<text v-if="product.promotions != null && product.promotions.type != 3">
+									<view class="coupon-tags" v-if="skuProduct.couponsLogo">优惠券</view>
+									<template v-if="skuProduct.actStatus == 1 && skuProduct.promotions">
+										<view v-if="PromotionsFormat(skuProduct.promotions)" class="floor-tags">
+											{{ skuProduct.promotions.name }}
+											<text
+												v-if="skuProduct.promotions != null && skuProduct.promotions.type != 3"
+											>
 												:¥{{
-													product.promotions == null
+													skuProduct.promotions == null
 														? '0.00'
-														: product.promotions.touchPrice | NumFormat
+														: skuProduct.promotions.touchPrice | NumFormat
 												}}
 											</text>
 										</view>
-										<view v-else-if="product.promotions.type != 3" class="floor-tags">
-											{{ product.promotions.name }}
+										<view v-else-if="skuProduct.promotions.type != 3" class="floor-tags">
+											{{ skuProduct.promotions.name }}
 										</view>
 									</template>
-									<template v-if="product.actStatus == null && product.ladderFlag == 1">
+									<template v-if="skuProduct.actStatus == null && skuProduct.ladderFlag == 1">
 										<view class="floor-tags">阶梯价格</view>
 									</template>
-									<template v-if="product.svipProductFlag == 1">
+									<template v-if="skuProduct.svipProductFlag == 1">
 										<view class="svip-tags">
 											<view class="tags">SVIP</view>
-											<view class="price">{{ product.svipPriceTag }}</view>
+											<view class="price">{{ skuProduct.svipPriceTag }}</view>
 										</view>
 									</template>
 								</view>
@@ -62,7 +66,7 @@
 								:key="index"
 								:class="skuIndex === index ? 'active' : ''"
 							>
-								{{ sku.unit }} <text class="tips">缺货</text>
+								{{ sku.unit }} <text class="tips" v-if="sku.stock === 0">缺货</text>
 							</view>
 						</view>
 					</view>
@@ -72,7 +76,13 @@
 				</view>
 				<view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
 					<view class="tui-modal-flex">
-						<button class="tui-modal-button confirm" @click="handleConfirm">确定</button>
+						<button
+							class="tui-modal-button confirm"
+							:class="[isBtnDisabled ? 'disabled' : '']"
+							@click="handleConfirm"
+						>
+							确定
+						</button>
 					</view>
 				</view>
 			</view>
@@ -91,7 +101,7 @@ export default {
 		cmLadderPopup
 	},
 	props: {
-		product: {
+		skuProduct: {
 			type: Object
 		},
 		popupShow: {
@@ -105,103 +115,15 @@ export default {
 	},
 	data() {
 		return {
-			laddePopupShow:false,
+			laddePopupShow: false,
 			isShowLadder: false,
 			skuIndex: 0,
-			userIdentity: 0,
-			number: 0,
-			buyRetailPrice: 0,
 			ladderPriceList: [],
-			isQuantity: false,
-			skuList: [
-				{
-					unit: '135ml70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100, // 库存
-					ladderPriceList: [
-						{
-							numRange: '1-10',
-							buyPrice: 500
-						},
-						{
-							numRange: '10-100',
-							buyPrice: 5000
-						},
-						{
-							numRange: '100-1000',
-							buyPrice: 50000
-						}
-					]
-				},
-				{
-					unit: ' 精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100, // 库存
-					ladderPriceList: null
-				},
-				{
-					unit: '精华70ml', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100, // 库存
-					ladderPriceList: null
-				},
-				{
-					unit: '【70ml】2瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100, // 库存
-					ladderPriceList: [
-						{
-							numRange: '1-10',
-							buyPrice: 500
-						},
-						{
-							numRange: '10-100',
-							buyPrice: 5000
-						},
-						{
-							numRange: '100-1000',
-							buyPrice: 50000
-						}
-					]
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100, // 库存
-					ladderPriceList: null
-				},
-				{
-					unit: '【50ml】3瓶', // 规格
-					normalPrice: 1000, // 市场价
-					price: 500, // 售价
-					costPrice: 500, // 结算价
-					stock: 100, // 库存
-					ladderPriceList: [
-						{
-							numRange: '1-10',
-							buyPrice: 500
-						},
-						{
-							numRange: '10-100',
-							buyPrice: 5000
-						},
-						{
-							numRange: '100-1000',
-							buyPrice: 50000
-						}
-					]
-				}
-			]
+			skuList: [],
+			isBtnDisabled:false,
+			handleUnit:'',
+			handleSkuId:0,
+			handleMinNumber:1
 		}
 	},
 	filters: {
@@ -211,21 +133,22 @@ export default {
 		}
 	},
 	created() {
-		this.number = this.product.minBuyNumber
-		this.buyRetailPrice = this.product.price
 		this.initData()
 	},
 	computed: {
 		...mapState(['hasLogin'])
 	},
 	methods: {
-		async initData(data) {
-			const userInfo = await this.$api.getStorage()
-			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
-			//处理禁用按钮商品
-			// if (this.product.skuList[0].ladderPriceList) {
-			// 	this.isShowLadder = true
-			// }
+		initData() {
+			console.log('skuProduct',this.skuProduct)
+			this.skuList = this.skuProduct.skus
+			this.handleUnit = this.skuList[0].unit
+			this.handleSkuId = this.skuList[0].skuId
+			this.handleMinNumber = this.skuList[0].minBuyNumber
+			this.isBtnDisabled = this.skuList[0].stock === 0
+			if (this.skuList[0].ladderPriceList) {
+				this.isShowLadder = true
+			}
 		},
 		PromotionsFormat(promo) {
 			//促销活动类型数据处理
@@ -239,7 +162,7 @@ export default {
 			return false
 		},
 		handleConfirm() {
-			const data = { unit : this.handleUnit} 
+			const data = { unit: this.handleUnit,skuId : this.handleSkuId,minBuyNumber:this.handleMinNumber}
 			this.$emit('handleUnitConfirm', data)
 			this.$parent.popupShow = false
 		},
@@ -247,9 +170,11 @@ export default {
 			// 选择SKU
 			this.skuIndex = index
 			this.handleUnit = sku.unit
+			this.handleSkuId = sku.skuId
 			this.ladderPriceList = sku.ladderPriceList
 			this.isShowLadder = sku.ladderPriceList ? true : false
-			
+			this.isBtnDisabled = sku.stock === 0
+			this.$emit('skuClick', sku)
 		},
 		showLaddePopup() {
 			// 点击显示阶梯价

+ 23 - 9
pages/seller/cart/components/immediatelyList.vue

@@ -246,7 +246,13 @@
 			</view>
 		</view>
 		<!-- 组合商品规格弹窗 -->
-		<cmUnitSupporPopup v-if="popupShow" :popupShow="popupShow" :product="handleProsData" @handleUnitConfirm="hanldeSupporUnitConfirm"></cmUnitSupporPopup>
+		<cmUnitSupporPopup
+			v-if="popupShow"
+			:popupShow="popupShow"
+			:skuProduct="handleProsData"
+			@handleUnitConfirm="hanldeSupporUnitConfirm"
+			@skuClick="handleSkuClick"
+		></cmUnitSupporPopup>
 		<!-- 可拖动悬浮按钮 -->
 		<cm-drag
 			:cartNum="cartQuantity"
@@ -527,15 +533,15 @@ export default {
 			//商品数量加加
 			if (pros.initProductNum == 0) {
 				pros.initProductNum = pros.minBuyNumber
-				this.processActivityPrice(pros)
+				// this.processActivityPrice(pros)
 			} else if (pros.initProductNum >= pros.minBuyNumber) {
 				pros.initProductNum++
-				this.processActivityPrice(pros)
+				// this.processActivityPrice(pros)
 			}
 			this.totalPeice(item)
 			this.totalCount(item)
 			this.totalKind(item)
-		},
+		}, 
 		changeCountSub(item, pros) {
 			//商品数量减减
 			if (pros.initProductNum == 0) {
@@ -543,10 +549,10 @@ export default {
 				return
 			} else if (pros.initProductNum == pros.minBuyNumber) {
 				pros.initProductNum = 0
-				this.processActivityPrice(pros)
+				// this.processActivityPrice(pros)
 			} else {
 				pros.initProductNum--
-				this.processActivityPrice(pros)
+				// this.processActivityPrice(pros)
 			}
 			this.totalPeice(item)
 			this.totalCount(item)
@@ -562,7 +568,7 @@ export default {
 				pros.initProductNum = pros.minBuyNumber
 			} else {
 				pros.initProductNum = parseInt(e.detail.value)
-				this.processActivityPrice(pros)
+				// this.processActivityPrice(pros)
 			}
 			this.totalPeice(item)
 			this.totalCount(item)
@@ -687,9 +693,17 @@ export default {
 			this.handleProsData = pros
 			this.popupShow = true
 		},
-		hanldeSupporUnitConfirm(data){
-			console.log('data',data)
+		hanldeSupporUnitConfirm(data) {
+			console.log('data', data)
+			this.handleProsData.skuId = data.skuId
 			this.handleProsData.unit = data.unit
+			this.handleProsData.initProductNum = data.minBuyNumber
+		},
+		handleSkuClick(sku){//选择Sku
+			this.handleProsData.unit = sku.unit
+			this.handleProsData.price = sku.price
+			this.handleProsData.originalPrice = sku.originalPrice
+			this.handleProsData.initProductNum = sku.minBuyNumber
 		},
 		btnClick() {
 			this.$emit('goCartPage')

+ 445 - 428
pages/seller/cart/immediately.vue

@@ -1,26 +1,35 @@
 <template>
 	<view class="container all-type-list-wrapper">
-		<immediately-list ref="productList"
-						  :search-status="true"
-						  @operationConfim="hanldOperationConfim"
-						  @alertjietiConfim ="hanldalertjietiConfim"
-						  @goCartPage="hanldToCartPage"
-						  :tabBars="tabBars"
-						  :tabIndex="tabIndex"
-						  @changetab="hanldChangeTab"
-						  >
+		<immediately-list
+			ref="productList"
+			:search-status="true"
+			@operationConfim="hanldOperationConfim"
+			@alertjietiConfim="hanldalertjietiConfim"
+			@goCartPage="hanldToCartPage"
+			:tabBars="tabBars"
+			:tabIndex="tabIndex"
+			@changetab="hanldChangeTab"
+		>
 		</immediately-list>
 		<!-- 单品规格弹窗 -->
-		<cm-unit-popup v-if="popupShow" :popupShow="popupShow" :product="handleData"></cm-unit-popup>
+		<cm-unit-popup
+			v-if="popupShow"
+			:popupShow="popupShow"
+			:skuProduct="handleData"
+			@skuClick="handleSkuClick"
+		></cm-unit-popup>
 		<!-- 组合加入购物车 -->
-		<view class="popup spec zuhe" :class="specClasszuhe"  @touchmove.stop.prevent="discard" @tap="hideSpecs">
+		<view class="popup spec zuhe" :class="specClasszuhe" @touchmove.stop.prevent="discard" @tap="hideSpecs">
 			<!-- 遮罩层 -->
 			<view class="mask"></view>
-			<view class="layer" @tap.stop="discard" :style="{paddingBottom :isIphoneX ? '68rpx' : '36rpx',bottom:isIphoneX ?'-290rpx' : '-270rpx'}">
+			<view
+				class="layer"
+				@tap.stop="discard"
+				:style="{ paddingBottom: isIphoneX ? '68rpx' : '36rpx', bottom: isIphoneX ? '-290rpx' : '-270rpx' }"
+			>
 				<view class="content zuhe-content">
 					<view class="number-left">
-						<text>种类:{{productKind}}</text>
-						<text>数量:{{productTotalNum}}</text>
+						<text>种类:{{ productKind }}</text> <text>数量:{{ productTotalNum }}</text>
 					</view>
 					<view class="number-right">
 						<view class="text">
@@ -28,25 +37,25 @@
 						</view>
 					</view>
 				</view>
-				<view class="btn">
-					<view class="button add" @click="getzuheCart">确定</view>
-				</view>
+				<view class="btn"> <view class="button add" @click="handlSupporAddCart">确定</view> </view>
 			</view>
 		</view>
 		<!--  -->
-		<view class="popup spec zuhe" :class="specClassjieti"  @touchmove.stop.prevent="discard" >
+		<view class="popup spec zuhe" :class="specClassjieti" @touchmove.stop.prevent="discard">
 			<view class="mask"></view>
 			<view class="jieti_box " @tap.stop="discard">
 				<view class="jieti_box_one">
-					<view class="jieti_left" >
+					<view class="jieti_left">
 						<view>起订量</view>
-						<view class="ladder-a"  v-for="(item,index) in ladderPriceList" :key="index">
-							{{item.buyNumRangeShow}}
+						<view class="ladder-a" v-for="(item, index) in ladderPriceList" :key="index">
+							{{ item.buyNumRangeShow }}
 						</view>
 					</view>
-					<view class="jieti_right" >
+					<view class="jieti_right">
 						<view>价格</view>
-						<view class="" v-for="(item,index) in ladderPriceList" :key="index">¥ {{item.buyPrice | NumFormat}}</view>
+						<view class="" v-for="(item, index) in ladderPriceList" :key="index"
+							>¥ {{ item.buyPrice | NumFormat }}</view
+						>
 					</view>
 				</view>
 				<view class="addbtn" @tap="hideSpecjieti">知道了</view>
@@ -56,469 +65,477 @@
 </template>
 
 <script>
-	import immediatelyList from './components/immediatelyList'
-	import cmUnitPopup from './components/cm-unit-popup'
-	export default{
-		components:{
-			immediatelyList,
-			cmUnitPopup
+import immediatelyList from './components/immediatelyList'
+import cmUnitPopup from './components/cm-unit-popup'
+export default {
+	components: {
+		immediatelyList,
+		cmUnitPopup
+	},
+	data() {
+		return {
+			popupShow: false,
+			clubId: '', //机构ID
+			serviceProviderId: '', //协销ID
+			serverUrl: '',
+			emptyText: '',
+			lastPageType: '',
+			lastPageVal: '',
+			isIphoneX: this.$store.state.isIphoneX,
+			specClass: '', //规格弹窗css类,控制开关动画
+			specClasszuhe: '', //组合加购物车弹窗
+			specClassjieti: '', //阶梯展示弹窗
+			ladderPriceList: {},
+			handleData: {},
+			isQuantity: false,
+			isStock: false,
+			minBuyNumber: 0,
+			number: 0,
+			buyRetailPrice: 0,
+			hanldChangeTabIndex: 0,
+			handleDataLadderPriceList: [],
+			productKind: 0,
+			productTotalNum: 0,
+			productTotalAmount: 0,
+			buyNumRangeShow: '', //起订量范围
+			buyPrice: '', //起订量范围价格
+			buyRetailPriceStep: 1,
+			supporAddParams:{
+				clubId: 0,
+				serviceProviderId: 0,
+				productInfo: '',
+				type: 2
+			}
+		}
+	},
+	onLoad() {},
+	filters: {
+		NumFormat(value) {
+			//处理金额
+			return Number(value).toFixed(2)
+		}
+	},
+	methods: {
+		async initData(data) {
+			const clubInfo = await this.$api.getComStorage('orderUserInfo')
+			const userInfo = await this.$api.getStorage()
+			this.clubId = this.supporAddParams.clubId = clubInfo.clubId ? clubInfo.clubId : 0
+			this.serviceProviderId =  this.supporAddParams.serviceProviderId = userInfo.serviceProviderId
+			this.getClubProductNum()
+		},
+		handleSkuClick(sku) {
+			this.handleData.price = sku.price
+		},
+		getClubProductNum() {
+			// 获取协销下机构购物车数量
+			this.SellerService.GetSellerProductNum({
+				clubId: this.clubId,
+				serviceProviderId: this.serviceProviderId
+			}).then(response => {
+				this.$refs.productList.cartQuantity = response.data
+			})
 		},
-		data(){
-			return{
-				popupShow:false,
-				clubId:'',	//机构ID
-				serviceProviderId:'',//协销ID
-				serverUrl: '',
-				emptyText: '',
-				lastPageType: '',
-				lastPageVal: '',
-				isIphoneX:this.$store.state.isIphoneX,
-				specClass: '',//规格弹窗css类,控制开关动画
-				specClasszuhe:'',//组合加购物车弹窗
-				specClassjieti:'',//阶梯展示弹窗
-				ladderPriceList:{},
-				handleData:{},
-				isQuantity:false,
-				isStock:false,
-				minBuyNumber:0,
-				number:0,
-				buyRetailPrice:0,
-				hanldChangeTabIndex:0,
-				handleDataLadderPriceList:[],
-				productKind:0,
-				productTotalNum:0,
-				productTotalAmount:0,
-				buyNumRangeShow:'',//起订量范围
-				buyPrice:'',//起订量范围价格
-				buyRetailPriceStep:1,
+		hanldChangeTab(index) {
+			if (index == 1) {
+				this.$refs.productList.getcombinationProduct()
 			}
 		},
-		onLoad() {
-
+		hanldalertjietiConfim(data) {
+			this.ladderPriceList = data.ladderPriceList
+			this.specClassjieti = 'show'
 		},
-		filters:{
-			NumFormat(value) {//处理金额
-				return Number(value).toFixed(2);
-			},
-		},	
-		methods:{
-			getClubProductNum(){// 获取协销下机构购物车数量
-				this.SellerService.GetSellerProductNum(
-					{
-						clubId:this.clubId,
-						serviceProviderId:this.serviceProviderId,
-					}
-				).then(response =>{
-					this.$refs.productList.cartQuantity = response.data
-				})
-			},
-			hanldChangeTab(index){
-				if(index == 1){
-					this.$refs.productList.getcombinationProduct()
+		hanldOperationConfim(data) {
+			//显示选择数量确认弹窗
+			this.handleData = data
+			console.log(this.handleData)
+			if (this.$refs.productList.tabIndex == 1) {
+				if (data.productKind == 0) {
+					this.$util.msg(`请至少选购一种商品`, 2000)
+				} else {
+					this.specClasszuhe = 'show'
+					this.productKind = data.productKind
+					this.productTotalNum = data.productTotalNum
+					this.productTotalAmount = data.productTotalAmount
 				}
-			},
-			hanldalertjietiConfim(data){
-				this.ladderPriceList = data.ladderPriceList
-				this.specClassjieti='show';
-			},
-			hanldOperationConfim(data){//显示选择数量确认弹窗
-				this.handleData = data
-				console.log(this.handleData)
-				if(this.$refs.productList.tabIndex == 1){
-					if(data.productKind ==0){
-						this.$util.msg(`请至少选购一种商品`,2000);
-					}else{
-						this.specClasszuhe = 'show';
-						this.productKind= data.productKind;
-						this.productTotalNum = data.productTotalNum;
-						this.productTotalAmount = data.productTotalAmount;
-					}
-				}else{
-					this.popupShow = true
+			} else {
+				this.popupShow = true
+			}
+		},
+		hideSpecs() {
+			this.specClasszuhe = 'hide'
+			setTimeout(() => {
+				this.specClasszuhe = 'none'
+			}, 200)
+		},
+		hideSpecjieti() {
+			this.specClassjieti = 'hide'
+			setTimeout(() => {
+				this.specClassjieti = 'none'
+			}, 200)
+		},
+		handlSupporAddCart() {
+			//组合商品加入购物车
+			let productInfo = []
+			this.handleData.combinationProductList.forEach(pros => {
+				if (pros.initProductNum > 0) {
+					productInfo.push( { skuId: pros.skuId,count: pros.initProductNum } )
 				}
-			},
-			hideSpecs(){
-				this.specClasszuhe='hide';
-				setTimeout(() => {
-					this.specClasszuhe='none';
-				}, 200);
-			},
-			hideSpecjieti(){
-				this.specClassjieti='hide';
-				setTimeout(() => {
-					this.specClassjieti='none';
-				}, 200);
-			},
-			getzuheCart(){//组合商品加入购物车
-				let productInfo=[];
-				this.handleData.combinationProductList.forEach(item =>{
-					if(item.initProductNum >0){
-						let handObj = {
-								id : item.productId,
-								count : item.initProductNum
-							}
-						productInfo.push(handObj)
-					}
-				})
-				this.SellerService.ShoppingCartBatchAddCart(
-					{
-						clubId:this.clubId,
-						serviceProviderId:this.serviceProviderId,
-						productInfo:JSON.stringify(productInfo),
-						type:2
-					}
-				).then(response => {
-					this.specClasszuhe = 'hide';
-					this.$util.msg('加入购物车成功',1500,true,'success');
-					this.getClubProductNum();
-					this.clearProduct();//清空
-					setTimeout(() => {this.specClasszuhe = 'none'}, 200)
-				}).catch(error =>{
-					this.$util.msg(error.msg,2000);
+			})
+			this.supporAddParams.productInfo = JSON.stringify(productInfo)
+			this.handleCartBatchAddCart(this.supporAddParams)
+		},
+		handleCartBatchAddCart(params){
+			this.SellerService.ShoppingCartBatchAddCart(params)
+				.then(response => {
+					this.specClasszuhe = 'hide'
+					this.$util.msg('加入购物车成功', 1500, true, 'success')
+					this.getClubProductNum()
+					this.clearProduct() //清空
+					setTimeout(() => {
+						this.specClasszuhe = 'none'
+					}, 200)
 				})
-			},
-			clearProduct(){//成功加入购物车后清空所选值
-				this.handleData.productKind= 0;
-				this.handleData.productTotalNum = 0;
-				this.handleData.productTotalAmount = 0;
-				this.handleData.combinationProductList.forEach(item =>{
-					item.initProductNum = 0;
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
 				})
-			},
-			hanldToCartPage(){
-				this.$api.navigateTo('/pages/seller/cart/cart')
-			},
-			discard(){
-				//丢弃
-			}
 		},
-		onShow() {
-			this.$api.getComStorage('orderUserInfo').then((resolve) =>{
-				this.clubId = resolve.clubId ? resolve.clubId : 0
-			})
-			this.$api.getStorage().then((resolve) =>{
-				this.serviceProviderId = resolve.serviceProviderId
-				this.getClubProductNum()
+		clearProduct() {
+			//成功加入购物车后清空所选值
+			this.handleData.productKind = 0
+			this.handleData.productTotalNum = 0
+			this.handleData.productTotalAmount = 0
+			this.handleData.combinationProductList.forEach(pros => {
+				pros.initProductNum = 0
 			})
 		},
+		hanldToCartPage() {
+			this.$api.navigateTo('/pages/seller/cart/cart')
+		},
+		discard() {
+			//丢弃
+		}
+	},
+	onShow() {
+		this.initData()
 	}
+}
 </script>
 
 <style lang="scss">
-	// 阶梯价格弹窗
-	.jieti_box{
-		width: 596rpx;
-		// height: 496rpx;
-		top: 10%;
-		right: 50%;
-		transform: translate(50%,50%);
-		position: absolute;
-		background:#FFFFFF;
-		color: #000;
-		font-size: 28rpx;
-		border-radius: 10rpx;
-		text-align: center;
-		line-height: 84rpx;
-		padding: 20rpx;
-		z-index: 99999;
-	}
-	.jieti_box_one{
-		// width: 548rpx;
-		overflow: hidden;
-		border: 2rpx solid #F5F5F5;
-		border-bottom: 0;
-		margin: auto;
+// 阶梯价格弹窗
+.jieti_box {
+	width: 596rpx;
+	// height: 496rpx;
+	top: 10%;
+	right: 50%;
+	transform: translate(50%, 50%);
+	position: absolute;
+	background: #ffffff;
+	color: #000;
+	font-size: 28rpx;
+	border-radius: 10rpx;
+	text-align: center;
+	line-height: 84rpx;
+	padding: 20rpx;
+	z-index: 99999;
+}
+.jieti_box_one {
+	// width: 548rpx;
+	overflow: hidden;
+	border: 2rpx solid #f5f5f5;
+	border-bottom: 0;
+	margin: auto;
+}
+.jieti_left {
+	width: 298rpx;
+	float: left;
+}
+.jieti_left view {
+	height: 84rpx;
+	border-bottom: 2rpx solid #f5f5f5;
+	border-right: 2rpx solid #f5f5f5;
+}
+.ladder-a {
+	letter-spacing: 4rpx;
+}
+.jieti_right {
+	width: 294rpx;
+	float: right;
+}
+.jieti_right view {
+	height: 84rpx;
+	border-bottom: 2rpx solid #f5f5f5;
+}
+.addbtn {
+	height: 84rpx;
+	background: linear-gradient(135deg, rgba(242, 143, 49, 1) 0%, rgba(225, 86, 22, 1) 100%);
+	text-align: center;
+	font-size: 28rpx;
+	color: #fff;
+	line-height: 84rpx;
+	border-radius: 42rpx;
+	margin: 20rpx auto;
+}
+.zuhe-content {
+	display: inline-block;
+}
+.number-left {
+	float: left;
+}
+.number-right {
+	margin-left: 30rpx;
+	float: left;
+}
+.number-left text {
+	margin-left: 30rpx;
+}
+.number-right-text {
+	color: #ff2a2a;
+}
+page {
+	background: $sub-bg-color;
+	.all-type-list-wrapper {
+		display: flex;
+		flex-direction: column;
 	}
-	.jieti_left{
-		width: 298rpx;
-		float: left;
-		}
-	.jieti_left view{
-		height: 84rpx;
-		border-bottom:2rpx solid #F5F5F5 ;
-		border-right:2rpx solid #F5F5F5  ;
+}
+/* 加入购物模态层*/
+@keyframes showPopup {
+	0% {
+		opacity: 0;
 	}
-	.ladder-a{
-		letter-spacing: 4rpx;
+	100% {
+		opacity: 1;
 	}
-	.jieti_right{
-			width: 294rpx;
-			float: right;
-		}
-	.jieti_right view{
-			height: 84rpx;
-			border-bottom:2rpx solid #F5F5F5;
-		}
-	.addbtn{
-			height: 84rpx;
-			background: linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
-			text-align: center;
-			font-size: 28rpx;
-			color: #fff;
-			line-height: 84rpx;
-			border-radius: 42rpx;
-			margin: 20rpx auto
-		}
-	.zuhe-content{
-		display: inline-block;
+}
+@keyframes hidePopup {
+	0% {
+		opacity: 1;
 	}
-	.number-left{
-		float: left;
+	100% {
+		opacity: 0;
 	}
-	.number-right{
-		margin-left: 30rpx;
-		float: left;
+}
+@keyframes showLayer {
+	0% {
+		transform: translateY(0);
 	}
-	.number-left text{
-		margin-left: 30rpx;
+	100% {
+		transform: translateY(-100%);
 	}
-	.number-right-text{
-		color: #FF2A2A;
+}
+@keyframes hideLayer {
+	0% {
+		transform: translateY(-100%);
 	}
-	page {
-		background: $sub-bg-color;
-		.all-type-list-wrapper {
-			display: flex;
-			flex-direction: column;
-		}
+	100% {
+		transform: translateY(0);
 	}
-	/* 加入购物模态层*/
-	@keyframes showPopup {
-		0% {
-			opacity: 0;
-		}
-		100% {
-			opacity: 1;
-		}
+}
+@keyframes showAmnation {
+	0% {
+		top: -12rpx;
+		opacity: 0;
 	}
-	@keyframes hidePopup {
-		0% {
-			opacity: 1;
-		}
-		100% {
-			opacity: 0;
-		}
+	50% {
+		top: -60rpx;
+		opacity: 1;
 	}
-	@keyframes showLayer {
-		0% {
-			transform: translateY(0);
-		}
-		100% {
-			transform: translateY(-100%);
-		}
+	100% {
+		top: -100rpx;
+		opacity: 0;
 	}
-	@keyframes hideLayer {
-		0% {
-			transform: translateY(-100%);
-		}
-		100% {
-			transform: translateY(0);
-		}
+}
+@keyframes hideAmnation {
+	0% {
+		top: -100rpx;
+		opacity: 0;
 	}
-	@keyframes showAmnation {
-		0% {
-			top: -12rpx;
-			opacity: 0;
-		}
-		50% {
-			top: -60rpx;
-			opacity: 1;
-		}
-		100% {
-			top: -100rpx;
-			opacity: 0;
-		}
+	100% {
+		top: -12rpx;
+		opacity: 0;
 	}
-	@keyframes hideAmnation {
-		0% {
-			top: -100rpx;
-			opacity: 0;
-		}
-		100% {
-			top: -12rpx;
-			opacity: 0;
-		}
-	}
-	.popup {
+}
+.popup {
+	position: fixed;
+	top: 0;
+	width: 100%;
+	height: 100%;
+	z-index: 999;
+	display: none;
+	.mask {
 		position: fixed;
 		top: 0;
 		width: 100%;
 		height: 100%;
-		z-index: 999;
-		display: none;
-		.mask{
-			position: fixed;
-			top: 0;
+		z-index: 21;
+		background-color: rgba(0, 0, 0, 0.6);
+	}
+	.layer {
+		position: fixed;
+		z-index: 22;
+		bottom: -360rpx;
+		width: 702rpx;
+		padding: 24rpx 24rpx 36rpx 24rpx;
+		// height: 236rpx;
+		border-radius: 20rpx 20rpx 0 0;
+		background-color: #fff;
+		display: flex;
+		flex-wrap: wrap;
+		align-content: space-between;
+		.content {
 			width: 100%;
-			height: 100%;
-			z-index: 21;
-			background-color: rgba(0, 0, 0, 0.6);
+			margin-top: 20rpx;
 		}
-		.layer {
-			position: fixed;
-			z-index: 22;
-			bottom: -360rpx;
-			width: 702rpx;
-			padding: 24rpx 24rpx 36rpx 24rpx;
-			// height: 236rpx;
-			border-radius: 20rpx 20rpx 0 0;
-			background-color: #fff;
+		.btn {
+			width: 100%;
+			// height: 88rpx;
 			display: flex;
-			flex-wrap: wrap;
-			align-content: space-between;
-			.content {
-				width: 100%;
-				margin-top: 20rpx;
-			}
-			.btn {
-				width: 100%;
-				// height: 88rpx;
+			.button {
+				width: 702rpx;
+				height: 88rpx;
+				color: #fff;
 				display: flex;
-				.button {
-					width: 702rpx;
-					height: 88rpx;
-					color: #fff;
-					display: flex;
-					align-items: center;
-					justify-content: center;
-					font-size: $font-size-28;
-					border-radius: 44rpx;
-					background: $btn-confirm;
-					margin-top: 20rpx;
-				}
+				align-items: center;
+				justify-content: center;
+				font-size: $font-size-28;
+				border-radius: 44rpx;
+				background: $btn-confirm;
+				margin-top: 20rpx;
 			}
 		}
-		.layer-nunbox-m{
-			font-size: 28rpx;
+	}
+	.layer-nunbox-m {
+		font-size: 28rpx;
+	}
+	&.show {
+		display: block;
+		.mask {
+			animation: showPopup 0.2s linear both;
 		}
-		&.show {
-			display: block;
-			.mask{
-				animation: showPopup 0.2s linear both;
-			}
-			.layer {
-				animation: showLayer 0.2s linear both;
-			}
+		.layer {
+			animation: showLayer 0.2s linear both;
 		}
-		&.hide {
-			display: block;
-			.mask{
-				animation: hidePopup 0.2s linear both;
-			}
-
-			.layer {
-				animation: hideLayer 0.2s linear both;
-			}
+	}
+	&.hide {
+		display: block;
+		.mask {
+			animation: hidePopup 0.2s linear both;
 		}
-		&.none {
-			display: none;
+
+		.layer {
+			animation: hideLayer 0.2s linear both;
 		}
-		&.service {
-			.row {
-				margin: 30upx 0;
-				.title {
-					font-size: 30upx;
-					margin: 10upx 0;
-				}
-				.description {
-					font-size: 28upx;
-					color: #999;
-				}
+	}
+	&.none {
+		display: none;
+	}
+	&.service {
+		.row {
+			margin: 30upx 0;
+			.title {
+				font-size: 30upx;
+				margin: 10upx 0;
+			}
+			.description {
+				font-size: 28upx;
+				color: #999;
 			}
 		}
-		.layer-smimg{
+	}
+	.layer-smimg {
+		width: 158rpx;
+		height: 158rpx;
+		float: left;
+		border-radius: 10rpx;
+		margin-right: 24rpx;
+		image {
 			width: 158rpx;
 			height: 158rpx;
-			float: left;
 			border-radius: 10rpx;
-			margin-right: 24rpx;
-			image{
-				width: 158rpx;
-				height: 158rpx;
-				border-radius: 10rpx;
-			}
 		}
-		.layer-nunbox{
-			justify-content: space-between;
-			align-items: center;
-			width: 510rpx;
-			height: 88rpx;
-			padding: 10rpx 0 0 0;
-			float: left;
-			.layer-nunbox-t{
-				width: 100%;
-				height:44rpx;
-				position:relative;
+	}
+	.layer-nunbox {
+		justify-content: space-between;
+		align-items: center;
+		width: 510rpx;
+		height: 88rpx;
+		padding: 10rpx 0 0 0;
+		float: left;
+		.layer-nunbox-t {
+			width: 100%;
+			height: 44rpx;
+			position: relative;
+			display: flex;
+			margin-top: 10rpx;
+			.layer-nunbox-text {
+				line-height: 44rpx;
+				font-size: $font-size-28;
+			}
+			.number-box {
 				display: flex;
-				margin-top: 10rpx;
-				.layer-nunbox-text{
-					line-height: 44rpx;
-					font-size: $font-size-28;
-				}
-				.number-box{
-					display: flex;
-					justify-content: center;
-					align-items: center;
-					border: 2rpx solid #ffe6dc;
-					border-radius: 30rpx;
-					height: 48rpx;
-					margin-left: 20rpx;
-					.iconfont{
-						font-size: $font-size-24;
-						padding:0 18rpx;
-						color: #999999;
-						text-align: center;
-						line-height: 48rpx;
-						font-weight: bold;
-						background: #fef6f3;
-						&.icon-jianhao{
-							border-radius: 30rpx 0 0 30rpx;
-						}
-						&.icon-jiahao{
-							border-radius: 0 30rpx 30rpx 0;
-						}
+				justify-content: center;
+				align-items: center;
+				border: 2rpx solid #ffe6dc;
+				border-radius: 30rpx;
+				height: 48rpx;
+				margin-left: 20rpx;
+				.iconfont {
+					font-size: $font-size-24;
+					padding: 0 18rpx;
+					color: #999999;
+					text-align: center;
+					line-height: 48rpx;
+					font-weight: bold;
+					background: #fef6f3;
+					&.icon-jianhao {
+						border-radius: 30rpx 0 0 30rpx;
 					}
-					.btn-input{
-						width: 80rpx;
-						height: 48rpx;
-						line-height: 48rpx;
-						background: #FFFFFF;
-						border-radius: 4rpx;
-						text-align: center;
-						font-size: $font-size-28;
+					&.icon-jiahao {
+						border-radius: 0 30rpx 30rpx 0;
 					}
 				}
-				.product-step{
-					position: absolute;
-					left: 45rpx;
-					bottom: 0;
-					height: 44rpx;
-					background: #FFFFFF;
+				.btn-input {
+					width: 80rpx;
+					height: 48rpx;
+					line-height: 48rpx;
+					background: #ffffff;
+					border-radius: 4rpx;
+					text-align: center;
+					font-size: $font-size-28;
 				}
 			}
-			.layer-nunbox-b{
-				width: 100%;
-				height:44rpx;
-				margin-top: 13rpx;
+			.product-step {
+				position: absolute;
+				left: 45rpx;
+				bottom: 0;
+				height: 44rpx;
+				background: #ffffff;
 			}
-			.text{
-				line-height: 44rpx;
-				font-size: $font-size-28;
-				.p{
-					color: #FF2A2A;
-				}
-				.p:first-child{
-					margin-left: 30rpx;
-				}
-				.p.sm{
-					font-size: $font-size-24;
-				}
+		}
+		.layer-nunbox-b {
+			width: 100%;
+			height: 44rpx;
+			margin-top: 13rpx;
+		}
+		.text {
+			line-height: 44rpx;
+			font-size: $font-size-28;
+			.p {
+				color: #ff2a2a;
+			}
+			.p:first-child {
+				margin-left: 30rpx;
+			}
+			.p.sm {
+				font-size: $font-size-24;
 			}
 		}
 	}
+}
 
-	.zuhe .layer{
-		bottom: -270rpx;
-		height: 200rpx;
-	}
+.zuhe .layer {
+	bottom: -270rpx;
+	height: 200rpx;
+}
 </style>

+ 42 - 0
pages/seller/cart/mixins/apisMixins.js

@@ -0,0 +1,42 @@
+import Vue from 'vue'
+const apisMixins = {
+    methods: {
+        apiUserClubCheckSku(params){
+            this.ProductService.ShoppingCheckSku(params)
+			    .then(response => {
+			        setTimeout(() => {
+			           this.initGetCartGoodsList()
+			        }, 1500)
+			    })
+			    .catch(error => {
+			        this.$util.msg(error.msg, 2000)
+			    })
+        },
+        apiSellerAddProductNum(params) {
+            //更新购物车商品
+            this.SellerService.SellerAddProductNum(params)
+                .then(response => {
+                    this.isshowDelbtn = false
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        },
+        apiSellerDeleteCart(params) { 
+            // 清除失效商品
+            this.SellerService.sellerDeleteCart(params)
+                .then(response => {
+                    this.$util.msg('删除成功', 2000)
+                    setTimeout(() => {
+                        this.isshowDelbtn = false
+                        this.initGetCartGoodsList()
+                    }, 2000)
+                })
+                .catch(error => {
+                    this.$util.msg(error.msg, 2000)
+                })
+        }
+    }
+}
+
+export default apisMixins

+ 103 - 0
pages/seller/cart/mixins/cartMixins.js

@@ -0,0 +1,103 @@
+// 统计数据
+// 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
+import Vue from 'vue'
+const cartMixins = {
+    data() {
+        return {
+			
+        }
+    },
+    methods: {
+        hanldlerToConfirm() {
+            //跳转确认订单页面
+            let productIdList = [],
+                skuIds = ''
+            this.goodsList.forEach(supper => {
+                supper.cartList.forEach(pros => {
+                    if (pros.isChecked) {
+                        productIdList.push(pros.skuId)
+                    }
+                })
+            })
+            if (productIdList == '') {
+                this.$util.msg('请先选择结算商品~', 2000)
+                return
+            } else {
+                //判断勾选的商品是否为充值商品或者为定金商品的一些处理逻辑
+                const isHasDepositlds = productIdList.filter(item => this.depositIds.includes(item))
+                const isHasRechargeIds = productIdList.filter(item => this.rechargeIds.includes(item))
+                const isGoods = productIdList.every(item => {
+                    ;[...this.depositIds, ...this.rechargeIds].includes(item)
+                })
+                if (productIdList.length == 1 && isHasDepositlds.length === 1 && isHasRechargeIds.length === 0) {
+                    console.log('定金商品')
+                    productIdList.forEach(skuId => {
+                        skuIds += skuId + ','
+                    })
+                } else if (productIdList.length == 1 && isHasRechargeIds.length === 1 && isHasDepositlds.length === 0) {
+                    console.log('充值余额商品')
+                    productIdList.forEach(skuId => {
+                        skuIds += skuId + ','
+                    })
+                } else if (!isGoods && isHasRechargeIds.length === 0 && isHasDepositlds.length === 0) {
+                    console.log('正常商品')
+                    productIdList.forEach(skuId => {
+                        skuIds += skuId + ','
+                    })
+                } else {
+                    this.$util.modal('提示', '缴纳订金商品或余额充值商品请单独下单!', '确定', '', false, () => {})
+                    return
+                }
+                let cartSkuIds = { skuIds: skuIds.substring(0, skuIds.lastIndexOf(',')) }
+                this.$api.navigateTo(`/pages/seller/order/create-order?data=${JSON.stringify({ data: cartSkuIds })}`)
+            }
+        },
+        handleBtnConfirm(data) {
+            console.log('data', data)
+            // 确认重选规格调用 apisMixins -> apiQueryShoppingCartList
+            this.apiUserClubCheckSku(data)
+        },
+        updateShoppogNum(pros) {
+            const params = {
+                id: pros.id,
+                productCount: pros.number,
+                serviceProviderId: this.listQuery.serviceProviderId
+            }
+            // 更新购物车调用 apisMixins -> apiQueryShoppingCartList
+            this.apiSellerAddProductNum(params)
+        },
+        handleDeleteCart() { //删除购物车商品
+            let delCartIds = ''
+            this.goodsList.forEach(delitem => {
+                delitem.cartList.forEach(pros => {
+                    if (pros.isChecked) {
+                        delCartIds += pros.id + ','
+                    }
+                })
+            })
+            this.failureList.forEach(failure => {
+                if (failure.isChecked) {
+                    delCartIds += failure.id + ','
+                }
+            })
+            if (delCartIds.length == 0) {
+                this.$util.msg('请选择要删除的商品~', 2000)
+                return
+            }
+            this.$util.modal('', '确定删除选中的商品吗?', '确定', '取消', true, () => {
+                this.apiSellerDeleteCart({ cartIds: delCartIds , serviceProviderId: this.listQuery.serviceProviderId })
+            })
+        },
+        handleDeletefailures() { // 一键删除所有失效商品
+            let delCartIds = ''
+            this.failureList.forEach(failure => {
+                delCartIds += failure.id + ','
+            })
+            this.$util.modal('', '确定清空全部失效商品吗?', '确定', '取消', true, () => {
+                this.apiSellerDeleteCart({ cartIds: delCartIds , serviceProviderId: this.listQuery.serviceProviderId })
+            })
+        }
+    }
+}
+
+export default cartMixins

+ 10 - 14
pages/seller/order/create-order.vue

@@ -193,7 +193,7 @@
 				modal: false,
 				isIphoneX:this.$store.state.isIphoneX,
 				cartParam: {// 购物车立即结算确认订单参数
-					productIds:0,		// 商品Id(逗号隔开)
+					skuIds:0,		// 商品Id(逗号隔开)
 					serviceProviderId:0,// 协销Id
 					clubId:0			// 机构Id
 				}, 		
@@ -204,7 +204,7 @@
 					clubId:0			// 机构Id
 				}, 	
 				postageParam: {// 邮费计算参数
-					productIds:0,		// 商品Id(逗号隔开)
+					skuIds:0,			// 商品Id(逗号隔开)
 					userId:0,			// 用户Id
 					townId:0			// 地区Id
 				},	
@@ -231,7 +231,6 @@
 				}, 	
 				rebateFee:'',
 				rebateFeeText:'否',
-				productIds:'',			  //商品ID,
 				confirmType:1,			  
 				submitState:'',  		  // 提交状态
 				totalCount:0,			  // 订单提交总数量
@@ -289,11 +288,10 @@
 						this.confirmType = 1
 						this.productParam.productCount = data.data.productCount
 						this.productParam.productId = data.data.productIds
-						this.productIds =  data.data.productIds
 						this.getInitProdcutCrearOrder()
 					}else{
 						this.confirmType = 2
-						this.productIds = this.cartParam.productIds = data.data.productIds
+						this.cartParam.skuIds = data.data.skuIds
 						this.getInitCrearOrder()
 					}
 			},
@@ -309,7 +307,7 @@
 					this.allPrice = data.totalPrice
 					this.rechargeGoods = data.includeRecharge
 					this.clauseList = data.clauseList
-					this.postageParam.productIds = this.getProductIds(data.list)
+					this.postageParam.productIds  = this.getProductIds(data.list)
 					this.isCouponShow = true
 					if(this.couponList.length>0){
 						this.couponAmount = data.couponList[0].couponAmount
@@ -339,15 +337,13 @@
 					this.$util.msg(error.msg,2000)
 				})
 			},
-			// 获取订单商品id列表
-			getProductIds(list){
-				const productIds = []
+			getProductIds(list){// 获取订单商品id列表
+				let productIds = []
 				list.forEach(function(supplier){
 					supplier.cartList.forEach(function(product){
 						productIds.push(product.productId)
 					})
 				})
-				// console.log(list);
 				return productIds.join(',')
 			},
 			getFreightData(){//获取邮费信息
@@ -518,12 +514,12 @@
 				
 				this.confirmParam.orderInfo = this.goodsData.map(el => {
 					let productInfo = []
-					el.cartList.forEach(item => {
+					el.cartList.forEach(pros => {
 						productInfo.push({
-							productId:item.productId,
-							productNum:item.number,
+							skuId:pros.skuId,
+							productNum:pros.number,
 							presentNum:0,
-							productType:item.giftType
+							productType:pros.giftType
 						})
 					})
 					return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}

+ 4 - 1
pages/user/collection/collection.vue

@@ -182,7 +182,7 @@
 			</view>
 		</tui-bottom-popup>
 		<!-- 选择规格弹窗 -->
-		<cm-unit-popup v-if="popupShow1" :popupShow="popupShow1" :product="handleData"></cm-unit-popup>
+		<cm-unit-popup v-if="popupShow1" :popupShow="popupShow1" :skuProduct="handleData" @skuClick="handleSkuClick"></cm-unit-popup>
 		<!-- 弹窗提示 -->
 		<tui-modal
 			:show="modal"
@@ -358,6 +358,9 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
+		handleSkuClick(sku){
+			this.handleData.price = sku.price
+		},
 		ProductCartNumber() {
 			// 获取用户购物车储量
 			this.ProductService.ProductCartNumber({

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

@@ -145,7 +145,7 @@
 				confirmType:1,
 				orderID:0,
 				cartParam: {// 购物车立即结算确认订单参数
-					productIds:0,		// 商品Id(逗号隔开)
+					skuIds:0,		// 商品Id(逗号隔开)
 					source:2,			// 来源:1WWW 2小程序
 					userId:0			// 用户Id
 				}, 		
@@ -258,13 +258,14 @@
 						this.confirmParam.cartType = 2
 						this.productParam.productCount = data.data.productCount
 						this.productParam.productId = data.data.productIds
+						this.productParam.skuId = data.data.skuId
 						this.productIds = data.data.productIds
 						this.GetProductCreateOrderInfo()
 						break
 					case '2':// 购物车结算
 						this.confirmParam.cartType = 1
 						this.confirmType = 2
-						this.productIds = this.cartParam.productIds = data.data.productIds
+						this.cartParam.skuIds = data.data.skuIds
 						this.CartCreateOrderInfo()
 						break
 					case '3':// 组合商品立即购买
@@ -568,12 +569,12 @@
 				}
 				this.confirmParam.orderInfo = this.goodsData.map(el => {
 					let productInfo = []
-					el.cartList.forEach(item => {
+					el.cartList.forEach(pros => {
 						productInfo.push({
-							productId:item.productId,
-							productNum:item.number,
+							skuId:pros.skuId,
+							productNum:pros.number,
 							presentNum:0,
-							productType:item.giftType
+							productType:pros.giftType
 						})
 					})
 					return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}

+ 4 - 1
pages/user/regularPurchase/regularPurchase.vue

@@ -3,7 +3,7 @@
 		<!-- 商品列表 -->
 		<product-list ref="productList" @operationConfim="hanldOperationConfim"></product-list>
 		<!-- 选择规格弹窗 -->
-		<cm-unit-popup v-if="popupShow1" :popupShow="popupShow1" :product="handleData"></cm-unit-popup>
+		<cm-unit-popup v-if="popupShow1" :popupShow="popupShow1" :skuProduct="handleData" @skuClick="handleSkuClick"></cm-unit-popup>
 	</view>
 </template>
 
@@ -38,6 +38,9 @@ export default {
 			this.popupShow1 = true
 			this.handleData = data
 		},
+		handleSkuClick(sku){
+			this.handleData.price = sku.price
+		},
 		GetUserCartNumber() {
 			this.OrderService.ShoppingCartCount({ userId: this.userId })
 				.then(response => {

+ 12 - 0
services/product.service.js

@@ -137,6 +137,18 @@ export default class ProductService {
               
         })
     }
+    /**
+	 * @机构添加购物车替换Sku
+	 * @param:userId 用户ID(必填)
+	 */
+    ShoppingCheckSku (data = {}) {
+	    return this.AjaxService.get({ 
+	        url:'/order/club/check/sku', 
+	        data, 
+	        isLoading: false ,
+	          
+	    })
+    }
     /**
 	 * @查询购物车数量
 	 * @param:userId 用户ID(必填)

+ 1 - 8
services/sellse.service.js

@@ -264,7 +264,7 @@ export default class SellerService {
 	 *@协销帮机构下单购物车删除商品
 	 *@param sellerCartIds 购物车ID
 	 */
-    DeleteSellerCart (data = {}) {
+    sellerDeleteCart (data = {}) {
         return this.AjaxService.post({ 
             url:'/order/seller/cart/delete', 
             data, 
@@ -334,13 +334,6 @@ export default class SellerService {
               
         })
     }
-    // 协销购物车清空失效列表
-    SellerCartdelete (data = {}) {
-        return this.AjaxService.post({ 
-            url:'/seller/deleteSellerCart', 
-            data, isLoading: true ,
-        })
-    }
     /**
 	 *@获取可分配协销列表
 	 */