productPricing.vue 6.7 KB

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