userList.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <div id="order-check">
  3. <div class="order-check-body" v-loading.fullscreen.lock="fullscreenLoading">
  4. <div class="order-management-body">
  5. <div class="order-management-inner">
  6. <!-- <span>时间段:</span>
  7. <el-date-picker size="large" v-model="searchDate" type="daterange" unlink-panels range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions2" value-format="yyyy-MM-dd" align="center">
  8. </el-date-picker> -->
  9. <span>关键字:</span>
  10. <el-input ref="searchOrderNumber" v-model="searchOrderNumber" value="" placeholder="用户名称"></el-input>
  11. <el-button type="primary" @click="_searchOrderData(1)" color='red'>搜索</el-button>
  12. <!-- <el-button type="success" @click="active = {file: ''}" color='red' style="float: right">上传</el-button> -->
  13. </div>
  14. <div class="order-check_bottom">
  15. <div class="order-management-table">
  16. <el-table ref="order_table" class='e-table' :data="orders" style="width: 100%">
  17. <el-table-column prop="id" label="用户id">
  18. </el-table-column>
  19. <!-- <el-table-column prop="name" label="名称">
  20. </el-table-column> -->
  21. <el-table-column prop="userName" label="用户名称">
  22. </el-table-column>
  23. <el-table-column prop="incrementNum" label="会员权益">
  24. </el-table-column>
  25. <el-table-column prop="remainDownLoadNum" label="剩余下载次数">
  26. </el-table-column>
  27. <el-table-column label="操作">
  28. <template slot-scope="scope">
  29. <el-button type="text" @click="addVipNum(scope.row)" class="new_edit_btn">新增权益</el-button>
  30. <el-button type="text" class="edit_btn" @click="addDownLoadNum(scope.row)">新增下载</el-button>
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. </div>
  35. <div class="order-management-pagination">
  36. <el-pagination @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="total">
  37. </el-pagination>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible" @close="closeAdd" width="30%">
  43. <el-form :model="vipForm" :rules="rules" ref="ruleForm">
  44. <el-form-item prop="num" :label="`${dialogTitle}数:`" :label-width="formLabelWidth">
  45. <el-input style="width: 80%;" @input="limitNum" v-model="vipForm.num"></el-input>
  46. </el-form-item>
  47. <el-form-item prop="incrementEndTime" v-if="addType==1" label="到期时间:" :label-width="formLabelWidth">
  48. <el-date-picker style="width: 80%;" v-model="vipForm.incrementEndTime" value-format="yyyy-MM-dd HH:mm:ss" type="date" placeholder="选择日期">
  49. </el-date-picker>
  50. </el-form-item>
  51. </el-form>
  52. <div slot="footer" class="dialog-footer">
  53. <el-button @click="closeAdd">取 消</el-button>
  54. <el-button type="primary" @click="addNum">确 定</el-button>
  55. </div>
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. export default {
  61. name: 'order-check',
  62. data () {
  63. return {
  64. // type: 9,
  65. orders: [],
  66. currentPage: 1,
  67. fullscreenLoading: false,
  68. total: 0,
  69. searchDate: [],
  70. searchOrderNumber: '',
  71. hasClickSearch: false,
  72. pickerOptions2: {
  73. shortcuts: [
  74. {
  75. text: '最近一周',
  76. onClick (picker) {
  77. const end = new Date()
  78. const start = new Date()
  79. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  80. picker.$emit('pick', [start, end])
  81. }
  82. },
  83. {
  84. text: '最近一个月',
  85. onClick (picker) {
  86. const end = new Date()
  87. const start = new Date()
  88. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  89. picker.$emit('pick', [start, end])
  90. }
  91. },
  92. {
  93. text: '最近三个月',
  94. onClick (picker) {
  95. const end = new Date()
  96. const start = new Date()
  97. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
  98. picker.$emit('pick', [start, end])
  99. }
  100. }
  101. ]
  102. },
  103. dialogFormVisible: false,
  104. formLabelWidth: '180px',
  105. vipForm: {
  106. num: 1,
  107. incrementEndTime: ''
  108. },
  109. dialogTitle: '新增权益',
  110. addType: 1,
  111. rules: {
  112. num: [{ required: true, message: '请输入数量', trigger: 'blur' }],
  113. incrementEndTime: [
  114. { required: true, message: '请选择结束时间', trigger: 'change' }
  115. ]
  116. }
  117. }
  118. },
  119. methods: {
  120. limitNum () {
  121. // if (this.vipForm.num - 0 == 0 && this.vipForm.num.length == 1) {
  122. // this.vipForm.num = 1
  123. // } else {
  124. // // this.vipForm.num = this.vipForm.num.replace(/[^1-9]/g, '')
  125. // }
  126. if (this.vipForm.num - 0 == 0 && this.vipForm.num.length == 1) {
  127. this.vipForm.num = 1
  128. } else {
  129. this.vipForm.num = this.vipForm.num.replace(/\D/g, '')
  130. }
  131. },
  132. addDownLoadNum (row) {
  133. this.vipForm.userName = row.userName
  134. this.addType = 2
  135. this.dialogFormVisible = true
  136. this.dialogTitle = '新增下载'
  137. },
  138. addVipNum (row) {
  139. this.vipForm.userName = row.userName
  140. this.addType = 1
  141. this.dialogTitle = '新增权益'
  142. this.dialogFormVisible = true
  143. },
  144. closeAdd () {
  145. this.dialogFormVisible = false
  146. this.vipForm.num = 1
  147. this.vipForm.incrementEndTime = ''
  148. this.$refs['ruleForm'].resetFields()
  149. },
  150. addNum () {
  151. let params
  152. if (this.addType == 1) {
  153. // params = this.vipForm
  154. params = {
  155. userName: this.vipForm.userName,
  156. incrementEndTime: this.vipForm.incrementEndTime,
  157. incrementNum: this.vipForm.num
  158. }
  159. } else {
  160. params = {
  161. downloadNum: this.vipForm.num,
  162. userName: this.vipForm.userName
  163. }
  164. }
  165. this.$refs['ruleForm'].validate(async (valid) => {
  166. if (valid) {
  167. this.$http
  168. .post('/manager/user/insertIncrementls', params)
  169. .then((res) => {
  170. this.closeAdd()
  171. this._searchOrderData(1)
  172. })
  173. } else {
  174. console.log('请补全信息')
  175. }
  176. })
  177. },
  178. handleCurrentChange (val) {
  179. let page = val
  180. if (this.total > 0 && !this.hasClickSearch) {
  181. this._searchOrderData(page)
  182. } else {
  183. this._searchOrderData(page)
  184. }
  185. },
  186. async _searchOrderData (page) {
  187. this.hasClickSearch = true
  188. this.fullscreenLoading = true
  189. let para = {
  190. pageNum: page,
  191. searchKey: this.searchOrderNumber,
  192. pageSize: 10
  193. }
  194. let url = '/manager/user/list'
  195. let data = (await this.$http['post'](url, para)).data
  196. console.log(data)
  197. this.fullscreenLoading = false
  198. let temp = data.list
  199. for (var i = 0; i < temp.length; i++) {
  200. // temp[i]['expressNum_input'] = "";
  201. temp[i].items = []
  202. temp[i].remainDownLoadNum =
  203. temp[i].downloadNumTotal - temp[i].downloadNum
  204. if (!temp[i].incrementNum) {
  205. temp[i].incrementNum = 0
  206. }
  207. }
  208. this.orders = temp
  209. this.currentPage = page
  210. this.total = data.total
  211. }
  212. },
  213. mounted () {
  214. this._searchOrderData(1)
  215. }
  216. }
  217. </script>
  218. <style scoped>
  219. @import url("./style.css");
  220. </style>
  221. <style type="text/css">
  222. .el-table__expand-icon > i {
  223. display: none !important;
  224. }
  225. </style>