diff --git a/api/model/index.js b/api/model/index.js index 25b9571..04628a2 100644 --- a/api/model/index.js +++ b/api/model/index.js @@ -13,6 +13,12 @@ const api = { method: 'GET', limit: 500, }, + // 商品信息- 查询商品信息详情 + queryGoodsById: { + url: '/teambuy/goods/queryGoodsById', + method: 'GET', + limit: 500, + }, } export default api \ No newline at end of file diff --git a/api/model/login.js b/api/model/login.js index 149ee49..3413dd6 100644 --- a/api/model/login.js +++ b/api/model/login.js @@ -14,8 +14,8 @@ const api = { // auth: true, }, // 修改个人信息接口 - updateInfo: { - url: '/info_common/updateInfo', + updateUser: { + url: '/teambuy/userInfo/updateUser', method: 'POST', limit: 500, showLoading: true, @@ -23,7 +23,7 @@ const api = { }, // 获取个人信息 getInfo: { - url: '/info_common/getInfo', + url: '/teambuy/userInfo/queryUser', method: 'GET', // auth: true, }, diff --git a/api/model/my.js b/api/model/my.js index 73649fa..8751e23 100644 --- a/api/model/my.js +++ b/api/model/my.js @@ -7,6 +7,56 @@ const api = { method: 'POST', limit: 500 }, + + // 我的-获取个人中心基础数据信息 + getUserCenterData: { + url: '/teambuy/userInfo/getUserCenterData', + method: 'GET', + limit: 500 + }, + + // 我的-查看个人信息 + queryUser: { + url: '/teambuy/userInfo/queryUser', + method: 'GET', + limit: 500 + }, + + // 我的-修改个人信息 + // updateUser: { + // url: '/teambuy/userInfo/updateUser', + // method: 'POST' + // }, + + // 我的-团长申请 + addLeader: { + url: '/teambuy/leader/addLeader', + method: 'POST', + limit: 500 + }, + + // 我的- 解绑团长 + deleteLeader: { + url: '/teambuy/leader/deleteLeader', + method: 'POST', + limit: 500 + }, + + // 我的-查询团长列表 + queryLeaderList: { + url: '/teambuy/leader/queryLeaderList', + method: 'POST', + limit: 500 + }, + + // 我的-更换团长 + updateLeader: { + url: '/teambuy/leader/updateLeader', + method: 'POST', + limit: '500' + }, + + } export default api \ No newline at end of file diff --git a/api/model/order.js b/api/model/order.js index 51e90b8..5ed8254 100644 --- a/api/model/order.js +++ b/api/model/order.js @@ -7,6 +7,7 @@ const api = { method: 'GET', limit: 500, }, + // 订单-查看优惠券列表-详情 queryCouponList: { url: '/teambuy/coupon/queryCouponList', @@ -19,19 +20,41 @@ const api = { method: 'GET', limit: 500 }, + // 订单-查看团员订单列表-详情 queryMemberOrderList: { url: '/teambuy/order/queryMemberOrderList', method: 'GET', limit: 500 }, + // 订单-查看购物车列表-详情 queryShopcarList: { url: '/teambuy/shopcar/queryShopcarList', method: 'GET', limit: 500 + }, + + // 订单-购物车-添加购物车 + addShopcar: { + url: '/teambuy/shopcar/addShopcar', + method: 'POST', + limit: 500 + }, + + // 订单-支付订单 + payOrder: { + url: '/teambuy/order/payOrder', + method: 'POST', + limit: 500 + }, + + // 订单- 创建订单 + createOrder: { + url: '/teambuy/order/createOrder', + method: 'POST', + limit: 500 } - } export default api \ No newline at end of file diff --git a/components/product/productItem.vue b/components/product/productItem.vue index aaaea0c..d157f7f 100644 --- a/components/product/productItem.vue +++ b/components/product/productItem.vue @@ -5,7 +5,7 @@ - + @@ -13,7 +13,7 @@ - 豆角炒鸡蛋 + {{ item.title }} @@ -98,13 +98,13 @@ - 已售出{{ item.payNum }}单 + 已售出{{ item.sales }}单 - 9.9 + {{ item.price }} @@ -140,6 +140,9 @@ return { } }, + mounted() { + console.log('商品项数据:', this.item); + }, methods: { // 购买商品(创建订单) purchase(id) { @@ -157,14 +160,19 @@ }, // 加入购物车 addCart(item){ - this.$api('addCart', { - shopId : item.id, + uni.showLoading({ + title: '加载中...' + }) + this.$api('addShopcar', { + goodsId : item.id, num : 1, }, res => { + uni.hideLoading() if(res.code == 200){ uni.showToast({ title: '加入购物车成功', - icon: 'none' + icon: 'none', + duration: 1000 }) } }) @@ -177,6 +185,9 @@ return price >= 0 ? price : item.price } + }, + onload() { + console.log(props.item); } } diff --git a/config.js b/config.js index 9c07f7d..b02ca57 100644 --- a/config.js +++ b/config.js @@ -6,13 +6,13 @@ import uvUI from '@/uni_modules/uv-ui-tools' Vue.use(uvUI); // 当前环境 -const type = 'test' +const type = 'local' // 环境配置 const config = { local : { - baseUrl: 'http://127.0.0.1:8001/jewelry-admin', + baseUrl: 'http://augcl.natapp1.cc/teambuy-api', }, dev: { baseUrl: 'http://h5.xzaiyp.top/jewelry-admin', diff --git a/mixins/list.js b/mixins/list.js index 23bb70e..8486d17 100644 --- a/mixins/list.js +++ b/mixins/list.js @@ -50,13 +50,20 @@ export default { if(!this.mixinsListApi){ return console.error('mixinsListApi 缺失'); } + uni.showLoading({ + title: '加载中...' + }) this.$api(this.mixinsListApi, query(this, queryParams), res => { uni.stopPullDownRefresh() + uni.hideLoading() if(res.code == 200){ success(res.result) // 更新列表数据 this[this.mixinsListKey || 'list'] = res.result.records || res.result + // 输出获得的分类列表 + console.log('这是你获得的分类商品',this.list); + // 更新总数 this.total = res.result.total || res.result.length // 调用数据加载完成的回调 diff --git a/pages/index/cart.vue b/pages/index/cart.vue index 9f06c7c..77d7cce 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -5,28 +5,28 @@ - + - + - {{ item.name }} + {{ item.goods.title }} - 已售出 {{ item.sold }}单 + 已售出 {{ item.goods.sales }}单 ¥ - {{ item.price.toFixed(1) }} + {{ item.goods.price }} - - {{ item.quantity }} + {{ item.num }} + @@ -36,7 +36,7 @@ - @@ -80,14 +80,16 @@ export default { }, data() { return { - cartData: mockCartData, + cartData: { + records: [] + }, checkboxValue: [], isManaged: false } }, computed: { allSelected() { - return this.cartData.items.every(item => this.checkboxValue.includes(item.id)) + return this.cartData.records.every(item => this.checkboxValue.includes(item.id)) }, // 全选的值 allCheckbox(){ @@ -99,41 +101,53 @@ export default { getCartData(){ this.$api('queryShopcarList', {}, res => { if (res.code == 200){ - console.log(res); + this.cartData = res.result + console.log(this.cartData); + } }) }, - toggleSelect(item) { - this.updateCart(); - }, - toggleSelectAll() { - if (this.allSelected){ - this.checkboxValue = [] - }else{ - this.checkboxValue = this.cartData.items.map(item => item.id) - } - this.updateCart(); - }, + modifyCart(item){ + this.$api('addShopcar', { + goodsId: item.goodsId, + id: item.id, + num: item.num + }, res => { + console.log(res); + }) + }, + // toggleSelect(item) { + // this.updateCart(); + // }, + // toggleSelectAll() { + // if (this.allSelected){ + // this.checkboxValue = [] + // }else{ + // this.checkboxValue = this.cartData.items.map(item => item.id) + // } + // this.updateCart(); + // }, increaseQuantity(item) { - item.quantity += 1; - this.updateCart(); + item.num += 1; + this.modifyCart(item) + // this.updateCart(); }, decreaseQuantity(item) { - if (item.quantity > 1) { - item.quantity -= 1; - this.updateCart(); + if (item.num > 1) { + item.num -= 1; + this.modifyCart(item) } }, updateCart() { - // 计算选中的商品数量 - this.cartData.selectedCount = this.checkboxValue.length; - // 计算总价 - this.cartData.totalPrice = this.cartData.items.reduce((total, item) => { - if (this.checkboxValue.includes(item.id)){ - total += item.price * item.quantity - } - return total - }, 0) + // // 计算选中的商品数量 + // this.cartData.selectedCount = this.checkboxValue.length; + // // 计算总价 + // this.cartData.totalPrice = this.cartData.items.reduce((total, item) => { + // if (this.checkboxValue.includes(item.id)){ + // total += item.price * item.quantity + // } + // return total + // }, 0) }, // 结账 checkout() { @@ -172,29 +186,29 @@ export default { }, 800) }, // 删除购物车 - deleteCart(){ - if (!this.checkboxValue.length) { - uni.showToast({ - title: '请选择商品', - icon: 'none' - }); + // deleteCart(){ + // if (!this.checkboxValue.length) { + // uni.showToast({ + // title: '请选择商品', + // icon: 'none' + // }); - return; - } - uni.showLoading({ - title: '删除中...' - }) - setTimeout(() => { - uni.hideLoading() - uni.showToast({ - title: '删除成功', - }) - this.cartData.items = this.cartData.items.filter(item => !this.checkboxValue.includes(item.id)) - this.checkboxValue = [] - this.updateCart() - // 编写删除函数的调用 - }, 800) - } + // return; + // } + // uni.showLoading({ + // title: '删除中...' + // }) + // setTimeout(() => { + // uni.hideLoading() + // uni.showToast({ + // title: '删除成功', + // }) + // this.cartData.items = this.cartData.items.filter(item => !this.checkboxValue.includes(item.id)) + // this.checkboxValue = [] + // this.updateCart() + // // 编写删除函数的调用 + // }, 800) + // } }, onLoad(){ this.getCartData() @@ -355,7 +369,7 @@ export default { .control-text{ position: absolute; right: 150rpx; - top: calc(env(safe-area-inset-bottom) + 60rpx); + top: calc(env(safe-area-inset-bottom) + 40rpx); font-size: 26rpx; color: #fff; z-index: 10000; diff --git a/pages/index/category.vue b/pages/index/category.vue index efdcd6c..24fbed6 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -60,10 +60,10 @@ - + @@ -112,9 +112,6 @@ export default { change(e) { // this.queryParams.classId = this.category[e].id this.currentChildren = e - console.log(this.currentChildren); - console.log(this.category[e].id); - // 重新加载数据 this.getData({ categoryId: this.category[e].id }) }, diff --git a/pages/index/center.vue b/pages/index/center.vue index d24eef1..6239de1 100644 --- a/pages/index/center.vue +++ b/pages/index/center.vue @@ -4,10 +4,10 @@ @@ -182,7 +182,7 @@