confirmQh.vue 4.1 KB

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