productPricing.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. ret = ret.filter((item, index) => index !== 2)
  128. // 市级价不显示
  129. if(!this.$hasPermissions('M_showAllCityPrice_mobile')){
  130. ret = ret.filter((item, index) => index !== 1)
  131. }
  132. }
  133. }
  134. return ret
  135. }
  136. },
  137. onLoad(option) {
  138. this.theme = getApp().globalData.theme
  139. this.getList()
  140. this.getDealer()
  141. },
  142. methods:{
  143. toPage(url){
  144. uni.switchTab({
  145. url:url
  146. })
  147. },
  148. // 刷新列表
  149. refreshList(val){
  150. this.params =val ? val : {},
  151. this.listData = []
  152. this.totalNum = 0
  153. this.getList(1)
  154. },
  155. // 获取当前经销商信息
  156. getDealer(){
  157. getCurrentDealer().then(res => {
  158. if (res.status == 200) {
  159. this.dealerData = res.data
  160. } else {
  161. this.dealerData = null
  162. }
  163. })
  164. },
  165. // 列表
  166. getList(pageNo){
  167. const _this = this
  168. if (pageNo) {
  169. this.pageNo = pageNo
  170. }
  171. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  172. this.status = "loading"
  173. console.log(params)
  174. dealerProductList(params).then(res => {
  175. if (res.status == 200) {
  176. if(this.pageNo>1){
  177. this.listData = this.listData.concat(res.data.list || [])
  178. }else{
  179. this.listData = res.data.list || []
  180. }
  181. this.totalNum = res.data.count || 0
  182. } else {
  183. this.listData = []
  184. this.totalNum = 0
  185. this.noDataText = res.message
  186. }
  187. this.status = "loadmore"
  188. })
  189. },
  190. // scroll-view到底部加载更多
  191. onreachBottom() {
  192. if(this.listData.length < this.totalNum){
  193. this.pageNo += 1
  194. this.getList()
  195. }
  196. },
  197. // 查看销售记录
  198. toViewDetail(row){
  199. uni.navigateTo({
  200. url: "/pages/sales/salesRecord?productSn="+row.productSn + "&productName="+row.name+ "&productCode="+row.code
  201. })
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss">
  207. .productPricing-content{
  208. width:100%;
  209. height: 100vh;
  210. .checkbox-price{
  211. background-color: #fff;
  212. display: flex;
  213. justify-content: space-around;
  214. padding: 20rpx 0;
  215. margin-bottom: 15rpx;
  216. color: #191919;
  217. }
  218. .product-list{
  219. height: calc(100vh - 94upx);
  220. .st-detailList-main{
  221. padding: 20upx;
  222. .st-detailList-main-item{
  223. background: #ffffff;
  224. padding: 20upx;
  225. margin-bottom: 25upx;
  226. border-radius: 25upx;
  227. box-shadow: 1px 1px 3px #EEEEEE;
  228. .st-detailList-tit{
  229. padding-bottom: 20upx;
  230. border-bottom: 1px solid #e4e7ed;
  231. .u-name{
  232. font-weight: bold;
  233. flex-grow: 1;
  234. width: 75%;
  235. }
  236. .u-line{
  237. display: inline-block;
  238. width: 6upx;
  239. height: 30upx;
  240. background-color: red;
  241. margin: 6upx 10upx 0 10upx;
  242. }
  243. .u-last{
  244. text-align: right;
  245. width: 25%;
  246. color: dodgerblue;
  247. }
  248. }
  249. .st-detailList-item-con{
  250. padding: 20upx;
  251. font-size: 26upx;
  252. .red{
  253. color: red;
  254. }
  255. .pimgs{
  256. margin-right: 16upx;
  257. }
  258. .font_13{
  259. font-size: 26upx;
  260. }
  261. .padding_3{
  262. padding: 6upx 0;
  263. word-break: break-all;
  264. }
  265. }
  266. .price-all{
  267. border-top: 1px solid #e4e7ed;
  268. padding: 20upx 20upx 0 20upx;
  269. flex:1;
  270. .price-item1{
  271. width: 33%;
  272. text-align: center;
  273. >view{
  274. color:#999;
  275. font-size:0.8em;
  276. }
  277. }
  278. }
  279. }
  280. }
  281. }
  282. }
  283. </style>