productList.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. checkChange(e){
  99. const row = this.partList.find(item => item.productSn == e.name)
  100. if(row){
  101. row.checked = !row.checked
  102. this.partList.splice()
  103. }
  104. // 判断是否全选
  105. const isAllNoChecked = this.partList.filter(item => !item.checked)
  106. this.$emit('allChecked',isAllNoChecked.length == 0)
  107. },
  108. // 获取所有选择的
  109. getAllChecked(){
  110. return this.partList.filter(item => item.checked)
  111. },
  112. // 获取所有数据
  113. getAllData(){
  114. return this.partList
  115. },
  116. // 数量 change
  117. numberChange(value, index){
  118. this.$emit('numberChange', value, index)
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="less" scoped>
  124. .partList-box{
  125. height: 100%;
  126. position: relative;
  127. .nodata{
  128. padding: 10vh 0;
  129. }
  130. .partList-list{
  131. flex-grow: 1;
  132. }
  133. .partList-list-box{
  134. padding: 10px 0;
  135. border-bottom: 2rpx solid #f5f5f5;
  136. .product{
  137. flex-grow: 1;
  138. .checkbox{
  139. width: 60rpx;
  140. }
  141. .pinfo{
  142. flex-grow: 1;
  143. padding-left: 20rpx;
  144. .pname{
  145. color: #191919;
  146. margin-bottom: 5rpx;
  147. text{
  148. font-weight: normal;
  149. margin-right: 10rpx;
  150. padding: 0 10rpx;
  151. background: rgba(3, 54, 146, 0.15);
  152. border-radius: 30rpx;
  153. color: #033692;
  154. font-size: 24rpx;
  155. }
  156. }
  157. .pname1{
  158. font-size: 26rpx;
  159. }
  160. }
  161. }
  162. .ptxt{
  163. font-size: 26rpx;
  164. color: #999;
  165. .pnums{
  166. color: #222;
  167. margin-right: 20upx;
  168. }
  169. }
  170. .ptools{
  171. font-size: 26rpx;
  172. margin-top: 20rpx;
  173. color: #999;
  174. .pnums{
  175. color: #ff5500;
  176. margin-right: 20upx;
  177. }
  178. .pcurnums{
  179. > text{
  180. margin-right: 20rpx;
  181. }
  182. }
  183. .u-ninput{
  184. border: 2rpx solid #eee;
  185. border-radius: 50rpx;
  186. padding: 0 6rpx;
  187. }
  188. /deep/ .u-icon-disabled{
  189. background: #fff!important;
  190. }
  191. /deep/ .u-number-input{
  192. margin: 0 0;
  193. border: 2rpx solid #eee;
  194. border-top: 0;
  195. border-bottom: 0;
  196. }
  197. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  198. border-radius: 50rpx;
  199. }
  200. }
  201. }
  202. }
  203. </style>