quickProductList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. {{item.productCode}}
  16. </view>
  17. <view class="pname pname1">
  18. {{item.productName}}
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="ptxt flex align_center justify_end">
  24. <view>
  25. 最大库容:<text class="pnums">{{item.maxQty}}</text>
  26. / 当前库存:<text class="pnums">{{item.qty}}</text>
  27. / 补货在途:<text class="pnums">{{item.afloatQty||0}}</text>
  28. </view>
  29. </view>
  30. <view class="ptools flex align_center justify_between">
  31. <view></view>
  32. <view class="pcurnums flex align_center">
  33. <text>补货数量</text>
  34. <view class="u-ninput">
  35. <u-number-box color="#000" bg-color="#fff" v-model="item.printQty" :min="0" :max="item.maxQty"></u-number-box>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="nodata" v-if="partList.length==0">
  41. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="120" :text="noDataText" img-width="120" mode="list"></u-empty>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. props: {
  49. list: {
  50. type: Array,
  51. default: function(){
  52. return []
  53. }
  54. },
  55. noDataText: {
  56. type: String,
  57. default: '暂无产品'
  58. },
  59. title: {
  60. type: String,
  61. default: '列表'
  62. },
  63. // model: checkbox 可选择模式,view 只显示
  64. model: {
  65. type: String,
  66. default: 'checkbox'
  67. },
  68. },
  69. data() {
  70. return {
  71. partList: [],
  72. }
  73. },
  74. methods: {
  75. setData(list){
  76. const _this = this
  77. list.map(item => {
  78. item.printQty = item.replenishBillQty
  79. item.checked = false
  80. })
  81. this.partList = JSON.parse(JSON.stringify(list))
  82. },
  83. // 全选
  84. allSelect(val){
  85. this.partList.map(item => {
  86. item.checked = val
  87. })
  88. this.partList.splice()
  89. },
  90. checkChange(e){
  91. const row = this.partList.find(item => item.productSn == e.name)
  92. if(row){
  93. row.checked = !row.checked
  94. this.partList.splice()
  95. }
  96. // 判断是否全选
  97. const isAllNoChecked = this.partList.filter(item => !item.checked)
  98. this.$emit('allChecked',isAllNoChecked.length == 0)
  99. },
  100. // 获取所有选择的
  101. getAllChecked(){
  102. return this.partList.filter(item => item.checked && item.printQty)
  103. },
  104. // 获取所有数据
  105. getAllData(){
  106. return this.partList
  107. },
  108. // 数量 change
  109. numberChange(value, index){
  110. this.$emit('numberChange', value, index)
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="less" scoped>
  116. .partList-box{
  117. height: 100%;
  118. position: relative;
  119. .nodata{
  120. padding: 10vh 0;
  121. }
  122. .partList-list{
  123. flex-grow: 1;
  124. }
  125. .partList-list-box{
  126. padding: 10px 0;
  127. border-bottom: 2rpx solid #f5f5f5;
  128. .product{
  129. flex-grow: 1;
  130. .checkbox{
  131. width: 60rpx;
  132. }
  133. .pinfo{
  134. flex-grow: 1;
  135. padding-left: 20rpx;
  136. .pname{
  137. color: #191919;
  138. margin-bottom: 5rpx;
  139. }
  140. }
  141. }
  142. .ptxt{
  143. font-size: 28rpx;
  144. color: #999;
  145. .pnums{
  146. color: #222;
  147. padding: 0 4upx;
  148. }
  149. }
  150. .ptools{
  151. margin-top: 20rpx;
  152. .pcurnums{
  153. > text{
  154. margin-right: 20rpx;
  155. }
  156. }
  157. .u-ninput{
  158. border: 2rpx solid #eee;
  159. border-radius: 50rpx;
  160. padding: 0 6rpx;
  161. }
  162. /deep/ .u-icon-disabled{
  163. background: #fff!important;
  164. }
  165. /deep/ .u-number-input{
  166. margin: 0 0;
  167. border: 2rpx solid #eee;
  168. border-top: 0;
  169. border-bottom: 0;
  170. }
  171. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  172. border-radius: 50rpx;
  173. }
  174. }
  175. }
  176. }
  177. </style>