partList.vue 9.3 KB

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