outWarehousing.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="replenishment-outWarehousing-wrap">
  3. <u-navbar back-text="补货出库" :border-bottom="false" :background="{backgroundColor: $config('primaryColor')}" back-icon-color="#fff" :back-text-style="{ color: '#fff' }">
  4. <view slot='right' style="padding: 0 30upx;color: #ffffff;" @click="creatSalesOrder">
  5. <u-icon name="chuangjiandingdan" custom-prefix="iscm-icon"></u-icon>
  6. <text style="margin-left: 6rpx;">生成销售单</text>
  7. </view>
  8. </u-navbar>
  9. <view class="replenishment-outWarehousing-body" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
  10. <view class="head-info" v-if="basicInfoData">
  11. <view class="states">
  12. <view>
  13. <u-icon name="icon_out" custom-prefix="iscm-icon" size="48"></u-icon>
  14. <text>待出库</text>
  15. </view>
  16. </view>
  17. <view>
  18. <view class="label"><u-icon name="ison_shelf" custom-prefix="iscm-icon" size="32"></u-icon><text>货架名称</text></view>
  19. <view class="info-txt">{{basicInfoData.shelfInfo&&basicInfoData.shelfInfo.shelfName || '--'}}</view>
  20. </view>
  21. <view>
  22. <view class="label"><u-icon name="icon_position" custom-prefix="iscm-icon" size="32"></u-icon><text>客户地址</text></view>
  23. <view class="info-txt">{{basicInfoData.customerAddr}}</view>
  24. </view>
  25. </view>
  26. <view class="part-list">
  27. <!-- 配件列表 -->
  28. <partList :list="partList" title="配件列表" model="view" fromPage="replenishmentOut" ref="partList" noDataText="暂无配件"></partList>
  29. </view>
  30. </view>
  31. <view class="replenishment-outWarehousing-footer">
  32. <u-button class="button" @click="goSendOutGoods" :custom-style="customDefalutStyle" hover-class="none" shape="circle">扫码出库</u-button>
  33. <u-button class="button" @click="confirmModal=true" :loading="loading" type="success" :custom-style="customStyle" hover-class="none" shape="circle">一键出库</u-button>
  34. </view>
  35. <!-- 一键出库弹框 -->
  36. <common-modal :openModal="confirmModal" title="确认信息无误并进行出库吗?" confirmText="确认" @confirm="modalConfirm" @close="confirmModal=false">
  37. <u-input type='textarea' v-model="remarks" :maxlength="100" placeholder="请输入出库备注(最多100字符)" border :height="100"></u-input>
  38. </common-modal>
  39. <!-- 生成销售单 -->
  40. <common-modal v-if="showModal" :showTitle="false" :openModal="showModal" @confirm="showModalConfirm" @close="showModal=false">
  41. <view style="font-size: 28upx;">
  42. <view style="padding: 10upx;margin: 20upx 0;" class="flex align_center justify_between">
  43. <view>产品总款数:<text style="color: red;">{{partList.length}}</text></view>
  44. <view>产品总件数:<text style="color: red;">{{totalNums}}</text></view>
  45. </view>
  46. <view v-if="salesOrderList.length">
  47. <view style="padding: 0 10upx 10upx;">此补货单已经存在对应的销售单?</view>
  48. <view style="padding: 0 10upx 20upx;">确认再次生成销售单吗?</view>
  49. <view>
  50. <view
  51. v-for="item in salesOrderList"
  52. :key="item.id"
  53. style="color: #00aaff;border-bottom: 1px solid #eee;padding: 10upx 0;"
  54. class="flex align_center justify_between"
  55. @click="viewSales(item)"
  56. >
  57. <text>{{item.salesBillNo}}</text>
  58. <view>
  59. <u-icon name="arrow-right"></u-icon>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view v-else>
  65. <view style="padding: 0 10upx 20upx;">确认生成销售单?</view>
  66. <view>
  67. <view
  68. v-for="item in salesOrderList" :key="item.id"
  69. style="color: #00aaff;border-bottom: 1px solid #eee;padding: 10upx 0;"
  70. class="flex align_center justify_between">
  71. <text>{{item.orderNo}}</text>
  72. <view>
  73. <u-icon name="arrow-right"></u-icon>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </common-modal>
  80. </view>
  81. </template>
  82. <script>
  83. import commonModal from '@/pages/common/commonModal.vue'
  84. import { salesDetailBySn } from '@/api/sales'
  85. import { shelfReplenishDetail, shelfReplenishDetailList, shelfReplenishOutStock, queryRelationSalesBill, createSalesBill } from '@/api/shelfReplenish'
  86. import partList from '@/pages/common/partList.vue'
  87. export default {
  88. components: { partList, commonModal },
  89. data() {
  90. return {
  91. loading: false,
  92. replenishBillSn: '',
  93. basicInfoData:null,
  94. partList: [],
  95. customStyle: {
  96. borderRadius:'100rpx',
  97. fontSize:'30rpx',
  98. background: this.$config('primaryColor')
  99. },
  100. customDefalutStyle: {
  101. borderRadius:'100rpx',
  102. fontSize:'30rpx',
  103. color: this.$config('primaryColor'),
  104. background: '#fff'
  105. },
  106. confirmModal: false,
  107. remarks: '',
  108. showModal: false
  109. }
  110. },
  111. onReady() {
  112. uni.setNavigationBarColor({
  113. frontColor: '#ffffff',
  114. backgroundColor: this.$config('primaryColor')
  115. })
  116. },
  117. onLoad(option) {
  118. this.replenishBillSn = option.sn
  119. this.getDetail()
  120. this.getPartList()
  121. this.getSalesOrder()
  122. },
  123. computed: {
  124. totalNums() {
  125. let ret = 0
  126. this.partList.map(item => {
  127. ret = ret + item.qty
  128. })
  129. return ret
  130. }
  131. },
  132. methods: {
  133. // 查询详情
  134. getDetail(){
  135. shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
  136. if(res.status == 200){
  137. this.basicInfoData = res.data || null
  138. }else{
  139. this.basicInfoData = null
  140. }
  141. })
  142. },
  143. // 查询列表
  144. getPartList(){
  145. const _this = this
  146. shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
  147. if(res.status == 200 && res.data){
  148. res.data.map(item =>{
  149. item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
  150. })
  151. this.partList = res.data || []
  152. }else{
  153. this.partList = []
  154. }
  155. })
  156. },
  157. // 一键出库
  158. modalConfirm(){
  159. const arr = []
  160. const _this = this
  161. _this.partList.map((item, index) => {
  162. arr.push({
  163. productSn: item.productSn,
  164. confirmQty: item.confirmQty,
  165. replenishBillDetailSn: item.replenishBillDetailSn,
  166. id: item.id
  167. })
  168. })
  169. const params = {
  170. replenishBillSn: _this.replenishBillSn,
  171. detailList: arr,
  172. remarks: _this.remarks,
  173. shelfSn: _this.basicInfoData && _this.basicInfoData.shelfSn
  174. }
  175. _this.showLoading('正在出库...')
  176. shelfReplenishOutStock(params).then(res => {
  177. console.log(res)
  178. if (res.status == 200) {
  179. _this.remarks = ''
  180. uni.$emit('refreshBL')
  181. uni.$emit("refreshBhList",'WAIT_CHECK')
  182. uni.navigateBack()
  183. }
  184. _this.toashMsg(res.message)
  185. uni.hideLoading()
  186. })
  187. },
  188. // 发货出库
  189. goSendOutGoods(){
  190. uni.navigateTo({ url: "/pages/replenishmentManage/sendOutGoods?sn="+this.replenishBillSn+'&shelfSn='+this.basicInfoData.shelfSn })
  191. },
  192. // 查询关联销售单
  193. getSalesOrder () {
  194. queryRelationSalesBill({ replenishBillSn: this.replenishBillSn }).then(res => {
  195. if (res.status == 200) {
  196. this.salesOrderList = res.data
  197. } else {
  198. this.salesOrderList = []
  199. }
  200. })
  201. },
  202. // 生成销售单
  203. creatSalesOrder(){
  204. this.showModal = true
  205. },
  206. showModalConfirm(){
  207. this.showLoading("正在生成销售单...")
  208. createSalesBill({ replenishBillSn: this.replenishBillSn }).then(res => {
  209. if (res.status == 200) {
  210. this.getSalesOrder()
  211. }
  212. this.showModal = false
  213. this.toashMsg(res.message)
  214. uni.hideLoading()
  215. })
  216. },
  217. // 查看销售单
  218. viewSales(data){
  219. salesDetailBySn({ salesBillSn: data.salesBillSn }).then(res => {
  220. if (res.data) {
  221. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  222. } else {
  223. this.toashMsg('此销售单已被删除!')
  224. }
  225. })
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="less">
  231. page {
  232. height: 100vh;
  233. }
  234. .replenishment-outWarehousing-wrap{
  235. position: relative;
  236. width: 100%;
  237. height: 100%;
  238. overflow: hidden;
  239. padding-bottom: 136upx;
  240. .replenishment-outWarehousing-body{
  241. padding: 0 30rpx;
  242. height: 100%;
  243. overflow: auto;
  244. > view{
  245. padding: 10rpx 25rpx;
  246. background-color: #fff;
  247. margin-bottom: 20rpx;
  248. border-radius: 25rpx;
  249. box-shadow: 2rpx 3rpx 5rpx #eee;
  250. }
  251. .head-info{
  252. .states{
  253. border: 0;
  254. padding: 20rpx 0;
  255. > view{
  256. color: #191919;
  257. text-align: center;
  258. font-size: 40rpx;
  259. text{
  260. margin-left: 20rpx;
  261. }
  262. }
  263. }
  264. .info-txt{
  265. word-break: break-word;
  266. }
  267. font-size: 30rpx;
  268. > view{
  269. display: flex;
  270. border-bottom: 2rpx solid #f5f5f5;
  271. padding: 20rpx 0;
  272. > view:last-child{
  273. flex-grow: 1;
  274. width: 80%;
  275. }
  276. &:last-child{
  277. border:0;
  278. }
  279. }
  280. .label{
  281. display: flex;
  282. align-items: center;
  283. width: 220rpx;
  284. height: 44rpx;
  285. color: #7C7D7E;
  286. text{
  287. margin-left: 10rpx;
  288. }
  289. }
  290. }
  291. }
  292. .replenishment-outWarehousing-footer{
  293. padding: 26upx 32upx 30upx;
  294. background-color: #fff;
  295. position: fixed;
  296. left: 0;
  297. bottom: 0;
  298. width: 100%;
  299. box-shadow: 3px 1px 7px #eee;
  300. display: flex;
  301. justify-content: space-between;
  302. align-items: center;
  303. .button{
  304. width: 45%;
  305. }
  306. }
  307. }
  308. </style>