confirmQh.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="content" v-if="nowData">
  3. <view class="productInfo">
  4. <view><u-image :src="nowData.images" border-radius="16" width="160" height="160" bg-color="#EBEBEB"></u-image></view>
  5. <view><text class="item-no">{{ nowData.shelfPlaceCode }}</text><text>{{ nowData.code }}</text></view>
  6. <view class="item-name">
  7. <text>{{ nowData.name }}</text>
  8. </view>
  9. </view>
  10. <view class="number-input flex flex_column align_center justify_center">
  11. <view class="u-ninput">
  12. <u-number-box :min="1" :max="nowData.currentInven" v-model="qty" color="#000" bg-color="#fff" size="36" :input-height="80" :input-width="180"></u-number-box>
  13. </view>
  14. <view class="kucun">可用库存:<text>{{nowData.currentInven}}</text>{{nowData.unit}}</view>
  15. </view>
  16. <view class="buttons">
  17. <u-button :throttle-time="100" :loading="loading" @click="onSubmit" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
  18. 确认取货
  19. </u-button>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { shelfOrderOnceCreate } from '@/api/shelf'
  25. export default {
  26. data() {
  27. return {
  28. loading:false,
  29. nowData: null,
  30. qty: 1
  31. }
  32. },
  33. onLoad(options) {
  34. this.nowData = JSON.parse(decodeURIComponent(options.data));
  35. },
  36. methods: {
  37. onSubmit(){
  38. const _this = this
  39. uni.showModal({
  40. title: '提示',
  41. content: '取货后扣减库存,确认取货吗?',
  42. confirmText: '确定',
  43. success(res) {
  44. if(res.confirm){
  45. _this.outShelfOrder()
  46. }
  47. }
  48. })
  49. },
  50. // 确认取货
  51. outShelfOrder(){
  52. this.loading = true
  53. shelfOrderOnceCreate({
  54. billSource: this.nowData.billSource,
  55. shelfOrderDetailList: [{
  56. "productSn": this.nowData.productSn,
  57. "totalQty": this.qty
  58. }]
  59. }).then(res => {
  60. if(res.status == 200){
  61. uni.showToast({
  62. icon:'none',
  63. title: res.message,
  64. duration: 4000
  65. })
  66. uni.redirectTo({
  67. url: "/pages/digitalShelf/orderDetail?shelfOrderSn="+res.data.shelfOrderSn
  68. })
  69. }else{
  70. if(res.errCode == 'VALIDATE_STOCK_LACK'){
  71. uni.showModal({
  72. title: '以下产品库存不足',
  73. content: res.message,
  74. confirmText: '知道了',
  75. showCancel: false,
  76. })
  77. }else{
  78. uni.showToast({
  79. icon:'none',
  80. title: res.message,
  81. duration: 4000
  82. })
  83. }
  84. }
  85. this.loading = false
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="less">
  92. .content{
  93. background-color: #fff;
  94. width: 100%;
  95. padding: 50rpx 30rpx;
  96. height: 100vh;
  97. .productInfo{
  98. > view{
  99. text-align: center;
  100. display: flex;
  101. justify-content: center;
  102. font-size: 32rpx;
  103. .item-no{
  104. font-weight: normal;
  105. margin-right: 6rpx;
  106. padding: 0 10rpx;
  107. background: rgba(3, 54, 146, 0.15);
  108. border-radius: 100rpx;
  109. color: #033692;
  110. font-size: 24rpx;
  111. }
  112. padding: 10rpx;
  113. }
  114. .item-name{
  115. margin-top: 20rpx;
  116. font-size: 28rpx;
  117. }
  118. }
  119. .number-input{
  120. padding: 30rpx 30rpx 10rpx;
  121. > view{
  122. padding: 20rpx 0;
  123. }
  124. .kucun{
  125. color: #999;
  126. text{
  127. color: #333;
  128. }
  129. }
  130. .u-ninput{
  131. border: 2rpx solid #eee;
  132. border-radius: 50rpx;
  133. padding: 0 12rpx;
  134. }
  135. /deep/ .u-icon-disabled{
  136. background: #fff!important;
  137. }
  138. /deep/ .u-number-input{
  139. margin: 0 2rpx;
  140. border: 2rpx solid #eee;
  141. border-top: 0;
  142. border-bottom: 0;
  143. }
  144. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  145. border-radius: 50rpx;
  146. }
  147. }
  148. .buttons{
  149. padding: 50rpx 0;
  150. > view{
  151. width: 80%;
  152. margin: 0 2%;
  153. }
  154. }
  155. }
  156. </style>