productList.vue 5.4 KB

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