productPricing.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="productPricing-content">
  3. <view class="checkbox-price">
  4. <u-checkbox-group placement="row">
  5. <u-checkbox v-model="item.checked" activeColor="rgb(4, 133, 246)" v-for="(item,index) in priceList" :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">
  12. <!-- <view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view> -->
  13. <view class="u-name">
  14. {{item.name}}
  15. </view>
  16. <view class="u-last">
  17. <copyText :text="item.name" label="产品名称"></copyText>
  18. </view>
  19. </view>
  20. <view class="st-detailList-item-con flex align_center">
  21. <view class="pimgs">
  22. <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>
  23. </view>
  24. <view class="flex_1">
  25. <view class="padding_3">产品编码:{{item.code}} </view>
  26. <view class="padding_3">原厂编码:{{(item.origCode&&item.origCode!=' ')?item.origCode:'--'}} </view>
  27. <view class="padding_3">品牌:{{item.productBrandName || '--'}} </view>
  28. <view class="flex align_center justify_between">
  29. <view class="font_13" @click="toViewDetail(item)">
  30. 库存数:<text style="text-decoration: underline;color: dodgerblue;">{{toThousands(item.stockQty|| 0)}}</text> 个
  31. </view>
  32. <view class="font_13">
  33. 车主价:<text class="red">¥{{toThousands(item.carOwnersPrice|| 0,2)}} </text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="price-all flex" v-if="selPriceShow">
  39. <view class="price-item" v-if="priceList[0].checked">
  40. <text>{{toThousands(item.offerCost|| 0,2)}} </text>
  41. <view>成本价</view>
  42. </view>
  43. <view class="price-item" v-if="priceList[1].checked">
  44. <text>{{toThousands(item.cityPrice|| 0,2)}} </text>
  45. <view>市级价</view>
  46. </view>
  47. <view class="price-item" v-if="priceList[2].checked">
  48. <text>{{toThousands(item.specialPrice|| 0,2)}} </text>
  49. <view>特约价</view>
  50. </view>
  51. <view class="price-item" v-if="priceList[3].checked">
  52. <text>{{toThousands(item.terminalPrice|| 0,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. }
  93. },
  94. onNavigationBarButtonTap(e){
  95. this.showModal=true
  96. },
  97. computed: {
  98. selPriceShow() {
  99. const a = this.priceList.filter(item => item.checked)
  100. return a.length > 0
  101. }
  102. },
  103. onLoad(option) {
  104. this.theme = getApp().globalData.theme
  105. this.getList()
  106. },
  107. methods:{
  108. toPage(url){
  109. uni.switchTab({
  110. url:url
  111. })
  112. },
  113. // 刷新列表
  114. refreshList(val){
  115. this.params =val ? val : {},
  116. this.listData = []
  117. this.totalNum = 0
  118. this.getList(1)
  119. },
  120. // 列表
  121. getList(pageNo){
  122. const _this = this
  123. if (pageNo) {
  124. this.pageNo = pageNo
  125. }
  126. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  127. this.status = "loading"
  128. console.log(params)
  129. dealerProductList(params).then(res => {
  130. if (res.status == 200) {
  131. if(this.pageNo>1){
  132. this.listData = this.listData.concat(res.data.list || [])
  133. }else{
  134. this.listData = res.data.list || []
  135. }
  136. this.totalNum = res.data.count || 0
  137. } else {
  138. this.listData = []
  139. this.totalNum = 0
  140. this.noDataText = res.message
  141. }
  142. this.status = "loadmore"
  143. })
  144. },
  145. // scroll-view到底部加载更多
  146. onreachBottom() {
  147. if(this.listData.length < this.totalNum){
  148. this.pageNo += 1
  149. this.getList()
  150. }
  151. },
  152. // 查看销售记录
  153. toViewDetail(row){
  154. uni.navigateTo({
  155. url: "/pages/sales/salesRecord?productSn="+row.productSn + "&productName="+row.name+ "&productCode="+row.code
  156. })
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss">
  162. .productPricing-content{
  163. width:100%;
  164. height: 100vh;
  165. .checkbox-price{
  166. background-color: #fff;
  167. display: flex;
  168. justify-content: space-around;
  169. padding: 20rpx 0;
  170. margin-bottom: 15rpx;
  171. color: #191919;
  172. }
  173. .product-list{
  174. height: calc(100vh - 94upx);
  175. .st-detailList-main{
  176. padding: 20upx;
  177. .st-detailList-main-item{
  178. background: #ffffff;
  179. padding: 20upx;
  180. margin-bottom: 25upx;
  181. border-radius: 25upx;
  182. box-shadow: 1px 1px 3px #EEEEEE;
  183. .st-detailList-tit{
  184. padding-bottom: 20upx;
  185. border-bottom: 1px solid #e4e7ed;
  186. .u-name{
  187. font-weight: bold;
  188. }
  189. .u-line{
  190. display: inline-block;
  191. width: 6upx;
  192. height: 30upx;
  193. background-color: red;
  194. margin: 6upx 10upx 0 10upx;
  195. }
  196. .u-last{
  197. width: 150upx;
  198. }
  199. }
  200. .st-detailList-item-con{
  201. padding: 20upx;
  202. font-size: 26upx;
  203. .red{
  204. color: red;
  205. }
  206. .pimgs{
  207. margin-right: 16upx;
  208. }
  209. .font_13{
  210. font-size: 26upx;
  211. }
  212. .padding_3{
  213. padding: 6upx 0;
  214. word-break: break-all;
  215. }
  216. }
  217. .price-all{
  218. border-top: 1px solid #e4e7ed;
  219. padding: 20upx 20upx 0;
  220. .price-item{
  221. width: 25%;
  222. border-right: 1px solid #e4e7ed;
  223. text-align: center;
  224. >view{
  225. color:#999;
  226. }
  227. }
  228. .price-item:last-child{
  229. border-right: none;
  230. }
  231. }
  232. }
  233. }
  234. }
  235. }
  236. </style>