partList.vue 9.3 KB

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