Browse Source

'测试后修改的第一版'

hfll
hflllll 5 months ago
parent
commit
798329ecb2
24 changed files with 1344 additions and 554 deletions
  1. +3
    -3
      App.vue
  2. +6
    -6
      components/base/navbar.vue
  3. +8
    -1
      components/base/tabbar.vue
  4. +1
    -1
      components/order/OrderItem.vue
  5. +9
    -7
      components/product/productItem.vue
  6. +8
    -1
      pages.json
  7. +44
    -30
      pages/index/cart.vue
  8. +2
    -3
      pages/index/center.vue
  9. +424
    -446
      pages/index/index.vue
  10. +453
    -0
      pages/index/oldIndex.vue
  11. +1
    -1
      pages/index/order.vue
  12. +1
    -1
      pages_order/auth/wxUserInfo.vue
  13. +24
    -7
      pages_order/components/order/placeOrder.vue
  14. +2
    -2
      pages_order/mine/share.vue
  15. +5
    -6
      pages_order/mine/team.vue
  16. +7
    -4
      pages_order/mine/unbindTeam.vue
  17. +0
    -1
      pages_order/mine/updateUser.vue
  18. +16
    -8
      pages_order/mine/wallet.vue
  19. +1
    -1
      pages_order/order/groupMealDetail.vue
  20. +104
    -15
      pages_order/order/newOrderDetail.vue
  21. +8
    -1
      pages_order/product/productDetail.vue
  22. +166
    -0
      static/js/mockHomeData.js
  23. +23
    -0
      store/modules/cartNum.js
  24. +28
    -9
      store/store.js

+ 3
- 3
App.vue View File

@ -4,9 +4,9 @@
this.$store.commit('initConfig')
// token访
// if(uni.getStorageSync('token')){
// this.$store.commit('getQrCode')
// }
if(uni.getStorageSync('token')){
this.$store.commit('getUserInfo')
}
// token


+ 6
- 6
components/base/navbar.vue View File

@ -8,30 +8,30 @@
<uv-icon name="home"
v-if="leftClick && length == 1"
@click="toHome"
:color="color" size="46rpx"></uv-icon>
:color="color" size="46rpx" />
<uv-icon name="arrow-left"
v-else-if="leftClick"
@click="$emit('leftClick')"
:color="color" size="46rpx"></uv-icon>
:color="color" size="46rpx" />
</view>
<view>{{ title }}</view>
<view class="icon">
<uv-icon name="search"
v-if="isSearch"
:color="color" size="58rpx"></uv-icon>
:color="color" size="58rpx" />
<uv-icon name="plus-circle" :color="color"
v-if="isPlus"
@click="plusCircleShow = true"
size="46rpx" style="margin-left: 30rpx;"></uv-icon>
size="46rpx" style="margin-left: 30rpx;" />
<view v-if="moreClick" style="margin-left: 30rpx;">
<uv-icon name="more-dot-fill" :color="color"
v-if="!moreText"
@click="moreClick()"
size="46rpx"></uv-icon>
size="46rpx" />
<view v-else @click="moreClick"
style="font-weight: 400;font-size: 30rpx;">
{{ moreText }}
@ -90,7 +90,7 @@
return
}
uni.reLaunch({
url: '/pages/index/category' //
url: '/pages/index/index' //
})
}
}


+ 8
- 1
components/base/tabbar.vue View File

@ -25,11 +25,18 @@
data() {
return {
list: [
{
"selectedIconPath": "/static/image/tabbar/home-active.png",
"iconPath": "/static/image/tabbar/home.png",
"pagePath": "/pages/index/index",
"title": "首页",
key: 'index',
},
{
"selectedIconPath": "/static/image/tabbar/product-list-active.png",
"iconPath": "/static/image/tabbar/product-list.png",
"pagePath": "/pages/index/category",
"title": "首页",
"title": "商品",
key: 'category',
},
{


+ 1
- 1
components/order/OrderItem.vue View File

@ -22,7 +22,7 @@
<!-- 订单信息 - 下单时间和价格 -->
<view class="order-info">
<view class="order-time">下单时间{{ order.updateTime }}</view>
<view class="order-time">下单时间{{ order.createTime }}</view>
<view class="order-price">
<text>合计:</text>
<text class="price">{{ order.priceAll }}</text>


+ 9
- 7
components/product/productItem.vue View File

@ -5,8 +5,7 @@
<!-- <image :src="item.image &&
item.image.split(',')[0]" mode="aspectFill">
</image> -->
<image :src="item.image" mode="aspectFill" class="item-image-img">
</image>
<image :src="item.image" mode="aspectFill" class="item-image-img" />
</view>
<!-- 商品信息 -->
@ -114,7 +113,7 @@
</view>
<view @click.stop="addCart(item)" class="buy-btn">
<uv-badge type="error" max="9" :value="1" absolute :offset="[-10, 1]" bg-color="#FF2A2A"></uv-badge>
<uv-badge type="error" max="9" :value="getProductCount(item.id)" absolute :offset="[-10, 1]" bg-color="#FF2A2A" />
加购物车
</view>
</view>
@ -124,7 +123,9 @@
<script>
import {
mapState
mapState,
mapGetters,
mapMutations
} from 'vuex'
export default {
@ -134,19 +135,20 @@
}
},
computed: {
...mapState(['userInfo'])
...mapState(['userInfo']),
...mapGetters( 'cartNum' , ['getProductCount'] )
},
data() {
return {
}
},
methods: {
...mapMutations( 'cartNum' , ['incrementProduct'] ),
// ()
purchase() {
this.$emit('purchase')
},
//
addCart(item){
this.incrementProduct({ productId: item.id })
uni.showLoading({
title: '加载中...'
})


+ 8
- 1
pages.json View File

@ -1,12 +1,19 @@
{
"pages": [
{
"path": "pages/index/category",
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": true
}
},
{
"path": "pages/index/category",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
},
{
"path": "pages/index/order",
"style": {


+ 44
- 30
pages/index/cart.vue View File

@ -36,11 +36,12 @@
</view>
</view>
</uv-checkbox-group>
<uv-empty mode="car" style="padding-top: 300rpx;" v-if="!cartData.records || !cartData.records.length"
text="购物车空空如也~" />
<view style="padding-top: 300rpx;">
<uv-empty mode="car" v-if="!cartData.records || !cartData.records.length" text="购物车空空如也~" />
</view>
</view>
<view class="cart-footer">
<view class="cart-footer" v-if="cartData.records && cartData.records.length">
<view class="select-all">
<uv-checkbox-group v-model="allCheckbox">
<uv-checkbox size="40rpx" iconSize="35rpx" activeColor="#019245" shape="circle" name="all"
@ -53,9 +54,9 @@
<text v-if="!isManaged">合计</text>
<text v-if="!isManaged" class="total-price">¥{{ (totalPrice).toFixed(2) }}</text>
<view v-if="isManaged" class="checkout-btn checkbox-collect" @tap="addCollect">
<!-- <view v-if="isManaged" class="checkout-btn checkbox-collect" @tap="addCollect">
<text>添加收藏</text>
</view>
</view> -->
</view>
<view v-if="!isManaged" class="checkout-btn checkbox-primary" @tap="checkout">
<text>去下单</text>
@ -164,33 +165,46 @@ export default {
url: '/pages_order/order/newOrderDetail?status=cart'
});
},
//
addCollect(){
if (!this.checkboxValue.length) {
uni.showToast({
title: '请选择商品',
icon: 'none'
});
return;
}
uni.showLoading({
title: '添加收藏中...'
})
setTimeout(() => {
uni.hideLoading()
uni.showToast({
title: '添加收藏成功',
})
//
}, 800)
},
// //
// addCollect(){
// if (!this.checkboxValue.length) {
// uni.showToast({
// title: '',
// icon: 'none'
// });
// return;
// }
// uni.showLoading({
// title: '...'
// })
// setTimeout(() => {
// uni.hideLoading()
// uni.showToast({
// title: '',
// })
// //
// }, 800)
// },
//
deleteCart(){
this.$api('deleteShopcar', {
shopcarId: this.deleteCartIds,
}, res => {
if (res.code == 200){
this.getCartData()
uni.showModal({
title: '提示',
content: '确定删除购物车?',
success: (res) => {
if (res.confirm) {
this.$api('deleteShopcar', {
shopcarId: this.deleteCartIds,
}, res => {
if (res.code == 200){
uni.showToast({
title: '删除成功',
icon: 'success',
duration: 1000
})
this.getCartData()
}
})
}
}
})
}


+ 2
- 3
pages/index/center.vue View File

@ -166,7 +166,6 @@
<text class="function-text">推广链接</text>
</view>
<view class="function-item" @tap="navigateTo('/pages_order/mine/wallet')">
<view class="function-icon">
<uv-icon name="chat" size="94rpx" color="#019245" />
@ -231,7 +230,7 @@ export default {
uni.showToast({
title: '切换成功',
icon: 'success',
duration: 2000
duration: 1000
})
}else if (res.result.status == '2'){
uni.showModal({
@ -272,7 +271,7 @@ export default {
uni.showToast({
title: '切换成功',
icon: 'success',
duration: 2000
duration: 1000
})
}
}


+ 424
- 446
pages/index/index.vue View File

@ -1,453 +1,431 @@
<template>
<view class="home">
<view style="background-color: white;">
<!-- 导航栏 -->
<navbar :title="configList.logo_name"/>
<!-- 搜索栏 -->
<view class="search">
<uv-search placeholder="搜你喜欢的产品" bgColor="#fff" @custom="search" @search="search"
v-model="keyword"></uv-search>
</view>
<!-- 轮播图 -->
<view class="swipe">
<uv-swiper :list="bannerList" indicator height="320rpx" keyName="image"></uv-swiper>
</view>
<!-- 首页-分类菜单 -->
<view class="home-menu">
<uv-grid :border="false" :col="5">
<uv-grid-item v-for="(item, index) in categoryList"
:key="index"
@tap="$utils.navigateTo(`/pages/index/category?cid=${item.id}`)">
<image :src="item.image" mode="aspectFill"></image>
<text class="menu-text">{{item.name}}</text>
</uv-grid-item>
</uv-grid>
</view>
</view>
<!-- 新人专享 -->
<view class="new-people">
<view class="new-perple-top">
<view class="new-perple-top-left">
<view class="title">
最新活动
</view>
<!-- <view class="descript">
领199元大礼包
</view> -->
</view>
<view class="new-perple-top-right"
@tap="$utils.navigateTo(`/pages_order/home/journalism`)">
<image :src="configList.index_model" mode="aspectFill"></image>
</view>
</view>
<view class="new-perple-main">
<!-- <view class="red-packet">
<image src="@/static/image/home/red-packet.png" mode="aspectFill"></image>
</view> -->
<view v-for="(item, index) in adList" :key="item.id"
@tap="$utils.navigateTo(`/pages_order/home/newsDetail?id=${item.id}`)"
class="activity">
<image :src="item.icon" mode="aspectFill"></image>
<view class="title">{{ item.title }}</view>
<!-- <view class="product-price">
100
</view> -->
</view>
</view>
</view>
<!-- 视频 -->
<view v-if="configList.index_vo" class="video-line">
<view class="line"></view>
视频
</view>
<view v-if="configList.index_vo" class="video-item">
<video
:src="configList.index_vo"
object-fit="cover"
@error="videoErrorCallback"
:danmu-list="danmuList"
controls class="product-video"></video>
</view>
<!-- 推荐 -->
<view class="recommend">
<view class="recommend-title">
<view class="line"></view>
推荐宝贝
</view>
<view @tap="$utils.navigateTo('/pages/index/category')"
class="recommend-more">更多</view>
</view>
<!-- 商品列表 -->
<view style="position: 20rpx;">
<productList :list="list" />
</view>
<!-- 全局弹框 -->
<PrivacyAgreementPoup />
<!-- 联系客服 -->
<customerServicePopup ref="customerServicePopup" />
<!-- tabbar -->
<tabber select="home" />
<!-- 优惠券弹窗 -->
<couponPopup v-if="riceInfo.isGetCoupon"></couponPopup>
</view>
<view class="page">
<navbar title="首页" bgColor="#019245" color="#fff" />
<!-- 内容区域 -->
<view class="content">
<!-- 轮播图 -->
<swiper class="banner-swiper" circular autoplay>
<swiper-item v-for="item in homeData.banners" :key="item.id">
<image :src="item.image" mode="aspectFill" class="banner-image" />
</swiper-item>
</swiper>
<!-- 店铺信息 -->
<view class="restaurant-info">
<div class="restaurant-logo">
<image :src="configList.config_logo" mode="aspectFill" style="width: 100%; height: 100%;" />
</div>
<view class="restaurant-name">{{homeData.restaurant.name}}</view>
<!-- <view class="service-btns">
<view class="service-btn">
<text>客服</text>
</view>
<view class="order-btn">
<text>订阅</text>
</view>
</view> -->
</view>
<!-- 商店内容区域 -->
<view class="shop-content">
<!-- 产品标签页 -->
<view class="product-tabs">
<!-- 公告信息 -->
<view class="notice">
<text class="notice-text">{{homeData.restaurant.notice}}</text>
<text class="notice-desc">{{homeData.restaurant.description}}</text>
</view>
<!-- 标签列表 -->
<view class="tag-list">
<view class="tag" v-for="(tag, index) in homeData.tags" :key="index">{{tag}}</view>
</view>
<!-- 价格区间 -->
<view class="price-range">
<text class="price">{{homeData.priceRange}}</text>
</view>
<!-- 产品展示 -->
<scroll-view scroll-x class="food-scroll">
<view class="food-item" v-for="food in homeData.foods" :key="food.id">
<image :src="food.image" mode="aspectFill" class="food-image" />
<view class="food-detail">
<view class="food-name">{{food.name}}</view>
<view class="food-desc">{{food.desc}}</view>
<view class="food-price">
<text class="current-price">¥{{food.price}}</text>
<text class="original-price">¥{{food.originalPrice}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
<!-- 跟团部分 -->
<view class="group-purchase">
<view class="group-order-list">
<swiper vertical autoplay circular interval="3000" duration="500"
display-multiple-items="3">
<swiper-item v-for="(order, index) in orderList" :key="index">
<view class="order-item">
<view class="order-id">{{ order.id }}</view>
<view class="order-user">
<image :src="order.avatar" mode="aspectFill" class="user-avatar" />
<text class="user-name">{{ order.userName }}</text>
<text class="order-time">{{ order.time }}</text>
</view>
<view class="order-content">
<text class="order-desc">{{ order.content }}</text>
<text class="order-count">+{{ order.count }}</text>
</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
</view>
<tabbar select="index" />
</view>
</template>
<script>
import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
import Position from '@/utils/position.js'
import tabber from '@/components/base/tabbar.vue'
import couponPopup from "@/components/couponPopup/couponPopup.vue"
import {
mapState
} from 'vuex'
import customerServicePopup from '@/components/config/customerServicePopup.vue'
import productList from '@/components/user/productList.vue'
import mixinsList from '@/mixins/list.js'
export default {
mixins: [mixinsList],
components: {
tabber,
PrivacyAgreementPoup,
customerServicePopup,
productList,
couponPopup
},
data() {
return {
notice: '',
bannerList: [],
baseList: [],
productList: [],
keyword: '',
commonProductList: [], //
riceProductList: [], //
newList: [], //
mixinsListApi: 'getClassShopPageList',
adList: [],
categoryList : [],
}
},
computed: {
...mapState(['riceInfo', 'category'])
},
onLoad(query) {
if (query.shareId) {
uni.setStorageSync('shareId', query.shareId)
}
},
onShow() {
this.getBanner()
this.getRiceNoticeList()
this.getRiceIconList()
this.getCategoryList()
this.getRiceAdList()
if(uni.getStorageSync('token')){
this.$store.commit('getRiceInfo')
this.$store.commit('getUserInfo')
}
},
onPullDownRefresh() {
this.getBanner()
this.getRiceNoticeList()
},
methods: {
//
search() {
uni.navigateTo({
url: '/pages/index/category?search=' + this.keyword
})
this.keyword = ''
},
//
getCategoryList() {
this.$api('getPidList', res => {
if (res.code == 200) {
this.categoryList = res.result
}
})
},
//
getBanner() {
this.$api('getRiceBanner', res => {
if (res.code == 200) {
this.bannerList = res.result
}
})
},
//
getRiceNoticeList() {
this.$api('getRiceNoticeList', res => {
if (res.code == 200) {
this.notice = res.result.title
}
})
},
//
getRiceNewsList() {
this.$api('getRiceNewsList', res => {
if (res.code == 200) {
this.newList = res.result.records
}
})
},
//
getRiceIconList() {
this.$api('getRiceIconList', res => {
if (res.code == 200) {
this.baseList = res.result
}
})
},
//广
getRiceAdList() {
this.$api('getRiceProductList', {
pageNo: 1,
pageSize: 4,
}, res => {
if (res.code == 200) {
this.adList = res.result.records
}
})
},
//
toUrl(url) {
if (!url) {
uni.showToast({
title: '功能暂未开放',
icon: 'none'
})
return
}
if (url == '::phone') {
this.$refs.customerServicePopup.open()
return
}
uni.navigateTo({
url
})
},
//
videoErrorCallback: function(e) {
uni.showModal({
content: e.target.errMsg,
showCancel: false
})
},
//
scroll: function(e) {
},
},
}
import navbar from '@/components/base/navbar.vue'
import tabbar from '@/components/base/tabbar.vue'
import { homeData } from '@/static/js/mockHomeData.js'
export default {
components: {
navbar,
tabbar
},
data() {
return {
homeData: homeData,
orderList: [
{
id: 19141,
userName: '3**',
avatar: '/static/image/中森明菜.webp',
time: '1分钟前',
content: '【单点】小炒黄牛肉...',
count: 1
},
{
id: 19145,
userName: 'B**',
avatar: '/static/image/中森明菜.webp',
time: '1分钟前',
content: '黑椒肥牛饭(1份)',
count: 1
},
{
id: 19144,
userName: '吃**',
avatar: '/static/image/中森明菜.webp',
time: '1分钟前',
content: '【单点】黑盒220g...',
count: 1
},
{
id: 19143,
userName: 'L**',
avatar: '/static/image/中森明菜.webp',
time: '2分钟前',
content: '红烧肉套餐(1份)',
count: 2
},
{
id: 19142,
userName: '美**',
avatar: '/static/image/中森明菜.webp',
time: '3分钟前',
content: '【单点】小炒肉(1份)',
count: 1
}
]
}
}
}
</script>
<style scoped lang="scss">
.home {
//
.search {
border: 1px solid #F0F0F0;
margin: 20rpx;
border-radius: 41rpx;
padding: 10rpx 0rpx;
display: flex;
align-items: center;
/deep/ .uv-search__action {
background-color: $uni-color;
color: #FFFFFF;
padding: 10rpx 20rpx;
border-radius: 30rpx;
}
}
//
.swipe {
overflow: hidden;
border-radius: 20rpx;
margin: 20rpx;
}
// -
.home-menu {
margin: 20rpx;
border-radius: 20rpx;
padding: 20rpx 0rpx;
background-color: #fff;
image {
width: 80rpx;
height: 80rpx;
margin-top: 10rpx;
}
.menu-text {
font-size: 28rpx;
margin: 10rpx 0rpx;
}
}
//
.new-people {
background: white;
padding: 20rpx;
margin-bottom: 20rpx;
.new-perple-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
.new-perple-top-left {
display: flex;
align-items: center;
color: $uni-color;
.title {
font-size: 40rpx;
font-weight: bold;
}
.descript {
margin-left: 10rpx;
}
}
.new-perple-top-right {
image {
width: 80px;
height: 40rpx;
}
}
}
.new-perple-main {
display: flex;
.red-packet {
display: flex;
align-items: center;
justify-content: center;
width: 20%;
image {
width: 120rpx;
height: 120rpx;
}
}
.activity {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 25%;
background: white;
border-radius: 10px;
image {
width: 140rpx;
height: 140rpx;
border-radius: 10rpx;
}
.title {
background: $uni-color;
color: white;
border-radius: 20rpx;
font-size: 24rpx;
padding: 5rpx 10rpx;
margin: 10rpx 0rpx;
width: 90%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box;
text-align: center;
}
.product-price {
color: $uni-color;
font-size: 24rpx;
}
}
}
}
//
.video-line {
display: flex;
align-items: center;
padding: 20rpx;
background: white;
font-size: 34rpx;
}
.line {
height: 40rpx;
width: 10rpx;
background: $uni-color;
border-radius: 5rpx;
margin-right: 10rpx;
}
.video-item {
display: flex;
justify-content: center;
align-items: center;
margin: 20rpx 0rpx;
.product-video {
border-radius: 20rpx;
width: calc(710rpx);
// height: 320rpx;
}
}
//
.recommend {
display: flex;
align-items: center;
justify-content: space-between;
background: white;
margin: 20rpx 0rpx;
padding: 20rpx;
.recommend-title {
font-size: 34rpx;
display: flex;
align-items: center;
}
.recommend-more {
color: $uni-color;
}
}
}
<style lang="scss" scoped>
.content {
flex: 1;
background: linear-gradient(to bottom, #fff, #f5f5f5);
// padding-bottom: 120rpx;
}
.banner-swiper {
width: 100%;
height: 350rpx;
position: relative;
z-index: 1;
}
.banner-image {
width: 100%;
height: 100%;
}
.restaurant-info {
display: flex;
align-items: center;
padding: 20rpx;
margin-top: -30rpx;
max-height: 60rpx;
border-radius: 20rpx 20rpx 0 0;
background-color: #fff;
border-bottom: 1px solid #eee;
position: relative;
z-index: 2;
}
.restaurant-logo {
width: 130rpx;
height: 130rpx;
border-radius: 20rpx;
margin-right: 20rpx;
margin-top: -60rpx;
overflow: hidden;
border: 4rpx solid #eee;
}
.restaurant-name {
flex: 1;
font-size: 32rpx;
font-weight: 500;
}
.service-btns {
display: flex;
}
.service-btn, .order-btn {
padding: 8rpx 20rpx;
border-radius: 30rpx;
font-size: 24rpx;
margin-left: 10rpx;
}
.service-btn {
border: 1px solid #ccc;
color: #666;
}
.order-btn {
background-color: #4cd964;
color: #fff;
}
.shop-content {
margin-top: 0;
padding: 20rpx;
position: relative;
z-index: 2;
}
/* 产品标签页 */
.product-tabs {
// border: 2rpx solid red;
background-color: #fff;
border-radius: 20rpx;
margin-bottom: 10rpx;
padding: 20rpx;
box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
}
.notice {
margin-bottom: 15rpx;
}
.notice-text {
font-size: 32rpx;
font-weight: bold;
margin-right: 10rpx;
max-width: 80%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
.notice-desc {
font-size: 24rpx;
color: #999;
background-color: #f5f5f5;
padding: 4rpx 10rpx;
border-radius: 4rpx;
}
.tag-list {
display: flex;
flex-wrap: wrap;
margin-bottom: 15rpx;
}
.tag {
font-size: 24rpx;
color: $uni-color-second;
border: 1px solid #ffcccc;
padding: 4rpx 12rpx;
border-radius: 4rpx;
margin-right: 10rpx;
margin-bottom: 10rpx;
}
.price-range {
margin-bottom: 20rpx;
}
.price {
font-size: 36rpx;
color: $uni-color-second;
font-weight: bold;
}
.food-scroll {
white-space: nowrap;
}
.food-item {
display: inline-block;
width: 300rpx;
margin-right: 20rpx;
background-color: #fff;
border-radius: 10rpx;
overflow: hidden;
box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
}
.food-image {
width: 140rpx;
height: 140rpx;
}
.food-detail {
padding: 10rpx;
}
.food-name {
font-size: 28rpx;
font-weight: bold;
margin-bottom: 5rpx;
}
.food-desc {
font-size: 24rpx;
color: #999;
margin-bottom: 5rpx;
white-space: normal;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.food-price {
display: flex;
align-items: baseline;
}
.current-price {
font-size: 28rpx;
color: $uni-color-second;
font-weight: bold;
margin-right: 10rpx;
}
.original-price {
font-size: 24rpx;
color: #999;
text-decoration: line-through;
}
.group-purchase {
background-color: #fff;
border-radius: 20rpx;
margin: 0rpx 20rpx 30rpx 20rpx;
padding: 30rpx 20rpx;
box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
}
.group-order-list {
// height: 330rpx;
overflow: hidden;
}
.order-item {
display: flex;
padding: 10rpx;
border-bottom: 1rpx solid #f2f2f2;
align-items: center;
justify-content: space-between;
}
.order-id {
// flex: 1;
font-size: 26rpx;
color: #999;
margin-right: 10rpx;
// display: inline-block;
}
.order-user {
flex: 1;
display: flex;
align-items: center;
width: 140rpx;
}
.user-avatar {
width: 54rpx;
height: 54rpx;
border-radius: 6rpx;
margin-right: 10rpx;
}
.user-name {
font-size: 26rpx;
color: black;
}
.order-time {
font-size: 24rpx;
color: #999;
margin-left: 10rpx;
}
.order-content {
flex: 1;
display: flex;
justify-content: flex-end;
align-items: center;
// margin-left: 10rpx;
}
.order-desc {
font-size: 28rpx;
color: #333;
font-weight: bold;
max-width: 88%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 10rpx;
}
.order-count {
font-size: 28rpx;
color: $uni-color-second;
// font-weight: bold;
}
</style>

+ 453
- 0
pages/index/oldIndex.vue View File

@ -0,0 +1,453 @@
<template>
<view class="home">
<view style="background-color: white;">
<!-- 导航栏 -->
<navbar :title="configList.logo_name"/>
<!-- 搜索栏 -->
<view class="search">
<uv-search placeholder="搜你喜欢的产品" bgColor="#fff" @custom="search" @search="search"
v-model="keyword"></uv-search>
</view>
<!-- 轮播图 -->
<view class="swipe">
<uv-swiper :list="bannerList" indicator height="320rpx" keyName="image"></uv-swiper>
</view>
<!-- 首页-分类菜单 -->
<view class="home-menu">
<uv-grid :border="false" :col="5">
<uv-grid-item v-for="(item, index) in categoryList"
:key="index"
@tap="$utils.navigateTo(`/pages/index/category?cid=${item.id}`)">
<image :src="item.image" mode="aspectFill"></image>
<text class="menu-text">{{item.name}}</text>
</uv-grid-item>
</uv-grid>
</view>
</view>
<!-- 新人专享 -->
<view class="new-people">
<view class="new-perple-top">
<view class="new-perple-top-left">
<view class="title">
最新活动
</view>
<!-- <view class="descript">
领199元大礼包
</view> -->
</view>
<view class="new-perple-top-right"
@tap="$utils.navigateTo(`/pages_order/home/journalism`)">
<image :src="configList.index_model" mode="aspectFill"></image>
</view>
</view>
<view class="new-perple-main">
<!-- <view class="red-packet">
<image src="@/static/image/home/red-packet.png" mode="aspectFill"></image>
</view> -->
<view v-for="(item, index) in adList" :key="item.id"
@tap="$utils.navigateTo(`/pages_order/home/newsDetail?id=${item.id}`)"
class="activity">
<image :src="item.icon" mode="aspectFill"></image>
<view class="title">{{ item.title }}</view>
<!-- <view class="product-price">
100
</view> -->
</view>
</view>
</view>
<!-- 视频 -->
<view v-if="configList.index_vo" class="video-line">
<view class="line"></view>
视频
</view>
<view v-if="configList.index_vo" class="video-item">
<video
:src="configList.index_vo"
object-fit="cover"
@error="videoErrorCallback"
:danmu-list="danmuList"
controls class="product-video"></video>
</view>
<!-- 推荐 -->
<view class="recommend">
<view class="recommend-title">
<view class="line"></view>
推荐宝贝
</view>
<view @tap="$utils.navigateTo('/pages/index/category')"
class="recommend-more">更多</view>
</view>
<!-- 商品列表 -->
<view style="position: 20rpx;">
<productList :list="list" />
</view>
<!-- 全局弹框 -->
<PrivacyAgreementPoup />
<!-- 联系客服 -->
<customerServicePopup ref="customerServicePopup" />
<!-- tabbar -->
<tabber select="home" />
<!-- 优惠券弹窗 -->
<couponPopup v-if="riceInfo.isGetCoupon"></couponPopup>
</view>
</template>
<script>
import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
import Position from '@/utils/position.js'
import tabber from '@/components/base/tabbar.vue'
import couponPopup from "@/components/couponPopup/couponPopup.vue"
import {
mapState
} from 'vuex'
import customerServicePopup from '@/components/config/customerServicePopup.vue'
import productList from '@/components/user/productList.vue'
import mixinsList from '@/mixins/list.js'
export default {
mixins: [mixinsList],
components: {
tabber,
PrivacyAgreementPoup,
customerServicePopup,
productList,
couponPopup
},
data() {
return {
notice: '',
bannerList: [],
baseList: [],
productList: [],
keyword: '',
commonProductList: [], //
riceProductList: [], //
newList: [], //
mixinsListApi: 'getClassShopPageList',
adList: [],
categoryList : [],
}
},
computed: {
...mapState(['riceInfo', 'category'])
},
onLoad(query) {
if (query.shareId) {
uni.setStorageSync('shareId', query.shareId)
}
},
onShow() {
this.getBanner()
this.getRiceNoticeList()
this.getRiceIconList()
this.getCategoryList()
this.getRiceAdList()
if(uni.getStorageSync('token')){
this.$store.commit('getRiceInfo')
this.$store.commit('getUserInfo')
}
},
onPullDownRefresh() {
this.getBanner()
this.getRiceNoticeList()
},
methods: {
//
search() {
uni.navigateTo({
url: '/pages/index/category?search=' + this.keyword
})
this.keyword = ''
},
//
getCategoryList() {
this.$api('getPidList', res => {
if (res.code == 200) {
this.categoryList = res.result
}
})
},
//
getBanner() {
this.$api('getRiceBanner', res => {
if (res.code == 200) {
this.bannerList = res.result
}
})
},
//
getRiceNoticeList() {
this.$api('getRiceNoticeList', res => {
if (res.code == 200) {
this.notice = res.result.title
}
})
},
//
getRiceNewsList() {
this.$api('getRiceNewsList', res => {
if (res.code == 200) {
this.newList = res.result.records
}
})
},
//
getRiceIconList() {
this.$api('getRiceIconList', res => {
if (res.code == 200) {
this.baseList = res.result
}
})
},
//广
getRiceAdList() {
this.$api('getRiceProductList', {
pageNo: 1,
pageSize: 4,
}, res => {
if (res.code == 200) {
this.adList = res.result.records
}
})
},
//
toUrl(url) {
if (!url) {
uni.showToast({
title: '功能暂未开放',
icon: 'none'
})
return
}
if (url == '::phone') {
this.$refs.customerServicePopup.open()
return
}
uni.navigateTo({
url
})
},
//
videoErrorCallback: function(e) {
uni.showModal({
content: e.target.errMsg,
showCancel: false
})
},
//
scroll: function(e) {
},
},
}
</script>
<style scoped lang="scss">
.home {
//
.search {
border: 1px solid #F0F0F0;
margin: 20rpx;
border-radius: 41rpx;
padding: 10rpx 0rpx;
display: flex;
align-items: center;
/deep/ .uv-search__action {
background-color: $uni-color;
color: #FFFFFF;
padding: 10rpx 20rpx;
border-radius: 30rpx;
}
}
//
.swipe {
overflow: hidden;
border-radius: 20rpx;
margin: 20rpx;
}
// -
.home-menu {
margin: 20rpx;
border-radius: 20rpx;
padding: 20rpx 0rpx;
background-color: #fff;
image {
width: 80rpx;
height: 80rpx;
margin-top: 10rpx;
}
.menu-text {
font-size: 28rpx;
margin: 10rpx 0rpx;
}
}
//
.new-people {
background: white;
padding: 20rpx;
margin-bottom: 20rpx;
.new-perple-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
.new-perple-top-left {
display: flex;
align-items: center;
color: $uni-color;
.title {
font-size: 40rpx;
font-weight: bold;
}
.descript {
margin-left: 10rpx;
}
}
.new-perple-top-right {
image {
width: 80px;
height: 40rpx;
}
}
}
.new-perple-main {
display: flex;
.red-packet {
display: flex;
align-items: center;
justify-content: center;
width: 20%;
image {
width: 120rpx;
height: 120rpx;
}
}
.activity {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 25%;
background: white;
border-radius: 10px;
image {
width: 140rpx;
height: 140rpx;
border-radius: 10rpx;
}
.title {
background: $uni-color;
color: white;
border-radius: 20rpx;
font-size: 24rpx;
padding: 5rpx 10rpx;
margin: 10rpx 0rpx;
width: 90%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box;
text-align: center;
}
.product-price {
color: $uni-color;
font-size: 24rpx;
}
}
}
}
//
.video-line {
display: flex;
align-items: center;
padding: 20rpx;
background: white;
font-size: 34rpx;
}
.line {
height: 40rpx;
width: 10rpx;
background: $uni-color;
border-radius: 5rpx;
margin-right: 10rpx;
}
.video-item {
display: flex;
justify-content: center;
align-items: center;
margin: 20rpx 0rpx;
.product-video {
border-radius: 20rpx;
width: calc(710rpx);
// height: 320rpx;
}
}
//
.recommend {
display: flex;
align-items: center;
justify-content: space-between;
background: white;
margin: 20rpx 0rpx;
padding: 20rpx;
.recommend-title {
font-size: 34rpx;
display: flex;
align-items: center;
}
.recommend-more {
color: $uni-color;
}
}
}
</style>

+ 1
- 1
pages/index/order.vue View File

@ -35,7 +35,7 @@
<!-- 订单列表 -->
<view class="order-list" v-else>
<OrderItem v-for="(order, index) in orderList" :key="order.id" :order="order" @cancel="handleCancelOrder(order.id)"
@pick="handlePickOrder(order.id)" @pay="handlePayOrder" @click="goToOrderDetail(order)" />
@pick="handlePickOrder(order.id)" @pay="goToOrderDetail(order)" @click="goToOrderDetail(order)" />
<view style="margin-top: 200rpx; min-width: 700rpx;">
<uv-empty mode="order" v-if="orderList.length == 0" />
</view>


+ 1
- 1
pages_order/auth/wxUserInfo.vue View File

@ -6,7 +6,7 @@
<view class="logo">
<image src="@/static/image/logo.webp" mode="aspectFill"></image>
</view>
<view class="title" v-if="configList.config_app_name">
<view class="title" v-if="configList.config_logo">
{{ configList.config_app_name }}
</view>
<view class="app-name" v-else>


+ 24
- 7
pages_order/components/order/placeOrder.vue View File

@ -5,7 +5,7 @@
<view class="place-order-title">
<image src="@/static/image/多人下单.webp" mode="aspectFit" class="place-order-title-image" />
<text class="number">{{ item.orderNum }}</text><text>人下单</text>
<text class="number">{{ item.sales }}</text><text class="text">人下单</text>
<view class="place-order-title-close" @click="close">
<uv-icon name="close" size="40rpx"></uv-icon>
</view>
@ -59,8 +59,7 @@
<uv-icon name="red-packet" size="70rpx" color="#019245" />
<text style="flex: 1;">
账户余额
<text style="color: gray; margin-left: 20rpx;">(余额: {{ userInfo.balance.toFixed(2) }})
</text>
<text style="color: gray; margin-left: 20rpx;">(余额: {{ userInfo.balance ? userInfo.balance.toFixed(2) : 0 }})</text>
</text>
<uv-radio activeColor="#019245" size="40rpx" name="1" />
</view>
@ -103,6 +102,7 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'placeOrder',
data() {
@ -119,7 +119,9 @@ export default {
default: () => {}
}
},
computed: {
...mapState(['userInfo']),
priceAll () {
return this.item.price * this.value
},
@ -160,6 +162,20 @@ export default {
//
createOrder(){
if (!this.pickupPoint) {
uni.showToast({
title: '请选择取餐地点',
icon: 'error'
})
return
}
if (this.payMethod == '1' && this.userInfo.balance < this.priceAll) {
uni.showToast({
title: '余额不足',
icon: 'error'
})
return
}
uni.showLoading({
title: '下单中...'
})
@ -169,7 +185,8 @@ export default {
pricePreferential: 0,
payType: this.payMethod,
leaderId: this.pickupPoint.id,
goodss: this.goodss
goodss: this.goodss,
remark: this.remark
}, res => {
uni.hideLoading()
if (res.code === 200) {
@ -195,9 +212,9 @@ export default {
},
mounted(){
this.listenPickupPoint();
},
onShow(){
console.log('onShow');
console.log(123123);
console.log('111', this.userInfo.balance);
},
beforeDestroy() {
uni.$off('updatePickupPoint');


+ 2
- 2
pages_order/mine/share.vue View File

@ -43,7 +43,7 @@
<script>
import navbar from '@/components/base/navbar.vue'
import { shareData } from '@/static/js/mockShare.js'
// import { shareData } from '@/static/js/mockShare.js'
export default {
components: {
@ -100,7 +100,7 @@ export default {
//
uni.getImageInfo({
//
src: this.shareData.qrCodeImage, //
src: this.shareData.url, //
success: (res) => {
uni.saveImageToPhotosAlbum({
//


+ 5
- 6
pages_order/mine/team.vue View File

@ -5,7 +5,7 @@
color="#fff" />
<!-- 顶部图片区域 -->
<view class="banner" v-if="!identity">s
<view class="banner" v-if="!identity">
<image src="/static/image/红烧肉.webp" mode="aspectFill" class="banner-image"></image>
</view>
@ -91,15 +91,14 @@ export default {
},
identity: uni.getStorageSync('identity'),
status: '-1', // -1 0 1 2
remark: '' //
remark: '', //
noBind: false //
}
},
methods: {
//
chooseImage() {
this.$Oss.ossUploadImage({
key: '',
folder: '',
compressed: true,
success: (res) => {
console.log('上传成功',res);
@ -190,7 +189,7 @@ export default {
console.log(this.formData);
//
this.$api('updateLeaderInfo', {
this.$api('addLeader', {
...this.formData,
}, res => {
uni.hideLoading()
@ -265,7 +264,7 @@ export default {
this.assign(res.result)
this.status = res.result.status
this.remark = res.result.remark
}
}
})
}
}


+ 7
- 4
pages_order/mine/unbindTeam.vue View File

@ -4,7 +4,7 @@
<navbar title="解绑团长" leftClick @leftClick="$utils.navigateBack" bgColor="#019245" color="#fff" />
<!-- 当前取餐点 -->
<view class="section">
<view class="section" v-if="isBind">
<view class="section-title">当前取餐点</view>
<view class="pickup-item" v-if="currentPickupPoint">
<view class="pickup-image">
@ -37,7 +37,8 @@
<!-- 提示信息 -->
<view class="warning-tip">
<uv-icon name="info-circle" color="#FF5722" size="36"></uv-icon>
<text>更换取餐地址和团长,需通过平台审核方可更换!</text>
<text v-if="isBind">更换取餐地址和团长,需通过平台审核方可更换!</text>
<text v-else>您还未绑定团长请先绑定团长!</text>
</view>
<!-- 取餐点列表 -->
@ -81,7 +82,8 @@ export default {
//
currentPickupPoint:{},
//
nearbyPickupPoints:[]
nearbyPickupPoints:[],
isBind: true
}
},
methods: {
@ -123,7 +125,6 @@ export default {
})
this.$api('updateLeader', {
leaderId: point.id
// leaderId: 1915305988566077441
}, res => {
if (res.code == 200) {
uni.hideLoading()
@ -149,6 +150,8 @@ export default {
this.$api('queryMyLeader', {}, res => {
if (res.code == 200){
this.currentPickupPoint = res.result
}else if(res.code == 500 || !res.result){
this.isBind = false
}
})
}


+ 0
- 1
pages_order/mine/updateUser.vue View File

@ -45,7 +45,6 @@
<script>
import { mapState } from 'vuex'
import { mockUserInfo } from '@/static/js/mockUserInfo.js'
import navbar from '@/components/base/navbar.vue'
export default {


+ 16
- 8
pages_order/mine/wallet.vue View File

@ -7,12 +7,16 @@
<view class="balance-card" :style="{ backgroundImage: 'url(/static/image/红烧肉.webp)' }">
<view class="balance-info">
<view class="balance-title">总余额</view>
<view class="balance-amount">{{ userInfo.balance.toFixed(2) }}</view>
<view class="balance-amount">{{ userInfo.balance ? userInfo.balance.toFixed(2) : '0.00' }}</view>
<view class="balance-actions">
<view class="action-btn recharge-btn" v-if="!isRecharge" @tap="navigateToRecharge">
<view class="action-btn recharge-btn" v-if="!isRecharge" @tap="navigateToRecharge">
<text>去充值</text>
<text class="arrow">></text>
</view>
<view class="action-btn recharge-btn" v-if="isRecharge" @tap="isRecharge = false">
<text>提现</text>
<text class="arrow">></text>
</view>
<view class="action-btn" v-else />
<view class="action-btn detail-btn" @tap="navigateToDetail">
<text>资产明细</text>
@ -29,9 +33,9 @@
<!-- 提现金额输入框 -->
<view class="input-item">
<text class="currency-symbol">¥</text>
<input v-if="!isRecharge" class="amount-input" type="digit" v-model="withdrawAmount" placeholder="请输入提现金额"
@blur="validateAmount" />
<input v-else class="amount-input" type="digit" v-model="rechargeAmount" placeholder="请输入充值金额"
<input v-if="!isRecharge" class="amount-input" type="digit" v-model="withdrawAmount"
placeholder="请输入提现金额" @blur="validateAmount" />
<input v-else class="amount-input" type="digit" v-model="rechargeAmount" placeholder="请输入充值金额"
@blur="validateAmount" />
</view>
@ -147,10 +151,8 @@ export default {
//
if (!this.validateAmount() || !this.validateName()) {
console.log(2);
//
if (this.amountError) {
console.log(3);
uni.showToast({
title: this.amountError,
icon: 'error'
@ -213,11 +215,17 @@ export default {
uni.hideLoading()
if (res.code === 200) {
uni.requestPaymentWxPay(res)
.catch(() => {
.then(() => {
this.userInfo.balance += parseFloat(this.rechargeAmount)
this.rechargeAmount = ''
this.isRecharge = false
})
.catch(() => {
uni.showToast({
title: '充值失败',
icon: 'error'
})
})
}
})


+ 1
- 1
pages_order/order/groupMealDetail.vue View File

@ -6,7 +6,7 @@
<view class="container">
<!-- 修改后 -->
<view class="top-btn-group">
<view class="top-btn-group" v-if="status == '2'">
<button class="top-action-btn" @click="test1">通知所有人取餐</button>
<button class="top-action-btn" @click="test2">通知所有人完成订单</button>
</view>


+ 104
- 15
pages_order/order/newOrderDetail.vue View File

@ -54,13 +54,13 @@
<view class="order-info">
<view class="info-item">
<text class="info-label">合计:</text>
<text class="info-value price">{{ orderDetail.priceAll }}</text>
<text class="info-value price">{{ orderDetail.priceAll.toFixed(2) }}</text>
</view>
<view class="info-item" v-if="this.orderDetail.status != '-1'" >
<view class="info-item" v-if="orderStatus != '-1'" >
<text class="info-label">创建时间:</text>
<text class="info-value">{{ orderDetail.createTime }}</text>
</view>
<view class="info-item" v-if="this.orderDetail.status != '-1'">
<view class="info-item" v-if="orderStatus != '-1'">
<text class="info-label">订单编号:</text>
<text class="info-value">{{orderDetail.id}}</text>
</view>
@ -87,7 +87,7 @@
<text>备注</text>
</view>
<view class="remark-content">
<input v-if="orderStatus === '0'" type="text" v-model="orderDetail.remark"
<input v-if="orderStatus === '0' || orderStatus === '-1'" type="text" v-model="orderDetail.remark"
placeholder="请输入您要备注的内容" placeholder-style="font-size: 28rpx" />
<text v-else>{{orderDetail.remark || '无备注信息'}}</text>
</view>
@ -114,17 +114,17 @@
<view class="bottom-bar">
<view class="total-section">
<text class="total-label">{{ orderDetail.goodsList.length || 0 }}<text style="color: black;">合计</text> </text>
<text class="total-price">{{ orderDetail.pricePay || cartPay }}</text>
<text class="total-price">{{ (orderDetail.pricePay || cartPay).toFixed(2) }}</text>
</view>
<view class="pay-button" @tap="handlePay" v-if="orderStatus === '0' || orderStatus === '-1'">立即下单</view>
<view class="pay-button" @tap="handlePay" v-if="orderStatus === '2'">立即取餐</view>
<view class="pay-button" @tap="handleTake" v-if="orderStatus === '3'">取餐完成</view>
</view>
</view>
</template>
<script>
import navbar from '@/components/base/navbar.vue'
import { mapState } from 'vuex'
import { mapState, mapMutations } from 'vuex'
export default {
components: {
navbar
@ -134,14 +134,21 @@
id: '',
payMethod: '0',
showAllFoods: false,
orderStatus: '',
orderDetail: { },
// orderStatus: '',
orderDetail: {
status: '',
remark: '',
goodsList: [],
priceAll: 0,
pricePay: 0,
pricePreferential: 0,
},
cartDiscount: 0,
teamLeader: {}
}
},
computed: {
...mapState(['cartData']),
...mapState(['cartData', 'userInfo']),
showedFoods() {
return this.showAllFoods ? this.orderDetail.goodsList : this.orderDetail.goodsList.slice(0, 3)
},
@ -155,7 +162,7 @@
// goodId,goodNum;goodId2,goodsNum
goodss() {
return this.orderDetail.goodsList.map(item => {
return `${item.id},${item.num},${item.goods.price * item.num}`
return `${item.goodsId},${item.num},${item.goods.price * item.num}`
}).join(';')
}
@ -165,13 +172,18 @@
if (options.status === 'cart') {
this.showCartData()
//
this.orderStatus = '-1'
this.orderDetail.status = '-1'
this.checkBindLeader()
}
else if (options.id) {
this.getOrderDetail(options.id)
}
console.log('userInfo', this.userInfo);
},
methods: {
...mapMutations(['checkBindLeader']),
//
navigateBack() {
uni.navigateBack()
@ -194,7 +206,10 @@
id: this.id
}, res => {
if (res.code === 200) {
console.log('res', res);
this.orderDetail = res.result.records[0]
this.teamLeader = res.result.records[0].teamLeader
}
})
},
@ -208,16 +223,35 @@
//
if(this.orderStatus === '0'){
this.$api('payOrder',{
id: this.id,
payMethod: this.payMethod
payType: this.payMethod,
orderId: this.id,
}, res => {
uni.hideLoading()
console.log('res', res);
if (res.code === 200) {
if (this.payMethod == '0') {
uni.requestPaymentWxPay(res)
.then(( ) => {
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
})
} else {
uni.showToast({
title: '下单成功',
icon: 'success'
})
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
}
}
})
}
//
else if(this.orderStatus === '-1'){
console.log('goodss', this.goodss);
this.$api('createOrder',{
priceAll: this.orderDetail.priceAll,
pricePay: this.orderDetail.priceAll - 0,
@ -229,11 +263,66 @@
uni.hideLoading()
console.log('res', res);
if(res.code === 200){
if (this.payMethod == '0') {
uni.requestPaymentWxPay(res)
.then(n => {
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
})
} else {
uni.showToast({
title: '下单成功',
icon: 'success'
})
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
}
}
})
}
},
// handlePickOrder(orderId) {
// uni.showModal({
// title: '',
// content: '',
// confirmColor: '#019245',
// success: (res) => {
// if (res.confirm) {
// this.$api('finishMemberOrderById', {
// memberOrderId: orderId
// }, res => {
// if (res.code === 200) {
// uni.showToast({
// title: '',
// icon: 'success',
// duration: 2000
// })
// this.getData()
// }
// })
// }
// }
// })
// }
//
handleTake() {
this.$api('finishMemberOrderById', {
memberOrderId: this.id
}, res => {
if (res.code === 200) {
uni.showToast({
title: '取餐完成',
icon: 'success'
})
setTimeout( () => {
uni.navigateBack()
}, 1000)
}
})
},
//
gotoCoupon() {
this.$utils.navigateTo({


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

@ -131,6 +131,7 @@
import customerServicePopup from '@/components/config/customerServicePopup.vue'
import newCouponPopup from '@/components/couponPopup/newCouponPopup.vue'
import placeOrder from '../components/order/placeOrder.vue'
import { mapMutations } from 'vuex'
export default {
components: {
submit,
@ -157,13 +158,14 @@
onShow() {
},
methods: {
...mapMutations( 'cartNum' , ['incrementProduct'] ),
//
share() {
},
//
addCart(){
this.incrementProduct({ productId: this.id })
uni.showLoading({
title: '加载中...'
})
@ -184,6 +186,11 @@
},
//
submit() {
//
if (!uni.getStorageSync('token')) {
this.$utils.navigateTo('/pages_order/auth/wxLogin')
return
}
this.$refs.placeOrder.open()
// this.$store.commit('setPayOrderProduct', [
// this.productDetail


+ 166
- 0
static/js/mockHomeData.js View File

@ -0,0 +1,166 @@
// 首页数据mock
const homeData = {
// 轮播图数据
banners: [
{
id: 1,
image: '/static/image/红烧肉.webp',
url: '/pages/product/detail'
},
{
id: 2,
image: '/static/image/古茗店面.webp',
url: '/pages/product/detail'
},
{
id: 3,
image: '/static/image/home/1.png',
url: '/pages/product/detail'
}
],
// 餐厅信息
restaurant: {
logo: '/static/image/logo.webp',
name: '大卫熊品质午餐',
notice: '5月16日周五取【Davv Bear 大卫熊品质】',
description: '近期发布'
},
// 会员权益与积分商城
memberBenefits: {
title: '会员权益',
desc: '最高9.0折',
icon: '/static/image/券.webp',
url: '/pages/member/benefits'
},
pointsMall: {
title: '积分商城',
desc: '跟团赚积分',
icon: '/static/image/红包.webp',
url: '/pages/points/mall'
},
// 团员晒单数据
teamSharing: {
title: '团员晒单',
descriptions: [
'吃的太快,忘记拍照了,酸笋够味...',
'这家店的红烧肉太香了,搭配米饭刚刚好...',
'必须给黑椒肥牛打call,真的很下饭...',
'今天终于吃到了心心念念的大卫熊午餐...'
],
images: [
'/static/image/红烧肉.webp',
'/static/image/member/1.png',
'/static/image/member/2.png'
]
},
// 产品标签页
productTabs: [
{
id: 1,
name: '默认'
},
{
id: 2,
name: '上新'
},
{
id: 3,
name: '销量'
}
],
// 产品列表
tags: ['今日热卖845件', '新人立减9', '满22减2', '满50减6', '满80减10', '大转盘'],
priceRange: '¥0.1-9999',
foods: [
{
id: 1,
name: '红烧肉套餐',
image: '/static/image/红烧肉.webp',
price: 19.9,
originalPrice: 29.9,
desc: '米饭+红烧肉+配菜+卤蛋'
},
{
id: 2,
name: '小炒黄牛肉',
image: '/static/image/member/1.png',
price: 22.8,
originalPrice: 32.8,
desc: '米饭+黄牛肉+时蔬'
},
{
id: 3,
name: '黑椒肥牛饭',
image: '/static/image/member/2.png',
price: 20.8,
originalPrice: 30.8,
desc: '米饭+黑椒肥牛+时蔬'
}
],
// 跟团学习
teamLearning: {
title: '最新跟团学习',
members: [
{
id: 1,
avatar: '/static/image/中森明菜.webp',
name: '学生妹',
time: '刚刚'
},
{
id: 2,
avatar: '/static/image/中森明菜.webp',
name: '美女团长',
time: '1分钟前'
},
{
id: 3,
avatar: '/static/image/中森明菜.webp',
name: '小可爱',
time: '2分钟前'
}
]
},
// 订单通知
orderNotifications: [
{
id: 19141,
user: '3**',
time: '1分钟前',
content: '【单点】小炒黄牛肉',
count: 1
},
{
id: 19145,
user: 'B**',
time: '1分钟前',
content: '黑椒肥牛饭(1份)',
count: 1
},
{
id: 19144,
user: '吃**',
time: '1分钟前',
content: '【单点】黑盒220g',
count: 1
}
],
// 统计信息
stats: {
viewCount: '1.9万人跟团',
orderCount: '6771人尝过'
}
}
// 统一导出
module.exports = {
homeData
}

+ 23
- 0
store/modules/cartNum.js View File

@ -0,0 +1,23 @@
// store/modules/cartNum.js
// 这是管理分类列表加入购物车数量的store
import Vue from 'vue'
export default {
namespaced: true,
state: {
productCounts: {} // 格式:{ 商品ID: 数量 }
},
mutations: {
// 增加商品数量
incrementProduct(state, { productId, amount = 1 }) {
const currentCount = state.productCounts[productId] || 0
Vue.set(state.productCounts, productId, currentCount + amount)
}
},
getters: {
// 获取指定商品数量
getProductCount: (state) => (productId) => {
return state.productCounts[productId] || 0
}
}
}

+ 28
- 9
store/store.js View File

@ -1,13 +1,16 @@
import Vue from 'vue'
import Vuex from 'vuex'
import utils from '../utils/utils.js'
import cartNum from '@/store/modules/cartNum.js'
Vue.use(Vuex); //vue的插件机制
import api from '@/api/api.js'
//Vuex.Store 构造器选项
const store = new Vuex.Store({
modules: {
cartNum
},
state: {
configList: {}, //配置列表
userInfo: {}, //用户信息
@ -41,14 +44,7 @@ const store = new Vuex.Store({
uni.$emit('initConfig', state.configList)
})
// let config = ['getPrivacyPolicy', 'getUserAgreement']
// config.forEach(k => {
// api(k, res => {
// if (res.code == 200) {
// state.configList[k] = res.result
// }
// })
// })
},
login(state, config = {}) {
uni.showLoading({
@ -93,6 +89,8 @@ const store = new Vuex.Store({
return
}
if (!state.userInfo.nickName ||
!state.userInfo.headImage ||
!state.userInfo.phone
@ -212,6 +210,27 @@ const store = new Vuex.Store({
console.log('data', data)
state.cartData = data
},
// 检查绑定团长与否
checkBindLeader(){
api('queryLeaderInfo', {}, res => {
if(res.code == 500 || !res.result) {
uni.showModal({
title: '提示',
content: '您还未绑定团长,请先绑定团长',
confirmText: '去绑定',
showCancel: false,
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages_order/mine/unbindTeam'
})
}
}
})
}
})
}
},
actions: {},
})


Loading…
Cancel
Save