|
@@ -144,8 +144,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="display: flex;color: #FFFFFF;align-items: center;">
|
|
|
- <view class="btn1" @click="addCart">加购物车</view>
|
|
|
- <view class="btn2" @click="buy">立即购买 </view>
|
|
|
+ <view class="btn1" @click="addCart()">加购物车</view>
|
|
|
+ <view class="btn2" @click="buy()">立即购买 </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -164,6 +164,41 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
+
|
|
|
+ <!-- 选择规格弹窗 -->
|
|
|
+ <u-popup v-model="toggleSkuShow" mode="bottom" border-radius="40">
|
|
|
+ <view class="popup_box">
|
|
|
+ <view class="check_head">
|
|
|
+ <view class="headers">
|
|
|
+ <view class="grade">选择规格</view>
|
|
|
+ <u-icon name="close" color="#9C9C9C" size="40" @click="closePop()"></u-icon>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="pop_prices">
|
|
|
+ <view class="lefts">
|
|
|
+ <!-- <image :src="$method.splitImgHost(item.coverUrl, true)" class="imgs"></image> -->
|
|
|
+ <!-- <image src="" class="imgs"></image> -->
|
|
|
+ </view>
|
|
|
+ <view class="rights">
|
|
|
+ <view class="goods_titles">【建筑全科】2022年一建精华 2022年一建精华班</view>
|
|
|
+ <view class="goods_price">¥154.00</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="lines"></view>
|
|
|
+ <view class="check_con">
|
|
|
+ <view v-for="(item, index) in specList" :key="index" class="check_items">
|
|
|
+ <view class="grades">{{ item.name }}</view>
|
|
|
+ <view class="grade_names">
|
|
|
+ <!-- :class="{nactive: skuIndex == index}" -->
|
|
|
+ <view class="course_items" v-for="(child, c_index) in item.specAttrList" :key="c_index" @click="selectSku(child, index, c_index)">
|
|
|
+ {{ child.name }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="right_now" @click="rightNowBuy()">确 定</view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -205,6 +240,65 @@ export default {
|
|
|
teaIndex: 0,
|
|
|
States: {0: 0},
|
|
|
goodsType: 1, // 1视频2题库 3补考 4前培 6直播
|
|
|
+ toggleSkuShow: false,
|
|
|
+ courseSku: ['基础班', '钻石班', '基础班', '钻石班', '基础班', '钻石班'],
|
|
|
+ skuItem: {},
|
|
|
+ skuIndex: -1,
|
|
|
+ isCarOrBuy: 1, // 1加入购物车 2立即购买
|
|
|
+ specList: [
|
|
|
+ {
|
|
|
+ "specId":62,
|
|
|
+ "specTemplateId":28,
|
|
|
+ name:"一建规格-001",
|
|
|
+ "code":null,
|
|
|
+ "sort":null,
|
|
|
+ "status":1,
|
|
|
+ specAttrList: [
|
|
|
+ {
|
|
|
+ "specAttributeId":115,
|
|
|
+ "specId":62,
|
|
|
+ name:"一建规格属性0011",
|
|
|
+ "code":null,
|
|
|
+ "sort":null,
|
|
|
+ "status":1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "specAttributeId":116,
|
|
|
+ "specId":62,
|
|
|
+ name:"一建规格属性0012",
|
|
|
+ "code":null,
|
|
|
+ "sort":null,
|
|
|
+ "status":1
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "specId":63,
|
|
|
+ "specTemplateId":28,
|
|
|
+ name:"一建规格-002",
|
|
|
+ "code":null,
|
|
|
+ "sort":null,
|
|
|
+ "status":1,
|
|
|
+ specAttrList: [
|
|
|
+ {
|
|
|
+ "specAttributeId":117,
|
|
|
+ "specId":63,
|
|
|
+ name:"一建规格属性0021",
|
|
|
+ "code":null,
|
|
|
+ "sort":null,
|
|
|
+ "status":1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "specAttributeId":118,
|
|
|
+ "specId":63,
|
|
|
+ name:"一建规格属性0022",
|
|
|
+ "code":null,
|
|
|
+ "sort":null,
|
|
|
+ "status":1
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ], // 规格列表
|
|
|
};
|
|
|
},
|
|
|
computed: { ...mapGetters(['userInfo','goodsAuditionConfigIdList','playSectionId','hideBuyState']) },
|
|
@@ -238,7 +332,7 @@ export default {
|
|
|
onShareAppMessage() {
|
|
|
return {
|
|
|
title: this.detail.goodsName,
|
|
|
- path: `/pages3/course/detail?id=` + this.id,
|
|
|
+ path: `/pages3/course/detail?id=` + this.id + '&goodsType=' + this.goodsType,
|
|
|
imageUrl: this.$method.splitImgHost(this.detail.coverUrl)
|
|
|
}
|
|
|
},
|
|
@@ -367,10 +461,8 @@ export default {
|
|
|
if(!item.down&&item.menuList.length==0){
|
|
|
this.getMenuList(item)
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
addShopCart() {
|
|
|
- let self = this
|
|
|
this.$api.addCart({goodsId:this.id}).then(res => {
|
|
|
if(res.data.code==200){
|
|
|
uni.setStorageSync('updateCart',1) //提醒刷新购物车
|
|
@@ -571,16 +663,60 @@ export default {
|
|
|
if(this.$method.isGoLogin()){
|
|
|
return
|
|
|
}
|
|
|
+ // 判断有没有规格选择
|
|
|
+ if (this.detail.specTemplateId) {
|
|
|
+ this.isCarOrBuy = 2
|
|
|
+ this.toggleSkuShow = true
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$navTo.togo('/pages2/order/confirm_list?id='+this.id);
|
|
|
},
|
|
|
addCart(){
|
|
|
+ // this.getSpecDetail()
|
|
|
+ this.toggleSkuShow = true
|
|
|
+ this.specList.forEach((item, index) => {
|
|
|
+ item.specAttrList.forEach((child) => {
|
|
|
+ child['check'] = false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ console.log('000', this.specList)
|
|
|
+ return
|
|
|
if(this.$method.isGoLogin()){
|
|
|
return
|
|
|
}
|
|
|
+ // 判断有没有规格选择
|
|
|
+ if (this.detail.specTemplateId) {
|
|
|
+ this.isCarOrBuy = 1
|
|
|
+ this.getSpecDetail()
|
|
|
+ return
|
|
|
+ }
|
|
|
this.addShopCart()
|
|
|
},
|
|
|
- open(item){
|
|
|
- item.showChildren = !item.showChildren
|
|
|
+ getSpecDetail() {
|
|
|
+ // ${this.detail.specTemplateId}
|
|
|
+ // 这里id到时候需要改回来
|
|
|
+ console.log('1111111111')
|
|
|
+ this.$http({
|
|
|
+ url: `/app/common/spec/28`,
|
|
|
+ method: 'get',
|
|
|
+ noToken: true
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.toggleSkuShow = true
|
|
|
+ let data = res.data.data
|
|
|
+ if (data) {
|
|
|
+ this.specList = data && (data.specList || [])
|
|
|
+ this.specList.forEach((item, index) => {
|
|
|
+ item.specAttrList.forEach((child) => {
|
|
|
+ child['check'] = false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ console.log('this.specList', this.specList)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$u.toast('暂无数据')
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
change(index){
|
|
|
this.current = index;
|
|
@@ -723,6 +859,26 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ closePop() {
|
|
|
+ this.toggleSkuShow = false
|
|
|
+ },
|
|
|
+ selectSku(item, index, c_index) {
|
|
|
+ console.log('defhd', item, index, c_index)
|
|
|
+ this.$set(this.specList[index].specAttrList[c_index], '')
|
|
|
+ // this.specList
|
|
|
+ // this.skuItem = item
|
|
|
+ // this.skuIndex = index
|
|
|
+ },
|
|
|
+ rightNowBuy() {
|
|
|
+ // if (Object.keys(this.skuItem).length == 0) {
|
|
|
+ // this.$u.toast('请选择科目')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if(this.$method.isGoLogin()){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // this.$navTo.togo('/pages2/order/confirm_list?id='+this.skuItem.goodsId)
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|