unSettlementDetail.vue 9.8 KB

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