confirm.vue 6.3 KB

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