signWarehousing.vue 9.1 KB

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