signWarehousing.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. 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.putQty = item.qty ? Number(item.qty) : 0
  150. if(item.qty && Number(item.qty)){
  151. _this.totalQty += Number(item.qty)
  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. salesDetailBySn({ salesBillSn: data.salesBillSn }).then(res => {
  234. if (res.data) {
  235. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  236. } else {
  237. this.toashMsg('此销售单已被删除!')
  238. }
  239. })
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="less">
  245. page{
  246. height: 100vh;
  247. }
  248. .replenishment-putWarehousing-wrap{
  249. position: relative;
  250. width: 100%;
  251. height: 100%;
  252. overflow: hidden;
  253. padding-bottom: 136upx;
  254. .replenishment-putWarehousing-body{
  255. padding: 0 30rpx;
  256. height: 100%;
  257. overflow: auto;
  258. > view{
  259. padding: 10rpx 25rpx;
  260. background-color: #fff;
  261. margin-bottom: 20rpx;
  262. border-radius: 25rpx;
  263. box-shadow: 2rpx 3rpx 5rpx #eee;
  264. }
  265. .head-info{
  266. .states{
  267. border: 0;
  268. padding: 20rpx 0;
  269. > view{
  270. color: #191919;
  271. text-align: center;
  272. font-size: 40rpx;
  273. text{
  274. margin-left: 20rpx;
  275. }
  276. }
  277. }
  278. .info-txt{
  279. word-break: break-word;
  280. }
  281. font-size: 30rpx;
  282. > view{
  283. display: flex;
  284. border-bottom: 2rpx solid #f5f5f5;
  285. padding: 20rpx 0;
  286. > view:last-child{
  287. flex-grow: 1;
  288. width: 80%;
  289. }
  290. &:last-child{
  291. border:0;
  292. }
  293. }
  294. .label{
  295. display: flex;
  296. align-items: center;
  297. width: 220rpx;
  298. height: 44rpx;
  299. color: #7C7D7E;
  300. text{
  301. margin-left: 10rpx;
  302. }
  303. }
  304. }
  305. }
  306. .replenishment-putWarehousing-footer{
  307. padding: 26upx 32upx 30upx;
  308. background-color: #fff;
  309. position: fixed;
  310. left: 0;
  311. bottom: 0;
  312. width: 100%;
  313. box-shadow: 3px 1px 7px #eee;
  314. }
  315. }
  316. </style>