shelfAnalyse.vue 13 KB

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