cancellingStocks.vue 5.3 KB

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