productList.vue 5.2 KB

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