超V课程
This commit is contained in:
@@ -16,10 +16,10 @@
|
||||
<u-icon name="bag" color="#fff" size="28"></u-icon>
|
||||
<text>立即购买</text>
|
||||
</view>
|
||||
<!-- <view class="saveBtnss gouwuche flexbox" @click="oprate('gouwuche')">
|
||||
<view class="saveBtnss gouwuche flexbox" @click="oprate('gouwuche')">
|
||||
<uni-icons type="cart" size="28" style="color: #666;"></uni-icons>
|
||||
<text>加入购物车</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
@@ -517,6 +517,13 @@
|
||||
"navigationBarTitleText": "健康超市",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/course/vipCourse",
|
||||
"style": {
|
||||
"navigationBarTitleText": "超V课程",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
@@ -7,11 +7,7 @@
|
||||
<u-alert
|
||||
v-if=""
|
||||
style="
|
||||
|
||||
position: fixed;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
"
|
||||
:title="goBuyTitle"
|
||||
type="warning"
|
||||
@@ -106,6 +102,7 @@
|
||||
proPriceList:[],
|
||||
pricespop:false,
|
||||
userMsg:{},
|
||||
cartList:[]
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
@@ -137,14 +134,111 @@
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
// 获取购物车数据
|
||||
addCart(val){
|
||||
console.log(val)
|
||||
if (val.productStock == 0) {
|
||||
uni.showToast({
|
||||
title: '商品库存不足',
|
||||
icon: "none"
|
||||
});
|
||||
} else {
|
||||
console.log(this.userInfo, '222')
|
||||
this.$http
|
||||
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
|
||||
.then(res => {
|
||||
// console.log(
|
||||
this.cartList = res.cartList
|
||||
this.isAddLink(val)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 加入到购物车
|
||||
isAddLink(item) {
|
||||
// 统计商品信息
|
||||
let data = {
|
||||
"userId": this.userInfo.id,
|
||||
"productId": item.productId,
|
||||
"productAmount": this.productAmount,
|
||||
"price": item.price
|
||||
}
|
||||
// 判断列表是否为空
|
||||
if (this.cartList.length > 0) {
|
||||
let flag = ''
|
||||
let shagnpin = {}
|
||||
// 循环购物车列表
|
||||
flag = this.cartList.some((item, index) => {
|
||||
if (item.productId == data.productId) {
|
||||
shagnpin = item
|
||||
shagnpin.productAmount += 1
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (flag) {
|
||||
// 已在购物车中添加
|
||||
$http.request({
|
||||
url: "book/ordercart/update",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: shagnpin,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.upoShow = false
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 加入购物车
|
||||
$http.request({
|
||||
url: "book/ordercart/save",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.upoShow = false
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
// 购物车列表为空时直接加入购物车
|
||||
$http.request({
|
||||
url: "book/ordercart/save",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
oprate(data){
|
||||
console.log(data,'得到的内容')
|
||||
if(data.name == 'buy'){
|
||||
this.buy(data.item)
|
||||
}
|
||||
// else if(data.name == 'gouwuche'){
|
||||
// this.addCart(data.item)
|
||||
// }
|
||||
else if(data.name == 'gouwuche'){
|
||||
this.addCart(data.item)
|
||||
}
|
||||
},
|
||||
buy(val){
|
||||
var mynavData = JSON.stringify({
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
</view>
|
||||
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
|
||||
<view class="imgcontainer" @click="onPageJump('/pages/course/myCourseLearn',item.id)">
|
||||
<image :src="item.image" mode="aspectFit"></image>
|
||||
<image v-if="item.image && item.image != ''" :src="item.image" mode="aspectFit"></image>
|
||||
<!-- <image :src="item.image" mode="" @click="goDetail(item.productId)"></image> -->
|
||||
<!-- <image v-else src="/static/nobg.jpg" mode="widthFix"></image> -->
|
||||
</view>
|
||||
<view class="buyItems">
|
||||
<view class="txt555">
|
||||
@@ -300,7 +302,7 @@
|
||||
.then(res => {
|
||||
// console.log(
|
||||
this.cartList = res.cartList
|
||||
// this.isAddLink(val)
|
||||
this.isAddLink(val)
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -321,7 +323,7 @@
|
||||
flag = this.cartList.some((item, index) => {
|
||||
if (item.productId == data.productId) {
|
||||
shagnpin = item
|
||||
shagnpin.productAmount = item.productAmount + 1
|
||||
shagnpin.productAmount += 1
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<z-nav-bar :title="pageTitle"></z-nav-bar>
|
||||
<z-nav-bar title="超V专享课程"></z-nav-bar>
|
||||
<view class="learnBox box" >
|
||||
<view class="newBox">
|
||||
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" @click="onPageJump('/pages/course/courseDetail',item.id, item.title)">
|
||||
@@ -102,10 +102,9 @@
|
||||
this.status = 1
|
||||
this.flag = false
|
||||
$http.request({
|
||||
url: "medical/home/getMarketCourseList",
|
||||
url: "medical/course/getCourseByVip",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
"id": this.tagId,
|
||||
"limit": 12,
|
||||
"page": this.page
|
||||
},
|
||||
@@ -115,10 +114,10 @@
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.courseList.records.length > 0) {
|
||||
var list = res.courseList.records
|
||||
if (res.data.records.length > 0) {
|
||||
var list = res.data.records
|
||||
this.courseList = this.courseList.concat(list)
|
||||
if(res.courseList.pages > this.page){
|
||||
if(res.data.pages > this.page){
|
||||
this.status = 0
|
||||
}else{
|
||||
this.status = 2
|
||||
|
||||
@@ -59,8 +59,10 @@
|
||||
class="curriulum_title_box goods_item"
|
||||
v-for="(v, i) in goodsDataList"
|
||||
>
|
||||
<image class="goods_item_img" :src="v.productImages" mode="aspectFit">
|
||||
|
||||
<image v-if="v.productImages && v.productImages != ''" class="goods_item_img" :src="v.productImages" mode="aspectFit">
|
||||
</image>
|
||||
<image v-else src="/static/nobg1.jpg" mode="widthFix" @click="goDetail(item.productId)"></image>
|
||||
<view class="normal_box">
|
||||
<view class="normal_box_top" style="justify-content: space-between">
|
||||
<view class="curriulum_title">{{ v.productName }} </view>
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<image src="../../static/my_02.png" mode="aspectFit"></image>
|
||||
<text>我的课程</text>
|
||||
</div>
|
||||
<!-- <div class="item flexbox" @click="onPageJump()">
|
||||
<image src="../../static/my_03.png" mode="aspectFit"></image>
|
||||
<div class="item flexbox" @click="onPageJump('/pages/course/vipCourse')">
|
||||
<image src="../../static/my_06.png" mode="aspectFit"></image>
|
||||
<text>超V专享</text>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <div class="item flexbox" @click="onPageJump()">
|
||||
<image src="../../static/my_03.png" mode="aspectFit"></image>
|
||||
<text>太湖讲堂</text>
|
||||
@@ -1387,20 +1387,20 @@
|
||||
|
||||
.hn_cl_tit.active {
|
||||
background-color: #e4eefa;
|
||||
position: relative;
|
||||
// position: relative;
|
||||
text {
|
||||
color: #3361a5;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.hn_cl_tit.active::after{
|
||||
display: block;
|
||||
transform: rotate(180deg);
|
||||
content: ''; position: absolute; bottom: -20rpx; left: calc(50% - 16rpx); z-index: 1;
|
||||
border-right: 20rpx solid transparent;
|
||||
border-left: 20rpx solid transparent;
|
||||
border-bottom: 20rpx solid #ffff;
|
||||
}
|
||||
// .hn_cl_tit.active::after{
|
||||
// display: block;
|
||||
// transform: rotate(180deg);
|
||||
// content: ''; position: absolute; bottom: -20rpx; left: calc(50% - 16rpx); z-index: 1;
|
||||
// border-right: 20rpx solid transparent;
|
||||
// border-left: 20rpx solid transparent;
|
||||
// border-bottom: 20rpx solid #ffff;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
class="round checkedItem" />
|
||||
</view>
|
||||
<view class="cartContent">
|
||||
<image :src="item.image" mode="" @click="goDetail(item.productId)"></image>
|
||||
<image v-if="item.image && item.image != ''" :src="item.image" mode="" @click="goDetail(item.productId)"></image>
|
||||
<image v-else src="/static/nobg1.jpg" mode="widthFix" @click="goDetail(item.productId)"></image>
|
||||
<view class="itemCenter">
|
||||
<view class="cartTitle" @click="goDetail(item.productId)">
|
||||
<text>{{item.productName}}</text>
|
||||
|
||||
BIN
static/my_06.png
Normal file
BIN
static/my_06.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
BIN
static/nobg1.jpg
Normal file
BIN
static/nobg1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user