productPricing.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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">
  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 class="u-last">
  17. <copyText :text="item.name" label="产品名称"></copyText>
  18. </view>
  19. </view>
  20. <view class="st-detailList-item-con flex align_center">
  21. <view class="pimgs">
  22. <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>
  23. </view>
  24. <view class="flex_1">
  25. <view class="padding_3">产品编码:{{item.code}} </view>
  26. <view class="padding_3">原厂编码:{{(item.origCode&&item.origCode!=' ')?item.origCode:'--'}} </view>
  27. <view class="flex align_center justify_between">
  28. <view class="font_13">
  29. 库存数:<text>{{toThousands(item.stockQty|| 0)}} 个</text>
  30. </view>
  31. <view class="font_13">
  32. 车主价:<text class="red">¥{{toThousands(item.carOwnersPrice|| 0,2)}} </text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="price-all flex" v-if="selPriceShow">
  38. <view class="price-item" v-if="priceList[0].checked">
  39. <text>{{toThousands(item.offerCost|| 0,2)}} </text>
  40. <view>成本价</view>
  41. </view>
  42. <view class="price-item" v-if="priceList[1].checked">
  43. <text>{{toThousands(item.cityPrice|| 0,2)}} </text>
  44. <view>市级价</view>
  45. </view>
  46. <view class="price-item" v-if="priceList[2].checked">
  47. <text>{{toThousands(item.specialPrice|| 0,2)}} </text>
  48. <view>特约价</view>
  49. </view>
  50. <view class="price-item" v-if="priceList[3].checked">
  51. <text>{{toThousands(item.terminalPrice|| 0,2)}} </text>
  52. <view>终端会员价</view>
  53. </view>
  54. </view>
  55. </view>
  56. <u-empty v-if="listData.length == 0 &&status!='loading'" :text="noDataText" mode="list" ></u-empty>
  57. <view style="padding-bottom: 20upx;">
  58. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  59. </view>
  60. </view>
  61. </scroll-view>
  62. <!-- 搜索弹窗 -->
  63. <search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
  64. </view>
  65. </template>
  66. <script>
  67. import { toThousands } from '@/libs/tools'
  68. import { dealerProductList } from '@/api/sales'
  69. import search from './search.vue'
  70. import copyText from '@/pages/common/copyText.vue'
  71. export default{
  72. components:{search,copyText},
  73. data(){
  74. return{
  75. toThousands,
  76. listData:[],
  77. totalNum:0,
  78. priceList:[
  79. { name: '成本价', checked: false, val: 'offerCost' },
  80. { name: '市级价', checked: false, val: 'cityPrice' },
  81. { name: '特约价', checked: false, val: 'specialPrice' },
  82. { name: '终端会员价', checked: false, val: 'terminalPrice' },
  83. ],
  84. pageNo:1,
  85. pageSize:15,
  86. noDataText: '暂无数据',
  87. theme: '',
  88. status: 'loadmore',
  89. showModal:false,
  90. params:{}
  91. }
  92. },
  93. onNavigationBarButtonTap(e){
  94. this.showModal=true
  95. },
  96. computed: {
  97. selPriceShow() {
  98. const a = this.priceList.filter(item => item.checked)
  99. return a.length > 0
  100. }
  101. },
  102. onLoad(option) {
  103. this.theme = getApp().globalData.theme
  104. this.getList()
  105. },
  106. methods:{
  107. toPage(url){
  108. uni.switchTab({
  109. url:url
  110. })
  111. },
  112. // 刷新列表
  113. refreshList(val){
  114. this.params =val ? val : {},
  115. this.listData = []
  116. this.totalNum = 0
  117. this.getList(1)
  118. },
  119. // 列表
  120. getList(pageNo){
  121. const _this = this
  122. if (pageNo) {
  123. this.pageNo = pageNo
  124. }
  125. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  126. this.status = "loading"
  127. console.log(params)
  128. dealerProductList(params).then(res => {
  129. if (res.status == 200) {
  130. if(this.pageNo>1){
  131. this.listData = this.listData.concat(res.data.list || [])
  132. }else{
  133. this.listData = res.data.list || []
  134. }
  135. this.totalNum = res.data.count || 0
  136. } else {
  137. this.listData = []
  138. this.totalNum = 0
  139. this.noDataText = res.message
  140. }
  141. this.status = "loadmore"
  142. })
  143. },
  144. // scroll-view到底部加载更多
  145. onreachBottom() {
  146. if(this.listData.length < this.totalNum){
  147. this.pageNo += 1
  148. this.getList()
  149. }
  150. },
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. .productPricing-content{
  156. width:100%;
  157. height: 100vh;
  158. .checkbox-price{
  159. background-color: #fff;
  160. display: flex;
  161. justify-content: space-around;
  162. padding: 20rpx 0;
  163. margin-bottom: 15rpx;
  164. color: #191919;
  165. }
  166. .product-list{
  167. height: calc(100vh - 94upx);
  168. .st-detailList-main{
  169. padding: 20upx;
  170. .st-detailList-main-item{
  171. background: #ffffff;
  172. padding: 20upx;
  173. margin-bottom: 25upx;
  174. border-radius: 25upx;
  175. box-shadow: 1px 1px 3px #EEEEEE;
  176. .st-detailList-tit{
  177. padding-bottom: 20upx;
  178. border-bottom: 1px solid #e4e7ed;
  179. .u-name{
  180. font-weight: bold;
  181. }
  182. .u-line{
  183. display: inline-block;
  184. width: 6upx;
  185. height: 30upx;
  186. background-color: red;
  187. margin: 6upx 10upx 0 10upx;
  188. }
  189. .u-last{
  190. width: 150upx;
  191. }
  192. }
  193. .st-detailList-item-con{
  194. padding: 20upx;
  195. font-size: 26upx;
  196. .red{
  197. color: red;
  198. }
  199. .pimgs{
  200. margin-right: 16upx;
  201. }
  202. .font_13{
  203. font-size: 26upx;
  204. }
  205. .padding_3{
  206. padding: 6upx 0;
  207. word-break: break-all;
  208. }
  209. }
  210. .price-all{
  211. border-top: 1px solid #e4e7ed;
  212. padding: 20upx 20upx 0;
  213. .price-item{
  214. width: 25%;
  215. border-right: 1px solid #e4e7ed;
  216. text-align: center;
  217. >view{
  218. color:#999;
  219. }
  220. }
  221. .price-item:last-child{
  222. border-right: none;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. </style>