productPricing.vue 7.4 KB

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