signWarehousing.vue 9.3 KB

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