productUniversal.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="productPricing-content">
  3. <scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
  4. <view class="st-detailList-main">
  5. <view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id">
  6. <view class="st-detailList-tit flex">
  7. <view class="u-line-1" style="font-weight: bold;margin-right: 20upx;max-width: 60%;">{{item.product.name}}</view>
  8. <u-tag size="mini" :type="item.product.onlineFalg==1?'success':'info'" :text="item.product.onlineFalgDictValue"></u-tag>
  9. <copyText :text="item.product.name" label="产品名称"></copyText>
  10. </view>
  11. <view class="st-detailList-item-con flex align_center">
  12. <view class="flex_1">
  13. <view class="padding_3">产品编码:{{item.productCode}} <copyText :text="item.productCode" label="产品编码"></copyText></view>
  14. <view class="padding_3">通用产品编码:{{item.productCommonCode}} </view>
  15. <view class="padding_3 u-line-2" style="max-width: 100%;">通用产品名称:{{item.productCommon.name || '--'}} </view>
  16. <view class="padding_3">通用产品分类:
  17. <text v-if="item.productCommon.productTypeName2 || item.productCommon.productTypeName3">{{ item.productCommon.productTypeName2 }} {{ item.productCommon.productTypeName3 ? '>' : '' }} {{ item.productCommon.productTypeName3 }}</text>
  18. <text v-else>--</text>
  19. </view>
  20. <view class="font_13">
  21. 创建时间:<text class="gray">{{item.createDate}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="price-all flex" v-if="selPriceShow">
  26. <view class="price-item1" v-if="priceList[0].checked">
  27. <text>{{(item.offerCost||item.offerCost==0)?toThousands(item.offerCost,2):'--'}} </text>
  28. <view>成本价</view>
  29. </view>
  30. <view class="price-item1" v-if="priceList[1].checked">
  31. <text>{{(item.cityPrice || item.cityPrice==0)?toThousands(item.cityPrice,2):'--'}} </text>
  32. <view>市级价</view>
  33. </view>
  34. <view class="price-item1" v-if="priceList[2].checked">
  35. <text>{{(item.specialPrice||item.specialPrice==0)?toThousands(item.specialPrice,2):'--'}} </text>
  36. <view>特约价</view>
  37. </view>
  38. <view class="price-item2" v-if="priceList[3].checked">
  39. <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>
  40. <view>终端价/自定义终端价</view>
  41. </view>
  42. </view>
  43. </view>
  44. <u-empty v-if="listData.length == 0 &&status!='loading'" :text="noDataText" mode="list" ></u-empty>
  45. <view style="padding-bottom: 20upx;">
  46. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  47. </view>
  48. </view>
  49. </scroll-view>
  50. <!-- 搜索弹窗 -->
  51. <search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
  52. </view>
  53. </template>
  54. <script>
  55. import { toThousands } from '@/libs/tools'
  56. import { productUniversalQueryPage } from '@/api/sales'
  57. import search from './search.vue'
  58. import copyText from '@/pages/common/copyText.vue'
  59. export default{
  60. components:{search,copyText},
  61. data(){
  62. return{
  63. toThousands,
  64. listData:[],
  65. totalNum:0,
  66. priceList:[
  67. { name: '成本价', checked: false, val: 'offerCost' },
  68. { name: '市级价', checked: false, val: 'cityPrice' },
  69. { name: '特约价', checked: false, val: 'specialPrice' },
  70. { name: '终端价/自定义终端价', checked: false, val: 'terminalPrice' },
  71. ],
  72. pageNo:1,
  73. pageSize:15,
  74. noDataText: '暂无数据',
  75. theme: '',
  76. status: 'loadmore',
  77. showModal:false,
  78. params:{
  79. "code": "",
  80. "name": "",
  81. "origCode": "",
  82. "putStockFlag": 1
  83. }
  84. }
  85. },
  86. onNavigationBarButtonTap(e){
  87. this.showModal=true
  88. },
  89. onBackPress() {
  90. if(this.showModal){
  91. this.showModal = false
  92. return true
  93. }
  94. },
  95. computed: {
  96. selPriceShow() {
  97. const a = this.priceList.filter(item => item.checked)
  98. return a.length > 0
  99. }
  100. },
  101. onLoad(option) {
  102. this.theme = getApp().globalData.theme
  103. this.getList()
  104. },
  105. methods:{
  106. toPage(url){
  107. uni.switchTab({
  108. url:url
  109. })
  110. },
  111. // 刷新列表
  112. refreshList(val){
  113. this.params =val ? val : {},
  114. this.listData = []
  115. this.totalNum = 0
  116. this.getList(1)
  117. },
  118. // 列表
  119. getList(pageNo){
  120. const _this = this
  121. if (pageNo) {
  122. this.pageNo = pageNo
  123. }
  124. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  125. this.status = "loading"
  126. productUniversalQueryPage(params).then(res => {
  127. if (res.status == 200) {
  128. if(this.pageNo>1){
  129. this.listData = this.listData.concat(res.data.list || [])
  130. }else{
  131. this.listData = res.data.list || []
  132. }
  133. this.totalNum = res.data.count || 0
  134. } else {
  135. this.listData = []
  136. this.totalNum = 0
  137. this.noDataText = res.message
  138. }
  139. this.status = "loadmore"
  140. })
  141. },
  142. // scroll-view到底部加载更多
  143. onreachBottom() {
  144. if(this.listData.length < this.totalNum){
  145. this.pageNo += 1
  146. this.getList()
  147. }
  148. },
  149. // 查看销售记录
  150. toViewDetail(row){
  151. uni.navigateTo({
  152. url: "/pages/sales/salesRecord?productSn="+row.productSn + "&productName="+row.name+ "&productCode="+row.code
  153. })
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="scss">
  159. .productPricing-content{
  160. width:100%;
  161. height: 100vh;
  162. .product-list{
  163. height: 100vh;
  164. .st-detailList-main{
  165. padding: 20upx;
  166. .st-detailList-main-item{
  167. background: #ffffff;
  168. padding: 20upx;
  169. margin-bottom: 25upx;
  170. border-radius: 25upx;
  171. box-shadow: 1px 1px 3px #EEEEEE;
  172. .st-detailList-tit{
  173. padding-bottom: 20upx;
  174. border-bottom: 1px solid #e4e7ed;
  175. }
  176. .st-detailList-item-con{
  177. padding: 20upx;
  178. font-size: 26upx;
  179. .gray{
  180. color: gray;
  181. }
  182. .pimgs{
  183. margin-right: 16upx;
  184. }
  185. .font_13{
  186. font-size: 26upx;
  187. }
  188. .padding_3{
  189. padding: 6upx 0;
  190. word-break: break-all;
  191. }
  192. }
  193. .price-all{
  194. border-top: 1px solid #e4e7ed;
  195. padding: 20upx 20upx 0;
  196. .price-item1{
  197. width: 18%;
  198. border-right: 1px solid #e4e7ed;
  199. text-align: center;
  200. >view{
  201. color:#999;
  202. }
  203. }
  204. .price-item2{
  205. width: 46%;
  206. border-right: none;
  207. text-align: center;
  208. >view{
  209. color:#999;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. }
  217. </style>