signWarehousing.vue 9.3 KB

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