cancellingStocks.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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. <partList title="配件列表" fromPage="recall" ref="partList" model="view" :list="partList"></partList>
  24. </view>
  25. </view>
  26. <view class="cancelStockPages-footer">
  27. <u-button @click="submit" shape="circle" :custom-style="{background:$config('primaryColor')}" type="primary">确定退库</u-button>
  28. </view>
  29. <!-- 确认弹框 -->
  30. <common-modal :openModal="confirmModal" content="此操作将会扣减数字货架的库存,确认退库吗?" confirmText="确认退库" @confirm="modalConfirm" @close="confirmModal=false" />
  31. <!-- 生成销售退货单弹窗 -->
  32. <common-modal :showTitle="false" :openModal="refundModal" @confirm="refundModalConfirm" @close="refundModal=false">
  33. <view style="font-size: 28upx;">
  34. <view style="padding: 10upx;" class="flex align_center justify_between" v-if="basicInfoData">
  35. <view>产品总款数:<text style="color: red;">{{basicInfoData.totalCategory}}</text></view>
  36. <view>产品总件数:<text style="color: red;">{{basicInfoData.totalQty}}</text></view>
  37. </view>
  38. <view v-if="salesOrderList.length">
  39. <view style="padding: 0 10upx 10upx;">此调回单已经存在对应的销售退货单?</view>
  40. <view style="padding: 0 10upx 20upx;">确认再次生成销售退货单吗?</view>
  41. <scroll-view scroll-y="true" style="height: 200rpx;">
  42. <view
  43. v-for="item in salesOrderList"
  44. :key="item.id"
  45. style="color: #00aaff;border-bottom: 1px solid #eee;padding: 10upx 0;"
  46. class="flex align_center justify_between">
  47. <text>{{item.salesReturnNo}}</text>
  48. <!-- <view>
  49. <u-icon name="arrow-right"></u-icon>
  50. </view> -->
  51. </view>
  52. </scroll-view>
  53. </view>
  54. <view v-else>
  55. <view style="padding: 0 10upx 20upx;">确认生成销售退货单吗?</view>
  56. <!-- <view>
  57. <view
  58. v-for="item in salesOrderList" :key="item.id"
  59. style="color: #00aaff;border-bottom: 1px solid #eee;padding: 10upx 0;"
  60. class="flex align_center justify_between">
  61. <text>{{item.orderNo}}</text>
  62. <view>
  63. <u-icon name="arrow-right"></u-icon>
  64. </view>
  65. </view>
  66. </view> -->
  67. </view>
  68. </view>
  69. </common-modal>
  70. </view>
  71. </template>
  72. <script>
  73. import commonModal from '@/pages/common/commonModal.vue'
  74. import partList from '@/pages/common/partList.vue'
  75. import { shelfRecallFindBySn, shelfRecallDetail, shelfRecallConfirm,generateSaleReturnBill } from '@/api/shelfRecall.js'
  76. export default {
  77. components: { commonModal, partList },
  78. data() {
  79. return {
  80. allChecked: false,
  81. recallBillSn: '',
  82. basicInfoData: null,
  83. partList: [],
  84. confirmModal: false,
  85. refundModal:false,
  86. salesOrderList:[]
  87. }
  88. },
  89. onReady() {
  90. uni.setNavigationBarColor({
  91. frontColor: '#ffffff',
  92. backgroundColor: this.$config('primaryColor')
  93. })
  94. },
  95. onLoad(option) {
  96. this.recallBillSn = option.sn
  97. this.getDetail()
  98. this.getPartList()
  99. },
  100. onNavigationBarButtonTap(){
  101. this.refundModal = true;
  102. },
  103. methods: {
  104. // 全选
  105. // allCheckeChange(e){
  106. // this.$refs.partList.allSelect(e.value)
  107. // },
  108. // allCheckedCallback(val){
  109. // this.allChecked = val
  110. // },
  111. // 查询详情
  112. getDetail(){
  113. shelfRecallFindBySn({sn: this.recallBillSn}).then(res => {
  114. if(res.status == 200){
  115. this.basicInfoData = res.data || null
  116. this.salesOrderList = res.data.salesReturnBillList ? res.data.salesReturnBillList:[];
  117. }else{
  118. this.basicInfoData = null
  119. }
  120. })
  121. },
  122. // 查询配件列表
  123. getPartList(){
  124. shelfRecallDetail({ recallBillSn: this.recallBillSn }).then(res => {
  125. if(res.status == 200 && res.data){
  126. res.data.map(item =>{
  127. item.confirmQty = item.qty ? Number(item.qty) : 0
  128. })
  129. this.partList = res.data || []
  130. console.log(res.data)
  131. }else{
  132. this.partList = []
  133. }
  134. })
  135. },
  136. // 确定退货
  137. submit(){
  138. this.confirmModal = true
  139. // const result =this.$refs.partList.getAllChecked()
  140. // if(result.length){
  141. // this.confirmModal = true
  142. // }else{
  143. // this.toashMsg("请选择配件!")
  144. // }
  145. },
  146. // 确认退库 confirm
  147. modalConfirm(){
  148. const result =this.$refs.partList.getAllData()
  149. const arr = []
  150. result.map((item, index) => {
  151. if (item.confirmQty || item.confirmQty == 0) {
  152. arr.push({
  153. productSn: item.productSn,
  154. confirmQty: item.confirmQty,
  155. recallBillDetailSn: item.recallBillDetailSn
  156. })
  157. }
  158. })
  159. const params = {
  160. shelfSn: this.partList[0].shelfSn,
  161. recallBillSn: this.recallBillSn,
  162. recallBillNo: this.partList[0].recallBillNo,
  163. detailList: arr
  164. }
  165. shelfRecallConfirm(params).then(res => {
  166. if(res.status == 200){
  167. uni.$emit("refreshBL")
  168. uni.navigateBack()
  169. }
  170. this.toashMsg(res.message)
  171. })
  172. },
  173. // 生成销售退货单
  174. refundModalConfirm(){
  175. generateSaleReturnBill({ recallBillSn: this.recallBillSn }).then(res => {
  176. if (res.status == 200) {
  177. uni.showToast({
  178. title:res.message
  179. })
  180. this.getDetail();
  181. setTimeout(()=>{
  182. this.refundModal = false
  183. },800)
  184. }else{
  185. uni.showToast({
  186. title:res.message,
  187. icon:'none'
  188. })
  189. }
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="less">
  196. page {
  197. height: 100vh;
  198. }
  199. .cancelStockPages{
  200. position: relative;
  201. width: 100%;
  202. height: 100%;
  203. overflow: hidden;
  204. padding-bottom: 136upx;
  205. .cancelStockPages-body{
  206. padding: 0 30rpx;
  207. height: 100%;
  208. overflow: auto;
  209. > view{
  210. padding: 10rpx 25rpx;
  211. background-color: #fff;
  212. margin-bottom: 20rpx;
  213. border-radius: 25rpx;
  214. box-shadow: 2rpx 3rpx 5rpx #eee;
  215. }
  216. .head-info{
  217. .states{
  218. border: 0;
  219. padding: 20rpx 0;
  220. > view{
  221. color: #191919;
  222. text-align: center;
  223. font-size: 40rpx;
  224. text{
  225. margin-left: 20rpx;
  226. }
  227. }
  228. }
  229. .info-txt{
  230. word-break: break-word;
  231. }
  232. font-size: 30rpx;
  233. > view{
  234. display: flex;
  235. border-bottom: 2rpx solid #f5f5f5;
  236. padding: 20rpx 0;
  237. > view:last-child{
  238. flex-grow: 1;
  239. width: 80%;
  240. }
  241. &:last-child{
  242. border:0;
  243. }
  244. }
  245. .label{
  246. display: flex;
  247. align-items: center;
  248. width: 220rpx;
  249. height: 44rpx;
  250. color: #7C7D7E;
  251. text{
  252. margin-left: 10rpx;
  253. }
  254. }
  255. }
  256. }
  257. .cancelStockPages-footer{
  258. padding: 20upx 32upx 26upx;
  259. background-color: #fff;
  260. position: fixed;
  261. left: 0;
  262. bottom: 0;
  263. width: 100%;
  264. box-shadow: 3px 1px 7px #eee;
  265. .button{
  266. width: 100%;
  267. }
  268. }
  269. }
  270. </style>