detailModal.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <a-modal
  3. centered
  4. class="vinRecord-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. :title="shelfName"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. width="60%">
  11. <!-- 详情 -->
  12. <div v-if="itemData">
  13. <a-descriptions :column="3" size="default">
  14. <a-descriptions-item label="调回单号">{{ itemData.recallBillNo }}</a-descriptions-item>
  15. <a-descriptions-item label="创建时间">{{ itemData.createDate }}</a-descriptions-item>
  16. <a-descriptions-item label="状态" :span="1">{{ itemData.billStateDictValue }}</a-descriptions-item>
  17. <a-descriptions-item label="退库时间">{{ itemData.confirmTime }}</a-descriptions-item>
  18. <a-descriptions-item style="width:calc(100% - 18px);background:red">
  19. <span style="color:rgba(0, 0, 0, 0.85)">关联销售退货单:</span>
  20. <span v-if="salesReturnBillList && salesReturnBillList.length>0">
  21. <span v-for="con in salesReturnBillList" :key="con.id" class="recallBillNo" @click="jumpDetail(con)">{{ con.salesReturnNo }}</span>
  22. </span>
  23. <span v-else>
  24. --
  25. </span>
  26. <a-button type="primary" ghost class="recallBillBtn" @click="seeRecallBill" v-if="itemData.billState != 'CANCEL'">生成销售退货单</a-button>
  27. </a-descriptions-item>
  28. </a-descriptions>
  29. </div>
  30. <!-- 表格 -->
  31. <div class="table-body" v-if="detailList && detailList.length>0">
  32. <a-table
  33. :columns="columns"
  34. :data-source="detailList"
  35. :scroll="{ y: 300 }"
  36. :rowKey="(record) => record.id"
  37. :pagination="false"
  38. :bordered="true"
  39. ></a-table>
  40. </div>
  41. <div class="btn-cont"><a-button id="vinRecord-modal-back" @click="isShow = false">关闭</a-button></div>
  42. <!-- 回调单号提示窗 -->
  43. <a-modal
  44. class="tipPopup"
  45. :maskClosable="false"
  46. v-model="tipVisible"
  47. :centered="true"
  48. :closable="false"
  49. :footer="null"
  50. width="23%">
  51. <div class="tipTop" v-if="itemData">
  52. <div>产品总款数:<span>{{ itemData.totalCategory }}</span></div>
  53. <div>产品总件数:<span>{{ itemData.viewQty }}</span></div>
  54. </div>
  55. <div class="tipCon" v-if="salesReturnBillList && salesReturnBillList.length==0">确认生成销售退货订单吗?</div>
  56. <div v-else>
  57. <div class="tipCon">此调回单已经存在相应的销售退货单,确定再次生成销售退货单吗?</div>
  58. <div class="tipRecallBillNo">
  59. <p v-for="con in salesReturnBillList" :key="con.id" @click="jumpDetail(con)">{{ con.salesReturnNo }}</p>
  60. </div>
  61. </div>
  62. <div class="tipFooter">
  63. <a-button class="btnLeft" type="link" @click="tipVisible = false">
  64. 取消
  65. </a-button>
  66. <a-button class="btnLeft" type="link" @click="setReturnBill" :loading="btnLoading">
  67. 确定
  68. </a-button>
  69. </div>
  70. </a-modal>
  71. </a-modal>
  72. </template>
  73. <script>
  74. import { generateSaleReturnBill } from '@/api/shelfRecall.js'
  75. export default {
  76. name: 'DetailModal',
  77. props: {
  78. openModal: { // 弹框显示状态
  79. type: Boolean,
  80. default: false
  81. },
  82. itemData: {
  83. type: Object,
  84. default: function () {
  85. return []
  86. }
  87. }
  88. },
  89. data () {
  90. return {
  91. isShow: this.openModal, // 是否打开弹框
  92. tipVisible: false,
  93. salesReturnBillList: [],
  94. detailList: [],
  95. btnLoading: false,
  96. columns: [{
  97. title: '序号',
  98. dataIndex: 'no',
  99. width: '10%',
  100. align: 'center'
  101. },
  102. {
  103. title: '产品编码',
  104. dataIndex: 'productCode',
  105. width: '15%',
  106. align: 'center',
  107. customRender: function (text) {
  108. return text || '--'
  109. }
  110. },
  111. {
  112. title: '产品名称',
  113. dataIndex: 'productName',
  114. width: '30%',
  115. align: 'left',
  116. customRender: function (text) {
  117. return text || '--'
  118. },
  119. ellipsis: true
  120. },
  121. {
  122. title: '调回数量',
  123. dataIndex: 'qty',
  124. width: '15%',
  125. align: 'center',
  126. customRender: function (text) {
  127. return text || text == 0 ? text : '--'
  128. }
  129. },
  130. {
  131. title: '实退数量',
  132. dataIndex: 'confirmQty',
  133. width: '15%',
  134. align: 'center',
  135. customRender: function (text) {
  136. return text || text == 0 ? text : '--'
  137. }
  138. },
  139. {
  140. title: '单位',
  141. dataIndex: 'product.unit',
  142. width: '15%',
  143. align: 'center',
  144. customRender: function (text) {
  145. return text || text == 0 ? text : '--'
  146. }
  147. }
  148. ],
  149. shelfName: ''
  150. }
  151. },
  152. watch: {
  153. // 父页面传过来的弹框状态
  154. openModal (newValue, oldValue) {
  155. this.isShow = newValue
  156. },
  157. // 重定义的弹框状态
  158. isShow (newValue, oldValue) {
  159. if (!newValue) {
  160. this.$emit('close')
  161. } else {
  162. if (this.itemData) {
  163. this.salesReturnBillList = this.itemData.salesReturnBillList ? this.itemData.salesReturnBillList : []
  164. this.itemData.detailList.map((con, i) => {
  165. con.no = i + 1
  166. })
  167. this.detailList = this.itemData.detailList
  168. this.shelfName = '调回单详情——' + this.itemData.shelfInfo.shelfName
  169. }
  170. }
  171. }
  172. },
  173. methods: {
  174. seeRecallBill () {
  175. this.tipVisible = true
  176. },
  177. // 生成销售退货单
  178. setReturnBill () {
  179. this.spinning = true
  180. this.btnLoading = true
  181. generateSaleReturnBill({ recallBillSn: this.itemData.recallBillSn }).then(res => {
  182. if (res.status == 200) {
  183. this.$message.success(res.message)
  184. this.tipVisible = false
  185. this.$emit('close')
  186. this.spinning = false
  187. } else {
  188. this.spinning = false
  189. }
  190. this.btnLoading = false
  191. })
  192. },
  193. jumpDetail (row) {
  194. const _this = this
  195. if (row.delFlag == 0) {
  196. _this.isShow = false
  197. _this.tipVisible = false
  198. _this.$router.push({ name: 'salesReturnDetail', params: { id: row.id, sn: row.salesReturnSn } })
  199. } else {
  200. _this.$error({
  201. title: '提示',
  202. content: '此销售退货单已删除,无法查看详情',
  203. centered: true
  204. })
  205. }
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="less">
  211. .vinRecord-modal{
  212. .ant-modal-body {
  213. padding: 40px 40px 24px;
  214. }
  215. .ant-modal-title{
  216. font-weight: 600;
  217. }
  218. .btn-cont {
  219. text-align: center;
  220. margin: 35px 0 10px;
  221. }
  222. .table-body{
  223. margin-top:10px;
  224. // table{
  225. // th,td{
  226. // text-align: center;
  227. // padding: 5px;
  228. // border:1px solid #ddd;
  229. // }
  230. // th{
  231. // background:#f8f8f8;
  232. // }
  233. // }
  234. }
  235. .recallBillNo{
  236. color:#39f;
  237. font-weight: 600;
  238. cursor: pointer;
  239. }
  240. .recallBillNo:not(:last-child)::after{
  241. content:',';
  242. }
  243. .recallBillBtn{
  244. border-color:#39f;
  245. color:#39f;
  246. margin-left: 20px;
  247. &:hover, &:focus {
  248. border-color: #52a6fb;
  249. color: #52a6fb;
  250. }
  251. }
  252. .ant-descriptions-item{
  253. vertical-align: top;
  254. }
  255. }
  256. // 弹窗
  257. .tipPopup{
  258. .ant-modal-body{
  259. padding:0 !important;
  260. }
  261. text-align: center;
  262. .tipTop{
  263. width:62%;
  264. display: flex;
  265. algin-item:center;
  266. padding:20px 0;
  267. box-sizing: border-box;
  268. justify-content: space-between;
  269. color:#333;
  270. margin:0 auto;
  271. span{
  272. color:#f30f30;
  273. font-weight: bold;
  274. }
  275. }
  276. .tipCon{
  277. width:62%;
  278. margin: 0 auto 30px;
  279. text-align: center;
  280. }
  281. .tipRecallBillNo{
  282. padding:0 20px;
  283. p{
  284. padding-bottom: 15px;
  285. border-bottom: 1px solid #e0e0e0;
  286. }
  287. }
  288. .tipFooter{
  289. display: flex;
  290. algin-item:center;
  291. border-top:1px solid #e0e0e0;
  292. :hover{
  293. }
  294. .btnLeft{
  295. width:50%;
  296. text-align: center;
  297. height:46px;
  298. line-height: 46px;
  299. color:#39f;
  300. &:first-child{
  301. border-right:1px solid #e0e0e0;
  302. }
  303. }
  304. }
  305. }
  306. </style>