Browse Source

2.4 第四次联调

hfll
hflllll 1 month ago
parent
commit
3e6f503ba5
12 changed files with 253 additions and 238 deletions
  1. +2
    -2
      api/model/index.js
  2. +6
    -6
      api/model/order.js
  3. +14
    -19
      components/product/productItem.vue
  4. +1
    -1
      config.js
  5. +6
    -3
      mixins/list.js
  6. +1
    -3
      pages/index/cart.vue
  7. +34
    -41
      pages/index/category.vue
  8. +6
    -9
      pages/index/center.vue
  9. +151
    -150
      pages/index/order.vue
  10. +4
    -3
      pages_order/components/order/placeOrder.vue
  11. +26
    -0
      pages_order/order/groupMealDetail.vue
  12. +2
    -1
      pages_order/product/productDetail.vue

+ 2
- 2
api/model/index.js View File

@ -11,13 +11,13 @@ const api = {
queryGoodsList: {
url: '/teambuy/goods/queryGoodsList',
method: 'GET',
limit: 500,
limit: 500
},
// 商品信息- 查询商品信息详情
queryGoodsById: {
url: '/teambuy/goods/queryGoodsById',
method: 'GET',
limit: 500,
limit: 500
},
}

+ 6
- 6
api/model/order.js View File

@ -56,12 +56,12 @@ const api = {
limit: 500
},
// 订单-创建订单2
createOrder2: {
url: '/teambuy/order/createOrder2',
method: 'POST',
limit: 500
},
// // 订单-创建订单2
// createOrder2: {
// url: '/teambuy/order/createOrder2',
// method: 'POST',
// limit: 500
// },
// 订单-修改团员订单状态
updateMemberOrderById: {


+ 14
- 19
components/product/productItem.vue View File

@ -109,7 +109,7 @@
<!-- 购买按钮 -->
<view class="" style="display: flex;justify-content: space-between;">
<view @click.stop="purchase(item.id)" class="buy-btn buy-order">
<view @click.stop="purchase" class="buy-btn buy-order">
立即下单
</view>
@ -140,23 +140,21 @@
return {
}
},
mounted() {
console.log('商品项数据:', this.item);
},
methods: {
// ()
purchase(id) {
this.$api('getRiceProductDetail', {
id
}, res => {
if (res.code == 200) {
res.result.num = 1
this.$store.commit('setPayOrderProduct', [
res.result
])
this.$utils.navigateTo('/pages_order/order/createOrder')
}
})
purchase() {
// this.$api('createOrder', {
// id
// }, res => {
// if (res.code == 200) {
// res.result.num = 1
// this.$store.commit('setPayOrderProduct', [
// res.result
// ])
// this.$utils.navigateTo('/pages_order/order/createOrder')
// }
// })
this.$emit('purchase')
},
//
addCart(item){
@ -186,9 +184,6 @@
return price >= 0 ? price : item.price
}
},
onload() {
console.log(props.item);
}
}
</script>


+ 1
- 1
config.js View File

@ -6,7 +6,7 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);
// 当前环境
const type = 'local'
const type = 'test'
// 环境配置


+ 6
- 3
mixins/list.js View File

@ -24,7 +24,7 @@ export default {
pageSize: 10,
},
total : 0,
list : [],
list : []
}
},
// 下拉刷新
@ -36,9 +36,10 @@ export default {
this.loadMoreData()
},
// 页面显示时加载数据
onShow() {
onShow() {
this.getData()
},
// 去掉 方便在组件中再使用 方便 只读对应list
methods: {
/**
* 获取列表数据
@ -51,8 +52,10 @@ export default {
return console.error('mixinsListApi 缺失');
}
uni.showLoading({
title: '加载中...'
title: '加载列表中...'
})
console.log('6666', query(this, queryParams));
this.$api(this.mixinsListApi,
query(this, queryParams), res => {
uni.stopPullDownRefresh()


+ 1
- 3
pages/index/cart.vue View File

@ -111,8 +111,6 @@ export default {
this.$api('queryShopcarList', {}, res => {
if (res.code == 200){
this.cartData = res.result
console.log(this.cartData);
}
})
},
@ -221,7 +219,7 @@ export default {
// }, 800)
// }
},
onLoad(){
onShow(){
this.getCartData()
}
}


+ 34
- 41
pages/index/category.vue View File

@ -1,3 +1,5 @@
const DEFAULT_OPEN = 1
<template>
<view class="page">
<!-- 导航栏 -->
@ -5,7 +7,7 @@
<!-- 搜索栏 -->
<view class="search">
<image src="/static/image/logo.webp" mode="aspectFill" class="search-img" @tap="testUtiles" />
<image src="/static/image/logo.webp" mode="aspectFill" class="search-img" />
<view style="position: relative;">
<uv-search placeholder="陕西苹果" bgColor="#fff" @search="search" @change="search" @custom="search"
:searchIconSize="40" v-model="queryParams.title" height="75rpx" :showAction="false"
@ -48,22 +50,31 @@
<uv-vtabs-item>
<view class="category-item">
<!-- 这里加载更多数据需要你使用scroll-view 因为你的列表在uv-vtabs里面 -->
<scroll-view
scroll-y="true"
@scrolltolower="loadMoreData"
style="height: calc(100vh - 470rpx);">
<productItem :item="pro" v-for="(pro, i) in list" :key="i"
@tap="navigateToDetail(pro.id)" />
scroll-y="true"
@scrolltolower="loadMoreData"
style="height: calc(100vh - 470rpx);"
>
<productItem
:item="pro"
:key="i"
v-for="(pro, i) in list"
@tap="navigateToDetail(pro.id)"
@purchase="navigateToDetail(pro.id, true)"
/>
<view style="padding-top: 100rpx;">
<uv-empty v-if="list.length == 0" text="还没有菜品哦" />
</view>
</scroll-view>
</view>
</uv-vtabs-item>
</uv-vtabs>
<!-- <uv-empty v-if="list.length == 0" text="还没有呢" /> -->
</view>
<!-- tabbar -->
@ -91,35 +102,19 @@ export default {
data() {
return {
//
mixinsListApi: 'queryGoodsList',
current: 0,
currentChildren: 0,
mixinsListApi: '',
// current: 0,
currentChildren: 0
}
},
computed: {
...mapState(['category']),
},
onLoad({
search,
cid
}) {
//
// this.queryParams.test = 11111
},
methods: {
change(e) {
// this.queryParams.classId = this.category[e].id
this.currentChildren = e
//
this.getData({ categoryId: this.category[e].id })
},
clickTabs({ index }) {
this.current = index
this.currentChildren = 0
//
this.queryParams.categoryId = this.category[e].id
this.getData()
},
search() {
@ -129,21 +124,19 @@ export default {
this.queryParams.pageSize = 10
this.getData()
},
navigateToDetail(id) {
console.log('跳转到商品详情页:', id);
// uni.navigateTo({
// url: `/pages_order/product/productDetail?id=${id}`
// })
this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}`);
},
testUtiles() {
try{
this.$authorize('scope.userLocation')
}catch(error){
console.log(error);
}
navigateToDetail(id, open) {
// console.log('open?:', open);
this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}&open=${open}`);
}
},
onShow() {
this.mixinsListApi = 'queryGoodsList'
this.queryParams.categoryId = this.category[this.currentChildren].id
this.getData()
},
onHide() {
this.mixinsListApi = ''
}
}
</script>


+ 6
- 9
pages/index/center.vue View File

@ -13,7 +13,7 @@
<view class="role-switch-btn" @tap="switchIdentity">
<uv-icon name="reload" size="30rpx" color="#fff" style="margin-right: 6rpx;" />
<text>切换为{{ !identity ? '团长' : '团员'}}</text>
<text>切换为{{ identity ? '团员' : '团长'}}</text>
</view>
</view>
@ -193,7 +193,7 @@ export default {
data() {
return {
// userInfo: mockUserInfo,
identity: 0
identity: uni.getStorageSync('identity') || 0
}
},
methods: {
@ -205,7 +205,7 @@ export default {
switchIdentity() {
uni.showModal({
title: '提示',
content: `确定要切换为${this.identity === 0 ? '团长' : '团员'}吗?`,
content: `确定要切换为${this.identity ? '团员' : '团长'}吗?`,
confirmColor: '#019245',
// cancelColor: '#FF2A2A',
success: (res) => {
@ -216,24 +216,21 @@ export default {
})
setTimeout(() => {
uni.hideLoading();
this.identity = this.identity === 0 ? 1 : 0;
this.identity = this.identity ? 0 : 1;
uni.setStorageSync('identity', this.identity)
uni.showToast({
title: '切换成功',
icon: 'success',
duration: 2000
})
}, 1000);
}, 500);
}
}
})
}
},
onLoad (){
onLoad() {
this.$store.commit('getUserInfo')
uni.setStorageSync('identity', 0) //
this.identity = uni.getStorageSync('identity') //
}
}
</script>


+ 151
- 150
pages/index/order.vue View File

@ -6,35 +6,38 @@
<!-- 搜索框 -->
<view style="background-color: #fff; padding: 12rpx 20rpx 0rpx; ">
<uv-search placeholder="搜索商品名" v-model="keyword" :showAction="false" actionText="" height="80rpx" animation
bgColor="#F5F5F5" inputAlign="center" color="#000" placeholderColor="#979797"
searchIconSize="50rpx"></uv-search>
bgColor="#F5F5F5" inputAlign="center" color="#000" placeholderColor="#979797"
searchIconSize="50rpx"></uv-search>
</view>
<!-- 订单筛选 -->
<view class="tabs">
<uv-tabs :list="tabs" :activeStyle="{ color: '#019245'}" lineColor="#019245" :scrollable="false"
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current"
@click="clickTabs" />
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current"
@click="clickTabs" />
</view>
<!-- 团餐列表 -->
<view class="group-meal-list" v-if="identity">
<view class="meal-item" v-for="(meal, index) in leaderOrderList" :key="meal.id">
<view class="meal-item" v-for="(meal, index) in mealList" :key="meal.id">
<view class="meal-name">{{ meal.title }}</view>
<view class="meal-price">本单佣金合计: <text class="price-value">¥{{ levelInfo.amount || '0.00' }}</text></view>
<view class="meal-price">本单佣金合计: <text class="price-value">¥{{ levelInfo.amount || '0.00' }}</text>
</view>
<view class="meal-action">
<button class="order-btn" @tap="viewOrder(meal)">查看订单</button>
</view>
</view>
<view style="margin-top: 200rpx; min-width: 700rpx;">
<uv-empty mode="order" v-if="mealList.length == 0" />
</view>
</view>
<!-- 订单列表 -->
<view class="order-list" v-else>
<OrderItem v-for="(order, index) in memberOrderList" :key="order.id" :order="order" @cancel="handleCancelOrder"
@pick="handlePickOrder"
@pay="handlePayOrder" @click="goToOrderDetail(order)" />
<OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" @cancel="handleCancelOrder"
@pick="handlePickOrder" @pay="handlePayOrder" @click="goToOrderDetail(order)" />
<view style="margin-top: 200rpx; min-width: 700rpx;">
<uv-empty mode="order" v-if="memberOrderList.length == 0"></uv-empty>
<uv-empty mode="order" v-if="orderList.length == 0" />
</view>
</view>
@ -119,7 +122,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'
export default {
mixins: [mixinsList, mixinsOrder],
components: {
@ -127,11 +130,21 @@
customerServicePopup,
OrderItem
},
computed: {},
computed: {
orderList() {
return this.memberOrderList.filter(order => order.status == this.current)
},
mealList() {
return this.leaderOrderList.filter(order => order.status == this.current)
},
tabs() {
return this.identity ? this.tabMeal : this.tabOrder
}
},
data() {
return {
keyword: '',
tabs: [{
tabOrder: [{
name: '待支付'
},
{
@ -147,58 +160,50 @@
name: '已完成'
}
],
statusMap: {
0: 'pending', //
1: 'processing', //
2: 'shipping', //
3: 'delivered', //
4: 'completed' //
tabMeal: [{
name: '待出餐'
},
{
name: '已出餐'
},
{
name: '待取餐'
},
{
name: '已完成'
}
],
current: 0,
// mixinsListApi: 'queryLeaderOrderList',
orderList: [],
memberOrderList: [],
leaderOrderList: [],
groupMeals: [],
identity: uni.getStorageSync('identity')
}
},
onLoad(args) {
// console.log(6666);
// 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.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
}
uni.showLoading({
title: '加载中'
})
if (!this.identity) {
this.$api('queryMemberOrderList', {}, res => {
uni.hideLoading()
if (res.code == 200) {
this.memberOrderList = res.result.records
}
})
}
else {
this.$api('queryLeaderOrderList', {}, res => {
uni.hideLoading()
if (res.code == 200) {
this.leaderOrderList = res.result.records
}
})
}
},
//tab
clickTabs({
@ -209,12 +214,8 @@
} else {
this.queryParams.state = index - 1
}
//
// this.getData()
// console.log('tab', index);
//
this.filterOrdersByStatus(index)
this.current = index
},
//
goToOrderDetail(order) {
@ -235,106 +236,106 @@
})
},
//
filterOrdersByStatus(index) {
this.loadMockOrders() //
// filterOrdersByStatus(index) {
// this.loadMockOrders() //
// if (index === 0) return //
const targetStatus = this.statusMap[index]
if (targetStatus) {
this.orderList = this.orderList.filter(order => order.status === targetStatus)
this.groupMeals = this.groupMeals.filter(meal => meal.status === targetStatus)
}
},
//
handleCancelOrder(orderId) {
uni.showModal({
title: '提示',
content: '确定要取消订单吗?',
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
// API
uni.showToast({
title: '订单已取消',
icon: 'success'
})
// // if (index === 0) return //
// const targetStatus = this.statusMap[index]
// if (targetStatus) {
// this.orderList = this.orderList.filter(order => order.status === targetStatus)
// this.groupMeals = this.groupMeals.filter(meal => meal.status === targetStatus)
// }
// },
// //
// handleCancelOrder(orderId) {
// uni.showModal({
// title: '',
// content: '',
// confirmColor: '#019245',
// success: (res) => {
// if (res.confirm) {
// // API
// uni.showToast({
// title: '',
// icon: 'success'
// })
//
const orderIndex = this.orderList.findIndex(item => item.id === orderId)
if (orderIndex !== -1) {
this.orderList[orderIndex].status = 'canceled'
// //
// const orderIndex = this.orderList.findIndex(item => item.id === orderId)
// if (orderIndex !== -1) {
// this.orderList[orderIndex].status = 'canceled'
//
if (this.current !== 0 && this.current !== 5) {
this.orderList.splice(orderIndex, 1)
}
}
}
}
})
},
// //
// if (this.current !== 0 && this.current !== 5) {
// this.orderList.splice(orderIndex, 1)
// }
// }
// }
// }
// })
// },
//
handlePayOrder(orderId) {
uni.showToast({
title: '正在跳转支付...',
icon: 'loading'
})
// handlePayOrder(orderId) {
// uni.showToast({
// title: '...',
// icon: 'loading'
// })
// API
setTimeout(() => {
uni.hideToast()
// // API
// setTimeout(() => {
// uni.hideToast()
this.$api('payOrder', {
orderId: orderId,
payType: 0
}, res => {
if (res.code == 200) {
uni.showToast({
title: '支付成功',
icon: 'success'
})
}
})
// this.$api('payOrder', {
// orderId: orderId,
// payType: 0
// }, res => {
// if (res.code == 200) {
// uni.showToast({
// title: '',
// icon: 'success'
// })
// }
// })
//
const orderIndex = this.orderList.findIndex(item => item.id === orderId)
if (orderIndex !== -1) {
this.orderList[orderIndex].status = 'processing'
// //
// const orderIndex = this.orderList.findIndex(item => item.id === orderId)
// if (orderIndex !== -1) {
// this.orderList[orderIndex].status = 'processing'
//
if (this.current !== 0 && this.current !== 2) {
this.orderList.splice(orderIndex, 1)
}
}
}, 1500)
},
// //
// if (this.current !== 0 && this.current !== 2) {
// this.orderList.splice(orderIndex, 1)
// }
// }
// }, 1500)
// },
//
handlePickOrder(order) {
uni.showModal( {
title: '提示',
content: '确定取餐完成?',
confirmColor: '#019245',
success: (res) => {
if (res.confirm) {
// order.status_dictText = '',
this.$api('updateMemberOrderStatus', { id: order.id, status: 3 }, res => {
if (res.code === 200) {
this.clickTabs({
index: 3
})
}
})
uni.showToast({
title: '取餐完成',
icon: 'success',
duration: 2000
})
}
}
})
}
// handlePickOrder(order) {
// uni.showModal( {
// title: '',
// content: '',
// confirmColor: '#019245',
// success: (res) => {
// if (res.confirm) {
// // order.status_dictText = '',
// this.$api('updateMemberOrderStatus', { id: order.id, status: 3 }, res => {
// if (res.code === 200) {
// this.clickTabs({
// index: 3
// })
// }
// })
// uni.showToast({
// title: '',
// icon: 'success',
// duration: 2000
// })
// }
// }
// })
// }
}
}
</script>


+ 4
- 3
pages_order/components/order/placeOrder.vue View File

@ -59,7 +59,7 @@
<uv-icon name="red-packet" size="70rpx" color="#019245" />
<text style="flex: 1;">
账户余额
<text style="color: gray; margin-left: 20rpx;">(余额: 0)
<text style="color: gray; margin-left: 20rpx;">(余额: {{ userInfo.balance.toFixed(2) }})
</text>
</text>
<uv-radio activeColor="#019245" size="40rpx" name="1" />
@ -195,8 +195,9 @@ export default {
},
mounted(){
this.listenPickupPoint();
// console.log(props.item);
},
onShow(){
console.log('onShow');
},
beforeDestroy() {
uni.$off('updatePickupPoint');


+ 26
- 0
pages_order/order/groupMealDetail.vue View File

@ -52,11 +52,15 @@ export default {
if (options.id) {
this.mealId = options.id
this.status = options.status
uni.showLoading({
title: '加载中'
})
//
// this.getMealInfo(options.status)
this.$api('queryLeaderOrderListById', {
teambuyOrderLeaderId: this.mealId
}, res => {
uni.hideLoading()
if (res.code === 200 ){
this.members = res.result.orderMemberList
}
@ -93,17 +97,39 @@ export default {
//
handleSend(member) {
uni.showLoading({
title: '通知中'
})
this.$api('informOrderOne', { memberOrderId: member.id }, res => {
uni.hideLoading()
if (res.code === 200) {
// this.$utils.showToast('')
uni.showToast({
title: '通知成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 500)
}
})
},
//
handleComplete(member) {
uni.showLoading({
title: '完成取餐中'
})
this.$api('finishOrderOne', { memberOrderId: member.id }, res => {
uni.hideLoading()
if (res.code === 200) {
// this.$utils.showToast('')
uni.showToast({
title: '完成取餐',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 500)
}
})
}


+ 2
- 1
pages_order/product/productDetail.vue View File

@ -151,8 +151,9 @@
},
onLoad(args) {
this.id = args.id
// this.getRiceProductDetail()
this.getGoodsDetail()
if (args.open === 'true')
this.submit()
},
onShow() {
},


Loading…
Cancel
Save