weight_restore.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="mainContainer">
  3. <div class="mainTableTools">
  4. <el-row :gutter="20">
  5. <el-col :span="3">
  6. <el-select v-model="selectedStatus" placeholder="状态" @change="getList()">
  7. <el-option
  8. v-for="(item, index) of statusOptions"
  9. :key="index"
  10. :label="item"
  11. :value="index"
  12. >
  13. </el-option>
  14. </el-select>
  15. </el-col>
  16. <el-col :span="9">
  17. <div class="mainTableTagbox">
  18. <el-tag type="success">申请总数:<b>{{counter.all}}</b></el-tag>
  19. <el-tag>已恢复:<b>{{counter.restore}}</b></el-tag>
  20. <el-tag type="danger">拒绝恢复:<b>{{counter.reject}}</b></el-tag>
  21. </div>
  22. </el-col>
  23. </el-row>
  24. </div>
  25. <el-table :data="tableData" border >
  26. <el-table-column prop="obj_id" label="申请人">
  27. <template slot-scope="scope">
  28. <span class="lblue point">
  29. <a target="_blank" :href="scope.row.host+'/rooter/user/'+scope.row.uid">{{scope.row.nickname}}</a>
  30. </span>
  31. </template>
  32. </el-table-column>
  33. <el-table-column prop="before_weight" label="申请时权重"></el-table-column>
  34. <el-table-column prop="money" label="付费金额"></el-table-column>
  35. <el-table-column prop="update_time" label="付费时间"></el-table-column>
  36. <el-table-column prop="status" label="当前状态">
  37. <template slot-scope="scope">
  38. <span :class="'status-' + scope.row.status">{{scope.row.status_name}}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="备注">
  42. <template slot-scope="scope">
  43. <div>{{ scope.row.remark_text }}</div>
  44. <el-button type="text" @click="onToList(scope.row)">查看备注({{ scope.row.remark_num }})</el-button>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="操作">
  48. <template slot-scope="scope">
  49. <el-button type="text" @click="onRemark(scope.row)">添加备注</el-button>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="obj_id" label="处理人">
  53. <template slot-scope="scope">
  54. <span class="lblue point">
  55. <a target="_blank" :href="scope.row.host+'/rooter/user/'+scope.row.action_uid">{{scope.row.action_nickname}}</a>
  56. </span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="操作" width="200">
  60. <template slot-scope="scope">
  61. <template v-if="scope.row.status == 2">
  62. <el-button size="mini" type="primary" @click="pass(scope.row)">允许恢复</el-button>
  63. <el-button size="mini" type="danger" @click="reject(scope.row)">拒绝恢复</el-button>
  64. </template>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <div class="mainPageBox">
  69. <el-pagination
  70. @current-change="changePagination"
  71. :page-size="20"
  72. :total="Number(total)"
  73. layout="total, prev, pager, next"
  74. background
  75. ></el-pagination>
  76. </div>
  77. <el-dialog title="添加备注" :visible.sync="remarkModel">
  78. <div>
  79. <el-input
  80. type="textarea"
  81. :rows="5"
  82. placeholder="请输入内容"
  83. v-model="remarkData.content">
  84. </el-input>
  85. </div>
  86. <div slot="footer" class="dialog-footer">
  87. <el-button @click="remarkModel = false">取 消</el-button>
  88. <el-button type="primary" :loading="loading" @click="onRemarkSave">确 定</el-button>
  89. </div>
  90. </el-dialog>
  91. </div>
  92. </template>
  93. <script>
  94. export default {
  95. data() {
  96. return {
  97. page: 1,
  98. total: 0,
  99. tableData: [],
  100. counter: {all:0, restore:0, reject:0},
  101. selectedStatus: '0',
  102. statusOptions: [],
  103. remarkModel: false,
  104. remarkData: {id: '0', content: ''},
  105. loading:false
  106. }
  107. },
  108. computed: {
  109. },
  110. mounted() {
  111. this.getStatus();
  112. this.getList();
  113. },
  114. methods: {
  115. async getStatus() {
  116. let res = await this.$post("/api/admin/UserWeight/getOptions");
  117. if (res && res.status === 1) {
  118. this.statusOptions = res.data.status_options;
  119. this.counter.all = res.data.counter[0];
  120. this.counter.restore = res.data.counter[3];
  121. this.counter.reject = res.data.counter[4];
  122. }
  123. },
  124. async getList() {
  125. const data = {
  126. page: this.page,
  127. status: this.selectedStatus
  128. };
  129. let res = await this.$post("/api/admin/UserWeight/getApplyList", data);
  130. if (res && res.status === 1) {
  131. this.tableData = res.data.list;
  132. this.total = res.data.total;
  133. }
  134. },
  135. async pass(row) {
  136. this.$confirm('确认通过恢复权重?', '提示', {
  137. confirmButtonText: '确定',
  138. cancelButtonText: '取消',
  139. type: 'info'
  140. }).then(async _ => {
  141. let res = await this.$post("/api/admin/UserWeight/pass", {id: row.id});
  142. if (res && res.status === 1) {
  143. this.$message.success('设置成功');
  144. this.getList();
  145. }
  146. });
  147. },
  148. async reject(row) {
  149. this.$prompt('拒绝恢复后付费金额将退回用户余额', '提示', {
  150. confirmButtonText: '确定',
  151. cancelButtonText: '取消',
  152. inputPlaceholder: '请输入拒绝原因'
  153. }).then(async ({ value }) => {
  154. let res = await this.$post("/api/admin/UserWeight/reject", {id: row.id, reject_msg:value});
  155. if (res && res.status === 1) {
  156. this.$message.success('设置成功');
  157. this.getList();
  158. }
  159. });
  160. },
  161. changePagination(val) {
  162. this.page = val;
  163. this.getList();
  164. },
  165. onRemark(row) {
  166. this.remarkData.id = row.id;
  167. this.remarkModel = true;
  168. },
  169. onToList(row) {
  170. let data = {
  171. obj_id: row.id,
  172. type: 7
  173. }
  174. this.$router.push({path: '/main/remark_list', query: data});
  175. },
  176. async onRemarkSave() {
  177. this.loading = true;
  178. if (this.remarkData.content === '' || this.remarkData.id === '0') {
  179. this.$message.error('请输入内容')
  180. this.loading = false
  181. return false
  182. }
  183. let data = {content: this.remarkData.content, id: this.remarkData.id}
  184. let res = await this.$post("/api/admin/UserWeight/saveRemark", data);
  185. if (res && res.status === 1) {
  186. this.$message.success('备注成功')
  187. this.remarkModel = false
  188. this.getList()
  189. }
  190. this.loading = false
  191. },
  192. }
  193. };
  194. </script>
  195. <style scoped>
  196. .status-1 {
  197. color:#909399;
  198. }
  199. .status-2 {
  200. color:#67C23A;
  201. }
  202. .status-3 {
  203. color:#409EFF;
  204. }
  205. .status-4 {
  206. color:#F56C6C;
  207. }
  208. </style>