2021double11List.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <el-page-header
  5. @back="onCancel"
  6. :content="year === '2021'? '2021双十一活动' : '2022双十一活动'"
  7. ></el-page-header>
  8. <!-- <h2>
  9. <div class="squrt"></div>
  10. 2021十一会员活动
  11. </h2> -->
  12. <div class="m-core">
  13. <save-form
  14. :inline="true"
  15. :model="searchForm"
  16. @submit="search"
  17. @reset="onReSet"
  18. >
  19. <el-form-item prop="organId">
  20. <el-select
  21. class="multiple"
  22. style="width: 180px !important"
  23. v-model.trim="searchForm.organId"
  24. filterable
  25. clearable
  26. placeholder="请选择分部"
  27. >
  28. <el-option
  29. v-for="(item, index) in selects.branchs"
  30. :key="index"
  31. :label="item.name"
  32. :value="item.id"
  33. ></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button native-type="submit" type="primary">搜索</el-button>
  38. <el-button native-type="reset" type="danger">重置</el-button>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button type="primary" @click="onCreateQRCode"
  42. >H5统计链接</el-button
  43. >
  44. </el-form-item>
  45. <el-form-item v-if="year === '2022'">
  46. <el-button type="primary" @click="onCreateQRCode2"
  47. >杭州H5统计链接</el-button
  48. >
  49. </el-form-item>
  50. <el-form-item>
  51. <auth auths="export/organDoubleEleven2021Statis">
  52. <el-button type="primary" @click="onExport">导出</el-button>
  53. </auth>
  54. </el-form-item>
  55. <el-form-item>
  56. <auth auths="export/doubleEleven2021OrderDetail">
  57. <el-button type="primary" @click="onExport2">学员明细导出</el-button>
  58. </auth>
  59. </el-form-item>
  60. </save-form>
  61. <!-- <div style="font-size: 14px; color: #f85043; padding-bottom: 10px"> -->
  62. <!-- 应收总金额:{{ totalExpectAmount }}元 &nbsp;&nbsp;&nbsp;&nbsp;
  63. 现金实收总额:{{ totalActualAmount }}元 &nbsp;&nbsp;&nbsp;&nbsp;
  64. 余额实收总额:{{ Number((totalExpectAmount - totalActualAmount).toFixed(2)) }}元 -->
  65. <!-- 营收金额=2-3
  66. 实收金额=应收总额(包含余额支付)
  67. 预收金额=充值总额(发生消费,记负数)
  68. 预收余额=充值总余额 -->
  69. <!-- 总金额:{{ head.buyAmount | moneyFormat }}元<i
  70. style="width: 10px; display: inline-block"
  71. ></i>
  72. 目标总金额:{{ head.targetAmount | moneyFormat }}元<i
  73. style="width: 10px; display: inline-block"
  74. ></i>
  75. 目标金额达成率:{{ head.targetAmountFinishScale }}%<i
  76. style="width: 10px; display: inline-block"
  77. ></i>
  78. 购买人数:{{ head.buyNum }}人<i
  79. style="width: 10px; display: inline-block"
  80. ></i>
  81. 人均购买金额:{{ head.avgBuyAmount | moneyFormat }}元<i
  82. style="width: 10px; display: inline-block"
  83. ></i>
  84. 目标人数:{{ head.targetNum }}人<i
  85. style="width: 10px; display: inline-block"
  86. ></i>
  87. 目标达成率:{{ head.targetFinishScale }}%<i
  88. style="width: 10px; display: inline-block"
  89. ></i> -->
  90. <!-- 购买总金额:{{ head.buyAmount | moneyFormat }}元<i
  91. style="width: 10px; display: inline-block"
  92. ></i> -->
  93. <!-- 购买率:{{ head.buyScale }}%
  94. <i style="width: 10px; display: inline-block"></i> -->
  95. <!-- 总人数:{{ head.totalNum }}元<i
  96. style="width: 10px; display: inline-block"
  97. ></i> -->
  98. </div>
  99. <div class="tableWrap">
  100. <el-table
  101. style="width: 100%"
  102. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  103. :data="tableList"
  104. @sort-change="sortChang"
  105. :default-sort="{
  106. prop: 'totalBuyAmount',
  107. order: 'descending',
  108. }"
  109. >
  110. <!-- <el-table-column
  111. align="center"
  112. prop="targetNum"
  113. label="排名"
  114. ></el-table-column> -->
  115. <el-table-column align="center" label="排名" type="index" width="50">
  116. </el-table-column>
  117. <el-table-column
  118. align="center"
  119. prop="organName"
  120. label="分部"
  121. width="170px"
  122. ></el-table-column>
  123. <el-table-column
  124. align="center"
  125. prop="totalBuyAmount"
  126. label="总成交金额"
  127. sortable="custom"
  128. >
  129. <template slot-scope="scope">
  130. <div>{{ scope.row.totalBuyAmount | moneyFormat }}元</div>
  131. </template>
  132. </el-table-column>
  133. <el-table-column
  134. align="center"
  135. prop="avgBuyAmount"
  136. label="人均购买金额"
  137. sortable="custom"
  138. >
  139. <template slot-scope="scope">
  140. <div>{{ scope.row.avgBuyAmount | moneyFormat }}元</div>
  141. </template>
  142. </el-table-column>
  143. <el-table-column
  144. align="center"
  145. prop="targetAmount"
  146. label="20节1v1成交金额/人数"
  147. width="150px"
  148. >
  149. <template slot-scope="scope">
  150. <div>
  151. {{ scope.row.vip1V120Amount| moneyFormat }}元/{{ scope.row.vip1V120Num }}人
  152. </div>
  153. </template>
  154. </el-table-column>
  155. <el-table-column
  156. align="center"
  157. prop="targetAmount"
  158. label="40节1v1成交金额/人数"
  159. width="150px"
  160. >
  161. <template slot-scope="scope">
  162. <div>
  163. {{ scope.row.vip1V140Amount| moneyFormat }}元/{{ scope.row.vip1V140Num }}人
  164. </div>
  165. </template>
  166. </el-table-column>
  167. <el-table-column
  168. align="center"
  169. prop="targetAmount"
  170. label="20节1v2成交金额/人数"
  171. width="150px"
  172. >
  173. <template slot-scope="scope">
  174. <div>
  175. {{ scope.row.vip1V220Amount| moneyFormat }}元/{{ scope.row.vip1V220Num }}人
  176. </div>
  177. </template>
  178. </el-table-column>
  179. <el-table-column
  180. align="center"
  181. prop="targetAmount"
  182. label="40节1v2成交金额/人数"
  183. width="150px"
  184. >
  185. <template slot-scope="scope">
  186. <div>
  187. {{ scope.row.vip1V240Amount| moneyFormat }}元/{{ scope.row.vip1V240Num }}人
  188. </div>
  189. </template>
  190. </el-table-column>
  191. <el-table-column
  192. align="center"
  193. prop="targetAmount"
  194. label="乐理课成交金额/人数"
  195. width="150px"
  196. v-if="year === '2021'"
  197. >
  198. <template slot-scope="scope">
  199. <div>
  200. {{ scope.row.musicTheoryAmount | moneyFormat }}元/{{ scope.row.musicTheoryNum }}人
  201. </div>
  202. </template>
  203. </el-table-column>
  204. <el-table-column label="详情" align="left">
  205. <template slot-scope="scope">
  206. <div>
  207. <el-button type="text" @click="gotoDetail(scope.row)"
  208. >详情</el-button
  209. >
  210. </div>
  211. </template>
  212. </el-table-column>
  213. </el-table>
  214. <!-- <pagination
  215. sync
  216. :total.sync="rules.total"
  217. :page.sync="rules.page"
  218. :limit.sync="rules.limit"
  219. :page-sizes="rules.page_size"
  220. @pagination="getList"
  221. /> -->
  222. <!-- </div> -->
  223. </div>
  224. <qr-code v-model="qrcodeStatus" title="统计二维码" :codeUrl="codeUrl" />
  225. </div>
  226. </template>
  227. <script>
  228. import axios from "axios";
  229. import { getToken } from "@/utils/auth";
  230. import pagination from "@/components/Pagination/index";
  231. import QrCode from "@/components/QrCode/index";
  232. import { vaildTeachingUrl } from "@/utils/validate";
  233. import { getDoubleElevenList, getDoubleElevenList2022 } from "./api";
  234. import { Export } from "@/utils/downLoadFile";
  235. import cleanDeep from "clean-deep";
  236. import qs from "qs";
  237. export default {
  238. components: { pagination, QrCode },
  239. data() {
  240. return {
  241. searchForm: {
  242. organId: null,
  243. },
  244. searchList: { sort: "totalBuyAmount", order: "DESC" },
  245. head: {
  246. avgBuyAmount: null,
  247. buyAmount: null,
  248. buyNum: null,
  249. buyScale: null,
  250. targetAmount: null,
  251. targetFinishScale: null,
  252. targetNum: null,
  253. totalNum: null,
  254. },
  255. tableList: [],
  256. organList: [],
  257. rules: {
  258. // 分页规则
  259. limit: 10, // 限制显示条数
  260. page: 1, // 当前页
  261. total: 0, // 总条数
  262. page_size: [10, 20, 40, 50], // 选择限制显示条数
  263. },
  264. qrcodeStatus: false,
  265. codeUrl: "",
  266. qrcodeStatus2: false,
  267. codeUrl2: "",
  268. year: "2021",
  269. };
  270. },
  271. //生命周期 - 创建完成(可以访问当前this实例)
  272. created() {},
  273. //生命周期 - 挂载完成(可以访问DOM元素)
  274. async mounted() {
  275. // 获取分部
  276. await this.$store.dispatch("setBranchs");
  277. this.year = this.$route.query.year || "2021"
  278. this.init();
  279. },
  280. methods: {
  281. init() {
  282. this.getList();
  283. },
  284. async getList() {
  285. try {
  286. let res = null
  287. if (this.year === "2021") {
  288. res = await getDoubleElevenList({
  289. organId: this.searchForm.organId,
  290. ...this.searchList
  291. });
  292. } else {
  293. res = await getDoubleElevenList2022({
  294. organId: this.searchForm.organId,
  295. ...this.searchList
  296. });
  297. }
  298. // ...this.searchList,
  299. this.tableList = res.data;
  300. // this.head = res.data.head;
  301. } catch (e) {
  302. console.log(e);
  303. }
  304. },
  305. search() {
  306. this.rules.page = 1;
  307. this.getList();
  308. },
  309. onReSet() {
  310. this.searchForm.organId = null;
  311. this.searchList = { sort: "targetFinishScale", order: "DESC" };
  312. this.search();
  313. },
  314. sortChang(val) {
  315. const dates = {
  316. ascending: "ASC",
  317. descending: "DESC",
  318. };
  319. this.searchList = {};
  320. if (val.prop && val.order) {
  321. this.searchList = { sort: val.prop, order: dates[val.order] };
  322. // this.searchList[val.prop] = dates[val.order];
  323. }
  324. this.rules.page = 1;
  325. this.getList();
  326. },
  327. onCreateQRCode(row) {
  328. // 生成报名二维码
  329. this.qrcodeStatus = true;
  330. if (this.year === "2022") {
  331. this.codeUrl = vaildTeachingUrl() + "/#/statistic-20221111";
  332. } else {
  333. this.codeUrl = vaildTeachingUrl() + "/#/statistic-20211111";
  334. }
  335. },
  336. onCreateQRCode2(row) {
  337. // 生成报名二维码
  338. this.qrcodeStatus = true;
  339. this.codeUrl = vaildTeachingUrl() + "/#/statistic-20221111?type=hz";
  340. },
  341. gotoDetail(row) {
  342. // console.log('跳转详情')
  343. if (this.year === "2022") {
  344. this.$router.push({
  345. path: "/operateManager/2021doubleDetail",
  346. query: { organId: row.organId, organName: row.organName, year: "2022" },
  347. });
  348. } else {
  349. this.$router.push({
  350. path: "/operateManager/2021doubleDetail",
  351. query: { organId: row.organId, organName: row.organName },
  352. });
  353. }
  354. },
  355. async onExport() {
  356. let obj = {
  357. organId: this.searchForm.organId,
  358. ...this.searchList,
  359. };
  360. await Export(
  361. this,
  362. {
  363. url: this.year === "2021" ? "/api-web/export/organDoubleEleven2021Statis" : "/api-web/export/organDoubleEleven2022Statis",
  364. fileName: this.year === "2021" ? "双十一活动.xls" : "双十一活动.xls",
  365. method: "post",
  366. params: qs.stringify(cleanDeep(obj)),
  367. },
  368. "您确定导出双十一活动列表?"
  369. );
  370. },
  371. async onExport2() {
  372. // let { getTime, ...rest } = this.searchForm;
  373. // let params = {
  374. // ...rest,
  375. // page: this.rules.page,
  376. // rows: this.rules.limit,
  377. // ...getTimes(getTime, ["startTime", "endTime"]),
  378. // };
  379. let obj = {
  380. organId: this.searchForm.organId,
  381. ...this.searchList,
  382. year: this.year,
  383. };
  384. await Export(
  385. this,
  386. {
  387. url: "/api-web/export/doubleEleven2021OrderDetail",
  388. fileName: this.$route.query.year === "2021" ? "学员购买详情.xls" : "学员购买详情.xls",
  389. method: "post",
  390. params: qs.stringify(cleanDeep(obj)),
  391. },
  392. "您确定导出双十一活动详情列表?"
  393. );
  394. },
  395. onCancel() {
  396. this.$store.dispatch("delVisitedViews", this.$route);
  397. this.$router.push("/activeMarketing");
  398. },
  399. },
  400. };
  401. </script>
  402. <style lang='scss' scoped>
  403. .titleCell {
  404. display: inline-block;
  405. }
  406. .tableWrap {
  407. margin-top: 20px;
  408. }
  409. .qrcode {
  410. display: flex;
  411. flex-direction: column;
  412. align-items: center;
  413. img {
  414. width: 200px;
  415. height: 200px;
  416. margin: 0 auto;
  417. }
  418. }
  419. .code-url {
  420. font-size: 18px;
  421. text-align: center;
  422. padding: 15px 15px 0 15px;
  423. }
  424. </style>