shelfAnalyse.vue 14 KB

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