detail.vue 11 KB

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