添加吴门医述
This commit is contained in:
@@ -108,7 +108,7 @@
|
||||
</view>
|
||||
<view class="buyItems">
|
||||
<view class="txt555" @click="onPageJump('/pages/course/courseDetail',item.id)">
|
||||
{{item.title}}
|
||||
{{item.title}}-{{item.catalogueTitle}}
|
||||
</view>
|
||||
<view class="jianjie" v-html="item.content">
|
||||
|
||||
@@ -215,7 +215,8 @@
|
||||
page: 1,
|
||||
flag: false
|
||||
},
|
||||
oldValue : ''
|
||||
oldValue : '',
|
||||
cartList:[]
|
||||
|
||||
};
|
||||
},
|
||||
@@ -286,8 +287,101 @@
|
||||
}
|
||||
},
|
||||
// 购物车
|
||||
addCart(){
|
||||
|
||||
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 = item.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,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 直接购买
|
||||
buy(val){
|
||||
@@ -464,7 +558,7 @@
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.code == 0 && res.courseList != null) {
|
||||
if (res.courseList.length > 0) {
|
||||
this.ExpiredCourseList.list = res.courseList
|
||||
// if (res.courseList.pages > this.ExpiredCourseList.page) {
|
||||
@@ -475,7 +569,9 @@
|
||||
} else {
|
||||
this.ExpiredCourseList.status = 3 // 暂无数据
|
||||
}
|
||||
console.log('status', this.ExpiredCourseList.status)
|
||||
console.log('status-------------------', this.ExpiredCourseList.status)
|
||||
}else{
|
||||
this.ExpiredCourseList.status = 3 // 暂无数据
|
||||
}
|
||||
// this.ExpiredCourseList.flag = false
|
||||
}).catch(e => {
|
||||
@@ -571,7 +667,7 @@
|
||||
url: "sociology/product/getProductListForCourse",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
"id": val.id
|
||||
"id": val.catalogueId
|
||||
},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
@@ -593,11 +689,7 @@
|
||||
|
||||
this.pricespop = true
|
||||
|
||||
},
|
||||
// 获取续费商品
|
||||
getCourseProList(){
|
||||
|
||||
},
|
||||
},
|
||||
// 跳转
|
||||
onPageJump(url, id) {
|
||||
uni.navigateTo({
|
||||
|
||||
Reference in New Issue
Block a user