index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <view class="one_1" v-if="barActive=='0'">
  6. <view class="first">
  7. <image class="image" :src="oneUrl" mode=""></image>
  8. </view>
  9. <view class="second">
  10. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  11. <view class="list-scroll-view">
  12. <view class="list" v-for="(item,index) in list" :key="index"
  13. @tap="toCommon('pagesHome/order/detail')">
  14. <image class="image" :src="item.url" mode=""></image>
  15. <view class="name">
  16. {{item.name}}
  17. </view>
  18. <view class="other">
  19. <view class="money">
  20. <text>¥</text>
  21. <text>{{item.money}}</text>
  22. </view>
  23. <view class="btn">
  24. <button type="default" size="mini">购买</button>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </scroll-view>
  30. </view>
  31. </view>
  32. <view class="one_2" v-else-if="barActive=='1'">
  33. 商品分类
  34. </view>
  35. <view class="one_3" v-else-if="barActive=='2'">
  36. 全部商品
  37. </view>
  38. <view class="one_4" v-else-if="barActive=='3'">
  39. <view class="first">
  40. <image class="image" :src="info.url" mode=""></image>
  41. <view class="name">{{info.name}}</view>
  42. </view>
  43. <view class="second">
  44. <view class="second_1">
  45. <view class="grade">
  46. <view>{{info.grade||'5'}}</view>
  47. 商品
  48. </view>
  49. <view class="grade">
  50. <view>{{info.grade||'5'}}</view>
  51. 发货
  52. </view>
  53. <view class="grade">
  54. <view>{{info.grade||'5'}}</view>
  55. 服务
  56. </view>
  57. </view>
  58. <view class="second_2">
  59. <image class="image" :src="info.url" mode=""></image>
  60. </view>
  61. </view>
  62. <view class="collect">
  63. <text v-if="!collection" @click="toCollect" class="iconfont icon-kongxin"></text>
  64. <text v-else @click="toCollect" class="iconfont icon-shixin"></text>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="two">
  69. <view class="list" v-for="(item,index) in barList" :key="index" @tap="barChange(index,item)">
  70. <view class="icon">
  71. <text :class="['iconfont',barActive==index?item.acticon:item.icon]"></text>
  72. </view>
  73. <view :class="['name',barActive==index?'activename':'']">
  74. {{item.name}}
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </mobile-frame>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. barActive: '0',
  86. barList: [ //底部菜单
  87. {
  88. icon: 'icon-shangdian',
  89. acticon: "icon-shangdian-copy",
  90. name: '微店首页'
  91. }, {
  92. icon: 'icon-fenlei',
  93. acticon: "icon-fenlei-copy",
  94. name: '商品分类'
  95. }, {
  96. icon: 'icon-shangpinfenlei',
  97. acticon: "icon-shangpinfenlei-copy",
  98. name: '全部商品'
  99. }, {
  100. icon: 'icon-qiyejianjie',
  101. acticon: "icon-qiyejianjie-copy",
  102. name: '店铺简介'
  103. }
  104. ],
  105. oneUrl: require('@/static/test.png'),
  106. info: {
  107. url: require('@/static/test.png'),
  108. name: '首农食品旗舰店',
  109. money: 100,
  110. },
  111. list: [ //
  112. {
  113. url: require('@/static/test.png'),
  114. name: '商品名称',
  115. money: 100,
  116. },
  117. {
  118. url: require('@/static/test.png'),
  119. name: '商品名称',
  120. money: 100,
  121. },
  122. {
  123. url: require('@/static/test.png'),
  124. name: '商品名称',
  125. money: 100,
  126. },
  127. {
  128. url: require('@/static/test.png'),
  129. name: '商品名称',
  130. money: 100,
  131. },
  132. {
  133. url: require('@/static/test.png'),
  134. name: '商品名称',
  135. money: 100,
  136. },
  137. ],
  138. // 收藏
  139. collection: false,
  140. };
  141. },
  142. onShow: function() {},
  143. methods: {
  144. // 选择底部菜单
  145. barChange(index, item) {
  146. const that = this;
  147. that.$set(that, `barActive`, index);
  148. },
  149. // 公共跳转
  150. toCommon(e) {
  151. uni.navigateTo({
  152. url: `/${e}`
  153. })
  154. },
  155. // 收藏
  156. toCollect() {
  157. const that = this;
  158. that.collection = !that.collection;
  159. if (that.collection == true) {
  160. uni.showToast({
  161. title: `收藏成功`,
  162. icon: 'none'
  163. })
  164. } else {
  165. uni.showToast({
  166. title: `取消成功`,
  167. icon: 'none'
  168. })
  169. }
  170. },
  171. // 分页
  172. toPage() {}
  173. }
  174. }
  175. </script>
  176. <style lang="scss">
  177. .main {
  178. display: flex;
  179. flex-direction: column;
  180. width: 100vw;
  181. height: 100vh;
  182. .one {
  183. position: relative;
  184. flex-grow: 1;
  185. .one_1 {
  186. display: flex;
  187. flex-direction: column;
  188. width: 96vw;
  189. height: 90vh;
  190. padding: 2vw;
  191. background-color: var(--fFB1Color);
  192. .first {
  193. margin: 0 0 2vw 0;
  194. .image {
  195. width: 100%;
  196. height: 50vw;
  197. }
  198. }
  199. .second {
  200. position: relative;
  201. flex-grow: 1;
  202. .list {
  203. margin: 0 2vw 2vw 0;
  204. background-color: var(--fffColor);
  205. padding: 2vw;
  206. width: 43vw;
  207. border-radius: 5px;
  208. .image {
  209. width: 100%;
  210. height: 49vw;
  211. margin: 0 0 1vw 0;
  212. }
  213. .name {
  214. font-size: var(--font15Size);
  215. margin: 0 0 2vw 0;
  216. }
  217. .other {
  218. display: flex;
  219. flex-direction: row;
  220. justify-content: space-between;
  221. .money {
  222. color: var(--ff0Color);
  223. text:nth-child(1) {
  224. font-size: var(--font12Size);
  225. }
  226. }
  227. .btn {
  228. button {
  229. border-radius: 25px;
  230. color: var(--fffColor);
  231. background-color: var(--ff0Color);
  232. font-size: var(--font12Size);
  233. }
  234. }
  235. }
  236. }
  237. .list:nth-child(2n) {
  238. margin: 0 0 2vw 0;
  239. }
  240. }
  241. }
  242. .one_4 {
  243. .first {
  244. display: flex;
  245. flex-direction: column;
  246. align-items: center;
  247. background-color: var(--fFB1Color);
  248. border-bottom-right-radius: 10vw;
  249. border-bottom-left-radius: 10vw;
  250. .image {
  251. width: 20vw;
  252. height: 20vw;
  253. border-radius: 20vw;
  254. }
  255. .name {
  256. margin: 2vw 0;
  257. font-size: var(--font16Szie);
  258. font-weight: bold;
  259. color: var(--mainColor);
  260. }
  261. }
  262. .second {
  263. margin: 2vw 0;
  264. .second_1 {
  265. display: flex;
  266. justify-content: space-evenly;
  267. .grade {
  268. display: flex;
  269. flex-direction: column;
  270. align-items: center;
  271. color: var(--f85Color);
  272. font-size: var(--font13Size);
  273. view {
  274. margin: 1vw 0 0 0;
  275. color: var(--ff0Color);
  276. }
  277. }
  278. }
  279. .second_2 {
  280. display: flex;
  281. justify-content: center;
  282. margin: 20vw 0 0 0;
  283. }
  284. }
  285. }
  286. .collect {
  287. position: fixed;
  288. top: 4vw;
  289. right: 5vw;
  290. .iconfont {
  291. font-size: 25px;
  292. }
  293. }
  294. }
  295. .two {
  296. display: flex;
  297. flex-direction: row;
  298. justify-content: space-around;
  299. border-top: 1px solid #f1f1f1;
  300. .list {
  301. padding: 1vw 0;
  302. text-align: center;
  303. .icon {}
  304. .name {
  305. font-size: 12px;
  306. }
  307. .activename {
  308. color: var(--fFB1Color);
  309. }
  310. }
  311. }
  312. }
  313. .scroll-view {
  314. position: absolute;
  315. top: 0;
  316. left: 0;
  317. right: 0;
  318. bottom: 0;
  319. .list-scroll-view {
  320. display: flex;
  321. flex-direction: row;
  322. flex-wrap: wrap;
  323. }
  324. }
  325. </style>