cancellingStocks.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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, 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. this.basicInfoData = res.data || null
  76. }else{
  77. this.basicInfoData = null
  78. }
  79. })
  80. },
  81. // 查询配件列表
  82. getPartList(){
  83. shelfRecallDetail({ recallBillSn: this.recallBillSn }).then(res => {
  84. if(res.status == 200 && res.data){
  85. res.data.map(item =>{
  86. item.confirmQty = item.qty ? Number(item.qty) : 0
  87. })
  88. this.partList = res.data || []
  89. }else{
  90. this.partList = []
  91. }
  92. })
  93. },
  94. // 确定退货
  95. submit(){
  96. const result =this.$refs.partList.getAllChecked()
  97. if(result.length){
  98. this.confirmModal = true
  99. }else{
  100. this.toashMsg("请选择配件!")
  101. }
  102. },
  103. // 确认退库 confirm
  104. modalConfirm(){
  105. const result =this.$refs.partList.getAllChecked()
  106. const arr = []
  107. result.map((item, index) => {
  108. if (item.confirmQty || item.confirmQty == 0) {
  109. arr.push({
  110. productSn: item.productSn,
  111. confirmQty: item.confirmQty,
  112. recallBillDetailSn: item.recallBillDetailSn
  113. })
  114. }
  115. })
  116. const params = {
  117. shelfSn: result[0].shelfSn,
  118. recallBillSn: this.recallBillSn,
  119. recallBillNo: result[0].recallBillNo,
  120. detailList: arr
  121. }
  122. shelfRecallConfirm(params).then(res => {
  123. if(res.status == 200){
  124. uni.$emit("refreshBL")
  125. uni.navigateBack()
  126. }
  127. this.toashMsg(res.message)
  128. })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="less">
  134. page {
  135. height: 100vh;
  136. }
  137. .cancelStockPages{
  138. position: relative;
  139. width: 100%;
  140. height: 100%;
  141. overflow: hidden;
  142. padding-bottom: 136upx;
  143. .cancelStockPages-body{
  144. padding: 0 30rpx;
  145. height: 100%;
  146. overflow: auto;
  147. > view{
  148. padding: 10rpx 25rpx;
  149. background-color: #fff;
  150. margin-bottom: 20rpx;
  151. border-radius: 25rpx;
  152. box-shadow: 2rpx 3rpx 5rpx #eee;
  153. }
  154. .head-info{
  155. .states{
  156. border: 0;
  157. padding: 20rpx 0;
  158. > view{
  159. color: #191919;
  160. text-align: center;
  161. font-size: 40rpx;
  162. text{
  163. margin-left: 20rpx;
  164. }
  165. }
  166. }
  167. .info-txt{
  168. word-break: break-word;
  169. }
  170. font-size: 30rpx;
  171. > view{
  172. display: flex;
  173. border-bottom: 2rpx solid #f5f5f5;
  174. padding: 20rpx 0;
  175. > view:last-child{
  176. flex-grow: 1;
  177. width: 80%;
  178. }
  179. &:last-child{
  180. border:0;
  181. }
  182. }
  183. .label{
  184. display: flex;
  185. align-items: center;
  186. width: 220rpx;
  187. height: 44rpx;
  188. color: #7C7D7E;
  189. text{
  190. margin-left: 10rpx;
  191. }
  192. }
  193. }
  194. }
  195. .cancelStockPages-footer{
  196. padding: 26upx 32upx 30upx;
  197. background-color: #fff;
  198. position: fixed;
  199. left: 0;
  200. bottom: 0;
  201. width: 100%;
  202. box-shadow: 3px 1px 7px #eee;
  203. display: flex;
  204. justify-content: space-between;
  205. align-items: center;
  206. .button{
  207. width: 45%;
  208. }
  209. }
  210. }
  211. </style>