confirmQh.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. this.$store.state.vuex_tempData = {shelfOrder:data}
  102. // 提交成功
  103. uni.redirectTo({
  104. url:"/pagesA/digitalShelf/choosePartResult?state=1"
  105. })
  106. },
  107. // 确认拿货
  108. outShelfOrder(){
  109. const _this = this
  110. this.loading = true
  111. shelfOrderOnceCreate({
  112. billSource: this.nowData.billSource,
  113. shelfOrderDetailList: [{
  114. "productSn": this.nowData.productSn,
  115. "totalQty": this.qty
  116. }]
  117. }).then(res => {
  118. if(res.status == 200){
  119. this.toDetail(res.data)
  120. }else{
  121. uni.showModal({
  122. title: res.errCode == 'VALIDATE_STOCK_LACK' ? '以下产品库存不足' : '提示',
  123. content: res.message,
  124. confirmText: '知道了',
  125. showCancel: false
  126. })
  127. }
  128. this.loading = false
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="less">
  135. .content{
  136. background-color: #fff;
  137. width: 100%;
  138. padding: 50rpx 30rpx;
  139. height: 100vh;
  140. .productInfo{
  141. .item-detail-text{
  142. color: #999;
  143. }
  144. /deep/ .u-tag{
  145. word-break: break-all;
  146. }
  147. > view{
  148. text-align: center;
  149. display: flex;
  150. justify-content: center;
  151. font-size: 32rpx;
  152. .item-no{
  153. font-weight: normal;
  154. margin-right: 6rpx;
  155. padding: 0 10rpx;
  156. background: rgba(3, 54, 146, 0.15);
  157. border-radius: 20rpx;
  158. color: #033692;
  159. font-size: 28rpx;
  160. }
  161. padding: 10rpx;
  162. }
  163. .item-name{
  164. margin-top: 20rpx;
  165. font-size: 28rpx;
  166. }
  167. }
  168. .number-input{
  169. padding: 30rpx 30rpx 10rpx;
  170. > view{
  171. padding: 20rpx 0;
  172. }
  173. .kucun{
  174. color: #999;
  175. text{
  176. color: #333;
  177. }
  178. .pcode{
  179. margin-right: 20upx;
  180. }
  181. }
  182. .u-ninput{
  183. border: 2rpx solid #eee;
  184. border-radius: 50rpx;
  185. padding: 0 12rpx;
  186. }
  187. /deep/ .u-icon-disabled{
  188. background: #fff!important;
  189. }
  190. /deep/ .u-number-input{
  191. margin: 0 2rpx;
  192. border: 2rpx solid #eee;
  193. border-top: 0;
  194. border-bottom: 0;
  195. }
  196. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  197. border-radius: 50rpx;
  198. }
  199. }
  200. .buttons{
  201. padding: 50rpx 0;
  202. > view{
  203. width: 80%;
  204. margin: 0 2%;
  205. }
  206. }
  207. }
  208. </style>