outWarehousing.vue 8.6 KB

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