detail.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <div v-if="showPage" class="jg-page-wrap onlinePayDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="onlinePayDetail-cont" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle" v-if="!outBizSn && detailData">
  7. <span class="billno">单号:{{ detailData.salesBillNo ||'--' }}</span>
  8. <a-tag color="green" v-if="detailData.billStatusDictValue">{{ detailData.billStatusDictValue }}</a-tag>
  9. <a-tag color="orange" v-if="detailData.financialStatusDictValue">{{ detailData.financialStatusDictValue }}</a-tag>
  10. <a-button type="link" class="button-default" @click="isShowBisiceInfo=!isShowBisiceInfo" style="margin-left:10px;vertical-align:middle;">
  11. <a-icon :type="isShowBisiceInfo ? 'eye-invisible' : 'eye'"/>
  12. {{ isShowBisiceInfo?'隐藏':'查看' }}信息
  13. </a-button>
  14. <a-button id="onlinePayDetail-back-btn" type="link" @click="handleBack" class="button-default"> <a-icon type="rollback" />返回列表</a-button>
  15. </template>
  16. <!-- 操作区,位于 title 行的行尾 -->
  17. <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_onlinePayPrint')">
  18. <div style="margin-top: 5px;">
  19. <PrintPanel ref="printBox" position="bottomRight" :disabled="localDataSource.length==0" @handlePrint="handlePrint">
  20. <div style="padding:10px;line-height: 30px;" slot="extendCons">
  21. <a-checkbox v-model="printAllName" :checked="printAllName" id="onlinePayDetail-printAllName">打印完整产品名称</a-checkbox>
  22. <a-checkbox v-model="printOrgCode" :checked="printOrgCode" id="onlinePayDetail-printOrgCode">打印原厂编码</a-checkbox>
  23. <a-checkbox v-model="printPrice" :checked="printPrice" id="onlinePayDetail-printPrice">打印售价</a-checkbox>
  24. <br>
  25. <a-checkbox v-model="printRemarks" :checked="printRemarks" id="onlinePayDetail-printRemarks">打印备注</a-checkbox>
  26. <!-- <a-checkbox v-model="printNo" :checked="printNo" id="onlinePayDetail-printNo">打印销售单号</a-checkbox> -->
  27. </div>
  28. </PrintPanel>
  29. </div>
  30. </template>
  31. </a-page-header>
  32. <div class="sales-detail-body">
  33. <!-- 基础信息 -->
  34. <a-card size="small" :bordered="false" class="onlinePayDetail-cont" v-show="isShowBisiceInfo">
  35. <a-descriptions size="small" :column="3">
  36. <div slot="title">
  37. <span>基础信息</span>
  38. </div>
  39. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerNameCurrent?detailData.buyerName?detailData.buyerName==detailData.buyerNameCurrent?detailData.buyerNameCurrent:detailData.buyerNameCurrent+'('+detailData.buyerName+')':detailData.buyerNameCurrent:'--' }}</a-descriptions-item>
  40. <a-descriptions-item label="客户地址" :span="2">
  41. <div v-if="detailData&&(detailData.shippingAddressProvinceName || detailData.shippingAddressCityName || detailData.shippingAddressCountyName || detailData.shippingAddress)">
  42. {{ detailData&&detailData.shippingAddressProvinceName || '' }}
  43. {{ detailData&&detailData.shippingAddressCityName || '' }}
  44. {{ detailData&&detailData.shippingAddressCountyName || '' }}
  45. {{ detailData&&detailData.shippingAddress || '' }}
  46. </div>
  47. <span v-else>--</span>
  48. </a-descriptions-item>
  49. <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  50. <a-descriptions-item label="联系电话">{{ detailData&&detailData.consigneeTel || '--' }}</a-descriptions-item>
  51. <a-descriptions-item label="销售单号">{{ detailData&&detailData.salesBillNo || '--' }}</a-descriptions-item>
  52. <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks || '--' }} <a-button
  53. v-if="detailData&&detailData.billStatus=='WAIT_AUDIT'"
  54. type="link"
  55. id="salesReturnGrabEdit-editDesc-btn"
  56. size="small"
  57. @click="openEditModal=true"
  58. class="button-info"
  59. key="0"> <a-icon type="edit"></a-icon> 编辑</a-button></a-descriptions-item>
  60. <a-descriptions-item label="制单人">{{ detailData&&detailData.operatorName || '--' }}</a-descriptions-item>
  61. <a-descriptions-item label="业务员">{{ detailData&&detailData.salesManName || '--' }}</a-descriptions-item>
  62. <a-descriptions-item label="来源">{{ detailData&&detailData.sourceTypeDictValue || '--' }}</a-descriptions-item>
  63. <a-descriptions-item label="下级采购单号" v-if="detailData&&detailData.sourceType=='PURCHASE'">{{ detailData&&detailData.purchaseBillNo || '--' }}</a-descriptions-item>
  64. <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  65. <a-descriptions-item label="财务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
  66. <a-descriptions-item label="采购单号" v-if="detailData&&detailData.sourceType!='SALES'">{{ detailData.purchaseBillNo || '--' }}</a-descriptions-item>
  67. <a-descriptions-item label="收货状态" v-if="detailData&&detailData.sourceType!='TEMPORARY_DISPATCHING'&&detailData.sourceType!='SALES'&&detailData.billStatus=='FINISH'">{{ detailData.receiptStatusDictValue || '--' }}</a-descriptions-item>
  68. </a-descriptions>
  69. </a-card>
  70. <a-card size="small" :bordered="false" class="pages-wrap">
  71. <!-- alert -->
  72. <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom:10px;">
  73. <div>
  74. 总款数:<strong>{{ detailData&&(detailData.totalCategory || detailData.totalCategory==0) ? detailData.totalCategory : '--' }}</strong>;
  75. 总数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
  76. 总赠品数量:<strong>{{ detailData&&(detailData.giftQty || detailData.giftQty==0) ? detailData.giftQty : '--' }}</strong>;
  77. 急件总款数:<strong>{{ detailData&&(detailData.oosCategory || detailData.oosCategory==0) ? detailData.oosCategory : '--' }}</strong>;
  78. 急件总数量:<strong>{{ detailData&&(detailData.oosQty || detailData.oosQty==0) ? detailData.oosQty : '--' }}</strong>;<br/>
  79. 总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;
  80. <template v-if="!showCell.includes('totalCost')">
  81. 总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;
  82. 总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;
  83. </template>
  84. <span>实收总售价:<strong>{{ detailData&&(detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount) : '--' }}</strong>;</span>
  85. <span v-if="detailData&&detailData.sourceType&&detailData.sourceType==='XPRH_PURCHASE'"> 返券金额:<strong>{{ detailData&&(detailData.totalGiveAmount || detailData.totalGiveAmount==0) ? toThousands(detailData.totalGiveAmount) : '--' }}</strong>;</span>
  86. <span>抵扣金额:<strong>{{ detailData&&(detailData.subsidyAmount || detailData.subsidyAmount==0) ? toThousands(detailData.subsidyAmount) : '--' }}</strong>;</span>
  87. </div>
  88. <div>
  89. <hideCellMenus id="onlinePayOrderList-showCellMenus" placeholder="显示" :defHiddenKes="colsArr" v-model="showCell"></hideCellMenus>
  90. </div>
  91. </div>
  92. <!-- 列表 -->
  93. <s-table
  94. class="sTable"
  95. ref="table"
  96. size="small"
  97. :rowKey="(record) => record.id"
  98. :columns="columns"
  99. :data="loadData"
  100. :defaultLoadData="false"
  101. bordered>
  102. <div slot="costTitle">
  103. <a-tooltip placement="top">
  104. <template slot="title">
  105. 系统中不同批次的产品,成本价可能不同,此值是按照实际出库批次的成本计算得到。
  106. </template>
  107. <span style="margin-right: 5px;">实际总成本</span> <a-icon type="question-circle" />
  108. </a-tooltip>
  109. </div>
  110. <!-- 产品编码 -->
  111. <template slot="productCode" slot-scope="text, record">
  112. <div v-if="detailData">
  113. <span>{{ text }}</span>
  114. <a-badge count="急" v-if="(isOwerEdit&&record.oosFlag == 1) || (!isOwerEdit&&isAudit&&record.oosFlag == 1)" :number-style="{ zoom:'80%',marginLeft:'5px' }"></a-badge>
  115. <a-badge count="缺" v-if="!isOwerEdit&&!isAudit&&(!record.currentStockQty || record.currentStockQty < record.qty)" :number-style="{ zoom:'80%',marginLeft:'5px' }"></a-badge>
  116. <a-badge count="赠" v-if="record.promoProductType=='GIFT_PRODUCT'" :number-style="{ backgroundColor: '#52c41a', zoom:'80%',marginLeft:'5px' }"></a-badge>
  117. <a-badge count="券" v-if="record.promoProductType=='TICKET_PRODUCT'" :number-style="{ backgroundColor: '#FF5500', zoom:'80%',marginLeft:'5px' }"></a-badge>
  118. <a-badge count="特" v-if="record.promoProductType=='SPECIAL_PRODUCT'" :number-style="{ backgroundColor: '#FED714',zoom:'80%',marginLeft:'5px' }"></a-badge>
  119. </div>
  120. </template>
  121. <!-- 操作 -->
  122. <template slot="action" slot-scope="text, record">
  123. <a-button
  124. :id="'sales-detail-out-'+record.id"
  125. size="small"
  126. type="link"
  127. v-if="record.oosFlag == 0 && (isOwerEdit || isAudit)"
  128. class="button-primary"
  129. @click="handleViewDetail(record)">出库明细</a-button>
  130. <span v-else>--</span>
  131. </template>
  132. </s-table>
  133. </a-card>
  134. </div>
  135. </a-spin>
  136. <!-- 出入库明细 -->
  137. <outInDetialModal ref="outInDetialModal" outBizType="SALES" :openModal="showOutInModal" @close="showOutInModal=false"></outInDetialModal>
  138. <!-- 编辑备注 -->
  139. <editRemarkModal
  140. :openModal="openEditModal"
  141. :itemSn="$route.params.sn"
  142. :mainContent="detailData&&detailData.remarks"
  143. @close="openEditModal=false"
  144. @ok="handleEditOk"></editRemarkModal>
  145. </div>
  146. </template>
  147. <script>
  148. import { commonMixin } from '@/utils/mixin'
  149. import { getOperationalPrecision } from '@/libs/tools.js'
  150. import { hdPrint } from '@/libs/JGPrint'
  151. // 组件
  152. import { STable, VSelect } from '@/components'
  153. import editRemarkModal from './editRemarkModal.vue'
  154. import PrintPanel from '@/views/common/printPanel.vue'
  155. import outInDetialModal from '../salesQueryNew/outInDetialModal.vue'
  156. import hideCellMenus from '@/views/common/hideCellMenus'
  157. // 接口
  158. import { salesDetailBySn, salesDetailPrint, salesDetailExport } from '@/api/sales'
  159. import { salesDetailList } from '@/api/salesDetail'
  160. export default {
  161. name: 'OnlinePayOrderDetail',
  162. components: { STable, VSelect, PrintPanel, editRemarkModal, outInDetialModal, hideCellMenus },
  163. mixins: [commonMixin],
  164. props: {
  165. outBizSn: { // 有值则为弹框,无值则为页面
  166. type: [Number, String],
  167. default: ''
  168. }
  169. },
  170. data () {
  171. return {
  172. showPage: false, // 是否显示组件
  173. spinning: false,
  174. disabled: false,
  175. printOrgCode: false, // 是否打印原创编码
  176. printAllName: false, // 是否打印全部名称
  177. printRemarks: false, // 是否打印备注
  178. printPrice: false, // 是否打印价格
  179. printNo: true, // 是否打印销售单号
  180. showOutInModal: false, // 出库明细弹框
  181. openEditModal: false, // 打开编辑备注弹窗
  182. // 加载数据方法 必须为 Promise 对象
  183. loadData: parameter => {
  184. this.disabled = true
  185. return salesDetailList(Object.assign(parameter, { salesBillSn: this.outBizSn || this.$route.params.sn })).then(res => {
  186. let data
  187. if (res.status == 200) {
  188. data = res.data
  189. const no = (data.pageNo - 1) * data.pageSize
  190. for (var i = 0; i < data.list.length; i++) {
  191. data.list[i].no = no + i + 1
  192. const productCode = (data.list[i].productEntity && data.list[i].productEntity.code) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.code)
  193. const productName = (data.list[i].productEntity && data.list[i].productEntity.name) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.name)
  194. const productOrigCode = (data.list[i].productEntity && data.list[i].productEntity.origCode) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.origCode) || '--'
  195. const productOrigUnit = (data.list[i].productEntity && data.list[i].productEntity.unit) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.unit)
  196. data.list[i].productCode = productCode || '--'
  197. data.list[i].productName = productName || '--'
  198. data.list[i].productOrigCode = productOrigCode || '--'
  199. data.list[i].productOrigUnit = productOrigUnit || '--'
  200. data.list[i].warehouseName = data.list[i].warehouseEntity && data.list[i].warehouseEntity.name || '--'
  201. data.list[i].warehouseLocationName = data.list[i].warehouseLocationEntity && data.list[i].warehouseLocationEntity.name || '--'
  202. // 售价小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  203. data.list[i].salePriceSubtotal = getOperationalPrecision(data.list[i].price, data.list[i].qty)
  204. }
  205. this.localDataSource = data.list
  206. this.disabled = false
  207. }
  208. return data
  209. })
  210. },
  211. localDataSource: [], // 原始列表数据
  212. detailData: null, // 详情数据
  213. isShowBisiceInfo: false, // 显示基础内容
  214. colsArr: [// 需要显示的列
  215. {
  216. title: '成本价',
  217. key: 'totalCost',
  218. disabled: false,
  219. checked: false
  220. },
  221. {
  222. title: '抵扣金额',
  223. key: 'subsidyAmount',
  224. disabled: false,
  225. checked: false
  226. },
  227. {
  228. title: '返券金额',
  229. key: 'giveAmount',
  230. disabled: false,
  231. checked: false
  232. }
  233. ],
  234. showCell: []// 已选要显示的列
  235. }
  236. },
  237. computed: {
  238. // 是否自建单据
  239. isOwerEdit () {
  240. return this.detailData && this.detailData.sourceType == 'SALES'
  241. },
  242. // 是否审核通过
  243. isAudit () {
  244. return this.detailData ? (this.detailData.billStatus == 'WAIT_OUT_WAREHOUSE' || this.detailData.billStatus == 'FINISH') : false
  245. },
  246. // 列定义
  247. columns () {
  248. const _this = this
  249. const arr = [
  250. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  251. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '11%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
  252. { title: '产品名称', dataIndex: 'productName', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  253. { title: '原厂编码', dataIndex: 'productOrigCode', width: '9%', align: 'center', customRender: function (text) { return text && text != ' ' ? text : '--' } },
  254. { title: '售价', dataIndex: 'price', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  255. { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  256. { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  257. { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  258. ]
  259. arr.push({ title: '抵扣金额', dataIndex: 'subsidyAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  260. if (this.detailData && this.detailData.sourceType && this.detailData.sourceType === 'XPRH_PURCHASE') {
  261. arr.push({ title: '返券金额', dataIndex: 'giveAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  262. }
  263. // 实际总成本
  264. arr.push({ slots: { title: 'costTitle' }, dataIndex: 'totalCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  265. // 下级创建,不显示仓库仓位
  266. if (!this.isOwerEdit) {
  267. arr.push({ title: '库存数量', dataIndex: 'currentStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  268. }
  269. arr.push({ title: '是否急件', dataIndex: 'oosFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
  270. arr.push({ title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' })
  271. return arr.filter(item => !this.showCell.includes(item.dataIndex))
  272. }
  273. },
  274. methods: {
  275. handleEditOk () {
  276. this.openEditModal = false
  277. this.getDetail()
  278. },
  279. // 打印预览/快捷打印
  280. handlePrint (type, printerType) {
  281. const _this = this
  282. _this.spinning = true
  283. let url = salesDetailPrint
  284. const params = {
  285. sn: this.outBizSn || this.$route.params.sn,
  286. printOrgCode: this.printOrgCode ? 1 : 0,
  287. printAllName: this.printAllName ? 1 : 0,
  288. remarksShowFlag: this.printRemarks ? 1 : 0,
  289. printNo: this.printNo ? 1 : 0,
  290. priceFlag: this.printPrice ? 1 : 0
  291. }
  292. if (type == 'export') { // 导出
  293. url = salesDetailExport
  294. }
  295. // 打印或导出
  296. hdPrint(printerType, type, url, params, '销售单', function () {
  297. _this.spinning = false
  298. })
  299. },
  300. // 返回
  301. handleBack () {
  302. this.$router.push({ name: 'onlinePayOrder' })
  303. },
  304. // 详情
  305. getDetail () {
  306. salesDetailBySn({ salesBillSn: this.outBizSn || this.$route.params.sn }).then(res => {
  307. if (res.status == 200) {
  308. this.detailData = res.data
  309. } else {
  310. this.detailData = null
  311. }
  312. })
  313. },
  314. // 打开出入库明细
  315. handleViewDetail (row) {
  316. this.showOutInModal = true
  317. this.$refs.outInDetialModal.getData(row)
  318. },
  319. // 页面初始
  320. pageInit () {
  321. const vm = this
  322. vm.$nextTick(() => {
  323. vm.spinning = false
  324. vm.disabled = false
  325. // 是否默认打印原厂编码
  326. vm.printOrgCode = localStorage.getItem('printOrgCode-' + this.$store.state.user.info.orgId) == 'true'
  327. vm.printAllName = localStorage.getItem('printAllName-' + this.$store.state.user.info.orgId) == 'true'
  328. vm.printRemarks = localStorage.getItem('printRemarks-' + this.$store.state.user.info.orgId) == 'true'
  329. vm.printPrice = localStorage.getItem('printPrice-' + this.$store.state.user.info.orgId) == 'true'
  330. const printNo = localStorage.getItem('printNo-' + this.$store.state.user.info.orgId)
  331. console.log(printNo)
  332. vm.printNo = printNo ? printNo == 'true' : true
  333. // 查询列表
  334. vm.$refs.table.refresh(true)
  335. // 获取单据详情
  336. vm.getDetail()
  337. })
  338. }
  339. },
  340. watch: {
  341. // 打印选项变化
  342. printOrgCode (newValue, oldValue) {
  343. localStorage.setItem('printOrgCode-' + this.$store.state.user.info.orgId, newValue)
  344. },
  345. printRemarks (newValue, oldValue) {
  346. localStorage.setItem('printRemarks-' + this.$store.state.user.info.orgId, newValue)
  347. },
  348. printPrice (newValue, oldValue) {
  349. localStorage.setItem('printPrice-' + this.$store.state.user.info.orgId, newValue)
  350. },
  351. printAllName (newValue, oldValue) {
  352. localStorage.setItem('printAllName-' + this.$store.state.user.info.orgId, newValue)
  353. },
  354. printNo (newValue, oldValue) {
  355. localStorage.setItem('printNo-' + this.$store.state.user.info.orgId, newValue)
  356. }
  357. },
  358. mounted () {
  359. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新时调用
  360. this.showPage = true
  361. this.pageInit()
  362. }
  363. },
  364. activated () {
  365. this.showPage = true
  366. this.pageInit()
  367. },
  368. beforeRouteEnter (to, from, next) {
  369. next(vm => {
  370. })
  371. }
  372. }
  373. </script>
  374. <style lang="less" scoped>
  375. .onlinePayDetail-wrap{
  376. position: relative;
  377. height: 100%;
  378. .billno{
  379. font-size: 16px;
  380. font-weight: 600;
  381. display: inline-block;
  382. vertical-align: middle;
  383. color: #333;
  384. margin-right: 15px;
  385. }
  386. .ant-tag-green,.ant-tag-orange{
  387. vertical-align: middle;
  388. }
  389. .onlinePayDetail-cont{
  390. margin-bottom: 10px;
  391. /deep/ .ant-descriptions-title{
  392. margin-bottom: 10px;
  393. }
  394. }
  395. .pages-wrap{
  396. strong{
  397. color:#f12929;
  398. }
  399. }
  400. }
  401. </style>