unSettlementDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div class="goodsAllocationSet-page">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="goodsAllocationSet-baseInfo" >
  5. <template slot="subTitle">
  6. <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
  7. <span style="margin: 0 15px;color: #666;"> {{ this.$route.params.shelfName||'--' }} </span>
  8. </template>
  9. </a-page-header>
  10. <!-- 额度统计 授信结算类型 显示-->
  11. <a-card size="small" :bordered="false" style="margin-bottom: 10px;" v-if="$route.params.settleType=='CREDIT'">
  12. <a-collapse :activeKey="['1']">
  13. <a-collapse-panel key="1" >
  14. <template slot="header">
  15. 额度统计
  16. <a-tooltip placement="right">
  17. <template slot="title">
  18. <p>待结金额:指客户已经扫码从数字货架取走配件,但还没有结算</p>
  19. <p>冻结金额:指客户已经下单,但还没有从数字货架取走配件</p>
  20. </template>
  21. <a-icon type="question-circle" style="display: inline-block;margin: 12px 0 0 12px;"/>
  22. </a-tooltip>
  23. </template>
  24. <a-descriptions size="small" :column="4">
  25. <a-descriptions-item label="授信额度">
  26. <span>{{ total && toThousands(total.creditLimit,2) }}</span>
  27. </a-descriptions-item>
  28. <a-descriptions-item label="待结金额">
  29. <span>{{ total && toThousands(total.waitSettleAmount,2) }}</span>
  30. </a-descriptions-item>
  31. <a-descriptions-item label="冻结金额">
  32. <span>{{ total && toThousands(total.freezeAmount,2) }}</span>
  33. </a-descriptions-item>
  34. <a-descriptions-item label="可用额度">
  35. <span>{{ total && toThousands(total.usableAmount,2) }}</span>
  36. </a-descriptions-item>
  37. </a-descriptions>
  38. </a-collapse-panel>
  39. </a-collapse>
  40. </a-card>
  41. <a-card :bordered="false" size="small" class="goodsAllocationSet-baseInfo">
  42. <div ref="tableSearch" class="table-page-search-wrapper">
  43. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  44. <a-row :gutter="15">
  45. <a-col :xl="6" :lg="6" :md="12" :sm="24">
  46. <a-form-item label="下单时间">
  47. <rangeDate ref="orderDate" :value="orderDate" @change="orderDateChange" />
  48. </a-form-item>
  49. </a-col>
  50. <a-col :xl="6" :lg="6" :md="12" :sm="24">
  51. <a-form-item label="取货时间">
  52. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  53. </a-form-item>
  54. </a-col>
  55. <a-col :xl="6" :lg="6" :md="12" :sm="24">
  56. <a-form-item label="取货单编号">
  57. <a-input placeholder="请输入取货单编号" v-model.trim="queryParam.orderBillNo" allowClear/>
  58. </a-form-item>
  59. </a-col>
  60. <a-col :xl="6" :lg="6" :md="6" :sm="6" >
  61. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" >查询</a-button>
  62. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
  63. </a-col>
  64. </a-row>
  65. </a-form>
  66. </div>
  67. <a-alert type="info" style="margin:10px 0">
  68. <div slot="message" style="display: flex;align-items: center;padding: 2px 0;">
  69. 共<strong>{{ count }}</strong>条记录;
  70. 待结算金额合计:<strong>{{ toThousands(priceTotal,2) }}</strong>
  71. </div>
  72. </a-alert>
  73. <s-table
  74. class="sTable fixPagination"
  75. :style="{ height: tableHeight+77+'px' }"
  76. ref="table"
  77. size="small"
  78. :rowKey="(record) => record.id"
  79. :columns="columns"
  80. :data="loadData"
  81. :defaultLoadData="false"
  82. :scroll="{ y:tableHeight }"
  83. bordered>
  84. </s-table>
  85. </a-card>
  86. </a-spin>
  87. </div>
  88. </template>
  89. <script>
  90. import { commonMixin } from '@/utils/mixin'
  91. import { STable, VSelect } from '@/components'
  92. import { toThousands } from '@/libs/tools.js'
  93. import moment from 'moment'
  94. import rangeDate from '@/views/common/rangeDate.vue'
  95. import { queryOrderBillDetailPage, queryOrderBillDetailCount, merchantCashOut } from '@/api/merchant'
  96. export default {
  97. mixins: [commonMixin],
  98. components: { STable, VSelect, commonMixin, rangeDate },
  99. data () {
  100. return {
  101. toThousands,
  102. spinning: false,
  103. disabled: false,
  104. isEdit: false, // 货位号是否为编辑
  105. openModal: false, // 货位模板弹窗初始状态
  106. tableHeight: 0,
  107. formItemLayout: {
  108. labelCol: { span: 6 },
  109. wrapperCol: { span: 16 }
  110. },
  111. time: [],
  112. orderDate: [],
  113. count: 0,
  114. priceTotal: 0,
  115. total: null,
  116. queryParam: {
  117. orderBeginDate: '',
  118. orderEndDat: '',
  119. outBeginDate: '',
  120. outEndDate: '',
  121. orderBillNo: ''
  122. },
  123. columns: [// 表头
  124. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  125. { title: '下单时间', dataIndex: 'orderDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  126. { title: '取货时间', dataIndex: 'outDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '订单编号', dataIndex: 'orderBillNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '货位号', dataIndex: 'shelfPlaceCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  129. { title: '产品编码', width: '10%', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
  130. { title: '产品名称', width: '15%', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  131. { title: '结算价', width: '10%', dataIndex: 'settlePrice', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } },
  132. { title: '下单数量', width: '8%', dataIndex: 'totalQty', align: 'center', customRender: function (text) { return text || '--' } },
  133. { title: '合计金额', width: '10%', dataIndex: 'settleAmount', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } }
  134. ],
  135. // 加载数据方法 必须为 Promise 对象
  136. loadData: parameter => {
  137. this.spinning = true
  138. const paramsPage = Object.assign(parameter, this.queryParam)
  139. paramsPage.settleState = 'WAIT'
  140. paramsPage.billState = 'FINISH'
  141. paramsPage.shelfSn = this.$route.params.shelfSn
  142. return queryOrderBillDetailPage(paramsPage).then(res => {
  143. let data
  144. if (res.status == 200) {
  145. data = res.data
  146. this.getCount(paramsPage)
  147. const no = (data.pageNo - 1) * data.pageSize
  148. for (let i = 0; i < data.list.length; i++) {
  149. const _item = data.list[i]
  150. _item.no = no + i + 1
  151. }
  152. }
  153. this.spinning = false
  154. return data
  155. })
  156. }
  157. }
  158. },
  159. methods: {
  160. handleBack () {
  161. this.$router.push({ path: '/numsGoodsShelves/settlementManagement/list' })
  162. },
  163. orderDateChange (date) {
  164. console.log(date, date)
  165. this.orderDate = date
  166. this.queryParam.orderBeginDate = date[0] || ''
  167. this.queryParam.orderEndDat = date[1] || ''
  168. },
  169. dateChange (date) {
  170. this.time = date
  171. this.queryParam.outBeginDate = date[0] ? moment(date[0]).format('YYYY-MM-DD') : ''
  172. this.queryParam.outEndDate = date[1] ? moment(date[1]).format('YYYY-MM-DD') : ''
  173. },
  174. getPageInfo () {
  175. this.spinning = true
  176. const info = JSON.parse(sessionStorage.getItem('settlementDetail'))
  177. merchantCashOut({ shelfSn: this.$route.params.shelfSn }).then(res => {
  178. console.log(res, info, '===========')
  179. if (res.status == 200) {
  180. this.total = res.data
  181. this.total.creditLimit = info.creditLimit
  182. this.total.waitSettleAmount = info.waitSettleAmount
  183. } else {
  184. this.total = null
  185. }
  186. this.spinning = false
  187. })
  188. },
  189. getCount (val) {
  190. queryOrderBillDetailCount(val).then(res => {
  191. if (res.status == 200) {
  192. this.count = res.data.detailNum
  193. this.priceTotal = res.data.settleAmount
  194. }
  195. })
  196. },
  197. // 重置
  198. resetSearchForm () {
  199. this.time = []
  200. this.orderDate = []
  201. this.queryParam = {
  202. orderBeginDate: '',
  203. orderEndDat: '',
  204. outBeginDate: '',
  205. outEndDate: '',
  206. orderBillNo: ''
  207. }
  208. this.$refs.rangeDate.resetDate(this.time)
  209. this.$refs.orderDate.resetDate(this.orderDate)
  210. this.$refs.table.refresh(true)
  211. },
  212. pageInit () {
  213. const _this = this
  214. this.getPageInfo()
  215. this.$nextTick(() => { // 页面渲染完成后的回调
  216. _this.setTableH()
  217. })
  218. },
  219. setTableH () {
  220. const tableSearchH = this.$refs.tableSearch.offsetHeight
  221. this.tableHeight = window.innerHeight - tableSearchH - (this.$route.params.settleType == 'CREDIT' ? 415 : 300)
  222. }
  223. },
  224. mounted () {
  225. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  226. this.pageInit()
  227. this.resetSearchForm()
  228. }
  229. },
  230. activated () {
  231. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  232. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  233. this.pageInit()
  234. this.resetSearchForm()
  235. }
  236. }
  237. }
  238. </script>
  239. <style lang="less">
  240. .goodsAllocationSet-page{
  241. position: relative;
  242. height: 100%;
  243. padding-bottom: 51px;
  244. box-sizing: border-box;
  245. .goodsAllocationSet-baseInfo{
  246. margin-bottom: 10px;
  247. }
  248. .bzj-collapse{
  249. margin-top: 10px;
  250. .ant-collapse-content-box{
  251. padding: 10px !important;
  252. }
  253. }
  254. }
  255. </style>