confirmQh.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. // 确认取货
  74. outShelfOrder(){
  75. this.loading = true
  76. shelfOrderOnceCreate({
  77. billSource: this.nowData.billSource,
  78. shelfOrderDetailList: [{
  79. "productSn": this.nowData.productSn,
  80. "totalQty": this.qty
  81. }]
  82. }).then(res => {
  83. if(res.status == 200){
  84. if(res.data&&res.data.remindMessage){
  85. uni.showModal({
  86. title: '提示',
  87. content: res.data.remindMessage,
  88. confirmText: '知道了',
  89. showCancel: false
  90. })
  91. }else{
  92. uni.showToast({
  93. icon:'none',
  94. title: res.message,
  95. duration: 4000
  96. })
  97. uni.$emit("updateQueryByCodeList")
  98. uni.redirectTo({
  99. url: "/pages/digitalShelf/orderDetail?shelfOrderSn="+res.data.shelfOrderSn
  100. })
  101. }
  102. }else{
  103. uni.showModal({
  104. title: res.errCode == 'VALIDATE_STOCK_LACK' ? '以下产品库存不足' : '提示',
  105. content: res.message,
  106. confirmText: '知道了',
  107. showCancel: false
  108. })
  109. }
  110. this.loading = false
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="less">
  117. .content{
  118. background-color: #fff;
  119. width: 100%;
  120. padding: 50rpx 30rpx;
  121. height: 100vh;
  122. .productInfo{
  123. > view{
  124. text-align: center;
  125. display: flex;
  126. justify-content: center;
  127. font-size: 32rpx;
  128. .item-no{
  129. font-weight: normal;
  130. margin-right: 6rpx;
  131. padding: 0 10rpx;
  132. background: rgba(3, 54, 146, 0.15);
  133. border-radius: 20rpx;
  134. color: #033692;
  135. font-size: 24rpx;
  136. }
  137. padding: 10rpx;
  138. }
  139. .item-name{
  140. margin-top: 20rpx;
  141. font-size: 28rpx;
  142. }
  143. }
  144. .number-input{
  145. padding: 30rpx 30rpx 10rpx;
  146. > view{
  147. padding: 20rpx 0;
  148. }
  149. .kucun{
  150. color: #999;
  151. text{
  152. color: #333;
  153. }
  154. .pcode{
  155. margin-right: 20upx;
  156. }
  157. }
  158. .u-ninput{
  159. border: 2rpx solid #eee;
  160. border-radius: 50rpx;
  161. padding: 0 12rpx;
  162. }
  163. /deep/ .u-icon-disabled{
  164. background: #fff!important;
  165. }
  166. /deep/ .u-number-input{
  167. margin: 0 2rpx;
  168. border: 2rpx solid #eee;
  169. border-top: 0;
  170. border-bottom: 0;
  171. }
  172. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  173. border-radius: 50rpx;
  174. }
  175. }
  176. .buttons{
  177. padding: 50rpx 0;
  178. > view{
  179. width: 80%;
  180. margin: 0 2%;
  181. }
  182. }
  183. }
  184. </style>