shelfAnalyse.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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.productMainPic&&item.productMainPic.imageUrl?item.productMainPic.imageUrl:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  17. </view>
  18. <view class="flex_1">
  19. <view class="flex align_center justify_between">
  20. <view>
  21. LJJLDS234DD323453
  22. </view>
  23. <view class="font_13">
  24. 2022-05-06 12:25:36
  25. </view>
  26. </view>
  27. <view class="padding_3">{{item.name || '--'}} </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">
  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 { dealerProductList } from '@/api/sales'
  116. import search from './search.vue'
  117. import copyText from '@/pages/common/copyText.vue'
  118. export default{
  119. components:{search,copyText},
  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. }
  142. },
  143. onNavigationBarButtonTap(e){
  144. uni.navigateTo({
  145. url:"/pages/vinAnalyse/shelfAnalyse?data="+encodeURIComponent(JSON.stringify(this.detail))
  146. })
  147. },
  148. onBackPress(e) {
  149. if(this.showModal||this.showCart) {
  150. this.showModal = false;
  151. this.showCart = false;
  152. return true;
  153. }
  154. },
  155. computed: {
  156. selPriceShow() {
  157. const a = this.priceList.filter(item => item.checked)
  158. return a.length > 0
  159. },
  160. tabList(){
  161. return this.priceList
  162. }
  163. },
  164. onLoad(option) {
  165. this.selfId = option.selfId
  166. this.getSelfDetail();
  167. this.theme = getApp().globalData.theme
  168. uni.setNavigationBarTitle({
  169. title: this.detail.shelfName
  170. })
  171. this.getList()
  172. },
  173. methods:{
  174. toPage(url){
  175. uni.switchTab({
  176. url:url
  177. })
  178. },
  179. // 刷新列表
  180. refreshList(val){
  181. this.params =val ? val : {},
  182. this.listData = []
  183. this.totalNum = 0
  184. this.getList(1)
  185. },
  186. // 列表
  187. getList(pageNo){
  188. const _this = this
  189. if (pageNo) {
  190. this.pageNo = pageNo
  191. }
  192. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  193. this.status = "loading"
  194. console.log(params)
  195. dealerProductList(params).then(res => {
  196. if (res.status == 200) {
  197. if(this.pageNo>1){
  198. this.listData = this.listData.concat(res.data.list || [])
  199. }else{
  200. this.listData = res.data.list || []
  201. }
  202. this.totalNum = res.data.count || 0
  203. } else {
  204. this.listData = []
  205. this.totalNum = 0
  206. this.noDataText = res.message
  207. }
  208. this.status = "loadmore"
  209. })
  210. },
  211. // scroll-view到底部加载更多
  212. onreachBottom() {
  213. if(this.listData.length < this.totalNum){
  214. this.pageNo += 1
  215. this.getList()
  216. }
  217. },
  218. // 查看销售记录
  219. toViewDetail(row){
  220. this.tempData = row
  221. this.showCart = true
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang="scss">
  227. .shelf-analyse-content{
  228. width:100%;
  229. height: 100vh;
  230. .checkbox-price{
  231. background-color: #fff;
  232. display: flex;
  233. align-items: center;
  234. justify-content: space-between;
  235. padding: 10rpx 25rpx;
  236. color: #191919;
  237. .search{
  238. color:#00aaff;
  239. }
  240. }
  241. .product-list{
  242. height: calc(100vh - 84upx);
  243. .st-detailList-main{
  244. padding: 20upx;
  245. .st-detailList-main-item{
  246. background: #ffffff;
  247. padding: 20upx;
  248. margin-bottom: 25upx;
  249. border-radius: 25upx;
  250. box-shadow: 1px 1px 3px #EEEEEE;
  251. .st-detailList-item-con{
  252. padding: 20upx 0;
  253. font-size: 28upx;
  254. .red{
  255. color: red;
  256. }
  257. .pimgs{
  258. margin-right: 16upx;
  259. }
  260. .font_13{
  261. font-size: 24upx;
  262. color: #999;
  263. }
  264. .padding_3{
  265. padding: 6upx 0;
  266. word-break: break-all;
  267. }
  268. }
  269. .price-all{
  270. border-top: 1px solid #e4e7ed;
  271. padding: 10upx 20upx 0;
  272. .price-item{
  273. width: 33.3%;
  274. border-right: 1px solid #e4e7ed;
  275. text-align: center;
  276. >view{
  277. color:#999;
  278. margin-bottom: 10rpx;
  279. font-size: 24rpx;
  280. }
  281. >text{
  282. border:1rpx solid #eee;
  283. font-size: 20rpx;
  284. padding:5rpx 10rpx;
  285. border-radius: 10rpx;
  286. min-width: 100rpx;
  287. display: inline-block;
  288. }
  289. .red{
  290. color:#ff5500;
  291. border-color: #ff5500;
  292. }
  293. .green{
  294. color:#00cb00;
  295. border-color: #00cb00;
  296. }
  297. }
  298. .price-item:last-child{
  299. border-right: none;
  300. }
  301. }
  302. }
  303. }
  304. }
  305. // 详情
  306. .cpb_cart-mask{
  307. position: fixed;
  308. width: 100%;
  309. background: rgba(0,0,0,0.5);
  310. z-index: 900;
  311. bottom: 0;
  312. top: 0;
  313. }
  314. .cpb_cart-box{
  315. background-color: #fff;
  316. position: absolute;
  317. width: 100%;
  318. z-index: 1000;
  319. bottom: 0;
  320. border-radius: 30rpx 30rpx 0 0;
  321. max-height: 70vh;
  322. display: flex;
  323. flex-direction: column;
  324. .cpb_close{
  325. position: absolute;
  326. top: 10rpx;
  327. right: 20rpx;
  328. width: 70rpx;
  329. height: 70rpx;
  330. font-size: 32rpx;
  331. color: #999;
  332. }
  333. .cpb_cart-tit{
  334. padding: 20rpx 30rpx 0;
  335. font-size: 30rpx;
  336. border-bottom: 2rpx solid #eee;
  337. .st-detailList-item-con{
  338. padding: 20upx 0;
  339. font-size: 28upx;
  340. .pimgs{
  341. margin-right: 16upx;
  342. }
  343. .font_13{
  344. font-size: 24upx;
  345. }
  346. .padding_3{
  347. padding: 6upx 0;
  348. word-break: break-all;
  349. }
  350. }
  351. }
  352. .cpb_body{
  353. height: 80vh;
  354. .cpb_tab{
  355. width: 25%;
  356. height: 100%;
  357. background-color: #f8f8f8;
  358. > div{
  359. padding: 30rpx 20rpx;
  360. font-size: 24rpx;
  361. text-align: center;
  362. }
  363. .active{
  364. background-color: #fff;
  365. border-left: 5rpx solid #00aaff;
  366. }
  367. }
  368. }
  369. .cpb_cart-list{
  370. padding: 20rpx;
  371. overflow: auto;
  372. flex-grow: 1;
  373. > view{
  374. margin-bottom: 20rpx;
  375. }
  376. .nav-right-item{
  377. padding: 0 30upx;
  378. }
  379. .item-name{
  380. font-size: 30rpx;
  381. text{
  382. background: rgba(3, 54, 146, 0.15);
  383. color: #1c588a;
  384. border-radius: 1em;
  385. font-size: 0.8em;
  386. padding: 0 0.5em;
  387. margin-right: 10upx;
  388. }
  389. }
  390. .item-info{
  391. border-bottom:2rpx solid #eee;
  392. flex-grow: 1;
  393. padding-left: 0.2em;
  394. }
  395. .item-detail{
  396. .item-detail-info{
  397. padding: 10upx 0 4upx;
  398. font-size: 24upx;
  399. > view{
  400. padding-bottom: 20rpx;
  401. align-items: center;
  402. .item-detail-text{
  403. color: #999;
  404. margin-left: 20upx;
  405. }
  406. }
  407. }
  408. }
  409. }
  410. }
  411. }
  412. </style>