outWarehousing.vue 9.0 KB

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