chooseProduct.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="chooseProduct-wrap">
  3. <!-- 标题 -->
  4. <u-navbar title="选择产品" :safeAreaInsetTop="false" :border-bottom="true">
  5. <view class="u-nav-slot" slot="right" style="padding-right: 30rpx;">
  6. <u-icon name="search" color="#999" size="28" @click="openModal=true"></u-icon>查询
  7. </view>
  8. </u-navbar>
  9. <!-- 产品列表 -->
  10. <view class="product-list-box">
  11. <scroll-view class="sales-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
  12. <view class="sales-list-item border-b font_13 flex justify_between" v-for="(item, index) in listData" :key="item.id">
  13. <view class="pimgs">
  14. <u-image :src="item.productMainMsg?item.productMainMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  15. <view v-if="item.oosFlag == 1" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
  16. <view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('errorColor')}">亏</view>
  17. <view v-if="item.price == 0" class="sign" :style="{backgroundColor: $config('errorColor')}">赠</view>
  18. </view>
  19. <view class="sales-item-main flex_1">
  20. <view class="sales-item-name">{{item.productName || '--'}}</view>
  21. <view class="sales-item-txt flex align_center justify_between">
  22. <view>{{item.productCode || '--'}}</view>
  23. <u-icon v-if="pageData.type=='edit'" @click="handleDel(item)" name="trash-fill" :color="$config('errorColor')" size="34"></u-icon>
  24. </view>
  25. <view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
  26. <view class="sales-item-txt flex align_center justify_between">
  27. <view class="sales-item-priceInfo">
  28. <view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
  29. <text style="display: inline-block;margin: 0 10upx;">*</text>
  30. <text style="font-size: 30upx;">{{toThousands(item.qty||0)}}</text>
  31. {{item.productUnit}}
  32. </view>
  33. <view class="sales-item-price">¥{{toThousands(item.totalAmount||0, 2)}}</view>
  34. </view>
  35. <view class="sales-item-price">折后¥{{toThousands(item.discountedAmount||0, 2)}}</view>
  36. </view>
  37. </view>
  38. <view v-if="listData && listData.length == 0">
  39. <u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
  40. </view>
  41. </scroll-view>
  42. </view>
  43. <!-- 查询右侧弹框 -->
  44. <productSearch :openModal="openModal" :defaultParams="searchForm" @refresh="refresh" @close="openModal=false" />
  45. </view>
  46. </template>
  47. <script>
  48. import ProductSearch from './productSearch.vue'
  49. import { toThousands } from '@/libs/tools'
  50. export default{
  51. components: { ProductSearch },
  52. data(){
  53. return{
  54. toThousands,
  55. customBtnStyle: { // 自定义按钮样式
  56. borderColor: this.$config('primaryColor'),
  57. backgroundColor: this.$config('primaryColor'),
  58. color: '#fff'
  59. },
  60. listData: [],
  61. pageNo: 1,
  62. pageSize: 6,
  63. totalNum: 0,
  64. noDataText: '暂无数据',
  65. searchForm: {},
  66. searchParams: {},
  67. openModal: false,
  68. theme: '',
  69. chooseProductList: [],
  70. scrollH: 0,
  71. }
  72. },
  73. onLoad(opt) {
  74. this.theme = getApp().globalData.theme
  75. if(opt){
  76. this.chooseProductList = opt.data ? JSON.parse(opt.data) : null
  77. }
  78. console.log(this.chooseProductList)
  79. this.getList()
  80. const _this = this
  81. let footerH = _this.$refs.productTotal && _this.$refs.productTotal.$el && _this.$refs.productTotal.$el.offsetHeight || 0
  82. uni.getSystemInfo({
  83. success: function (res) {
  84. const winH = res.windowHeight * 2
  85. _this.scrollH = winH - footerH - 85
  86. }
  87. })
  88. },
  89. methods: {
  90. // 获取查询参数 刷新列表
  91. refresh(params){
  92. const _this = this
  93. this.searchParams = Object.assign(params, this.searchForm)
  94. this.$nextTick(function(){
  95. // _this.$refs.salesList.getList(1)
  96. })
  97. },
  98. getList(){}
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .chooseProduct-wrap{
  104. width: 100%;
  105. .list-box{
  106. padding: 20upx 20upx;
  107. }
  108. }
  109. </style>