cancellingStocks.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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" :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. <view>
  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. </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.getAllChecked()
  149. const arr = []
  150. this.partList.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: result[0].shelfSn,
  161. recallBillSn: this.recallBillSn,
  162. recallBillNo: result[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.refundModal = false
  181. }else{
  182. uni.showToast({
  183. title:res.message,
  184. icon:'none'
  185. })
  186. }
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="less">
  193. page {
  194. height: 100vh;
  195. }
  196. .cancelStockPages{
  197. position: relative;
  198. width: 100%;
  199. height: 100%;
  200. overflow: hidden;
  201. padding-bottom: 136upx;
  202. .cancelStockPages-body{
  203. padding: 0 30rpx;
  204. height: 100%;
  205. overflow: auto;
  206. > view{
  207. padding: 10rpx 25rpx;
  208. background-color: #fff;
  209. margin-bottom: 20rpx;
  210. border-radius: 25rpx;
  211. box-shadow: 2rpx 3rpx 5rpx #eee;
  212. }
  213. .head-info{
  214. .states{
  215. border: 0;
  216. padding: 20rpx 0;
  217. > view{
  218. color: #191919;
  219. text-align: center;
  220. font-size: 40rpx;
  221. text{
  222. margin-left: 20rpx;
  223. }
  224. }
  225. }
  226. .info-txt{
  227. word-break: break-word;
  228. }
  229. font-size: 30rpx;
  230. > view{
  231. display: flex;
  232. border-bottom: 2rpx solid #f5f5f5;
  233. padding: 20rpx 0;
  234. > view:last-child{
  235. flex-grow: 1;
  236. width: 80%;
  237. }
  238. &:last-child{
  239. border:0;
  240. }
  241. }
  242. .label{
  243. display: flex;
  244. align-items: center;
  245. width: 220rpx;
  246. height: 44rpx;
  247. color: #7C7D7E;
  248. text{
  249. margin-left: 10rpx;
  250. }
  251. }
  252. }
  253. }
  254. .cancelStockPages-footer{
  255. padding: 20upx 32upx 26upx;
  256. background-color: #fff;
  257. position: fixed;
  258. left: 0;
  259. bottom: 0;
  260. width: 100%;
  261. box-shadow: 3px 1px 7px #eee;
  262. .button{
  263. width: 100%;
  264. }
  265. }
  266. }
  267. </style>