productPricing.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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 search from './search.vue'
  71. import copyText from '@/pages/common/copyText.vue'
  72. export default{
  73. components:{search,copyText},
  74. data(){
  75. return{
  76. toThousands,
  77. listData:[],
  78. totalNum:0,
  79. priceList:[
  80. { name: '成本价', checked: false, val: 'offerCost' },
  81. { name: '市级价', checked: false, val: 'cityPrice' },
  82. { name: '特约价', checked: false, val: 'specialPrice' },
  83. { name: '终端价/自定义终端价', checked: false, val: 'terminalPrice' },
  84. ],
  85. pageNo:1,
  86. pageSize:15,
  87. noDataText: '暂无数据',
  88. theme: '',
  89. status: 'loadmore',
  90. showModal:false,
  91. params:{
  92. "code": "",
  93. "name": "",
  94. "origCode": "",
  95. "putStockFlag": 1
  96. }
  97. }
  98. },
  99. onNavigationBarButtonTap(e){
  100. this.showModal=true
  101. },
  102. onBackPress() {
  103. if(this.showModal){
  104. this.showModal = false
  105. return true
  106. }
  107. },
  108. computed: {
  109. selPriceShow() {
  110. const a = this.priceList.filter(item => item.checked)
  111. return a.length > 0
  112. },
  113. tabList(){
  114. if(!this.$hasPermissions('M_showCostPrice_mobile')){
  115. return this.priceList.slice(1,4)
  116. }
  117. return this.priceList
  118. }
  119. },
  120. onLoad(option) {
  121. this.theme = getApp().globalData.theme
  122. this.getList()
  123. },
  124. methods:{
  125. toPage(url){
  126. uni.switchTab({
  127. url:url
  128. })
  129. },
  130. // 刷新列表
  131. refreshList(val){
  132. this.params =val ? val : {},
  133. this.listData = []
  134. this.totalNum = 0
  135. this.getList(1)
  136. },
  137. // 列表
  138. getList(pageNo){
  139. const _this = this
  140. if (pageNo) {
  141. this.pageNo = pageNo
  142. }
  143. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  144. this.status = "loading"
  145. console.log(params)
  146. dealerProductList(params).then(res => {
  147. if (res.status == 200) {
  148. if(this.pageNo>1){
  149. this.listData = this.listData.concat(res.data.list || [])
  150. }else{
  151. this.listData = res.data.list || []
  152. }
  153. this.totalNum = res.data.count || 0
  154. } else {
  155. this.listData = []
  156. this.totalNum = 0
  157. this.noDataText = res.message
  158. }
  159. this.status = "loadmore"
  160. })
  161. },
  162. // scroll-view到底部加载更多
  163. onreachBottom() {
  164. if(this.listData.length < this.totalNum){
  165. this.pageNo += 1
  166. this.getList()
  167. }
  168. },
  169. // 查看销售记录
  170. toViewDetail(row){
  171. uni.navigateTo({
  172. url: "/pages/sales/salesRecord?productSn="+row.productSn + "&productName="+row.name+ "&productCode="+row.code
  173. })
  174. }
  175. }
  176. }
  177. </script>
  178. <style lang="scss">
  179. .productPricing-content{
  180. width:100%;
  181. height: 100vh;
  182. .checkbox-price{
  183. background-color: #fff;
  184. display: flex;
  185. justify-content: space-around;
  186. padding: 20rpx 0;
  187. margin-bottom: 15rpx;
  188. color: #191919;
  189. }
  190. .product-list{
  191. height: calc(100vh - 94upx);
  192. .st-detailList-main{
  193. padding: 20upx;
  194. .st-detailList-main-item{
  195. background: #ffffff;
  196. padding: 20upx;
  197. margin-bottom: 25upx;
  198. border-radius: 25upx;
  199. box-shadow: 1px 1px 3px #EEEEEE;
  200. .st-detailList-tit{
  201. padding-bottom: 20upx;
  202. border-bottom: 1px solid #e4e7ed;
  203. .u-name{
  204. font-weight: bold;
  205. flex-grow: 1;
  206. width: 75%;
  207. }
  208. .u-line{
  209. display: inline-block;
  210. width: 6upx;
  211. height: 30upx;
  212. background-color: red;
  213. margin: 6upx 10upx 0 10upx;
  214. }
  215. .u-last{
  216. text-align: right;
  217. width: 25%;
  218. color: dodgerblue;
  219. }
  220. }
  221. .st-detailList-item-con{
  222. padding: 20upx;
  223. font-size: 26upx;
  224. .red{
  225. color: red;
  226. }
  227. .pimgs{
  228. margin-right: 16upx;
  229. }
  230. .font_13{
  231. font-size: 26upx;
  232. }
  233. .padding_3{
  234. padding: 6upx 0;
  235. word-break: break-all;
  236. }
  237. }
  238. .price-all{
  239. border-top: 1px solid #e4e7ed;
  240. padding: 20upx 20upx 0;
  241. .price-item1{
  242. width: 18%;
  243. border-right: 1px solid #e4e7ed;
  244. text-align: center;
  245. >view{
  246. color:#999;
  247. }
  248. }
  249. .price-item2{
  250. width: 46%;
  251. border-right: none;
  252. text-align: center;
  253. >view{
  254. color:#999;
  255. }
  256. }
  257. }
  258. }
  259. }
  260. }
  261. }
  262. </style>