2021double11List.vue 12 KB

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