|
@@ -356,16 +356,25 @@
|
|
|
}
|
|
|
// 显示最低价格的规格信息,不考虑库存问题
|
|
|
if (data.specs && data.specs.length > 0) {
|
|
|
- // 规格排序
|
|
|
- let indexSpecs = data.specs.sort(function(a, b) {
|
|
|
- let i, j;
|
|
|
- if (a.price) i = 'price'
|
|
|
- else i = 'sell_money'
|
|
|
- if (b.price) j = 'price'
|
|
|
- else j = 'sell_money'
|
|
|
- return a[i] - b[j];
|
|
|
+ data.specs = data.specs.filter(i => i.status == '0');
|
|
|
+ data.specs.sort((a, b) => {
|
|
|
+ return b.sort - a.sort
|
|
|
})
|
|
|
- that.$set(that, `infospecs`, indexSpecs[0])
|
|
|
+ const lowPrice = Math.min.apply(Math, data.specs.map(item => item.price || item
|
|
|
+ .sell_money))
|
|
|
+ let indexSpecs = data.specs.find(i => i.price == lowPrice || i.sell_money == lowPrice)
|
|
|
+ // 规格排序
|
|
|
+ // let indexSpecs = data.specs.sort(function(a, b) {
|
|
|
+ // // return a.sort - b.sort
|
|
|
+ // let i, j;
|
|
|
+ // if (a.price) i = 'price'
|
|
|
+ // else i = 'sell_money'
|
|
|
+ // if (b.price) j = 'price'
|
|
|
+ // else j = 'sell_money'
|
|
|
+ // return a[i] - b[j];
|
|
|
+ // })
|
|
|
+ // console.log(indexSpecs);
|
|
|
+ that.$set(that, `infospecs`, indexSpecs)
|
|
|
}
|
|
|
that.$set(that, `info`, data);
|
|
|
// 优惠
|
|
@@ -375,7 +384,8 @@
|
|
|
if (act) that.$set(that.discount, `full_fold`, act.text.split(';'));
|
|
|
await that.searchOther();
|
|
|
// 查询规格
|
|
|
- await that.searchSpecs(data.specs);
|
|
|
+ // await that.searchSpecs(data.specs);
|
|
|
+ await that.searchSpecs(data.specs, that.infospecs);
|
|
|
// 查询评价数
|
|
|
await that.searchRate(data);
|
|
|
}
|
|
@@ -387,10 +397,10 @@
|
|
|
}
|
|
|
},
|
|
|
// 查询规格
|
|
|
- searchSpecs(e) {
|
|
|
+ searchSpecs(e, data) {
|
|
|
const that = this;
|
|
|
if (e.length > 0) {
|
|
|
- let data = e.find(i => i.num > 0);
|
|
|
+ // let data = e.find(i => i.num > 0);
|
|
|
let dataIndex = e.findIndex(i => i._id == data._id);
|
|
|
if (data) {
|
|
|
let specsInfo = that.group_config.find(i => i.spec._id == data._id)
|
|
@@ -787,7 +797,7 @@
|
|
|
.money {
|
|
|
font-size: 20px;
|
|
|
padding: 0 1vw 0 0;
|
|
|
- color: var(--fFB1Color);
|
|
|
+ color: var(--fFB1Color);
|
|
|
font-weight: bold;
|
|
|
|
|
|
text {
|