salesBudget.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. <style lang="scss" scoped xmlns="http://www.w3.org/1999/html">
  2. .search-bar {
  3. display: flex;
  4. align-items: center;
  5. }
  6. .search-box p {
  7. display: inline-block;
  8. border: 1px solid #f2f2f2;
  9. border-radius: 5px;
  10. margin-right: 10px;
  11. padding: 5px 10px;
  12. cursor: pointer;
  13. }
  14. </style>
  15. <style>
  16. /* .data-display-statistics .ant-card-body {
  17. padding: 0 15px;
  18. } */
  19. .data-display-statistics .ant-col-6 {
  20. margin: 10px 0;
  21. }
  22. .data-display-statistics .ant-col-6 .ant-card-body {
  23. display: flex;
  24. justify-content: center;
  25. }
  26. .data-display-statistics .ant-col-6 p,
  27. .data-display-statistics .ant-col-6 span {
  28. text-align: center;
  29. line-height: 40px;
  30. font-size: 30px;
  31. font-weight: 600;
  32. color: red;
  33. margin: 0;
  34. }
  35. .search-box .ant-card-body {
  36. padding: 5px 15px;
  37. }
  38. .data-display-statistics .ant-col-6 .ant-card-body .styleElse {
  39. line-height: 60px;
  40. height: 40px;
  41. font-size: 16px;
  42. font-weight: 400;
  43. margin-left: 10px;
  44. }
  45. .ant-modal-wrap .yincang .ant-modal-content .ant-modal-footer {
  46. display: none !important;
  47. }
  48. .yincang .ant-col-6 p {
  49. text-align: left;
  50. color: red;
  51. font-size: 16px;
  52. font-weight: 500;
  53. }
  54. .ant-table-thead div {
  55. font-weight: 700;
  56. }
  57. .tool-tip {
  58. position: absolute;
  59. top: 65px;
  60. right: 10px;
  61. }
  62. th div {
  63. white-space: nowrap;
  64. }
  65. </style>
  66. <template>
  67. <div class="data-statistics">
  68. <a-row class="image-list-heading vm-panel">
  69. <a-row type="flex" align="middle" justify="space-between" class="panel-body">
  70. <div class="search-bar" style="width: 100%">
  71. <div class="item">
  72. <span>媒体维度:</span>
  73. <a-radio-group v-model="mediaId" @change="typeChange()">
  74. <a-radio-button value="2">快手</a-radio-button>
  75. <a-radio-button value="1">头条</a-radio-button>
  76. </a-radio-group>
  77. </div>
  78. <span style="margin-left: 10px">日期选择:</span>
  79. <a-date-picker v-model="statDate" format="YYYY-MM-DD" @change="typeChange()"/>
  80. <a-button type="primary" style="margin: 10px" @click="searchData"
  81. >搜索
  82. </a-button
  83. >
  84. <a-button
  85. @click="exportExcel"
  86. :loading="visibleLoading"
  87. style="margin-right: 15px"
  88. >
  89. 导 出
  90. </a-button>
  91. <a-button
  92. type="primary"
  93. icon="reload"
  94. @click="getDataReset"
  95. style="background-color: #67c23a; border-color: #67c23a"
  96. >重置
  97. </a-button>
  98. </div>
  99. </a-row>
  100. </a-row>
  101. <a-row :gutter="10" style="margin-top: 10px">
  102. <a-col :span="24">
  103. <a-table
  104. v-if="this.mediaId == '2'"
  105. size="middle"
  106. :columns="ksColumns"
  107. :dataSource="data"
  108. :pagination="ipagination"
  109. bordered
  110. id="outTable"
  111. :scroll="{ x: true }"
  112. :loading="loading"
  113. >
  114. <span slot="relativePeople" slot-scope="text, record">
  115. <p>销售:{{ record.saleName || "无" }}</p>
  116. <p>运营:{{ record.responsibleName || "无" }}</p>
  117. </span>
  118. <span slot="updateData" slot-scope="text, record">
  119. <a @click="handleEdit(record)">设置</a>
  120. </span>
  121. <span slot="budgetInfo" slot-scope="text, record">
  122. <p v-if="!!record.budgetJson.setBudget">
  123. 预算:{{ record.budgetJson.setBudget }}
  124. </p>
  125. <p>消耗:{{ record.budgetJson.actualBudget }}</p>
  126. <p v-if="record.budgetJson.compare && record.budgetJson.compare == 0">
  127. 差值:
  128. </p>
  129. <p v-if="record.budgetJson.compare && record.budgetJson.compare > 0">
  130. 差值:<font color="red"> ↑{{ record.budgetJson.subtract }}</font>
  131. </p>
  132. <p v-if="record.budgetJson.compare && record.budgetJson.compare < 0">
  133. 差值:<font color="green"> ↓{{ record.budgetJson.subtract }}</font>
  134. </p>
  135. </span>
  136. <span slot="costInfo" slot-scope="text, record">
  137. <div v-for="(item, index) in record.costArray" :key="index">
  138. <p>
  139. {{ item.name }}&nbsp;&nbsp;考核:{{ item.setCost }}&nbsp;&nbsp;实际:
  140. <font v-if="!item.compare && item.compare == 0"> {{ item.cost }}</font>
  141. <font v-if="item.compare && item.compare < 0" color="green">
  142. ↓{{ item.cost }}</font
  143. >
  144. <font v-if="item.compare && item.compare > 0" color="red">
  145. ↑{{ item.cost }}</font
  146. >
  147. </p>
  148. </div>
  149. </span>
  150. </a-table>
  151. <a-table
  152. v-if="this.mediaId == '1'"
  153. size="middle"
  154. :columns="bytedanceColumns"
  155. :dataSource="data"
  156. :pagination="ipagination"
  157. bordered
  158. id="outTable"
  159. :scroll="{ x: true }"
  160. :loading="loading"
  161. >
  162. <span slot="relativePeople" slot-scope="text, record">
  163. <p>销售:{{ record.saleName || "无" }}</p>
  164. <p>运营:{{ record.responsibleName || "无" }}</p>
  165. </span>
  166. <span slot="budgetInfo" slot-scope="text, record">
  167. <p v-if="!!record.budgetJson.setBudget">
  168. 预算:{{ record.budgetJson.setBudget }}
  169. </p>
  170. <p>消耗:{{ record.budgetJson.actualBudget }}</p>
  171. <p v-if="record.budgetJson.compare && record.budgetJson.compare == 0">
  172. 差值:-
  173. </p>
  174. <p v-if="record.budgetJson.compare && record.budgetJson.compare > 0">
  175. 差值:<font color="red"> ↑{{ record.budgetJson.subtract }}</font>
  176. </p>
  177. <p v-if="record.budgetJson.compare && record.budgetJson.compare < 0">
  178. 差值:<font color="green"> ↓{{ record.budgetJson.subtract }}</font>
  179. </p>
  180. </span>
  181. <span slot="costInfo" slot-scope="text, record">
  182. <div v-for="(item, index) in record.costArray" :key="index">
  183. <p>
  184. {{ item.name }}&nbsp;&nbsp;考核:{{ item.setCost }}&nbsp;&nbsp;实际:<font
  185. v-if="!item.compare && item.compare == 0"
  186. >{{ item.cost }}</font
  187. >
  188. <font v-if="item.compare && item.compare < 0" color="green">
  189. ↓{{ item.cost }}</font
  190. >
  191. <font v-if="item.compare && item.compare > 0" color="red">
  192. ↑{{ item.cost }}</font
  193. >
  194. </p>
  195. </div>
  196. </span>
  197. <span slot="updateData" slot-scope="text, record">
  198. <a @click="handleEdit(record)">设置</a>
  199. </span>
  200. </a-table>
  201. </a-col>
  202. </a-row>
  203. <a-modal
  204. title="设置预算及成本"
  205. v-model="visible"
  206. @ok="handleOkAdd"
  207. @cancel="handleCancel"
  208. :confirmLoading="confirmLoading"
  209. :width="800"
  210. >
  211. <a-form :form="form">
  212. <a-form-item label="设置预算" :labelCol="labelCol" :wrapperCol="wrapperCol">
  213. <a-input
  214. @input="maxValueInput"
  215. placeholder="请输入预算"
  216. v-model="submitForm.budget"
  217. />
  218. </a-form-item>
  219. <div>
  220. <div>
  221. <a-form-item
  222. label="转化目标"
  223. :labelCol="labelCol"
  224. :wrapperCol="wrapperCol"
  225. showSearch
  226. >
  227. <a-select
  228. showSearch
  229. :filterOption="filterOption"
  230. @change="ocpxActionToutiaoChange($event)"
  231. @deselect="ocpextiondeselect"
  232. v-decorator="[
  233. 'ocpxActionType',
  234. { rules: [{ required: true, message: '请选择转化目标' }] },
  235. ]"
  236. mode="multiple"
  237. >
  238. <a-select-option
  239. :value="item.ocpxActionType"
  240. v-for="(item, index) in ocpxList"
  241. :key="index"
  242. >{{ item.ocpxActionName }}
  243. </a-select-option>
  244. </a-select>
  245. </a-form-item>
  246. <div v-if="Array.isArray(getFormFieldValue('ocpxActionType'))">
  247. <a-form-item
  248. v-if="getFormFieldValue('ocpxActionType').length > 0"
  249. :labelCol="labelCol"
  250. :wrapperCol="wrapperCol"
  251. v-for="(item, index) in submitForm.ruleDetails"
  252. :key="index"
  253. :label="item.ocpxName"
  254. >
  255. <a-input
  256. @input="maxValueInput"
  257. @keyup.native="
  258. item.maxValue = item.maxValue.replace(
  259. /^(\-)*(\d+)\.(\d\d).*$/,
  260. '$1$2.$3'
  261. )
  262. "
  263. placeholder="请输入最高成本"
  264. v-model="item.maxValue"
  265. />
  266. </a-form-item>
  267. </div>
  268. </div>
  269. </div>
  270. </a-form>
  271. </a-modal>
  272. </div>
  273. </template>
  274. <script>
  275. import ARow from "ant-design-vue/es/grid/Row";
  276. import ACol from "ant-design-vue/es/grid/Col";
  277. import countTo from "vue-count-to";
  278. import moment from "moment";
  279. import DatePicker from "@/components/DatePicker";
  280. import {JeecgListMixin} from "@/mixins/ipagination";
  281. import lifting from "./components/lifting";
  282. import timeCheck from "./components/timeCheck";
  283. import {mapGetters} from "vuex";
  284. import pick from "lodash.pick";
  285. import {downFile} from "@api/manage";
  286. var length = 0;
  287. var active = 1;
  288. const ksColumns = [
  289. {
  290. title: "项目",
  291. dataIndex: "projectName",
  292. align: "left",
  293. width: 150,
  294. },
  295. {
  296. title: "相关人",
  297. dataIndex: "relativePeople",
  298. key: "relativePeople",
  299. scopedSlots: {customRender: "relativePeople"},
  300. align: "left",
  301. width: 130,
  302. },
  303. {
  304. title: "操作",
  305. dataIndex: "updateData",
  306. key: "updateData",
  307. scopedSlots: {customRender: "updateData"},
  308. align: "left",
  309. width: 80,
  310. },
  311. {
  312. title: "预算情况",
  313. dataIndex: "budgetInfo",
  314. key: "budgetInfo",
  315. scopedSlots: {customRender: "budgetInfo"},
  316. align: "left",
  317. width: 180,
  318. },
  319. {
  320. title: "成本情况",
  321. dataIndex: "costInfo",
  322. key: "costInfo",
  323. scopedSlots: {customRender: "costInfo"},
  324. align: "left",
  325. width: 300,
  326. },
  327. {
  328. title: "激活数",
  329. dataIndex: "activation",
  330. align: "left",
  331. width: 80,
  332. customRender: function (t) {
  333. if (t && t != 0) {
  334. return t;
  335. } else {
  336. return "-";
  337. }
  338. },
  339. },
  340. {
  341. title: "激活成本",
  342. dataIndex: "activationCost",
  343. align: "left",
  344. width: 80,
  345. customRender: function (t) {
  346. if (t && t != 0) {
  347. return t;
  348. } else {
  349. return "-";
  350. }
  351. },
  352. },
  353. {
  354. title: "次留",
  355. dataIndex: "eventNextDayStay",
  356. align: "left",
  357. width: 80,
  358. customRender: function (t) {
  359. if (t && t != 0) {
  360. return t;
  361. } else {
  362. return "-";
  363. }
  364. },
  365. },
  366. {
  367. title: "次留率",
  368. dataIndex: "eventNextDayStayRate",
  369. align: "left",
  370. width: 80,
  371. customRender: function (t) {
  372. if (t && t != 0) {
  373. return t;
  374. } else {
  375. return "-";
  376. }
  377. },
  378. },
  379. {
  380. title: "次留成本",
  381. dataIndex: "eventNextDayStayCost",
  382. align: "left",
  383. width: 100,
  384. customRender: function (t) {
  385. if (t && t != 0) {
  386. return t;
  387. } else {
  388. return "-";
  389. }
  390. },
  391. },
  392. {
  393. title: "表单数",
  394. dataIndex: "formCount",
  395. align: "left",
  396. width: 80,
  397. customRender: function (t) {
  398. if (t && t != 0) {
  399. return t;
  400. } else {
  401. return "-";
  402. }
  403. },
  404. },
  405. {
  406. title: "表单成本",
  407. dataIndex: "formCountCost",
  408. align: "left",
  409. width: 80,
  410. customRender: function (t) {
  411. if (t && t != 0) {
  412. return t;
  413. } else {
  414. return "-";
  415. }
  416. },
  417. },
  418. {
  419. title: "付费数",
  420. dataIndex: "eventPay",
  421. align: "left",
  422. width: 80,
  423. customRender: function (t) {
  424. if (t && t != 0) {
  425. return t;
  426. } else {
  427. return "-";
  428. }
  429. },
  430. },
  431. {
  432. title: "付费成本",
  433. dataIndex: "eventCost",
  434. align: "left",
  435. width: 80,
  436. customRender: function (t) {
  437. if (t && t != 0) {
  438. return t;
  439. } else {
  440. return "-";
  441. }
  442. },
  443. },
  444. {
  445. title: "关键行为数",
  446. dataIndex: "keyAction",
  447. align: "left",
  448. width: 80,
  449. customRender: function (t) {
  450. if (t && t != 0) {
  451. return t;
  452. } else {
  453. return "-";
  454. }
  455. },
  456. },
  457. {
  458. title: "关键行为成本",
  459. dataIndex: "keyActionCost",
  460. align: "left",
  461. width: 80,
  462. customRender: function (t) {
  463. if (t && t != 0) {
  464. return t;
  465. } else {
  466. return "-";
  467. }
  468. },
  469. },
  470. {
  471. title: "唤起数",
  472. dataIndex: "eventAppInvoked",
  473. align: "left",
  474. width: 80,
  475. customRender: function (t) {
  476. if (t && t != 0) {
  477. return t;
  478. } else {
  479. return "-";
  480. }
  481. },
  482. },
  483. {
  484. title: "唤起成本",
  485. dataIndex: "eventAppInvokedCost",
  486. align: "left",
  487. width: 80,
  488. customRender: function (t) {
  489. if (t && t != 0) {
  490. return t;
  491. } else {
  492. return "-";
  493. }
  494. },
  495. },
  496. {
  497. title: "roi",
  498. dataIndex: "eventPayPurchaseAmountFirstDayCost",
  499. align: "left",
  500. width: 80,
  501. customRender: function (t) {
  502. if (t && t != 0) {
  503. return t;
  504. } else {
  505. return "-";
  506. }
  507. },
  508. },
  509. {
  510. title: "3留",
  511. dataIndex: "eventThreeDayStayByConversionCost",
  512. align: "left",
  513. width: 80,
  514. customRender: function (t) {
  515. if (t && t != 0) {
  516. return t;
  517. } else {
  518. return "-";
  519. }
  520. },
  521. },
  522. {
  523. title: "7留",
  524. dataIndex: "eventWeekStayByConversionCost",
  525. align: "left",
  526. width: 80,
  527. customRender: function (t) {
  528. if (t && t != 0) {
  529. return t;
  530. } else {
  531. return "-";
  532. }
  533. },
  534. },
  535. ];
  536. const bytedanceColumns = [
  537. {
  538. title: "项目",
  539. dataIndex: "projectName",
  540. align: "left",
  541. width: 150,
  542. },
  543. {
  544. title: "相关人",
  545. dataIndex: "relativePeople",
  546. key: "relativePeople",
  547. scopedSlots: {customRender: "relativePeople"},
  548. align: "left",
  549. width: 130,
  550. },
  551. {
  552. title: "操作",
  553. dataIndex: "updateData",
  554. key: "updateData",
  555. scopedSlots: {customRender: "updateData"},
  556. align: "left",
  557. width: 80,
  558. },
  559. {
  560. title: "预算情况",
  561. dataIndex: "budgetInfo",
  562. key: "budgetInfo",
  563. scopedSlots: {customRender: "budgetInfo"},
  564. align: "left",
  565. width: 180,
  566. },
  567. {
  568. title: "成本情况",
  569. dataIndex: "costInfo",
  570. key: "costInfo",
  571. scopedSlots: {customRender: "costInfo"},
  572. align: "left",
  573. width: 300,
  574. },
  575. {
  576. title: "激活数",
  577. dataIndex: "active",
  578. align: "left",
  579. width: 80,
  580. customRender: function (t) {
  581. if (t && t != 0) {
  582. return t;
  583. } else {
  584. return "-";
  585. }
  586. },
  587. },
  588. {
  589. title: "激活成本",
  590. dataIndex: "activeCost",
  591. align: "left",
  592. width: 80,
  593. customRender: function (t) {
  594. if (t && t != 0) {
  595. return t;
  596. } else {
  597. return "-";
  598. }
  599. },
  600. },
  601. {
  602. title: "次留",
  603. dataIndex: "attributionNextDayOpenCnt",
  604. align: "left",
  605. width: 80,
  606. customRender: function (t) {
  607. if (t && t != 0) {
  608. return t;
  609. } else {
  610. return "-";
  611. }
  612. },
  613. },
  614. {
  615. title: "次留率",
  616. dataIndex: "attributionNextDayOpenRate",
  617. align: "left",
  618. width: 80,
  619. customRender: function (t) {
  620. if (t && t != 0) {
  621. return t;
  622. } else {
  623. return "-";
  624. }
  625. },
  626. },
  627. {
  628. title: "次留成本",
  629. dataIndex: "attributionNextDayOpenCost",
  630. align: "left",
  631. width: 100,
  632. customRender: function (t) {
  633. if (t && t != 0) {
  634. return t;
  635. } else {
  636. return "-";
  637. }
  638. },
  639. },
  640. {
  641. title: "表单数",
  642. dataIndex: "form",
  643. align: "left",
  644. width: 80,
  645. customRender: function (t) {
  646. if (t && t != 0) {
  647. return t;
  648. } else {
  649. return "-";
  650. }
  651. },
  652. },
  653. {
  654. title: "表单成本",
  655. dataIndex: "formCost",
  656. align: "left",
  657. width: 80,
  658. customRender: function (t) {
  659. if (t && t != 0) {
  660. return t;
  661. } else {
  662. return "-";
  663. }
  664. },
  665. },
  666. {
  667. title: "付费数",
  668. dataIndex: "payCount",
  669. align: "left",
  670. width: 80,
  671. customRender: function (t) {
  672. if (t && t != 0) {
  673. return t;
  674. } else {
  675. return "-";
  676. }
  677. },
  678. },
  679. {
  680. title: "付费成本",
  681. dataIndex: "payCost",
  682. align: "left",
  683. width: 80,
  684. customRender: function (t) {
  685. if (t && t != 0) {
  686. return t;
  687. } else {
  688. return "-";
  689. }
  690. },
  691. },
  692. {
  693. title: "关键行为数",
  694. dataIndex: "gameAddiction",
  695. align: "left",
  696. width: 80,
  697. customRender: function (t) {
  698. if (t && t != 0) {
  699. return t;
  700. } else {
  701. return "-";
  702. }
  703. },
  704. },
  705. {
  706. title: "关键行为成本",
  707. dataIndex: "gameAddictionCost",
  708. align: "left",
  709. width: 80,
  710. customRender: function (t) {
  711. if (t && t != 0) {
  712. return t;
  713. } else {
  714. return "-";
  715. }
  716. },
  717. },
  718. {
  719. title: "注册数",
  720. dataIndex: "register",
  721. align: "left",
  722. width: 80,
  723. customRender: function (t) {
  724. if (t && t != 0) {
  725. return t;
  726. } else {
  727. return "-";
  728. }
  729. },
  730. },
  731. {
  732. title: "注册成本",
  733. dataIndex: "registerCost",
  734. align: "left",
  735. width: 80,
  736. customRender: function (t) {
  737. if (t && t != 0) {
  738. return t;
  739. } else {
  740. return "-";
  741. }
  742. },
  743. },
  744. {
  745. title: "完件数",
  746. dataIndex: "loanCompletion",
  747. align: "left",
  748. width: 80,
  749. customRender: function (t) {
  750. if (t && t != 0) {
  751. return t;
  752. } else {
  753. return "-";
  754. }
  755. },
  756. },
  757. {
  758. title: "完件成本",
  759. dataIndex: "loanCompletionCost",
  760. align: "left",
  761. width: 80,
  762. customRender: function (t) {
  763. if (t && t != 0) {
  764. return t;
  765. } else {
  766. return "-";
  767. }
  768. },
  769. },
  770. {
  771. title: "授信数",
  772. dataIndex: "preLoanCredit",
  773. align: "left",
  774. width: 80,
  775. customRender: function (t) {
  776. if (t && t != 0) {
  777. return t;
  778. } else {
  779. return "-";
  780. }
  781. },
  782. },
  783. {
  784. title: "授信成本",
  785. dataIndex: "preLoanCreditCost",
  786. align: "left",
  787. width: 80,
  788. customRender: function (t) {
  789. if (t && t != 0) {
  790. return t;
  791. } else {
  792. return "-";
  793. }
  794. },
  795. },
  796. {
  797. title: "app内访问数",
  798. dataIndex: "inAppUv",
  799. align: "left",
  800. width: 80,
  801. customRender: function (t) {
  802. if (t && t != 0) {
  803. return t;
  804. } else {
  805. return "-";
  806. }
  807. },
  808. },
  809. {
  810. title: "app内访问成本",
  811. dataIndex: "inAppUvCost",
  812. align: "left",
  813. width: 80,
  814. customRender: function (t) {
  815. if (t && t != 0) {
  816. return t;
  817. } else {
  818. return "-";
  819. }
  820. },
  821. },
  822. {
  823. title: "app内付费数",
  824. dataIndex: "inAppPay",
  825. align: "left",
  826. width: 80,
  827. customRender: function (t) {
  828. if (t && t != 0) {
  829. return t;
  830. } else {
  831. return "-";
  832. }
  833. },
  834. },
  835. {
  836. title: "app内付费成本",
  837. dataIndex: "inAppPayCost",
  838. align: "left",
  839. width: 80,
  840. customRender: function (t) {
  841. if (t && t != 0) {
  842. return t;
  843. } else {
  844. return "-";
  845. }
  846. },
  847. },
  848. {
  849. title: "首日roi",
  850. dataIndex: "statPayAmount",
  851. align: "left",
  852. width: 80,
  853. customRender: function (t) {
  854. if (t && t != 0) {
  855. return t;
  856. } else {
  857. return "-";
  858. }
  859. },
  860. },
  861. ];
  862. export default {
  863. name: "data-display-statistics",
  864. components: {
  865. ACol,
  866. ARow,
  867. countTo,
  868. lifting,
  869. timeCheck,
  870. DatePicker,
  871. },
  872. mixins: [JeecgListMixin],
  873. data: function () {
  874. return {
  875. visibleLoading: false,
  876. submitForm: {
  877. projectId: undefined,
  878. budget: undefined,
  879. ruleDetails: [],
  880. },
  881. ocpxActionTypeArray: [],
  882. confirmLoading: false,
  883. form: this.$form.createForm(this),
  884. visible: false,
  885. data: [],
  886. mediaId: "2",
  887. statDate: moment(new Date()),
  888. ksColumns: ksColumns,
  889. bytedanceColumns: bytedanceColumns,
  890. loading: false,
  891. dataElse: [],
  892. ocpxList: [],
  893. labelCol: {
  894. xs: {span: 24},
  895. sm: {span: 5},
  896. },
  897. wrapperCol: {
  898. xs: {span: 24},
  899. sm: {span: 16},
  900. },
  901. ipagination: {
  902. current: 1,
  903. pageSize: 10,
  904. showTotal: (total, range) => {
  905. return range[0] + "-" + range[1] + " 共" + total + "条";
  906. },
  907. showQuickJumper: true,
  908. showSizeChanger: false,
  909. pageSizeOptions: ["10", "30", "50"],
  910. total: 0,
  911. onChange: (current, pageSize) => {
  912. // 切换分页时的回调,
  913. // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
  914. this.ipagination.current = current;
  915. this.ipagination.pageSize = pageSize;
  916. this.getSaleData();
  917. },
  918. },
  919. };
  920. },
  921. filters: {
  922. formatDate: function (value) {
  923. let date = new Date(value);
  924. let y = date.getFullYear();
  925. let MM = date.getMonth() + 1;
  926. MM = MM < 10 ? "0" + MM : MM;
  927. let d = date.getDate();
  928. d = d < 10 ? "0" + d : d;
  929. let h = date.getHours();
  930. h = h < 10 ? "0" + h : h;
  931. let m = date.getMinutes();
  932. m = m < 10 ? "0" + m : m;
  933. let s = date.getSeconds();
  934. s = s < 10 ? "0" + s : s;
  935. return y + "-" + MM + "-" + d;
  936. },
  937. toFixtwo: function (value) {
  938. if (value) {
  939. return value.toFixed(2);
  940. } else {
  941. return 0.0;
  942. }
  943. },
  944. getBo: function (value) {
  945. if (value) {
  946. return (value * 100).toFixed(2) + "%";
  947. } else {
  948. return "0.00%";
  949. }
  950. },
  951. },
  952. methods: {
  953. moment,
  954. ...mapGetters(["nickname", "avatar", "userInfo"]),
  955. exportExcel() {
  956. this.visibleLoading = true;
  957. var params = {};
  958. params.date = this.statDate.format("YYYY-MM-DD");
  959. params.userId = this.userInfo().id;
  960. params.mediaId = this.mediaId;
  961. downFile("http://api.tjyourong.com.cn/jeecg-boot" + "/budget/exportReport", params).then(
  962. (res) => {
  963. this.visibleLoading = false;
  964. let blob = new Blob([res], {
  965. type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  966. });
  967. let downloadElement = document.createElement("a");
  968. let href = window.URL.createObjectURL(blob); //创建下载的链接
  969. downloadElement.href = href;
  970. downloadElement.download = '销售成本报表.xlsx'; //下载后文件名
  971. document.body.appendChild(downloadElement);
  972. downloadElement.click(); //点击下载
  973. document.body.removeChild(downloadElement); //下载完成移除元素
  974. window.URL.revokeObjectURL(href); //释放掉blob对象
  975. }
  976. );
  977. },
  978. getDataReset() {
  979. this.ipagination.current = 1;
  980. this.ipagination.pageSize = 10;
  981. this.statDate = moment(new Date());
  982. this.getSaleData();
  983. this.getOcpxList();
  984. },
  985. ocpextiondeselect(item) {
  986. this.submitForm.ruleDetails.forEach((element, index) => {
  987. if (element.ocpxCode == item) {
  988. this.submitForm.ruleDetails.splice(index, 1);
  989. }
  990. });
  991. },
  992. ocpxActionToutiaoChange(item) {
  993. item.forEach((element) => {
  994. this.ocpxList.find((par) => {
  995. if (par.ocpxActionType == element) {
  996. this.submitForm.ruleDetails.push({
  997. ocpxCode: par.ocpxActionType,
  998. ocpxName: par.ocpxActionName,
  999. maxValue: undefined,
  1000. });
  1001. }
  1002. });
  1003. });
  1004. this.deWeight();
  1005. },
  1006. deWeight() {
  1007. for (var i = 0; i < this.submitForm.ruleDetails.length - 1; i++) {
  1008. for (var j = i + 1; j < this.submitForm.ruleDetails.length; j++) {
  1009. if (
  1010. this.submitForm.ruleDetails[i].ocpxName ==
  1011. this.submitForm.ruleDetails[j].ocpxName
  1012. ) {
  1013. this.submitForm.ruleDetails.splice(j, 1);
  1014. j--;
  1015. }
  1016. }
  1017. }
  1018. },
  1019. maxValueInput() {
  1020. this.$forceUpdate();
  1021. },
  1022. getOcpxList() {
  1023. this.getAction("/budget/ocpxList", {
  1024. mediaId: this.mediaId,
  1025. }).then((res) => {
  1026. if (res.success) {
  1027. this.ocpxList = res.result;
  1028. }
  1029. });
  1030. },
  1031. handleOkAdd() {
  1032. console.log(this.submitForm);
  1033. this.confirmLoading = true;
  1034. this.getAction("/budget/add", {
  1035. userId: this.userInfo().id,
  1036. mediaId: this.mediaId,
  1037. addInfo: this.submitForm,
  1038. }).then((res) => {
  1039. if (res.success) {
  1040. this.confirmLoading = false;
  1041. this.visible = false;
  1042. this.submitForm.ruleDetails = [];
  1043. this.submitForm.budget = undefined;
  1044. this.submitForm.projectId = undefined;
  1045. this.form.resetFields();
  1046. this.getSaleData();
  1047. } else {
  1048. this.confirmLoading = false;
  1049. this.$message.error(res.message);
  1050. }
  1051. });
  1052. },
  1053. handleCancel() {
  1054. this.submitForm.ruleDetails = [];
  1055. this.submitForm.budget = undefined;
  1056. this.submitForm.projectId = undefined;
  1057. this.form.resetFields();
  1058. },
  1059. handleEdit: function (record, sign) {
  1060. this.submitForm.projectId = record.projectId;
  1061. this.visible = true;
  1062. this.getAction("/budget/getById", {
  1063. projectId: record.projectId,
  1064. }).then((res) => {
  1065. if (res.success) {
  1066. this.visible = true;
  1067. this.submitForm.budget = res.data.budget;
  1068. this.submitForm.ruleDetails = res.data.ruleDetails;
  1069. var model = {};
  1070. model.ocpxActionType = res.data.ruleDetails.map((item) => {
  1071. return item.ocpxCode;
  1072. });
  1073. this.$nextTick(() => {
  1074. setTimeout(() => {
  1075. this.form.setFieldsValue(pick(model, "ocpxActionType"));
  1076. });
  1077. });
  1078. } else {
  1079. this.$message.error(res.message);
  1080. }
  1081. });
  1082. },
  1083. searchData() {
  1084. this.ipagination.current = 1;
  1085. this.ipagination.pageSize = 10;
  1086. var that = this;
  1087. that.getSaleData();
  1088. },
  1089. typeChange() {
  1090. this.ipagination.current = 1;
  1091. this.ipagination.pageSize = 10;
  1092. this.getSaleData();
  1093. this.getOcpxList();
  1094. },
  1095. getSaleData() {
  1096. this.loading = true;
  1097. let date = this.statDate.format("YYYY-MM-DD");
  1098. this.getAction("/budget/report", {
  1099. userId: this.userInfo().id,
  1100. mediaId: this.mediaId,
  1101. date: date,
  1102. pageNo: this.ipagination.current,
  1103. pageSize: this.ipagination.pageSize,
  1104. }).then((res) => {
  1105. if (res.success) {
  1106. this.data = res.result.list;
  1107. this.ipagination.total = res.result.total;
  1108. this.loading = false;
  1109. }
  1110. });
  1111. },
  1112. getFormFieldValue(field) {
  1113. return this.form.getFieldValue(field);
  1114. },
  1115. filterOption(input, option) {
  1116. return (
  1117. option.componentOptions.children[0].text
  1118. .toLowerCase()
  1119. .indexOf(input.toLowerCase()) >= 0
  1120. );
  1121. },
  1122. getDate(value) {
  1123. if (value) {
  1124. let date = new Date(value);
  1125. let y = date.getFullYear();
  1126. let MM = date.getMonth() + 1;
  1127. MM = MM < 10 ? "0" + MM : MM;
  1128. let d = date.getDate();
  1129. d = d < 10 ? "0" + d : d;
  1130. this.date = y + "-" + MM + "-" + d;
  1131. } else {
  1132. let date = new Date();
  1133. let y = date.getFullYear();
  1134. let MM = date.getMonth() + 1;
  1135. MM = MM < 10 ? "0" + MM : MM;
  1136. let d = date.getDate();
  1137. d = d < 10 ? "0" + d : d;
  1138. this.date = y + "-" + MM + "-" + d;
  1139. }
  1140. },
  1141. },
  1142. ipaginationChange(pagination) {
  1143. this.ipagination.current = pagination.current;
  1144. this.ipagination.pageSize = pagination.pageSize;
  1145. this.getSaleData();
  1146. },
  1147. watch: {},
  1148. mounted: function () {
  1149. this.getSaleData();
  1150. this.getOcpxList();
  1151. },
  1152. };
  1153. </script>