productPricing.vue 8.6 KB

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