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