confirmQh.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 style="display: block;"><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 flex justify_center">
  15. <view class="pcode" v-if="nowData.showPrice">
  16. <view>
  17. 价格:<text class="item-price">{{nowData.showPrice||0}}</text>
  18. </view>
  19. </view>
  20. <view>
  21. 可用库存:<text>{{nowData.currentInven}}</text>{{nowData.unit}}
  22. </view>
  23. </view>
  24. </view>
  25. <view class="buttons">
  26. <u-button :throttle-time="100" :loading="loading" @click="onSubmit" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
  27. 确认拿货
  28. </u-button>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { shelfOrderOnceCreate } from '@/api/shelf'
  34. export default {
  35. data() {
  36. return {
  37. loading:false,
  38. nowData: null,
  39. qty: 1,
  40. }
  41. },
  42. onLoad(options) {
  43. this.nowData = this.$store.state.vuex_tempData
  44. },
  45. computed: {
  46. userInfo(){
  47. return this.$store.state.vuex_userInfo
  48. },
  49. isAdmin(){
  50. return this.userInfo.superAdmin == 1
  51. }
  52. },
  53. methods: {
  54. onSubmit(){
  55. const _this = this
  56. uni.showModal({
  57. title: '提示',
  58. content: '拿货后扣减库存,确认拿货吗?',
  59. confirmText: '确定',
  60. success(res) {
  61. if(res.confirm){
  62. _this.outShelfOrder()
  63. }
  64. }
  65. })
  66. },
  67. toDetail(data){
  68. uni.$emit("updateQueryByCodeList")
  69. // 提交成功
  70. uni.redirectTo({
  71. url:"/pagesA/digitalShelf/choosePartResult?data="+encodeURIComponent(JSON.stringify({shelfOrder:data}))+"&state=1"
  72. })
  73. },
  74. // 确认拿货
  75. outShelfOrder(){
  76. const _this = this
  77. this.loading = true
  78. shelfOrderOnceCreate({
  79. billSource: this.nowData.billSource,
  80. shelfOrderDetailList: [{
  81. "productSn": this.nowData.productSn,
  82. "totalQty": this.qty
  83. }]
  84. }).then(res => {
  85. if(res.status == 200){
  86. this.toDetail(res.data)
  87. }else{
  88. uni.showModal({
  89. title: res.errCode == 'VALIDATE_STOCK_LACK' ? '以下产品库存不足' : '提示',
  90. content: res.message,
  91. confirmText: '知道了',
  92. showCancel: false
  93. })
  94. }
  95. this.loading = false
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="less">
  102. .content{
  103. background-color: #fff;
  104. width: 100%;
  105. padding: 50rpx 30rpx;
  106. height: 100vh;
  107. .productInfo{
  108. > view{
  109. text-align: center;
  110. display: flex;
  111. justify-content: center;
  112. font-size: 32rpx;
  113. .item-no{
  114. font-weight: normal;
  115. margin-right: 6rpx;
  116. padding: 0 10rpx;
  117. background: rgba(3, 54, 146, 0.15);
  118. border-radius: 20rpx;
  119. color: #033692;
  120. font-size: 24rpx;
  121. }
  122. padding: 10rpx;
  123. }
  124. .item-name{
  125. margin-top: 20rpx;
  126. font-size: 28rpx;
  127. }
  128. }
  129. .number-input{
  130. padding: 30rpx 30rpx 10rpx;
  131. > view{
  132. padding: 20rpx 0;
  133. }
  134. .kucun{
  135. color: #999;
  136. text{
  137. color: #333;
  138. }
  139. .pcode{
  140. margin-right: 20upx;
  141. }
  142. }
  143. .u-ninput{
  144. border: 2rpx solid #eee;
  145. border-radius: 50rpx;
  146. padding: 0 12rpx;
  147. }
  148. /deep/ .u-icon-disabled{
  149. background: #fff!important;
  150. }
  151. /deep/ .u-number-input{
  152. margin: 0 2rpx;
  153. border: 2rpx solid #eee;
  154. border-top: 0;
  155. border-bottom: 0;
  156. }
  157. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  158. border-radius: 50rpx;
  159. }
  160. }
  161. .buttons{
  162. padding: 50rpx 0;
  163. > view{
  164. width: 80%;
  165. margin: 0 2%;
  166. }
  167. }
  168. }
  169. </style>