confirmQh.vue 5.4 KB

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