partList.vue 9.6 KB

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