shelfAnalyse.vue 13 KB

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