完善商品数据提交
This commit is contained in:
@ -35,7 +35,7 @@
|
||||
<text class="text-999 ml20">随时退 过期自动退</text>
|
||||
</view>
|
||||
<view>
|
||||
<u-button @click="chooseSpec" hover-class="none"
|
||||
<u-button @click="showSpec = true" hover-class="none"
|
||||
:customStyle="{width: '116rpx', height: '46rpx', lineHeight: '46rpx', fontSize: '24rpx', backgroundColor: themeColor, color: '#fff', border: 'none', paddingTop: '8rpx'}"
|
||||
:hair-line="false"
|
||||
shape="circle">
|
||||
@ -69,7 +69,7 @@
|
||||
<view>门店</view>
|
||||
</view>
|
||||
<view class="u-m-l-64 flex1">
|
||||
<u-button @click="onBuy" hover-class="none"
|
||||
<u-button hover-class="none" @click="onBuy"
|
||||
:customStyle="{height: '92rpx', fontSize: '24rpx', backgroundColor: themeColor, color: '#fff', border: 'none', paddingTop: '8rpx'}"
|
||||
:hair-line="false"
|
||||
shape="circle">
|
||||
@ -78,7 +78,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<shop-spec v-model="showSpec" @close="showSpec = false"></shop-spec>
|
||||
<shop-spec v-model="showSpec" :spec="goods.goods_spec" @close="showSpec = false" @confirm="confirmSpec"></shop-spec>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -98,7 +98,8 @@
|
||||
return {
|
||||
id: 0,
|
||||
showSpec: false,
|
||||
goods: []
|
||||
goods: [],
|
||||
spec: [],
|
||||
}
|
||||
},
|
||||
|
||||
@ -126,13 +127,25 @@
|
||||
}
|
||||
},
|
||||
|
||||
chooseSpec() {
|
||||
this.showSpec = true
|
||||
// 获取选择的商品规格
|
||||
confirmSpec(data) {
|
||||
console.log("data>>>", data.spec);
|
||||
this.spec = data.spec
|
||||
this.showSpec = false
|
||||
},
|
||||
|
||||
// 购买商品
|
||||
onBuy() {
|
||||
// 这里需压判断选购规格
|
||||
if (!this.isLogin) return toLogin();
|
||||
this.$store.commit("setBuyGoods", {
|
||||
id: this.id, // 商品id
|
||||
num: 1, // 购买商品数量
|
||||
spec: this.spec // 选中的商品规格
|
||||
});
|
||||
|
||||
console.log("this.$>>>", this.$store.state.goods.buyGoods);
|
||||
|
||||
uni.navigateTo({
|
||||
url: `/pages/order_now/order_now`
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user