index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view :data-theme="theme">
  3. <view class="cart_nav" :style='"height:"+navH+"rpx;"'>
  4. <nav-bar iconColor='#fff' backgroundColor="#FF6702" ref="navBarRef" navTitle="今日吃啥">
  5. </nav-bar>
  6. </view>
  7. <view class="content" :style="{'background-image': `url(${urlDomain}crmebimage/public/product/2025/05/27/b093a9555dbf44d4a075f0dd3eebb2dcekjtc8f0qp.png)`}">
  8. <view class="items">
  9. <view class="item" v-for="(item,i) in items" :key="i" :class="item.checked ? 'active':'notActive'"
  10. @click="handleCheck(i)">
  11. <img :src="item.icon" alt="" style="height: 80rpx;width: 80rpx;margin-right: 19rpx;" />
  12. <view class="">
  13. {{item.label}}
  14. </view>
  15. </view>
  16. </view>
  17. <image class="start-btn" :src="`${urlDomain}crmebimage/public/product/2025/05/27/fe5f9a55c25d474c93a0f9c04fe324092cwk087wnu.png`" mode="" @click="onStartBtnClick"></image>
  18. </view>
  19. <!-- 评论 -->
  20. <uni-popup type="center" animation ref="activate" :mask-click="false">
  21. <view class="model-container">
  22. <img @click="onClose" :src="`${urlDomain}crmebimage/public/product/2025/05/27/a884a9fa58b14f689a848787e1496abbl34fck2hsw.png`" alt="" style="height: 49rpx;width: 49rpx;"
  23. class="m-close" />
  24. <view class="goods-items">
  25. <view class="g-item" v-for="ite in productList" :key="ite">
  26. <img :src="ite.image" alt="" style="height: 230rpx;width: 230rpx;" />
  27. <view class="g-title">
  28. {{ite.name||'-'}}
  29. </view>
  30. <view class="g-price">
  31. ¥{{ite.price||'-'}}
  32. </view>
  33. <view class="choose-btn" @click="onChoose({id:ite.id})">
  34. 选择
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </uni-popup>
  40. </view>
  41. </template>
  42. <script>
  43. import {whattodayeatApi,whattodayeatProductApi} from '../what_to_eat_today.js'
  44. import navBar from '@/components/navBar';
  45. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  46. let app = getApp();
  47. export default {
  48. components: {
  49. navBar
  50. },
  51. data() {
  52. return {
  53. urlDomain: this.$Cache.get("imgHost"),
  54. theme: app.globalData.theme,
  55. navH: '',
  56. statusBarHeight: app.globalData.statusBarHeight,
  57. navigationBarHeight: 0,
  58. loading: false,
  59. loadTitle: '',
  60. productList:[],
  61. items: []
  62. // [{
  63. // label: '我不挑食',
  64. // icon: require('../static/img/甜点.png'),
  65. // checked: true
  66. // },
  67. // {
  68. // label: '减肥套餐',
  69. // icon: require('../static/img/减肥餐.png'),
  70. // checked: true
  71. // },
  72. // {
  73. // label: '精致小食',
  74. // icon: require('../static/img/小食.png'),
  75. // checked: true
  76. // },
  77. // {
  78. // label: '豪华美食',
  79. // icon: require('../static/img/豪华餐.png'),
  80. // checked: true
  81. // }
  82. // ]
  83. }
  84. },
  85. //下拉刷新
  86. onPullDownRefresh() {
  87. },
  88. onLoad(options) {
  89. this.navH = 96;
  90. whattodayeatApi().then(res => {
  91. this.items = res.data.map((ite,i) => ({
  92. label:ite.tagName,
  93. checked:i==0,
  94. ...ite
  95. }))
  96. })
  97. },
  98. onShow() {
  99. },
  100. methods: {
  101. handleCheck(i) {
  102. this.items.forEach(ite => ite.checked = false)
  103. this.items[i].checked = true
  104. },
  105. handBack() {
  106. uni.navigateBack({
  107. delta: 1
  108. })
  109. },
  110. async onStartBtnClick() {
  111. uni.showLoading()
  112. let check = this.items.filter((ite) => ite.checked)
  113. const params = {
  114. latitude: uni.getStorageSync('user_latitude'),
  115. longitude: uni.getStorageSync('user_longitude'),
  116. tagId:check[0].id
  117. }
  118. const res = await whattodayeatProductApi(params).finally(()=>uni.hideLoading())
  119. this.productList = res.data.splice(0,1)
  120. this.$refs.activate.open()
  121. },
  122. onClose() {
  123. this.$refs.activate.close()
  124. },
  125. onChoose(data) {
  126. uni.navigateTo({
  127. url: `/pages/goods/goods_details/index?id=${data.id}&mt=0`,
  128. })
  129. }
  130. },
  131. mounted() {
  132. },
  133. }
  134. </script>
  135. <style scoped>
  136. .order-nav {
  137. font-weight: 500;
  138. font-size: 35rpx;
  139. color: #FFFFFF;
  140. background-color: #FF6702;
  141. text-align: center;
  142. position: relative;
  143. }
  144. .back-button {
  145. width: 25rpx;
  146. height: 25rpx;
  147. border-right: 4rpx solid #fff;
  148. border-bottom: 4rpx solid #fff;
  149. transform: rotate(135deg);
  150. margin-left: 10rpx;
  151. display: inline-block;
  152. position: absolute;
  153. left: 40rpx;
  154. top: 25rpx;
  155. }
  156. .content {
  157. position: relative;
  158. height: calc(100vh - 49px);
  159. width: 100vw;
  160. padding-top: 135rpx;
  161. /* background-image: url('../static/img/背景.png'); */
  162. background-size: cover;
  163. background-repeat: no-repeat;
  164. }
  165. .items {
  166. display: grid;
  167. grid-template-columns: auto auto;
  168. grid-gap: 19.23rpx;
  169. margin: 0 57rpx;
  170. }
  171. .item {
  172. display: flex;
  173. align-items: center;
  174. color: #B16F22;
  175. font-size: 35rpx;
  176. font-weight: 500;
  177. font-family: PingFangSC, PingFang SC;
  178. width: 308rpx;
  179. height: 96rpx;
  180. background: linear-gradient(180deg, #FFE7CA 0%, #FFFFFF 100%);
  181. border-radius: 8rpx;
  182. border: 4rpx solid;
  183. border-image: linear-gradient(225deg, rgba(255, 194, 80, 1), rgba(255, 220, 107, 1), rgba(255, 225, 133, 1)) 4 4 !important;
  184. padding: 9rpx;
  185. }
  186. .active {
  187. border: 4rpx solid;
  188. }
  189. .notActive {
  190. border: none;
  191. }
  192. .start-btn {
  193. position: absolute;
  194. width: 153rpx;
  195. height: 80rpx;
  196. top: 55%;
  197. left: 50%;
  198. transform: translateX(-50%);
  199. }
  200. .model-container {
  201. position: relative;
  202. width: 712rpx;
  203. height: 654rpx;
  204. background-color: #fff;
  205. border-radius: 23rpx;
  206. padding-top: 96rpx;
  207. }
  208. .m-close {
  209. position: absolute;
  210. right: 39rpx;
  211. top: 20rpx;
  212. }
  213. .goods-items {
  214. margin: 0 39rpx;
  215. display: flex;
  216. gap: 20rpx;
  217. }
  218. .g-item {
  219. padding: 38.46rpx;
  220. background: linear-gradient(180deg, #FFF9F1 0%, #FFFFFF 100%);
  221. border-radius: 8rpx;
  222. border: 2rpx solid;
  223. border-image: linear-gradient(225deg, rgba(255, 194, 80, 1), rgba(255, 220, 107, 1), rgba(255, 225, 133, 1)) 2 2;
  224. }
  225. .g-title {
  226. margin-top: 19rpx;
  227. font-family: PingFangSC, PingFang SC;
  228. font-size: 27rpx;
  229. color: #141414;
  230. line-height: 38rpx;
  231. text-align: center;
  232. }
  233. .g-price {
  234. font-family: PingFangSC, PingFang SC;
  235. font-weight: 600;
  236. font-size: 31rpx;
  237. color: #FF9805;
  238. line-height: 42rpx;
  239. text-align: center;
  240. margin-bottom: 10rpx;
  241. }
  242. .choose-btn {
  243. width: 154rpx;
  244. height: 54rpx;
  245. background: linear-gradient(180deg, #FFAC3D 0%, #FF1E1D 100%);
  246. border-radius: 15rpx;
  247. border: 2rpx solid #FFD288;
  248. font-family: PingFangSC, PingFang SC;
  249. font-size: 27rpx;
  250. color: #FFFFFF;
  251. line-height: 54rpx;
  252. text-align: center;
  253. margin: auto;
  254. }
  255. </style>