productPricing.vue 8.7 KB

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