productPricing.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="productPricing-content">
  3. <view class="checkbox-price">
  4. <u-checkbox-group placement="row" :size="28">
  5. <u-checkbox :label-size="26" 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 align_center">
  12. <view class="u-name flex align_center justify_between">
  13. <view style="flex-grow: 1;width:80%" class="flex align_center">
  14. <text>{{item.name}}</text>
  15. <copyText :text="item.name" style="zoom:0.8;margin-left: 5px;" label="产品名称"></copyText>
  16. </view>
  17. <view style="zoom:0.7;margin-left: 5px;">
  18. <u-tag size="mini" :type="item.onlineFalg==1?'success':'info'" :text="item.onlineFalgDictValue"></u-tag>
  19. </view>
  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" style="zoom:0.8;margin-left: 5px;" 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">库存数:<text>{{toThousands(item.stockQty|| 0)}} 个</text></view>
  32. <view><u-button size="mini" type="primary" plain @click="toViewDetail(item)" shape="circle">销售记录</u-button></view>
  33. </view>
  34. <view class="font_13">
  35. 车主价/自定义车主价:<text class="red">{{item.carOwnersPrice ||item.carOwnersPrice==0?'¥'+toThousands(item.carOwnersPrice,2):'--'}}/{{item.dealerProductPrice&&(item.dealerProductPrice.carOwnersPrice||item.dealerProductPrice.carOwnersPrice==0)?'¥'+toThousands(item.dealerProductPrice.carOwnersPrice,2):'--'}} </text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="price-all flex" v-if="selPriceShow">
  40. <view class="price-item1" v-if="priceList[0].checked">
  41. <text>{{(item.offerCost||item.offerCost==0)?toThousands(item.offerCost,2):'--'}} </text>
  42. <view>参考成本价</view>
  43. </view>
  44. <view class="price-item1" v-if="priceList[1].checked">
  45. <text>{{(item.cityPrice || item.cityPrice==0)?toThousands(item.cityPrice,2):'--'}} </text>
  46. <view>市级价</view>
  47. </view>
  48. <view class="price-item1" v-if="priceList[2].checked">
  49. <text>{{(item.specialPrice||item.specialPrice==0)?toThousands(item.specialPrice,2):'--'}} </text>
  50. <view>特约价</view>
  51. </view>
  52. <view class="price-item1" v-if="priceList[3].checked">
  53. <text>{{(item.terminalPrice||item.terminalPrice==0)?toThousands(item.terminalPrice,2):'--'}}/{{item.dealerProductPrice&&(item.dealerProductPrice.terminalPrice||item.dealerProductPrice.terminalPrice==0)?toThousands(item.dealerProductPrice.terminalPrice,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 { getCurrentDealer } from '@/api/data'
  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": 1
  98. },
  99. dealerData: null
  100. }
  101. },
  102. onNavigationBarButtonTap(e){
  103. this.showModal=true
  104. },
  105. onBackPress() {
  106. if(this.showModal){
  107. this.showModal = false
  108. return true
  109. }
  110. },
  111. computed: {
  112. selPriceShow() {
  113. const a = this.priceList.filter(item => item.checked)
  114. return a.length > 0
  115. },
  116. tabList(){
  117. let ret = this.priceList
  118. // 成本价不显示
  119. if(!this.$hasPermissions('M_showCostPrice_mobile')){
  120. ret = ret.filter((item, index) => item.val != 'offerCost')
  121. }
  122. if(this.dealerData){
  123. // 特约价不显示市级
  124. if(this.dealerData.dealerLevel == 'SPECIAL' || !this.$hasPermissions('M_showAllCityPrice_mobile')){
  125. ret = ret.filter((item, index) => item.val != 'cityPrice')
  126. }
  127. // 不显示特约
  128. if(this.dealerData.isShowSpecialPrice != '1'){
  129. ret = ret.filter((item, index) => item.val != 'specialPrice')
  130. }
  131. }
  132. return ret
  133. }
  134. },
  135. onLoad(option) {
  136. this.theme = getApp({ allowDefault: true }).globalData.theme
  137. this.getList()
  138. this.getDealer()
  139. },
  140. methods:{
  141. toPage(url){
  142. uni.switchTab({
  143. url:url
  144. })
  145. },
  146. // 刷新列表
  147. refreshList(val){
  148. this.params =val ? val : {},
  149. this.listData = []
  150. this.totalNum = 0
  151. this.getList(1)
  152. },
  153. // 获取当前经销商信息
  154. getDealer(){
  155. getCurrentDealer().then(res => {
  156. if (res.status == 200) {
  157. this.dealerData = res.data
  158. } else {
  159. this.dealerData = null
  160. }
  161. })
  162. },
  163. // 列表
  164. getList(pageNo){
  165. const _this = this
  166. if (pageNo) {
  167. this.pageNo = pageNo
  168. }
  169. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  170. this.status = "loading"
  171. console.log(params)
  172. dealerProductList(params).then(res => {
  173. if (res.status == 200) {
  174. if(this.pageNo>1){
  175. this.listData = this.listData.concat(res.data.list || [])
  176. }else{
  177. this.listData = res.data.list || []
  178. }
  179. this.totalNum = res.data.count || 0
  180. } else {
  181. this.listData = []
  182. this.totalNum = 0
  183. this.noDataText = res.message
  184. }
  185. this.status = "loadmore"
  186. })
  187. },
  188. // scroll-view到底部加载更多
  189. onreachBottom() {
  190. if(this.listData.length < this.totalNum){
  191. this.pageNo += 1
  192. this.getList()
  193. }
  194. },
  195. // 查看销售记录
  196. toViewDetail(row){
  197. uni.navigateTo({
  198. url: "/pages/sales/salesRecord?productSn="+row.productSn + "&productName="+row.name+ "&productCode="+row.code
  199. })
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="scss">
  205. .productPricing-content{
  206. width:100%;
  207. height: 100vh;
  208. .checkbox-price{
  209. background-color: #fff;
  210. display: flex;
  211. justify-content: space-around;
  212. padding: 20rpx 0;
  213. margin-bottom: 15rpx;
  214. color: #191919;
  215. }
  216. .product-list{
  217. height: calc(100vh - 94upx);
  218. .st-detailList-main{
  219. padding: 0 20upx 20upx;
  220. .st-detailList-main-item{
  221. background: #ffffff;
  222. padding: 20upx;
  223. margin-bottom: 25upx;
  224. border-radius: 25upx;
  225. box-shadow: 1px 1px 3px #EEEEEE;
  226. .st-detailList-tit{
  227. padding-bottom: 20upx;
  228. border-bottom: 1px solid #e4e7ed;
  229. .u-name{
  230. font-weight: bold;
  231. flex-grow: 1;
  232. width: 75%;
  233. }
  234. .u-line{
  235. display: inline-block;
  236. width: 6upx;
  237. height: 30upx;
  238. margin: 0 10upx 0;
  239. border-radius: 5rpx;
  240. }
  241. .u-last{
  242. text-align: right;
  243. width: 25%;
  244. color: dodgerblue;
  245. }
  246. }
  247. .st-detailList-item-con{
  248. padding: 20upx 0;
  249. font-size: 26upx;
  250. .red{
  251. color: red;
  252. }
  253. .pimgs{
  254. margin-right: 20upx;
  255. }
  256. .font_13{
  257. font-size: 26upx;
  258. }
  259. .padding_3{
  260. padding: 6upx 0;
  261. word-break: break-all;
  262. }
  263. }
  264. .price-all{
  265. border-top: 1px solid #e4e7ed;
  266. padding: 20upx 20upx 0 20upx;
  267. flex:1;
  268. .price-item1{
  269. width: 33%;
  270. text-align: center;
  271. >view{
  272. color:#999;
  273. font-size:0.8em;
  274. }
  275. }
  276. }
  277. }
  278. }
  279. }
  280. }
  281. </style>