index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
  4. <el-form-item label="分销商名称" label-width="90px">
  5. <el-input
  6. v-model="queryParams.personsName"
  7. placeholder="请输入分销商名称"
  8. clearable
  9. style="width: 200px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="收支类型">
  14. <el-select
  15. v-model="queryParams.serialType"
  16. placeholder="收支类型"
  17. clearable
  18. style="width: 160px"
  19. >
  20. <el-option
  21. v-for="dict in incomeExpensesList"
  22. :key="dict.id"
  23. :label="dict.name"
  24. :value="dict.value"
  25. />
  26. </el-select>
  27. </el-form-item>
  28. <!-- <el-form-item label="业务类型">-->
  29. <!-- <el-select-->
  30. <!-- v-model="queryParams.serialContent"-->
  31. <!-- placeholder="业务类型"-->
  32. <!-- clearable-->
  33. <!-- style="width: 160px"-->
  34. <!-- >-->
  35. <!-- <el-option-->
  36. <!-- v-for="dict in businessTypeList"-->
  37. <!-- :key="dict.id"-->
  38. <!-- :label="dict.name"-->
  39. <!-- :value="dict.value"-->
  40. <!-- />-->
  41. <!-- </el-select>-->
  42. <!-- </el-form-item>-->
  43. <el-form-item label="产生时间">
  44. <el-date-picker
  45. v-model="queryParams.time"
  46. type="daterange"
  47. value-format="yyyy-MM-dd"
  48. range-separator="至"
  49. start-placeholder="开始日期"
  50. end-placeholder="结束日期">
  51. </el-date-picker>
  52. </el-form-item>
  53. <el-form-item>
  54. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  55. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  56. </el-form-item>
  57. </el-form>
  58. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  59. <el-button
  60. type="primary"
  61. size="mini"
  62. icon="el-icon-download"
  63. :disabled="tableData.length === 0"
  64. v-hasPermi="['distributionDetailMr:distributionDetailMr:downloadExcel']"
  65. @click="handleExport"
  66. v-loading.fullscreen.lock="handleExportLoading"
  67. element-loading-text="正在拼命生成数据中..."
  68. element-loading-spinner="el-icon-loading"
  69. element-loading-background="rgba(0, 0, 0, 0.5)"
  70. >导出excel</el-button>
  71. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  72. </el-row>
  73. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  74. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  75. <el-table-column label="分销商名称" align="center" prop="personsName" />
  76. <el-table-column label="分销商类型" align="center" prop="personType">
  77. <template slot-scope="scope">
  78. <dict-tag :options="dict.type.distribution_type" :value="scope.row.personType"/>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="金额(元)" align="center" prop="type">
  82. <template slot-scope="scope">
  83. <span v-if="scope.row.balance">¥{{ scope.row.balance }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="收支类型" align="center" prop="serialType">
  87. <template slot-scope="scope">
  88. <span>{{ scope.row.serialType == 1 ? '收入' : '支出' }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="业务类型" align="center" prop="serialContent" />
  92. <el-table-column label="产生时间" align="center" prop="createTime" width="160" >
  93. <template slot-scope="scope">
  94. <span>{{ parseTime(scope.row.createTime) }}</span>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. <pagination
  99. v-show="total>0"
  100. :total="total"
  101. :page.sync="queryParams.pageNum"
  102. :limit.sync="queryParams.pageSize"
  103. @pagination="getList"
  104. />
  105. </div>
  106. </template>
  107. <script>
  108. import { pageList, downOrderListXls } from '@/api/distribution/detailsMr'
  109. import { exportExcel } from '@/utils/exportexcel'
  110. export default {
  111. name: "agreement",
  112. dicts: ['distribution_type'],
  113. data() {
  114. return {
  115. // 遮罩层
  116. loading: true,
  117. // 选中数组
  118. ids: [],
  119. // 非单个禁用
  120. single: true,
  121. // 非多个禁用
  122. multiple: true,
  123. // 显示搜索条件
  124. showSearch: true,
  125. // 总条数
  126. total: 0,
  127. // 用户表格数据
  128. dataList: null,
  129. // 弹出层标题
  130. title: "",
  131. // 是否显示弹出层
  132. open: false,
  133. // 日期范围
  134. dateRange: [],
  135. // 查询参数
  136. queryParams: {
  137. pageNum: 1,
  138. pageSize: 10,
  139. },
  140. statusList: [
  141. {id: 1, name: '申请中', value: 0},
  142. {id: 2, name: '退款成功', value: 1},
  143. {id: 3, name: '退款失败', value: 2},
  144. {id: 4, name: '退款中', value: 3},
  145. ],
  146. sourceMap: {
  147. 1: '小程序',
  148. 2: '美团',
  149. 3: '携程',
  150. 4: '公众号',
  151. 5: '支付宝',
  152. },
  153. incomeExpensesList: [
  154. {id: 1, name: '收入', value: 1},
  155. {id: 2, name: '支出', value: 2},
  156. ],
  157. businessTypeList: [
  158. {id: 1, name: '佣金收益', value: '佣金收益'},
  159. {id: 2, name: '余额提现', value: '余额提现'},
  160. ],
  161. visibleStatus: false,
  162. newObj: {},
  163. visibleType: '',
  164. handleExportLoading: false,
  165. tableData: {}
  166. };
  167. },
  168. created() {
  169. this.getList();
  170. },
  171. methods: {
  172. /** 查询列表 */
  173. getList() {
  174. this.loading = true;
  175. if(this.queryParams.time && this.queryParams.time.length > 0){
  176. this.queryParams.beginTime = this.queryParams.time[0];
  177. this.queryParams.endTime = this.queryParams.time[1];
  178. } else {
  179. if(this.queryParams.beginTime){
  180. delete this.queryParams.beginTime
  181. delete this.queryParams.endTime
  182. }
  183. }
  184. pageList(this.addDateRange(this.queryParams, this.dateRange))
  185. .then(response => {
  186. this.dataList = response.data.rows;
  187. this.total = response.data.total;
  188. this.loading = false;
  189. }
  190. );
  191. },
  192. // 取消按钮
  193. cancel() {
  194. this.open = false;
  195. },
  196. /** 搜索按钮操作 */
  197. handleQuery() {
  198. this.queryParams.pageNum = 1;
  199. this.getList();
  200. },
  201. /** 重置按钮操作 */
  202. resetQuery() {
  203. this.dateRange = [];
  204. this.$set(this.queryParams, 'time', []);
  205. this.$set(this.queryParams, 'serialContent', '');
  206. this.$set(this.queryParams, 'personsName', '');
  207. this.$set(this.queryParams, 'serialType', '');
  208. this.queryParams.pageNum = 1;
  209. this.handleQuery();
  210. },
  211. /** 详情按钮操作 */
  212. openDetails(row, type) {
  213. this.$refs["detailsDia"].openDialog("详情", row, type);
  214. },
  215. /**
  216. * 导出报表
  217. * @date 2022-10-24
  218. * @returns {any}
  219. */
  220. handleExport() {
  221. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  222. confirmButtonText: '确定 ',
  223. cancelButtonText: '取消 ',
  224. type: 'warning'
  225. })
  226. .then(() => {
  227. this.handleExportLoading = true;
  228. // const { pageNum, pageSize} = this.params;
  229. let postMap = {}
  230. for (let key in this.queryParams) {
  231. if(key != 'pageNum' && key != 'pageSize'){
  232. postMap[key] = this.queryParams[key]
  233. }
  234. }
  235. downOrderListXls(postMap)
  236. .then((res) => {
  237. exportExcel(res, '流水管理', '.xlsx');
  238. this.handleExportLoading = false;
  239. })
  240. .catch(() => {
  241. this.handleExportLoading = false;
  242. });
  243. })
  244. .catch(() => {
  245. this.$message.info('您已取消导出!');
  246. });
  247. },
  248. }
  249. };
  250. </script>