index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <!--<el-form-item label="下单日期" prop="payTime">
  5. <el-date-picker
  6. v-model="queryParams.payTime"
  7. type="date"
  8. size="small"
  9. style="width: 205.4px"
  10. value-format="yyyy-MM-dd"
  11. placeholder="选择日期">
  12. </el-date-picker>
  13. </el-form-item>-->
  14. <el-form-item label="公司名" prop="companyId">
  15. <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  16. <el-option
  17. v-for="item in companys"
  18. :key="item.companyId"
  19. :label="item.companyName"
  20. :value="item.companyId"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <!--<el-form-item label="是否共享客户" prop="status">
  25. <el-select v-model="queryParams.status" placeholder="请选择是否共享客户" clearable size="small">
  26. <el-option
  27. v-for="dict in yseOrNoOptions"
  28. :key="dict.dictValue"
  29. :label="dict.dictLabel"
  30. :value="dict.dictValue"
  31. />
  32. </el-select>
  33. </el-form-item>-->
  34. <el-form-item label="订单状态" prop="orderStatus">
  35. <el-select v-model="queryParams.orderStatus" placeholder="订单请选择状态" clearable size="small">
  36. <el-option
  37. v-for="dict in orderStatusOptions"
  38. :key="dict.dictValue"
  39. :label="dict.dictLabel"
  40. :value="dict.dictValue"
  41. />
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  46. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  47. </el-form-item>
  48. </el-form>
  49. <el-row :gutter="10" class="mb8">
  50. <el-col :span="1.5">
  51. <el-button
  52. type="warning"
  53. icon="el-icon-download"
  54. size="mini"
  55. @click="handleExport"
  56. v-hasPermi="['crm:report:export']"
  57. >导出</el-button>
  58. </el-col>
  59. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  60. </el-row>
  61. <!--<el-tabs type="card" v-model="activeName" @tab-click="handleClick">
  62. <el-tab-pane label="日报表" name="1"></el-tab-pane>
  63. <el-tab-pane label="总报表" name="2"></el-tab-pane>
  64. </el-tabs>-->
  65. <el-table height="500" border v-loading="loading" :data="reportList" @selection-change="handleSelectionChange">
  66. <el-table-column type="selection" width="55" align="center" />
  67. <el-table-column label="订单编号" align="center" prop="orderSn" />
  68. <el-table-column label="成单金额" align="center" prop="money" />
  69. <el-table-column label="支付时间" align="center" prop="payTime" />
  70. <el-table-column label="订单状态" align="center" prop="orderStatus" >
  71. <template slot-scope="scope">
  72. <el-tag prop="status" v-for="(item, index) in orderStatusOptions" v-if="scope.row.orderStatus==item.dictValue">{{item.dictLabel}}</el-tag>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="客户名称" align="center" prop="userName" />
  76. <el-table-column label="是否共享客户" align="center" prop="status" >
  77. <template slot-scope="scope">
  78. <el-tag prop="status" v-for="(item, index) in yseOrNoOptions" :type="scope.row.status==1?'success':'danger'" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="共享销售" align="center" prop="companyUserNames" />
  82. <el-table-column label="分成比例(百分比)" align="center" prop="proportion" />
  83. <el-table-column label="我的业绩" align="center" prop="myPerformance" />
  84. </el-table>
  85. <pagination
  86. v-show="total>0"
  87. :total="total"
  88. :page.sync="queryParams.pageNum"
  89. :limit.sync="queryParams.pageSize"
  90. @pagination="getList"
  91. />
  92. </div>
  93. </template>
  94. <script>
  95. import {getReport,exportReport} from "@/api/statistics/report"
  96. import { getCompanyList } from "@/api/company/company";
  97. export default {
  98. name: "report",
  99. data() {
  100. return {
  101. companys:[],
  102. activeName:"1",
  103. payTypeOptions:[],
  104. statusOptions:[],
  105. orderStatusOptions:[],
  106. yseOrNoOptions:[],
  107. // 遮罩层
  108. loading: true,
  109. // 选中数组
  110. ids: [],
  111. // 非单个禁用
  112. single: true,
  113. // 非多个禁用
  114. multiple: true,
  115. // 显示搜索条件
  116. showSearch: true,
  117. // 总条数
  118. total: 0,
  119. dateRange: [],
  120. // 充值表格数据
  121. companyRechargeList: [],
  122. reportList:[],
  123. // 弹出层标题
  124. title: "",
  125. // 是否显示弹出层
  126. open: false,
  127. // 查询参数
  128. queryParams: {
  129. pageNum: 1,
  130. pageSize: 10,
  131. companyId: null,
  132. money: null,
  133. rechargeNo: null,
  134. payTime: null,
  135. status: null,
  136. orderStatus:null
  137. },
  138. // 表单参数
  139. form: {},
  140. // 表单校验
  141. rules: {
  142. },
  143. recharge:{
  144. open:false,
  145. title:"后台充值"
  146. },
  147. // 表单校验
  148. rechargeRules: {
  149. money: [
  150. { required: true, message: "充值金额不能为空", trigger: "blur" }
  151. ],
  152. imgs: [
  153. { required: true, message: "凭证不能为空", trigger: "change" }
  154. ],
  155. },
  156. // 表单参数
  157. rechargeForm: {
  158. money: 0,
  159. },
  160. };
  161. },
  162. created() {
  163. getCompanyList().then(response => {
  164. this.companys = response.data;
  165. if(this.companys!=null&&this.companys.length>0){
  166. this.companyId=this.companys[0].companyId;
  167. //this.getTreeselect();
  168. }
  169. });
  170. this.getDicts("company_pay_status").then((response) => {
  171. this.statusOptions = response.data;
  172. });
  173. this.getDicts("common_order_status").then((response) => {
  174. this.orderStatusOptions = response.data;
  175. });
  176. this.getDicts("sys_company_or").then((response) => {
  177. this.yseOrNoOptions = response.data;
  178. });
  179. const today = new Date();
  180. const y = today.getFullYear();
  181. const m = String(today.getMonth() + 1).padStart(2, '0');
  182. const d = String(today.getDate()).padStart(2, '0');
  183. this.queryParams.payTime = `${y}-${m}-${d}`;
  184. this.getList();
  185. },
  186. methods: {
  187. /** 查询充值列表 */
  188. getList() {
  189. this.loading = true;
  190. console.log(this.queryParams)
  191. getReport(this.queryParams).then(response => {
  192. this.reportList = response.rows;
  193. this.total = response.total;
  194. this.loading = false;
  195. });
  196. },
  197. handleClick(tab, event) {
  198. if (tab.name === "2") { // 总报表
  199. this.queryParams.payTime = null;
  200. } else if (tab.name === "1") { // 日报表
  201. const today = new Date();
  202. const y = today.getFullYear();
  203. const m = String(today.getMonth() + 1).padStart(2, '0');
  204. const d = String(today.getDate()).padStart(2, '0');
  205. this.queryParams.payTime = `${y}-${m}-${d}`;
  206. }
  207. this.getList();
  208. },
  209. // 取消按钮
  210. cancel() {
  211. this.open = false;
  212. this.reset();
  213. },
  214. // 表单重置
  215. reset() {
  216. this.form = {
  217. rechargeId: null,
  218. companyId: null,
  219. money: null,
  220. rechargeNo: null,
  221. createTime: null,
  222. payTime: null,
  223. status: 0
  224. };
  225. this.resetForm("form");
  226. },
  227. /** 搜索按钮操作 */
  228. handleQuery() {
  229. this.queryParams.pageNum = 1;
  230. this.getList();
  231. },
  232. /** 重置按钮操作 */
  233. resetQuery() {
  234. this.resetForm("queryForm");
  235. this.handleQuery();
  236. },
  237. // 多选框选中数据
  238. handleSelectionChange(selection) {
  239. this.ids = selection.map(item => item.rechargeId)
  240. this.single = selection.length!==1
  241. this.multiple = !selection.length
  242. },
  243. /** 导出按钮操作 */
  244. handleExport() {
  245. const queryParams = this.queryParams;
  246. this.$confirm('是否确认导出所选日报数据项?', "警告", {
  247. confirmButtonText: "确定",
  248. cancelButtonText: "取消",
  249. type: "warning"
  250. }).then(function() {
  251. return exportReport(queryParams);
  252. }).then(response => {
  253. this.download(response.msg);
  254. }).catch(function() {});
  255. },
  256. }
  257. };
  258. </script>