confirm.vue 6.5 KB

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