partList.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view class="partList-box">
  3. <view class="partList-title flex align_center justify_between">
  4. <text>{{title}}</text>
  5. <view>{{list.length}}款,{{pageType=='shuntBackDetail'?'实退':'共'}}<text>{{totalNums}}</text>件</view>
  6. </view>
  7. <view class="partList-list">
  8. <view class="partList-list-box" v-for="item in partList" :key="item.id">
  9. <view class="product flex align_center">
  10. <view class="checkbox" v-if="model == 'checkbox'"><u-checkbox v-model="item.checked" :name="item.id" @change="checkChange" size="40" shape="circle"></u-checkbox></view>
  11. <view class="flex align_center flex_1">
  12. <view class="pimgs">
  13. <u-image :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
  14. </view>
  15. <view class="pinfo">
  16. <view class="pname">{{item.product&&item.product.name?item.product.name:'--'}}</view>
  17. <view class="ptxt flex align_center justify_between">
  18. <view>
  19. <text class="pcode">{{item.product&&item.product.code?item.product.code:'--'}}</text>
  20. </view>
  21. <view v-if="pageType=='replenishmentSign'||pageType=='manualPrint'||pageType=='scanCodePrint'">
  22. 实发数量:<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}{{item.product&&item.product.unit?item.product.unit:'--'}}</text>
  23. </view>
  24. <view v-if="pageType=='replenishmentOut'">
  25. x<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>
  26. </view>
  27. <view v-if="pageType=='replenishmentDetail'">
  28. 应发<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
  29. 实发<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>
  30. 签收<text class="pnums">{{item.putQty||item.putQty==0?item.putQty:'--'}}</text>
  31. </view>
  32. <view v-if="pageType=='sendOutGoods'">
  33. 实发:<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}{{item.product&&item.product.unit?item.product.unit:'--'}}</text>
  34. /已扫:<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
  35. </view>
  36. <view v-if="pageType=='replenishmentDetailc'">
  37. <text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
  38. {{item.product&&item.product.unit?item.product.unit:'--'}}
  39. </view>
  40. <view v-if="pageType=='recall'">
  41. 调回数量:<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
  42. {{item.product&&item.product.unit?item.product.unit:'--'}}
  43. </view>
  44. <view v-if="pageType=='shuntBackDetail'">
  45. 调回:<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}{{item.product&&item.product.unit?item.product.unit:'--'}}</text>
  46. /实退:<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>
  47. </view>
  48. <view v-if="pageType=='shuntBackDetailc'">
  49. <text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
  50. {{item.product&&item.product.unit?item.product.unit:'--'}}
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 有复选框 -->
  57. <view v-if="model == 'checkbox'" class="ptools flex align_center justify_between">
  58. <view></view>
  59. <view class="pcurnums flex align_center" v-if="pageType=='recall'">
  60. <text>实退数量</text>
  61. <view class="u-ninput">
  62. <u-number-box color="#000" bg-color="#fff" v-model="item.confirmQty" :min="1" :max="item.qty"></u-number-box>
  63. </view>
  64. </view>
  65. <view class="pcurnums flex align_center" v-if="pageType=='manualPrint'">
  66. <text>打印数量</text>
  67. <view class="u-ninput">
  68. <u-number-box color="#000" bg-color="#fff" v-model="item.printQty" :min="1" :max="item.confirmQty"></u-number-box>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- 无复选框 -->
  73. <view v-if="model == 'view'" class="ptools flex align_center justify_between">
  74. <view></view>
  75. <view class="pcurnums flex align_center" v-if="pageType=='replenishmentSign'">
  76. <text>入库数量</text>
  77. <view class="u-ninput">
  78. <u-number-box color="#000" bg-color="#fff" v-model="item.putQty" @change="numberChange" :min="0" :max="item.confirmQty"></u-number-box>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="nodata" v-if="list.length==0">
  84. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="120" :text="noDataText" img-width="120" mode="list"></u-empty>
  85. </view>
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. export default {
  91. props: {
  92. list: {
  93. type: Array,
  94. default: function(){
  95. return []
  96. }
  97. },
  98. noDataText: {
  99. type: String,
  100. default: '暂无配件'
  101. },
  102. title: {
  103. type: String,
  104. default: '列表'
  105. },
  106. // model: checkbox 可选择模式,view 只显示
  107. model: {
  108. type: String,
  109. default: 'checkbox'
  110. },
  111. // 那个功能页面调用,展示不同的字段,recall: 调回退库,调回详情-已完成:shuntBackDetail,调回详情-已取消:shuntBackDetailc,replenishmentSign:补货签收,replenishmentOut:补货出库,manualPrint:手动打印,sendOutGoods:发货出库,replenishmentDetail:补货详情-已完成,replenishmentDetailc:补货详情-已取消,scanCodePrint:扫码打印
  112. fromPage: {
  113. type: String,
  114. default: ''
  115. }
  116. },
  117. watch: {
  118. list(newValue, oldValue) {
  119. const _this = this
  120. this.totalNums = 0
  121. newValue.map(item => {
  122. if(_this.pageType=='replenishmentSign'){ // 补货签收
  123. this.totalNums = this.totalNums + item.confirmQty
  124. }else if(_this.pageType=='replenishmentOut'){ // 补货出库
  125. this.totalNums = this.totalNums + item.confirmQty
  126. }else if(_this.pageType=='manualPrint'){ // 补货-手动打印
  127. this.totalNums = this.totalNums + item.confirmQty
  128. }else if(_this.pageType=='scanCodePrint'){ // 补货-扫码打印
  129. this.totalNums = this.totalNums + item.confirmQty
  130. }else if(_this.pageType=='replenishmentDetail'){ // 补货详情-已完成
  131. this.totalNums = this.totalNums + item.putQty
  132. }else if(_this.pageType=='replenishmentDetailc'){ // 补货详情-已取消
  133. this.totalNums = this.totalNums + item.qty
  134. }else if(_this.pageType=='shuntBackDetail'){ // 调回详情-已完成
  135. this.totalNums = this.totalNums + item.confirmQty
  136. }else{
  137. this.totalNums = this.totalNums + item.qty
  138. }
  139. item.checked = false
  140. })
  141. this.partList = JSON.parse(JSON.stringify(newValue))
  142. this.pageType = this.fromPage
  143. }
  144. },
  145. onLoad() {
  146. this.theme = getApp().globalData.theme
  147. },
  148. data() {
  149. return {
  150. partList: this.list,
  151. totalNums: 0,
  152. pageType: this.fromPage,
  153. theme: ''
  154. }
  155. },
  156. methods: {
  157. // 全选
  158. allSelect(val){
  159. this.partList.map(item => {
  160. item.checked = val
  161. })
  162. this.partList.splice()
  163. },
  164. checkChange(e){
  165. const row = this.partList.find(item => item.id == e.name)
  166. console.log(row.checked)
  167. if(row){
  168. row.checked = !row.checked
  169. this.partList.splice()
  170. }
  171. // 判断是否全选
  172. const isAllNoChecked = this.partList.filter(item => !item.checked)
  173. this.$emit('allChecked',isAllNoChecked.length == 0)
  174. },
  175. // 获取所有选择的
  176. getAllChecked(){
  177. return this.partList.filter(item => item.checked)
  178. },
  179. // 获取所有数据
  180. getAllData(){
  181. return this.partList
  182. },
  183. // 数量 change
  184. numberChange(value, index){
  185. this.$emit('numberChange', value, index)
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="less" scoped>
  191. .partList-box{
  192. .nodata{
  193. padding: 10vh 0;
  194. }
  195. .partList-title{
  196. padding: 20rpx 0;
  197. > text{
  198. font-size: 32rpx;
  199. color: #222222;
  200. }
  201. > view{
  202. font-size: 32rpx;
  203. text{
  204. color: red;
  205. margin: 0 5rpx;
  206. }
  207. }
  208. }
  209. .partList-list-box{
  210. padding: 10px 0;
  211. border-bottom: 2rpx solid #f5f5f5;
  212. &:last-child{
  213. border:0;
  214. }
  215. .product{
  216. flex-grow: 1;
  217. .checkbox{
  218. width: 60rpx;
  219. }
  220. .pinfo{
  221. flex-grow: 1;
  222. padding-left: 20rpx;
  223. .pname{
  224. font-size: 32rpx;
  225. color: #191919;
  226. font-weight: bold;
  227. margin-bottom: 10rpx;
  228. }
  229. .pno{
  230. background-color: rgba(3, 54, 146, 0.15);
  231. border-radius: 50rpx;
  232. padding: 0 20rpx;
  233. color: #033692;
  234. font-size: 24rpx;
  235. margin-right: 10rpx;
  236. }
  237. .ptxt{
  238. font-size: 28rpx;
  239. color: #999;
  240. .pnums{
  241. color: #222;
  242. padding: 0 4upx;
  243. }
  244. }
  245. }
  246. }
  247. .ptools{
  248. margin-top: 20rpx;
  249. .pcurnums{
  250. > text{
  251. margin-right: 20rpx;
  252. }
  253. }
  254. .u-ninput{
  255. border: 2rpx solid #eee;
  256. border-radius: 50rpx;
  257. padding: 0 6rpx;
  258. }
  259. /deep/ .u-icon-disabled{
  260. background: #fff!important;
  261. }
  262. /deep/ .u-number-input{
  263. margin: 0 0;
  264. border: 2rpx solid #eee;
  265. border-top: 0;
  266. border-bottom: 0;
  267. }
  268. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  269. border-radius: 50rpx;
  270. }
  271. }
  272. }
  273. }
  274. </style>