chooseProduct.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="chooseProduct-wrap">
  3. <!-- 产品列表 -->
  4. <view class="product-list-box">
  5. <scroll-view class="product-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
  6. <view class="product-list-item font_13" v-for="(item, index) in listData" :key="item.id">
  7. <view class="list-item-tit">
  8. <view class="item-tit ellipsis-one" :style="{borderColor: $config('primaryColor')}">{{item.productName}}</view>
  9. </view>
  10. <view class="list-item-con flex align_center justify_between">
  11. <view class="pimgs">
  12. <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>
  13. </view>
  14. <view class="flex_1">
  15. <view>产品编码:{{item.productCode || '--'}}</view>
  16. <view class="padding_3 flex align_center justify_between">
  17. <view>原厂编码:{{item.productOrigCode || '--'}}</view>
  18. <u-icon name="plus-circle" :color="$config('primaryColor')" size="40" class="close-circle" @click="clearWarehouse"></u-icon>
  19. </view>
  20. <view v-if="item.warehouseName || item.warehouseLocationName">仓库仓位:{{item.warehouseName}} > {{item.warehouseLocationName}}</view>
  21. </view>
  22. </view>
  23. <view class="list-item-footer flex align_center justify_between">
  24. <view class="footer-item">
  25. <view>{{toThousands(item.currentQty||0)}}{{item.unit}}</view>
  26. <view class="color_6">库存数量</view>
  27. </view>
  28. <view class="footer-item">
  29. <view>
  30. <text :style="{color: $config('errorColor')}">{{toThousands((item.lastSalePrice ? item.lastSalePrice : item.salePrice)||0, 2)}}</text>
  31. <text v-if="item.origSalePriceFlag == 1">(原)</text>
  32. </view>
  33. <view class="color_6">参考售价</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view v-if="listData && listData.length == 0">
  38. <u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
  39. </view>
  40. </scroll-view>
  41. </view>
  42. <!-- 已选产品 -->
  43. <view ref="productTotal" class="selected-box flex align_center justify_between">
  44. <view class="choose-info flex_1 flex align_center justify_between" @click="lookProduct">
  45. <text>已选 3 款,合计 ¥96.00</text>
  46. <u-icon name="arrow-up" :color="$config('primaryColor')" size="34" class="close-circle"></u-icon>
  47. </view>
  48. <view class="choose-btn" @click="handleChoose" :style="{backgroundColor: $config('primaryColor')}">选好了</view>
  49. </view>
  50. <!-- 查询右侧弹框 -->
  51. <productSearch :openModal="openModal" :defaultParams="searchForm" @refresh="refresh" @close="openModal=false" />
  52. </view>
  53. </template>
  54. <script>
  55. import ProductSearch from './productSearch.vue'
  56. import { toThousands } from '@/libs/tools'
  57. import { querySumByProductLocation } from '@/api/stock'
  58. export default{
  59. components: { ProductSearch },
  60. data(){
  61. return{
  62. toThousands,
  63. customBtnStyle: { // 自定义按钮样式
  64. borderColor: this.$config('primaryColor'),
  65. backgroundColor: this.$config('primaryColor'),
  66. color: '#fff'
  67. },
  68. listData: [],
  69. pageNo: 1,
  70. pageSize: 6,
  71. totalNum: 0,
  72. noDataText: '暂无数据',
  73. searchForm: {},
  74. searchParams: {},
  75. openModal: false,
  76. theme: '',
  77. chooseProductList: [],
  78. scrollH: 0,
  79. }
  80. },
  81. onLoad(opt) {
  82. this.theme = getApp().globalData.theme
  83. if(opt){
  84. this.chooseProductList = opt.data ? JSON.parse(opt.data) : null
  85. }
  86. console.log(this.chooseProductList)
  87. this.getList()
  88. const _this = this
  89. uni.getSystemInfo({
  90. success: function (res) {
  91. const winH = res.windowHeight * 2
  92. _this.scrollH = winH - 200
  93. }
  94. })
  95. },
  96. methods: {
  97. // 获取查询参数 刷新列表
  98. refresh(params){
  99. const _this = this
  100. this.searchParams = Object.assign(params, this.searchForm)
  101. this.getList(1)
  102. },
  103. // 列表
  104. getList(pageNo){
  105. const _this = this
  106. if (pageNo) {
  107. this.pageNo = pageNo
  108. }
  109. let params = {
  110. pageNo: this.pageNo,
  111. pageSize: this.pageSize
  112. }
  113. querySumByProductLocation(Object.assign(params, this.searchParams)).then(res => {
  114. if (res.status == 200) {
  115. if(this.pageNo>1){
  116. this.listData = this.listData.concat(res.data.list || [])
  117. }else{
  118. this.listData = res.data.list || []
  119. }
  120. this.totalNum = res.data.count || 0
  121. } else {
  122. this.listData = []
  123. this.totalNum = 0
  124. this.noDataText = res.message
  125. }
  126. })
  127. },
  128. // scroll-view到底部加载更多
  129. onreachBottom() {
  130. if(this.listData.length < this.totalNum){
  131. this.pageNo += 1
  132. this.getList()
  133. }
  134. },
  135. // 选好了
  136. handleChoose(){},
  137. // 查看已选产品
  138. lookProduct(){
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss">
  144. .chooseProduct-wrap{
  145. width: 100%;
  146. position: relative;
  147. .padding_3{
  148. padding: 6upx 0;
  149. }
  150. .color_6{
  151. color: #666;
  152. }
  153. .product-list-box{
  154. padding: 20upx 20upx;
  155. .product-list-con{
  156. .product-list-item{
  157. background: #ffffff;
  158. padding: 20upx 20upx 0;
  159. margin-bottom: 25upx;
  160. border-radius: 25upx;
  161. box-shadow: 1px 1px 3px #EEEEEE;
  162. .list-item-tit{
  163. padding-bottom: 12upx;
  164. border-bottom: 1px solid #e4e7ed;
  165. .item-tit{
  166. font-weight: bold;
  167. color: rgb(48, 49, 51);
  168. font-size: 28upx;
  169. padding-left: 10upx;
  170. border-left: 6upx solid #000;
  171. line-height: 1;
  172. }
  173. }
  174. .list-item-con{
  175. padding: 14upx 14upx 16upx;
  176. font-size: 26upx;
  177. .pimgs{
  178. margin-right: 16upx;
  179. }
  180. }
  181. .list-item-footer{
  182. border-top: 1px solid #e4e7ed;
  183. .footer-item{
  184. width: 50%;
  185. text-align: center;
  186. border-right: 1px solid #e4e7ed;
  187. font-size: 26upx;
  188. padding: 8upx 0 12upx;
  189. }
  190. .footer-item:last-child{
  191. border: none;
  192. }
  193. }
  194. }
  195. }
  196. }
  197. .selected-box{
  198. position: fixed;
  199. bottom: 0;
  200. left: 0;
  201. width: 100%;
  202. background-color: #fff;
  203. box-shadow: 1px -1px 3px #EEEEEE;
  204. .choose-info{
  205. padding: 0 30upx;
  206. }
  207. .choose-btn{
  208. color: #fff;
  209. width: 28%;
  210. padding: 26upx 0;
  211. text-align: center;
  212. }
  213. }
  214. }
  215. </style>