shelfAnalyse.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. </view>
  54. </template>
  55. <script>
  56. import { toThousands } from '@/libs/tools'
  57. import { dealerProductList } from '@/api/sales'
  58. import search from './search.vue'
  59. import copyText from '@/pages/common/copyText.vue'
  60. export default{
  61. components:{search,copyText},
  62. data(){
  63. return{
  64. toThousands,
  65. listData:[],
  66. totalNum:0,
  67. priceList:[
  68. { name: '空调滤清器', checked: true, val: 'kt' },
  69. { name: '空气滤清器', checked: true, val: 'kq' },
  70. { name: '机油滤清器', checked: true, val: 'jy' },
  71. ],
  72. pageNo:1,
  73. pageSize:15,
  74. noDataText: '暂无数据',
  75. theme: '',
  76. status: 'loadmore',
  77. showModal:false,
  78. params:{},
  79. detail: null
  80. }
  81. },
  82. onNavigationBarButtonTap(e){
  83. },
  84. computed: {
  85. selPriceShow() {
  86. const a = this.priceList.filter(item => item.checked)
  87. return a.length > 0
  88. },
  89. tabList(){
  90. return this.priceList
  91. }
  92. },
  93. onLoad(option) {
  94. this.detail = JSON.parse(option.data)
  95. this.theme = getApp().globalData.theme
  96. uni.setNavigationBarTitle({
  97. title: this.detail.shelfName
  98. })
  99. this.getList()
  100. },
  101. methods:{
  102. toPage(url){
  103. uni.switchTab({
  104. url:url
  105. })
  106. },
  107. // 刷新列表
  108. refreshList(val){
  109. this.params =val ? val : {},
  110. this.listData = []
  111. this.totalNum = 0
  112. this.getList(1)
  113. },
  114. // 列表
  115. getList(pageNo){
  116. const _this = this
  117. if (pageNo) {
  118. this.pageNo = pageNo
  119. }
  120. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  121. this.status = "loading"
  122. console.log(params)
  123. dealerProductList(params).then(res => {
  124. if (res.status == 200) {
  125. if(this.pageNo>1){
  126. this.listData = this.listData.concat(res.data.list || [])
  127. }else{
  128. this.listData = res.data.list || []
  129. }
  130. this.totalNum = res.data.count || 0
  131. } else {
  132. this.listData = []
  133. this.totalNum = 0
  134. this.noDataText = res.message
  135. }
  136. this.status = "loadmore"
  137. })
  138. },
  139. // scroll-view到底部加载更多
  140. onreachBottom() {
  141. if(this.listData.length < this.totalNum){
  142. this.pageNo += 1
  143. this.getList()
  144. }
  145. },
  146. // 查看销售记录
  147. toViewDetail(row){
  148. uni.navigateTo({
  149. url: "/pages/sales/salesRecord?productSn="+row.productSn + "&productName="+row.name+ "&productCode="+row.code
  150. })
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss">
  156. .shelf-analyse-content{
  157. width:100%;
  158. height: 100vh;
  159. .checkbox-price{
  160. background-color: #fff;
  161. display: flex;
  162. align-items: center;
  163. justify-content: space-between;
  164. padding: 0 25rpx;
  165. color: #191919;
  166. .search{
  167. color:#00aaff;
  168. }
  169. }
  170. .product-list{
  171. height: calc(100vh - 94upx);
  172. .st-detailList-main{
  173. padding: 20upx;
  174. .st-detailList-main-item{
  175. background: #ffffff;
  176. padding: 20upx;
  177. margin-bottom: 25upx;
  178. border-radius: 25upx;
  179. box-shadow: 1px 1px 3px #EEEEEE;
  180. .st-detailList-item-con{
  181. padding: 20upx 0;
  182. font-size: 26upx;
  183. .red{
  184. color: red;
  185. }
  186. .pimgs{
  187. margin-right: 16upx;
  188. }
  189. .font_13{
  190. font-size: 24upx;
  191. color: #999;
  192. }
  193. .padding_3{
  194. padding: 6upx 0;
  195. word-break: break-all;
  196. }
  197. }
  198. .price-all{
  199. border-top: 1px solid #e4e7ed;
  200. padding: 10upx 20upx 0;
  201. .price-item{
  202. width: 33.3%;
  203. border-right: 1px solid #e4e7ed;
  204. text-align: center;
  205. >view{
  206. color:#999;
  207. margin-bottom: 10rpx;
  208. font-size: 24rpx;
  209. }
  210. >text{
  211. border:1rpx solid #eee;
  212. font-size: 20rpx;
  213. padding:5rpx 10rpx;
  214. border-radius: 10rpx;
  215. min-width: 100rpx;
  216. display: inline-block;
  217. }
  218. .red{
  219. color:#ff5500;
  220. border-color: #ff5500;
  221. }
  222. .green{
  223. color:#00cb00;
  224. border-color: #00cb00;
  225. }
  226. }
  227. .price-item:last-child{
  228. border-right: none;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. </style>