productPricing.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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 tabList" :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. onBackPress() {
  99. if(this.showModal){
  100. this.showModal = false
  101. return true
  102. }
  103. },
  104. computed: {
  105. selPriceShow() {
  106. const a = this.priceList.filter(item => item.checked)
  107. return a.length > 0
  108. },
  109. tabList(){
  110. if(!this.$hasPermissions('M_showCostPrice_mobile')){
  111. return this.priceList.slice(1,4)
  112. }
  113. return this.priceList
  114. }
  115. },
  116. onLoad(option) {
  117. this.theme = getApp().globalData.theme
  118. this.getList()
  119. },
  120. methods:{
  121. toPage(url){
  122. uni.switchTab({
  123. url:url
  124. })
  125. },
  126. // 刷新列表
  127. refreshList(val){
  128. this.params =val ? val : {},
  129. this.listData = []
  130. this.totalNum = 0
  131. this.getList(1)
  132. },
  133. // 列表
  134. getList(pageNo){
  135. const _this = this
  136. if (pageNo) {
  137. this.pageNo = pageNo
  138. }
  139. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  140. this.status = "loading"
  141. console.log(params)
  142. dealerProductList(params).then(res => {
  143. if (res.status == 200) {
  144. if(this.pageNo>1){
  145. this.listData = this.listData.concat(res.data.list || [])
  146. }else{
  147. this.listData = res.data.list || []
  148. }
  149. this.totalNum = res.data.count || 0
  150. } else {
  151. this.listData = []
  152. this.totalNum = 0
  153. this.noDataText = res.message
  154. }
  155. this.status = "loadmore"
  156. })
  157. },
  158. // scroll-view到底部加载更多
  159. onreachBottom() {
  160. if(this.listData.length < this.totalNum){
  161. this.pageNo += 1
  162. this.getList()
  163. }
  164. },
  165. // 查看销售记录
  166. toViewDetail(row){
  167. uni.navigateTo({
  168. url: "/pages/sales/salesRecord?productSn="+row.productSn + "&productName="+row.name+ "&productCode="+row.code
  169. })
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss">
  175. .productPricing-content{
  176. width:100%;
  177. height: 100vh;
  178. .checkbox-price{
  179. background-color: #fff;
  180. display: flex;
  181. justify-content: space-around;
  182. padding: 20rpx 0;
  183. margin-bottom: 15rpx;
  184. color: #191919;
  185. }
  186. .product-list{
  187. height: calc(100vh - 94upx);
  188. .st-detailList-main{
  189. padding: 20upx;
  190. .st-detailList-main-item{
  191. background: #ffffff;
  192. padding: 20upx;
  193. margin-bottom: 25upx;
  194. border-radius: 25upx;
  195. box-shadow: 1px 1px 3px #EEEEEE;
  196. .st-detailList-tit{
  197. padding-bottom: 20upx;
  198. border-bottom: 1px solid #e4e7ed;
  199. .u-name{
  200. font-weight: bold;
  201. flex-grow: 1;
  202. width: 75%;
  203. }
  204. .u-line{
  205. display: inline-block;
  206. width: 6upx;
  207. height: 30upx;
  208. background-color: red;
  209. margin: 6upx 10upx 0 10upx;
  210. }
  211. .u-last{
  212. text-align: right;
  213. width: 25%;
  214. color: dodgerblue;
  215. }
  216. }
  217. .st-detailList-item-con{
  218. padding: 20upx;
  219. font-size: 26upx;
  220. .red{
  221. color: red;
  222. }
  223. .pimgs{
  224. margin-right: 16upx;
  225. }
  226. .font_13{
  227. font-size: 26upx;
  228. }
  229. .padding_3{
  230. padding: 6upx 0;
  231. word-break: break-all;
  232. }
  233. }
  234. .price-all{
  235. border-top: 1px solid #e4e7ed;
  236. padding: 20upx 20upx 0;
  237. .price-item{
  238. width: 25%;
  239. border-right: 1px solid #e4e7ed;
  240. text-align: center;
  241. >view{
  242. color:#999;
  243. }
  244. }
  245. .price-item:last-child{
  246. border-right: none;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. }
  253. </style>