index.vue 13 KB

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