|
@@ -22,16 +22,16 @@
|
|
|
<img @click="onClose" src="../static/img/关闭.png" alt="" style="height: 49rpx;width: 49rpx;"
|
|
|
class="m-close" />
|
|
|
<view class="goods-items">
|
|
|
- <view class="g-item" v-for="ite in 2" :key="ite">
|
|
|
+ <view class="g-item" v-for="ite in productList" :key="ite">
|
|
|
<img src="../static/img/甜点.png" alt="" style="height: 230rpx;width: 230rpx;" />
|
|
|
<view class="g-title">
|
|
|
- 张记煲仔饭套餐
|
|
|
+ {{ite.name||'-'}}
|
|
|
</view>
|
|
|
<view class="g-price">
|
|
|
- ¥18
|
|
|
+ ¥{{ite.price||'-'}}
|
|
|
</view>
|
|
|
|
|
|
- <view class="choose-btn" @click="onChoose({id:23})">
|
|
|
+ <view class="choose-btn" @click="onChoose({id:ite.id})">
|
|
|
选择
|
|
|
</view>
|
|
|
</view>
|
|
@@ -42,6 +42,7 @@
|
|
|
</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();
|
|
@@ -57,27 +58,29 @@
|
|
|
navigationBarHeight: 0,
|
|
|
loading: false,
|
|
|
loadTitle: '',
|
|
|
- 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
|
|
|
- }
|
|
|
- ]
|
|
|
+ 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
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
}
|
|
|
},
|
|
|
//下拉刷新
|
|
@@ -86,30 +89,46 @@
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.navH = 96;
|
|
|
+ whattodayeatApi().then(res => {
|
|
|
+ this.items = res.data.map((ite,i) => ({
|
|
|
+ label:ite.tagName,
|
|
|
+ icon:ite.icon,
|
|
|
+ checked:i==0,
|
|
|
+ ...ite
|
|
|
+ }))
|
|
|
+ })
|
|
|
},
|
|
|
onShow() {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
handleCheck(i) {
|
|
|
- this.items[i].checked = !this.items[i].checked
|
|
|
+ this.items.forEach(ite => ite.checked = false)
|
|
|
+ this.items[i].checked = true
|
|
|
},
|
|
|
handBack() {
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|
|
|
})
|
|
|
},
|
|
|
- onStartBtnClick() {
|
|
|
+ async onStartBtnClick() {
|
|
|
uni.showLoading()
|
|
|
- this.$refs.activate.open()
|
|
|
- uni.hideLoading()
|
|
|
+ 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&type=4`,
|
|
|
+ url: `/pages/goods/goods_details/index?id=${data.id}&mt=0`,
|
|
|
})
|
|
|
}
|
|
|
},
|