signWarehousing.vue 8.9 KB

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