|
|
@@ -1,42 +1,70 @@
|
|
|
<template>
|
|
|
- <view class="item-cmd_bx" @click="customNum()">
|
|
|
- <view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
|
|
|
- <image :src="info.cover" v-if="isImg"></image>
|
|
|
- </view>
|
|
|
- <view class="cmd-info_bx">
|
|
|
- <view class="tit" >
|
|
|
- <text class="item-tag item-tag--presell" v-if="info.presell == 1">预售</text>
|
|
|
-
|
|
|
- <text class="item-tag item-tag--limit-buy" v-if="Number(info.limitBuy) > 0">限购{{ Number(info.limitBuy) }}份</text>
|
|
|
-
|
|
|
- {{ info.itemName}}
|
|
|
+ <view class="product-item">
|
|
|
+ <view class="item-cmd_bx" @click="customNum()">
|
|
|
+ <view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
|
|
|
+ <image :src="info.cover" v-if="isImg"></image>
|
|
|
</view>
|
|
|
- <view class="kc num-open_bx flex-space">
|
|
|
- <view v-if="!offPrice">
|
|
|
- <view class="flex-space" style="margin-top:20upx;" v-if="Number(info.discountPrice)>0">
|
|
|
- <view style="padding:2upx 10upx 5upx 10upx;text-align: center;color: red;border: 1upx solid red;line-height: 1;font-size: 20upx;">
|
|
|
- {{parseFloat(((Number(info.discountPrice)/Number(info.prePrice)).toFixed(2)*10).toFixed(1))+'折'}}
|
|
|
+ <view class="cmd-info_bx">
|
|
|
+ <view class="tit">
|
|
|
+ <text class="item-tag item-tag--presell" v-if="info.presell == 1">预售</text>
|
|
|
+ <text class="item-tag item-tag--limit-buy" v-if="Number(info.limitBuy) > 0">限购{{ Number(info.limitBuy) }}份</text>
|
|
|
+ {{ info.itemName }}
|
|
|
+ </view>
|
|
|
+ <view class="kc num-open_bx">
|
|
|
+ <view v-if="!offPrice" class="price-left">
|
|
|
+ <view class="discount-row" v-if="Number(info.discountPrice)>0">
|
|
|
+ <view class="discount-tag">
|
|
|
+ {{parseFloat(((Number(info.discountPrice)/Number(info.prePrice)).toFixed(2)*10).toFixed(1))+'折'}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="ratio-row" v-else>
|
|
|
+ <block v-if="info.ratioType == 0">
|
|
|
+ {{info.ratio}}{{info.smallUnit}}/{{info.bigUnit}}
|
|
|
+ </block>
|
|
|
+ <block v-else>
|
|
|
+ 若干{{info.smallUnit}}/{{info.bigUnit}}
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+ <view class="price price-wrap">
|
|
|
+ <text v-if="displayOriginalPriceLabel" class="price-original">{{ displayOriginalPriceLabel }}</text>
|
|
|
+ <text class="price-current" :class="{'price-reach': reachDiscountReached}">¥{{ displayUnitPrice }}</text>
|
|
|
</view>
|
|
|
- <text style="text-decoration:line-through;color:#A9A9A9;position:absolute;display:block;top:16upx;left:90upx;">¥{{parseFloat(info.prePrice)}}</text>
|
|
|
</view>
|
|
|
- <view class="flex-space" style="color:#333333;position:absolute;top:13upx;" v-else>
|
|
|
- <block v-if="info.ratioType == 0">
|
|
|
- {{info.ratio}}{{info.smallUnit}}/{{info.bigUnit}}
|
|
|
- </block>
|
|
|
- <block v-else>
|
|
|
- 若干{{info.smallUnit}}/{{info.bigUnit}}
|
|
|
- </block>
|
|
|
+ <view class="price-left" v-else></view>
|
|
|
+ <view class="ctrl-side">
|
|
|
+ <view class="open-bx">
|
|
|
+ <i class="iconfont iconjian" @click.stop="delEvent()" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
+ <text class="num">
|
|
|
+ <text v-if="bigCount > 0" class="num-big">{{ bigCount }}</text>
|
|
|
+ </text>
|
|
|
+ <i class="iconfont iconzeng add-btn" @click.stop="addEvents()"></i>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <view class="price" >¥{{ parseFloat(info.price) }}</view>
|
|
|
</view>
|
|
|
- <view class="price" v-else></view>
|
|
|
-
|
|
|
- <view class="open-bx" >
|
|
|
- <i class="iconfont iconjian" @click.stop="delEvent()" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
- <text class="num">
|
|
|
- <text v-if="bigCount > 0" style="font-weight:bold;color:#3385ff;">{{ `${bigCount}` }}</text>
|
|
|
- </text>
|
|
|
- <i class="iconfont iconzeng" @click.stop="addEvents()"></i>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="extra-line extra-line--middle" v-if="info.itemRemark" @click.stop>
|
|
|
+ <view class="extra-line-row extra-line-row--with-icon">
|
|
|
+ <view class="remark-notice-icon">!</view>
|
|
|
+ <view class="extra-line-content">
|
|
|
+ <text class="remark-text">{{ info.itemRemark }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="extra-line extra-line--middle" v-if="showMiddleExtra" @click.stop>
|
|
|
+ <view class="extra-line-row extra-line-row--with-icon" v-if="Number(info.reachNum)>0 && displayReachPrice > 0">
|
|
|
+ <text class="iconfont iconjianqu extra-line-icon"></text>
|
|
|
+ <view class="extra-line-content">
|
|
|
+ <text class="reach-text">满{{ info.reachNum }}扎 享 ¥{{ displayReachPrice }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="extra-line-row extra-line-row--with-icon" v-if="info.presell && info.presell == 1">
|
|
|
+ <text class="iconfont iconfahuo extra-line-icon"></text>
|
|
|
+ <view class="extra-line-content">
|
|
|
+ <text class="reach-text presell-label">配送日</text>
|
|
|
+ <block v-if="!$util.isEmpty(info.presellDateShow)">
|
|
|
+ <text class="reach-text" v-for="(dateItem, dateIndex) in info.presellDateShow" :key="dateIndex">{{ dateItem }}<text v-if="dateIndex != info.presellDateShow.length - 1">,</text></text>
|
|
|
+ </block>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -91,6 +119,46 @@ export default {
|
|
|
default: false
|
|
|
},
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ showMiddleExtra() {
|
|
|
+ return this.info.presell == 1 || (Number(this.info.reachNum) > 0 && this.displayReachPrice > 0);
|
|
|
+ },
|
|
|
+ displayReachPrice() {
|
|
|
+ const reachPrice = Number(this.info.reachPrice);
|
|
|
+ if (!isNaN(reachPrice) && reachPrice > 0) {
|
|
|
+ return parseFloat(reachPrice);
|
|
|
+ }
|
|
|
+ const price = Number(this.info.price) || 0;
|
|
|
+ const reachNumDiscount = Number(this.info.reachNumDiscount) || 0;
|
|
|
+ if (reachNumDiscount > 0 && price > reachNumDiscount) {
|
|
|
+ const computed = parseFloat((price - reachNumDiscount).toFixed(2));
|
|
|
+ return computed <= 0 ? 0.01 : computed;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ },
|
|
|
+ reachDiscountReached() {
|
|
|
+ const reachNum = Number(this.info.reachNum) || 0;
|
|
|
+ return reachNum > 0 && Number(this.bigCount) >= reachNum;
|
|
|
+ },
|
|
|
+ hasLimitDiscount() {
|
|
|
+ return Number(this.info.discountPrice) > 0;
|
|
|
+ },
|
|
|
+ displayOriginalPriceLabel() {
|
|
|
+ if (this.reachDiscountReached) {
|
|
|
+ return `¥${parseFloat(Number(this.info.price) || 0)}`;
|
|
|
+ }
|
|
|
+ if (this.hasLimitDiscount) {
|
|
|
+ return `¥${parseFloat(Number(this.info.prePrice) || 0)}`;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ },
|
|
|
+ displayUnitPrice() {
|
|
|
+ if (this.reachDiscountReached) {
|
|
|
+ return this.displayReachPrice;
|
|
|
+ }
|
|
|
+ return parseFloat(Number(this.info.price) || 0);
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
COMMODITY_TYPE,
|
|
|
@@ -102,10 +170,9 @@ export default {
|
|
|
changeAutoPrice:'',
|
|
|
showPrice:0.00,
|
|
|
ifFocus:false,
|
|
|
- showMaxStock:230,//囤货时显示的最大库存
|
|
|
+ showMaxStock:230,
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
mounted() {
|
|
|
setTimeout(()=>{
|
|
|
this.isImg = true;
|
|
|
@@ -119,39 +186,18 @@ export default {
|
|
|
showBigImg(){
|
|
|
this.$emit("showBigCover", this.info);
|
|
|
},
|
|
|
- //input点击删除按键
|
|
|
deleteInputVal(){
|
|
|
this.isAloneAllActive=false;
|
|
|
this.changeAutoPrice = '';
|
|
|
},
|
|
|
- //离开input
|
|
|
moveAllInput(e){
|
|
|
this.isAloneAllActive=false;
|
|
|
this.isAloneAllFocus=false;
|
|
|
- // if(e==''){return}
|
|
|
this.changeAutoPrice = e?e:0;
|
|
|
if(this.isAlterMoney){
|
|
|
this.isAlterMoney = false;
|
|
|
- // let self = this
|
|
|
- changePriceByIdApi({
|
|
|
- productId: this.info.id,
|
|
|
- price: this.changeAutoPrice
|
|
|
- }).then(res => {
|
|
|
- if(res.code == 1){
|
|
|
- this.showPrice = res.data.price
|
|
|
- this.isShowSucceed = true
|
|
|
- setTimeout(()=>{
|
|
|
- this.isShowSucceed = false
|
|
|
- },1000)
|
|
|
- }else{
|
|
|
- this.$msg(res.msg)
|
|
|
- }
|
|
|
- })
|
|
|
}
|
|
|
},
|
|
|
- showBigImg(){
|
|
|
- this.$emit("showBigCover", this.info);
|
|
|
- },
|
|
|
addEvents() {
|
|
|
const ratio = Number(this.info.ratio);
|
|
|
if(this.offVerifyRepertory){
|
|
|
@@ -169,10 +215,9 @@ export default {
|
|
|
delEvent() {
|
|
|
this.$emit("del", this.info);
|
|
|
},
|
|
|
- changePriceEvent(event) {
|
|
|
+ changePriceEvent() {
|
|
|
this.isFocus = false;
|
|
|
this.isAlterMoney = true;
|
|
|
-
|
|
|
},
|
|
|
customNum() {
|
|
|
if(this.info.stock<=0){
|
|
|
@@ -198,9 +243,82 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.item-cmd_bx {
|
|
|
+.product-item {
|
|
|
position: relative;
|
|
|
margin-bottom: 20upx;
|
|
|
+}
|
|
|
+.remark-notice-icon {
|
|
|
+ width: 30upx;
|
|
|
+ height: 30upx;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #ff8c3a;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 22upx;
|
|
|
+ font-weight: bold;
|
|
|
+ line-height: 30upx;
|
|
|
+ text-align: center;
|
|
|
+ flex-shrink: 0;
|
|
|
+ margin-right: 8upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.remark-text {
|
|
|
+ font-size: 30upx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #ff2842;
|
|
|
+ line-height: 30upx;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+}
|
|
|
+.extra-line-row--with-icon {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.extra-line-icon {
|
|
|
+ font-size: 26upx;
|
|
|
+ color: #3385ff;
|
|
|
+ line-height: 26upx;
|
|
|
+ height: 26upx;
|
|
|
+ margin-right: 8upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.extra-line-content {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+}
|
|
|
+.reach-text {
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+.presell-label {
|
|
|
+ margin-right: 10upx;
|
|
|
+}
|
|
|
+.extra-line {
|
|
|
+ margin-top: 8upx;
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #3385ff;
|
|
|
+ line-height: 1.4;
|
|
|
+ word-wrap: break-word;
|
|
|
+ white-space: normal;
|
|
|
+}
|
|
|
+.extra-line--middle {
|
|
|
+ font-size: 26upx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
+.extra-line-row + .extra-line-row {
|
|
|
+ margin-top: 4upx;
|
|
|
+}
|
|
|
+.item-cmd_bx {
|
|
|
+ position: relative;
|
|
|
+ margin-bottom: 0;
|
|
|
.img_bx {
|
|
|
height: 140upx;
|
|
|
width: 140upx;
|
|
|
@@ -219,7 +337,6 @@ export default {
|
|
|
font-size: 30upx;
|
|
|
font-weight: 700;
|
|
|
color: #333333;
|
|
|
- padding-top: 0 0 2upx 0;
|
|
|
overflow: hidden;
|
|
|
white-space: nowrap;
|
|
|
text-overflow: ellipsis;
|
|
|
@@ -250,78 +367,111 @@ export default {
|
|
|
position: relative;
|
|
|
color: #999999;
|
|
|
font-size: 24upx;
|
|
|
- .price{
|
|
|
+ .price-left {
|
|
|
+ min-height: 96upx;
|
|
|
+ }
|
|
|
+ .discount-row {
|
|
|
+ position: absolute;
|
|
|
+ top: 14upx;
|
|
|
+ left: 0;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
+ .discount-tag {
|
|
|
+ display: inline-block;
|
|
|
+ padding: 2upx 10upx 5upx 10upx;
|
|
|
+ text-align: center;
|
|
|
+ color: red;
|
|
|
+ border: 1upx solid red;
|
|
|
+ line-height: 1;
|
|
|
+ font-size: 20upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .ratio-row {
|
|
|
+ position: absolute;
|
|
|
+ top: 13upx;
|
|
|
+ left: 0;
|
|
|
+ z-index: 1;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+ .price {
|
|
|
position: absolute;
|
|
|
left: 0;
|
|
|
bottom: 0;
|
|
|
}
|
|
|
}
|
|
|
& .num-open_bx {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- & .price {
|
|
|
+ position: relative;
|
|
|
+ min-height: 96upx;
|
|
|
+ .ctrl-side {
|
|
|
+ position: absolute;
|
|
|
+ right: 16upx;
|
|
|
+ top: -2upx;
|
|
|
+ z-index: 2;
|
|
|
+ flex-shrink: 0;
|
|
|
+ text-align: right;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .price-wrap {
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 30upx;
|
|
|
+ top: 60upx;
|
|
|
+ right: 230upx;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ .price-original {
|
|
|
+ text-decoration: line-through;
|
|
|
+ color: #A9A9A9;
|
|
|
font-size: 28upx;
|
|
|
+ margin-right: 8upx;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .price-current {
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #ff2842;
|
|
|
+ font-weight: 550;
|
|
|
+ }
|
|
|
+ .price-reach {
|
|
|
color: #ff2842;
|
|
|
- flex: 1;
|
|
|
- top:60upx;
|
|
|
- font-weight:550;
|
|
|
}
|
|
|
& .open-bx {
|
|
|
- position: absolute;
|
|
|
- right:10upx;
|
|
|
- top:10upx;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ box-sizing: border-box;
|
|
|
+ flex-shrink: 0;
|
|
|
& .iconfont {
|
|
|
- //margin-left: 15upx;
|
|
|
color: #3385ff;
|
|
|
font-size: 55upx;
|
|
|
}
|
|
|
- .position{
|
|
|
- display: block;
|
|
|
- width: 70upx;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .iconcachu {
|
|
|
- margin: 0 6upx 0 20upx;
|
|
|
- color: #ccc;
|
|
|
- &.edit {
|
|
|
- color: #3385ff;
|
|
|
- }
|
|
|
+ & .iconfont.add-btn {
|
|
|
+ font-size: 62upx;
|
|
|
+ line-height: 1;
|
|
|
+ padding: 6upx;
|
|
|
+ margin: -6upx 0;
|
|
|
+ box-sizing: content-box;
|
|
|
}
|
|
|
& > .num {
|
|
|
- display: inline-block;
|
|
|
- width: 100upx;
|
|
|
- height:40upx;
|
|
|
- line-height:40upx;
|
|
|
- text-align:center;
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ min-width: 100upx;
|
|
|
+ height: 50upx;
|
|
|
+ line-height: 50upx;
|
|
|
+ text-align: center;
|
|
|
margin: 0 8upx;
|
|
|
color: #868686;
|
|
|
- border-radius: 22upx;
|
|
|
+ border-radius: 25upx;
|
|
|
background-color: #f5f5f5;
|
|
|
- font-size: 24upx;
|
|
|
+ font-size: 30upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 8upx;
|
|
|
}
|
|
|
- .change-input {
|
|
|
- width: 164upx;
|
|
|
- height: 60upx;
|
|
|
- line-height: 60upx;
|
|
|
- text-align: center;
|
|
|
- background: #ffffff;
|
|
|
- border: 1upx solid #dddddd;
|
|
|
- border-radius: 4upx;
|
|
|
- font-size: 25upx;
|
|
|
- }
|
|
|
- .btn-box{
|
|
|
- width: 100upx;
|
|
|
- height: 60upx;
|
|
|
- line-height: 60upx;
|
|
|
- color: #ffffff;
|
|
|
- background: #3385ff;
|
|
|
- text-align: center;
|
|
|
- border-radius: 10upx;
|
|
|
+ .num-big {
|
|
|
+ font-weight: bold;
|
|
|
+ color: #3385ff;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|