shoppingMalls.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view>
  3. <view class="title" >
  4. <view class="title_text">商场分类</view>
  5. <view @click="linkto('commodity')" class="title_more">更多></view>
  6. </view>
  7. <view class="box" >
  8. <u-grid :border="false" col="4" >
  9. <u-grid-item v-for="(listItem,listIndex) in list" :key="listIndex" >
  10. <view class="box_grid">
  11. <u--image width="80rpx" @click="clickItem(listItem)" height="80rpx" :src="listItem.imgUrl" ></u--image>
  12. <text class="grid-text">{{listItem.columnIdName}}</text>
  13. </view>
  14. </u-grid-item>
  15. </u-grid>
  16. <view class="box_two">
  17. <view v-if="rexiaoList.length>0" class="box_two_item">
  18. <view class="bt_item_title">热销心选</view>
  19. <view class="flex">
  20. <view @click="linkto(item)" v-for="(item,index) in rexiaoList" :key="index">
  21. <view class="bt_item_img">
  22. <u--image width="130rpx" height="130rpx" :src="item.fileList[0].fileUrl" ></u--image>
  23. </view>
  24. <view class="bt_item_text">
  25. <text style="font-size: 16rpx;">¥</text>{{item.price}}
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view v-if="haowuList.length>0" class="box_two_item">
  31. <view class="bt_item_title">好物推荐</view>
  32. <view class="flex">
  33. <view @click="linkto(item)" v-for="(item,index) in haowuList" :key="index">
  34. <view class="bt_item_img">
  35. <u--image width="130rpx" height="130rpx" :src="item.fileList[0].fileUrl" ></u--image>
  36. </view>
  37. <view class="bt_item_text">
  38. <text style="font-size: 16rpx;">¥</text>{{item.price}}
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {toastFunc} from '@/pages/util/util.js'
  49. import {moduleBySix,productPage} from '@/http/api/common.js'
  50. export default {
  51. data() {
  52. return {
  53. list: [],
  54. rexiaoList:[],
  55. haowuList:[],
  56. }
  57. },
  58. async mounted() {
  59. this.getmoduleBySix()
  60. this.getProductPage()
  61. },
  62. methods: {
  63. async getmoduleBySix(){
  64. //获取模块6
  65. let res = await moduleBySix()
  66. this.list = []
  67. if (res.data.code == 200) {
  68. this.list = res.data.data.subList.map(v =>{
  69. return {
  70. ...v,
  71. imgUrl:v.coverList[0].fileUrl
  72. }
  73. })
  74. }
  75. },
  76. async getProductPage(categoryId=''){
  77. // 标签;1=热销心选;2=好物推荐
  78. let res = await productPage({
  79. tag:1,
  80. pageSize:2,
  81. pageNum:1,
  82. })
  83. let res2 = await productPage({
  84. tag:2,
  85. pageSize:2,
  86. pageNum:1,
  87. })
  88. if (res.data.code == 200) {
  89. this.rexiaoList = res.data.data.rows
  90. this.haowuList = res2.data.data.rows
  91. }
  92. },
  93. clickItem(item){
  94. console.log(item);
  95. // toastFunc('点击了'+item.columnIdName)
  96. uni.setStorageSync('categoryId', item.columnId)
  97. uni.setStorageSync('columnIdName', item.columnIdName)
  98. uni.switchTab({
  99. url: '/pages/market/commodity',
  100. });
  101. },
  102. linkto(item){
  103. if (item == 'commodity') {
  104. uni.switchTab({
  105. url: '/pages/market/commodity',
  106. });
  107. }else{
  108. uni.navigateTo({
  109. url: '/pages/market/ProductDetails?id=' + item.id
  110. });
  111. }
  112. }
  113. }
  114. }
  115. </script>
  116. <style>
  117. .title{
  118. display: flex;
  119. width: 90vw;
  120. justify-content: space-between;
  121. margin: 0 auto;
  122. }
  123. .title_text{
  124. width: 128rpx;
  125. height: 45rpx;
  126. font-size: 32rpx;
  127. font-weight: bold;
  128. color: #333333;
  129. line-height: 45rpx;
  130. }
  131. .title_more{
  132. width: 80rpx;
  133. height: 40rpx;
  134. font-size: 28rpx;
  135. font-weight: 500;
  136. color: #999999;
  137. line-height: 40rpx;
  138. }
  139. .box{
  140. margin: 80rpx 0 20rpx 0;
  141. background: linear-gradient(180deg, #FFFFFF 0%, #ECF6FF 100%);
  142. border-radius: 20rpx 20rpx 20rpx 20rpx;
  143. opacity: 1;
  144. width: 95vw;
  145. }
  146. .box_grid{
  147. margin: 20rpx 0;
  148. display: flex;
  149. flex-direction: column;
  150. align-items: center;
  151. }
  152. .grid-text{
  153. font-size: 28rpx;
  154. font-weight: bold;
  155. color: #333333;
  156. margin-top: 16rpx;
  157. }
  158. .box_two{
  159. display: flex;
  160. display: flex;
  161. justify-content: space-around;
  162. padding: 40rpx 20rpx;
  163. }
  164. .box_two_item{
  165. width: 327rpx;
  166. height: 283rpx;
  167. background: #FFFFFF;
  168. border-radius: 10rpx 10rpx 10rpx 10rpx;
  169. opacity: 1;
  170. /* padding: 10rpx; */
  171. }
  172. .bt_item_title{
  173. width: 128rpx;
  174. height: 45rpx;
  175. font-size: 32rpx;
  176. font-weight: bold;
  177. color: #333333;
  178. margin: 24rpx;
  179. }
  180. .bt_item_img{
  181. width: 130rpx;
  182. height: 130rpx;
  183. background: #EEEEEE;
  184. border-radius: 0rpx 0rpx 0rpx 0rpx;
  185. opacity: 1;
  186. }
  187. .bt_item_text{
  188. width: 130rpx;
  189. height: 28rpx;
  190. font-size: 24rpx;
  191. font-weight: bold;
  192. color: #F6514F;
  193. text-align: center;
  194. }
  195. </style>