inline_shop.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <view>
  3. <!-- 线上订货 -->
  4. <u-navbar :background="background" back-icon-color="#ffffff" is-fixed>
  5. <u-search placeholder="请输入轮胎规格" :show-action="false" v-model="keyword"></u-search>
  6. <u-icon @click="handleGo('msg')" name="chat-fill" label="消息" size="36" label-pos="bottom" :margin-right="16"
  7. label-color="#ffffff" :custom-style="iconCustomStyle"></u-icon>
  8. </u-navbar>
  9. <view class="content">
  10. <u-sticky >
  11. <view class="filter-wrap wrap-flex">
  12. <u-button :custom-style="buttonCustomStyle" :hair-line="false" hover-class="none" @click="handleGo('mallMenu1')">全部</u-button>
  13. <u-dropdown style="position: static;">
  14. <u-dropdown-item v-model="brandValue" title="品牌" :options="brandOptions"></u-dropdown-item>
  15. <u-dropdown-item v-model="patternValue" title="花纹" :options="patternOptions"></u-dropdown-item>
  16. </u-dropdown>
  17. <u-button :custom-style="buttonCustomStyle" :hair-line="false" hover-class="none" @click="showFilterPopup=true">筛选
  18. <u-icon name="grid"></u-icon>
  19. </u-button>
  20. </view>
  21. </u-sticky>
  22. <u-waterfall v-model="flowList" ref="uWaterfall">
  23. <template v-slot:left="{leftList}">
  24. <view class="demo-warter" v-for="(item, index) in leftList" :key="index" @click="inDetails">
  25. <!-- 警告:微信小程序中需要hx2.8.11版本才支持在template中结合其他组件,比如下方的lazy-load组件 -->
  26. <u-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
  27. <view class="demo-title">
  28. {{item.title}}
  29. </view>
  30. <!-- <view class="demo-price">
  31. {{item.price}}元
  32. </view> -->
  33. <!-- <view class="demo-tag">
  34. <view class="demo-tag-owner">
  35. 自营
  36. </view>
  37. <view class="demo-tag-text">
  38. 放心购
  39. </view>
  40. </view> -->
  41. <view class="demo-shop">
  42. 库存:{{item.count}}
  43. </view>
  44. <view class="shopping-car"><u-icon :custom-style="iconCustomStyleCar" color="#ffffff" name="car"></u-icon></view>
  45. </view>
  46. </template>
  47. <template v-slot:right="{rightList}">
  48. <view class="demo-warter" v-for="(item, index) in rightList" :key="index">
  49. <u-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
  50. <view class="demo-title">
  51. {{item.title}}
  52. </view>
  53. <!-- <view class="demo-price">
  54. {{item.price}}元
  55. </view> -->
  56. <!-- <view class="demo-tag">
  57. <view class="demo-tag-owner">
  58. 自营
  59. </view>
  60. <view class="demo-tag-text">
  61. 放心购
  62. </view>
  63. </view> -->
  64. <view class="demo-shop">
  65. 库存:{{item.count}}
  66. </view>
  67. <view class="shopping-car"><u-icon :custom-style="iconCustomStyleCar" name="car" color="#ffffff"></u-icon></view>
  68. </view>
  69. </template>
  70. </u-waterfall>
  71. <u-loadmore bg-color="rgb(240, 240, 240)" :status="loadStatus" @loadmore="addRandomData"></u-loadmore>
  72. </view>
  73. <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>
  74. <u-popup v-model="showFilterPopup" mode="right" width="60%">
  75. <view class="filter-title">筛选</view>
  76. <block v-for="(item,index) in tabbar" :key="index">
  77. <scroll-view scroll-y class="right-box">
  78. <view class="page-view">
  79. <view class="class-item">
  80. <view class="item-title">
  81. <text>{{item.name}}</text>
  82. </view>
  83. <view class="item-container">
  84. <view class="thumb-box" v-for="(item1, index1) in item.foods" :key="index1">
  85. <view class="item-menu-name">{{item1.value}}</view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </scroll-view>
  91. </block>
  92. </u-popup>
  93. </view>
  94. </template>
  95. <script>
  96. import classifyData from "@/common/classify.data.js";
  97. export default {
  98. data() {
  99. return {
  100. background: {
  101. backgroundColor: "#0291FD",
  102. color: "#ffffff"
  103. },
  104. iconCustomStyle: {
  105. padding: "24rpx 14rpx 14rpx 14rpx"
  106. },
  107. iconCustomStyleCar: {
  108. background: "#0291FD",
  109. padding: "16rpx",
  110. borderRadius: "50%"
  111. },
  112. iconCustomStyleCarFixed: {
  113. background: "#ffffff",
  114. padding: "16rpx",
  115. borderRadius: "50%",
  116. boxShadow: "0px 1px 12px 0px rgba(116, 116, 116, 0.6)"
  117. },
  118. buttonCustomStyle: {
  119. border: "none"
  120. },
  121. keyword: "",
  122. allValue: "",
  123. brandValue: "",
  124. brandOptions: [{
  125. label: "赛轮",
  126. value: "SAILUN"
  127. }, {
  128. label: "金宇",
  129. value: "jinyu"
  130. }],
  131. patternValue: "",
  132. patternOptions: [{
  133. label: "SH08",
  134. value: "SH08"
  135. }, {
  136. label: "RH07",
  137. value: "RH07"
  138. }],
  139. showFilterPopup: false,
  140. tabbar: [{
  141. "name": "品牌",
  142. "foods": [{
  143. "value": "赛轮",
  144. "label": "SAILUN",
  145. },
  146. {
  147. "value": "金宇",
  148. "label": "jinyu",
  149. },
  150. ]
  151. }],
  152. loadStatus: 'loadmore',
  153. goodsCounts: 99,//购物车商品数
  154. flowList: [],
  155. list: [{
  156. price: 35,
  157. title: '175/70R14 88T XL SH08 BGSL',
  158. count: '100',
  159. image: 'https://img12.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  160. },
  161. {
  162. price: 75,
  163. title: '175/70R14 88T XL SH08 BGSL',
  164. count: '100',
  165. image: 'https://img12.360buyimg.com/n7/jfs/t1/47645/22/6120/140457/5d3d17deEec9f8e8d/3687ff03ca89b48c.jpg',
  166. },
  167. {
  168. price: 385,
  169. title: '175/70R14 88T XL SH08 BGSL',
  170. count: '100',
  171. image: 'https://img11.360buyimg.com/n7/jfs/t1/88990/24/4208/105799/5de4c6e9E24bc09d0/f810effb14c9c13a.jpg',
  172. },
  173. {
  174. price: 784,
  175. title: '175/70R14 88T XL SH08 BGSL',
  176. count: '100',
  177. image: 'https://img12.360buyimg.com/n7/jfs/t1/93698/23/4500/114562/5de713dfEfc997085/e8deaa979909851d.jpg',
  178. },
  179. {
  180. price: 7891,
  181. title: '175/70R14 88T XL SH08 BGSL',
  182. count: '100',
  183. image: 'https://img11.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  184. },
  185. {
  186. price: 2341,
  187. count: '100',
  188. title: '175/70R14 88T XL SH08 BGSL',
  189. image: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  190. },
  191. {
  192. price: 661,
  193. count: '100',
  194. title: '175/70R14 88T XL SH08 BGSL',
  195. image: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  196. },
  197. {
  198. price: 1654,
  199. title: '175/70R14 88T XL SH08 BGSL',
  200. count: '100',
  201. image: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  202. },
  203. {
  204. price: 1678,
  205. title: '175/70R14 88T XL SH08 BGSL',
  206. count: '100',
  207. image: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  208. },
  209. {
  210. price: 924,
  211. title: '175/70R14 88T XL SH08 BGSL',
  212. count: '100',
  213. image: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  214. },
  215. {
  216. price: 8243,
  217. title: '175/70R14 88T XL SH08 BGSL',
  218. count: '100',
  219. image: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  220. },
  221. ]
  222. }
  223. },
  224. onLoad() {
  225. this.addRandomData();
  226. },
  227. onReachBottom() {
  228. this.loadStatus = 'loading';
  229. // 模拟数据加载
  230. setTimeout(() => {
  231. this.addRandomData();
  232. this.loadStatus = 'loadmore';
  233. }, 1000)
  234. },
  235. methods: {
  236. handleGo: function(value) {
  237. var urlStr = ""
  238. switch (value) {
  239. case "msg":
  240. urlStr: "../../msg/index";
  241. break;
  242. case "mallMenu1":
  243. urlStr: "../../mallMenu/index1";
  244. break;
  245. case "mallMenu2":
  246. urlStr: "../../mallMenu2/index2";
  247. break;
  248. };
  249. uni.switchTab({
  250. url: urlStr
  251. });
  252. },
  253. addRandomData() {
  254. for (let i = 0; i < 10; i++) {
  255. let index = this.$u.random(0, this.list.length - 1);
  256. // 先转成字符串再转成对象,避免数组对象引用导致数据混乱
  257. let item = JSON.parse(JSON.stringify(this.list[index]))
  258. item.id = this.$u.guid();
  259. this.flowList.push(item);
  260. }
  261. },
  262. remove(id) {
  263. this.$refs.uWaterfall.remove(id);
  264. },
  265. clear() {
  266. this.$refs.uWaterfall.clear();
  267. },
  268. inDetails(){
  269. this.$u.route({
  270. url: 'pages/home/shopping/inline_shop_details',
  271. })
  272. }
  273. }
  274. }
  275. </script>
  276. <style lang="scss" scoped>
  277. .wrap-flex {
  278. display: flex;
  279. }
  280. .filter-wrap {
  281. background: #ffffff;
  282. }
  283. .filter-title {
  284. background: #F6F6F6;
  285. padding: 16rpx;
  286. }
  287. .class-item {
  288. margin-bottom: 30rpx;
  289. background-color: #fff;
  290. padding: 16rpx;
  291. border-radius: 8rpx;
  292. }
  293. .class-item:last-child {
  294. min-height: 100vh;
  295. }
  296. .item-title {
  297. font-size: 26rpx;
  298. color: $u-main-color;
  299. font-weight: bold;
  300. }
  301. .item-menu-name {
  302. font-weight: normal;
  303. font-size: 24rpx;
  304. color: $u-main-color;
  305. }
  306. .item-container {
  307. display: flex;
  308. flex-wrap: wrap;
  309. }
  310. .thumb-box {
  311. width: 33.333333%;
  312. display: flex;
  313. align-items: center;
  314. justify-content: center;
  315. flex-direction: column;
  316. margin: 20px 16rpx 0;
  317. background: #f6f6f6;
  318. padding: 8rpx;
  319. }
  320. .demo-warter {
  321. border-radius: 8px;
  322. margin: 5px;
  323. background-color: #ffffff;
  324. padding: 8px;
  325. position: relative;
  326. }
  327. .u-close {
  328. position: absolute;
  329. top: 32rpx;
  330. right: 32rpx;
  331. }
  332. .demo-image {
  333. width: 100%;
  334. border-radius: 4px;
  335. }
  336. .demo-title {
  337. font-size: 30rpx;
  338. margin-top: 5px;
  339. color: $u-main-color;
  340. }
  341. .demo-tag {
  342. display: flex;
  343. margin-top: 5px;
  344. }
  345. .demo-tag-owner {
  346. background-color: $u-type-error;
  347. color: #FFFFFF;
  348. display: flex;
  349. align-items: center;
  350. padding: 4rpx 14rpx;
  351. border-radius: 50rpx;
  352. font-size: 20rpx;
  353. line-height: 1;
  354. }
  355. .demo-tag-text {
  356. border: 1px solid $u-type-primary;
  357. color: $u-type-primary;
  358. margin-left: 10px;
  359. border-radius: 50rpx;
  360. line-height: 1;
  361. padding: 4rpx 14rpx;
  362. display: flex;
  363. align-items: center;
  364. border-radius: 50rpx;
  365. font-size: 20rpx;
  366. }
  367. .demo-price {
  368. font-size: 30rpx;
  369. color: $u-type-error;
  370. margin-top: 5px;
  371. }
  372. .demo-shop {
  373. font-size: 22rpx;
  374. color: $u-tips-color;
  375. margin-top: 5px;
  376. }
  377. .shopping-car{
  378. position: absolute;
  379. bottom: 4rpx;
  380. right: 16rpx;
  381. }
  382. #shopping-car{
  383. position: fixed;
  384. z-index: 9999;
  385. right: 26rpx;
  386. bottom: 300rpx;
  387. }
  388. </style>