integral_mall.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view>
  3. <!-- 积分商城 -->
  4. <u-sticky>
  5. <view class="filter-wrap wrap-flex">
  6. <u-button :custom-style="buttonCustomStyle" :hair-line="false" hover-class="none" @click="handleGo('mallMenu1')">精选</u-button>
  7. <u-dropdown style="position: static;">
  8. <u-dropdown-item v-model="brandValue" title="品牌" :options="brandOptions"></u-dropdown-item>
  9. </u-dropdown>
  10. <u-button :custom-style="buttonCustomStyle" :hair-line="false" hover-class="none" @click="showFilterPopup=true">分类
  11. <u-icon name="grid"></u-icon>
  12. </u-button>
  13. <u-search placeholder="请输入商品名称或种类" :animation="true" :style="inputCustomStyle" :show-action="false" v-model="keyword" @focus="inputFocus" @blur="inputBlur"></u-search>
  14. </view>
  15. </u-sticky>
  16. <view class="page-box">
  17. <view class="order" >
  18. <view class="item" v-for="(item, index) in goodsList" :key="index">
  19. <view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
  20. <view class="content">
  21. <view class="title u-line-2">{{ item.title }}</view>
  22. <view class="type">{{ item.type }}</view>
  23. <!-- <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view> -->
  24. <view class="price-row">
  25. <view class="price">
  26. {{ item.price }}积分
  27. </view>
  28. <view class="exchange">立即兑换</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <u-loadmore :status="loadStatus" bgColor="#f2f2f2"></u-loadmore>
  34. </view>
  35. <u-popup v-model="showFilterPopup" mode="right" width="60%">
  36. <view class="filter-title">分类</view>
  37. <block v-for="(item,index) in tabbar" :key="index">
  38. <scroll-view scroll-y class="right-box">
  39. <view class="page-view">
  40. <view class="class-item">
  41. <view class="item-title">
  42. <text>{{item.name}}</text>
  43. </view>
  44. <view class="item-container">
  45. <view class="thumb-box" v-for="(item1, index1) in item.foods" :key="index1">
  46. <view class="item-menu-name">{{item1.value}}</view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </scroll-view>
  52. </block>
  53. </u-popup>
  54. </view>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. buttonCustomStyle: {
  61. border: "none"
  62. },
  63. brandValue: "",
  64. brandOptions: [{
  65. label: "赛轮",
  66. value: "SAILUN"
  67. }, {
  68. label: "金宇",
  69. value: "jinyu"
  70. }],
  71. keyword: "",
  72. inputCustomStyle: {},
  73. showFilterPopup: false,
  74. tabbar: [{
  75. "name": "品牌",
  76. "foods": [{
  77. "value": "赛轮",
  78. "label": "SAILUN",
  79. },
  80. {
  81. "value": "金宇",
  82. "label": "jinyu",
  83. },
  84. ]
  85. }],
  86. loadStatus: "false",
  87. goodsList: [],
  88. list: [
  89. {
  90. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  91. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  92. type: '胎动品牌;修补类型;普通积分',
  93. deliveryTime: '付款后30天内发货',
  94. price: '348.58',
  95. number: 2
  96. },
  97. {
  98. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t1/47645/22/6120/140457/5d3d17deEec9f8e8d/3687ff03ca89b48c.jpg',
  99. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  100. type: '胎动品牌;修补类型;普通积分',
  101. deliveryTime: '付款后30天内发货',
  102. price: '135.00',
  103. number: 1
  104. },
  105. {
  106. goodsUrl: 'https://img11.360buyimg.com/n7/jfs/t1/88990/24/4208/105799/5de4c6e9E24bc09d0/f810effb14c9c13a.jpg',
  107. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  108. type: '胎动品牌;修补类型;普通积分',
  109. deliveryTime: '付款后7天内发货',
  110. price: '128.05',
  111. number: 1
  112. },
  113. {
  114. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t1/93698/23/4500/114562/5de713dfEfc997085/e8deaa979909851d.jpg',
  115. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  116. type: '胎动品牌;修补类型;普通积分',
  117. deliveryTime: '保质5年',
  118. price: '1998',
  119. number: 3
  120. },
  121. {
  122. goodsUrl: 'https://img11.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  123. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  124. type: '胎动品牌;修补类型;普通积分',
  125. deliveryTime: '保质5年',
  126. price: '2354',
  127. number: 1
  128. },
  129. {
  130. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  131. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  132. type: '胎动品牌;修补类型;普通积分',
  133. deliveryTime: '珍藏10年好酒',
  134. price: '1543',
  135. number: 3
  136. },
  137. {
  138. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  139. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  140. type: '胎动品牌;修补类型;普通积分',
  141. deliveryTime: '口感好',
  142. price: '120',
  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: '使用方便',
  150. price: '451',
  151. number: 9
  152. }
  153. ]
  154. }
  155. },
  156. onLoad() {
  157. this.addRandomData();
  158. },
  159. onReachBottom() {
  160. this.loadStatus = 'loading';
  161. // 模拟数据加载
  162. setTimeout(() => {
  163. this.addRandomData();
  164. this.loadStatus = 'loadmore';
  165. }, 1000)
  166. },
  167. methods: {
  168. inputFocus: function(){
  169. console.log(111);
  170. this.inputCustomStyle = {
  171. position: "absolute",
  172. zIndex: "100",
  173. width: "98%",
  174. margin: "6rpx 1%"
  175. };
  176. },
  177. inputBlur: function(){
  178. this.inputCustomStyle = {};
  179. },
  180. handleGo: function(value) {
  181. var urlStr = ""
  182. switch (value) {
  183. case "msg":
  184. urlStr: "../../msg/index";
  185. break;
  186. case "mallMenu1":
  187. urlStr: "../../mallMenu/index1";
  188. break;
  189. case "mallMenu2":
  190. urlStr: "../../mallMenu2/index2";
  191. break;
  192. };
  193. uni.switchTab({
  194. url: urlStr
  195. });
  196. },
  197. addRandomData() {
  198. for (let i = 0; i < 10; i++) {
  199. let index = this.$u.random(0, this.list.length - 1);
  200. // 先转成字符串再转成对象,避免数组对象引用导致数据混乱
  201. let item = JSON.parse(JSON.stringify(this.list[index]))
  202. item.id = this.$u.guid();
  203. this.goodsList.push(item);
  204. }
  205. },
  206. }
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. .wrap-flex {
  211. display: flex;
  212. }
  213. .filter-wrap {
  214. background: #ffffff;
  215. }
  216. .filter-title {
  217. background: #F6F6F6;
  218. padding: 16rpx;
  219. }
  220. .class-item {
  221. margin-bottom: 30rpx;
  222. background-color: #fff;
  223. padding: 16rpx;
  224. border-radius: 8rpx;
  225. }
  226. .class-item:last-child {
  227. min-height: 100vh;
  228. }
  229. .item-title {
  230. font-size: 26rpx;
  231. color: $u-main-color;
  232. font-weight: bold;
  233. }
  234. .item-menu-name {
  235. font-weight: normal;
  236. font-size: 24rpx;
  237. color: $u-main-color;
  238. }
  239. .item-container {
  240. display: flex;
  241. flex-wrap: wrap;
  242. }
  243. .thumb-box {
  244. width: 33.333333%;
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. flex-direction: column;
  249. margin: 20px 16rpx 0;
  250. background: #f6f6f6;
  251. padding: 8rpx;
  252. }
  253. .order {
  254. width: 710rpx;
  255. background-color: #ffffff;
  256. margin: 20rpx auto;
  257. border-radius: 20rpx;
  258. box-sizing: border-box;
  259. padding: 20rpx;
  260. font-size: 28rpx;
  261. .top {
  262. display: flex;
  263. justify-content: space-between;
  264. .left {
  265. display: flex;
  266. align-items: center;
  267. .store {
  268. margin: 0 10rpx;
  269. font-size: 32rpx;
  270. font-weight: bold;
  271. }
  272. }
  273. .right {
  274. color: $u-type-warning-dark;
  275. }
  276. }
  277. .item {
  278. display: flex;
  279. margin: 20rpx 0 0;
  280. .left {
  281. margin-right: 20rpx;
  282. image {
  283. width: 200rpx;
  284. height: 200rpx;
  285. border-radius: 10rpx;
  286. }
  287. }
  288. .content {
  289. .title {
  290. font-size: 28rpx;
  291. line-height: 50rpx;
  292. }
  293. .type {
  294. margin: 10rpx 0;
  295. font-size: 24rpx;
  296. color: $u-tips-color;
  297. }
  298. .delivery-time {
  299. color: #e5d001;
  300. font-size: 24rpx;
  301. }
  302. .price-row{
  303. display: flex;
  304. justify-content: space-between;
  305. margin: 10rpx 0;
  306. font-size: 26rpx;
  307. .price{
  308. color: #FF0000;
  309. }
  310. .exchange{
  311. background: #0094FE;
  312. color: #FFFFFF;
  313. padding: 4rpx 16rpx;
  314. line-height: 1.5;
  315. }
  316. }
  317. }
  318. .right {
  319. margin-left: 10rpx;
  320. padding-top: 20rpx;
  321. text-align: right;
  322. .decimal {
  323. font-size: 24rpx;
  324. margin-top: 4rpx;
  325. }
  326. .number {
  327. color: $u-tips-color;
  328. font-size: 24rpx;
  329. }
  330. }
  331. }
  332. .total {
  333. margin-top: 20rpx;
  334. text-align: right;
  335. font-size: 24rpx;
  336. .total-price {
  337. font-size: 32rpx;
  338. }
  339. }
  340. .bottom {
  341. display: flex;
  342. margin-top: 40rpx;
  343. padding: 0 10rpx;
  344. justify-content: space-between;
  345. align-items: center;
  346. .btn {
  347. line-height: 52rpx;
  348. width: 160rpx;
  349. border-radius: 26rpx;
  350. border: 2rpx solid $u-border-color;
  351. font-size: 26rpx;
  352. text-align: center;
  353. color: $u-type-info-dark;
  354. }
  355. .evaluate {
  356. color: $u-type-warning-dark;
  357. border-color: $u-type-warning-dark;
  358. }
  359. }
  360. }
  361. </style>