shelfAnalyse.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <template>
  2. <view class="shelf-analyse-content">
  3. <view class="headerName u-flex">
  4. <text></text>
  5. <view class="shelfName u-line-1">{{shelfName}}</view>
  6. </view>
  7. <view class="checkbox-price">
  8. <u-checkbox-group placement="row" :size="24">
  9. <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>
  10. </u-checkbox-group>
  11. <view class="search" @click="showModal=true">
  12. <text>筛选</text> <u-icon name="arrow-down"></u-icon>
  13. </view>
  14. </view>
  15. <scroll-view class="product-list" scroll-y>
  16. <view class="st-detailList-main">
  17. <view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="toViewDetail(item)">
  18. <view class="st-detailList-item-con flex align_center">
  19. <view class="pimgs">
  20. <u-image :src="item.icon?item.icon:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  21. </view>
  22. <view class="flex_1 pimgs_right">
  23. <view class="flex align_center justify_between">
  24. <view>
  25. {{item.vinCode}}
  26. </view>
  27. <view class="font_13">
  28. {{item.createDate}}
  29. </view>
  30. </view>
  31. <view class="padding_3">{{item.modelInfo || '--'}} </view>
  32. </view>
  33. </view>
  34. <view class="price-all flex" v-if="selPriceShow">
  35. <view class="price-item" v-if="priceList[0].checked">
  36. <view>空调滤清器</view>
  37. <text class="green" v-if="item.airConditionerFilterFlag == 1">有适配</text>
  38. <text class="red" v-else-if="item.airConditionerFilterFlag == 2">无适配</text>
  39. <text v-else>--</text>
  40. </view>
  41. <view class="price-item" v-if="priceList[1].checked">
  42. <view>空气滤清器</view>
  43. <text class="green" v-if="item.airFilterFlag == 1">有适配</text>
  44. <text class="red" v-else-if="item.airFilterFlag == 2">无适配</text>
  45. <text v-else>--</text>
  46. </view>
  47. <view class="price-item" v-if="priceList[2].checked">
  48. <view>机油滤清器</view>
  49. <text class="green" v-if="item.engineOilFilterFlag == 1">有适配</text>
  50. <text class="red" v-else-if="item.engineOilFilterFlag == 2">无适配</text>
  51. <text v-else>--</text>
  52. </view>
  53. </view>
  54. </view>
  55. <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>
  56. <view style="padding-bottom: 20upx;">
  57. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  58. </view>
  59. </view>
  60. </scroll-view>
  61. <!-- 搜索弹窗 -->
  62. <search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
  63. <!-- vin 详情 -->
  64. <div class="cpb_cart-mask" v-if="showCart" @click="showCart=false;selFlag=0">
  65. <div class="cpb_cart-box" @click.stop="showCart=true">
  66. <div class="cpb_close flex align-center justify_center" @click.stop="showCart=false;selFlag=0">
  67. <u-icon name="close"></u-icon>
  68. </div>
  69. <div class="cpb_cart-tit">
  70. <view>VIN详情</view>
  71. <view class="st-detailList-item-con flex">
  72. <view class="pimgs">
  73. <u-image :src="tempData.icon?tempData.icon:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  74. </view>
  75. <view class="flex_1 pimgs_right">
  76. <view class="padding_3">{{tempData.modelInfo || '--'}} </view>
  77. <view class="font_13">
  78. VIN:{{tempData.vinCode}}
  79. </view>
  80. </view>
  81. </view>
  82. </div>
  83. <div class="cpb_body flex justify_between">
  84. <div class="cpb_tab">
  85. <div :class="selFlag==0?'active':''" @click.stop="changeSel(0)">空调滤清器</div>
  86. <div :class="selFlag==1?'active':''" @click.stop="changeSel(1)">空气滤清器</div>
  87. <div :class="selFlag==2?'active':''" @click.stop="changeSel(2)">机油滤清器</div>
  88. </div>
  89. <div class="cpb_cart-list" v-if="productList.length>0">
  90. <div
  91. v-for="(item, index) in productList"
  92. :key="index"
  93. >
  94. <view class="nav-right-item flex">
  95. <view class="uni-col-2">
  96. <u-image :src="item.productImageUrl?item.productImageUrl:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="30"></u-image>
  97. </view>
  98. <view class="item-info uni-col-10">
  99. <view class="item-name u-line-2">
  100. {{item.productName}}
  101. </view>
  102. <view class="item-detail">
  103. <view class="item-detail-info align_center flex justify_between">
  104. <view>
  105. {{item.productCode}}
  106. </view>
  107. <!-- 判断是否铺货 -->
  108. <view class="flex justify_end" v-if="item.isShelfProduct != '否'">
  109. <text class="item-detail-text">
  110. 库存:{{item.qty?item.qty:0}}
  111. </text>
  112. </view>
  113. <view class="flex justify_end isShelf" v-else>
  114. 暂未铺货
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </div>
  121. <div class="loadmoreStyle"><u-loadmore status="nomore" :load-text="loadText"/></div>
  122. </div>
  123. <view v-else class="emptyStyle">
  124. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" text="暂无匹配产品" mode="list"></u-empty>
  125. </view>
  126. </div>
  127. </div>
  128. </div>
  129. </view>
  130. </template>
  131. <script>
  132. import { toThousands } from '@/libs/tools'
  133. import { queryPage,queryDetail } from '@/api/vinLog'
  134. import search from './search.vue'
  135. // import copyText from '@/pages/common/copyText.vue'
  136. export default{
  137. components:{search},
  138. data(){
  139. return{
  140. toThousands,
  141. listData:[],
  142. totalNum:0,
  143. priceList:[
  144. { name: '空调滤清器', checked: true, val: 'kt' },
  145. { name: '空气滤清器', checked: true, val: 'kq' },
  146. { name: '机油滤清器', checked: true, val: 'jy' },
  147. ],
  148. pageNo:1,
  149. pageSize:15,
  150. noDataText: '暂无数据',
  151. theme: '',
  152. status: 'loadmore',
  153. showModal:false,
  154. showCart: false,
  155. params:{},
  156. detail: null,
  157. tempData: null,
  158. productList: [],
  159. shelfSn:'',//货架名称
  160. selFlag:0,
  161. pullDownRefresh:false,//下拉刷新,
  162. loadText:{
  163. nomore: '已显示全部'
  164. },
  165. shelfName:''
  166. }
  167. },
  168. onNavigationBarButtonTap(e){
  169. uni.navigateTo({
  170. url:"/pages/vinAnalyse/fitProductlist?shelfSn="+this.shelfSn +"&shelfName="+ this.shelfName
  171. })
  172. },
  173. onBackPress(e) {
  174. if(this.showModal||this.showCart) {
  175. this.showModal = false;
  176. this.showCart = false;
  177. return true;
  178. }
  179. },
  180. computed: {
  181. selPriceShow() {
  182. const a = this.priceList.filter(item => item.checked)
  183. return a.length > 0
  184. },
  185. tabList(){
  186. return this.priceList
  187. }
  188. },
  189. onLoad(option) {
  190. this.theme = getApp().globalData.theme;
  191. this.shelfSn = option.shelfSn
  192. this.shelfName = option.shelfName
  193. let ajaxData={
  194. shelfSn:option.shelfSn,
  195. pageNo: this.pageNo,
  196. pageSize: this.pageSize
  197. }
  198. this.getList(ajaxData);
  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. .headerName{
  297. background:#fff;
  298. vertical-align: top;
  299. padding: 15rpx 20rpx;
  300. color: #222;
  301. font-size: 30rpx;
  302. text{
  303. display: block;
  304. height: 30rpx;
  305. width: 6rpx;
  306. background: #0485F6;
  307. margin-right: 10rpx;
  308. border-radius: 10rpx;
  309. }
  310. .shelfName{
  311. font-weight: bold;
  312. width: calc(100% - 16rpx);
  313. }
  314. }
  315. .emptyStyle{
  316. margin:auto;
  317. }
  318. .checkbox-price{
  319. background-color: #fff;
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-between;
  323. padding: 10rpx 25rpx;
  324. color: #191919;
  325. .search{
  326. color:#00aaff;
  327. width: 90rpx;;
  328. }
  329. }
  330. .product-list{
  331. .st-detailList-main{
  332. padding: 20upx;
  333. .st-detailList-main-item{
  334. width: 100%;
  335. box-sizing: border-box;
  336. background: #ffffff;
  337. padding: 20upx;
  338. margin-bottom: 25upx;
  339. border-radius: 25upx;
  340. box-shadow: 1px 1px 3px #EEEEEE;
  341. .st-detailList-item-con{
  342. width: 100%;
  343. box-sizing: border-box;
  344. padding: 20upx 0;
  345. font-size: 28upx;
  346. .red{
  347. color: red;
  348. }
  349. .pimgs{
  350. width: 100rpx;
  351. height: 100rpx;
  352. margin-right: 16upx;
  353. }
  354. .pimgs_right{
  355. width:calc(100% - 116upx);
  356. }
  357. .font_13{
  358. font-size: 24upx;
  359. color: #999;
  360. }
  361. .padding_3{
  362. margin: 6upx 0;
  363. overflow:hidden;
  364. text-overflow: ellipsis;
  365. white-space: nowrap
  366. }
  367. }
  368. .price-all{
  369. border-top: 1px solid #e4e7ed;
  370. padding: 10upx 20upx 0;
  371. .price-item{
  372. width: 33.3%;
  373. border-right: 1px solid #e4e7ed;
  374. text-align: center;
  375. >view{
  376. color:#999;
  377. margin-bottom: 10rpx;
  378. font-size: 24rpx;
  379. }
  380. >text{
  381. border:1rpx solid #eee;
  382. font-size: 20rpx;
  383. padding:5rpx 10rpx;
  384. border-radius: 10rpx;
  385. min-width: 100rpx;
  386. display: inline-block;
  387. }
  388. .red{
  389. color:#ff5500;
  390. border-color: #ff5500;
  391. }
  392. .green{
  393. color:#00cb00;
  394. border-color: #00cb00;
  395. }
  396. }
  397. .price-item:last-child{
  398. border-right: none;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. // 详情
  405. .cpb_cart-mask{
  406. position: fixed;
  407. width: 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. max-height: 70vh;
  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: 80vh;
  456. .cpb_tab{
  457. width: 25%;
  458. height: 100%;
  459. background-color: #f8f8f8;
  460. > div{
  461. padding: 30rpx 20rpx;
  462. font-size: 24rpx;
  463. text-align: center;
  464. }
  465. .active{
  466. background-color: #fff;
  467. border-left: 5rpx solid #00aaff;
  468. }
  469. }
  470. }
  471. .cpb_cart-list{
  472. width: 75%;
  473. height: 100%;
  474. padding: 20rpx;
  475. overflow: auto;
  476. flex-grow: 1;
  477. box-sizing: border-box;
  478. > view{
  479. margin-bottom: 20rpx;
  480. }
  481. .nav-right-item{
  482. padding: 0 20upx 20rpx;
  483. }
  484. .item-name{
  485. font-size: 30rpx;
  486. width:100%;
  487. // text{
  488. // background: rgba(3, 54, 146, 0.15);
  489. // color: #1c588a;
  490. // border-radius: 1em;
  491. // font-size: 0.8em;
  492. // padding: 0 0.5em;
  493. // margin-right: 10upx;
  494. // }
  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>