detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="storeTransferOutDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutDetail-back" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle" v-if="!outBizSn">
  7. <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack">
  8. <a-icon type="left" />
  9. 返回列表
  10. </a>
  11. <a-button
  12. v-if="isEdit && $hasPermissions('B_storeCallOutEdit')"
  13. type="primary"
  14. size="small"
  15. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  16. id="storeTransferOutDetail-edit-btn"
  17. @click.stop="handleEdit"
  18. >
  19. 编辑
  20. </a-button>
  21. </template>
  22. <!-- 操作区,位于 title 行的行尾 -->
  23. <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_storeCallOutPrint')">
  24. <a-checkbox key="4" v-if="$hasPermissions('M_ShowAllCost')" v-model="printCostChecked">打印成本</a-checkbox>
  25. <Print :disabled="localDataSource.length == 0" :showExport="false" @handlePrint="handlePrint"></Print>
  26. </template>
  27. </a-page-header>
  28. <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont" v-if="basicInfoData">
  29. <a-collapse :activeKey="['1']">
  30. <a-collapse-panel key="1" header="基础信息">
  31. <a-descriptions :column="3">
  32. <a-descriptions-item label="调往对象名称">
  33. {{
  34. (basicInfoData.putPersonType == 'EMPLOYEE'
  35. ? basicInfoData.putPersonName
  36. : basicInfoData.customerNameCurrent == basicInfoData.putPersonName
  37. ? basicInfoData.customerNameCurrent
  38. : basicInfoData.customerNameCurrent + '(' + basicInfoData.putPersonName + ')') || '--'
  39. }}
  40. </a-descriptions-item>
  41. <a-descriptions-item label="店内调出单号">{{ basicInfoData.storeCallOutNo || '--' }}</a-descriptions-item>
  42. <a-descriptions-item label="业务状态">{{ basicInfoData.stateDictValue || '--' }}</a-descriptions-item>
  43. <a-descriptions-item label="财务状态">{{ basicInfoData.settleStateDictValue || '--' }}</a-descriptions-item>
  44. <a-descriptions-item label="调拨类型">{{ basicInfoData.callOutTypeName || '--' }}</a-descriptions-item>
  45. <a-descriptions-item label="备注">{{ basicInfoData.remark || '--' }}</a-descriptions-item>
  46. </a-descriptions>
  47. </a-collapse-panel>
  48. </a-collapse>
  49. </a-card>
  50. <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
  51. <!-- 总计 -->
  52. <a-alert type="info" style="margin-bottom:10px">
  53. <div slot="message">
  54. 总款数
  55. <strong>{{ productTotal && (productTotal.productTotalCategory || productTotal.productTotalCategory == 0) ? productTotal.productTotalCategory : '--' }}</strong>
  56. , 总数量
  57. <strong>{{ productTotal && (productTotal.productTotalQty || productTotal.productTotalQty == 0) ? productTotal.productTotalQty : '--' }}</strong>
  58. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  59. ,总成本
  60. <strong>{{ productTotal && (productTotal.productTotalCost || productTotal.productTotalCost == 0) ? toThousands(productTotal.productTotalCost, 2) : '--' }}</strong>
  61. </div>
  62. </div>
  63. </a-alert>
  64. <!-- 列表 -->
  65. <s-table
  66. class="sTable"
  67. ref="table"
  68. size="small"
  69. :rowKey="record => record.id"
  70. :columns="columns"
  71. :data="loadData"
  72. :defaultLoadData="false"
  73. bordered>
  74. <div slot="costTitle">
  75. <a-tooltip placement="top">
  76. <template slot="title">
  77. 系统中不同批次的产品,成本价可能不同,此值是按照实际出库批次的成本计算得到。
  78. </template>
  79. <span style="margin-right: 5px;">实际总成本</span>
  80. <a-icon type="question-circle" />
  81. </a-tooltip>
  82. </div>
  83. <!-- 操作 -->
  84. <template slot="action" slot-scope="text, record">
  85. <a-button size="small" type="link" class="button-primary" @click="handleViewDetail(record)">出库明细</a-button>
  86. </template>
  87. </s-table>
  88. <!-- 出入库明细 -->
  89. <outInDetialModal ref="outInDetialModal" outBizType="SHOP_CALL_OUT" :openModal="showOutInModal" @close="showOutInModal = false"></outInDetialModal>
  90. </a-card>
  91. </a-spin>
  92. </div>
  93. </template>
  94. <script>
  95. import { commonMixin } from '@/utils/mixin'
  96. import { STable, VSelect } from '@/components'
  97. import { getOperationalPrecision } from '@/libs/tools.js'
  98. import { storeCallOutDetailList, storeCallOutDetailCount, storeCallOutDetailSn, storeCallOutDetailPrint } from '@/api/storeCallOut'
  99. import Print from '@/views/common/print.vue'
  100. import outInDetialModal from '@/views/common/outInDetialModal.vue'
  101. import { hdPrint } from '@/libs/JGPrint'
  102. export default {
  103. name: 'StoreCallOutDetail',
  104. components: { STable, VSelect, Print, outInDetialModal },
  105. mixins: [commonMixin],
  106. props: {
  107. outBizSn: {
  108. // 有值则为弹框,无值则为页面
  109. type: [Number, String],
  110. default: ''
  111. }
  112. },
  113. data () {
  114. return {
  115. spinning: false,
  116. showOutInModal: false,
  117. // 加载数据方法 必须为 Promise 对象
  118. loadData: parameter => {
  119. this.spinning = true
  120. return storeCallOutDetailList(Object.assign(parameter, { storeCallOutSn: this.outBizSn || this.$route.params.sn })).then(res => {
  121. let data
  122. if (res.status == 200) {
  123. data = res.data
  124. const no = (data.pageNo - 1) * data.pageSize
  125. for (var i = 0; i < data.list.length; i++) {
  126. data.list[i].no = no + i + 1
  127. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  128. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
  129. }
  130. this.localDataSource = data.list
  131. }
  132. this.spinning = false
  133. return data
  134. })
  135. },
  136. localDataSource: [],
  137. basicInfoData: null, // 基本信息
  138. productTotal: null, // 合计
  139. printCostChecked: true // 打印成本
  140. }
  141. },
  142. computed: {
  143. isEdit () {
  144. return (
  145. ((this.basicInfoData && this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')) &&
  146. this.$hasPermissions('B_storeCallOutEdit')
  147. )
  148. },
  149. columns () {
  150. const _this = this
  151. const arr = [
  152. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  153. {
  154. title: '产品编码',
  155. dataIndex: 'productCode',
  156. width: '22%',
  157. align: 'center',
  158. customRender: function (text) {
  159. return text || '--'
  160. }
  161. },
  162. {
  163. title: '产品名称',
  164. dataIndex: 'productName',
  165. width: '22%',
  166. align: 'left',
  167. customRender: function (text) {
  168. return text || '--'
  169. },
  170. ellipsis: true
  171. },
  172. {
  173. title: '单位',
  174. dataIndex: 'productUnit',
  175. width: '6%',
  176. align: 'center',
  177. customRender: function (text) {
  178. return text || '--'
  179. }
  180. },
  181. // { title: '成本价(¥)', dataIndex: 'outCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  182. {
  183. title: '调出仓库',
  184. dataIndex: 'warehouseName',
  185. width: '12%',
  186. align: 'center',
  187. customRender: function (text) {
  188. return text || '--'
  189. }
  190. },
  191. {
  192. title: '调出仓位',
  193. dataIndex: 'warehouseLocationName',
  194. width: '12%',
  195. align: 'center',
  196. customRender: function (text) {
  197. return text || '--'
  198. }
  199. },
  200. {
  201. title: '调出数量',
  202. dataIndex: 'outQty',
  203. width: '10%',
  204. align: 'center',
  205. customRender: function (text) {
  206. return text || text == 0 ? text : '--'
  207. }
  208. },
  209. // { slots: { title: 'costTitle' }, dataIndex: 'totalOutCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  210. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  211. ]
  212. if (this.$hasPermissions('M_ShowAllCost')) {
  213. arr.splice(6, 0, {
  214. slots: { title: 'costTitle' },
  215. dataIndex: 'totalOutCost',
  216. width: '8%',
  217. align: 'right',
  218. customRender: function (text) {
  219. return text || text == 0 ? _this.toThousands(text, 2) : '--'
  220. }
  221. })
  222. }
  223. return arr
  224. }
  225. },
  226. methods: {
  227. // 返回列表
  228. handleBack () {
  229. this.$router.push({ path: '/allocationManagement/storeTransferOut/list' })
  230. },
  231. // 打印预览/快捷打印
  232. handlePrint (type, printerType) {
  233. const _this = this
  234. _this.spinning = true
  235. const url = storeCallOutDetailPrint
  236. const params = {
  237. sn: this.outBizSn || this.$route.params.sn,
  238. type: printerType,
  239. costFlag: this.printCostChecked && this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
  240. }
  241. // 打印或导出
  242. hdPrint(printerType, type, url, params, '店内调出单', function () {
  243. _this.spinning = false
  244. })
  245. },
  246. // 出入库明细
  247. handleViewDetail (row) {
  248. this.showOutInModal = true
  249. this.$refs.outInDetialModal.getData(row)
  250. },
  251. // 基本信息
  252. getDetail () {
  253. storeCallOutDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  254. if (res.status == 200) {
  255. this.basicInfoData = res.data
  256. this.getDetailCount()
  257. } else {
  258. this.basicInfoData = null
  259. }
  260. })
  261. },
  262. // 合计
  263. getDetailCount () {
  264. storeCallOutDetailCount({ storeCallOutSn: this.outBizSn || this.$route.params.sn }).then(res => {
  265. if (res.status == 200) {
  266. this.productTotal = res.data
  267. this.$nextTick(() => {
  268. this.$refs.table.refresh(true)
  269. })
  270. } else {
  271. this.productTotal = null
  272. }
  273. })
  274. },
  275. // 编辑
  276. handleEdit () {
  277. this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${this.basicInfoData.id}/${this.basicInfoData.storeCallOutSn}` })
  278. }
  279. },
  280. mounted () {
  281. this.printCostChecked = true
  282. this.getDetail()
  283. },
  284. activated () {
  285. this.printCostChecked = true
  286. this.getDetail()
  287. },
  288. beforeRouteEnter (to, from, next) {
  289. next(vm => {})
  290. }
  291. }
  292. </script>
  293. <style lang="less">
  294. .storeTransferOutDetail-wrap {
  295. .storeTransferOutDetail-back {
  296. margin-bottom: 10px;
  297. }
  298. .storeTransferOutDetail-cont {
  299. margin-bottom: 10px;
  300. }
  301. }
  302. </style>