|
@@ -27,7 +27,7 @@
|
|
|
<span class="money">
|
|
<span class="money">
|
|
|
<span v-if="fragment.currency == 'RMB'">¥</span>
|
|
<span v-if="fragment.currency == 'RMB'">¥</span>
|
|
|
<span v-if="fragment.currency == 'USD'">$</span>
|
|
<span v-if="fragment.currency == 'USD'">$</span>
|
|
|
- <span v-text="fragment.price"></span>
|
|
|
|
|
|
|
+ <span>{{fragment.price | currency}}</span>
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="com-info">
|
|
<div class="com-info">
|
|
@@ -48,9 +48,10 @@
|
|
|
<div class="com-info">
|
|
<div class="com-info">
|
|
|
<span class="name">库 存</span>:<span v-text="commodity.reserve || 0"></span>
|
|
<span class="name">库 存</span>:<span v-text="commodity.reserve || 0"></span>
|
|
|
(<span v-text="commodity.minBuyQty || 1"></span>个起订)
|
|
(<span v-text="commodity.minBuyQty || 1"></span>个起订)
|
|
|
|
|
+ <span :class="commodity.breakUp?'div-sell can-div-sell':'div-sell not-div-sell'" v-text="commodity.breakUp?'可拆卖':'不可拆卖'" ></span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="com-info">
|
|
<div class="com-info">
|
|
|
- <span class="name">货 期</span>:
|
|
|
|
|
|
|
+ <span class="name">交 期</span>:
|
|
|
<div class="delivery">
|
|
<div class="delivery">
|
|
|
<span v-text="commodity.b2cMinDelivery || 0"></span>
|
|
<span v-text="commodity.b2cMinDelivery || 0"></span>
|
|
|
<span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">-</span>
|
|
<span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">-</span>
|
|
@@ -78,17 +79,17 @@
|
|
|
<div class="select">
|
|
<div class="select">
|
|
|
<span v-if="fragment.currency == 'RMB'">¥</span>
|
|
<span v-if="fragment.currency == 'RMB'">¥</span>
|
|
|
<span v-if="fragment.currency == 'USD'">$</span>
|
|
<span v-if="fragment.currency == 'USD'">$</span>
|
|
|
- <span>{{(fragment.price || 0)}}</span>
|
|
|
|
|
|
|
+ <span>{{(fragment.price || 0) | currency}}</span>
|
|
|
<span v-if="fragment.currency == 'RMB'" class="tax"> ( 含税 ) </span>
|
|
<span v-if="fragment.currency == 'RMB'" class="tax"> ( 含税 ) </span>
|
|
|
</div>
|
|
</div>
|
|
|
=
|
|
=
|
|
|
<span class="money">
|
|
<span class="money">
|
|
|
<span v-if="fragment.currency == 'RMB'">¥</span>
|
|
<span v-if="fragment.currency == 'RMB'">¥</span>
|
|
|
<span v-if="fragment.currency == 'USD'">$</span>
|
|
<span v-if="fragment.currency == 'USD'">$</span>
|
|
|
- <span>{{(calculate || 0)}}</span>
|
|
|
|
|
|
|
+ <span>{{(calculate || 0) | currency}}</span>
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="button" ng-controller="GoodsPickUpCtrl">
|
|
|
|
|
|
|
+ <div class="button">
|
|
|
<button class="btn btn-default btn-primary" @click="buyNow(false, commodity)">加入购物车</button>
|
|
<button class="btn btn-default btn-primary" @click="buyNow(false, commodity)">加入购物车</button>
|
|
|
<button class="btn btn-default btn-now" @click="buyNow(true, commodity)">立即购买</button>
|
|
<button class="btn btn-default btn-now" @click="buyNow(true, commodity)">立即购买</button>
|
|
|
</div>
|
|
</div>
|
|
@@ -108,10 +109,10 @@
|
|
|
<span v-text="price.start"></span>+
|
|
<span v-text="price.start"></span>+
|
|
|
</div>
|
|
</div>
|
|
|
<div class="price">
|
|
<div class="price">
|
|
|
- <span v-if="price.rMBPrice" v-text="price.rMBPrice || 0"></span>
|
|
|
|
|
|
|
+ <span v-if="price.rMBPrice">{{price.rMBPrice || 0 | currency}}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="price">
|
|
<div class="price">
|
|
|
- <span v-if="price.uSDPrice" v-text="price.uSDPrice || 0"></span>
|
|
|
|
|
|
|
+ <span v-if="price.uSDPrice">{{price.uSDPrice || 0 | currency}}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
@@ -175,6 +176,32 @@ export default {
|
|
|
canSub: true}
|
|
canSub: true}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ filters: {
|
|
|
|
|
+ currency: function (num) {
|
|
|
|
|
+ if (typeof num === 'number') {
|
|
|
|
|
+ if (num <= 0.000001) {
|
|
|
|
|
+ num = 0.000001
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (num.toString().indexOf('.') === -1) {
|
|
|
|
|
+ num += '.00'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let inputStr = num.toString()
|
|
|
|
|
+ let arr = inputStr.split('.')
|
|
|
|
|
+ let floatNum = arr[1]
|
|
|
|
|
+ if (floatNum.length > 6) {
|
|
|
|
|
+ num = inputStr.substring(0, arr[0].length + 7)
|
|
|
|
|
+ if (Number(floatNum.charAt(6)) > 4) {
|
|
|
|
|
+ num = (Number(num) * 1000000 + 1) / 1000000
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (floatNum.length === 1) {
|
|
|
|
|
+ num = num + '0'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return num
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
computed: {
|
|
computed: {
|
|
|
storeInfo () {
|
|
storeInfo () {
|
|
|
return this.$store.state.shop.storeInfo.store.data
|
|
return this.$store.state.shop.storeInfo.store.data
|
|
@@ -214,9 +241,10 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
changeNum: function (newNum) {
|
|
changeNum: function (newNum) {
|
|
|
- let pack = this.commodity.minPackQty
|
|
|
|
|
|
|
+ let pack = this.commodity.perQty || this.commodity.minPackQty
|
|
|
let buy = this.commodity.minBuyQty
|
|
let buy = this.commodity.minBuyQty
|
|
|
let reserve = this.commodity.reserve
|
|
let reserve = this.commodity.reserve
|
|
|
|
|
+ newNum = parseInt(newNum)
|
|
|
if (newNum < buy) {
|
|
if (newNum < buy) {
|
|
|
this.$message.error('该商品最少购买' + buy + '件')
|
|
this.$message.error('该商品最少购买' + buy + '件')
|
|
|
this.fragment.num = buy
|
|
this.fragment.num = buy
|
|
@@ -258,12 +286,14 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
subNum () {
|
|
subNum () {
|
|
|
- let newNum = this.fragment.num - this.commodity.minPackQty
|
|
|
|
|
|
|
+ let pack = this.commodity.perQty || this.commodity.minPackQty
|
|
|
|
|
+ let newNum = this.fragment.num - pack
|
|
|
this.changeNum(newNum)
|
|
this.changeNum(newNum)
|
|
|
getFragment(this.commodity, this.fragment)
|
|
getFragment(this.commodity, this.fragment)
|
|
|
},
|
|
},
|
|
|
addNum () {
|
|
addNum () {
|
|
|
- let newNum = this.fragment.num + this.commodity.minPackQty
|
|
|
|
|
|
|
+ let pack = this.commodity.perQty || this.commodity.minPackQty
|
|
|
|
|
+ let newNum = this.fragment.num + pack
|
|
|
this.changeNum(newNum)
|
|
this.changeNum(newNum)
|
|
|
getFragment(this.commodity, this.fragment)
|
|
getFragment(this.commodity, this.fragment)
|
|
|
},
|
|
},
|
|
@@ -272,15 +302,15 @@ export default {
|
|
|
this.changeNum(this.fragment.num)
|
|
this.changeNum(this.fragment.num)
|
|
|
getFragment(this.commodity, this.fragment)
|
|
getFragment(this.commodity, this.fragment)
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.error('请输入数字')
|
|
|
|
|
|
|
+ this.$message.error('请输入整数')
|
|
|
this.fragment.num = this.commodity.minBuyQty
|
|
this.fragment.num = this.commodity.minBuyQty
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
buyNow: function (isBuy, item) {
|
|
buyNow: function (isBuy, item) {
|
|
|
if (!this.$store.state.option.user.logged) {
|
|
if (!this.$store.state.option.user.logged) {
|
|
|
- this.$http.get('/login/page').then(response => {
|
|
|
|
|
|
|
+ this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
|
|
|
if (response.data) {
|
|
if (response.data) {
|
|
|
- this.$router.push('/auth/login')
|
|
|
|
|
|
|
+ window.location.href = response.data.content + '&baseUrl=' + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
@@ -319,6 +349,9 @@ export default {
|
|
|
}
|
|
}
|
|
|
}, err => {
|
|
}, err => {
|
|
|
console.log(err)
|
|
console.log(err)
|
|
|
|
|
+ if (item.minBuyQty > item.reserve) {
|
|
|
|
|
+ this.$message.error('商品' + item.code + '的库存已经不满足起订量')
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
// this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
|
|
// this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
|
|
@@ -607,4 +640,36 @@ export default {
|
|
|
#commodity-info-fragment{
|
|
#commodity-info-fragment{
|
|
|
margin-bottom: 20px;
|
|
margin-bottom: 20px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ .commodity-detail .content .com-info .div-sell {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ height: 16px;
|
|
|
|
|
+ line-height: 16px;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ padding: 0 5px;
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ }
|
|
|
|
|
+ .commodity-detail .content .com-info .can-div-sell {
|
|
|
|
|
+ background: #5078cb;
|
|
|
|
|
+ }
|
|
|
|
|
+ .commodity-detail .content .com-info .not-div-sell {
|
|
|
|
|
+ background: #fc8200;
|
|
|
|
|
+ }
|
|
|
|
|
+ .commodity-detail .content .com-info .can-div-sell:before {
|
|
|
|
|
+ content: '';
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: -8px;
|
|
|
|
|
+ top: 10px;
|
|
|
|
|
+ border-left: 8px solid transparent;
|
|
|
|
|
+ border-bottom: 6px solid #5078cb;
|
|
|
|
|
+ }
|
|
|
|
|
+ .commodity-detail .content .com-info .not-div-sell:before {
|
|
|
|
|
+ content: '';
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: -8px;
|
|
|
|
|
+ top: 10px;
|
|
|
|
|
+ border-left: 8px solid transparent;
|
|
|
|
|
+ border-bottom: 6px solid #fc8200;
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|