From 7018a5c242d8d02e7095449ce3e5d563f702c6f3 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Tue, 25 Jun 2024 13:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85V=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/buyPup.vue | 4 +- pages.json | 7 +++ pages/course/coursePrice.vue | 110 ++++++++++++++++++++++++++++++++--- pages/course/myCourse.vue | 8 ++- pages/course/vipCourse.vue | 13 ++--- pages/goods/order/index.vue | 4 +- pages/peanut/home.vue | 24 ++++---- pages/peanut/shopping.vue | 3 +- static/my_06.png | Bin 0 -> 7064 bytes static/nobg1.jpg | Bin 0 -> 1643 bytes 10 files changed, 139 insertions(+), 34 deletions(-) create mode 100644 static/my_06.png create mode 100644 static/nobg1.jpg diff --git a/components/buyPup.vue b/components/buyPup.vue index 43aa968..1204329 100644 --- a/components/buyPup.vue +++ b/components/buyPup.vue @@ -16,10 +16,10 @@ 立即购买 - + diff --git a/pages.json b/pages.json index 185e3ab..8036664 100644 --- a/pages.json +++ b/pages.json @@ -517,6 +517,13 @@ "navigationBarTitleText": "健康超市", "enablePullDownRefresh": false } + }, + { + "path": "pages/course/vipCourse", + "style": { + "navigationBarTitleText": "超V课程", + "enablePullDownRefresh": false + } } ], "globalStyle": { diff --git a/pages/course/coursePrice.vue b/pages/course/coursePrice.vue index 6ce4387..7fc80b9 100644 --- a/pages/course/coursePrice.vue +++ b/pages/course/coursePrice.vue @@ -7,11 +7,7 @@ { + // 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({ diff --git a/pages/course/myCourse.vue b/pages/course/myCourse.vue index a44e02c..6bf4f4f 100644 --- a/pages/course/myCourse.vue +++ b/pages/course/myCourse.vue @@ -37,7 +37,9 @@ - + + + @@ -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 } }) diff --git a/pages/course/vipCourse.vue b/pages/course/vipCourse.vue index e18a0c8..0d0ad07 100644 --- a/pages/course/vipCourse.vue +++ b/pages/course/vipCourse.vue @@ -2,7 +2,7 @@ - + @@ -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, + data: { "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 diff --git a/pages/goods/order/index.vue b/pages/goods/order/index.vue index 76e1900..b2e9681 100644 --- a/pages/goods/order/index.vue +++ b/pages/goods/order/index.vue @@ -59,8 +59,10 @@ class="curriulum_title_box goods_item" v-for="(v, i) in goodsDataList" > - + + + {{ v.productName }} diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue index 170b210..f1e42a7 100644 --- a/pages/peanut/home.vue +++ b/pages/peanut/home.vue @@ -22,10 +22,10 @@ 我的课程 - +