From 444f7a214506e26dce6b9e94a32e3eaea21fed85 Mon Sep 17 00:00:00 2001 From: hflllll Date: Thu, 8 May 2025 17:48:42 +0800 Subject: [PATCH] =?UTF-8?q?'2.2=E7=AC=AC=E4=BA=8C=E5=A4=A9=E8=81=94?= =?UTF-8?q?=E8=B0=83'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/model/my.js | 34 ++++++ api/model/order.js | 56 ++++++++++ components/order/OrderItem.vue | 24 ++--- config.js | 2 +- pages/index/cart.vue | 33 ++++-- pages/index/center.vue | 4 +- pages/index/order.vue | 82 ++++++++------ pages_order/auth/wxUserInfo.vue | 1 + pages_order/components/order/MemberFoodItem.vue | 86 +++++++-------- pages_order/components/order/placeOrder.vue | 37 ++++--- pages_order/location/pickupPoint.vue | 101 +++++++++-------- pages_order/mine/assets.vue | 48 +++++---- pages_order/mine/unbindTeam.vue | 12 ++- pages_order/mine/wallet.vue | 64 ++++++----- pages_order/order/groupMealDetail.vue | 71 +++++++++--- pages_order/order/newOrderDetail.vue | 138 ++++++++---------------- store/store.js | 8 +- utils/index.js | 5 +- 18 files changed, 483 insertions(+), 323 deletions(-) diff --git a/api/model/my.js b/api/model/my.js index 8751e23..ea47dfa 100644 --- a/api/model/my.js +++ b/api/model/my.js @@ -56,6 +56,40 @@ const api = { limit: '500' }, + // 我的-查询团长列表 + queryLeaderList : { + url: '/teambuy/leader/queryLeaderList', + method: 'POST', + limit: 500 + }, + + // 我的-查询团长列表(下单选择地址) + queryLeaderList: { + url: '/teambuy/leader/queryLeaderList', + method: 'GET', + limit: 500 + }, + + // 钱包-充值回调 + CashNotify: { + url: '/teambuy/amount/CashNotify', + method: 'POST', + limit: 500 + }, + + // 钱包-充值 + cashIn: { + url: '/teambuy/amount/cashIn', + method: 'POST', + limit: 500 + }, + + // 钱包- 收支明细 + queryAmountLog: { + url: '/teambuy/amount/queryAmountLog', + method: 'POST', + limit: 500 + } } diff --git a/api/model/order.js b/api/model/order.js index 5ed8254..18f88fe 100644 --- a/api/model/order.js +++ b/api/model/order.js @@ -54,6 +54,62 @@ const api = { url: '/teambuy/order/createOrder', method: 'POST', limit: 500 + }, + + // 订单-创建订单2 + createOrder2: { + url: '/teambuy/order/createOrder2', + method: 'POST', + limit: 500 + }, + + // 订单-修改团员订单状态 + updateMemberOrderById: { + url: '/teambuy/order/updateMemberOrderById', + method: 'POST', + limit: 500 + }, + + // 订单- 修改团长订单状态 + updateLeaderOrderById : { + url: '/teambuy/order/updateLeaderOrderById', + method: 'POST', + limit: 500 + }, + + // 订单-根据团餐id查询团团员订单列表 + queryLeaderOrderListById: { + url: '/teambuy/order/queryLeaderOrderListById', + method: 'GET', + limit: 500 + }, + + // 订单-团长完成全体取餐 + finishOrderAll: { + url: '/teambuy/order/finishOrderAll', + method: 'POST', + limit: 500 + }, + + // 订单-团长完成单体取餐 + finishOrderOne: { + url: '/teambuy/order/finishOrderOne', + method: 'POST', + limit: 500 + }, + + // 订单-团长通知全体取餐 + informOrderAll: { + url: '/teambuy/order/informOrderAll', + method: 'POST', + limit: 500 + }, + + // 订单-团长通知单个团员取餐 + informOrderOne: { + url: '/teambuy/order/informOrderOne', + method: 'POST', + limit: 500 } } diff --git a/components/order/OrderItem.vue b/components/order/OrderItem.vue index b1fb892..9b75e46 100644 --- a/components/order/OrderItem.vue +++ b/components/order/OrderItem.vue @@ -3,8 +3,8 @@ - - {{ order.shopName }} + + {{ order.title }} @@ -12,20 +12,20 @@ - - + + - 共{{ order.foodCount }}个 + 共{{ order.goodsList.length }}个 - 下单时间:{{ order.orderTime }} + 下单时间:{{ order.updateTime }} 合计: - ¥{{ order.totalPrice.toFixed(2) }} + ¥{{ order.priceAll }} @@ -52,7 +52,7 @@ 订单售后 - + 取餐完成 @@ -68,14 +68,6 @@ export default { type: Object, required: true, default: () => ({ - id: '', - shopName: '', - shopLogo: '', - foods: [], - foodCount: 0, - orderTime: '', - totalPrice: 0, - status: 'pending' // pending, processing, shipping, completed, delivered, canceled }) } }, diff --git a/config.js b/config.js index e15a57d..b02ca57 100644 --- a/config.js +++ b/config.js @@ -6,7 +6,7 @@ import uvUI from '@/uni_modules/uv-ui-tools' Vue.use(uvUI); // 当前环境 -const type = 'test' +const type = 'local' // 环境配置 diff --git a/pages/index/cart.vue b/pages/index/cart.vue index 77d7cce..79ddac0 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -49,9 +49,9 @@ 全选 - 已选{{ cartData.selectedCount }}个, + 已选{{ checkboxValue.length }}个, 合计 - ¥{{ (cartData.totalPrice).toFixed(1) }} + ¥{{ (totalPrice).toFixed(2) }} 添加收藏 @@ -84,7 +84,8 @@ export default { records: [] }, checkboxValue: [], - isManaged: false + isManaged: false, + } }, computed: { @@ -94,6 +95,14 @@ export default { // 全选的值 allCheckbox(){ return this.allSelected ? ['all'] : [] + }, + totalPrice(){ + return this.cartData.records.reduce((total, item) => { + if (this.checkboxValue.includes(item.id)){ + total += item.goods.price * item.num + } + return total + }, 0) } }, methods: { @@ -119,14 +128,16 @@ export default { // toggleSelect(item) { // this.updateCart(); // }, - // toggleSelectAll() { - // if (this.allSelected){ - // this.checkboxValue = [] - // }else{ - // this.checkboxValue = this.cartData.items.map(item => item.id) - // } - // this.updateCart(); - // }, + toggleSelectAll() { + console.log(111); + + if (this.allSelected){ + this.checkboxValue = [] + }else{ + this.checkboxValue = this.cartData.records.map(item => item.id) + } + // this.updateCart(); + }, increaseQuantity(item) { item.num += 1; this.modifyCart(item) diff --git a/pages/index/center.vue b/pages/index/center.vue index 6239de1..94ce1f1 100644 --- a/pages/index/center.vue +++ b/pages/index/center.vue @@ -230,8 +230,8 @@ export default { } }, onLoad (){ - // 进来加载的时候 会检查一次信息是否完整 若不完整 重新进入登录界面 - this.$store.commit('getUserInfo') + this.$store.commit('getUserInfo') + uni.setStorageSync('identity', 0) // 一开始的身份默认为团员 this.identity = uni.getStorageSync('identity') // 获取身份 } diff --git a/pages/index/order.vue b/pages/index/order.vue index c3eb11d..23fc557 100644 --- a/pages/index/order.vue +++ b/pages/index/order.vue @@ -19,9 +19,9 @@ - - {{ meal.name }} - 本单佣金合计: ¥{{meal.price}} + + {{ meal.title }} + 本单佣金合计: ¥{{ levelInfo.amount || '0.00' }} @@ -30,11 +30,11 @@ - + @pay="handlePayOrder" @click="goToOrderDetail(order)" /> - + @@ -119,7 +119,7 @@ import tabber from '@/components/base/tabbar.vue' import customerServicePopup from '@/components/config/customerServicePopup.vue' import OrderItem from '@/components/order/OrderItem.vue' - import { mockOrders, mockGroupMeals} from '@/static/js/mockOrders.js' + // import { mockOrders, mockGroupMeals} from '@/static/js/mockOrders.js' export default { mixins: [mixinsList, mixinsOrder], components: { @@ -155,32 +155,51 @@ 4: 'completed' // 已完成 }, current: 0, - mixinsListApi: 'queryLeaderOrderList', + // mixinsListApi: 'queryLeaderOrderList', orderList: [], + memberOrderList: [], + leaderOrderList: [], groupMeals: [], identity: uni.getStorageSync('identity') } }, onLoad(args) { + // console.log(6666); - if (args.status) { - // 因为传过来的是状态 所以需要 遍历Map找到下标 - for (const key in this.statusMap) { - if (this.statusMap[key] === args.status) { - this.current = Number(key) - break - } - } - this.clickTabs({ - index: this.current - }) - } + // console.log('222',this.$store.state.levelInfo); + + // if (args.status) { + // // 因为传过来的是状态 所以需要 遍历Map找到下标 + // for (const key in this.statusMap) { + // if (this.statusMap[key] === args.status) { + // this.current = Number(key) + // break + // } + // } + // this.clickTabs({ + // index: this.current + // }) + // } // 加载模拟订单数据 - this.loadMockOrders() - this.filterOrdersByStatus(this.current) + // this.loadMockOrders() + // this.filterOrdersByStatus(this.current) + this.getData() }, methods: { + getData() { + this.$api('queryMemberOrderList', {}, res => { + if (res.code == 200) { + this.memberOrderList = res.result.records + } + }) + this.$api('queryLeaderOrderList', {}, res => { + if (res.code == 200) { + this.leaderOrderList = res.result.records + + } + }) + }, //点击tab栏 clickTabs({ index @@ -192,7 +211,7 @@ } // 关闭请求 // this.getData() - console.log('点击了tab栏', index); + // console.log('点击了tab栏', index); // 模拟根据状态筛选订单 this.filterOrdersByStatus(index) @@ -205,7 +224,7 @@ }) } else { this.$utils.navigateTo({ - url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status + url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status_dictText }) } }, @@ -215,11 +234,6 @@ url: '/pages_order/order/groupMealDetail?id=' + meal.id + '&status=' + meal.status }) }, - // 加载模拟订单数据 - loadMockOrders() { - this.orderList = mockOrders - this.groupMeals = mockGroupMeals - }, // 根据状态筛选订单 filterOrdersByStatus(index) { this.loadMockOrders() // 先重置数据 @@ -304,9 +318,13 @@ confirmColor: '#019245', success: (res) => { if (res.confirm) { - order.status = 'completed', - this.clickTabs({ - index: 3 + // order.status_dictText = '已完成', + this.$api('updateMemberOrderStatus', { id: order.id, status: 3 }, res => { + if (res.code === 200) { + this.clickTabs({ + index: 3 + }) + } }) uni.showToast({ title: '取餐完成', diff --git a/pages_order/auth/wxUserInfo.vue b/pages_order/auth/wxUserInfo.vue index e33fbd9..fc62b53 100644 --- a/pages_order/auth/wxUserInfo.vue +++ b/pages_order/auth/wxUserInfo.vue @@ -143,6 +143,7 @@ phone : self.userInfoForm.phone, }, res => { if (res.code == 200) { + this.$store.commit('getUserInfo') uni.reLaunch({ url:'/pages/index/category' }) diff --git a/pages_order/components/order/MemberFoodItem.vue b/pages_order/components/order/MemberFoodItem.vue index 238e644..4a33c5e 100644 --- a/pages_order/components/order/MemberFoodItem.vue +++ b/pages_order/components/order/MemberFoodItem.vue @@ -3,19 +3,19 @@ - + - {{ member.name }} + {{ member.hanHaiMember.nickName }} {{ isExpanded ? '收起餐点' : '查看餐点' }} - + 通知取餐 - + 完成取餐 @@ -23,20 +23,20 @@ - + - + - {{ food.name }} + {{ food.goods.title }} - 已售出 {{ food.sold }}单 + 已售出 {{ food.goods.sales }}单 - ¥ {{ food.price.toFixed(1) }} + ¥ {{ food.goods.price.toFixed(2) }} - ×{{ food.quantity }} + ×{{ food.num }} @@ -61,7 +61,7 @@ export default { // 从父页面获取的订单状态 status: { type: String, - default: 'processing' + default: '0' } }, data() { @@ -84,41 +84,43 @@ export default { }); }, sendNotice() { + this.$emit('sendNotice') // 模拟通知体验 - setTimeout(() => { - uni.showLoading({ - title: '通知中...', - icon: 'loading', - duration: 2000 - }) - setTimeout(() => { - uni.hideLoading() - uni.showToast({ - title: '通知成功', - icon: 'success', - duration: 2000 - }) - }, 1200) - }, 200) + // setTimeout(() => { + // uni.showLoading({ + // title: '通知中...', + // icon: 'loading', + // duration: 2000 + // }) + // setTimeout(() => { + // uni.hideLoading() + // uni.showToast({ + // title: '通知成功', + // icon: 'success', + // duration: 2000 + // }) + // }, 1200) + // }, 200) // 这里存放通知函数的逻辑.... }, - completeSend() { + completeOrder() { + this.$emit('completeOrder') // 模拟体验 - setTimeout(() => { - uni.showLoading({ - title: '请稍等...', - icon: 'loading', - duration: 2000 - }) - setTimeout(() => { - uni.hideLoading() - uni.showToast({ - title: '已完成', - icon: 'success', - duration: 2000 - }) - }, 1200) - }, 200) + // setTimeout(() => { + // uni.showLoading({ + // title: '请稍等...', + // icon: 'loading', + // duration: 2000 + // }) + // setTimeout(() => { + // uni.hideLoading() + // uni.showToast({ + // title: '已完成', + // icon: 'success', + // duration: 2000 + // }) + // }, 1200) + // }, 200) // 这里执行函数逻辑 } } diff --git a/pages_order/components/order/placeOrder.vue b/pages_order/components/order/placeOrder.vue index 1d9881f..45acd87 100644 --- a/pages_order/components/order/placeOrder.vue +++ b/pages_order/components/order/placeOrder.vue @@ -23,7 +23,7 @@ {{ pickupPoint.name }},{{ pickupPoint.phone }} - {{ pickupPoint.address }} + {{ pickupPoint.area }} {{ pickupPoint.address }} @@ -120,8 +120,11 @@ export default { } }, computed: { - priceAll(){ + priceAll () { return this.item.price * this.value + }, + goodss () { + return `${this.item.id},${this.value},${this.priceAll};` } }, methods: { @@ -157,33 +160,43 @@ export default { // 创建订单 createOrder(){ + uni.showLoading({ + title: '下单中...' + }) this.$api('createOrder', { priceAll: this.priceAll, pricePay: this.priceAll - 0, pricePreferential: 0, payType: this.payMethod, + leaderId: this.pickupPoint.id, + goodss: this.goodss }, res => { + uni.hideLoading() if (res.code === 200) { - - uni.requestPaymentWxPay(res) - .then(e => { - uni.showToast({ - title: '下单成功', - icon: 'none' - }) - - // this.paySuccess(res) - }).catch(n => { + if (this.payMethod == '0') { + uni.requestPaymentWxPay(res) + .catch(n => { setTimeout(uni.redirectTo, 700, { url: '/pages/index/order' }) }) + }else { + uni.showToast({ + title: '下单成功', + icon: 'success' + }) + setTimeout(uni.redirectTo, 700, { + url: '/pages/index/order' + }) + } } }) } }, mounted(){ this.listenPickupPoint(); + // console.log(props.item); + }, beforeDestroy() { uni.$off('updatePickupPoint'); diff --git a/pages_order/location/pickupPoint.vue b/pages_order/location/pickupPoint.vue index 4976531..a2ca5b2 100644 --- a/pages_order/location/pickupPoint.vue +++ b/pages_order/location/pickupPoint.vue @@ -1,40 +1,40 @@ diff --git a/pages_order/mine/assets.vue b/pages_order/mine/assets.vue index 1317ec2..3a5773e 100644 --- a/pages_order/mine/assets.vue +++ b/pages_order/mine/assets.vue @@ -24,15 +24,15 @@ - + - {{ item.type }} - {{ item.time }} + {{ item.title }} + {{ item.createTime }} @@ -45,7 +45,7 @@ diff --git a/pages_order/mine/unbindTeam.vue b/pages_order/mine/unbindTeam.vue index fe1d53d..76ac49b 100644 --- a/pages_order/mine/unbindTeam.vue +++ b/pages_order/mine/unbindTeam.vue @@ -44,15 +44,15 @@ - + - {{ item.name }} + {{ item.spotName }} - {{ item.address }} + {{ item.area }} @@ -114,7 +114,11 @@ export default { }, onLoad() { this.currentPickupPoint = currentPickupPoint - this.nearbyPickupPoints = nearbyPickupPoints + this.$api('queryLeaderList', {}, res => { + if (res.code == 200){ + this.nearbyPickupPoints = res.result.records + } + }) } } diff --git a/pages_order/mine/wallet.vue b/pages_order/mine/wallet.vue index 61e1b4f..ab3bc0f 100644 --- a/pages_order/mine/wallet.vue +++ b/pages_order/mine/wallet.vue @@ -7,7 +7,7 @@ 总余额(元) - {{ walletData.balance.toFixed(2) }} + {{ userInfo.balance.toFixed(2) }} 去充值 @@ -29,7 +29,7 @@ ¥ - @@ -180,21 +180,21 @@ export default { }) // 模拟提交过程 - setTimeout(() => { - uni.hideLoading() - uni.showToast({ - title: '提现申请已提交', - icon: 'success' - }) - - // 模拟余额变更 - this.walletData.balance -= parseFloat(this.withdrawAmount) - // 清空表单 - this.withdrawAmount = '' - this.realName = '' + // setTimeout(() => { + // uni.hideLoading() + // uni.showToast({ + // title: '提现申请已提交', + // icon: 'success' + // }) + + // // 模拟余额变更 + // this.walletData.balance -= parseFloat(this.withdrawAmount) + // // 清空表单 + // this.withdrawAmount = '' + // this.realName = '' - this.isFormValid = true - }, 1500) + // this.isFormValid = true + // }, 1500) }, recharge() { @@ -208,21 +208,27 @@ export default { uni.showLoading({ title: '充值中...' }) - // 执行重置逻辑 - // 模拟重置时间 - setTimeout(() => { + this.$api('cashIn', { amount: this.rechargeAmount } , res => { uni.hideLoading() - uni.showToast({ - title: '充值成功', - icon: 'success' - }) - // 模拟余额变更 - this.walletData.balance += parseFloat(this.rechargeAmount) - // 重置表单 - this.rechargeAmount = '' - this.isRecharge = false - }, 1500) + if (res.code === 200) { + uni.requestPaymentWxPay(res) + .catch(() => { + this.userInfo.balance += parseFloat(this.rechargeAmount) + this.rechargeAmount = '' + this.isRecharge = false + }) + } + }) + + // 模拟重置时间 + // setTimeout(() => { + // // 模拟余额变更 + // this.walletData.balance += parseFloat(this.rechargeAmount) + // // 重置表单 + // this.rechargeAmount = '' + // this.isRecharge = false + // }, 1500) } }, fail: (err) => { diff --git a/pages_order/order/groupMealDetail.vue b/pages_order/order/groupMealDetail.vue index 62a8007..bba08b4 100644 --- a/pages_order/order/groupMealDetail.vue +++ b/pages_order/order/groupMealDetail.vue @@ -5,6 +5,9 @@ bgColor="#019245" color="#fff" /> + + + @@ -12,14 +15,16 @@ v-for="(member, index) in members" :key="index" :member="member" - :status="mealInfo.status" + :status="status" :default-expanded="index === defaultExpandedIndex" @toggle="handleMemberToggle" + @sendNotice="handleSend(member)" + @completeOrder="handleComplete(member)" /> - + @@ -27,8 +32,8 @@