From 4d997b7b4f843dba804a89ae168854482823561c Mon Sep 17 00:00:00 2001 From: yangwenhua <1289978696@qq.com> Date: Thu, 5 May 2022 10:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5qsqd=E5=88=86=E6=94=AF?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- .../FeedListPopup/FeedListPopup.vue | 233 ++++++++++++- src/components/GoodsList/GoodsList.vue | 21 ++ src/pages.json | 11 +- src/pages/confirmOrder/confirmOrder.vue | 64 ++++ src/pages/food/food.vue | 322 +++++++++++++++++- src/pages/giveNoodle/giveNoodle.vue | 2 +- src/pages/homeNew/homeNew.vue | 35 +- .../underDevelopment/underDevelopment.vue | 63 ++++ src/store/index.js | 27 ++ 10 files changed, 748 insertions(+), 32 deletions(-) create mode 100644 src/pages/underDevelopment/underDevelopment.vue diff --git a/src/App.vue b/src/App.vue index 098e59f..6a3a97f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,7 @@ import store from "@/store/index.js"; export default { globalData: { - imageServer: 'https://hbl-1305371387.cos.ap-chengdu.myqcloud.com/company/QSQD/', //图片服务器地址 + imageServer: 'https://hbl-1305371387.cos.ap-chengdu.myqcloud.com/company/QSQD/', //图片服务器地址且时且多 user: { gender: 0, openId: '', diff --git a/src/components/FeedListPopup/FeedListPopup.vue b/src/components/FeedListPopup/FeedListPopup.vue index b4a3a16..08889f6 100644 --- a/src/components/FeedListPopup/FeedListPopup.vue +++ b/src/components/FeedListPopup/FeedListPopup.vue @@ -46,7 +46,7 @@ - + {{addFood.name}} @@ -67,10 +67,83 @@ + + + + + {{feed.name}} + + + + + + + + + {{addFood.name}} + + + {{addFood.company ? addFood.company : '份'}} + + + + ¥{{addFood.price}} + + + + + + {{addFood.count}} + + + + + + 选好了 + + + + + {{currentChoose.name}} + + + + + {{specificationType.name}} + + + + {{specifiDetail.name}} + + + + + + + 已选规格: + + + + {{specifiItem.name}} + + + + + + 总计 + ¥{{specificationTotalPrice}} + + + + 加入购物车 + + + + @@ -81,6 +154,8 @@ data() { return { imageServer: getApp().globalData.imageServer, + currentChoose: {}, //当前已选商品 + showSpecification: false }; }, computed: { @@ -114,6 +189,19 @@ }, currentGoods() { return store.state.currentGoods; + }, + specificationTotalPrice() { + let price = 0; + if (this.currentChoose.specification) { + this.currentChoose.specification.forEach(specifiType => { + specifiType.foods.forEach(specifiItem => { + if (specifiItem.isSelect) { + price += specifiItem.price + } + }); + }); + } + return price; } }, methods: { @@ -133,6 +221,43 @@ onSure() { store.commit('onStapleFoodPlusFromList'); this.$emit('onFeedPopuoClose'); + }, + //套餐减1 + onSetMealCountReduce(setMeal) { + if (setMeal.count === 0) return; + store.commit('onSetMealCountReduce', setMeal); + }, + //套餐加1 + onSetMealCountPlus(setMeal) { + if (setMeal.specification && setMeal.specification.length > 0) { + this.currentChoose = setMeal; + this.openChooseSpeci(); + } else { + store.commit('onSetMealCountPlus', setMeal); + } + }, + closeChooseSpeci() { + this.showSpecification = false; + }, + openChooseSpeci() { + this.showSpecification = true; + }, + onChooseSpecifi(type, chooseIndex) { + if (type.singleChoice) { + type.foods.forEach((item, index) => { + if (chooseIndex === index) { + item.isSelect = true; + } else { + item.isSelect = false; + } + }); + } else { + type.foods[chooseIndex].isSelect = !type.foods[chooseIndex].isSelect; + } + }, + onJoinCar() { + store.commit('onSetMealCountPlus', this.currentChoose); + this.closeChooseSpeci(); } } } @@ -218,7 +343,7 @@ height: 30rpx; } - .feed-list { + .feed-list, .set-meal-list { max-height: 450rpx; overflow: scroll; margin: 40rpx 0; @@ -229,14 +354,20 @@ } .feed-cover { + flex-shrink: 0; width: 100rpx; height: 100rpx; margin-right: 30rpx; } + .feed-info-center { + flex-grow: 1; + } + .feed-info { display: flex; align-items: center; + margin-bottom: 10rpx; } .feed-name-box { @@ -251,7 +382,8 @@ } .feed-buy-count { - width: 200rpx; + flex-shrink: 0; + width: 180rpx; display: flex; justify-content: space-around; align-items: center; @@ -303,4 +435,99 @@ top: 180rpx; padding: 0 !important; } + + /* 套餐 */ + .set-meal-list .feed-title { + font-size: 30rpx; + font-weight: 700; + } + + /* 选规格 */ + .specifi-box { + width: 680rpx; + padding: 30rpx; + box-sizing: border-box; + } + + .specifi-head { + font-size: 34rpx; + font-weight: 900; + } + + .specifi-type-list, .specifi-type-item { + margin: 20rpx 0; + } + + .specifi-item-title { + margin-bottom: 10rpx; + font-size: 28rpx; + color: #999; + } + + .specifi-detail-list { + display: flex; + align-items: center; + flex-wrap: wrap; + } + + .specifi-detail-item { + margin-right: 10rpx; + margin-bottom: 10rpx; + border: 2rpx solid #dedede; + padding: 10rpx 40rpx; + border-radius: 10rpx; + font-size: 28rpx; + } + + .specifi-detail-select { + border-color: #51A97D; + color: #51A97D; + } + + .specifi-choosed-card { + background-color: rgb(250, 250, 250); + font-size: 26rpx; + padding: 10rpx 10rpx; + } + + .specifi-choosed-card, .specifi-choosed-list { + display: flex; + flex-wrap: wrap; + } + + .specifi-choosed-item::after { + content: '、'; + } + + .specifi-total-card { + display: flex; + align-items: center; + justify-content: space-between; + height: 100rpx; + font-size: 30rpx; + } + + .specifi-total-right { + display: flex; + align-items: center; + } + + .specifi-total-price { + font-size: 36rpx; + color: #F94352; + } + + .specifi-total-right { + display: flex; + align-items: center; + background-color: #51A97D; + color: #FFF; + padding: 10rpx 40rpx; + border-radius: 10rpx; + } + + .specifi-total-right .iconfont { + color: #FFF; + margin-right: 20rpx; + } diff --git a/src/components/GoodsList/GoodsList.vue b/src/components/GoodsList/GoodsList.vue index f95eb85..d9a8861 100644 --- a/src/components/GoodsList/GoodsList.vue +++ b/src/components/GoodsList/GoodsList.vue @@ -167,6 +167,27 @@ currentGoods = JSON.parse(JSON.stringify(food)); store.commit('initCurrentGoods', currentGoods); this.isShowFeedPopup = true; + } else if (food.setMealList && food.setMealList.length > 0) { + food.setMealList.forEach(item => { + item.foods.forEach(additional => { + additional.count = 0; + additional.sourceCount = 0; + if (additional.specification && additional.specification.length > 0) { + additional.specification.forEach(specifiType => { + specifiType.foods.forEach((specifiItem, specifiIndex) =>{ + if (specifiIndex === 0) { + specifiItem.isSelect = true; + } else { + specifiItem.isSelect = false; + } + }); + }); + } + }); + }); + currentGoods = JSON.parse(JSON.stringify(food)); + store.commit('initCurrentGoods', currentGoods); + this.isShowFeedPopup = true; } else { currentGoods = JSON.parse(JSON.stringify(food)); store.commit('initCurrentGoods', currentGoods); diff --git a/src/pages.json b/src/pages.json index 935a7d7..ddd8e2a 100644 --- a/src/pages.json +++ b/src/pages.json @@ -296,7 +296,16 @@ "path" : "pages/homeNew/homeNew", "style" : { - "navigationBarTitleText": "", + "navigationBarTitleText": "首页", + "enablePullDownRefresh": false + } + + } + ,{ + "path" : "pages/underDevelopment/underDevelopment", + "style" : + { + "navigationBarTitleText": "功能开发中", "enablePullDownRefresh": false } diff --git a/src/pages/confirmOrder/confirmOrder.vue b/src/pages/confirmOrder/confirmOrder.vue index 936e8fe..b26b563 100644 --- a/src/pages/confirmOrder/confirmOrder.vue +++ b/src/pages/confirmOrder/confirmOrder.vue @@ -165,6 +165,36 @@ + + + + 超值换购 + + + + + + + + {{exchangeGoods.name}} + {{exchangeGoods.company}} + + + ¥{{exchangeGoods.discountPrice}} + + ¥{{exchangeGoods.originalPrice}} + + + + + + + {{exchangeGoods.count}} + + + + + @@ -227,6 +257,17 @@ userLocation: '', //用户坐标 autoActivityList: [], //自动参与活动列表 userAutoActivityJson: {},//参与活动JSON数据 + exchangeList: [ + { + id: '1001100', + name: '丝滑香草冰淇淋', + cover: '97fba14a-6908-48b2-8f4b-fcf6556030cd.png', + originalPrice: 9, //原价 + discountPrice: 1, //折后价 + count: 0, + company: '杯' //单位 + } + ], } }, created() { @@ -723,6 +764,18 @@ flex-grow: 1; } + .value-exchange-count { + display: flex; + align-items: center; + justify-content: space-between; + flex-shrink: 0; + width: 130rpx; + font-size: 32rpx; + } + + .value-exchange-count .iconfont { + font-size: 40rpx; + } .exchange-goos-compant { margin-left: 10rpx; @@ -730,6 +783,17 @@ color: #999; } + .value-exchange-price { + font-family: fangsong; + color: #F84352; + } + + .exchange-original-price { + margin-left: 10rpx; + color: #999; + text-decoration: line-through; + } + .order-discount-title { color: #999; diff --git a/src/pages/food/food.vue b/src/pages/food/food.vue index 18c7a75..a879fcb 100644 --- a/src/pages/food/food.vue +++ b/src/pages/food/food.vue @@ -136,8 +136,328 @@ } typeItem.foods.forEach(food => { food.shopCartNumber = 0; - }); + }); }); + //套餐 模拟JSON数据 + const foodTypeItem = { + id: 'f697317d-e715-430d-8703-65b805520220428', + name: '爆款!单人套餐', + sort: 0, + coverUrl: 'http://res.hualala.com/basicdoc/f4201455-d8fd-4695-a9eb-0d2664f12f7b.png', + foods: [ + { + addtoFoodList: [], + company: '套', + cover: 'http://res.hualala.com/basicdoc/f4201455-d8fd-4695-a9eb-0d2664f12f7b.png', + id: '920b6b5b-b612-4f70-903e-a6627920220428', + name: '立减套餐!咖啡鸡排面,咖啡+奶茶(饮品二选一)', + price: 44, + sort: 0, + state: 1, + vipPrice: 32, + shopCartNumber: 0, + setMealList: [ + { + id: 'f697317d-e715-430d-8703-65b805520220428', + name: '立减套餐!咖啡鸡排面,咖啡+奶茶(饮品二选一)', + sort: 0, + coverUrl: 'http://res.hualala.com/basicdoc/f4201455-d8fd-4695-a9eb-0d2664f12f7b.png', + foods: [ + { + company: '份', + cover: 'http://res.hualala.com/basicdoc/f4201455-d8fd-4695-a9eb-0d2664f12f7b.png', + id: '920b6b5b-b612-abcd-903e-a6627920220428', + name: '泰式咖啡鸡排面(咖喱与鸡的完美搭配)', + price: 32, + sort: 0, + state: 1, + vipPrice: 24, + mandatory: true, //是否必选 + singleChoice: true, //是否单选 + } + ] + }, + { + id: 'f697317d-1111-430d-8703-65b805520220428', + name: '奶茶二选一', + sort: 0, + coverUrl: null, + foods: [ + { + company: '杯', + cover: 'http://res.hualala.com/basicdoc/c2bdda52-99d0-4c3e-9b91-7e9cfce7ca9e.png?x-oss-process=image/resize,limit_0,m_fill,h_300,w_300', + id: '920b6b5b-1234-abcd-903e-a6627920220428', + name: '金瓜波波奶茶(香糯南瓜泥+芋圆珍珠、醇香茶汤,杯杯有料超满足)', + price: 20, + sort: 0, + state: 1, + vipPrice: 14, + mandatory: false, //是否必选 + singleChoice: true, //是否单选 + specification: [ //选规格 + { + id: 'f697317d-fn15-430d-8703-65b805520220428', + name: '分量', + sort: 0, + coverUrl: '', + mandatory: true, //是否必选 + singleChoice: true, //是否单选 + foods: [ + { + company: '份', + cover: '', + id: '920b6b5b-gg34-abcd-903e-a6627920220428', + name: '+冰淇淋(限冷饮)', + price: 20, + sort: 0, + state: 1, + vipPrice: 14, + }, + { + company: '份', + cover: '', + id: '920b6b5b-gg35-abcd-903e-a6627920220428', + name: '+芋圆', + price: 21, + sort: 0, + state: 1, + vipPrice: 14, + }, + { + company: '份', + cover: '', + id: '920b6b5b-gg36-abcd-903e-a6627920220428', + name: '+椰奶冻', + price: 22, + sort: 0, + state: 1, + vipPrice: 14, + } + ] + }, + { + id: 'f697317d-td15-430d-8703-65b805520220428', + name: '糖度', + sort: 0, + coverUrl: '', + mandatory: true, //是否必选 + singleChoice: false, //是否单选 + foods: [ + { + company: '份', + cover: '', + id: '920b6b5b-td34-abcd-903e-a6627920220428', + name: '三分糖', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-td35-abcd-903e-a6627920220428', + name: '五分糖', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-td36-abcd-903e-a6627920220428', + name: '全糖', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + } + ] + }, + { + id: 'f697317d-jd15-430d-8703-65b805520220428', + name: '可选基底', + sort: 0, + coverUrl: '', + mandatory: true, //是否必选 + singleChoice: true, //是否单选 + foods: [ + { + company: '份', + cover: '', + id: '920b6b5b-jd34-abcd-903e-a6627920220428', + name: '阿萨姆红茶', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-jd35-abcd-903e-a6627920220428', + name: '茉莉绿茶', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-jd36-abcd-903e-a6627920220428', + name: '清香乌龙茶', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + } + ] + } + ] + }, + { + company: '杯', + cover: 'http://res.hualala.com/basicdoc/3b2a9516-3a24-4400-ab3c-9540b42f97ed.png?x-oss-process=image/resize,limit_0,m_fill,h_300,w_300', + id: '920b6b5b-1222-abcd-903e-a6627920220428', + name: '栗栗波波奶茶(香糯板栗配珍珠芋圆,口感醇厚茶汤,杯杯有料超满足)', + price: 20, + sort: 0, + state: 1, + vipPrice: 14, + mandatory: false, //是否必选 + singleChoice: true, //是否单选 + specification: [ //选规格 + { + id: 'f697317d-fb15-430d-8703-65b805520220428', + name: '分量', + sort: 0, + coverUrl: '', + mandatory: true, //是否必选 + singleChoice: true, //是否单选 + foods: [ + { + company: '份', + cover: '', + id: '920b6b5b-gg34-abcd-903e-a6627920220428', + name: '+冰淇淋(限冷饮)', + price: 20, + sort: 0, + state: 1, + vipPrice: 14, + }, + { + company: '份', + cover: '', + id: '920b6b5b-gg35-abcd-903e-a6627920220428', + name: '+芋圆', + price: 21, + sort: 0, + state: 1, + vipPrice: 14, + }, + { + company: '份', + cover: '', + id: '920b6b5b-gg36-abcd-903e-a6627920220428', + name: '+椰奶冻', + price: 22, + sort: 0, + state: 1, + vipPrice: 14, + } + ] + }, + { + id: 'f697317d-gg15-430d-8703-65b805520220428', + name: '糖度', + sort: 0, + coverUrl: '', + mandatory: true, //是否必选 + singleChoice: true, //是否单选 + foods: [ + { + company: '份', + cover: '', + id: '920b6b5b-td34-abcd-903e-a6627920220428', + name: '三分糖', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-td35-abcd-903e-a6627920220428', + name: '五分糖', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-td36-abcd-903e-a6627920220428', + name: '全糖', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + } + ] + }, + { + id: 'f697317d-jd15-430d-8703-65b805520220428', + name: '可选基底', + sort: 0, + coverUrl: '', + mandatory: true, //是否必选 + singleChoice: true, //是否单选 + foods: [ + { + company: '份', + cover: '', + id: '920b6b5b-jd34-abcd-903e-a6627920220428', + name: '阿萨姆红茶', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-jd35-abcd-903e-a6627920220428', + name: '茉莉绿茶', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + }, + { + company: '份', + cover: '', + id: '920b6b5b-jd36-abcd-903e-a6627920220428', + name: '清香乌龙茶', + price: 0, + sort: 0, + state: 1, + vipPrice: 0, + } + ] + } + ] + }, + ] + }, + ] + } + ] + } + foodTypes.unshift(foodTypeItem); store.commit('initFoodArray', foodTypes); setTimeout(() => { this.$refs.goodsListRef.getNodeInfo(); diff --git a/src/pages/giveNoodle/giveNoodle.vue b/src/pages/giveNoodle/giveNoodle.vue index 51e49b9..11921f1 100644 --- a/src/pages/giveNoodle/giveNoodle.vue +++ b/src/pages/giveNoodle/giveNoodle.vue @@ -5,7 +5,7 @@ - + diff --git a/src/pages/homeNew/homeNew.vue b/src/pages/homeNew/homeNew.vue index e7490c0..a689ca7 100644 --- a/src/pages/homeNew/homeNew.vue +++ b/src/pages/homeNew/homeNew.vue @@ -105,11 +105,8 @@ }); }, onJumpTakeOut() { - uni.showToast({ - title: '开发中', - duration: 1000, - icon: 'none', - mask: true + uni.navigateTo({ + url: '/pages/underDevelopment/underDevelopment' }); }, //跳转注册会员 @@ -130,27 +127,18 @@ }); }, 2000, true), onJumpSign() { - uni.showToast({ - title: '开发中', - duration: 1000, - icon: 'none', - mask: true + uni.navigateTo({ + url: '/pages/underDevelopment/underDevelopment' }); }, onJumpNewProduct() { - uni.showToast({ - title: '开发中', - duration: 1000, - icon: 'none', - mask: true + uni.navigateTo({ + url: '/pages/underDevelopment/underDevelopment' }); }, onJumpFriendShare() { - uni.showToast({ - title: '开发中', - duration: 1000, - icon: 'none', - mask: true + uni.navigateTo({ + url: '/pages/underDevelopment/underDevelopment' }); }, //跳转积碗换面 @@ -162,11 +150,8 @@ }) }, 2000, true), onJumpDrink() { - uni.showToast({ - title: '开发中', - duration: 1000, - icon: 'none', - mask: true + uni.navigateTo({ + url: '/pages/underDevelopment/underDevelopment' }); }, //获取循环消费数据 diff --git a/src/pages/underDevelopment/underDevelopment.vue b/src/pages/underDevelopment/underDevelopment.vue new file mode 100644 index 0000000..cdfb42b --- /dev/null +++ b/src/pages/underDevelopment/underDevelopment.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/src/store/index.js b/src/store/index.js index f036012..0b97687 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -105,6 +105,33 @@ const store = new Vuex.Store({ }); }); }, + //套餐-1 + onSetMealCountReduce(state, payload) { + const setMeal = payload; + if (setMeal.count === 0) return; + state.currentGoods.setMealList.forEach(item =>{ + item.foods.forEach(addFood => { + if (addFood.id === setMeal.id) { + addFood.count -= 1; + addFood.sourceCount = addFood.count; + state.currentGoods.sencondId = state.currentGoods.sencondId.concat(addFood.id); + } + }) + }); + }, + //套餐+1 + onSetMealCountPlus(state, payload) { + const setMeal = payload; + state.currentGoods.setMealList.forEach(item =>{ + item.foods.forEach(addFood => { + if (addFood.id === setMeal.id) { + addFood.count += 1; + addFood.sourceCount = addFood.count; + state.currentGoods.sencondId = state.currentGoods.sencondId.replace(addFood.id, ''); + } + }) + }); + }, //从购物车添加主食 onStapleFoodPlusFromCart(state, payload) { let stapleFood = payload;