integral_mall.vue 11 KB

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