unSettlementDetail.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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="this.$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. <a-range-picker v-model="orderDate" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD" @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. <a-range-picker v-model="time" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD" @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. ref="table"
  76. size="small"
  77. rowKey="id"
  78. :columns="columns"
  79. :data="loadData"
  80. :defaultLoadData="false"
  81. bordered>
  82. </s-table>
  83. </a-card>
  84. </a-spin>
  85. </div>
  86. </template>
  87. <script>
  88. import { commonMixin } from '@/utils/mixin'
  89. import { STable, VSelect } from '@/components'
  90. import { toThousands } from '@/libs/tools.js'
  91. import moment from 'moment'
  92. import { queryOrderBillDetailPage, queryOrderBillDetailCount, merchantCashOut } from '@/api/merchant'
  93. export default {
  94. mixins: [commonMixin],
  95. components: { STable, VSelect, commonMixin },
  96. data () {
  97. return {
  98. toThousands,
  99. spinning: false,
  100. disabled: false,
  101. isEdit: false, // 货位号是否为编辑
  102. openModal: false, // 货位模板弹窗初始状态
  103. formItemLayout: {
  104. labelCol: { span: 6 },
  105. wrapperCol: { span: 16 }
  106. },
  107. time: [],
  108. orderDate: [],
  109. count: 0,
  110. priceTotal: 0,
  111. total: null,
  112. queryParam: {
  113. orderBeginDate: '',
  114. orderEndDat: '',
  115. outBeginDate: '',
  116. outEndDate: '',
  117. orderBillNo: ''
  118. },
  119. // 表头
  120. columns: [
  121. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  122. { title: '下单时间', dataIndex: 'orderDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  123. { title: '取货时间', dataIndex: 'outDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  124. { title: '订单编号', dataIndex: 'orderBillNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  125. { title: '货位号', dataIndex: 'shelfPlaceCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  126. { title: '产品编码', width: '10%', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '产品名称', width: '15%', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  128. { title: '结算价', width: '10%', dataIndex: 'settlePrice', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } },
  129. { title: '下单数量', width: '8%', dataIndex: 'totalQty', align: 'center', customRender: function (text) { return toThousands(text) || '--' } },
  130. { title: '合计金额', width: '10%', dataIndex: 'settleAmount', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } }
  131. ],
  132. // 加载数据方法 必须为 Promise 对象
  133. loadData: parameter => {
  134. this.spinning = true
  135. const paramsPage = Object.assign(parameter, this.queryParam)
  136. paramsPage.settleState = 'WAIT'
  137. paramsPage.billState = 'FINISH'
  138. paramsPage.shelfSn = this.$route.params.shelfSn
  139. return queryOrderBillDetailPage(paramsPage).then(res => {
  140. let data
  141. if (res.status == 200) {
  142. data = res.data
  143. this.getCount(paramsPage)
  144. const no = (data.pageNo - 1) * data.pageSize
  145. for (let i = 0; i < data.list.length; i++) {
  146. const _item = data.list[i]
  147. _item.no = no + i + 1
  148. }
  149. }
  150. this.spinning = false
  151. return data
  152. })
  153. }
  154. }
  155. },
  156. methods: {
  157. handleBack () {
  158. this.$router.push({ path: '/numsGoodsShelves/settlementManagement/list' })
  159. },
  160. orderDateChange (date) {
  161. console.log(date, date)
  162. this.orderDate = date
  163. this.queryParam.orderBeginDate = moment(date[0]).format('YYYY-MM-DD')
  164. this.queryParam.orderEndDat = moment(date[1]).format('YYYY-MM-DD')
  165. },
  166. dateChange (date) {
  167. this.time = date
  168. this.queryParam.outBeginDate = moment(date[0]).format('YYYY-MM-DD')
  169. this.queryParam.outEndDate = moment(date[1]).format('YYYY-MM-DD')
  170. },
  171. disabledDate (current) {
  172. return current && current > moment().endOf('day')
  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.table.refresh(true)
  209. }
  210. },
  211. mounted () {
  212. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  213. this.getPageInfo()
  214. this.resetSearchForm()
  215. }
  216. },
  217. activated () {
  218. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  219. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  220. this.getPageInfo()
  221. this.resetSearchForm()
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang="less">
  227. .goodsAllocationSet-page{
  228. position: relative;
  229. height: 100%;
  230. padding-bottom: 51px;
  231. box-sizing: border-box;
  232. .goodsAllocationSet-baseInfo{
  233. margin-bottom: 10px;
  234. }
  235. .bzj-collapse{
  236. margin-top: 10px;
  237. .ant-collapse-content-box{
  238. padding: 10px !important;
  239. }
  240. }
  241. }
  242. </style>