|
@@ -7,7 +7,7 @@
|
|
|
<view class="tui-sku-title">
|
|
|
<view class="tui-sku-image"> <image :src="skuProduct.mainImage" mode=""></image> </view>
|
|
|
<view class="tui-sku-price">
|
|
|
- <cmUnitPrice :skuProduct="skuProduct" :productCoupon="productCoupon"></cmUnitPrice>
|
|
|
+ <cmUnitPrice :skuProduct="skuProduct" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="tui-sku-unit">
|
|
@@ -21,14 +21,10 @@
|
|
|
:class="skuIndex === index ? 'active' : ''"
|
|
|
>
|
|
|
{{ 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="skuProduct.step === 2">
|
|
|
- <view class="text">*该商品只能以起订量的整数倍购买</view>
|
|
|
- </view> -->
|
|
|
<view class="sku-unit-nunbox-t">
|
|
|
<view class="sku-unit-nunbox-text">购买数量:</view>
|
|
|
<view class="sku-unit-nunbox-num">
|
|
@@ -54,13 +50,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="sku-unit-ladel" v-if="isShowLadder" @click.stop="showLaddePopup">
|
|
|
- 此规格商品存在阶梯价格,点击查看 >>>
|
|
|
- </view>
|
|
|
</view>
|
|
|
<view
|
|
|
class="tui-right-flex tui-popup-btn"
|
|
|
- v-if="isShowButton"
|
|
|
:style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }"
|
|
|
>
|
|
|
<view class="tui-flex-1" v-if="type === 1">
|
|
@@ -92,8 +84,6 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</tui-bottom-popup>
|
|
|
- <!-- 阶梯价弹窗 -->
|
|
|
- <cmLadderPopup v-if="laddePopupShow" :show="laddePopupShow" :list="ladderPriceList"></cmLadderPopup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -101,21 +91,16 @@
|
|
|
import { mapState, mapMutations } from 'vuex'
|
|
|
import uniGrader from '@/components/uni-grade/uni-grade.vue'
|
|
|
import cmUnitPrice from './cm-unit-price.vue'
|
|
|
-import cmLadderPopup from '@/components/cm-module/productDetails/cm-ladder-popup.vue'
|
|
|
export default {
|
|
|
name: 'cm-unit-popup',
|
|
|
components: {
|
|
|
uniGrader,
|
|
|
cmUnitPrice,
|
|
|
- cmLadderPopup
|
|
|
},
|
|
|
props: {
|
|
|
skuProduct: {
|
|
|
type: Object
|
|
|
},
|
|
|
- productCoupon: {
|
|
|
- type: Array
|
|
|
- },
|
|
|
goodsData: {
|
|
|
type: Object
|
|
|
},
|
|
@@ -138,7 +123,6 @@ export default {
|
|
|
ladderPriceList: [],
|
|
|
isStock: false, //
|
|
|
isQuantity: false,
|
|
|
- isShowButton: false,
|
|
|
skuList: [],
|
|
|
handleStock: 0, // 规格库存
|
|
|
handleMinNumber: 1, // 规格起订量
|
|
@@ -155,20 +139,10 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async initData(data) {
|
|
|
- const userInfo = await this.$api.getStorage()
|
|
|
- if (userInfo.userIdentity == 1 || userInfo.userIdentity == 3) {
|
|
|
- this.isShowButton = false
|
|
|
- } else {
|
|
|
- this.isShowButton = true
|
|
|
- }
|
|
|
this.skuList = this.skuProduct.organizeSkus
|
|
|
this.productCount = this.skuList[0].minBuyNumber
|
|
|
this.handleMinNumber = this.skuList[0].minBuyNumber
|
|
|
this.handleStock = this.skuList[0].stock
|
|
|
- // if (this.skuList[0].ladderPriceList) {
|
|
|
- // this.isShowLadder = true
|
|
|
- // this.ladderPriceList = this.skuList[0].ladderPriceList
|
|
|
- // }
|
|
|
},
|
|
|
//popup弹窗数量增加按钮
|
|
|
changeCountAdd() {
|
|
@@ -176,27 +150,16 @@ export default {
|
|
|
this.isStock = true
|
|
|
return
|
|
|
}
|
|
|
- if (this.skuProduct.step == 2) {
|
|
|
- this.productCount += this.handleMinNumber
|
|
|
- } else {
|
|
|
- this.productCount++
|
|
|
- }
|
|
|
- this.totalLadderPrice()
|
|
|
+ this.productCount++
|
|
|
},
|
|
|
//popup弹窗数量减按钮
|
|
|
changeCountSub() {
|
|
|
if (this.productCount <= this.handleMinNumber) {
|
|
|
this.productCount = this.handleMinNumber
|
|
|
this.isQuantity = true
|
|
|
- this.$util.msg(`该商品最小起订量为${this.handleMinNumber}`, 2000)
|
|
|
return
|
|
|
} else {
|
|
|
- if (this.skuProduct.step == 2) {
|
|
|
- this.productCount -= this.handleMinNumber
|
|
|
- } else {
|
|
|
- this.productCount--
|
|
|
- }
|
|
|
- this.totalLadderPrice()
|
|
|
+ this.productCount--
|
|
|
this.isQuantity = false
|
|
|
}
|
|
|
},
|
|
@@ -205,27 +168,12 @@ export default {
|
|
|
if (!this.$api.isNumber(_value)) {
|
|
|
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.productCount = this.handleMinNumber
|
|
|
} else if (_value > this.handleStock) {
|
|
|
this.productCount = this.handleStock
|
|
|
} else {
|
|
|
this.productCount = e.detail.value
|
|
|
}
|
|
|
- this.totalLadderPrice()
|
|
|
- },
|
|
|
- totalLadderPrice() {
|
|
|
- //单独处理活动价格和阶梯价格
|
|
|
- if (this.ladderPriceList.length > 0) {
|
|
|
- this.ladderPriceList.forEach((ladder, index) => {
|
|
|
- if (this.productCount >= ladder.buyNum) {
|
|
|
- this.$parent.skuProduct.price = ladder.buyPrice
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
},
|
|
|
handleConfirm(type) {
|
|
|
if (this.hasLogin) {
|
|
@@ -235,22 +183,21 @@ export default {
|
|
|
this.$emit('buyConfirm', { type: type, productCount: this.productCount })
|
|
|
this.$parent.popupShow3 = false
|
|
|
} else {
|
|
|
- this.$api.navigateTo('/pages/login/login')
|
|
|
+ this.handleNavLogin()
|
|
|
}
|
|
|
},
|
|
|
+ handleNavLogin(){
|
|
|
+ //未登录跳转
|
|
|
+ const pages = getCurrentPages()
|
|
|
+ const page = pages[pages.length - 1]
|
|
|
+ uni.setStorageSync('LOGIN_REDIRECT_URL', page.$page.fullPath)
|
|
|
+ this.$api.redirectTo('/pages/login/login')
|
|
|
+ },
|
|
|
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.skuProduct.productId}`
|
|
|
- })
|
|
|
- }
|
|
|
this.$emit('buyConfirm', { type: this.btnType, productCount: this.productCount })
|
|
|
this.$parent.popupShow3 = false
|
|
|
},
|
|
@@ -391,7 +338,7 @@ export default {
|
|
|
.iconfont {
|
|
|
font-size: $font-size-24;
|
|
|
padding: 0 18rpx;
|
|
|
- color: #D5D5D5;
|
|
|
+ color: #333333;
|
|
|
text-align: center;
|
|
|
line-height: 48rpx;
|
|
|
font-weight: bold;
|