integral_mall.vue 9.9 KB

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