productPricing.vue 6.8 KB

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