detailModal.vue 8.9 KB

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