productPricing.vue 6.8 KB

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