confirmQh.vue 5.0 KB

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