integral_mall.vue 9.5 KB

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