outWarehousing.vue 9.0 KB

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