shelfAnalyse.vue 14 KB

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