confirmQh.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. <view v-else>
  20. 价格:<text class="item-price">{{nowData.price||0}}</text>
  21. </view>
  22. </view>
  23. <view>
  24. 可用库存:<text>{{nowData.currentInven}}</text>{{nowData.unit}}
  25. </view>
  26. </view>
  27. </view>
  28. <view class="buttons">
  29. <u-button :throttle-time="100" :loading="loading" @click="onSubmit" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
  30. 确认拿货
  31. </u-button>
  32. </view>
  33. <!-- 红包 -->
  34. <u-mask :show="showMask">
  35. <view class="imageWarp flex flex_column justify_center align_center" style="width:100%;height:100vh;">
  36. <view style="position: relative;">
  37. <u-image src="/pagesA/static/hb.png" width="700" height="657" @click="toDetail"></u-image>
  38. <view style="font-size: 60rpx;color:#fff;position: absolute;top:50%;text-align: center;width: 100%;">
  39. {{tempData&&tempData.totalRewardAmount||'0.00'}} <text style="font-size: 26rpx;margin-left: 10rpx;">元</text>
  40. </view>
  41. </view>
  42. </view>
  43. </u-mask>
  44. </view>
  45. </template>
  46. <script>
  47. import { shelfOrderOnceCreate } from '@/api/shelf'
  48. export default {
  49. data() {
  50. return {
  51. loading:false,
  52. nowData: null,
  53. qty: 1,
  54. showMask: false,
  55. tempData: null
  56. }
  57. },
  58. onLoad(options) {
  59. this.nowData = this.$store.state.vuex_tempData
  60. },
  61. computed: {
  62. userInfo(){
  63. return this.$store.state.vuex_userInfo
  64. },
  65. showPrice(){
  66. return this.$store.state.vuex_showPrice
  67. },
  68. isAdmin(){
  69. return this.userInfo.superAdmin == 1
  70. }
  71. },
  72. methods: {
  73. onSubmit(){
  74. const _this = this
  75. uni.showModal({
  76. title: '提示',
  77. content: '拿货后扣减库存,确认拿货吗?',
  78. confirmText: '确定',
  79. success(res) {
  80. if(res.confirm){
  81. _this.outShelfOrder()
  82. }
  83. }
  84. })
  85. },
  86. toDetail(data){
  87. uni.$emit("updateQueryByCodeList")
  88. uni.redirectTo({
  89. url: "/pagesA/digitalShelf/orderDetail?shelfOrderSn="+data.shelfOrderSn
  90. })
  91. },
  92. showRedModal(data){
  93. if(data.totalRewardAmount){
  94. this.tempData = data
  95. this.showMask = true
  96. }else{
  97. this.toDetail(data)
  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. if(res.data&&res.data.remindMessage){
  113. uni.showModal({
  114. title: '提示',
  115. content: res.data.remindMessage,
  116. confirmText: '知道了',
  117. showCancel: false,
  118. success(ret) {
  119. if(ret.confirm){
  120. _this.showRedModal(res.data)
  121. }
  122. }
  123. })
  124. }else{
  125. uni.showToast({
  126. icon:'none',
  127. title: res.message,
  128. duration: 4000
  129. })
  130. _this.showRedModal(res.data)
  131. }
  132. }else{
  133. uni.showModal({
  134. title: res.errCode == 'VALIDATE_STOCK_LACK' ? '以下产品库存不足' : '提示',
  135. content: res.message,
  136. confirmText: '知道了',
  137. showCancel: false
  138. })
  139. }
  140. this.loading = false
  141. })
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="less">
  147. .content{
  148. background-color: #fff;
  149. width: 100%;
  150. padding: 50rpx 30rpx;
  151. height: 100vh;
  152. .productInfo{
  153. > view{
  154. text-align: center;
  155. display: flex;
  156. justify-content: center;
  157. font-size: 32rpx;
  158. .item-no{
  159. font-weight: normal;
  160. margin-right: 6rpx;
  161. padding: 0 10rpx;
  162. background: rgba(3, 54, 146, 0.15);
  163. border-radius: 20rpx;
  164. color: #033692;
  165. font-size: 24rpx;
  166. }
  167. padding: 10rpx;
  168. }
  169. .item-name{
  170. margin-top: 20rpx;
  171. font-size: 28rpx;
  172. }
  173. }
  174. .number-input{
  175. padding: 30rpx 30rpx 10rpx;
  176. > view{
  177. padding: 20rpx 0;
  178. }
  179. .kucun{
  180. color: #999;
  181. text{
  182. color: #333;
  183. }
  184. .pcode{
  185. margin-right: 20upx;
  186. }
  187. }
  188. .u-ninput{
  189. border: 2rpx solid #eee;
  190. border-radius: 50rpx;
  191. padding: 0 12rpx;
  192. }
  193. /deep/ .u-icon-disabled{
  194. background: #fff!important;
  195. }
  196. /deep/ .u-number-input{
  197. margin: 0 2rpx;
  198. border: 2rpx solid #eee;
  199. border-top: 0;
  200. border-bottom: 0;
  201. }
  202. /deep/ .u-icon-plus, /deep/ .u-icon-minus{
  203. border-radius: 50rpx;
  204. }
  205. }
  206. .buttons{
  207. padding: 50rpx 0;
  208. > view{
  209. width: 80%;
  210. margin: 0 2%;
  211. }
  212. }
  213. }
  214. </style>