productList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="partList-box flex flex_column">
  3. <view class="partList-list">
  4. <view class="partList-list-box" v-for="item in partList" :key="item.productSn">
  5. <view class="product flex align_center">
  6. <view class="checkbox">
  7. <u-checkbox v-model="item.checked" :name="item.productSn" @change="checkChange" size="40" shape="circle"></u-checkbox>
  8. </view>
  9. <view class="flex align_center flex_1" @click="checkChange({name:item.productSn})">
  10. <view class="pimgs">
  11. <u-image :src="item.productImageUrl?item.productImageUrl:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  12. </view>
  13. <view class="pinfo">
  14. <view class="pname">
  15. <text>{{item.shelfPlaceCode}}</text>
  16. {{item.productCode}}
  17. </view>
  18. <view class="pname pname1">
  19. {{item.productName}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="ptxt flex align_center justify_end">
  25. <view>
  26. 最大库容:<text class="pnums">{{item.maxQty}}</text>
  27. 当前库存:<text class="pnums">{{item.qty}}</text>
  28. 补货在途:<text class="pnums">{{item.replenishBillQty||0}}</text>
  29. </view>
  30. </view>
  31. <view class="ptools flex align_center justify_between">
  32. <view class="flex align_center">
  33. <view v-if="item.replenishBillQty">
  34. 补货在途:<text class="pnums">{{item.replenishBillQty||0}}</text>
  35. </view>
  36. <view v-if="item.recallBillQty">
  37. 调回在途:<text class="pnums">{{item.recallBillQty||0}}</text>
  38. </view>
  39. </view>
  40. <view class="pcurnums flex align_center flex">
  41. <text>补货数量</text>
  42. <view class="u-ninput">
  43. <u-number-box color="#000" :long-press="false" :input-height="60" bg-color="#fff" v-model="item.replenishQty" :min="1"></u-number-box>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="nodata" v-if="partList.length==0">
  49. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="120" :text="noDataText" img-width="120" mode="list"></u-empty>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. props: {
  57. list: {
  58. type: Array,
  59. default: function(){
  60. return []
  61. }
  62. },
  63. noDataText: {
  64. type: String,
  65. default: '暂无产品'
  66. },
  67. title: {
  68. type: String,
  69. default: '列表'
  70. },
  71. // model: checkbox 可选择模式,view 只显示
  72. model: {
  73. type: String,
  74. default: 'checkbox'
  75. },
  76. },
  77. data() {
  78. return {
  79. partList: [],
  80. }
  81. },
  82. methods: {
  83. setData(list){
  84. const _this = this
  85. list.map(item => {
  86. item.replenishQty = item.replenishBillWaitQty || 1
  87. item.checked = false
  88. })
  89. this.partList = list
  90. },
  91. // 全选
  92. allSelect(val){
  93. this.partList.map(item => {
  94. item.checked = val
  95. })
  96. this.partList.splice()
  97. },
  98. setChecked(id,val){
  99. const row = this.partList.find(item => item.id == id)
  100. row.checked = val
  101. this.partList.splice()
  102. },
  103. checkChange(e){
  104. const row = this.partList.find(item => item.productSn == e.name)
  105. if(row){
  106. row.checked = !row.checked
  107. this.partList.splice()
  108. }
  109. // 判断是否全选
  110. const isAllNoChecked = this.partList.filter(item => !item.checked)
  111. this.$emit('allChecked',isAllNoChecked.length == 0)
  112. },
  113. // 获取所有选择的
  114. getAllChecked(){
  115. const newArr = []
  116. this.partList.map(item => {
  117. if(item.checked){
  118. newArr.push(item)
  119. }
  120. })
  121. return newArr
  122. },
  123. // 获取所有数据
  124. getAllData(){
  125. return this.partList
  126. },
  127. // 更新数量
  128. changeNums(id,val){
  129. const row = this.partList.find(item => item.id == id)
  130. row.replenishQty = val
  131. this.partList.splice()
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="less" scoped>
  137. .partList-box{
  138. height: 100%;
  139. position: relative;
  140. .nodata{
  141. padding: 10vh 0;
  142. }
  143. .partList-list{
  144. flex-grow: 1;
  145. }
  146. .partList-list-box{
  147. padding: 10px 0;
  148. border-bottom: 2rpx solid #f5f5f5;
  149. .product{
  150. flex-grow: 1;
  151. .checkbox{
  152. width: 60rpx;
  153. }
  154. .pinfo{
  155. flex-grow: 1;
  156. padding-left: 20rpx;
  157. .pname{
  158. color: #191919;
  159. margin-bottom: 5rpx;
  160. text{
  161. font-weight: normal;
  162. margin-right: 10rpx;
  163. padding: 0 10rpx;
  164. background: rgba(3, 54, 146, 0.15);
  165. border-radius: 30rpx;
  166. color: #033692;
  167. font-size: 24rpx;
  168. }
  169. }
  170. .pname1{
  171. font-size: 26rpx;
  172. }
  173. }
  174. }
  175. .ptxt{
  176. font-size: 26rpx;
  177. color: #999;
  178. .pnums{
  179. color: #222;
  180. margin-right: 20upx;
  181. }
  182. }
  183. .ptools{
  184. font-size: 26rpx;
  185. margin-top: 20rpx;
  186. color: #999;
  187. .pnums{
  188. color: #ff5500;
  189. margin-right: 20upx;
  190. }
  191. .pcurnums{
  192. > text{
  193. margin-right: 20rpx;
  194. }
  195. }
  196. .u-ninput{
  197. border: 2rpx solid #eee;
  198. border-radius: 50rpx;
  199. padding: 0 6rpx;
  200. }
  201. /deep/ .u-icon-disabled{
  202. background: #fff!important;
  203. }
  204. /deep/ .u-number-input{
  205. margin: 0 0;
  206. border: 2rpx solid #eee;
  207. border-top: 0;
  208. border-bottom: 0;
  209. }
  210. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  211. border-radius: 50rpx;
  212. }
  213. }
  214. }
  215. }
  216. </style>