integral_mall.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <view>
  3. <view class="wrap">
  4. <!-- 积分商城 -->
  5. <u-sticky :enable="enable2">
  6. <view class="filter-wrap wrap-flex">
  7. <u-button :custom-style="buttonCustomStyle" :hair-line="false" hover-class="none" @click="handleGo('mallMenu1')">精选</u-button>
  8. <u-dropdown style="position: static;">
  9. <u-dropdown-item v-model="brandValue" title="品牌" :options="brandOptions"></u-dropdown-item>
  10. </u-dropdown>
  11. <u-button :custom-style="buttonCustomStyle" :hair-line="false" hover-class="none" @click="showFilterPopup=true">分类
  12. <u-icon name="grid"></u-icon>
  13. </u-button>
  14. <u-search placeholder="请输入商品名称或种类" :animation="true" :style="inputCustomStyle" :show-action="false" v-model="keyword"
  15. @focus="inputFocus" @blur="inputBlur"></u-search>
  16. </view>
  17. </u-sticky>
  18. <scroll-view scroll-y @scrolltolower="scrollBottom" class="scroll-view-container">
  19. <view class="page-box">
  20. <view class="order">
  21. <view class="item" v-for="(item, index) in goodsList" :key="index" @click="handleGoDetails">
  22. <view class="left">
  23. <image :src="item.goodsUrl" mode="aspectFill"></image>
  24. </view>
  25. <view class="content">
  26. <view class="title u-line-2">{{ item.title }}</view>
  27. <view class="type">{{ item.type }}</view>
  28. <view class="price-row">
  29. <view class="price">
  30. {{ item.price }}积分
  31. </view>
  32. <view class="exchange">加入购物车</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <u-loadmore :status="loadStatus" bgColor="#f2f2f2"></u-loadmore>
  38. </view>
  39. </scroll-view>
  40. <view id="shopping-car" @click="handleGoCar">
  41. <u-icon :custom-style="iconCustomStyleCarFixed" size="48" name="car" color="#9999999"></u-icon>
  42. <u-badge :offset="[-8,-8]" :count="goodsCounts" type="error"></u-badge>
  43. </view>
  44. <u-popup v-model="showFilterPopup" mode="right" width="60%">
  45. <view class="filter-title">分类</view>
  46. <block v-for="(item,index) in tabbar" :key="index">
  47. <scroll-view scroll-y class="right-box">
  48. <view class="page-view">
  49. <view class="class-item">
  50. <view class="item-title">
  51. <text>{{item.name}}</text>
  52. </view>
  53. <view class="item-container">
  54. <view class="thumb-box" v-for="(item1, index1) in item.foods" :key="index1">
  55. <view class="item-menu-name">{{item1.value}}</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </scroll-view>
  61. </block>
  62. </u-popup>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. buttonCustomStyle: {
  71. border: "none",
  72. background: "transparent"
  73. },
  74. brandValue: "",
  75. brandOptions: [{
  76. label: "赛轮",
  77. value: "SAILUN"
  78. }, {
  79. label: "金宇",
  80. value: "jinyu"
  81. }],
  82. keyword: "",
  83. inputCustomStyle: {},
  84. iconCustomStyleCarFixed: {
  85. background: "#ffffff",
  86. padding: "16rpx",
  87. borderRadius: "50%",
  88. boxShadow: "0px 1px 12px 0px rgba(116, 116, 116, 0.6)"
  89. },
  90. goodsCounts: 100,
  91. showFilterPopup: false,
  92. tabbar: [{
  93. "name": "品牌",
  94. "foods": [{
  95. "value": "赛轮",
  96. "label": "SAILUN",
  97. },
  98. {
  99. "value": "金宇",
  100. "label": "jinyu",
  101. },
  102. ]
  103. }],
  104. loadStatus: "loadmore",
  105. goodsList: [],
  106. list: [{
  107. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  108. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  109. type: '胎动品牌;修补类型;普通积分',
  110. deliveryTime: '付款后30天内发货',
  111. price: '348.58',
  112. number: 2
  113. },
  114. {
  115. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t1/47645/22/6120/140457/5d3d17deEec9f8e8d/3687ff03ca89b48c.jpg',
  116. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  117. type: '胎动品牌;修补类型;普通积分',
  118. deliveryTime: '付款后30天内发货',
  119. price: '135.00',
  120. number: 1
  121. },
  122. {
  123. goodsUrl: 'https://img11.360buyimg.com/n7/jfs/t1/88990/24/4208/105799/5de4c6e9E24bc09d0/f810effb14c9c13a.jpg',
  124. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  125. type: '胎动品牌;修补类型;普通积分',
  126. deliveryTime: '付款后7天内发货',
  127. price: '128.05',
  128. number: 1
  129. },
  130. {
  131. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t1/93698/23/4500/114562/5de713dfEfc997085/e8deaa979909851d.jpg',
  132. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  133. type: '胎动品牌;修补类型;普通积分',
  134. deliveryTime: '保质5年',
  135. price: '1998',
  136. number: 3
  137. },
  138. {
  139. goodsUrl: 'https://img11.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  140. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  141. type: '胎动品牌;修补类型;普通积分',
  142. deliveryTime: '保质5年',
  143. price: '2354',
  144. number: 1
  145. },
  146. {
  147. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  148. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  149. type: '胎动品牌;修补类型;普通积分',
  150. deliveryTime: '珍藏10年好酒',
  151. price: '1543',
  152. number: 3
  153. },
  154. {
  155. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  156. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  157. type: '胎动品牌;修补类型;普通积分',
  158. deliveryTime: '口感好',
  159. price: '120',
  160. number: 1
  161. },
  162. {
  163. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  164. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  165. type: '胎动品牌;修补类型;普通积分',
  166. deliveryTime: '使用方便',
  167. price: '451',
  168. number: 9
  169. }
  170. ],
  171. enable2: true
  172. };
  173. },
  174. onLoad() {
  175. this.getDataList();
  176. },
  177. onShow() {
  178. this.enable2 = true
  179. },
  180. onHide() {
  181. this.enable2 = false
  182. },
  183. computed: {
  184. // 价格小数
  185. priceDecimal() {
  186. return val => {
  187. if (val !== parseInt(val)) return val.slice(-2);
  188. else return '00';
  189. };
  190. },
  191. // 价格整数
  192. priceInt() {
  193. return val => {
  194. if (val !== parseInt(val)) return val.split('.')[0];
  195. else return val;
  196. };
  197. }
  198. },
  199. methods: {
  200. inputFocus() {
  201. this.inputCustomStyle = {
  202. position: "absolute",
  203. zIndex: "100",
  204. width: "98%",
  205. margin: "6rpx 1%"
  206. };
  207. },
  208. inputBlur() {
  209. this.inputCustomStyle = {};
  210. },
  211. scrollBottom(v) {
  212. this.loadStatus = 'loading';
  213. // 模拟数据加载
  214. setTimeout(() => {
  215. this.getDataList();
  216. this.loadStatus = 'loadmore';
  217. }, 1000)
  218. },
  219. getDataList() {
  220. this.goodsList = this.goodsList.concat(this.list)
  221. },
  222. handleGoCar() {
  223. this.$u.route({
  224. url: 'pages/home/integral-mall/integral_mall_car',
  225. })
  226. },
  227. handleGoDetails() {
  228. this.$u.route({
  229. url: 'pages/home/integral-mall/integral_mall_goods_details',
  230. })
  231. },
  232. }
  233. };
  234. </script>
  235. <style lang="scss" scoped>
  236. /* #ifndef H5 */
  237. page {
  238. height: 100%;
  239. background-color: #f2f2f2;
  240. }
  241. /* #endif */
  242. .wrap-flex {
  243. display: flex;
  244. }
  245. .scroll-view-container {
  246. width: 100%;
  247. height: calc(100% - 88rpx);
  248. }
  249. .filter-title {
  250. background: #F6F6F6;
  251. padding: 16rpx;
  252. }
  253. .class-item {
  254. margin-bottom: 30rpx;
  255. background-color: #fff;
  256. padding: 16rpx;
  257. border-radius: 8rpx;
  258. }
  259. .class-item:last-child {
  260. min-height: 100vh;
  261. }
  262. .item-title {
  263. font-size: 26rpx;
  264. color: $u-main-color;
  265. font-weight: bold;
  266. }
  267. .item-menu-name {
  268. font-weight: normal;
  269. font-size: 24rpx;
  270. color: $u-main-color;
  271. }
  272. .item-container {
  273. display: flex;
  274. flex-wrap: wrap;
  275. }
  276. .thumb-box {
  277. width: 33.333333%;
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. flex-direction: column;
  282. margin: 20px 16rpx 0;
  283. background: #f6f6f6;
  284. padding: 8rpx;
  285. }
  286. .order {
  287. width: 710rpx;
  288. background-color: #ffffff;
  289. margin: 20rpx auto;
  290. border-radius: 20rpx;
  291. box-sizing: border-box;
  292. padding: 20rpx;
  293. font-size: 28rpx;
  294. .top {
  295. display: flex;
  296. justify-content: space-between;
  297. .left {
  298. display: flex;
  299. align-items: center;
  300. .store {
  301. margin: 0 10rpx;
  302. font-size: 32rpx;
  303. font-weight: bold;
  304. }
  305. }
  306. .right {
  307. color: $u-type-warning-dark;
  308. }
  309. }
  310. .item {
  311. display: flex;
  312. margin: 20rpx 0 0;
  313. .left {
  314. margin-right: 20rpx;
  315. image {
  316. width: 200rpx;
  317. height: 200rpx;
  318. border-radius: 10rpx;
  319. }
  320. }
  321. .content {
  322. .title {
  323. font-size: 28rpx;
  324. line-height: 50rpx;
  325. }
  326. .type {
  327. margin: 10rpx 0;
  328. font-size: 24rpx;
  329. color: $u-tips-color;
  330. }
  331. .delivery-time {
  332. color: #e5d001;
  333. font-size: 24rpx;
  334. }
  335. .price-row {
  336. display: flex;
  337. justify-content: space-between;
  338. margin: 10rpx 0;
  339. font-size: 26rpx;
  340. .price {
  341. color: #FF0000;
  342. }
  343. .exchange {
  344. background: #0094FE;
  345. color: #FFFFFF;
  346. padding: 4rpx 16rpx;
  347. line-height: 1.5;
  348. }
  349. }
  350. }
  351. .right {
  352. margin-left: 10rpx;
  353. padding-top: 20rpx;
  354. text-align: right;
  355. .decimal {
  356. font-size: 24rpx;
  357. margin-top: 4rpx;
  358. }
  359. .number {
  360. color: $u-tips-color;
  361. font-size: 24rpx;
  362. }
  363. }
  364. }
  365. .total {
  366. margin-top: 20rpx;
  367. text-align: right;
  368. font-size: 24rpx;
  369. .total-price {
  370. font-size: 32rpx;
  371. }
  372. }
  373. .bottom {
  374. display: flex;
  375. margin-top: 40rpx;
  376. padding: 0 10rpx;
  377. justify-content: space-between;
  378. align-items: center;
  379. .btn {
  380. line-height: 52rpx;
  381. width: 160rpx;
  382. border-radius: 26rpx;
  383. border: 2rpx solid $u-border-color;
  384. font-size: 26rpx;
  385. text-align: center;
  386. color: $u-type-info-dark;
  387. }
  388. .evaluate {
  389. color: $u-type-warning-dark;
  390. border-color: $u-type-warning-dark;
  391. }
  392. }
  393. }
  394. .centre {
  395. text-align: center;
  396. margin: 200rpx auto;
  397. font-size: 32rpx;
  398. image {
  399. width: 164rpx;
  400. height: 164rpx;
  401. border-radius: 50%;
  402. margin-bottom: 20rpx;
  403. }
  404. .tips {
  405. font-size: 24rpx;
  406. color: #999999;
  407. margin-top: 20rpx;
  408. }
  409. .btn {
  410. margin: 80rpx auto;
  411. width: 200rpx;
  412. border-radius: 32rpx;
  413. line-height: 64rpx;
  414. color: #ffffff;
  415. font-size: 26rpx;
  416. background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
  417. }
  418. }
  419. .wrap {
  420. display: flex;
  421. flex-direction: column;
  422. height: calc(100vh - var(--window-top));
  423. width: 100%;
  424. }
  425. #shopping-car {
  426. position: fixed;
  427. z-index: 9999;
  428. right: 26rpx;
  429. bottom: 300rpx;
  430. }
  431. </style>