detailModal.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <a-modal
  3. centered
  4. class="replenishmentManagement-confirm-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. :title="modalTit"
  8. v-model="isShow"
  9. @cancel="isShow = false"
  10. :width="800">
  11. <div v-if="nowData">
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <!-- 基础信息 -->
  14. <div v-if="detailData">
  15. <a-descriptions size="small" :column="3">
  16. <a-descriptions-item label="补货单号">{{ detailData && detailData.replenishBillNo || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="创建时间">{{ detailData && detailData.createDate || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="状态">{{ detailData&&detailData.billStateDictValue || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="出库时间">{{ detailData&&detailData.outStockTime || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="签收时间">{{ detailData&&detailData.putStockTime || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="出库备注">
  22. <div style="word-break: break-all;">
  23. {{ detailData&&detailData.remarks || '--' }}
  24. </div>
  25. </a-descriptions-item>
  26. <a-descriptions-item label="关联销售单" :span="3" v-if="detailData.billState=='WAIT_CHECK' || detailData.billState=='WAIT_OUT_STOCK' || detailData.billState=='FINISH'">
  27. <div style="word-break: break-all;">
  28. <a
  29. style="margin-right:10px;color:#00aaff;"
  30. v-for="item in salesOrderList"
  31. :key="item.id"
  32. @click="viewSales(item)">
  33. {{ item.salesBillNo }};
  34. </a>
  35. <a-button v-if="totalNums" type="primary" class="button-info" @click="showPlModal=true">生成销售单</a-button>
  36. <span v-else>--</span>
  37. </div>
  38. </a-descriptions-item>
  39. </a-descriptions>
  40. </div>
  41. <div class="pages-wrap" style="margin-top:10px;">
  42. <!-- 列表 -->
  43. <s-table
  44. class="sTable"
  45. ref="table"
  46. size="small"
  47. :rowKey="(record) => record.id"
  48. :columns="columns"
  49. :data="loadData"
  50. :scroll="{ y: 400 }"
  51. :showPagination="false"
  52. bordered>
  53. </s-table>
  54. </div>
  55. </a-spin>
  56. </div>
  57. <div class="btn-cont">
  58. <a-button @click="isShow = false">关闭</a-button>
  59. </div>
  60. <!-- 生成销售单 -->
  61. <commonModal modalTit="" :openModal="showPlModal" @close="showPlModal=false" @ok="createSales">
  62. <div style="display: flex;justify-content: center;margin-bottom: 15px;">
  63. <div style="padding:5px 20px;">产品款数:<span style="color:red;">{{ listData&&listData.length }}</span></div>
  64. <div style="padding:5px 20px;">产品总件数:<span style="color:red;">{{ totalNums }}</span></div>
  65. </div>
  66. <div style="text-align: center;" v-if="salesOrderList.length">
  67. <div style="margin-bottom: 5px;font-size: 14px;">此补货单已经存在对应的销售单</div>
  68. <div style="margin-bottom: 15px;font-size: 14px;"><strong>确认再次生成销售单吗?</strong></div>
  69. <div style="line-height: 24px;">
  70. <div
  71. style="padding:5px;border-bottom: 1px solid #eee;color:#00aaff;cursor: pointer;display: flex;justify-content: space-between;align-items: center;"
  72. v-for="item in salesOrderList"
  73. :key="item.id"
  74. @click="viewSales(item)"
  75. >
  76. <div class="flex-grow:1;padding:0 5px;">{{ item.salesBillNo }};</div>
  77. <div class="padding:0 5px;"><a-icon type="right" style="color:#00aaff;" /></div>
  78. </div>
  79. </div>
  80. </div>
  81. <div style="text-align: center;" v-else>
  82. <div style="margin-bottom: 15px;font-size: 14px;"><strong>确认生成销售单吗?</strong></div>
  83. </div>
  84. </commonModal>
  85. <!-- 销售单详情 -->
  86. <a-modal
  87. centered
  88. class="outboundOrderDetail-modal"
  89. :footer="null"
  90. :maskClosable="false"
  91. :bodyStyle="{padding:'12px'}"
  92. :zIndex="1001"
  93. title="销售单详情"
  94. v-model="openDetailModal"
  95. @cancel="openDetailModal=false"
  96. width="80%">
  97. <div style="max-height: 700px;overflow-y: auto;">
  98. <salesDetailModal v-if="openDetailModal" :outBizSn="orderSn" />
  99. </div>
  100. </a-modal>
  101. </a-modal>
  102. </template>
  103. <script>
  104. import { commonMixin } from '@/utils/mixin'
  105. import { STable, VSelect } from '@/components'
  106. import commonModal from '@/views/common/commonModal.vue'
  107. import salesDetailModal from '@/views/salesManagement/salesQuery/detail.vue'
  108. import { salesDetailBySn } from '@/api/sales'
  109. import { shelfReplenishDetailList, shelfReplenishDetail, queryRelationSalesBill, createSalesBill } from '@/api/shelfReplenish'
  110. export default {
  111. name: 'DetailModal',
  112. components: { STable, VSelect, commonModal, salesDetailModal },
  113. mixins: [commonMixin],
  114. props: {
  115. openModal: { // 弹框显示状态
  116. type: Boolean,
  117. default: false
  118. },
  119. nowData: {
  120. type: Object,
  121. default: () => {
  122. return {}
  123. }
  124. }
  125. },
  126. data () {
  127. return {
  128. isShow: this.openModal, // 是否打开弹框
  129. spinning: false,
  130. disabled: false,
  131. showPlModal: false,
  132. openDetailModal: false,
  133. orderSn: null,
  134. listData: [],
  135. // 表头
  136. columns: [
  137. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  138. { title: '产品编码', dataIndex: 'product.code', width: '22%', align: 'center', customRender: function (text) { return text || '--' } },
  139. { title: '产品名称', dataIndex: 'product.name', width: '28%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  140. { title: '补货数量', dataIndex: 'qty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  141. { title: '签收数量', dataIndex: 'putQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  142. { title: '单位', dataIndex: 'product.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
  143. ],
  144. // 加载数据方法 必须为 Promise 对象
  145. loadData: parameter => {
  146. this.disabled = true
  147. this.spinning = true
  148. return shelfReplenishDetailList({ replenishBillSn: this.nowData.replenishBillSn }).then(res => {
  149. let data
  150. if (res.status == 200) {
  151. data = res.data
  152. for (var i = 0; i < data.length; i++) {
  153. data[i].no = i + 1
  154. }
  155. this.disabled = false
  156. this.listData = data || []
  157. }
  158. this.spinning = false
  159. return data
  160. })
  161. },
  162. localDataSource: [],
  163. detailData: null, // 详情数据
  164. salesOrderList: []
  165. }
  166. },
  167. computed: {
  168. modalTit () {
  169. const hjName = this.nowData && this.nowData.shelfInfo.shelfName ? this.nowData.shelfInfo.shelfName : ''
  170. return '补货单详情 —— ' + hjName
  171. },
  172. totalNums () {
  173. let ret = 0
  174. const isFin = this.detailData && this.detailData.billState == 'FINISH'
  175. this.listData.map(item => {
  176. ret = ret + (isFin ? item.putQty : item.qty)
  177. })
  178. return ret
  179. }
  180. },
  181. methods: {
  182. // 基本信息
  183. getDetail () {
  184. shelfReplenishDetail({ sn: this.nowData.replenishBillSn }).then(res => {
  185. if (res.status == 200) {
  186. this.detailData = res.data
  187. } else {
  188. this.detailData = null
  189. }
  190. })
  191. },
  192. // 查询关联销售单
  193. getSalesOrder () {
  194. queryRelationSalesBill({ replenishBillSn: this.nowData.replenishBillSn }).then(res => {
  195. if (res.status == 200) {
  196. this.salesOrderList = res.data
  197. } else {
  198. this.salesOrderList = []
  199. }
  200. })
  201. },
  202. // 生成销售单
  203. createSales () {
  204. this.spinning = true
  205. this.showPlModal = false
  206. createSalesBill({ replenishBillSn: this.nowData.replenishBillSn }).then(res => {
  207. if (res.status == 200) {
  208. this.$message.info(res.message)
  209. this.getSalesOrder()
  210. }
  211. this.spinning = false
  212. })
  213. },
  214. // 查看销售单详情
  215. viewSales (item) {
  216. salesDetailBySn({ salesBillSn: item.salesBillSn }).then(res => {
  217. if (res.data) {
  218. this.orderSn = item.salesBillSn
  219. this.openDetailModal = true
  220. } else {
  221. this.$message.info('此销售单已被删除!')
  222. }
  223. })
  224. },
  225. pageInit () {
  226. const vm = this
  227. vm.$nextTick(() => {
  228. vm.spinning = false
  229. vm.disabled = false
  230. vm.getSalesOrder()
  231. vm.getDetail()
  232. })
  233. }
  234. },
  235. watch: {
  236. // 父页面传过来的弹框状态
  237. openModal (newValue, oldValue) {
  238. this.isShow = newValue
  239. },
  240. // 重定义的弹框状态
  241. isShow (newValue, oldValue) {
  242. if (!newValue) {
  243. this.$emit('close')
  244. } else {
  245. this.pageInit()
  246. }
  247. }
  248. }
  249. }
  250. </script>
  251. <style lang="less">
  252. .replenishmentManagement-confirm-modal {
  253. .btn-cont {
  254. text-align: center;
  255. margin: 35px 0 10px;
  256. }
  257. }
  258. </style>