shelfAnalyse.vue 13 KB

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