123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <template>
- <view :data-theme="theme">
- <view class="cart_nav" :style='"height:"+navH+"rpx;"'>
- <nav-bar iconColor='#fff' backgroundColor="#FF6702" ref="navBarRef" navTitle="今日吃啥">
- </nav-bar>
- </view>
- <view class="content" :style="{'background-image': `url(${urlDomain}crmebimage/public/product/2025/05/27/b093a9555dbf44d4a075f0dd3eebb2dcekjtc8f0qp.png)`}">
- <view class="items">
- <view class="item" v-for="(item,i) in items" :key="i" :class="item.checked ? 'active':'notActive'"
- @click="handleCheck(i)">
- <img :src="item.icon" alt="" style="height: 80rpx;width: 80rpx;margin-right: 19rpx;" />
- <view class="">
- {{item.label}}
- </view>
- </view>
- </view>
- <image class="start-btn" :src="`${urlDomain}crmebimage/public/product/2025/05/27/fe5f9a55c25d474c93a0f9c04fe324092cwk087wnu.png`" mode="" @click="onStartBtnClick"></image>
- </view>
- <!-- 评论 -->
- <uni-popup type="center" animation ref="activate" :mask-click="false">
- <view class="model-container">
- <img @click="onClose" :src="`${urlDomain}crmebimage/public/product/2025/05/27/a884a9fa58b14f689a848787e1496abbl34fck2hsw.png`" alt="" style="height: 49rpx;width: 49rpx;"
- class="m-close" />
- <view class="goods-items">
- <view class="g-item" v-for="ite in productList" :key="ite">
- <img :src="ite.image" alt="" style="height: 230rpx;width: 230rpx;" />
- <view class="g-title">
- {{ite.name||'-'}}
- </view>
- <view class="g-price">
- ¥{{ite.price||'-'}}
- </view>
-
- <view class="choose-btn" @click="onChoose({id:ite.id})">
- 选择
- </view>
- </view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import {whattodayeatApi,whattodayeatProductApi} from '../what_to_eat_today.js'
- import navBar from '@/components/navBar';
- var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
- let app = getApp();
- export default {
- components: {
- navBar
- },
- data() {
- return {
- urlDomain: this.$Cache.get("imgHost"),
- theme: app.globalData.theme,
- navH: '',
- statusBarHeight: app.globalData.statusBarHeight,
- navigationBarHeight: 0,
- loading: false,
- loadTitle: '',
- productList:[],
- items: []
- // [{
- // label: '我不挑食',
- // icon: require('../static/img/甜点.png'),
- // checked: true
- // },
- // {
- // label: '减肥套餐',
- // icon: require('../static/img/减肥餐.png'),
- // checked: true
- // },
- // {
- // label: '精致小食',
- // icon: require('../static/img/小食.png'),
- // checked: true
- // },
- // {
- // label: '豪华美食',
- // icon: require('../static/img/豪华餐.png'),
- // checked: true
- // }
- // ]
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- },
- onLoad(options) {
- this.navH = 96;
- whattodayeatApi().then(res => {
- this.items = res.data.map((ite,i) => ({
- label:ite.tagName,
- checked:i==0,
- ...ite
- }))
- })
- },
- onShow() {
- },
- methods: {
- handleCheck(i) {
- this.items.forEach(ite => ite.checked = false)
- this.items[i].checked = true
- },
- handBack() {
- uni.navigateBack({
- delta: 1
- })
- },
- async onStartBtnClick() {
- uni.showLoading()
- let check = this.items.filter((ite) => ite.checked)
- const params = {
- latitude: uni.getStorageSync('user_latitude'),
- longitude: uni.getStorageSync('user_longitude'),
- tagId:check[0].id
- }
- const res = await whattodayeatProductApi(params).finally(()=>uni.hideLoading())
- this.productList = res.data.splice(0,1)
- this.$refs.activate.open()
- },
- onClose() {
- this.$refs.activate.close()
- },
- onChoose(data) {
- uni.navigateTo({
- url: `/pages/goods/goods_details/index?id=${data.id}&mt=0`,
- })
- }
- },
- mounted() {
- },
- }
- </script>
- <style scoped>
- .order-nav {
- font-weight: 500;
- font-size: 35rpx;
- color: #FFFFFF;
- background-color: #FF6702;
- text-align: center;
- position: relative;
- }
- .back-button {
- width: 25rpx;
- height: 25rpx;
- border-right: 4rpx solid #fff;
- border-bottom: 4rpx solid #fff;
- transform: rotate(135deg);
- margin-left: 10rpx;
- display: inline-block;
- position: absolute;
- left: 40rpx;
- top: 25rpx;
- }
- .content {
- position: relative;
- height: calc(100vh - 49px);
- width: 100vw;
- padding-top: 135rpx;
- /* background-image: url('../static/img/背景.png'); */
- background-size: cover;
- background-repeat: no-repeat;
- }
- .items {
- display: grid;
- grid-template-columns: auto auto;
- grid-gap: 19.23rpx;
- margin: 0 57rpx;
- }
- .item {
- display: flex;
- align-items: center;
- color: #B16F22;
- font-size: 35rpx;
- font-weight: 500;
- font-family: PingFangSC, PingFang SC;
- width: 308rpx;
- height: 96rpx;
- background: linear-gradient(180deg, #FFE7CA 0%, #FFFFFF 100%);
- border-radius: 8rpx;
- border: 4rpx solid;
- border-image: linear-gradient(225deg, rgba(255, 194, 80, 1), rgba(255, 220, 107, 1), rgba(255, 225, 133, 1)) 4 4 !important;
- padding: 9rpx;
- }
- .active {
- border: 4rpx solid;
- }
- .notActive {
- border: none;
- }
- .start-btn {
- position: absolute;
- width: 153rpx;
- height: 80rpx;
- top: 55%;
- left: 50%;
- transform: translateX(-50%);
- }
- .model-container {
- position: relative;
- width: 712rpx;
- height: 654rpx;
- background-color: #fff;
- border-radius: 23rpx;
- padding-top: 96rpx;
- }
- .m-close {
- position: absolute;
- right: 39rpx;
- top: 20rpx;
- }
- .goods-items {
- margin: 0 39rpx;
- display: flex;
- gap: 20rpx;
- }
- .g-item {
- padding: 38.46rpx;
- background: linear-gradient(180deg, #FFF9F1 0%, #FFFFFF 100%);
- border-radius: 8rpx;
- border: 2rpx solid;
- border-image: linear-gradient(225deg, rgba(255, 194, 80, 1), rgba(255, 220, 107, 1), rgba(255, 225, 133, 1)) 2 2;
- }
- .g-title {
- margin-top: 19rpx;
- font-family: PingFangSC, PingFang SC;
- font-size: 27rpx;
- color: #141414;
- line-height: 38rpx;
- text-align: center;
- }
- .g-price {
- font-family: PingFangSC, PingFang SC;
- font-weight: 600;
- font-size: 31rpx;
- color: #FF9805;
- line-height: 42rpx;
- text-align: center;
- margin-bottom: 10rpx;
- }
- .choose-btn {
- width: 154rpx;
- height: 54rpx;
- background: linear-gradient(180deg, #FFAC3D 0%, #FF1E1D 100%);
- border-radius: 15rpx;
- border: 2rpx solid #FFD288;
- font-family: PingFangSC, PingFang SC;
- font-size: 27rpx;
- color: #FFFFFF;
- line-height: 54rpx;
- text-align: center;
- margin: auto;
- }
- </style>
|