allLdDetail.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <a-card :bordered="false" class="allLdDetail-page-info">
  3. <!-- 搜索条件 -->
  4. <div class="allLdDetail-searchForm">
  5. <a-form layout="inline" v-bind="formItemLayout" @keyup.enter.native="refresh">
  6. <a-row :gutter="24">
  7. <a-col :xs="24" :sm="12" :md="8" :lg="5">
  8. <a-form-item label="创建时间" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  9. <a-range-picker
  10. id="allLdDetail-time"
  11. v-model="time"
  12. style="width: 100%;"
  13. :format="dateFormat"
  14. :placeholder="['开始时间','结束时间']"
  15. :disabledDate="disabledDate"
  16. @change="onChange" />
  17. </a-form-item>
  18. </a-col>
  19. <a-col :xs="24" :sm="12" :md="8" :lg="5">
  20. <a-form-item label="变动类型" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  21. <v-select
  22. v-model="queryParam.changeType"
  23. ref="changeType"
  24. id="allLdDetail-status"
  25. code="GOLD_CHANGE_TYPE"
  26. placeholder="请选择"
  27. allowClear></v-select>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :xs="24" :sm="12" :md="8" :lg="5">
  31. <a-form-item label="变动原因" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  32. <v-select
  33. v-model="queryParam.operateType"
  34. ref="operateType"
  35. id="allLdDetail-status"
  36. code="GOLD_OPERATE_TYPE_ALL"
  37. placeholder="请选择"
  38. allowClear></v-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :xs="24" :sm="12" :md="8" :lg="5">
  42. <a-form-item label="用户手机" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  43. <a-input id="boxSetting-name" allowClear :maxLength="30" v-model="queryParam.name" placeholder="请输入用户手机" />
  44. </a-form-item>
  45. </a-col>
  46. <a-col :xs="24" :sm="12" :md="8" :lg="4">
  47. <a-button class="handle-btn serach-btn" id="allLdDetail-btn-serach" type="primary" @click="refresh">查询</a-button>
  48. <a-button class="handle-btn" type="" id="allLdDetail-btn-reset" @click="handleReset">重置</a-button>
  49. </a-col>
  50. </a-row>
  51. </a-form>
  52. </div>
  53. <!-- 总计 -->
  54. <a-alert type="info" showIcon style="margin-bottom:15px">
  55. <div class="ftext" slot="message">共<span> {{ }} </span>条,乐豆变动总计<span> {{ }} </span>个</div>
  56. </a-alert>
  57. <!-- 列表 -->
  58. <s-table
  59. ref="table"
  60. size="default"
  61. :rowKey="(record) => record.id"
  62. :columns="columns"
  63. :data="loadData"
  64. bordered>
  65. </s-table>
  66. </a-card>
  67. </template>
  68. <script>
  69. import { STable, VSelect } from '@/components'
  70. import { customerGoldLogDetail } from '@/api/userInfo.js'
  71. import moment from 'moment'
  72. import getDate from '@/libs/getDate.js'
  73. export default {
  74. name: 'ShopOrder',
  75. components: { STable, VSelect },
  76. data () {
  77. return {
  78. formItemLayout: {
  79. labelCol: { span: 7 },
  80. wrapperCol: { span: 17 }
  81. },
  82. // 将默认近七天时间日期回显在时间选择框中
  83. time: [
  84. moment(getDate.getRecentday().starttime, 'YYYY-MM-DD'),
  85. moment(getDate.getRecentday().endtime, 'YYYY-MM-DD')
  86. ],
  87. dateFormat: 'YYYY-MM-DD',
  88. // 查询参数
  89. queryParam: {
  90. beginDate: null, // 开始时间
  91. endDate: null, // 结束时间
  92. changeType: '', // 类型
  93. operateType: '' // 原因
  94. },
  95. info: '',
  96. // 表头
  97. columns: [
  98. { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  99. { title: '创建时间', dataIndex: 'createDate', width: 200, align: 'center' },
  100. { title: '用户手机', dataIndex: '', width: 200, align: 'center' },
  101. { title: '变动类型', dataIndex: 'changeTypeDictValue', width: 200, align: 'center' },
  102. { title: '变动原因', dataIndex: 'operateTypeDictValue', width: 200, align: 'center' },
  103. { title: '乐豆变动量(个)', dataIndex: 'changeNum', width: 200, align: 'center' }
  104. ],
  105. // 加载数据方法 必须为 Promise 对象
  106. loadData: parameter => {
  107. const searchData = Object.assign(parameter, this.queryParam)
  108. if (this.time && this.time.length) {
  109. searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
  110. searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD')
  111. } else {
  112. searchData.beginDate = ''
  113. searchData.endDate = ''
  114. }
  115. return customerGoldLogDetail(Object.assign(parameter, searchData)).then(res => {
  116. if (res.status == 200) {
  117. const no = (res.data.pageNo - 1) * res.data.pageSize
  118. for (let i = 0; i < res.data.list.length; i++) {
  119. const _item = res.data.list[i]
  120. _item.no = no + i + 1
  121. }
  122. return res.data
  123. }
  124. })
  125. }
  126. }
  127. },
  128. methods: {
  129. // 不可选日期
  130. disabledDate (date, dateStrings) {
  131. return date && date.valueOf() > Date.now()
  132. },
  133. // 创建时间change
  134. onChange (dates, dateStrings) {
  135. if ((dates, dateStrings)) {
  136. this.queryParam.beginDate = dateStrings[0]
  137. this.queryParam.endDate = dateStrings[1]
  138. }
  139. },
  140. // 查询
  141. refresh () {
  142. this.$refs.table.refresh(true)
  143. },
  144. // 重置
  145. handleReset () {
  146. this.time = [moment(getDate.getRecentday().starttime, 'YYYY-MM-DD'),
  147. moment(getDate.getRecentday().endtime, 'YYYY-MM-DD')]
  148. this.queryParam.changeType = ''
  149. this.queryParam.operateType = ''
  150. this.$refs.table.refresh(true)
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="less" scoped>
  156. .allLdDetail-page-info{
  157. .page-header{
  158. margin-bottom: 15px;
  159. span{
  160. margin-left: 20px;
  161. }
  162. .page-header-info{
  163. margin-left:0;
  164. font-weight: bold;
  165. }
  166. }
  167. .allLdDetail-searchForm{
  168. .ant-form-inline .ant-form-item{
  169. width: 100%;
  170. }
  171. // 搜索框的下间距
  172. .ant-form-item {
  173. margin-bottom: 15px;
  174. }
  175. .handle-btn{
  176. margin-top: 4px;
  177. }
  178. .serach-btn{
  179. margin-right: 10px;
  180. }
  181. }
  182. }
  183. </style>