bugList
This commit is contained in:
parent
119d92ea09
commit
dce7d15ab1
|
@ -46,7 +46,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<view class="joinCart" @tap="joinCart">加入购物车</view>
|
<view class="joinCart" @tap="joinCart">加入购物车</view>
|
||||||
<view class="buy" @tap="buy">立即购买</view>
|
<view v-if="good.num>0" class="buy" @tap="buy">立即购买</view>
|
||||||
|
<view v-else class="buy">库存不足</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- share弹窗 -->
|
<!-- share弹窗 -->
|
||||||
|
@ -102,16 +103,12 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 规格-模态层弹窗 -->
|
<!-- 立即购买-模态层弹窗 -->
|
||||||
<view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
|
<view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
|
||||||
<!-- 遮罩层 -->
|
<!-- 遮罩层 -->
|
||||||
<view class="mask"></view>
|
<view class="mask"></view>
|
||||||
<view class="layer" @tap.stop="discard">
|
<view class="layer" @tap.stop="discard">
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<!-- <view class="title">选择规格:</view>
|
|
||||||
<view class="sp">
|
|
||||||
<view v-for="(item,index) in goodsData.spec" :class="[index==selectSpec?'on':'']" @tap="setSelectSpec(index)" :key="index">{{item}}</view>
|
|
||||||
</view> -->
|
|
||||||
<view class="length">
|
<view class="length">
|
||||||
<view class="text">数量</view>
|
<view class="text">数量</view>
|
||||||
<view class="number">
|
<view class="number">
|
||||||
|
@ -336,12 +333,11 @@
|
||||||
methods: {
|
methods: {
|
||||||
getGood(id) {
|
getGood(id) {
|
||||||
this.$u.api.getGood(id).then(res => {
|
this.$u.api.getGood(id).then(res => {
|
||||||
let good = res.data
|
let good = res.data;
|
||||||
|
good._num = 1;//购买数
|
||||||
if (good.content) {
|
if (good.content) {
|
||||||
good.content = richTextUtil.formatRichText(good.content);
|
good.content = richTextUtil.formatRichText(good.content);
|
||||||
good._num = 1;//购买数
|
|
||||||
}
|
}
|
||||||
// console.log(good)
|
|
||||||
this.good = good
|
this.good = good
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -399,13 +395,6 @@
|
||||||
buy() {
|
buy() {
|
||||||
this.action = 'buy';
|
this.action = 'buy';
|
||||||
this.specClass = 'show'
|
this.specClass = 'show'
|
||||||
// this.showSpec()
|
|
||||||
// if(this.selectSpec==null){
|
|
||||||
// return this.showSpec(()=>{
|
|
||||||
// this.toConfirmation();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// this.toConfirmation();
|
|
||||||
},
|
},
|
||||||
//商品评论
|
//商品评论
|
||||||
toRatings() {
|
toRatings() {
|
||||||
|
@ -524,24 +513,25 @@
|
||||||
},
|
},
|
||||||
//关闭规格弹窗
|
//关闭规格弹窗
|
||||||
confirm() {
|
confirm() {
|
||||||
this.specClass = 'none';
|
debugger;
|
||||||
//回调
|
let num = parseInt(this.good._num);
|
||||||
|
if(num>this.good.num){
|
||||||
// this.selectSpec&&this.specCallback&&this.specCallback();
|
uni.showToast({
|
||||||
// this.specCallback = false;
|
icon:'error',
|
||||||
// setTimeout(() => {
|
title: "库存不足!"
|
||||||
// this.specClass = 'none';
|
});
|
||||||
// }, 200);
|
}else{
|
||||||
if (this.action == 'buy') {
|
this.specClass = 'none';
|
||||||
|
if (this.action == 'buy') {
|
||||||
this.toConfirmation()
|
|
||||||
} else {
|
this.toConfirmation()
|
||||||
this.$u.api.addtoCart(this.good.id, this.good._num).then(res => {
|
} else {
|
||||||
uni.showToast({
|
this.$u.api.addtoCart(this.good.id, this.good._num).then(res => {
|
||||||
title: "已加入购物车"
|
uni.showToast({
|
||||||
});
|
title: "已加入购物车"
|
||||||
})
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discard() {
|
discard() {
|
||||||
|
|
Loading…
Reference in New Issue