confirmQh.vue 4.3 KB

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