productList.vue 5.2 KB

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