productPricing.vue 7.3 KB

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