partList.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. }else if(_this.pageType=='scanCodePrint'){ // 补货-扫码打印
  134. this.totalNums = this.totalNums + item.confirmQty
  135. }else if(_this.pageType=='replenishmentDetail'){ // 补货详情-已完成
  136. this.totalNums = this.totalNums + item.putQty
  137. }else if(_this.pageType=='replenishmentDetailc'){ // 补货详情-已取消
  138. this.totalNums = this.totalNums + item.qty
  139. }else if(_this.pageType=='shuntBackDetail'){ // 调回详情-已完成
  140. this.totalNums = this.totalNums + item.confirmQty
  141. }else{
  142. this.totalNums = this.totalNums + item.qty
  143. }
  144. item.checked = false
  145. })
  146. this.partList = JSON.parse(JSON.stringify(newValue))
  147. this.pageType = this.fromPage
  148. }
  149. },
  150. onLoad() {
  151. this.theme = getApp().globalData.theme
  152. },
  153. data() {
  154. return {
  155. partList: this.list,
  156. totalNums: 0,
  157. pageType: this.fromPage,
  158. theme: ''
  159. }
  160. },
  161. methods: {
  162. // 全选
  163. allSelect(val){
  164. this.partList.map(item => {
  165. item.checked = val
  166. })
  167. this.partList.splice()
  168. },
  169. checkChange(e){
  170. const row = this.partList.find(item => item.id == e.name)
  171. console.log(row.checked)
  172. if(row){
  173. row.checked = !row.checked
  174. this.partList.splice()
  175. }
  176. // 判断是否全选
  177. const isAllNoChecked = this.partList.filter(item => !item.checked)
  178. this.$emit('allChecked',isAllNoChecked.length == 0)
  179. },
  180. // 获取所有选择的
  181. getAllChecked(){
  182. return this.partList.filter(item => item.checked)
  183. },
  184. // 获取所有数据
  185. getAllData(){
  186. return this.partList
  187. },
  188. // 数量 change
  189. numberChange(value, index){
  190. this.$emit('numberChange', value, index)
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="less" scoped>
  196. .partList-box{
  197. .nodata{
  198. padding: 10vh 0;
  199. }
  200. .partList-title{
  201. padding: 20rpx 0;
  202. > text{
  203. font-size: 32rpx;
  204. color: #222222;
  205. }
  206. > view{
  207. font-size: 32rpx;
  208. text{
  209. color: red;
  210. margin: 0 5rpx;
  211. }
  212. }
  213. }
  214. .partList-list-box{
  215. padding: 10px 0;
  216. border-bottom: 2rpx solid #f5f5f5;
  217. &:last-child{
  218. border:0;
  219. }
  220. .product{
  221. flex-grow: 1;
  222. .checkbox{
  223. width: 60rpx;
  224. }
  225. .pinfo{
  226. flex-grow: 1;
  227. padding-left: 20rpx;
  228. .pname{
  229. font-size: 32rpx;
  230. color: #191919;
  231. font-weight: bold;
  232. margin-bottom: 10rpx;
  233. text{
  234. font-weight: normal;
  235. margin-right: 6rpx;
  236. padding: 0 10rpx;
  237. background: rgba(3, 54, 146, 0.15);
  238. border-radius: 100rpx;
  239. color: #033692;
  240. font-size: 28rpx;
  241. }
  242. }
  243. .pno{
  244. background-color: rgba(3, 54, 146, 0.15);
  245. border-radius: 50rpx;
  246. padding: 0 20rpx;
  247. color: #033692;
  248. font-size: 24rpx;
  249. margin-right: 10rpx;
  250. }
  251. .ptxt{
  252. font-size: 28rpx;
  253. color: #999;
  254. .pnums{
  255. color: #222;
  256. padding: 0 4upx;
  257. }
  258. }
  259. }
  260. }
  261. .ptools{
  262. margin-top: 20rpx;
  263. .pcurnums{
  264. > text{
  265. margin-right: 20rpx;
  266. }
  267. }
  268. .u-ninput{
  269. border: 2rpx solid #eee;
  270. border-radius: 50rpx;
  271. padding: 0 6rpx;
  272. }
  273. /deep/ .u-icon-disabled{
  274. background: #fff!important;
  275. }
  276. /deep/ .u-number-input{
  277. margin: 0 0;
  278. border: 2rpx solid #eee;
  279. border-top: 0;
  280. border-bottom: 0;
  281. }
  282. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  283. border-radius: 50rpx;
  284. }
  285. }
  286. }
  287. }
  288. </style>