outWarehousing.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 5upx;">此补货单已经存在对应的销售单?</view>
  48. <view style="padding: 0 10upx 20upx;">确认再次生成销售单吗?</view>
  49. <scroll-view :scroll-y="true" style="max-height: 18vh;">
  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. </scroll-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. onBackPress() {
  118. if(this.showModal){
  119. this.showModal = false
  120. return true
  121. }
  122. },
  123. onLoad(option) {
  124. this.replenishBillSn = option.sn
  125. this.getDetail()
  126. this.getPartList()
  127. this.getSalesOrder()
  128. },
  129. computed: {
  130. totalNums() {
  131. let ret = 0
  132. this.partList.map(item => {
  133. ret = ret + item.qty
  134. })
  135. return ret
  136. }
  137. },
  138. methods: {
  139. // 查询详情
  140. getDetail(){
  141. shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
  142. if(res.status == 200){
  143. this.basicInfoData = res.data || null
  144. }else{
  145. this.basicInfoData = null
  146. }
  147. })
  148. },
  149. // 查询列表
  150. getPartList(){
  151. const _this = this
  152. shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
  153. if(res.status == 200 && res.data){
  154. res.data.map(item =>{
  155. item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
  156. })
  157. this.partList = res.data || []
  158. }else{
  159. this.partList = []
  160. }
  161. })
  162. },
  163. // 一键出库
  164. modalConfirm(){
  165. const arr = []
  166. const _this = this
  167. _this.partList.map((item, index) => {
  168. arr.push({
  169. productSn: item.productSn,
  170. confirmQty: item.confirmQty,
  171. replenishBillDetailSn: item.replenishBillDetailSn,
  172. id: item.id
  173. })
  174. })
  175. const params = {
  176. replenishBillSn: _this.replenishBillSn,
  177. detailList: arr,
  178. remarks: _this.remarks,
  179. shelfSn: _this.basicInfoData && _this.basicInfoData.shelfSn
  180. }
  181. _this.showLoading('正在出库...')
  182. shelfReplenishOutStock(params).then(res => {
  183. console.log(res)
  184. if (res.status == 200) {
  185. _this.remarks = ''
  186. uni.$emit('refreshBL')
  187. uni.$emit("refreshBhList",'WAIT_CHECK')
  188. uni.navigateBack()
  189. }
  190. _this.toashMsg(res.message)
  191. uni.hideLoading()
  192. })
  193. },
  194. // 发货出库
  195. goSendOutGoods(){
  196. uni.navigateTo({ url: "/pages/replenishmentManage/sendOutGoods?sn="+this.replenishBillSn+'&shelfSn='+this.basicInfoData.shelfSn })
  197. },
  198. // 查询关联销售单
  199. getSalesOrder () {
  200. queryRelationSalesBill({ replenishBillSn: this.replenishBillSn }).then(res => {
  201. if (res.status == 200) {
  202. this.salesOrderList = res.data
  203. } else {
  204. this.salesOrderList = []
  205. }
  206. })
  207. },
  208. // 生成销售单
  209. creatSalesOrder(){
  210. this.showModal = true
  211. },
  212. showModalConfirm(){
  213. this.showLoading("正在生成销售单...")
  214. createSalesBill({ replenishBillSn: this.replenishBillSn }).then(res => {
  215. if (res.status == 200) {
  216. this.getSalesOrder()
  217. }
  218. this.showModal = false
  219. this.toashMsg(res.message)
  220. uni.hideLoading()
  221. })
  222. },
  223. // 查看销售单
  224. viewSales(data){
  225. salesDetailBySn({ salesBillSn: data.salesBillSn }).then(res => {
  226. if (res.data) {
  227. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  228. } else {
  229. this.toashMsg('此销售单已被删除!')
  230. }
  231. })
  232. }
  233. }
  234. }
  235. </script>
  236. <style lang="less">
  237. page {
  238. height: 100vh;
  239. }
  240. .replenishment-outWarehousing-wrap{
  241. position: relative;
  242. width: 100%;
  243. height: 100%;
  244. overflow: hidden;
  245. padding-bottom: 136upx;
  246. .replenishment-outWarehousing-body{
  247. padding: 0 30rpx;
  248. height: 100%;
  249. overflow: auto;
  250. > view{
  251. padding: 10rpx 25rpx;
  252. background-color: #fff;
  253. margin-bottom: 20rpx;
  254. border-radius: 25rpx;
  255. box-shadow: 2rpx 3rpx 5rpx #eee;
  256. }
  257. .head-info{
  258. .states{
  259. border: 0;
  260. padding: 20rpx 0;
  261. > view{
  262. color: #191919;
  263. text-align: center;
  264. font-size: 40rpx;
  265. text{
  266. margin-left: 20rpx;
  267. }
  268. }
  269. }
  270. .info-txt{
  271. word-break: break-word;
  272. }
  273. font-size: 30rpx;
  274. > view{
  275. display: flex;
  276. border-bottom: 2rpx solid #f5f5f5;
  277. padding: 20rpx 0;
  278. > view:last-child{
  279. flex-grow: 1;
  280. width: 80%;
  281. }
  282. &:last-child{
  283. border:0;
  284. }
  285. }
  286. .label{
  287. display: flex;
  288. align-items: center;
  289. width: 220rpx;
  290. height: 44rpx;
  291. color: #7C7D7E;
  292. text{
  293. margin-left: 10rpx;
  294. }
  295. }
  296. }
  297. }
  298. .replenishment-outWarehousing-footer{
  299. padding: 26upx 32upx 30upx;
  300. background-color: #fff;
  301. position: fixed;
  302. left: 0;
  303. bottom: 0;
  304. width: 100%;
  305. box-shadow: 3px 1px 7px #eee;
  306. display: flex;
  307. justify-content: space-between;
  308. align-items: center;
  309. .button{
  310. width: 45%;
  311. }
  312. }
  313. }
  314. </style>