shelfAnalyse.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <template>
  2. <view class="shelf-analyse-content">
  3. <view class="headerName u-flex u-row-between">
  4. <view class="headerNameLeft u-flex">
  5. <text class="barBox"></text>
  6. <view class="shelfName u-line-1">{{ shelfName }}</view>
  7. </view>
  8. <view class="search" @click="showModal = true">
  9. <text>筛选</text>
  10. <u-icon name="arrow-down"></u-icon>
  11. </view>
  12. </view>
  13. <view class="checkbox-price">
  14. <u-checkbox-group placement="row" :size="24">
  15. <u-checkbox v-model="item.checked" activeColor="rgb(4, 133, 246)" v-for="(item, index) in tabList" :key="index" :name="item.val">{{ item.name }}</u-checkbox>
  16. </u-checkbox-group>
  17. </view>
  18. <scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
  19. <view class="st-detailList-main">
  20. <view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="toViewDetail(item)">
  21. <view class="st-detailList-item-con flex align_center">
  22. <view class="pimgs">
  23. <u-image :src="item.icon ? item.icon : `../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  24. </view>
  25. <view class="flex_1 pimgs_right">
  26. <view class="flex align_center justify_between">
  27. <view>{{ item.vinCode }}</view>
  28. <view class="font_13">{{ item.createDate }}</view>
  29. </view>
  30. <view class="padding_3">{{ item.modelInfo || '--' }}</view>
  31. </view>
  32. </view>
  33. <view class="price-all flex" v-if="selPriceShow">
  34. <view class="price-item" v-if="priceList[0].checked">
  35. <view>空调滤清器</view>
  36. <text class="green" v-if="item.airConditionerFilterFlag == 1">有适配</text>
  37. <text class="red" v-else-if="item.airConditionerFilterFlag == 2">无适配</text>
  38. <text v-else>--</text>
  39. </view>
  40. <view class="price-item" v-if="priceList[1].checked">
  41. <view>空气滤清器</view>
  42. <text class="green" v-if="item.airFilterFlag == 1">有适配</text>
  43. <text class="red" v-else-if="item.airFilterFlag == 2">无适配</text>
  44. <text v-else>--</text>
  45. </view>
  46. <view class="price-item" v-if="priceList[2].checked">
  47. <view>机油滤清器</view>
  48. <text class="green" v-if="item.engineOilFilterFlag == 1">有适配</text>
  49. <text class="red" v-else-if="item.engineOilFilterFlag == 2">无适配</text>
  50. <text v-else>--</text>
  51. </view>
  52. </view>
  53. </view>
  54. <u-empty
  55. v-if="listData.length == 0 && status != 'loading'"
  56. :src="`/static/${$config('themePath')}/def_no_data@3x.png`"
  57. icon-size="150"
  58. text="暂无VIN记录"
  59. mode="list"
  60. :margin-top="260"
  61. ></u-empty>
  62. <view style="padding-bottom: 20upx;"><u-loadmore v-if="totalNum > listData.length || status == 'loading'" :status="status" /></view>
  63. </view>
  64. </scroll-view>
  65. <!-- 搜索弹窗 -->
  66. <search :showModal="showModal" @refresh="refreshList" @close="showModal = false" />
  67. <!-- vin 详情 -->
  68. <view class="cpb_cart-mask" v-if="showCart" @click=" showCart = false; selFlag = 0;">
  69. <view class="cpb_cart-box" @click.stop="showCart = true">
  70. <view class="cpb_close flex align-center justify_center" @click.stop="showCart = false;selFlag = 0;">
  71. <u-icon name="close"></u-icon>
  72. </view>
  73. <view class="cpb_cart-tit">
  74. <view>VIN详情</view>
  75. <view class="st-detailList-item-con flex">
  76. <view class="pimgs">
  77. <u-image :src="tempData.icon ? tempData.icon : `../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  78. </view>
  79. <view class="flex_1 pimgs_right">
  80. <view class="padding_3">{{ tempData.modelInfo || '--' }}</view>
  81. <view class="font_13">VIN:{{ tempData.vinCode }}</view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="cpb_body">
  86. <view class="cpb_tab">
  87. <view :class="selFlag == 0 ? 'active' : ''" @click.stop="changeSel(0)">空调滤清器</view>
  88. <view :class="selFlag == 1 ? 'active' : ''" @click.stop="changeSel(1)">空气滤清器</view>
  89. <view :class="selFlag == 2 ? 'active' : ''" @click.stop="changeSel(2)">机油滤清器</view>
  90. </view>
  91. <scroll-view scroll-y class="cpb_cart-list" v-if="productList.length > 0">
  92. <view v-for="(item, index) in productList" :key="index">
  93. <view class="nav-right-item flex">
  94. <view class="uni-col-2">
  95. <u-image
  96. :src="item.productImageUrl ? item.productImageUrl : `../../static/${theme}/def_img@2x.png`"
  97. width="100"
  98. height="100"
  99. border-radius="30"
  100. ></u-image>
  101. </view>
  102. <view class="item-info uni-col-10">
  103. <view class="item-name u-line-2">{{ item.productName }}</view>
  104. <view class="item-detail">
  105. <view class="item-detail-info align_center flex justify_between">
  106. <view>{{ item.productCode }}</view>
  107. <!-- 判断是否铺货 -->
  108. <view class="flex justify_end" v-if="item.isShelfProduct != '否'">
  109. <text class="item-detail-text">库存:{{ item.qty ? item.qty : 0 }}</text>
  110. </view>
  111. <view class="flex justify_end isShelf" v-else>暂未铺货</view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <view class="sdsjdjsdj">
  118. <u-image
  119. :src="`../../static/${theme}/def_img@2x.png`"
  120. width="100"
  121. height="100"
  122. border-radius="30"
  123. ></u-image>
  124. <u-image
  125. :src="`../../static/${theme}/def_img@2x.png`"
  126. width="100"
  127. height="100"
  128. border-radius="30"
  129. ></u-image>
  130. <u-image
  131. :src="`../../static/${theme}/def_img@2x.png`"
  132. width="100"
  133. height="100"
  134. border-radius="30"
  135. ></u-image>
  136. <u-image
  137. :src="`../../static/${theme}/def_img@2x.png`"
  138. width="100"
  139. height="100"
  140. border-radius="30"
  141. ></u-image>
  142. <u-image
  143. :src="`../../static/${theme}/def_img@2x.png`"
  144. width="100"
  145. height="100"
  146. border-radius="30"
  147. ></u-image>
  148. </view>
  149. <view class="loadmoreStyle"><u-loadmore status="nomore" :load-text="loadText" /></view>
  150. </scroll-view>
  151. <view v-else class="emptyStyle u-flex">
  152. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" text="暂无匹配产品" mode="list"></u-empty>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. </view>
  158. </template>
  159. <script>
  160. import { toThousands } from '@/libs/tools';
  161. import { queryPage, queryDetail } from '@/api/vinLog';
  162. import search from './search.vue';
  163. // import copyText from '@/pages/common/copyText.vue'
  164. export default {
  165. components: { search },
  166. data() {
  167. return {
  168. toThousands,
  169. listData: [],
  170. totalNum: 0,
  171. priceList: [{ name: '空调滤清器', checked: true, val: 'kt' }, { name: '空气滤清器', checked: true, val: 'kq' }, { name: '机油滤清器', checked: true, val: 'jy' }],
  172. pageNo: 1,
  173. pageSize: 15,
  174. noDataText: '暂无数据',
  175. theme: '',
  176. status: 'loadmore',
  177. showModal: false,
  178. showCart: false,
  179. params: {},
  180. detail: null,
  181. tempData: null,
  182. productList: [],
  183. shelfSn: '', //货架名称
  184. selFlag: 0,
  185. pullDownRefresh: false, //下拉刷新,
  186. loadText: {
  187. nomore: '已显示全部'
  188. },
  189. shelfName: '',
  190. isRestCon:false,//是否点击重置按钮
  191. scrollHeight:''
  192. };
  193. },
  194. onNavigationBarButtonTap(e) {
  195. uni.navigateTo({
  196. url: '/pages/vinAnalyse/fitProductlist?shelfSn=' + this.shelfSn + '&shelfName=' + this.shelfName
  197. });
  198. },
  199. onBackPress(e) {
  200. if (this.showModal || this.showCart) {
  201. this.showModal = false;
  202. this.showCart = false;
  203. return true;
  204. }
  205. },
  206. computed: {
  207. selPriceShow() {
  208. const a = this.priceList.filter(item => item.checked);
  209. return a.length > 0;
  210. },
  211. tabList() {
  212. return this.priceList;
  213. }
  214. },
  215. onLoad(option) {
  216. this.theme = getApp().globalData.theme;
  217. this.shelfSn = option.shelfSn;
  218. this.shelfName = option.shelfName;
  219. let ajaxData = {
  220. shelfSn: option.shelfSn,
  221. pageNo: this.pageNo,
  222. pageSize: this.pageSize
  223. };
  224. this.getList(ajaxData);
  225. },
  226. onReady() {
  227. uni.setNavigationBarTitle({
  228. title: 'VIN分析'
  229. });
  230. },
  231. methods: {
  232. toPage(url) {
  233. uni.switchTab({
  234. url: url
  235. });
  236. },
  237. // 搜索查询新列表
  238. refreshList(val) {
  239. (this.params = val ? val : {}), (this.listData = []);
  240. this.totalNum = 0;
  241. delete val.date;
  242. let ajaxData = {
  243. shelfSn: this.shelfSn,
  244. pageNo: 1,
  245. pageSize: this.pageSize
  246. };
  247. if (val) {
  248. Object.assign(ajaxData, val);
  249. }
  250. this.getList(ajaxData);
  251. },
  252. // 列表
  253. getList(params) {
  254. const _this = this;
  255. this.status = 'loading';
  256. queryPage(params).then(res => {
  257. if (res.status == 200) {
  258. if (this.pageNo > 1) {
  259. this.listData = this.listData.concat(res.data.list || []);
  260. } else {
  261. this.listData = res.data.list || [];
  262. }
  263. this.totalNum = res.data.count || 0;
  264. } else {
  265. this.listData = [];
  266. this.totalNum = 0;
  267. this.noDataText = res.message;
  268. }
  269. this.status = 'loadmore';
  270. /* if (this.pullDownRefresh) {
  271. uni.stopPullDownRefresh();
  272. } */
  273. });
  274. },
  275. changeSel(num) {
  276. this.selFlag = num;
  277. this.$nextTick(() => {
  278. this.toViewDetail(this.tempData);
  279. });
  280. },
  281. // 查看详情
  282. toViewDetail(row) {
  283. this.tempData = row;
  284. queryDetail({ id: row.id }).then(res => {
  285. this.showCart = true;
  286. if (this.selFlag == 0) {
  287. this.productList = res.data.airConditionerFilter;
  288. } else if (this.selFlag == 1) {
  289. this.productList = res.data.airFilterFlag;
  290. } else {
  291. this.productList = res.data.engineOilFilterFlag;
  292. }
  293. });
  294. },
  295. //到底部加载更多
  296. onreachBottom() {
  297. if (this.listData.length < this.totalNum) {
  298. this.pageNo += 1;
  299. let ajaxData = {
  300. shelfSn: this.shelfSn,
  301. pageNo: this.pageNo,
  302. pageSize: this.pageSize
  303. };
  304. if(this.params){
  305. delete this.params.date;
  306. Object.assign(ajaxData, this.params)
  307. }
  308. this.getList(ajaxData);
  309. } else {
  310. this.status = 'nomore';
  311. }
  312. }
  313. },
  314. // onPullDownRefresh() {
  315. // this.pullDownRefresh = true;
  316. // this.pageNo = 1;
  317. // let ajaxData = {
  318. // shelfSn: this.shelfSn,
  319. // pageNo: this.pageNo,
  320. // pageSize: this.pageSize
  321. // };
  322. // this.getList(ajaxData);
  323. // }
  324. };
  325. </script>
  326. <style lang="scss">
  327. .shelf-analyse-content {
  328. width: 100%;
  329. height: 100vh;
  330. .headerName {
  331. background-color: #fff;
  332. padding: 0 20rpx;
  333. color: #222;
  334. font-size: 30rpx;
  335. .headerNameLeft{
  336. width: calc(100% - 110rpx);
  337. .barBox {
  338. display: block;
  339. height: 30rpx;
  340. width: 6rpx;
  341. background: #0485f6;
  342. margin-right: 10rpx;
  343. border-radius: 10rpx;
  344. }
  345. .shelfName {
  346. font-weight: bold;
  347. width: calc(100% - 16rpx);
  348. }
  349. }
  350. .search {
  351. color: #00aaff;
  352. width: 90rpx;
  353. }
  354. }
  355. .checkbox-price {
  356. background-color: #fff;
  357. padding: 10rpx 25rpx;
  358. color: #191919;
  359. }
  360. .product-list {
  361. height: calc(100vh - 116rpx);
  362. .st-detailList-main {
  363. padding: 20rpx;
  364. .st-detailList-main-item {
  365. width: 100%;
  366. box-sizing: border-box;
  367. background: #ffffff;
  368. padding: 20upx;
  369. margin-bottom: 25upx;
  370. border-radius: 25upx;
  371. box-shadow: 1px 1px 3px #eeeeee;
  372. .st-detailList-item-con {
  373. width: 100%;
  374. box-sizing: border-box;
  375. padding: 20upx 0;
  376. font-size: 28upx;
  377. .red {
  378. color: red;
  379. }
  380. .pimgs {
  381. width: 100rpx;
  382. height: 100rpx;
  383. margin-right: 16upx;
  384. }
  385. .pimgs_right {
  386. width: calc(100% - 116upx);
  387. }
  388. .font_13 {
  389. font-size: 24upx;
  390. color: #999;
  391. }
  392. .padding_3 {
  393. margin: 6upx 0;
  394. overflow: hidden;
  395. text-overflow: ellipsis;
  396. white-space: nowrap;
  397. }
  398. }
  399. .price-all {
  400. border-top: 1px solid #e4e7ed;
  401. padding: 10upx 20upx 0;
  402. .price-item {
  403. width: 33.3%;
  404. border-right: 1px solid #e4e7ed;
  405. text-align: center;
  406. > view {
  407. color: #999;
  408. margin-bottom: 10rpx;
  409. font-size: 24rpx;
  410. }
  411. > text {
  412. border: 1rpx solid #eee;
  413. font-size: 20rpx;
  414. padding: 5rpx 10rpx;
  415. border-radius: 10rpx;
  416. min-width: 100rpx;
  417. display: inline-block;
  418. }
  419. .red {
  420. color: #ff5500;
  421. border-color: #ff5500;
  422. }
  423. .green {
  424. color: #00cb00;
  425. border-color: #00cb00;
  426. }
  427. }
  428. .price-item:last-child {
  429. border-right: none;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. // 详情
  436. .cpb_cart-mask {
  437. position: fixed;
  438. width: 100%;
  439. height: 100%;
  440. background: rgba(0, 0, 0, 0.5);
  441. z-index: 900;
  442. bottom: 0;
  443. top: 0;
  444. }
  445. .cpb_cart-box {
  446. background-color: #fff;
  447. position: absolute;
  448. width: 100%;
  449. z-index: 1000;
  450. bottom: 0;
  451. border-radius: 30rpx 30rpx 0 0;
  452. height: 60vh;
  453. display: flex;
  454. flex-direction: column;
  455. .cpb_close {
  456. position: absolute;
  457. top: 10rpx;
  458. right: 20rpx;
  459. width: 70rpx;
  460. height: 70rpx;
  461. font-size: 32rpx;
  462. color: #999;
  463. }
  464. .cpb_cart-tit {
  465. padding: 20rpx 30rpx 0;
  466. font-size: 30rpx;
  467. border-bottom: 2rpx solid #eee;
  468. .st-detailList-item-con {
  469. padding: 20upx 0;
  470. font-size: 28upx;
  471. .pimgs {
  472. margin-right: 16upx;
  473. }
  474. .pimgs_right {
  475. width: calc(100% - 66upx);
  476. }
  477. .font_13 {
  478. font-size: 24upx;
  479. }
  480. .padding_3 {
  481. padding: 6upx 0;
  482. word-break: break-all;
  483. }
  484. }
  485. }
  486. .cpb_body {
  487. height:calc(60vh - 202rpx);
  488. box-sizing: border-box;
  489. display: flex;
  490. .cpb_tab {
  491. width: 25%;
  492. height: 100%;
  493. background-color: #f8f8f8;
  494. > view {
  495. padding: 30rpx 20rpx;
  496. font-size: 24rpx;
  497. text-align: center;
  498. }
  499. .active {
  500. background-color: #fff;
  501. border-left: 5rpx solid #00aaff;
  502. }
  503. }
  504. .emptyStyle{
  505. align-items: center !important;
  506. margin:160rpx auto 0;
  507. /deep/.u-empty{
  508. justify-content:flex-start !important;
  509. }
  510. }
  511. }
  512. .cpb_cart-list {
  513. width: 75%;
  514. height: 100%;
  515. padding: 20rpx;
  516. flex-grow: 1;
  517. box-sizing: border-box;
  518. > view {
  519. margin-bottom: 20rpx;
  520. }
  521. .nav-right-item {
  522. padding: 0 20upx 20rpx;
  523. }
  524. .item-name {
  525. font-size: 30rpx;
  526. width: 100%;
  527. }
  528. .item-info {
  529. border-bottom: 2rpx solid #eee;
  530. flex-grow: 1;
  531. padding-left: 20rpx;
  532. }
  533. .item-detail {
  534. .item-detail-info {
  535. padding: 10upx 0 4upx;
  536. font-size: 24upx;
  537. > view {
  538. padding-bottom: 20rpx;
  539. align-items: center;
  540. .item-detail-text {
  541. color: #999;
  542. margin-left: 20upx;
  543. }
  544. }
  545. }
  546. .isShelf {
  547. color: #ff5500;
  548. }
  549. }
  550. .loadmoreStyle {
  551. margin-top: 20rpx;
  552. }
  553. }
  554. }
  555. }
  556. </style>