index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view class="uni-main">
  3. <view class="sticky-nav">
  4. <view class="nav-bar">
  5. <view class="left-nav">
  6. <ul>
  7. <li v-for="(item,index) in cateList" :class="{active:!(index-cateIndex)}" @click="switchCate(index)">
  8. {{item.name}}
  9. </li>
  10. </ul>
  11. </view>
  12. <view class="right-nav">
  13. <image src="../../static/index/search_white_blod_big_icon.png" class="index_search"></image>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="uni-list">
  18. <view class="uni-list-item" v-for="(item,index) in dataList" :key="index">
  19. <view class="uni-list-item_box">
  20. <view class="uni-list-media">
  21. <image :src="item.thumb" class="thumb"></image>
  22. </view>
  23. <view class="uni-list_text">
  24. <view class="text_title">{{item.title}}</view>
  25. <text class="text_price">¥{{item.price}}</text>
  26. <text class="text_sale">{{item.sale}}人购买</text>
  27. <text class="text_buy"><navigator :url="'./detail?id='+item.id">购买</navigator></text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. cateIndex: 0,
  39. cateList: [{
  40. id: 0,
  41. name: '推荐'
  42. },
  43. {
  44. id: 1,
  45. name: '香烛'
  46. },
  47. {
  48. id: 2,
  49. name: '道具'
  50. },
  51. {
  52. id: 3,
  53. name: '纸币'
  54. },
  55. {
  56. id: 4,
  57. name: '其他'
  58. },
  59. ],
  60. dataList: [],
  61. tempList: [
  62. [{
  63. thumb: '../../static/shop/1.jpg',
  64. title: '三宝香',
  65. sale: 0,
  66. description: "",
  67. price: 10.50,
  68. },
  69. {
  70. thumb: '../../static/shop/3-1.jpg',
  71. title: '观音香',
  72. sale: 2,
  73. description: "",
  74. price: 15.50,
  75. },
  76. {
  77. thumb: '../../static/shop/2-3.jpg',
  78. title: '招财香',
  79. sale: 4,
  80. description: "",
  81. price: 12.00,
  82. },
  83. {
  84. thumb: '../../static/shop/4-1.jpg',
  85. title: '红烛',
  86. sale: 1,
  87. description: "",
  88. price: 7.50,
  89. },
  90. {
  91. thumb: '../../static/shop/3-5.jpg',
  92. title: '佛香缘红烛',
  93. sale: 3,
  94. description: "",
  95. price: 18.00,
  96. },
  97. {
  98. thumb: '../../static/shop/6.jpg',
  99. title: '水晶酥油蜡烛',
  100. sale: 1,
  101. description: "",
  102. price: 30.00,
  103. },
  104. ],
  105. [{
  106. thumb: '../../static/shop/1.jpg',
  107. title: '三宝香',
  108. sale: 0,
  109. description: "",
  110. price: 10.50,
  111. },
  112. {
  113. thumb: '../../static/shop/2.jpg',
  114. title: '观音香',
  115. sale: 2,
  116. description: "",
  117. price: 15.50,
  118. },
  119. {
  120. thumb: '../../static/shop/3.jpg',
  121. title: '招财香',
  122. sale: 4,
  123. description: "",
  124. price: 12.00,
  125. },
  126. {
  127. thumb: '../../static/shop/4.jpg',
  128. title: '红烛',
  129. sale: 1,
  130. description: "",
  131. price: 7.50,
  132. },
  133. {
  134. thumb: '../../static/shop/5.jpg',
  135. title: '佛香缘红烛',
  136. sale: 3,
  137. description: "",
  138. price: 18.00,
  139. },
  140. {
  141. thumb: '../../static/shop/6.jpg',
  142. title: '水晶酥油蜡烛',
  143. sale: 1,
  144. description: "",
  145. price: 30.00,
  146. },
  147. ],
  148. [{
  149. thumb: '../../static/shop/2-1.jpg',
  150. title: '黄纸钱',
  151. sale: 10,
  152. description: "",
  153. price: 6.00,
  154. },
  155. {
  156. thumb: '../../static/shop/2-2.jpg',
  157. title: '烛台',
  158. sale: 1,
  159. description: "",
  160. price: 14,
  161. },
  162. {
  163. thumb: '../../static/shop/2-3.jpg',
  164. title: '元宝盆',
  165. sale: 2,
  166. description: "",
  167. price: 35.00,
  168. },
  169. ],
  170. [{
  171. thumb: '../../static/shop/3-1.jpg',
  172. title: '元宝烛',
  173. sale: 0,
  174. description: "",
  175. price: 20.00,
  176. },
  177. {
  178. thumb: '../../static/shop/3-2.jpg',
  179. title: '百元纸币',
  180. sale: 2,
  181. description: "",
  182. price: 10.00,
  183. },
  184. {
  185. thumb: '../../static/shop/3-3.jpg',
  186. title: '大额纸币',
  187. sale: 2,
  188. description: "",
  189. price: 20.00,
  190. },
  191. {
  192. thumb: '../../static/shop/3-4.jpg',
  193. title: '黄香纸',
  194. sale: 2,
  195. description: "",
  196. price: 8.00,
  197. },
  198. {
  199. thumb: '../../static/shop/3-5.jpg',
  200. title: '元宝黄纸',
  201. sale: 20,
  202. description: "",
  203. price: 12.00,
  204. },
  205. {
  206. thumb: '../../static/shop/3-6.jpg',
  207. title: '金元宝烧纸',
  208. sale: 5,
  209. description: "",
  210. price: 10.00,
  211. },
  212. ],
  213. [{
  214. thumb: '../../static/shop/4-1.jpg',
  215. title: '黄金杯筷',
  216. sale: 0,
  217. description: "",
  218. price: 50.50,
  219. },
  220. {
  221. thumb: '../../static/shop/4-2.jpg',
  222. title: '招福香台',
  223. sale: 3,
  224. description: "",
  225. price: 18.00,
  226. },
  227. {
  228. thumb: '../../static/shop/4-3.jpg',
  229. title: '红香木灵牌',
  230. sale: 1,
  231. description: "",
  232. price: 78.00,
  233. },
  234. {
  235. thumb: '../../static/shop/4-4.jpg',
  236. title: '金元宝',
  237. sale: 2,
  238. description: "",
  239. price: 30.00,
  240. },
  241. {
  242. thumb: '../../static/shop/4-5.jpg',
  243. title: '黄金大福杯',
  244. sale: 7,
  245. description: "",
  246. price: 15.00,
  247. },
  248. {
  249. thumb: '../../static/shop/4-6.jpg',
  250. title: '观音杯',
  251. sale: 3,
  252. description: "",
  253. price: 16.00,
  254. },
  255. ],
  256. ],
  257. }
  258. },
  259. onLoad() {
  260. this.dataList = this.tempList[0]
  261. },
  262. methods: {
  263. switchCate(index) {
  264. this.cateIndex = index;
  265. this.dataList = this.tempList[index]
  266. },
  267. }
  268. }
  269. </script>
  270. <style>
  271. page {
  272. background-color: rgb(247, 246, 242);
  273. }
  274. </style>
  275. <style lang="less" scoped>
  276. .uni-main {
  277. width: 100%;
  278. height: 100%;
  279. background-color: #f6f7f5;
  280. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  281. }
  282. .sticky-nav {
  283. position: sticky;
  284. width: 100%;
  285. top: 0;
  286. z-index: 1;
  287. }
  288. .nav-bar {
  289. padding-top: 50rpx;
  290. padding-bottom: 20rpx;
  291. display: flex;
  292. justify-content: space-between;
  293. align-items: center;
  294. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  295. height: 125rpx;
  296. .back {
  297. width: 85rpx;
  298. height: 85rpx;
  299. // padding-right: 35rpx;
  300. }
  301. }
  302. .left-nav {
  303. ul {
  304. padding: 0;
  305. margin-left: 20rpx;
  306. }
  307. ul li {
  308. list-style: none;
  309. display: inline-block;
  310. height: 60rpx;
  311. line-height: 60rpx;
  312. width: 100rpx;
  313. text-align: center;
  314. color: rgb(255, 214, 205);
  315. font-size: 36rpx;
  316. font-weight: bold;
  317. padding-bottom: 4rpx;
  318. }
  319. .active {
  320. color: #fff;
  321. font-size: 44rpx;
  322. border-bottom: 4rpx solid #fff;
  323. }
  324. }
  325. .nav-box {
  326. width: 100%;
  327. padding-top: 90rpx;
  328. display: flex;
  329. align-items: center;
  330. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  331. height: 135rpx;
  332. padding-bottom: 50rpx;
  333. .header-text {
  334. font-size: 45rpx;
  335. color: #333;
  336. font-weight: bold;
  337. width: 100%;
  338. text-align: center;
  339. margin-left: 20rpx;
  340. }
  341. .header_operate {
  342. width: 23px;
  343. height: 21px;
  344. float: right;
  345. margin-right: 20rpx;
  346. }
  347. }
  348. .right-nav {
  349. margin-right: 15rpx;
  350. .index_search {
  351. width: 45rpx;
  352. height: 45rpx;
  353. margin-right: 15rpx;
  354. }
  355. .index_info {
  356. width: 45rpx;
  357. height: 45rpx;
  358. }
  359. }
  360. .uni-list-item {
  361. padding: 20rpx 30rpx;
  362. margin-bottom: 8rpx;
  363. background-color: #FFFFFF;
  364. border-radius: 8rpx;
  365. position: relative;
  366. }
  367. .uni-list-media {
  368. width: 300rpx;
  369. height: 320rpx;
  370. display: inline-block;
  371. }
  372. .uni-list-item_box .thumb {
  373. width: 100%;
  374. height: 100%;
  375. border-radius: 4rpx;
  376. }
  377. .uni-list-item_box .text_title {
  378. font-size: 40rpx;
  379. // font-weight: bold;
  380. padding: 8rpx 0rpx;
  381. }
  382. .uni-list_text {
  383. // padding-top: 10rpx;
  384. width: calc(100% - 320rpx);
  385. margin-left: 20rpx;
  386. display: inline-block;
  387. vertical-align: top;
  388. }
  389. .uni-list_text .text_price {
  390. font-size: 40rpx;
  391. color: #ff7a55;
  392. display: block;
  393. }
  394. .uni-list_text .text_sale {
  395. margin-top: 20rpx;
  396. font-size: 32rpx;
  397. color: #999;
  398. display: block;
  399. margin-bottom: 20rpx;
  400. }
  401. .uni-list_text .text_buy {
  402. font-size: 36rpx;
  403. float: right;
  404. background-color: #ff7a55;
  405. color: #fff;
  406. text-align: center;
  407. padding: 4rpx 12rpx;
  408. display: inline-block;
  409. border-radius: 6rpx;
  410. }
  411. </style>