index.vue 8.8 KB

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