detail.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <div class="pushOrder-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont" :style="{marginBottom:!outBizSubSn&&!bizSn?'6px':'0px'}">
  5. <template slot="subTitle" v-if="!outBizSubSn&&!bizSn">
  6. <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
  7. <span style="margin: 0 15px;color: #666;font-weight: bold;">单号:{{ detailData&&detailData.dispatchBillNo }}</span>
  8. <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
  9. <a-button type="link" size="small" class="button-default" @click="showDetail=!showDetail">
  10. <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
  11. </a-button>
  12. </template>
  13. <template slot="extra">
  14. <a-button
  15. key="4"
  16. type="primary"
  17. class="button-info"
  18. id="salesDetail-fhdy-print-btn"
  19. :disabled="localDataSource.length==0"
  20. v-if="$hasPermissions('B_dispatchPrint')"
  21. @click="handlePrint('DISPATCH_BILL')">发货打印</a-button>
  22. <a-button
  23. key="3"
  24. type="primary"
  25. class="button-info"
  26. id="salesDetail-fhfl-print-btn"
  27. :disabled="localDataSource.length==0"
  28. @click="handlePrint('DISPATCH_BILL_TYPE')">发货分类打印</a-button>
  29. <a-divider type="vertical" />
  30. <a-button
  31. key="2"
  32. type="default"
  33. class="button-info"
  34. id="purchaseOrderDetail-export-btn"
  35. :disabled="localDataSource.length==0"
  36. v-if="$hasPermissions('B_dispatchExport')"
  37. @click="openExcelModal=true">导出Excel</a-button>
  38. <a-button
  39. key="1"
  40. type="default"
  41. class="button-info"
  42. id="salesDetail-fhfl-print-btn"
  43. :disabled="localDataSource.length==0"
  44. v-if="$hasPermissions('B_dispatchTypeExport')"
  45. @click="handleFlExport('DISPATCH_BILL_TYPE')">发货分类导出</a-button>
  46. </template>
  47. </a-page-header>
  48. <!-- 基础信息 -->
  49. <a-card size="small" :bordered="false" class="salesDetail-cont" v-show="showDetail">
  50. <div>
  51. <a-descriptions size="small" :column="3">
  52. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  53. <a-descriptions-item label="销售单号">{{ detailData&&detailData.salesBillNo || '--' }}</a-descriptions-item>
  54. <a-descriptions-item label="备货单号">{{ detailData&&detailData.dispatchBillNo || '--' }}</a-descriptions-item>
  55. <a-descriptions-item label="收货客户名称">{{ detailData&&detailData.receiverName || '--' }}</a-descriptions-item>
  56. <a-descriptions-item label="发货编号">{{ detailData&&detailData.sendNo || '--' }}</a-descriptions-item>
  57. <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  58. <a-descriptions-item label="收货人" v-if="detailData&&detailData.salesBillExtEntity">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
  59. <a-descriptions-item label="收货电话" v-if="detailData&&detailData.salesBillExtEntity">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
  60. <a-descriptions-item label="收货地址" :span="2" v-if="detailData&&detailData.salesBillExtEntity">
  61. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddrProvinceName || '' }}
  62. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddrCityName || '' }}
  63. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddrCountyName || '' }}
  64. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddr || '' }}
  65. </a-descriptions-item>
  66. <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  67. <a-descriptions-item label="备注">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
  68. </a-descriptions>
  69. </div>
  70. </a-card>
  71. <!-- 弹框基础信息 -->
  72. <div style="padding: 10px 12px 0 12px" v-show="outBizSubSn||bizSn">
  73. <a-collapse :activeKey="['1']">
  74. <a-collapse-panel key="1" header="基础信息">
  75. <a-descriptions size="small" :column="3">
  76. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  77. <a-descriptions-item label="销售单号">{{ detailData&&detailData.salesBillNo || '--' }}</a-descriptions-item>
  78. <a-descriptions-item label="备货单号">{{ detailData&&detailData.dispatchBillNo || '--' }}</a-descriptions-item>
  79. <a-descriptions-item label="收货客户名称">{{ detailData&&detailData.receiverName || '--' }}</a-descriptions-item>
  80. <a-descriptions-item label="发货编号">{{ detailData&&detailData.sendNo || '--' }}</a-descriptions-item>
  81. <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  82. <a-descriptions-item label="收货人" v-if="detailData&&detailData.salesBillExtEntity">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
  83. <a-descriptions-item label="收货电话" v-if="detailData&&detailData.salesBillExtEntity">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
  84. <a-descriptions-item label="收货地址" :span="2" v-if="detailData&&detailData.salesBillExtEntity">
  85. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddrProvinceName || '' }}
  86. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddrCityName || '' }}
  87. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddrCountyName || '' }}
  88. {{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.shippingAddr || '' }}
  89. </a-descriptions-item>
  90. <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  91. <a-descriptions-item label="备注">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
  92. </a-descriptions>
  93. </a-collapse-panel>
  94. </a-collapse>
  95. </div>
  96. <a-card size="small" :bordered="false" class="pages-wrap">
  97. <!-- 统计信息 -->
  98. <a-alert type="info" style="margin-bottom: 10px;" v-if="detailData!=null">
  99. <div slot="message">
  100. <span v-if="$route.params.type!='stockOut'">
  101. 总销售数量:<strong>{{ detailData&&(detailData.totalSalesQty || detailData.totalSalesQty==0) ? detailData.totalSalesQty : '--' }}</strong>;
  102. </span>
  103. 本次下推数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
  104. <span v-if="$hasPermissions('B_dispatchDetail_salesPrice')">本次下推金额:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
  105. <span v-if="$route.params.type!='stockOut'&&$hasPermissions('B_dispatchDetail_cityPrice')">
  106. 本次下推市级价金额:<strong>{{ detailData&&(detailData.totalCityAmount || detailData.totalCityAmount==0) ? toThousands(detailData.totalCityAmount) : '--' }}</strong>;
  107. </span>
  108. <span v-if="$route.params.type!='stockOut'&&$hasPermissions('B_dispatchDetail_cityPrice')">
  109. 合计重量(kg):<strong>{{ detailData&&(detailData.totalWeight || detailData.totalWeight==0) ? detailData.totalWeight : '--' }}</strong>;
  110. </span>
  111. </div>
  112. </a-alert>
  113. <!-- 列表 -->
  114. <s-table
  115. class="sTable"
  116. :class="outBizSubSn||bizSn?'':'fixPagination'"
  117. :style="{ height: outBizSubSn||bizSn ? 'auto' : tableHeight+65+'px' }"
  118. ref="table"
  119. size="small"
  120. :rowKey="(record) => record.no"
  121. rowKeyName="no"
  122. :pageSize="30"
  123. :columns="($route.params.type=='stockOut' || outBizSubSn) ? outColumns : columns"
  124. :data="loadData"
  125. :scroll="{ y: tableHeight }"
  126. :defaultLoadData="false"
  127. bordered>
  128. <!-- 产品编码 -->
  129. <template slot="productCode" slot-scope="text, record">
  130. <span>{{ text }}</span>
  131. <a-badge count="促" v-if="record.promotionFlag=='GIFT'" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
  132. <a-badge count="特" v-if="record.promotionFlag=='DISCOUNT'" :number-style="{ backgroundColor: '#faad14', zoom:'80%' }"></a-badge>
  133. </template>
  134. <!-- 销售价 -->
  135. <template slot="price" slot-scope="text, record">
  136. {{ toThousands(text) }}
  137. <span v-if="record.promotionFlag=='GIFT'||record.promotionFlag=='DISCOUNT'" title="原价">({{ toThousands(record.origPrice) }})</span>
  138. </template>
  139. </s-table>
  140. </a-card>
  141. </a-spin>
  142. <!-- 发货分类打印 -->
  143. <sendTypeModal
  144. ref="typePrint"
  145. :hasNoPrint="hasNoPrint"
  146. :nowType="nowType"
  147. :openModal="openModal"
  148. @ok="handlePrintOk"
  149. @close="openModal=false" />
  150. <!-- 导出Excel -->
  151. <export-excel-modal :openModal="openExcelModal" :itemData="detailData" @ok="handleExcelOk" @close="openExcelModal=false" />
  152. <!-- 打印 -->
  153. <div id="print"></div>
  154. </div>
  155. </template>
  156. <script>
  157. import { commonMixin } from '@/utils/mixin'
  158. import { STable, VSelect } from '@/components'
  159. import sendTypeModal from './sendTypeModal.vue'
  160. import exportExcelModal from './exportExcelModal.vue'
  161. import { printBase64Fun, exportExcel } from '@/libs/JGPrint.js'
  162. import { dispatchDetaillList, dispatchFindBySn, dispatchDetailPrint, dispatchDetailExcel } from '@/api/dispatch'
  163. export default {
  164. name: 'PushOrderDetail',
  165. mixins: [commonMixin],
  166. components: { STable, VSelect, sendTypeModal, exportExcelModal },
  167. props: {
  168. outBizSubSn: { // 有值则为弹框,无值则为页面
  169. type: [Number, String],
  170. default: ''
  171. },
  172. bizSn: { // 有值则为弹框,无值则为页面
  173. type: [Number, String],
  174. default: ''
  175. }
  176. },
  177. data () {
  178. return {
  179. disabled: false,
  180. spinning: false,
  181. outColumns: [
  182. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  183. { title: '产品编码', dataIndex: 'productCode', width: '25%', scopedSlots: { customRender: 'productCode' }, align: 'left' },
  184. { title: '产品名称', dataIndex: 'productName', width: '33%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  185. { title: '原厂编码', dataIndex: 'productOrigCode', width: '20%', align: 'left', customRender: function (text) { return text || '--' } },
  186. { title: '单位', dataIndex: 'productOrigUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  187. { title: '本次出库数', dataIndex: 'qty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  188. ],
  189. // 加载数据方法 必须为 Promise 对象
  190. loadData: parameter => {
  191. this.disabled = true
  192. return dispatchDetaillList(Object.assign(parameter, { dispatchBillSn: this.outBizSubSn || this.bizSn || this.$route.params.sn })).then(res => {
  193. let data
  194. if (res.status == 200) {
  195. data = res.data
  196. const no = (data.pageNo - 1) * data.pageSize
  197. for (var i = 0; i < data.list.length; i++) {
  198. data.list[i].no = no + i + 1
  199. const productCode = (data.list[i].productEntity && data.list[i].productEntity.code) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.code)
  200. const productName = (data.list[i].productEntity && data.list[i].productEntity.name) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.name)
  201. const productOrigCode = (data.list[i].productEntity && data.list[i].productEntity.origCode) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.origCode)
  202. const productOrigUnit = (data.list[i].productEntity && data.list[i].productEntity.unit) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.unit)
  203. data.list[i].productCode = productCode || '--'
  204. data.list[i].productName = productName || '--'
  205. data.list[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
  206. data.list[i].productOrigUnit = productOrigUnit || '--'
  207. }
  208. this.localDataSource = data.list
  209. this.disabled = false
  210. }
  211. return data
  212. })
  213. },
  214. detailData: null, // 详情数据
  215. openModal: false,
  216. localDataSource: [],
  217. nowPrintType: '', // 当前打印类型
  218. openExcelModal: false,
  219. fromRouter: null,
  220. nowType: 'print',
  221. showDetail: false,
  222. tableHeight: 300
  223. }
  224. },
  225. computed: {
  226. // 以下2中状态下不显示打印按钮
  227. hasNoPrint () {
  228. return this.detailData && (this.detailData.printStatus == 'UNABLE_PRINT' || this.detailData.printStatus == 'CANCEL_PRINT')
  229. },
  230. columns () {
  231. const arr = [
  232. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  233. { title: '产品编码', dataIndex: 'productCode', width: '10%', scopedSlots: { customRender: 'productCode' }, align: 'left' },
  234. { title: '产品名称', dataIndex: 'productName', width: '23%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  235. { title: '原厂编码', dataIndex: 'productOrigCode', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
  236. { title: '单位', dataIndex: 'productOrigUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  237. // { title: '销售价格', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  238. // { title: '市级销售价格', dataIndex: 'cityPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  239. { title: '销售数量', dataIndex: 'salesQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  240. { title: '本次下推数', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  241. { title: '合计重量(kg)', dataIndex: 'totalWeight', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  242. // { title: '本次下推金额', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  243. ]
  244. if (this.$hasPermissions('B_dispatchDetail_salesPrice')) { // 售价权限
  245. arr.splice(5, 0, { title: '销售价格', dataIndex: 'price', width: '8%', align: 'right', scopedSlots: { customRender: 'price' } })
  246. arr.splice(8, 0, { title: '本次下推金额', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  247. }
  248. if (this.$hasPermissions('B_dispatchDetail_cityPrice')) { // 市级权限
  249. arr.splice(6, 0, { title: '市级销售价格', dataIndex: 'cityPrice', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  250. }
  251. return arr
  252. }
  253. },
  254. watch: {
  255. showDetail (newValue, oldValue) {
  256. this.getTableHeight()
  257. }
  258. },
  259. methods: {
  260. // 返回
  261. handleBack () {
  262. this.$router.push({ name: 'pushOrderManagementList' })
  263. },
  264. // 计算表格高度
  265. getTableHeight () {
  266. this.tableHeight = this.outBizSubSn || this.bizSn ? 300 : (window.innerHeight - (this.showDetail ? 403 : 265))
  267. },
  268. // 详情
  269. getDetail () {
  270. dispatchFindBySn({ dispatchBillSn: this.outBizSubSn || this.bizSn || this.$route.params.sn }).then(res => {
  271. if (res.status == 200) {
  272. this.detailData = res.data
  273. } else {
  274. this.detailData = null
  275. }
  276. this.getTableHeight()
  277. })
  278. },
  279. // 导出Excel
  280. handleExcelOk (priceType, data, fileName) {
  281. const _this = this
  282. const params = {
  283. dispatchBillSn: this.outBizSubSn || this.bizSn || this.$route.params.sn,
  284. printType: priceType,
  285. ...data
  286. }
  287. this.spinning = true
  288. exportExcel(dispatchDetailExcel, params, fileName, function () {
  289. _this.spinning = false
  290. _this.$store.state.app.curActionPermission = ''
  291. })
  292. },
  293. // 发货分类导出
  294. handleFlExport () {
  295. this.openModal = true
  296. this.nowType = 'export'
  297. this.$refs.typePrint.setData(this.detailData, this.outBizSubSn || this.bizSn || this.$route.params.sn)
  298. },
  299. // 打印预览/快捷打印
  300. handlePrint (type) {
  301. this.nowPrintType = type
  302. if (type == 'DISPATCH_BILL') { // 发货打印
  303. const params = {
  304. dispatchBillSn: this.detailData.dispatchBillSn,
  305. dispatchBillNo: this.detailData.dispatchBillNo
  306. }
  307. this.$store.state.app.curActionPermission = 'B_dispatchPrint'
  308. this.handlePrintOk(params, '发货', 'preview')
  309. } else if (type == 'DISPATCH_BILL_TYPE') { // 发货分类打印
  310. this.openModal = true
  311. this.nowType = 'print'
  312. this.$refs.typePrint.setData(this.detailData, this.outBizSubSn || this.bizSn || this.$route.params.sn)
  313. }
  314. },
  315. // 发货分类打印,导出
  316. handlePrintOk (obj, taskName, type) {
  317. const _this = this
  318. const params = {
  319. type: this.nowPrintType,
  320. dispatchBillSn: this.outBizSubSn || this.bizSn || this.$route.params.sn
  321. }
  322. // 打印
  323. if (type != 'export') {
  324. _this.spinning = true
  325. // 货位编号
  326. if (obj.orderBy) {
  327. params.type = params.type + '_STACK_PLACE'
  328. }
  329. // 原厂编码
  330. if (obj.origCode == 1) {
  331. params.type = params.type + '_ORIG_CODE'
  332. }
  333. // 装箱号
  334. if (obj.packNo == 1) {
  335. params.type = params.type + '_PACK_NUM'
  336. }
  337. printBase64Fun(
  338. dispatchDetailPrint,
  339. Object.assign(params, obj || {}),
  340. type,
  341. taskName,
  342. () => {
  343. _this.spinning = false
  344. _this.$store.state.app.curActionPermission = ''
  345. },
  346. {
  347. billType: 'DISPATCH',
  348. billSn: obj.dispatchBillSn,
  349. billNo: obj.dispatchBillNo,
  350. printType: taskName + '打印'
  351. }, this.hasNoPrint)
  352. } else {
  353. this.handleExcelOk('DISPATCH_BILL_TYPE', obj, taskName)
  354. }
  355. }
  356. },
  357. mounted () {
  358. if (!this.$store.state.app.isNewTab || this.outBizSubSn || this.bizSn) { // 页签刷新 或 为弹框时调用
  359. this.$refs.table.refresh(true)
  360. this.getDetail()
  361. }
  362. },
  363. activated () {
  364. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  365. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  366. this.$refs.table.refresh(true)
  367. this.getDetail()
  368. }
  369. },
  370. beforeRouteEnter (to, from, next) {
  371. next(vm => {
  372. vm.fromRouter = from
  373. })
  374. }
  375. }
  376. </script>
  377. <style lang="less">
  378. .pushOrder-wrap{
  379. .salesDetail-cont{
  380. margin-bottom: 6px;
  381. }
  382. .footer-cont{
  383. margin-top: 5px;
  384. text-align: center;
  385. }
  386. }
  387. </style>