productPricing.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="productPricing-content">
  3. <view class="checkbox-price">
  4. <u-checkbox-group placement="row">
  5. <u-checkbox v-model="item.checked" activeColor="rgb(4, 133, 246)" v-for="(item,index) in priceList" :key="index" :name="item.val">{{item.name}}</u-checkbox>
  6. </u-checkbox-group>
  7. </view>
  8. <scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
  9. <view class="st-detailList-main">
  10. <view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
  11. <view class="st-detailList-tit flex">
  12. <view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>
  13. <view class="u-name">
  14. {{item.name}}
  15. </view>
  16. </view>
  17. <view class="st-detailList-item-con flex align_center">
  18. <view class="pimgs">
  19. <u-image :src="item.productMainPic&&item.productMainPic.imageUrl?item.productMainPic.imageUrl:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  20. </view>
  21. <view class="flex_1">
  22. <view>产品编码:{{item.code}}</view>
  23. <view class="padding_3">原厂编码:{{item.origCode?item.origCode:'--'}}</view>
  24. <view class="flex align_center justify_between">
  25. <view class="font_13">
  26. 总款数:<text>{{toThousands(item.stockQty|| 0)}} 个</text>
  27. </view>
  28. <view class="font_13">
  29. 车主价:<text class="red">¥{{toThousands(item.carOwnersPrice|| 0,2)}} </text>
  30. </view>
  31. </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. <text>{{toThousands(item.offerCost|| 0,2)}} </text>
  37. <view>成本价</view>
  38. </view>
  39. <view class="price-item" v-if="priceList[1].checked">
  40. <text>{{toThousands(item.cityPrice|| 0,2)}} </text>
  41. <view>市级价</view>
  42. </view>
  43. <view class="price-item" v-if="priceList[2].checked">
  44. <text>{{toThousands(item.specialPrice|| 0,2)}} </text>
  45. <view>特约价</view>
  46. </view>
  47. <view class="price-item" v-if="priceList[3].checked">
  48. <text>{{toThousands(item.terminalPrice|| 0,2)}} </text>
  49. <view>终端会员价</view>
  50. </view>
  51. </view>
  52. </view>
  53. <u-empty v-if="listData.length == 0 &&status!='loading'" :text="noDataText" mode="list" ></u-empty>
  54. <view style="padding-bottom: 20upx;">
  55. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  56. </view>
  57. </view>
  58. </scroll-view>
  59. <!-- 搜索弹窗 -->
  60. <search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
  61. </view>
  62. </template>
  63. <script>
  64. import { toThousands } from '@/libs/tools'
  65. import { dealerProductList } from '@/api/sales'
  66. import search from './search.vue'
  67. export default{
  68. components:{search},
  69. data(){
  70. return{
  71. toThousands,
  72. listData:[],
  73. totalNum:0,
  74. priceList:[
  75. { name: '成本价', checked: false, val: 'offerCost' },
  76. { name: '市级价', checked: false, val: 'cityPrice' },
  77. { name: '特约价', checked: false, val: 'specialPrice' },
  78. { name: '终端会员价', checked: false, val: 'terminalPrice' },
  79. ],
  80. pageNo:1,
  81. pageSize:15,
  82. noDataText: '暂无数据',
  83. theme: '',
  84. status: 'loadmore',
  85. showModal:false,
  86. params:{}
  87. }
  88. },
  89. onNavigationBarButtonTap(e){
  90. this.showModal=true
  91. },
  92. computed: {
  93. selPriceShow() {
  94. const a = this.priceList.filter(item => item.checked)
  95. return a.length > 0
  96. }
  97. },
  98. onLoad(option) {
  99. this.theme = getApp().globalData.theme
  100. this.getList()
  101. },
  102. methods:{
  103. toPage(url){
  104. uni.switchTab({
  105. url:url
  106. })
  107. },
  108. // 刷新列表
  109. refreshList(val){
  110. this.params =val ? val : {},
  111. this.$nextTick(function(){
  112. this.getList(1)
  113. })
  114. },
  115. // 列表
  116. getList(pageNo){
  117. const _this = this
  118. if (pageNo) {
  119. this.pageNo = pageNo
  120. }
  121. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  122. this.status = "loading"
  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. }
  148. </script>
  149. <style lang="scss">
  150. .productPricing-content{
  151. width:100%;
  152. height: 100vh;
  153. .checkbox-price{
  154. background-color: #fff;
  155. display: flex;
  156. justify-content: space-around;
  157. padding: 20rpx 0;
  158. margin-bottom: 15rpx;
  159. color: #191919;
  160. }
  161. .product-list{
  162. height: calc(100vh - 94upx);
  163. .st-detailList-main{
  164. padding: 20upx;
  165. .st-detailList-main-item{
  166. background: #ffffff;
  167. padding: 20upx;
  168. margin-bottom: 25upx;
  169. border-radius: 25upx;
  170. box-shadow: 1px 1px 3px #EEEEEE;
  171. .st-detailList-tit{
  172. padding-bottom: 20upx;
  173. border-bottom: 1px solid #e4e7ed;
  174. .u-name{
  175. font-weight: bold;
  176. }
  177. .u-line{
  178. display: inline-block;
  179. width: 6upx;
  180. height: 30upx;
  181. background-color: red;
  182. margin: 6upx 10upx 0 10upx;
  183. }
  184. }
  185. .st-detailList-item-con{
  186. padding: 20upx;
  187. font-size: 26upx;
  188. .red{
  189. color: red;
  190. }
  191. .pimgs{
  192. margin-right: 16upx;
  193. }
  194. .font_13{
  195. font-size: 26upx;
  196. }
  197. .padding_3{
  198. padding: 6upx 0;
  199. }
  200. }
  201. .price-all{
  202. border-top: 1px solid #e4e7ed;
  203. padding: 20upx 20upx 0;
  204. .price-item{
  205. width: 25%;
  206. border-right: 1px solid #e4e7ed;
  207. text-align: center;
  208. >view{
  209. color:#999;
  210. }
  211. }
  212. .price-item:last-child{
  213. border-right: none;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. </style>