Browse Source

'test到了最后几个阶段'

hfll
hflllll 6 months ago
parent
commit
2acd41ec43
14 changed files with 364 additions and 446 deletions
  1. +8
    -8
      api/model/order.js
  2. +9
    -3
      components/couponPopup/couponPopup.vue
  3. +170
    -42
      components/couponPopup/newCouponPopup.vue
  4. +9
    -2
      mixins/order.js
  5. +20
    -22
      pages/index/cart.vue
  6. +8
    -2
      pages/index/index.vue
  7. +33
    -183
      pages/index/order.vue
  8. +62
    -60
      pages_order/components/order/placeOrder.vue
  9. +12
    -6
      pages_order/mine/coupon.vue
  10. +3
    -3
      pages_order/mine/wallet.vue
  11. +7
    -47
      pages_order/order/cartOrder.vue
  12. +22
    -28
      pages_order/order/groupMealDetail.vue
  13. +1
    -37
      pages_order/order/orderDetail.vue
  14. +0
    -3
      pages_order/product/productDetail.vue

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

@ -5,14 +5,14 @@ const api = {
queryLeaderOrderList: { queryLeaderOrderList: {
url: '/teambuy/order/queryLeaderOrderList', url: '/teambuy/order/queryLeaderOrderList',
method: 'GET', method: 'GET',
limit: 500,
limit: 200,
}, },
// 订单-查看优惠券列表-详情 // 订单-查看优惠券列表-详情
queryCouponList: { queryCouponList: {
url: '/teambuy/coupon/queryCouponList', url: '/teambuy/coupon/queryCouponList',
method: 'GET', method: 'GET',
limit: 500
limit: 200
}, },
// 优惠券-领取优惠券 // 优惠券-领取优惠券
@ -37,11 +37,11 @@ const api = {
// }, // },
// 订单- 查询团餐订单列表 - 详情 // 订单- 查询团餐订单列表 - 详情
queryLeaderOrderList: {
url: '/teambuy/order/queryLeaderOrderList',
method: 'GET',
limit: 500
},
// queryLeaderOrderList: {
// url: '/teambuy/order/queryLeaderOrderList',
// method: 'GET',
// limit: 500
// },
// 订单-查看团员订单列表-详情 // 订单-查看团员订单列表-详情
queryMemberOrderList: { queryMemberOrderList: {
@ -54,7 +54,7 @@ const api = {
queryShopcarList: { queryShopcarList: {
url: '/teambuy/shopcar/queryShopcarList', url: '/teambuy/shopcar/queryShopcarList',
method: 'GET', method: 'GET',
limit: 500
limit: 500
}, },
// 订单-购物车-添加购物车 // 订单-购物车-添加购物车


+ 9
- 3
components/couponPopup/couponPopup.vue View File

@ -19,11 +19,11 @@
</view> </view>
</view> </view>
<image :src="configList.qd_image" mode="widthFix" class="register-success"></image> <image :src="configList.qd_image" mode="widthFix" class="register-success"></image>
<view class="shopping">购物即可抵扣</view>
<view class="shopping">下单即可抵扣</view>
</view> </view>
<image <image
:src="configList.down_image" mode="widthFix" :src="configList.down_image" mode="widthFix"
class="examine"></image>
class="examine" />
</view> </view>
</view> </view>
</uv-popup> </uv-popup>
@ -41,6 +41,11 @@
}, },
mounted() { mounted() {
this.$refs.couponPopup.open() this.$refs.couponPopup.open()
this.$api('queryFetchCouponList', res => {
if(res.code == 200){
this.couponList = res.result.records
}
})
}, },
computed: { computed: {
...mapState(['riceInfo']) ...mapState(['riceInfo'])
@ -74,9 +79,10 @@
align-items: center; align-items: center;
.main-container { .main-container {
// background-color: red;
.body { .body {
position: relative; position: relative;
background-color: red;
.coupon-bg { .coupon-bg {
} }


+ 170
- 42
components/couponPopup/newCouponPopup.vue View File

@ -1,20 +1,27 @@
<template> <template>
<view class="new-coupon-popup"> <view class="new-coupon-popup">
<uv-popup ref="popup" @change="change" min-height="400rpx" closeable>
<uv-popup ref="popup" @change="change" min-height="400rpx" closeable :z-index="999999">
<view class="coupon-content"> <view class="coupon-content">
<text class="coupon-title">恭喜获得</text>
<text class="coupon-title">优惠券列表</text>
<view class="coupon-list"> <view class="coupon-list">
<view class="coupon-item">
<text class="coupon-name">优惠券名称</text>
<text class="coupon-desc">优惠券描述</text>
<view class="coupon-item" v-for="item in couponList" :key="item.id">
<view class="coupon-left">
<view class="coupon-amount">
<text class="amount-symbol">¥</text>
<text class="amount-value">{{item.amount}}</text>
</view>
<view class="coupon-info">
<text class="coupon-name">{{item.title}}</text>
<text class="coupon-type">{{item.type_dictText}}</text>
<text class="coupon-desc">{{item.remark}}</text>
</view>
</view>
<view class="coupon-right">
<view class="fetch-btn" hover-class="fetch-btn-hover" @click="fetchCoupon(item.id)">
<text class="fetch-btn-text">领取</text>
</view>
</view>
</view> </view>
<view class="coupon-item">
<text class="coupon-name">优惠券名称</text>
<text class="coupon-desc">优惠券描述</text>
</view>
</view>
<view class="coupon-btn" hover-class="coupon-btn-hover" @click="getCoupon">
<text class="coupon-btn-text">立即领取</text>
</view> </view>
</view> </view>
</uv-popup> </uv-popup>
@ -23,28 +30,42 @@
<script> <script>
export default { export default {
name: 'newCouponPopup',
name: 'NewCouponPopup',
data() { data() {
return { return {
couponList: [] couponList: []
} }
}, },
mounted() { mounted() {
// this.getCouponList()
// this.$refs.popup.open()
if (uni.getStorageSync('token')){
this.getCouponList()
}
}, },
methods: { methods: {
getCouponList() { getCouponList() {
this.$api.getCouponList().then(res => {
this.couponList = res.data
this.$api('queryFetchCouponList', {}, res => {
if (res.code === 200 && res.result.length > 0){
this.couponList = res.result
this.$refs.popup.open()
}
}) })
}, },
getCoupon() {
uni.showToast({
title: '领取成功~',
icon: 'success'
fetchCoupon(id) {
this.$api('fetchCoupon', {
couponId: id
}, res => {
uni.showToast({
title: `${res.message}`,
icon: 'success'
})
this.$refs.popup.close();
}) })
this.$refs.popup.close()
},
change(e) {
if(!e) {
this.$emit('close')
}
} }
} }
} }
@ -63,35 +84,142 @@ export default {
.coupon-title{ .coupon-title{
color: black; color: black;
text-align: center; text-align: center;
font-size: 32rpx;
font-size: 36rpx;
font-weight: 600; font-weight: 600;
margin-bottom: 10rpx;
} }
.coupon-list{ .coupon-list{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 20rpx; gap: 20rpx;
width: 100%;
.coupon-item{ .coupon-item{
width: 660rpx;
width: 80vw;
height: 180rpx; height: 180rpx;
background-color: $uni-color;
border-radius: 10rpx;
}
}
.coupon-btn-hover{
opacity: 0.7;
}
.coupon-btn{
width: 570rpx;
height: 110rpx;
background-color: $uni-color;
border-radius: 55rpx;
display: flex;
align-items: center;
justify-content: center;
.coupon-btn-text{
color: #fff;
font-size: 30rpx;
background: linear-gradient(135deg, $uni-color, #ff8a8a);
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
position: relative;
box-shadow: 0 6rpx 12rpx rgba(255, 99, 99, 0.2);
overflow: hidden;
&::before {
content: '';
position: absolute;
left: -15rpx;
top: 50%;
transform: translateY(-50%);
width: 30rpx;
height: 30rpx;
background-color: #fff;
border-radius: 50%;
}
&::after {
content: '';
position: absolute;
right: -15rpx;
top: 50%;
transform: translateY(-50%);
width: 30rpx;
height: 30rpx;
background-color: #fff;
border-radius: 50%;
}
.coupon-left {
display: flex;
align-items: center;
gap: 20rpx;
.coupon-amount {
display: flex;
align-items: baseline;
color: #fff;
.amount-symbol {
font-size: 28rpx;
font-weight: bold;
}
.amount-value {
font-size: 48rpx;
font-weight: bold;
}
}
.coupon-info {
display: flex;
flex-direction: column;
.coupon-name {
font-size: 32rpx;
color: #fff;
font-weight: 600;
margin-bottom: 4rpx;
}
.coupon-type {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.9);
background-color: rgba(255, 255, 255, 0.2);
padding: 2rpx 10rpx;
border-radius: 10rpx;
display: inline-block;
margin-bottom: 6rpx;
}
.coupon-desc {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.8);
}
}
}
.coupon-right {
.fetch-btn {
width: 120rpx;
height: 60rpx;
background: rgba(255, 255, 255, 0.9);
border-radius: 30rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.5), transparent);
transform: translateX(-100%);
transition: transform 0.6s;
}
&:active::before {
transform: translateX(100%);
}
.fetch-btn-text {
color: $uni-color;
font-size: 26rpx;
font-weight: bold;
}
}
.fetch-btn-hover {
transform: scale(0.95);
opacity: 0.9;
}
}
} }
} }
} }


+ 9
- 2
mixins/order.js View File

@ -1,4 +1,4 @@
import { mapMutations } from 'vuex'
export default { export default {
data() { data() {
@ -8,6 +8,7 @@ export default {
computed: { computed: {
}, },
methods: { methods: {
...mapMutations(['clearCouponData']),
// 支付接口 // 支付接口
handlePay(orderParams) { handlePay(orderParams) {
uni.showLoading({ uni.showLoading({
@ -17,12 +18,15 @@ export default {
// 没有优惠卷 则不传 // 没有优惠卷 则不传
delete orderParams.userCouponId delete orderParams.userCouponId
} }
if (orderParams.remark == '') {
delete orderParams.remark
}
this.$api('createOrder', { this.$api('createOrder', {
...orderParams ...orderParams
}, res => { }, res => {
uni.hideLoading() uni.hideLoading()
if (res.code === 200) { if (res.code === 200) {
if (this.payMethod == '0') {
if (orderParams.payType == '0') {
uni.requestPaymentWxPay(res) uni.requestPaymentWxPay(res)
.then(n => { .then(n => {
setTimeout(uni.redirectTo, 700, { setTimeout(uni.redirectTo, 700, {
@ -110,5 +114,8 @@ export default {
// } // }
// }) // })
// }, // },
},
beforeDestroy() {
this.clearCouponData();
} }
} }

+ 20
- 22
pages/index/cart.vue View File

@ -4,13 +4,13 @@
<navbar title="购物车" color="#fff" /> <navbar title="购物车" color="#fff" />
<!-- 悬浮管理按钮 --> <!-- 悬浮管理按钮 -->
<view class="float-manage-btn" @tap="isManaged = !isManaged" v-if="cartData.records && cartData.records.length">
<view class="float-manage-btn" @tap="isManaged = !isManaged" v-if="cartList && cartList.length">
<text>{{ isManaged ? '完成' : '管理' }}</text> <text>{{ isManaged ? '完成' : '管理' }}</text>
</view> </view>
<view class="cart-items"> <view class="cart-items">
<uv-checkbox-group shape="circle" v-model="checkboxValue"> <uv-checkbox-group shape="circle" v-model="checkboxValue">
<view v-for="(item, index) in cartData.records" :key="item.id" class="cart-item">
<view v-for="(item, index) in cartList" :key="item.id" class="cart-item">
<view class="checkbox"> <view class="checkbox">
<uv-checkbox :key="index" :name="item.id" size="40rpx" iconSize="35rpx" activeColor="#019245" /> <uv-checkbox :key="index" :name="item.id" size="40rpx" iconSize="35rpx" activeColor="#019245" />
</view> </view>
@ -42,11 +42,11 @@
</view> </view>
</uv-checkbox-group> </uv-checkbox-group>
<view style="padding-top: 300rpx;"> <view style="padding-top: 300rpx;">
<uv-empty mode="car" v-if="!cartData.records || !cartData.records.length" text="购物车空空如也~" />
<uv-empty mode="car" v-if="!cartList || !cartList.length" text="购物车空空如也~" />
</view> </view>
</view> </view>
<view class="cart-footer" v-if="cartData.records && cartData.records.length">
<view class="cart-footer" v-if="cartList && cartList.length">
<view class="select-all"> <view class="select-all">
<uv-checkbox-group v-model="allCheckbox"> <uv-checkbox-group v-model="allCheckbox">
<uv-checkbox size="40rpx" iconSize="35rpx" activeColor="#019245" shape="circle" name="all" <uv-checkbox size="40rpx" iconSize="35rpx" activeColor="#019245" shape="circle" name="all"
@ -73,9 +73,12 @@
<script> <script>
import tabber from '@/components/base/tabbar.vue' import tabber from '@/components/base/tabbar.vue'
import navbar from '@/components/base/navbar.vue' import navbar from '@/components/base/navbar.vue'
import { mapActions } from 'vuex'
import mixinsList from '@/mixins/list.js'
import { mapMutations } from 'vuex'
export default { export default {
mixins: [mixinsList],
components: { components: {
tabber, tabber,
navbar navbar
@ -85,20 +88,23 @@ export default {
cartData: { cartData: {
records: [] records: []
}, },
cartList: [],
mixinsListKey: 'cartList',
mixinsListApi: 'queryShopcarList',
checkboxValue: [], checkboxValue: [],
isManaged: false, isManaged: false,
} }
}, },
computed: { computed: {
allSelected() { allSelected() {
return this.cartData.records.every(item => this.checkboxValue.includes(item.id))
return this.cartList.every(item => this.checkboxValue.includes(item.id))
}, },
// //
allCheckbox(){ allCheckbox(){
return this.allSelected ? ['all'] : [] return this.allSelected ? ['all'] : []
}, },
totalPrice(){ totalPrice(){
return this.cartData.records.reduce((total, item) => {
return this.cartList.reduce((total, item) => {
if (this.checkboxValue.includes(item.id)){ if (this.checkboxValue.includes(item.id)){
total += item.goods.price * item.num total += item.goods.price * item.num
} }
@ -110,15 +116,7 @@ export default {
} }
}, },
methods: { methods: {
...mapActions(['setCartData']),
//
getCartData(){
this.$api('queryShopcarList', {}, res => {
if (res.code == 200){
this.cartData = res.result
}
})
},
...mapMutations(['setCartData']),
// //
modifyCart(item, type){ modifyCart(item, type){
this.$api('addShopcar', { this.$api('addShopcar', {
@ -133,7 +131,7 @@ export default {
if (this.allSelected){ if (this.allSelected){
this.checkboxValue = [] this.checkboxValue = []
}else{ }else{
this.checkboxValue = this.cartData.records.map(item => item.id)
this.checkboxValue = this.cartList.map(item => item.id)
} }
}, },
increaseQuantity(item) { increaseQuantity(item) {
@ -156,7 +154,7 @@ export default {
return; return;
} }
const sendData = this.cartData.records.filter(item => this.checkboxValue.includes(item.id))
const sendData = this.cartList.filter(item => this.checkboxValue.includes(item.id))
this.$store.commit('setCartData', { sendData, priceAll: this.totalPrice } ) this.$store.commit('setCartData', { sendData, priceAll: this.totalPrice } )
// //
@ -189,7 +187,7 @@ export default {
icon: 'success', icon: 'success',
duration: 1000, duration: 1000,
}) })
this.getCartData()
this.getData()
this.checkboxValue = [] this.checkboxValue = []
} }
}) })
@ -198,9 +196,9 @@ export default {
}) })
} }
}, },
onShow(){
this.getCartData()
}
// onShow(){
// this.getData()
// }
} }
</script> </script>


+ 8
- 2
pages/index/index.vue View File

@ -98,6 +98,7 @@
</view> </view>
<tabbar select="index" /> <tabbar select="index" />
<NewCouponPopup />
</view> </view>
</template> </template>
@ -105,11 +106,13 @@
import navbar from '@/components/base/navbar.vue' import navbar from '@/components/base/navbar.vue'
import tabbar from '@/components/base/tabbar.vue' import tabbar from '@/components/base/tabbar.vue'
import { homeData } from '@/static/js/mockHomeData.js' import { homeData } from '@/static/js/mockHomeData.js'
import NewCouponPopup from '@/components/couponPopup/newCouponPopup.vue'
export default { export default {
components: { components: {
navbar, navbar,
tabbar
tabbar,
NewCouponPopup
}, },
data() { data() {
return { return {
@ -182,7 +185,10 @@ export default {
}) })
}, },
getGoodsList() { getGoodsList() {
this.$api('queryGoodsList', { }, res => {
this.$api('queryGoodsList', {
pageNo: 1,
pageSize: 5
}, res => {
if (res.code == 200) { if (res.code == 200) {
this.$set(this.homeData, 'goodsList', res.result.records) this.$set(this.homeData, 'goodsList', res.result.records)
} }


+ 33
- 183
pages/index/order.vue View File

@ -13,138 +13,59 @@
<!-- 订单筛选 --> <!-- 订单筛选 -->
<view class="tabs"> <view class="tabs">
<uv-tabs :list="tabs" :activeStyle="{ color: '#019245'}" lineColor="#019245" :scrollable="false" <uv-tabs :list="tabs" :activeStyle="{ color: '#019245'}" lineColor="#019245" :scrollable="false"
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current"
:inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="status"
@click="clickTabs" /> @click="clickTabs" />
</view> </view>
<!-- 团餐列表 --> <!-- 团餐列表 -->
<view class="group-meal-list" v-if="identity"> <view class="group-meal-list" v-if="identity">
<view class="meal-item" v-for="(meal, index) in mealList" :key="meal.id">
<view class="meal-item" v-for="(meal, index) in leaderOrderList" :key="meal.id">
<view class="meal-name">{{ meal.title }}</view> <view class="meal-name">{{ meal.title }}</view>
<view class="meal-price">本单佣金合计: <text class="price-value">¥{{ levelInfo.amount || '0.00' }}</text>
<view class="meal-price">本单佣金合计: <text class="price-value">¥{{ (meal.commission || 0).toFixed(2) || 0.00 }}</text>
</view> </view>
<view class="meal-action"> <view class="meal-action">
<button class="order-btn" @tap="viewOrder(meal)">查看订单</button> <button class="order-btn" @tap="viewOrder(meal)">查看订单</button>
</view> </view>
</view> </view>
<view style="margin-top: 200rpx; min-width: 700rpx;"> <view style="margin-top: 200rpx; min-width: 700rpx;">
<uv-empty mode="order" v-if="mealList.length == 0" />
<uv-empty mode="order" v-if="leaderOrderList.length == 0" />
</view> </view>
</view> </view>
<!-- 订单列表 --> <!-- 订单列表 -->
<view class="order-list" v-else> <view class="order-list" v-else>
<OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order"
<OrderItem v-for="(order, index) in memberOrderList" :key="order.id" :order="order"
@cancel="handleCancelOrder(order.id)" @pick="handlePickOrder(order.id)" @pay="goToOrderDetail(order)" @cancel="handleCancelOrder(order.id)" @pick="handlePickOrder(order.id)" @pay="goToOrderDetail(order)"
@click="goToOrderDetail(order)" /> @click="goToOrderDetail(order)" />
<view style="margin-top: 200rpx; min-width: 700rpx;"> <view style="margin-top: 200rpx; min-width: 700rpx;">
<uv-empty mode="order" v-if="orderList.length == 0" />
<uv-empty mode="order" v-if="memberOrderList.length == 0" />
</view> </view>
</view> </view>
<!-- <view class="list">
<view class="item" v-for="(item, index) in list" @tap="toOrderDetail(item.id)" :key="index">
<view class="content" :key="index" v-for="(good, index) in item.commonOrderSkuList">
<view class="top">
<view class="service">
{{ good.title }}
</view>
<view class="status">
<text> {{ tabs[Number(item.state) + 1].name }}</text>
</view>
</view>
<view class="main">
<view class="left">
<image mode="aspectFill" :src="good.image && good.image.split(',')[0]"></image>
</view>
<view class="right">
<view class="text-hidden-1">
客户姓名{{item.name}}
</view>
<view class="text-hidden-1">
下单时间{{item.createTime}}
</view>
<view class="text-hidden-1">
联系电话{{item.phone}}
</view>
</view>
</view>
</view>
<view class="bottom">
<view class="price">
<text class="total-title">总价格</text>
<text class="unit"></text>
<text class="num">{{item.price}}</text>
<text class="c-unit"></text>
</view>
<view @tap.stop="toPayOrder(item)" class="btn" v-if="item.state == 0">
立即付款
</view>
<view @tap.stop="cancelOrder(item)" class="btn" v-if="item.state == 0">
取消订单
</view>
<view class="btn" @tap.stop="confirmOrder(item)" v-if="item.state == 2">
确认收货
</view>
<view @tap.stop="$refs.customerServicePopup.open()" class="btn" v-if="item.state > 0">
联系客服
</view>
</view>
</view>
<view style="
margin-top: 20rpx;
min-width: 700rpx;">
<uv-empty mode="list" v-if="list.length == 0"></uv-empty>
</view>
</view> -->
<customerServicePopup ref="customerServicePopup" />
<tabber select="order" /> <tabber select="order" />
</view> </view>
</template> </template>
<script> <script>
import {
mapGetters
} from 'vuex'
import mixinsList from '@/mixins/list.js' import mixinsList from '@/mixins/list.js'
import mixinsOrder from '@/mixins/order.js'
import tabber from '@/components/base/tabbar.vue' import tabber from '@/components/base/tabbar.vue'
import customerServicePopup from '@/components/config/customerServicePopup.vue'
import OrderItem from '@/components/order/OrderItem.vue' import OrderItem from '@/components/order/OrderItem.vue'
export default { export default {
mixins: [mixinsList, mixinsOrder],
mixins: [mixinsList],
components: { components: {
tabber, tabber,
customerServicePopup,
OrderItem OrderItem
}, },
computed: { computed: {
orderList() {
return this.memberOrderList.filter(order => order.status == this.current)
},
mealList() {
return this.leaderOrderList.filter(order => order.status == this.current)
},
tabs() { tabs() {
return this.identity ? this.tabMeal : this.tabOrder return this.identity ? this.tabMeal : this.tabOrder
}
},
}, },
data() { data() {
return { return {
keyword: '', keyword: '',
title: '',
tabOrder: [{ tabOrder: [{
name: '待支付' name: '待支付'
}, },
@ -174,97 +95,61 @@
name: '已完成' name: '已完成'
} }
], ],
current: 0,
status: 0,
memberOrderList: [], memberOrderList: [],
leaderOrderList: [], leaderOrderList: [],
identity: uni.getStorageSync('identity')
identity: uni.getStorageSync('identity'),
mixinsListApi: '',
mixinsListKey: '',
} }
}, },
onLoad(args) {
this.getData()
onLoad(args) {
//
this.mixinsListApi = this.identity ? 'queryLeaderOrderList' : 'queryMemberOrderList',
this.mixinsListKey = this.identity ? 'leaderOrderList' : 'memberOrderList'
// tabIndextab // tabIndextab
if (args.tabIndex !== undefined) { if (args.tabIndex !== undefined) {
const index = parseInt(args.tabIndex) const index = parseInt(args.tabIndex)
if (!isNaN(index) && index >= 0 && index < this.tabs.length) { if (!isNaN(index) && index >= 0 && index < this.tabs.length) {
this.current = index
//
// if (index == 0) {
// delete this.queryParams.state
// } else {
// this.queryParams.state = index - 1
// }
this.status = index
} }
} }
}, },
methods: { methods: {
handleSearch() { handleSearch() {
this.$api('queryMemberOrderList', {
title: this.keyword
}, res => {
if (res.code == 200) {
this.memberOrderList = res.result.records
}
})
this.title = this.keyword
this.getData()
this.keyword = ''
this.title = ''
}, },
getData() {
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
}
})
beforeGetData() {
const params = {
status: this.status,
title: this.title || ''
} }
return params
}, },
//tab //tab
clickTabs({ clickTabs({
index index
}) { }) {
this.current = index
this.status = index
this.getData() this.getData()
}, },
// //
goToOrderDetail(order) { goToOrderDetail(order) {
if (order.status === 'completed') {
this.$utils.navigateTo({
url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status
})
} else {
this.$utils.navigateTo({
url: '/pages_order/order/newOrderDetail?id=' + order.id + '&status=' + order.status_dictText
})
}
this.$utils.navigateTo({
url: '/pages_order/order/newOrderDetail?id=' + order.id
})
}, },
// //
viewOrder(meal) { viewOrder(meal) {
this.$utils.navigateTo({ this.$utils.navigateTo({
url: '/pages_order/order/groupMealDetail?id=' + meal.id + '&status=' + meal.status
url: '/pages_order/order/groupMealDetail?id=' + meal.id
}) })
}, },
//
// 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) { handleCancelOrder(orderId) {
uni.showModal({ uni.showModal({
@ -290,41 +175,6 @@
} }
}) })
}, },
//
// handlePayOrder(orderId) {
// uni.showToast({
// title: '...',
// icon: 'loading'
// })
// // API
// setTimeout(() => {
// uni.hideToast()
// 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'
// //
// if (this.current !== 0 && this.current !== 2) {
// this.orderList.splice(orderIndex, 1)
// }
// }
// }, 1500)
// },
// //
handlePickOrder(orderId) { handlePickOrder(orderId) {
uni.showModal( { uni.showModal( {


+ 62
- 60
pages_order/components/order/placeOrder.vue View File

@ -36,9 +36,8 @@
<view class="item"> <view class="item">
<image :src="item.image" mode="aspectFill" class="item-image"></image> <image :src="item.image" mode="aspectFill" class="item-image"></image>
<view style="font-size: 36rpx;"> <view style="font-size: 36rpx;">
<view>{{ item.name }}</view>
<view style="color: red; ">{{ priceAll }}</view>
<view style="color: red; ">实付{{ pricePay }}</view>
<view>{{ item.title }}</view>
<view style="color: red; ">{{ (priceAll || 0).toFixed(2) }}</view>
<view style="margin-top: 30rpx;"> <view style="margin-top: 30rpx;">
<uv-number-box v-model="value" button-size="36"></uv-number-box> <uv-number-box v-model="value" button-size="36"></uv-number-box>
</view> </view>
@ -59,8 +58,7 @@
<uv-icon name="red-packet" size="70rpx" color="#019245" /> <uv-icon name="red-packet" size="70rpx" color="#019245" />
<text style="flex: 1;"> <text style="flex: 1;">
账户余额 账户余额
<text style="color: gray; margin-left: 20rpx;">(余额: {{ userInfo.balance ?
userInfo.balance.toFixed(2) : 0 }})</text>
<text style="color: gray; margin-left: 20rpx;">(余额: {{ (userInfo.balance || 0).toFixed(2) }})</text>
</text> </text>
<uv-radio activeColor="#019245" size="40rpx" name="1" :disabled="userInfo.balance < pricePay" /> <uv-radio activeColor="#019245" size="40rpx" name="1" :disabled="userInfo.balance < pricePay" />
</view> </view>
@ -95,6 +93,10 @@
<uv-icon name="shopping-cart-fill" size="60rpx" color="#019245" label="加入购物车" labelPos="bottom" <uv-icon name="shopping-cart-fill" size="60rpx" color="#019245" label="加入购物车" labelPos="bottom"
labelSize="25rpx" /> labelSize="25rpx" />
</view> </view>
<view class="total-section">
<text>合计</text>
<text class="total-price">{{ (pricePay || 0).toFixed(2) }}</text>
</view>
<view class="pay" @tap="createOrder"> <view class="pay" @tap="createOrder">
立即支付 立即支付
</view> </view>
@ -105,8 +107,10 @@
</template> </template>
<script> <script>
import { mapState, mapMutations } from 'vuex'
import { mapState } from 'vuex'
import order from '@/mixins/order'
export default { export default {
mixins: [order],
name: 'placeOrder', name: 'placeOrder',
data() { data() {
@ -127,17 +131,31 @@ export default {
computed: { computed: {
...mapState(['userInfo', 'couponData']), ...mapState(['userInfo', 'couponData']),
priceAll () { priceAll () {
return this.item.price * this.value
return this.item?.price * this.value || 0
}, },
goodss () { goodss () {
return `${this.item.id},${this.value},${this.priceAll};`
return this.item?.id ? `${this.item.id},${this.value},${this.priceAll};` : ''
}, },
pricePay () { pricePay () {
return (this.priceAll - ( this.couponData.discount || 0 )) > 0 ? (this.priceAll - ( this.couponData.discount || 0 )) : 0.01
const discount = this.couponData?.discount || 0
return (this.priceAll - discount) > 0.01 ? (this.priceAll - discount) : 0.01
},
orderParams () {
return {
priceAll: this.priceAll,
pricePay: this.pricePay,
pricePreferential: this.couponData?.discount || 0,
payType: this.payMethod,
leaderId: this.pickupPoint?.id || '',
userCouponId: this.couponData?.id || '',
goodss: this.goodss,
remark: this.remark
}
} }
}, },
methods: { methods: {
...mapMutations(['clearCouponData']),
// ...mapMutations(['clearCouponData']),
// //
gotoCoupon() { gotoCoupon() {
this.$utils.navigateTo('/pages_order/mine/coupon?usein=1') this.$utils.navigateTo('/pages_order/mine/coupon?usein=1')
@ -174,61 +192,30 @@ export default {
// //
createOrder(){ createOrder(){
if (!this.pickupPoint) { if (!this.pickupPoint) {
uni.showToast({
title: '请选择取餐地点',
icon: 'error'
uni.showModal({
title: '提示',
content: '请选择取餐地点',
showCancel: false,
confirmColor: '#019245',
success: () => {
this.gotoPickupPoint()
}
}) })
return return
} }
if (this.payMethod == '1' && this.userInfo.balance < this.priceAll) {
uni.showToast({
if (this.payMethod == '1' && this.userInfo && this.userInfo.balance < this.pricePay) {
uni.showModal({
title: '余额不足', title: '余额不足',
icon: 'error'
showCancel: false,
content: '前往充值',
confirmColor: '#019245',
success: () => {
this.$utils.navigateTo('/pages_order/mine/wallet')
}
}) })
return return
} }
uni.showLoading({
title: '下单中...'
})
this.$api('createOrder', {
priceAll: this.priceAll,
pricePay: this.pricePay,
pricePreferential: this.couponData.discount || 0,
payType: this.payMethod,
leaderId: this.pickupPoint.id,
userCouponId: this.couponData.id || '',
goodss: this.goodss,
remark: this.remark
}, res => {
uni.hideLoading()
if (res.code === 200) {
if (this.payMethod == '0') {
uni.requestPaymentWxPay(res)
.then(n => {
setTimeout(uni.redirectTo, 500, {
url: '/pages/index/order?tabIndex=1'
})
})
.catch(err => {
uni.showToast({
title: '支付失败',
icon: 'error'
})
setTimeout(uni.redirectTo, 500, {
url: '/pages/index/order?tabIndex=0'
})
})
}else {
uni.showToast({
title: '下单成功',
icon: 'success'
})
setTimeout(uni.redirectTo, 500, {
url: '/pages/index/order?tabIndex=1'
})
}
}
})
this.handlePay(this.orderParams)
} }
}, },
mounted(){ mounted(){
@ -236,7 +223,7 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
uni.$off('updatePickupPoint'); uni.$off('updatePickupPoint');
this.clearCouponData();
// this.clearCouponData();
} }
} }
</script> </script>
@ -372,8 +359,23 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.total-section{
width: 30%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text{
font-size: 28rpx;
&.total-price{
color: #ff0000;
font-size: 32rpx;
font-weight: 500;
}
}
}
.pay{ .pay{
width: 70%;
width: 40%;
background-color: $uni-color; background-color: $uni-color;
color: #fff; color: #fff;
text-align: center; text-align: center;


+ 12
- 6
pages_order/mine/coupon.vue View File

@ -14,21 +14,27 @@
<view class="coupon-list"> <view class="coupon-list">
<template v-if="currentTab === 0"> <template v-if="currentTab === 0">
<coupon-item v-for="coupon in unusedCoupons" :key="coupon.id" :coupon="coupon" @use="useCoupon" /> <coupon-item v-for="coupon in unusedCoupons" :key="coupon.id" :coupon="coupon" @use="useCoupon" />
<uv-empty v-if="unusedCoupons.length == 0" text="暂无优惠卷" textSize="30rpx" iconSize="200rpx"
style="padding-top: 200rpx;" icon="list" />
<view v-if="unusedCoupons.length == 0" style="padding-top: 200rpx;">
<uv-empty text="暂无优惠卷" textSize="30rpx" iconSize="200rpx"
style="padding-top: 200rpx;" icon="list" />
</view>
</template> </template>
<template v-if="currentTab === 1"> <template v-if="currentTab === 1">
<coupon-item v-for="coupon in usedCoupons" :key="coupon.id" :coupon="coupon" /> <coupon-item v-for="coupon in usedCoupons" :key="coupon.id" :coupon="coupon" />
<uv-empty v-if="usedCoupons.length == 0" text="暂无优惠卷" textSize="30rpx" iconSize="200rpx"
style="padding-top: 200rpx;" icon="list" />
<view v-if="usedCoupons.length == 0" style="padding-top: 200rpx;">
<uv-empty text="暂无优惠卷" textSize="30rpx" iconSize="200rpx"
style="padding-top: 200rpx;" icon="list" />
</view>
</template> </template>
<template v-if="currentTab === 2"> <template v-if="currentTab === 2">
<coupon-item v-for="coupon in expiredCoupons" :key="coupon.id" :coupon="coupon" /> <coupon-item v-for="coupon in expiredCoupons" :key="coupon.id" :coupon="coupon" />
<uv-empty v-if="expiredCoupons.length == 0" text="暂无优惠卷" textSize="30rpx" iconSize="200rpx"
style="padding-top: 200rpx;" icon="list" />
<view v-if="expiredCoupons.length == 0" style="padding-top: 200rpx;">
<uv-empty text="暂无优惠卷" textSize="30rpx" iconSize="200rpx"
style="padding-top: 200rpx;" icon="list" />
</view>
</template> </template>
</view> </view>
</view> </view>


+ 3
- 3
pages_order/mine/wallet.vue View File

@ -67,7 +67,7 @@
<script> <script>
import navbar from '@/components/base/navbar.vue' import navbar from '@/components/base/navbar.vue'
import { walletData } from '@/static/js/mockWallet.js'
// import { walletData } from '@/static/js/mockWallet.js'
export default { export default {
components: { components: {
@ -87,7 +87,7 @@ export default {
}, },
onLoad() { onLoad() {
this.walletData = walletData
// this.walletData = walletData
}, },
methods: { methods: {
// //
@ -216,7 +216,7 @@ export default {
if (res.code === 200) { if (res.code === 200) {
uni.requestPaymentWxPay(res) uni.requestPaymentWxPay(res)
.then(() => { .then(() => {
this.userInfo.balance += parseFloat(this.rechargeAmount)
this.$store.commit('getUserInfo')
this.rechargeAmount = '' this.rechargeAmount = ''
this.isRecharge = false this.isRecharge = false
}) })


+ 7
- 47
pages_order/order/cartOrder.vue View File

@ -4,7 +4,7 @@
<navbar title="购物车支付 " leftClick @leftClick="navigateBack" bgColor="#019245" color="#fff" /> <navbar title="购物车支付 " leftClick @leftClick="navigateBack" bgColor="#019245" color="#fff" />
<!-- 店铺信息 --> <!-- 店铺信息 -->
<view class="shop-info">
<view class="shop-info" v-show="hasLeader">
<view class="shop-header"> <view class="shop-header">
<image class="shop-logo" :src="teamLeader.spotImage" mode="aspectFill"></image> <image class="shop-logo" :src="teamLeader.spotImage" mode="aspectFill"></image>
<view class="shop-name-container"> <view class="shop-name-container">
@ -120,7 +120,7 @@
<script> <script>
import navbar from '@/components/base/navbar.vue' import navbar from '@/components/base/navbar.vue'
import order from '@/mixins/order.js' import order from '@/mixins/order.js'
import { mapState, mapMutations } from 'vuex'
import { mapState } from 'vuex'
export default { export default {
mixins: [order], mixins: [order],
components: { components: {
@ -132,7 +132,8 @@ export default {
showAllFoods: false, showAllFoods: false,
teamLeader: {}, teamLeader: {},
thePriceAll: 0, thePriceAll: 0,
remark: ''
remark: '',
hasLeader: false
} }
}, },
computed: { computed: {
@ -170,11 +171,7 @@ export default {
this.getLeaderData() this.getLeaderData()
}, },
beforeDestroy() {
this.clearCouponData()
},
methods: { methods: {
...mapMutations(['clearCouponData']),
// //
navigateBack() { navigateBack() {
uni.navigateBack() uni.navigateBack()
@ -183,8 +180,9 @@ export default {
// //
getLeaderData() { getLeaderData() {
this.$api('queryMyLeader', {}, res => { this.$api('queryMyLeader', {}, res => {
if (res.code === 200) {
if (res.code === 200 && res.result.bindStatus !== '2') {
this.teamLeader = res.result this.teamLeader = res.result
this.hasLeader = true
}else { }else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@ -209,45 +207,7 @@ export default {
} }
}) })
}, },
//
// handlePay() {
// uni.showLoading({
// title: '...'
// })
// this.$api('createOrder', {
// ...this.orderParams
// }, res => {
// uni.hideLoading()
// if (res.code === 200) {
// if (this.payMethod == '0') {
// uni.requestPaymentWxPay(res)
// .then(n => {
// setTimeout(uni.redirectTo, 700, {
// url: '/pages/index/order?tabIndex=1'
// })
// })
// .catch(err => {
// uni.showToast({
// title: '',
// icon: 'error'
// })
// setTimeout(uni.redirectTo, 700, {
// url: '/pages/index/order?tabIndex=0'
// })
// })
// } else {
// uni.showToast({
// title: '',
// icon: 'success'
// })
// setTimeout(uni.redirectTo, 700, {
// url: '/pages/index/order?tabIndex=1'
// })
// }
// }
// })
// },
// //
gotoCoupon() { gotoCoupon() {
// //


+ 22
- 28
pages_order/order/groupMealDetail.vue View File

@ -1,25 +1,27 @@
<template> <template>
<view class="page"> <view class="page">
<!-- 导航栏 --> <!-- 导航栏 -->
<navbar :title="'团餐' + (mealInfo ? mealInfo.id : '')" leftClick @leftClick="$utils.navigateBack"
bgColor="#019245" color="#fff" />
<navbar title="详情页" leftClick @leftClick="navigateBack" bgColor="#019245" color="#fff" />
<view class="container"> <view class="container">
<!-- 修改后 --> <!-- 修改后 -->
<view class="top-btn-group" v-if="status == '2'">
<view class="top-btn-group" v-if="memberRes.status == '2'">
<button class="top-action-btn" @click="test1">通知所有人取餐</button> <button class="top-action-btn" @click="test1">通知所有人取餐</button>
<button class="top-action-btn" @click="test2">通知所有人完成订单</button> <button class="top-action-btn" @click="test2">通知所有人完成订单</button>
</view> </view>
<!-- 成员列表 --> <!-- 成员列表 -->
<view class="member-list"> <view class="member-list">
<!-- 使用封装的成员项组件 --> <!-- 使用封装的成员项组件 -->
<member-food-item v-for="(member, index) in members" :key="index" :member="member" :status="status"
:default-expanded="index === defaultExpandedIndex" @toggle="handleMemberToggle"
@sendNotice="handleSend(member)" @completeOrder="handleComplete(member)" />
<member-food-item v-for="(member, index) in memberRes.orderMemberList" :key="index" :member="member"
:status="memberRes.status" :default-expanded="index === defaultExpandedIndex"
@toggle="handleMemberToggle" @sendNotice="handleSend(member)"
@completeOrder="handleComplete(member)" />
</view> </view>
<!-- 空数据提示 --> <!-- 空数据提示 -->
<uv-empty v-if="members.length === 0" text="暂无成员" mode="list" style="padding-top: 200rpx;" />
<uv-empty v-if="memberRes.orderMemberList.length === 0" text="暂无成员" mode="list"
style="padding-top: 200rpx;" />
</view> </view>
</view> </view>
</template> </template>
@ -27,9 +29,11 @@
<script> <script>
import navbar from '@/components/base/navbar.vue' import navbar from '@/components/base/navbar.vue'
import MemberFoodItem from '../components/order/MemberFoodItem.vue' import MemberFoodItem from '../components/order/MemberFoodItem.vue'
import mixinsList from '@/mixins/list'
// status // status
// 0 1 2 3 // 0 1 2 3
export default { export default {
mixins: [mixinsList],
components: { components: {
navbar, navbar,
MemberFoodItem MemberFoodItem
@ -37,36 +41,26 @@ export default {
data() { data() {
return { return {
mealId: null, mealId: null,
mealInfo: null,
defaultExpandedIndex: -1, // defaultExpandedIndex: -1, //
members: [],
status: ''
mixinsListApi: 'queryLeaderOrderListById',
mixinsListKey: 'memberRes',
memberRes: null,
} }
}, },
onLoad(options) { onLoad(options) {
if (options.id) { if (options.id) {
this.mealId = 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
}
})
} }
// console.log(options.status);
// this.members = mockFoodMember
}, },
methods: { methods: {
navigateBack(){
this.$utils.navigateBack()
},
beforeGetData(){
return {
teambuyOrderLeaderId: this.mealId
}
},
// //
test1 () { test1 () {
this.$api('informOrderAll', { leaderOrderId: this.mealId }, res => { this.$api('informOrderAll', { leaderOrderId: this.mealId }, res => {


+ 1
- 37
pages_order/order/orderDetail.vue View File

@ -2,35 +2,6 @@
<view> <view>
<navbar title="订单详情" leftClick @leftClick="$utils.navigateBack" /> <navbar title="订单详情" leftClick @leftClick="$utils.navigateBack" />
<!-- <view class="">
<view class="controls">
<view class="title">
<image src="../static/order/icon.png" mode=""></image>
服务完成
</view>
<view class="tips">
待送回
</view>
<view class="btns">
<view class="btn1">
快递寄回
</view>
<view class="btn2">
线下配送
</view>
</view>
</view>
<view class="steps">
<uv-steps
activeColor="#FD5100"
:current="stepsCurrent" dot>
<uv-steps-item :title="item"
:key="index"
v-for="(item, index) in steps"></uv-steps-item>
</uv-steps>
</view>
</view> -->
<view class="info"> <view class="info">
<view class="flex" style="display: flex;"> <view class="flex" style="display: flex;">
<view style="width: 8rpx;height: 30rpx; <view style="width: 8rpx;height: 30rpx;
@ -51,14 +22,7 @@
{{good.title}} {{good.title}}
<!-- <view class="coupon">领券立减</view> --> <!-- <view class="coupon">领券立减</view> -->
</view> </view>
<!-- <view class="current-price">
<text class="unit"></text>{{good.price}}
</view>
<view class="sales-volume" style="margin-top: 5px;">
<view class="desc">规格{{good.sku}}</view>
</view> -->
>
<view class="texture"> <view class="texture">
产品材质{{ good.subText }} 产品材质{{ good.subText }}


+ 0
- 3
pages_order/product/productDetail.vue View File

@ -119,7 +119,6 @@
<!-- 联系客服 --> <!-- 联系客服 -->
<customerServicePopup ref="customerServicePopup" /> <customerServicePopup ref="customerServicePopup" />
<newCouponPopup ref="newCouponPopup" />
<placeOrder ref="placeOrder" :item="productDetail" @addCart="addCart" /> <placeOrder ref="placeOrder" :item="productDetail" @addCart="addCart" />
<uv-safe-bottom /> <uv-safe-bottom />
</view> </view>
@ -129,7 +128,6 @@
import submit from '../components/product/submit.vue' import submit from '../components/product/submit.vue'
import submitUnitSelect from '../components/product/submitUnitSelect.vue' import submitUnitSelect from '../components/product/submitUnitSelect.vue'
import customerServicePopup from '@/components/config/customerServicePopup.vue' import customerServicePopup from '@/components/config/customerServicePopup.vue'
import newCouponPopup from '@/components/couponPopup/newCouponPopup.vue'
import placeOrder from '../components/order/placeOrder.vue' import placeOrder from '../components/order/placeOrder.vue'
import { mapMutations } from 'vuex' import { mapMutations } from 'vuex'
export default { export default {
@ -137,7 +135,6 @@
submit, submit,
submitUnitSelect, submitUnitSelect,
customerServicePopup, customerServicePopup,
newCouponPopup,
placeOrder placeOrder
}, },
data() { data() {


Loading…
Cancel
Save