shelfAnalyse.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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. 筛选 <u-icon name="arrow-down"></u-icon>
  9. </view>
  10. </view>
  11. <scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
  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">有适配</text>
  34. </view>
  35. <view class="price-item" v-if="priceList[1].checked">
  36. <view>空气滤清器</view>
  37. <text class="red">无适配</text>
  38. </view>
  39. <view class="price-item" v-if="priceList[2].checked">
  40. <view>机油滤清器</view>
  41. <text>--</text>
  42. </view>
  43. </view>
  44. </view>
  45. <u-empty v-if="listData.length == 0 &&status!='loading'" :text="noDataText" mode="list" ></u-empty>
  46. <view style="padding-bottom: 20upx;">
  47. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  48. </view>
  49. </view>
  50. </scroll-view>
  51. <!-- 搜索弹窗 -->
  52. <search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
  53. <!-- vin 详情 -->
  54. <div class="cpb_cart-mask" v-if="showCart">
  55. <div class="cpb_cart-box">
  56. <div class="cpb_close flex align-center justify_center" @click="showCart=false">
  57. <u-icon name="close"></u-icon>
  58. </div>
  59. <div class="cpb_cart-tit">
  60. <view>VIN详情</view>
  61. <view class="st-detailList-item-con flex">
  62. <view class="pimgs">
  63. <u-image :src="tempData.productMainPic&&tempData.productMainPic.imageUrl?tempData.productMainPic.imageUrl:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  64. </view>
  65. <view class="flex_1 pimgs_right">
  66. <view class="padding_3">{{tempData.name || '--'}} </view>
  67. <view class="font_13">
  68. VIN:LJJLDS234DD323453
  69. </view>
  70. </view>
  71. </view>
  72. </div>
  73. <div class="cpb_body flex justify_between">
  74. <div class="cpb_tab">
  75. <div class="active">空调滤清器</div>
  76. <div>空气滤清器</div>
  77. <div>机油滤清器</div>
  78. </div>
  79. <div class="cpb_cart-list">
  80. <div
  81. v-for="(item, index) in productList"
  82. :key="item.id"
  83. >
  84. <view class="nav-right-item flex">
  85. <view class="uni-col-2">
  86. <u-image :src="item.product&&item.product.images?item.product.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="100" height="100" border-radius="30"></u-image>
  87. </view>
  88. <view class="item-info uni-col-10">
  89. <view class="item-name">
  90. {{item.product.productName}}
  91. </view>
  92. <view class="item-detail">
  93. <view class="item-detail-info align_center flex justify_between">
  94. <view>
  95. {{item.productCode}}
  96. </view>
  97. <view class="flex justify_end">
  98. <text class="item-detail-text">
  99. 库存:{{item.stockQty?item.stockQty:0}} {{item.product&&item.product.unit}}
  100. </text>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </view>
  112. </template>
  113. <script>
  114. import { toThousands } from '@/libs/tools'
  115. import { queryPage,queryDetail } from '@/api/vinLog'
  116. import search from './search.vue'
  117. // import copyText from '@/pages/common/copyText.vue'
  118. export default{
  119. components:{search},
  120. data(){
  121. return{
  122. toThousands,
  123. listData:[],
  124. totalNum:0,
  125. priceList:[
  126. { name: '空调滤清器', checked: true, val: 'kt' },
  127. { name: '空气滤清器', checked: true, val: 'kq' },
  128. { name: '机油滤清器', checked: true, val: 'jy' },
  129. ],
  130. pageNo:1,
  131. pageSize:15,
  132. noDataText: '暂无数据',
  133. theme: '',
  134. status: 'loadmore',
  135. showModal:false,
  136. showCart: false,
  137. params:{},
  138. detail: null,
  139. tempData: null,
  140. productList: [],
  141. shelfSn:''
  142. }
  143. },
  144. onNavigationBarButtonTap(e){
  145. uni.navigateTo({
  146. url:"/pages/vinAnalyse/shelfAnalyse?data="+encodeURIComponent(JSON.stringify(this.detail))
  147. })
  148. },
  149. onBackPress(e) {
  150. if(this.showModal||this.showCart) {
  151. this.showModal = false;
  152. this.showCart = false;
  153. return true;
  154. }
  155. },
  156. computed: {
  157. selPriceShow() {
  158. const a = this.priceList.filter(item => item.checked)
  159. return a.length > 0
  160. },
  161. tabList(){
  162. return this.priceList
  163. }
  164. },
  165. onLoad(option) {
  166. this.shelfSn = option.shelfSn
  167. let ajaxData={
  168. id:option.shelfSn,
  169. pageNo: this.pageNo,
  170. pageSize: this.pageSize
  171. }
  172. this.getList(ajaxData);
  173. this.theme = getApp().globalData.theme
  174. // uni.setNavigationBarTitle({
  175. // title: this.detail.shelfName
  176. // })
  177. // this.getList()
  178. },
  179. methods:{
  180. toPage(url){
  181. uni.switchTab({
  182. url:url
  183. })
  184. },
  185. // 刷新列表
  186. refreshList(val){
  187. this.params =val ? val : {},
  188. this.listData = []
  189. this.totalNum = 0
  190. this.getList(1)
  191. },
  192. // 列表
  193. getList(params){
  194. const _this = this
  195. this.status = "loading"
  196. queryPage(params).then(res => {
  197. if (res.status == 200) {
  198. if(this.pageNo>1){
  199. this.listData = this.listData.concat(res.data.list || [])
  200. }else{
  201. this.listData = res.data.list || []
  202. }
  203. this.totalNum = res.data.count || 0
  204. } else {
  205. this.listData = []
  206. this.totalNum = 0
  207. this.noDataText = res.message
  208. }
  209. this.status = "loadmore"
  210. })
  211. },
  212. // 查看销售记录
  213. toViewDetail(row){
  214. this.tempData = row
  215. this.showCart = true
  216. }
  217. },
  218. // scroll-view到底部加载更多
  219. onReachBottom() {
  220. debugger
  221. if(this.listData.length < this.totalNum){
  222. this.pageNo += 1
  223. let ajaxData={
  224. id:this.shelfSn,
  225. pageNo: this.pageNo,
  226. pageSize: this.pageSize
  227. }
  228. this.getList(ajaxData)
  229. }else{
  230. this.status = "nomore"
  231. }
  232. }
  233. }
  234. </script>
  235. <style lang="scss">
  236. .shelf-analyse-content{
  237. width:100%;
  238. height: 100vh;
  239. .checkbox-price{
  240. background-color: #fff;
  241. display: flex;
  242. align-items: center;
  243. justify-content: space-between;
  244. padding: 10rpx 25rpx;
  245. color: #191919;
  246. .search{
  247. color:#00aaff;
  248. }
  249. }
  250. .product-list{
  251. .st-detailList-main{
  252. padding: 20upx;
  253. .st-detailList-main-item{
  254. width: 100%;
  255. box-sizing: border-box;
  256. background: #ffffff;
  257. padding: 20upx;
  258. margin-bottom: 25upx;
  259. border-radius: 25upx;
  260. box-shadow: 1px 1px 3px #EEEEEE;
  261. .st-detailList-item-con{
  262. width: 100%;
  263. box-sizing: border-box;
  264. padding: 20upx 0;
  265. font-size: 28upx;
  266. .red{
  267. color: red;
  268. }
  269. .pimgs{
  270. width: 100rpx;
  271. height: 100rpx;
  272. margin-right: 16upx;
  273. }
  274. .pimgs_right{
  275. width:calc(100% - 116upx);
  276. }
  277. .font_13{
  278. font-size: 24upx;
  279. color: #999;
  280. }
  281. .padding_3{
  282. margin: 6upx 0;
  283. overflow:hidden;
  284. text-overflow: ellipsis;
  285. white-space: nowrap
  286. }
  287. }
  288. .price-all{
  289. border-top: 1px solid #e4e7ed;
  290. padding: 10upx 20upx 0;
  291. .price-item{
  292. width: 33.3%;
  293. border-right: 1px solid #e4e7ed;
  294. text-align: center;
  295. >view{
  296. color:#999;
  297. margin-bottom: 10rpx;
  298. font-size: 24rpx;
  299. }
  300. >text{
  301. border:1rpx solid #eee;
  302. font-size: 20rpx;
  303. padding:5rpx 10rpx;
  304. border-radius: 10rpx;
  305. min-width: 100rpx;
  306. display: inline-block;
  307. }
  308. .red{
  309. color:#ff5500;
  310. border-color: #ff5500;
  311. }
  312. .green{
  313. color:#00cb00;
  314. border-color: #00cb00;
  315. }
  316. }
  317. .price-item:last-child{
  318. border-right: none;
  319. }
  320. }
  321. }
  322. }
  323. }
  324. // 详情
  325. .cpb_cart-mask{
  326. position: fixed;
  327. width: 100%;
  328. background: rgba(0,0,0,0.5);
  329. z-index: 900;
  330. bottom: 0;
  331. top: 0;
  332. }
  333. .cpb_cart-box{
  334. background-color: #fff;
  335. position: absolute;
  336. width: 100%;
  337. z-index: 1000;
  338. bottom: 0;
  339. border-radius: 30rpx 30rpx 0 0;
  340. max-height: 70vh;
  341. display: flex;
  342. flex-direction: column;
  343. .cpb_close{
  344. position: absolute;
  345. top: 10rpx;
  346. right: 20rpx;
  347. width: 70rpx;
  348. height: 70rpx;
  349. font-size: 32rpx;
  350. color: #999;
  351. }
  352. .cpb_cart-tit{
  353. padding: 20rpx 30rpx 0;
  354. font-size: 30rpx;
  355. border-bottom: 2rpx solid #eee;
  356. .st-detailList-item-con{
  357. padding: 20upx 0;
  358. font-size: 28upx;
  359. .pimgs{
  360. margin-right: 16upx;
  361. }
  362. .pimgs_right{
  363. background-color: red;
  364. width:calc(100% - 66upx);
  365. }
  366. .font_13{
  367. font-size: 24upx;
  368. }
  369. .padding_3{
  370. padding: 6upx 0;
  371. word-break: break-all;
  372. }
  373. }
  374. }
  375. .cpb_body{
  376. height: 80vh;
  377. .cpb_tab{
  378. width: 25%;
  379. height: 100%;
  380. background-color: #f8f8f8;
  381. > div{
  382. padding: 30rpx 20rpx;
  383. font-size: 24rpx;
  384. text-align: center;
  385. }
  386. .active{
  387. background-color: #fff;
  388. border-left: 5rpx solid #00aaff;
  389. }
  390. }
  391. }
  392. .cpb_cart-list{
  393. padding: 20rpx;
  394. overflow: auto;
  395. flex-grow: 1;
  396. > view{
  397. margin-bottom: 20rpx;
  398. }
  399. .nav-right-item{
  400. padding: 0 30upx;
  401. }
  402. .item-name{
  403. font-size: 30rpx;
  404. text{
  405. background: rgba(3, 54, 146, 0.15);
  406. color: #1c588a;
  407. border-radius: 1em;
  408. font-size: 0.8em;
  409. padding: 0 0.5em;
  410. margin-right: 10upx;
  411. }
  412. }
  413. .item-info{
  414. border-bottom:2rpx solid #eee;
  415. flex-grow: 1;
  416. padding-left: 0.2em;
  417. }
  418. .item-detail{
  419. .item-detail-info{
  420. padding: 10upx 0 4upx;
  421. font-size: 24upx;
  422. > view{
  423. padding-bottom: 20rpx;
  424. align-items: center;
  425. .item-detail-text{
  426. color: #999;
  427. margin-left: 20upx;
  428. }
  429. }
  430. }
  431. }
  432. }
  433. }
  434. }
  435. </style>