confirm.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="replenishment-confirm-wrap">
  3. <scroll-view scroll-y class="replenishment-confirm-cont">
  4. <view class="replenishment-confirm-main" v-for="(item,index) in listdata" :key="item.id">
  5. <u-image class="item-pic" :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="64px" height="64px"></u-image>
  6. <view class="item-con">
  7. <view class="item-name">{{item.product&&item.product.name?item.product.name:'--'}}</view>
  8. <view class="item-code">{{item.product&&item.product.code?item.product.code:'--'}}</view>
  9. <view class="item-num">
  10. <view class="num-t">x {{item.qty||item.qty==0?item.qty:'--'}} {{item.product&&item.product.unit?item.product.unit:'--'}}</view>
  11. <view class="num-v">
  12. <u-number-box color="#000" bg-color="#fff" v-model="item.confirmQty" @change="handlerChange" :min="0" :max="item.qty"></u-number-box>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </scroll-view>
  18. <view class="replenishment-confirm-footer">
  19. <u-button @click="confirmModal=true" type="success" :custom-style="customStyle" hover-class="none" shape="circle">确定补货({{confirmQty}}/{{totalQty}})</u-button>
  20. </view>
  21. <!-- 确认弹框 -->
  22. <common-modal :openModal="confirmModal" content="确认对该数字货架进行补货吗?" confirmText="确认补货" @confirm="modalConfirm" @close="confirmModal=false" />
  23. <!-- 库存不足 弹框 -->
  24. <stock-modal :openModal="stockModal" :list="stockList" :params="paramsData" @confirm="modalStock" @close="stockModal=false" />
  25. </view>
  26. </template>
  27. <script>
  28. import commonModal from '@/pages/common/commonModal.vue'
  29. import stockModal from './stockModal.vue'
  30. import { shelfReplenishDetailList, shelfReplenishDetailStock, shelfReplenishConfirm } from '@/api/shelfReplenish'
  31. export default {
  32. components: { commonModal, stockModal },
  33. data() {
  34. return {
  35. listdata: [],
  36. theme: '',
  37. customStyle: {
  38. borderRadius:'100rpx',
  39. fontSize:'30rpx',
  40. background: '#0485F6'
  41. },
  42. confirmQty: 0, // 实发数量之和
  43. totalQty: 0, // 应发数量之和
  44. replenishBillSn: '',
  45. confirmModal: false,
  46. stockModal: false,
  47. stockList: [],
  48. paramsData: null
  49. }
  50. },
  51. onLoad(options){
  52. this.theme = getApp().globalData.theme
  53. this.replenishBillSn = options.sn
  54. this.getRow()
  55. },
  56. methods:{
  57. // 查询列表
  58. getRow () {
  59. const _this = this
  60. shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
  61. if (res.status == 200) {
  62. _this.totalQty = 0
  63. _this.confirmQty = 0
  64. res.data.map(item =>{
  65. item.confirmQty = item.qty || 0
  66. if(item.qty && Number(item.qty)){
  67. _this.totalQty += Number(item.qty)
  68. }
  69. if(item.confirmQty && Number(item.confirmQty)){
  70. _this.confirmQty += Number(item.confirmQty)
  71. }
  72. })
  73. this.listdata = res.data || []
  74. } else {
  75. this.listdata = []
  76. }
  77. })
  78. },
  79. handlerChange(value, index){
  80. const _this = this
  81. this.confirmQty = 0
  82. this.listdata.map(item => {
  83. if(item.confirmQty && Number(item.confirmQty)){
  84. _this.confirmQty += Number(item.confirmQty)
  85. }
  86. })
  87. },
  88. // 确认补货 confirm
  89. modalConfirm(){
  90. const arr = []
  91. this.listdata.map((item, index) => {
  92. if (item.confirmQty || item.confirmQty == 0) {
  93. arr.push({
  94. productSn: item.productSn,
  95. confirmQty: item.confirmQty
  96. })
  97. }
  98. })
  99. const params = {
  100. replenishBillSn: this.replenishBillSn,
  101. detailList: arr
  102. }
  103. // 校验产品库存是否足够
  104. shelfReplenishDetailStock(params).then(res => {
  105. if (res.status == 200) {
  106. if (res.data && res.data.length > 0) {
  107. this.stockList = res.data || []
  108. this.paramsData = params
  109. this.confirmModal = false
  110. this.stockModal = true
  111. } else {
  112. this.confirmFun(params)
  113. }
  114. }
  115. })
  116. },
  117. // 提交确认
  118. confirmFun (params) {
  119. shelfReplenishConfirm(params).then(res => {
  120. if (res.status == 200) {
  121. if(res.status == 200){
  122. uni.$emit('refreshBL')
  123. uni.navigateBack()
  124. }
  125. this.toashMsg(res.message)
  126. }
  127. })
  128. },
  129. // 库存不足 confirm
  130. modalStock(params){
  131. this.stockModal = false
  132. this.confirmFun(params)
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .replenishment-confirm-wrap{
  139. background-color: #fff;
  140. position: relative;
  141. width: 100%;
  142. height: 100%;
  143. overflow: hidden;
  144. padding-bottom: 136upx;
  145. .replenishment-confirm-cont{
  146. width: 100%;
  147. height: 100%;
  148. overflow: auto;
  149. .replenishment-confirm-main{
  150. display: flex;
  151. justify-content: space-between;
  152. margin: 0 32upx;
  153. padding: 30upx 0;
  154. border-bottom: 1px solid #E5E5E5;
  155. .item-pic{
  156. flex-shrink: 0;
  157. margin-right: 20upx;
  158. }
  159. .item-con{
  160. flex-grow: 1;
  161. .item-name{
  162. color: #191919;
  163. font-size: 30upx;
  164. font-weight: bold;
  165. }
  166. .item-code{
  167. color: #999999;
  168. font-size: 26upx;
  169. }
  170. .item-num{
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. .num-t{
  175. color: #707070;
  176. font-size: 26upx;
  177. }
  178. .num-v{
  179. border: 2rpx solid #eee;
  180. border-radius: 50rpx;
  181. padding: 0 6rpx;
  182. }
  183. /deep/ .u-icon-disabled{
  184. background: #fff!important;
  185. }
  186. /deep/ .u-number-input{
  187. margin: 0 0;
  188. border: 2rpx solid #eee;
  189. border-top: 0;
  190. border-bottom: 0;
  191. }
  192. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  193. border-radius: 50rpx;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. .replenishment-confirm-footer{
  200. padding: 26upx 32upx 30upx;
  201. background-color: #fff;
  202. position: fixed;
  203. left: 0;
  204. bottom: 0;
  205. width: 100%;
  206. box-shadow: 3px 1px 7px #eee;
  207. }
  208. }
  209. </style>