cancellingStocks.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="cancelStockPages" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
  3. <view class="cancelStockPages-body">
  4. <view class="head-info" v-if="basicInfoData">
  5. <view class="states">
  6. <view>
  7. <u-icon name="icon_withdrawal" custom-prefix="iscm-icon" size="48"></u-icon>
  8. <text>待退库</text>
  9. </view>
  10. </view>
  11. <view>
  12. <view class="label"><u-icon name="ison_shelf" custom-prefix="iscm-icon" size="32"></u-icon><text>货架名称</text></view>
  13. <view class="info-txt">{{basicInfoData.shelfInfo&&basicInfoData.shelfInfo.shelfName || '--'}}</view>
  14. </view>
  15. <view>
  16. <view class="label"><u-icon name="icon_position" custom-prefix="iscm-icon" size="32"></u-icon><text>客户地址</text></view>
  17. <view class="info-txt">{{basicInfoData.customerAddr || '--'}}</view>
  18. </view>
  19. </view>
  20. <view class="part-list">
  21. <!-- 配件列表 -->
  22. <partList title="配件列表" fromPage="recall" ref="partList" :list="partList" @allChecked="allCheckedCallback"></partList>
  23. </view>
  24. </view>
  25. <view class="cancelStockPages-footer">
  26. <view>
  27. <u-checkbox size="40" @change="allCheckeChange" v-model="allChecked" shape="circle">{{allChecked?'取消全选':'全选'}}</u-checkbox>
  28. </view>
  29. <view>
  30. <u-button @click="submit" shape="circle" :custom-style="{background:$config('primaryColor')}" type="primary">确定退库</u-button>
  31. </view>
  32. </view>
  33. <!-- 确认弹框 -->
  34. <common-modal :openModal="confirmModal" content="调回产品将退回至经销商仓库,确认退库吗?" confirmText="确认退库" @confirm="modalConfirm" @close="confirmModal=false" />
  35. </view>
  36. </template>
  37. <script>
  38. import commonModal from '@/pages/common/commonModal.vue'
  39. import partList from '@/pages/common/partList.vue'
  40. import { shelfRecallFindBySn, detailQueryCount, shelfRecallDetail, shelfRecallConfirm } from '@/api/shelfRecall.js'
  41. export default {
  42. components: { commonModal, partList },
  43. data() {
  44. return {
  45. allChecked: false,
  46. recallBillSn: '',
  47. basicInfoData: null,
  48. partList: [],
  49. confirmModal: false,
  50. }
  51. },
  52. onReady() {
  53. uni.setNavigationBarColor({
  54. frontColor: '#ffffff',
  55. backgroundColor: this.$config('primaryColor')
  56. })
  57. },
  58. onLoad(option) {
  59. this.recallBillSn = option.sn
  60. this.getDetail()
  61. this.getPartList()
  62. },
  63. methods: {
  64. // 全选
  65. allCheckeChange(e){
  66. this.$refs.partList.allSelect(e.value)
  67. },
  68. allCheckedCallback(val){
  69. this.allChecked = val
  70. },
  71. // 查询详情
  72. getDetail(){
  73. shelfRecallFindBySn({sn: this.recallBillSn}).then(res => {
  74. if(res.status == 200){
  75. if(res.status == 200){
  76. this.basicInfoData = res.data || null
  77. }else{
  78. this.basicInfoData = null
  79. }
  80. }
  81. })
  82. },
  83. // 查询配件列表
  84. getPartList(){
  85. shelfRecallDetail({ recallBillSn: this.recallBillSn }).then(res => {
  86. if(res.status == 200 && res.data){
  87. res.data.map(item =>{
  88. item.confirmQty = item.qty ? Number(item.qty) : 0
  89. })
  90. this.partList = res.data || []
  91. }else{
  92. this.partList = []
  93. }
  94. })
  95. },
  96. // 确定退货
  97. submit(){
  98. const result =this.$refs.partList.getAllChecked()
  99. if(result.length){
  100. this.confirmModal = true
  101. }else{
  102. this.toashMsg("请选择配件!")
  103. }
  104. },
  105. // 确认退库 confirm
  106. modalConfirm(){
  107. const result =this.$refs.partList.getAllChecked()
  108. const arr = []
  109. result.map((item, index) => {
  110. if (item.confirmQty || item.confirmQty == 0) {
  111. arr.push({
  112. productSn: item.productSn,
  113. confirmQty: item.confirmQty,
  114. recallBillDetailSn: item.recallBillDetailSn
  115. })
  116. }
  117. })
  118. const params = {
  119. shelfSn: result[0].shelfSn,
  120. recallBillSn: this.recallBillSn,
  121. recallBillNo: result[0].recallBillNo,
  122. detailList: arr
  123. }
  124. shelfRecallConfirm(params).then(res => {
  125. if(res.status == 200){
  126. uni.$emit("refreshBL")
  127. uni.navigateBack()
  128. }
  129. this.toashMsg(res.message)
  130. })
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="less">
  136. page {
  137. height: 100vh;
  138. }
  139. .cancelStockPages{
  140. position: relative;
  141. width: 100%;
  142. height: 100%;
  143. overflow: hidden;
  144. padding-bottom: 136upx;
  145. .cancelStockPages-body{
  146. padding: 0 30rpx;
  147. height: 100%;
  148. overflow: auto;
  149. > view{
  150. padding: 10rpx 25rpx;
  151. background-color: #fff;
  152. margin-bottom: 20rpx;
  153. border-radius: 25rpx;
  154. box-shadow: 2rpx 3rpx 5rpx #eee;
  155. }
  156. .head-info{
  157. .states{
  158. border: 0;
  159. padding: 20rpx 0;
  160. > view{
  161. color: #191919;
  162. text-align: center;
  163. font-size: 40rpx;
  164. text{
  165. margin-left: 20rpx;
  166. }
  167. }
  168. }
  169. .info-txt{
  170. word-break: break-word;
  171. }
  172. font-size: 30rpx;
  173. > view{
  174. display: flex;
  175. border-bottom: 2rpx solid #f5f5f5;
  176. padding: 20rpx 0;
  177. > view:last-child{
  178. flex-grow: 1;
  179. width: 80%;
  180. }
  181. &:last-child{
  182. border:0;
  183. }
  184. }
  185. .label{
  186. display: flex;
  187. align-items: center;
  188. width: 220rpx;
  189. height: 44rpx;
  190. color: #7C7D7E;
  191. text{
  192. margin-left: 10rpx;
  193. }
  194. }
  195. }
  196. }
  197. .cancelStockPages-footer{
  198. padding: 26upx 32upx 30upx;
  199. background-color: #fff;
  200. position: fixed;
  201. left: 0;
  202. bottom: 0;
  203. width: 100%;
  204. box-shadow: 3px 1px 7px #eee;
  205. display: flex;
  206. justify-content: space-between;
  207. align-items: center;
  208. .button{
  209. width: 45%;
  210. }
  211. }
  212. }
  213. </style>