confirmQh.vue 5.4 KB

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