partList.vue 9.8 KB

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